Why is my symbolic trig expression is not fully simplifying?

33 次查看(过去 30 天)
When I run the following,
syms x
y = sqrt(1-sin(x)^2)
y = simplify(y)
the "simplify" function is not working as expected, i.e. I am not getting an output of "cos(x)" or "abs(cos(x))". Instead, "y" is simply left unchanged.

采纳的回答

MathWorks Support Team
By default, "simplify" only performs one simplification step, and that is why some expressions, like the one in the question, are not fully reduced. However, you can get a better answer by forcing "simplify" to perform more steps:
In your example, I began getting the right answer after raising "Steps" to 15:
syms x
y = sqrt(1-sin(x)^2)
y = simplify(y,'Steps',15);
Now the output of "simplify" is "abs(cos(x))" as expected.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

标签

尚未输入任何标签。

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by