# symsum

## Syntax

• `symsum(expr,var)` example
• `symsum(expr,var,a,b)` example

## 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 Sum of 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 Sum of 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 Sum of Series Specifying 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

collapse 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).

collapse all

### Definite Sum

The definite sum of series is defined as

$\sum _{i=a}^{b}{x}_{i}={x}_{a}+{x}_{a+1}+\dots +{x}_{b}$

### Indefinite Sum

$f\left(i\right)=\sum _{i}{x}_{i}$

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

$f\left(i+1\right)-f\left(i\right)={x}_{i}$