I included a greater range of values for the Sun and Moon radii because they might be used to represent eclipses of other objects; moons around other planets, or exosolar planets passing in front of their parent stars.

The obscuration calculation uses simple area formulae for circular sectors and triangles. More details of how the magnitude and obscuration are calculated are shown below.

*OAB*of radius $r$ shown here which makes an angle $\theta$ at its centre.

\begin{eqnarray}

\textrm{Segment Area} &=&\textrm{Sector Area} - \textrm{Triangle Area} \\

&=&\tfrac{1}{2}r^2 \theta - \tfrac{1}{2}r^2 \sin \theta \\

&=&\tfrac{1}{2}r^2 (\theta - \sin \theta)

\end{eqnarray}

\]

Let's take a look at the geometry of the eclipse, which is just two overlapping circles of radii $r$ and $R$.

\begin{eqnarray}

\textrm{Magnitude} &=& \frac{BC}{OC}\\

\textrm{Obscuration} &=& \frac{\textrm{Segment } DCE + \textrm{Segment } DBE}{\textrm{Sun area}}\\

&=& \frac{\textrm{Segment } DCE + \textrm{Segment } DBE}{\pi R^2}

\end{eqnarray}

\]

We want to express the magnitude and obscuration in terms of $R$, $r$ and the lunar centre distance $OA$.

DX^2 = R^2 - a^2

\]

DX^2 = r^2 - (OA - a)^2

\]

R^2 -a^2 =r^2 -(OA-a)^2

\]

\begin{eqnarray}

\cos(\tfrac{1}{2}\alpha) &=& \frac{a}{R}\\

\cos(\tfrac{1}{2}\beta) &=& \frac{OA-a}{r}

\end{eqnarray}

\]