It seems that Mathematica's handling of principal value integrals fails on some corner cases. Consider these two expressions (which should give the same result):
Integrate[UnitBox[x]/(x0 - x), {x, -Infinity, Infinity},
PrincipalValue -> True, Assumptions -> {x0 > 0}] /. x0 -> 1 // Simplify
Integrate[UnitBox[x]/(x0 - x) /. x0 -> 1, {x, -Infinity, Infinity},
PrincipalValue -> True]
In Mathematica 7.0.0 I get
I Pi+Log[3]
Log[3]
Has this been fixed in later versions? Does anybody have an idea for a (more or less) general workaround?
EDIT: The two expressions above should calculate the same result, the first by calculating a general form of the integral and evaluating it at x0=1
, the second by performing the integral with x0
set to 1
. Since the Cauchy principal value has a precise mathematical definition, Mathematica should give the same result or decline to answer.
EDIT 2: A perhaps simpler example of the same bug, putting a factor of -1 inside and outside the Integral
give different answers (second one gives the correct answer, first one doesn't):
-Integrate[ UnitBox[x]/(x0 - x), {x, -Infinity, Infinity}, PrincipalValue -> True, Assumptions -> {x0 > 0}]
Integrate[-UnitBox[x]/(x0 - x), {x, -Infinity, Infinity}, PrincipalValue -> True, Assumptions -> {x0 > 0}]