numerical error in eig command

6 ビュー (過去 30 日間)
H Sadeghi
H Sadeghi 2015 年 7 月 10 日
コメント済み: H Sadeghi 2015 年 7 月 10 日
If you calculate the eigenvalue of A = [0 1; 0 0], using [Evec, Eval] = eig(A), Matlab will return the answer as:
EVec =
1.0000 -1.0000
0 0.0000
Eval =
0 0
0 0
However this is not correct mathematically. Mathematically, this problem has one eigenvalue Eval = 0 and one eigenvector Evec = [1 0]. The calculated eigenvectors by Matlab are not independent eigenvectors as Evec(:,1) = -Evec(:,2).
If you print the data with longer format, "format longe", the answer is :
EVec =
1.000000000000000e+00 -1.000000000000000e+00
0 2.004168360008973e-292
Eval =
0 0
0 0
It seems that because of the numerical error, Matlab assumes Evec(:,1) and Evec(:,2) as two independent eigenvector! Anyway, this is numerical error.
How could you make sure that in your code where the eigenvalue problem on a matrix with many zeros is the central bit, Matlab does not compute the eigenvectors and eigenvalues incorrectly due to the numerical error?

採用された回答

Roger Stafford
Roger Stafford 2015 年 7 月 10 日
While it is quite true that in an ideal mathematical sense the eigenvectors of your matrix A ought to be linearly dependent, you must face the fact that you are using a computer which is subject to round-off errors because it has only a finite number of bits to represent its numbers. For that reason you obtained two vectors which are, strictly speaking, linearly independent because of a very tiny error.
Therefore in your code you must provide a tolerance for such tiny errors rather than expecting your computer to give you mathematically perfect results. This is entirely analogous to the computation .1+.2-.3 which doesn't yield an exact zero.
  1 件のコメント
H Sadeghi
H Sadeghi 2015 年 7 月 10 日
Thanks for your reply. I agree. However, if you have a matrix with 6000x6000 elements and solve the eigenvalue problem, depending on the algorithm used, finding and eliminating dependent eigenvectors and corresponding eigenvalues could be extremely time consuming. Is there any function/command in Matlab that does this comparison for a given tolerance in the efficient way?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by