Open-source physics

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.

Real Larzscript running in your browser74 automated checksOpen source · MITNo sign-up · your inputs never leave your device

Mechanics

Projectile motion, kinetic and potential energy, springs, pendulums, and momentum and collisions.

🎯 Projectile Motion CalculatorRange, maximum height and time of flight for any launch speed, angle and gravity — with a range-vs-angle plot.⚡ Kinetic & Potential Energy CalculatorKE = ½mv² and PE = mgh for any mass, speed and height, with a kinetic-energy-vs-speed plot.🌀 Spring Force & Oscillation Calculator (Hooke's Law)Restoring force, stored energy and oscillation period for a mass on an ideal spring.🕐 Pendulum Period CalculatorSmall-angle simple-pendulum period T = 2π√(L/g) for any length and gravity, with a period-vs-length plot.🎱 Momentum & Collision Calculator1-D elastic and perfectly inelastic collisions: final velocities, momentum and the kinetic energy lost.

Heat & thermodynamics

Specific heat and linear thermal expansion.

🌡️ Specific Heat Calculator (q = mcΔT)Heat energy needed to change a material's temperature, with common specific-heat presets.🌡 Linear Thermal Expansion CalculatorChange in length from a temperature change, for steel, aluminum, concrete, Invar and more.

Electricity & magnetism

Coulomb's law, Ohm's law and power, and capacitor energy.

⚡ Coulomb's Law CalculatorElectrostatic force between two point charges at any separation, with a force-vs-distance plot.🔌 Ohm's Law & Electric Power CalculatorSolve V = IR for voltage, current or resistance, and get power (P = VI = I²R = V²/R) in one step.🔋 Capacitor Energy CalculatorStored energy (½CV²) and charge (Q = CV) for any capacitance and voltage.

Waves & optics

Wave speed, Snell's law refraction, and the thin-lens equation.

🌊 Wave Speed Calculator (v = fλ)Solve for wave speed, frequency or wavelength — works for sound, light or any wave.🔭 Snell's Law Calculator (Refraction)Refracted angle for light crossing between any two media, with a refraction-angle plot.🔎 Thin-Lens Equation CalculatorImage distance and magnification for a thin lens, from the focal length and object distance.

Modern physics

Escape velocity and relativistic energy — built directly on larzscript-cosmos.

🚀 Escape Velocity CalculatorEscape velocity and surface gravity for any planet, moon or custom body — reuses larzscript-cosmos's verified orbital-mechanics package.⚛️ Relativistic Energy CalculatorRest, total and kinetic energy at relativistic speed, compared against the Newtonian ½mv² estimate — reuses larzscript-cosmos's verified relativity package.

Why you can trust the numbers

74automated checks
15calculators
2packages shared with larzscript-cosmos
0dependencies — pure Larzscript

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.