# Exploring Series

## Introduction

In this activity we will explore series geometrically and symbolically.
First, we will use the commands cumsum and stem to plot partial sums of series and try to determine whether they converge or diverge. Then we will calculate the limit of particular series using the commands symsum and limit.

## Before starting

Use the MATLAB Live Editor to edit and run this Live Script in your browser or your desktop.
2. Run the code within a section before starting to read the next.
3. To run the code from each section, click into the code section and then click on the Run Section button (from the toolstrip) or click on the blue stripe on left side of that section as shown below:
Remark: Run the code of each section from top to bottom, otherwise you may get an error.
- The end of a section is indicated with a thin line, like the next one -

## 1. Geometric exploration

### 1.1 Partial sums

It is possible to explore geometrically the series
by considering the associated partial sums
, ,
and, in general,
These partial sums form a new sequence , which may or may not have a limit. If
exits (as a finite number), then, we call this value S the sum of the infinite series .

### 1.2 Plotting partial sums of series

Now consider the following series
To plot this first, let's create a variable:
max = 10;
This variable is an integer defined between 1 and 150.
We need to use the command linspace to define the domain of the sequence of partial sums. In this case we can store this information as a variable:
k = linspace(1, max, max);
Now we just need to use the command cumsum to define the partial sums and plot it witht the command stem. That is:
a(k) = cumsum( 1./(k.*(k+1)) ); % Define sequence of partial sums
stem(k, a(k), 'filled'); % Plot terms
Remark: Here we are using row vectors (also known as arrays) which means that the operations multiplication, division and exponentiation must have the period "." before each operator: *, /, ^. Learn more about it here: Arithmetic operations.
Run this section to see the plot. You can change the number of point in the plot by dragging the slider max.

## 2. Symbolic exploration

As you have noticed, in the previous section, the plot of the partial sums for the series
suggests that it has limit. We can verify this symbolically using the commands symsum and limit.
First, we need to define two symbolic variables:
syms k n
Second, we define the partial sum as a symbolic expression:
Sn = symsum(1/(k*(k+1)), k, 1, n);
Finally, we calculate the limit:
limit(Sn, n, inf)

## 3. Hands on practice!

Let's practice what we just learned.

### Activity 1:

Use the commands linspace, cumsum and stem to plot 300 terms of the partial sums of the following series:
Analyse the plots in each case. What do you notice? Can you determine whether the series converges or diverges based on the information provided by its plot?

### Activity 2:

Use the commands symsum and limit, as we did in section 2, to calculate the sum of the series from Activity 1.