Re: defining a recursive function

• To: mathgroup at smc.vnet.net
• Subject: [mg54886] Re: [mg54870] defining a recursive function
• From: "David Park" <djmp at earthlink.net>
• Date: Sat, 5 Mar 2005 01:34:30 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```Lou,

pr[R_] := R*(i + 1) - a

f[n_] := Nest[pr, r, n]

f[5]
-a + (1 + i) (-a + (1 + i) (-a + (1 + i) (-a + (1 + i) (-a + (1 + i) r))))

You can't use N as a symbol because it has a defined meaning in Mathematica.

If you are new to Mathematica and intend to make much use of it, you would
do well to work through most of Part I in the book, typing in the commands
and familiarizing yourself with the syntax and basic commands.

David Park

From: lou zion [mailto:illuzioner at adelphia.net]
To: mathgroup at smc.vnet.net

hi,

i have a function

pr[R_] := R*(i+1) -a

and i need to define f as:

f[N_] := pr[pr[pr[pr[R]]]]     to N levels deep

how can i do this?

thanks!

lou

```

• Prev by Date: Setting the ResultFormat in a ASP.NET WebApplication.
• Next by Date: Re: Goto Line ?
• Previous by thread: defining a recursive function
• Next by thread: defining a recursive formula?