Sponsored links: Algebra eBooks ### The Maxima on-line user's manual

Algebra Calculator

#### Search: #### Sum

Function: sum (<expr>, <i>, <i_0>, <i_1>) Represents a summation of the values of <expr> as the index <i> varies from <i_0> to <i_1>. The noun form sum is displayed as an uppercase letter sigma. `sum` evaluates its summand <expr> and lower and upper limits <i_0> and <i_1>, `sum` quotes (does not evaluate) the index <i>.

If the upper and lower limits differ by an integer, the summand <expr> is evaluated for each value of the summation index <i>, and the result is an explicit sum.

Otherwise, the range of the index is indefinite. Some rules are applied to simplify the summation. When the global variable `simpsum` is `true`, additional rules are applied. In some cases, simplification yields a result which is not a summation; otherwise, the result is a noun form sum.

When the `evflag` (evaluation flag) `cauchysum` is `true`, a product of summations is expressed as a Cauchy product, in which the index of the inner summation is a function of the index of the outer one, rather than varying independently.

The global variable `genindex` is the alphabetic prefix used to generate the next index of summation, when an automatically generated index is needed.

`gensumnum` is the numeric suffix used to generate the next index of summation, when an automatically generated index is needed. When `gensumnum` is `false`, an automatically-generated index is only `genindex` with no numeric suffix.

See also `sumcontract`, `intosum`, `bashindices`, `niceindices`, `nouns`, `evflag`, and `zeilberger`.

Examples:

```          (%i1) sum (i^2, i, 1, 7);
(%o1)                          140
(%i2) sum (a[i], i, 1, 7);
(%o2)           a  + a  + a  + a  + a  + a  + a
7    6    5    4    3    2    1
(%i3) sum (a(i), i, 1, 7);
(%o3)    a(7) + a(6) + a(5) + a(4) + a(3) + a(2) + a(1)
(%i4) sum (a(i), i, 1, n);
n
====
\
(%o4)                       >    a(i)
/
====
i = 1
(%i5) sum (2^i + i^2, i, 0, n);
n
====
\       i    2
(%o5)                     >    (2  + i )
/
====
i = 0
(%i6) sum (2^i + i^2, i, 0, n), simpsum;
3      2
n + 1   2 n  + 3 n  + n
(%o6)             2      + --------------- - 1
6
(%i7) sum (1/3^i, i, 1, inf);
inf
====
\     1
(%o7)                        >    --
/      i
====  3
i = 1
(%i8) sum (1/3^i, i, 1, inf), simpsum;
1
(%o8)                           -
2
(%i9) sum (i^2, i, 1, 4) * sum (1/i^2, i, 1, inf);
inf
====
\     1
(%o9)                      30  >    --
/      2
====  i
i = 1
(%i10) sum (i^2, i, 1, 4) * sum (1/i^2, i, 1, inf), simpsum;
2
(%o10)                       5 %pi
(%i11) sum (integrate (x^k, x, 0, 1), k, 1, n);
n
====
\       1
(%o11)                      >    -----
/     k + 1
====
k = 1
(%i12) sum (if k <= 5 then a^k else b^k, k, 1, 10);
10    9    8    7    6    5    4    3    2
(%o12)   b   + b  + b  + b  + b  + a  + a  + a  + a  + a```

There are also some inexact matches for `sum`. Try `?? sum` to see them.

```(%o1)                                true
(%i2) ```

### Related Examples

##### sum

sum (i^2, i, 1, 7);

sum (a[i], i, 1, 7);

sum (a(i), i, 1, 7);

Calculate

##### sum

f(x) := x+5+'sum (x^i...

f(g);

f(i) ;

Calculate

##### sum

(sum(k^2,k,1,n));

Calculate

##### sum

sum(k^3,k1,1,3);

sum((-3)^i,i,-2,1);

Calculate

sum(n,n,1,100);

Calculate

sum(k,k,1,16);

Calculate

q:1/2;

? sum;

Calculate

##### sum

'sum(k^2,k,1,10);

Calculate

##### sum

sum(i,i,1,12);

sum(i,i,2*1-1,5) /* 9...

sum(i,i,2*1-3,3) /* 9...

Calculate

##### sum

h:[2, 8, 10, 1, 1];

x:[1, 2, 3, 4, 5];

N:sum(h[i],i,1,5);

Calculate 