Conformal geometry with Clifford algebra
Robin K. S. Hankin
Source:vignettes/conformal_algebra_clifford.Rmd
conformal_algebra_clifford.Rmd
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
Thus if
To work in R, we set up some basic features of conformal geometry.
Specifically, we consider the three Euclidean basis vectors
then we may say that 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
e0
## Element of a Clifford algebra, equal to
## - 0.5e_4 + 0.5e_5
einf
## Element of a Clifford algebra, equal to
## + 1e_4 + 1e_5
E
## Element of a Clifford algebra, equal to
## - 1e_45
Points
With these definitions, we can consider Euclidean vectors
This is straightforward in package idiom:
point <- function(x){ as.1vector(x) + sum(x^2)*einf/2 + e0 }
Thus point()
takes an R vector of length 3 and returns
its conformal embedding. For example, we may translate points
## Element of a Clifford algebra, equal to
## + 1e_1 + 2e_2 + 5e_3 + 14.5e_4 + 15.5e_5
point(b)
## Element of a Clifford algebra, equal to
## + 2e_1 + 2e_2 + 2e_3 + 5.5e_4 + 6.5e_5
It can be shown that %.%
].
Package idiom to verify this would be
## conformal Euclidean
## -5 -5
showing that the two results match.
Sphere, IPNS
We can define a sphere with center
and then the sphere is just the inner product null space of
sphere <- function(x,r){ point(x) - r^2*einf/2}
S <- sphere(1:3,5) # center (1,2,3) radius 5:
S
## 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
drop(S^2) # 5^2 = 25
## [1] 25
Finding the center of the sphere is slightly more involved;
Hildenbrand calls this the sandwich product given by
S*einf*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
-S*einf*S/2
## 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
point(1:3)
## Element of a Clifford algebra, equal to
## + 1e_1 + 2e_2 + 3e_3 + 6.5e_4 + 7.5e_5
Sphere, OPNS
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
The conformal representation for a sphere in OPNS would be
and points that lie on the sphere are the set
Observe again that this parameterization does not require one to take
a basis of
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
## [1] 1.110223e-16
Above we see that
Planes
A plane is defined as
plane <- function(n,d){ as.1vector(n/sqrt(sum(n^2))) + d*einf}
For example, we consider the plane plane()
above but first need to
calculate
## 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
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 P1
,
P2
, P3
which are known to lie in plane
## [1] 3.191891e-16 -1.110223e-16 -3.330669e-16
Above we see zero (to numerical precision), showing that we do indeed
have
where
Pi2 <- P1 ^ P2 ^ P3 ^ einf
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
p4 <- point(d*nhat + 7.6*u - 9.23*v)
Mod(Pi2 ^ p4)
## [1] 3.005929e-13
Above we see a very small result showing that p4
is
indeed in the OPNS of plane Pi2
.
Circle
A circle is defined as the intersection of two spheres:
circle <- function(S1,S2){ # IPNS
S1 ^ S2
}
For example
circle(sphere(1:3,5),sphere(c(1.1,2.1,3.4),6))
## 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:
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:
poc # point on circle, found numerically [chunk omitted]
## Element of a Clifford algebra, equal to
## - 0.7152127e_1 - 0.2498563e_2 + 0.3267822e_3 - 0.159628e_4 + 0.840372e_5
poc ^ CIRC
## 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.
Lines and point pairs
A line is the intersection of two planes; in R:
line <- function(P1,P2){ P1 ^ P2 }
and a “point pair” is the intersection of three spheres; in R:
pointpair <- function(S1,S2,S3){ S1 ^ S2 ^ S3 }
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
(S1^S2)^S3 == S1^(S2^S3)
## [1] TRUE