# 30.1 Quaternion algebras

Module: sage.algebras.quaternion_algebra

Quaternion algebras

Author: David Kohel, 2005-09

TESTS:

sage: A = QuaternionAlgebra(QQ, -1,-1, names=list('ijk'))
True
sage: i, j, k = A.gens()
True


Module-level Functions

 QuaternionAlgebra( K, a, b, [names=['i', 'j', 'k']], [denom=1])
Return the quaternion algebra over generated by , , and such that , , and .

INPUT:
K -- field
a -- element of K
b -- element of K
names -- list of three strings
denom -- (optional, default 1)


sage: A.<i,j,k> = QuaternionAlgebra(QQ, -1,-1)
sage: i^2
-1
sage: j^2
-1
sage: i*j
k
sage: j*i
-k
sage: (i + j + k)^2
-3
sage: A.ramified_primes()
[2]


 QuaternionAlgebraWithDiscriminants( D1, D2, T, [names=['i', 'j', 'k']], [M=2])
Return the quaternion algebra over the rationals generated by , , and where , , and are quadratic suborders of discriminants , , and , respectively. The traces of and are chosen in .

The integers , and must all be even or all odd, and , and must each be the discriminant of some quadratic order, i.e. nonsquare integers = 0, 1 (mod 4).

INPUT:
D1 -- Integer
D2 -- Integer
T  -- Integer
M -- Integer (default: 2)

OUTPUT:
A quaternion algebra.


sage: A = QuaternionAlgebraWithDiscriminants(-7,-47,1, names=('i','j','k'))
sage: print A
Quaternion algebra with generators (i, j, k) over Rational Field
sage: i, j, k = A.gens()
sage: i**2
-2 + i
sage: j**2
-12 + j
sage: k**2
-24 + k
sage: i.minimal_polynomial('x')
x^2 - x + 2
sage: j.minimal_polynomial('x')
x^2 - x + 12


 QuaternionAlgebraWithGramMatrix( K, gram, [names=i,j,k])
INPUT:
K -- base field
gram -- the Gram matrix
names -- names of the three generators.


sage: A.<i,j,k> = QuaternionAlgebra(QQ, -1,-1)
sage: g = A.gram_matrix(); g
[2 0 0 0]
[0 2 0 0]
[0 0 2 0]
[0 0 0 2]
sage: K.<i,j,k> = QuaternionAlgebraWithGramMatrix(QQ, g); K
Quaternion algebra with generators (i, j, k) over Rational Field


sage: R.<i,j,k> = QuaternionAlgebraWithGramMatrix(QQ, diagonal_matrix([8]*4))
sage: i^2, j^2, k^2
(-4, -4, -4)


 QuaternionAlgebraWithInnerProduct( K, norms, traces, [names=i,j,k])

 QuaternionAlgebra_fast( K, a, b, [names=ijk])

 fundamental_discriminant( D)
Return the discriminant of the quadratic extension , i.e. an integer d congruent to either 0 or 1, mod 4, and such that, at most, the only square dividing it is 4.

 ramified_primes( a, b)
Return a list of the finite primes ramifying in Q(a,b)

 ramified_primes_from_discs( D1, D2, T)

 sign( x)

Class: QuaternionAlgebra_faster

class QuaternionAlgebra_faster

Special Functions: __call__

Class: QuaternionAlgebra_generic

class QuaternionAlgebra_generic
 QuaternionAlgebra_generic( self, K, [basis_traces=None], [ramified_primes=None])

Functions: basis, discriminant, gen, gram_matrix, inner_product_matrix, is_commutative, is_division_algebra, is_exact, is_field, is_finite, is_integral_domain, is_noetherian, order, ramified_primes, random_element, vector_space

 discriminant( self)
Given a quaternion algebra A defined over the field of rational numbers, return the discriminant of A, i.e. the product of the ramified primes of A.

 gen( self, i)
The i-th generator of the quaternion algebra.

 gram_matrix( self)
The Gram matrix of the inner product determined by the norm.

 is_commutative( self)

sage: Q.<i,j,k> = QuaternionAlgebra(QQ, -3,-7)
sage: Q.is_commutative()
False


 is_division_algebra( self)
Return True if the quaternion algebra is a division algebra (i.e. a ring, not necessarily commutative, in which every nonzero element is invertible). So if this returns False, the quaternion algebra is isomorphic to the 2x2 matrix algebra.

At the moment, this is implemented only for finite fields.

sage: Q.<i,j,k> = QuaternionAlgebra(GF(5), -3, -7)
sage: Q.is_division_algebra()
False


 is_exact( self)
Return True if elements of this quaternion algebra are represented exactly, i.e. there is no precision loss when doing arithmetic. A quaternion algebra is exact if and only if its base field is exact.

sage: Q.<i,j,k> = QuaternionAlgebra(QQ, -3, -7)
sage: Q.is_exact()
True
sage: Q.<i,j,k> = QuaternionAlgebra(Qp(7), -3, -7)
sage: Q.is_exact()
False


 is_field( self)
Return False always, since all quaternion algebras are noncommutative and all fields are commutative.

sage: Q.<i,j,k> = QuaternionAlgebra(QQ, -3, -7)
sage: Q.is_field()
False


 is_finite( self)
Return True if the quaternion algebra is a finite ring, i.e. if and only if the base field is finite.

sage: Q.<i,j,k> = QuaternionAlgebra(QQ, -3, -7)
sage: Q.is_finite()
False
sage: Q.<i,j,k> = QuaternionAlgebra(GF(5), -3, -7)
sage: Q.is_finite()
True


 is_integral_domain( self)
Return False always, since all quaternion algebras are noncommutative and integral domains are commutative (in SAGE).

sage: Q.<i,j,k> = QuaternionAlgebra(QQ, -3, -7)
sage: Q.is_integral_domain()
False


 is_noetherian( self)
Return True always, since any quaternion algebra is a noetherian ring (because it's a finitely-generated module over a field, which is noetherian).

sage: Q.<i,j,k> = QuaternionAlgebra(QQ, -3, -7)
sage: Q.is_noetherian()
True


 order( self)
Return the number of elements of the quaternion algebra, or +Infinity if the algebra is not finite.

sage: Q.<i,j,k> = QuaternionAlgebra(QQ, -3, -7)
sage: Q.order()
+Infinity
sage: Q.<i,j,k> = QuaternionAlgebra(GF(5), -3, -7)
sage: Q.order()
20


Special Functions: __call__, __repr__