Function: polclass
Section: polynomials
C-Name: polclass
Prototype: GD0,L,Dn
Help: polclass(D,{inv=0},{x='x}): return a polynomial generating the
 Hilbert class field of Q(sqrt(D)) for the discriminant D<0.
Doc:
 Return a polynomial in $\Z[x]$ generating the Hilbert class field for the
 imaginary quadratic discriminant $D$.  If $inv$ is 0 (the default),
 use the modular $j$-function and return the classical Hilbert polynomial,
 otherwise use a class invariant. The following invariants correspond to
 the different values of $inv$, where $f$ denotes Weber's function
 \kbd{weber}, and $w_{p,q}$ the double eta quotient given by
 $w_{p,q} = \dfrac{ \eta(x/p)\*\eta(x/q) }{ \eta(x)\*\eta(x/{pq}) }$

 The invariants $w_{p,q}$ are not allowed unless they satisfy the following
 technical conditions ensuring they do generate the Hilbert class
 field and not a strict subfield:

 \item if $p\neq q$, we need them both noninert, prime to the conductor of
 $\Z[\sqrt{D}]$. Let $P, Q$ be prime ideals  above $p$ and $q$; if both are
 unramified, we further require that $P^{\pm 1} Q^{\pm 1}$ be all distinct in
 the class group of $\Z[\sqrt{D}]$; if both are ramified, we require that $PQ
 \neq 1$ in the class group.

 \item if $p = q$, we want it split and prime to the conductor and
 the prime ideal above it must have order $\neq 1, 2, 4$ in the class group.

 \noindent Invariants are allowed under the additional conditions on $D$
 listed below.

 \item 0 : $j$

 \item 1 : $f$, $D = 1 \mod 8$ and $D = 1,2 \mod 3$;

 \item 2 : $f^{2}$, $D = 1 \mod 8$ and $D = 1,2 \mod 3$;

 \item 3 : $f^{3}$, $D = 1 \mod 8$;

 \item 4 : $f^{4}$, $D = 1 \mod 8$ and $D = 1,2 \mod 3$;

 \item 5 : $\gamma_{2}= j^{1/3}$, $D = 1,2 \mod 3$;

 \item 6 : $w_{2,3}$, $D = 1 \mod 8$ and $D = 1,2 \mod 3$;

 \item 8 : $f^{8}$, $D = 1 \mod 8$ and $D = 1,2 \mod 3$;

 \item 9 : $w_{3,3}$, $D = 1 \mod 2$ and $D = 1,2 \mod 3$;

 \item 10: $w_{2,5}$, $D \neq 60 \mod 80$ and $D = 1,2 \mod 3$;

 \item 14: $w_{2,7}$, $D = 1 \mod 8$;

 \item 15: $w_{3,5}$, $D = 1,2 \mod 3$;

 \item 21: $w_{3,7}$, $D = 1 \mod 2$ and $21$ does not divide $D$

 \item 23: $w_{2,3}^{2}$, $D = 1,2 \mod 3$;

 \item 24: $w_{2,5}^{2}$, $D = 1,2 \mod 3$;

 \item 26: $w_{2,13}$, $D \neq 156 \mod 208$;

 \item 27: $w_{2,7}^{2}$, $D\neq 28 \mod 112$;

 \item 28: $w_{3,3}^{2}$, $D = 1,2 \mod 3$;

 \item 35: $w_{5,7}$, $D = 1,2 \mod 3$;

 \item 39: $w_{3,13}$, $D = 1 \mod 2$ and $D = 1,2 \mod 3$;

 The algorithm for computing the polynomial does not use the floating point
 approach, which would evaluate a precise modular function in a precise
 complex argument. Instead, it relies on a faster Chinese remainder based
 approach modulo small primes, in which the class invariant is only defined
 algebraically by the modular polynomial relating the modular function to $j$.
 So in fact, any of the several roots of the modular polynomial may actually
 be the class invariant, and more precise assertions cannot be made.

 For instance, while \kbd{polclass(D)} returns the minimal polynomial of
 $j(\tau)$ with $\tau$ (any) quadratic integer for the discriminant $D$,
 the polynomial returned by \kbd{polclass(D, 5)} can be the minimal polynomial
 of any of $\gamma_{2} (\tau)$, $\zeta_{3} \gamma_{2} (\tau)$ or
 $\zeta_{3}^{2} \gamma_{2} (\tau)$, the three roots of the modular polynomial
 $j = \gamma_{2}^{3}$, in which $j$ has been specialised to $j (\tau)$.

 The modular polynomial is given by
 $j = {(f^{24}-16)^{3} \over f^{24}}$ for Weber's function $f$.

 For the double eta quotients of level $N = p q$, all functions are covered
 such that the modular curve $X_{0}^{+} (N)$, the function field of which is
 generated by the functions invariant under $\Gamma^{0} (N)$ and the
 Fricke--Atkin--Lehner involution, is of genus $0$ with function field
 generated by (a power of) the double eta quotient $w$.
 This ensures that the full Hilbert class field (and not a proper subfield)
 is generated by class invariants from these double eta quotients.
 Then the modular polynomial is of degree $2$ in $j$, and
 of degree $\psi (N) = (p+1)(q+1)$ in $w$.

 \bprog
 ? polclass(-163)
 %1 = x + 262537412640768000
 ? polclass(-51, , 'z)
 %2 = z^2 + 5541101568*z + 6262062317568
 ? polclass(-151,1)
 x^7 - x^6 + x^5 + 3*x^3 - x^2 + 3*x + 1
 @eprog

Function: _polclass_worker
Section: programming/internals
C-Name: polclass_worker
Prototype: GGG
Help: used by polclass
Doc: used by polclass
