Open rtoy opened 2 months ago
Imported from SourceForge on 2024-07-07 20:49:15 Created by robert_dodier on 2019-02-03 20:22:00 Original: https://sourceforge.net/p/maxima/bugs/3526/#06e6
Imported from SourceForge on 2024-07-07 20:49:19 Created by robert_dodier on 2019-02-03 20:22:00 Original: https://sourceforge.net/p/maxima/bugs/3526/#fbfb
I'm closing this one as won't-fix since changing ev(..., a[0]=b) to use binding instead of substitution breaks the existing use of temporary assignment in ev to effect substitutions. It turns out there are many instances of that in the test suite -- stuff like ev(..., laplace(expr, u, v) = ...)
. I don't think there's any comprehensible way to distinguish assignments which can succeed from ones, like the laplace example, which can't, so at this point I think using binding instead of substitution can't work.
Imported from SourceForge on 2024-07-07 20:49:14 Created by robert_dodier on 2019-02-03 03:01:45 Original: https://sourceforge.net/p/maxima/bugs/3526
ev
handles assignments to simple variables differently than assignments to subscripted variables. Assignments to simple variables are handled by binding (via MBIND) the variables. Assignments to subscripted variables are handled by substituting the value for the subscripted variable in the input expression, and then evaluating the expression.Since the subscripted variables are not bound, any further occurence of the subscripted variables in the evaluation won't make use of the assigned value. Here is an example, take from [1].
But if the variable is
a0
instead ofa[0]
the result is what you'd expect from dynamic binding:The behavior of ev is actually documented: "If 'V' is a non-atomic expression then a substitution rather than a binding is performed." But I think the current behavior is a bug anyway, since it is counterintuitive at best.
[1] https://stackoverflow.com/questions/54300600/maxima-indexed-variables-assigned-in-evaluation-of-function