From grimoire
Calculates how measurement uncertainties propagate through mathematical operations using partial derivative or Monte Carlo methods. For computing combined uncertainty in sums, products, powers, and general functions.
How this skill is triggered — by the user, by Claude, or both
Slash command
/grimoire:calculate-error-propagationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Propagate measurement uncertainties through mathematical operations using partial derivative methods — quantifying the combined uncertainty of a calculated result from uncertainties in measured input quantities, following GUM methodology.
Propagate measurement uncertainties through mathematical operations using partial derivative methods — quantifying the combined uncertainty of a calculated result from uncertainties in measured input quantities, following GUM methodology.
Adopted by: ISO/IEC Guide 98-3 (GUM) is the international standard for measurement uncertainty, adopted by BIPM, NIST, PTB, NPL, and all national metrology institutes. Every ISO 17025-accredited testing laboratory reports uncertainty following GUM. Scientific journals (APS, Nature, ACS) require uncertainty quantification for experimental results. Impact: Taylor (1997) demonstrates that improper error propagation produces either overconfident results (understated uncertainty, leading to false precision) or uselessly conservative bounds (overstated uncertainty). The 2019 redefinition of the SI system (fixing exact values of physical constants) was predicated on uncertainty analyses from multiple independent metrology institutes using GUM methodology. Incompatible scientific results between laboratories are often traceable to different uncertainty quantification practices.
Following GUM, two approaches to evaluating standard uncertainty:
Coverage factor k: relates standard uncertainty to expanded uncertainty U = k·u_c
For quantity q calculated from measured values x₁, x₂, ..., each with uncertainty δx₁, δx₂, ...:
General formula (partial derivative method / GUM):
u_c(q) = √[Σᵢ (∂q/∂xᵢ)² · u²(xᵢ)]
Valid when inputs are uncorrelated and uncertainties are small relative to the value.
Addition/subtraction: q = x ± y
u(q) = √[u(x)² + u(y)²]
Absolute uncertainties add in quadrature.
Multiplication/division: q = x·y or q = x/y
u(q)/q = √[(u(x)/x)² + (u(y)/y)²]
Relative (fractional) uncertainties add in quadrature.
Power: q = xⁿ
u(q)/q = |n| · u(x)/x
Relative uncertainty multiplies by the exponent magnitude.
General function q = f(x, y):
u(q) = √[(∂f/∂x)² · u(x)² + (∂f/∂y)² · u(y)²]
Density calculation: ρ = m/V, where V = L × W × H (rectangular block)
Measurements:
Step 1: V = 5.12 × 3.08 × 2.54 = 40.09 cm³ Step 2: Relative uncertainty in V:
u(V)/V = √[(0.01/5.12)² + (0.01/3.08)² + (0.01/2.54)²]
= √[(0.00195)² + (0.00325)² + (0.00394)²]
= √[3.8×10⁻⁶ + 1.06×10⁻⁵ + 1.55×10⁻⁵] = 0.0053 = 0.53%
u(V) = 0.0053 × 40.09 = 0.21 cm³
Step 3: Relative uncertainty in ρ:
u(ρ)/ρ = √[(u(m)/m)² + (u(V)/V)²] = √[(0.2/125.4)² + (0.0053)²]
= √[(0.00160)² + (0.00530)²] = 0.0055 = 0.55%
ρ = 125.4/40.09 = 3.128 g/cm³
u(ρ) = 0.0055 × 3.128 = 0.017 g/cm³
Report: ρ = 3.13 ± 0.02 g/cm³ (k=1, 68% confidence)
When inputs are correlated (e.g., same instrument used for two measurements):
u²_c(q) = Σᵢ (∂f/∂xᵢ)² u²(xᵢ) + 2 Σᵢ<j (∂f/∂xᵢ)(∂f/∂xⱼ) u(xᵢ,xⱼ)
Where u(xᵢ,xⱼ) = r(xᵢ,xⱼ) · u(xᵢ) · u(xⱼ) is the covariance and r is the correlation coefficient.
For perfectly correlated (r=+1) variables: errors ADD, not in quadrature — worst case for systematic bias.
When partial derivatives are difficult or inputs have non-Gaussian distributions:
import numpy as np
# Monte Carlo uncertainty propagation
N = 100000
m_samples = np.random.normal(125.4, 0.2, N)
L_samples = np.random.normal(5.12, 0.01, N)
W_samples = np.random.normal(3.08, 0.01, N)
H_samples = np.random.normal(2.54, 0.01, N)
rho_samples = m_samples / (L_samples * W_samples * H_samples)
rho_mean = np.mean(rho_samples)
rho_std = np.std(rho_samples) # standard uncertainty
rho_95 = np.percentile(rho_samples, [2.5, 97.5]) # 95% CI
Monte Carlo propagation is especially important when uncertainties are large relative to the value, or when the function is strongly nonlinear.
npx claudepluginhub jeffreytse/grimoire --plugin grimoireCalculates measurement uncertainty for physical measurements using GUM methodology (Type A/B, combined, expanded). For scientific and metrological reporting.
Performs symbolic mathematics in Python: solving equations, calculus, algebra, matrix manipulation, physics calculations, and code generation. Use for exact symbolic results instead of numerical approximations.
Performs symbolic mathematics in Python with SymPy: solve equations algebraically, compute derivatives/integrals/limits, manipulate expressions, work with symbolic matrices, and generate code from formulas. Use when exact symbolic results are needed.