How to avoid rounding error
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ewout Audenaert
el 9 de Abr. de 2021
Comentada: Walter Roberson
el 10 de Abr. de 2021
When I use lu[A] for A = [10^(-20) 1 ; 1 2] I get 2 matrices (L and U). When I multiply them, the result is not the same as the original matrix A. What method can I use in order to get the correct matrix A?
1 comentario
Rik
el 9 de Abr. de 2021
You could try vpa.
The more fundamental problem is that computers have finite precision. If you want infinite precision, you will need to use algebraic tools. Not every problem can be solved perfectly. The general solution for this is to avoid problems that span more than 20 orders of magnitude, so you can rely on eps to estimate if your results are close enough.
Respuesta aceptada
Walter Roberson
el 9 de Abr. de 2021
A = [sym(10)^(-20) 1 ; 1 2]
[L,U] = lu(A)
L*U - A
You can see from this that in order to get back A exactly, then you need a system that can distinguish 99999999999999999998 from 100000000000000000000, but
eps(100000000000000000000)
it certainly is not double precision arithmetic.
1 comentario
Walter Roberson
el 10 de Abr. de 2021
syms N real
A = [sym(10)^(-N) 1 ; 1 2]
[L,U] = lu(A)
eqn = U(2,2) == -1/eps
solve(eqn)
vpa(ans)
So beyond about 10^15.65 you go beyond what can be represented exactly in double precision.
Más respuestas (0)
Ver también
Categorías
Más información sobre Numbers and Precision en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!