wrong solution for double integral of piecewise function
I've got a function
f[\[Chi]_, \[Psi]_] =
{Piecewise[{{k, {a <= \[Chi] <= b, a <= \[Psi] <= b}}}, 0]}
I'm attempting to solve for k such that f becomes a probability
density function by applying the normalization constraint, i.e.
solving for k such that the double (indefinite) integral of f equals
1. I can do this by hand pretty easily, integrating first/inside WRT
psi and second/outside WRT chi, and I get
(1) k = 1/((b-a)^2)
I don't have the world's greatest calculus chops, but that looks
correct to me. (Am I missing something?) However, when I use
Mathematica to
Solve[
First[
Integrate[
Integrate[
f[\[Chi], \[Psi]], {\[Psi], -\[Infinity], \[Infinity]}
],
{\[Chi], -\[Infinity], \[Infinity]}
]
] == 1, k
]
I get
(2) {{k -> -(1/((a - b)^2 (-1 + UnitStep[a - b])))}}
which seems wrong to me, though I'll admit I don't know what
"UnitStep" means. So I'm wondering
* does (1) = (2)? or
* have I made a syntax error? or
* is this just really hard to solve symbolically? If so, is there a
better way to setup this function and its solution?