Problem with Integrate with Piecewise and PrincipalValue
I think this is a bug, because if we transform the Piecewise
function into a combination of UnitStep
(which is mathematically equivalent to the original function of course), Integrate
integrates without difficulty:
um = -(2/3) - 2/(3 (-1 + u)) - (2 u)/3 + u^2/3;
up = -(10/3) - 2/(3 (-1 + u)) + (8 u)/3 - u^2/3;
sv = Simplify`PWToUnitStep@Piecewise[{{um, u <= 1}, {up, u > 1}}];
Integrate[sv, {u, 0, 2}, PrincipalValue -> True]
(* -1 *)
Tested on v9.0.1 and v11.2.
Another way. Integrate from both sides to small r near the singularity and let r go to zero.
um = -(2/3) - 2/(3 (-1 + u)) - (2 u)/3 + u^2/3;
up = -(10/3) - 2/(3 (-1 + u)) + (8 u)/3 - u^2/3;
sv[u_] = Piecewise[{{um, u <= 1}, {up, u > 1}}];
int = Integrate[sv[u], {u, 0, 1 - r}, Assumptions -> 0 < r < 1] +
Integrate[sv[u], {u, 1 + r, 2}, Assumptions -> 0 < r < 1]
(* 1/9 (-8 + 9 r - r^3 - 6 Log[r]) +
1/9 (-1 + 9 r - 9 r^2 + r^3 + 6 Log[r]) *)
Limit[int, r -> 0, Direction -> -1]
(* -1 *)