# Numeric integration over Dirac delta

I'm trying to solve the following integral numerically. $$H(y) = \int dx \, f(x) \, \delta(g(x,y)).$$ For this I chose a representation of the delta-function and employ convergence with respect to $\eta$ $$\sum_\limits{x_i} \, f(x_i) \, \frac{\eta}{g(x_i,y)^2+\eta^2}.$$

I calculate this for every $y$ such that I can plot $H(y)$ in the end. The problem is, that I would expect for $\eta \rightarrow 0$ the best results, but there seems to be a line (approx. $\eta=10^{-4}$) upon which I get a bunch of delta-like peaks in $H(y)$ instead of a smooth curve (for e.g. $\eta=10^{-2}$) which I want and would expect.

• What about finding the zeroes of $g(x,y)$ rather? – Joce Nov 18 '16 at 15:14
• If its only 1D or 2D, I think I have seen a good algorithm at chebfun.org. For higher dimensional problems, root finding is of course a problem. – Bort Nov 18 '16 at 15:24
• Finding the zero's of g(x,y) requires to do this for every y. One problem is also that you would have to interpolate g, because the x-dependence is known only numerically. Sounds really complicated procedure to me and I have now idea about stability of this? – J. Goe Nov 18 '16 at 15:30
• This approach would require the quadrature method to resolve large changes in function magnitude on length scale of $\eta$, so it's quite reasonable that it fails to do it well when $\eta$ is small. Finding the zeros of $g$ seems like a better approach. – Kirill Nov 18 '16 at 16:50
• I think Joce's proposition is the proper one as well. I believe approximating a Dirac functional cannot be very robust. What do you mean by "x-dependence is known only numerically"? I would assume this means that for each y you have a list of g-values corresponding to some predetermined set of x-values? – knl Nov 19 '16 at 11:02