Symbolic math solve numeric approximation
15 views (last 30 days)
Show older comments
Question: When does the Symbolic Math "solve" statement try to find a numeric approximation?
I have 2 versions of the same complex logic. In version 2, my colleague made a lot of changes over the weekend, but the results should be exactly the same. Now, when one specific "solve" statement runs, version 1 produces the following:
Warning: Solutions might be lost
Version 2 produces this:
Warning: Cannot solve symbolically. Returning a numeric approximation instead
Q: Why does "solve" in version 2 try to find a numeric approximation, when "solve" in version 1 does not?
I looked at the input to "solve" and couldn't find any differences. In both cases, we are passing cell arrays containing 1x1 sym expressions. They look the same to me. I didn't find any options for "solve" like we have for fmincon.
Q: Are the any default or global options for "solve" or Symbolic Math in general?
3 Comments
Answers (1)
Karan Gill
on 18 Sep 2017
Edited: Karan Gill
on 17 Oct 2017
Question: When does the Symbolic Math "solve" statement try to find a numeric approximation?
"solve" tries to find a symbolic (closed form) solution. If one doesn't exist, then a numeric solution could still be possible. A numeric solution is always an approximation of an exact symbolic solution. The numeric answer is the result of vpasolve. See https://www.mathworks.com/help/symbolic/solve.html#bue1gjw-1.
Q: Why does "solve" in version 2 try to find a numeric approximation, when "solve" in version 1 does not?
As Walter said, that's undocumented behavior. I assume your input changed so that the solver's approach worked differently in the two cases. "solve" only falls back to a numeric solutions when a symbolic solution cannot be found.
Q: Are the any default or global options for "solve" or Symbolic Math in general?
All options for a function are documented in the "Arguments" section of the respective function reference page.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!