why dosen't out put as short answer?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
sadiqah aldahan
am 15 Apr. 2022
Kommentiert: Walter Roberson
am 16 Apr. 2022
syms y
R1=(nthroot(y-2,3)+2);
R2=y;
R3=1;
eq1=int(R1^2,y,1,2.1);
eq2=int(R2^2,y,2.094,4);
eq3=int(R3^2,y,0,1);
format short
volume=(eq1+eq2+eq3)*pi
0 Kommentare
Akzeptierte Antwort
Star Strider
am 16 Apr. 2022
Because it is symbolic, not numeric.
syms y
R1=(nthroot(y-2,3)+2);
R2=y;
R3=1;
eq1=int(R1^2,y,1,2.1);
eq2=int(R2^2,y,2.094,4);
eq3=int(R3^2,y,0,1);
format short
volume=(eq1+eq2+eq3)*pi
vpa_volume = vpa(volume)
double_volume = double(volume)
If you want to always have this sort of result, see the documentation on sympref, and specifically Display Symbolic Results in Floating-Point Format.
.
1 Kommentar
Walter Roberson
am 16 Apr. 2022
The purpose of solve() and int() are to return indefinitely precise answers whenever possible. solve() avoids approximate numeric solutions, and int() never uses approximate numeric solutions. If you int() and the exact theoretical solution is
then int() will return that, not 1.236<something>
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/965885/image.png)
If what you want is a numeric approximation then you should be reconsidering whether you should be using int() at all: perhaps you should be using the pure-numeric integral() or perhaps you should be doing extended precision numeric approximation using vpaintegral()
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Number Theory finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!