Why is the simplify function not simplifying?

84 ビュー (過去 30 日間)
MATLABexpertmedical
MATLABexpertmedical 2018 年 3 月 20 日
コメント済み: Rena Berman 2018 年 5 月 29 日
Why is x not being simplified? A picture of my results is attached.
syms th1 th2 th3 th4
x=sin(th1)*sin(th4) - cos(th4)*(cos(th1)*sin(th2)*sin(th3) - cos(th1)*cos(th2)*cos(th3))
simplify(x)
simplify(cos(th1)*sin(th2)*sin(th3) - cos(th1)*cos(th2)*cos(th3))
  1 件のコメント
Rena Berman
Rena Berman 2018 年 5 月 29 日
(Answers Dev) Restored edit

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

採用された回答

Priyank Sharma
Priyank Sharma 2018 年 4 月 2 日
編集済み: Walter Roberson 2018 年 5 月 21 日
This is the expected behavior of the SIMPLIFY function in the Symbolic Math Toolbox. By default, the function tries to make as few assumptions about the symbolic variables as possible. Considering a simple example, the expression 'log(exp(x))' cannot always be simplified to the expression 'x'. In particular, consider if x = 2*pi*i (where i is the imaginary unit). Then log(exp(x)) = 0, which is clearly not equal to x.
In order to do simplifications with looser assumptions about the symbolic variables, call the MuPAD SIMPLIFY function in the MuPAD notebook interface or in MATLAB through the FEVAL or EVALIN commands. Using the MuPAD command directly allows the inclusion of the 'IgnoreAnalyticConstraints' option which controls the level of mathematical rigor that the solver uses on the analytical constraints on the solution.
For example:
syms x
feval(symengine,'simplify',log(exp(x)),'IgnoreAnalyticConstraints')
For more information on the MuPAD SIMPLIFY command, the 'IgnoreAnalyticConstraints' option, and other options which can be used with the MuPAD SIMPLIFY command you may refer to:
  1 件のコメント
Walter Roberson
Walter Roberson 2018 年 4 月 2 日
In current versions, simplify can use IgnoreAnalyticConstraints directly.
https://www.mathworks.com/help/symbolic/simplify.html

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

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by