Types of errors

Propagation of errors

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 $$

Uniformly distributed random numbers

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

Numerical integration

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

$$ \frac{b-a}{n} \sum_{i=1}^{n} f(x_i) $$

with $x_i = a + r_i(b-a)$