Unhandled case in EllipticCurve_from_cubic

99 views
Skip to first unread message

Robin Houston

unread,
Jul 25, 2016, 6:25:00 AM7/25/16
to sage-devel
I ran into an unexpected error in EllipticCurve_from_cubic, with the following cubic and rational point:

R.<x,y,z> = QQ[]
cubic = -3*x^2*y + 3*x*y^2 + 4*x^2*z + 4*y^2*z - 3*x*z^2 + 3*y*z^2 - 8*z^3
EllipticCurve_from_cubic(cubic, (-4/5, 4/5, 3/5))

Note that it works as expected using instead the different rational point (1, 1, 0).

On investigation, I found there is a case that isn’t handled correctly. The code computes

P2 = chord_and_tangent(F, P)

and if P2 is projectively equivalent to P then it uses a different algorithm. If they’re different, it then computes

P3 = chord_and_tangent(F, P2)

and uses an algorithm that fails if P3 is equivalent to P2.

I think the attached patch fixes this problem. At least, with this patch it now works for my examples.

Best wishes,
Robin
constructor.py.diff

John Cremona

unread,
Jul 25, 2016, 7:07:31 AM7/25/16
to SAGE devel

Can someone make a trac ticket for this please?

--
You received this message because you are subscribed to the Google Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
To post to this group, send email to sage-...@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Jeroen Demeyer

unread,
Jul 25, 2016, 11:43:50 AM7/25/16
to sage-...@googlegroups.com
On 2016-07-25 13:07, John Cremona wrote:
> Can someone make a trac ticket for this please?

Done: https://trac.sagemath.org/ticket/21092

leif

unread,
Jul 25, 2016, 12:03:19 PM7/25/16
to sage-...@googlegroups.com
Ooops, race condition (I did look at the trac timeline!).

On behalf of John (Forgot your password?):

https://trac.sagemath.org/ticket/21093



-leif

John Cremona

unread,
Jul 26, 2016, 7:55:44 AM7/26/16
to SAGE devel


On 25 Jul 2016 17:03, "leif" <not.r...@online.de> wrote:
>
> Jeroen Demeyer wrote:
> > On 2016-07-25 13:07, John Cremona wrote:
> >> Can someone make a trac ticket for this please?
> >
> > Done: https://trac.sagemath.org/ticket/21092
>
> Ooops, race condition (I did look at the trac timeline!).
>
> On behalf of John (Forgot your password?):

No just away from home with only a phone.

>
> https://trac.sagemath.org/ticket/21093
>
>
>
> -leif

Robin Houston

unread,
Jul 29, 2016, 6:54:26 PM7/29/16
to sage-devel
I think there’s another case that isn’t handled correctly, exemplified by:

R.<x,y,z> = QQ[]

T = EllipticCurve_from_cubic(y^2*z - x^3 - z^3, (0,1,0))


A simple change that fixes this problem is to make the projective_point() method not blow up when given (0,0,0), e.g.:


--- a/src/sage/schemes/elliptic_curves/constructor.py

+++ b/src/sage/schemes/elliptic_curves/constructor.py

@@ -1127,6 +1127,8 @@ def projective_point(p):

         p_lcm = LCM_list([x.denominator() for x in p])

     except AttributeError:

         return p

+    if p_gcd == 0:

+        return p

     scale = p_lcm / p_gcd

     return [scale * x for x in p]

 


This change may be undesirable for other reasons, though.


Robin

John Cremona

unread,
Jul 30, 2016, 5:43:44 AM7/30/16
to SAGE devel

I think that an error should be raised if the projective point constructor is called with (0,0,0). 

Robin Houston

unread,
Aug 1, 2016, 8:26:42 AM8/1/16
to sage-...@googlegroups.com
Okay, that’s reasonable. How about the attached, then?

Robin

You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/ywH31HkRo7g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
cubic2.patch
Reply all
Reply to author
Forward
0 new messages