Sympy Integrate is not showing the right answer

Viewed 36

I want to integrate(cos(3theta)/(5-4cos(theta)),(theta,0,2pi)) this expression whose answer is pi/12. But sympy does not execute the integral correctly.

So, I replaced cos(3theta) with 4cos(theta)*3-3cos(theta). Then I am obtained -21pi/8. Also, when I replaced cos(3theta) with cos(theta) sympy executed the integral and gave -pi/2. Can anyone please elaborate why sympy is not giving the correct integral? What would be the right code to obtain the correct answer?

from sympy import integrate, cos, pi, symbols

theta = symbols('theta')
sol = integrate(cos(3 * theta) / (5 - 4 * cos(theta)), (theta, 0, 2 * pi))
print(sol)

Output: 67*pi/24

Correct output would be pi/12

0 Answers
Related