I'm writing a program to randomly generate star systems and I have been having a difficult time figuring this out. I've found the equations I need to get the heliocentric equatorial coordinates, but I haven't been able to figure out how to determine the longitude of perihelion. Is it just the opposite of the longitude of the ascending node or is it a completely different variable?

It might just me, but the names for this stuff is definitely making it more confusing than it should be.

Here is all my notes:

** = power

P = planet's period

a = semi-major axis

b = semi-minor axis

M = mean anomaly

E = Eccentric anomaly

e = eccentricity of orbit

v = true anomaly

r = radial distance

A = longitude of asending node

w = longitude of perihelion

i = inclination

t = time

(r, v) = polar coordinates

(x, y, z) = Heliocentric Ecliptic coordinates

(X, Y, Z) = Heliocentric Equalorial coordinates


e = sqrt(1 - (b ** 2 / a ** 2))


P = sqrt(a ** 3)

Kepler's Equation

M = E - e * sin(E)

Mean Anomaly use as starting point for eccentric anomaly

M = (2 * pi * t) / P

True Anomaly

v = 2 * atan(sqrt((1 + e) / (1 - e)) * tan(E / 2))

Radial Distance

r = (a(1 - e ** 2)) / (1 + e * cos(v))

Heliocentric Ecliptic coordinates

x = r(cos(A) * cos(w + v) - sin(A) * sin(w + v) * cos(i)

y = r(sin(A) * cos(w + v) + cos(A) * sin(w + v) * cos(i)

z = r * sin(w + v) * sin(i)

Heliocentric Equalorial coordinates

X = x

Y = y * cos(i) - z * sin(i)

Z = y * sin(i) + z * cos(i)

  • $\begingroup$ The longitude of the perihelion is an independent variable. It's not dependent on the longitude of the ascending node, or the other variables that define an ellipse. $\endgroup$
    – user21
    Commented Dec 11, 2015 at 2:33
  • $\begingroup$ Ok but what is it? $\endgroup$
    – Eegxeta
    Commented Dec 11, 2015 at 15:04
  • $\begingroup$ Since you're creating the star system, you can make it whatever you want it to be. $\endgroup$
    – user21
    Commented Dec 11, 2015 at 16:28
  • $\begingroup$ Right but I don't know what it is. Does it affect the orientation of the orbit? What units is it in? I kinda need to know what it is as it has enough significance to be in the equations. $\endgroup$
    – Eegxeta
    Commented Dec 11, 2015 at 17:27
  • 1
    $\begingroup$ The diagram on en.wikipedia.org/wiki/Longitude_of_the_ascending_node may help explain the relationship between the various elliptical orbit parameters (periapsis in that diagram is perihelion if the central object is the Sun) $\endgroup$
    – user21
    Commented Dec 11, 2015 at 17:32

1 Answer 1


As opposed to what @user21 said, the longitude of periastron does depend on the longitude of ascending node (I was surprised by that myself).

In orbital dynamics, there exist the argument of periastron (symbol ω) as well as the longitude of periastron (symbol π [or ϖ but may lead to confusion) ), which is equal to the argument of periastron (ω) plus the longitude of ascending node (Ω). In other words:

π = ω + Ω

Now, the argument of periastron is equal to:

ω = arccos $\frac{\mathbf{n}\ ·\ \mathbf{e}} {|\mathbf{n}||\mathbf{e}|}$

If ez < 0 then ω → 2π − ω.


$\mathbf{n}$ is a vector pointing towards the ascending node (i.e. the z-component of $\mathbf{n}$ is zero), and

$\mathbf{e}$ is the eccentricity vector (a vector pointing towards the periastron).

This formula can be found at https://en.wikipedia.org/wiki/Argument_of_periapsis (I call it instead the “argument of periastron,” as Meeus says: “The word ‘periapse’, used by some authors, is incorrect. The word perihelion means the point of the orbit that is closest to the Sun [from the Greek peri = near + helios = Sun]. Similarly, perigee is the point closest to the Earth [ge = Earth]. Therefore, ‘periapse’ would really mean the point closest to the apse; but this is ridiculous, because what is meant is the apse itself!”)

So, using the above formula, you should be able to figure out the longitude of the ascending node for each of your hypothetical bodies.

Have fun!

  • 1
    $\begingroup$ Note that the equation π = ω + Ω represents a compound angle; If the Orbital Plane has non-zero Orbital Inclination, you cannot just add the values of the Longitude of the Ascending Node and the Argument of Periapsis to get the Longitude of Periapsis; you're going to have to do some more complicated spherical trigonometry. $\endgroup$
    – notovny
    Commented Nov 24, 2020 at 21:33
  • $\begingroup$ It may be a compound angle, but that’s the definition of “longitude of periastron,” as can be seen here en.wikipedia.org/wiki/Longitude_of_the_periapsis and in any and all other references on the subject you may find. $\endgroup$ Commented Nov 25, 2020 at 1:39

You must log in to answer this question.

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