Quaternion Algebras

AUTHORS:

  • Jon Bobber – 2009 rewrite
  • William Stein – 2009 rewrite

This code is partly based on Sage code by David Kohel from 2005.

TESTS:

We test pickles:

sage: Q.<i,j,k> = QuaternionAlgebra(QQ,-5,-2)
sage: Q == loads(dumps(Q))
True
sage.algebras.quatalg.quaternion_algebra.QuaternionAlgebra(arg0, arg1=None, arg2=None, names='i, j, k')

There are three input formats:

  • QuaternionAlgebra(a, b): quaternion algebra generated by i, j subject to i^2 = a, j^2 = b, j * i = -i * j.
  • QuaternionAlgebra(K, a, b): same as above but over a field K. Here, a and b are nonzero elements of a field (K) of characteristic not 2, and we set k = i * j.
  • QuaternionAlgebra(D): a rational quaternion algebra with discriminant D, where D > 1 is a squarefree integer.

EXAMPLES:

QuaternionAlgebra(a, b) - return quaternion algebra over the smallest field containing the nonzero elements a and b with generators i, j, k with i^2=a, j^2=b and j*i=-i*j:

sage: QuaternionAlgebra(-2,-3)
Quaternion Algebra (-2, -3) with base ring Rational Field
sage: QuaternionAlgebra(GF(5)(2), GF(5)(3))
Quaternion Algebra (2, 3) with base ring Finite Field of size 5
sage: QuaternionAlgebra(2, GF(5)(3))
Quaternion Algebra (2, 3) with base ring Finite Field of size 5
sage: QuaternionAlgebra(QQ[sqrt(2)](-1), -5)
Quaternion Algebra (-1, -5) with base ring Number Field in sqrt2 with defining polynomial x^2 - 2
sage: QuaternionAlgebra(sqrt(-1), sqrt(-3))
Quaternion Algebra (I, sqrt(-3)) with base ring Symbolic Ring
sage: QuaternionAlgebra(0,0)
...
ValueError: a and b must be nonzero
sage: QuaternionAlgebra(GF(2)(1),1)
...
ValueError: a and b must be elements of a field with characteristic not 2

QuaternionAlgebra(K, a, b) - return quaternion algebra over the field K with generators i, j, k with i^2=a, j^2=b and i*j=-j*i:

sage: QuaternionAlgebra(QQ, -7, -21)
Quaternion Algebra (-7, -21) with base ring Rational Field
sage: QuaternionAlgebra(QQ[sqrt(2)], -2,-3)
Quaternion Algebra (-2, -3) with base ring Number Field in sqrt2 with defining polynomial x^2 - 2

QuaternionAlgebra(D) - D is a squarefree integer; returns a rational quaternion algebra of discriminant D:

sage: QuaternionAlgebra(1)
Quaternion Algebra (-1, 1) with base ring Rational Field
sage: QuaternionAlgebra(2)
Quaternion Algebra (-1, -1) with base ring Rational Field
sage: QuaternionAlgebra(7)
Quaternion Algebra (-1, -7) with base ring Rational Field
sage: QuaternionAlgebra(2*3*5*7)
Quaternion Algebra (-22, 210) with base ring Rational Field

If the coefficients a and b in the definition of the quaternion algebra are not integral, then a slower generic type is used for arithmetic:

sage: type(QuaternionAlgebra(-1,-3).0)
<type 'sage.algebras.quatalg.quaternion_algebra_element.QuaternionAlgebraElement_rational_field'>
sage: type(QuaternionAlgebra(-1,-3/2).0)
<type 'sage.algebras.quatalg.quaternion_algebra_element.QuaternionAlgebraElement_generic'>

Make sure caching is sane:

sage: A = QuaternionAlgebra(2,3); A
Quaternion Algebra (2, 3) with base ring Rational Field
sage: B = QuaternionAlgebra(GF(5)(2),GF(5)(3)); B
Quaternion Algebra (2, 3) with base ring Finite Field of size 5
sage: A is QuaternionAlgebra(2,3)
True
sage: B is QuaternionAlgebra(GF(5)(2),GF(5)(3))
True
sage: Q = QuaternionAlgebra(2); Q
Quaternion Algebra (-1, -1) with base ring Rational Field
sage: Q is QuaternionAlgebra(QQ,-1,-1)
True
sage: Q is QuaternionAlgebra(-1,-1)
True
sage: Q.<ii,jj,kk> = QuaternionAlgebra(15); Q.variable_names()
('ii', 'jj', 'kk')
sage: QuaternionAlgebra(15).variable_names()
('i', 'j', 'k')
class sage.algebras.quatalg.quaternion_algebra.QuaternionAlgebra_ab(base_ring, a, b, names='i, j, k')

The quaternion algebra of the form (a, b/K), where i^2=a, j^2 = b, and j*i = -i*j. K is a field not of characteristic 2 and a, b are nonzero elements of K.

See QuaternionAlgebra for many more examples.

EXAMPLES:

sage: QuaternionAlgebra(QQ, -7, -21)  # indirect doctest
Quaternion Algebra (-7, -21) with base ring Rational Field
__cmp__(other)

Compare self and other.

EXAMPLES:

sage: cmp(QuaternionAlgebra(-1,-7), QuaternionAlgebra(-1,-7))
0
sage: cmp(QuaternionAlgebra(-1,-7), QuaternionAlgebra(-1,-5))
-1
sage: cmp(QuaternionAlgebra(-1,-7), QuaternionAlgebra(-1,-10))
1
__init__(base_ring, a, b, names='i, j, k')

Create the quaternion algebra with i^2 = a, j^2 = b, and i*j = -j*i = k.

INPUT:

  • base_ring - commutative ring
  • a, b - elements of base_ring
  • names - string (optional, default ‘i, j, k’) names of the generators

TESTS:

Test making quaternion elements (using the element constructor):

sage: Q.<i,j,k> = QuaternionAlgebra(QQ,-1,-2)
sage: a = Q(2/3); a
2/3
sage: type(a)
<type 'sage.algebras.quatalg.quaternion_algebra_element.QuaternionAlgebraElement_rational_field'>
sage: Q(a)
2/3
sage: Q([1,2,3,4])
1 + 2*i + 3*j + 4*k
sage: Q((1,2,3,4))
1 + 2*i + 3*j + 4*k
sage: Q(-3/5)
-3/5

The base ring must be a field:

sage: Q.<ii,jj,kk> = QuaternionAlgebra(ZZ,-5,-19)
...
TypeError: base ring of quaternion algebra must be a field
__reduce__()

Internal method used for pickling.

TESTS:

sage: QuaternionAlgebra(QQ,-1,-2).__reduce__()
(<function unpickle_QuaternionAlgebra_v0 at ...>, (Rational Field, -1, -2, ('i', 'j', 'k')))

Test uniqueness of parent:

sage: Q = QuaternionAlgebra(QQ,-1,-2)
sage: loads(dumps(Q)) is Q
True
_magma_init_(magma)

Return Magma version of this quaternion algebra.

EXAMPLES:

sage: Q = QuaternionAlgebra(-1,-1); Q
Quaternion Algebra (-1, -1) with base ring Rational Field
sage: Q._magma_init_(magma)                                  # optional - magma
'QuaternionAlgebra(_sage_[1],-1,-1)'
sage: A = magma(Q); A                                        # optional - magma
Quaternion Algebra with base ring Rational Field
sage: A.RamifiedPlaces()                                     # optional - magma
[
Ideal of Integer Ring generated by 2
]

A more complicated example involving a quaternion algebra over a number field:

sage: K.<a> = QQ[sqrt(2)]; Q = QuaternionAlgebra(K,-1,a); Q
Quaternion Algebra (-1, sqrt2) with base ring Number Field in sqrt2 with defining polynomial x^2 - 2
sage: magma(Q)                                              # optional - magma
Quaternion Algebra with base ring Number Field with defining polynomial x^2 - 2 over the Rational Field
sage: Q._magma_init_(magma)                                 # optional - magma
'QuaternionAlgebra(_sage_[...],(_sage_[...]![-1, 0]),(_sage_[...]![0, 1]))'
_repr_()

Print representation.

TESTS:

sage: Q.<i,j,k> = QuaternionAlgebra(QQ,-5,-2)
sage: type(Q)
<class 'sage.algebras.quatalg.quaternion_algebra.QuaternionAlgebra_ab'>
sage: Q._repr_()
'Quaternion Algebra (-5, -2) with base ring Rational Field'
sage: Q
Quaternion Algebra (-5, -2) with base ring Rational Field
sage: print Q
Quaternion Algebra (-5, -2) with base ring Rational Field
sage: str(Q)
'Quaternion Algebra (-5, -2) with base ring Rational Field'
discriminant()

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.

EXAMPLES:

sage: QuaternionAlgebra(210,-22).discriminant()
210
sage: QuaternionAlgebra(19).discriminant()
19

This raises a NotImplementedError if the base field is not the rational numbers:

sage: QuaternionAlgebra(QQ[sqrt(2)],3,19).discriminant()
...
NotImplementedError: base field must be rational numbers
gen(i=0)

Return the i^{th} generator of self.

INPUT:

  • i - integer (optional, default 0)

EXAMPLES:

sage: Q.<ii,jj,kk> = QuaternionAlgebra(QQ,-1,-2); Q
Quaternion Algebra (-1, -2) with base ring Rational Field
sage: Q.gen(0)
ii
sage: Q.gen(1)
jj
sage: Q.gen(2)
kk
sage: Q.gens()
[ii, jj, kk]
ideal(gens, left_order=None, right_order=None, check=True)

Return the quaternion ideal with given gens over \ZZ. Neither a left or right order structure need be specified.

INPUT:

  • gens – a list of elements of this quaternion order
  • check – bool (default: True); if False, then gens must 4-tuple that forms a Hermite basis for an ideal
  • left_order – a quaternion order or None
  • right_order – a quaternion order or None

EXAMPLES:

sage: R = QuaternionAlgebra(-11,-1)
sage: R.ideal([2*a for a in R.basis()])
Fractional ideal (2, 2*i, 2*j, 2*k)
inner_product_matrix()

Return the inner product matrix associated to self, i.e. the Gram matrix of the reduced norm as a quadratic form on self. The standard basis 1, i, j, k is orthogonal, so this matrix is just the diagonal matrix with diagonal entries 1, a, b, ab.

EXAMPLES:

sage: Q.<i,j,k> = QuaternionAlgebra(-5,-19)
sage: Q.inner_product_matrix()
[  2   0   0   0]
[  0  10   0   0]
[  0   0  38   0]
[  0   0   0 190]

sage: R.<a,b> = QQ[]; Q.<i,j,k> = QuaternionAlgebra(Frac(R),a,b)
sage: Q.inner_product_matrix()
[    2     0     0     0]
[    0  -2*a     0     0]
[    0     0  -2*b     0]
[    0     0     0 2*a*b]
invariants()

Return the structural invariants a, b of this quaternion algebra: self is generated by i, j subject to i^2 = a, j^2 = b and j*i = -i*j.

EXAMPLES:

sage: Q.<i,j,k> = QuaternionAlgebra(15)
sage: Q.invariants()
(-3, 5)
sage: i^2
-3
sage: j^2
5
maximal_order()

Return a maximal order in this quaternion algebra.

OUTPUT: an order in this quaternion algebra

EXAMPLES:

sage: QuaternionAlgebra(-1,-7).maximal_order()
Order of Quaternion Algebra (-1, -7) with base ring Rational Field with basis (1/2 + 1/2*j, 1/2*i + 1/2*k, j, k)
quaternion_order(basis, check=True)

Return the order of this quaternion order with given basis.

INPUT:

  • basis - list of 4 elements of self
  • check - bool (default: True)

EXAMPLES:

sage: Q.<i,j,k> = QuaternionAlgebra(-11,-1)
sage: Q.quaternion_order([1,i,j,k])
Order of Quaternion Algebra (-11, -1) with base ring Rational Field with basis (1, i, j, k)

We test out check=False:

sage: Q.quaternion_order([1,i,j,k], check=False)
Order of Quaternion Algebra (-11, -1) with base ring Rational Field with basis [1, i, j, k]
sage: Q.quaternion_order([i,j,k], check=False)
Order of Quaternion Algebra (-11, -1) with base ring Rational Field with basis [i, j, k]
ramified_primes()

Return the primes that ramify in this quaternion algebra. Currently only implemented over the rational numbers.

EXAMPLES:

sage: QuaternionAlgebra(QQ, -1, -1).ramified_primes()
[2]
class sage.algebras.quatalg.quaternion_algebra.QuaternionAlgebra_abstract
_repr_()

EXAMPLES:

sage: sage.algebras.quatalg.quaternion_algebra.QuaternionAlgebra_abstract(QQ)._repr_()
'Quaternion Algebra with base ring Rational Field'
basis()

Return the fixed basis of self, which is 1, i, j, k, where i, j, k are the generators of self.

EXAMPLES:

sage: Q.<i,j,k> = QuaternionAlgebra(QQ,-5,-2)
sage: Q.basis()
(1, i, j, k)

sage: Q.<xyz,abc,theta> = QuaternionAlgebra(GF(9,'a'),-5,-2)
sage: Q.basis()
(1, xyz, abc, theta)

The basis is cached:

sage: Q.basis() is Q.basis()
True
inner_product_matrix()

Return the inner product matrix associated to self, i.e. the Gram matrix of the reduced norm as a quadratic form on self. The standard basis 1, i, j, k is orthogonal, so this matrix is just the diagonal matrix with diagonal entries 2, 2a, 2b, 2ab.

EXAMPLES:

sage: Q.<i,j,k> = QuaternionAlgebra(-5,-19)
sage: Q.inner_product_matrix()
[  2   0   0   0]
[  0  10   0   0]
[  0   0  38   0]
[  0   0   0 190]
is_commutative()

Return False always, since all quaternion algebras are noncommutative.

EXAMPLES:

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

Return True if the quaternion algebra is a division algebra (i.e. every nonzero element in self is invertible), and False if the quaternion algebra is isomorphic to the 2x2 matrix algebra.

EXAMPLES:

sage: QuaternionAlgebra(QQ,-5,-2).is_division_algebra()
True
sage: QuaternionAlgebra(1).is_division_algebra()
False
sage: QuaternionAlgebra(2,9).is_division_algebra()
False
sage: QuaternionAlgebra(RR(2.),1).is_division_algebra()
...
NotImplementedError: base field must be rational numbers
is_exact()

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.

EXAMPLES:

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()

Return False always, since all quaternion algebras are noncommutative and all fields are commutative.

EXAMPLES:

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

Return True if the quaternion algebra is finite as a set.

Algorithm: A quaternion algebra is finite if and only if the base field is finite.

EXAMPLES:

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()

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

EXAMPLES:

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

Return True if the quaternion algebra is isomorphic to the 2x2 matrix ring, and False if self is a division algebra (i.e. every nonzero element in self is invertible).

EXAMPLES:

sage: QuaternionAlgebra(QQ,-5,-2).is_matrix_ring()
False
sage: QuaternionAlgebra(1).is_matrix_ring()
True
sage: QuaternionAlgebra(2,9).is_matrix_ring()
True
sage: QuaternionAlgebra(RR(2.),1).is_matrix_ring()
...
NotImplementedError: base field must be rational numbers
is_noetherian()

Return True always, since any quaternion algebra is a noetherian ring (because it is a finitely generated module over a field).

EXAMPLES:

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

Return the number of generators of the quaternion algebra as a K-vector space, not including 1. This value is always 3: the algebra is spanned by the standard basis 1, i, j, k.

EXAMPLES:

sage: Q.<i,j,k> = QuaternionAlgebra(QQ,-5,-2)
sage: Q.ngens()
3
sage: Q.gens()
[i, j, k]
order()

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

EXAMPLES:

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()
625
random_element(*args, **kwds)

Return a random element of this quaternion algebra.

The args and kwds are passed to the random_element method of the base ring.

EXAMPLES:

sage: QuaternionAlgebra(QQ[sqrt(2)],-3,7).random_element()
-4 + (-1/95*sqrt2 - 1/2)*i + (-12*sqrt2 + 1/2)*j + (1/2*sqrt2 - 1)*k
sage: QuaternionAlgebra(-3,19).random_element()
-1/4 + 2/3*i - 5/2*j
sage: QuaternionAlgebra(GF(17)(2),3).random_element()
11 - i + 4*j + 13*k

Specify the numerator and denominator bounds:

sage: QuaternionAlgebra(-3,19).random_element(10^6,10^6)
-61003/263835 + 222181/103881*i - 7314/2707*j + 458453/129132*k
vector_space()

Return the vector space associated to self with inner product given by the reduced norm.

EXAMPLES:

sage: QuaternionAlgebra(-3,19).vector_space()
Ambient quadratic space of dimension 4 over Rational Field
Inner product matrix:
[   2    0    0    0]
[   0    6    0    0]
[   0    0  -38    0]
[   0    0    0 -114]
class sage.algebras.quatalg.quaternion_algebra.QuaternionFractionalIdeal(ring, gens, coerce=True)
class sage.algebras.quatalg.quaternion_algebra.QuaternionFractionalIdeal_rational(basis, left_order=None, right_order=None, check=True)

A fractional ideal in a rational quaternion algebra.

__cmp__(right)

Compare this fractional quaternion ideal to right. If right is not a fractional quaternion ideal a TypeError is raised. If the fractional ideals are in different ambient quaternion algebras, then the quaternion algebras themselves are compared.

INPUT:

  • right - another fractional quaternion ideal

EXAMPLES:

sage: I = QuaternionAlgebra(-11,-1).maximal_order().unit_ideal()
sage: I == I                # indirect doctest
True
sage: I == 5
False
__init__(basis, left_order=None, right_order=None, check=True)

INPUT:

  • left_order – a quaternion order or None
  • right_order – a quaternion order or None
  • basis – tuple of length 4 of elements in of ambient quaternion algebra whose \ZZ-span is an ideal
  • check – bool (default: True); if False, do no type checking, and the input basis must be in Hermite form.

EXAMPLES:

sage: R = QuaternionAlgebra(-11,-1).maximal_order()
sage: R.right_ideal(R.basis())
Fractional ideal (1/2 + 1/2*j, 1/2*i + 1/2*k, j, k)
sage: R.right_ideal(tuple(R.basis()), check=False)
Fractional ideal (1/2 + 1/2*j, 1/2*i + 1/2*k, j, k)
__mul__(right)

Return the product of the fractional ideals self and right.

NOTE: We do not keep track of left or right order structure.

EXAMPLES:

sage: I = BrandtModule(3,5).right_ideals()[1]; I
Fractional ideal (2 + 6*j + 4*k, 2*i + 4*j + 34*k, 8*j + 32*k, 40*k)
sage: I*I
Fractional ideal (8 + 24*j + 16*k, 8*i + 16*j + 136*k, 32*j + 128*k, 160*k)
sage: I*I.conjugate()
Fractional ideal (16 + 16*j + 224*k, 8*i + 16*j + 136*k, 32*j + 128*k, 320*k)
sage: I.multiply_by_conjugate(I)
Fractional ideal (16 + 16*j + 224*k, 8*i + 16*j + 136*k, 32*j + 128*k, 320*k)
__repr__()

Return string representation of this quaternion fractional ideal.

EXAMPLES:

sage: I = BrandtModule(11).right_ideals()[1]
sage: type(I)
<class 'sage.algebras.quatalg.quaternion_algebra.QuaternionFractionalIdeal_rational'>
sage: I.__repr__()
'Fractional ideal (2 + 6*j + 4*k, 2*i + 4*j + 2*k, 8*j, 8*k)'
basis()

Return basis for this fractional ideal. The basis is in Hermite form.

OUTPUT: tuple

EXAMPLES:

sage: QuaternionAlgebra(-11,-1).maximal_order().unit_ideal().basis()
(1/2 + 1/2*j, 1/2*i + 1/2*k, j, k)
basis_matrix()

Return basis matrix M in Hermite normal form for self as a matrix with rational entries.

If Q is the ambient quaternion algebra, then the \ZZ-span of the rows of M viewed as linear combinations of Q.basis() = [1,i,j,k] is the fractional ideal self. Also, M * M.denominator() is an integer matrix in Hermite normal form.

OUTPUT: matrix over \QQ

EXAMPLES:

sage: QuaternionAlgebra(-11,-1).maximal_order().unit_ideal().basis_matrix()
[1/2   0 1/2   0]
[  0 1/2   0 1/2]
[  0   0   1   0]
[  0   0   0   1]
conjugate()

Return the ideal with generators the conjugates of the generators for self.

OUTPUT: a quaternionic fractional ideal

EXAMPLES:

sage: I = BrandtModule(3,5).right_ideals()[1]; I
Fractional ideal (2 + 6*j + 4*k, 2*i + 4*j + 34*k, 8*j + 32*k, 40*k)
sage: I.conjugate()
Fractional ideal (2 + 2*j + 28*k, 2*i + 4*j + 34*k, 8*j + 32*k, 40*k)
free_module()

Return the free module associated to this quaternionic fractional ideal, viewed as a submodule of Q.free_module(), where Q is the ambient quaternion algebra.

OUTPUT: free \ZZ-module of rank 4 embedded in an ambient \QQ^4.

EXAMPLES:

sage: QuaternionAlgebra(-11,-1).maximal_order().unit_ideal().basis_matrix()
[1/2   0 1/2   0]
[  0 1/2   0 1/2]
[  0   0   1   0]
[  0   0   0   1]
gens()

Return the generators for this ideal, which are the same as the \ZZ-basis for this ideal.

EXAMPLES:

sage: QuaternionAlgebra(-11,-1).maximal_order().unit_ideal().gens()
(1/2 + 1/2*j, 1/2*i + 1/2*k, j, k)
gram_matrix()

Return the Gram matrix of this fractional ideal.

OUTPUT: 4x4 matrix over \QQ.

EXAMPLES:

sage: I = BrandtModule(3,5).right_ideals()[1]; I
Fractional ideal (2 + 6*j + 4*k, 2*i + 4*j + 34*k, 8*j + 32*k, 40*k)
sage: I.gram_matrix()
[  640  1920  2112  1920]
[ 1920 14080 13440 16320]
[ 2112 13440 13056 15360]
[ 1920 16320 15360 19200]
is_equivalent(I, J, B=10)

Return True if I and J are equivalent as right ideals.

INPUT:

  • I – a fractional quaternion ideal (self)
  • J – a fractional quaternion ideal with same order as I
  • B – a bound to compute and compare theta series before doing the full equivalence test

OUTPUT: bool

EXAMPLES:

sage: R = BrandtModule(3,5).right_ideals(); len(R)
2
sage: R[0].is_equivalent(R[1])
False
sage: R[0].is_equivalent(R[0])
True
sage: OO = R[0].quaternion_order()
sage: S = OO.right_ideal([3*a for a in R[0].basis()])
sage: R[0].is_equivalent(S)
True
left_order()

Return the left order associated to this fractional ideal.

OUTPUT: an order in a quaternion algebra

EXAMPLES:

sage: B = BrandtModule(11)
sage: R = B.maximal_order()
sage: I = R.unit_ideal()
sage: I.left_order()
Order of Quaternion Algebra (-1, -11) with base ring Rational Field with basis (1/2 + 1/2*j, 1/2*i + 1/2*k, j, k)
multiply_by_conjugate(J)

Return product of self and the conjugate Jbar of J.

INPUT:

  • J – a quaternion ideal.

OUTPUT: a quaternionic fractional ideal.

EXAMPLES:

sage: R = BrandtModule(3,5).right_ideals()
sage: R[0].multiply_by_conjugate(R[1])
Fractional ideal (8 + 8*j + 112*k, 8*i + 16*j + 136*k, 32*j + 128*k, 160*k)
sage: R[0]*R[1].conjugate()
Fractional ideal (8 + 8*j + 112*k, 8*i + 16*j + 136*k, 32*j + 128*k, 160*k)
norm()

Return the norm of this fractional ideal.

OUTPUT: rational number

EXAMPLES:

sage: C = BrandtModule(37).right_ideals()
sage: [I.norm() for I in C]
[32, 64, 64]
quadratic_form()

Return the normalized quadratic form associated to this quaternion ideal.

OUTPUT: quadratic form

EXAMPLES:

sage: I = BrandtModule(11).right_ideals()[1]
sage: Q = I.quadratic_form(); Q
Quadratic form in 4 variables over Rational Field with coefficients: 
[ 18 22 33 22 ]
[ * 7 22 11 ]
[ * * 22 0 ]
[ * * * 22 ]
sage: Q.theta_series(10)
1 + 12*q^2 + 12*q^3 + 12*q^4 + 12*q^5 + 24*q^6 + 24*q^7 + 36*q^8 + 36*q^9 + O(q^10)
sage: I.theta_series(10)
1 + 12*q^2 + 12*q^3 + 12*q^4 + 12*q^5 + 24*q^6 + 24*q^7 + 36*q^8 + 36*q^9 + O(q^10)
quaternion_algebra()

Return the ambient quaternion algebra that contains this fractional ideal.

OUTPUT: a quaternion algebra

EXAMPLES:

sage: I = BrandtModule(3,5).right_ideals()[1]; I
Fractional ideal (2 + 6*j + 4*k, 2*i + 4*j + 34*k, 8*j + 32*k, 40*k)
sage: I.quaternion_algebra()
Quaternion Algebra (-1, -3) with base ring Rational Field
quaternion_order()

Return the order for which this ideal is a left or right fractional ideal. If this ideal has both a left and right ideal structure, then the left order is returned. If it has neither structure, then an error is raised.

OUTPUT: QuaternionOrder

EXAMPLES:

sage: R = QuaternionAlgebra(-11,-1).maximal_order()
sage: R.unit_ideal().quaternion_order() is R
True
right_order()

Return the right order associated to this fractional ideal.

OUTPUT: an order in a quaternion algebra

EXAMPLES:

sage: I = BrandtModule(389).right_ideals()[1]; I
Fractional ideal (2 + 6*j + 2*k, i + 2*j + k, 8*j, 8*k)
sage: I.right_order()
Order of Quaternion Algebra (-2, -389) with base ring Rational Field with basis (1/2 + 1/2*j + 1/2*k, 1/4*i + 1/2*j + 1/4*k, j, k)
sage: I.left_order()
...
ValueError: ideal not equipped with left order structure
ring()

Return ring that this is a fractional ideal for.

EXAMPLES:

sage: R = QuaternionAlgebra(-11,-1).maximal_order()
sage: R.unit_ideal().ring() is R
True
theta_series(B, var='q')

Return normalized theta series of self, as a power series over \ZZ in the variable var, which is ‘q’ by default.

The normalized theta series is by definition

\theta_I(q)=\sum_{x \in I} q^{\frac{N(x)}{N(I)}}

INPUT:

  • B – positive integer
  • var – string (default: ‘q’)

OUTPUT: power series

EXAMPLES:

sage: I = BrandtModule(11).right_ideals()[1]; I
Fractional ideal (2 + 6*j + 4*k, 2*i + 4*j + 2*k, 8*j, 8*k)
sage: I.norm()
64
sage: I.theta_series(5)
1 + 12*q^2 + 12*q^3 + 12*q^4 + O(q^5)
sage: I.theta_series(5,'T')
1 + 12*T^2 + 12*T^3 + 12*T^4 + O(T^5)
sage: I.theta_series(3)
1 + 12*q^2 + O(q^3)
theta_series_vector(B)

Return theta series coefficients of self, as a vector of B integers.

INPUT:

  • B – positive integer

OUTPUT: vector over \ZZ with B entries

EXAMPLES:

sage: I = BrandtModule(37).right_ideals()[1]; I
Fractional ideal (2 + 6*j + 2*k, i + 2*j + k, 8*j, 8*k)
sage: I.theta_series_vector(5)
(1, 0, 2, 2, 6)
sage: I.theta_series_vector(10)
(1, 0, 2, 2, 6, 4, 8, 6, 10, 10)
sage: I.theta_series_vector(5)
(1, 0, 2, 2, 6)
class sage.algebras.quatalg.quaternion_algebra.QuaternionOrder(A, basis, check=True)

An order in a quaternion algebra.

EXAMPLES:

sage: QuaternionAlgebra(-1,-7).maximal_order()
Order of Quaternion Algebra (-1, -7) with base ring Rational Field with basis (1/2 + 1/2*j, 1/2*i + 1/2*k, j, k)
sage: type(QuaternionAlgebra(-1,-7).maximal_order())
<class 'sage.algebras.quatalg.quaternion_algebra.QuaternionOrder'>
__cmp__(R)

Compare orders self and other. Two orders are equal if they have the same basis and are in the same quaternion algebra.

EXAMPLES:

sage: R = QuaternionAlgebra(-11,-1).maximal_order()
sage: R == R                       # indirect doctest
True
sage: R == QuaternionAlgebra(-13,-1).maximal_order()
False
sage: R==5
False
__init__(A, basis, check=True)

INPUT:

  • A - a quaternion algebra
  • basis - list of 4 integral quaternions in A
  • check - whether to do type and other consistency checks
** TODO – NOTE: We do not currently check that basis is
closed under multiplication!! **

EXAMPLES:

sage: A.<i,j,k> = QuaternionAlgebra(-3,-5)
sage: sage.algebras.quatalg.quaternion_algebra.QuaternionOrder(A, [1,i,j,k])
Order of Quaternion Algebra (-3, -5) with base ring Rational Field with basis (1, i, j, k)
sage: R = sage.algebras.quatalg.quaternion_algebra.QuaternionOrder(A, [1,2*i,2*j,2*k]); R
Order of Quaternion Algebra (-3, -5) with base ring Rational Field with basis (1, 2*i, 2*j, 2*k)
sage: type(R)
<class 'sage.algebras.quatalg.quaternion_algebra.QuaternionOrder'>
_repr_()

Return string representation of this order.

EXAMPLES:

sage: QuaternionAlgebra(-11,-1).maximal_order()._repr_()
'Order of Quaternion Algebra (-11, -1) with base ring Rational Field with basis (1/2 + 1/2*j, 1/2*i + 1/2*k, j, k)'
sage: QuaternionAlgebra(-11,-1).maximal_order()
Order of Quaternion Algebra (-11, -1) with base ring Rational Field with basis (1/2 + 1/2*j, 1/2*i + 1/2*k, j, k)
basis()

Return fix choice of basis for this quaternion order.

EXAMPLES:

sage: QuaternionAlgebra(-11,-1).maximal_order().basis()
(1/2 + 1/2*j, 1/2*i + 1/2*k, j, k)
discriminant()

Return the discriminant of this order, which we define as \sqrt{ det ( Tr(e_i \bar{e_j} ) ) }, where \{e_i\} is the basis of the order.

OUTPUT: rational number

EXAMPLES:

sage: QuaternionAlgebra(-11,-1).maximal_order().discriminant()
11
sage: S = BrandtModule(11,5).order_of_level_N()
sage: S.discriminant()
55
sage: type(S.discriminant())
<type 'sage.rings.rational.Rational'>
free_module()

Return the free \ZZ-module that corresponds to this order inside the vector space corresponding to the ambient quaternion algebra.

OUTPUT: a free \ZZ-module of rank 4

EXAMPLES:

sage: R = QuaternionAlgebra(-11,-1).maximal_order()
sage: R.basis()
(1/2 + 1/2*j, 1/2*i + 1/2*k, j, k)
sage: R.free_module()
Free module of degree 4 and rank 4 over Integer Ring
Echelon basis matrix:
[1/2   0 1/2   0]
[  0 1/2   0 1/2]
[  0   0   1   0]
[  0   0   0   1]
gen(n)

Return the n-th generator.

INPUT:

  • n - an integer between 0 and 3, inclusive.

EXAMPLES:

sage: R = QuaternionAlgebra(-11,-1).maximal_order(); R
Order of Quaternion Algebra (-11, -1) with base ring Rational Field with basis (1/2 + 1/2*j, 1/2*i + 1/2*k, j, k)
sage: R.gen(0)
1/2 + 1/2*j
sage: R.gen(1)
1/2*i + 1/2*k
sage: R.gen(2)
j
sage: R.gen(3)
k
gens()

Return generators for self.

EXAMPLES:

sage: QuaternionAlgebra(-1,-7).maximal_order().gens()
(1/2 + 1/2*j, 1/2*i + 1/2*k, j, k)
intersection(other)

Return the intersection of this order with other.

INPUT:

  • other - a quaternion order in the same ambient quaternion algebra

OUTPUT: a quaternion order

EXAMPLES:

sage: R = QuaternionAlgebra(-11,-1).maximal_order()
sage: R.intersection(R)
Order of Quaternion Algebra (-11, -1) with base ring Rational Field with basis (1/2 + 1/2*j, 1/2*i + 1/2*k, j, k)

We intersect various orders in the quaternion algebra ramified at 11:

sage: B = BrandtModule(11,3)
sage: R = B.maximal_order(); S = B.order_of_level_N()
sage: R.intersection(S)
Order of Quaternion Algebra (-1, -11) with base ring Rational Field with basis (1/2 + 1/2*j, 1/2*i + 5/2*k, j, 3*k)
sage: R.intersection(S) == S
True
sage: B = BrandtModule(11,5)
sage: T = B.order_of_level_N()
sage: S.intersection(T)
Order of Quaternion Algebra (-1, -11) with base ring Rational Field with basis (1/2 + 1/2*j, 1/2*i + 23/2*k, j, 15*k)
left_ideal(gens, check=True)

Return the ideal with given gens over \ZZ.

INPUT:

  • gens – a list of elements of this quaternion order
  • check – bool (default: True); if False, then gens must 4-tuple that forms a Hermite basis for an ideal

EXAMPLES:

sage: R = QuaternionAlgebra(-11,-1).maximal_order()
sage: R.left_ideal([2*a for a in R.basis()])
Fractional ideal (1 + j, i + k, 2*j, 2*k)
ngens()

Return the number of generators (which is 4).

EXAMPLES:

sage: QuaternionAlgebra(-1,-7).maximal_order().ngens()
4
quaternion_algebra()

Return ambient quaternion algebra that contains this quaternion order.

EXAMPLES:

sage: QuaternionAlgebra(-11,-1).maximal_order().quaternion_algebra()
Quaternion Algebra (-11, -1) with base ring Rational Field
random_element(*args, **kwds)

Return a random element of this order.

The args and kwds are passed to the random_element method of the integer ring, and we return an element of the form

ae_1 + be_2 + ce_3 + de_4

where e_1, ..., e_4 are the basis of this order and a, b, c, d are random integers.

EXAMPLES:

sage: QuaternionAlgebra(-11,-1).maximal_order().random_element()
-4 + i - 4*j + k
sage: QuaternionAlgebra(-11,-1).maximal_order().random_element(-10,10)
-9/2 - 7/2*i - 7/2*j + 3/2*k
right_ideal(gens, check=True)

Return the ideal with given gens over \ZZ.

INPUT:

  • gens – a list of elements of this quaternion order
  • check – bool (default: True); if False, then gens must 4-tuple that forms a Hermite basis for an ideal

EXAMPLES:

sage: R = QuaternionAlgebra(-11,-1).maximal_order()
sage: R.right_ideal([2*a for a in R.basis()])
Fractional ideal (1 + j, i + k, 2*j, 2*k)
unit_ideal()

Return the unit ideal in this quaternion order.

EXAMPLES:

sage: R = QuaternionAlgebra(-11,-1).maximal_order()
sage: I = R.unit_ideal(); I
Fractional ideal (1/2 + 1/2*j, 1/2*i + 1/2*k, j, k)
sage.algebras.quatalg.quaternion_algebra.basis_for_quaternion_lattice(gens)

Return a basis for the \ZZ-lattice in a quaternion algebra spanned by the given gens.

INPUT:

  • gens – list of elements of a single quaternion algebra

EXAMPLES:

sage: A.<i,j,k> = QuaternionAlgebra(-1,-7)
sage: sage.algebras.quatalg.quaternion_algebra.basis_for_quaternion_lattice([i+j, i-j, 2*k, A(1/3)])
[1/3, i + j, 2*j, 2*k]
sage.algebras.quatalg.quaternion_algebra.is_QuaternionAlgebra(A)

Return True if A is of the QuaternionAlgebra data type.

EXAMPLES:

sage: sage.algebras.quatalg.quaternion_algebra.is_QuaternionAlgebra(QuaternionAlgebra(QQ,-1,-1))
True
sage: sage.algebras.quatalg.quaternion_algebra.is_QuaternionAlgebra(ZZ)
False
sage.algebras.quatalg.quaternion_algebra.unpickle_QuaternionAlgebra_v0(*key)

The 0th version of pickling for quaternion algebras.

EXAMPLES:

sage: Q = QuaternionAlgebra(-5,-19)
sage: f, t = Q.__reduce__()
sage: sage.algebras.quatalg.quaternion_algebra.unpickle_QuaternionAlgebra_v0(*t)
Quaternion Algebra (-5, -19) with base ring Rational Field
sage: loads(dumps(Q)) == Q
True
sage: loads(dumps(Q)) is Q
True

Previous topic

Quaternion Algebras

Next topic

Elements of Quaternion Algebras

This Page