The algorithm for this procedure is
- Use the uniform distribution to find the random variable y in the interval [0,1]. The function p(x) is a user provided PDF.
- Evaluate thereafter
\begin{equation*}
I=\int_a^b F(x) dx =\int_a^b p(x)\frac{F(x)}{p(x)} dx,
\end{equation*}
by rewriting
\begin{equation*}
\int_a^b p(x)\frac{F(x)}{p(x)} dx =
\int_{\tilde{a}}^{\tilde{b}}\frac{F(x(y))}{p(x(y))} dy,
\end{equation*}
since
\begin{equation*}
\frac{dy}{dx}=p(x).
\end{equation*}
- Perform then a Monte Carlo sampling for
\begin{equation*}
\int_{\tilde{a}}^{\tilde{b}}\frac{F(x(y))}{p(x(y))} dy\approx \frac{1}{N}\sum_{i=1}^N\frac{F(x(y_i))}{p(x(y_i))},
\end{equation*}
with
y_i\in [0,1] ,
- and evaluate the variance as well.