Hi!(adsbygoogle = window.adsbygoogle || []).push({});

I'm trying to write an algorithm that performes Importance Sampling Monte Carlo integration.

I found some info about it, but I have trouble understanding how it actually can be implemented.

Let f(x) be the function we want to integrate and p(x) the non-uniform probability distribution function which is normalized and is in the same shape as f(x). p(x) returns values in the range of the interval we want to integrate. The monte carlo importance sampling formula is the following:

[tex] <f>=\int_{0}^{1}f(x)dx= \int_{0}^{1}p(x) \frac{f(x)}{p(x)}dx [/tex]

So I thought that the implementation is the following

[tex]<f>= \frac{1}{N} \sum_{i=1}^{N} \frac{f(x _{i} )}{p(x _{i} )} [/tex]

and the estimated error will be given by:

[tex] ( \frac{1}{N} \sum_{i=1}^{N} \frac{f(x _{i} )*(f(x _{i} )}{p(x _{i} )}) -<f> ^{2}[/tex]

The problem is that this works only for integrals in the range 0 to 1.

What should I do if I want to integrate over the range from a to b?

And how are these formulas modified when dealing with a multidimentional integral. If my understanding of importance sampling is already wrong please correct me!

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Monte Carlo Integration - Importance Sampling

Loading...

Similar Threads - Monte Carlo Integration | Date |
---|---|

A Lebesgue measure and integral | Jan 14, 2018 |

Monte Carlo integration method: sampling in region? | Jul 21, 2010 |

Monte Carlo Integration-reliability of the error estimate for funcs not square integr | Dec 5, 2009 |

Monte carlo Intigration | May 16, 2005 |

**Physics Forums - The Fusion of Science and Community**