Professional Documents
Culture Documents
TOE
Pratiksha R Rodewad
5th semester Aerospace Engineering
IIST,Thiruvanthapuram
#python code to compute eigen values , and eigen vectors and for checking orthogonality of eigen vector
import numpy as np
import math
from CubicEquationSolver import *
R = int(input("Enter the number of rows:"))
C = int(input("Enter the number of columns:"))
1
m = (e*i - f*h) + (a*i - c*g) + (a*e - b*d)
n = a*(e*i - f*h) - b*(d*i - f*g) + c*(d*h - e*g)
eigen_values = solve(1,l,m,n)
eigen_values = -1 * np.array(eigen_values)
print(’eigen values(principal stresses) are’+str(eigen_values))
2
#print(’for eigen value=’+str(eigen_values[1])+’equation in p,q,r terms are’)
#print(str(h)+’q+(’+str(c)+’)r =(’+str(eigen_values[1]-a))
#print((str(e-eigen_values[1])+’q+(’+str(d)+’)r =(’+ str(d)))
#print(str(h)+’q+(’+str(i-(eigen_values[1]))+’r =(-’+str(g))
A=np.array([[h,c],[e-eigen_values[1],d]])
B=np.linalg.inv(A)
C=np.array([[eigen_values[1]-a],[-d]])
k=np.dot(B,C)
#print(’from the above euation we get q and r which are:’)
#print(np.dot(B,C))
o=1+k[0]*k[0]+k[1]*k[1]
#print(’values of p^2+q^2+r^2 is’)
#print(o)
l2=1/math.sqrt(o)
m2=k[0]/math.sqrt(o)
n2=k[1]/math.sqrt(o)
print(’l2,m2,n2 are eigen vector(v2) corresponding to ’+str(eigen_values[1])+’are’)
print(np.array([[l2],m2,n2]))
3
SAMPLE EXAMPLE
consider a A matrix=
2 −1 0
−1 2 −1
0 −1 2
4
result
stress tensor is matrix with all stress elements.
we consider the matrix A of 3 by 3 order and computed the eigen values , eigen vectors and checked the
orthogonality of eigen vectors.
figure.2 shows output of given matrix A
5
Bibliography