Engineering Examples
The examples/engineering/ directory contains real-world engineering applications of stochastic differential equations, organized in tiers of increasing complexity.
Running Engineering Examples
# List engineering examples
uv run asgard example --list | grep engineering
# Run all engineering examples
uv run asgard example -c engineering
# Run a single example
uv run asgard example engineering/01_rc_circuit_thermal_noise.yaml
# Run with monitor dashboard
uv run asgard example -c engineering --monitor
Tier Organization
Tier 1 — Ornstein-Uhlenbeck (Constant Diffusion)
Simple mean-reverting processes with constant noise intensity. These are the building blocks for more complex models.
| # | Example | Domain | SDE |
|---|---|---|---|
| 01 | RC Circuit Thermal Noise | Electrical | dV = -(V/RC)dt + sigma dW |
| 02 | Newton's Cooling | Thermal | dT = -k(T - T_env)dt + sigma dW |
| 03 | First-Order Control | Control | dx = -a(x - x_ref)dt + sigma dW |
Common structure: dX = -alpha(X - mu)dt + sigma dW — linear mean reversion to equilibrium with additive noise.
Tier 2 — Geometric Brownian Motion (Multiplicative Noise)
Processes where noise scales with the state value — common in growth and decay models.
| # | Example | Domain | SDE |
|---|---|---|---|
| 04 | Population Dynamics | Ecology | dN = rN dt + sigmaN dW |
| 05 | Component Degradation | Mechanical | dD = muD dt + sigmaD dW |
| 06 | Stochastic Inflation | Financial | dP = muP dt + sigmaP dW |
Common structure: dX = mu*X dt + sigma*X dW — exponential growth/decay with proportional noise. Solutions are always positive (lognormal distribution).
Tier 3 — Square-Root and Absolute-Value Diffusion
Processes with state-dependent noise that requires special handling.
| # | Example | Domain | Feature |
|---|---|---|---|
| 07 | Chemical Birth-Death | Chemical | sqrt() diffusion (CLE) |
| 08 | Structural Vibration | Structural | abs() in diffusion |
Key insight: The chemical Langevin equation uses sqrt(X) diffusion, which naturally arises from the Poisson nature of molecular reactions. The abs() guard prevents NaN from transiently negative states.
Tier 4 — Coupled SDEs
Multi-equation systems where state variables interact through their drift terms.
| # | Example | Domain | Coupling |
|---|---|---|---|
| 09 | Mass-Spring-Damper | Mechanical | Position + velocity |
| 10 | Predator-Prey (Lotka-Volterra) | Ecology | Bilinear interaction |
| 11 | Kalman-Bucy State Estimation | Control | Hidden state + observation |
See the Coupled SDEs guide for the YAML format and expression syntax.
Tier 5 — Decision and Optimization
These examples go beyond simulation to answer actionable questions.
| # | Example | Domain | Key Feature |
|---|---|---|---|
| 12 | Epidemic Outbreak Response (SIR) | Public Health | 3-coupled SDE, time-dependent intervention |
| 13 | Infrastructure Budget Contingency | Finance | Percentile analysis for contingency sizing |
| 14 | Predictive Maintenance Scheduling | Reliability | First-passage time for maintenance scheduling |
| 15 | Spring Constant Identification | Mechanical | Gradient optimization, inverse problem |
What makes Tier 5 different: Each example frames a real-world decision problem and produces a concrete recommendation (e.g., "set contingency budget at the 90th percentile", "schedule maintenance before 95% failure probability").
Tier 6 — Cross-Domain Applications
Complex multi-physics examples combining techniques from earlier tiers.
| # | Example | Domain | Key Feature |
|---|---|---|---|
| 16 | Power Grid Frequency Regulation | Electrical | 4-coupled SDE (swing equations), two generators |
| 17 | Two-Compartment Drug Dosing | Pharmacokinetics | Coupled PK compartments, periodic dosing, therapeutic window |
| 18 | Solar Farm Battery Sizing | Energy | OU generation with diurnal solar cycle, battery clamping |
| 19 | Heat Exchanger Calibration | Thermal | Gradient optimization pipeline, inverse problem |
What makes Tier 6 different: These examples combine multiple domains and techniques — coupled dynamics from Tier 4, optimization from Tier 5, and non-trivial physics (periodic forcing, clamped state, multi-generator coupling).
Example Walkthrough: RC Circuit Thermal Noise
The simplest engineering example demonstrates thermal noise in an RC circuit:
name: RC Circuit Thermal Noise
description: |
Johnson-Nyquist noise in an RC low-pass filter.
dV = -(V/RC) dt + sqrt(2 k_B T / C) dW
equation: "Y = sde($drift, $sigma, X)"
stochastic:
calculus: ito
n_paths: 1000
dt: 0.001
seed: 42
simulate:
t_start: 0.0
t_end: 0.1
initial_condition:
x0: 0.0
params:
drift: -100.0 # -1/RC, with RC = 10ms
sigma: 0.0064 # sqrt(2 * k_B * T / C)
output:
type: StochasticEnsemble
title: "RC Circuit: Thermal Noise"
Physical interpretation: The voltage across the capacitor fluctuates around zero due to thermal agitation of charge carriers. The OU process captures the RC time constant (mean reversion) and the equilibrium voltage variance predicted by the fluctuation-dissipation theorem.
Next Steps
- Coupled SDEs — Multi-equation system details
- YAML Examples — Complete field reference
- Gradient Optimization — Inverse problems and parameter identification