I have some complicated function depending on many arguments $x,y,z$ and parameter $a$ multiplied by Dirac delta of another function,
$$ \tag 1 f(a,x,y,z) = g(a,x,y,z)\delta(t(a,x,y,z)) $$
I want to perform numerical integration over all the variables. Then, independently on the parameter a which has been chosen, the result is 0. However, evaluating the same integral analytically, I obtain non-zero result.
What is a reason that Mathematica doesn't evaluate the numerical integral correctly, and how to force it to do this? It seems that I can't use limit representations of the Dirac delta because of the numerical integration.
Edit. My example is
f[a_,x_,y_,z_] =(a^4 + 6400 a^2 - 81920000) Exp[-0.01 x^2] Sqrt[y^2 - a^2]Sin[z] UnitStep[11 Pi/45 - z] UnitStep[z - 11 Pi/90] DiracDelta[a^2 + 2 Sqrt[y^2 - a^2] x Cos[z] - 2 y Sqrt[x^2 + 6400] + 6400]
I want to integrate it over the region $x \in (0,3000), \ y\in (a,3000), \ z \in (0,\pi)$. I can perform the first step - evaluate one of the integrals by rewriting the Dirac delta as, say, $$ \delta (t(a,x,y,z)) = \frac{\delta(x-x_{1})}{|t'(x_{1})|}+\frac{\delta(x-x_{2})}{|t'(x_{2})|}, $$ where $x_{1,2} \equiv x_{1,2}(a,y,z)$ are solutions of $t(a,x,y,z) = 0$, and then to introduce reduced function depending only on $a,y,z$, $$ \tag 2 f_{1}(a,y,z) = \frac{g(a,x_{1},y,z)}{|t'(x_{1})|}+\frac{g(a,x_{2},y,z)}{|t'(x_{2})|}, $$ where $g$ is defined in $(1)$. However, this step introduces extra work which I would like to avoid.
Simple numerical integration
NIntegrate[f[2, x, y, z], {x, 0, 3000}, {y, 2, 3000}, {z, 0, Pi}]
gives zero, but the integration performed with $(2)$ is non-zero.
DiracDelta
is that it will evaluate to0
when fed by a nonzero numerical argument. This way, $\delta(t(a,x,y,z))$ will quite likely be interpreted as function that is zero almost everywhere (but in reality, $\delta$ is not a function). It is better not to use it for numerical code. If I understand you correctly, you want to intergrate over the hypersurface defined by the equation $t(a,x,y,z) = 0$. Please, provide the concrete equations. $\endgroup$KroneckerDelta
andDiscreteDelta
andDiracDelta
are not the same thing. $\endgroup$NIntegrate[ g[a, x, y, z], {a, x, y, z} \[Element] ImplicitRegion[t[a, x, y, z] == 0, {a, x, y, z}]]
$\endgroup$