我查看了给定矩阵的特征向量矩阵,但是当我尝试对其求逆时,我在eigenvector_matrix_inv()
.
require 'matrix'
m = Matrix[ [0.5703125, 1.8369140625, 0.0, 0.0],
[-0.6875, -0.4609375, 0.0, 0.0],
[0.0, 0.0, -2.1796875, 8.7119140625],
[0.0, 0.0, -0.6875, 2.2890625] ]
meigen = m.eigen.eigenvector_matrix
meiveni = m.eigen.eigenvector_matrix_inv
# .../matrix.rb:930:in `block in inverse_from': Not Regular Matrix (ExceptionForMatrix::ErrNotRegular)
它不应该是单数,如检查Mathematica
:
mruby = {{0.5703125, 1.8369140625, 0.0, 0.0}, {-0.6875, -0.4609375,
0.0, 0.0}, {0.0, 0.0, -2.1796875, 8.7119140625}, {0.0,
0.0, -0.6875, 2.2890625}};
Inverse[Eigenvectors[mruby]]
给予
{{0.586146 - 0.302685 I, 0.586146 + 0.302685 I, 0. + 0. I,
0. + 0. I}, {0. - 1.07831 I, 0. + 1.07831 I, 0. + 0. I,
0. + 0. I}, {0. + 0. I, 0. + 0. I, 0.519354 + 1.16217 I,
0.519354 - 1.16217 I}, {0. + 0. I, 0. + 0. I, 0. - 4.53135 I,
0. + 4.53135 I}}
我究竟做错了什么 ?
我应该特别注意 Ruby 中的一些特殊内容吗?