Opened 4 months ago

Closed 4 months ago

#16068 closed defect (fixed)

Use base_ring in chord_and_tangent

Reported by: jkeitel Owned by:
Priority: minor Milestone: sage-6.2
Component: elliptic curves Keywords:
Cc: vbraun Merged in:
Authors: Jan Keitel Reviewers: Peter Bruin
Report Upstream: N/A Work issues:
Branch: 2c67789 (Commits) Commit: 2c6778933512a38353951459e75cebbf84131346
Dependencies: Stopgaps:


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.

Change History (6)

comment:1 Changed 4 months ago by jkeitel

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

New commits:

caeb6e1Merge branch 'develop' of into develop
3f35e0bMerge branch 'develop' of into develop
2a57b18Fixed appearence of int in chord_and_tangent

comment:2 Changed 4 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 4 months ago by git

  • Commit changed from 2a57b1843b30b38ac84da8d7a57b05d93d3113b9 to 2c6778933512a38353951459e75cebbf84131346

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

2c67789Fixed indentation.

comment:4 Changed 4 months ago by jkeitel

  • Status changed from needs_work to needs_review

Thanks, I've changed the indentation.

comment:5 Changed 4 months ago by pbruin

  • Status changed from needs_review to positive_review

comment:6 Changed 4 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.