I have two matrixes with values differs only slightly
CloudGet["https://www.wolframcloud.com/objects/6cfbdce0-d7d4-4999-abd1-6a4c2db3bccf"];
CloudGet["https://www.wolframcloud.com/objects/299385d7-3f6f-4571-877e-e05313aa31f1"];
Hls1 - Hls2 // Flatten // Abs // Max
(* 5.46584*10^-10 *)
but EigenSystem gives large difference.
Eigensystem[Hls1] - Eigensystem[Hls2] // Flatten // Abs // Max
(* 1.99918 *)
While Matlab seems to give reasonable close results (MATLink package by Szabolcs is here).
Needs["MATLink`"]
OpenMATLAB[]
MSet["Hls1", Hls1]
MSet["Hls2", Hls2]
MEvaluate["[V1,D1] = eig(Hls1)"];
MEvaluate["[V2,D2] = eig(Hls2)"];
MEvaluate["max(max(abs(D1-D2)))"]
(* ">>
ans =
1.0851e-09
" *)
MEvaluate["max(max(abs(V1-V2)))"]
(* ">>
ans =
8.0894e-06
" *)
It appears that both values of the eigensystem for the two matrixes are correct, but there is a phase jump in the eigenvectors. So why is there this phase jump? Does Mathematica use two different methods on the two matrixes?
Note that we can always manually correct the phase by setting a convention, but sometimes this is tedious and time consuming, if one only requires the consistence of the phase.