symsum

Symbolic sum of a series.

Category: Mathematics > Calculus

Syntax

S = symsum(f, k, a, b)

Sum of f as the index k runs from a to b.

S = symsum(f, k)

Indefinite sum: the function whose difference is f.

Description

When the limits are numbers the result is the exact value, e.g. symsum(k^2, k, 1, 10) is 385. With a symbolic upper limit n the answer is a closed form in n, such as n*(n+1)*(2*n+1)/6. A sum that has no closed form is returned unevaluated.

Input arguments

f
Symbolic expression in the index.
k
Summation index.
a, b
Lower and upper limits, possibly symbolic.

Output arguments

S
Symbolic sum, exact for rational terms.

Example

Sum of squares

syms k n
symsum(k^2, k, 1, 10)
symsum(k, k, 1, n)
Output
ans = 385
ans = (n*(n + 1))/2

Notes

Infinite series such as 1/k^2 up to Inf are returned unevaluated in MatLivre, where MATLAB answers pi^2/6.

See also

symprod sum int series