Skip to content

Validation

Every solver in the engine ships with tests that run in CI on every change. Three kinds:

  1. Exact solutions. Start from a closed-form soliton, run for many periods, compare pointwise.
  2. Invariants. Compute the conserved quantities before and after and demand they agree to round-off.
  3. Qualitative physics. Two solitons must emerge from a collision with their original amplitudes.
ScenarioCheckedResult
Projectileposition against the closed form at any time stepround-off
Mass on a springperiod against Verlet’s known dispersion, energy drift1e-8, 1e-5
Atwood machine, block and hanging massacceleration, tension, normal forceround-off
Simple pendulum, 2 radperiod against the elliptic integral, convergence order1.7e-8, order 2.0
Block on inclineat rest with friction mgsin⁡θm g \sin\theta; sliding acceleration1e-10
Sliding blockstopping distance, friction work, ledger drift4e-9, 5e-10, 3e-9
Collisionselastic and inelastic outgoing velocities, energy lost, 90° scattering of equal discs1e-10
Rolling discrolling acceleration and v=ωRv = \omega R; slipping when μs\mu_s is too small1e-8
Seesawbalanced stays still; tipping angular acceleration1e-9
Bouncing ballapex ratios e2e^2, first landing time3e-5, 1e-6 s
Massive pulley, flywheelacceleration, both tensions, rim speed1e-8
Circular orbitspeed constant, closes after one period, energy1e-4, one step, 1e-9
Elliptical orbitfarthest point and slowest speed; areal velocity (Kepler’s second law)1e-5, 1e-10
Escape velocitymaximum height below it; speed far away above it1e-5
Two free massescircle their common centre: separation, momentum, energy1e-7, 1e-12, 1e-9
Damped oscillatorposition against the closed form over six seconds1e-5 m
Driven oscillatorsteady amplitude below, near and above resonance2e-3
Coupled oscillatorseach normal mode against one cosine; beats against the sum of two2e-5 m, 5e-5 m
Stopping distancedistance and time to stop1e-6, 2 ms
Projectile on an inclinetime of flight and range on three slopes5e-4, 8 cm
Uniform circular motionspeed, radius, tensionround-off, round-off, 1e-5
Two blocks and a stringacceleration and tension, with and without friction1e-8
Liftthe floor’s push at four accelerations, including free fall1e-6 N
Recoilboth speeds, total momentum1e-10, 1e-9
Block and ball on a springgreatest compression, energy1e-4
Glancing collisionright angle, momentum, energy; angle and speedsround-off; 0.5°, 1 %
Torque on a rodangular speed and angle after two seconds1e-8, 1e-5
Vertical spring, springs in parallel and in seriesperiod1e-5, 1e-5, 2e-3
Coulomb’s lawforce and acceleration at the start; speed at twice the distance; energyround-off, 2e-3, 1e-7
Field of two chargesfield and force at a test charge; zero potential on the midlineround-off
Charged bob in a fieldfurthest angle; rest at the equilibrium angle, with its tension1e-4, 1e-9
Charge between platesdeflection on leaving and on the screen, either sign of charge3e-3
Balanced dropstays still at the balancing field; acceleration away from it1e-9
Dipole in a fieldcentre does not move; small-swing period; energy1e-9 m, 2e-3, 1e-6
Closest approachturning distance; energy1e-5, 1e-7
Accelerating voltageleaving speed at two gaps; supply’s work equals kinetic energy1e-3, 1e-6
Charge in a magnetic fieldspeed, radius, return to the start, zero workround-off, 1e-5, two steps, exact
Velocity selectorlands on the centre line at E/B; bent the right way either side1e-9 m
Cyclotrontime per turn; supply’s work equals kinetic energy; leaves near qBR/m3 %, 1e-4, within 20 %
Two free chargesorbit each other: momentum, energy1e-15, 1e-6
Gauss’s lawflux summed over a sphere round one charge, both, neither; part of a wire or a shell inside1e-3, 2e-3
Charged wirecircle and speed at two distances; energy1e-4, 1e-6
Charged sheetsame acceleration at two distances; an opposite charge returns to its start1e-6, 1 cm
Charged shellvelocity unchanged inside; speed outside from the energy equation1e-12, 1e-3
Bar magnetfield on the axis and beside the middle against the formulas; ratio far awayround-off, 1e-3
Compass needlesmall-swing period; fastest spin from 60°; centre does not move2e-3, 1e-4, 1e-9 m
Neutral pointsfield at the predicted point, either way round1e-9 of the earth’s
Magnetic materialsforce at the start, pushed or pulled the right way; energy1e-6, 1e-6
Free magnets and a magnetised beadmomentum, angular momentum, energy1e-15, 1e-12, 1e-6
Every catalogue scenariobuilds, runs, round-trips through JSONpasses

A few hundred molecules fluctuate, so these are tested within a stated tolerance, on a fixed random seed.

WhatTestError
Energy of an insulated gas300 molecules, 20 000 steps, over a thousand collisions1e-12
First lawpiston moving and walls at a temperature: ΔU = Q + W1e-9
Reproducibilitythe same seed gives the same gas, molecule for moleculeexact
A wall at a temperaturebrings the gas to that temperature3 %
Gas lawpressure from wall blows against NkT/V, four combinations of N, T, V4 %
Maxwell’s distributionmean and root mean square speed after relaxing from equal speeds2 %, 1 %
Mixtureeach gas alone reaches the common temperature; rms speeds6 %, 4 %
Isothermal compressionwork; final pressure; mean temperature6 %, 5 %, 3 %
Adiabatic compression and expansionfinal temperature and pressure; work; zero heat3 %, 5 %, 7 %, exact
Free expansiontemperature unchanged; zero work; pressure halves1e-12, exact, 6 %
Mixingshare of each gas in each half8 %
Brownian grainits mean temperature and rms speed25 %, 15 %
Carnot cycleefficiency; work in each isothermal stroke; first law over the cycle10 %, 6 %, 1e-9
Every thermal scenariobuilds, round-trips through JSON; an overfull box is refusedpasses
WhatTestError
Straight wireBiot–Savart summed along the wire against μ₀I/2πr: 5 A at 5 cm is 20 µT0.01 %
Coilon the axis against the formula; a dipole’s field far away; reversed outside the coil in its plane0.1 %
Solenoidμ₀nI at the centre, the same 10 cm off centre, half at the end, summed over 500 turns0.5 %
Parallel wires1 A in each, 1 m apart: 2 × 10⁻⁷ N on each metre; opposite currents repel0.1 %
Galvanometersettles at NIAB/k; half the current gives half the deflection1 %
Magnet through a coilpeak emf from the change of flux; twice the speed doubles it and leaves the charge alone0.5 %
Rod on railsterminal speed FR/B²l²; the pull’s work against heat and kinetic energy0.2 %
Falling loopheat in the loop against the energy the fall lost; free fall with no field1 %; 1e-9
Generatorpeak emf against NBAω0.2 %
InductanceL I/T while the current rises; the work against it against ½LI²; MωI₀0.2 %
Every scenarioruns at its defaults and at the lowest and highest values that may be typedpasses
WhatTestError
Hooke’s law10 kg on 1 mm of steel 2 m long stretches 1.248 mm; doubles with the load2e-6 m
Shear and bulkthe textbook’s lead block; water at 3 km1e-6 m; 0.02 %
Hydraulic liftrise of the large piston; work in equals work out1e-9
Floating and sinkingshare under the surface, or apparent weight, for five pairs of densities0.1 %
Venturi tubea tracer timed through the throat against continuity2 %
Draining tanktime to empty for three tanks1 %
Stokesterminal speed of a steel ball in glycerine1e-3
Capillary risewater in a 0.5 mm tube; halves in one twice as wide; mercury depressed0.1 mm
Calorimetryfinal temperature of aluminium in water0.02 K
Heating icetimes to warm, melt, heat and boil1e-6
Conductionjunction temperature and heat current, two metals either way round1 K; 2 %
Newton’s coolingtime for the excess to halve1e-3
Planck’s curveits peak against Wien, its area against Stefan, 500 K to 10 000 K0.2 %
WhatTestError
Einstein’s equationcaesium: threshold 579 nm; 400 nm light gives 0.96 eV1e-3 eV
Photoelectrons countedat +1 V, 0 V, half the stopping potential and beyond it2.5 of 40 a second
Below the thresholdno electrons at full brightnessexact
de Broglie wavelength100 V and 54 V1e-4 nm
Davisson–Germerhump for 54 V on nickel at 50.9°; read off the pattern0.2°, 1.5°
Alpha, head on7.7 MeV on gold turns back at 29.5 fm0.1 fm
Alpha, integrated path against Rutherford’s formulaimpact parameters 10, 30, 80, 200 fm0.15°
Bohr atom−13.6 eV, 0.0529 nm, 656.3 nm, 121.5 nm, Balmer limit 364.5 nm0.5 nm or better
Radioactive decay, 2500 nucleileft after one and two half-lives; mean life3 σ; 0.4 s
Liquid-drop formulairon-56 and uranium-238; every measured value from calcium up0.1; 0.12 MeV per nucleon
D + T fusionfrom measured binding energies17.59 ± 0.02 MeV
WhatTestError
Onsager’s formulascritical temperature; magnetisation at T = 1; energy at T = 0 and at the critical point1e-14, 1e-6, 1e-9, 1e-6
Ising lattice at absolute zerostays ordered; energy −2 J, and −2.5 J in a field of 0.5exact
Ising lattice when hotno magnetisation; energy −2 tanh(1/T)0.06, 0.02
Metropolis against Onsagerenergy and magnetisation at T = 1.5, 2, 3, 40.06 J; 0.04 below T꜀, 0.12 above
Cooling through the transitionspecific heat peaks at T꜀; every point away from it against Onsager0.2; 0.06 J
Dartsπ after 400 000 points, against its expected error3 σ
Random walkersrms distance against √N at 100, 400, 1600 steps5 %
Reproducibilitythe same seed gives the same runexact
WhatTestError
A cell and a resistorcurrent, terminal voltage, power supplied equals power takenround-off
Junction rulecurrents into every junction of the Wheatstone bridge1e-12 A
A loop of ideal cells; a battery across a wirerefused as having no answerpasses
An open switchthe part cut off carries nothing; closing it restores the currentexact
Charging capacitorvoltage against the exponential over three time constants1e-6
A switch thrown part waycharging starts then, from the state just before5e-3
LC circuitenergy and voltage after five periods1e-9, 1e-4
Series LCRamplitude by complex numbers against the formula; against stepping in time1e-12, 1e-4
Bridges and potentiometerzero at the balance point; opposite signs either side1e-9 mA
Steady scenarios across their slidersevery measured answer1e-12
Junction diodeShockley’s law; circuit against an independent root-finder, silicon and germanium, both ways round1e-6
Rectifiersnever negative; full-wave average twice half-wave; half-wave idle half the time2 %, 6 %
Smoothing capacitorripple against I/(2fC); a quarter with four times the capacitance0.6–0.95 V of 0.93 V; 15 %
Zener regulatoroutput from 9 V to 20 V in, and 500 Ω to 5 kΩ load0.1 V
Diode gatestruth tables of OR and AND; output voltagesexact; 1e-6
Series LCR at 10, 50, 200 Hz and at resonanceimpedance, current, lag, voltages1e-9
Every circuit scenariomeasured answers; round trip through JSON1e-3, passes
WhatTestError
Reflectionangle of reflection equals angle of incidence, 0° to 80°round-off
RefractionSnell’s law at 5° to 85°; a ray sent back retraces its pathround-off
Total internal reflectionrefracts 0.01° inside the critical angle, reflects 0.01° beyond itexact
Ideal thin lensfive rays from one point, to the edge of the lens, all through the image pointround-off
Spherical mirrornear-axis rays cross at R/2; a ray at half the radius crosses well short1e-6
Mirror formula, concave and conveximage distance and magnification at five object distances1e-6
Lens formula, convex and concavethe same; no image reported with the object at the focus1e-6
Flat surface, slab, apparent depth, curved surfacetraced angles and image against the formulas1e-9, 1e-6
Prismdeviation at four angles; least at the predicted angle and larger either side1e-9
Dispersionred and violet through a prism at three angles; violet turned more1e-6
Rainbowred and violet through a drop at five heights; bows at 42.4°, 40.7° and, with two reflections, 50.5°1e-6; 0.3°, 0.5°
Optical fibreonly total reflections inside the acceptance angle; leaks 5° outside itexact
Lens maker’s formulaa real lens 8 mm thick against the thin-lens focus; marginal focus short of it2 %
Lenses in contact, telescope, microscopefocal length and magnifying power1e-4, 1e-9, 1e-6
Every optics scenariobuilds, traces, round-trips through JSONpasses
EquationTestError
KdVsingle soliton, t=5t = 55×10−85 \times 10^{-8}
KdVtwo-soliton invariants, 8000 stepsdrift <10−8< 10^{-8}
KdVcollision amplitude recoverywithin 0.020.02 of exact
NLSmoving bright soliton, t=10t = 103×10−93 \times 10^{-9}
NLStwo-soliton invariants, 10000 stepsdrift <10−8< 10^{-8}

Every row is a test that runs against the engine on every change.

The playground shows the invariants and their drift live in the side panel, so you can watch the solver’s accuracy while it runs.