# Solving short trigo equation with sine - need some help!

From the relation $M=E-\epsilon\cdot\sin(E)$, I need to find the value of E, knowing the two other parameters. How should I go about this?

This is part of a computation which will be done quite a number of times per second. I hope there's a quick way to get E out of this equation.

Thank you very much,

MJ

-
Have you tried root finding algorithms like Newton Raphson etc? – user17762 Feb 13 '11 at 17:26
I was afraid I'd have to use that kind of solution! I'll try it and do some tests. Hopefully I can get it to converge [very] quickly with good precision. To all: do not hesitate to come up with more solutions! – Joanis Feb 13 '11 at 18:05

I assume $\epsilon$ is a small quantity and propose one of the following:

(a) Write your equation in the form $E=M+\epsilon \sin(E)=: f(E)$ and consider this as a fixed point problem for the function $f$. Starting with $E_0:=M$ compute numerically successive iterates $E_{n+1}:=f(E_n)$; these will converge to the desired solution of the given equation.

(b) $E$ depends in an analytic way on the parameter $\epsilon$. Make the "Ansatz" $E:=M +\sum_{k=1}^\infty a_k \epsilon^k$ and determine the coefficients $a_k$ recursively. You will find $a_1=\sin(M)$, $a_2=\cos(M)\sin(M)$ and so on.

-
Wow, thanks. I just did a little test with (a) and it seems to work pretty well. Only thing left is to determine the number of iterations, which is nothing. I really should have said more on the problem. (Kepler's law) You are correct, ε is small: between 0 and 1. It is the eccentricity of an ellipse/orbit. M is the mean anomaly (between 0 and 2π) and E is eccentric anomaly. – Joanis Feb 13 '11 at 19:17
Generally when doing a numeric solution you don't predetermine the number of iterations, you just iterate until the change in the value(s) is small enough, though it is good to set an upper limit to avoid iterating forever. – Ross Millikan Feb 14 '11 at 4:20

Know that the solution to Kepler's equation can in fact be expressed as a series of Bessel functions of the first kind:

$$E=M+2\sum_{k=1}^\infty \frac{\sin(k M)J_k(k\epsilon)}{k}$$

but since the Bessel function is a bit more complicated to use, one is better off using Newton-Raphson or Halley to solve Kepler's equation (particularly convenient due to the properties of the derivatives of the sine and cosine, so you can recycle common subexpressions in numerical evaluation). That leaves you with the problem of starting up the iteration; I personally prefer the starting approximation due to G.R. Smith:

$$E\approx M+\frac{\epsilon\;\sin\;M}{1+\sin\;M-\sin(\epsilon+M)}$$

which is easily polished off subsequently with Halley, Newton-Raphson, or the simple fixed-point iteration mentioned by Christian. the paper shows how one can arrive at this via linear interpolation.

FWIW, the first thing you should have done before asking was to search the archives of the Celestial Mechanics and Dynamical Astronomy journal at Springer's web page or The SAO/NASA Astrophysics Data System; there are quite a number of survey articles on the efficient routes for evaluating the solutions to Kepler's (elliptic) equation, as well as methods for the parabolic ($\epsilon=1$) and hyperbolic ($\epsilon > 1$) cases.

Lastly, as a meta-note since I can't comment, this should be tagged [astronomy] and/or [celestial-mechanics]

-
Generally speaking I would prefer that tags on this site refer directly to mathematics. If someone decides that either [astronomy] or [celestial-mechanics] is an appropriate tag for their question, then probably their question is not appropriate for this site and should be asked e.g. on physics.SE instead. – Qiaochu Yuan Feb 14 '11 at 9:02