This material was developed by Aaron Tresham at the University of Hawaii at Hilo and is

licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

- Intro to Sage
- Sequences

An infinite series is simply an infinite sum of numbers.

The harmonic series is the sum of the reciprocals of the positive integers:

This may be written with summation notation as

The decimal expansion of a real number can be thought of as a series.

In this example, we can see that an infinite sum of numbers may give you a finite answer. Such a series is called **convergent**.

Of course, many infinite series do not give you a finite sum. Such series are called **divergent**.

(We'll define these more precisely below.)

One of the easiest ways to get a divergent series is if the terms don't approach zero. That is, diverges if .

On the other hand, if , this is no guarantee that converges.

Even though , the harmonic series diverges. This fact was proved as far back as the 14th century by Oresme. His approach was to compare the harmonic series to a series with smaller terms. If the smaller series diverges, then the harmonic series must as well.

Given

Replace with , replace with , replace each of , , and with , and so on. What you get is the smaller series

This series diverges, since .

Compare this result with this convergent series:

[Side note: compare this to the improper integrals (divergent) and (convergent). Actually, each series is a Riemann sum for the corresponding integral.]

Given a series , we define a *sequence* as follows:

is called the nth partial sum of the series.

Find the 10th and 20th partial sums of the series .

We can use the sum command in Sage, which requires four arguments: sum(expression, index variable, starting value, ending value). Don't forget to declare the index variable first.

Here is the 10th partial sum (I'll convert the answer to a decimal).

28771121/20454564
1.40658686247236

Here is the 20th partial sum.

12139706620041946362/6522879694663705009
1.86109620111088

We define convergence of a series in terms of the sequence of partial sums, .

If exists, then we say the series **converges** (or is convergent), and we define the **sum** of the series to be this limit; that is,

If the limit does not exist, then we say the series **diverges** (or is divergent).

Here is a graph of the first 50 partial sums for .

Notice that the partial sums seem to get bigger and bigger without approaching a limit, which suggests this series diverges.

Sage can handle infinite series. In this case, Sage tells us the series is divergent.

Error in lines 1-1
Traceback (most recent call last):
File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 995, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 1, in <module>
File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/sage/misc/functional.py", line 563, in symbolic_sum
return expression.sum(*args, **kwds)
File "sage/symbolic/expression.pyx", line 11601, in sage.symbolic.expression.Expression.sum (/projects/sage/sage-7.5/src/build/cythonized/sage/symbolic/expression.cpp:63737)
return symbolic_sum(self, *args, **kwds)
File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/sage/calculus/calculus.py", line 621, in symbolic_sum
return maxima.sr_sum(expression,v,a,b)
File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.py", line 892, in sr_sum
raise ValueError("Sum is divergent.")
ValueError: Sum is divergent.

Consider the series .

Here is a graph of the first 50 partial sums of this series. It appears the partial sums are getting larger and larger without bound. This is what we expect, since we saw above that this series diverges.

Sage will also tell us that this series diverges.

Error in lines 1-1
Traceback (most recent call last):
File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 995, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 1, in <module>
File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/sage/misc/functional.py", line 563, in symbolic_sum
return expression.sum(*args, **kwds)
File "sage/symbolic/expression.pyx", line 11601, in sage.symbolic.expression.Expression.sum (/projects/sage/sage-7.5/src/build/cythonized/sage/symbolic/expression.cpp:63737)
return symbolic_sum(self, *args, **kwds)
File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/sage/calculus/calculus.py", line 621, in symbolic_sum
return maxima.sr_sum(expression,v,a,b)
File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.py", line 892, in sr_sum
raise ValueError("Sum is divergent.")
ValueError: Sum is divergent.

Consider the series .

Here is a graph of the first 50 partial sums for this series. Now the partial sums approach a limit around 1.6 (the exact answer is ).

Here is the answer from Sage.

1/6*pi^2

One common type of series is called a geometric series, because the terms form a geometric sequence (a sequence is geometric if the ratio of successive terms is a constant, called the common ratio).

In other words, is a geometric series, if there exists a constant such that for all .

In general, a geometric series has the form

where is the first term and is the common ratio (note: it is customary to begin geometric series at , although this is not necessary).

Consider the geometric series . Let's look at the partial sums.

I'll use the sum command in Sage: sum(formula, index variable, start, end)

I'm going to separate out the initial 1 (the 0th term) to make the pattern easier to see.

Interact: please open in CoCalc

As , the partial sums approach .

Here is a graph of the sequence of partial sums of the series. It appears the limit of the sequence is 2.

In general, if , then .

If or , then this series diverges.

[Note: the index must start at 0 for this formula. You can also think of it as , and then the index does not matter.]

(geometric series with and )

Here's the answer from Sage.

15/4

(geometric series with and )

Here's the answer from Sage.

5/2

Find the sum of the geometric series .

In this case, (first term) and (common ratio , etc.).

So the sum is .

Here's the answer from Sage.

5/9

5/9

Let's explore the series using Sage.

Try things like , etc.

Interact: please open in CoCalc