I am trying to numerically evaluate an integral that came up in my work. The integral takes the form
$$ \int_0^{\infty}dx\tanh(\alpha(x-x^*))\int_0^{\infty}dzf(x,z)\delta(g(x,z)-\beta t(z)) $$
with $\delta(...)$ the Dirac delta function. It is straightforward to write some code to find a $z^*$ such that $g(x,z^*)-\beta h(y^*)\approx0$, but the code takes awhile to solve the expression. I have tried using an approximation for $\delta()$, taking it as the limit of narrower Gaussians, but I found that I could not choose a sufficiently small width parameter, given the actual numbers that go into these expressions. I found a little more success with equation 2.2 from here, but I find that varying $n$ by orders of magnitude changes my results by orders of magnitude, which I would not expect after a sufficiently large $n$. Does anyone have any advice for tackling this integral? I'd prefer to use the scipy module in python if possible.