incresing the precision of epsilon to 30 digits by symbolic toolbox, i could encounter not enough input arguments error?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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
Antworten (1)
Walter Roberson
am 9 Feb. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Numbers and Precision finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!