Symbolic math solve numeric approximation
显示 更早的评论
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 个评论
Walter Roberson
2017-9-18
There are a small number of preferences for solve(); see https://www.mathworks.com/help/symbolic/sympref.html
Note: the ability to pass cell arrays to symbolic routines is not documented.
Thomas Ligon
2017-9-19
Thomas Ligon
2017-9-20
回答(1 个)
Karan Gill
2017-9-18
编辑:Karan Gill
2017-10-17
0 个投票
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Code Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!