# Tolerance, correct digits

3 vues (au cours des 30 derniers jours)
mohamed hassan le 12 Mai 2020
Commenté : Akihumi le 12 Mai 2020
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.
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponses (2)

M le 12 Mai 2020
If the tolerane is 5E5 what does it actually means ?
It depends...
Can you provide the code ?
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
mohamed hassan le 12 Mai 2020
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;

Connectez-vous pour commenter.

Akihumi le 12 Mai 2020
You can try to type that in Command Window and you might have your answer right there :)
##### 4 commentairesAfficher 2 commentaires plus anciensMasquer 2 commentaires plus anciens
mohamed hassan le 12 Mai 2020
Yes and the y in your equation is correct digits but why I dont know how to choose x or why x is 5 in my case.
Akihumi le 12 Mai 2020
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); ?

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Loops and Conditional Statements 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