Monte Carlo Method to integrate function

258 Views Asked by At

I want to approximate the integral

$$\int_0^\infty\,\text{d}x \exp(-x^2)h(x)$$

with a bounded function $h: \mathbb{R} \rightarrow \mathbb{R}$ using a Monte-Carlo-method.

I tried the following: Let $X_k, k \in \mathbb{N}$ be exponential distributed random variables with $\lambda = 1$. Then we get for the random variables $Y_k := h(X_k)$ the expectation:

$$\int_0^\infty \,\text{d}x\exp(-x)h(x)$$

I seem to be almost there, but can't get the square into the exponent.

1

There are 1 best solutions below

0
On

You have (at least) two possibilities:

  1. Use the transformation $x = \sqrt{y}$ (and $\mathrm dx = \frac{1}{\sqrt{2}}\mathrm dy$) to rewrite your integral as $$ \int_0^\infty \exp(-x^2)h(x)\, \mathrm dx = \int_0^\infty \exp(-y)\frac{h(\sqrt{2})}{2\sqrt{y}}\, \mathrm dy $$ and apply the MC method with the exponential distribution and $\tilde h(y) := \frac{h(\sqrt{2})}{2\sqrt{y}}$.

  2. Use a normally distributed random variable $Z$ and $Y=|Z|$. If the density of $Z$ is $f_Z(z) = \frac{1}{\sqrt{\pi}}\exp(-z^2)$ on $(-\infty,\infty)$, then, by symmetry, the one of $Y$ is given by $f_Y(y)=\frac{2}{\sqrt{\pi}}\exp(-y^2)$ on $[0,\infty)$, which is nearly what you need. Note that $Z$ is not the standard normal distribution, but with a variance of $1/2$, and that you have to take care of the normalizing constants. Then you can rewrite your integral as $$ \int_0^\infty \exp(-x^2)h(x)\, \mathrm dx = \frac{\sqrt{\pi}}{2}\int_0^\infty f_Y(y)h(y)\, \mathrm dy $$ and apply the MC method using $Y$.