MathGroup Archive 2006

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

Search the Archive

Re: calculate Recurrence Equations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68759] Re: calculate Recurrence Equations
  • From: albert <awnl at arcor.de>
  • Date: Fri, 18 Aug 2006 03:12:03 -0400 (EDT)
  • References: <ec1a1u$omo$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Frank Hechtner wrote:

> hi,
> 
> i?m in trouble with my Recurrence Equations:
> 
> i?ve defined the following function
> 
> anteil[0] = 1
> anteil[n_] := anteil[n - 1] + (anteil[n - 1]*5 - 1)/100
> 

perfect problem for a function that remembers values it has already
calculated (see the mathematica book, section 2.5.9) Try the following:

anteil[n_] := anteil[n] = anteil[n - 1] + (anteil[n - 1]*5-1)/100

if you need even more speed and an approximate result is o.k., the following
might be even faster for large n, but could probably give you wrong results
(it does not for n=10,20,30):

anteil[n_] := anteil[n] = anteil[n - 1] + (anteil[n - 1]*5.-1.)/100.

hth,

albert


  • Prev by Date: RE: product formula in mathematica
  • Next by Date: Re: product formula in mathematica
  • Previous by thread: Re: calculate Recurrence Equations
  • Next by thread: Re: calculate Recurrence Equations