question about summation



Jianrong Li <lijr07 at gmail.com> writes:

> Dear all,
>
> I have some questions about summation. I am reading some codes about maxima
>
> What does " map(x->sum(sum(x,j,0,k),i,0,m), f(m+n+2*i,2*i+2*k+1-2*j)); "
> mean? Here f( , ) is a polynomial. " -> " is defined as " (arg ->
> form)::=buildq([arg,form],lambda([arg],form)) ". It is very strange since
> it seems that the summation is over x.
>
> Is " map(x->sum(sum(x,j,0,k),i,0,m), f(m+n+2*i,2*i+2*k+1-2*j)); " the same
> as " sum(sum(f(m+n+2*i,2*i+2*k+1-2*j), j, 0, k), i, 0, m) "? Maybe the they
> are not the same because I changed the codes to "
> sum(sum(f(m+n+2*i,2*i+2*k+1-2*j), j, 0, k), i, 0, m) ", then the answer is
> different.

Let's break things down a bit. I couldn't work out how to define ->
correctly, so translated your first example to

  map (lambda([x], sum(sum(x,j,0,k),i,0,m)), f(m+n+2*i,2*i+2*k+1-2*j));

This probably isn't what you wanted, since

  map (func, f(a,b))  =>  f(func(a), func(b))

Instead, you probably wanted "apply":

  apply (lambda([x], sum(sum(x,j,0,k),i,0,m)),
         [f(m+n+2*i,2*i+2*k+1-2*j)]);

                 m     k
                ====  ====
                \     \
(%o4)            >     >    f(n + m + 2 i, 2 k - 2 j + 2 i + 1)
                /     /
                ====  ====
                i = 0 j = 0


I'm not sure what you mean by "the summation is over x".

I think your confusion about map vs. apply explains the answer to the
question in your second paragraph.

If things still aren't behaving like you expect, maybe you could put a
complete example in your email so we can try it out?


Rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20121121/41c557ef/attachment-0001.pgp>;