To cite the clifford
package in publications please use
Hankin (2022). This short document shows
how conformal geometry may be implemented using the
clifford
R package; it follows Hildenbrand (2013) and Perwass (2009). Here we work in Clβ(p,βq), which Perwass
denotes πΎp,βq. The set
of grade-k objects is denoted
πΎp,βqk.
First we define the IPNS and OPNS [inner product null space and outer
product null space] of AβββπΎp,βqk.
$$ \begin{eqnarray} \operatorname{IPNS}(\mathbf{A}) &=& \left\lbrace\mathbf{x}\in\mathbb{G}^1_{p,q}\colon\mathbf{x}\cdot\mathbf{A} = 0\right\rbrace\\ \operatorname{OPNS}(\mathbf{A}) &=& \left\lbrace\mathbf{x}\in\mathbb{G}^1_{p,q}\colon\mathbf{x}\wedge\mathbf{A} = 0\right\rbrace \end{eqnarray} $$
Thus if $\mathbf{A}=\left\langle \mathbf{A}\right\rangle_{k}=\bigwedge_{i=1}^k\mathbf{a}_i$, then OPNSβ(A)β=βspanβ(a1,ββ¦,βak)βββπΎp,βq. Further, OPNSβ(A) is linear in the sense that x,βyβββOPNSβ(A) implies Ξ±xβ +β Ξ²yβββOPNSβ(A) for any real numbers Ξ±,βΞ². We will use this system to express a geometrical object π’ββββ3 (such as a sphere or a line) as a point P in Clβ(4,β1); the idea is that the IPNS or OPNS of P is π’. This allows one to express geometrical ideas in pure Clifford formalism, without needing to take a dangerous and unsightly basis.
To work in R, we set up some basic features of conformal geometry. Specifically, we consider the three Euclidean basis vectors e1, e2, e3 together with two additional basis vectors e+ and eβ obeying e+2β=β1, eβ2β=β0, e+β β β eββ=β0. If we define
$$ \mathbf{e}_0=\frac{1}{2}\left(\mathbf{e}_--\mathbf{e}_+\right),\qquad \mathbf{e}_\infty=\mathbf{e}_- +\mathbf{e}_+ $$
then we may say that e0 represents
βthe originβ and eβ represents
βthe point at infinityβ. We see that e02β=βeβ2β=β0
and eββ
β
β
e0β=ββ1;
the geometric product is given by eβe0β=ββEβ
ββ
1
and e0eββ=βEβ
ββ
1
where Eβ=βeββ
β§β
e0.
It is straightforward to implement these objects using the
clifford
package:
dimension <- 3
options("maxdim" = dimension+2) # paranoid safety measure
signature(dimension + 1,1)
eplus <- basis(dimension+1)
eminus <- basis(dimension + 2)
e0 <- (eminus - eplus)/2
einf <- eminus + eplus
E <- e0 ^ einf
So
## Element of a Clifford algebra, equal to
## - 0.5e_4 + 0.5e_5
## Element of a Clifford algebra, equal to
## + 1e_4 + 1e_5
## Element of a Clifford algebra, equal to
## - 1e_45
With these definitions, we can consider Euclidean vectors a,βbββββ3 and conformal embeddings A,βB given by
Aβ=βC(a)β=βaβ +β a2eβ/2β +β e0βββBβ=βC(b)β=βbβ +β b2eβ/2β +β e0
This is straightforward in package idiom:
Thus point()
takes an R vector of length 3 and returns
its conformal embedding. For example, we may translate points (1,β2,β5) and (2,β2,β2) to their conformal equivalent:
## Element of a Clifford algebra, equal to
## + 1e_1 + 2e_2 + 5e_3 + 14.5e_4 + 15.5e_5
## Element of a Clifford algebra, equal to
## + 2e_1 + 2e_2 + 2e_3 + 5.5e_4 + 6.5e_5
It can be shown that Aβ
β
β
Bβ=βββ₯aβ
ββ
bβ₯2/2
[where the dot product is the Clifford inner product, %.%
].
Package idiom to verify this would be
## conformal Euclidean
## -5 -5
showing that the two results match.
We can define a sphere with center a and radius Ο as
Sβ=βC(a)β ββ Ο2eβ/2
and then the sphere is just the inner product null space of S, that is {x:βSβ β β xβ=β0}. This is straightforward to implement computationally. Suppose we have a sphere of radius 5, center (1,β2,β3):
## Element of a Clifford algebra, equal to
## + 1e_1 + 2e_2 + 3e_3 - 6e_4 - 5e_5
Then object S
is a conformal representation of such a
sphere. The radius Ο can be
calculated from S2β=βΟ2.
Package idiom:
## [1] 25
Finding the center of the sphere is slightly more involved; Hildenbrand calls this the sandwich product given by Pβ=βSeβS:
## Element of a Clifford algebra, equal to
## - 2e_1 - 4e_2 - 6e_3 - 13e_4 - 15e_5
Hildenbrand shows that the scaling factor is β2 so this gives us
## Element of a Clifford algebra, equal to
## + 1e_1 + 2e_2 + 3e_3 + 6.5e_4 + 7.5e_5
which we recognise as the point (1,β2,β3):
## Element of a Clifford algebra, equal to
## + 1e_1 + 2e_2 + 3e_3 + 6.5e_4 + 7.5e_5
We can also consider the OPNS for a sphere, defined in terms of four points that lie on it. For example, if our four points are (0,β0,β0), (1,β0,β0), (0,β1,β0), (0,β0,β1) we would have a rather involved algebraic calculation resulting in a sphere of radius $\frac{\sqrt{3}}{2}$ and center $\left(\frac{1}{2},\frac{1}{2},\frac{1}{2}\right)$.
The conformal representation for a sphere in OPNS would be
S*β=βP1β β§β P2β β§β P3β β§β P4
and points that lie on the sphere are the set
{x:βxβ β§β S*β=β0}.
Observe again that this parameterization does not require one to take a basis of β3, as all the results are presented in terms of vector quantities: at no point does one need to consider components or elements of any vector. The R idiom for defining the sphere touching {P1,βP2,βP3,βP4} is straightforward:
origin <- point(c(0,0,0))
px <- point(c(1,0,0))
py <- point(c(0,1,0))
pz <- point(c(0,0,1))
(S <- origin ^ px ^ py ^ pz)
## Element of a Clifford algebra, equal to
## + 0.5e_1234 - 0.5e_1235 - 0.5e_1245 + 0.5e_1345 - 0.5e_2345
And this is the representation for a sphere (translating this into a center and radius is not yet implemented). Slightly slicker R idiom might be:
## Element of a Clifford algebra, equal to
## + 0.5e_1234 - 0.5e_1235 - 0.5e_1245 + 0.5e_1345 - 0.5e_2345
As a verification, we may check that point $\left(\frac{1}{2},\frac{1}{2},\frac{1}{2}+\frac{\sqrt{3}}{2}\right)$ is on the sphere as well:
## [1] 1.110223e-16
Above we see that pβ β§β S is zero to within numerical error. Again observe that this is established without taking a basis of β3.
A plane is defined as $\hat{\mathbf{n}} + d\mathbf{e}_\infty$, where $\hat{\mathbf{n}}$ is the unit normal and d the distance to the origin.
For example, we consider the plane Ξ with normal nβ=β(1,β2,β5) and distance
7. We may use plane()
above but first need to calculate
$\hat{\mathbf{n}}=\mathbf{n}/\left|\mathbf{n}\right|$:
## Element of a Clifford algebra, equal to
## + 0.1825742e_1 + 0.3651484e_2 + 0.9128709e_3 + 7e_4 + 7e_5
Just to check, we may verify that some points known to lie in Ξ are in fact in its IPNS. We observe that the point $7\hat{\mathbf{n}}\in\Pi$, and also that vectors uβ=β(2,ββ1,β0) and vβ=β(5,β0,ββ1) are orthogonal to the normal of Ξ . So $7\hat{\mathbf{n}} + \alpha\mathbf{u} + \beta\mathbf{v}\in\Pi$ for any real numbers Ξ±,βΞ². In R:
u <- c(2,-1,0)
v <- c(5,0,-1)
P1 <- point(d*nhat)
P2 <- point(d*nhat + 1.3*u + 3.44*v)
P3 <- point(d*nhat - 6.1*u + 1.02*v)
Above we use some made-up values of Ξ±,βΞ² to generate
P1
, P2
, P3
which are known to lie
in plane Ξ . Then to verify
that these points lie in the IPNS of Ξ we need to take the inner product
with the conformal representation of Ξ :
## [1] 3.191891e-16 -1.110223e-16 -3.330669e-16
Above we see zero (to numerical precision), showing that we do indeed have $7\hat{\mathbf{n}} + \alpha\mathbf{u} + \beta\mathbf{v}\in\operatorname{IPNS}(\Pi)$ for at least these values of Ξ± and Ξ². Alternatively, a plane can be thought of as a sphere that touches the point at infinity; thus the OPNS of plane is given by
Οββ=βP1β β§β P2β β§β P3β β§β eβ
where P1,βP2,βP3 are any points that lie in the plane. To illustrate this we will use the three points used in the IPNS above:
Then for verification we can create another point known to be in the
plane and check that this is in the OPNS. Below we will use
p4
which is $d\hat{\mathbf{n}} +
7.6\mathbf{u} - 9.23\mathbf{v}$:
## [1] 3.005929e-13
Above we see a very small result showing that p4
is
indeed in the OPNS of plane Pi2
.
A circle is defined as the intersection of two spheres:
For example
## Element of a Clifford algebra, equal to
## - 0.1e_12 + 0.1e_13 + 0.5e_23 - 3.31e_14 - 7.22e_24 - 9.33e_34 - 3.41e_15 -
## 7.32e_25 - 9.73e_35 + 3.91e_45
A circle may be represented in the OPNS by specifying three points that lie on it:
Z*β=βP1β β§β P2β β§β P3
circlestar <- function(...){ # OPNS; A^B^C
jj <- list(...)
stopifnot(length(jj) == dimension)
Reduce(`^`,lapply(jj,point))
}
(CIRC <- circlestar(c(1,2,3),c(5,6,3),c(8,8,-2)))
## Element of a Clifford algebra, equal to
## + 8e_123 - 38e_124 - 110e_134 - 54e_234 - 42e_125 - 130e_135 - 74e_235 +
## 40e_145 + 68e_245 + 140e_345
verify:
## Element of a Clifford algebra, equal to
## - 0.7152127e_1 - 0.2498563e_2 + 0.3267822e_3 - 0.159628e_4 + 0.840372e_5
## Element of a Clifford algebra, equal to
## - 0.003402925e_1234 - 0.003402866e_1235 - 0.001701745e_1245 - 0.00850813e_1345
## - 0.008507714e_2345
Above we see that poc
is at least close to the circle
from the small magnitude of the terms in the wedge product.
A line is the intersection of two planes; in R:
and a βpoint pairβ is the intersection of three spheres; in R:
It is not at all obvious that three spheres intersect in a pair of points; and still less obvious that the process is associative. However, we may verify associativity explicitly:
## Element of a Clifford algebra, equal to
## - 5e_123 + 31e_124 + 25e_134 - 40.5e_234 + 29e_125 + 25e_135 - 39.5e_235 -
## 10e_145 + 10e_245 - 5e_345
## [1] TRUE