MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Mathematica bugs?


You need to use greater precision than machine precision

x = Pi/4; 
For[i = 0, i < 56, i += 1, x = 2*Abs[x - 1/2]];
x//Simplify
 N[x,20]

56593902016227523 - 18014398509481984*Pi

0.79387245267980382900

x=Nest[2*Abs[#-1/2]&, Pi/4, 56]//Simplify
N[x,20]

56593902016227523 - 18014398509481984*Pi

0.79387245267980382900

x = Pi/4; For[i = 0, i < 50, i += 1, x = 2*Abs[x - 1/2]]; 
N[Log[x],20] 

-3.3676443458316025909

x=Nest[2*Abs[#-1/2]&, Pi/4, 50];
N[Log[x],20]

-3.3676443458316025909


Bob Hanlon

---- Yaroslav Bulatov <yaroslavvb at gmail.com> wrote: 
> When I run the following line
> x = Pi/4; For[i = 0, i < 56, i += 1, x = 2*Abs[x - 1/2]]; N[x]
> I get
> 3.
> 
> But x should always stay between 0 and 1, why do I get 3?
> 
> Also
> x = Pi/4; For[i = 0, i < 50, i += 1, x = 2*Abs[x - 1/2]]; N[Log[x]]
> gives me
> Indeterminate
> 
> How can I get an indeterminate here?
> 


  • Prev by Date: Re: Mathematica bugs?
  • Next by Date: Re: Problem with derivate of product
  • Previous by thread: Re: Mathematica bugs?
  • Next by thread: Re: Mathematica bugs?