# Implementation of formulae for Meeus for the Moon

With Astronomical Algorithms by J. Meeus (1998) I have obtained the relevant illuminated fraction of the disk and position angle.

But they're numbers (all Greek to me!) I know, Meeus explains that they're ratios of the lengths of the illuminated limb and areas.

Okay, so I have a ratio. How do I implement that together with the position angle to work out the direction of the illuminated limb and the amount illuminated?

I'm assuming that the ratio 1.0 is totally illuminated (i.e. Full Moon) and 0.0 is nothing (i.e. New Moon).

and then there is the position angle, I'm assuming that the direction in degrees is starting at 0 pointing upwards. Is that the crescent shape direction i.e. the horns are pointing away from the directional angle?

I would like to be able plot this so that I can show visually the moon's illuminated fraction and direction for any day in any given year.

As I said, I have the numbers, I'm trying to translate that into a more visually appealling and meaningful result.

Meeus says this is the selenocentric elongation of the Earth from the Sun (Phase Angle) - i.

the formula for illuminated fraction k is:

k = ( 1 + cos i ) / 2

tan i = (R sin l) / (D - (R cos l))

R = distance Earth-Sun D = distance Earth-Moon l = geocentric elongation

Meeus calls k the ratio of the lengths BC:AC the same as the ratio of the areas: NBSC:NASC

Where • If celestial north is up, this diagram shows an illuminated fraction of 0.35 and a position angle of 290$^\circ$. May 8, 2018 at 13:58
• @MikeG Thanks, but how do you know that? and which angle is the position angle in the diagram? Aug 25, 2021 at 15:00
• I measured the image: C is 290° counterclockwise from the top, and CB = 0.35 CA. Aug 25, 2021 at 19:02
• What makes you think this is to scale or represents the actual measurement? Please note that Meeus in fact doesn't use any values in his descriptions and algorithms, he only uses them in his working examples. In any event, what use is a diagram without a reference point, date, location, time etc.? I think you're missing the point of the question. Aug 28, 2021 at 22:57
• Obviously the diagram above is only an example. If you need clarification beyond the accepted answer, I suggest posting a new question focusing on that issue so we're less likely to latch onto the wrong thing. Aug 29, 2021 at 21:25

Your understanding of the illumination is correct. k is the ratio of the illuminated length BC to the diameter AC. New Moon has an illumination of 0, Full Moon an illumination of 1, and the quarter phase an illumination of 0.5.

The position angle is measured counterclockwise from north (celestial north, along a line of right ascension) to the bright limb C. You need to calculate the parallactic angle, q, which is the angle from "up" to celestial north. From chapter 14 (in the 2009 version) $$\tan q = \frac{\sin H}{\tan \phi \; \cos \delta - \sin \delta \; \cos H}$$ where $\phi$ is the geographical latitude, $\delta$ is the declination of the Moon, and H is the hour angle. The diagram below shows a positive value for both q and PA. • You answered a question factually correctly. Thank you. However, I still want to implement this programmatically. I'm going to have to ask in Stackoverflow to figure out how to do this. May 10, 2018 at 9:00
• BTW, what's the proper name for the angle PA-q, i.e. mathematical difference between the position angle and parallactic angle, which describes the tilt of the bright limb of the Moon "as seen"? Jul 14, 2021 at 16:05

Calculating H (local hour angle) requires knowing the local sidereal time θ and the RA of the moon. H = θ - RA. Calculating the LST is not too difficult, but getting the RA of the moon is more involved, described in Ch 47 of Meeus' Astronomical Algorithms. It could be obtained more quickly by just scraping the value from somewhere using cURL. Once you have these values, then calculating q is straightforward.

I just finish my blog detailing 3 ways to get Moon phase as seen from your location. The actual working codings are included. 3 ways to get Moon phase as seen at your location

• This answer can be expanded. If not it is considered to be a link-only answer. better to be in the comments section Feb 15, 2022 at 16:15
• While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review Feb 15, 2022 at 16:15
• While this is an interesting answer, my question was not about the moon phase, but rather the angle and position of the sun reflected on the moon. The calculation of the moon phase isn't difficult, and easily solvable in Meeus's Astronomical Algorithms. The answers given are just further links to other implementations. May 7, 2022 at 18:17