Opened 7 years ago

# correct set of points at infinity for hyperelliptic curve

Reported by: Owned by: mstreng major sage-6.4 geometry hyperelliptic curve points at infinity Marco Streng N/A doctest the rest of the sage library, check how documentation looks, add example from ticket description to patch #15108

Here are two isomorphic hyperelliptic curves:

```sage: HyperellipticCurve(x^6+x-1).points()
[(0 : 1 : 0),
(1 : 6 : 1),
(1 : 1 : 1),
(2 : 4 : 1),
(2 : 3 : 1),
(4 : 5 : 1),
(4 : 2 : 1)]
sage: HyperellipticCurve(-x^6+x^5+1).points()
[(0 : 1 : 0),
(0 : 6 : 1),
(0 : 1 : 1),
(1 : 6 : 1),
(1 : 1 : 1),
(2 : 5 : 1),
(2 : 2 : 1),
(4 : 4 : 1),
(4 : 3 : 1)]
```

The isomorphism is `(x,y) |-> (1/x,y/x^3)`. They don't have the same number of points because of singularities at infinity. But by "hyperelliptic curve", one really means the desingularized curve. So the function "points" should return points on the desingularized curve.

Apply:

Based on top of #15108 (so may depend on that).

### comment:1 Changed 7 years ago by mstreng

• Description modified (diff)
• Work issues set to doctest the rest of the sage library, check how documentation looks, add example from ticket description to patch

apply 15115.patch

### comment:2 Changed 7 years ago by mstreng

• Dependencies set to #15108
• Description modified (diff)

### comment:3 follow-up: ↓ 4 Changed 7 years ago by nbruin

Sorry, but this won't fly. You'll have to implement weighted projective planes for that to work. The problem quickly becomes obvious when you look at the defining ideal:

```sage: _.<x>=QQ[]
sage: C=HyperellipticCurve(x^6+x+1)
sage: I=C.defining_ideal()
sage: F=I.0
sage: F
-x0^6 + x1^2*x2^4 - x0*x2^5 - x2^6
sage: F(1,1,0)
-1
sage: F(0,1,0)
0
```

It's obviously a bad idea to return as "points" on a hyperelliptic curve some points where the generator of the reported defining ideal doesn't vanish!

It may not be so bad to implement weighted projective planes. We can already define the relevant weights (I have no idea whether they're efficient, but frankly, the projective coordinate ring of a hyperelliptic curve doesn't need to be very efficient. It's mainly there for decoration):

```sage: P.<x,y,z> = PolynomialRing(QQ, 3, order=TermOrder('wdegrevlex',(1,3,1)))
sage: G=x^6+z^6-y^2
sage: G.is_homogeneous()
True
sage: G.degree()
6
sage: J=P.ideal(G)
sage: R=P.quotient(J)
sage: R(x^6)-R(z^6)
ybar^2 - 2*zbar^6
```

Unfortunately, sage doesn't seem to be aware that R inherits a grading from P, but I guess presently, sage never does.

Also note that `wdegrevlex` might not be entirely the most appropriate order, since eliminating `y` as much as possible is probably the best approach.

We can make that work with

```sage: P.<y,x,z> = PolynomialRing(QQ, 3, order=TermOrder('wdegrevlex',(3,1,1)))
sage: G=x^6+z^6-y^2
sage: R=P.quotient(J)
sage: R(y^2)
xbar^6 + zbar^6
```

but putting the `y` in front is probably more trouble than it's worth.

### comment:4 in reply to: ↑ 3 ; follow-up: ↓ 6 Changed 7 years ago by mstreng

I looked at polynomial rings and projective spaces for a while, then found that there is a long way to go before we have weighted projective spaces in Sage. But I did not see that `is_homogeneous()` and `degree` are already working, so maybe I was pessimistic.

One more pessimistic remark though: elliptic curves over the p-adics inherit from hyperelliptic curves, so switching to weighed projective space with weights (1, g+1, 1) for all hyperelliptic curves will lead to trouble.

Anyway, note that many changes in the patch must happen also with weighted projective spaces, this patch just does it now, rather than waiting.

Of course the fake points at infinity in this patch are an ugly hack, but using a singular model gives mathematically incorrect answers (as in #11980), and implementing the whole weighted projective spaces thing takes time. So which is the lesser of three evils?

Last edited 7 years ago by mstreng (previous) (diff)

### comment:5 Changed 7 years ago by mstreng

But wait, Sage does have weighted projective spaces. There is even a genuine hyperelliptic curve in the documentation!

```      sage: X = toric_varieties.WP([1,3,1], names='x y z')
sage: X.inject_variables()
Defining x, y, z
sage: g = y^2-(x^6-z^6)
sage: C = X.subscheme([g]); C
Closed subscheme of 2-d toric variety covered by 3 affine patches defined by:
-x^6 + z^6 + y^2
```

WP stands for "weighted projective space". The three affine patches are more than we need for hyperelliptic curves, so I wonder whether working with points is efficient for such a hyperelliptic curve.

### comment:6 in reply to: ↑ 4 ; follow-up: ↓ 7 Changed 7 years ago by nbruin

One more pessimistic remark though: elliptic curves over the p-adics inherit from hyperelliptic curves, so switching to weighed projective space with weights (1, g+1, 1) for all hyperelliptic curves will lead to trouble.

Yes, if we're going to give our curves by projective models then elliptic curves should probably be given by a cubic model in ordinary projective space. That means that the common stuff between p-adic hyperelliptic curves and p-adic elliptic curves needs to be factored out into an object/interface that does not care about projective models.

Of course the fake points at infinity in this patch are an ugly hack,

No, they are just wrong!

but using a singular model gives mathematically incorrect answers (as in #11980),

But in those cases the answers can be made correct by rephrasing them in terms of "birational" rather than "isomorphic" and if necessary in terms of "places of degree 1" rather than points.

and implementing the whole weighted projective spaces thing takes time. So which is the lesser of three evils?

reporting points that don't lie on the projective model advertised is definitely the worst of the three in my view. Having a model where there's no 1-1 correspondence between the degree 1 places and the (possibly singular) rational points is perhaps inconvenient, but not intrinsically wrong. Eventually having both agree is of course what we should strive for.

### comment:7 in reply to: ↑ 6 ; follow-up: ↓ 8 Changed 7 years ago by mstreng

But in those cases the answers can be made correct by rephrasing them in terms of "birational" rather than "isomorphic" and if necessary in terms of "places of degree 1" rather than points.

What kind of functionality for places of function fields does Sage have right now? It is definitely good to have for general curves. But for hyperelliptic curves we should still switch to weighted projective spaces at some point anyway.

### comment:8 in reply to: ↑ 7 Changed 7 years ago by nbruin

What kind of functionality for places of function fields does Sage have right now? It is definitely good to have for general curves. But for hyperelliptic curves we should still switch to weighted projective spaces at some point anyway.

I was really just thinking about rephrasing the docstrings of the routines you now claim give mathematically wrong results: either stick with the zeta function of the singular model (which is going to be confusing now and wrong in the future) or yield the appropriate zeta function and document it as "the zeta function of the complete nonsingular curve in the birationality class of this curve" or "the zeta function of the function field of this curve" or something similar. You wouldn't particularly need support for places and function fields to write that in a docstring.

Similarly, document "isomorphic" as "birational isomorphic" if t hat makes the routine correct.

All the hard work for hyperelliptic curves happens in an affine patch anyway, so the completion doesn't really matter that much. So perhaps it's doable to simply use `toric_varieties.WP` as an ambient! (of course, for performance this stuff should only lazily be there: for many applications, a hyperelliptic curve is a list of coefficients of the polynomials `f,h` in `y^2+h(x)y=f(x)`.

### comment:9 Changed 7 years ago by jpflori

FYI, we did a little of work on zeta functions of hyperelliptic curves at Sage Days 53 and (when merged) you'll get "the zeta function of the complete nonsingular curve in the birationality class of this curve" or "the zeta function of the function field of this curve" which is what you really want. See #15148 and #11980.

We did not really make special attention to the docstrings, so this should still be done here.

### comment:10 Changed 6 years ago by vbraun_spam

• Milestone changed from sage-6.1 to sage-6.2

### comment:11 Changed 6 years ago by vbraun_spam

• Milestone changed from sage-6.2 to sage-6.3

### comment:12 Changed 6 years ago by vbraun_spam

• Milestone changed from sage-6.3 to sage-6.4
Note: See TracTickets for help on using tickets.