Re: help: recursive functions

*To*: mathgroup at smc.vnet.net*Subject*: [mg32644] Re: [mg32616] help: recursive functions*From*: Tomas Garza <tgarza01 at prodigy.net.mx>*Date*: Fri, 1 Feb 2002 02:03:09 -0500 (EST)*References*: <200201310645.BAA04374@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

You need to give the base cases (in order to stop the recursion). Try, for example, In[1]:= f[n_]:=Sin[Pi*n*(0.05+(0.0005*n))]; y[n_]:=1.5*y[n-1]-0.85*y[n-2]+f[n]; y[1]=0; y[2]=0; In[2]:= ListPlot[Table[y[n],{n,1,20}]]; The default depth for recursion is 256. If you need more (like 320), modify your $RecursionLimit. For fillings, use In[1]:= << "Graphics`FilledPlot`" In[2]:= FilledPlot[Sin[x], {x, 0, Pi}] Tomas Garza Mexico City ----- Original Message ----- From: "Okke" <Okke at tref.nl> To: mathgroup at smc.vnet.net Subject: [mg32644] [mg32616] help: recursive functions > Hello, > > I'm having some problems with a recursive function. > Could somebody please help me by telling me how I > should enter such a function? > > tia, > > This is what I've done so far: > > f[n_]:=Sin[Pi*n*(0.05+(0.0005*n))] > y[n_]:=1.5*y[n-1]-0.85*y[n-2]+f[n] > > 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? > > -- > Okke > > remove NOSPAM from my email address to reply >