# Chapter12- Algebric systems¶

## Ex12.4 Pg 365¶

In [1]:
from numpy import mat
a=(8-4)-3
b=8-(4-3)
print 'since a and b are not equal so subtraction is non-commutative on Z(set of integers)'

a=mat([[1, 2],[3, 4]])
b=mat([[5 ,6],[0, -2]])
g= a*b
k= b*a
print 'since g and k are not equal matrix multiplication is non-commutative'

h=(2**2)**3
j=2**(2**3)
print 'since h and j are not equal so exponential operation is non associative on the set of positive integers N'

since a and b are not equal so subtraction is non-commutative on Z(set of integers)
since g and k are not equal matrix multiplication is non-commutative
since h and j are not equal so exponential operation is non associative on the set of positive integers N


## Ex12.17 Pg 380¶

In [2]:
from sympy import symbols, solve
t=symbols('t')
f=t**3+t**2-8*t+4
r=solve(f,t)
print 'roots of f(t) are as follows:'
for r in r:
print r

roots of f(t) are as follows:
2
-3/2 + sqrt(17)/2
-sqrt(17)/2 - 3/2


## Ex12.18 Pg 382¶

In [3]:
from sympy import symbols, solve
t=symbols('t')
h=t**4-2*t**3+11*t-10
r=solve(h,t)
print 'the real roots of h(t) are 1 and -2'
for r in r:
print r

t=symbols('t')
f=t**4-3*t**3+6*t**2+25*t-39
r=solve(f,t)
print '\nroots of f(t) are as follows:'
for r in r:
print r

the real roots of h(t) are 1 and -2
-2
1
3/2 - sqrt(11)*I/2
3/2 + sqrt(11)*I/2

roots of f(t) are as follows:
-1/2 + sqrt(13)/2
2 - 3*I
2 + 3*I
-sqrt(13)/2 - 1/2