Re: defining a recursive formula?

• To: mathgroup at smc.vnet.net
• Subject: [mg54896] Re: [mg54869] defining a recursive formula?
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Sat, 5 Mar 2005 01:34:40 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```p[R_] := i*R-a;

f1[n_Integer?Positive] := Nest[p,R,n];

f2[1] = p[R];
f2[n_Integer?Positive] :=
f2[n] = p[f2[n-1]];

Needs["DiscreteMath`RSolve`"];

f3[n_Integer?Positive]=f3[n] /.
RSolve[{
f3[n]==i*f3[n-1]-a,
f3[1]==i*R-a},
f3[n],n][[1]]//FullSimplify

(a - i^n*(a - i*R + R))/(i - 1)

These are all equivalent

And@@(Table[f1[n]==f2[n]==f3[n],{n,20}]//Simplify)

True

Bob Hanlon

>
> From: "lou zion" <illuzioner at adelphia.net>
To: mathgroup at smc.vnet.net
> Date: 2005/03/04 Fri AM 05:08:04 EST
> To: mathgroup at smc.vnet.net
> Subject: [mg54896] [mg54869] defining a recursive formula?
>
> can someone help me represent the following?
>
> i have a quantity p[R_] := i* R -a
>
> i need to compute
>
> F[N_]  := p[p[p[p[p[R]]]]]  to N levels deep.
>
> how can i do this? thanks!
>
> lou
>
>
>

```

• Prev by Date: Re: Goto Line ?
• Next by Date: Re: Goto Line ?
• Previous by thread: Re: defining a recursive formula?
• Next by thread: Re: defining a recursive formula?