Ask Your Question

Gilles Falquet's profile - activity

2017-11-09 07:55:48 -0500 received badge  Student (source)
2014-06-28 23:56:27 -0500 received badge  Famous Question (source)
2014-06-28 23:56:27 -0500 received badge  Popular Question (source)
2014-06-28 23:56:27 -0500 received badge  Notable Question (source)
2013-01-22 10:40:02 -0500 received badge  Scholar (source)
2013-01-22 10:40:02 -0500 marked best answer How to do symbolic computation with quaternions

You should define Q as a QuaternionAlgebra over the symbolic ring SR instead of over the rationals:

sage: Q.<i,j,k> = QuaternionAlgebra(SR, -1, -1)
sage: q = a*i + b*j + c*k
sage: q
a*i + b*j + c*k
sage: q^2
-a^2 - b^2 - c^2
2013-01-21 20:37:05 -0500 asked a question How to do symbolic computation with quaternions

I need to do symbolic computations with quaternions. Ideally I'd like to enter something like

Q.<i,j,k> = QuaternionAlgebra(QQ,-1,-1)
a=var('a')
b=var('b')
c=var('c')
q = a*i+b*j+c*k

But it doesn't work : TypeError: unsupported operand parent(s) for '*': 'Symbolic Ring' and 'Quaternion Algebra (-1, -1) with base ring Rational Field'

Looks like SAGE doesn't know how to multiply a variable and a quaternion. Or should I specify the types of the variables ? How ?

Thanks for your help.