[Date Index] [Thread Index] [Author Index]
Re: Bad Precision output for SphericaBesselY and BesselY
On Thu, 24 Nov 2011 12:12:15 -0000, Antonio Alvaro Ranha Neves <aneves at gmail.com> wrote: > @Oleksander > Why is Rationalize[120.3] better than SetPrecision[120.3, Infinity]? > Each command gives me a rational output, > 1203/10 > And > 8465359924572979/70368744177664 > Respectivaly. > I used 120.3 as an example, but my actual number is an irrational number > with a high precision (output of a findroot) > Simply because, when representing 120.3 as a rational number, in most cases one probably prefers a value that reproduces the number actually entered rather than one corresponding to the machine-precision real number closest to it. In this case the result of SetPrecision[120.3, Infinity] is equal to 1203/10 + 1/351843720888320, i.e. slightly more than 120.3. If the number is only known to finite precision to start with rather than being entered as something that could conceivably represent an exact rational value, it most likely makes little difference whether Rationalize or SetPrecision is used. Of course, in your example, it will probably be better to use the PrecisionGoal option to get a number having sufficient precision from FindRoot, rather than accepting the default precision and then using a rational representation of that output in further calculations.