7
$\begingroup$

This was an exam question.

$$ \int_0^{2 \pi} \delta(\sin^2(\theta) -x ) \,d\theta $$

Direct use of Integrate on it does not give the solution. Is there a trick or workaround? Here is the code I used

ClearAll[theta,x]
integrand = DiracDelta[Sin[theta]^2 - x]
Integrate[ integrand, {theta, 0, 2 Pi}]

Here is the key solution analytical solution

Mathematica graphics

The solution uses this known relation (half way down the Wikipedia page)

Mathematica graphics

Where the sum above is over all zeros of $g(x)$ in the integration interval. Mathematica does not seem to know this relation?

ps. Maple can't do it either.

$\endgroup$
1
  • $\begingroup$ The integral under consideration makes no sense in traditional math: DiracDelta is not a usual function, but a distribution (see en.wikipedia.org/wiki/Dirac_delta_function as a first reading). $\endgroup$
    – user64494
    Commented May 9, 2019 at 6:29

2 Answers 2

8
$\begingroup$

You need to give Integrate assumptions:

Integrate[DiracDelta[Sin[θ]^2-x], {θ, 0, 2 π}, Assumptions -> 0<x<1]

2/Sqrt[-(-1 + x) x]

Unfortunately, Integrate is not quite smart enough to use the assumption x ∈ Reals:

Integrate[DiracDelta[Sin[θ]^2-x], {θ, 0, 2 π}, Assumptions -> x ∈ Reals]

Integrate[DiracDelta[-x + Sin[θ]^2], {θ, 0, 2 π}, Assumptions -> x ∈ Reals]

$\endgroup$
3
  • $\begingroup$ Nice! For some reason, this does not work for exponents other than 2 (e.g., Sin[θ]^3 - x). My code does not work either, presumably for the same reason (Solve is unable to determine the roots). Any idea how to work around this? $\endgroup$ Commented May 8, 2019 at 20:55
  • 2
    $\begingroup$ @AccidentalFourierTransform One hack is to replace x with EulerGamma, that will produce a result for Sin[θ]^3 - x, which you can then extrapolate into a generic answer. $\endgroup$
    – Carl Woll
    Commented May 8, 2019 at 21:18
  • $\begingroup$ The integral under consideration makes no sense in traditional math: DiracDelta is not a usual function, but a distribution (see en.wikipedia.org/wiki/Dirac_delta_function as a first reading). $\endgroup$
    – user64494
    Commented May 9, 2019 at 6:30
3
$\begingroup$
f[θ_, x_] := Sin[θ]^2 - x
Derivative[1, 0][f][θ, x] /. Solve[{f[θ, x] == 0, 0 < θ < 2 π}, θ, Reals]
Integrate[DiracDelta[x - θ]/Abs[%], {θ, 0, 2 π}] // Total

enter image description here

This code should also work for other functions $f$, presumably.

$\endgroup$
3
  • $\begingroup$ You have an extra [θ, x], and your Solve would work better if you added the domain Reals. Probably more robust than just relying on Integrate. $\endgroup$
    – Carl Woll
    Commented May 8, 2019 at 21:16
  • $\begingroup$ @CarlWoll Ah, yes, thank you! $\endgroup$ Commented May 8, 2019 at 21:28
  • $\begingroup$ The integral under consideration makes no sense in traditional math: DiracDelta is not a usual function, but a distribution (see en.wikipedia.org/wiki/Dirac_delta_function as a first reading). $\endgroup$
    – user64494
    Commented May 9, 2019 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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