Menu

#2919 Definite integration broken: integrate(1/(x^2), x, -inf, inf) gives zero

None
closed
None
1
2015-03-26
2015-03-12
No

Definite integration is broken:

(%i1) integrate(1/(x^2), x, -inf, inf);
(%o1) 0

(%i2) build_info();
(%o2)
Maxima version: "branch_5_35_base_207_g1cd831f"
Maxima build date: "2015-03-12 23:08:56"
Host type: "x86_64-unknown-linux-gnu"
Lisp implementation type: "SBCL"
Lisp implementation version: "1.0.55.0.debian"

Needless to say, the correct answer would be:

defint: integral is divergent.

Related

Wiki: 5.36.0

Discussion

  • Robert Dodier

    Robert Dodier - 2015-03-13

    Git bisect shows that this is due to commit [b0776c24b]. The commit message says:

        Fix #2776 Error when integrate sqrt
    
        src/defint.lisp:
        o poles-in-interval: test sign of denom.  This handles cases where we
          can't find the exact roots, but we know that they occur outside the
          interval of integration.
          example: integrate((1+exp(t))/sqrt(t+exp(t)), t, 0, 1);
    

    and the changed code is:

    diff --git a/src/defint.lisp b/src/defint.lisp
    index 03c567f..ab79c78 100644
    --- a/src/defint.lisp
    +++ b/src/defint.lisp
    @@ -3337,7 +3337,12 @@ in the interval of integration.")
         (roots (real-roots denom var))
         (ll-pole (limit-pole exp var ll '$plus))
         (ul-pole (limit-pole exp var ul '$minus)))
    -    (cond ((or (eq roots '$failure)
    +    (cond ((member ($csign denom) '($pos $neg $pz))
    +      ;; this clause handles cases where we can't find the exact roots,
    +      ;; but we know that they occur outside the interval of integration.
    +      ;;  example: integrate ((1+exp(t))/sqrt(t+exp(t)), t, 0, 1);
    +      '$no)
    +     ((or (eq roots '$failure)
               (null ll-pole)
               (null ul-pole))   '$unknown)
          ((and (eq roots '$no)
    

    Not sure where to go from here.

     
  • David Scherfgen

    David Scherfgen - 2015-03-13

    Reverting the change fixes this bug.
    Also, reverting does not seem to reintroduce the mentioned bug #2776. It seems to have been fixed by something else.

     
  • Robert Dodier

    Robert Dodier - 2015-03-14

    Well, there was another patch to the same code a little bit later (commit [86685c3e]), which reverted b0776c24b and made a similar change in a different place. I'm not sure what's going on at this point. In each commit, new test cases have been introduced, so at least we can tell whether or not the problems that have been fixed come back again.

     
  • David Scherfgen

    David Scherfgen - 2015-03-14

    Robert, can you add test cases for the following, so that we get at least some basic test coverage for this issue:

    integrate(1/x, x, 0, 1) --> Error
    (expected additional output: defint: Integral is divergent.)

    integrate(1/x, x, -1, 1) --> 0
    (expected additional output: Principal Value)

    integrate(1/x, x, 0, inf) --> Error
    (expected additional output: defint: Integral is divergent.)

    integrate(1/x, x, 1, inf) --> Error
    (expected additional output: defint: Integral is divergent.)

    integrate(1/x, x, -inf, inf) --> 0
    (expected additional output: Principal Value)

    integrate(1/x^2, x, 0, 1) --> Error
    (expected additional output: defint: Integral is divergent.)

    integrate(1/x^2, x, -1, 1) --> Error
    (expected additional output: defint: Integral is divergent.)

    integrate(1/x^2, x, 0, inf) --> Error
    (expected additional output: defint: Integral is divergent.)

    integrate(1/x^2, x, 1, inf) --> 1
    (no additional output)

    integrate(1/x^2, x, -inf, inf) --> Error
    (expected additional output: defint: Integral is divergent.)

     
    • Robert Dodier

      Robert Dodier - 2015-03-26

      I've included these tests in the test suite (commit [f38312f]).

       
  • Dan Gildea

    Dan Gildea - 2015-03-26
    • status: open --> closed
    • assigned_to: Dan Gildea
     
  • Dan Gildea

    Dan Gildea - 2015-03-26

    Fixed in commit [d0a8769f5d1ea9a0ce6b2f05ec162d98b48fd91d]

    Fix typo: $pz can be zero
    
    Fixes #2919 Definite integration broken: integrate(1/(x^2), x, -inf, inf) gives zero
    
    src/defint.lisp:
    o poles-in-interval: fix typo introduced in commit
      [b0776c24bf74d0cf909055600cd1f6594c303c2c]
    
    tests/rtestint.mac:
    o add integrate(1/(x^2), x, -inf, inf)
    o add integrate(1/(x+1), x,0,inf)
    
     

    Related

    Commit: [d0a876]


Log in to post a comment.