B1 · Lesson 52 · Simulating motion with drag
When there's no formula, integrate Newton's law numerically
Every projectile formula in lesson 3 ignored air. With real air drag, which grows with the square of speed, there is no formula for the path at all: the horizontal and vertical motions are tied together through the speed. Engineers handle this the way circuit simulators handle nonlinear circuits: step Newton's law forward in small time steps on a computer. In this lab you'll write that simulation, check it against the drag-free formula, and use it to find the best launch angle when drag matters.
- The solid curve is the drag-free parabola. The dashed curve is the path with drag proportional to velocity, , one of the few drag laws with an exact solution.
- Raise : the path falls short and comes down more steeply than it went up.
- Real air drag goes as , which has no closed form; the lab simulates it.
Predict
With air drag, is the launch angle that throws farthest above or below 45°?
Below. Drag eats into a high, slow arc more than a low, fast one, because the projectile spends longer in the air losing speed. For a ball at 30 m/s with moderate drag the best angle is about 41°; for a golf ball or a bullet it's lower still. You'll find it with your own simulation in step 3.
Name it
The equations
With quadratic drag , Newton's law for a mass is
with in 1/m. The speed couples the two directions, so they can't be solved separately. Along with , that's four first-order equations for , , and .
Stepping in time
Starting from the launch state, advance by small steps . The RK4 method (A8.45) evaluates the acceleration four times per step and is accurate to order ; Euler's method, using only the start of the step, is accurate only to order and needs far smaller steps for the same accuracy.
Finding the landing point
The projectile crosses between two steps. Interpolate linearly between the last point above and the first below: if they're at heights and , the crossing is a fraction of the way through the step, which pins the range far more precisely than the step size.
Trusting a simulation
- Check a case you can solve. With the range must match .
- Halve the step. If the answer barely changes, the step is small enough.
- Check the physics. With drag the range must be shorter, and the falling half of the path steeper.
Worked example
A ball leaves at 30 m/s and 45°. Without drag, how far does it go? With /m, what does an accurate simulation give?
Show the solution
- Without drag. in 4.32 s.
- With drag. With /m, RK4 with ms gives 55.8 m in 3.72 s.
- Check the step. Halving the step changes the range by less than a micrometer.
- Compare. Drag cost 39% of the range.
Answer 91.7 m without drag, and 55.8 m with it.
Worked example
What is the terminal speed for /m?
Show the solution
- Drag balances gravity. Falling straight down at terminal speed,
- Terminal speed.
- What it means. The ball launched at 30 m/s is already near its terminal speed, which is why drag affects it so strongly.
Answer the terminal speed is 31.3 m/s.
Check
Step 1. Write accel(v, k) returning the acceleration as a NumPy array [ax, ay] for velocity v (an array [vx, vy]), with gravity 9.81 m/s² and quadratic drag .
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 2. Write simulate(v0, theta, k, dt) that launches from the origin at speed v0 and angle theta (degrees), steps with RK4, and returns (range, flight_time), interpolating the landing between steps. accel is included.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 3. Write best_angle(v0, k) that tries every whole-degree angle from 30° to 50° with simulate (use dt=4e-3) and returns the angle with the longest range. simulate is included.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 4. What terminal speed does a falling object reach with quadratic drag coefficient = 0.01 /m?
Write units the way you normally would: 1.5 m/s, 1500 mm/s and 0.0015 km/s are the same answer.
Explain why
Why check the simulation against the drag-free case before trusting it with drag?
A simulation can be wrong in many quiet ways: a sign error, a missing factor, a step too big, a landing detected one step late. With drag turned off there's an exact answer, so any of those mistakes shows up as a mismatch. If the code reproduces to high precision, the integrator, the units and the landing detection are all working, and the only new ingredient with drag on is one extra term in the acceleration, which is easy to check by hand.
Practice
Keep practicing
4 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.