trapzVariance

fiducia.stats.trapzVariance(yUnc, x=None, dx=1.0)[source]

Error propogation for Trapezoidal rule integration using uniform or non-uniform grids.

Parameters
  • yUnc (list, numpy.ndarray) – The list of uncertainities, referenced as \(\sigma_i\).

  • x (list, numpy.ndarray, optional) – The sampling points for which the uncertainites ‘’y’’ were found. Must be the same length as ‘’y’’. If none are provided, then the step size will be uniform and set with ‘’dx’’. The default is None.

  • dx (int, float, optional) – Step size. Only applies if sampling points aren’t specified with ‘’x’’. The default is 1.0.

Returns

variance – The total variance (\(\sigma^2\)) found by propagating ‘’y’’.

Return type

float

Notes

Trap rule integration with non uniform spacing takes the form

\[\sum_{k=1}^N \frac{\Delta x_i}{2} \left(f(x)_{i-1} + f(y)_i \right)\]

Propogating the uncertainties through this integration results in

\[\sigma^2 = \frac{1}{4} \left(\sum_{k=1}^N \Delta x_i \sigma_{i-1}^2 + \sigma_i^2 + 2\sum_{k=1}^{N-1} \Delta x_i \Delta x_i+1 \sigma_i^2 \right)\]

The equation is generalized and applies to uniform and non-uniform step sizes.

Examples