Simple recursive assignment
- To: mathgroup at smc.vnet.net
- Subject: [mg15996] Simple recursive assignment
- From: "Peltio" <pelt.ioNOS at PAMiol.it>
- Date: Fri, 19 Feb 1999 03:27:10 -0500
- Organization: Peltio Inc.
- Sender: owner-wri-mathgroup at wolfram.com
Can someone spare a little time for a trivial question? The assignement a[0]=1.; a[1]=2.; a[n_]:=a[n]=a[n-1]-a[n-2]/n works fine, all right... a[5] 0.291667 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. I tried a few combinations with Hold, Release, and so on but I can't fool the recursion trap.I'm sure it's something trivial I'm missing Any help would be greatly appreciated. Thanks Peltio, peltioNO at SPAMusa.net (remove NO SPAM to e-mail me)
- Follow-Ups:
- Re: Simple recursive assignment
- From: "Wolf, Hartmut" <hwolf@debis.com>
- Re: Simple recursive assignment