MathGroup Archive 2002

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

Search the Archive

Re: help: recursive functions

  • To: mathgroup at
  • Subject: [mg32635] Re: [mg32616] help: recursive functions
  • From: BobHanlon at
  • Date: Fri, 1 Feb 2002 02:02:41 -0500 (EST)
  • Sender: owner-wri-mathgroup at

In a message dated 1/31/02 2:13:14 AM, Okke at writes:

>I'm having some problems with a recursive function.
>Could somebody please help me by telling me how I
>should enter such a function?
>This is what I've done so far:
>I'm trying to Plot[y[n],{n,0,320}] but that gives me
>an error: $RecursionLimit::reclim: Recursion depth of 256 exceeded.
>btw, is there an option to fill the area under the sine?

You need to define some stopping values for the recursion.  
I also recommend adding "memory" to the recursion to speed 
it up.  For example,


y[0] = y[1]=0;

y[n_Integer]:= y[n]=1.5*y[n-1]-0.85*y[n-2]+f[n];


ListPlot[data, PlotJoined->True, ImageSize->350];


FilledListPlot[data, PlotJoined->True, Fills->RGBColor[1, 0, 0],

Bob Hanlon
Chantilly, VA  USA

  • Prev by Date: Re: help: recursive functions
  • Next by Date: RE: dropping higher order terms
  • Previous by thread: Re: help: recursive functions
  • Next by thread: Re: help: recursive functions