Menu

#4687 integrate(1/x,x,-1,1) should issue Principal Value warning

None
open
nobody
5
2026-03-25
2026-03-23
No
integrate(1/x,x,-1,2) => Principal Value // log(2)
integrate(1/x,x,-1,1) => 0
integrate(1/x,x,-2,2) => 0

Shouldn't integrate(1/x,x,-1,1) also be giving the Principal Value warning?

Discussion

  • Stavros Macrakis

    Some more cases:

    integrate(x,x,minf,inf) -- No PV warning
     ~~~
     These cases should probably complain that the endpoints aren't well-defined:
     ~~~
     integrate(x,x,minf,2*inf) -- says it's divergent
     integrate(x,x,minf,inf-1) -- says it's divergent
    

    This is better, although the wording isn't quite right:

    integrate(x,x,0,sin(inf)) => defint: upper limit of integration must be real; found sin(inf) -- an error
    

    Arguably correct, but probably an accident:
    ~~~
    integrate(x,x,0,1/inf) => 0
    ~~~

     
  • Barton Willis

    Barton Willis - 2026-03-24

    The definite integration code calls the one argument limit on the limits of integration:

    (%i31)  integrate(x,x,minf,inf-1);
    1" Call   "limit" "[1-inf]
    
    1" Return "limit" "-inf
    

    But when the limit is ind, the user gets a fairly clear error:

        integrate(4,x,0,sin(inf));
    1" Call   "limit" "[sin(inf)]
    
    1" Return "limit" "ind
    
    defint: upper limit of integration must be real; found sin(inf)
    
     
    • Stavros Macrakis

      Hmm, not consistently:

      integrate(x,x,0,1+zeroa) => result involving zeroa
      integrate(x,x,1,atan(inf-1)) => integral is divergent
      integrate(x,x,1,limit(atan(inf-1))) => %pi^2/8-1/2
       integrate(exp(-x),x,zeroa,inf) => gamma_incomplete(1, zeroa)
       integrate(exp(-x),x,limit(zeroa),inf) => 1
      

      Should it?

       
  • Barton Willis

    Barton Willis - 2026-03-24

    Possibly my claim about calling the one argument limit function was more true than false, but after that, what's the story?

        integrate(x,x,0,1+zeroa) ;
    1" Call   "limit" "[zeroa+1]
    1" Return "limit" "1
    1" Call   "limit" "[0]
    1" Return "limit" "0
    1" Call   "limit" "[zeroa+1]
    1" Return "limit" "1
    1" Call   "limit" "[zeroa+1]
    1" Return "limit" "1
    1" Call   "limit" "[zeroa+1,zeroa,0,plus]
    1" Return "limit" "1    (zeroa^2+2*zeroa+1)/2
    

    Guess: sometimes after a change of variable, the limit of integration need to be cleaned up with the one argument limit function.

     
  • Barton Willis

    Barton Willis - 2026-03-24

    Another observation: try ldefint

        ldefint(x,x,0,1+zeroa) ;
    1" Call   "limit" "[zeroa+1]
    
    1" Return "limit" "1    1/2
    
        ldefint(x,x,1,atan(inf-1));
    1" Call   "limit" "[atan(inf-1)]
    
    1" Return "limit" "%pi/2    %pi^2/8-1/2
    
     
  • Barton Willis

    Barton Willis - 2026-03-25

    Some (but not all) of these calls to the one-argument limit come from complm. I think that complm attempts to determine if the the lower limit is less than the upper limit of integration:

    (%i9) integrate(x,x,0, 1+zeroa);
    
    0> Calling (COMPLM NOASK 0 ((MPLUS SIMP) 1 $ZEROA))
    1 Call   limit [zeroa + 1]
    1 Return limit 1
    <0 COMPLM returned 1
    1 Call   limit [0]
    1 Return limit 0
    1 Call   limit [zeroa + 1]
    1 Return limit 1
    1 Call   limit [zeroa + 1]
    1 Return limit 1
    1 Call   limit [zeroa + 1, zeroa, 0, plus]
    1 Return limit 1
    
     

Log in to post a comment.

MongoDB Logo MongoDB