Physics Calculators
Mechanics, heat, electricity and magnetism, waves and optics, plus relativistic energy and escape velocity — calculators backed by a verified open-source library written in Larzscript, running live in your browser.
Mechanics
Projectile motion, kinetic and potential energy, springs, pendulums, and momentum and collisions.
Heat & thermodynamics
Specific heat and linear thermal expansion.
Electricity & magnetism
Coulomb's law, Ohm's law and power, and capacitor energy.
Waves & optics
Wave speed, Snell's law refraction, and the thin-lens equation.
Modern physics
Escape velocity and relativistic energy — built directly on larzscript-cosmos.
Why you can trust the numbers
Every result is checked against something that does not share its code — a closed-form textbook value, an independent conservation-law identity, or a round trip back through the same formula from the other direction — and the cases that must fail (zero gravity, total internal reflection, a zero temperature change) are checked to fail. The method is written up in docs/VERIFICATION.md.
Use the library yourself
A complete program using the same packages these pages run:
import "mechanics" as ph print(ph.projectile_range(20, 45, 9.80665)) # 40.78862... m print(ph.pendulum_period(1, 9.80665)) # 2.00609... s (the "seconds pendulum")
Source code, documentation and tests on GitHub → · What is Larzscript? · Learn Larzscript
Frequently asked questions
What is larzscript-physics?
An open-source physics toolkit written entirely in the Larzscript programming language: mechanics (projectile motion, energy, springs, pendulums, momentum and collisions), heat, electricity and magnetism, waves and optics, plus escape velocity and relativistic energy built directly on larzscript-cosmos's verified astro and relativity packages.
How do I know the answers are right?
The library has 74 automated checks: closed-form textbook values (a classic 45°-projectile range, the 'seconds pendulum', Earth's escape velocity, air-to-water refraction at 45°), physical conservation laws checked independently (momentum and kinetic energy in elastic collisions), and every input round-tripped back out of its own output wherever the algebra allows it.
Does it run on my device or on a server?
On your device. The Larzscript interpreter is compiled to WebAssembly and runs in a background thread of your browser; your inputs are never sent anywhere.
Why does this reuse packages from larzscript-cosmos?
Escape velocity and relativistic energy call cosmos's astro and relativity packages directly rather than reimplementing the same formulas twice — one verified implementation, used consistently by both projects, is more trustworthy than two that could quietly drift apart.
Can I use the library in my own programs?
Yes — it is MIT-licensed. Install a Larzscript release (a single binary), clone the repository and import "mechanics" as ph or import "emwaves" as ph. The repository documents every function.