(%i1) integrate(sec(x)^2, x, %pi/4, 3*%pi/4);
(%o1) -2
This result is obviously wrong because the integrand is positive everywhere.
The antiderivative is tan(x).
Maxima fails to realize that tan(x) has a pole at x = %pi/2 and substitutes the limits into the antiderivative.
This can be fixed by changing the function discontinuities-in-interval in defint.lisp. However care must be taken that all poles are found. So if somebody decides to fix this, he/she should also make sure that it still works when shifting the bounds by multiples of %pi:
integrate(sec(x)^2, x, %pi/4 + %pi, 3*%pi/4 + %pi);
integrate(sec(x)^2, x, %pi/4 + 2*%pi, 3*%pi/4 + 2*%pi);
integrate(sec(x)^2, x, %pi/4 + 3*%pi, 3*%pi/4 + 3*%pi);
...
seems ok for me
Hmm, you're right.
But if you add
2*%pito both the lower and the upper limit (which should not change the integral, since the function has a period of2*%pi), do you get -2 even withintanalysis : true?This bug presents itself as a much more simple case with Maxima 5.42.1: