CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

CoCalc is a real-time collaborative commercial alternative to JupyterHub and Overleaf that provides Jupyter Notebooks, LaTeX documents, and SageMath.

| Download

Aaron Tresham Calculus Materials - Feb 2018 snapshot

Views: 8489
This material was developed by Aaron Tresham at the University of Hawaii at Hilo and is Creative Commons License
licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Prerequisites:

  • Intro to Sage

  • Sequences

Infinite Series

An infinite series is simply an infinite sum of numbers.

Example 1

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

1+12+13+14++1n+1+\frac{1}{2}+\frac{1}{3}+\frac{1}{4}+\cdots+\frac{1}{n}+\cdots

This may be written with summation notation as n=11n\sum_{n=1}^{\infty}\frac{1}{n}

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

Example 2

19=0.11111=110+1102+1103++110n+=n=1110n\frac{1}{9}=0.11111\ldots=\frac{1}{10}+\frac{1}{10^2}+\frac{1}{10^3}+\cdots+\frac{1}{10^n}+\cdots=\sum_{n=1}^{\infty}\frac{1}{10^n}

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, n=1an\displaystyle\sum_{n=1}^{\infty}a_n diverges if limnan0\displaystyle\lim_{n\to\infty}a_n\ne0.

On the other hand, if limnan=0\displaystyle\lim_{n\to\infty}a_n=0, this is no guarantee that n=1an\displaystyle\sum_{n=1}^{\infty}a_n converges.

Example 3

Even though limn1n=0\displaystyle\lim_{n\to\infty}\frac{1}{n}=0, 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 1+12+13+14++1n+1+\frac{1}{2}+\frac{1}{3}+\frac{1}{4}+\cdots+\frac{1}{n}+\cdots

Replace 11 with 12\frac{1}{2}, replace 13\frac{1}{3} with 14\frac{1}{4}, replace each of 15\frac{1}{5}, 16\frac{1}{6}, and 17\frac{1}{7} with 18\frac{1}{8}, and so on. What you get is the smaller series

12+12+14+14+18+18+18+18+\frac{1}{2}+\frac{1}{2}+\frac{1}{4}+\frac{1}{4}+\frac{1}{8}+\frac{1}{8}+\frac{1}{8}+\frac{1}{8}+\cdots=12+12+(14+14)+(18+18+18+18)+=\frac{1}{2}+\frac{1}{2}+\left(\frac{1}{4}+\frac{1}{4}\right)+\left(\frac{1}{8}+\frac{1}{8}+\frac{1}{8}+\frac{1}{8}\right)+\cdots=12+12+12+12+=\frac{1}{2}+\frac{1}{2}+\frac{1}{2}+\frac{1}{2}+\cdots

This series diverges, since limn12=120\displaystyle\lim_{n\to\infty}\frac{1}{2}=\frac{1}{2}\ne0.

Compare this result with this convergent series:

n=11n2=π261.64493406684823\sum_{n=1}^{\infty}\frac{1}{n^2}=\frac{\pi^2}{6}\approx1.64493406684823


[Side note: compare this to the improper integrals 11xdx\displaystyle\int_1^{\infty}\frac{1}{x}\, dx (divergent) and 11x2dx\displaystyle\int_1^{\infty}\frac{1}{x^2}\, dx (convergent). Actually, each series is a Riemann sum for the corresponding integral.]

Partial Sums

Given a series n=1an\displaystyle\sum_{n=1}^{\infty}a_n, we define a sequence {Sn}\{S_n\} as follows:

Sn=i=1nai(add up the first n terms of the series)S_n=\sum_{i=1}^na_i \quad \mathrm{(add\ up\ the\ first\ n\ terms\ of\ the\ series)}

SnS_n is called the nth partial sum of the series.

Example 4

Find the 10th and 20th partial sums of the series n=12n+13n2+9\displaystyle\sum_{n=1}^{\infty}\frac{2n+1}{3n^2+9}.

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).

%var n sum((2*n+1)/(3*n^2+9),n,1,10) N(_)
28771121/20454564 1.40658686247236

Here is the 20th partial sum.

sum((2*n+1)/(3*n^2+9),n,1,20) N(_)
12139706620041946362/6522879694663705009 1.86109620111088

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


If limnSn\displaystyle\lim_{n\to\infty}S_n exists, then we say the series converges (or is convergent), and we define the sum of the series to be this limit; that is, n=1an=limnSn\sum_{n=1}^{\infty}a_n=\lim_{n\to\infty}S_n


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 n=12n+13n2+9\displaystyle\sum_{n=1}^{\infty}\frac{2n+1}{3n^2+9}.

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.

sum((2*n+1)/(3*n^2+9),n,1,Infinity)
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.

Example 5

Consider the series n=11n\displaystyle\sum_{n=1}^{\infty}\frac{1}{n}.

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.

sum(1/n,n,1,Infinity)
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.

Example 6

Consider the series n=11n2\displaystyle\sum_{n=1}^{\infty}\frac{1}{n^2}.

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 π261.64493406684823\frac{\pi^2}{6}\approx1.64493406684823).

Here is the answer from Sage.

%var n sum(1/n^2,n,1,Infinity)
1/6*pi^2

Geometric Series

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, n=1an\displaystyle\sum_{n=1}^{\infty}a_n is a geometric series, if there exists a constant rr such that r=an+1an\displaystyle r=\frac{a_{n+1}}{a_n} for all n1n\ge1.

In general, a geometric series has the form n=0arn=a+ar+ar2+ar3+\sum_{n=0}^{\infty}a\cdot r^n=a+a\cdot r+a\cdot r^2+a\cdot r^3+\cdots

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

Example 7

Consider the geometric series n=012n\displaystyle\sum_{n=0}^{\infty}\frac{1}{2^n}. 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 nn\to\infty, the partial sums approach 22.

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

Sum of a Geometric Series

In general, if 1<r<1-1< r < 1, then n=0arn=a1r\displaystyle\sum_{n=0}^{\infty}a\cdot r^n=\frac{a}{1-r}.

If r1r \le -1 or r1r \ge 1, then this series diverges.


[Note: the index must start at 0 for this formula. You can also think of it as first term1common ratio\displaystyle\frac{\text{first term}}{1-\text{common ratio}}, and then the index does not matter.]

Example 8

n=035n=3115=154\displaystyle\sum_{n=0}^{\infty}\frac{3}{5^n}=\frac{3}{1-\frac{1}{5}}=\frac{15}{4} (geometric series with a=3a=3 and r=15r=\frac{1}{5})

Here's the answer from Sage.

%var n sum(3/5^n,n,0,+Infinity)
15/4

Example 9

n=03n5n=1135=52\displaystyle\sum_{n=0}^{\infty}\frac{3^n}{5^n}=\frac{1}{1-\frac{3}{5}}=\frac{5}{2} (geometric series with a=1a=1 and r=35r=\frac{3}{5})

Here's the answer from Sage.

%var n sum(3^n/5^n,n,0,+Infinity)
5/2

Example 10

Find the sum of the geometric series 13+215+475+\displaystyle \frac{1}{3}+\frac{2}{15}+\frac{4}{75}+\cdots.

In this case, a=13a=\frac{1}{3} (first term) and r=25r=\frac{2}{5} (common ratio =2/151/3=4/752/15=\frac{2/15}{1/3}=\frac{4/75}{2/15}, etc.).


So the sum is 1/312/5=59\displaystyle\frac{1/3}{1-2/5}=\frac{5}{9}.

Here's the answer from Sage.

sum(1/3*(2/5)^n,n,0,+Infinity)
5/9
1/3/(1-2/5)
5/9

Example 11

Let's explore the series n=ian\displaystyle\sum_{n=i}^{\infty}a_n using Sage.

Try things like 1n, 1n2, .9n, .99n, .999n\displaystyle\frac{1}{n},\ \frac{1}{n^2},\ .9^n,\ .99^n,\ .999^n, etc.

Interact: please open in CoCalc