Variables: fill fraction \( f \) (0–100 %), can height \( H \), radius \( R \), empty can mass \( m_{\text{can}} \), beverage volume \( V \), gravitational acceleration \( g \), and applied horizontal acceleration \( a_{\text{train}} \).
$$h_{\text{liq}} = \frac{f}{100} \; H \qquad m_{\text{liq}} = \frac{f}{100} \; V$$
$$y_{\text{COM}} = \frac{m_{\text{can}} \left(\tfrac{H}{2}\right) + m_{\text{liq}} \left(\tfrac{h_{\text{liq}}}{2}\right)}{m_{\text{can}} + m_{\text{liq}}}$$
$$\theta_{\text{tip}} = \tan^{-1}\!\left(\frac{R}{y_{\text{COM}}}\right)$$
$$a_{\text{crit}} = g \; \tan(\theta_{\text{tip}}) = g \; \frac{R}{y_{\text{COM}}}$$
$$S = \frac{a_{\text{crit}}}{a_{\text{train}}} \qquad \text{Can tips if } a_{\text{train}} \ge a_{\text{crit}}$$