symsum

Sum of series

Syntax

Description

example

symsum(expr,var) finds the indefinite sum of a series, where expression expr defines the terms of a series, with respect to the symbolic variable var. This is an expression s, such that expr(var) = s(var + 1) - s(var). If you do not specify the variable, symsum uses the default variable determined by symvar. If expr is a constant, then the default variable is x.

example

symsum(expr,var,a,b) evaluates the sum of a series, where expression expr defines the terms of a series, with respect to the symbolic variable var. The value of the variable var changes from a to b. If you do not specify the variable, symsum uses the default variable determined by symvar. If expr is a constant, then the default variable is x.

symsum(expr,var,[a,b]), symsum(expr,var,[a b]), and symsum(expr,var,[a;b]) are equivalent to symsum(expr,var,a,b).

Examples

Evaluate the Sum of a Series

Evaluate the sum of a series for the symbolic expressions k and k^2:

syms k
symsum(k)
symsum(1/k^2)
ans =
k^2/2 - k/2

ans =
-psi(1, k)

Evaluate the Sum of a Series Specifying Bounds

Evaluate the sum of a series for these expressions specifying the bounds:

syms k
symsum(k^2, 0, 10)
symsum(1/k^2,1,Inf)
ans =
385
 
ans =
pi^2/6

You also can specify bounds as a row or column vector:

syms k
symsum(k^2, [0, 10])
symsum(1/k^2, [1; Inf])
ans =
385
 
ans =
pi^2/6

Evaluate the Sum of a Series Specifying the Summation Index and Bounds

Evaluate the sum of a series for this multivariable expression with respect to k:

syms k x
symsum(x^k/sym('k!'), k, 0, Inf)
ans =
exp(x)

Input Arguments

expand all

expr — Expression defining terms of seriessymbolic expression | symbolic function | symbolic vector | symbolic matrix | symbolic number

Expression defining terms of series, specified as a symbolic expression or function, a constant, or a vector or matrix of symbolic expressions, functions, or constants.

var — Summation indexsymbolic variable

Summation index, specified as a symbolic variable. If you do not specify this variable, symsum uses the default variable determined by symvar(expr,1). If expr is a constant, then the default variable is x.

a — Lower bound of summation indexnumber | symbolic number | symbolic variable | symbolic expression | symbolic function

Lower bound of summation index, specified as a number, symbolic number, variable, expression or function (including expressions and functions with infinities).

b — Upper bound of summation indexnumber | symbolic number | symbolic variable | symbolic expression | symbolic function

Upper bound of summation index, specified as a number, symbolic number, variable, expression or function (including expressions and functions with infinities).

More About

expand all

Definite Sum

The definite sum of series is defined as

i=abxi=xa+xa+1++xb

Indefinite Sum

f(i)=ixi

is called the indefinite sum of xi over i, if the following identity is true for all values of i.

f(i+1)f(i)=xi

See Also

| | | | |

Related Examples

Was this topic helpful?