How to solve Kepler's equation $M=E-\varepsilon \sin E$ for $E$?

2k Views Asked by At

I'm trying to create a program to solve a set of Kepler's Equation and I cannot isolate the single variable to use the expression in my program.

The Kepler Equation is $$M = E - \varepsilon \sin(E)$$

I will enter the values of $M$ and $\varepsilon$ and wish to find the value of $E$.

The website Wolfram Alpha could find a solution for this input $30(\frac{\pi}{180})=x-0.3 \sin(x)$

How can I find $E$?

EDIT:

I would like to propose this algorithm (Javascript) to solve the equation. It might require some adjustments depending on the programming language used. I did some basic tests with it, and would like feedback on it.

The following algorithm doesn't have an user input method and is treating the expression:

$0 = -x + \sin(-x)$

which is related to:

$x = \sin(-x)$

I used this algorithm to solve $E$ in Kepler's Equation rewriting it as (And swapping M and e for numerical constants, that in my case will be user inputs):

$0 = -M + E - e*sin(E)$

<script>
var start = Number.MIN_SAFE_INTEGER; end = Number.MAX_VALUE;

var result = null;

while(result === null) {
    var resultStart = Math.abs(-start + Math.sin(-start));
    var resultEnd = Math.abs(-end + Math.sin(-end));
    if(resultStart === 0) {
        result = start;
    } else if (resultEnd === 0) {
        result = end;
    } else {
        if (resultStart > resultEnd) {
            var startOld = start;
            start = (start+end)/2;
            if(startOld === start) { // underflow
                result = start;
            }
        } else {
            var endOld = end;
            end = (start+end)/2;
            if(endOld === end) { // underflow
                result = end;
            }
        }
    }
}

console.log(result);

</script>
4

There are 4 best solutions below

1
On BEST ANSWER

There is no known closed form inverse for Kepler's equation. Newton's Method works well numerically, except in the case of near parabolic orbits ($\varepsilon\approx1$). It says to iterate $$ E_{n+1}=\frac{M+\varepsilon\sin(E_n)-\varepsilon E_n\cos(E_n)}{1-\varepsilon\cos(E_n)} $$ until it converges.

3
On
0
On

$\def\L{\operatorname L} \def\J{\operatorname J}$

@giorgiomugnaini gave a Fourier series solution and the following integral representations was not found elsewhere online, but here are other solutions to the Kepler equation

Laplace Transform:

We apply the Laplace inversion theorem and one could expand $\sin(\phi)$, like in the Fourier series derivation, or:

$$f(\phi)=\sin(\phi)+a\phi=x\implies \phi=\L^{-1}_x(\L_s(\phi(t))$$

We define $\phi(x)=0\not<x\not<\pi a$, substitute $\phi(t)\to t$, and integrate by parts:

$$\L_s(\phi(t))=\int_0^{\pi a}e^{-st}\phi(t)dt=\int_0^\pi e^{-sf(t)}t\ df(t)=-\frac\pi s e^{-\pi a s}+\int_0^\pi e^{-s\sin(t)-a s t}dt$$

$-\frac\pi s e^{-\pi a s}$’s inverse Laplace transform is a Heaviside theta function which is zero for $x<\pi a$. Alternatively, if $f(x)$ is monotonic, then there is global inverse, so another setup is:

$$\L_s(h(t))=\int_0^\infty e^{-st}dt=\int_0^\infty t e^{-sf(t)}df(t)=\frac1s\int_0^\infty e^{-s\sin(t)-a s t}dt$$

Finally, expand $e^{c\sin(x)}$ via Maclaurin series, integrate, and sum over to obtain an Anger J. Therefore:

$$\bbox[3px,border: solid blue 3px]{\sin(\phi)+a\phi=x\implies \phi=\int_{ic-\infty}^{ic+\infty}\frac{e^{isx}\J_{a s}(s)}{is(e^{\pi i a s}+1)}ds,\int_{ic+\infty}^{ic-\infty}\frac{e^{isx}}{2s}\csc(\pi a s)\J_{as}(s)ds}$$

The first integral represents a period of $\phi(x)$ while the second is the global inverse. shown here:

enter image description here

Fourier Transform:

The Fourier inversion theorem uses Anger J:

$$\bbox[3px,border: solid blue 3px]{\sin(\phi)-a\phi=x\implies \phi=\int_0^\infty\frac2t\sin(tx)\operatorname J_{at}(t)dt}$$

shown here:

enter image description here

1
On

An analytical and elegant solution is the following Kapteyn / Fourier series:

$$E(M)=M+\sum_{n=1}\frac{ 2 J_n(n\epsilon) }{n} \sin(n M)$$

where $J_n(x)$ are the Bessel functions.

Other analytical solutions based on series expansion are discussed in:

"Solving Kepler's Equation Over Three Centuries", Peter Colwell, 1993

For implementation of Bessel functions in Javascript, several codes are available. For example:

http://www.mhtl.uwaterloo.ca/old/courses/me3532/js/bessel.html

https://github.com/SheetJS/bessel