Every physics textbook has the projectile formulas for a vacuum: range R = u² sin 2θ / g, time of flight T = 2u sin θ / g and maximum height H = u² sin² θ / 2g. Real balls fly in air, and the answer changes a lot. Here is a small simulation that shows how much, and why the best launch angle is no longer 45 degrees.
The model
Gravity pulls down with g = 9.81 m/s². Air drag points against the velocity and grows with speed. I use a quadratic drag, a_drag = -k * |v| * v, where k (in 1/m) bundles air density, area, mass and the drag coefficient. k = 0 is the textbook case.
The code
function fly({ speed, degrees, k = 0, g = 9.81, dt = 0.001 }) {
const a = (degrees * Math.PI) / 180;
let x = 0, y = 0, vx = speed * Math.cos(a), vy = speed * Math.sin(a);
let t = 0, top = 0;
while (y >= 0) {
const v = Math.hypot(vx, vy);
vx += -k * v * vx * dt;
vy += (-g - k * v * vy) * dt;
x += vx * dt;
y += vy * dt;
t += dt;
top = Math.max(top, y);
}
return { range: x, time: t, height: top };
}
It is a simple semi-implicit Euler step. With dt = 0.001 s it matches the closed-form answers to about 0.1 percent when k = 0.
What the numbers say
Launch at 20 m/s and 45 degrees:
| k (1/m) | range | time of flight | max height |
|---|---|---|---|
| 0 (vacuum) | 40.8 m | 2.88 s | 10.2 m |
| 0.02 | 25.8 m | 2.51 s | 7.8 m |
| 0.05 | 17.5 m | 2.20 s | 6.0 m |
The vacuum row agrees with the formulas: 20² x sin 90° / 9.81 = 40.8 m and 2 x 20 x sin 45° / 9.81 = 2.88 s. With a modest drag the range drops by more than a third.
The best angle moves
With k = 0.02 and the same 20 m/s launch, the range is 24.2 m at 30 degrees, 25.4 m at 35 degrees, 25.9 m at 40 degrees and 25.8 m at 45 degrees. The best angle is now a little below 45 degrees, because a flatter shot spends less time in the air losing speed. The more drag, the lower the best angle.
Three things worth remembering for exams
- The 45 degree rule holds only for level ground and no air resistance.
- Angles theta and 90 degrees minus theta give the same range only in a vacuum.
- The horizontal velocity stays constant only without drag.
Play with it
If you would rather drag sliders than edit code, the projectile lab on PractiSci lets you change the speed and angle (with an optional air drag) and plots the path. The chapter guide for projectile motion and kinematics collects the formulas and worked examples for Class 11.
Top comments (0)