Log inStart free
LESSON 21.21 · 5 STAGES · 2 CONTROLS · 2 CHECKSPRO · PREVIEW

Differentiable simulators

Push a puck, then send the gradient back through every simulator step.


Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 2 controls and 2 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 21.21 · PUCK SIMU 3.50 M/S · B ENDS AT 3.42 M
01
Stage 1 of 5 · Roll out
The simulator moves A and B in 30 steps of 0.1 s. A hits B in step 4, then B slides on.
Explain it simply

Think of two pucks on ice. Each step of the simulator moves both pucks a tenth of a second forward. Drag slows them a little in each step. When A hits B, the two pucks swap speeds, so A stops and B slides on.

Positions over 30 steps. A starts at 0 m with 3.5 m/s. B starts at 1.5 m and ends at 3.42 m.

puck positionsstart speed uloss, gradientgoalzero-gradient cellshard-simulator check
010203001234stepx (m)goal 2.5 mimpact, step 4ABloss L against start speed u12340123u (m/s)puck positions, 30 stepss₃₀: A at 1.10 m, B at 3.42 m010203001234stepx (m)goal 2.5 mimpact, step 4ABloss L against start speed u12340123u (m/s)puck positions, 30 stepss₃₀: A at 1.10 m, B at 3.42 m
Toy: 2 pucks on ice, 30 steps of 0.1 s
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
st+1=f(st),s0=(0, u, 1.5, 0)\sy{s}{data}{s_{t+1}} = f(\sy{s}{data}{s_t}),\quad \sy{s}{data}{s_0} = (0,\ \sy{u}{param}{u},\ 1.5,\ 0)
s30=(1.10, 0.00, 3.42, 0.15)s_{30} = (1.10,\ 0.00,\ 3.42,\ 0.15)

Each step maps the state of both pucks to the next state.

Common mix-ups

MYTHA zero gradient means the start speed is already best.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
2 CHECKS · PRO
Q01With hard contact, where does gradient descent take a start speed of 1.0 m/s?

Make your guess, then test it in the diagram. All 2 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
  • 4 more stages and 2 live controls
  • 2 mix-up cards and 2 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.