incresing the precision of epsilon to 30 digits by symbolic toolbox, i could encounter not enough input arguments error?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
function unidec=quad(a,b,r,eps)
a=input('enter a');
b=input('enter b');
r=sym(eps);
digits(30);
vpa(r);
if abs(a-b)< r
unidec=' a & b are equal';
else
unidec='a & b are not equal in double & single precision 3rd loop';
end
Réponses (1)
Walter Roberson
le 9 Fév 2018
digits(30) does not increase the precision of the function eps(). The function eps() is a purely numeric function that only operates on single and double.
Your code is inputting a and b as numeric (double precision) . Changing digits() does not affect the result of a double minus a double.
For your code to make any sense, you would need to use
if abs(vpa(a) - vpa(b)) < r
0 commentaires
Voir également
Catégories
En savoir plus sur Numbers and Precision dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!