Opened 7 years ago

Closed 7 years ago

#13005 closed defect (fixed)

"maximum recursion depth exceeded" when doing change_ring(RR) on an elliptic curve

Reported by: was Owned by: cremona
Priority: major Milestone: sage-5.1
Component: elliptic curves Keywords: sd40.5
Cc: Merged in: sage-5.1.beta5
Authors: R. Andrew Ohana Reviewers: William Stein
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

Behold this bug:

K.<a> = NumberField(x^2-5)
EllipticCurve(K,[1..5]).change_ring(RR)

BOOM!

...
  File "coerce_maps.pyx", line 82, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3345)
  File "coerce_maps.pyx", line 77, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3248)
  File "/Users/wstein/sage/build/sage-5.0/local/lib/python2.7/site-packages/sage/rings/complex_field.py", line 286, in _element_constructor_
    if not isinstance(x, (real_mpfr.RealNumber, tuple)):
RuntimeError: maximum recursion depth exceeded while calling a Python object

Attachments (1)

13005.patch (2.7 KB) - added by ohanar 7 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 7 years ago by cremona

It's nothing to do with elliptic curves. Try

sage: K.<a> = NumberField(x^2-5)
sage: RR(K(1))     

So the expected "natural" coercion from elements of K to elements of RR is blowing up, instead of using the default embedding.

comment:2 Changed 7 years ago by ohanar

  • Authors set to R. Andrew Ohana
  • Keywords sd40.5 added
  • Status changed from new to needs_review

comment:3 follow-up: Changed 7 years ago by roed

  • Status changed from needs_review to needs_work

Can you add doctests for number fields that already embeds into a real field (possibly of precision different from that of R)?

comment:4 in reply to: ↑ 3 Changed 7 years ago by ohanar

  • Status changed from needs_work to needs_review

Replying to roed:

Can you add doctests for number fields that already embeds into a real field (possibly of precision different from that of R)?

Ok, done

comment:5 follow-up: Changed 7 years ago by ppurka

Can you mention the ticket number as :trac:`#13005` in the documentation?

comment:6 in reply to: ↑ 5 Changed 7 years ago by ohanar

Replying to ppurka:

Can you mention the ticket number as :trac:`#13005` in the documentation?

Done

comment:7 Changed 7 years ago by was

Never ever do this:

            raise TypeError("cannot convert %s to real number"%(self)) 

Changed 7 years ago by ohanar

comment:8 Changed 7 years ago by was

  • Reviewers set to William Stein
  • Status changed from needs_review to positive_review

LGTM

comment:9 Changed 7 years ago by jdemeyer

  • Merged in set to sage-5.1.beta5
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.