# Tolerance, correct digits

2 次查看（过去 30 天）
mohamed hassan2020-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