Re: recursive relation problem ?
- To: mathgroup at smc.vnet.net
- Subject: [mg13678] Re: [mg13656] recursive relation problem ?
- From: BobHanlon at aol.com
- Date: Sat, 15 Aug 1998 04:39:10 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Needs["DiscreteMath`RSolve`"]
RSolve[{f[0] == f[1] == 1, f[n] == n*f[n - 1]}, f[n], n]
{{f[n] -> n!}}
However, the second initial condition is unnecessary:
RSolve[{f[0] == 1, f[n] == n*f[n - 1]}, f[n], n]
{{f[n] -> n!}}
Another example:
Simplify[RSolve[{f[0] == 0, f[1] == 1,
f[n] == f[n - 1] + f[n - 2]}, f[n], n]]
{{f[n] -> -(((1/2*(1 - Sqrt[5]))^n - (1/2*(1 + Sqrt[5]))^n)/
Sqrt[5])}}
Bob Hanlon
In a message dated 8/11/98 6:28:53 AM, cplai at geocities.com wrote:
>I am studying data structure, and always encounter recursive relation
>equations. How do I use mathematica to give general solution of
>recursive relation.
>
>For example: f(0)=1; f(1)=1; f(x)=x*f(x-1);