In: Computer Science
Adding the transpose and the original matrix will result in the original matrix*2.
All the functions are built into the numpy library.
CODE :
import numpy as np
My_arr = np.fromfunction(lambda m, n: m + n, (3, 3), dtype=int)
mean = np.mean(My_arr)
median = np.median(My_arr)
r = np.ptp(My_arr)
variance = np.var(My_arr)
print("Mean : ",mean," Median : ",median," Range : ",r," Variance :
",variance)
pinv = np.linalg.pinv(My_arr)
print("Pseudo-Inverse :\n ",pinv)
det = np.linalg.det(My_arr)
print("Determinant : ",det)
a1 = My_arr.flatten()
a2 = My_arr.transpose()
a3 = My_arr+a2
print("Flattened array : ",a1,"\nTranspose : \n",a2,"\n Transpose + My_arr :\n",a3)