Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Re: iterative function query



Eric Walters wrote:
> 
> Can someone explain the best way to code:
> 
> starting at x=1 and going to x=5;
> taxes[x_]:= 45 + 0.97(taxes[x+1])/; 
> 
> so that the following is generated:
> 
> 45 + 0.97(45+0.97(45+0.97(45+0.97(45))))

Eric:

Nest[(b +a(#))&,0, 5]

b + a (b + a (b + a (b + a b)))

%/.{a->.97, b->45}

211.899

or, in one line

Nest[(45 +.97(#))&,0, 5]

211.899

-- 
Allan Hayes
Training and Consulting
Leicester, UK
hay@haystack.demon.co.uk
http://www.haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44 (0)116 271 8642




  • Prev by Date: Re: ParametricPlot3D Question
  • Next by Date: Re: Drawing multiple curves with ParametricPlot3D
  • Prev by thread: Re: iterative function query
  • Next by thread: Importing formulas in Word with acceptable display & printing resolution