Calculate Astronomical Things

You can calculate various astronomical things yourself:

- mathematical notation
- coordinate transformations
- Julian Day number
- sidereal time
- positions in the sky
- horizontal phenomena
- seasons
- transits of planets across the Sun
- the position of the Sun
- great circles
- the Extended Euclidean Algorithm
- the ratios of periods
- the saros
- synodical periods
- the period of all planets together
- relativistic space travel
- Kepler's equation
- gravity
- Lagrange points
- frequency determination
- distances in the sky
- evolution of the lunar orbit
- ephemeris comparison

The formulas that I give on the mentioned pages are mathematical
formulas. To be able to use them in computer programs you need to
take into account how those computer languages and compilers work.
For example, if you copy the formula `4000*`

(with *s*/1461001

a whole number) without changes into a program
that can handle whole numbers only, then the result can depend on the
order in which the calculations are done, because in such a program
the intermediate results can only be whole numbers, too, and any
fractional parts are discarded. If intermediate results are too
large, then parts of them can be discarded as well, and then the
results won't fit the mathematical results, either.
*s*

Suppose that

. Then the mathematical result is
*s* = 400```
4000*400⁄1461001 = 1600000⁄1461001 = 1 +
138999⁄1461001
```

. If this is calculated in a program that can
handle whole numbers only, and if the multiplication is performed
first, then the intermediate result is `4000*`

and the second calculation *s* = 1600000`1600000⁄1461001`

then yields
the end result 1, because the fractional part of the result is
discarded. If the division is done first, then the first calculation
is

which yields 0, because the
remainder of the division is discarded. The second calculation is then
*s*/1461001 = 400⁄1461001`0*4000 = 0`

so the end result is 0. The end result
depends on the order in which the calculations are done.

Many astronomical formulas involve **angles**. If you turn around
once and end up facing in the same direction, then you've swung
through an angle of 360 degrees. So, two directions that differ by a
multiple of 360 degrees are equivalent, and you can always reduce any
angle to an equivalent angle that is between 0 and 360 degrees, by
subtracting a suitable multiple of 360 degrees. For example, an angle
of 19462.44 degrees can be reduced to the equivalent angle of 22.44
degrees. The difference between the two is 19440 degrees, which is
exactly 54 times 360 degrees.

One way to do that is as follows:

- Divide by 360: 19462.44/360 = 54.062333...
- Subtract the integer part, i.e. 54: 54.062333... - 54 = 0.062333...
- Multiply by 360: 0.062333... * 360 = 22.44

In a computer program, you'd use the "modulus" function or operator,
something like `19462.44 % 360`

or ```
19462.44 mod
360
```

, or `mod(19462.44, 360)`

.

*//aa.quae.nl/en/reken.html;
Last updated: 2016-02-07*