Maths - 2D multivector Code

On this page I have put some links to both code that I have written and to some more general open source programs. sfmulti2d is a very simple class to represent this algebra, this may be good enough if you just want a simple class that you can expand to meet your own requirements.

Below that I have shown how to use Axiom which is a general algebra program.

Complete sfmulti2d class

This class can represent a 2D rotation. The class has 4 double numbers which represent the rotation as either quaternion, axis-angle or euler number depending on the cde int/enum

The class has methods to combine with other rotations. Also many other methods, including the ability to load and save to from VRML and x3d

There are 3 versions available depending on language:

See also the following related classes

The full source code is available on Sourceforge here:

Axiom Program

There are a number of open source programs that can solve polynomial equations. I have used Axiom, how to install Axiom here.

As an example the following shows how to generate quaternions using Clifford algebra.

I have put user input in red:

(1) -> K := Fraction Polynomial Integer
 (1)  Fraction Polynomial Integer
           Type: Domain
(2) -> m := matrix[[-1,0],[0,-1]]
     +- 1   0 +
(2)  |        |
     + 0   - 1+
Type: Matrix Integer

(3) -> H := CliffordAlgebra(2, K, quadraticForm m)
 (3)  CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
           Type: Domain

(4) -> i: H := e(1)
     (4)  e
           1
Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)

(5) -> j: H := e(2)
     (5)  e
           2
Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)

(6) -> k: H := i*j
 (6)  e e
       1 2
Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
(7) -> x:= a + b*i + c*j + d*k
 (7)  a + b e  + c e  + d e e
             1      2      1 2
Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
(8) -> y:= e + f*i + g*j + h*k

 (8)  e + f e  + g e  + h e e
             1      2      1 2
Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
(9) -> x + y
 (9)  e + a + (f + b)e  + (g + c)e  + (h + d)e e
                      1           2           1 2
Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
(10) -> x * y
 (10)
- d h - c g - b f + a e + (c h - d g + a f + b e)e
                                                  1
           +
(- b h + a g + d f + c e)e  + (a h + b g - c f + d e)e e
                          2                           1 2
Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)

metadata block
see also:

 

Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

flag flag flag flag flag flag Clifford Algebra to Geometric Calculus: A Unified Language for Mathematics and Physics (Fundamental Theories of Physics). This book is intended for mathematicians and physicists rather than programmers, it is very theoretical. It covers the algebra and calculus of multivectors of any dimension and is not specific to 3D modelling.

 

Terminology and Notation

Specific to this page here:

 

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2023 Martin John Baker - All rights reserved - privacy policy.