According to the documentation online, we can use the following command to load the Quaternion package.

<< Quaternions`

It is clear that the pakage uses left handed quaternions for all its quaternion algebra. Is it possible to define the explicitly right handed quaternions in mathematica and thereby use algebra like multiplication, conjugates etc. ?

For eg. Quaternion[2, 0, -6, 3] ** Quaternion[1, 3, -2, 2] results in a different value depending on whether the defined quaternions are left or right handed.

P.S: I know that I can manually shuffle the last element to convert a right quaternion to a left quaternion. I was just wondering whether it is possible with the help of definion in mathematica itself.

  • 1
    $\begingroup$ Just curious, as just yesterday I became aware of the work mathematican, Chole Furey, has undertaken in relating quaternions and octonions to the Standard Model of particle physics (see: furey.space). I'd love to know what has brought you to quaternions and what you want to do with them. Also raises the question about how this stuff might relate to the Wolfram Physics Project. I know I've gone a bit off-topic but this seems like very interesting stuff. $\endgroup$
    – Jagra
    Jul 21, 2022 at 22:24
  • 1
    $\begingroup$ I am trying to understand flexible mechanisms in outer space. They often encounter large displacements/strains which may be prone to gimbal lock in case of the very friendly SO(3) group of matrices. $\endgroup$ Jul 21, 2022 at 23:02
  • $\begingroup$ Interesting. Thanks. $\endgroup$
    – Jagra
    Jul 21, 2022 at 23:58

1 Answer 1


OP wants another version of the quaternions that I denote myQuaternion that are related to the usual Quaternion by a change of basis given by some invertible real $4 \times 4$ matrix M. In the code below, one can adjust M.



(* fix the invertible real 4 x 4 matrix you want
   the one I use here is just an example *)

(* change of basis from and to usual Quaternion *)

(* define multiplication and conjugation *)

One can add more operations if required. If one uses something like this more regularly, one should put it into a dedicated package, see also here, with only myQuaternion public.


(* myQuaternion[-16,12,-19,-11] *)

(* myQuaternion[12,-3,1,-3] *)

Comment. The myQuaternion/: is used above to define an upvalue, which allows us to get the desired behavior without modifying the built-in functions ** and Conjugate.

  • 1
    $\begingroup$ That's exactly what I wanted to know! Thank you @user293787 ! $\endgroup$ Jul 22, 2022 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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