rem
stringlengths 0
322k
| add
stringlengths 0
2.05M
| context
stringlengths 8
228k
|
---|---|---|
Returns the lower and upper corners of a 3D bounding box for self. This is used for rendering and self should fit entirely within this
|
Returns the lower and upper corners of a 3-D bounding box for ``self``. This is used for rendering and ``self`` should fit entirely within this
|
def bounding_box(self): """ Returns the lower and upper corners of a 3D bounding box for self. This is used for rendering and self should fit entirely within this box. In this case, we simply return the center of the point.
|
using Tachyon ray tracer.
|
using the Tachyon ray tracer.
|
def tachyon_repr(self, render_params): """ Returns representation of the point suitable for plotting using Tachyon ray tracer.
|
Create the graphics primitive :class:`Line` in 3D. See the
|
Create the graphics primitive :class:`Line` in 3-D. See the
|
def __init__(self, points, thickness=5, corner_cutoff=.5, arrow_head=False, **kwds): """ Create the graphics primitive :class:`Line` in 3D. See the docstring of this class for full documentation.
|
Returns the lower and upper corners of a 3D bounding box for self. This is used for rendering and self should fit entirely within this
|
Returns the lower and upper corners of a 3-D bounding box for ``self``. This is used for rendering and ``self`` should fit entirely within this
|
def bounding_box(self): """ Returns the lower and upper corners of a 3D bounding box for self. This is used for rendering and self should fit entirely within this box. In this case, we return the highest and lowest values of each coordinate among all points.
|
using Tachyon ray tracer.
|
using the Tachyon ray tracer.
|
def tachyon_repr(self, render_params): """ Returns representation of the line suitable for plotting using Tachyon ray tracer.
|
def quotient(self, sub, check=True):
|
def quotient(self, sub, check=True, positive_point=None, positive_dual_point=None):
|
def quotient(self, sub, check=True): """ Return the quotient of ``self`` by the given sublattice ``sub``. INPUT:
|
Torsion quotient of 3-d lattice N by Sublattice <N(1, 8, 0), N(0, 12, 0)>
|
Quotient with torsion of 3-d lattice N by Sublattice <N(1, 8, 0), N(0, 12, 0)> See :class:`ToricLattice_quotient` for more examples.
|
def quotient(self, sub, check=True): """ Return the quotient of ``self`` by the given sublattice ``sub``. INPUT:
|
return ToricLattice_quotient(self, sub, check=False)
|
return ToricLattice_quotient(self, sub, check=False, positive_point=positive_point, positive_dual_point=positive_dual_point)
|
def quotient(self, sub, check=True): """ Return the quotient of ``self`` by the given sublattice ``sub``. INPUT:
|
meth:`~sage.modules.free_module.FreeModule_generic_pid.submodule`,
|
:meth:`~sage.modules.free_module.FreeModule_generic_pid.submodule`,
|
def span(self, *args, **kwds): """ Return the span of the given generators.
|
meth:`~sage.modules.free_module.FreeModule_generic_pid.submodule_with_basis`,
|
:meth:`~sage.modules.free_module.FreeModule_generic_pid.submodule_with_basis`,
|
def span(self, *args, **kwds): """ Return the span of the given generators.
|
meth:`~sage.modules.free_module.FreeModule_generic_pid.submodule`,
|
:meth:`~sage.modules.free_module.FreeModule_generic_pid.submodule`,
|
def span_of_basis(self, *args, **kwds): r""" Return the submodule with the given ``basis``.
|
meth:`~sage.modules.free_module.FreeModule_generic_pid.submodule_with_basis`,
|
:meth:`~sage.modules.free_module.FreeModule_generic_pid.submodule_with_basis`,
|
def span_of_basis(self, *args, **kwds): r""" Return the submodule with the given ``basis``.
|
1-d lattice, quotient of 3-d lattice N by Sublattice <N(1, 0, 1), N(0, 1, -1)>
|
1-d lattice, quotient of 3-d lattice N by Sublattice <N(1, 0, 1), N(0, 1, -1)> sage: Q.gens() (N[0, 0, 1],) Here, ``sublattice`` happens to be of codimension one in ``N``. If you want to prescribe the sign of the quotient generator, you can do either:: sage: Q = N.quotient(sublattice, positive_point=N(0,0,-1)); Q 1-d lattice, quotient of 3-d lattice N by Sublattice <N(1, 0, 1), N(0, 1, -1)> sage: Q.gens() (N[0, 0, -1],) or:: sage: M = N.dual() sage: Q = N.quotient(sublattice, positive_dual_point=M(0,0,-1)); Q 1-d lattice, quotient of 3-d lattice N by Sublattice <N(1, 0, 1), N(0, 1, -1)> sage: Q.gens() (N[0, 0, -1],) TESTS:: sage: loads(dumps(Q)) == Q True sage: loads(dumps(Q)).gens() == Q.gens() True
|
def _latex_(self): r""" Return a LaTeX representation of ``self``. OUTPUT:
|
Torsion quotient of 3-d lattice N
|
Quotient with torsion of 3-d lattice N
|
def _repr_(self): r""" Return a string representation of ``self``.
|
return "Torsion quotient of %s by %s" % (self.V(), self.W())
|
return "Quotient with torsion of %s by %s" % (self.V(), self.W())
|
def _repr_(self): r""" Return a string representation of ``self``.
|
- integer.
|
Integer. The dimension of the free part of the quotient.
|
def rank(self): r""" Return the rank of ``self``. OUTPUT: - integer. EXAMPLES:: sage: N = ToricLattice(3) sage: Ns = N.submodule([N(2,4,0), N(9,12,0)]) sage: Q = N/Ns sage: Q.rank() 1 sage: Ns = N.submodule([N(1,4,0)]) sage: Q = N/Ns sage: Q.rank() 2 """ return self.V().rank() - self.W().rank()
|
EXAMPLES:
|
EXAMPLES::
|
def overlap_partition(self, other, delay=0, p=None, involution=None) : r""" Returns the partition of the alphabet induced by the overlap of self and other with the given delay.
|
class _python_object_alphabet(object):
|
class _python_object_alphabet(UniqueRepresentation):
|
def __contains__(self, x): """ Returns True if x is contained in self.
|
def parse_deps(self, filename, verify=True):
|
def parse_deps(self, filename, ext_module, verify=True):
|
def parse_deps(self, filename, verify=True): """ Open a Cython file and extract all of its dependencies. INPUT: filename -- the file to parse verify -- only return existing files (default True) OUTPUT: list of dependency files """ # only parse cython files if filename[-4:] not in ('.pyx', '.pxd', '.pxi'): return [] dirname = os.path.split(filename)[0] deps = set() if filename.endswith('.pyx'): pxd_file = filename[:-4] + '.pxd' if os.path.exists(pxd_file): deps.add(pxd_file) raw_deps = [] f = open(filename) for m in dep_regex.finditer(open(filename).read()): groups = m.groups() modules = groups[0] or groups[1] # cimport or from ... cimport if modules is not None: for module in modules.split(','): module = module.strip().split(' ')[0] # get rid of 'as' clause if '.' in module: path = module.replace('.', '/') + '.pxd' base_dependency_name = path else: path = "%s/%s.pxd" % (dirname, module) base_dependency_name = "%s.pxd"%module raw_deps.append((path, base_dependency_name)) else: # include or extern from extern_file = groups[2] or groups[3] path = '%s/%s'%(dirname, extern_file) if not os.path.exists(path): path = extern_file raw_deps.append((path, extern_file))
|
if filename[-4:] not in ('.pyx', '.pxd', '.pxi'):
|
if not is_cython_file(filename):
|
def parse_deps(self, filename, verify=True): """ Open a Cython file and extract all of its dependencies. INPUT: filename -- the file to parse verify -- only return existing files (default True) OUTPUT: list of dependency files """ # only parse cython files if filename[-4:] not in ('.pyx', '.pxd', '.pxi'): return [] dirname = os.path.split(filename)[0] deps = set() if filename.endswith('.pyx'): pxd_file = filename[:-4] + '.pxd' if os.path.exists(pxd_file): deps.add(pxd_file) raw_deps = [] f = open(filename) for m in dep_regex.finditer(open(filename).read()): groups = m.groups() modules = groups[0] or groups[1] # cimport or from ... cimport if modules is not None: for module in modules.split(','): module = module.strip().split(' ')[0] # get rid of 'as' clause if '.' in module: path = module.replace('.', '/') + '.pxd' base_dependency_name = path else: path = "%s/%s.pxd" % (dirname, module) base_dependency_name = "%s.pxd"%module raw_deps.append((path, base_dependency_name)) else: # include or extern from extern_file = groups[2] or groups[3] path = '%s/%s'%(dirname, extern_file) if not os.path.exists(path): path = extern_file raw_deps.append((path, extern_file))
|
for idir in CYTHON_INCLUDE_DIRS: new_path = os.path.normpath(idir + base_dependency_name)
|
for idir in ext_module.include_dirs + CYTHON_INCLUDE_DIRS + include_dirs + extra_include_dirs: new_path = os.path.normpath(idir + '/' + base_dependency_name)
|
def parse_deps(self, filename, verify=True): """ Open a Cython file and extract all of its dependencies. INPUT: filename -- the file to parse verify -- only return existing files (default True) OUTPUT: list of dependency files """ # only parse cython files if filename[-4:] not in ('.pyx', '.pxd', '.pxi'): return [] dirname = os.path.split(filename)[0] deps = set() if filename.endswith('.pyx'): pxd_file = filename[:-4] + '.pxd' if os.path.exists(pxd_file): deps.add(pxd_file) raw_deps = [] f = open(filename) for m in dep_regex.finditer(open(filename).read()): groups = m.groups() modules = groups[0] or groups[1] # cimport or from ... cimport if modules is not None: for module in modules.split(','): module = module.strip().split(' ')[0] # get rid of 'as' clause if '.' in module: path = module.replace('.', '/') + '.pxd' base_dependency_name = path else: path = "%s/%s.pxd" % (dirname, module) base_dependency_name = "%s.pxd"%module raw_deps.append((path, base_dependency_name)) else: # include or extern from extern_file = groups[2] or groups[3] path = '%s/%s'%(dirname, extern_file) if not os.path.exists(path): path = extern_file raw_deps.append((path, extern_file))
|
if path[-2:] != '.h': raise IOError, "could not find dependency %s included in %s."%(path, filename)
|
msg = 'could not find dependency %s included in %s.'%(path, filename) if is_cython_file(filename): raise IOError, msg else: warnings.warn(msg+' I will assume it is a system C/C++ header.')
|
def parse_deps(self, filename, verify=True): """ Open a Cython file and extract all of its dependencies. INPUT: filename -- the file to parse verify -- only return existing files (default True) OUTPUT: list of dependency files """ # only parse cython files if filename[-4:] not in ('.pyx', '.pxd', '.pxi'): return [] dirname = os.path.split(filename)[0] deps = set() if filename.endswith('.pyx'): pxd_file = filename[:-4] + '.pxd' if os.path.exists(pxd_file): deps.add(pxd_file) raw_deps = [] f = open(filename) for m in dep_regex.finditer(open(filename).read()): groups = m.groups() modules = groups[0] or groups[1] # cimport or from ... cimport if modules is not None: for module in modules.split(','): module = module.strip().split(' ')[0] # get rid of 'as' clause if '.' in module: path = module.replace('.', '/') + '.pxd' base_dependency_name = path else: path = "%s/%s.pxd" % (dirname, module) base_dependency_name = "%s.pxd"%module raw_deps.append((path, base_dependency_name)) else: # include or extern from extern_file = groups[2] or groups[3] path = '%s/%s'%(dirname, extern_file) if not os.path.exists(path): path = extern_file raw_deps.append((path, extern_file))
|
def immediate_deps(self, filename):
|
def immediate_deps(self, filename, ext_module):
|
def immediate_deps(self, filename): """ Returns a list of files directly referenced by this file. """ if (filename not in self._deps or self.timestamp(filename) < self._last_parse[filename]): self._deps[filename] = self.parse_deps(filename) self._last_parse[filename] = self.timestamp(filename) return self._deps[filename]
|
self._deps[filename] = self.parse_deps(filename)
|
self._deps[filename] = self.parse_deps(filename, ext_module)
|
def immediate_deps(self, filename): """ Returns a list of files directly referenced by this file. """ if (filename not in self._deps or self.timestamp(filename) < self._last_parse[filename]): self._deps[filename] = self.parse_deps(filename) self._last_parse[filename] = self.timestamp(filename) return self._deps[filename]
|
def all_deps(self, filename, path=None):
|
def all_deps(self, filename, ext_module, path=None):
|
def all_deps(self, filename, path=None): """ Returns all files directly or indirectly referenced by this file. A recursive algorithm is used here to maximize caching, but it is still robust for circular cimports (via the path parameter). """ if filename not in self._deps_all: circular = False deps = set([filename]) if path is None: path = set([filename]) else: path.add(filename) for f in self.immediate_deps(filename): if f not in path: deps.update(self.all_deps(f, path)) else: circular = True path.remove(filename) if circular: return deps # Don't cache, as this may be incomplete else: self._deps_all[filename] = deps return self._deps_all[filename]
|
for f in self.immediate_deps(filename):
|
for f in self.immediate_deps(filename, ext_module):
|
def all_deps(self, filename, path=None): """ Returns all files directly or indirectly referenced by this file. A recursive algorithm is used here to maximize caching, but it is still robust for circular cimports (via the path parameter). """ if filename not in self._deps_all: circular = False deps = set([filename]) if path is None: path = set([filename]) else: path.add(filename) for f in self.immediate_deps(filename): if f not in path: deps.update(self.all_deps(f, path)) else: circular = True path.remove(filename) if circular: return deps # Don't cache, as this may be incomplete else: self._deps_all[filename] = deps return self._deps_all[filename]
|
deps.update(self.all_deps(f, path))
|
deps.update(self.all_deps(f, ext_module, path))
|
def all_deps(self, filename, path=None): """ Returns all files directly or indirectly referenced by this file. A recursive algorithm is used here to maximize caching, but it is still robust for circular cimports (via the path parameter). """ if filename not in self._deps_all: circular = False deps = set([filename]) if path is None: path = set([filename]) else: path.add(filename) for f in self.immediate_deps(filename): if f not in path: deps.update(self.all_deps(f, path)) else: circular = True path.remove(filename) if circular: return deps # Don't cache, as this may be incomplete else: self._deps_all[filename] = deps return self._deps_all[filename]
|
def newest_dep(self, filename):
|
def newest_dep(self, filename, ext_module):
|
def newest_dep(self, filename): """ Returns the most recently modified file that filename depends on, along with its timestamp. """ nfile = filename ntime = self.timestamp(filename) for f in self.all_deps(filename): if self.timestamp(f) > ntime: nfile = f ntime = self.timestamp(f) return nfile, ntime
|
for f in self.all_deps(filename):
|
for f in self.all_deps(filename, ext_module):
|
def newest_dep(self, filename): """ Returns the most recently modified file that filename depends on, along with its timestamp. """ nfile = filename ntime = self.timestamp(filename) for f in self.all_deps(filename): if self.timestamp(f) > ntime: nfile = f ntime = self.timestamp(f) return nfile, ntime
|
dep_file, dep_time = deps.newest_dep(f)
|
dep_file, dep_time = deps.newest_dep(f,m)
|
def compile_command_list(ext_modules, deps): """ Computes a list of commands needed to compile and link the extension modules given in 'ext_modules' """ queue_compile_high = [] queue_compile_med = [] queue_compile_low = [] for m in ext_modules: new_sources = [] for f in m.sources: if f.endswith('.pyx'): dep_file, dep_time = deps.newest_dep(f) dest_file = "%s/%s"%(SITE_PACKAGES, f) dest_time = deps.timestamp(dest_file) if dest_time < dep_time: if dep_file == f: print "Building modified file %s."%f queue_compile_high.append([compile_command, (f,m)]) elif dep_file == (f[:-4] + '.pxd'): print "Building %s because it depends on %s."%(f, dep_file) queue_compile_med.append([compile_command, (f,m)]) else: print "Building %s because it depends on %s."%(f, dep_file) queue_compile_low.append([compile_command, (f,m)]) new_sources.append(process_filename(f, m)) m.sources = new_sources return queue_compile_high + queue_compile_med + queue_compile_low
|
Shafarevich-Tate group for the Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field
|
Tate-Shafarevich group for the Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field
|
def update(self): """ Updates some properties from ``curve``.
|
A curve for which 3 divides the order of the Shafarevich-Tate group::
|
A curve for which 3 divides the order of the Tate-Shafarevich group::
|
sage: def foo(use_database):
|
ValueError: polys (=[x - y, x*y]) must be homogeneous of the same degree
|
ValueError: polys (=[x - y, x*y]) must be of the same degree sage: H([x-1, x*y+x]) Traceback (most recent call last): ... ValueError: polys (=[x - 1, x*y + x]) must be homogeneous
|
def _repr_defn(self): """ This function is used internally for printing.
|
deg = self.defining_polynomials()[0].degree() for poly in self.defining_polynomials(): if (poly.degree() != deg) or not poly.is_homogeneous(): raise ValueError, "polys (=%s) must be homogeneous of the same degree"%polys
|
polys = self.defining_polynomials() try: d = polys[0].degree() except AttributeError: polys = [f.lift() for f in polys] if not all([f.is_homogeneous() for f in polys]): raise ValueError, "polys (=%s) must be homogeneous"%polys degs = [f.degree() for f in polys] if not all([d==degs[0] for d in degs[1:]]): raise ValueError, "polys (=%s) must be of the same degree"%polys
|
def __init__(self, parent, polys, check=True): SchemeMorphism_on_points.__init__(self, parent, polys, check) if check: # morphisms from projective space are always given by # homogeneous polynomials of the same degree deg = self.defining_polynomials()[0].degree() for poly in self.defining_polynomials(): if (poly.degree() != deg) or not poly.is_homogeneous(): raise ValueError, "polys (=%s) must be homogeneous of the same degree"%polys
|
return 0
|
return ZZ(0)
|
def _eval_(self, x): """ EXAMPLES::
|
return 1
|
return ZZ(1)
|
def _eval_(self, x): """ EXAMPLES::
|
return -1
|
return ZZ(-1)
|
def _eval_(self, x): """ EXAMPLES::
|
Construct a module with basis from the data in ``x``
|
Construct a module with basis from the data in ``x``.
|
def _call_(self, x): """ Construct a module with basis from the data in ``x``
|
Returns whether this category is abelian
|
Returns whether this category is abelian.
|
def is_abelian(self): """ Returns whether this category is abelian
|
With the ``zero`` argument, one can define affine morphisms:
|
With the ``zero`` argument, one can define affine morphisms::
|
def module_morphism(self, on_basis = None, diagonal = None, triangular = None, **keywords): r""" Constructs morphisms by linearity
|
Or more generaly any ring admitting a coercion map from the base ring:
|
Or more generaly any ring admitting a coercion map from the base ring::
|
def module_morphism(self, on_basis = None, diagonal = None, triangular = None, **keywords): r""" Constructs morphisms by linearity
|
I
|
i
|
def _sympy_(self): """ Converts pi to sympy pi. EXAMPLES:: sage: import sympy sage: sympy.pi == pi # indirect doctest True """ import sympy return sympy.pi
|
def is_cyclic_ordered(x1,x2,x3): return ( (x1 < x2 and x2 < x3) or (x2 < x3 and x3 < x1) or (x3 < x1 and x1 < x2))
|
def is_cyclic_ordered(x1,x2,x3): return ( (x1 < x2 and x2 < x3) or (x2 < x3 and x3 < x1) or (x3 < x1 and x1 < x2))
|
|
Primitive class for the Arc graphics type. See arc? for information
|
Primitive class for the Arc graphics type. See ``arc?`` for information
|
def is_cyclic_ordered(x1,x2,x3): return ( (x1 < x2 and x2 < x3) or (x2 < x3 and x3 < x1) or (x3 < x1 and x1 < x2))
|
Note that the construction should be done using arc::
|
Note that the construction should be done using ``arc``::
|
def is_cyclic_ordered(x1,x2,x3): return ( (x1 < x2 and x2 < x3) or (x2 < x3 and x3 < x1) or (x3 < x1 and x1 < x2))
|
Initializes base class Arc.
|
Initializes base class ``Arc``.
|
def __init__(self, x, y, r1, r2, angle, s1, s2, options): """ Initializes base class Arc.
|
Return the allowed options for the Arc class.
|
Return the allowed options for the ``Arc`` class.
|
def _allowed_options(self): """ Return the allowed options for the Arc class.
|
String representation of Arc primitive.
|
String representation of ``Arc`` primitive.
|
def _repr_(self): """ String representation of Arc primitive.
|
TESTS:
|
TESTS::
|
def plot3d(self): r""" TESTS:
|
integers n -1.
|
integers n >= 1.
|
def spherical_bessel_J(n, var, algorithm="maxima"): r""" Returns the spherical Bessel function of the first kind for integers n -1. Reference: AS 10.1.8 page 437 and AS 10.1.15 page 439. EXAMPLES:: sage: spherical_bessel_J(2,x) ((3/x^2 - 1)*sin(x) - 3*cos(x)/x)/x """ if algorithm=="scipy": import scipy.special ans = str(scipy.special.sph_jn(int(n),float(var))) ans = ans.replace("(","") ans = ans.replace(")","") ans = ans.replace("j","*I") return sage_eval(ans) elif algorithm == 'maxima': _init() return meval("spherical_bessel_j(%s,%s)"%(ZZ(n),var)) else: raise ValueError, "unknown algorithm '%s'"%algorithm
|
import scipy.special ans = str(scipy.special.sph_jn(int(n),float(var))) ans = ans.replace("(","") ans = ans.replace(")","") ans = ans.replace("j","*I") return sage_eval(ans)
|
from scipy.special.specfun import sphj return sphj(int(n), float(var))[1][-1]
|
def spherical_bessel_J(n, var, algorithm="maxima"): r""" Returns the spherical Bessel function of the first kind for integers n -1. Reference: AS 10.1.8 page 437 and AS 10.1.15 page 439. EXAMPLES:: sage: spherical_bessel_J(2,x) ((3/x^2 - 1)*sin(x) - 3*cos(x)/x)/x """ if algorithm=="scipy": import scipy.special ans = str(scipy.special.sph_jn(int(n),float(var))) ans = ans.replace("(","") ans = ans.replace(")","") ans = ans.replace("j","*I") return sage_eval(ans) elif algorithm == 'maxima': _init() return meval("spherical_bessel_j(%s,%s)"%(ZZ(n),var)) else: raise ValueError, "unknown algorithm '%s'"%algorithm
|
this function is not called) is n=15, but it might have to be
|
this function is not called) is ``n=15``, but it might have to be
|
def set_precision(n): r""" Set the global NTL real number precision. This has a massive effect on the speed of mwrank calculations. The default (used if this function is not called) is n=15, but it might have to be increased if a computation fails. In this case, one must recreate the mwrank curve from scratch after resetting this precision. INPUT: - `n` (long) -- real precision used for floating point computations in the library, in decimal digits. .. note:: This change is global and affects all of Sage. EXAMPLES:: sage: mwrank_set_precision(20) """ # don't want to load mwrank every time Sage starts up, so we do # the import here. from sage.libs.mwrank.mwrank import set_precision set_precision(n)
|
- `n` (long) -- real precision used for floating point
|
- ``n`` (long) -- real precision used for floating point
|
def set_precision(n): r""" Set the global NTL real number precision. This has a massive effect on the speed of mwrank calculations. The default (used if this function is not called) is n=15, but it might have to be increased if a computation fails. In this case, one must recreate the mwrank curve from scratch after resetting this precision. INPUT: - `n` (long) -- real precision used for floating point computations in the library, in decimal digits. .. note:: This change is global and affects all of Sage. EXAMPLES:: sage: mwrank_set_precision(20) """ # don't want to load mwrank every time Sage starts up, so we do # the import here. from sage.libs.mwrank.mwrank import set_precision set_precision(n)
|
.. note:: This change is global and affects all of Sage.
|
.. warning:: This change is global and affects *all* of Sage.
|
def set_precision(n): r""" Set the global NTL real number precision. This has a massive effect on the speed of mwrank calculations. The default (used if this function is not called) is n=15, but it might have to be increased if a computation fails. In this case, one must recreate the mwrank curve from scratch after resetting this precision. INPUT: - `n` (long) -- real precision used for floating point computations in the library, in decimal digits. .. note:: This change is global and affects all of Sage. EXAMPLES:: sage: mwrank_set_precision(20) """ # don't want to load mwrank every time Sage starts up, so we do # the import here. from sage.libs.mwrank.mwrank import set_precision set_precision(n)
|
curve using the Curvedata class from eclib, called here an 'mwrank
|
curve using the ``Curvedata`` class from ``eclib``, called here an 'mwrank
|
def set_precision(n): r""" Set the global NTL real number precision. This has a massive effect on the speed of mwrank calculations. The default (used if this function is not called) is n=15, but it might have to be increased if a computation fails. In this case, one must recreate the mwrank curve from scratch after resetting this precision. INPUT: - `n` (long) -- real precision used for floating point computations in the library, in decimal digits. .. note:: This change is global and affects all of Sage. EXAMPLES:: sage: mwrank_set_precision(20) """ # don't want to load mwrank every time Sage starts up, so we do # the import here. from sage.libs.mwrank.mwrank import set_precision set_precision(n)
|
``a_invs``, which is a list of `\leq 5` \emph{integers} `a_1`, `a_2`, `a_3`, `a_4`, and `a_`$. If strictly less than 5 invariants are given, then the first ones are set to 0, so, e.g., ``[3,4] means `a_1=a_2=a_3=0` and `a_4=3`, `a_6=4`. INPUT: - `ainvs` (list or tuple) -- a list of <= 5 integers, the coefficients of a nonsingular Weierstrass equation. - `verbose` (bool, default False) -- verbosity flag. If True, then all Selmer group computations will be verbose.
|
``ainvs``, which is a list of 5 or less *integers* `a_1`, `a_2`, `a_3`, `a_4`, and `a_5`. See the docstring of this class for full documentation.
|
def __init__(self, ainvs, verbose=False): r""" Create the mwrank elliptic curve with invariants ``a_invs``, which is a list of `\leq 5` \emph{integers} `a_1`, `a_2`, `a_3`, `a_4`, and `a_`$.
|
This example illustrates that omitted $a$-invariants default to $0$:: sage: e = mwrank_EllipticCurve([3, -4]) sage: e y^2 = x^3 + 3*x - 4 sage: e.ainvs() [0, 0, 0, 3, -4] The entries of the input list are coerced to :class:`int`. If this is impossible then an error is raised:: sage: e = mwrank_EllipticCurve([3, -4.8]); e Traceback (most recent call last): ... TypeError: ainvs must be a list of integers. When you enter a singular model you get an exception:: sage: e = mwrank_EllipticCurve([0, 0]) Traceback (most recent call last): ... ArithmeticError: Invariants (= [0, 0, 0, 0, 0]) do not describe an elliptic curve.
|
def __init__(self, ainvs, verbose=False): r""" Create the mwrank elliptic curve with invariants ``a_invs``, which is a list of `\leq 5` \emph{integers} `a_1`, `a_2`, `a_3`, `a_4`, and `a_`$.
|
|
if not isinstance(ainvs, list) and len(ainvs) <= 5: raise TypeError, "ainvs must be a list of length at most 5."
|
if not isinstance(ainvs, (list,tuple)) or not len(ainvs) <= 5: raise TypeError, "ainvs must be a list or tuple of length at most 5."
|
def __init__(self, ainvs, verbose=False): r""" Create the mwrank elliptic curve with invariants ``a_invs``, which is a list of `\leq 5` \emph{integers} `a_1`, `a_2`, `a_3`, `a_4`, and `a_`$.
|
raise TypeError, "ainvs must be a list of integers."
|
raise TypeError, "ainvs must be a list or tuple of integers."
|
def __init__(self, ainvs, verbose=False): r""" Create the mwrank elliptic curve with invariants ``a_invs``, which is a list of `\leq 5` \emph{integers} `a_1`, `a_2`, `a_3`, `a_4`, and `a_`$.
|
Set the verbosity of printing of output by the 2-descent and
|
Set the verbosity of printing of output by the :meth:`two_descent()` and
|
def set_verbose(self, verbose): """ Set the verbosity of printing of output by the 2-descent and other functions.
|
- `verbose` (int) -- if positive, print lots of output when
|
- ``verbose`` (int) -- if positive, print lots of output when
|
def set_verbose(self, verbose): """ Set the verbosity of printing of output by the 2-descent and other functions.
|
Returns the underlying _Curvedata class for this mwrank elliptic curve.
|
Returns the underlying :class:`_Curvedata` class for this mwrank elliptic curve.
|
def _curve_data(self): r""" Returns the underlying _Curvedata class for this mwrank elliptic curve.
|
- ``verbose`` (bool, default True) -- print what mwrank is doing - ``selmer_only`` (bool, default False) -- selmer_only switch
|
- ``verbose`` (bool, default ``True``) -- print what mwrank is doing. - ``selmer_only`` (bool, default ``False``) -- ``selmer_only`` switch.
|
def two_descent(self, verbose = True, selmer_only = False, first_limit = 20, second_limit = 8, n_aux = -1, second_descent = True): """ Compute 2-descent data for this curve.
|
quartic point search - ``second_limit`` (int, default 8) -- bound on `\log `max(|x|,|z|)`, i.e. logarithmic
|
quartic point search. - ``second_limit`` (int, default 8) -- bound on `\log \max(|x|,|z|)`, i.e. logarithmic.
|
def two_descent(self, verbose = True, selmer_only = False, first_limit = 20, second_limit = 8, n_aux = -1, second_descent = True): """ Compute 2-descent data for this curve.
|
quartic search. n_aux=-1 causes default (8) to be used.
|
quartic search. ``n_aux=-1`` causes default (8) to be used.
|
def two_descent(self, verbose = True, selmer_only = False, first_limit = 20, second_limit = 8, n_aux = -1, second_descent = True): """ Compute 2-descent data for this curve.
|
- ``second_descent`` (bool, default True) -- (only relevant
|
- ``second_descent`` (bool, default ``True``) -- (only relevant
|
def two_descent(self, verbose = True, selmer_only = False, first_limit = 20, second_limit = 8, n_aux = -1, second_descent = True): """ Compute 2-descent data for this curve.
|
descent. Default strongloy recommended.
|
descent. *Default strongly recommended.*
|
def two_descent(self, verbose = True, selmer_only = False, first_limit = 20, second_limit = 8, n_aux = -1, second_descent = True): """ Compute 2-descent data for this curve.
|
Nothing -- nothing is returned
|
Nothing -- nothing is returned.
|
def two_descent(self, verbose = True, selmer_only = False, first_limit = 20, second_limit = 8, n_aux = -1, second_descent = True): """ Compute 2-descent data for this curve.
|
Returns the rank of this curve, computed using 2-descent.
|
Returns the rank of this curve, computed using :meth:`two_descent()`.
|
def rank(self): """ Returns the rank of this curve, computed using 2-descent.
|
upper bound may be obtained using the function rank_bound().
|
upper bound may be obtained using the function :meth:`rank_bound()`.
|
def rank(self): """ Returns the rank of this curve, computed using 2-descent.
|
the method :meth:`certain`.
|
the method :meth:`certain()`.
|
def rank(self): """ Returns the rank of this curve, computed using 2-descent.
|
using 2-descent.
|
using :meth:`two_descent()`.
|
def rank_bound(self): """ Returns an upper bound for the rank of this curve, computed using 2-descent.
|
of order 4, we only obtain an upper bound of 2:
|
of order 4, we only obtain an upper bound of 2::
|
def rank_bound(self): """ Returns an upper bound for the rank of this curve, computed using 2-descent.
|
In this case the value returned by :meth:`rank` is only a lower bound in general (though in this is correct)::
|
In this case the value returned by :meth:`rank()` is only a lower bound in general (though this is correct)::
|
def rank_bound(self): """ Returns an upper bound for the rank of this curve, computed using 2-descent.
|
the computation again but turn off the second descent::
|
the computation again but turn off ``second_descent``::
|
def selmer_rank(self): r""" Returns the rank of the 2-Selmer group of the curve. EXAMPLES:
|
but with no 2-torsion, the selmer rank is strictly greater
|
but with no 2-torsion, the Selmer rank is strictly greater
|
def selmer_rank(self): r""" Returns the rank of the 2-Selmer group of the curve. EXAMPLES:
|
primes up to bound.
|
primes up to ``bound``.
|
def saturate(self, bound=-1): """ Compute the saturation of the Mordell-Weil group at all primes up to bound.
|
- `bound` (int, default -1) -- Use `-1` (the default) to
|
- ``bound`` (int, default -1) -- Use `-1` (the default) to
|
def saturate(self, bound=-1): """ Compute the saturation of the Mordell-Weil group at all primes up to bound.
|
True if the last :meth:`two_descent` call provably correctly computed the rank. If :meth:`two_descent` hasn't been called, then it is first called by :meth:`certain`
|
Returns ``True`` if the last :meth:`two_descent()` call provably correctly computed the rank. If :meth:`two_descent()` hasn't been called, then it is first called by :meth:`certain()`
|
def certain(self): r""" True if the last :meth:`two_descent` call provably correctly computed the rank. If :meth:`two_descent` hasn't been called, then it is first called by :meth:`certain` using the default parameters.
|
The result is true if and only if the results of the methods :meth:`rank` and :meth:`rank_bound` are equal.
|
The result is ``True`` if and only if the results of the methods :meth:`rank()` and :meth:`rank_bound()` are equal.
|
def certain(self): r""" True if the last :meth:`two_descent` call provably correctly computed the rank. If :meth:`two_descent` hasn't been called, then it is first called by :meth:`certain` using the default parameters.
|
for the curve `y^2 + y = x^3 - x^2 - 120x - 2183`.::
|
for the curve `y^2 + y = x^3 - x^2 - 120x - 2183`::
|
def certain(self): r""" True if the last :meth:`two_descent` call provably correctly computed the rank. If :meth:`two_descent` hasn't been called, then it is first called by :meth:`certain` using the default parameters.
|
computing the L-function), but Sha has order 4 and the $2$-torsion is trivial, so mwrank cannot conclusively
|
computing the `L`-function), but Sha has order 4 and the 2-torsion is trivial, so mwrank cannot conclusively
|
def certain(self): r""" True if the last :meth:`two_descent` call provably correctly computed the rank. If :meth:`two_descent` hasn't been called, then it is first called by :meth:`certain` using the default parameters.
|
floating point number $B$ such that if $P$ is a point on the curve, then the naive logarithmic height $h(P)$ is less than $B+\hat{h}(P)$, where $\hat{h}(P)$ is the canonical height of $P$.
|
floating point number `B` such that if `P` is a point on the curve, then the naive logarithmic height `h(P)` is less than `B+\hat{h}(P)`, where `\hat{h}(P)` is the canonical height of `P`.
|
def CPS_height_bound(self): r""" Return the Cremona-Prickett-Siksek height bound. This is a floating point number $B$ such that if $P$ is a point on the curve, then the naive logarithmic height $h(P)$ is less than $B+\hat{h}(P)$, where $\hat{h}(P)$ is the canonical height of $P$.
|
number $B$ such that if $P$ is a point on the curve, then the naive logarithmic height $h(P)$ is less than $B+\hat{h}(P)$, where $\hat{h}(P)$ is the canonical height of $P$.
|
number `B` such that if `P` is a point on the curve, then the naive logarithmic height `h(P)` is less than `B+\hat{h}(P)`, where `\hat{h}(P)` is the canonical height of `P`.
|
def silverman_bound(self): r""" Return the Silverman height bound. This is a floating point number $B$ such that if $P$ is a point on the curve, then the naive logarithmic height $h(P)$ is less than $B+\hat{h}(P)$, where $\hat{h}(P)$ is the canonical height of $P$.
|
INPUT: - `curve` (:class:`mwrank_EllipticCurve`) -- the underlying elliptic curve. - `verbose` (bool, default False) -- verbosity flag (controls amount of output produced in point searches) - `pp` (int, default 1) -- process points flag (if nonzero, the points found are processed, so that at all times only a `\ZZ`-basis for the subgroup generated by the points found so far is stored; if zero, no processing is done and all points found are stored). - `maxr` (int, default 999) -- maximum rank (quit point searching once the points found generate a subgroup of this rank; useful if an upper bound for the rank is already known).
|
See the docstring of this class for full documentation.
|
def __init__(self, curve, verbose=True, pp=1, maxr=999): r""" Constructor for the :class:`mwrank_MordellWeil` class.
|
Subgroup of Mordell Weil group: [] sage: EQ.search(2) The previous command produces the following output:: P1 = [0:1:0] is torsion point, order 1 P1 = [1:-1:1] is torsion point, order 2 P1 = [2:2:1] is torsion point, order 3 P1 = [9:23:1] is torsion point, order 6 sage: E = mwrank_EllipticCurve([0,0,1,-7,6]) sage: EQ = mwrank_MordellWeil(E) sage: EQ.search(2) sage: EQ Subgroup of Mordell Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]] Example to illustrate the verbose parameter:: sage: E = mwrank_EllipticCurve([0,0,1,-7,6]) sage: EQ = mwrank_MordellWeil(E, verbose=False) sage: EQ.search(1) sage: EQ Subgroup of Mordell Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]] sage: EQ = mwrank_MordellWeil(E, verbose=True) sage: EQ.search(1) The previous command produces the following output:: P1 = [0:1:0] is torsion point, order 1 P1 = [-3:0:1] is generator number 1 saturating up to 20...Checking 2-saturation Points have successfully been 2-saturated (max q used = 7) Checking 3-saturation Points have successfully been 3-saturated (max q used = 7) Checking 5-saturation Points have successfully been 5-saturated (max q used = 23) Checking 7-saturation Points have successfully been 7-saturated (max q used = 41) Checking 11-saturation Points have successfully been 11-saturated (max q used = 17) Checking 13-saturation Points have successfully been 13-saturated (max q used = 43) Checking 17-saturation Points have successfully been 17-saturated (max q used = 31) Checking 19-saturation Points have successfully been 19-saturated (max q used = 37) done P2 = [-2:3:1] is generator number 2 saturating up to 20...Checking 2-saturation possible kernel vector = [1,1] This point may be in 2E(Q): [14:-52:1] ...and it is! Replacing old generator Points have successfully been 2-saturated (max q used = 7) Index gain = 2^1 Checking 3-saturation Points have successfully been 3-saturated (max q used = 13) Checking 5-saturation Points have successfully been 5-saturated (max q used = 67) Checking 7-saturation Points have successfully been 7-saturated (max q used = 53) Checking 11-saturation Points have successfully been 11-saturated (max q used = 73) Checking 13-saturation Points have successfully been 13-saturated (max q used = 103) Checking 17-saturation Points have successfully been 17-saturated (max q used = 113) Checking 19-saturation Points have successfully been 19-saturated (max q used = 47) done (index = 2). Gained index 2, new generators = [ [1:-1:1] [-2:3:1] ] P3 = [-14:25:8] is generator number 3 saturating up to 20...Checking 2-saturation Points have successfully been 2-saturated (max q used = 11) Checking 3-saturation Points have successfully been 3-saturated (max q used = 13) Checking 5-saturation Points have successfully been 5-saturated (max q used = 71) Checking 7-saturation Points have successfully been 7-saturated (max q used = 101) Checking 11-saturation Points have successfully been 11-saturated (max q used = 127) Checking 13-saturation Points have successfully been 13-saturated (max q used = 151) Checking 17-saturation Points have successfully been 17-saturated (max q used = 139) Checking 19-saturation Points have successfully been 19-saturated (max q used = 179) done (index = 1). P4 = [-1:3:1] = -1*P1 + -1*P2 + -1*P3 (mod torsion) P4 = [0:2:1] = 2*P1 + 0*P2 + 1*P3 (mod torsion) P4 = [2:13:8] = -3*P1 + 1*P2 + -1*P3 (mod torsion) P4 = [1:0:1] = -1*P1 + 0*P2 + 0*P3 (mod torsion) P4 = [2:0:1] = -1*P1 + 1*P2 + 0*P3 (mod torsion) P4 = [18:7:8] = -2*P1 + -1*P2 + -1*P3 (mod torsion) P4 = [3:3:1] = 1*P1 + 0*P2 + 1*P3 (mod torsion) P4 = [4:6:1] = 0*P1 + -1*P2 + -1*P3 (mod torsion) P4 = [36:69:64] = 1*P1 + -2*P2 + 0*P3 (mod torsion) P4 = [68:-25:64] = -2*P1 + -1*P2 + -2*P3 (mod torsion) P4 = [12:35:27] = 1*P1 + -1*P2 + -1*P3 (mod torsion) sage: EQ Subgroup of Mordell Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]] Example to illustrate the `process points` parameter:: sage: E = mwrank_EllipticCurve([0,0,1,-7,6]) sage: EQ = mwrank_MordellWeil(E, verbose=False, pp=1) sage: EQ.search(1); EQ Subgroup of Mordell Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]] sage: EQ = mwrank_MordellWeil(E, verbose=False, pp=0) sage: EQ.search(1); EQ Subgroup of Mordell Weil group: [[-3:0:1], [-2:3:1], [-14:25:8], [-1:3:1], [0:2:1], [2:13:8], [1:0:1], [2:0:1], [18:7:8], [3:3:1], [4:6:1], [36:69:64], [68:-25:64], [12:35:27]]
|
Subgroup of Mordell-Weil group: []
|
def __init__(self, curve, verbose=True, pp=1, maxr=999): r""" Constructor for the :class:`mwrank_MordellWeil` class.
|
'Subgroup of Mordell Weil group: []'
|
'Subgroup of Mordell-Weil group: []'
|
def __repr__(self): r""" String representation of this Mordell-Weil subgroup.
|
'Subgroup of Mordell Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]]' """ return "Subgroup of Mordell Weil group: %s"%self.__mw
|
'Subgroup of Mordell-Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]]' """ return "Subgroup of Mordell-Weil group: %s"%self.__mw
|
def __repr__(self): r""" String representation of this Mordell-Weil subgroup.
|
This function allows one to add points to a mwrank_MordellWeil object. Process points in the list v, with saturation at primes up to sat. If sat = 0 (the default), do no saturation.
|
This function allows one to add points to a :class:`mwrank_MordellWeil` object. Process points in the list ``v``, with saturation at primes up to ``sat``. If ``sat`` is zero (the default), do no saturation.
|
def process(self, v, sat=0): """ This function allows one to add points to a mwrank_MordellWeil object.
|
- `v` (list of 3-tuples or lists of ints or Integers) -- a
|
- ``v`` (list of 3-tuples or lists of ints or Integers) -- a
|
def process(self, v, sat=0): """ This function allows one to add points to a mwrank_MordellWeil object.
|
- `sat` (int, default 0) --saturate at primes up to sat, or at all primes if sat=0.
|
- ``sat`` (int, default 0) -- saturate at primes up to ``sat``, or at *all* primes if ``sat`` is zero.
|
def process(self, v, sat=0): """ This function allows one to add points to a mwrank_MordellWeil object.
|
None. But note that if the verbose flag is set, then there
|
None. But note that if the ``verbose`` flag is set, then there
|
def process(self, v, sat=0): """ This function allows one to add points to a mwrank_MordellWeil object.
|
Example to illustrate the saturation parameter::
|
Example to illustrate the saturation parameter ``sat``::
|
def process(self, v, sat=0): """ This function allows one to add points to a mwrank_MordellWeil object.
|
raise TypeError, "v (=%s) must be a list of 3-tuples of ints"%v
|
raise TypeError, "v (=%s) must be a list of 3-tuples (or 3-element lists) of ints"%v
|
def process(self, v, sat=0): """ This function allows one to add points to a mwrank_MordellWeil object.
|
but the interface currently returns the output as a float.
|
but the interface currently returns the output as a ``float``.
|
def regulator(self): """ Return the regulator of the points in this subgroup of the Mordell-Weil group.
|
(float) the regulator of the points in this subgroup.
|
(float) The regulator of the points in this subgroup.
|
def regulator(self): """ Return the regulator of the points in this subgroup of the Mordell-Weil group.
|
OUTPUT: (int) The rank of this subgroup of the Mordell-Weil group.
|
def rank(self): """ Return the rank of this subgroup of the Mordell-Weil group.
|
|
Subgroup of Mordell Weil group: []
|
Subgroup of Mordell-Weil group: []
|
def rank(self): """ Return the rank of this subgroup of the Mordell-Weil group.
|
Subgroup of Mordell Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]]
|
Subgroup of Mordell-Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]]
|
def rank(self): """ Return the rank of this subgroup of the Mordell-Weil group.
|
all primes up to `max_prime`. If `-1` (default) then an
|
all primes up to ``max_prime``. If `-1` (the default), an
|
def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. INPUT: - ``max_prime`` (int, default -1) -- saturation is performed for all primes up to `max_prime`. If `-1` (default) then an upper bound is computed for the primes at which the subgroup may not be saturated, and this is used; however, if the computed bound is greater than a value set by the eclib library (currently 97) then no saturation will be attempted at primes above this. - ``odd_primes_only`` (bool, default False) -- only do saturation at odd primes. (If the points have been found via 2-descent they should alreday be 2-saturated.)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.