1
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ What does convince you that there should exist a closed form for the integral? $\endgroup$ – Henrik Schumacher May 29 '18 at 14:05
  • $\begingroup$ @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? $\endgroup$ – McLawrence May 29 '18 at 14:06
  • $\begingroup$ @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. $\endgroup$ – McLawrence May 29 '18 at 14:15
1
$\begingroup$

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}]
 ]

Mathematica graphics

The difference in the antiderivatives is that Boole results in a Piecewise function, while HeavisideTheta gives a closed form.

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – McLawrence May 29 '18 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.