A hands-on simulator textbook

Tutorials on simulation.

Start with one falling point mass. Finish by tracing an articulated, contact-rich robot through the complete native timestep. Every chapter pairs physical intuition with tested NumPy code, LavenderSim experiments, and the actual engine implementation.

12 chaptersFrom integration to the full simulation loop.
Build, then measureEvery important claim becomes a runnable numerical experiment.
Honest internalsReference algorithms and real LavenderSim behavior are labeled separately.
The map before the territory

Three implementations may appear in one lesson.

Knowing which system an equation describes is part of understanding simulation.

LabelMeaning
Reference labA small NumPy implementation designed to make an algorithm readable.
LavenderSimBehavior verified against the current Python API and compact C++ engine.
MuJoCo comparisonA conceptual comparison grounded in MuJoCo's official computation documentation—not a compatibility claim.
Future featureInstrumentation or an algorithm proposed by the curriculum but not yet part of the engine.
The key architectural contrast: MuJoCo primarily uses generalized coordinates for articulated dynamics. LavenderSim currently stores Cartesian rigid-body states and maintains joints with numerical constraints and sequential impulses. We will learn both models without pretending they are the same.
Keep beside the workbench

Reference shelves.

Recover a definition, locate an equation, trace current engine code, or continue into primary sources.

Part I

Foundations

Turn continuous equations into stable, inspectable state updates.

Part II

Articulated systems

Move from isolated bodies to robot coordinates and recursive dynamics.

Part III

Interaction

Understand the geometry and numerical constraints behind joints and contact.

Part IV

The whole engine

Put control, collision, solving, integration, sensing, and RL into one timestep.

How to study

Read less. Predict, run, and explain more.

01 / PREDICT

Write down what should happen

Direction, scale, conserved quantity, and likely failure mode are more useful than a vague guess.

02 / RUN

Change one thing

Keep the scene and initial state fixed while sweeping timestep, stiffness, friction, or solver iterations.

03 / EXPLAIN

Use the telemetry

A plot should support a causal explanation, not merely show that two curves differ.