Accuracy of solving a system

3 vues (au cours des 30 derniers jours)
Eric Schols
Eric Schols le 24 Fév 2016
Commenté : Eric Schols le 24 Fév 2016
With
k = 12;
eps = 10^(-k);
A = [[1+eps,1];[1,1+eps]];
I can control the condition number of A to be approximately 2*10^k. Then, when I solve an equation and examine its accuracy:
x = unifrnd(0,2,2,1);
y = A*x;
disp(norm(A\y-x))
This seems to give accuracy up to 16-k digits. Is this a general rule of thumb regarding accuracy in MATLAB?
MATLAB returns a warning when the condition number is above 1e16, and a condition number of 10^k roughly leads to losing k digits in acccuracy, so we lose 16-k digits?

Réponses (1)

Roger Stafford
Roger Stafford le 24 Fév 2016
There is no hard and fast rule as to the number of significant digits in computations. It depends on the values and the nature of the computation. However, it is helpful to realize that the double precision floating point numbers which matlab uses are in binary form and have 53 bits (binary digits) in their significands (mantissas) which is about equivalent to 16 decimal digits. Thus, many computations have roughly an accuracy of 16 decimal places. As you can imagine, it is easy to have computations with far less accuracy in the result, as say in the subtraction of two values that are nearly equal. If two values with equal exponential parts differ only in the least n bits of their significands, the subtraction result will have lost 53-n bits of relative accuracy. Your example looks rather similar.
  1 commentaire
Eric Schols
Eric Schols le 24 Fév 2016
Thank you for your answer. I figured it would be case dependent and no hard and fast rule, as you put it, was available, but your answer clarifies things for me. I now know how to describe the situation in a report I am writing. :)

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by