Validation
Every solver in the engine ships with tests that run in CI on every change. Three kinds:
- Exact solutions. Start from a closed-form soliton, run for many periods, compare pointwise.
- Invariants. Compute the conserved quantities before and after and demand they agree to round-off.
- Qualitative physics. Two solitons must emerge from a collision with their original amplitudes.
Mechanics
Section titled “Mechanics”| Scenario | Checked | Result |
|---|---|---|
| Projectile | position against the closed form at any time step | round-off |
| Mass on a spring | period against Verlet’s known dispersion, energy drift | 1e-8, 1e-5 |
| Atwood machine, block and hanging mass | acceleration, tension, normal force | round-off |
| Simple pendulum, 2 rad | period against the elliptic integral, convergence order | 1.7e-8, order 2.0 |
| Block on incline | at rest with friction ; sliding acceleration | 1e-10 |
| Sliding block | stopping distance, friction work, ledger drift | 4e-9, 5e-10, 3e-9 |
| Collisions | elastic and inelastic outgoing velocities, energy lost, 90° scattering of equal discs | 1e-10 |
| Rolling disc | rolling acceleration and ; slipping when is too small | 1e-8 |
| Seesaw | balanced stays still; tipping angular acceleration | 1e-9 |
| Bouncing ball | apex ratios , first landing time | 3e-5, 1e-6 s |
| Massive pulley, flywheel | acceleration, both tensions, rim speed | 1e-8 |
| Every catalogue scenario | builds, runs, round-trips through JSON | passes |
| Equation | Test | Error |
|---|---|---|
| KdV | single soliton, | |
| KdV | two-soliton invariants, 8000 steps | drift |
| KdV | collision amplitude recovery | within of exact |
| NLS | moving bright soliton, | |
| NLS | two-soliton invariants, 10000 steps | drift |
Reproduce with:
git clone https://github.com/soliton-physics/solitoncd soliton && cargo test --releaseThe playground shows the invariants and their drift live in the side panel, so you can watch the solver’s accuracy while it runs.