Python Code
Python Code
import numpy as np
# create numpy 3d-array
rows_a = int(input("Enter the Number of rows for the first matrix: " ))
column_a = int(input("Enter the Number of Columns for the first matrix: "))
print("Enter the elements of First Matrix:")
matrix_a= [[int(input()) for i in range(column_a)] for i in range(rows_a)]
print("First Matrix is: ")
for n in matrix_a:
print(n)
# finding eigenvalues and eigenvectors
w,v2=np.linalg.eig(matrix_a)
# printing eigen values
print("Printing the Eigen values of the given square array:\n", w)
# printing eigen vectors
print("Printing Right eigen vectors of the given square array:\n", v2)
if z==1:
le=l
Pcr=(3.14*3.14*e*I*pow(10,-12))/(le*le)
Pc= cs*A*pow(10,-6)
Pr=(cs*A*pow(10,-6))/(1+a*pow(le/K,2)*pow(10,6))
elif z==2:
le=2*l
Pcr=(3.14*e*I*pow(10,-12))/(le*le)
Pc=cs*A*pow(10,-6)
Pr=(cs*A*pow(10,-6))/(1+a*pow(le/K,2)*pow(10,6))
elif z==3:
le=l/2
Pcr=(3.14*e*I*pow(10,-12))/(le*le)
Pc=cs*A*pow(10,-6)
Pr=(cs*A*pow(10,-6))/(1+a*pow(le/K,2)*pow(10,6))
elif z==4:
le=l/1.414
Pcr=(3.14*e*I*pow(10,-12))/(le*le)
Pc=cs*A*pow(10,-6)
Pr=(cs*A*pow(10,-6))/(1+a*pow(le/K,2))
dis_form = b * b - 4 * a * c
sqrt_val = math.sqrt(abs(dis_form))
if dis_form > 0:
print(" real and different roots ")
print((-b + sqrt_val) / (2 * a))
print((-b - sqrt_val) / (2 * a))
elif dis_form == 0:
print(" real and same roots")
print(-b / (2 * a))
else:
print("Complex Roots")
print(- b / (2 * a), " + i", sqrt_val)
print(- b / (2 * a), " - i", sqrt_val)
a = int(input('Enter a:'))
b = int(input('Enter b:'))
c = int(input('Enter c:'))
else:
findRoots(a, b, c)