Matlab ignores pi in a function

조회 수: 2 (최근 30일)
Alex CB
Alex CB 2016년 1월 3일
편집: Walter Roberson 2016년 1월 4일
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에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by