Menu ▾ ▴

#5631 Wrong definite integral of sqrt(1-cos(x)) for limits in [-%pi, 0]

None
open
nobody
5
6 hours ago
6 hours ago
No

By Claude:

integrate gets the definite integral of sqrt(1-cos(x)) wrong whenever both limits lie in [-%pi, 0]. Over [-1, 0] the result is even negative, although the integrand is positive:

(%i1) display2d:false
(%i2) integrate(sqrt(1-cos(x)),x,-1,0)
(%o2) (2^(3/2)*cos(1)+2^(3/2))/sqrt(sin(1)^2+cos(1)^2+2*cos(1)+1)-2^(3/2)
(%i3) float(%)
(%o3) -0.3462488024912078
(%i4) quad_qags(sqrt(1-cos(x)),x,-1,0)
(%o4) [0.3462488024912079,3.844133927746274e-15,21,0]

Over [-2, -1] the integrand lies between 0.68 and 1.19, so the integral over this interval of length 1 must too, but integrate gives 6.61:

(%i5) integrate(sqrt(1-cos(x)),x,-2,-1)
(%o5) (-sqrt(2)*cos(1)-sqrt(2))*sin((3*%pi-1)/2)
 -sqrt(2)*sin(1)*cos((3*%pi-1)/2)
 -(2^(3/2)*cos(2)+2^(3/2))/sqrt(sin(2)^2+cos(2)^2+2*cos(2)+1)+2^(5/2)
(%i6) float(%)
(%o6) 6.610826874267005
(%i7) quad_qags(sqrt(1-cos(x)),x,-2,-1)
(%o7) [0.9539726247746232,1.059122372886882e-14,21,0]

The right values are 2^(3/2)*(1-cos(1/2)) and 2^(3/2)*(cos(1/2)-cos(1)). Intervals that reach below -%pi or above 0 come out right. Other integrands with radicals of 1-cos(x), such as (1-cos(x))^(3/2) and sqrt(1-cos(x))*cos(x), have the same problem.

Discussion


Log in to post a comment.