# Finding Root of BesselJ [closed]

When I work on some physical problem I needed to know how to get all of first 100 roots of BesselJ[n,x] function -which is a quasi periodic function-, as a List. I tried this code:

FindRoot[BesselJ[0, x], {x, {2, 5, 8, 11, 14}}]

{x -> {2.40483, 5.52008, 8.65373, 11.7915, 14.9309}}


but it's so terrible because you need firstly to know the approximation root as argument, and it'll give you the exact root.

I ask if there any other direct methods.

Update from comment:

Yeah [there is BesselJZero[],] but I want to know what is the code inside this BesselJZero[]. I mean how I can construct it by myself?

[Edit notice: I (Michael E2) discovered the answer to this question, which now sits in a comment. I'd be happy to post the comment as an answer if the community thinks this question should be reopened.]

• Have you seen BesselJZero[]? There's a link to it near the bottom of the doc page for BesselJ under "See Also". – Michael E2 Jun 28 '18 at 22:00
• Yeah but i want to know what is the code inside this BesselJZero[] i mean how i can construct it by myself ? – El Mouden Jun 28 '18 at 22:11
• There are some unsatisfying hints in the "Related Links" of the doc page for BesselJZero, which suggest they might use "use series and asymptotic expansions." – Michael E2 Jun 28 '18 at 22:48
• For a more complicated example involving roots of combinations of Bessel functions, see e.g. Labeling solutions of an Eigenvalue equation involving Bessel functions. In my answer to that question, I use FindRoot with starting values determined by the (asymptotic) WKB approximation to find the roots - giving an improved version of BesselJYJYZeros. – Jens Jun 29 '18 at 2:50
• Before BesselJZero was introduced in V6, there was a package NumericalMathBesselZeros , available here, that contains code for BesselJZero. I don't know if it is the same as the current implementation. It cites Abramovitz & Stegun 9.5.12, which is the same as DLMF 10.21.19. You can inspect the code yourself. The main function is bz[], which handles the zeros of both the $J$ and the $Y$ functions. – Michael E2 Jun 29 '18 at 17:31

The asymptotic form for $x\rightarrow\infty$ of $J_0(x)$ is $\sqrt{2/(\pi *x)} {\rm Cos}[x-\pi/4]$, with zeros at $x=(k-1/4)\pi$, for $k=1,2,3,...$. These values of $x$ approximate the zeros quite well.

If you want to use FindRoot so you "can construct it by myself", try

Table[FindRoot[BesselJ[0, x], {x, (k - 1/4) Pi}], {k, 1, 100}]


where k is the index of the root. The result is the same as

BesselJZero[0, Range[1.,100.]]


The asymptotic form for $J_n(x)$ is $\sqrt{2/(\pi *x)} {\rm Cos}[x-\pi/4-n \pi/2]$.

• The asymptotic form starts to give poor starting points for the roots for small k when the order n is greater than or equal to 6. – Michael E2 Jun 30 '18 at 22:21

A more general result than that provided by KennyColnago

The built-in BesselJZero[n, k]

Grid[tab = Table[{n, k, BesselJZero[n, k] // N}, {n, 0, 3}, {k, 3}]]


While this is not the code that Mathematica uses, you can generate your own BesselJZero[n, k] values using FindRoot

Grid[tab2 = Table[
{n, k, x /. FindRoot[BesselJ[n, x] == 0, {x, (2 k + 1) (2 n + 9)/8}]},
{n, 0, 3}, {k, 3}]]


Verifying,

tab - tab2 // Chop

(* {{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0,
0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}} *)

• Sorry, @Bob Hanlon, but {x, (2 k + 1) (2 n + 9)/8}  are very bad starting values. Regard tab1 = Flatten[ Table[{n, k, BesselJZero[n, k] // N}, {n, 0, 20}, {k, 100}], 1];  and tab2 = Flatten[ Table[{0, 0, x /. First@ FindRoot[BesselJ[n, x] == 0, {x, (2 k + 1) (2 n + 9)/8}, WorkingPrecision -> 20]}, {n, 0, 20}, {k, 100}], 1];  to see, nearly all but the first 3 zeros are wrong. ListPointPlot3D[tab1 - tab2, PlotRange -> {-1000, 0}]  . – Akku14 Jun 29 '18 at 7:34

An easy straightforward approach

NSolve[{BesselJ[0, x], 0 <= x <= 50}, x]
(*{{x -> 2.40483}, {x -> 5.52008}, {x -> 8.65373}, {x -> 11.7915},
{x ->14.9309}, {x -> 18.0711}, {x -> 21.2116}, {x -> 24.3525},
{x ->27.4935},{x  -> 30.6346}, {x -> 33.7758}, {x -> 36.9171},
{x ->40.0584}, {x -> 43.1998}, {x -> 46.3412}, {x -> 49.4826}}*)


evaluates all roots in the given range.

Unfortunately the possible range seems to be restricted x<55.7655 perhaps for numerical reasons. Adapting WorkingPrecision might help...

• In MMA Version 8.0, x is not restricted at all. – Akku14 Jun 29 '18 at 8:01
• If you try NSolve[{BesselJ[0, x], 50 <= x <= 100}, x] MMA 11.0.1.0 gives only two solutions {{x -> 52.6241}, {x -> 55.7655}} which is obviously wrong. – Ulrich Neumann Jun 29 '18 at 8:09
• This is a real setback compared to Version 8, which gives all. – Akku14 Jun 29 '18 at 14:13
• NSolve[{BesselJ[0, x], 50 <= x <= 100}, x, WorkingPrecision -> 32] gives all roots. – Michael E2 Jun 30 '18 at 6:12