integrate: wrong Cauchy principle value



>>>>> "Edwin" == Edwin Woollett <woollett at charter.net> writes:

    Edwin> On Nov. 30, 2012, I wrote:
    Edwin> ----------------------------------
    >> integrate (and defint) give the wrong Cauchy
    >> principal value result for a non-convergent
    >> integral:
    >> ................
    >> (%i1) integrate(1/(x-1),x,0,2);
    >> Principal Value
    >> (%o1) %i*%pi
    Edwin> ---------------------
    Edwin> in which the correct Cauchy principal value is 0.

    Edwin> Another example of an incorrect principal value
    Edwin> integral:

    Edwin> (%i2) assume(eps > 0, eps < 1);
    Edwin> (%o2) [eps > 0,eps < 1]

    Edwin> (%i20) integrate(1/((x-1)*(x-2)),x,0,3);
    Edwin> Principal Value
    Edwin> (%o20) %i*%pi-2*log(2)

[snip]
    Edwin> -----------------------------------------------
    Edwin> So the correct result is -2*log(2).

In case you didn't know, you can verify this with quad_qawc too:

/* Cauchy value integrate(1/(x-1)/(x-2),x,0,3/2) */
i1:quad_qawc(1/(x-2), x, 1, 0, 1.5)$
i2:quad_qawc(1/(x-1), x, 2, 1.5, 3)$
i1[1]+i2[1];
-1.38629436111989

Of course, this only works because you know where the roots are.

Ray