# [Maxima] wrong symbolic sum

Richard Fateman fateman at cs.berkeley.edu
Sun Jul 26 09:09:28 CDT 2009

```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.

```