I want to plot the definite integral of the following function

    Integrand[p_, Q2_, ν_, θ_] := p^2/(M^2 (M - 2*E3[p])^2) 
    1/(E3[p] E4[p, Q2, ν, θ]) 1/D[f[p, Q2, ν, θ], p] 
    DiracDelta[p - p3zero1[Q2, ν, θ]]+p^2/(M^2 (M - 2*E3[p])^2) 
    1/(E3[p] E4[p, Q2, ν, θ]) 1/D[f[p, Q2, ν, θ], p] 
    DiracDelta[p - p3zero2[Q2, ν, θ]]

Where the integration over p runs from 0 to Infinity and the integration over θ runs from 0 to Pi. The definitions of p3zero1 and p3zero2 are bad enough that I can't analytically integrate the function and I don't know a priori if they are always greater or smaller than 0 for all points on the integration region. I then came up with the following code to plot it.

    Plot3D[NIntegrate[Integrand[p, Q2, ν, θ], {p, 0, Infinity},
    {θ, 0, π}], {Q2, 0, 5000}, {ν, 0, 2000}]

The problem that I'm facing is that the Dirac delta function is not defined for numerical integrals. Numerical integrations of Dirac deltas appear to always return 0. But I need a way to plot the function in terms of Q2 and ν.


  • $\begingroup$ Encyclopedia of Mathematics and Wiki say nothing about any integrals of the $\delta$-distribution over the positive ray of the real axis. As I know it, such integrals make no sense. $\endgroup$ – user64494 May 15 at 8:20

Integrate can be used to handle the DiracDelta,

Integrate[Integrand[p, Q2, ν, θ], {p, 0, Infinity}, 
    Assumptions -> p3zero2[Q2, ν, θ] ∈ Reals && p3zero1[Q2, ν, θ] ∈ Reals]
(* ((HeavisideTheta[p3zero1[Q2, ν, θ]]*p3zero1[Q2, ν, θ]^2)/
   ((M - 2*E3[p3zero1[Q2, ν, θ]])^2*E3[p3zero1[Q2, ν, θ]]*
   E4[p3zero1[Q2, ν, θ], Q2, ν, θ]*Derivative[1, 0, 0, 0][f][p3zero1[Q2, ν, θ], Q2, ν, θ]) 
   + (HeavisideTheta[p3zero2[Q2, ν, θ]]*p3zero2[Q2, ν, θ]^2)/
   ((M - 2*E3[p3zero2[Q2, ν, θ]])^2*E3[p3zero2[Q2, ν, θ]]*
   E4[p3zero2[Q2, ν, θ], Q2, ν, θ]*Derivative[1, 0, 0, 0][f][p3zero2[Q2, ν, θ], Q2, ν, θ]))
   /M^2 *)

However, NIntegrate will not work for the remaining integrand, unless all symbols except θ are given numerical values. This can be done by creating a Table in Q2 and ν of integrals over θ, which then can be plotted with ListPlot3D.

  • 1
    $\begingroup$ I should have thought of this. The indefinite integral will get rid of the delta functions, as you had said. You can however plot a numerical integral such as the one that I have given above since the Plot function inputs values for Q2 and nu into the argument. Try something like Plot[NIntegrate[c*x, {c, 0, Pi}], {x, 0, 10}]. $\endgroup$ – T-Ray Aug 26 '15 at 6:58
  • $\begingroup$ @JohnTerry Indeed so, Well done. $\endgroup$ – bbgodfrey Aug 26 '15 at 10:50

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.