>[!warning]
>This content has not been peer reviewed.
# Variational principles — Code
Script: `rst_variational_cost_vs_mu.py`.
## Purpose
Illustrates a simple **cost vs fidelity** trade-off: a one-parameter family of
paths with different "costs" \(S\) (proxy for action) and corresponding
effective signal-to-noise ratios, and compares this with the **RST fidelity**
\(\mu(\eta, n)\). Paths with lower cost correspond to higher \(\mu\).
## Engine
Imports from `rst_engine`: `mu_rst` and `DEFAULT_N`. This application lives
under **foundation/** so the workspace root is **three** levels up
(`..`, `..`, `..`).
## Parameters
| Parameter | Value | Meaning |
|:---|:---|:---|
| \(S\) | lin-spaced, 0.1 to 10 | Proxy for action / path cost. |
| \(\eta\) | decreasing function of \(S\) | Proxy for signal-to-noise ratio. |
## Output
- **Figure:** `variational_cost_vs_mu.png` — plots cost \(S\) vs RST fidelity
\(\mu(\eta(S), n)\), highlighting that lower-cost paths correspond to higher
fidelity. Saved in the same subfolder.
## Links
- **Foundation:** [[Variational principles (RST)]]
- **Roadmap:** [[../../Applications Roadmap]]