# Operations on Curves

## Quadratic Twists

There are standard functions for quadratic twists of hyperelliptic curves in characteristic not equal to 2. In addition, from the new package [[Lercier *et al.*, 2021](../../references.md#cite-lrs)] (described in more detail in the next section) there are functions to return *all* twists of a genus 2 hyperelliptic curve over a finite field of any characteristic.

### `QuadraticTwist(C, d): CrvHyp, RngElt -> CrvHyp`

Given a hyperelliptic curve $C$ defined over a field $k$ of characteristic not equal to 2 and an element $d$ that is coercible into $k$, return the quadratic twist of $C$ by $d$.

### `QuadraticTwist(C): CrvHyp -> CrvHyp`

Given a hyperelliptic curve $C$ defined over a finite field $k$, return the standard quadratic twist of $C$ over the unique extension of $k$ of degree 2. If the characteristic of $k$ is odd, then this is the same as the twist of $C$ by a primitive element of $k$.

### `QuadraticTwists(C): CrvHyp -> SeqEnum`

Given a hyperelliptic curve $C$ defined over a finite field $k$ of odd characteristic, return a sequence containing the non-isomorphic quadratic twists of $C$.

### `IsQuadraticTwist(C, D): CrvHyp, CrvHyp -> BoolElt, RngElt`

```magma
verbose: CrvHypIso                    Default: Verbose : 3
```

Given hyperelliptic curves $C$ and $D$ over a common field $k$ having characteristic not equal to two, return `true` if and only if $C$ is a quadratic twist of $D$ over $k$. If so, the twisting factor is returned as the second value.

### `Example: Quadratic Twists (ex-a5b80e)`

We construct the quadratic twists of the hyperelliptic curve $y^2=x^6+x^2+1$ defined over ${\bf F}_{7}$.

```magma
> P<x> := PolynomialRing(GF(7));
> C := HyperellipticCurve(x^6+x^2+1);
> QuadraticTwists(C);
[
    Hyperelliptic Curve defined by y^2 = x^6 + x^2 + 1 over GF(7),
    Hyperelliptic Curve defined by y^2 = 3*x^6 + 3*x^2 + 3 over GF(7)
]
> IsIsomorphic($1[1],$1[2]);
false

```

### `Example: Quadratic Twists (ex-0bc2c3)`

We take a hyperelliptic curve over the rationals and form a quadratic twist of it.

```magma
> P<x> := PolynomialRing(Rationals());
> C := HyperellipticCurve(x^6+x);
> C7 := QuadraticTwist(C, 7);
> C7;
Hyperelliptic Curve defined by y^2 = 7*x^6 + 7*x over Rational Field

```

We now use the function `IsIsomorphic` to verify that $C$ and $C_7$ are nonisomorphic. We then extend the field of definition of both curves to ${\mathbb{Q}}(\sqrt{7})$ and verify that the curves become isomorphic over this extension.

```magma
> IsIsomorphic(C, C7);
false
> K<w> := ext< Rationals() | x^2-7 >;
> CK := BaseChange(C, K);
> C7K := BaseChange(C7, K);
> IsIsomorphic(CK, C7K);
true (x : y : z) :-> (x : -1/7*w*y : z)

```

## Elementary Invariants

### `HyperellipticPolynomials(C): CrvHyp -> RngUPolElt, RngUPolElt`

The univariate polynomials $f(x)$, $h(x)$, in that order, defining the hyperelliptic curve $C$ by $y^2 + h(x)y = f(x)$.

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

### `Degree(C): SetPtHyp -> RngIntElt`

The degree of the hyperelliptic curve $C$ or a pointset $C$ of a hyperelliptic curve.

### `Discriminant(C): CrvHyp -> RngElt`

The discriminant of the hyperelliptic curve $C$.

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

The genus of the hyperelliptic curve $C$.

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

Conductor of a hyperelliptic curve $C$ defined over ${\mathbb{Q}}$ or a number field.

### `Conductor(C, p): CrvHyp[FldRat], RngIntElt -> RngIntElt`

### `Conductor(C, P): CrvHyp[FldNum], RngOrdIdl -> RngIntElt`

Conductor exponent of a hyperelliptic curve $C/{\mathbb{Q}}$ at a prime $p$ or a curve over a number field at a prime ideal $P$.

### `Example: Crvhyp Conductor Q (ex-9451e3)`

```magma
> R<x>:=PolynomialRing(Rationals());
> C:=HyperellipticCurve(x^8+1,x); C;
Hyperelliptic Curve defined by y^2 + x*y = x^8 + 1 over Rational Field
> Factorization(Integers()!Discriminant(C));
[ <2, 4>, <109, 2>, <601, 2> ]
> Factorization(Conductor(C));                       // global
[ <2, 2>, <109, 2>, <601, 2> ]
> Conductor(C,2),Conductor(C,3),Conductor(C,5);      // local
2 0 0

```

### `ConductorExponent(C): CrvHyp[FldPad] -> RngIntElt`

### `Conductor(C): CrvHyp[FldPad] -> FldPadElt`

Conductor exponent and conductor ideal (uniformizer to the conductor exponent power) of a hyperelliptic curve over a $p$-adic field.

### `Example: Crvhyp Conductor Padic (ex-581c7e)`

Here is a genus 4 example over ${\mathbb{Q}}_3$.

```magma
> K:=pAdicField(3,20);
> R<x>:=PolynomialRing(K);
> C:=HyperellipticCurve(x^9+1);
> ConductorExponent(C);
12
> Conductor(C);
3^12 + O(3^32)

```

### `EulerFactor(C, p): CrvHyp[FldRat], RngIntElt -> RngUPolElt`

### `EulerFactor(C, P): CrvHyp[FldNum], RngOrdIdl -> RngUPolElt`

### `EulerFactor(C): CrvHyp[FldPad] -> RngUPolElt`

```magma
Degree: RngIntElt                    Default: Infinity()
```

The Euler factor (local polynomial) of a hyperelliptic curve defined over ${\mathbb{Q}}$, a number field or a $p$-adic field at a prime $p$. If `Degree` is specified, it is computed only up to that degree.

### `EulerFactor(C, p): CrvHyp[FldNum], RngIntElt -> RngUPolElt`

```magma
Degree: RngIntElt                    Default: Infinity()
```

The total Euler factor of a hyperelliptic curve defined over a number field over all primes above $p$. If `Degree` is specified, it is computed only up to that degree.

### `Example: Crvhyp Eulerfactor (ex-9f8b78)`

We consider the genus 2 curve $C/{\mathbb{Q}}: y^2=x^5+x^2+3$ and compute its conductor at $p=3$, and over $K={\mathbb{Q}}(\root 5\of 3)$ at the unique prime ideal $P|3$.

```magma
> R<x>:=PolynomialRing(Rationals());
> C:=HyperellipticCurve(x^5+x^2+3);
> EulerFactor(C,3);                     // local factor /Q at 3
-T + 1
> K:=NumberField(x^5-3);
> P:=Ideal(Decomposition(K,5)[1,1]);
> EulerFactor(BaseChange(C,K),P);       // local factor /K at P
25*x^4 - 5*x^3 - x + 1
> EulerFactor(BaseChange(C,Completion(K,P)));   // same, computed over K_P
25*x^4 - 5*x^3 - x + 1
> EulerFactor(BaseChange(C,K),2);       // total factor /K over all P|2
1

```

## Base Ring

### `BaseField(C): Sch -> Fld`

### `BaseRing(C): Sch -> Fld`

### `CoefficientRing(C): Sch -> Fld`

The base field of the hyperelliptic curve $C$.
