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) |