Build mathematical modelsLesson 42 of 48 · 9 min
Propagate small input uncertainty
Use a Jacobian for a first-order covariance approximation and state its limits.
Maths refresher: Variance, covariance and local change
Variance is the average squared departure from the mean. Covariance averages the product of two inputs’ departures from their means, so it can be positive, negative or zero.
For one output , the variance is times the input variance. Multiple outputs can share covariance through common inputs.
A nonlinear model can transform uncertainty in several inputs into related output uncertainties. Near a nominal point, the Jacobian collects partial derivatives that describe the local linear response. Multiplying propagates an input covariance matrix through that linear approximation.
The example uses rectangle length and width with independent, invented variances. Its outputs are area and perimeter. Even independent inputs can produce correlated outputs because both outputs depend on the same lengths.
Evaluate the Jacobian at the nominal input before applying the covariance formula. The result is first-order propagation, not an exact uncertainty law for every nonlinear transformation. Large spread, skewness, boundaries and dependence can make a simulation or richer analysis necessary.
Can area and perimeter be correlated even if length and width errors are independent?
Write a prediction (optional)
First-order propagation of invented input uncertainty
Select Run Python with the code unchanged.
Your saved draft is open. To use the published code, select Restore example in Tools. Use Recover draft to bring back your code.
Tools
About Python
Python and the course packages can load while you read. Each run starts with fresh user variables; imported modules stay loaded. Stop replaces the worker. Runtime details ↗
Ctrl+Enter or ⌘+Enter runs Python.
Execution error
Technical error details
Your result
Python text output
Compare with the worked example
Executed from the published Python during the site build. Your own run appears above. Build environment ↗
Worked text output
Jacobian, input order (length,width): Matrix([[width, length], [2, 2]]) Jacobian at (2,3): Matrix([[3, 2], [2, 2]]) Approximate output covariance, order (area,perimeter): Matrix([[1/4, 11/50], [11/50, 1/5]]) Approximate area variance: 1/4
Read the starter result
In the output covariance matrix, the diagonal entries give separate variances. The off-diagonal entries record shared output variation. The first diagonal entry is printed separately as Approximate area variance.
Edit and compare
Replace cross_covariance = 0 with cross_covariance = sp.Rational(1,100). This invented positive covariance is half the product of the two input standard deviations. Select Run Python. Compare Approximate area variance with the independent-input result.
Scope. This is a local approximation using invented input uncertainty. The starter assumes independent inputs and the edited comparison supplies an assumed covariance.
Try a fresh case
When is this first-order result most in need of further checking?
Need a hint?
Hint 1
Ask whether one local slope represents the whole uncertain region.
Hint 2
Compare with a suitable simulation when curvature matters.