Iwerlipse
The Iwerlipse (pronounced ee-ver-lipse /ˈivɜlɪps/) is the range of positions Mario can occupy while he is in the air and cannot turn, assuming that drag is constant. The boundary of the Iwerlipse is reached by Arctan Straining - the optimal way of air straining that gives the greatest distance along a chosen angle ω for a given number of frames T. For a single frame T = 1, the Iwerlipse is an ellipse with half-width 10 (in the sideways direction) and half-height 1.5 (in the forwards direction). For general T, it resembles an ellipse with half-width 10T and half-height 3T(T+1)/4, but bulges at the corners, covering more area than an ellipse with the same dimensions. As shown by Grassdigger, the shape is well approximated by a generalised superellipse, and thus Pannenkoek2012 proposed calling this shape the Iwerlipse - a pun on the name of Iwer Sonsch, who first discoverered that Arctan Straining was optimal in April 2018.
Basics
Arctan Straining gives the maximum possible distance along a target angle ω that differs from the facing angle θ, over a finite number of frames T. It is performed by choosing straining angles 𝜙t (intendedYaw) such that
Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \begin{align} \phi_t - \theta = \begin{cases} \arctan \left[\dfrac{10\tan(\omega - \theta)}{1.5(T+1-t)} \right] & \text{if } \cos(\omega-\theta) > 0, \\[14pt] \arctan \left[\dfrac{10\tan(\omega - \theta)}{1.5(T+1-t)} \right] + 180^\circ & \text{if } \cos(\omega-\theta) < 0, \end{cases} \end{align} }
with t being the frame number between 1 and T. (Usually only the top row of this equation is given, but since the arctan function only gives results between ±90°, we must add 180° to the result if the target angle is behind Mario.)
Arctan straining is a result of two asymmetries in how Mario's forward velocity and sideways speed are updated
- Forward velocity accelerates gradually over time, while sideways speed is reset every frame.
- Straining on a single frame has a weak effect on forward velocity (increasing velocity by a maximum of 1.5), but a strong effect on sideways speed for a single frame (setting sideways speed to a maximum of 10).
In terms of total distance acquired along some direction, forward velocity is thus more effective over long periods of time, where it has time to accelerate to large values, whereas sideways speed is more effective over short periods of time. Optimal straining over many frames then involves straining mostly along the forwards direction to build up a large forward velocity, and then towards the end of the trajectory, transitioning into sideways straining to exploit the large sideways displacement obtainable in a single frame.
Update equations
When Mario is in the air and cannot turn, the function update_air_without_turn is responsible for updating Mario's velocity variables from one frame, t-1, to the next, t. Without loss of generality, we can choose coordinates so that Mario's facing angle is zero. In other words, he is facing along the z-axis, while his sideways speed is directed along the x-axis. Mario's forward velocity and position coordinates are then updated via
Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \begin{align} v_t &= v_{t-1} - D(v_{t-1}, \phi_t) + 1.5\cos(\phi_t),\\ z_t &= z_{t-1} + v_t,\\ x_t &= x_{t-1} + 10\sin(\phi_t), \end{align}}
where 𝜙t is the straining angle (intendedYaw) on frame t. The total effect of drag is determined by
Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle D(v_{t-1}, \phi_t) = \begin{cases} -2.35 & \text{if } v_{t-1} < - 16.35 - 1.5 \cos(\phi_t),\\ -0.35 & \text{if } -16.35 - 1.5 \cos(\phi_t) \leq v_{t-1} \leq -0.35,\\ v_{t-1} & \text{if } -0.35 < v_{t-1} < 0.35,\\ 0.35 & \text{if } 0.35 \leq v_{t-1} \leq D_\text{cap} + 0.35 - 1.5 \cos(\phi_t),\\ 1.35 & \text{if } v_{t-1} > D_\text{cap} + 0.35 - 1.5 \cos(\phi_t). \end{cases} }
where Dcap is a soft velocity cap equal to 48 for long jumps and 32 otherwise. In practice, these drag boundaries are far enough apart that the drag is often constant over large periods of time. In this case we can write Mario's position after T frames as
Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \begin{align} x_T &= x_0 + 10 \sum_{t=1}^{T} \sin(\phi_t),\\ z_T &= z_0 + v_0 T - \frac{DT(T+1)}{2} + 1.5 \sum_{t=1}^T (T+1-t)\cos(\phi_t). \end{align}}
In deriving the expression for zT we have used that the sum of the first T integers is equal to the triangle number T(T+1)/2, and we have grouped together terms of cos(𝜙t). Notice that, since forward straining produces an acceleration that is not reset between frames, earlier frames have a stronger effect on zT than later frames. The effective strength is 1.5(T+1-t), i.e. 1.5 multiplied by the number of frames remaining (including the current frame), since the forward velocity gained on one frame produces a displacement also on all remaining frames.
Arctan straining proof
The displacement vector after T frames is R = (xT − x0) x̂ + (zT − z0) ẑ. Taking the dot product of this with the unit vector along the target angle ω gives the distance moved along this angle
Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \begin{align} S &= \left(v_0 T - \frac{DT(T+1)}{2}\right)\cos(\omega)\\ &+ \sum_{t=1}^T \left[10\sin(\phi_t)\sin(\omega) + 1.5(T+1-t)\cos(\phi_t)\cos(\omega)\right],\\ \end{align} }
where the first line is a constant displacement due to our initial velocity and drag, and the second line gives the effective contribution from straining on each frame. Thanks to this separation, we can maximize the total distance by individually maximizing each contribution, dS/d𝜙t = 0, yielding
Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \tan(\phi_t - \theta) = \frac{10\tan(\omega - \theta)}{1.5(T+1-t)},}
where we have also rotated the coordinate system back to allow for general facing angles θ. Since tan(x) = tan(x±180°), this equation has two unique solutions for 𝜙t which are given above.
Iwerlipse equations
By writing sin(𝜙t) and cos(𝜙t) in terms of tan(𝜙t), and using the optimal straining relation, we obtain exact expressions for the boundary of the Iwerlipse after T frames
Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \begin{aligned} x_T - x_0 &= \pm10 \sum_{t=1}^T \frac{1}{\sqrt{1+\beta^2 t^2}},\\ z_T - \langle z \rangle &= \pm1.5 \beta \sum_{t=1}^T \frac{t^2}{\sqrt{1+\beta^2 t^2}}, \end{aligned} }
where β = 1.5/10tan(ω), and ⟨z⟩ = z0 + v0T - DT(T+1)/2. We can restrict 0 < ω < 90°, with the four combinations of plus and minus signs giving the remaining quadrants. The Iwerlipse's half-width is xmax = 10T, while its half-height is zmax = 3T(T+1)/4.
Approximations
If T is large, the exact expressions involve large summation terms, so it may be useful to have approximate expressions that are easier to compute. By replacing the summations from t = 1 to t = T with an integral from t = 1/2 to t = T + 1/2 (essentially performing the midpoint rule of numerical integration in reverse), we obtain
Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \begin{aligned} x_T - x_0 &= \pm \frac{10}{\beta} \left[\operatorname{arsinh}(\beta t)\right]^{T+1/2}_{1/2},\\ z_T - \langle z \rangle &= \pm \frac{3}{4\beta^2} \left[\beta t\sqrt{1+\beta^2 t^2} - \operatorname{arsinh}(\beta t)\right]^{T+1/2}_{1/2}, \end{aligned} }
with the notation [F(t)]ab = F(b) − F(a). This approximation converges to the true result very quickly - even for T = 2, the RMS error (normalized by xmax and zmax) is 4.3×10−3, while for T > 6 it is less than 10−3. Similar expressions obtained using the Euler–Maclaurin formula converge more slowly, even with first-order correction terms.
A simpler but less accurate approximation is obtained by fitting the Iwerlipse to a generalized superellipse
with exponents m(T) and n(T) found by minimizing the error. These have been computed up to large T, and can be obtained from a lookup table[1]. In the limit T ≫ 1, the exponents converge to m ≈ 2.520897 and n ≈ 2.064371, but unlike the integral approximation, the expression never converges to the exact result — there is always some small error.
Quarterstep penalty
If a number of quartersteps, q ∈ {0,1,2,3}, are lost on the final frame, the forward velocity gained on frame t no longer accumulates forward distance over T+1-t frames, but instead over T - q/4 + 1 - t frames. The optimal straining relation then becomes:
Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \tan(\phi_{t'}) = \begin{cases} \dfrac{10\tan(\omega)}{1.5(T - q/4 + 1 - t)}, & \text{if } t < T,\\[10pt] \dfrac{10\tan(\omega)}{1.5}, & \text{if } t = T. \end{cases} }
The optimal straining angle for the final frame is not affected, since in this case the ellipse shrinks in both directions rather than just vertically, i.e. a factor (1-q/4) cancels in the numerator and denominator.
History
Plush discovers that during a dive recover, one can gain greater distance along an angle different from Mario's facing angle by “flinging” the control stick through different angles during the trajectory, rather than holding it at a constant angle.
Pannenkoek qualitatively explains this phenomenon that would later be known as arctan straining:
I think you're supposed to hold forward-ish for most of it, then sideways at the end. Because sideways movement doesn't depend on your speed. So 5 frames of sideways holding at the start of the DR is equivalent to the 5 frames at the end. But forward distance depends on your hspeed. So let's say you start with some hspeed. If you go sideways then forwards, then you'll lose that hspeed. But if you go forward then sideways, then you'll take advantage of your starting hspeed. The best inputs would probably mix sideways and forwards somewhat.
— Pannenkoek2012
Peter Fedak shares the correct velocity update equations, and the three of them begin to consider what the mathematically optimal inputs are.
Iwer Sonsch independently rediscovers the velocity update equations and realises that by facing along the hypotenuse of the forward velocity and sideways speed — a trick known in other speedrunning communities as vectoring — he can gain greater distance in a single frame. He wonders how this would look over multiple frames, restarting the discussion of optimal straining. However, there is no quantitative progress until it becomes relevant to the A Button Challenge the following year.
The “Blast to the Stone Pillar” star in JRB is collected in 0 A presses for the first time, after Tyler Kehne figures out how to use conserved speed to get from the nearby pillar to the star platform.
The community turns their attention to whether the “Treasure of the Ocean Cave” star can be collected in a similar way, again reviving the optimal straining question, as people including Iwer, bad_boot, and DeRockProject begin attempting to make the most of the limited speed they have available.
Iwer states the optimal straining equation for the first time in the following form
Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \phi_{t'} - \theta = \operatorname{arccot}(0.15\,r\,t')}
This is equivalent to our expression above, since arccot(x) = arctan(1/x), with, r = 1/tan(ω), and, t' = T + 1 - t. (If using this expression, we need to add 180° if the target angle is to the right of Mario, since arccot only gives results between 0° and 180°.)
Pannenkoek posts an idea for collecting the “Scale the Mountain” star in TTM via a dive recover. To find out whether it was possible, Iwer, Grassdigger, Jane, bad_boot, and DeRockProject work to plot all of Mario’s possible positions while air straining.
Iwer discovers the exact equations describing Mario's possible positions after Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle T} frames. Grassdigger and DeRockProject then show that the total shape can be well approximated by a generalised superellipse. Pannenkoek proposes calling it the Iwerlipse.
Silverstrawb provides an alternative proof[2] of the optimal straining relation by converting the discrete update equations into the continuous differential equations
Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://en.wikipedia.org/api/rest_v1/":): {\displaystyle \begin{align} \dot{x} &= 10 \sin(\phi(t)),\\ \ddot{z} &= 1.5 \cos(\phi(t)) - D, \end{align}}
and using the calculus of variations.
Krithalith independently rediscovers Iwer’s original proof and extends it to include quartersteps.
sm64expert adds arctan straining to MKDasher’s input direction LUA program, making it accessible to everyone for the first time.
sm64expert adds arctan straining to SM64 Lua Redux.