Re: numerical, bessel

*To*: mathgroup at smc.vnet.net*Subject*: [mg55258] Re: numerical, bessel*From*: Paul Abbott <paul at physics.uwa.edu.au>*Date*: Thu, 17 Mar 2005 03:30:59 -0500 (EST)*Organization*: The University of Western Australia*References*: <d193ob$nmg$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

In article <d193ob$nmg$1 at smc.vnet.net>, Richard Fateman <fateman at cs.berkeley.edu> wrote: > << NumericalMath`BesselZeros` > BesselJZeros[0, {17, 19}, WorkingPrecision -> 30] > > works, but > > BesselJZeros[0, {17, 19}, AccuracyGoal -> 30] > > just returns unevaluated. Not in 5.1. > The documentation for NumericalMath`BesselZeros` claims that > AccuracyGoal, as well as WorkingPrecision is an option. Apparently not. > version 5.0 In 5.1 one gets the following warning: AccuracyGoal -> 30 is not a valid value, or is larger than WorkingPrecision -> MachinePrecision, computation may not be able to achieve desired accuracy. One can argue the case whether setting AccuracyGoal -> 30 should cause the WorkingPrecision to be increased automatically. However, a combination of the two options together yields the desired result and is consistent with the documentation: BesselJZeros[0, {17, 19}, AccuracyGoal -> 30, WorkingPrecision -> 40] I wrote a naive RootsInRange function that works with arbitrary functions: Needs["Utilities`FilterOptions`"] RootsInRange[d_, {l_, lmin_, lmax_}, opts___] := Module[{s, p, x, f = Function[l, Evaluate[d]]}, s = Plot[f[l], {l, lmin, lmax}, Compiled -> False, Evaluate[FilterOptions[Plot, opts]]]; p = Cases[s, Line[{x__}] -> x, Infinity]; p = Map[First, Select[Split[p, Sign[Last[#2]] == -Sign[Last[#1]]&], Length[#1] == 2 & ], {2}]; Apply[FindRoot[f[l] == 0, {l, ##1}, Evaluate[FilterOptions[FindRoot, opts]]] &, p, {1}] ] Entering RootsInRange[BesselJ[0, x], {x, 50, 60}, AccuracyGoal -> 30, WorkingPrecision -> 40] gives the same answer as the invocation of BesselJZeros above. Alternatively, Ted Ersek's RootSearch package at http://library.wolfram.com/infocenter/MathSource/4482/ appears to be robust for such computations. Cheers, Paul -- Paul Abbott Phone: +61 8 6488 2734 School of Physics, M013 Fax: +61 8 6488 1014 The University of Western Australia (CRICOS Provider No 00126G) 35 Stirling Highway Crawley WA 6009 mailto:paul at physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul