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?


closed as off-topic by J. M. will be back soon Sep 17 '17 at 6:59

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – J. M. will be back soon
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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


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