← All Base Form Math projects
BM-22NOT STARTEDBASE FORM · CALCULUSMATHPYTHON

Gravity from a video

Film a ball being thrown, track it frame by frame, and recover gravity and air drag by fitting a simulation to the path.

EST.10 h
REWARD+100 XP
AFTERoriginal

ML-ARENA BENCHMARKS

YOUR NUMBER VS THE INDUSTRY'S
METRICINDUSTRYMINE
estimated g
GOAL · within 3%
9.81 m/s²—
no results yet
YOUR RESULTS

Your recorded results appear here.

Brief

Everything near the ground falls with the same acceleration, about 9.81 m/s². You can measure it with a phone. Film a ball being thrown, find it in every frame, and ask which value of gg makes a physics model match what you saw. This project ties together the tools you already have: least squares, ODE solvers, gradient descent and autodiff.

Without air, the height is a parabola: y(t)=y0+vy0t−12gt2y(t) = y_0 + v_{y0} t - \tfrac12 g t^2. That is linear in the unknowns, so plain least squares gives a first estimate. Real balls also feel drag. With a drag constant kk the motion is r¨=(0,−g)−k∣v∣v\ddot{\mathbf{r}} = (0, -g) - k \lvert \mathbf{v} \rvert \mathbf{v}, which has no simple formula. You solve it with RK4 and tune gg, kk and the launch state until the simulated path sits on your tracked points.

Most of the error comes from the video, not the maths. A wrong pixel scale or a wrong frame rate shifts gg directly. Many phones record at a variable frame rate, so check the timestamps rather than trusting the number on the label. Slow-motion mode at 120 or 240 frames per second gives many more points per throw.

VISUALFig. 1
0 1 2 3 4 5 6 0 1 2 x (m) y (m) tracked frames fit with drag same launch, no drag
Tracked frames (dots) and a fitted path with drag. The dashed path is the same launch with no air: it goes higher and lands further. Why it's here: Shows how much drag bends a real throw, and why a pure parabola leaves a pattern in the residuals.
HINT · OBJECTIVE 2
Stuck? Hints stay hidden until you ask.
HINT · OBJECTIVE 5
Stuck? Hints stay hidden until you ask.

DATA · your own video

Objectives

0 / 6 CLEARED

Read-only. Log in to update progress.

VICTORY CONDITIONS

  1. Your estimated g is within 3% of 9.81 m/s² (9.52 to 10.10) from your own video. Record it with `python tools/mlarena.py record BM-22 "<your g>"`.
  2. The fitted simulation follows the tracked points with an RMS error under 2 cm, and its residuals show no clear curve.
  3. The gradient from your autodiff matches a finite-difference check to a relative error under 1e-5.

Side quests

Throw a ping-pong ball and a tennis ball and compare their drag constants. Explain the difference from mass and size.
Drop a light ball from a height and estimate its terminal speed from the fitted drag.
Read about the adjoint method and compare its cost with backpropagating through every RK4 step.

Terms in plain words

Calibration
Finding how many pixels make one metre, using an object of known length filmed at the same distance as the ball.
Quadratic drag
Air pushes back on the ball with a force that grows with the square of its speed and points against its motion.
Residual
The gap between a tracked point and the model's prediction for that frame. Good fits leave residuals that look like random noise.
Parameter fitting
Choosing the unknown numbers in a model (here g, the drag constant and the launch) so its output lines up with the data.