Monte Carlo For Integral Involving Dirac-Delta How does one do MC for integrand which has dirac-delta function like following:
$I=\int e^{-S(x)} \delta(f(x))dx$
where $x$ would be multi-dimensional, and hence this is a multi-dimensional integral over coordinates such as $x_1,x_2,x_3$ and so on. 
I want to do importance sampling. I do have my sampling distribution $g(x)$ which is nice, and closely resembles $e^{-S(x)}$. My major problem is dealing with dirac-delta. I want to do it completely using MC. In other words, I don't want to integrate out dirac-delta analytically, and perform the rest of the integrals over $x_2,x_3$, etc. by MC. Rather, everything is supposed to be done numerically using MC. Does anyone have any idea how to deal with dirac-delta distribution in monte carlo sampling methods? 
 A: Use the identity
\begin{align*}
\int_{\mathbb{R}^{n}}\exp(-S(\mathbf{x})) \delta(f(\mathbf{x})) \, \mathrm{d}\mathbf{x} = \int_{f^{-1}(0) \subset \mathbb{R}^{n-1}}  \frac{\exp(-S(\mathbf{x})) }{|\nabla f(\mathbf{x})|} \, \mathrm{d}\mathbf{x}
\end{align*}
and then use Monte-Carlo on the surface integral. The difficulty will be accurate determination of the surface $f^{-1}(0)$.
Note that naive application of Monte-Carlo integration to an integrand with a delta-function will never work. You attempting to randomly sample a set with measure zero, so unless some finite-precision arithmetic works in your favor, the integral will always evaluate to zero.
A: One thought: the Dirac Delta is technically defined as the limit of a sequence of functions (like box functions or Gaussians). Just take one of these functions for your Dirac Delta and perform MC on that. That is, use
$$ \delta(x) \approx \frac{1}{n\sqrt{\pi}} e^{-(x/n)^2} $$
as an approximation to the Dirac Delta, for some suitably large $n$.
