Symbolic math solve numeric approximation
Mostra commenti meno recenti
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 Commenti
Walter Roberson
il 18 Set 2017
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
il 19 Set 2017
Thomas Ligon
il 20 Set 2017
Risposte (1)
Karan Gill
il 18 Set 2017
Modificato: Karan Gill
il 17 Ott 2017
0 voti
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.
1 Commento
Thomas Ligon
il 17 Ott 2017
Categorie
Scopri di più su Code Performance in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!