Iterating on "Replacement"
- To: mathgroup at smc.vnet.net
- Subject: [mg17736] Iterating on "Replacement"
- From: bcrain at gmu.edu (Ben Crain)
- Date: Tue, 25 May 1999 02:15:17 -0400
- Organization: George Mason University, Fairfax, Virginia, USA
- Sender: owner-wri-mathgroup at wolfram.com
I've got an output from a rather complicated symbolic calculation, and I want to assign numbers to terms in the output, e.g. x[1] = % /. {f[1] -> a[1], f[2] -> a[2]} where f[1] and f[2] are terms in the output, and numbers have already been assigned to a[1] and a[2] . The problem is: this output gets repeated many times, each time with more terms, (higher and higher derivatives are being taken of an original function, each derivative generating more symbolic terms). The next output will have f[1], f[2], and f[3], to be replaced by a[1], a[2], and a[3], and the result assigned to x[2]. And so on. But I can't figure out how to automate this. Say x[1] gets assigned replacements for f[1],f[2], and x[n] gets assigned replacements for f[1]...f[n+1] -- the expression in question being evaluated n times, each time producing more f [] to be replaced by more a[] terms. No configuration of Do[expr , {i,2,n}] applied to the replacement operations % /. {...} seems to work. Any ideas? thanks Ben Crain bcrain at gmu.edu