# Orbital Mechanics, Part 1

Quick note: I wrote this on April 1, posted it two weeks later, but it’s not quite finished. I hope to finish it later, but I didn’t want to leave it sitting too long.

## Julian Date

Astronomers are a special bunch. They decided they needed their own calendar, and that the appropriate way to count time was the number of days since 1 January 4713 BCE, or 24 November 4714 BCE depending on which calendar you were counting from. It does solve that issue, which is why some historians have adopted it since.

Oh, and these days are counted starting at noon at the Greenwich meridian: fractional values are the amount of time since the previous date began divided by 24. In other words, midnight of 1 January 2000 CE was 2451544.5. In England. This made a lot of sense in 1583, since astronomers did their work at night, and it would be annoying if your Julian day number rolled over at midnight. That way they could just keep track of the time and have some underling write the same number in front of all their notations the following day.

Now since astronomy happens at all times of the day in all parts of the world at all parts of the electromagnetic spectrum, with still other astronomy happening with gravitational wave detectors and neutrino detectors, it’s fortunate that we have computers to keep track of time. But the Julian day number is still useful!

One simple way is that, by subtracting one day from another, regardless of the cultural calendar in use, you will get an accurate count of the number of days between dates. Another is the aforementioned difference of cultural calendars: proleptic Gregorian, proleptic Julian, Islamic, Jewish, etc.

But how do you get from here to there? I know that today, as I’m writing this, it’s the afternoon of April Fool’s Day of 2019, and that I’m 5 hours behind UTC. But how can I figure out That the Julian date is 2458575 point something?

Let’s start with what we know: Year=2019, Month=4, Day=1. That’s close enough for now, we’ll get in the day fraction later.

Wikipedia gives the following for calculating the day number:

(1461 × (Y + 4800 + (M − 14)/12))/4 + (367 × (M − 2 − 12 × ((M − 14)/12)))/12 − (3 × ((Y + 4900 + (M – 14)/12)/100))/4 + D − 32075

where all division is integer division (not floor divisionvery important distinction that I missed the first…dozen or so times I tried this). Throw away the remainders.

(M-14)/12 shows up a lot. Basically, if it’s a January or February, it’s -1, otherwise it’s 0. Since it’s April, let’s do the appropriate thing with those terms:

(1461 × (Y + 4800))/4 + (367 × (M − 2))/12 − (3 × ((Y + 4900)/100))/4 + D − 32075

Much cleaner! I’ll throw in 4 for the remaining M and 2019 for the Ys, and of course 1 for the D, then it’s just the maths!:

(1461 × (2019 + 4800))/4 + (367 × (4 − 2))/12 − (3 × ((2019 + 4900)/100))/4 + 1 − 32075
= (1461 × 6819)/4 + (367 × 2)/12 − (3 × (6919/100))/4 + 1 − 32075
= (1461 × 6819)/4 + 734/12 − (3 × 69)/4 − 32074
= 9962559/4 + 734/12 − 207/4 − 32074
= 2490639 + 61 − 51 − 32074
= 2458575

And we’re there!

It’s a few minutes after 3, so let’s call it 15:10:05.0025 just because. So the fractional day is

(H + 5 − 12)/24 + m/1440 + S/86400
= 8/24 + 10/1440 + 5.0025/86400
= 0.34033567708333333

So the Julian date for “right now” is

2458575 + 0.34033567708333333
= 2458575.34033567708333333.

I’m not nearly ambitious enough to try to turn a WordPress post into one that dynamically changes all the math depending on what day it is (though it can be done, I’ll leave that as an exercise for the reader).

## Sidereal Time

Another thing those crazy astronomers decided to do was make up their own clock. 24 hours works great for day-to-day life, but they noticed that the Earth turns once every 23 hours, 56 minutes, and about 4.1 seconds. So why not make a new system of time to pretend 23 hours, 56 minutes, 4.0905 seconds was actually 24 hours?

Why in the world would this be useful?

Well, let’s say you pointed your telescope at a particularly interesting star, and you knew the sidereal time, along with which direction you were pointing your telescope and how high above the horizon it was. If you give your buddy the sidereal time, if he can match your latitude, he can point his telescope the exact same direction at the exact same sidereal time and see the exact same star.

Of course, why would you bother using 1 January as your baseline for this new clock? Of course you’re going to set 0 hours to be equivalent to the moment of the Spring Equinox.

But hey, it’s still a useful tool, so let’s see how you calculate it.

First, we need the Earth Rotation Angle.

2π(0.7790572732640 + 1.00273781191135448(tU − 2451545)) where tU is our old friend the Julian date. This is in radians, so can be converted to degrees, minutes, seconds in the usual way. For our example time from earlier, this works out to 7050.367142462069. Normalizing to 2π radians per circle this is 0.633227806573089, which works out to 36°16’52.61″, or 2:25:07.51.

This has to be tweaked based on one’s longitude (positive to the east), precession, and nutation, with longitude making by far the largest contribution.

# Square Roots

Don’t ask—these posts don’t (yet) have any thread connecting them. Maybe one day I’ll get there.

So I was trying to figure out the square root of 10005, and trying to be a bit more accurate than “slightly over 100”. Problem is, the algorithm I learned seems to be, let’s say, unwieldy, or not quite how I remembered it, when the initial number has lots of zeroes in it. Turns out there’s a slightly easier solution, at least in terms of how many steps you have to remember, and how complicated the math can begin.

Step 1, guess. Your guess doesn’t matter a whole lot, but your guess can’t be zero. 100 is a great guess for 10005.

Step 2, divide the initial number by your guess. 100.05 in this case

Step 3, take the average of your guess and the result of step 2. This is your new guess. 100.025 in this case. Repeat steps 2 and 3 until you’re satisfied with the accuracy of your result.

How accurate does the next iteration get in this particular case, though?

10005/100.025=400200/4001=100+100/4001=100.02499375156210947263184203949… (the first 500 decimal places repeat themselves). Then, average this number with 100.025 for our next approximation: 32016001/320080=100.02499687578105473631592101974…

Considering our initial guess of 100 is 0.02% off of reality, differing by less than 0.025, it doesn’t take much to get even more accurate.

Here’s a table, adding a different guess of 1, rather than 100, to show how this method converges:

 Iteration Guess Accuracy Guess Accuracy 0 100 3-nines 1 not good 1 100.025 7-nines 5003 actually worse 2 100.02499… 15-nines 2502.49990… slightly better, but still very bad 3 100.02499… 30-nines 1253.24895… moving in the right direction 4 100.02499… 62-nines 630.61610… closer 5 100.02499… 124-nines 323.24077… and closer 6 177.09646… almost there… 7 116.79555… almost there… 8 101.22903… huzzah! 98% accurate! 9 100.03216… 4-nines 10 100.02499… 8-nines

You roughly double the accuracy, percentage-wise, for each iteration, so the better the initial guess, the more quickly you get to a reasonable answer. Though no matter where you start, you’ll eventually get there.