"sum" quotes its arguments -- what's up with that?



Hello everyone,

I notice that the function "sum" is defined in src/asum.lisp
as a defmspec so it quotes its arguments. This leads to some
strange behavior. I'd like to suggest "sum" be changed to a
defmfun so it doesn't quote its arguments. Yes, this breaks
with a thousand-year tradition. Oh well.

First, here's how it ought to work:

  (%i1) depends (f, a)$
  (%i2) 'sum (diff (f(x[i]), a), i, 1, n);
                         n
                        ====
                        \
  (%o2)                  >    diff(f(x ), a)
                        /             i
                        ====
                        i = 1
  (%i3) f(x) := a*x + b$
  (%i4) %o2, nouns;
                               n
                              ====
                              \
  (%o4)                        >    x
                              /      i
                              ====
                              i = 1

Which is the result I get after declaring "sum" to be defmfun.
And here's how it currently works:

  (%i1) depends (f, a)$
  (%i2) 'sum (diff (f(x[i]), a), i, 1, n);
                         n
                        ====
                        \
  (%o2)                  >    diff(f(x ), a)
                        /             i
                        ====
                        i = 1
  (%i3) f(x) := a*x + b$
  (%i4) %o2, nouns;
                         n
                        ====
                        \
  (%o4)                  >    diff(f(x ), a)
                        /             i
                        ====
                        i = 1
  (%i5) ''%o2;
                         n
                        ====
                        \
  (%o5)                  >    diff(f(x ), a)
                        /             i
                        ====
                        i = 1

The problem is this: doing the obvious things does not
cause a*x + b to be substituted for f(x).

Incidentally "integrate" is defined in src/simp.lisp as a
defmfun so it does not quote its arguments.

I am guessing the original motivation was to protect the 
summation index in case a variable of the same name were
assigned. I'd rather make "sum" work more like "integrate".

The only previous discussion I find (which mentions "sum"
in passing) is this:
http://www.math.utexas.edu/pipermail/maxima/2004/007267.html

Regards,
Robert Dodier


		
__________________________________ 
Do you Yahoo!? 
All your favorites on one personal page – Try My Yahoo!
http://my.yahoo.com