Chapter 21 Series

Example 21_1 pgno:256

In [13]:
#ex(1) 7,13,19,25....
common_diff=19-13
print 6
#ex(2) 6,4,2,0,-2
common_diff=2-4
print -2
6
-2

Example 21_2 pgno:256

In [14]:
#ex(1) in the series 7,10,13,.... the common difference is 3. 10th trerm is ?
nth_term=('7+(n-1)*3')
term10=7+(10-1)*3
#ex(2) i the series 6,2,-2,-6,....and d=-4
nth_term=('6-(n-1)*4')
term8=6+(8-1)*-4
print term8
 
-22

Example 21_3 pgno:256

In [19]:
#insert 3 A.M's between 4 and 20

#let 4,a,b,c,20 are in A.P. using, l=a+(n-1)*d
d=(20-4)/(5-1);
a=4+d;
b=a+d;
c=b+d;
print("the five terms are 4,     ,20",a,b,c)
('the five terms are 4,     ,20', 8, 12, 16)

Example 21_4 pgno:258

In [15]:
#sum of A.P of 8 terms is 90.1st term is 6.

# using s=n*{2*a+(n-1)*d}/2 
#substituting given values
d=0;
for d in range(0,100):
  if(90==8/2*(2*6 + (8-1)*d)):
  	print d
print 'd=1.5'
d=1.5

Example 21_5 pgno:259

In [4]:
import numpy
# using s=n*{2*a+(n-1)*d}/2 
a=3;d=3;s=135;
#substituting given values
n=('n');
p='n/2*(6 + (n-1)*3)-135';
#n=numpy.roots(p)
print("\n As root -10 is inadmissible, the solution is n=9")
 
 As root -10 is inadmissible, the solution is n=9

Example 21_6 pgno:261

In [6]:
#ex(1).1,2,4,8,...
commom_ratio=4/2
#ex(2). 1,1/2,1/4,1/8,....
common_ratio=(1./4.)/(1./2.)
#ex(3). 2,-6,18,-54
common_ratio=-6/2
#ex(4). R,R^2,R^3,R^4....
R=('R');
common_ratio='R**2/R'
print 'common_ratio',R
common_ratio R

Example 21_7 pgno:262

In [1]:
#7th term of the series 3,6,12,....

#in the series r=2, so using the formula
# nth term=a*r^(n-1) 
a=3;n=7;#given data
term7=3*(2)**(7-1);
print"\n the seventh term of the series is ",term7
 the seventh term of the series is  192

Example 21_8 pgno:262

In [2]:
#8th term of the series 2,-6,18,-54,......

#in the series r=-3, so using the formula
# nth term=a*r^(n-1) 
a=2;n=8;#given data
term8=2*(-3)**(8-1);
print("\n the eighth term of the series is ",term8)
 
('\n the eighth term of the series is ', -4374)

Example 21_9 pgno:262

In [3]:
#5th term of the series.1st term is 100 and common ratio(r) is 0.63

# using the formula
#nth term=a*r^(n-1) 
a=100;n=0.63;#given data
print"\n the fifth term of the series is \n"

term5=100*0.63**(5-1)
print term5
#3rd term of G.P is 4.5 and 9th is 16.2
 the fifth term of the series is 

15.752961

Example 21_10 pgno:263

In [5]:
# nth term=a*r^(n-1)
term3=4.5;#given data
#'a*r^(3-1)=4.5  ---equ(1)'
term9=16.2;#given
#'a*r^(9-1)=16.2 ---equ(2)'
print("\n the common ratio is :\n");

r=(16.2/4.5)**(1./6.)#equ(2)/equ(1)
print round(r,3)
 the common ratio is :

1.238

Example 21_11 pgno:265

In [6]:
#sum of 7 terms of the series 2,3,4,5,....

r=3./2.;a=2.;n=7.;#given
#using the formula
S=a*(r**(n)-1)/(r-1)
print ("substituting the given values ")

print round(S,1)
substituting the given values 
64.34375

Example 21_12 pgno:265

In [7]:
#sum of 7 terms of the series 4,-8,16,....

r=-8./4.;a=4;n=7;#given
#using the formula
S=a*(r**(n)-1)/(r-1)
#substituting the values 
print S
172.0

Example 21_13 pgno:270

In [10]:
#sum to infinity series 2 + 1/2 + 1/8 + ......

a=2;r=1./4.;#given
#using the formula
S_infinity=a/(1-r)
print round(S_infinity,2)
2.67

Example 21_14 pgno:270

In [12]:
#sum to infinity series 5 - 1 + 1/5 - ......

a=5;r=-1./5.;#given
#using the formula
S_infinity=a/(1-r)
print round(S_infinity,2)
4.17