Not sure about the rules part (I'm dying to figure out some of the
idiosyncrazies there) but I think I can offer a solution for part of your
problem, where i is not evaluated in the RHS of your rules. Instead of
calling let() directly (when let() would use its second argument
unevaluated) use apply():
(%i1) for i thru 2 do let(x[i]^2,i^2+1,gleep);
(%o1) done
(%i2) letrules();
2 2
x --> i + 1 where gleep()
2
2 2
x --> i + 1 where gleep()
1
(%o2) done
(%i3) for i thru 2 do apply(let,[x[i]^2,i^2+1,gleep2]);
(%o3) done
(%i4) letrules();
2
x --> 5 where gleep2()
2
2
x --> 2 where gleep2()
1
2 2
x --> i + 1 where gleep()
2
2 2
x --> i + 1 where gleep()
1
(%o4) done
Viktor
-----Original Message-----
From: maxima-admin@math.utexas.edu [mailto:maxima-admin at math] On
Behalf Of Allan Adler
Sent: Tuesday, May 17, 2005 8:37 AM
To: Maxima@math.utexas.edu; ara@zurich.csail.mit.edu
Subject: automatic generation of letrule packages
Suppose x is a list whose 1000 entries are variables xi, i=1,2,..., i.e.
x is [x1,x2,x3,x4,...,x1000]. Suppose I want to define a set of letrules
in a package called gleep and to do it by a command like:
for i:1 thru 5 do let(x[i]^2,i^2+1,gleep);
This doesn't work. E.g. it can't simplify x[1]^2 to get 2.
What is the right way to do it?
I'm using the list x because I don't know a way to generate indexed
variables on the fly. But even if I did, I don't think it would help
in this case.
--
Ignorantly,
Allan Adler
* Disclaimer: I am a guest and *not* a member of the MIT CSAIL. My actions
and
* comments do not reflect in any way on MIT. Also, I am nowhere near Boston.
_______________________________________________
Maxima mailing list
Maxima@www.math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima