# Integral over Boole step function does not evaluate

I have a uniform probability distribution in polar coordinates for ras well as phi. To get the marginal distribution as a function of x, I have to intgrate:

r[x_, y_] := Sqrt[x^2 + y^2];
p[x_, y_] := ArcTan[x, y];

G[r_, p_] :=
1/(b - a)*1/(d - c)*Boole[r - a >= 0]*Boole[b - r >= 0]*
Boole[p - c >= 0]*Boole[d - p >= 0]

Integrate[G[r[x, y], p[x, y]]/r[x, y], {y, -Infinity, Infinity},
Assumptions -> {a > 0, b > 0, b > a, c > 0, d > 0, d > c,
Element[x, Reals], Element[y, Reals]}]


However, this integral does not evaluate. If I leave out the condition on the angle p in the definition of G, everything works fine. Does the integral simple get to complicated or can this be solved somehow?

• What does convince you that there should exist a closed form for the integral? – Henrik Schumacher May 29 '18 at 14:05
• @HenrikSchumacher. I do not know that. But would it be possible for Mathematica to formulate cases depending on x,a,b,c,d and express the Boole functions as integral boundaries? – McLawrence May 29 '18 at 14:06
• @HenrikSchumacher My line of though was as follows: 1/Sqrt[x^2+y^2] can be solved. The Boolean functions can be transferred to the boundaries. Thus, the integral should have a closed form on different intervals of x. – McLawrence May 29 '18 at 14:15

I'm not sure Mathematica can solve this integral, but I guess your main question is about Boole. You can replace the boolean ranges you used with a call to HeavisideTheta. This function is closely related to DiracDelta and was made for the usage in integrals. You should probably read more about distributions and the Dirac delta function in particular.

Anyway, compare these:

Plot[Boole[x > 3], {x, -5, 5}]
Plot[HeavisideTheta[x - 3], {x, -5, 5}]


or

Plot[Boole[1 < x < 3], {x, -5, 5}]
Plot[HeavisideTheta[x - 1] - HeavisideTheta[x - 3], {x, -5, 5}]


And to give an example and show these two are equivalent

With[{
i1 = Integrate[Sin[x]*(HeavisideTheta[x] - HeavisideTheta[x - Pi]), x],
i2 = Integrate[Sin[x]*Boole[0 < x < Pi], x]},
Plot[{i1, i2}, {x, -5, 5}, PlotStyle -> {Thickness[.015], Yellow}]
] The difference in the antiderivatives is that Boole results in a Piecewise function, while HeavisideTheta gives a closed form.

• Thank you for the answer! I used HeavisideTheta before, which took too long to evaluate even without the last two angular parts, while Boole works if I leave out the angle condition. I would be fine with a piecewise function as a closed form might not exist but I do not know how to get this piecewise function. – McLawrence May 29 '18 at 20:10