Question: Is there a better way to do this?

I am trying to write a quaternion package, I also want it to be able to multiply quaternion polynomials where the unknown "x" remains on the right of the coefficient. the I,J,K rules are standard quaternion rules.

define(M, 'flat', 'multilinear', 'identity' = 1,
M(I,I)=-1, M(J,J)=-1, M(K,K)=-1, M(I,J)=K, M(J,I)=-K, M(J,K)=I, M(K,J)=-I, M(I,K)=-J, M(K,I)=J,


this indeed works(as far as I know) but it doesn't look pretty and seems pretty tedius!!! is there a simpler way to let maple know that any term with x (or x^something) should have x (or x^something)  on the right of the coeficient?

Please Wait...