# [Maxima] wrong symbolic sum

Barton Willis willisb at unk.edu
Sun Jul 26 10:14:07 CDT 2009

```With CVS Maxima, the results are different:

(%i18) sum(-k, k, -a, -1), simpsum, factor;
(%o18) a*(a+1)/2

Manifestly empty sums simplify to zero:

(%i19) sum(-k,k,5,-1);
(%o19) 0

I suggest that we consider restoring the sumhack option.

Barton

-----maxima-bounces at math.utexas.edu wrote: -----

>To: Alexandros Droseltis <ml-maxima at alex-droseltis.com>, Maxima List
><maxima at math.utexas.edu>
>From: Richard Fateman <fateman at cs.berkeley.edu>
>Sent by: maxima-bounces at math.utexas.edu
>Date: 07/26/2009 09:09AM
>Subject: Re: [Maxima] wrong symbolic sum
>
>Alexandros Droseltis wrote:
>> Hello!
>>
>> [Using Maxima 5.17.0 provided by the rpm 5.17.0-1.3 for openSuSE]
>>
>> Please, have a look at this.
>>
>> These sums are correct:
>>
>> (%i27) sum(k, k, 1, 4);
>> (%o27)                                10
>> (%i28) sum(-k, k, -4, -1);
>> (%o28)                                10
>>
>> Now check these two sums:
>>
>> (%i1) simpsum: true;
>> (%o1)                                true
>> (%i2) sum(k, k, 1, a);
>>                                      2
>>                                     a  + a
>> (%o2)                               ------
>>                                       2
>> (%i3) sum(-k, k, -a, -1);
>> Is  a  positive, negative, or zero?
>>
>> p;
>>                                      2
>>                                     a  - a
>> (%o3)                               ------
>>                                       2
>> (%i4) sum(-k, k, -a, -1);
>> Is  a  positive, negative, or zero?
>>
>> n;
>>                                             2
>>                              - a + (- a - 1)  - 1
>> (%o4)                        --------------------
>>                                       2
>> (%i5) ratsimp(%);
>>                                      2
>>                                     a  + a
>> (%o5)                               ------
>>                                       2
>>
>>
>> Should n't a positive "a" create the same result as %o2 and a negative
>> the empty sum, thus 0? Do I miss something?
>>
>> Best Regards
>>
>> Alexandros
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>
>First of all, convince yourself that
>sum(f(i),i,a,b) = -sum(f(i),i,b+1,a-1) when a>b,  NOT zero.
>
>This is a consequence of
>
>sum(f(i),i,a,b) + sum(f(i),i,b+1,c) = sum(f(i),i,a,c)
>
>where  a<=b<c
>
>being extended to all b.
>
>Commercial Macsyma has a flag "sumhack"  that makes this true.
>
>A "negative sum" is not zero if you maintain this identity.
>
>I think what you are seeing is that one part of Maxima believes this
>identity and another one doesn't.
>Two people can disagree on which part of Maxima is in error.
>
>
>_______________________________________________
>Maxima mailing list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima

```