# Modular Curves of Given Level and Genus

The intrinsics described in this section are designed to construct curves $C$ over **Q** of genus at least 2 which are images of $X_1(N)$ (or $X_0(N)$) under a morphism $\pi: X_1(N) \rightarrow C$ defined over **Q**. Such curves will be referred to as modular curves. The code uses some of the ideas and methods from the papers [[Gonzalez-Jimenez and Gonzalez, 2003](../../references.md#cite-gjg03)], [[Baker *et al.*, 2005](../../references.md#cite-bgjgp05)] and [[Gonzalez-Jimenez and Oyono, 2010](../../references.md#cite-gjo10)].

The morphism $\pi$ induces an isogeny $\pi^*$ from the Jacobian of $C$, $Jac(C)$ onto a **Q**-rational abelian subvariety $B$ of $J_1(N)$ (or $J_0(N)$), i.e. a **Q**-rational modular abelian variety of dimension $g$, the genus of $C$. The space of holomorphic differentials of $Jac(C)$ identified with those of $C$ pull back under $\pi^*$ to the holomorphic differentials of $B$ which can be identified with the space of weight 2 cusp forms associated to $B$.

If $f_1,\ldots,f_g$ is a **Q**-basis of this space, then these forms will satisfy the canonical relations for some canonical embedding of $C$ in the non-hyperelliptic case. Conversely, if a basis of the space of cusp forms for a **Q**-rational modular abelian variety $B$ of dimension $g$ satisfies the polynomial relations defining a canonical curve $C$ of genus $g$, then $C$ is a modular curve, but the pullback of the space of holomorphic differentials under the obvious map $\pi: z\mapsto [f_1(z):f_2(z):\ldots : f_g(z)]$ from $X_1(N)$ to $C$ may NOT give the space of differentials $\langle f_1,\ldots,f_g\rangle$ and $Jac(C)$ may be isogenous to a different modular abelian subvariety of $J_1(N)$ to $B$.

In the hyperelliptic case, criteria for the pullback of the differentials of the curve $C$ to give precisely the space of forms of a particular modular abelian variety $B$ are given in [[Gonzalez-Jimenez and Gonzalez, 2003](../../references.md#cite-gjg03)] and [[Baker *et al.*, 2005](../../references.md#cite-bgjgp05)], provided that $B$ lies in the new part of $J_1(N)$. In the genus 3 non-hyperelliptic case, a simple explicit criterion for $Jac(C)$ to pull back to $B$ is given in [[Gonzalez-Jimenez and Oyono, 2010](../../references.md#cite-gjo10)].

Modular curves $C$ such that the pullback $\pi^*(Jac(C))$ lies in the *new* part of $J_1(N)$ (or $J_0(N)$) are referred to as *new* modular curves.

Intrinsics are provided that determine all of the new modular hyperelliptic curves or all of the new modular genus 3 non-hyperelliptic curves of $X_1(N)$ (or $X_0(N)$) for a given level $N$. There are also intrinsics that determine whether a given modular abelian subvariety $B$ corresponds to a hyperelliptic or genus 3 non-hyperelliptic curve $C$ and give the equations of $C$ (as a Weierstrass model or canonical model, respectively) in the affirmative case.

In future releases it is planned to add intrinsics to deal with non-hyperelliptic modular curves of genus greater than 3 and to add more functionality to cover non-new cases.

## `SetVerbose("ModularCurve", v): MonStgElt, RngIntElt`

Set the printing level for verbose output for the following intrinsics. Currently the legal values for $v$ are `true`, `false`, $0$, $1$, $2$ (`false` is the same as $0$, and `true` is the same as $1$).

## `NewModularHyperellipticCurves(N, g): RngIntElt, RngIntElt -> SeqEnum`

```magma
check: BoolElt                      Default: false
prec : RngIntElt                    Default: 100
gamma: RngIntElt                    Default: 1
```

For level $N$, this function returns a list of all hyperelliptic curves of genus $g \ge 2$ which are new modular curves for $X_1(N)$ if parameter `gamma` equals $1$ (the default) or $X_0(N)$, if `gamma` equals $0$.

A hyperelliptic curve is returned as a univariate polynomial $f(x)$ such that $y^2=f(x)$ is a Weierstrass equation of the actual curve.

The parameter `prec` (default 100) is the precision to which modular forms are expanded in the computations. If parameter `check` (default `false`) is `true`, the forms are actually computed to a precision slightly in excess of the precision $prec_1$ needed to guarantee that polynomial relations on them (of the degrees that are used in the computations) vanish if they vanish to precision $prec_1$.

## `NewModularHyperellipticCurve(B): [ModSym] -> BoolElt, RngUPol`

```magma
check: BoolElt                      Default: false
prec : RngIntElt                    Default: 100
gamma: RngIntElt                    Default: 1
```

Given a sequence $B$ of distinct modular abelian subvarieties of $J_1(N)^{new}$, presented as subspaces of modular symbols, this function `true` if the modular abelian variety $M$ which is the direct sum of the $B$ corresponds exactly to a hyperelliptic curve $C$ as described in the introduction ($M$ is isogenous to $Jac(C)$). If so, a univariate polynomial $f(x)$ is also returned such that $y^2=f(x)$ is a Weierstrass equation for $C$.

The parameters `check` and `prec` have the same meaning as in the previous intrinsic. The parameter `gamma` is only relevant if `check` is `true`, is $1$ by default, and should only be set to $0$ if all of the $B$ are abelian subvarieties of $J_0(N)$. It is then used to get sharper bounds for the precision required for the $q$-expansions.

## `NewModularHyperellipticCurve(F): [RngSerPowElt] -> BoolElt, RngUPol`

This is a variant on the intrinsic directly above where, instead of the sequence of modular abelian subvarieties as argument, the sequence of $q$-expansions of the basis of weight 2 forms for the modular abelian subvariety $M$ is given instead.

## `ModularHyperellipticCurve(B): [ModSym] -> BoolElt, RngUPol`

```magma
prec: RngIntElt                    Default: 100
```

Given a sequence $B$ of distinct modular abelian subvarieties of $J_1(N)^{new}$, where the direct sum modular abelian variety $M$ that $B$ defines does not have to lie in the new part $J_1(N)^{new}$, the function determines whether the basis of the differentials (forms) of $M$ satisfy the correct relations so as to arise from a hyperelliptic curve $C$ of genus $g$. If so, the intrinsic also returns a univariate polynomial $f(x)$, such that $y^2=f(x)$ is a Weierstrass equation for $C$. The difference between this and the new case is that, although $C$ is a modular curve, it is not guaranteed that $Jac(C)$ is isogenous to $M$: it may be isogenous to a different modular abelian subvariety of $J_1(N)$.

The parameter `prec` (default 100) is the precision to which modular forms are expanded in the computations.

## `ModularHyperellipticCurve(F): [RngSerPowElt] -> BoolElt, RngUPol`

This is a variant on the intrinsic immediately above where, instead of a sequence of modular abelian varieties $B$ with direct sum $M$ passed as the argument, a sequence of $q$-expansions of the basis of weight 2 cusp forms of such an $M$ is given instead.

## `NewModularNonHyperellipticCurvesGenus3(N): RngIntElt -> SeqEnum`

```magma
check: BoolElt                      Default: false
prec : RngIntElt                    Default: 100
gamma: RngIntElt                    Default: 1
```

Given an integer $N$, this function returns a list of all non-hyperelliptic curves of genus $3$ which are new modular curves, for $X_1(N)$ if the parameter `gamma` equals 1 (the default), or for $X_0(N)$ if `gamma` equals 0.

The parameter `prec` (default 100) is the precision to which modular forms are computed to in the computations. If parameter `check` (default `false`) is `true`, the forms are actually computed to a little over the precision $prec_1$ needed to check that polynomial relations on them (of the degrees that are used in the computations) are definitely guaranteed to vanish if they vanish to precision $prec_1$.

## `NewModularNonHyperellipticCurveGenus3(B): [ModSym] -> BoolElt, RngMPolElt`

```magma
check: BoolElt                      Default: false
prec : RngIntElt                    Default: 100
gamma: RngIntElt                    Default: 1
```

Given a sequence $B$ of distinct modular abelian subvarieties of $J_1(N)^{new}$, where the direct sum modular abelian variety $M$ that $B$ defines does not have to lie in the new part $J_1(N)^{new}$, the function determines whether the basis of the differentials (forms) of $M$ satisfy the correct relations so as to arise from a non-hyperelliptic curve $C$ of genus $3$. If so, the intrinsic also returns a a defining polynomial for the canonical image of $C$. The parameters `check` and `prec` have the same meaning as for the intrinsic `NewModularHyperellipticCurves`. The parameter `gamma`, which is only relevant if `check` is `true`, and is $1$ by default, may be set to 0 if $M$ is an abelian subvariety of $J_0(N)$ when sharper bounds for the required precision of $q$-expansions will be used. This intrinsic is similar to `NewModularHyperellipticCurve(B)`.

## `NewModularNonHyperellipticCurveGenus3(F): [RngSerPowElt] -> BoolElt, RngMPolElt`

This is a variant on the intrinsic `NewModularNonHyperellipticCurveGenus3(B)` above where, instead of the sequence of modular abelian varieties $B$ with direct sum $M$ passed as the argument, a sequence $F$ of $q$-expansions of the basis of weight 2 cusp forms of such an $M$ is given instead.

## `ModularNonHyperellipticCurveGenus3(F): [RngSerPowElt] -> BoolElt, RngMPolElt`

This is the same as the intrinsic `NewModularNonHyperellipticCurveGenus3(F)` immediately preceding except that it is not required that the modular abelian variety $M$ which corresponds to $F$ lies in the new part $J_1(N)^{new}$. This may be used to search for non-new non-hyperelliptic genus 3 curves.

## `Example: Jim Ex Mod Crvs Hyp (ex-dc59de)`

We give some examples of the use of these intrinsics.

The modular curve $X_1(13)$ is of genus $2$, therefore hyperelliptic, and the space of modular forms of weight $2$ for $\Gamma_1(13)$ is generated by an unique newform $f$ of nebentypus a Dirichlet character of order $6$, such that the modular abelian variety attached to $f$, $A_f$, is $\bf Q$-isogenous to $J_1(13)$:

```magma
> chi := DirichletGroup(13,CyclotomicField(6)).1; //order 6 character mod 13
> A13:=Af(chi)[1];
> NewModularHyperellipticCurve([A13]);
true x^6 + 4*x^5 + 6*x^4 + 2*x^3 + x^2 + 2*x + 1
> f13:=qIntegralBasis(A13,100);
> NewModularHyperellipticCurve(f13);
true x^6 + 4*x^5 + 6*x^4 + 2*x^3 + x^2 + 2*x + 1
> SetVerbose("ModularCurve",1);
> NewModularHyperellipticCurve([A13]:check:=true);
Checking ...
          ... bound =113
true x^6 + 4*x^5 + 6*x^4 + 2*x^3 + x^2 + 2*x + 1

```

Let us compute all the new modular hyperelliptic curves parameterized by $X_0(80)$:

```magma
> NewModularHyperellipticCurves(80,0: gamma:=0);

     Candidates:=3

     All the curves

1 2 3

[
    x^5 + 2*x^4 - 26*x^3 - 132*x^2 - 231*x - 142
]

```

Finally, we calculate the new modular hyperelliptic curves parameterized by $X_1(80)$ (the default):

```magma
> SetVerbose("ModularCurve",0);
> NewModularHyperellipticCurves(80,0);
[
    x^5 + 2*x^4 - 26*x^3 - 132*x^2 - 231*x - 142,
    x^5 - 2*x^4 - 2*x^3 + 20*x^2 - 47*x + 30,
    x^7 - 4*x^6 - 4*x^5 + 39*x^4 - 64*x^3 + 40*x^2 - 8*x,
    x^7 + 2*x^5 + 7*x^4 - 4*x^3 - 20*x^2 - 16*x - 4
]

```

## `Example: Jim Ex Mod Crvs Jeon (ex-c93378)`

In this exercise, an interesting example from [[Jeon and Kim, 2007](../../references.md#cite-jeon)] is presented.

```magma
> S:=CuspidalSubspace(ModularSymbolsH(21,[1,8,13,20],2,+1));
> S;
Modular symbols space of level 21, weight 2, and dimension 3 over Rational Field
(multi-character)
> ModularHyperellipticCurve([S]);
true x^8 - 6*x^6 + 4*x^5 + 11*x^4 - 24*x^3 + 22*x^2 - 8*x + 1

```

The above curve is the unique hyperelliptic intermediate modular curve $X_{\Delta}(N)$ between $X_1(N)$ and $X_0(N)$, where $\Delta$ is a subgroup of $({\bf Z}/N{\bf Z})^*/\{\pm 1\}$ and $X_{\Delta}(N)$ is the modular curve associated to some congruence subgroup of $PSL_2({\bf Z})$ attached to $\Delta$. In fact, the above hyperelliptic curve is the new modular curve denoted by $C^A_{21A_{\{0,2\}}}$ in [[Baker *et al.*, 2005](../../references.md#cite-bgjgp05)].

## `Example: Jim Ex Mod Crvs Jeon (ex-f78f1d)`

Given a modular abelian subvariety of $J_0(97)$, we determine whether it corresponds to a new modular non-hyperelliptic curve of genus $3$ and level $97$:

```magma
> M:=ModularSymbols(97,2,1);
> NN:=SortDecomposition(NewformDecomposition(NewSubspace(CuspidalSubspace(M))));
> NN;
[
    Modular symbols space for Gamma_0(97) of weight 2 and dimension 3 over
    Rational Field,
    Modular symbols space for Gamma_0(97) of weight 2 and dimension 4 over
    Rational Field
]
> A97:=NN[1];
> NewModularNonHyperellipticCurveGenus3([A97]);
true -x^2*y^2 + x*y^3 + x^3*z + x*y^2*z - 5*x^2*z^2 + 3*x*y*z^2 - 3*y^2*z^2 +
  6*x*z^3 - y*z^3 - 2*z^4

```

## `Example: Jim Ex Mod Crvs Gen3 (ex-724f38)`

We calculate all of the new modular non-hyperelliptic curves of genus $3$ parameterized by $X_1(20)$:

```magma
> NewModularNonHyperellipticCurvesGenus3(20);
[
    -x^2*y^2 + x*y^3 + x^3*z - 3*x^2*z^2 + 4*x*z^3 - 2*z^4
]

```

We now construct an example of a non-new modular non-hyperelliptic curve of genus 3:

```magma
> S1:=ModularSymbols(178,2,1);
> N1:=SortDecomposition(NewformDecomposition(NewSubspace(CuspidalSubspace(S1))));
> A:=N1[3];A;
Modular symbols space for Gamma_0(178) of weight 2 and dimension 2 over
Rational Field
> S2:=ModularSymbols(89,2,1);
> N2:=SortDecomposition(NewformDecomposition(NewSubspace(CuspidalSubspace(S2))));
> B:=N2[1];B;
Modular symbols space for Gamma_0(89) of weight 2 and dimension 1 over
Rational Field
> fA:=qIntegralBasis(A,100);
> fB:=qIntegralBasis(B,100);
> q := Universe(fB).1;
> fB2:=&+[Coefficient(fB[1],k)*q^(2*k) : k in [1..99]];
> g:=fB[1]+2*fB2;
> ModularNonHyperellipticCurveGenus3([g,fA[1],fA[2]]);
true -x^4 + 2*x^2*y^2 - y^4 + 8*x^2*y*z + 8*y^3*z - 6*x^2*z^2 - 38*y^2*z^2 +
    24*y*z^3 + 7*z^4
>

```

The above curve is denoted by $C^{89A}_{178C}$ in [[Gonzalez-Jimenez and Oyono, 2010](../../references.md#cite-gjo10)]. Its jacobian is ${\bf Q}$-isogenous to $A\times B$.
