Ask Your Question
1

Dual Quaternion Algebra

asked 2018-03-15 19:07:35 +0100

Tdguerreiro gravatar image

Hello,

I'm quite new to SAGE.

I need to work with the algebra of dual quaternions. It can be defined in two equivalent ways:

  1. The algebra of quaternions over the dual numbers. Dual numbers are elements of the form a+be where a and b are real and e is such that e^2=0.

  2. The algebra of polynomials over the quaternions and variable e modulo e^2.

For the first definition I tried to do this:

P.<e>=PolynomialRing(RR)
S.<e>=P.quo(e*e); 
F.<I,J,K> = QuaternionAlgebra(S, -1,-1)

For some reason this doesn't work. What is the best way to define this Dual Quaternion Algebra in SAGE ?

Thank you for your help!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-03-16 15:48:33 +0100

dan_fulea gravatar image

The reason is

TypeError: base ring of quaternion algebra must be a field

and the documentation of QuaternionAlgebra mentions it must be a field. To avoid the reason one may go to the source directly, this gives the short solution:

Short answer:

R.<e> = PolynomialRing(QQ, names='E').quotient( E^2 )
D, (i,j,k) = sage.algebras.free_algebra_quotient.hamilton_quatalg( R )

Test:

sage: (1+2*i+3*j+4*k+5*e)^6
(117480*e-12208) + (33360*e+8944)*i + (50040*e+13416)*j + (66720*e+17888)*k
sage: F.<I,J,K> = QuaternionAlgebra(QQ, -1,-1)
sage: (1+2*I+3*J+4*K)^6
-12208 + 8944*I + 13416*J + 17888*K

Explicit answer A more elaboarted way would be:

S.<E> = PolynomialRing( QQ )
R.<e> = S.quotient( E^2 )

A = FreeAlgebra(R, 3, 'u')
U = A.monoid()
I, J, K = U.gens()
mons = [ U(1), I, J, K, ]
M    = MatrixSpace(QQ, len(mons))

# columns for mats
#             1  I  J  K 
mats = [ M( [ 0, 1, 0, 0,    # 1*I
             -1, 0, 0, 0,    # I*I
              0, 0, 0,-1,    # J*I
              0, 0, 1, 0,    # K*I
              ] ),
         M( [ 0, 0, 1, 0,    # 1*J
              0, 0, 0, 1,    # I*J
             -1, 0, 0, 0,    # J*J
              0,-1, 0, 0,    # K*J
              ] ),
         M( [ 0, 0, 0, 1,    # 1*K
              0, 0,-1, 0,    # I*K
              0, 1, 0, 0,    # J*K
             -1, 0, 0, 0,    # K*K
              ] ),
         ]
D.<i,j,k> = FreeAlgebraQuotient(A, mons, mats)

(It would be maybe a good idea to mention in the documentation that the matrices correspond to the right multiplication with the generators, a while i was getting confused about this point.) Same test:

sage: (1+2*i+3*j+4*k+5*e)^6
(117480*e-12208) + (33360*e+8944)*i + (50040*e+13416)*j + (66720*e+17888)*k
edit flag offensive delete link more

Comments

1

Thank you for your answer!

I did have a problem using 'E' as the name variable but it worked out fine with E replaced by x. Also, what if I want to work with complex coefficients rather than real coefficients ? I want to be able to distinguish the Hamiltonian "I" from the complex "I" so that, for instance, the difference between them is non-zero. How could I do this ?

Tdguerreiro gravatar imageTdguerreiro ( 2018-03-19 12:28:29 +0100 )edit

Then:

F.<i> = QuadraticField(-1)    # or F = CC
S.<E> = PolynomialRing(F)
R.<e> = S.quotient( E^2 )

A = FreeAlgebra(R, 3, 'J')
U = A.monoid()
J1, J2, J3 = U.gens()
mons = [U(1), J1, J2, J3]
M = MatrixSpace(F, 4)

mats = [ M([0,1,0,0, -1,0,0,0, 0,0,0,-1, 0,0,1,0]),
         M([0,0,1,0, 0,0,0,1, -1,0,0,0, 0,-1,0,0]),
         M([0,0,0,1, 0,0,-1,0, 0,1,0,0, -1,0,0,0]), ]

D.<j1,j2,j3> = FreeAlgebraQuotient(A, mons, mats)

should do the job. Here, i prefer to use the gaussian field $\mathbb Q(i)$ instead of CC, the imprecise version of $\mathbb C$. Generators have to be renamed according to the own needs. Sample calculus in the D above:

sage: (i+j1+j2+j3+e)^10
(42400*i ...
(more)
dan_fulea gravatar imagedan_fulea ( 2018-03-21 18:47:07 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-03-15 18:57:36 +0100

Seen: 621 times

Last updated: Mar 16 '18