Monday, June 1, 2020

How far can I throw in a tunnel?

As pointed out in this video from LindyBeige, if you are inside, say, a dungeon, then low ceilings limit how far you can throw javelins and the like because they rely on you throwing them high to achieve distance. So the question is, if you know the ceiling height, how far can you throw?

Let's assume that we know how far you can throw outside, where you're not limited by ceilings. This aligns with the maximum range that may be listed in a game's rules. For example, in Dungeons and Dragons, a javelin has a long range of 120'. For simplicity, let's assume the ceiling is uniform is height. (Yes, this directly contradicts the first point in LindyBeige's video.)

When you throw, you can choose the angle at which you throw. Inside, you'll use a lower angle to avoid the ceiling. But let's assume that you throw with the same initial speed. Gravity pulls the javelin down and air pushes against the direction of movement. We'll account for the first, but ignore the second. Ignoring air resistance is par for the course when doing analyses such as this, often without regard for whether or not it's appropriate. Our first task is to deduce the initial speed based on the outside throwing range. Let $x_f$ be this range. We'll break up the initial velocity into its horizontal component, $v_{x0}$, and its vertical component, $v_{y0}$. Gravity provides a constant acceleration, the rate of change in velocity, so we know the velocity as a function of time and the gravitational constant $g = 9.8 \, \text{m}/\text{s}$.
v_y(t) = v_{y0} -  g\cdot t
From this we can determine the elevation of the javelin throughout its flight, $y(t)$. Here we'll reference zero height at the normal height of a person, assuming that since the target is about equal in height to the launch height, so $y(0) = y_0 = 0$. The change in height is determined by integrating the velocity.
y(t) &= y_0 + \int_0^t v(t) \,\mathrm{d}t \\
y(t) &= \int_0^t  v_{y0} -  g\cdot t  \,\mathrm{d}t \\
y(t) &=  v_{y0} \cdot t -  \frac{1}{2} \cdot g\cdot t^2
Using this we can solve for the time at which the javelin reaches the target height of $y(t) = 0$, which occurs at the final time $t_f$.
y(t_f) &= 0 \\
0 &= v_{y0} \cdot t_f -  \frac{1}{2} \cdot g\cdot t_f^2  \\
We're interested in the case when $y(t) = 0$ but $t \neq 0$, so we can divide by $t_f$ and then solve for it.
0 &= v_{y0} -  \frac{1}{2} \cdot g\cdot t_f  \\
\frac{1}{2} \cdot g\cdot t_f & =v_{y0} \\
t_f &= \frac{v_{y0}}{\frac{1}{2} \cdot g} \\
t_f &= 2 \cdot \frac{v_{y0}}{g}
This tells us how much time the javelin spends in the air. Next, we can find how far it travels based on this. Since you're not throwing it straight up, there's some initial horizontal component to the velocity, $v_{x0}$. We'll specify the horizontal position, $x$, to have value $0$ at $t=0$ where you throw from, so the horizontal position is simply proportional to time and initial horizontal velocity. In fact, this position is equal to the product of these two.
x(t) = v_{x0} \cdot t
Thus the distance thrown, $x_f = x(t_f)$ is as follows.
x_f &= v_{x0} \cdot t_f \\
&= v_{x0} \cdot 2 \cdot \frac{v_{y0}}{g} \\
&=  \frac{2 \cdot v_{x0} \cdot v_{y0}}{g}
Next, we can find the optimal way to split the initial velocity $v_0$ between its vertical and horizontal components. The initial velocity is a vector, having both magnitude, $|v_0|$ and an angle $\angle v_0$. We can use trigonometric functions to relate the initial velocity into its Cartesian components.
v_{x0} &= |v_0| \cos  \angle v_0  \\
v_{y0} &= |v_0| \sin  \angle v_0
We don't ultimately care about the angle, so we can also just look at the magnitude, using the Pythagorean formula.
|v_0|^2 &= v_{x0}^2 + v_{y0}^2
From this we can solve for $v_{x0}$.
v_{y0} &=  \sqrt{|v_0|^2 - v_{x0}^2}
We can use this to go back and find the distance thrown in terms of $v_0$ and $v_{y0}$.
x_f &=   \frac{2  \cdot v_{x0} \cdot \sqrt{|v_0|^2 - v_{x0}^2}}{g}
The final distance reached is a function of the initial horizontal velocity component. We anticipate a maximum, so let's take the derivative of the final position with respect to this velocity component and find where it's zero.
0 & = \frac{ \mathrm{d} x_f } {  \mathrm{d} v_{x0}  } \\
0 &= \frac{ \mathrm{d} } {  \mathrm{d} v_{x0}  }   \frac{2  \cdot v_{x0} \cdot \sqrt{|v_0|^2 - v_{x0}^2}}{g}  \\
0 &=  \frac{2 }{g} \cdot \frac{ \mathrm{d} } {  \mathrm{d} v_{x0}  }   \cdot v_{x0} \cdot \sqrt{|v_0|^2 - v_{x0}^2}  \\
0 &=  \frac{2 }{g} \cdot \left ( \sqrt{|v_0|^2 - v_{x0}^2} + v_{x0} \cdot \frac{1}{2} { \left (|v_0|^2 - v_{x0}^2 \right )}^{-\frac{1}{2}}\cdot  \frac{ \mathrm{d} } {  \mathrm{d} v_{x0}  } |v_0|^2 - v_{x0}^2 \right ) \\
0 &=  \frac{2 }{g} \cdot \left ( \sqrt{|v_0|^2 - v_{x0}^2} + v_{x0} \cdot \require{cancel}\cancel{ \frac{1}{2}} { \left (|v_0|^2 - v_{x0}^2 \right )}^{-\frac{1}{2}}\cdot  -\cancel{2}\cdot v_{x0} \right ) \\
0 &=  \frac{2 }{g} \cdot \left ( \sqrt{|v_0|^2 - v_{x0}^2} -  v_{x0} \cdot { \left (|v_0|^2 - v_{x0}^2 \right )}^{-\frac{1}{2}}\cdot  v_{x0} \right ) \\
0 &=  \left ( \sqrt{|v_0|^2 - v_{x0}^2} -  \frac{v_{x0}^2}{\sqrt{|v_0|^2 - v_{x0}^2 }} \right ) \\
Now let's bring some stuff to both sides and rearrange.
\frac{v_{x0}^2}{\sqrt{|v_0|^2 - v_{x0}^2 }} &=   \sqrt{|v_0|^2 - v_{x0}^2}  \\
\frac{v_{x0}^2}{\sqrt{|v_0|^2 - v_{x0}^2 }} \cdot  \sqrt{|v_0|^2 - v_{x0}^2}  &=   \sqrt{|v_0|^2 - v_{x0}^2} \cdot  \sqrt{|v_0|^2 - v_{x0}^2} \\
v_{x0}^2 & = |v_0|^2 - v_{x0}^2 \\
2 v_{x0}^2 & = |v_0|^2 \\
v_{x0}^2 & = \frac{1}{2} |v_0|^2
There's a solution to this where $v_{x0}$ and $|v_0|$ are both $0$, but we're not interested in that case.
v_{x0} &= \frac{ |v_0| }{\sqrt{2}}
This is a simple case that we can recognize that $v_{y0}=1/ \sqrt{2} \cdot |v_0|$ also and $\angle v_0 = 45^\circ$. We can now plug this back into our previous equation to find a relationship between $x_f$ and $v_0$.
x_f &=  \frac{2  \cdot  \frac{ |v_0| }{\sqrt{2}} \cdot \sqrt{|v_0|^2 -\left(  \frac{ |v_0| }{\sqrt{2}} \right )^2}}{g}  \\
&=  \frac{2  \cdot  \frac{ |v_0| }{\sqrt{2}} \cdot \sqrt{\frac{|v_0|^2}{2}}}{g}  \\
&=  \frac{2  \cdot  \frac{ |v_0| }{\sqrt{2}} \cdot \frac{ |v_0| }{\sqrt{2}}}{g}  \\
&=  \frac{\require{cancel}\cancel{2}  \cdot  \frac{|v_0|^2}{\cancel{2}} }{g}  \\
x_f &=  \frac{|v_0|^2}{g}  \\
|v_0|^2 &= g \cdot x_f\\
|v_0| &= \sqrt{g \cdot x_f}
All this work has been done to give us the initial speed as a function of the distance thrown outside. Now we can turn our attention to how far we can throw given this initial velocity and a ceiling height. Let's set the maximum height of the javelin in flight to be $y_p$, where our $p$ is for peak. We'll say that this occurs at time $t_p$.
y_p &= y(t_p)
To try to keep our variables from getting confused, we'll specify different vertical and horizontal components to the velocity now that you're throwing inside. Let these be $v_{yi}$ and $v_{xi}$, respectively.
y_p &= v_{yi} \cdot t_p -  \frac{1}{2} \cdot g\cdot t_p^2
We'll find where the derivative is zero again to find the time at which the maximum height occurs maximum again.
0 &= \frac{ \mathrm{d} y(t) } {  \mathrm{d} t  } \\
0 &= \frac{ \mathrm{d} } {  \mathrm{d} t  }  \left ( v_{yi} \cdot t -  \frac{1}{2} \cdot g\cdot t^2 \right )\\
0 &=    v_{yi}  -    g\cdot t\\
g\cdot t &=  v_{yi}   \\
t &= \frac{v_{yi}}{g}\\
t_p &= \frac{v_{yi}}{g}
Now we can find the maximum height by plugging in this time.
y_p &= v_{yi} \cdot \frac{v_{yi}}{g} -  \frac{1}{2} \cdot g\cdot \left ( \frac{v_{yi}}{g} \right ) ^2 \\
&= \frac{v_{yi}^2}{g} -  \frac{1}{2} \cdot g\cdot  \frac{v_{yi}^2}{g^2}  \\
&= \frac{v_{yi}^2}{g} -  \frac{1}{2} \cdot   \frac{v_{yi}^2}{g}  \\
y_p &=   \frac{1}{2} \cdot  \frac{v_{yi}^2}{g}   \\
v_{yi}^2 &= 2 \cdot g \cdot y_p \\
v_{yi} &= \sqrt{2 \cdot g \cdot y_p }
Based on the previous equation for the final distance, we can find the write the final inside distance, $x_{fi}$, in terms of the initial velocity components.
&=  \frac{2 \cdot v_{xi} \cdot v_{yi}}{g} \\
&=  \frac{2 \cdot \sqrt{|v_0|^2 - v_{yi}^2} \cdot v_{yi}}{g}  \\
&=  \frac{2 \cdot \sqrt{|v_0|^2 - 2 \cdot g \cdot y_p } \cdot \sqrt{2 \cdot g \cdot y_p }}{g}  \\
&=  \frac{2 \cdot \sqrt{\left (  \sqrt{g \cdot x_f} \right)^2 - 2 \cdot g \cdot y_p } \cdot \sqrt{2 \cdot g \cdot y_p }}{g}  \\
&=  \frac{2 \cdot \sqrt{\require{cancel}\cancel{g} \cdot x_f- 2 \cdot \cancel{g} \cdot y_p } \cdot \sqrt{2 \cdot \cancel{ g} \cdot y_p }}{\cancel{g}}  \\
x_{fi} &=  2 \cdot \sqrt{x_f - 2  \cdot y_p } \cdot \sqrt{2  \cdot y_p }
Note that this only applies when $y_p$ is less than the maximum height outside. As an example with the javelin's range of 120 ft in a 10 ft room, the maximum thrown distance in ft becomes,
2 \cdot \sqrt{120 - 2  \cdot 10 } \cdot \sqrt{2  \cdot 10 }  \approx 89.4 .
There's a little gotcha here. We assumed zero elevation at the height of the thrower. Let's just call this 5 ft for simplicity. Thus, we should take 5 ft off the height that we plug into the equation above.
2 \cdot \sqrt{120 - 2  \cdot (10-5) } \cdot \sqrt{2  \cdot (10-5) }  \approx 66.3

Another thing we need to take care of is the range over which our equation is valid. Now, since we're dealing with real numbers in the real world, we know that we must meet the condition $x_f > 2 \cdot y_p$, as otherwise we'd have a negative number inside the square root. However, we need to consider the case when the outdoor maximum height, $y_{max}$, is less than or equal to the elevation of the ceiling, $y_p$. To check, we'll go back and find $y_{max}$. If $y_p \geq y_{max}$ then the indoor range is equal to the outdoor range. To do this, let's recall some earlier equations.
|v_0| &= \sqrt{g \cdot x_f} \\
v_{y0} &= \sqrt{2 \cdot g \cdot y_{max} } \\
v_{y0}&=\frac{1}{ \sqrt{2}} \cdot |v_0|
We can combine these and do some algebra to find the outdoor maximum height reached by the javelin.
\sqrt{2 \cdot  g \cdot y_{max} } & = \frac{1}{ \sqrt{2}} \cdot |v_0| \\
2 \cdot g \cdot y_{max}  & = \frac{1}{2} \cdot |v_0|^2 \\
y_{max}  & = \frac{1}{4g} \cdot |v_0|^2 \\
y_{max}  & = \frac{1}{4g} \cdot \left (  \sqrt{g \cdot x_f} \right )^2 \\
y_{max}  & =  \frac{ x_f}{4}
So this means the maximum range is 4 times the height reached during flight outside. Thus, if the ceiling is at least one quarter of the outdoor range, it has no impact. To check that the points coincide, we can evaluate our equation for the indoor range when the ceiling is equal to $y_{max} = \frac{x_f}{4}$.
x_{fi} &=  2 \cdot \sqrt{x_f - 2  \cdot \frac{x_f}{4} } \cdot \sqrt{2 \cdot \frac{x_f}{4} }  \\
& =  2 \cdot \sqrt{x_f - \frac{x_f}{2} } \cdot \sqrt{ \frac{x_f}{2} }  \\
& =  2 \cdot \sqrt{ \frac{x_f}{2} } \cdot \sqrt{ \frac{x_f}{2} }  \\
& =  2 \cdot \frac{x_f}{2} \\
& =  x_f
Indeed they match.

Putting this together we can get in the following equation.
x_{fi} &= \begin{cases}
2 \cdot \sqrt{x_f - 2  \cdot y_p } \cdot \sqrt{2  \cdot y_p } & \text{if } y_p < \frac{x_f}{4} \\
x_f & \text{otherwise}
This is shown below as plots of indoor range vs. outdoor range by ceiling height, assuming a 5' tall thrower. Some example indoor ranges, rounded to the nearest 5', for an assortment of outdoor ranges and ceiling heights are listed in the table at the end.

Indoor range by ceiling height

\text{Ceiling Height}&  15& 60& 100& 120& 320& 400& 600 \\ \hline
 5&   0&    0&    0&    0&    0&    0&    0\\
10&  15&   45&   60&   65&  110&  125&  155\\
15&  15&   55&   80&   90&  155&  175&  215\\
20&  15&   60&   90&  105&  185&  210&  260\\
25&  15&   60&  100&  115&  210&  240&  300\\
30&  15&   60&  100&  120&  230&  265&  330\\
35&  15&   60&  100&  120&  250&  285&  360\\
40&  15&   60&  100&  120&  265&  305&  385\\
45&  15&   60&  100&  120&  275&  320&  410\\
50&  15&   60&  100&  120&  290&  335&  430\\
\text{Indoor ranges by outdoor ranges for project weapons, rounded to 5'}\\

No comments:

Post a Comment