I use this planetarium tool to see the position of the Moon to check I have it in the right place for a given place and time, for my non-Earth plant. I'm considering having another moon. How would I track it in a similar way as the tool above? I would prefer a visual way to do it, but calculating its position in the sky would be sufficient. The math is enormously complicated, I'm sure. There's also phases to consider; one step at a time, though I suspect that will come with the rest of the math incidentally.

Since it's a fictional planet, adherence to the real position of the real Moon is not important. Simplification is fine, and any equation or equations will be programmed, but I'm not sure where to look for the math here to begin with.

  • 2
    $\begingroup$ Calculate the position of the fictional satellite in the fictional sky to what degree of precision and accuracy? For a quick and dirty approximation, once you have set the synodic period of the satellite and the inclination of its orbit, that's basically all you need to get a believable position for a given time and geographical position on the planet. Simply assume that it moves at constant speed on its apparent orbit. On the other hand, if you want any kind of astronomical accuracy, the details are grotty... $\endgroup$
    – AlexP
    Commented Jan 18 at 15:37
  • $\begingroup$ Do you mind if I ask why you need this? It's a level of "realism" that's way beyond any book, game, or movie I've ever experienced. I'm wondering if you're getting stuck in (very small) details. $\endgroup$
    – JBH
    Commented Jan 18 at 15:38
  • $\begingroup$ even if you are going to neglect gravitational perturbation from other moon and assume Earth is a perfect sphere with well distributed density, this is still a many body problem and I haven't even touch on orbital resonance and atmospheric drag at perigee... okay I actually BS a bit but you get the drift! $\endgroup$
    – user6760
    Commented Jan 18 at 16:59
  • 1
    $\begingroup$ What is the technology level of your planet? If it's ancient, this is done empirically. You look up at the sky and find patterns, if it's a little more modern some geometry and mathematics could be used, if it is like modern day earth computer models can be made. If it is more advanced, then you could just detect where the signals from the colony on that moon are coming from. $\endgroup$
    – Mathaddict
    Commented Jan 18 at 17:03
  • 2
    $\begingroup$ If all you want is an orrery, i.e. an idealized circular orbit disregarding perturbations, the math is pretty simple: trig functions (sine, cosine) and rotation matrices. For phase, use a vector dot product to measure the apparent angle between the moon and the sun. $\endgroup$ Commented Jan 19 at 18:27

2 Answers 2



You probably do not need to do this. Yes, it is hard. It took me a long time to cobble together enough of a basic understanding to take a crack at this, and I'm still not 100% sure I've done this entirely right. There are a lot of fiddly details about things like coordinate systems and reference points, and I'm by no means confident that I didn't mess something important up.

So if you really need this much precision for your worldbuilding you should go through and check my work. If you don't need this much precision, it would be much easier to just fake it in your story, it's unlikely anyone will notice (especially for a fictional moon around a fictional planet).

I've left out a lot of details (mainly about what the numbers used here mean, and about where the equations come from) for the sake of brevity, and yet this answer still ended up quite long. Hopefully it's at least interesting to look through how one goes about calculating this kind of thing.

Part 1: Where is the Moon

There are two moving bodies at play here. The first is the moon. We need to end up with two coordinates for the moon given the date-time: its right ascension $\alpha$ and its declination $\delta$.

To get those coordinates, we need to know the orbital elements of the moon. Now, for real satellites (including Earth's moon) astronomers use what are called ephermeris tables as the starting point for these calculations, since the orbital elements are constantly changing for a variety of reasons (tidal effects, $n$-body effects, atmospheric drag, etc). We're going to assume that your moon has orbital elements that do not change, to make this possible. You will just have to pick numbers for these elements as a part of creating your fictional moon.1

The first thing to do is to specify the necessary orbital elements for your moon:

  • Semimajor axis $a$
  • Eccentricity $e$
  • Inclination $i$
  • Right ascension of the ascending node $\Omega$
  • Argument of the perigee $\omega$
  • Orbital period $P$
  • Epoch of perigee $T$
  • The time $t$ since your epoch of perigee

Together these numbers define your moon's orbit.2 There are lots of details about what these mean on Google or in the reference I used (pdf) so you can understand what they represent about your moon's orbit, but again you just need to pick values for them.

Now, do the following calculations in order: $$n = \frac{2\pi}{P}$$ $$R = a\left(1-e\cos\left(n (t-T)\right)\right)$$ $$v = \arccos\left(\frac{a(1-e^2)-R}{eR}\right)$$

Once we've got these, we can compute the declination: $$\delta = \arcsin\left(\sin (i) \sin (\omega + v) \right)$$

and the right ascension: $$\alpha = \Omega + \arctan\left(\cos(i)\tan(\omega + v)\right)$$

Part 2: The Observer

The declination and right ascension found above are for an observer at the center of the planet. To figure out where in the sky an observer somewhere on the surface should look, we must specify a latitude, longitude, and the local sidereal time. These are all measured relative to a reference. Latitude has a natural reference (the equator), but for longitude you'll need to pick a reference meridian; on Earth we use Greenwich. Sidereal time at this reference meridian is based on the vernal equinox.1

If you know the sidereal time at your reference meridian $\theta_0$, you can get local sidereal $\theta$ time as simply: $$\theta = \theta_0 + \text{lon}$$

(Yes, sidereal time is measure in angular not time units; for orbital systems time and angle are highly related measures and angles are much more convenient to work with.)

With local sidereal time in hand, we calculate something called the hour-angle from the right ascension we found before: $$\tau = \theta - \alpha$$

And now, finally, we can calculate where in the sky the moon will appear! For this we use coordinates called altitude $h$ and asimuth $\phi$ ($\alpha$ is often used as the symbol for azimuth, but we're already using it for right ascension). These measure, respectively, how far above the horizon the moon is, and how far eastward of north the moon is. Here are the formulae (taken from this reference): $$h = \arcsin\left(\sin(\text{lat})\sin(\delta) + \cos(\text{lat})\cos(\delta)\cos(\tau)\right)$$ $$\phi = \arctan\left(\frac{-\sin(\tau)}{\cos(\text{lat})\tan(\delta) - \sin(\text{lat})\cos(\tau)}\right)$$

The moon will be observable as long as the altitude $h$ indicates that the moon is far enough above the horizon not to be obscured by any obstacles (like mountains) and its azimuth $\phi$ doesn't place it behind any obstacles (again, like mountains).

1 The vernal equinox for your planet is the point on the celestial sphere where the ecliptic intersects the equator with your planet's sun traveling northward (as viewed from the planet). We use this as the reference point for right ascension, including the right ascension of the ascending node. We also reference the sidereal time at the reference meridian to the vernal equinox. I'll assume you've already figured out the details of your planet's equator and ecliptic. If not, you'll need to decide on some things about your planet and its orbit around its host star before continuing.

2 Astronomy buffs will notice that this is overconstrained, we really only need six orbital elements to fully specify an orbit. I believe, though I'm not sure, that this is done to make the math easier to work through.


For fiction history, you don't need the exact orbit of the first moon or or the second one. For your purposes, you need only circle flat ecliptic orbit for both, for to know when this or that moon is rising, falling, below the horizon - in other words the approximate position on the sky sphere. Only one number for the position along the orbit, for every moon

 M1(t), M2(t)

So, you can simply put that second Moon at the distance, where the period is 2x longer than that of the first moon. Or shorter. Or you can choose another coefficient. Notice, that you don't need the distance itself.
Choose the start moment, when the both moons are at the same position on their orbits. Let's name it T0


After that, if you can count the position of the second moon for the moment t1, you should simply use your application to count the position of the first moon for the time:

T1' = (T1-T0)/2 + T0

It will be equal to the position of the second moon for time T1

M2(T1) = M1(T1') - this one you get from the app

That's enough.

You can use that acquired position to obtain the phase of the second moon, too. Take the sun position for T1


, and compare them. If the difference is 180 deg, the moon is full, if 0 deg, the moon is new, and so on.

That picture can serve for moon and sun eclipses. Only don't forget, that the moon eclipse happens only at the full moon, and the sun eclipses only at the new moon. :-) Simply add some statistics, and if the second moon is closer, its eclipses will happen more often. For our Moon, we have about two moon eclipses for a year, seen from everywhere, and about 1 sun eclipse for one place on the Earth for 20 years.

If you need such complex things as mutual eclipses, that approximate picture is not enough, but they are so very, very rare (moons are small!), that you can simply set them at will. Only both moons should be on the same side of the planet. Both growing or both declining. BTW, their mutual eclipse could be a fine picture: both moons are seen as halves, lenses, or crescents, but the shadow is round.

If you do need exact numbers for all eclipses, then you need not only all orbit numbers, but also the diameters of the moons, the planet and the Sun, and the orbit of the planet, too, and move the planet and both moons around the sun and count their mutual angles of visibility for all cases, when there are three bodies approximately on one straight line.

There is an even more simple way. Use https://www.solarsystemscope.com/ or another solar system simulator, and choose two satellites of Mars and look at them. Or any 2 satellites of another planet. But then you should shorten the time so many times, how large the year of the chosen planet is, given in the earth years.


You must log in to answer this question.

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