r/Physics • u/ShreyasGameSwap Fluid dynamics and acoustics • 4h ago
I built an open-source Python physics sandbox where every solver is tested against an analytic result. What should I add next?
I've been building a free, MIT-licensed Python package called qplay for exploring physics by simulation. Each solver is tested against a known analytic result, so the pictures can be trusted.
Try it:
pip install quantum-playground
qplay run double-slitI'd like feedback from people who actually do this. Which topics are missing, and where is the physics or numerics sloppy? I'd especially like to hear about anything I've got wrong.
docs : https://github.com/StativeSh/quantum-playground
try it live: https://stativesh.github.io/quantum-playground/



10
u/No_Vermicelli_2170 3h ago •
Very cool simulation!
I don't know if the numerical results agree with the analytical results, since it's a nonlinear system with 8 degrees of freedom: two dimensions, two pendulums, and position & velocity. Chaos manifests, and you will have sensitive dependence on initial conditions, so all initial trajectories will eventually deviate from theoretical results, no matter how small your time step is.
2
u/ShreyasGameSwap Fluid dynamics and acoustics 3h ago
Some of what's checked against exact results, so you can judge the claim yourself:
- 2D Ising (Metropolis) vs Onsager's exact magnetisation and Tc = 2/ln(1+sqrt(2))
- Split-step Schrödinger solver: tunnelling and a double slit, fringes compared with the two-source prediction
- Hydrogen fine structure vs the Dirac energy; Zeeman from weak field up to Paschen-Back
- Hard-sphere gas: Maxwell-Boltzmann emerges from collisions, pV = N k_B T with the hard-sphere correction
One specific thing I'd like opinions on: the split-step solvers use a periodic box with an absorbing layer at the edges. Is there a cleaner approach people prefer for scattering problems, such as exterior complex scaling or a PML?