Different answers when I do the same integration

조회 수: 2 (최근 30일)
Nishanth Pradyumna
Nishanth Pradyumna 2022년 9월 13일
댓글: Nishanth Pradyumna 2022년 9월 13일
Hey,
I'm getting different answers when I perform the same integration but by just expanding the squared term.
How is this possible?
As I procced further, I'm getting 2 completely different answers as my result.
Which one is correct?
PS: I'm getting the same answer even after using 'IgnoreAnalyticConstraints',true.
Thanks
  댓글 수: 4
David Hill
David Hill 2022년 9월 13일
-2ab = -2*cos(n) and is not the same as -2*(1-cos(x))
Nishanth Pradyumna
Nishanth Pradyumna 2022년 9월 13일
My bad. That was a dumb typo. Thanks.

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

답변 (1개)

David Hill
David Hill 2022년 9월 13일
They are not the same expressions.
syms x
int((1+cos(x))^2,0,pi)
ans = 
int(1+2*cos(x)+cos(x)^2,0,pi)
ans = 
int(1+cos(x)^2-2*(1-cos(x)),0,pi)%this is not the same expression
ans = 
  댓글 수: 2
Nishanth Pradyumna
Nishanth Pradyumna 2022년 9월 13일
편집: Nishanth Pradyumna 2022년 9월 13일
My bad, added the wrong screenshot. please try int((1-cos(x))^2,0,pi).
I did not get the same answer with that. (please check the updated screenshot)
Torsten
Torsten 2022년 9월 13일
Look up the binomial formula:
(a-b)^2 = a^2 - 2*a*b + b^2

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

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by