Re: Bad Precision output for SphericaBesselY and

*To*: mathgroup at smc.vnet.net*Subject*: [mg123084] Re: Bad Precision output for SphericaBesselY and*From*: Richard Fateman <fateman at cs.berkeley.edu>*Date*: Wed, 23 Nov 2011 07:04:14 -0500 (EST)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*References*: <201111221036.FAA28073@smc.vnet.net> <jag4aa$6n$1@smc.vnet.net>

On 11/22/2011 4:24 AM, Oliver Ruebenkoenig wrote: > On Tue, 22 Nov 2011, Antonio Alvaro Ranha Neves wrote: > >> Dear users, >> >> Recently I'm working with precision calculations of spherical functions. Example, let, >> >> n = 150 >> x = SetPrecision[120.3, 100] >> BesselY[n + 1/2, x] // Precision >> BesselJ[n+ 1/2, x] // Precision >> >> >> Yields 67.2708 and 96.9297 respectively. The two questions are: >> 1) Why does BesselY results in a worse than BesselJ? >> 2) How to redefine, BesselY to automatically output a result with a desired pecision? >> >> Note: Simply using N[expr,90], does not yield a result of expr with 90 precision but maintains the same 67.2708. >> >> Thanks, >> Antonio >> >> >> > > Antonio, > > you could use exact arithmetic and only later derive the numeric > quantities. > > n = 150 > x = 1203/10 > BesselY[n + 1/2, x] // Precision > BesselJ[n + 1/2, x] // Precision > > N[BesselY[n + 1/2, x], 100] // Precision > N[BesselJ[n + 1/2, x], 100] // Precision > > gives a precision of 100. for both. > > Oliver > First of all, you should realize that x is approximately 120.299999999999997157829056959599256515502929687500000000000000000000\ 0000000000000000000000000000000 and perhaps you mean z=SetPrecision[1203/10, 100] which is 120.300000000000000000000000000000000000000000000000000000000000000000\ 0000000000000000000000000000000 The way Mathematica works is that it assumes that all the digits beyond 100 are garbage, instead of (say) filling with zero. This means it sometimes operates as if it has insufficient information in the input to satisfy your demands for precision in the output. If you want to find 100 digits in the answer, you could try using exact numbers until the last N operation: N[BesselJ[150+1/2, 1203/10, 100] Which provides 100 digits of precision. RJF

**References**:**Bad Precision output for SphericaBesselY and BesselY***From:*Antonio Alvaro Ranha Neves <aneves@gmail.com>