Re: Simple recursive assignment
- To: mathgroup at smc.vnet.net
- Subject: [mg16012] Re: Simple recursive assignment
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Sat, 20 Feb 1999 02:52:04 -0500
- Organization: Universitaet Leipzig
- References: <7ajadc$imu@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Peltino,
what is with ?
expr=b[n-1]-b[n-2]/n;
b[0]=1;
b[1]=2;
b[nn_Integer]:=b[nn]=expr /. n->nn
Hope that helps
Jens
Peltio wrote:
>
> Can someone spare a little time for a trivial question?
>
---- SNIP SNAPP --- SNIP SNAP ----
> But how can I achieve the same results when the expression a[n-1]-a[n-2]/n
> is stored in a variable expr? The following approach leads to a Recursion
> Limit error
> expr=b[n-1]-b[n-2]/n;
>
> b[0]=1;
> b[1]=2;
> b[n_]:=b[n]=expr
>
> b[3]
> $RecursionLimit::reclim: etc.
>