Why the both results are different
Show older comments
I compute the little program in matlab
clear; clf;
syms a b
f1 = 96*pi - 16*pi * (log(a)-log(b)+1)
f1_ = subs(f1,[a b],[12 2])
f1_ = vpa(f1_)
f2 = 96*pi - 16*pi*(log(12)-log(2)+1)
with the output
f1 =
f1_ =
f1_ =
f2 = 161.2638
Why the results are different?
2 Comments
Walter Roberson
on 8 Jun 2020
Ah, sorry, somehow when I formatted your code, the special characters disappeared!! If you could repost that part, that would be good.
Walter Roberson
on 8 Jun 2020
When I test, I get
f1_ =
161.26375811875458240605931894947
f2 =
161.263758118755
The first of those has been computed to higher precision.
The first has also been computed in a mode that recognized pi as being the indefinitely precise transcendental number, whereas the second one that was calculated purely numeric was calculated with the 16-digit numeric approximation of pi.
Accepted Answer
More Answers (1)
Christian Muth
on 10 Jun 2020
0 votes
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

