Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*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 2002

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

Search the Archive

RE: help: recursive functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32628] RE: [mg32616] help: recursive functions
  • From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
  • Date: Fri, 1 Feb 2002 02:02:30 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

> -----Original Message-----
> From: Okke at NOSPAMtref.nl [mailto:Okke at NOSPAMtref.nl]
To: mathgroup at smc.vnet.net
> Sent: Thursday, January 31, 2002 7:46 AM
> To: mathgroup at smc.vnet.net
> Subject: [mg32628] [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
> 
Could it be, you mistyped your function y?
If not, you should reconsider: (1) there is no base case,
which makes it not terminating, and (2) the variable is
real, so the base case must be defined for an interval at 
least (but normally we then expect y to be a solution 
to an integration equation).


Supposed there is a typo, consider this:

<< Graphics`FilledPlot`
?FilledPlot
?Fills

FilledPlot[{1.5*f[n - 1] - 0.85*f[n - 2] + f[n], f[n]}, {n, 0, 100}, 
  Fills -> {{{Axis, 1}, Hue[.25, .7, 0.5]}, {{1, 2}, Hue[0]}}]

--
Hartmut Wolf



  • Prev by Date: Re: help: recursive functions
  • Next by Date: Re: help: recursive functions
  • Previous by thread: Re: help: recursive functions
  • Next by thread: Re: help: recursive functions