Physics by Construction

Physics by Construction is a free, open-source educational initiative by JIDAI, created by Ahmet Taspinar. About the creator and JIDAI.

Physics by Construction teaches physics by building it. Every concept comes with code you can run, and every listing, figure, and proof on this site is produced or checked by the same pipeline that publishes it. Three activities run through the content: Construct, Investigate, and Verify.

The site is written for readers who already know undergraduate mechanics and can program. It does not teach either again.

Three activities

Construct

State a model and its assumptions, write it as a short Python program, and compare the result with what theory predicts. Published example:

Numerical integrators, which compares four ways of stepping a model forward in time.

Investigate

The aim is to work from real measurements: quantify uncertainty, fit models, and design experiments. The planned courses and method paths, with their labs, are listed below. What is published today is an experiment on a simulation, run by an AI agent on your own machine with your own API key. Published example:

An agent runs an experiment.

Verify

Check what can actually be established. A lesson whose code fails or whose proof does not compile cannot be published. Results about the models are stated as theorems in Lean 4 with Mathlib and checked by machine. Published example:

Proving what the simulation showed.

One result, constructed and proved

Take a mass mm on a spring with stiffness kk. Its total energy is

E=12mv2+12kx2. E = \frac{1}{2} m v^{2} + \frac{1}{2} k x^{2}.

A simulation shows how quickly a numerical method makes EE drift. A proof settles, for every initial condition at once, the factor by which one step of explicit Euler multiplies EE. The agent lesson runs its experiment on the projectile simulation of the course, not on this oscillator.

Published

The site publishes 38 lessons in 7 strands. A lesson appears here only after it passes verification.

The Classical mechanics course is published with 16 core lessons and 12 extensions (by course).

The Thermodynamics and statistical physics course is published with 3 core lessons and 1 extension (by course).

The Waves and optics course is published with 3 core lessons and 0 extensions (by course).

The Electromagnetism course is published with 3 core lessons and 0 extensions (by course).

Classical mechanics: Kinematics as a program; Newton’s laws as a first-order system; Projectile motion with quadratic drag; The harmonic oscillator; Numerical integrators; Energy conservation; Momentum and collisions; The Kepler orbit; Verifying scientific code; Automated analysis pipelines; Gravitational-wave strain lab; Inverse physics: parameters from observations; Double pendulum and chaos; Lagrangian mechanics; Hamiltonian mechanics; Resonance and driven oscillators.

Thermodynamics and statistical physics: Random walks and diffusion; Kinetic theory of gases; Entropy from ensembles.

Waves and optics: The wave equation; Interference and resonance; Sound, resonance, and the Doppler effect.

Electromagnetism: Electric fields, superposition, and the potential; Charged particles in electric and magnetic fields; Induction: magnetic flux and the electromotive force.

Physics and AI: LLM agents: An agent runs an experiment; A counterexample hunter; Three reviewers for one piece of code; An agent that designs the measurements; Discovering a force law with controlled probes; Full, partial, and no prior knowledge under one protocol; Unlearning a familiar law: a modified force.

Agent-based modelling: Particles in a box.

Formal proofs: Proving what the simulation showed; Momentum in a collision, proved; What symplectic Euler conserves; Lean exercises on your machine; The chirp law, proved.

See the learning path for every lesson with its difficulty and prerequisites, and by method for the paths of simulation, LLM agents, agent-based modelling, and formal proofs, or by method path for the four paths of the reference curriculum.

Planned

Planned means not published. No date is promised. The reference curriculum plans 115 lessons: those of eight courses and four method paths, and one proof. The published count of an item is the lessons that exist; a planned lesson has no page and is not part of it.

  • Classical mechanics, course: 28 lessons published, 4 planned.
  • Thermodynamics and statistical physics, course: 4 lessons published, 8 planned.
  • Waves and optics, course: 3 lessons published, 6 planned.
  • Electromagnetism, course: 3 lessons published, 6 planned.
  • Fluid dynamics, course: 0 lessons published, 10 planned.
  • Quantum physics, course: 0 lessons published, 8 planned.
  • Astrophysics, cosmology, and relativity, course: 0 lessons published, 10 planned.
  • Condensed matter and materials physics, course: 0 lessons published, 6 planned.
  • Physics reasoning and scientific agents, method path: 4 lessons published, 5 planned.
  • Scientific law discovery, method path: 5 lessons published, 8 planned.
  • Physics agent benchmarking, method path: 0 lessons published, 5 planned.
  • Autonomous scientific research, method path: 1 lesson published, 5 planned.

Source and licence

To run the experiment of a lesson on your own machine, see Set up and run; to report an error or propose a change, see Contribute. The complete source of this site, including the code behind every figure, is in the repository on GitHub. Code is released under the MIT licence. Lesson text and figures are released under the Creative Commons Attribution 4.0 International licence (CC BY 4.0). The About page has the details.