integrate: wrong Cauchy principle value



On Nov. 30, 2012, I wrote:
----------------------------------
>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
---------------------
in which the correct Cauchy principal value is 0.

Another example of an incorrect principal value
integral:

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

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

/* which is wrong; as usual we let eps be a
  small positive number, and calculate three
  pieces:  */

(%i21) i1: integrate(1/((x-1)*(x-2)),x,0,1-eps);
(%o21) log(eps+1)-log(eps)-log(2)

(%i22) i2: integrate(1/((x-1)*(x-2)),x,1+eps,2-eps);
Is  2*eps-1  positive, negative, or zero?

n;
(%o22) 2*log(eps)-2*log(1-eps)

(%i23) i3: integrate(1/((x-1)*(x-2)),x,2+eps,3);
(%o23) log(eps+1)-log(eps)-log(2)

(%i24) isum : i1+i2+i3;
(%o24) 2*log(eps+1)-2*log(1-eps)-2*log(2)

(%i25) limit(isum,eps,0,plus);
(%o25) -2*log(2)
-----------------------------------------------
So the correct result is -2*log(2).

Ted Woollett