syms x
f(x) = cos(x)*sin(x);
Fx = int(f,x)
Fx(x) = 
Fx(x) =
sin(x)^2/2
while the correct answer is -cos(x)^2/2

댓글 수: 3

Robin Merkle
Robin Merkle 2022년 3월 2일
The answer is correct. d/dx sin^2(x)/2 = sin(x)cos(x).
Torsten
Torsten 2022년 3월 2일
Since sin(x)^2/2 = -cos(x)^2/2 + 1/2, both answers are correct.
Note that both answers only differ by a constant, namely 1/2.
Ali M
Ali M 2022년 3월 5일
Thanks @Torsten & @Robin Merkle! @Torsten I would vote for you but I cant, your is a comment not an answer

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2022년 3월 2일

0 개 추천

Remember that indefinite integration always has an implied "plus a constant". So any two results of int() that differ by a constant are the same integral result. And sin squared plus cos squared equals 1 so the two possibilities are the same up to the constant.
You can ask to rewrite() to 'cos'

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

제품

릴리스

R2021b

태그

질문:

2022년 3월 2일

댓글:

2022년 3월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by