On 08/12/16 18:03, Tim Daly wrote:
So the real question might be "Can I formulate my physics in
matrix and tensors and shift between them". Which leads to the
question "Can I easily convert between matrices and tensors?"
From what I've seen so far this should be possible, provided it is
implemented properly. The CA wedge product is just the basis
vectors times the determinant so you might have to specify the
map between the matrix basis and the tensor basis.
Although matrix and Clifford algebras are apples and oranges I think
that, in the context of a given geometry and physics it may be
theoretically possible to have an equivalence between them but in
practice I suspect this may be too messy?
As an example lets look at 3D rotations as either 3x3 Matrix or
quaternions (taken to be Clifford algebra with 3D bivector + scalar) in
the context of Euclidean space and classical physics (rotation by 360
degrees taken to be identity).
I think the matrix to Clifford conversion would be something like this
untested code:
matrix2Quat(m:SquareMatrix(3,DoubleFloat)) == Quaternion(DoubleFloat)
tr:DoubleFloat = elt(m,0,0) + elt(m,1,1) + elt(m,2,2)
if (tr > 0) then
S:DoubleFloat = sqrt(tr+1.0) * 2
qw = 0.25 * S
qx = (elt(m,2,1) - elt(m,1,2)) / S
qy = (elt(m,0,2) - elt(m,2,0)) / S
qz = (elt(m,1,0) - elt(m,0,1)) / S
else if ((elt(m,0,0) > elt(m,1,1)) and (elt(m,0,0) > elt(m,2,2))) then
S:DoubleFloat = sqrt(1.0 + elt(m,0,0) - elt(m,1,1) - elt(m,2,2)) * 2
qw = (elt(m,2,1) - elt(m,1,2)) / S
qx = 0.25 * S;
qy = (elt(m,0,1) + elt(m,1,0)) / S
qz = (elt(m,0,2) + elt(m,2,0)) / S
else if (elt(m,1,1) > elt(m,2,2)) then
S:DoubleFloat = sqrt(1.0 + elt(m,1,1) - elt(m,0,0) - elt(m,2,2)) * 2
qw = (elt(m,0,2) - elt(m,2,0)) / S
qx = (elt(m,0,1) + elt(m,1,0)) / S
qy = 0.25 * S
qz = (elt(m,1,2) + elt(m,2,1)) / S
else
S:DoubleFloat = sqrt(1.0 + elt(m,2,2) - elt(m,0,0) - elt(m,1,1)) * 2
qw = (elt(m,1,0) - elt(m,0,1)) / S
qx = (elt(m,0,2) + elt(m,2,0)) / S
qy = (elt(m,1,2) + elt(m,2,1)) / S
qz = 0.25 * S
quatern(qx,qy,qz,qw)
The 'if' statements are required to do the translation in a part of the
geometry away from singularities and to avoid root of negative numbers.
This seems quite complicated to me and I suspect (but I don't know) that
any attempt to generalise it may make it more complicated?
Therefore I was thinking more of being able to plug in either matrix or
Clifford but not both.
So I have a physics problem that needs to work with 3D rotations, I
could either plug in the matrix code to do the problem or the Clifford
code. They should give the same answer but the will differ in rounding
errors, ability to scale etc.
Martin
_______________________________________________
Axiom-developer mailing list
Axiom-developer@nongnu.org
https://lists.nongnu.org/mailman/listinfo/axiom-developer