# Lecture 008

## Numerical Integration Curse of Dimensionality in Trapezoid Rule with Multidimensional Integrals and Fubini's Theorem

The basic idea is: as dimension increase, you need more sample points. So only Monte Carlo can save us.

Desired Properties of Uniform Random:

• sequence should pass statistical tests of randomness

• sequence should have a long period

• efficient to compute, requires only little storage

• repeatability: always produce the same sequence (different compilers, operating systems, processors)

Modern example is PCG32 (pcg-random.org)

But estimating with average of random sample will give us wrong estimation.

Solution: Approximate $f$ by averaging realizations of a random variable $X$, and explicitly accounting for its PDF:

F \simeq \frac{1}{N} \sum_{i = 1}^N \frac{f(x_i)}{p(x_i)} Correct, on everage, Monte Carlo Integration. With assumption that p(X_i) \neq 0p(X_i) \neq 0 when f(X_i) \neq 0f(X_i) \neq 0 (ie. assuming unbiased pp)

// TODO: code Derivation of: For an unbiased estimator, its average error is equal to its variance!

Pros

• Flexible

• Easy to implement

• Easily handles complex integrands

• Efficient for high dimensional integrands

• Unbiased estimator

Cons

• Variance (noise)

• Slow convergence ($O(\frac{1}{\sqrt{N}})$)

## Monte Carlo Sampling by Choosing $p(x)$

Rejection Sampling:

• flexible: good for complex shape

• inefficient for small area

• difficult to combine with stratification (quasi-Monte Carlo)