Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

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

Search the Archive

Re: Recursive Rules

  • To: mathgroup at
  • Subject: [mg31156] Re: [mg31147] Recursive Rules
  • From: BobHanlon at
  • Date: Sun, 14 Oct 2001 04:11:49 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

In a message dated 2001/10/13 3:17:53 AM, mcoleman at writes:

>I know that a recurrent/recursive function can be written 
>f[t_] := f[t] = a + b*f[t-1].
>So that once an initial value is stipulated, e.g., f[0]=0, then the 
>function "remembers" past values and can correctly calculate f[] for 
>any t. 
>I was wondering if it was possible to do the same thing with a Rule?

Use ReplaceRepeated (//.)

fact[0] = 1;

fact[5] //. fact[n_] -> n*fact[n-1]


f[1] = c;

f[4] //. f[n_] -> a+b*f[n-1]

a + b*(a + b*(a + b*c))

Bob Hanlon
Chantilly, VA  USA

  • Prev by Date: Plot-Function
  • Next by Date: style sheeting
  • Previous by thread: Recursive Rules
  • Next by thread: Re: Recursive Rules