>[!warning]
>This content has not been peer reviewed.
# Relational Dynamics — Code
## Purpose
`rst_relational_dynamics.py` demonstrates two applications of the RST fidelity function to classical dynamics:
1. **Dynamical friction** — fits the Chandrasekhar drag profile h(X) as μ(X, n)^α
2. **Lorentz factor** — proves that γ = 1/μ(η, 2) is an exact algebraic identity
## Modes
- `--friction` — Fit μ^α to Chandrasekhar h(X), extract n_dyn and α
- `--lorentz` — Demonstrate the exact Lorentz identity, scan n values
Running with no flags executes both modes.
## Dependencies
- `numpy`, `scipy`, `matplotlib`
- `rst_engine.core.mu_rst` (workspace root)
## Run
From workspace root:
```bash
python "expanded theory applied/further applications/Relational Dynamics/rst_relational_dynamics.py"
python "expanded theory applied/further applications/Relational Dynamics/rst_relational_dynamics.py" --friction
python "expanded theory applied/further applications/Relational Dynamics/rst_relational_dynamics.py" --lorentz
```
## Output
**Friction mode:**
- Console: n_dyn, α, R², sample comparison table
- `relational_dynamics_friction.png` — Chandrasekhar vs RST profile + residual
**Lorentz mode:**
- Console: exact proof, n-scan table, velocity comparison
- `relational_dynamics_lorentz.png` — 3-panel: exact match, n-scan, machine-precision error
**CSV:** `relational_dynamics_results.csv`
## Links
- **Theory:** [[Relational Dynamics (RST)]]
- **Results:** [[Relational Dynamics Results]]