0% found this document useful (0 votes)
4 views6 pages

Ashin Assignment

Uploaded by

rmaha1908
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views6 pages

Ashin Assignment

Uploaded by

rmaha1908
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

print (" Eigen value and eigen vector by python

programming") print ("Ashin Balakrishnan")

print("September 30,

2024") #importing

necessary libraries import

numpy as np

from scipy import linalg as lg

#Defination (Matrix defination by numpy array

method) A= np.array(([4,7,5],[5,8,3],[7,2,1]))

B= np.array(([7,3,6],[2,4,8],[9,7,3]))

#Displaying the individual

matrices print ("A = ")

print("

") print

(A)

print("

")

print ("B = ")

print(" ")

print(B)

print(" ")

#operations

sum1 = A+B

print ("Sum:

")

print(" ")

print(sum1)
print(" ")

diff1 = A-B
print ("Difference:

") print(" ")

print(diff1)

print(" ")

print ("Transpose of the A :

") print(" ")

transpose_A=np.transpose(

A) print(transpose_A)

print(" ")

print ("Transpose of the B :

") print(" ")

transpose_B=np.transpose(

B) print(transpose_B)

print(" ")

print("Inverse of A

: ") print(" ")

inverse_A = np.linalg.inv(A)

print(inverse_A)

print(" ")

print("Inverse of B

: ") print(" ")

inverse_B = np.linalg.inv(B)

print(inverse_B)

print(" ")

eig_A = np.linalg.eig(A)

print("Eigenvectors of A: ")

print(" ")
print(eig_A)

eig_B = np.linalg.eig(B)

print("Eigenvectors of B: ")

print(" ")

print(eig_B)

Result:

Python 3.12.6 (tags/v3.12.6:a4a2d2b, Sep 6 2024, 20:11:23) [MSC v.1940


64 bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license()" for more information.

= RESTART: D:\python projects\1st class.py

Eigen value and eigen vector by python

programming Ashin Balakrishnan

September 30,

2024 A =

[[4 7 5]

[5 8 3]

[7 2 1]]

B=

[[7 3 6]

[2 4 8]

[9 7 3]]

Sum:
[[11 10 11]

[ 7 12 11]

[16 9 4]]

Difference:

[[-3 4 -1]

[ 3 4 -5]

[-2 -5 -2]]

Transpose of the A :

[[4 5 7]

[7 8 2]

[5 3 1]]

Transpose of the B :

[[7 2 9]

[3 4 7]

[6 8 3]]

Inverse of A :

[[-0.01818182 -0.02727273 0.17272727]

[-0.14545455 0.28181818 -0.11818182]

[ 0.41818182 -0.37272727 0.02727273]]


Inverse of B :

[[ 1.81818182e-01 -1.36363636e-01 -

2.46716228e-17] [-2.72727273e-01

1.36363636e-01 1.81818182e-01] [

9.09090909e-02 9.09090909e-02 -

9.09090909e-02]]

Eigenvectors of A:

EigResult(eigenvalues=array([14.67017715, -3.69788061, 2.02770346]),


eigenvectors=array([[-0.62706216, -0.56265603, 0.28279577],

[-0.65774728, 0.02861139, -0.60899774],

[-0.41732668, 0.82619585, 0.74104541]]))

Eigenvectors of B:

EigResult(eigenvalues=array([16.44923653, 2.80174721, -5.25098374]),


eigenvectors=array([[-0.57099933, -0.61404148, -0.22328059],

[-0.50677179, 0.78847901, -0.60953302],

[-0.6458654 , 0.03541072, 0.76066765]]))

You might also like