Re: Re: Re: Precision of AiryAi[0.0]
- To: mathgroup at smc.vnet.net
- Subject: [mg103591] Re: [mg103530] Re: [mg103519] Re: Precision of AiryAi[0.0]
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Tue, 29 Sep 2009 07:39:27 -0400 (EDT)
- References: <200909241149.HAA29080@smc.vnet.net> <h9i44n$98i$1@smc.vnet.net> <200909271130.HAA04934@smc.vnet.net>
To tell the truth, I don't see much point in any of this but why do you expect the precision of the derivative of AiryAi to behave in the same way as that of AiryAi, that is, to increase with each iteration? After all, this depends on the kind of function you iterate, e.g. a = N[1, 10]; Precision@Nest[Sqrt, a, 10^3] 311.03 Precision was increased Precision@Nest[#^2 &, a, 10^3] 0. Precision was decreased ?? Andrzej Kozlowski On 27 Sep 2009, at 20:30, DrMajorBob wrote: > Where's the bug? > > AiryAi1[x_?NumberQ] := SetPrecision[AiryAi[x], MachinePrecision] > > ClearSystemCache[] > Precision@Nest[AiryAi1, 0.0, 100] // Timing > > {0.000844, MachinePrecision} > > You asked for MachinePrecision, and that's what you got. No problem. > > Now for the other problem: > > ClearSystemCache[] > Precision@Nest[AiryAi, 0.0, 100] // Timing > > {0.130276, 225.079} > > You got more precision than you started with. Why? Because the > derivative > of AiryAi at 0 is less than 1 in absolute value: > > AiryAi'[0.] > > -0.2588194037928068 > > So... whenever you apply AiryAi, the result has approximately 74.2% > smaller error or doubt than the argument. > > Clear[f] > f[a_] := (Sow@Precision@a; AiryAi@a) > First@Last@Reap@ Nest[f, 0.0, 10] > Differences@% > > {MachinePrecision, 15.9546, 17.9528, 20.098, 22.2037, 24.3188, \ > 26.4316, 28.545, 30.6583, 32.7715} > > {1.77636*10^-15, 1.99821, 2.14525, 2.10563, 2.11516, 2.1128, > 2.11338, \ > 2.11324, 2.11327} > > We gain about 2.1 decimal digits of precision at each step. That is, > the > answer is "0" at each step, but we're increasingly confident that it's > CLOSE to zero. > > But wait! Here's another function with the same properties > (apparently): > > Clear[g] > g[x_] = N[AiryAi'[0.], MachinePrecision] x; > g[0.0] > g'[0.0] > > 0. > > -0.258819 > > Another contraction. Won't precision increase, just as it did above? > > Clear[f] > f[a_] := (Sow@Precision@a; g@x) > First@Last@Reap@Nest[f, 0.0, 10] > > {MachinePrecision, MachinePrecision, MachinePrecision, \ > MachinePrecision, MachinePrecision, MachinePrecision, \ > MachinePrecision, MachinePrecision, MachinePrecision, \ > MachinePrecision} > > No, and here's why. The value and derivative of AiryAi are "arbitrary > precision" numbers: > > {AiryAi[0.0], AiryAi'[0.0]} // InputForm > > {0.35502805388781723926006337187548776944`15.954589770191005, > -0.25881940379280679840518356018919926961`15.954589770191005} > > But not so for the function g, where both values are MachinePrecision: > > {g[0.0], g'[0.0]} // InputForm > > {0., -0.2588194037928068} > > (It's actually g that matters for this, not g'.) > > In computing AiryAi, Mathematica switches to arbitrary precision > arithmetic... but computing g, it does not. > > Here's almost the same example, with a different outcome: > > Clear[g] > g[x_] = AiryAi'[0.] x; > First@Last@Reap@Nest[f, 0.0, 10] > > {MachinePrecision, 15.9546, 15.9546, 15.9546, 15.9546, 15.9546, > 15.9546, \ > 15.9546, 15.9546, 15.9546} > > {g[0.0], g'[0.0]} // InputForm > > {0., -0.25881940379280679840518356018919926961`15.954589770191005} > > This time precision doesn't remain precisely MachinePrecision... yet > it > doesn't grow. > > Why? Beats the hell out of me! > > Bobby > > On Sat, 26 Sep 2009 05:13:14 -0500, Harutyun Amirjanyan > <amirjanyan at gmail.com> wrote: > >> this looks like a bug >> and it's the same in versions 5,6,7 >> >> setting every time Precision to MachinePrecision can help >> In[1]:= AiryAi1[x_?NumberQ] := >> SetPrecision[AiryAi[x], MachinePrecision] >> >> In[2]:= ClearSystemCache[] >> Precision@Nest[AiryAi1, 0.0, 100] // Timing >> >> Out[3]= {0., MachinePrecision} >> >> In[4]:= ClearSystemCache[] >> Precision@Nest[AiryAi, 0.0, 100] // Timing >> >> Out[5]= {0.687, 225.079} >> > > > -- > DrMajorBob at yahoo.com >
- References:
- Re: Precision of AiryAi[0.0]
- From: Bill Rowe <readnews@sbcglobal.net>
- Re: Re: Precision of AiryAi[0.0]
- From: DrMajorBob <btreat1@austin.rr.com>
- Re: Precision of AiryAi[0.0]