Different results for the same equation

1 visualización (últimos 30 días)
Diana
Diana el 14 de En. de 2021
Comentada: Walter Roberson el 14 de En. de 2021
Why E1 is different than E3, though lambda(1)= lambda(3)

Respuestas (1)

Steven Lord
Steven Lord el 14 de En. de 2021
lambda(1) is displayed the same as lambda(3) but its value is not identical to the value of lambda(3).
A = [-10 10 -15; 10 5 -30; -5 -10 0];
lambda = eig(A)
lambda = 3×1
-15.0000 25.0000 -15.0000
lambda(1) == lambda(3) % false
ans = logical
0
lambda(1)-lambda(3) % very small but not 0
ans = 3.5527e-15
  2 comentarios
Diana
Diana el 14 de En. de 2021
but that should not effect the final result
Walter Roberson
Walter Roberson el 14 de En. de 2021
A = [-10 10 -15; 10 5 -30; -5 -10 0];
lambda = eig(A)
lambda = 3×1
-15.0000 25.0000 -15.0000
lambda(1) + 15
ans = 3.5527e-15
lambda(3) + 15
ans = 0
The third lambda is an exact integer. When you calculate A-lambda(3)*eye(3) you get exact integers, and rref() is able to calculate exact integer outputs.
When you use format short (which is the default) and all of the outputs to be displayed are exact integers, then no decimal points are shown. When any of the outputs are not exact integers, then decimal points are shown in all of the outputs.

Iniciar sesión para comentar.

Categorías

Más información sobre Operating on Diagonal Matrices en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by