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.

Use the MATLAB Live Editor to edit and run this Live Script in your browser or your desktop.

- Read each section carefully.
- Run the code within a section before starting to read the next.
- 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 -

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 .

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.

As you have noticed, in the previous section, the plot of the partial sums for the series

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)

Let's practice what we just learned.

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?

Write your code here:

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

Write your code here:

In your notebook, determine whether the series from Activity 1 converge or diverge. You can use different tests to do so. Where possible, find the sum of the convergent series and compare your results with those provided by MATLAB.