Chapter 11 Factors

Example 11_1 pgno:128

In [28]:
#factors of 6a^2 + 3ac
print ('6*a^2+3*a*c ')
print('=> 3a(2a+c)')
6*a^2+3*a*c 
=> 3a(2a+c)

Example 11_2 pgno:128

In [29]:
#5*x^2*y^2-10*x^2*y+20*y^2

print"\n the highest common factor to each term is 5 and other factor is y \n"
print('5y(x^2y-2x^2+4y)')
 the highest common factor to each term is 5 and other factor is y 

5y(x^2y-2x^2+4y)

Example 11_3 pgno:129

In [30]:
#factors of a^2+cd+ad+ac

print(" \n (a^2+ac)+(ad+cd) => a(a+c)+d(a+d)  \n")
print("the factors are:")
print('(a+c)(a+d)')
 
 (a^2+ac)+(ad+cd) => a(a+c)+d(a+d)  

the factors are:
(a+c)(a+d)

Example 11_4 pgno:130

In [31]:
#factorize, if possible,ab+ac+bc+bd

print("\n there are no factors of this expression")
 there are no factors of this expression

Example 11_5 pgno:130

In [32]:
#factors of ab-5a-3b+15

#by arrangement into suitable pairs,
print("(ab-5a)-(3b-15) => a(b-5)-3(b-5)")
print("\n the factors are: \n")
print('(b-5)(a-3)')
(ab-5a)-(3b-15) => a(b-5)-3(b-5)

 the factors are: 

(b-5)(a-3)

Example 11_6 pgno:131

In [33]:
#x^2+13*x+36
import numpy

#x^2+13*x+36;
p=numpy.array([1, 13, 36])
x=numpy.roots(p)
print x
[-9. -4.]

Example 11_7 pgno:131

In [34]:
#x^2-13*x+36
import numpy
p=numpy.array([1, -13, 36])
x=numpy.roots(p)
print x
[ 9.  4.]

Example 11_8 pgno:132

In [35]:
#y^2-13*y+30
import numpy

p=numpy.array([1, -13, 30]);
y=numpy.roots(p)
print y
[ 10.   3.]

Example 11_9 pgno:132

In [8]:
#x^2-5*x-36
import numpy
p=numpy.array([1, -5, -36])
x=numpy.roots(p)
print x
[ 9. -4.]

Example 11_10 pgno:132

In [36]:
#x^2+12*x-28
import numpy
p=numpy.array([1, 12, -28])
x=numpy.roots(p)
print x
[-14.   2.]

Example 11_11 pgno:132

In [37]:
#a^2-8*a*b-48*b^2
import numpy
p=numpy.array([1, -8, 48])
x=numpy.roots(p)
print x

print "the second letter b will appear in 1st term of each factor"
print "ans(1)=(4b+a)";                                    
print "ans(2)=(-12b+a)"
[ 4.+5.65685425j  4.-5.65685425j]
the second letter b will appear in 1st term of each factor
ans(1)=(4b+a)
ans(2)=(-12b+a)

Example 11_12 pgno:133

In [38]:
#2*x^2+7*x+3

import numpy
p=numpy.array([2, 7, 3])
x=numpy.roots(p)


print(x,"the factors of 2*x^2+7*x+3 are")
(array([-3. , -0.5]), 'the factors of 2*x^2+7*x+3 are')

Example 11_13 pgno:133

In [1]:
#6*x^2+17*x-3
import numpy
p=numpy.array([6, 17, -3])
x=numpy.roots(p)

#multiply by 6 the p1 factors to get the original factors of p
print "the factors of 6*x^2+17*x-3 are",x                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
the factors of 6*x^2+17*x-3 are [-3.          0.16666667]

Example 11_14 pgno:133

In [40]:
#4*x^2-17*x-15
import numpy
p=numpy.array([4, -17, -15])
x=numpy.roots(p)

print x,"the factors of 4*x^2-17*x-15 are"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
[ 5.   -0.75] the factors of 4*x^2-17*x-15 are

Example 11_15 pgno:136

In [41]:
#100*x^2-1
import numpy
p=numpy.array([100, 0, -1])
x=numpy.roots(p)
print x,"is the complete square of binomial"

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
[ 0.1 -0.1] is the complete square of binomial

Example 11_16 pgno:136

In [42]:
#36*a^2*b^2-25

#the numbers squared are 6ab and 5")
print ("36*a^2*b^2-25=(6ab+5)(6ab-5)") 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
36*a^2*b^2-25=(6ab+5)(6ab-5)

Example 11_17 pgno:136

In [43]:
#factorize (a+b)^2 - c^2

#using the formula, a^2-b^2=(a+b)(a-b)
print ('(a+b+c)(a+b-c)')
(a+b+c)(a+b-c)

Example 11_18 pgno:136

In [44]:
#factorize (a+b)^2 - (c-a)^2

#using the formula, a^2-b^2=(a+b)(a-b)
print ('(b+c)(2a+b-c)')
                                   
(b+c)(2a+b-c)

Example 11_19 pgno:136

In [47]:
print 47.5**2-22.5**2
1750.0

Example 11_20 pgno:136

In [48]:
#area of ring between 2 concentric circles.
#given,r1=97mm,r2=83mm

r1=97;r2=83;
#the area of ring is difference between the areas of 2 circles
diff_in_area=(r1**2-r2**2);
print"difference in area=pi mm**2",diff_in_area
difference in area=pi mm**2 2520