Eigen values

TO solve a function that takes two input A and B in which A represent coefficient and B represents the respective right hand values and returns the solution array

Python code:

from scipy import linalg
import numpy as np
a = ([[3,2,0],[1,-1,0],[0,5,1]])
b = ([2,4,-1])
x = linalg.solve(a,b)
print(x)
Output:
[ 2. -2.  9.]
from scipy import linalg
import numpy as np
A = np.array([[1,2],[3,4]])
x = linalg.det(A)
print("determinant of A:",x)
Output:
determinant of A: -2.0
from scipy import linalg
import numpy as np
A = np.array([[1,2],[3,4]])
l,v=linalg.eig(A)
print("eigen values:")
print(l)
print("eigen vectors:")
print(v)
Output:
eigen values:
[-0.37228132+0.j  5.37228132+0.j]
eigen vectors:
[[-0.82456484 -0.41597356]
 [ 0.56576746 -0.90937671]]


from scipy import linalg
import numpy as np
a = np.random.randn(3,2)+1.j*np.random.randn(3,2)
U,S,Vh = linalg.svd(a)
print(U,Vh,S)
[[ 0.077977  +0.05411598j -0.77019965-0.39853945j -0.4406608 -0.21158427j]
 [-0.31303172+0.49822701j -0.35071814+0.26303478j  0.5632886 -0.3798637j ]
 [ 0.68816976-0.41375647j -0.23602533-0.0077673j   0.53815934-0.09921794j]] [[ 0.8028028 +0.j         -0.30462668-0.51255268j]
 [ 0.59624463+0.j          0.41015908+0.69011728j]] [3.05464529 2.79889948]