API Reference¶
soerp provides a Python implementation of the SOERP method (Cox 1979) for second-order error propagation. See the Theory and Quickstart for mathematical background and usage.
Main Features¶
- Transparent calculations with automatic derivatives
- Basic NumPy support
- Nearly all standard math module functions supported via
soerp.umath(e.g.,sin,exp,sqrt, etc.) - Analytical derivatives up to second order
- Easy continuous distribution constructors:
normal(mu, sigma)orN(mu, sigma): Normaluniform(a, b)orU(a, b): Uniformexponential(lamda, [mu])orExp(lamda, [mu]): Exponentialgamma(k, theta)orGamma(k, theta): Gammabeta(alpha, beta, [a, b])orBeta(alpha, beta, [a, b]): Betalog_normal(mu, sigma)orLogN(mu, sigma): Log-normalchi_squared(k)orChi2(k): Chi-squaredf_distribution(d1, d2)orF(d1, d2): F-distributiontriangular(a, b, c)orTri(a, b, c): Triangularstudent_t(v)orT(v): T-distributionweibull(lamda, k)orWeib(lamda, k): Weibull
Core Classes and Functions¶
uv: Uncertain variable constructor (accepts moments or a scipy.stats distribution)normal,uniform,exponential,gamma,chi_squared, ...: Distribution functionsN,U,Exp,Gamma,Chi2, ...: Same functions with uppercase namesumath: Math functions for uncertain variablesdescribe(): Print mean, variance, skewness, kurtosismoments(): Return moments of a variabled(),d2(),d2c(): First and second derivatives, mixed derivativesgradient(),hessian(): Vector/matrix of derivativeserror_components(pprint=True/False): Variance decomposition and error component breakdown
Example Workflows¶
soerp supports both direct moment input and distribution-based construction. You can:
- Create uncertain variables from moments, scipy.stats distributions, or constructors
- Combine variables using arithmetic and math functions
- Compute and print all moments, derivatives, and error components
See the Quickstart for full code examples, including:
- Assembly stack-up
- Orifice flow
- Manufacturing tolerance stackup
- Scheduling facilities
- Two-bar truss
All examples demonstrate both moment-based and distribution-based usage, as well as advanced features like error decomposition.