为什么Mathematica和Matlab对于同一矩阵产生不同的归一化特征向量?

问题描述 投票:0回答:1

我编写了以下Mathematica代码来计算H0的归一化特征值:

    H0 = {{2., 0, 0, 0, 0, 0, 0, 0}, {0, 5, 0, 0, 8, 0, 0, 0}, {0, 0, 72.,
     0, 22, 0, 0, 0}, {0, 0, 0, 34, 0, 7, 74, 0}, {0, 4, 3, 0, 0, 0, 
    0, 0}, {0, 0, 0, 0, 0, 58, 0, 0}, {0, 0, 0, 77., 0, 0, 13, 0}, {0,
     0, 0, 0, 0, 0, 0, 54}};

Simplify[Normalize /@ Eigenvectors[H0]]   // MatrixForm

我得到了以下特征向量:

    {{0., 0., 0., 0.74774, 0., 0., 0.663992, 0.}, {0., 0.00487434, 
  0.999132, 0., 0.0413777, 0., 0., 0.}, {0., 0., 0., -0.0675965, 0., 
  0.990986, -0.115665, 0.}, {0., 0., 0., 0., 0., 0., 0., 1.}, {0., 0.,
   0., 0.649149, 0., 0., -0.760661, 0.}, {0., 0.912332, -0.13384, 0., 
  0.38696, 0., 0., 0.}, {0., 0.636919, 0.213575, 0., -0.740756, 0., 
  0., 0.}, {1., 0., 0., 0., 0., 0., 0., 0.}}

另一方面,Matlab产生不同的归一化特征向量。我用过:

H0=[2,0,0,0,0,0,0,0;0,5,0,0,8,0,0,0;0,0,72,0,22,0,0,0;0,0,0,34,0,7,74,0;0,4,3,0,0,0,0,0;0,0,0,0,0,58,0,0;0,0,0,77,0,0,13,0;0,0,0,0,0,0,0,54];
[V,E] = eig(H0)

我的代码有什么错误吗?

matlab wolfram-mathematica normalization eigenvector
1个回答
0
投票

差异是由于Matlab代码使用精确值而WL代码没有使用精确值。例如22.

Simplify[Normalize /@ Eigenvectors[Rationalize@H0]]

enter image description here

数值

Simplify[Normalize /@ Eigenvectors[Rationalize@H0]] // N

(*
{{0., 0., 0., 0.74774, 0., 0., 0.663992, 0.}, {0., 0.00487434, 
  0.999132, 0., 0.0413777, 0., 0., 0.}, {0., 0., 0., 0.0675965, 
  0., -0.990986, 0.115665, 0.}, {0., 0., 0., 0., 0., 0., 0., 1.}, {0.,
   0., 0., -0.649149, 0., 0., 0.760661, 0.}, {0., 0.912332, -0.13384, 
  0., 0.38696, 0., 0., 0.}, {0., -0.636919, -0.213575, 0., 0.740756, 
  0., 0., 0.}, {1., 0., 0., 0., 0., 0., 0., 0.}}
*)
© www.soinside.com 2019 - 2024. All rights reserved.