When I was looking into a few things like angles of the sun and the moon (and uranus) from the earth, I really got annoyed going to suncalc tools to get a particular angle on this and that date and place. So I thought: Why not build my own sunapp?

And so I started..

And here it is: Solar System Animation App

First of all, it is actually not very complicated. The basic rules for the path of the planets around the sun are based on six parameters for each body:

The primary orbital elements are:

N (Ω)= longitude of the ascending node

i = inclination to the ecliptic (plane of the Earth's orbit)

w (ω) = argument of perihelion or argument of periapsis (which is the same for the sun),

a = semi-major axis, or mean distance from Sun (the sum of the distance at periapsis and apoapsis divided by 2.

e = eccentricity (0=circle, 0-1=ellipse, 1=parabola)

M = mean anomaly (0 at perihelion; increases uniformly with time)

Related orbital elements are:

w1 = N + w = longitude of perihelion

L = M + w1 = mean longitude

q = a*(1-e) = perihelion distance

Q = a*(1+e) = aphelion distance

P = a ^ 1.5 = orbital period (years if a is in AU, astronomical units)

T = Epoch_of_M - (M(deg)/360_deg) / P = time of perihelion

v = true anomaly (angle between position and perihelion)

E = eccentric anomaly

That is a lot of difficult terminology, which are explained on https://en.wikipedia.org/wiki/Orbital_elements and I will try to explain them in laymen terms:

The reference plane is the ecliptic, this is the plane of earth's orbit around the sun. In the picture this is the dark grey plane.

The inclination is the angle to this reference plane, and thus the angle the orbit has to the ecliptic.

The sun is off course in the ecliptic, so the inclination is 0. The moon is slightly (5.14^{o}) tilted in the ecliptic, so the inclination (i) is 5.14^{o}.

The orbital elements are specified for a specific date and time, i.e. January 1^{st} 2000 at midnight and then calculated for a specific date.

i = 0.0

N = 0.0

a = 1.00000011 (AU)

e = 0.016709

w = 282.9404

M = 356.0470

**i** is zero, as the sun and the earth are (per definition) in the same reference plane:The ecliptic.

**N**: The longitude of the ascending node (the angle of the direction of the sun and the intersection of the plane of reference and the orbit of the earth is undefined, as the intersection is on the whole plane. We therefore can assign the value of 0 to N.

**a** is 1,00000011 (and thus nearly 1 Astronomical Unit

**e** is an indication of the shape of the orbit. for e=0 it is a perfect circle, between 0 and 1 the shape is an ellipse, and for e>1 the orbit becomes a parabola. At 1-1-2000 the shape of the orbit gets a 0.016709, so

it is close to a circle. This shape changes over (a very long) time.

So we are left with only 2 interesting values w, and M.

**w** is the argument of perihelion. The perihelion is the position of the earth in it's orbit when it is closest to the sun. In 2019 this happened on January 3 at 05:20 UTC, when the sun was at 147.099.761 km distance). The argument of the perihelion is the angle between the sun, at 1-1-2000, to the perihelion.

**M** is the mean anomaly. This is the projection of the angles on a true circle from the ellipsis. This is necessary, because the speed of the earth around the sun changes during the year., It is fastest when the sun is furthest away, and slowest at perihelion. Projected on a circle, the speed never changes, and therefore it is easier to calculate with. The mean anomaly is 356.0470^{o}.

So these are the orbital elements explained, for 1-1-2000. Now we have to calculate them for a specific date.

For that we are going to use these formulas, where d is the number of days since/before 1-1-2000.Now d is something special. We cannot just take the days since 1-1-2000, because a solar year is longer than our year of 365 days, hence we have leap years, etc. That is why we use Julian Day Numbers.

The formula I used to convert to Julian days =

$$d = 367*Y - \frac{7*(Y + ((M+9)/12))}{4} + \frac{275*M}{9} + D - 730530$$

i = 0.0

N = 0.0

w = 282.9404 + 4.70935E-5 * d

a = 1.000000 (AU)

e = 0.016709 - 1.151E-9 * d

M = 356.0470 + 0.9856002585 * d.

There are 3 parameters that are depended on d. The argument of the perihelion, the shape of the orbit, and the mean anomaly. The factors are all describing the shape of the orbit, and the speed of the earth along this orbit.

M is easy, as this show a single degree per Julian Day.

The eccentricity changes over time, this is a very small number, so the changes are small, but they are there. They are caused by the gravitational influence of Jupiter and Saturn.

The argument of the perihelion is changing too over time, at a factor of 0,00005^{o} per day. (-0.1668523^{o} in 10 years). This is called the Apsidal Precession. The orbit of the earth itself tilts

## Calculating the path of the sun, the final calculations.

So now we can calculate the true distance and angle on a specific day:

We can calculate the eccentric anomaly (or true anomaly) from Kepler's equation

E = eccentric anomaly = M + e sin(E) = M + (180/pi) * e * sin(M) * (1 + e * cos(M))

x = cos(E) - e

y = sin(E) * sqrt(1 - e*e)

r = sqrt(x^{2} + y^{2})

v = arctan2( y, x )

The moon is influenced by a lot of things: The graviational forces of the sun, the planets and of course the earth itself. But even by the tides on earth, or the shape of the earth and the position of the moon at a particular moment.

Add these terms to the Moon's longitude (degrees):

-1.274 * sin(Mm - 2*D)(the Evection)+0.658 * sin(2*D)(the Variation)-0.186 * sin(Ms)(the Yearly Equation)-0.059 * sin(2*Mm - 2*D) -0.057 * sin(Mm - 2*D + Ms) +0.053 * sin(Mm + 2*D) +0.046 * sin(2*D - Ms) +0.041 * sin(Mm - Ms) -0.035 * sin(D)(the Parallactic Equation)-0.031 * sin(Mm + Ms) -0.015 * sin(2*F - 2*D) +0.011 * sin(Mm - 4*D)

Add these terms to the Moon's latitude (degrees):

-0.173 * sin(F - 2*D) -0.055 * sin(Mm - F - 2*D) -0.046 * sin(Mm + F - 2*D) +0.033 * sin(F + 2*D) +0.017 * sin(2*Mm + F)

Add these terms to the Moon's distance (Earth radii):

-0.58 * cos(Mm - 2*D) -0.46 * cos(2*D)

All perturbation terms that are smaller than 0.01 degrees in longitude or latitude and smaller than 0.1 Earth radii in distance have been omitted here. A few of the largest perturbation terms even have their own names! The Evection (the largest perturbation) was discovered already by Ptolemy a few thousand years ago (the Evection was one of Ptolemy's epicycles). The Variation and the Yearly Equation were both discovered by Tycho Brahe in the 16'th century.

The computations can be simplified by omitting the smaller perturbation terms. The error introduced by this seldom exceeds the sum of the amplitudes of the 4-5 largest omitted terms. If one only computes the three largest perturbation terms in longitude and the largest term in latitude, the error in longitude will rarley exceed 0.25 degrees, and in latitude 0.15 degrees.

What we just did was calculating the expected position of the earth in the orbit around the sun. When we want to calculate the angle we see the sun at, from the surface of the earth, we have to deal with one extra item: The tilt of the earth itself. Moving through the ecliptic plane we are tilted at a 23.4^{o} angle: The obliquity, and the main reason we have seasons. With the formula oblecl = 23.4393 - 3.563E-7 * d we can calculate this for a specific day.

This is pretty cool, is it not? And doing some more test the data is very exact. So we show here that with some relative simple formulae we get an accurate calculation of what we see when we look outside.

# Explaining the angles when calculation the position of the sun

Have you ever tried to understand all the terminology used when looking up things like Sidereal Time, and Right Ascension.

The webapplication I created, shows you exactly what is what. On this page a more verbal explanation is given, right along some things you can do in the app to make it more clear.

The webapplication can be found on https://solarsystem.bartje.org/solarsystem.php?apptype=gmst_explain

Wiki information can be found here : https://en.wikipedia.org/wiki/Equatorial_coordinate_system

## Ecliptic

## Equatorial Plane

## Meridian/Equator

## Sun Pointer

## Longitude Pointer

## Sun Trail

## Sun Distance Indicator

## Angle Calculations

The application shows how you can envision the different angles that are used to calculate the position of the sun, earth, planets, and all other celestial objects.

The explanation here uses the sun as it's primary example. This is done intentionally as I found it hard to get used to the terminology when going through all the explanations on the internet. However where I use the sun in these descriptions, the method is valid for most other objects in the sky.

## Animate Calculation

## Greenwich Mean Sidereal Time

The Greenwich Mean Sidereal Time is the angle between the Vernal Equinox and the Prime Meridian, on the celestial plane.

The word **mean** describes that

https://en.wikipedia.org/wiki/Sidereal_time

## LM Sidereal Time

The local mean sidereal time is the angle(or time) between the vernal equinox and the meridian of the observer, on the celestial plane.

## Right Ascension

The right ascension measures the angle along the **celestial** equator from the vernal equinox to where the sun is at that moment.

To show how it works, pick on of the prime times: Vernal Equinox (0^{o}), Summer Solstice(90^{o}), Autumnal Equinox(180^{o}) or Winter Solstice (270^{o}).

When you move the date the angle will decrease when going back and increase when going forward in time. Note how the earth rotates almost precisely with the Right Ascension angle when going up (or down) 1 day.

When inceasing the time, the angle will change too, of course, but it is smaller: The earth does not move that much around the sun in 1 hour.

However it will not change when moving you location from east to west (or north to south): The value is fixed on the position of the earth around the sun.

Set the sequence function 1 to day, and see how it changes during the year, make sure to set the display option for Right Ascension (white) on, and leave the others off to not get confused.

You could leave the Sun Pointer and the Point of Aries (red) on too, it will make even more sense.

https://en.wikipedia.org/wiki/Right_ascension

## Hour Angle

The Hour angle measures the angle along the **celestial** equator from the observer's meridian to the hour circle passing through the sun. In layman language: It is the angle (or time) since noon on the observers place.

In the application there are two options, one from P.o.A. (Point of Aries). This is not the real situation, but lets you see how the angle changes over time. One noticeable thing is, to view

https://en.wikipedia.org/wiki/Hour_angle

## Universal Time

The Universal Time is the hour angle between the suns position and the Prime Meridian, only the not at 0^{o}, but at the other side of the earth at a 180^{o}.

So essentially it is the time since midnight in Greenwich.

In the app this is visible by always showing the angle from from the Prime Meridian.

To show same examples:

Set lat/lon to Greenwich (use Earth Icon and select Greenwich) and click on the Sun Icon . Set display option to show Universal Time: The result is a semi circle. Now move the time to 0hrs. The earth will spin 180^{o} and the purple arc is gone.

## Longitude

The longitude option shows the longitude from Greenwich, on the **celestial** equator.

## Point Of Aries

The point of Aries is the place where the Equatorial Plane and the Celestial Plane intersect. Those are fancy words for the point where the sun is when spring begins (around march 22nd).