Re: calculate Recurrence Equations

*To*: mathgroup at smc.vnet.net*Subject*: [mg68785] Re: [mg68713] calculate Recurrence Equations*From*: Sseziwa Mukasa <mukasa at jeol.com>*Date*: Fri, 18 Aug 2006 03:12:43 -0400 (EDT)*References*: <200608170818.EAA24918@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

On Aug 17, 2006, at 4:18 AM, 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 > > i want mathematica to calculate the values for anteil[30] and so on. > > Unfortunately mathematica needs for this calculation over 2 hours (and > is still running, athlon x2 4600, 2 gb ram). > > I don?t see where are the difficulties for mathematica... The difficulties are subtle, for starters use anteil[0]:=1, also if you are not evaluating the series for large values of n, cache the values of intermediate n eg: anteil[0] := 1 anteil[n_] := anteil[n] =anteil[n - 1] + (anteil[n - 1] 5 - 1)/100 Timing[anteil[30]] {0.0014070000000003802 Second, 4909085745117164100520051333566036654601/1342177280000000000000000000000 000000000} Regards, Ssezi

**References**:**calculate Recurrence Equations***From:*Frank Hechtner <frank.hechtner@rub.de>