sum & lsum



Learning when to quote is an essential part of learning Maxima. So
we should do less to protect users from unquoted expressions
(fewer defmspec functions)---there are many cases where expressions
must be quoted, so why protect users using sum, product, and ....?

I was looking at how to support lsum(p,k, rootsof(q,x))
expressions. The natural approach is to make lsum into a simplifying
function. That's not difficult and it doesn't cause problems with the
test suite. So I looked at how sum and lsum work. It's a mess.
The user documentation doesn't help all that much.

(%i1) (a : b, b : c, c : d, d  : e, e : f, f : g, g : h)$

(%i2) sum(a * b, b, 5,6);
(%o2) 61

(%i3) lsum(a * b, b, [5,6]);
(%o3) 11*b

(%i4) sum('a * b, b, 5,6);
(%o4) 11*a

(%i5) lsum('a * b, b, [5,6]);
(%o5) 11*a

(%i6) sum(a * 'b, b, 5,6);
(%o6) 61

(%i7) lsum(a * 'b, b, [5,6]);
(%o7) 2*b^2

(%i8) sum('(a * b), b, 5,6);
(%o8) 11*a

(%i9) lsum('(a * b), b, [5,6]);
(%o9) 2*a*b

(%i10) sum(sum(a*b,a,5,6),b,2,3);
(%o10) 55

(%i11) lsum(lsum(a*b,a,[5,6]),b,[2,3]);
(%o11) 55

(%i12) sum(sum('a*b,a,5,6),b,2,3);
(%o12) 55

(%i13) lsum(lsum('a*b,a,[5,6]),b,[2,3]);
(%o13) 10*a

(%i14) sum(sum(a*'b,a,5,6),b,2,3);
(%o14) 55

(%i15) lsum(lsum(a*'b,a,[5,6]),b,[2,3]);
(%o15) 22*b

(%i16) sum(sum('(a*b),a,5,6),b,2,3);
(%o16) 55

(%i17) lsum(lsum('(a*b),a,[5,6]),b,[2,3]);
(%o17) 4*a*b

Barton