# Tolerance, correct digits

조회 수: 2(최근 30일)
mohamed hassan 2020년 5월 12일
댓글: Akihumi 2020년 5월 12일
i have a code where i have aa while loop and the condition is that the diffrence between two variables is bigger than the tolerence.
If the tolerane is 5E5 what does it actually means ? this has to do with correct digits. It is a numerical method question.

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

### 답변(2개)

M 2020년 5월 12일
If the tolerane is 5E5 what does it actually means ?
It depends...
Can you provide the code ?
##### 댓글 수: 1표시숨기기 없음
mohamed hassan 2020년 5월 12일
newton
a =19
k=3
s=1
tol = 5E-5
while ((d> tol)|
s = s + a;
a = a*6/(k+1);
d = abs(s-a)
k=k+1;
end;

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

Akihumi 2020년 5월 12일
You can try to type that in Command Window and you might have your answer right there :)
##### 댓글 수: 4표시숨기기 이전 댓글 수: 3
Akihumi 2020년 5월 12일
I see... but what is the purpose of the while loop and how do you decide the equations in that? For example, why a = a*6/(k+1); ?

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

### Community Treasure Hunt

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

Start Hunting!

Translated by