[Maxima] how can I make a variable local inside "product"?
robert.dodier at gmail.com
Thu May 11 10:40:06 CDT 2006
On 5/11/06, Stavros Macrakis <macrakis at gmail.com> wrote:
> It appears that the new code does *two* evaluations of the summand. This is
> bound to lead to problems like this.... I thought we had discussed this a
> long time ago, and in fact discussed this particular kind of problem.
Yes, we did discuss it.
Here is the code that computes the each term in a finite sum/product,
lines 439 ff in src/asum.lisp.
((foo (mbinding (lind l*i) (meval expr)))
(bar (subst-if-not-freeof *i ind foo)))
expr = summand/productand (not yet evaluated),
ind = index variable, lind = index variable in a list,
*i = particular value of index, l*i = particular value of index in a list.
subst-if-not-freeof replaces instances of the index variable
by the particular value of the index.
In this case, (meval expr) => an expression containing $i .
Then subst-if-not-freeof replaces $i with 1, 2, and 3,
> For better or worse, Maxima semantics makes it the case that
> eval(eval(<expr>)) is NOT the same thing as eval(<expr>).
Yes, as it should be.
More information about the Maxima