pyuncertainnumber.propagation.taylor_expansion

Functions

taylor_expansion_method(→ tuple)

Performs uncertainty propagation using the Taylor expansion method.

taylor_expansion_method_scalar(→ tuple)

For scalar random variable only

taylor_expansion_method_vector(→ tuple)

For random vector only

Module Contents

pyuncertainnumber.propagation.taylor_expansion.taylor_expansion_method(func, mean, *, var=None, cov=None) tuple

Performs uncertainty propagation using the Taylor expansion method.

Parameters:
  • func – function to propagate uncertainty through. Expecting a iterable-signature function.

  • mean (Jax array) – mean of the input random variable (scalar or vector)

  • var (Jax array) – variance of the input random variable (scalar only)

  • cov (Jax array) – covariance matrix of the input random vector (vector only)

Returns:

mean of the output random variable through the function var_f: variance of the output random variable through the function

Return type:

mu_f

Note

Currently it only supports scalar-output functions. Also, for multivariate function, the calling signature is assumed to be func(x) where x is a 1D array, i.e. func: R^n -> R, the vec style. For best compatibility to work with derivatives, the func is better written in jax.numpy.

Example

>>> import jax.numpy as jnp
>>> from pyuncertainnumber import taylor_expansion_method
>>> MEAN= jnp.array([3., 2.5])
>>> COV = jnp.array([[4, 0.3], [0.3, 0.25]])
>>> def bar(x): return x[0]**2 + x[1] + 3
>>> mu_, var_ = taylor_expansion_method(func=bar, mean=MEAN, cov=COV)
pyuncertainnumber.propagation.taylor_expansion.taylor_expansion_method_scalar(func, mean, var) tuple

For scalar random variable only

pyuncertainnumber.propagation.taylor_expansion.taylor_expansion_method_vector(func, mean, cov) tuple

For random vector only