There is a reason why the coefficient ring of an algebra should be commutative: multiplication is bilinear.
This implies that (ax)y = a(xy) and x(by) = b(xy) for all scalars a, b and algebra elements x, y. It follows
that we must have (ax)(by) = a(x(by)) = a(b(xy)) = (ab)(xy) and also (ax)(by) = b((ax)y) = b(a(xy)) = (ba)(xy).
That is hard to arrange if the coefficients a and b do not commute.
Instead of defining quaternions with non-commutative arguments, I would try to implement the tensor
product of two algebras. That would not be hard for finite-dimensional free algebras such as quaternions
and (finite dimensional) Lie algebras.
Kalevi Suominen