# Fast Switch and Spline Scheme for Accurate Inversion of Nonlinear Functions: The New First Choice Solution to Kepler’s Equation. (arXiv:1812.02273v1 [physics.comp-ph])

Fast Switch and Spline Scheme for Accurate Inversion of Nonlinear Functions: The New First Choice Solution to Kepler’s Equation. (arXiv:1812.02273v1 [physics.comp-ph])
<a href="http://arxiv.org/find/physics/1/au:+Tommasini_D/0/1/0/all/0/1">Daniele Tommasini</a>, <a href="http://arxiv.org/find/physics/1/au:+Olivieri_D/0/1/0/all/0/1">David N. Olivieri</a>

Numerically obtaining the inverse of a function is a common task for many
scientific problems, often solved using a Newton iteration method. Here we
describe an alternative scheme, based on switching variables followed by spline
interpolation, which can be applied to monotonic functions under very general
conditions. To optimize the algorithm, we designed a specific spline routine
that is faster and more accurate than those that have been described in the
literature. We also derive analytically the theoretical errors of the method
and test it on examples that are of interest in physics. In particular, we
compute the real branch of Lambert’s \$W(y)\$ function, which is defined as the
inverse of \$x exp(x)\$, and we solve Kepler’s equation for the time evolution
of planets and spacecrafts. In all cases, our predictions for the theoretical
errors are in excellent agreement with our numerical results, and are smaller
than what could be expected from the general error analysis of spline
interpolation by many orders of magnitude, namely by an astonishing \$3times
10^{-22}\$ factor for the computation of \$W\$ in the range \$W(y)in [0,10]\$. In
our tests, this scheme is much faster than the Newton-Raphson iteration method,
by a factor in the range \$10^{-4}\$ to \$10^{-3}\$ for the execution time in the
examples, when the values of the inverse function over an entire interval or
for a large number of points are requested. For Kepler’s equation and tolerance
\$10^{-6}\$ rad, the algorithm outperforms Newton’s method for all values of the
number of points \$Nge 2\$.

Numerically obtaining the inverse of a function is a common task for many
scientific problems, often solved using a Newton iteration method. Here we
describe an alternative scheme, based on switching variables followed by spline
interpolation, which can be applied to monotonic functions under very general
conditions. To optimize the algorithm, we designed a specific spline routine
that is faster and more accurate than those that have been described in the
literature. We also derive analytically the theoretical errors of the method
and test it on examples that are of interest in physics. In particular, we
compute the real branch of Lambert’s \$W(y)\$ function, which is defined as the
inverse of \$x exp(x)\$, and we solve Kepler’s equation for the time evolution
of planets and spacecrafts. In all cases, our predictions for the theoretical
errors are in excellent agreement with our numerical results, and are smaller
than what could be expected from the general error analysis of spline
interpolation by many orders of magnitude, namely by an astonishing \$3times
10^{-22}\$ factor for the computation of \$W\$ in the range \$W(y)in [0,10]\$. In
our tests, this scheme is much faster than the Newton-Raphson iteration method,
by a factor in the range \$10^{-4}\$ to \$10^{-3}\$ for the execution time in the
examples, when the values of the inverse function over an entire interval or
for a large number of points are requested. For Kepler’s equation and tolerance
\$10^{-6}\$ rad, the algorithm outperforms Newton’s method for all values of the
number of points \$Nge 2\$.

http://arxiv.org/icons/sfx.gif