# 37.2 Hyperelliptic curves over a finite field

Module: `sage.schemes.hyperelliptic_curves.hyperelliptic_finite_field`

Hyperelliptic curves over a finite field

```sage: K.<a> = GF(9, 'a')
sage: x = polygen(K)
sage: C = HyperellipticCurve(x^7 - x^5 - 2, x^2 + a)
sage: C._points_fast_sqrt()
[(0 : 1 : 0), (2*a : 2*a + 2 : 1), (2*a : 2*a : 1), (a + 1 : a : 1), (a + 1
: a + 1 : 1), (2 : a + 1 : 1), (1 : a + 1 : 1)]
```

Class: `HyperellipticCurve_finite_field`

class HyperellipticCurve_finite_field

Functions: points

 points( self)
All the points on this hyperelliptic curve.

```sage: x = polygen(GF(7))
sage: C = HyperellipticCurve(x^7 - x^2 - 1)
sage: C.points()
[(0 : 1 : 0), (2 : 5 : 1), (2 : 2 : 1), (3 : 0 : 1), (4 : 6 : 1), (4 : 1 :
1), (5 : 0 : 1), (6 : 5 : 1), (6 : 2 : 1)]
```

```sage: x = polygen(GF(121, 'a'))
sage: C = HyperellipticCurve(x^5 + x - 1, x^2 + 2)
sage: len(C.points())
122
```

Special Functions: _points_cache_sqrt, _points_fast_sqrt

 _points_cache_sqrt( self, [brute_force=False])
Count points by enumerating over x and solving the resulting quadratic for y.

Caches all square roots ahead of time by sqaring every element of the field. Elements must have an __index__ method.

```sage: x = polygen(GF(7))
sage: C = HyperellipticCurve(x^3 + x^2 - 1)
sage: C._points_cache_sqrt()
[(0 : 1 : 0), (1 : 6 : 1), (1 : 1 : 1), (2 : 5 : 1), (2 : 2 : 1), (3 : 0 :
1), (4 : 4 : 1), (4 : 3 : 1), (5 : 4 : 1), (5 : 3 : 1)]
sage: set(C._points_cache_sqrt()) == set(C._points_cache_sqrt(brute_force=True))
True
```

 _points_fast_sqrt( self)
Count points by enumerating over x and solving the resulting quadratic for y.

```sage: K.<a> = GF(9, 'a')
sage: x = polygen(K)
sage: C = HyperellipticCurve(x^7 - 1, x^2 + a)
sage: C._points_fast_sqrt()
[(0 : 1 : 0), (2 : a + 1 : 1), (a : 2*a + 1 : 1), (2*a + 2 : 2*a : 1), (2*a
+ 2 : 1 : 1), (1 : 2*a + 2 : 1), (1 : 0 : 1)]
sage: K.<a> = GF(49, 'a')
sage: x = polygen(K)
sage: C = HyperellipticCurve(x^5 - x^2 - 1, x^2 + a)
sage: len(C._points_fast_sqrt())
31
```

TESTS:

```sage: x = polygen(GF(16, 'a'))
sage: C = HyperellipticCurve(x^5 - x + 1, x^2 + x)
sage: set(C._points_fast_sqrt()) == set(C._points_cache_sqrt())
True
sage: x = polygen(GF(19))
sage: C = HyperellipticCurve(x^5 + 5*x^2 + 1, x + 1)
sage: set(C._points_fast_sqrt()) == set(C._points_cache_sqrt())
True
sage: x = polygen(GF(13))
sage: C = HyperellipticCurve(x^3 + x^2 - 1)
sage: C._points_fast_sqrt()
[(0 : 1 : 0), (0 : 5 : 1), (0 : 8 : 1), (1 : 1 : 1), (1 : 12 : 1), (3 : 3 :
1), (3 : 10 : 1), (4 : 1 : 1), (4 : 12 : 1), (6 : 2 : 1), (6 : 11 : 1), (7
: 1 : 1), (7 : 12 : 1), (8 : 4 : 1), (8 : 9 : 1), (9 : 4 : 1), (9 : 9 : 1),
(12 : 5 : 1), (12 : 8 : 1)]
sage: set(C._points_fast_sqrt()) == set(C._points_cache_sqrt())
True
```

See About this document... for information on suggesting changes.