I tried to compute $$\int_{-1}^1 d x_1 \int_{-1}^1 d x_2 \int_{-1}^1 d y_1 \int_{-1}^1 d y_2 \theta(x_1 x_2 + y_1 y_2)\,$$ where $\theta$ is Heaviside's step function, by using
Integrate[HeavisideTheta[x1 x2+y1 y2],{x1,-1,1},{x2,-1,1},{y1,-1,1},{y2,-1,1}]
but it took forever to evaluate. I didn't have the patience to wait until the end. However,
Integrate[Boole[x1 x2+y1 y2 >= 0],{x1,-1,1},{x2,-1,1},{y1,-1,1},{y2,-1,1}]
was very quick. Can anybody explain this strange behavior?
x1 x2 + y1 y2is zero? Perhaps you wantUnitStep? – Mr.Wizard♦ Nov 11 '12 at 19:59UnitStep? I got bored of waiting in both cases. But I have to admit I got bored quite fast – Rojo Nov 11 '12 at 20:34Integrate[HeavisideTheta[x1 x2 + y1 y2], {x1, -1, 1}]will take extremely long (if it finishes at all). For another clue, giving this one about 10 seconds shows that MMA creates an impossible integrand (for it) after the first integration, suggesting the complications it's running into:Integrate[ HeavisideTheta[x1 x2 + y1 y2], {x1, -1, 0}, {x2, -1, 0}, {y1, -1, 0}, {y2, 0, 1}](notice the limits of integration). UsingUnitStephelps, but is extremely slow compared toBoole(which is used exclusively onIntegrate's help page). – whuber Nov 12 '12 at 17:59