# Elliptic and Modular Invariants

Binary quadratic forms of negative discriminant describe positive definite lattices in the complex plane, with integral-valued inner product. As such, it is possible to apply modular and elliptic functions to the form, interpreting this as an element of the upper half plane.

## `Lattice(f): QuadBinElt -> Lat`

Given a binary quadratic form $f = ax^2 + bxy + cy^2$ of negative discriminant, returns the rank two lattice of $f$ having Gram matrix

$$
\left({\ a\ \ b/2\atop b/2\ \ c\ }\right).
$$

Note that the lattice $L$ is the half-integral lattice such that integral representations $f(x,y) = n$ are in bijection with vectors $(x,y)$ of norm $n$, which will be a rational number.

## `GramMatrix(f): QuadBinElt -> AlgMatElt`

Returns the Gram matrix of the binary quadratic form $f$, which need not be of negative discriminant. The matrix will be half-integral and defined over the rationals.

## `ThetaSeries(f, n): QuadBinElt, RngIntElt -> RngSerElt`

The integral theta series of the binary quadratic form $f$ to precision $n$.

## `RepresentationNumber(f, n): QuadBinElt, RngIntElt -> RngIntElt`

The $n$th representation number of the form $f$ of negative discriminant.

## `jInvariant(f): QuadBinElt -> RngSerElt`

For a binary quadratic form $f = ax^2 + bxy + cy^2$ with negative discriminant, return the $j$–invariant of $f$, equal to the $j$–invariant of $\tau = (-b + \sqrt{b^2 - 4ac})/2a$.

## `Eisenstein(k, f): RngIntElt, QuadBinElt -> RngSerElt`

Given a positive even integer $k = 2n$ and a binary quadratic form $f = ax^2 + bxy + cy^2$, return the value of the Eisenstein series $E_k(L)$ at the complex lattice $L = \langle a, (-b + \sqrt{b^2-4ac}) /2\rangle$.

## `WeierstrassSeries(z, f): RngSerElt, QuadBinElt -> RngSerElt`

Given a complex power series $z$ with positive valuation and a binary quadratic form $f = ax^2 + bxy + cy^2$, returns the $q$–expansion of the Weierstrass $\wp$-function at the complex lattice $L = \langle a, (-b + \sqrt{b^2 - 4ac} )/2\rangle$.

## `Example: Ell Mod (ex-f93e36)`

```magma
> Q := QuadraticForms(-163);
> f := PrimeForm(Q,41);
> CC<i> := ComplexField();
> PC<z> := LaurentSeriesRing(CC);
> x := WeierstrassSeries(z,f);
> y := -Derivative(x)/2;
> A := -Eisenstein(4,f)/48;
> B := Eisenstein(6,f)/864;
> Evaluate(y^2 - (x^3 + A*x + B),1/2);
1.384608660824596881000000000 E-26 - 1.305091481190174818000000000 E-26*i

```
