# Dynamical modeling of the flightpath of a baseball

The flight of a baseball is of much interest to sabermetricians and baseball players alike. There are many applications of a forward model for baseball flight, and in this post, I will develop a modular model for the flight of a baseball, which can use a bevy of different modeling choices to capture different phenomena in baseball flight.

## Governing equation of a baseball's flight

The fundamental ordinary differential equation that governs a baseball's flight is given by:
$$\ddot{\mathbf{x}}= \frac{\mathbf{F}_\mathrm{M}}{m_\mathrm{BB}} + \frac{\mathbf{F}_\mathrm{D}}{m_\mathrm{BB}} + \mathbf{g}$$
where $\mathbf{F}_\mathrm{M}$ is the lift force due to Magnus effect1, $\mathbf{F}_\mathrm{D}$ is the drag force on the baseball, and $\mathbf{g}= [0, 0, -g]^\mathrm{T}$ is the vector of gravitational acceleration.

The Magnus and drag forces can be described less generally by:
$$\mathbf{F}_\mathrm{M}= \frac{1}{2} \rho A_\mathrm{BB} C_L \frac{||(\mathbf{V} - \mathbf{v}_w)||}{||\boldsymbol{\omega}||}(\boldsymbol{\omega} \times (\mathbf{V} - \mathbf{v}_w))$$
and
$$\mathbf{F}_\mathrm{D}= - \frac{1}{2} \rho A_\mathrm{BB} C_D ||(\mathbf{V} - \mathbf{v}_w)|| (\mathbf{V} - \mathbf{v}_w)$$
where $\rho$ is the density of the surrounding air, $A_\mathrm{BB}$ is the cross-sectional area of a baseball, $C_L$ and $C_D$ are lift and drag coefficients, which are to be specified, $\mathbf{V}= \mathbf{\dot{x}}$ is the velocity vector of a baseball, $\boldsymbol{\omega}$ is the rotational velocity of the baseball, and $\mathbf{v}_w$ is the ambient wind environment.

## Modeling Magnus effect lift

The specification of the lift and drag models comes from a couple places. We begin with the lift coefficient which comes from the work of Robinson & Robinson2:
$$C_L= C_{L_0} ( 1 - \exp(-\lambda_L ||\boldsymbol{\omega}||))$$
where $C_{L_0}$ is a the zero-spin lift coefficient3, $\lambda_L$ is a lifting efficiency parameter. Under this model, the lift coefficient increases with spin, but in a fashion which has diminishing returns.

## Modeling drag on a baseball

For the drag model, we begin with a model which is inspired by a plot in Adair's The Physics of Baseball4:
$$C_D= C_{D_0} + \frac{(C_{D_\infty} - C_{D_0})}{(1 + \exp(-k_D (||\mathbf{V}|| - V_\mathrm{crit})))}$$
where $C_{D_0}$ is a zero-velocity (technically zero Reynolds number) drag coefficients, $C_{D_\infty}$ is an infinite limit drag coefficient, and $k$ governs the transition rate from $C_{D_0}$ to $C_{D_\infty}$. This is simply a logistic curve fit, which seeks to capture the laminar-turbulent transition of the baseball.

We now return to Robinson & Robinson2, who propose a drag coefficient which captures a crucial component of drag: spin-related augmentation of the drag coefficient. They propose a simple linear effect of spin on the drag:
$$C_D= C_{D_0} + m_D ||\boldsymbol{\omega}||$$
where, here, $C_{D_0}$ is the zero-spin lift, and $m_D$ is the spin-effect parameter.

In the end, I want to capture both of the effect of velocity/laminar-turbulent transition and the spin, so I propose a combined model, which plugs the Adair-inspired model as the zero-spin lift in the Robinson & Robinson model:
$$C_D= C_{D_0} + \frac{(C_{D_\infty} - C_{D_0})}{(1 + \exp(-k_D (||\mathbf{V}|| - V_\mathrm{crit})))} + m_D ||\boldsymbol{\omega}||$$
The logic for the simple additive combination is somewhat dubious, since the drag tends to come about from the wake size, which is phenomonologically significantly different across laminar-turbulent transition, and this area may be ripe for improvement.

## Modeling spin

Currently, it is assumed that spin is constant throughout a baseball's flight path:
$$\boldsymbol{\omega}(t)= \boldsymbol{\omega}_0$$
Done. That's the default for the code.

### But then again...

I think that one of the most under-appreciated parts of baseball physics is the change in spin during a baseball's flight. This is a cartoonish example, but look at how the baseball obliterated by this 717 foot dinger curves:

The path of the baseball is clearly influenced by a lifting force, which decays in time, eventually allowing the baseball to settle into a ballistic trajectory.

For another example, see:

In the video in the tweet, we can see that the dynamics of the rotation of the baseball are very active. The ball tumbles as the spin vector changes due to gyroscopic forces. These are very complex actions and forces, and until now have been mostly assumed not to exist.

### Phenomenology of spin dynamics

Understanding the spin dynamics of the baseball is crucial to making a model. Barton Smith's work concentrates on trying to figure out how significant forces manifest from orientation-dependent accelerations, mostly in terms of translation.

The baseball will be rotationally accelerated by drag torques acting on (1) the surface and (2) the seams of the baseball. At their distance from the center, these two effects should be the largest contributors to the spin dynamics. I would guess that when a baseball is not spinning, there is a significant, massively orientation-dependent set of rotational forces on the baseball. Capturing these in a model would require substantial aerodynamic modeling of the air surrounding the baseball, and in my view is not really attainable.

When the baseball is spinning with significant rotational velocity, however, I suspect the dependency on orientation will decrease somewhat, and the primary effect of the seams and the surface of the baseball will be to slow the rotation rate, without significantly changing the spin orientation. This has potential to be modelled.

### A simple spin dynamics model

$$\boldsymbol{\omega}(t)= \boldsymbol{\omega}_0 \exp(-\lambda_t (t - t_0))$$
where, here, $\boldsymbol\omega_0$ is the initial rotational velocity vector at time $t_0$, which typically will be bat impact or release, and should be updated with every spin-inducing event. We can specify $\lambda_t$ by way of decay times. Going back to the video from Smarter Every Day, a rough estimate for the 95% decay time is $1.25$ seconds. From that, we can estimate:
$$\lambda_t= \frac{\log(10)}{\Delta t_{90\%}}$$
This gives us $\lambda_t= 0.8$ for a starting guess.

## Putting it all together

Now, we seek to assemble all the parts into the final dynamical model. We start with the state.

We take the second-order translational system and solve it as a set of coupled first-order equations:
$$\mathbf{y}= \begin{pmatrix} \mathbf{\dot{x}} \\ \mathbf{x} \\ \boldsymbol\omega \end{pmatrix}$$
such that we can write:
$$\mathbf{\dot{y}}= f(\mathbf{y}, t, \boldsymbol\theta)$$
where
$$\boldsymbol\theta= \begin{pmatrix} \rho \\ A_\mathrm{BB} \\ C_{L_0} \\ \lambda_L \\ C_{D_0} \\ C_{D_\infty} \\ k_D \\ V_\mathrm{crit} \\ m_D \\ \lambda_t \end{pmatrix}$$
is a vector of parameters.

We can look a bit closer at the parameters:

symbol parameter ballpark value units period comments
$\rho$ density $1.225$ $\mathrm{kg/m^3}$ game fairly deterministic within a single game, can be calculated accurately from weather data
$A_\mathrm{BB}$ baseball frontal area $\frac{\pi}{4} 0.07379^2$ $\mathrm{m^2}$ forever? need to figure out the tolerance for this, but it seems its safely assumed to be pretty remarkably static
$C_{L_0}$ zero-spin lift coefficient $0.319$ $\mathrm{constant}$ season I'd guess this varies at worst season to season
$\lambda_L$ lifting efficiency parameter $2.48e-3$ $(\mathrm{rad./s})^{-1}$ season I'd guess this varies at worst season to season at worst
$C_{D_0}$ drag coefficient as $Re \to 0$ $0.6$ $\mathrm{constant}$ pitch/game Rob's work seems to indicate that this one's gonna be a real pain in the ass
$C_{D_\infty}$ drag coefficient as $Re \to \infty$ $0.2$ $\mathrm{constant}$ pitch/game Rob's work seems to indicate that this one's gonna be a real pain in the ass
$k_D$ drag transition parameter $\frac{1}{125}$ $(\mathrm{m/s})^{-1}$ >season this is a tough one to guess on, but I think this should be reliable from season to season, if not longer; may be wrong if there is strong dependence on seam + surface characteristics of baseballs
$V_\mathrm{crit}$ drag crisis velocity $24.384$ $\mathrm{m/s}$ >season this is a tough one to guess on, but I think this should be reliable from season to season, if not longer; may be wrong if there is strong dependence on seam + surface characteristics of baseballs
$m_D$ churn drag parameter $\frac{1}{125}$ $(\mathrm{rad./s})^{-1}$ >season this is a tough one to guess on, but I think this should be reliable from season to season, if not longer; may be wrong if there is strong dependence on seam + surface characteristics of baseballs
$\lambda_t$ spin decay parameter $0.8$ $\mathrm{s}^{-1}$ season once again, this is hard to guess on- it may vary pretty significantly based on the seam + ball construction more generally.

1.: a fun and random fact: Heinrich Gustav Magnus, of the aforementioned Magnus effect, is my great-great-great-great-great-great-great-great-Ph.D. advisor. I'm sure he would be proud that I'm writing out the effect of aerodynamics on a baseball's flight instead of doing actual research lol.

2.: Robinson, Garry, and Robinson, Ian. "The motion of an arbitrarily rotating spherical projectile and its application to ball games." Physica Scripta 88.1 (2013): 018101.

3.: This is somewhat nonsensical, as the lift is generated by spin, so lift will be definition be zero, and the lift coefficient will not matter. Nonetheless, this is really just a linear fit intercept when it comes down to, so the self-contradiction is moot.

4.: Adair, Robert K. The Physics of Baseball. HarperCollins, New York, 2002.