Install and load the package
Install and load the package
PacletInstall["https://github.com/sw1sh/GeometricAlgebra/releases/download/0.8/GeometricAlgebra-0.8.paclet", ForceVersionInstallTrue]<<GeometricAlgebra`;
Out[]=
PacletObject
Let’s work with 5-dimensional geometric algebras and
5,0
4,1
In[]:=
G1=GeometricAlgebra[5,0]G2=GeometricAlgebra[4,1]
Out[]=
5,0
Out[]=
4,1
And generate random numerical multivectors in these algebras
In[]:=
SeedRandom[1234]v=Multivector[Rationalize[RandomReal[{-1,1},32],0.01],G1]w=Multivector[Rationalize[RandomReal[{-1,1},32],0.01],G2]
Out[]=
3
4
1
22
e
1
5
6
e
2
1
4
e
3
31
32
e
4
6
7
e
5
1
11
e
12
1
24
e
13
1
2
e
14
9
17
e
15
24
25
e
23
4
7
e
24
1
12
e
25
7
9
e
34
1
6
e
35
7
15
e
45
5
6
e
123
1
7
e
124
28
29
e
125
1
6
e
134
5
6
e
135
4
7
e
145
2
5
e
234
1
2
e
235
1
5
e
245
3
11
e
345
9
14
e
1234
11
14
e
1235
1
17
e
1245
3
8
e
1345
4
7
e
2345
4
7
e
12345
Out[]=
-++-+++-++-++++-++++-++-++-+-+++-++-+-+-++-++
4
7
3
4
e
1
2
11
e
2
4
11
e
3
5
7
e
4
47
48
e
1
3
10
e
12
5
14
e
13
4
13
e
14
7
13
e
1
1
3
14
e
23
16
17
e
24
3
13
e
2
1
2
9
e
34
7
10
e
3
1
2
9
e
4
1
7
8
e
123
1
4
e
124
4
5
e
12
1
3
4
e
134
5
9
e
13
1
26
27
e
14
1
5
8
e
234
7
10
e
23
1
9
11
e
24
1
10
19
e
34
1
3
5
e
1234
9
10
e
123
1
2
5
e
124
1
3
4
e
134
1
1
4
e
234
1
7
11
e
1234
1
Any multivector can be transformed into a matrix (square MultivectorArray of rank 2) containing lower dimensional multivectors as its components
In[]:=
MultivectorMatrix[v]
Out[]=
| ||||
| ||||
| ||||
|
In[]:=
MultivectorMatrix[w]
Out[]=
| ||||
| ||||
| ||||
|
Notice that matrix components of contain multivectors of , and components of contain which are lowest dimensional algebras with the same sign of pseudoscalar squared, 1 and -1 respectivelyThe components also has usual imaginary units , which come from the conversion of algebras ≡(,,,,)(,,,,)≡, and ≡(,,,,)(,,,,)≡
5,0
1,0
4,1
0,1
5,0
e
1
e
2
e
3
e
4
e
5
e
1
e
2
e
3
f
4
f
5
3,2
4,1
e
1
e
2
e
3
e
4
f
1
e
1
e
2
e
3
e
4
f
1
2,3
Converting from one algebra to another is easy
In[]:=
ConvertGeometricAlgebra[w,G1]
Out[]=
-++-+++++-++-++-+-++-+++-+-+-++-+++-++-++-++-+-
4
7
3
4
e
1
2
11
e
2
4
11
e
3
5
7
e
4
47
48
e
5
3
10
e
12
5
14
e
13
4
13
e
14
7
13
e
15
3
14
e
23
16
17
e
24
3
13
e
25
2
9
e
34
7
10
e
35
2
9
e
45
7
8
e
123
1
4
e
124
4
5
e
125
3
4
e
134
5
9
e
135
26
27
e
145
5
8
e
234
7
10
e
235
9
11
e
245
10
19
e
345
3
5
e
1234
9
10
e
1235
2
5
e
1245
3
4
e
1345
4
e
2345
7
11
e
12345
In[]:=
ConvertGeometricAlgebra[v,G2]
Out[]=
3
4
1
22
e
1
5
6
e
2
1
4
e
3
31
32
e
4
6
7
e
1
1
11
e
12
1
24
e
13
1
2
e
14
9
17
e
1
1
24
25
e
23
4
7
e
24
12
e
2
1
7
9
e
34
6
e
3
1
7
15
e
4
1
5
6
e
123
1
7
e
124
28
29
e
12
1
1
6
e
134
5
6
e
13
1
4
7
e
14
1
2
5
e
234
2
e
23
1
5
e
24
1
3
11
e
34
1
9
14
e
1234
11
14
e
123
1
17
e
124
1
3
8
e
134
1
4
7
e
234
1
4
7
e
1234
1
The inverse operation of MultivectorMatrix is MatrixMultivector, with an optional additional argument of desired geometric algebra, because there are exist different geometric algebra signatures with dimension 5
5+1
In[]:=
MatrixMultivector[MultivectorMatrix[v],G1]vMatrixMultivector[MultivectorMatrix[w],G2]w
Out[]=
True
Out[]=
True
Multiplying matrices is equivalent to multiplying multivectors (make sure to multiply within one algebra to avoid coersion)
In[]:=
MatrixMultivector[MultivectorMatrix[v]**MultivectorMatrix[ConvertGeometricAlgebra[w,G1]],G1]===v**ConvertGeometricAlgebra[w,G1]MatrixMultivector[MultivectorMatrix[ConvertGeometricAlgebra[v,G2]]**MultivectorMatrix[w],G2]===ConvertGeometricAlgebra[v,G2]**w
Out[]=
True
Out[]=
True
Also any conventional operation on matrices can be exported into geometric algebra this way (Matrix Gateway to Geometric Algebra)
For example computing an inverse multivector is straightforward now
In[]:=
Inverse[v]**vInverse[w]**w
Out[]=
1
Out[]=
1
Or exponential and logarithm
In[]:=
MultivectorFunction[Exp/*Expand,w]//ShortMultivectorFunction[Log/*Expand,v]//Short
Out[]//Short=
1
8
--
11728
9009
19467
7480
--
8270
9009
597
7480
1
8
-+
11728
9009
19467
7480
-+
8270
9009
1
7480
1
8
--1
4
4
4
4
1
8
-+
8578
9009
4133
7480
7984
9009
3963
7480
Out[]//Short=
1
8
58
119
1697
3570
269
238
1397
3570
1
8
58
119
1697
3570
269
238
1397
3570
1
8
31
238
411
3570
1
8
31
238
8333
3570
180
119
473
3570
e
1
Also for some vectors identity may not hold due to factors, as it is for matricies, but always does
log(exp(v))=v
2π
exp(log(v))=v
In[]:=
MultivectorFunction[Log@*Exp,v]===vMultivectorFunction[Log@*Exp,w]===wMultivectorFunction[Exp@*Log,v]===vMultivectorFunction[Exp@*Log,w]===w
Out[]=
False
Out[]=
True
Out[]=
True
Out[]=
True
Instead of getting matrix of hyperbolic or complex numbers for 5-dimensional multivector, one can get a matrix block of 3-dimensional multivectors
4×4
2×2
In[]:=
MultivectorBlock[v]
Out[]=
| ||
|
Nest multivector blocks