Skip to main content
Post Made Community Wiki by J. M.'s missing motivation
Source Link

A look at how QuaternionQ[] is defined in the package reveals the trouble: it is dependent on the private function ScalarQ[] for checking its individual components. ScalarQ[] is defined this way:

ScalarQ[x_]:= (NumericQ[x] && Head[x] =!= Complex) 

It is clear that none of the components of Quaternion[A0, A1, A2, A3] will pass ScalarQ[], and thus QuaternionQ[] returns False. Relatedly, FromQuaternion[] also depends on QuaternionQ[] (and thus ScalarQ[]), which is why it also doesn't work for your symbolic quaternion.

Thus, when testing for not necessarily numeric quaternions, you might want to do something like MatchQ[Quaternion[A0, A1, A2, A3], _Quaternion], and use {1, I, J, K}.(List @@ expr) for conversion to an explicit form.

Finally, for extracting components of symbolic quaternions, look up Part[] or Extract[].