How can I recognize symbolic value with actual value 0?

3 views (last 30 days)
I was making some calculation and got symbolic value of
ans =
3/2 - (73^(1/2)/4 - 7/4)*(73^(1/2)/4 + 7/4)
it was actually 0, but matlab didn't recognize it. I used double(syms), but the result was
ans =
-4.5278e-72
how can I make matlab recognize it as 0?

Accepted Answer

Walter Roberson
Walter Roberson on 3 May 2020
simplify() the expression

More Answers (1)

Paresh yeole
Paresh yeole on 3 May 2020
You need to specify custom tolerance.
if abs(ans) < 1e-10
ans = 0;
end
You can specify your own tolerance instead of 1e-10.

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!