# Enumeration of Totally Real Fields¶

AUTHORS:

• Craig Citro and John Voight (2007-11-04): Type checking and other polishing.
• John Voight (2007-10-09): Improvements: Smyth bound, Lagrange multipliers for b.
• John Voight (2007-09-19): Various optimization tweaks.
• John Voight (2007-09-01): Initial version.
sage.rings.number_field.totallyreal_data.easy_is_irreducible_py(f)

Used solely for testing easy_is_irreducible.

EXAMPLES:

sage: sage.rings.number_field.totallyreal_data.easy_is_irreducible_py(pari('x^2+1'))
1
sage: sage.rings.number_field.totallyreal_data.easy_is_irreducible_py(pari('x^2-1'))
0

sage.rings.number_field.totallyreal_data.hermite_constant(n)

This function returns the nth Hermite constant

The nth Hermite constant (typically denoted $$\gamma_n$$), is defined to be

$\max_L \min_{0 \neq x \in L} ||x||^2$

where $$L$$ runs over all lattices of dimension $$n$$ and determinant $$1$$.

For $$n \leq 8$$ it returns the exact value of $$\gamma_n$$, and for $$n > 9$$ it returns an upper bound on $$\gamma_n$$.

INPUT:

• n – integer

OUTPUT:

• (an upper bound for) the Hermite constant gamma_n

EXAMPLES:

sage: hermite_constant(1) # trivial one-dimensional lattice
1.0
sage: hermite_constant(2) # Eisenstein lattice
1.1547005383792515
sage: 2/sqrt(3.)
1.15470053837925
sage: hermite_constant(8) # E_8
2.0


Note

The upper bounds used can be found in [CS1999] and [CE2003].

AUTHORS:

• John Voight (2007-09-03)
sage.rings.number_field.totallyreal_data.int_has_small_square_divisor(d)

Returns the largest a such that a^2 divides d and a has prime divisors < 200.

EXAMPLES:

sage: from sage.rings.number_field.totallyreal_data import int_has_small_square_divisor
sage: int_has_small_square_divisor(500)
100
sage: is_prime(691)
True
sage: int_has_small_square_divisor(691)
1
sage: int_has_small_square_divisor(691^2)
1

sage.rings.number_field.totallyreal_data.lagrange_degree_3(n, an1, an2, an3)

Private function. Solves the equations which arise in the Lagrange multiplier for degree 3: for each 1 <= r <= n-2, we solve

r*x^i + (n-1-r)*y^i + z^i = s_i (i = 1,2,3)

where the s_i are the power sums determined by the coefficients a. We output the largest value of z which occurs. We use a precomputed elimination ideal.

EXAMPLES:

sage: ls = sage.rings.number_field.totallyreal_data.lagrange_degree_3(3,0,1,2)
sage: [RealField(10)(x) for x in ls]
[-1.0, -1.0]
sage: sage.rings.number_field.totallyreal_data.lagrange_degree_3(3,6,1,2) # random
[-5.8878, -5.8878]

class sage.rings.number_field.totallyreal_data.tr_data

Bases: object

This class encodes the data used in the enumeration of totally real fields.

We do not give a complete description here. For more information, see the attached functions; all of these are used internally by the functions in totallyreal.py, so see that file for examples and further documentation.

increment(verbose=False, haltk=0, phc=False)

This function ‘increments’ the totally real data to the next value which satisfies the bounds essentially given by Rolle’s theorem, and returns the next polynomial as a sequence of integers.

The default or usual case just increments the constant coefficient; then inductively, if this is outside of the bounds we increment the next higher coefficient, and so on.

If there are no more coefficients to be had, returns the zero polynomial.

INPUT:

• verbose – boolean to print verbosely computational details
• haltk – integer, the level at which to halt the inductive coefficient bounds
• phc – boolean, if PHCPACK is available, use it when k == n-5 to compute an improved Lagrange multiplier bound

OUTPUT:

The next polynomial, as a sequence of integers

EXAMPLES:

sage: T = sage.rings.number_field.totallyreal_data.tr_data(2,100)
sage: T.increment()
[-24, -1, 1]
sage: for i in range(19): _ = T.increment()
sage: T.increment()
[-3, -1, 1]
sage: T.increment()
[-25, 0, 1]

printa()

Print relevant data for self.

EXAMPLES:

sage: T = sage.rings.number_field.totallyreal_data.tr_data(3,2^10)
sage: T.printa()
k = 1
a = [0, 0, -1, 1]
amax = [0, 0, 0, 1]
beta =  [...]
gnk =  [...]