Matlab

# How to Find Symbolic Sum of Series in MATLAB Using symsum

Series and sequence are the basic components of mathematics. A sequence is a sequential representation of any kind of data while a series is a summation of the elements of a sequence. We usually donate the series using the variable S.

Finding the sum of a series is a complicated mathematical operation that becomes difficult while performing it manually. However, in the world of high-performance computing, it has become an easier task by using MATLAB’s built-in symsum() function.

Follow this article to learn how to compute the symbolic sum of a series in MATLAB using the symsum() function.

## What is a Series?

As mentioned earlier a series is a summation of a sequence’s elements. In mathematics, it is considered as a sequence having N terms x1,x2,x3,…xN and can be denoted as:

Here, xi represents the terms of the above sequence at the ith location.

## How to Find the Symbolic Sum of a Series in MATLAB Using the symsum() Function?

MATLAB is a high-performance computing tool that provides us with a built-in symsum() function to compute the sum of the symbolic series. This function accepts one or more inputs and returns a scalar value that represents the computed summation of the given series.

## Syntax

There are different syntaxes of the symsum() function in MATLAB, which are given below:

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

Here,

The function S = symsum(f,k,a,b) computes the series sum denoted by f with respect to summation index k ranges from the lower bound a to the upper bound b. If k is not specified, the function uses the variable determined by symsum as an index. If f behaves like a constant the default index will be x.

Note: The function symsum(f,k,a,b) is equivalent to symsum(f,k,[a,b]) and symsum(f,k,[a;b]).

The function S = symsum(f,k) determines the indefinite summation of the series f over the index k satisfying the relation:

f(K)=f(K+1)-f(K)

## Examples

Consider some examples to practically understand the working of the symsum() function to determine the sum of the series in MATLAB.

## Example 1: How to Find the Sum of the Series for the Specified Bounds Using the symsum(f,k,a,b) Function?

This example calculates the finite sum of the given series from lower bound a=0 to upper bound b=20 using the symsum(f,k,a,b) function in MATLAB.

syms k x
S = symsum(1/(k^2+1),k,0,20)

## Example 2: How to Find the Indefinite Sum of the Series Using the symsum(f,k) Function?

In this example, we compute the indefinite sum of the given series f over k using the symsum(f,k) function.

syms k
S = symsum(k^2,k)

## Conclusion

A series is the summation of a sequence’s elements. Manually, it is a complicated task to find the sum of a series. However, in MATLAB, you can calculate it quickly using the sysum() function. This guide has presented different syntaxes of the symsum() function in MATLAB and provided examples for each syntax to help us understand this function working.