Physics Theory — Project 1: Ballistics and Projectile Launching

Objective

This project introduces the numerical simulation of two-dimensional motion under gravity, with and without air resistance. Its teaching goal is to connect:

  1. two-dimensional kinematics;
  2. Newton’s second law;
  3. numerical integration of ordinary differential equations;
  4. extraction of physical metrics such as flight time, horizontal range, and apex.

Conventions

  • length: meter (m)
  • time: second (s)
  • mass: kilogram (kg)
  • velocity: m/s
  • acceleration: m/s²
  • launch angle in the interface: degree (deg)
  • angle in the integrator: radian (rad)

In the physical domain, the xx axis increases to the right and the yy axis increases upward.

Case without air resistance

When gravity acts alone, the acceleration is constant:

a⃗=(0,−g)\vec{a} = (0, -g)

If the initial velocity has magnitude v0v_0 and angle θ\theta, then:

v0x=v0cos⁡θv_{0x} = v_0\cos\theta v0y=v0sin⁡θv_{0y} = v_0\sin\theta

The kinematic equations are:

x(t)=v0xtx(t) = v_{0x} t y(t)=v0yt−12gt2y(t) = v_{0y} t - \frac{1}{2}gt^2

Flight time

For launch and landing at the same level:

T=2v0sin⁡θgT = \frac{2v_0\sin\theta}{g}

Horizontal range

R=v0xT=v02sin⁡(2θ)gR = v_{0x} T = \frac{v_0^2\sin(2\theta)}{g}

Maximum height

The apex occurs when vy=0v_y = 0:

tapice=v0sin⁡θgt_{apice} = \frac{v_0\sin\theta}{g}

and the maximum height is:

hmax=v02sin⁡2θ2gh_{max} = \frac{v_0^2\sin^2\theta}{2g}

These expressions serve as analytical references for validating numerical integration in the drag-free case.

Case with air resistance

In the current project, air resistance is modeled as quadratic drag. The drag force points opposite to the velocity:

F⃗drag=−12ρCdA∥v⃗∥v⃗\vec{F}_{drag} = -\frac{1}{2}\rho C_d A \|\vec{v}\|\vec{v}

where:

  • ρ\rho is the air density;
  • CdC_d is the drag coefficient;
  • AA is the cross-sectional area;
  • v⃗\vec{v} is the instantaneous velocity.

Because the projectile is treated as a sphere, the area used is:

A=πr2A = \pi r^2

Dividing the force by the mass mm gives the drag acceleration:

a⃗drag=−12mρCdA∥v⃗∥v⃗\vec{a}_{drag} = -\frac{1}{2m}\rho C_d A \|\vec{v}\|\vec{v}

The total acceleration is therefore:

a⃗=a⃗gravidade+a⃗drag\vec{a} = \vec{a}_{gravidade} + \vec{a}_{drag}

with

a⃗gravidade=(0,−g)\vec{a}_{gravidade} = (0, -g)

This term makes the problem nonlinear and removes the simple closed-form solution of the ideal case. Numerical integration therefore becomes essential.

Formulation as a system of ODEs

The dynamic state of the projectile is:

s=(x,y,vx,vy)\mathbf{s} = (x, y, v_x, v_y)

Its time derivative is:

s˙=(vx,vy,ax,ay)\dot{\mathbf{s}} = (v_x, v_y, a_x, a_y)

With drag, axa_x and aya_y depend on the instantaneous velocity, so the integrator must re-evaluate the derivative field during the step.

Numerical methods used

Symplectic Euler

The symplectic method updates the velocities first and then the position using the already corrected velocity. Schematically:

v⃗n+1=v⃗n+a⃗(sn)Δt\vec{v}_{n+1} = \vec{v}_n + \vec{a}(\mathbf{s}_n)\Delta t x⃗n+1=x⃗n+v⃗n+1Δt\vec{x}_{n+1} = \vec{x}_n + \vec{v}_{n+1}\Delta t

It is simple and inexpensive, and it often preserves the qualitative behavior of mechanical systems better than traditional explicit Euler.

Fourth-order Runge-Kutta (RK4)

RK4 uses four intermediate evaluations per step:

sn+1=sn+Δt6(k1+2k2+2k3+k4)\mathbf{s}_{n+1} = \mathbf{s}_n + \frac{\Delta t}{6}(k_1 + 2k_2 + 2k_3 + k_4)

with each kik_i obtained from derivatives evaluated at intermediate states. This method significantly reduces local error and is the project’s default integrator.

Ground impact detection

The ground is at y=0y = 0. The current project ends the simulation at the first ground impact. This implementation has neither restitution nor bouncing after the collision.

Because the integrator works in discrete steps, the state can cross the ground between two samples. To keep the range from depending too heavily on the step size, the project uses cubic Hermite interpolation within the last step to locate the impact instant more precisely.

In practice, this substantially improves:

  • the flight-time estimate;
  • the final-range estimate;
  • test stability when Δt\Delta t varies.

Extracted physical metrics

The project records and displays:

  • global simulation time;
  • current or final horizontal range;
  • apex point;
  • time to apex;
  • a history of unique launches with their parameters.

The apex is estimated from the recorded trajectory samples using local quadratic interpolation over neighboring points.

Relevant physical validation

Without drag

  • compare the numerical range with the analytical expression R=v02sin⁡(2θ)/gR = v_0^2\sin(2\theta)/g;
  • compare the flight time with the corresponding analytical expression;
  • check the apex against the closed-form kinematic solution.

With drag

  • compare stability between coarser and finer time steps;
  • verify that the solution remains physically plausible;
  • compare different integrators to understand cost versus accuracy.

Assumptions and simplifications of the current model

  • the projectile is treated as a particle whose radius is used only to compute the cross-sectional area;
  • projectile spin is not modeled;
  • there is no Magnus effect;
  • wind is not modeled;
  • the ground is a rigid boundary at y=0y=0;
  • impact ends the trajectory instead of simulating a collision with restitution.

These simplifications make the project an ideal first numerical laboratory: it already requires integration, impact interpolation, and comparison between ideal and dissipative models, without introducing excessive complexity too early.