Menu

#3537 integrate(sec(x)^2, x, %pi/4, 3*%pi/4) ignores tangent pole

None
open
nobody
5
2019-07-27
2019-03-13
No
(%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);
...

Discussion

  • Dan Gildea

    Dan Gildea - 2019-04-15

    seems ok for me

    (%i1) intanalysis;
    (%o1)                                true
    (%i2) integrate(sec(x)^2, x, %pi/4, 3*%pi/4);
    
    defint: integral is divergent.
     -- an error. To debug this try: debugmode(true);
    (%i3) intanalysis:false;
    (%o3)                                false
    (%i4) integrate(sec(x)^2, x, %pi/4, 3*%pi/4);
    (%o4)                                 - 2
    
     
  • David Scherfgen

    David Scherfgen - 2019-04-16

    Hmm, you're right.
    But if you add 2*%pi to both the lower and the upper limit (which should not change the integral, since the function has a period of 2*%pi), do you get -2 even with intanalysis : true?

     
  • John Scott

    John Scott - 2019-07-27

    This bug presents itself as a much more simple case with Maxima 5.42.1:

    (%i1) integrate(tan(x),x,0,%pi);
    (%o1)                                  0
    
     

Log in to post a comment.

MongoDB Logo MongoDB