Nothing but Net ball trajectory equations with air resistance

Recently, Nathan made a launching speed calculator which calculates the speed and/or angle required to score a ball from any position on the field in Nothing but Net.

The theoretical basis behind this calculator is the Drag Equation:

F_D\, =\, \tfrac12\, \rho\, v^2\, C_D\, A

\text{drag force} = \tfrac12 \times \text{air density} \times \text{velocity}^2 \times \text{drag coefficient} \times \text{cross-sectional area}

This makes the equations more complex than if air resistance was ignored or if air resistance was assumed to be proportional to velocity (rather than the square of velocity). However, these equations should also be more accurate.

We can group the variables that will not change into one constant and call it k:

k= \frac{1}{2}\rho C_D A

To model the ball’s trajectory, we will split the motion into horizontal and vertical components. We want to find out the distance travelled as a function of time in both the horizontal and vertical directions.

In the horizontal direction, we can express horizontal acceleration a_x in terms of k , horizontal velocity v , mass m and time t:

a_x = \dfrac{dv_x}{dt} = \dfrac{-kv^2_x}{m}

\dfrac{-kdt}{m} = \dfrac{dv_x}{v^2_x}

 -\int{ \dfrac{k}{m} } \,dt = \int v^{-2}_x \,dv_x

-\dfrac{kt}{m} = -\dfrac{1}{v_x} + c

where c is a constant of integration.
When t=0 , v_x=v_{x_o}

c=\dfrac{1}{v_{x_o}}

\dfrac{kt}{m} = \dfrac{1}{v_{x}} - \dfrac{1}{v_{x_o}}

v_x = \dfrac{1}{\dfrac{1}{v_{x_0}}+\dfrac{kt}{m}}

v_x = \dfrac{1}{\dfrac{1}{v_0 \cos \theta}+\dfrac{kt}{m}}

also for horizontal distance covered:

\int v_x \,dt = \int{\left( \dfrac{1}{\dfrac{1}{v_0 \cos \theta}+\dfrac{kt}{m}} \right)} \,dt

s_x(t) = \dfrac{m}{k}\ln \left( kt{v_0 \cos \theta}+m \right) + c

When t=0 , s_x=0

c = -\dfrac{m}{k}\ln (m)

s_x(t) = \dfrac{m}{k} \left( \ln \left( \dfrac{kt{v_0 \cos \theta}+m}{m} \right) \right)

For the vertical component, we split the equations into an upward section and a downward section. The drag force acts downward in both cases, but squaring the velocity gives a positive drag force whether the velocity is positive or negative.

For the upward section:

a_y= \dfrac{-kv^2_x}{m} - mg = \dfrac{dv_y}{dt}

This can be solved to get

v_y(t) = \sqrt{\dfrac{mg}{k}} \: \tan \left( c - \sqrt{\dfrac{gk}{m}} \:\: t \right)

When t=0 , v_y(t)=v_{y_o}=v_0 \sin \theta

c = \arctan \left( \sqrt{\dfrac{k}{mg}} \:\: v_{y_o} \right)

v_y(t) = \sqrt{\dfrac{mg}{k}} \: \tan \left( \arctan \left( \sqrt{\dfrac{k}{mg}} \:\: v_{y_o} \right) - \sqrt{\dfrac{gk}{m}} \:\: t \right)

Also for vertical height covered:

\int v_y \, dt = \int \left( \sqrt{\dfrac{mg}{k}} \: \tan \left( \arctan \left( \sqrt{\dfrac{k}{mg}} \:\: v_{y_o} \right) - \sqrt{\dfrac{gk}{m}} \:\: t \right) \right) dt

s_y(t) = \dfrac{m}{k} \ln \left( \cos \left( \sqrt{ \dfrac {gk}{m} } \:\: t - \arctan \left( \sqrt{ \dfrac {k}{mg}} \:\: v_{y_o} \right) \right) \right) + c

When t=0 , s_y(t)=0

c = - \dfrac{m}{k} \ln \left( \cos \left( \arctan \left( \sqrt{ \dfrac {k}{mg}} \:\: v_{y_o} \right) \right) \right)

s_y(t) = \dfrac{m}{k} \ln \left( \cos \left( \sqrt{ \dfrac {gk}{m} } \:\: t - \arctan \left( \sqrt{ \dfrac {k}{mg}} \:\: v_{y_o} \right) \right) \right) \quad - \quad \dfrac{m}{k} \ln \left( \cos \left( \arctan \left( \sqrt{ \dfrac {k}{mg}} \:\: v_{y_o} \right) \right) \right)

So if h is the maximum height and t_{ascend} is the required time to reach there then

t_{ascend} = \sqrt{\dfrac{m}{gk}} \: \arctan \left(  \sqrt{ \dfrac {k}{mg} } \:\: v_{y_o} \right)

h = - \dfrac{m}{k} \ln \left(  \cos \left(  \arctan \left(  \sqrt{ \dfrac {k}{mg}} \:\: v_{y_o}  \right)   \right)   \right)

Similarly for when the projectile is coming downward. Here t is the descending time only. ie. t is counted only after reaching the maximum height.

a_y= \dfrac{kv^2_x}{m} - mg = \dfrac{dv_y}{dt}

This too can be solved to get

v_y \left( t \right)  = - \sqrt{\dfrac{mg}{k}} \: \tanh  \left( c + \sqrt{\dfrac{gk}{m}} \:: t \right)

When t=0 , v_y \left( t \right) =0

c = 0

v_y \left( t \right)  = - \sqrt{\dfrac{mg}{k}} \: \tanh  \left( \sqrt{\dfrac{gk}{m}} \:\: t \right)

And if s_y \left( t \right) is the height above the surface at a particular time after t_{ascend}

s_y \left( t \right)  = - \dfrac{m}{k} \ln \left(  \cosh \left(  \sqrt{\dfrac{gk}{m}} \:\: t \right)  \right)  + c

When t=0 , s_y \left( t \right) =h , where h is the maximum height

c = h s_y \left( t \right)  = h - \dfrac{m}{k} \ln \left(  \cosh \left(  \sqrt{\dfrac{gk}{m}} \:\: t \right)  \right)

So if t_{descend} is the required time to hit the ground

t_{descend} = \sqrt{\dfrac{m}{gk}} \: \text{arccosh} \left( e^{\frac{hk}{m}} \right)

Finally, the velocity at any instant v \left( t \right)  , Total Time of flight T , Range R and speed at which it hit the ground V_{hit} is

v \left( t \right)  = \sqrt{v^2_x \left( t \right)  + v^2_y \left( t \right) }

T= t_{ascend} + t_{descend}

R = \dfrac{m}{k} \left( \ln  \left( \dfrac{kT{v_0 \cos \theta}+m}{m} \right)  \right)

V_{hit} = \left( \left( \dfrac{1}{\dfrac{1}{v_0 \cos \theta}+\dfrac{kT}{m}} \right) ^2 + \dfrac{mg}{k} \left(  \tanh \left(  \text{arccosh} \left( e^\frac{hk}{m} \right)  \right)  \right) ^2 \right)^\frac{1}{2}