フィルターのクリア

Is there a way to limit the "solve" function to converge only to a real solution (no imaginary or complex numbers)?

10 ビュー (過去 30 日間)
I am trying to solve a system of algebraic equations using the "solve" function in the symbolic toolbox. Since the equations describe a physical system only a real solution can be realistic (taking the real parts of the resulting complex numbers is not a solution). Is there a way to make the "solve" function converge to real numbers only?
Thank you in advance.

採用された回答

Walter Roberson
Walter Roberson 2019 年 4 月 23 日
No, there is not.
  • vpasolve() permits ranges to be specified for each value. vpasolve() will typically only find one solution
  • You can add additional equations that are inequalities, but it is common for solve() to give up almost immediately when the number of equations does not match the number of variables to be solved for. Also, when solve() does respect an inequality, it does not return a description of the ranges that are valid: instead it returns a representative value. For example if it figures out that 1/2 < x < 14 then it will return 1, and if it figures out that 2 < x < 14 then it returns pi
  • When you "syms" the variable or sym() it into existence, you can specify the real flag, such as syms x y real . These can help the computation a fair bit, but they can also lead to solve() missing valid answers . solve() is also permitted to ignore these kinds of assumptions
  • You can assume() and assumeAlso() to add assumptions that specify restrict ranges, such as assume(2 < x & x < 14) . These have the same disadvantages as the real flag, and as well it can lead to solve() spending a lot of time working on the value of the variable at the boundary conditions when the boundary conditions might be of lower priority than some other calculations.
  1 件のコメント
Georgios Pasias
Georgios Pasias 2019 年 4 月 23 日
Thank you, specifying the symbolic variables as real has solved my problem in this case.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAssumptions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by