Opened 9 years ago

Closed 3 years ago

# bug in matrix of frobenius when p = 3

Reported by: Owned by: jen was major sage-7.2 number theory elliptic curves, Weierstrass form, matrix of Frobenius, sd87 Jennifer Balakrishnan Aly Deines N/A ac7b356 (Commits) ac7b3567f0712dbb7cadd75b7c88b77cdbe59e6b

### Description

The code for computing the matrix of frobenius when p = 3 does not seem to be implemented:

```sage: E = EllipticCurve('83a1')
sage: EW = E.short_weierstrass_model()
sage: EW.is_ordinary(3)
True
sage: EW.matrix_of_frobenius(3)
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)

/home/jen/<ipython console> in <module>()

in matrix_of_frobenius(self, p, prec, check, check_hypotheses,
algorithm)
1521     # todo: implement the p == 3 case
1522     if p < 5:
-> 1523         raise NotImplementedError, "p (=%s) must be at least 5" % p
1524
1525     prec = int(prec)

NotImplementedError: p (=3) must be at least 5
```

However, telling Sage that you're dealing with a hyperelliptic curve calls other code, which seems to run into problems when p = 3:

```sage: EW
Elliptic Curve defined by y^2 = x^3 + 1269*x - 10746 over Rational Field
sage: R.<x> = QQ['x']
sage: C= HyperellipticCurve(x^3 + 1269*x - 10746)
sage: C.matrix_of_frobenius(3)
[                                                      3^-109 +
2*3^-104 + 3^-102 + 2*3^-101 + 2*3^-100 + 3^-99 + 3^-97 + 3^-92 +
O(3^-89) 2*3^-101 + 3^-99 + 2*3^-97 + 3^-96 + 2*3^-95 + 2*3^-94 +
3^-91 + 3^-90 + 2*3^-87 + 2*3^-86 + 2*3^-85 + 3^-84 + 3^-83 + 2*3^-82
+ O(3^-81)]
[      3^-110 + 2*3^-109 + 2*3^-107 + 2*3^-106 + 3^-102 + 2*3^-101 +
3^-100 + 3^-99 + 3^-98 + 3^-97 + 3^-94 + 2*3^-93 + 2*3^-92 + O(3^-90)
2*3^-102 + 3^-101 + 2*3^-96 + 3^-94 +
2*3^-92 + 3^-91 + 2*3^-89 + 2*3^-88 + 3^-86 + 3^-84 + 3^-83 +
O(3^-82)]
```

### comment:1 Changed 9 years ago by jdemeyer

• Milestone sage-4.7.3 deleted

Milestone sage-4.7.3 deleted

### comment:2 Changed 5 years ago by kedlaya

• Milestone set to sage-7.2

I think matrix_of_frobenius is only failing because the short Weierstrass equation has bad reduction at 3. If you manually write down a Weierstrass equation of the form `y^2 = P(x)` with good reduction at 3, everything works:

```sage: E = EllipticCurve('83a1')
sage: E
Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 + x over Rational Field
sage: pr.<x> = PolynomialRing(QQ)
sage: a = x^3 + x^2 + x
sage: b = x + 1
sage: C = HyperellipticCurve(a + b^2/4)
sage: C.matrix_of_frobenius(3)
[                                2*3 + 3^5 + 2*3^6 + 3^8 + 3^11 + 2*3^12 + 2*3^13 + 2*3^14 + 2*3^15 + 3^16 + 3^18 + 3^19 + O(3^20)               2*3 + 2*3^2 + 2*3^3 + 2*3^7 + 3^8 + 2*3^9 + 2*3^10 + 2*3^11 + 2*3^13 + 3^14 + 3^15 + 2*3^16 + 3^17 + 3^19 + O(3^20)]
[2*3 + 3^2 + 2*3^5 + 3^6 + 2*3^7 + 2*3^9 + 3^10 + 3^11 + 3^12 + 3^13 + 2*3^14 + 2*3^15 + 2*3^16 + 2*3^17 + 2*3^18 + 3^19 + O(3^20)                     2 + 2*3^2 + 2*3^3 + 2*3^4 + 3^5 + 2*3^7 + 3^8 + 2*3^9 + 2*3^10 + 3^11 + 3^16 + 2*3^17 + 3^18 + 3^19 + O(3^20)]
```

### comment:3 Changed 5 years ago by kedlaya

• Keywords elliptic curves Weierstrass form matrix of Frobenius added

### comment:4 Changed 5 years ago by jdemeyer

For the record, PARI also has code which does this.

### comment:5 Changed 5 years ago by kedlaya

Would it make sense to have `EllipticCurve.matrix_of_frobenius` call out to `HyperellipticCurve.matrix_of_frobenius` and then have the triage among different code options be handled there?

### comment:8 Changed 3 years ago by jen

Added a fix following the suggestion above to call the hyperelliptic code, passing in a Weierstrass equation that has good reduction at 3.

New commits:

 ​ac7b356 `added functionality for matrix of frobenius for p = 3`

### comment:9 Changed 3 years ago by jen

• Status changed from new to needs_review

### comment:10 Changed 3 years ago by aly.deines

• Reviewers set to Aly Deines
• Status changed from needs_review to positive_review

Looks good.

### comment:11 Changed 3 years ago by jen

• Authors set to Jennifer Balakrishnan