4
$\begingroup$

I tried to define quaternionic multiplication in terms of pairs of complex numbers where I identify $\mathbb{C}^2$ with $\mathbb{H}$ via $(z,w)\mapsto z+jw$. Consequently, I used the multiplication rule

Q /: Q[a_, b_]*Q[c_, d_] := 
 Q[a*c - Conjugate[b]*d, Conjugate[a]*d + b*c]

Strangely enough, the input

Q[0, 1]*Q[0, I]

Gives the incorrect output

Q[I, 0]

However, typing

Q[0, 1]*Q[a, I]

Gives the correct output

Q[-I, a]

Does anyone have an idea why this is happening?

$\endgroup$
9
$\begingroup$

Multiplication with * is commutative (technically, Orderless), whereas quaternionic multiplication is not. Because * automatically puts its terms in normal order before multiplying, you sometimes end up with a commuted result. In your case this happens because I comes before 1 in the alphabet, and 0 comes before a, so the two terms are commuted (exchanged) automatically (try Sort[{Q[0, 1], Q[0, I]}] and Sort[{Q[0, 1], Q[a, I]}]).

The solution is to use NonCommutativeMultiply to prevent term reordering:

Q /: Q[a_, b_] ** Q[c_, d_] := Q[a*c - Conjugate[b]*d, Conjugate[a]*d + b*c]

Q[0, 1] ** Q[0, I]
(*    Q[-I, 0]    *)

Q[0, 1] ** Q[a, I]
(*    Q[-I, a]    *)
$\endgroup$
  • $\begingroup$ Thank you so much!:) $\endgroup$ – deepfloe Jul 1 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.