- #1

- 2

- 0

## Main Question or Discussion Point

So I'm in need of some more help for my astronomy class again.

My professor wants us to write a program that outputs a table with the distance of Mars from the sun (r) and it's true anomaly. The problem is that i need to compute the Eccentric Anomaly (E) from the Mean Anomaly (M). Kepler's equation is E = M + εsin(E), but I can't get it down in terms of E. Seeing as how I'm using c++, it is kind of a necessity. One website seemed to have an equation involving Einitial and Efinals, but it didn't do me any good. Is the idea to set the original Einitial equal to 0 at t=0 (the perihelion point) and find E final in terms of that? At the end of each iteration (I'm running a while loop) the Eintial of the next iteration would be set to the Efinal of the current loop. Anybody got any ideas? Thanks

My professor wants us to write a program that outputs a table with the distance of Mars from the sun (r) and it's true anomaly. The problem is that i need to compute the Eccentric Anomaly (E) from the Mean Anomaly (M). Kepler's equation is E = M + εsin(E), but I can't get it down in terms of E. Seeing as how I'm using c++, it is kind of a necessity. One website seemed to have an equation involving Einitial and Efinals, but it didn't do me any good. Is the idea to set the original Einitial equal to 0 at t=0 (the perihelion point) and find E final in terms of that? At the end of each iteration (I'm running a while loop) the Eintial of the next iteration would be set to the Efinal of the current loop. Anybody got any ideas? Thanks