Matlab ignores pi in a function

1 次查看(过去 30 天)
When I try to use:
syms x; y=3*cos(pi-x^2); diff(y)
it gives
6*x*sin(x^2)
it ignores the pi, giving an incorrect solution and I don't know how to solve it.
It also says that "y=-3*cos(x^2)", ignoring the pi again.
Thanks in advance.

采纳的回答

Image Analyst
Image Analyst 2016-1-3
Why do you incorrectly think that cos(pi-theta) is not equal to -cos(theta)? It is. Just try plotting some angles on the unit circle to prove it to yourself. So you can use either equation because they are equivalent.
  1 个评论
Alex CB
Alex CB 2016-1-3
...I see it now, it seems I'm just an idiot.
Thank you so much, I'm sorry for the troubles.

请先登录,再进行评论。

更多回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by