# Operations on Curves

## Elementary Invariants

### `aInvariants(E): CrvEll -> [ RngElt ]`

### `Coefficients(E): CrvEll -> [ RngElt ]`

### `ElementToSequence(E): CrvEll -> [ RngElt ]`

### `Eltseq(E): CrvEll -> [ RngElt ]`

Given an elliptic curve $E$, this function returns a sequence consisting of the Weierstrass coefficients of $E$; this is the sequence $[a_1, a_2, a_3, a_4, a_6]$ such that $E$ is defined by $y^2z+a_1xyz+a_3yz^2=x^3+a_2x^2z+a_4xz^2+a_6z^3$. Note that this function returns the five coefficients even if $E$ was defined by a sequence [$a, b$] of length two (the first three coefficients are zero in such a case).

### `bInvariants(E): CrvEll -> [ RngElt ]`

This function returns a sequence of length $4$ containing the $b$-invariants of the elliptic curve $E$, namely $[b_2, b_4, b_6, b_8]$. In terms of the coefficients of $E$ these are defined by

$$
\begin{aligned}b_2&=a_1^2+4a_2\\
   b_4&=a_1a_3+2a_4\\
   b_6&=a_3^2+4a_6\\
   b_8&=a_1^2a_6+4a_2a_6-a_1a_3a_4+a_2a_3^2-a_4^2.\end{aligned}
$$

### `cInvariants(E): CrvEll -> [ RngElt ]`

This function returns a sequence of length $2$ containing the $c$-invariants of the elliptic curve $E$, namely $[c_4, c_6]$. In terms of the $b$-invariants of $E$ these are defined by

$$
\begin{aligned}c_4&=b_2^2-24b_4\\
   c_6&=-b_2^3+36b_2b_4-216b_6.\end{aligned}
$$

### `Discriminant(E): CrvEll -> RngElt`

This function returns the discriminant $\Delta$ of the elliptic curve $E$. In terms of the $b$-invariants of $E$ it is defined by

$$
\begin{aligned}\Delta&=-b_2^2b_8-8b_4^3-27b_6^2+9b_2b_4b_6\end{aligned}
$$

and there is also the relationship $1728\Delta=c_4^3-c_6^2$.

### `jInvariant(E): CrvEll -> RngElt`

Return the $j$-invariant of the elliptic curve $E$. In terms of the $c$-invariants and the discriminant of $E$ it is defined by $j=c_4^3/\Delta$. Two elliptic curves defined over the same base field are isomorphic over some extension field exactly when their $j$-invariants are equal.

### `HyperellipticPolynomials(E): CrvEll -> RngUPolElt, RngUPolElt`

Returns polynomials $x^3 + a_2 x^2 + a_4 x + a_6$ and $a_1 x + a_3$, formed from the invariants of the elliptic curve $E$.

### `Example: Invariants (ex-aa8afb)`

Here are a few simple uses of the above functions.

```magma
> E := EllipticCurve([0, -1, 1, 1, 0]);
> E;
Elliptic Curve defined by y^2 + y = x^3 - x^2 + x over Rational Field
> aInvariants(E);
[ 0, -1, 1, 1, 0 ]
> Discriminant(E);
-131
> c4, c6 := Explode(cInvariants(E));
> jInvariant(E) eq c4^3 / Discriminant(E);
true

```

### `Example: Generic Curve (ex-6fe5ca)`

By constructing a generic elliptic curve we can see that the relationships described above hold.

```magma
> F<a1, a2, a3, a4, a6> := FunctionField(Rationals(), 5);
> E := EllipticCurve([a1, a2, a3, a4, a6]);
> E;
Elliptic Curve defined by y^2 + a1*x*y + a3*y = x^3 + a2*x^2 + a4*x + a6
over F
> aInvariants(E);
[
    a1,
    a2,
    a3,
    a4,
    a6
]
> bInvariants(E);
[
    a1^2 + 4*a2,
    a1*a3 + 2*a4,
    a3^2 + 4*a6,
    a1^2*a6 - a1*a3*a4 + a2*a3^2 + 4*a2*a6 - a4^2
]
> b2,b4,b6,b8 := Explode(bInvariants(E));
> cInvariants(E);
[
    a1^4 + 8*a1^2*a2 - 24*a1*a3 + 16*a2^2 - 48*a4,
    -a1^6 - 12*a1^4*a2 + 36*a1^3*a3 - 48*a1^2*a2^2 + 72*a1^2*a4 +
        144*a1*a2*a3 - 64*a2^3 + 288*a2*a4 - 216*a3^2 - 864*a6
]
> c4,c6 := Explode(cInvariants(E));
> c4 eq b2^2 - 24*b4;
true
> c6 eq -b2^3 + 36*b2*b4 - 216*b6;
true
> d := Discriminant(E);
> d;
-a1^6*a6 + a1^5*a3*a4 - a1^4*a2*a3^2 - 12*a1^4*a2*a6 + a1^4*a4^2 +
    8*a1^3*a2*a3*a4 + a1^3*a3^3 + 36*a1^3*a3*a6 - 8*a1^2*a2^2*a3^2 -
    48*a1^2*a2^2*a6 + 8*a1^2*a2*a4^2 - 30*a1^2*a3^2*a4 + 72*a1^2*a4*a6 +
    16*a1*a2^2*a3*a4 + 36*a1*a2*a3^3 + 144*a1*a2*a3*a6 - 96*a1*a3*a4^2 -
    16*a2^3*a3^2 - 64*a2^3*a6 + 16*a2^2*a4^2 + 72*a2*a3^2*a4 +
    288*a2*a4*a6 - 27*a3^4 - 216*a3^2*a6 - 64*a4^3 - 432*a6^2
> d eq -b2^2*b8 - 8*b4^3 - 27*b6^2 + 9*b2*b4*b6;
true
> 1728*d eq c4^3 - c6^2;
true

```

## Associated Structures

### `Category(E): CrvEll -> Cat`

### `Type(E): CrvEll -> Cat`

Returns the category of elliptic curves, `CrvEll`.

### `BaseRing(E): CrvEll -> Rng`

### `CoefficientRing(E): CrvEll -> Rng`

The base ring of the elliptic curve $E$; that is, the parent of its coefficients and the coefficient ring of the default point set of $E$.

## Predicates on Elliptic Curves

### `E eq F: CrvEll, CrvEll -> BoolElt`

Returns `true` if and only if the elliptic curves $E$ and $F$ are defined over the same ring and have the same coefficients.

### `E ne F: CrvEll, CrvEll -> BoolElt`

The logical negation of `eq`.

### `IsIsomorphic(E, F): CrvEll, CrvEll -> BoolElt, Map`

Given two elliptic curves $E$ and $F$ this function returns `true` if there exists an isomorphism between $E$ and $F$ over the base field, and `false` otherwise. If $E$ and $F$ are isomorphic then the isomorphism is returned as a second value. This function requires being able to take roots in the base field.

### `IsIsogenous(E, F): CrvEll[FldRat], CrvEll[FldRat] -> BoolElt, Map`

### `IsIsogenous(E, F): CrvEll[FldFin], CrvEll[FldFin] -> BoolElt`

Given two elliptic curves $E$ and $F$ defined over the rationals or a finite field, this function returns `true` if the curves $E$ and $F$ are isogenous over this field and `false` otherwise. In the rational case, if the curves are isogenous then the isogeny will be returned as the second value. For finite fields the isogeny computation operates via point counting and thus no isogeny is returned.

### `Example: Twists2 (ex-4c9255)`

We return to the curves in the earlier quadratic twist example. By definition, these curves are not isomorphic over their base field, but are isomorphic over a quadratic extension.

```magma
> K := GF(13);
> E := EllipticCurve([K | 3, 1]);
> E5 := QuadraticTwist(E, 5);
> IsIsomorphic(E, E5);
false
> IsIsomorphic(BaseExtend(E, 2), BaseExtend(E5, 2));
true

```

Since they are isomorphic over an extension, their $j$-invariants must be the same.

```magma
> jInvariant(E) eq jInvariant(E5);
true

```
