필터 지우기
필터 지우기

Accuracy of solving a system

조회 수: 5 (최근 30일)
Eric Schols
Eric Schols 2016년 2월 24일
댓글: Eric Schols 2016년 2월 24일
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?

답변 (1개)

Roger Stafford
Roger Stafford 2016년 2월 24일
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
Eric Schols
Eric Schols 2016년 2월 24일
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. :)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by