# Sum of a series (sum)

Sum of an expression over one or more ranges.

## How to write it

### sum(f, k = a..b)

The sum over the range.

**f**

The expression or function to work on. Takes an expression.

**k = a..b**

The index and its bounds; a bound may be inf. Takes a variable with its range.

### sum(f, i = a..b, j = a..b)

A double sum.

**f**

The expression or function to work on. Takes an expression.

**i = a..b**

The first index and its range. Takes a variable with its range.

**j = a..b**

The second index and its range. Takes a variable with its range.

## Examples

- $\displaystyle \sum_{k=1}^{10} k = 55$

  `sum(k, k = 1..10)`

  In the solver, `sum(k, k = 1..10)` gives `55`.

  [Open in the solver](https://hilberon.com/?q=sum%28k%2C%20k%20%3D%201..10%29)
- $\displaystyle \sum_{k=1}^{\infty} \frac{1}{k^{2}} = \frac{\pi^{2}}{6}$

  `sum(1/k^2, k = 1..inf)`

  In the solver, `sum(1/k^2, k = 1..inf)` gives `pi^2/6`.

  [Open in the solver](https://hilberon.com/?q=sum%281%2Fk%5E2%2C%20k%20%3D%201..inf%29)
- $\displaystyle \sum_{i=1}^{3} \sum_{j=1}^{3} i j = 36$

  `sum(i*j, i = 1..3, j = 1..3)`

  In the solver, `sum(i*j, i = 1..3, j = 1..3)` gives `36`.

  [Open in the solver](https://hilberon.com/?q=sum%28i*j%2C%20i%20%3D%201..3%2C%20j%20%3D%201..3%29)

## Related functions

- [sum_convergence](https://hilberon.com/library/sum_convergence)

  Test whether the sum of an expression over a variable converges.
- [numeric_sum](https://hilberon.com/library/numeric_sum)

  Add up an expression over a range, as a decimal.
- [series_coefficient](https://hilberon.com/library/series_coefficient)

  The coefficient of the term of a given order in the series of an expression.
- [differences](https://hilberon.com/library/differences)

  The differences between neighbouring elements of a list.
- [series](https://hilberon.com/library/series)

  Series expansion of an expression about a point.
- [find_linear_recurrence](https://hilberon.com/library/find_linear_recurrence)

  The recurrence a list of terms obeys, given only when it also holds on two more.

---
Source: https://hilberon.com/library/sum
