Types of errors
- Statistical errors: repeated measurements is better
- Systematic errors: will not improve with more data
Given a quantity $x$ that has a measurement error characterised by a variance $V(x)$. The error propagation to a function $f(x)$ will yield to a variance on that function which is $V(f)$:
$$ V(f) \approx \left( \frac{\partial f}{\partial x} \right)^2 V(x) $$
If the function includes more than one quantity which have uncertainties:
$$ V(f) \approx \left( \frac{\partial f}{\partial x} \right)^2 V(x) + \left( \frac{\partial f}{\partial y} \right)^2 V(y) + \dots + 2 \left( \frac{\partial f}{\partial x} \right) \left( \frac{\partial f}{\partial y} \right) \operatorname{cov} (x,y) + \dots $$
Generating random uniform integers between 0 and $m-1$ using the linear congruential generator (LCG) (Pseudo random number generator)
$$ n_{i} = (a n_{i-1} + c) \operatorname{mod} m $$
where $a,c$ and $m$ are provided constants, $n_{i-1}$ is the previous number and $n_i$ is current
We can turn it to a fraction between 0 and 1:
$$ r_i=\frac{n_i}{m} $$
🗒️ Note: LCG repeat after at most $m$ draws
Consider
$$ I = \int_a^b f(x) \,\text dx $$
We can approximate
$$ I \approx \frac{b-a}{n} \sum_{i=1}^{n} f(x_i) $$
with $x_i = a + \left( i-\frac{1}{2} \right)\frac{(b-a)}{n}$
Procedure for ‘crude’ Monte Carlo integration
- Generate $n$ random numbers $r_i$ drawn from a random distribution $U(0,1)$
- Evaluate the integral according to
$$ \frac{b-a}{n} \sum_{i=1}^{n} f(x_i) $$
with $x_i = a + r_i(b-a)$