Ask Your Question

Gilles Falquet's profile - activity

2022-04-16 19:22:50 +0200 received badge  Taxonomist
2017-11-09 14:55:48 +0200 received badge  Student (source)
2014-06-29 06:56:27 +0200 received badge  Notable Question (source)
2014-06-29 06:56:27 +0200 received badge  Famous Question (source)
2014-06-29 06:56:27 +0200 received badge  Popular Question (source)
2013-01-22 17:40:02 +0200 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-22 17:40:02 +0200 received badge  Scholar (source)
2013-01-22 03:37:05 +0200 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.