Due Tuesday, Oct 20 at 1:00 pm

Lab III : Infinite Series

Determine if each series converges or diverges. Show your work!

Problem 1

$$\sum_{n=5}^{\infty} \frac{1}{n\left[ \ln(n) \right]^4}$$

In [94]:
import sympy as sp
from matplotlib import pyplot as plt

%matplotlib inline

# Customize figure size
plt.rcParams['figure.figsize'] = 25, 15
#plt.rcParams['lines.linewidth'] = 1
#plt.rcParams['lines.color'] = 'g'
#plt.rcParams['font.family'] = 'monospace'
plt.rcParams['font.size'] = '16.0'
plt.rcParams['font.monospace'] = 'Anonymous Pro, serif'
plt.rcParams['text.hinting'] = 'either'

print("Font size: {}".format( plt.rcParams['font.size'] ))
print("Font family: {}".format( plt.rcParams['font.family']) )
print("Monospace font config: {}".format( plt.rcParams['font.monospace']) )


# f(x) = 1/x --> Diverges
f = lambda x: 1/(x * sp.mpmath.log(x)**4)

sp.mpmath.plot([f], xlim=[0,5], ylim=[0,25], points=500)


Font size: 16.0
Font family: [u'monospace']
Monospace font config: [u'Anonymous Pro', u'serif']

Problem 2

$$\sum_{n=1}^{\infty} \frac{6}{5^n}$$

In [76]:
%matplotlib inline

# Customize figure size
plt.rcParams['figure.figsize'] = 25, 15
plt.rcParams['font.size'] = '14.0'

import numpy as np
import sympy as sp
from sympy.plotting import plot

# f(x) = 1/x --> Diverges
g = lambda x: 6/(5**x)

sp.mpmath.plot([g], xlim=[0,10], ylim=[0,3], points=2500)



In [19]:
# To check your work, use Sympy.mpmath.nsum()
# This gives the sum of the infinite series (if the series converges)
infty = sp.mpmath.inf
sum = sp.mpmath.nsum(g, [1, infty])
print('The sum of the series = {}'.format(sum))


The sum of the series = -9.82880444889338

Problem 3

$$\sum_{n=1}^{\infty} \frac{11^n}{10^n-5}$$

In [77]:
import sympy as sp
from matplotlib import pyplot as plt

%matplotlib inline

# Customize figure size
plt.rcParams['figure.figsize'] = 25, 15
plt.rcParams['font.size'] = '14.0'

# f(x) = 1/x --> Diverges
h = lambda x: (11**x)/((10**x)-5)

sp.mpmath.plot([h], xlim=[0,2], ylim=[0,30], points=1500)



Problem 4

$$\sum_{n=1}^{\infty} \frac{3}{\sqrt[3]{n}}$$

In [78]:
import sympy as sp
from matplotlib import pyplot as plt

%matplotlib inline

# Customize figure size
plt.rcParams['figure.figsize'] = 25, 15
plt.rcParams['font.size'] = '14.0'

# f(x) = 1/x --> Diverges
a = lambda x: 3/sp.mpmath.cbrt(x)

sp.mpmath.plot([a], xlim=[-10,200], ylim=[0,5], points=1500)



In [45]:
# To check your work, use Sympy.mpmath.nsum()
# This gives the sum of the infinite series (if the series converges)
infty = sp.mpmath.inf
sum = sp.mpmath.nsum(a, [1, infty])
print('The sum of the series = {}'.format(sum))


The sum of the series = 124.401989403233

Problem 5

$$\sum_{n=7}^{\infty} \frac{\sqrt{n}}{n-5}$$

In [38]:
import sympy as sp
from matplotlib import pyplot as plt

%matplotlib inline

# Customize figure size
plt.rcParams['figure.figsize'] = 25, 15

# f(x) = 1/x --> Diverges
b = lambda x: sp.mpmath.sqrt(x)/(x-5)

sp.mpmath.plot([b], xlim=[-10,200], ylim=[0,5], points=1500)



Problem 6

$$\sum_{n=1}^{\infty} \frac{2n^2}{3n^2+5}$$

In [80]:
import sympy as sp
from matplotlib import pyplot as plt

%matplotlib inline

# Customize figure size
plt.rcParams['figure.figsize'] = 25, 15
plt.rcParams['font.size'] = '16.0'

# f(x) = 1/x --> Diverges
c = lambda x: (2*x**2)/((3*x**2)+5)

sp.mpmath.plot([c], xlim=[-1,10], ylim=[0,1], points=1500)



In [58]:
# To check your work, use Sympy.mpmath.nsum()
# This gives the sum of the infinite series (if the series converges)
infty = sp.mpmath.inf
sum = sp.mpmath.nsum(c, [1, infty])
print('The sum of the series = {}'.format(sum))


The sum of the series = 98.9879781601176

Problem 7

$$\sum_{n=6}^{\infty} \frac{e^n}{n^3}$$

In [81]:
import sympy as sp
import matplotlib.pyplot as plt

%matplotlib inline

# Customize figure size
plt.rcParams['figure.figsize'] = 25, 15
plt.rcParams['font.size'] = '16.0'

# f(x) = 1/x --> Diverges
d = lambda x: sp.mpmath.exp(x)/(x**3)

sp.mpmath.plot([d], xlim=[-1,40], ylim=[0,250000], points=1500)



In [68]:
print(sp.mpmath.exp(25))


72004899337.3859

In [69]:
print(25**3)


15625

In [70]:
print(sp.mpmath.exp(20)/(20**3))


60645.6494262238

In [75]:
for i in range(1, 30):
    numerator = sp.mpmath.exp(i)
    denominator = i**3
    
    print("Value of i = {}".format(i))
    print("The sum of e^i = {}".format(numerator))
    print("The sum of i^3 = {}".format(denominator))
    print("The quotient of e^i / i^3 = {}".format(numerator/denominator))
    print("-----------------------------------------------------")


Value of i = 1
The sum of e^i = 2.71828182845905
The sum of i^3 = 1
The quotient of e^i / i^3 = 2.71828182845905
-----------------------------------------------------
Value of i = 2
The sum of e^i = 7.38905609893065
The sum of i^3 = 8
The quotient of e^i / i^3 = 0.923632012366331
-----------------------------------------------------
Value of i = 3
The sum of e^i = 20.0855369231877
The sum of i^3 = 27
The quotient of e^i / i^3 = 0.743908774932877
-----------------------------------------------------
Value of i = 4
The sum of e^i = 54.5981500331442
The sum of i^3 = 64
The quotient of e^i / i^3 = 0.853096094267879
-----------------------------------------------------
Value of i = 5
The sum of e^i = 148.413159102577
The sum of i^3 = 125
The quotient of e^i / i^3 = 1.18730527282061
-----------------------------------------------------
Value of i = 6
The sum of e^i = 403.428793492735
The sum of i^3 = 216
The quotient of e^i / i^3 = 1.8677258957997
-----------------------------------------------------
Value of i = 7
The sum of e^i = 1096.63315842846
The sum of i^3 = 343
The quotient of e^i / i^3 = 3.19718121990804
-----------------------------------------------------
Value of i = 8
The sum of e^i = 2980.95798704173
The sum of i^3 = 512
The quotient of e^i / i^3 = 5.82218356844088
-----------------------------------------------------
Value of i = 9
The sum of e^i = 8103.08392757538
The sum of i^3 = 729
The quotient of e^i / i^3 = 11.1153414644381
-----------------------------------------------------
Value of i = 10
The sum of e^i = 22026.4657948067
The sum of i^3 = 1000
The quotient of e^i / i^3 = 22.0264657948067
-----------------------------------------------------
Value of i = 11
The sum of e^i = 59874.1417151978
The sum of i^3 = 1331
The quotient of e^i / i^3 = 44.9843288619067
-----------------------------------------------------
Value of i = 12
The sum of e^i = 162754.791419004
The sum of i^3 = 1728
The quotient of e^i / i^3 = 94.1868005897013
-----------------------------------------------------
Value of i = 13
The sum of e^i = 442413.39200892
The sum of i^3 = 2197
The quotient of e^i / i^3 = 201.371593995867
-----------------------------------------------------
Value of i = 14
The sum of e^i = 1202604.28416478
The sum of i^3 = 2744
The quotient of e^i / i^3 = 438.266867406989
-----------------------------------------------------
Value of i = 15
The sum of e^i = 3269017.37247211
The sum of i^3 = 3375
The quotient of e^i / i^3 = 968.597739991736
-----------------------------------------------------
Value of i = 16
The sum of e^i = 8886110.52050787
The sum of i^3 = 4096
The quotient of e^i / i^3 = 2169.46057629587
-----------------------------------------------------
Value of i = 17
The sum of e^i = 24154952.7535753
The sum of i^3 = 4913
The quotient of e^i / i^3 = 4916.53831743849
-----------------------------------------------------
Value of i = 18
The sum of e^i = 65659969.1373305
The sum of i^3 = 5832
The quotient of e^i / i^3 = 11258.5680962501
-----------------------------------------------------
Value of i = 19
The sum of e^i = 178482300.963187
The sum of i^3 = 6859
The quotient of e^i / i^3 = 26021.621368011
-----------------------------------------------------
Value of i = 20
The sum of e^i = 485165195.40979
The sum of i^3 = 8000
The quotient of e^i / i^3 = 60645.6494262238
-----------------------------------------------------
Value of i = 21
The sum of e^i = 1318815734.48321
The sum of i^3 = 9261
The quotient of e^i / i^3 = 142405.327122688
-----------------------------------------------------
Value of i = 22
The sum of e^i = 3584912846.13159
The sum of i^3 = 10648
The quotient of e^i / i^3 = 336674.760155108
-----------------------------------------------------
Value of i = 23
The sum of e^i = 9744803446.2489
The sum of i^3 = 12167
The quotient of e^i / i^3 = 800920.805970979
-----------------------------------------------------
Value of i = 24
The sum of e^i = 26489122129.8435
The sum of i^3 = 13824
The quotient of e^i / i^3 = 1916169.13555002
-----------------------------------------------------
Value of i = 25
The sum of e^i = 72004899337.3859
The sum of i^3 = 15625
The quotient of e^i / i^3 = 4608313.5575927
-----------------------------------------------------
Value of i = 26
The sum of e^i = 195729609428.839
The sum of i^3 = 17576
The quotient of e^i / i^3 = 11136186.2442444
-----------------------------------------------------
Value of i = 27
The sum of e^i = 532048240601.799
The sum of i^3 = 19683
The quotient of e^i / i^3 = 27030851.0187369
-----------------------------------------------------
Value of i = 28
The sum of e^i = 1446257064291.48
The sum of i^3 = 21952
The quotient of e^i / i^3 = 65882701.5438901
-----------------------------------------------------
Value of i = 29
The sum of e^i = 3931334297144.04
The sum of i^3 = 24389
The quotient of e^i / i^3 = 161192927.022184
-----------------------------------------------------

In [76]:
# To check your work, use Sympy.mpmath.nsum()
# This gives the sum of the infinite series (if the series converges)
infty = sp.mpmath.inf
sum = sp.mpmath.nsum(d, [1, infty])
print('The sum of the series = {}'.format(sum))


The sum of the series = 11.5178362483214

Problem 8

$$\sum_{n=6}^{\infty} \frac{n^3}{e^n}$$

In [82]:
import sympy as sp
import matplotlib.pyplot as plt
%matplotlib inline

%matplotlib inline

# Customize figure size
plt.rcParams['figure.figsize'] = 25, 15
plt.rcParams['font.size'] = '16.0'

# f(x) = 1/x --> Diverges
r = lambda x: (x**3)/sp.mpmath.exp(x)


sp.mpmath.plot([r], xlim=[-5,25], ylim=[0,1.5], points=1500)



In [78]:
# To check your work, use Sympy.mpmath.nsum()
# This gives the sum of the infinite series (if the series converges)
infty = sp.mpmath.inf
sum = sp.mpmath.nsum(r, [1, infty])
print('The sum of the series = {}'.format(sum))


The sum of the series = 124.401989403233

In [87]:
import matplotlib.pyplot as plt
%matplotlib inline

print("Current text.hinting settings are: {}".format(plt.rcParams['text.hinting']))
print("Current font settings:")
print("Font size: {}".format(plt.rcParams['font.size']))
print("Font family: {}".format(plt.rcParams['font.family']))


Current text.hinting settings are: either
Current font settings:
Font size: 10.0
Font family: [u'monospace']

In [ ]: