Coverage for local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/gp_simon.py : 80%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" Denis Simon's PARI scripts """ from __future__ import absolute_import
#***************************************************************************** # Copyright (C) 2005 William Stein <wstein@gmail.com> # # Distributed under the terms of the GNU General Public License (GPL) # # This code is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # The full text of the GPL is available at: # # http://www.gnu.org/licenses/ #*****************************************************************************
from sage.structure.parent_gens import localvars
from sage.interfaces.gp import Gp from sage.misc.sage_eval import sage_eval from sage.misc.randstate import current_randstate from sage.rings.all import QQ, ZZ from .constructor import EllipticCurve
gp = None def init(): """ Function to initialize the gp process """ global gp
def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None, maxprob=20, limbigprime=30, known_points=[]): """ Interface to Simon's gp script for two-descent.
.. NOTE::
Users should instead run E.simon_two_descent()
EXAMPLES::
sage: import sage.schemes.elliptic_curves.gp_simon sage: E=EllipticCurve('389a1') sage: sage.schemes.elliptic_curves.gp_simon.simon_two_descent(E) (2, 2, [(1 : 0 : 1), (-11/9 : 28/27 : 1)])
TESTS::
sage: E = EllipticCurve('37a1').change_ring(QuadraticField(-11,'x')) sage: E.simon_two_descent() (1, 1, [(0 : 0 : 1)])
An example with an elliptic curve defined over a relative number field::
sage: F.<a> = QuadraticField(29) sage: x = QQ['x'].gen() sage: K.<b> = F.extension(x^2-1/2*a+1/2) sage: E = EllipticCurve(K,[1, 0, 5/2*a + 27/2, 0, 0]) # long time (about 3 s) sage: E.simon_two_descent(lim1=2, limtriv=3) (1, 1, ...)
Check that :trac:`16022` is fixed::
sage: K.<y> = NumberField(x^4 + x^2 - 7) sage: E = EllipticCurve(K, [1, 0, 5*y^2 + 16, 0, 0]) sage: E.simon_two_descent(lim1=2, limtriv=3) # long time (about 3 s) (1, 1, ...)
An example that checks that :trac:`9322` is fixed (it should take less than a second to run)::
sage: K.<w> = NumberField(x^2-x-232) sage: E = EllipticCurve([2-w,18+3*w,209+9*w,2581+175*w,852-55*w]) sage: E.simon_two_descent() (0, 2, []) """
# The following is to correct the bug at #5204: the gp script # fails when K is a number field whose generator is called 'x'. # It also deals with relative number fields. # Simon's program requires that this name be y. else:
# The block below mimicks the defaults in Simon's scripts, and needs to be changed # when these are updated. else: lim1 = 2 lim3 = 4 limtriv = 2
verbose, lim1, lim3, limtriv, maxprob, limbigprime))
raise RuntimeError("\n%s\nAn error occurred while running Simon's 2-descent program"%s) raise RuntimeError("An error occurred while running Simon's 2-descent program")
# pari represents field elements as Mod(poly, defining-poly) # so this function will return the respective elements of K |