I wrote software which uses GMT real time to calculate Earth's mean, eccentric, and true anomaly. I encountered a bug where after reaching 360 degrees, instead of flipping back to zero, it subtracts from 360.

So I checked Wolfram Alpha with search for Earth's true anomaly, just to see if we had passed through 0 degrees triggering the bug. As of a few days ago Wolfram and I were in agreement, approaching 360 degrees. But now Wolfram reads 179 degrees approx. I remember passing 180 in July or August.

So it appears Wolfram is also experiencing an error. To double check, true anomaly is the angle between Earth and perihelion side of major axis. We know Earth reaches its closest point to the Sun in the northern hemisphere winter, January roughly. And aphelion in summer months.

Additionally the j2000 epoch I uses 358 degrees roughly, putting the perihelion or closest approach right around early january roughly.

Thus I can only conclude Wolfram is in error as well?

  • 2
    $\begingroup$ Cross-posted at physics.SE: physics.stackexchange.com/questions/451856/… $\endgroup$ Jan 3, 2019 at 15:44
  • $\begingroup$ I'm voting to close this question as off-topic because the same question was asked earlier on physics.stackexchange.com . $\endgroup$ Jan 3, 2019 at 15:46
  • $\begingroup$ Seems interdiscipline. I had suggestion already to move here. It has received positive vote here, I think would be better to have closed on physics, myself, if in fact either should really be closed. $\endgroup$ Jan 3, 2019 at 15:51
  • $\begingroup$ It seems physicist and astronomer use true anomaly for different purpose, say understanding gravity, or viewing a nebula. Perhaps one uses reference to aphelion and one to perhelion? I think it isn't completely unreasonable to have two questions. $\endgroup$ Jan 3, 2019 at 15:55
  • 1
    $\begingroup$ @DavidHammen while cross-posting on SE is certainly discouraged, it's neither forbidden, nor is it a valid reason for closure. The question is about celestial mechanics, which is without doubt on-topic on our site. I'm therefore voting to leave this question open. $\endgroup$ Jan 3, 2019 at 21:50

2 Answers 2


To fix the bug, maybe try something like this

Assume you have managed to calculate $\sin(f)$ and $\cos(f)$ of the true anomaly $f$. Then the true anomaly can be expressed in code as $$f = (\sin(f) > = 0)\arccos\big(\cos(f)\big)\, + \, (\sin(f) < 0) \Big(\, 360^{\circ} - \arccos\big(\cos(f)\big)\,\Big)$$ In this expression the logical operation $(\sin(f) > = 0)$ produces as output either $1$ or $0$ and so does $(\sin(f) < 0)$. Also make sure the your $\arccos$ function produces output in degrees and not radians, because that's what $\arccos$ does mathematically. If it produces radians, then multiply the output by $\frac{180^{\circ}}{\pi}$ i.e. $$f = (\sin(f) > = 0)\frac{180^{\circ}}{\pi}\,\arccos\big(\cos(f)\big)\, + \, (\sin(f) < 0) \Big(\, 360^{\circ} - \frac{180^{\circ}}{\pi}\,\arccos\big(\cos(f)\big)\,\Big)$$


I've found an almanac for Earth perihelion up to the year 2100. 2019 perihelion occurred at roughly 5:00 January 3, 2019. Thus the angle now of true anomaly is some extent past 0 degrees. And Wolfram Alpha is wrong by negative 180 degrees. By Wikipedia and other standard definitions of mean anomaly which have persisted since Kepler's time.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .