I'm trying out Sage on quaternions, on the problem of finding the center of the real Hamiltonian quaternions $\mathbb{H}$. So what I tried was:
Q.<i,j,k> = QuaternionAlgebra(SR, -1, -1)
a1, b1, c1, d1 = SR.var('a1, b1, c1, d1', domain = RR)
a2, b2, c2, d2 = SR.var('a2, b2, c2, d2', domain = RR)
q1 = a1 + b1*i + c1*j + d1*k
q2 = a2 + b2*i + c2*j + d2*k
solve([q1*q2 - q2*q1], a1, b1, c1, d1)
which rewarded me with:
TypeError Traceback (most recent call last)
<ipython-input-3-fa8574b079be> in <module>()
----> 1 solve([q1*q2 - q2*q1], a1, b1, c1, d1)
/usr/lib/python2.7/dist-packages/sage/symbolic/relation.pyc in solve(f, *args, **kwds)
1039 raise TypeError("The first argument to solve() should be a"
1040 "symbolic expression or a list of symbolic expressions, "
-> 1041 "cannot handle %s"%repr(type(f)))
1042
1043 if is_Expression(f): # f is a single expression
TypeError: The first argument to solve() should be asymbolic expression or a list of symbolic expressions, cannot handle <type 'list'>
Well, OK, that's not a symbolic expression:
sage: type(q1*q2 - q2*q1)
<type 'sage.algebras.quatalg.quaternion_algebra_element.QuaternionAlgebraElement_generic'>
and oddly, it's always zero?:
sage: q1*q2 - q2*q1 == 0
True
even though it's not:
sage: q1*q2 - q2*q1
((c1 - d1)*(c2 + d2) - (c1 + d1)*(c2 - d2))*i + (2*b2*d1 - 2*b1*d2)*j + (-(a2 + b2)*(c1 + d1) + (a2 - b2)*(c1 + d1) + (a1 + b1)*(c2 + d2) - (a1 - b1)*(c2 + d2) + 2*b2*d1 - 2*b1*d2)*k
I can figure out the answer from the last line, but was hoping for something like $b_1 = c_1 = d_1 = 0$. Not sure how this works.