[U,V]=eig(A) , AU won't equal UV
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
steam086
am 19 Nov. 2019
Bearbeitet: Bhaskar R
am 19 Nov. 2019
My understanding with [U,V]=eig(A) is that AU=UV, however, in some cases with matlab, these this is not true.
It works with A=diag([3, 3, 3, 2, 2, 1]), but not with A=magic(4) or A=ones(4)

Is AU=UV supposed to hold true or will they not equal each other in certain cases?
0 Kommentare
Akzeptierte Antwort
Bhaskar R
am 19 Nov. 2019
Bearbeitet: Bhaskar R
am 19 Nov. 2019
In general terms A*U and U*V are equal but in MATLAB it computes with difference in decimal points almost at 15th decimal value as you see
A=magic(4);
[U,V]=eig(A);
format long
>> A*U
-17.000000000000000 -7.366563145999501 -3.366563145999497 -0.000000000000001
-17.000000000000000 3.788854381999832 -0.211145618000169 0.000000000000007
-17.000000000000000 0.211145618000165 -3.788854381999833 0.000000000000004
-17.000000000000000 3.366563145999499 7.366563145999495 0.000000000000006
>> U*V
-17.000000000000000 -7.366563145999498 -3.366563145999494 0.000000000000000
-16.999999999999993 3.788854381999834 -0.211145618000169 0.000000000000001
-17.000000000000004 0.211145618000170 -3.788854381999831 -0.000000000000001
-16.999999999999996 3.366563145999493 7.366563145999494 -0.000000000000000
as you can see that there is a difference at 15th decimal point thats why your if condition is failing each time
And one more thing you can't use A*U == U*V in if condition cause it produces matrix instead of a logical condition, use as isequal(A*U, U*V).
0 Kommentare
Weitere Antworten (1)
Erivelton Gualter
am 19 Nov. 2019
It is not a bug.
It depends of the floating point numbers. If you type the following, you will observe that the floating point is equivalent to 2.2204e-16:
eps
Now, try the following:
A*U - U*V
It is almost zero. Maybe aroung 10^-15 for your case.
There is a better explanation about this matter. But for sure, I know you do not need to worry about the eig function contains a bug or not.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Linear Algebra finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!