> # BESSEL FUNCTIONS

>

> # What does Maple know about Bessel functions?

> ?Bessel

> ?BesselZeros

>

> # The exercises occupying pp. 379-386 of D. Betounes,

> # Partial Differential Equations for Computational Science

> # (Springer, 1998)

> # show lots of things that computer algebra systems can do with Bessel functions.

>

> # For example, Ex. 5 challenges your CAS to evaluate the integrals that arise

> # as normalization constants in Fourier-Bessel series:

>

> Int(BesselJ(0, w*r)^2 * r, r);

Int(BesselJ(0,w*r)^2*r,r)

> value(%);

>

1/2*r^2*(BesselJ(0,w*r)^2+BesselJ(1,w*r)^2)

> Int(BesselJ(3, w*r)^2 *r, r);

Int(BesselJ(3,w*r)^2*r,r)

> value(%);

1/2*r^2*(BesselJ(3,w*r)^2-BesselJ(2,w*r)*BesselJ(4,...

> Int(BesselJ(n, r)^2 *r, r);

Int(BesselJ(n,r)^2*r,r)

> value(%);

1/2*r^2*(BesselJ(n,r)^2-BesselJ(n-1,r)*BesselJ(n+1,...

> # Let's try to expand something in Bessel functions.

> h := x -> 1/(1 + x^2);

h := proc (x) options operator, arrow; 1/(1+x^2) en...

> # Use the notation for the 0th-order Fourier-Bessel series on p. 96 of notes.

> # Take r_0 = 1.

> c := k-> num(k)/den(k);

c := proc (k) options operator, arrow; num(k)/den(k...

> den := k -> int( BesselJ(0, BesselJZeros(0,k)*r)^2 * r, r=0..1);

den := proc (k) options operator, arrow; int(Bessel...

> den(1);

1/2*BesselJ(1,BesselJZeros(0,1))^2

> evalf(%);

.1347570619

> # (It works as expected.)

> num := k -> int( BesselJ(0, BesselJZeros(0,k)*r) * h(r) * r, r=0..1);

num := proc (k) options operator, arrow; int(Bessel...

> num(1);

int(BesselJ(0,BesselJZeros(0,1)*r)*r/(1+r^2),r = 0 ...

> evalf(%);

.1697309343

> c(2);

2*int(BesselJ(0,BesselJZeros(0,2)*r)*r/(1+r^2),r = ...

> evalf(%);

-.4925803224

> partialsum := (n,r) -> evalf(sum( c(k)*BesselJ(0,BesselJZeros(0,k)*r), k=1..n));

partialsum := proc (n, r) options operator, arrow; ...

> plot(h, 0..1);

[Maple Plot]

> plot(partialsum(1,r), r=0..1);

[Maple Plot]

> plot({partialsum(2,r), h(r)}, r=0..1);

[Maple Plot]

>

> plot({partialsum(6,r), h(r)}, r=0..1);

[Maple Plot]

> plot({partialsum(20,r), h(r)}, r=0..1);

[Maple Plot]

> # This looks much like a typical Fourier series, complete with Gibbs phenomenon

> # at the end where all the eigenfunctions vanish.

>

> # Let's try a different value of the Bessel index. This will cause trouble at

> # the origin, too.

>

> den := k -> int( BesselJ(3, BesselJZeros(3,k)*r)^2 * r, r=0..1);

den := proc (k) options operator, arrow; int(Bessel...

> num := k -> int( BesselJ(3, BesselJZeros(3,k)*r) * h(r) * r, r=0..1);

num := proc (k) options operator, arrow; int(Bessel...

> partialsum := (n,r) -> evalf(sum( c(k)*BesselJ(3,BesselJZeros(3,k)*r), k=1..n));

partialsum := proc (n, r) options operator, arrow; ...

> plot({partialsum(1,r), h(r)}, r=0..1);

[Maple Plot]

> plot({partialsum(10,r), h(r)}, r=0..1);

[Maple Plot]

> plot({partialsum(50,r), h(r)}, r=0..1);

[Maple Plot]

>