6
$\begingroup$

I am performing lots of simple calculations with dirac delta functions. It would be awesome if Mathematica could do this routine exercise for me, eliminating any possible human errors. For example, this integral:

Integrate[DiracDelta[t - a - (r^2 + (z - a)^2)^(1/2)] /
  (4 Pi (r^2 + (z - a)^2)^(1/2)), {a, -Infinity, Infinity}]

Mathematica does not know how to evaluate it.

I tried using FunctionalExpand to expand the delta-function, but in this case it does nothing. But I can easily take the integral above manually.

Maybe there is a way of evaluating such integrals automatically?

$\endgroup$
5
$\begingroup$

Adding assumptions finds two of the cases.

Assuming[{a, t, r, z} ∈ Reals && t > z,
 Integrate[
  DiracDelta[
    t - a - (r^2 + (z - a)^2)^(1/2)]/(4 Pi (r^2 + (z - a)^2)^(1/2)),
  {a, -Infinity, Infinity}]
 ]
(*  1/(4 π t - 4 π z)  *)

Assuming[{a, t, r, z} ∈ Reals && t < z,
 Integrate[
  DiracDelta[
    t - a - (r^2 + (z - a)^2)^(1/2)]/(4 Pi (r^2 + (z - a)^2)^(1/2)),
  {a, -Infinity, Infinity}]
 ]
(*  (-t + z)/(4 π r^2)  *)

The case t == z seems to reveal a bug:

Assuming[{a, r, z} ∈ Reals,
 Integrate[
  DiracDelta[
     t - a - (r^2 + (z - a)^2)^(1/2)]/(4 Pi (r^2 + (z - a)^2)^(1/2)) /. t -> z,
  {a, -Infinity, Infinity}]
 ]

Select::normal: Nonatomic expression expected at position 1 in Select[Integrate`ImproperDump`newx,Integrate`NLtheoremDump`sel$293548]. >>

Mathematica graphics

$\endgroup$
  • $\begingroup$ At t==z, the argument of DiracDelta vanishes only at Infinity. $\endgroup$ – bbgodfrey Feb 12 '15 at 16:38
  • $\begingroup$ @bbgodfrey Yes, however, the interesting thing to me (with respect to this site) was that the internal code committed a programming error. $\endgroup$ – Michael E2 Feb 12 '15 at 18:02
2
$\begingroup$

Try this:

    1/(4 Pi (r^2 + (z - a)^2)^(1/2)) /. (Solve[
     t - a - (r^2 + (z - a)^2)^(1/2) == 0, a][[1, 1]]) // Simplify

(*  1/(2 \[Pi] Sqrt[(r^2 + (t - z)^2)^2/(t - z)^2])  *)

Have fun!

$\endgroup$
2
$\begingroup$

Although Mathematica cannot solve

Integrate[DiracDelta[g[x]] h[x], x]

as written, it can be transformed to

Integrate[DiracDelta[x-x0] h[x] / (Abs[D[g, x]]/.x -> x0), x]

using standard formulas, where g[x0] == 0. (Note that, if g[x] has multiple real zeroes, the preceding expression must be summed over those zeroes.)

This can be applied to the specific case here as follows, with q the original integral:

arg = Cases[q, DiracDelta[z_] -> z, Infinity];
a0 = a /. First@Solve[arg == 0, a];
q /. DiracDelta[z_] :> DiracDelta[a - a0]/(Abs[D[arg, a] /. a -> a0])

(* {Boole[-Infinity < -((r^2 - t^2 + z^2)/(2*t - 2*z)) < Infinity]/
     (2*Pi*Sqrt[(r^2 + (t - z)^2)^2/(t - z)^2]*
     Abs[1 + (-r^2 + (t - z)^2)/(Sqrt[(r^2 + (t - z)^2)^2/(t - z)^2]*(t - z))])} *)

If the constants contained in the argument of Boole are real, it evaluates to 1, and the expression greatly simplifies.

Assuming[{a, t, r, z} \[Element] Reals, Simplify[%]]
(* Piecewise[{{(4*Pi*t - 4*Pi*z)^(-1), t >= z}}, (-t + z)/(4*Pi*r^2)] *)

(This is, of course, the approach used by Alexei Boulbitch in his earlier answer.)

$\endgroup$
  • $\begingroup$ I think there's something missing from your code -- q at least -- but I can't reproduce your answer. I guess I'm brain-dead or something. If you Simplify your answer with assumptions that the variables are real, it comes out nice. $\endgroup$ – Michael E2 Feb 12 '15 at 15:57
  • $\begingroup$ @MichaelE2 Sorry, q is the original integral. I have updated my answer (and also rerun the code to assure that it works). Thanks for pointing out the omission. $\endgroup$ – bbgodfrey Feb 12 '15 at 16:15
  • $\begingroup$ +1 It works now. Note also if I use q = Inactivate[<integral>, Integrate] and then Activate on the last line, I save myself about 6 seconds on the first, fruitless attempt at the integral. $\endgroup$ – Michael E2 Feb 12 '15 at 16:29
  • $\begingroup$ @MichaelE2 Thanks for the Inactivate suggestion. By the way, I simplified my final result by assuming all constants are real, as you did. $\endgroup$ – bbgodfrey Feb 12 '15 at 16:31
  • $\begingroup$ My question was whether this could be done automatically or not. $\endgroup$ – Solenodon Paradoxus Feb 13 '15 at 14:08

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.