Robert Dodier wrote:
...
> I think we should consider making $sum an ordinary
> argument-evaluating function, and do away with the peculiar
> evaluation scheme which is now in place.
It's been there for 40 years. Other computer algebra systems probably do
the same
kind of thing. I doubt that the arguments pro and con have changed in
that time.
Undoubtedly a change would prompt bug reports like those from plot.
In Mathematica, Sum has attribute "HoldAll". As does NIntegrate. Oddly,
Integrate does not.
As I've suggested previously, a cleaner way of doing some summation
notation is to internalize the index, e.g.
sum( lambda([i] ....expression involving i ), 1,n).
but this seems to be unpopular with programs that muck around with the
expression,
not evaluating it.
It would be easy to add a program, maybe call it dosum, which always
evaluates its arguments,
instead of changing sum.
It would also be nice to allow the syntax for i:1 thru n sum f(i).
instead of
(s:0, for i:1 thru n do s:s+f(i), s)j. That would be like dosum, except
better, since
for i in [a,b,c] sum f(i) would work too.
RJF