# Points

The hyperelliptic curve is embedded in a weighted projective space, with weights $1$, $g+1$, and $1$, respectively on $x$, $y$ and $z$. Therefore point triples satisfy the equivalence relation $(x : y : z) = (\mu x : \mu^{g+1} y : \mu z)$, and the points at infinity are then normalized to take the form $(1 : y : 0)$.

## Creation of Points

### `C ! [x, y]: CrvHyp, [RngElt] -> PtHyp`

### `C ! [x, y, z]: CrvHyp, [RngElt] -> PtHyp`

### `elt< PS | x, y >: SetPtHyp, RngElt, RngElt, RngElt -> PtHyp`

### `elt< PS | x, y, z >: SetPtHyp, RngElt, RngElt, RngElt -> PtHyp`

Returns the point on a hyperelliptic curve $C$ specified by the coordinates $(x,y,z)$. The `elt` constructor takes the pointset of a hyperelliptic curve as an argument. If $z$ is not specified it is assumed to be $1$.

### `C ! P: CrvHyp, PtHyp -> PtHyp`

Given a point $P$ on a hyperelliptic curve $C_1$, such that $C$ is a base extension of $C_1$, this returns the corresponding point on the hyperelliptic curve $C$. The curve $C$ can be, e.g., the reduction of $C_1$ to finite characteristic (i.e., base extension to a finite field) or the tautological coercion to itself.

### `Points(C, x): CrvHyp, RngElt -> SetIndx`

### `RationalPoints(C, x): CrvHyp, RngElt -> SetIndx`

### `Points(C, x): CrvHyp, Infty -> SetIndx`

### `RationalPoints(C, x): CrvHyp, Infty -> SetIndx`

The indexed set of all rational points on the hyperelliptic curve $C$ that have the value $x$ as their $x$-coordinate. (Rational points are those with coordinates in the coefficient ring of $C$). Note that points at infinity are considered to have $\infty$ as their $x$-coordinate.

### `PointsAtInfinity(C): CrvHyp -> SetIndx`

The points at infinity for the hyperelliptic curve $C$ returned as an indexed set of points.

### `IsPoint(C, S): CrvHyp, SeqEnum -> BoolElt, PtHyp`

The function returns `true` if and only if the sequence $S$ specifies a point on the hyperelliptic curve $C$, and if so, returns this point as the second value.

### `Example: Points At Infinity On Hypcurves (ex-c9370e)`

We look at the point at infinity on $y^2=x^5+1$.

```magma
> P<x> := PolynomialRing(Rationals());
> C := HyperellipticCurve(x^5+1);
> PointsAtInfinity(C);
{@ (1 : 0 : 0) @}

```

There is only one, and to see that this really is a point on $C$ it must be remembered that in Magma, all hyperelliptic curves are considered to live in weighted projective spaces:

```magma
> Ambient(C);
Projective Space of dimension 2
Variables : $.1, $.2, $.3
Gradings :
1       3       1

```

In fact, the point is nonsingular on $C$, as we now check. (It’s worth remembering that all the functionality for curves, for instance `IsNonsingular`, applies to hyperelliptic curves as a special case.)

```magma
> pointAtInfinity := C![1,0,0];  // Entering the point by hand.
> IsNonsingular(pointAtInfinity);
true

```

## Random Points

### `Random(C): CrvHyp -> PtHyp`

Given a hyperelliptic curve $C$ defined over a finite field, this returns a point chosen at random on the curve. If the set of all points on $C$ has already been computed, this gives a truly random point, otherwise the ramification points have a slight advantage.

## Predicates on Points

### `P eq Q: PtHyp, PtHyp -> BoolElt`

Returns `true` if and only if the two points $P$ and $Q$ on the same hyperelliptic curve have the same coordinates.

### `P ne Q: PtHyp, PtHyp -> BoolElt`

Returns `false` if and only if the two points $P$ and $Q$ on the same hyperelliptic curve have the same coordinates.

## Access Operations

### `P[i]: PtHyp, RngIntElt -> RngElt`

The $i$-th coordinate of the point $P$, for $1\leq i\leq 3$.

### `Eltseq(P): PtHyp -> SeqEnum`

### `ElementToSequence(P): PtHyp -> SeqEnum`

Given a point $P$ on a hyperelliptic curve, this returns a $3$-element sequence consisting of the coordinates of the point $P$.

## Arithmetic of Points

### `- P: PtHyp -> PtHyp`

### `Involution(P): PtHyp -> PtHyp`

Given a point $P$ on a hyperelliptic curve, this returns the image of $P$ under the hyperelliptic involution.

## Enumeration and Counting Points

### `NumberOfPointsAtInfinity(C): CrvHyp -> RngIntElt`

The number of points at infinity on the hyperelliptic curve $C$.

### `PointsAtInfinity(C): CrvHyp -> SetIndx`

The points at infinity for the hyperelliptic curve $C$ returned as an indexed set of points.

### `# C: CrvHyp -> RngIntElt`

Given a hyperelliptic curve $C$ defined over a finite field, this returns the number of rational points on $C$.

If the base field is small or there is no other good alternative, a naive point counting technique is used. However, if they are applicable, the faster $p$-adic methods described in the `#J` section are employed (which actually yield the full zeta function of $C$). As for `#J`, the verbose flag `JacHypCnt` can be used to output information about the computation.

### `Points(C): CrvHyp -> SetIndx`

### `RationalPoints(C): CrvHyp -> SetIndx`

### `RationalPoints(C): SetPtHyp -> SetIndx`

```magma
Bound           : RngIntElt                    Default: 
NPrimes         : RngIntElt                    Default: 30
DenominatorBound: RngIntElt                    Default: Bound
```

For a hyperelliptic curve $C$ defined over a finite field, the function returns an indexed set of all rational points on $C$.

For a curve $C$ over ${\mathbb{Q}}$ of the form $y^2 = f(x)$ with integral coefficients, it returns the set of points such that the naive height of the $x$-coordinate is less than `Bound`.

For a curve $C$ over a number field, it returns the set of points in a search region which is controlled by the parameters `Bound` (which must be specified) and `DenominatorBound`. The algorithm is a sieve method, described in Appendix A of [[Bruin, 2002](../../references.md#cite-bruin-phdthesis)]. The parameter `NPrimes` controls the number of primes to be used for the sieve.

### `PointsGenus2(C): CrvHyp -> SetIndx, BoolElt, RngIntElt`

### `RationalPointsGenus2(C): CrvHyp -> SetIndx, BoolElt, RngIntElt`

```magma
Bound1     : RngIntElt                    Default: 1000
Bound2     : RngIntElt                    Default: 20000
Fast       : BoolElt                      Default: false
RankBound  : RngIntElt                    Default: Infinity()
PrimeCutoff: RngIntElt                    Default: 10000
```

For a curve $C$ over ${\mathbb{Q}}$ of the form $y^2 = f(x)$ try to determine the set of rational points

This returns a set of rational points on the curve, a flag indicating whether we know that these are all the points, and if this is not the case, a number such that all the points of (multiplicative x-coordinate) height up to that bound are included in the set.

`Bound1` is an argument passed to `RationalPoints`. Same is true for `Bound2`, which will be called after the first search for small points has failed, and the curve is everywhere locally soluble. If `Fast` is set, smaller bounds than the default ones are used in the call to `MordellWeilGroupGenus2` for the search on 2-coverings. This has the effect of making this function fail faster when otherwise a time-intensive search for rational points on 2-coverings would be triggered. `PrimeCutoff` is passed on to `TwoCoverDescent`.

This function uses a combination of techniques:

**i)**
search for (relatively small) points,

**ii)**
test for everywhere local solubility,

**iii)**
two-cover descent,

**iv)**
degree 2 and 3 elliptic subcovers of rank zero,

**v)**
computation of generators of a finite-index subgroup of the Mordell-Weil group,

**vi)**
Chabauty when the rank is at most 1,

**vii)**
a check whether the curve has rational divisors of odd degree,

**viii)**
if the rank is at least 2 and no points were found, a Mordell-Weil sieve computation.

The two possible failure modes are:

**i)**
failure to determine the rank

**ii)**
rank is at least 2 and rational points exist; in these cases the result is `false`, and it returns the set of rational points up to the height bound for the search.

### `PointsKnown(C): CrvHyp -> BoolElt`

Returns `true` if and only if the points of the hyperelliptic curve $C$ have been computed. This can especially be helpful when the curve is likely to have many points and when one does not wish to trigger the possibly expensive point computation.

### `Example: Point Enumeration (ex-814aee)`

For the following classical curve of Diophantus’ *Arithmetica*, it is proved by Joseph Wetherell [[Wetherell, 1997](../../references.md#cite-weth97th)] that Diophantus found all positive rational points. The following Magma code enumerates the points on this curve.

```magma
> P<x> := PolynomialRing(Rationals());
> C := HyperellipticCurve(x^6+x^2+1);
> Points(C : Bound := 1);
{@ (1 : -1 : 0), (1 : 1 : 0), (0 : -1 : 1), (0 : 1 : 1) @}
> Points(C : Bound := 2);
{@ (1 : -1 : 0), (1 : 1 : 0), (0 : -1 : 1), (0 : 1 : 1), (-1 : -9 : 2),
(-1 : 9 : 2), (1 : -9 : 2), (1 : 9 : 2) @}
> Points(C : Bound := 4);
{@ (1 : -1 : 0), (1 : 1 : 0), (0 : -1 : 1), (0 : 1 : 1), (-1 : -9 : 2),
(-1 : 9 : 2), (1 : -9 : 2), (1 : 9 : 2) @}

```

## Frobenius

### `Frobenius(P, F): PtHyp, FldFin -> PtHyp`

```magma
Check: BoolElt                    Default: true
```

Applies the Frobenius $x -> x^{(\#F)}$ to $P$. If `Check` is `true`, it verifies that the curve of which $P$ is a point is defined over the finite field $F$.

### `FrobeniusMatrix(C, p): CrvHyp, RngIntElt -> Mtrx`

```magma
Precision: RngIntElt                    Default: 10
```

Given a hyperelliptic curve over the rationals and a good prime $p$, this computes the matrix corresponding to the action of Frobenius to the indicated precision. The basis used is $x^e(dx/y)$ for $0\le e<d-1$, where the curve is given by $y^2=f(x)$ with $f$ of degree $d$.
