I am confused with the Integrate Given by Mathematica. First let's see a one-dimensional case:
Integrate[UnitStep[k - Sqrt[kx^2]], {kx, -Infinity, Infinity}, Assumptions -> k > 0]
The result is 2k
. Right answer! You can change UnitStep
to HeavisideTheta
, it still gives the same correct answer.
However, when changing to three dimension case,HeavisideTheta
gives the wrong answer. See the following:
Integrate[ HeavisideTheta[k - Sqrt[kx^2 + ky^2 + kz^2]],
{kx,-Infinity, Infinity}, {ky, -Infinity, Infinity}, {kz, -Infinity, Infinity},
Assumptions -> k > 0]
Mathematica gives the wrong answer 0
and with an error message I don't understand.
Refine::fas: Warning: One or more assumptions evaluated to False.
If Assumptions
is not added, it directly gives 0
without any WARNING! As if it calculated it right! How dangerous if I previously didn't know the answer!
@Jens suggested using UnitStep
instead of HeavisideStep
. I tried: in Mathematica 7 it fails (giving the wrong answer 0) but in version 8 it gives the right result:
(4 k^3 \[Pi])/3
Still with the same message:
Refine::fas: Warning: One or more assumptions evaluated to False.
So what does this message mean? Why do different Mathematica versions give different answers? Is this because of the computing time involved?
Above is the main question, here is some subtle question I would like to ask; see this integral:
Assuming[k > 0, Integrate[ UnitStep[k - Sqrt[kx^2 + ky^2 + kz^2]],
{kx, -Infinity, Infinity}, {ky, -Infinity, Infinity}, {kz, -Infinity, Infinity}]]
the results:
(4 k^3 \[Pi])/3 k>0
0 True
UnitStep
, just the correct answer. WithAssumptions -> k > 0
, I get a more detailed message that showskx^2 + ky^2 + kz^2
has been factored; addingkx^2 + ky^2 + kz^2 > 0
to the assumptions removes the message, but the output is still 0. WithAssuming
, I get the output-(4/3) k^3 \[Pi] (-1 + UnitStep[-k])
, which is cute. $\endgroup$Piecewise
function, that is 0 in the default case (whenk > 0
is false). $\endgroup$