# Is this result wrong because of calculation time? (and more questions about Assumptions)

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


## It seems Mathematica 'forgets' that I have assumed that k>0. Why is that? What does the second line of the result mean?

• Welcome to Mma.SE! Please note that formatted code does not wrap lines. Please include returns as appropriate to make the question more readable. (Thanks!) – Michael E2 May 14 '13 at 11:53
• FYI, in v9.0.1, I get no warning messages with UnitStep, just the correct answer. With Assumptions -> k > 0, I get a more detailed message that shows kx^2 + ky^2 + kz^2 has been factored; adding kx^2 + ky^2 + kz^2 > 0 to the assumptions removes the message, but the output is still 0. With Assuming, I get the output -(4/3) k^3 \[Pi] (-1 + UnitStep[-k]), which is cute. – Michael E2 May 14 '13 at 11:54
• – Michael E2 May 14 '13 at 11:55
• Can you answer my second bold face question? And, can you tell me why mathematica can calculate 1D but not 3D, is this because computation time? – 喵喵是我的猫猫 May 14 '13 at 14:55
• I don't know the answer to why the assumption is forgotten, but I've observed it before. Others have asked before, but I can't find a suitable answer to refer you to (sorry!). As for the result, it looks like a Piecewise function, that is 0 in the default case (when k > 0 is false). – Michael E2 May 14 '13 at 21:04