MathGroup Archive 2005

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

Search the Archive

Re: Differences between recursions and limit

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60536] Re: [mg60509] Differences between recursions and limit
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Tue, 20 Sep 2005 05:18:51 -0400 (EDT)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

The recursion is faster if you give it memory so that it doesn't have to redo 
calculations.

Clear[x];
x[0]=0;
x[k_]:=x[k]=0.25`30*(1+x[k-1]+x[k-1]^2+x[k-1]^3);

Table[{k,x[k]},{k,0,150,10}]//TableForm

The limit can be found exactly

Solve[z==(1+z+z^2+z^3)/4,z][[3]]

{z -> -1 + Sqrt[2]}

N[%,30]

{z -> 0.414213562373095048801688724209698078569671875377`30.}


Bob Hanlon

> 
> From: "anbra1" <xyxanbra1 at tiscalixxxyxxx.it>
To: mathgroup at smc.vnet.net
> Date: 2005/09/19 Mon AM 04:45:30 EDT
> Subject: [mg60536] [mg60509] Differences between recursions and limit
> 
> Please,
> I want to know
> why these two recursions,doing the same thing,
> are the first one much more slow than the second
> 
> -------------------------
> 
> x[0]=0;
> x[k_] := .25 *(1 + x[k-1] + (x[k-1])^2 + (x[k-1])^3);
> 
> For[k=1,k<12,Print[k," ",SetPrecision[x[k],30]];k++]
> 
> -------------------------
> 
> a=0;
> 
> For[k=1,k<12,k++,
> 
> b= .25 (1 + a + a^2 + a^3);a:=b;Print[k," ",SetPrecision[b,30]]]
> 
> -------------------------
> Another question
> How can I calculate
> the limit of this recursion for k->Infinite ?
> Thank you all
> 
> 
> 


  • Prev by Date: Re: Match exactly zero or one
  • Next by Date: Re: Re: another Bug in Reduce ?
  • Previous by thread: Re: Differences between recursions and limit
  • Next by thread: Re: Differences between recursions and limit