# Backslide in NSolve in V11.1?

Bug introduced in 11.1.0 and persisting through 11.1.1

In V11.1,

NSolve[BesselJ[0, x] == 0 && 0 < x < 20, x]


returns no solutions:

But in V11.0 (and earlier), it returns all solutions:

Is there anyway to get NSolve to solve this equation in V11.1?

(Interestingly, Solve[BesselJ[0, x] == 0 && 0 < x < 20, x] works in both, but I was particularly interested NSolve, since I was wanting to compare it with other numerical methods.)

• It's weird that this only happens for special functions; with elementary functions like the trigonometric functions, NSolve[] works fine. – J. M.'s torpor Apr 18 '17 at 13:54
• There were also similar problems in NSolve dealing with elementary functions, see e.g. this post Issue with NSolve. – Artes Apr 19 '17 at 14:31
• NSolve[BesselJ[0, x] == 0 && 0 < x < 20, x, Abracadabra] // Quiet :) – Mariusz Iwaniuk Apr 24 '17 at 11:14

## 2 Answers

It is a bug in V11.1. As a workaround, you can put the following in your init.m file.

ReduceRealTNRoots;
nonElementaryQ[f_] := Module[{x}, !ListQ[SimplifyFunctionSingularities[f[x], x, "ELEM"]]]
SystemTRootsDumpNIntervalRoots[f_?nonElementaryQ, ii_, prec_] := \$Failed


This will disable the offending code for non-elementary functions.

In[4]:= NSolve[BesselJ[0, x] == 0 && 0 < x < 20, x]
Out[4]= {{x -> 2.40483}, {x -> 5.52008}, {x -> 8.65373}, {x -> 11.7915},
>    {x -> 14.9309}, {x -> 18.0711}}


Is there anyway to get NSolve to solve this equation in V11.1?

Adding Complexes makes it work

    NSolve[BesselJ[0, x] == 0 && 0 < x < 20, x, Complexes]


• it works in 11.1 – Rom38 Apr 18 '17 at 4:35
• Thanks! NSolve[BesselJ[0, x] == 0 && 0 < Re[x] < 20, x] and NSolve[BesselJ[0, x] == 0 && 0 < Re[x] < 20 && Im[x] == 0, x] also work (suggested by your answer). I don't understand the reason for the change, since it breaks previous code. – Michael E2 Apr 18 '17 at 11:58
• Works for other special functions, too. But NSolve[Zeta[x] - 2 == 0 && 0 < Re@x < 2 && Im[x] == 0, x] takes 4.5 sec and NSolve[Zeta[x] - 2 == 0 && 1 < x < 2, x, Complexes] takes 18.5 sec.; NSolve[-2 + Zeta[x] == 0 && 1 < Re[x] < 2, x] fails (but that's not surprising -- I was more surprised it worked on the Bessel funciton). – Michael E2 Apr 18 '17 at 13:28