MathGroup Archive 2006

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

Search the Archive

Re: calculate Recurrence Equations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68810] Re: calculate Recurrence Equations
  • From: Roger Bagula <rlbagula at sbcglobal.net>
  • Date: Sat, 19 Aug 2006 00:41:19 -0400 (EDT)
  • References: <ec3peq$287$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Bob Hanlon wrote:

>Add memory to the definition
>
>Clear[anteil1];
>anteil1[0]=1;
>anteil1[n_Integer?Positive]:=
>    anteil1[n]=
>      anteil1[n-1]+(anteil1[n-1]*5-1)/100;
>anteil1[n_Integer?Negative]:=
>    anteil1[n]=(1/105)*(100*anteil1[n+1]+1);
>
>anteil1[30]//Timing//N
>
>{0.002837 Second,3.65755}
>
>Clear[anteil2];
>
>anteil2[n_]=anteil2[n]/.RSolve[{
>          anteil2[n]==anteil2[n-1]+(anteil2[n-1]*5-1)/100, 
>          anteil2[0]==1},anteil2[n],n][[1]]
>
>(1/5)*(1 + 4^(1 - n)*(21/5)^n)
>
>anteil2[30]//Timing//N
>
>{0.000229 Second,3.65755}
>
>Plot[anteil2[n],{n,-10,10},
>    PlotStyle->Blue,ImageSize\[Rule]432,
>    Epilog->{Red, AbsolutePointSize[4],
>        Point/@Table[{n,anteil1[n]},{n,-10,20}]}];
>
>
>Bob Hanlon
>
>
>  
>
Very good!
It seems to have a very low ratio (1.05 about) even if it is a rational 
sequence.
You can convert it into an Integer sequence with the right factor.
Try:

Table[anteil1[n]*20^(2 + n), {n, 0, 30}]
b=Table[N[anteil1[n + 1]/anteil1[n]], {n, 0, 100}]
ListPlot[b]


  • Prev by Date: Re: Preventing NIntegrate from reevaluating after DumpSave and Get
  • Next by Date: Re: NonlinearFit + Sums
  • Previous by thread: Re: calculate Recurrence Equations
  • Next by thread: Numerically eliminate quantifiers