# Class Polynomials

Class polynomials are invariants of elliptic curves with complex multiplication by an imaginary quadratic order of discriminant $D$. As such the Hilbert class polynomials can be interpreted as defining a subscheme or divisor on the modular curve $X(1) \cong {\mathbb{P}}^1$, while the Weber variants define a subscheme of a modular curve of higher level.

## `HilbertClassPolynomial(D): RngIntElt -> RngUPolElt`

Given a negative discriminant $D$, returns the Hilbert class polynomial, defined as the minimal polynomial of $j(\tau)$, where ${\mathbb{Z}}[\tau]$ is an imaginary quadratic order of discriminant $D$.

## `WeberClassPolynomial(D): RngIntElt -> RngUPolElt, FldFunRatUElt`

Given a negative discriminant $D$ not congruent to $5$ modulo $8$, returns the Weber class polynomial, defined as the minimal polynomial of $f(\tau)$, where ${\mathbb{Z}}[\tau]$ is an imaginary quadratic order of discriminant $D$ and $f$ is a particular normalized Weber function generating the same class field as $j(\tau)$. The particular $f(\tau)$ used depends on whether $D$ is odd ($\equiv 1$ mod $8$) or even, in which case it also depends on $D/4$ mod $8$, as well as whether $3$ divides $D$ or not. A root $f(\tau)$ of the Weber class polynomial is an algebraic integer (a unit in most cases and always a unit outside of 2) generating the ring class field related to the corresponding root $j(\tau)$ of the Hilbert class polynomial by an expression $j(\tau) = F(f(\tau))$. Here $F$ is a rational function of the form $A(Bx^r+C)^3/x^r$ with $r|24$ and $A$,$B$,$C$ rational integers which are positive or negative powers of $2$. The function $F$ is also returned. For example, if $D \equiv 1$ mod $8$ then

$$
j(\tau) = {(f(\tau)^{24}-16)^3 \over f(\tau)^{24}},
$$

where ${\rm GCD}(D,3) = 1$, and

$$
j(\tau) = {(f(\tau)^8-16)^3 \over f(\tau)^8},
$$

if $3$ divides $D$ and $f(\tau)$ is a unit.

In fact, $f(\tau)$ can only be a non-unit when $4|D$ and $D/4 \equiv 0,4$ or $5$ mod $8$. For further details, consult Yui and Zagier [[Yui and Zagier, 1997](../../references.md#cite-yui-zagier)] for the case of odd $D$ and Schertz [[Schertz, 1976](../../references.md#cite-schertz)] for the case of even $D$.

## `WeberToHilbertClassPolynomial(f, D): RngUPolElt, RngIntElt -> RngUPolElt`

```magma
Al: MonStgElt                    Default: "Roots"
```

Given a negative discriminant $D$, and the corresponding Weber class polynomial $f$, returns the Hilbert class polynomial for $D$. The default algorithm, as specified by the `Al` parameter, is to compute complex approximations to the roots of the latter polynomial from approximations to the roots of the Weber polynomial and the rational function $F$ linking the two. The other method is algebraic and uses resultants and the function $F$ which was discussed in the description of the intrinsic `WeberClassPolynomial`.

## `Example: Standard class polynomials (ex-fbd8cf)`

Class polynomials are typically used for constructing elliptic curves with a known endomorphism ring or known number of points over some finite field. The Weber (and other) variants of the class polynomials were introduced as a means of obtaining class invariants – defining the $j$-invariant of curves with given CM discriminant – with much smaller coefficients. In this example we give the classical example of $D = -71$, where the

```magma
> HilbertClassPolynomial(-71);
x^7 + 313645809715*x^6 - 3091990138604570*x^5 + 98394038810047812049302*x^4
- 823534263439730779968091389*x^3 + 5138800366453976780323726329446*x^2 -
425319473946139603274605151187659*x + 737707086760731113357714241006081263
> WeberClassPolynomial(-71);
x^7 + x^6 - x^5 - x^4 - x^3 + x^2 + 2*x - 1

```

As indicated by the constant term -1, the roots of the WeberClassPolynomial are units in a particular ring class order.
