Opened 5 months ago

Closed 5 months ago

# Use base_ring in chord_and_tangent

Reported by: Owned by: jkeitel minor sage-6.2 elliptic curves vbraun Jan Keitel Peter Bruin N/A 2c67789 (Commits) 2c6778933512a38353951459e75cebbf84131346

### Description

Right now, the following fails:

```sage: from sage.schemes.elliptic_curves.constructor import chord_and_tangent
sage: R = PolynomialRing(QQ, 'x,y,z')
sage: x,y,z = R.gens()
sage: cubic = x**3 - 4*x**2*y - 65*x*y**2 + 3*x*y*z - 76*y*z**2
sage: f0 = (0, 1, 0)
sage: chord_and_tangent(cubic, f0)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-9-05d9ab02db04> in <module>()
----> 1 chord_and_tangent(cubic, f0)

/home/pcl337b/jkeitel/sage/sage/local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/constructor.pyc in chord_and_tangent(F, P)
898             g = F.substitute({x:y, y:x})
899             Q = [P[1], P[0], P[2]]
--> 900             R = chord_and_tangent(g, Q)
901             return [R[1], R[0], R[2]]
902         elif dz != 0:

/home/pcl337b/jkeitel/sage/sage/local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/constructor.pyc in chord_and_tangent(F, P)
917         g = F.substitute({x:z, z:x})
918         Q = [P[2], P[1], P[0]]
--> 919         R = chord_and_tangent(g, Q)
920         return [R[2], R[1], R[0]]
921     # Ft has a double zero at t=0 by construction, which we now remove

/home/pcl337b/jkeitel/sage/sage/local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/constructor.pyc in chord_and_tangent(F, P)
924     # first case: the third point is at t=infinity
925     if Ft.is_constant():
--> 926         return projective_point([dy, -dx, 0])
927     # second case: the third point is at finite t
928     else:

/home/pcl337b/jkeitel/sage/sage/local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/constructor.pyc in projective_point(p)
955     from sage.rings.integer import GCD_list, LCM_list
956     try:
--> 957         p_gcd = GCD_list([x.numerator() for x in p])
958         p_lcm = LCM_list([x.denominator() for x in p])
959     except AttributeError:

TypeError: 'int' object is not callable
```

This is very simple to fix - convert a 0 into an element of the base ring of the curve and I've attached a branch that does that.

### comment:1 Changed 5 months ago by jkeitel

• Branch set to u/jkeitel/chord_and_tangent
• Commit set to 2a57b1843b30b38ac84da8d7a57b05d93d3113b9
• Status changed from new to needs_review

New commits:

 ​caeb6e1 Merge branch 'develop' of trac.sagemath.org:sage into develop ​3f35e0b Merge branch 'develop' of trac.sagemath.org:sage into develop ​2a57b18 Fixed appearence of int in chord_and_tangent

### comment:2 Changed 5 months ago by pbruin

• Reviewers set to Peter Bruin
• Status changed from needs_review to needs_work
• Type changed from PLEASE CHANGE to defect

Looks good, but the line See :trac:`16068`:: is indented one level too many.

(I wonder why this function is called chord_and_tangent given that it only implements the "tangent" part, but that is irrelevant for this bug.)

### comment:3 Changed 5 months ago by git

• Commit changed from 2a57b1843b30b38ac84da8d7a57b05d93d3113b9 to 2c6778933512a38353951459e75cebbf84131346

Branch pushed to git repo; I updated commit sha1. New commits:

 ​2c67789 Fixed indentation.

### comment:4 Changed 5 months ago by jkeitel

• Status changed from needs_work to needs_review

Thanks, I've changed the indentation.

### comment:5 Changed 5 months ago by pbruin

• Status changed from needs_review to positive_review

### comment:6 Changed 5 months ago by vbraun

• Branch changed from u/jkeitel/chord_and_tangent to 2c6778933512a38353951459e75cebbf84131346
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.