A complex-pair representation of GA(2,0).

June 15, 2023 math and physics play , , , ,

[Click here for a PDF version of this post]

Motivation.

Suppose that we want to represent GA(2,0) (Euclidean) multivectors as a pair of complex numbers, with a structure like
\begin{equation}\label{eqn:bicomplexGA20:20}
M = (m_1, m_2),
\end{equation}
where
\begin{equation}\label{eqn:bicomplexGA20:40}
\begin{aligned}
\gpgrade{M}{0,2} &\sim m_1 \\
\gpgrade{M}{1} &\sim m_2.
\end{aligned}
\end{equation}
Specifically
\begin{equation}\label{eqn:bicomplexGA20:60}
\begin{aligned}
\gpgrade{M}{0} &= \textrm{Re}(m_1) \\
\gpgrade{M}{1} \cdot \Be_1 &= \textrm{Re}(m_2) \\
\gpgrade{M}{1} \cdot \Be_2 &= \textrm{Im}(m_2) \\
\gpgrade{M}{2} i^{-1} &= \textrm{Im}(m_1),
\end{aligned}
\end{equation}
where \( i \sim \Be_1 \Be_2 \).

Multivector product representation.

Let’s figure out how we can represent the various GA products, starting with the geometric product. Let
\begin{equation}\label{eqn:bicomplexGA20:80}
\begin{aligned}
M &= \gpgrade{M}{0,2} + \gpgrade{M}{1} = (m_1, m_2) = (m_{11} + m_{12} i, m_{21} + m_{22} i) \\
N &= \gpgrade{N}{0,2} + \gpgrade{N}{1} = (n_1, n_2) = (n_{11} + n_{12} i, n_{21} + n_{22} i),
\end{aligned}
\end{equation}
so
\begin{equation}\label{eqn:bicomplexGA20:200}
\begin{aligned}
M N
&= \gpgrade{M}{0,2} \gpgrade{N}{0,2} + \gpgrade{M}{1} \gpgrade{N}{1} \\
&\quad+ \gpgrade{M}{1} \gpgrade{N}{0,2} + \gpgrade{M}{0,2} \gpgrade{N}{1}
\end{aligned}
\end{equation}

The first two terms have only even grades, and the second two terms are vectors. The complete representation of the even grade components of this multivector product is
\begin{equation}\label{eqn:bicomplexGA20:240}
\gpgrade{M N}{0,2} \sim \lr{ m_1 n_1 + \textrm{Re}(m_2 n_2^\conj) – i \textrm{Im}(m_2 n_2^\conj), 0 },
\end{equation}
or
\begin{equation}\label{eqn:bicomplexGA20:260}
\begin{aligned}
\gpgrade{M N}{0} &= \textrm{Re}\lr{ m_1 n_1 + m_2 n_2^\conj } \\
\gpgrade{M N}{2} i^{-1} &= \textrm{Im}\lr{ m_1 n_1 – m_2 n_2^\conj }.
\end{aligned}
\end{equation}

For the vector components we have
\begin{equation}\label{eqn:bicomplexGA20:280}
\begin{aligned}
\gpgrade{M N}{1}
&=
\gpgrade{M}{1} \gpgrade{N}{0} + \gpgrade{M}{0} \gpgrade{N}{1}
+
\gpgrade{M}{1} \gpgrade{N}{2} + \gpgrade{M}{2} \gpgrade{N}{1} \\
&= \gpgrade{M}{1} n_{11} + m_{11} \gpgrade{N}{1} + \gpgrade{M}{1} i n_{12} + i m_{12} \gpgrade{N}{1}.
\end{aligned}
\end{equation}
For these,
\begin{equation}\label{eqn:bicomplexGA20:300}
\begin{aligned}
\gpgrade{M}{1} i
&= \lr{ m_{21} \Be_1 + m_{22} \Be_2 } \Be_{12}
&= – m_{22} \Be_1 + m_{21} \Be_2,
\end{aligned}
\end{equation}
and
\begin{equation}\label{eqn:bicomplexGA20:320}
\begin{aligned}
i \gpgrade{N}{1}
&= \Be_{12} \lr{ n_{21} \Be_1 + n_{22} \Be_2 }
&=
n_{22} \Be_1 – n_{21} \Be_2.
\end{aligned}
\end{equation}
Comparing to
\begin{equation}\label{eqn:bicomplexGA20:340}
i (a + i b)
= -b + i a,
\end{equation}
we see that
\begin{equation}\label{eqn:bicomplexGA20:360}
\gpgrade{M N}{1}
\sim
\lr{ 0, n_{11} m_2 + m_{11} n_2 + n_{12} i m_2 – m_{12} i n_2 }.
\end{equation}
If we want the vector coordinates, those are
\begin{equation}\label{eqn:bicomplexGA20:380}
\begin{aligned}
\gpgrade{M N}{1} \cdot \Be_1 &= \textrm{Re} \lr{ n_{11} m_2 + m_{11} n_2 + n_{12} i m_2 – m_{12} i n_2 } \\
\gpgrade{M N}{1} \cdot \Be_2 &= \textrm{Im} \lr{ n_{11} m_2 + m_{11} n_2 + n_{12} i m_2 – m_{12} i n_2 }.
\end{aligned}
\end{equation}

Summary.

\begin{equation}\label{eqn:bicomplexGA20:n}
M N \sim
\lr{ m_1 n_1 + \textrm{Re}(m_2 n_2^\conj) – i \textrm{Im}(m_2 n_2^\conj), n_{11} m_2 + m_{11} n_2 + n_{12} i m_2 – m_{12} i n_2 }.
\end{equation}

A sample Mathematica implementation is available, as well as an example notebook (that also doubles as a test case.)

Clarification.

I skipped a step above, showing the correspondances to the dot and wedge product.

Let \(z = a + bi\), and \(w = c + di\). Then:
\begin{equation}\label{eqn:bicomplexGA20:420}
\begin{aligned}
z w^\conj
&=
\lr{ a + b i } \lr{ c – d i } \\
&= a c + b d -i \lr{ a d – b c }.
\end{aligned}
\end{equation}
Compare that to the geometric product of two vectors \( \Bx = a \Be_1 + b \Be_2 \), and \( \By = c \Be_1 + d \Be_2 \), where we have
\begin{equation}\label{eqn:bicomplexGA20:440}
\begin{aligned}
\Bx \By &= \Bx \cdot \By + \Bx \wedge \By \\
&= \lr{ a \Be_1 + b \Be_2 } \lr{ c \Be_1 + d \Be_2 } \\
&= a c + b d + \Be_1 \Be_2 \lr{ a d – b c }.
\end{aligned}
\end{equation}
So we have
\begin{equation}\label{eqn:bicomplexGA20:460}
\begin{aligned}
a b + cd &= \Bx \cdot \By = \textrm{Re} \lr{ z w^\conj } \\
a d – b c &= \lr{ \Bx \wedge \By } \Be_{12}^{-1} = – \textrm{Im} \lr{ z w^\conj }.
\end{aligned}
\end{equation}
We see that \( \lr{z w^\conj}^\conj = z^\conj w \) can be used as a representation of the geometric product of two vectors (setting \( i = \Be_1 \Be_2 \) as usual.)

Another simplification.

We have sums of the form
\begin{equation}\label{eqn:bicomplexGA20:480}
\textrm{Re}(z) w \pm \textrm{Im}(z) i w
\end{equation}
above. Let’s see if those can be simplified. For the positive case we have
\begin{equation}\label{eqn:bicomplexGA20:500}
\begin{aligned}
\textrm{Re}(z) w + \textrm{Im}(z) i w
&=
\inv{2} \lr{ z + z^\conj } w + \inv{2} \lr{ z – z^\conj } w \\
&=
z w,
\end{aligned}
\end{equation}
and for the negative case, we have
\begin{equation}\label{eqn:bicomplexGA20:520}
\begin{aligned}
\textrm{Re}(z) w – \textrm{Im}(z) i w
&=
\inv{2} \lr{ z + z^\conj } w – \inv{2} \lr{ z – z^\conj } w \\
&=
z^\conj w.
\end{aligned}
\end{equation}
This, with the vector-vector product simplification above, means that we can represent the full multivector product in this representation as just
\begin{equation}\label{eqn:bicomplexGA20:540}
M N \sim
\lr{ m_1 n_1 + m_2^\conj n_2, m_2 n_1 + m_1^\conj n_2 }.
\end{equation}

Inscribed circle in a triangle

June 12, 2023 Uncategorized

[Click here for a PDF version of this post]

Motivation

In Jim Smith’s recent Handling Rejection! Using Geometric Algebra to Find the Incircle of a Triangle video, he uses an area argument to find the center point of a circle inscribed in a triangle, as illustrated in fig. 1.

fig. 1. Triangle with inscribed circle.

fig. 1. Triangle with inscribed circle.

In the video, Jim mentioned that he first tried calculating the intersection of the bivectors, but didn’t like the form of the solution. I’m curious what aspect of that solution wasn’t desirable, since it is a pretty compact way to solve the system.

Setup.

A very convenient way to describe a triangle is with a pair of vectors for two of the edges, say \( \Ba, \Bb \), where the third edge is \( \Bc = \Ba -\Bb \). In Jim’s problem, he started with the scalar lengths of all the edges \( a, b, c \). The two representations are interchangable. We can set
\begin{equation}\label{eqn:triangleInscribedCircle:n}\
\begin{aligned}
\Ba &= a\Be_1 \\
\Bb &= b \Be_1 e^{i\theta_c},
\end{aligned}
\end{equation}
where \( i = \Be_1 \Be_2 \), and \( \theta_c \) is the angle opposite edge \( \Bc \), which can be found from the cosine law
\begin{equation}\label{eqn:triangleInscribedCircle:20}
\Bc^2 = \lr{ \Ba – \Bb }^2 = \Ba^2 + \Bb^2 – 2 \Ba \cdot \Bb = a^2 + b^2 – 2 a b \cos\theta_c,
\end{equation}
or
\begin{equation}\label{eqn:triangleInscribedCircle:40}
\theta_c = \cos^{-1} \lr{ \frac{a^2 + b^2 – c^2}{2 a b} }.
\end{equation}

The center point.

The points on our bisectors are
\begin{equation}\label{eqn:triangleInscribedCircle:60}
\begin{aligned}
r_c(t) &= t \lr{ \mathbf{\hat{a}} + \mathbf{\hat{b}} } \\
r_b(t) &= \Ba + t \lr{ \mathbf{\hat{a}} + \mathbf{\hat{c}} } \\
r_a(t) &= \Bb + t \lr{ \mathbf{\hat{c}} – \mathbf{\hat{b}} }.
\end{aligned}
\end{equation}
We can find the intersection of any two of these to find the center point of the circle. For example, we seek solutions of
\begin{equation}\label{eqn:triangleInscribedCircle:80}
u \lr{ \mathbf{\hat{a}} + \mathbf{\hat{b}} } = \Ba + v \lr{ \mathbf{\hat{a}} + \mathbf{\hat{c}} }.
\end{equation}
We can wedge this with either of the \( u, v \) vector factors, to eliminate one of the scalars in this equation. Seeking \( u \), we wedge with \( \mathbf{\hat{a}} + \mathbf{\hat{c}} \), for
\begin{equation}\label{eqn:triangleInscribedCircle:100}
u \lr{ \mathbf{\hat{a}} + \mathbf{\hat{c}} } \wedge \lr{ \mathbf{\hat{a}} + \mathbf{\hat{b}} } = \lr{ \mathbf{\hat{a}} + \mathbf{\hat{c}} } \wedge \Ba = \mathbf{\hat{c}} \wedge \Ba.
\end{equation}
so
\begin{equation}\label{eqn:triangleInscribedCircle:120}
\Bz = \lr{ \mathbf{\hat{a}} + \mathbf{\hat{b}} } \lr{ \lr{ \mathbf{\hat{c}} \wedge \Ba } \cdot \inv{ \lr{ \mathbf{\hat{a}} + \mathbf{\hat{c}} } \wedge \lr{ \mathbf{\hat{a}} + \mathbf{\hat{b}} } } }.
\end{equation}
Having found the center, we can calculate the radius that touches the \( a \) edge, which is just
\begin{equation}\label{eqn:triangleInscribedCircle:140}
\mathrm{Rej}_{\Ba}(\Bz) = \lr{ \Bz \wedge \mathbf{\hat{a}} } \cdot \mathbf{\hat{a}}.
\end{equation}
The scalar radius is
\begin{equation}\label{eqn:triangleInscribedCircle:160}
r = \Norm{ \Bz \wedge \mathbf{\hat{a}} }.
\end{equation}

Calculation.

Using a Mathematica Manipulate, I plotted this solution, employing a duality transformation to calculate the bivectors using cross products (avoiding any GA package dependencies.)

For the radius, we need only:
\begin{equation}\label{eqn:triangleInscribedCircle:200}
r = \Norm{ \Bz \cross \mathbf{\hat{a}} }.
\end{equation}

For the intersection, we can use:
\begin{equation}\label{eqn:triangleInscribedCircle:180}
\Bz = \lr{ \mathbf{\hat{a}} + \mathbf{\hat{b}} } \lr{ \lr{ \mathbf{\hat{c}} \cross \Ba } \cdot \inv{ \lr{ \mathbf{\hat{a}} + \mathbf{\hat{c}} } \cross \lr{ \mathbf{\hat{a}} + \mathbf{\hat{b}} } } }.
\end{equation}

In retrospect, just using a ratio of the determinants of the coordinates would have been a direct representation of the ratio of the wedge products, so I could have done that instead to translate the results from GA to Mathematica (since this is a planar problem.)  The wedge products could have also been encoding using complex numbers (in the newest version of the notebook, I’ve done that.)

Of course, using Mathematica, we could have just used it’s more general \( \textrm{Solve} \) function, and need not grow our own wedge product based implementation.

A discord server for “Peeter’s math and physics play”

April 12, 2023 math and physics play ,

I receive emailed math and physics questions fairly frequently, often about my “Geometric Algebra for Electrical Engineers” book.  Email is a very unsatisfactory way to correspond for mathematics centric material, as you cannot format content easily using LaTeX.

To ease that pain, I have created a discord server, “Peeter Joot’s math and physics play” that I hope to use instead of email going forward.  I have the TexIt bot installed on my discord server, so with relatively little effort anybody that uses that server for Q&A will be able to supply questions that are formatted nicely in LaTeX.  And if nothing else, my side of any such discussions can be formatted nicely in a readable fashion.

I know that the primary user base for discord are video gamers, but I don’t have an issue with rebranding discord as “the math chat app” for my own purposes.  I’m not the originator of this idea — I am flagrantly stealing the idea from Enki’s bivector discord, a great community, but more general than I expect mine to be.  I don’t think we can loose with lots of math chat apps available.

 

Static load with two forces in a plane, solved a few different ways.

February 12, 2023 math and physics play , , , , , , , , , , , ,

[Click here for a PDF version of this post]

There’s a class of simple statics problems that are pervasive in high school physics and first year engineering classes (for me that CIV102.)  These problems are illustrated in the figures below. Here we have a static load under gravity, and two supporting members (rigid beams or wire lines), which can be under compression, or tension, depending on the geometry.

The problem, given the geometry, is to find the magnitudes of the forces in the two members. The equation to solve is of the form
\begin{equation}\label{eqn:twoForceStaticsProblem:20}
\BF_s + \BF_r + m \Bg = 0.
\end{equation}
The usual way to solve such a problem is to resolve the forces into components. We will do that first here as a review, but then also solve the system using GA techniques, which are arguably simpler or more direct.

Solving as a conventional vector equation.

If we were back in high school we could have written our forces out in vector form
\begin{equation}\label{eqn:twoForceStaticsProblem:160}
\begin{aligned}
\BF_r &= f_r \lr{ \Be_1 \cos\alpha + \Be_2 \sin\alpha } \\
\BF_s &= f_s \lr{ \Be_1 \cos\beta + \Be_2 \sin\beta } \\
\Bg &= g \Be_1.
\end{aligned}
\end{equation}
Here the gravitational direction has been pointed along the x-axis.

Our equation to solve is now
\begin{equation}\label{eqn:twoForceStaticsProblem:180}
f_r \lr{ \Be_1 \cos\alpha + \Be_2 \sin\alpha } + f_s \lr{ \Be_1 \cos\beta + \Be_2 \sin\beta } + m g \Be_1 = 0.
\end{equation}
This we can solve as a set of scalar equations, one for each of the \( \Be_1 \) and \( \Be_2 \) directions
\begin{equation}\label{eqn:twoForceStaticsProblem:200}
\begin{aligned}
f_r \cos\alpha + f_s \cos\beta + m g &= 0 \\
f_r \sin\alpha + f_s \sin\beta &= 0.
\end{aligned}
\end{equation}
Our solution is
\begin{equation}\label{eqn:twoForceStaticsProblem:220}
\begin{aligned}
\begin{bmatrix}
f_r \\
f_s
\end{bmatrix}
&=
{\begin{bmatrix}
\cos\alpha & \cos\beta \\
\sin\alpha & \sin\beta
\end{bmatrix}}^{-1}
\begin{bmatrix}
– m g \\
0
\end{bmatrix} \\
&=
\inv{
\cos\alpha \sin\beta – \cos\beta \sin\alpha
}
\begin{bmatrix}
\sin\beta & -\cos\beta \\
-\sin\alpha & \cos\alpha
\end{bmatrix}
\begin{bmatrix}
– m g \\
0
\end{bmatrix} \\
&=
\frac{ m g }{ \cos\alpha \sin\beta – \cos\beta \sin\alpha }
\begin{bmatrix}
-\sin\beta \\
\sin\alpha
\end{bmatrix} \\
&=
\frac{ m g }{ \sin\lr{ \beta – \alpha } }
\begin{bmatrix}
-\sin\beta \\
\sin\alpha
\end{bmatrix}.
\end{aligned}
\end{equation}
We have to haul out some trig identities to make a final simplification, but find a solution to the system.

Another approach, is to take cross products with the unit force direction.  First note that
\begin{equation}\label{eqn:twoForceStaticsProblem:240}
\begin{aligned}
\lr{ \Be_1 \cos\alpha + \Be_2 \sin\alpha } \cross \lr{ \Be_1 \cos\beta + \Be_2 \sin\beta }
&=
\Be_3 \lr{
\cos\alpha \sin\beta – \sin\alpha \cos\beta
} \\
&=
\Be_3 \sin\lr{ \beta – \alpha }.
\end{aligned}
\end{equation}

If we take cross products with each of the unit vectors, we find
\begin{equation}\label{eqn:twoForceStaticsProblem:260}
\begin{aligned}
f_r \lr{ \Be_1 \cos\alpha + \Be_2 \sin\alpha } \cross \lr{ \Be_1 \cos\beta + \Be_2 \sin\beta } + m g \Be_1 \cross \lr{ \Be_1 \cos\beta + \Be_2 \sin\beta } &= 0 \\
f_s \lr{ \Be_1 \cos\beta + \Be_2 \sin\beta } \cross \lr{ \Be_1 \cos\alpha + \Be_2 \sin\alpha } + m g \Be_1 \cross \lr{ \Be_1 \cos\alpha + \Be_2 \sin\alpha } &= 0,
\end{aligned}
\end{equation}
or
\begin{equation}\label{eqn:twoForceStaticsProblem:280}
\begin{aligned}
\Be_3 f_r \sin\lr{ \beta – \alpha } + m g \Be_3 \sin\beta &= 0 \\
-\Be_3 f_s \sin\lr{ \beta – \alpha } + m g \Be_3 \sin\alpha &= 0.
\end{aligned}
\end{equation}
After cancelling the \( \Be_3 \)’s, we find the same result as we did solving the scalar system. This was a fairly direct way to solve the system, but the intermediate cross products were a bit messy. We will try this cross product using the wedge product. Switching from the cross to the wedge, by itself, will not make things any simpler or more complicated, but we can use the complex exponential form of the unit vectors for the forces, and that will make things simpler.

Geometric algebra setup and solution.

As usual for planar problems, let’s write \( i = \Be_1 \Be_2 \) for the plane pseudoscalar, which allows us to write the forces in polar form
\begin{equation}\label{eqn:twoForceStaticsProblem:40}
\begin{aligned}
\BF_r &= f_r \Be_1 e^{i\alpha} \\
\BF_s &= f_s \Be_1 e^{i\beta} \\
\Bg &= g \Be_1,
\end{aligned}
\end{equation}
Our equation to solve is now
\begin{equation}\label{eqn:twoForceStaticsProblem:60}
f_r \Be_1 e^{i\alpha} + f_s \Be_1 e^{i\beta} + m g \Be_1 = 0.
\end{equation}
The solution for either \( f_r \) or \( f_s \) is now trivial, as we only have to take wedge products with the force direction vectors to solve for the magnitudes.  That is
\begin{equation}\label{eqn:twoForceStaticsProblem:80}
\begin{aligned}
f_r \lr{ \Be_1 e^{i\alpha} +} \wedge \lr{ \Be_1 e^{i\beta} } + m g \Be_1 \wedge \lr{ \Be_1 e^{i\beta} } &= 0 \\
f_s \lr{ \Be_1 e^{i\beta} +} \wedge \lr{ \Be_1 e^{i\alpha} } + m g \Be_1 \wedge \lr{ \Be_1 e^{i\alpha} } &= 0.
\end{aligned}
\end{equation}
Writing the wedges as grade two selections, and noting that \( e^{i\theta} \Be_1 = \Be_1 e^{-i\theta } \), we have
\begin{equation}\label{eqn:twoForceStaticsProblem:100}
\begin{aligned}
f_r &= – m g \frac{ \gpgradetwo{\Be_1^2 e^{i\beta}} }{ \gpgradetwo{ \Be_1^2 e^{-i\alpha} e^{i\beta} } } = – m g \frac{ \sin\beta }{ \sin\lr{ \beta – \alpha } } \\
f_s &= – m g \frac{ \gpgradetwo{\Be_1^2 e^{i\alpha}} }{ \gpgradetwo{ \Be_1^2 e^{-i\beta} e^{i\alpha} } } = m g \frac{ \sin\alpha }{ \sin\lr{ \beta – \alpha } }.
\end{aligned}
\end{equation}
The grade selection a unit pseudoscalar factor in both the denominator and numerator, which cancelled out to give the final scalar result.

As a complex variable problem.

Observe that we could have reframed the problem as a multivector problem by left multiplying \ref{eqn:twoForceStaticsProblem:60} by \( \Be_1 \) to find
\begin{equation}\label{eqn:twoForceStaticsProblem:120}
f_r e^{i\alpha} + f_s e^{i\beta} + m g = 0.
\end{equation}
Alternatively, we could have written the equations this way directly as a complex variable problem.

We can now solve for \( f_r \) or \( f_s \) by multiplying by the conjugate of one of the complex exponentials. That is
\begin{equation}\label{eqn:twoForceStaticsProblem:140}
\begin{aligned}
f_r + f_s e^{i\beta} e^{-i\alpha} + m g e^{-i\alpha} &= 0 \\
f_r e^{i\alpha} e^{-i\beta} + f_s + m g e^{-i\beta} &= 0.
\end{aligned}
\end{equation}
Selecting the bivector part of these equations (if interpreted as a multivector equation), or selecting the imaginary (if interpreting as a complex variables equation), will eliminate one of the force magnitudes from each equation, after which we find the same result.

This last approach, treating the problem as either a complex number problem (selecting imaginaries), or multivector problem (selecting bivectors), seems the simplest. We have no messing cross products, nor do we have to haul out the trig identities (the sine difference in the denominator comes practically for free, as it did with the wedge product method.)

Geometric Algebra for Electrical Engineers, version V0.1.16-19.

February 7, 2023 math and physics play

A new version, V0.1.16-19, of the book has now been posted on Amazon and all the other usual places.

This version has solutions for most of the chapter I problems, increasing the size of the book by about 13 pages.

I plan to work through the chapter II and III problems too, and add those in a later version.  If that increases the size of the book too much (i.e.: forcing a price increase), I may opt to omit the problem solutions from the print versions, leaving solutions in the free PDF version, and in the Leanpub (pay what you want) edition.