# Math Geeks Wanted - help with oribtal mechanics formulas

I’m currently rebuilding my D&D fantasy setting and one of my favorite parts of setting building is cosmology and mythology construction. I find that science can often be as inspiring as fantasy and sometimes even more interesting, so I’ve been doing some studies into orbital mechanics - in particular in a binary star system. My starting model is Alpha Centauri, but at its heart this is a two sun system.

I’ll share what I’ve learned here and what I plan but what I can use some help with is writing software that can reasonably model stellar movements in a binary system. It doesn’t have to be exacta - heavens know the ancients didn’t have any way to make and such calculations and few if any players will care.

What I want the system for is the simple reason that with two suns there will be times when whole weeks can go by without a true nighttime. After establishing this as a thought exercise I’ve been playing with how this might affect the societies therein.

Sound interesting? Great. Let’s get started.

The first assumption is the world is the same size as our own - has a moon like our own and orbits a sun like our own. The twist is the second sun, slightly smaller than our sun (about 90% its size, still well large enough to be a functioning star). This second sun I’ll call the “cold sun” because it is so far away that it provides only light to the world - no appreciable heat.

The distance is modeled after Alpha Centauri - the two suns are about 24 AU apart - roughly the distance from the sun to Uranus. The cold sun complete an apparent orbit of the sun once approximately every 80 years. This seems reasonable - 24 AU is the mean distance of Alpha Centauri’s stars although they vary in distance a lot more. I don’t want to deal with those variances at first go.

(Note I say apparent orbit here. I’m fully aware binary stars orbit a common center of gravity some 10 AU away from each star, but we’re talking about what is apparent to a culture that probably thinks it’s planet is flat and the center of the universe - if fixing the position of one of the suns makes writing the software easier I’m all for it)

The inclination of the orbital plane of the cold sun is 23 degrees. This is the same inclination as the planet which means that it should be possible for the poles of the planet to occassionally line up with the cold sun, meaning that one hemisphere will not see it’s light.

Now this will be the sort of changes that humans will only rarely see one cycle of and elves may see only a few.

Ignoring inclination for a moment, the cold sun would be visible half a day. For one day of the year it’s rising and setting would coincide with the main sun. The orbit of the cold sun would be cosmologically counted from when it rose with the main sun in the sky and set with it on the winter solstice. From that point it takes 80 years for it to do that again.

The consequence of this is half the year there is no night - at least until inclination comes into play.

As I mentioned before I want the orbital plane to be highly tilted. One reason for this is that this is what we observe in nature - the tilt of orbit of the Centauri suns is in the same neighborhood. The second reason is that eclipses of the cold sun by the main sun can only occur when the cold sun is on the ecliptic - something that will only occur once every 40 years - even then it would need to be in this position just as the planet is on the far side.

Now the final punchline - I mentioned a moon. Now, what are the odds of the moon eclipsing both suns simultaneously. I want it to work out to happen once every few thousand years, but the event is what I intend to mark the ages of the world - such grand conjunctions mark shifts in the nature of magic.

So, there’s my premise. A little bit more about the program. I love little details in settings but find they can overwhelm me and my players without management. Rather than abandon them as Wizards of the Coast chose to do with D&D 4th edition, I want to place them in a program and let a computer manage them.

So all the foregoing is linked to a calendar program. Rather than use a true to the second timestamp I intend to use a day stamp. If time of day of the event is important I’ll put it in the comments.

Day 1 is the last time the moon and suns conjoined as descripted above. Campaign start day is 1400 years later. Leap years are still in effect. So Day 1 of most campaigns has date stamp 476,000. I’ll need a function that can return to me month, day and week name for any datestamp.

Sidenote - the calendar itself is markedly different from ours. There are only 8 months, 45 days each. There are 5 holidays at the start of the year and winter, start of spring, summer, and fall, then the end of year day. Yes, this does mean the last day of the year is followed by the first day of the year and technically neither day belongs to either month. If there’s a leap year it is stuck between the two leading to 3 consecutive monthless days.

There are 9 days in a week and 5 weeks in a month. No numbers are used for dates - each day in the month has a first and last name - the first name being the day and the last being the week.

If it sounds odd - well that’s sort of the point. I don’t think it’s any worse than some historically used systems.

Anyway, the function needs to calculate out the month, day and week of a date stamp or, if necessary, that the date was a holiday (and if so which one).

Eventually I want an interface where I can look up a day and see what the phase of the moon was (or will be) and the like. I like to link up astrological predictions in my stories.

Oh, and yes there are two other planets in this mess - but I’ll worry about that much later.

Any ideas on finding some guides to compose such formulas? They don’t have to be accurately predictive of anything, but they need to feel reasonable, at least to a layman (so rounding values like the year to 365.25 is just fine)

Wow, you’re pretty hardcore in your world modelling, especially for something that may never actually occur in the timelines of your campaigns (unless you’re planning on running a campaign that occurs over thousands of years).

Good luck with the above.

Well I played with it some in javascript - specifically the daystamp conversion. I realized after making the post above that I can everything lined up on day 1 by simply putting them there Through trial and error though I discovered a couple things about year calculations.

If you have a raw count of days you can find the year accurately by dividing by 365.25. This is intuitive enough. I found that you can find the day within the year by using a modulus with a fraction – day % 365.25. This will be accurate, but if the day is leap day it returns 0 exactly - which can be detected. On the year following a leap year you need to add one to the day count to keep it in sync, then it evens back out. Weird.

If anyone is interested I can post the code snippet involved tonight.

The calendar itself is eccentric but fairly easy to calculate dates for from a given datestamp. One reason for this is our calendar actually needs 14 iterations depending on the day of the week you started with and whether its a leap year.

The setting calendar divides the year down into 8 months of 45 days each – this leaves 5 days left over. Those days are holidays that don’t belong to any particular month. One is at the start of the year, the next between the 2nd & 3rd months, the third 4th & 5th months, the fourth between 6th & 7th months and the last one at the end of the year (making it back to back with the start of year on the calendar). The leap day is inserted between years and belongs to the year that preceded it for historical accounting.

The months themselves have 9 days per week and 5 weeks. One fun wrinkle for the setting is the weeks have names just as the days do. In setting people don’t refer to days by numbers, rather they refer to them by first and last name.

Tonight I’ll look into some of the celestial timings, starting with the moon. By having all celestial bodies at conjuction at the start of the calendar the dates become rather easy to deal with. For example, if I want to know where the moon is I should be able to find it by daystamp % 28 - the moon is at position 28 if that returns 0.

Precession of the incline of the moon’s orbit (the reason there are not eclipses every time the moon is behind the earth) may be tracked by another modulus call. When both return a 0 at the same time a lunar eclipse occurs. Need to do some studying to see what this period should be.

The cold sun will be trickier though. I can get it’s position easily enough with this call, but the rise and set times can’t be so easily calculated.

Footnote: The major events won’t occur during a setting, but subtle interactions certainly will. Lunar eclipses occur on the order of 1 every 3 years, and it’s not unknown for 2 eclipses to occur in the same year one every couple decades. When the moon eclipses the cold sun it will be worldwide since it’s disk will be about 5x as big in the sky. It will be weird to see a sun eclipsed by a full (or nearly full) moon though.

And frequency can be toyed with by the numbers I choose. Some intervals will be more harmonic than others.