Opened 4 years ago

# Wrong integral of sqrt(1-cos(x))

Reported by: Owned by: tmonteil major sage-8.2 symbolics integrate charpent, mafra, kcrisman Reported upstream. No feedback yet.

As reported on this ask question:

```sage: integral(sqrt(1-cos(x)), x, 0, 2*pi)
0
```

This comes from the following wrong primitive

```sage: integral(sqrt(1-cos(x)), x, algorithm='maxima')
-2*sqrt(2)/sqrt(sin(x)^2/(cos(x) + 1)^2 + 1)
```

where Fricas find a correct answer:

```-2*(cos(x) + 1)*sqrt(-cos(x) + 1)/sin(x)
```

See Maxima bug 3659.

### comment:2 Changed 4 years ago by mantepse

#25220 fixes the problem with FriCAS.

Last edited 4 years ago by mantepse (previous) (diff)

### comment:3 Changed 18 months ago by chapoton

• Description modified (diff)

### comment:4 Changed 18 months ago by chapoton

• Description modified (diff)

### comment:6 Changed 14 months ago by chapoton

This should be upstreamed to maxima. Karl-Dieter, would you do so, please ?

### comment:7 Changed 14 months ago by kcrisman

Interestingly, this may not necessarily be a problem with `domain:complex`. Can you just confirm that the Fricas antiderivative makes more sense at this graphic? It's been a while since I've had to deal with branch cuts and I feel like that is part of the question here - but the way in which the graphs are different between pi and 2pi is definitely a problem. BUT Maxima gives the correct answer to the definite integral between pi and 2pi with either setting of `domain`.

### comment:8 Changed 14 months ago by kcrisman

Okay, it is `domain:complex`, but more subtly.

```(%i1) integrate(sqrt(1-cos(x)), x, %pi, 2*%pi);
3/2
(%o1)                                2
(%i2) integrate(sqrt(1-cos(x)), x, 0, 2*%pi);
5/2
(%o2)                                2
(%i3) domain:complex;
(%o3)                               complex
(%i4) integrate(sqrt(1-cos(x)), x, %pi, 2*%pi);
3/2
(%o4)                                2
(%i5) integrate(sqrt(1-cos(x)), x, 0, 2*%pi);
(%o5)                                  0
```

This I am more confident about reporting upstream.

### comment:9 Changed 14 months ago by kcrisman

• Description modified (diff)
• Report Upstream changed from N/A to Reported upstream. No feedback yet.
Note: See TracTickets for help on using tickets.