On 06/23/2011 01:25 PM, Emmanuel wrote:
I want to perform symboli algebra in a quaternion algebra. The
following does not work because I have not been able to assumle that
my variables are rationals. How can I make this assumption?
Q.<i,j,k>=QuaternionAlgebra(QQ,-1,-1)
a,b,c,d = var('a,b,c,d')
q=a+b*i+c*j+d*k;
I'm not familiar with symbolic computations but I'd suggest one of these
approaches:
1) use the symbolic ring as base ring:
sage: a,b,c,d = var("a,b,c,d")
sage: Q.<i,j,k> = QuaternionAlgebra(a.parent(),-1,-1)
sage: (a+b*i+c*j+d*k)**2
a^2 - b^2 - c^2 - d^2 + (-(c - d)*(c + d) + (a + b)^2 - a^2 - b^2 + c^2
- d^2)*i + 2*a*c*j + ((c + d)*(a - b) + (c + d)*(a + b) - 2*a*c)*k
Here I'm stuck because I don't know how to expand this any further... So
maybe this is better:
2) work in the polynomial ring:
sage: Q.<i,j,k> = QuaternionAlgebra(FractionField(R),-1,-1)
sage: R.<a,b,c,d> = PolynomialRing(QQ,"a,b,c,d")
sage: Q.<i,j,k> = QuaternionAlgebra(FractionField(R),-1,-1)
sage: (a+b*i+c*j+d*k)**2
a^2 - b^2 - c^2 - d^2 + 2*a*b*i + 2*a*c*j + 2*a*d*k
Solution 2) might be better suited to your needs because a,b,c,d are
implicitely "known" to be rational.
HTH,
Christian
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org