fork download
  1. import scipy as np
  2. from scipy import linalg
  3. a=np.matrix([[1,2],[2,1]])
  4. e=np.linalg.eig(a)
  5. print(np.dot(np.dot(e[1], np.diag(e[0])), e[1].T)) #ok
  6. print(np.dot(np.dot(e[1], np.matrix([[4,3],[3,4]])), e[1].T))
  7. print(np.dot(e[1], np.dot(np.matrix([[4,3],[3,4]]), e[1].T)))# not ok
  8. print(np.dot(e[1], e[1].T))# ok
  9. print(np.dot(e[1].T, e[1]))# ok
  10. print(np.dot(e[1].T, np.dot(a, e[1])))# not ok
  11.  
Success #stdin #stdout 0.13s 135680KB
stdin
Standard input is empty
stdout
[[ 1.+0.j  2.+0.j]
 [ 2.+0.j  1.+0.j]]
[[  1.00000000e+00   1.05471187e-15]
 [  8.88178420e-16   7.00000000e+00]]
[[  1.00000000e+00   8.88178420e-16]
 [  1.05471187e-15   7.00000000e+00]]
[[ 1.  0.]
 [ 0.  1.]]
[[ 1.  0.]
 [ 0.  1.]]
[[  3.00000000e+00   6.10622664e-16]
 [  4.44089210e-16  -1.00000000e+00]]