Mathematica can easily compute exponentials and logarithms of concrete quaternions:


Exp[Quaternion[1.3, 3.5, -0.7, 0.9]]
Log[Quaternion[1.3, 3.5, -0.7, 0.9]]
Quaternion[-3.14824, -1.79206, 0.358412, -0.460816]

Quaternion[1.36196, 1.17075, -0.23415, 0.301051]

Even for exact numbers:

Exp[Quaternion[1, 3, 7/2, -5]]
Quaternion[E Cos[Sqrt[185]/2], (6 E Sin[Sqrt[185]/2])/Sqrt[185],
           (7 E Sin[Sqrt[185]/2])/Sqrt[185], -2 Sqrt[5/37] E Sin[Sqrt[185]/2]]

But it seems to be unable to expand this for the general quaternion:

Exp[Quaternion[a, b, c, d]]
E^Quaternion[a, b, c, d]

I've tried using Simplify, FunctionExpand, ToQuaternion on this, but still it doesn't give a Quaternion object. But there exists a closed form for such functions.

I can, of course, define such functions myself, like:

exp[q_] = With[{v = q - Re[q]}, Exp[Re[q]] (Cos[Abs[v]] + v/Abs[v] Sin[Abs[v]]) ];
ln[q_] = Log[Abs[q]] + (q - Re[q])/AbsIJK[q] ArcCos[Re[q]/Abs[q]];

But is there a way to get Mathematica itself expand these functions of general quaternions, without me having to redefine them all?


The reason for the behavior you were seeing can be seen if you look through the definitions within the package. In particular, the extended elementary functions are defined with a format like func[a:Quaternion[__?ScalarQ]] := (* stuff *) where ScalarQ[] is a private package function that checks if the stuff within the Quaternion[] object are real numbers. Since the components of Quaternion[a, b, c, d] are manifestly not real (in the sense of not satisfying ScalarQ[]), the formulae within are not applied to your symbolic quaternion.

But, since this is a package function, you can modify the code yourself so that it can work with quaternions with symbolic components.

|improve this answer|||||

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.