The Shadow Angle

Given the shadow plane and hour angle described in The Hour Angle, we can calculate a unit vector in the dial face parallel to the shadow, and track its progress across the dial face.
from analemma.algebra import frame, render, result
Intersecting the Shadow Plane and Dial Face
The shadow cast on the dial face by the gnomon is parallel to the intersection between the shadow bivector \(S\) (the plane containing the sun ray and the gnomon) and \(G\) (the dial face). We can construct this intersection in Geometric Algebra (GA) as
\[u = \langle I G S \rangle_1\]
where \(I = e_1 \wedge e_2 \wedge e_3\) is the pseudo-scalar (directed volume).
Sn = result.shadow_bivector_explicit()
Gn = frame.dialface()
u = result.dialface_shadowbivector_intersection(Gn, Sn)
render.align("u", u)
\[\displaystyle \begin{align} u & = \left(\sin{\left (\Xi \right )} \sin{\left (d \right )} \sin{\left (i \right )} \sin{\left (\iota \right )} \sin{\left (\mu \right )} + \sin{\left (\Xi \right )} \cos{\left (i \right )} \cos{\left (\mu \right )}\right) n_1 \nonumber \\ &\left(- \sin{\left (\Xi \right )} \sin{\left (i \right )} \sin{\left (\iota \right )} \sin{\left (\mu \right )} \cos{\left (d \right )} - \sin{\left (\Xi \right )} \sin{\left (\mu \right )} \cos{\left (i \right )} \cos{\left (\iota \right )}\right) n_2 \nonumber \\ &\left(- \sin{\left (\Xi \right )} \sin{\left (d \right )} \sin{\left (i \right )} \sin{\left (\mu \right )} \cos{\left (\iota \right )} + \sin{\left (\Xi \right )} \sin{\left (i \right )} \cos{\left (d \right )} \cos{\left (\mu \right )}\right) n_3& \nonumber \end{align}\]
Normalization
Want to normalize \(u\) to get \(\hat{u} \equiv \hat{w}\), a unit vector parallel to the shadow \(w\). We could square and add the above components and attempt to factorize, but there is a route to a simpler expression because GA allows us to project two- and higher-dimensional objects onto each other just like vectors.
The cosine of the angle between \(S\) and \(G\) is given by
\[\cos(\Psi) = \frac{S\cdot G}{\sqrt{-S^2}\sqrt{-G^2}}\]
Given that \(S^2 = -\sin^2(\Xi)\) and \(G^2 = -1\), we have
\[ \cos(\Psi) = \frac{S\cdot G}{\sin(\Xi)}\]
We can calculate a simple expression for \(\cos(\Psi)\):
cosPsi = result.dialface_shadowbivector_angle_cos(Gn, Sn)
render.expression(r"\cos(\Psi)", cosPsi)
\[\displaystyle
\begin{equation}
\cos(\Psi) = - \sin{\left (d \right )} \sin{\left (i \right )} \cos{\left (\mu \right )} - \sin{\left (i \right )} \sin{\left (\mu \right )} \cos{\left (d \right )} \cos{\left (\iota \right )} + \sin{\left (\iota \right )} \sin{\left (\mu \right )} \cos{\left (i \right )} \nonumber
\end{equation}
\]
Now, the length of \(u\) is related to \(\Psi\) as follows.
\[u^2 = (I\; G \times S)^2 = (\frac{I}{2}(GS-SG))^2 = -\frac{1}{4}(GSGS+SGSG-2S^2G^2)\]
But
\[(S\cdot G)^2 = \frac{1}{4}(SG+GS)^2 = \frac{1}{4}(SGSG+GSGS+2S^2G^2)\]
So,
\[u^2 = S^2G^2 - (S\cdot G)^2 = \sin^2(\Xi) - (S\cdot G)^2 = \sin^2(\Xi)\sin^2(\Psi)\]
(my Geometric Algebra cheat sheet can be useful at times like this)
The Unit Shadow
We can now form \(\hat{w}\) by dividing \(u\) by its length \(\sin(\Xi)\sin(\Psi)\). Note that this length is not the length of the shadow vector \(w\) which we will call \(L\) such that \(w = L \hat{w}\). It is related to \(L\) as we shall see in The Shadow Length.
w_hat = result.unit_shadow(Gn, Sn)
render.align(r"\hat{w} = \frac{w}{L} = \frac{u}{\sin(\Xi)\sin(\Psi)}", w_hat)
\[\displaystyle \begin{align} \hat{w} = \frac{w}{L} = \frac{u}{\sin(\Xi)\sin(\Psi)} & = \left(\frac{\sin{\left (d \right )} \sin{\left (i \right )} \sin{\left (\iota \right )} \sin{\left (\mu \right )}}{\sin{\left (\Psi \right )}} + \frac{\cos{\left (i \right )} \cos{\left (\mu \right )}}{\sin{\left (\Psi \right )}}\right) n_1 \nonumber \\ &\left(- \frac{\sin{\left (i \right )} \sin{\left (\iota \right )} \sin{\left (\mu \right )} \cos{\left (d \right )}}{\sin{\left (\Psi \right )}} - \frac{\sin{\left (\mu \right )} \cos{\left (i \right )} \cos{\left (\iota \right )}}{\sin{\left (\Psi \right )}}\right) n_2 \nonumber \\ &\left(- \frac{\sin{\left (d \right )} \sin{\left (i \right )} \sin{\left (\mu \right )} \cos{\left (\iota \right )}}{\sin{\left (\Psi \right )}} + \frac{\sin{\left (i \right )} \cos{\left (d \right )} \cos{\left (\mu \right )}}{\sin{\left (\Psi \right )}}\right) n_3& \nonumber \end{align}\]
The Shadow Angle Relative to Noon
Let's get the angular coordinate of the shadow relative to noon, call it \(\zeta\). At noon we have \(\mu = 0\):
render.expression(r"\hat{w}_{\mu=0}", result.unit_noon_shadow(Gn, Sn))
\[\displaystyle
\begin{equation}
\hat{w}_{\mu=0} = \frac{\cos{\left (i \right )}}{\sqrt{- {\sin{\left (d \right )}}^{2} {\sin{\left (i \right )}}^{2} + 1}} \boldsymbol{n}_{1} + \frac{\sin{\left (i \right )} \cos{\left (d \right )}}{\sqrt{- {\sin{\left (d \right )}}^{2} {\sin{\left (i \right )}}^{2} + 1}} \boldsymbol{n}_{3} \nonumber
\end{equation}
\]
So \(\cos(\zeta) = \hat{w}(\mu) \cdot \hat{w}(0)\) and the easiest route to \(\sin(\zeta)\) is to use the fact that the shadow lives in the plane of the dial face, so \(\hat{w}(\mu) \wedge \hat{w}(0) = \sin(\zeta) G\).
render.expressions(
(r"\sin(\zeta)", r"\cos(\zeta)", r"\tan(\zeta)"),
result.noon_angle_sincos(Gn, Sn) + (result.noon_angle_tan(Gn, Sn),)
)
\[\displaystyle
\begin{equation}
\sin(\zeta) = \frac{\left(\sin{\left (i \right )} \sin{\left (\iota \right )} \cos{\left (d \right )} + \cos{\left (i \right )} \cos{\left (\iota \right )}\right) \sin{\left (\mu \right )}}{\sqrt{- {\sin{\left (d \right )}}^{2} {\sin{\left (i \right )}}^{2} + 1} \sin{\left (\Psi \right )}} \nonumber
\end{equation}
\\
\begin{equation}
\cos(\zeta) = \frac{\left(- {\sin{\left (d \right )}}^{2} {\sin{\left (i \right )}}^{2} + 1\right) \cos{\left (\mu \right )} + \left(- \sin{\left (i \right )} \cos{\left (d \right )} \cos{\left (\iota \right )} + \sin{\left (\iota \right )} \cos{\left (i \right )}\right) \sin{\left (d \right )} \sin{\left (i \right )} \sin{\left (\mu \right )}}{\sqrt{- {\sin{\left (d \right )}}^{2} {\sin{\left (i \right )}}^{2} + 1} \sin{\left (\Psi \right )}} \nonumber
\end{equation}
\\
\begin{equation}
\tan(\zeta) = - \frac{\left(\sin{\left (i \right )} \sin{\left (\iota \right )} \cos{\left (d \right )} + \cos{\left (i \right )} \cos{\left (\iota \right )}\right) \tan{\left (\mu \right )}}{{\sin{\left (d \right )}}^{2} {\sin{\left (i \right )}}^{2} + \sin{\left (d \right )} {\sin{\left (i \right )}}^{2} \cos{\left (d \right )} \cos{\left (\iota \right )} \tan{\left (\mu \right )} - \sin{\left (d \right )} \sin{\left (i \right )} \sin{\left (\iota \right )} \cos{\left (i \right )} \tan{\left (\mu \right )} - 1} \nonumber
\end{equation}
\]
Next in The Shadow Length, we calculate the length of the shadow, whose tip traces the analemma.