Bug 1552789 and acos and simplification.



I was looking at bug 1552789 which mentions that
integrate(1/(sin(x)^2+1),x,1,1+%pi) takes forever.  That's not the
case anymore, but the answer that is returned:

sqrt(2)*atan(sqrt(2)*tan(%pi+1))/2-sqrt(2)*atan(sqrt(2)*tan(1))/2

isn't quite right.  Or, rather, there's no way to tell atan which
branch to take so it returns the principal value and everything
cancels to zero.

However, maxima has code to try to take care of this in
SAME-SHEET-SUBS.  It seems to be working, but is unable to compute the
pole.  First, it doesn't know the poles of tan(x), but I hacked the
code to call trigsimp to convert tan(x) to sin(x)/cos(x) so maxima can
now determine the pole.

Actually, it's looking for the pole of tan(x+1).  With the above
change, it finds the pole is acos(0)-1.  However, it doesn't simplify
acos(0) to %pi/2.  The actual expression is ((%acos simp) 0), so it's
already simplified somehow.

How can I get maxima to convert that to %pi/2?

If I hack the code to make acos(0) be %pi/2, the integral becomes

-sqrt(2)*atan(sqrt(2)*tan(1))/2+sqrt(2)*atan(sqrt(2)*sin(1)/cos(1))/2+%pi/sqrt(2)

That works out to be %pi/sqrt(2), which, I think is right.  quad_qags
says it's pretty close.

Ray