I have some orbital elements for comet P/2004 R1 (McNaught) from this dataset and I would like to calculate its position around the sun (x, y, z coordinates where the sun is at the origin) at a specific Julian date. Here is the data I have:

  • object: P/2004 R1 (McNaught)

    epoch_tdb: 54629

    tp_tdb: 2455248.548

    e: 0.682526943

    i_deg: 4.894555854

    w_deg: 0.626837835

    node_deg: 295.9854497

    q_au_1: 0.986192006

    q_au_2: 5.23

    p_yr: 5.48

    moid_au: 0.027011

    a1_au_d_2: NA

    a2_au_d_2: NA

    a3_au_d_2: NA

    dt_d: NA

    ref: 20

    object_name: P/2004 R1 (McNaught)

I already know how to calculate eccentric anomaly from kepler's equation. However I am struggling on calculating the mean anomaly.

Can you give me a step by step guide on the subject?

  • 1
    $\begingroup$ These elements are a few years newer. ssd.jpl.nasa.gov/tools/sbdb_lookup.html#/?sstr=P%2F2004%20R1 I assume the epoch in your data is a Modified Julian Date (in JPL's Barycentric Dynamical Time). $\endgroup$
    – PM 2Ring
    Apr 22, 2023 at 11:03
  • 1
    $\begingroup$ I'm not quite sure what you're having difficulty with. All 3 of mean, eccentric, and true anomalies are 0° at the instant of perihelion passage. $\endgroup$
    – PM 2Ring
    Apr 22, 2023 at 11:09

1 Answer 1


The "mean anomaly" is actually a measure of time expressed in terms of an angle. It is just $360^\circ\times(t-t_{\text{periapse}})/(\text{orbital period})$. (If you are working in degrees, you may find it convenient to work in radians.)

To find the mean anomaly, you need to know the time of periapsis This seems to be tp_tbd in your data. Also you need the orbital period. That is p_yr*365.25 (the factor of 365.25 is to convert the period to days, as the time is given as a Julian day number). And finally you need to know the time at which you want to calculate the position of the comet, again this should be as a Julian day number, your software will probably have a routine for converting a date-time to JD.

  • $\begingroup$ Note that tp_tdb strongly implies the time is in Barycentric Dynamic Time (TDB; the acronym is TDB regardless of language). TDB differs slightly from Terrestrial Time (TT), plus or minus at most a couple of milliseconds, which in turn differs from International Atomic Time (TAI) by about 16.184 seconds. Finally, TAI differs from UTC by an integer number of seconds; these are the much hated leap seconds. Those differences might or might not be important. $\endgroup$ Apr 22, 2023 at 18:01
  • $\begingroup$ Thank you I calculated the mean anomaly as you mentioned (but in radians). My current problem is, when for some of the time that is greater than tp_tbd + P or less than tp_tbd, the comet teleports to a location along the orbit instead of following it. For example: When time is equal to tp_tbd + P + 5, the comet teleports to somewhere very near perihelion (backwards) instead of following its course. Why is this happening and how can I solve it? $\endgroup$
    – Ege Can
    Apr 23, 2023 at 13:50
  • $\begingroup$ You should reduce the value of M to the range 0 to 2pi (by repeatedly subtracting multiples of 2pi) some programming languages call this fmod. $\endgroup$
    – James K
    Apr 23, 2023 at 14:35
  • $\begingroup$ @JamesK This is it! Thank you so much! $\endgroup$
    – Ege Can
    Apr 23, 2023 at 22:57

You must log in to answer this question.

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