I would like to plot the Nth partial sum of the Fourier series of $f(x) = 1$ with the 0th order Bessel function as the eigenfunctions. This sum corresponds to:

$$\sum_{n=1}^N \frac{2 J_0(x \lambda_{0n})}{\lambda_{0n} J_1(\lambda_{0n})}$$

Where $\lambda_{0n}$ is the nth zero of the 0th order Bessel function. I would like to plot this for $N = 5, 10$.

My attempt:

An[n_] := 2/(BesselJZero[0, n] BesselJ[1, BesselJZero[0, n]])

BesselFourier[x_, N_] := Sum[A_n[n] BesselJ[0, BesselJZero[0, n] x], {n, N}]

Plot[BesselFourier[x, 5], {x, 0, 1}]

However, when I execute this, I get a blank plot. I have also tried to surround the sum in Evaluate[], but got the same result. Any advice?

  • 1
    $\begingroup$ The blank comes from your use of A_n[n] there in the code. $\endgroup$ – Nasser Mar 16 '17 at 0:38
  • 1
    $\begingroup$ @Nasser Yupp, that fixed it. Can we bring 'facepalm' back now? $\endgroup$ – infinitylord Mar 16 '17 at 0:42

Few corrections. Do not use N as variable. Call was wrong for An

An[n_]:=2/(BesselJZero[0,n] BesselJ[1,BesselJZero[0,n]]);
BesselFourier[x_,max_]:=Sum[An[n] BesselJ[0,BesselJZero[0,n] x],{n,max}];

Mathematica graphics

It is little slow for more terms, but this could be optimized if needed. (I think the slowness comes from BesselJZero but not sure now)


Mathematica graphics

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.