Chapter 9 : Infinite Series

Example 9.1, page no. 302

In [4]:
import numpy,sympy

n = sympy.Symbol('n')
f = ((1/n)**2-2*(1/n))/(3*(1/n)**2+(1/n))
print sympy.limit(f,n,0)
1/3

Example 9.1.3, page no. 303

In [17]:
import sympy
n = sympy.Symbol('n')
f = 3+(-1)**n
print sympy.limit(f,n,100)
4

Example 9.2.1, page no. 304

In [4]:
import numpy,sympy

n = sympy.Symbol('n')
print "1+2+3+4+5+6+7+....+n + . . . . . = ",
p = 1/n*(1/n+1)/2
print sympy.limit(p,n,0)
1+2+3+4+5+6+7+....+n + . . . . . =  oo

Example 9.2.2, page no. 304

In [5]:
print "5−4−1+5−4−1+5−4−1+5−4−1+.........=0,5,1 according to the no. of terms."
print "clearly, in this case sum doesnt tend to a unique limit. hence, series is oscillatory."
5−4−1+5−4−1+5−4−1+5−4−1+.........=0,5,1 according to the no. of terms.
clearly, in this case sum doesnt tend to a unique limit. hence, series is oscillatory.

Example 9.5.1, page no. 308

In [6]:
import numpy,sympy

n = sympy.Symbol('n')
v = 1/((1/n)**2)
u = (2/n-1)/(1/n*(1/n +1)*(1/n +2))
print sympy.limit(u/v,n,0)
print "both u and v converge and diverge together, hence u is convergent"
2
both u and v converge and diverge together, hence u is convergent

Example 9.5.2, page no. 308

In [7]:
import numpy,sympy

n = sympy.Symbol('n')
v = 1/((1/n)**2)
u = ((1/n)**2)/((3/n+1)*(3/n+4)*(3/n+7))
print sympy.limit(u/v,n,0)
print "both u and v converge and diverge together, hence u is divergent"
oo
both u and v converge and diverge together, hence u is divergent

Example 9.7.1, page no. 312

In [8]:
import numpy,sympy

n = sympy.Symbol('n')
print "u=((n+1)^0.5−1)/((n+2)^3−1)=>"
u = ((1+1/(1/n))-(1/n)**(-0.5))/(((1/n)**5/2)*((1+2/(1/n))**3-(1/n)**(-3)))
v = (1/n)**(-5/2)
print sympy.limit(u/v,n,0)
print 'since, v is convergent, so u is also conzavergent.'
u=((n+1)^0.5−1)/((n+2)^3−1)=>
0
since, v is convergent, so u is also conzavergent.

Example 9.7.3, page no. 313

In [11]:
import numpy,sympy

n = sympy.Symbol('n')
print sympy.integrate(1/(n*sympy.log(n)),(n,2,numpy.inf))
-log(log(2)) + +inf

Example 9.8.1, page no. 314

In [4]:
import numpy,sympy

n = sympy.Symbol('n')
x = sympy.Symbol('x')
u = (x**(2*(1/n)-2))/(((1/n)+1)*(1/n)**0.5)
v = (x**(2*(1/n)))/((1/n+2)*(1/n+1)**0.5)
print sympy.limit(u/v,n,0)
x**(-2)

Example 9.8.2, page no. 314

In [5]:
import numpy,sympy

n = sympy.Symbol('n')
x = sympy.Symbol('x')
u = ((2**(1/n)-2)*(x**(1/n-1)))/(2**(1/n)+1)
v = ((2**((1/n)+1)-2)*(x**(1/n)))/(2**(1/n+1)+1)
print sympy.limit(u/v,n,0)
1/x

Example 9.10.1, page no. 316

In [6]:
import numpy,sympy

n = sympy.Symbol('n')
x = sympy.Symbol('x')
u = 1/(1+x**(-n))
v = 1/(1+x**(-n-1))
print sympy.limit(u/v,n,0)
(x + 1)/(2*x)

Example 9.10.2, page no. 316

In [7]:
import numpy,sympy

n = sympy.Symbol('n')
a = sympy.Symbol('a')
b = sympy.Symbol('b')
l = (b+1/n)/(a+1/n)
print sympy.limit(l,n,0)
1

Example 9.11.1, page no. 317

In [9]:
import numpy,sympy

n = sympy.Symbol('n')
x = sympy.Symbol('x')
print "u=((4.7....(3n+1))∗xˆn)/(1.2.....n)"
print "v=((4.7....(3n+4)∗xˆ(n+1))/(1.2.....(n+1))"
print "l=u/v=>",
l = (1+n)/((3+4*n)*x)
print sympy.limit(l,n,0)
u=((4.7....(3n+1))∗xˆn)/(1.2.....n)
v=((4.7....(3n+4)∗xˆ(n+1))/(1.2.....(n+1))
l=u/v=> 1/(3*x)

Example 9.11.2, page no. 318

In [12]:
import numpy,sympy,math

n = sympy.Symbol('n')
x = sympy.Symbol('x')
u = (((sympy.factorial(n))**2)*x**(2*n))/sympy.factorial(2*n)
v = (((sympy.factorial(n+1))**2)*x**(2*(n+1)))/sympy.factorial(2*(n+1))
print sympy.limit(u/v,n,numpy.inf )
4/x**2