unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24754: problems with footnotes and a bug with links in emacs info
       [not found]       ` <6849fd8187dc4d119fdb2b6f4fbdc0b4@mbx13b.intern.tuwien.ac.at>
@ 2016-10-21  6:42         ` Rubey Martin
  2016-10-21 16:01           ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Rubey Martin @ 2016-10-21  6:42 UTC (permalink / raw)
  To: 24754

[-- Attachment #1: Type: text/plain, Size: 2901 bytes --]

(a previous version of this bug report was sent to bug-texinfo, but it turns out to be a bug in emacs, not in info...)

Dear all,

I have two problems with info in emacs.  Find attached a .texi file that exhibits both.  Note that none of the two problems exists in the standalone info reader!

After compiling this file with makeinfo, and viewing it in emacs with "C-u C-h i filename", please do the following:

1.) problem with footnotes:

select the fourth menu node

    The On-Line Encyclopedia of Integer Sequences (OEIS)

right at the beginning you will see

=========================================
AUTHORS:

   - Thierry Monteil (2012-02-10 – 2013-06-21): initial version.

   - Vincent Delecroix (2014): modifies continued fractions because of
     trac ticket #14567(1)

   - Moritz Firsching (2016): modifies handling of dead sequence, see
     trac ticket #17330(2)
=========================================

and both (2014) and (2016) are interpreted by emacs-info as links.

I learned that this is actually mandated by the specification, but I think it would be important to be able to switch off footnote links, or, even better, improve them such that makeinfo either escapes non-footnote occurrences of "(12345)", or uses a less easily confused markup.

Note that in this project (sagemath, a large gpl computer algebra system) non-footnote occurrences of (1), (2) and (3) are very very frequent, but footnotes are used, too.  Therefore, navigating to footnote (1) and clicking on it will send you anywhere.

2.) A bug with links.  Go back to top, and then visit the node

    FindStat - the Combinatorial Statistic Finder

you should see in line 29 the link

    To access the database, use *note findstat: 7a.:

but clicking on it does not send me to the line beginning with

    Class sage.databases.findstat.FindStat

but a little below.  This problem is much worse in other, larger examples.

I tested both problems on two versions of makeinfo and emacs, without noticing any difference.  The later version is

martin@convex63:~/sage-master/local/share/doc/sage/texinfo/en/reference/combinat$ makeinfo --version
texi2any (GNU texinfo) 6.1

Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

martin@convex63:~/sage-master/local/share/doc/sage/texinfo/en/reference/combinat$ emacs --version
GNU Emacs 24.5.1
Copyright (C) 2015 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

In any case, thanks for looking into this!

Martin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sagereferencemanualdatabases.texi --]
[-- Type: text/x-texinfo; name="sagereferencemanualdatabases.texi", Size: 182698 bytes --]

\input texinfo   @c -*-texinfo-*-
@c %**start of header
@setfilename sagereferencemanualdatabases.info
@documentencoding UTF-8
@ifinfo
@*Generated by Sphinx 1.4.4.@*
@end ifinfo
@settitle Sage Reference Manual Databases
@defindex ge
@paragraphindent 0
@exampleindent 4
@finalout
@dircategory Python
@direntry
* SageReferenceManualDatabases: (sagereferencemanualdatabases.info). The SageReferenceManualDatabases reference
                                manual.
@end direntry

@definfoenclose strong,`,'
@definfoenclose emph,`,'
@c %**end of header

@copying
@quotation
Sage Reference Manual: Databases 7.4, Oct 20, 2016



Copyright @copyright{} 2005--2016, The Sage Development Team
@end quotation

@end copying

@titlepage
@title Sage Reference Manual Databases
@insertcopying
@end titlepage
@contents

@c %** start of user preamble

@c %** end of user preamble

@ifnottex
@node Top
@top Sage Reference Manual Databases
@insertcopying
@end ifnottex

@c %**start of body
@anchor{index doc}@anchor{c}
There are numerous specific mathematical databases either included
in Sage or available as optional packages. Also, Sage includes two
powerful general database packages.

Sage includes the ZOPE object oriented database ZODB, which
"is a Python object persistence system. It provides transparent object-oriented persistency."

Sage also includes the powerful relational database SQLite, along
with a Python interface to SQLite. SQlite is a small C library that
implements a self-contained, embeddable, zero-configuration SQL
database engine.


@itemize -

@item 
Transactions are atomic, consistent, isolated, and durable
(ACID) even after system crashes and power failures.

@item 
Zero-configuration - no setup or administration needed.

@item 
Implements most of SQL92. (Features not supported)

@item 
A complete database is stored in a single disk file.

@item 
Database files can be freely shared between machines with
different byte orders.

@item 
Supports databases up to 2 tebibytes (2^41 bytes) in size.

@item 
Strings and BLOBs up to 2 gibibytes (2^31 bytes) in size.

@item 
Small code footprint: less than 250KiB fully configured or less
than 150KiB with optional features omitted.

@item 
Faster than popular client/server database engines for most
common operations.

@item 
Simple, easy to use API.

@item 
TCL bindings included. Bindings for many other languages
available separately.

@item 
Well-commented source code with over 95% test coverage.

@item 
Self-contained: no external dependencies.

@item 
Sources are in the public domain. Use for any purpose.
@end itemize

@c nodoctest

@menu
* Cremona's tables of elliptic curves:: 
* The Stein-Watkins table of elliptic curves:: 
* John Jones's tables of number fields:: 
* The On-Line Encyclopedia of Integer Sequences (OEIS): The On-Line Encyclopedia of Integer Sequences OEIS. 
* Local copy of Sloane On-Line Encyclopedia of Integer Sequences:: 
* FindStat - the Combinatorial Statistic Finder.: FindStat - the Combinatorial Statistic Finder. 
* Frank Luebeck's tables of Conway polynomials over finite fields:: 
* Tables of zeros of the Riemann-Zeta function:: 
* Ideals from the Symbolic Data project:: 
* Cunningham table:: 
* Database of Hilbert Polynomials:: 
* Database of Modular Polynomials:: 
* Indices and Tables:: 
* Python Module Index:: 
* Index:: 

@end menu

@node Cremona's tables of elliptic curves,The Stein-Watkins table of elliptic curves,Top,Top
@anchor{sage/databases/cremona cremona-s-tables-of-elliptic-curves}@anchor{d}@anchor{sage/databases/cremona sage-databases-cremona}@anchor{e}@anchor{sage/databases/cremona doc}@anchor{f}@anchor{sage/databases/cremona databases}@anchor{10}
@chapter Cremona's tables of elliptic curves


@c This file has been autogenerated.
@anchor{sage/databases/cremona module-sage databases cremona}@anchor{1}
@geindex sage.databases.cremona (module)

Sage includes John Cremona's tables of elliptic curves in an
easy-to-use format. An instance of the class CremonaDatabase()
gives access to the database.

If the optional full CremonaDatabase is not installed, a mini-version
is included by default with Sage.  It contains Weierstrass equations,
rank, and torsion for curves up to conductor 10000.

The large database includes all curves in John Cremona's tables. It
also includes data related to the BSD conjecture and modular degrees
for all of these curves, and generators for the Mordell-Weil
groups. To install it, run the following in the shell:

@example
sage -i database_cremona_ellcurve
@end example

This causes the latest version of the database to be downloaded from
the internet.

Both the mini and full versions of John Cremona's tables are stored in
SAGE_SHARE/cremona as SQLite databases. The mini version has the layout:

@example
CREATE TABLE t_class(conductor INTEGER, class TEXT PRIMARY KEY, rank INTEGER);
CREATE TABLE t_curve(class TEXT, curve TEXT PRIMARY KEY, eqn TEXT UNIQUE, tors INTEGER);
CREATE INDEX i_t_class_conductor ON t_class(conductor);
CREATE INDEX i_t_curve_class ON t_curve(class);
@end example

while the full version has the layout:

@example
CREATE TABLE t_class(conductor INTEGER, class TEXT PRIMARY KEY, rank INTEGER, L REAL, deg INTEGER);
CREATE TABLE t_curve(class TEXT, curve TEXT PRIMARY KEY, eqn TEXT UNIQUE, gens TEXT, tors INTEGER, cp INTEGER, om REAL, reg REAL, sha);
CREATE INDEX i_t_class_conductor ON t_class(conductor);
CREATE INDEX i_t_curve_class ON t_curve(class);
@end example

@geindex CremonaDatabase() (in module sage.databases.cremona)
@anchor{sage/databases/cremona sage databases cremona CremonaDatabase}@anchor{11}
@deffn {Function} sage.databases.cremona.CremonaDatabase (name=None, mini=None, set_global=None)

Initializes the Cremona database with name @code{name}. If @code{name} is
@code{None} it instead initializes large Cremona database (named 'cremona'),
if available or default mini Cremona database (named 'cremona mini').

If the Cremona database in question is in the format of the mini database,
you must set @code{mini=True}, otherwise it must be set to @code{False}.

If you would like other components of Sage to use this database, mark
@code{set_global=True}.

TESTS:

@example
sage: c = CremonaDatabase()
sage: isinstance(c, sage.databases.cremona.MiniCremonaDatabase)
True
sage: isinstance(c, sage.databases.cremona.LargeCremonaDatabase)  # optional - database_cremona_ellcurve
True
@end example

Verify that trac ticket #12341@footnote{https://trac.sagemath.org/12341} has been resolved:

@example
sage: c = CremonaDatabase('should not exist',mini=True)
Traceback (most recent call last):
...
ValueError: Desired database (='should not exist') does not exist
sage: c = CremonaDatabase('should not exist',mini=False)
Traceback (most recent call last):
...
ValueError: Desired database (='should not exist') does not exist
sage: from sage.env import SAGE_SHARE
sage: os.path.isfile(os.path.join(SAGE_SHARE,'cremona','should_not_exist.db'))
False
@end example
@end deffn

@geindex LargeCremonaDatabase (class in sage.databases.cremona)
@anchor{sage/databases/cremona sage databases cremona LargeCremonaDatabase}@anchor{12}
@deffn {Class} sage.databases.cremona.LargeCremonaDatabase (name, read_only=True, build=False)

Bases: @ref{13,,sage.databases.cremona.MiniCremonaDatabase}

The Cremona database of elliptic curves.

EXAMPLES:

@example
sage: c = CremonaDatabase('cremona')  # optional - database_cremona_ellcurve
sage: c.allcurves(11)                 # optional - database_cremona_ellcurve
@{'a1': [[0, -1, 1, -10, -20], 0, 5],
'a2': [[0, -1, 1, -7820, -263580], 0, 1],
'a3': [[0, -1, 1, 0, 0], 0, 5]@}
@end example

@geindex allbsd() (sage.databases.cremona.LargeCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona LargeCremonaDatabase allbsd}@anchor{14}
@deffn {Method} allbsd (N)

Return the allbsd table for conductor N. The entries are:

@example
[id, tamagawa_product, Omega_E, L, Reg_E, Sha_an(E)]
@end example

where id is the isogeny class (letter) followed by a number, e.g.,
b3, and L is @math{L^r(E@comma{}1)/r!}, where E has rank r.

INPUT:


@itemize -

@item 
@code{N} - int, the conductor
@end itemize

OUTPUT: dict containing the allbsd table for each isogeny class
in conductor N

EXAMPLES:

@example
sage: c = CremonaDatabase()
sage: c.allbsd(12)            # optional - database_cremona_ellcurve
@{@}
sage: c.allbsd(19)['a3']      # optional - database_cremona_ellcurve
[1, 4.07927920046493, 0.453253244496104, 1.0, 1]
sage: c.allbsd(12001)['a1']   # optional - database_cremona_ellcurve
[2, 3.27608135248722, 1.54910143090506, 0.236425971187952, 1.0]
@end example
@end deffn

@geindex allgens() (sage.databases.cremona.LargeCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona LargeCremonaDatabase allgens}@anchor{15}
@deffn {Method} allgens (N)

Return the allgens table for conductor N.

INPUT:


@itemize -

@item 
@code{N} - int, the conductor
@end itemize

OUTPUT:


@itemize -

@item 
@code{dict} - id:[points, ...], ...
@end itemize

EXAMPLES:

@example
sage: c = CremonaDatabase()
sage: c.allgens(12)            # optional - database_cremona_ellcurve
@{@}
sage: c.allgens(1001)['a1']    # optional - database_cremona_ellcurve
[[61, 181, 1]]
sage: c.allgens(12001)['a1']   # optional - database_cremona_ellcurve
[[7, 2, 1]]
@end example
@end deffn

@geindex degphi() (sage.databases.cremona.LargeCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona LargeCremonaDatabase degphi}@anchor{16}
@deffn {Method} degphi (N)

Return the degphi table for conductor N.

INPUT:


@itemize -

@item 
@code{N} - int, the conductor
@end itemize

OUTPUT:


@itemize -

@item 
@code{dict} - id:degphi, ...
@end itemize

EXAMPLES:

@example
sage: c = CremonaDatabase()
sage: c.degphi(11)            # optional - database_cremona_ellcurve
@{'a1': 1@}
sage: c.degphi(12001)['c1']   # optional - database_cremona_ellcurve
1640
@end example
@end deffn
@end deffn

@geindex MiniCremonaDatabase (class in sage.databases.cremona)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase}@anchor{13}
@deffn {Class} sage.databases.cremona.MiniCremonaDatabase (name, read_only=True, build=False)

Bases: sage.databases.sql_db.SQLDatabase@footnote{../../../../../../html/en/reference/misc/sage/databases/sql_db.html#sage.databases.sql_db.SQLDatabase}

The Cremona database of elliptic curves.

EXAMPLES:

@example
sage: c = CremonaDatabase()
sage: c.allcurves(11)
@{'a1': [[0, -1, 1, -10, -20], 0, 5],
 'a2': [[0, -1, 1, -7820, -263580], 0, 1],
 'a3': [[0, -1, 1, 0, 0], 0, 5]@}
@end example

@geindex allcurves() (sage.databases.cremona.MiniCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase allcurves}@anchor{17}
@deffn {Method} allcurves (N)

Returns the allcurves table of curves of conductor N.

INPUT:


@itemize -

@item 
@code{N} - int, the conductor
@end itemize

OUTPUT:


@itemize -

@item 
@code{dict} - id:[ainvs, rank, tor], ...
@end itemize

EXAMPLES:

@example
sage: c = CremonaDatabase()
sage: c.allcurves(11)['a3']
[[0, -1, 1, 0, 0], 0, 5]
sage: c.allcurves(12)
@{@}
sage: c.allcurves(12001)['a1']   # optional - database_cremona_ellcurve
[[1, 0, 0, -101, 382], 1, 1]
@end example
@end deffn

@geindex coefficients_and_data() (sage.databases.cremona.MiniCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase coefficients_and_data}@anchor{18}
@deffn {Method} coefficients_and_data (label)

Return the Weierstrass coefficients and other data for the
curve with given label.

EXAMPLES:

@example
sage: c, d = CremonaDatabase().coefficients_and_data('144b1')
sage: c
[0, 0, 0, 6, 7]
sage: d['conductor']
144
sage: d['cremona_label']
'144b1'
sage: d['rank']
0
sage: d['torsion_order']
2
@end example

Check that trac ticket #17904@footnote{https://trac.sagemath.org/17904} is fixed:

@example
sage: 'gens' in CremonaDatabase().coefficients_and_data('100467a2')[1] # optional - database_cremona_ellcurve
True
@end example
@end deffn

@geindex conductor_range() (sage.databases.cremona.MiniCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase conductor_range}@anchor{19}
@deffn {Method} conductor_range ()

Return the range of conductors that are covered by the database.

OUTPUT: tuple of ints (N1,N2+1) where N1 is the smallest and
N2 the largest conductor for which the database is complete.

EXAMPLES:

@example
sage: c = CremonaDatabase('cremona mini')
sage: c.conductor_range()
(1, 10000)
@end example
@end deffn

@geindex curves() (sage.databases.cremona.MiniCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase curves}@anchor{1a}
@deffn {Method} curves (N)

Returns the curves table of all @emph{optimal} curves of conductor N.

INPUT:


@itemize -

@item 
@code{N} - int, the conductor
@end itemize

OUTPUT:


@itemize -

@item 
@code{dict} - id:[ainvs, rank, tor], ...
@end itemize

EXAMPLES:

Optimal curves of conductor 37:

@example
sage: CremonaDatabase().curves(37)
@{'a1': [[0, 0, 1, -1, 0], 1, 1], 'b1': [[0, 1, 1, -23, -50], 0, 3]@}
@end example

Note the 'h3', which is the unique case in the tables where
the optimal curve doesn't have label ending in 1:

@example
sage: list(sorted(CremonaDatabase().curves(990).keys()))
['a1', 'b1', 'c1', 'd1', 'e1', 'f1', 'g1', 'h3', 'i1', 'j1', 'k1', 'l1']
@end example

TESTS:

@example
sage: c = CremonaDatabase()
sage: c.curves(12001)['a1']   # optional - database_cremona_ellcurve
[[1, 0, 0, -101, 382], 1, 1]
@end example
@end deffn

@geindex data_from_coefficients() (sage.databases.cremona.MiniCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase data_from_coefficients}@anchor{1b}
@deffn {Method} data_from_coefficients (ainvs)

Return elliptic curve data for the curve with given
Weierstrass coefficients.

EXAMPLES:

@example
sage: d = CremonaDatabase().data_from_coefficients([1, -1, 1, 31, 128])
sage: d['conductor']
1953
sage: d['cremona_label']
'1953c1'
sage: d['rank']
1
sage: d['torsion_order']
2
@end example

Check that trac ticket #17904@footnote{https://trac.sagemath.org/17904} is fixed:

@example
sage: ai = EllipticCurve('100467a2').ainvs() # optional - database_cremona_ellcurve
sage: 'gens' in CremonaDatabase().data_from_coefficients(ai) # optional - database_cremona_ellcurve
True
@end example
@end deffn

@geindex elliptic_curve() (sage.databases.cremona.MiniCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase elliptic_curve}@anchor{1c}
@deffn {Method} elliptic_curve (label)

Return an elliptic curve with given label with some data about it
from the database pre-filled in.

INPUT:


@itemize -

@item 
@code{label} - str (Cremona or LMFDB label)
@end itemize

OUTPUT:


@itemize -

@item 
an sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field@footnote{../../../../../../html/en/reference/curves/sage/schemes/elliptic_curves/ell_rational_field.html#sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field}
@end itemize

@cartouche
@quotation Note 
For more details on LMFDB labels see @ref{1d,,parse_lmfdb_label()}.
@end quotation
@end cartouche

EXAMPLES:

@example
sage: c = CremonaDatabase()
sage: c.elliptic_curve('11a1')
Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field
sage: c.elliptic_curve('12001a1')    # optional - database_cremona_ellcurve
Elliptic Curve defined by y^2 + x*y = x^3 - 101*x + 382 over Rational Field
sage: c.elliptic_curve('48c1')
Traceback (most recent call last):
...
ValueError: There is no elliptic curve with label 48c1 in the database
@end example

You can also use LMFDB labels:

@example
sage: c.elliptic_curve('462.f3')
Elliptic Curve defined by y^2 + x*y = x^3 - 363*x + 1305 over Rational Field
@end example
@end deffn

@geindex elliptic_curve_from_ainvs() (sage.databases.cremona.MiniCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase elliptic_curve_from_ainvs}@anchor{1e}
@deffn {Method} elliptic_curve_from_ainvs (ainvs)

Returns the elliptic curve in the database of with minimal
ainvs, if it exists, or raises a RuntimeError exception
otherwise.

INPUT:


@itemize -

@item 
@code{ainvs} - list (5-tuple of int's); the minimal
Weierstrass model for an elliptic curve
@end itemize

OUTPUT: EllipticCurve

EXAMPLES:

@example
sage: c = CremonaDatabase()
sage: c.elliptic_curve_from_ainvs([0, -1, 1, -10, -20])
Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field
sage: c.elliptic_curve_from_ainvs([1, 0, 0, -101, 382])  # optional - database_cremona_ellcurve
Elliptic Curve defined by y^2 + x*y = x^3 - 101*x + 382 over Rational Field
@end example

Old (pre-2006) Cremona labels are also allowed:

@example
sage: c.elliptic_curve('9450KKKK1')
Elliptic Curve defined by y^2 + x*y + y = x^3 - x^2 - 5*x + 7 over Rational Field
@end example

Make sure trac ticket #12565@footnote{https://trac.sagemath.org/12565} is fixed:

@example
sage: c.elliptic_curve('10a1')
Traceback (most recent call last):
...
ValueError: There is no elliptic curve with label 10a1 in the database
@end example
@end deffn

@geindex isogeny_class() (sage.databases.cremona.MiniCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase isogeny_class}@anchor{1f}
@deffn {Method} isogeny_class (label)

Returns the isogeny class of elliptic curves that are
isogenous to the curve with given Cremona label.

INPUT:


@itemize -

@item 
@code{label} - string
@end itemize

OUTPUT:


@itemize -

@item 
@code{list} - list of EllipticCurve objects.
@end itemize

EXAMPLES:

@example
sage: c = CremonaDatabase()
sage: c.isogeny_class('11a1')
[Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field,
 Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7820*x - 263580 over Rational Field,
 Elliptic Curve defined by y^2 + y = x^3 - x^2 over Rational Field]
sage: c.isogeny_class('12001a1')   # optional - database_cremona_ellcurve
[Elliptic Curve defined by y^2 + x*y = x^3 - 101*x + 382 over Rational Field]
@end example
@end deffn

@geindex isogeny_classes() (sage.databases.cremona.MiniCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase isogeny_classes}@anchor{20}
@deffn {Method} isogeny_classes (conductor)

Return the allcurves data (ainvariants, rank and torsion) for the
elliptic curves in the database of given conductor as a list of
lists, one for each isogeny class. The curve with number 1 is
always listed first.

EXAMPLES:

@example
sage: c = CremonaDatabase()
sage: c.isogeny_classes(11)
[[[[0, -1, 1, -10, -20], 0, 5],
 [[0, -1, 1, -7820, -263580], 0, 1],
 [[0, -1, 1, 0, 0], 0, 5]]]
sage: c.isogeny_classes(12001)   # optional - database_cremona_ellcurve
[[[[1, 0, 0, -101, 382], 1, 1]],
 [[[0, 0, 1, -247, 1494], 1, 1]],
 [[[0, 0, 1, -4, -18], 1, 1]],
 [[[0, 1, 1, -10, 18], 1, 1]]]
@end example
@end deffn

@geindex iter() (sage.databases.cremona.MiniCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase iter}@anchor{21}
@deffn {Method} iter (conductors)

Return an iterator through all curves in the database with given
conductors.

INPUT:


@itemize -

@item 
@code{conductors} - list or generator of ints
@end itemize

OUTPUT: generator that iterates over EllipticCurve objects.

EXAMPLES:

@example
sage: [e.cremona_label() for e in CremonaDatabase().iter([11..15])]
['11a1', '11a2', '11a3', '14a1', '14a2', '14a3', '14a4', '14a5',
 '14a6', '15a1', '15a2', '15a3', '15a4', '15a5', '15a6', '15a7', '15a8']
@end example
@end deffn

@geindex iter_optimal() (sage.databases.cremona.MiniCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase iter_optimal}@anchor{22}
@deffn {Method} iter_optimal (conductors)

Return an iterator through all optimal curves in the database with given conductors.

INPUT:


@itemize -

@item 
@code{conductors} - list or generator of ints
@end itemize

OUTPUT:

generator that iterates over EllipticCurve objects.

EXAMPLES:

We list optimal curves with conductor up to 20:

@example
sage: [e.cremona_label() for e in CremonaDatabase().iter_optimal([11..20])]
['11a1', '14a1', '15a1', '17a1', '19a1', '20a1']
@end example

Note the unfortunate 990h3 special case:

@example
sage: [e.cremona_label() for e in CremonaDatabase().iter_optimal([990])]
['990a1', '990b1', '990c1', '990d1', '990e1', '990f1', '990g1', '990h3', '990i1', '990j1', '990k1', '990l1']
@end example
@end deffn

@geindex largest_conductor() (sage.databases.cremona.MiniCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase largest_conductor}@anchor{23}
@deffn {Method} largest_conductor ()

The largest conductor for which the database is complete.

OUTPUT:


@itemize -

@item 
@code{int} - largest conductor
@end itemize

EXAMPLES:

@example
sage: c = CremonaDatabase('cremona mini')
sage: c.largest_conductor()
9999
@end example
@end deffn

@geindex list() (sage.databases.cremona.MiniCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase list}@anchor{24}
@deffn {Method} list (conductors)

Returns a list of all curves with given conductors.

INPUT:


@itemize -

@item 
@code{conductors} - list or generator of ints
@end itemize

OUTPUT:


@itemize -

@item 
list of EllipticCurve objects.
@end itemize

EXAMPLES:

@example
sage: CremonaDatabase().list([37])
[Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field,
 Elliptic Curve defined by y^2 + y = x^3 + x^2 - 23*x - 50 over Rational Field,
 Elliptic Curve defined by y^2 + y = x^3 + x^2 - 1873*x - 31833 over Rational Field,
 Elliptic Curve defined by y^2 + y = x^3 + x^2 - 3*x + 1 over Rational Field]
@end example
@end deffn

@geindex list_optimal() (sage.databases.cremona.MiniCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase list_optimal}@anchor{25}
@deffn {Method} list_optimal (conductors)

Returns a list of all optimal curves with given conductors.

INPUT:


@itemize -

@item 

@table @asis

@item @code{conductors} - list or generator of ints

list of EllipticCurve objects.
@end table
@end itemize

OUTPUT:

list of EllipticCurve objects.

EXAMPLES:

@example
sage: CremonaDatabase().list_optimal([37])
[Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field,
 Elliptic Curve defined by y^2 + y = x^3 + x^2 - 23*x - 50 over Rational Field]
@end example
@end deffn

@geindex number_of_curves() (sage.databases.cremona.MiniCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase number_of_curves}@anchor{26}
@deffn {Method} number_of_curves (N=0, i=0)

Returns the number of curves stored in the database with conductor
N. If N = 0, returns the total number of curves in the database.

If i is nonzero, returns the number of curves in the i-th isogeny
class. If i is a Cremona letter code, e.g., 'a' or 'bc', it is
converted to the corresponding number.

INPUT:


@itemize -

@item 
@code{N} - int

@item 
@code{i} - int or str
@end itemize

OUTPUT: int

EXAMPLES:

@example
sage: c = CremonaDatabase()
sage: c.number_of_curves(11)
3
sage: c.number_of_curves(37)
4
sage: c.number_of_curves(990)
42
sage: num = c.number_of_curves()
@end example
@end deffn

@geindex number_of_isogeny_classes() (sage.databases.cremona.MiniCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase number_of_isogeny_classes}@anchor{27}
@deffn {Method} number_of_isogeny_classes (N=0)

Returns the number of isogeny classes of curves in the database of
conductor N. If N is 0, return the total number of isogeny classes
of curves in the database.

INPUT:


@itemize -

@item 
@code{N} - int
@end itemize

OUTPUT: int

EXAMPLES:

@example
sage: c = CremonaDatabase()
sage: c.number_of_isogeny_classes(11)
1
sage: c.number_of_isogeny_classes(37)
2
sage: num = c.number_of_isogeny_classes()
@end example
@end deffn

@geindex random() (sage.databases.cremona.MiniCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase random}@anchor{28}
@deffn {Method} random ()

Returns a random curve from the database.

EXAMPLES:

@example
sage: CremonaDatabase().random() # random -- depends on database installed
Elliptic Curve defined by y^2 + x*y  = x^3 - x^2 - 224*x + 3072 over Rational Field
@end example
@end deffn

@geindex smallest_conductor() (sage.databases.cremona.MiniCremonaDatabase method)
@anchor{sage/databases/cremona sage databases cremona MiniCremonaDatabase smallest_conductor}@anchor{29}
@deffn {Method} smallest_conductor ()

The smallest conductor for which the database is complete: always 1.

OUTPUT:


@itemize -

@item 
@code{int} - smallest conductor
@end itemize

@cartouche
@quotation Note 
This always returns the integer 1, since that is the
smallest conductor for which the database is complete,
although there are no elliptic curves of conductor 1.  The
smallest conductor of a curve in the database is 11.
@end quotation
@end cartouche

EXAMPLES:

@example
sage: CremonaDatabase().smallest_conductor()
1
@end example
@end deffn
@end deffn

@geindex build() (in module sage.databases.cremona)
@anchor{sage/databases/cremona sage databases cremona build}@anchor{2a}
@deffn {Function} sage.databases.cremona.build (name, data_tgz, largest_conductor=0, mini=False, decompress=True)

Build the CremonaDatabase with given name from scratch
using the data_tgz tarball.

@cartouche
@quotation Note 
For data up to level 350000, this function takes about
3m40s.  The resulting database occupies 426MB disk space.
@end quotation
@end cartouche

To create the large Cremona database from Cremona's data_tgz
tarball, obtainable from
@indicateurl{http://homepages.warwick.ac.uk/staff/J.E.Cremona/ftp/data/}, run
the following command:

@example
sage: d = sage.databases.cremona.build('cremona','ecdata.tgz')   # not tested
@end example
@end deffn

@geindex class_to_int() (in module sage.databases.cremona)
@anchor{sage/databases/cremona sage databases cremona class_to_int}@anchor{2b}
@deffn {Function} sage.databases.cremona.class_to_int (k)

Converts class id string into an integer. Note that this is the
inverse of cremona_letter_code.

EXAMPLES:

@example
sage: import sage.databases.cremona as cremona
sage: cremona.class_to_int('ba')
26
sage: cremona.class_to_int('cremona')
821863562
sage: cremona.cremona_letter_code(821863562)
'cremona'
@end example
@end deffn

@geindex cremona_letter_code() (in module sage.databases.cremona)
@anchor{sage/databases/cremona sage databases cremona cremona_letter_code}@anchor{2c}
@deffn {Function} sage.databases.cremona.cremona_letter_code (n)

Returns the Cremona letter code corresponding to an integer. For
example, 0 - a 25 - z 26 - ba 51 - bz 52 - ca 53 - cb etc.

@cartouche
@quotation Note 
This is just the base 26 representation of n, where a=0, b=1,
..., z=25. This extends the old Cremona notation (counting from
0) for the first 26 classes, and is different for classes above
26.
@end quotation
@end cartouche

INPUT:


@itemize -

@item 
@code{n} (int) -- a non-negative integer
@end itemize

OUTPUT: str

EXAMPLES:

@example
sage: from sage.databases.cremona import cremona_letter_code
sage: cremona_letter_code(0)
'a'
sage: cremona_letter_code(26)
'ba'
sage: cremona_letter_code(27)
'bb'
sage: cremona_letter_code(521)
'ub'
sage: cremona_letter_code(53)
'cb'
sage: cremona_letter_code(2005)
'czd'
@end example

TESTS:

@example
sage: cremona_letter_code(QQ)
Traceback (most recent call last):
...
ValueError: Cremona letter codes are only defined for non-negative integers
sage: cremona_letter_code(x)
Traceback (most recent call last):
...
ValueError: Cremona letter codes are only defined for non-negative integers
sage: cremona_letter_code(-1)
Traceback (most recent call last):
...
ValueError: Cremona letter codes are only defined for non-negative integers
sage: cremona_letter_code(3.14159)
Traceback (most recent call last):
...
ValueError: Cremona letter codes are only defined for non-negative integers
@end example
@end deffn

@geindex cremona_to_lmfdb() (in module sage.databases.cremona)
@anchor{sage/databases/cremona sage databases cremona cremona_to_lmfdb}@anchor{2d}
@deffn {Function} sage.databases.cremona.cremona_to_lmfdb (cremona_label, CDB=None)

Converts a Cremona label into an LMFDB label.

See @ref{1d,,parse_lmfdb_label()} for an explanation of LMFDB labels.

INPUT:


@itemize -

@item 
@code{cremona_label} -- a string, the Cremona label of a curve.
This can be the label of a curve (e.g. '990j1') or of an isogeny
class (e.g. '990j')

@item 
@code{CDB} -- the Cremona database in which to look up the isogeny
classes of the same conductor.
@end itemize

OUTPUT:


@itemize -

@item 
@code{lmfdb_label} -- a string, the corresponding LMFDB label.
@end itemize

EXAMPLES:

@example
sage: from sage.databases.cremona import cremona_to_lmfdb, lmfdb_to_cremona
sage: cremona_to_lmfdb('990j1')
'990.h3'
sage: lmfdb_to_cremona('990.h3')
'990j1'
@end example

TESTS:

@example
sage: for label in ['5077a1','66a3','102b','420c2']:
...       assert(lmfdb_to_cremona(cremona_to_lmfdb(label)) == label)
sage: for label in ['438.c2','306.b','462.f3']:
...       assert(cremona_to_lmfdb(lmfdb_to_cremona(label)) == label)
@end example
@end deffn

@geindex is_optimal_id() (in module sage.databases.cremona)
@anchor{sage/databases/cremona sage databases cremona is_optimal_id}@anchor{2e}
@deffn {Function} sage.databases.cremona.is_optimal_id (id)

Returns true if the Cremona id refers to an optimal curve, and
false otherwise. The curve is optimal if the id, which is of the
form [letter code][number] has number 1.

@cartouche
@quotation Note 
990h3 is the optimal curve in that class, so doesn't obey
this rule.
@end quotation
@end cartouche

INPUT:


@itemize -

@item 
@code{id} - str of form letter code followed by an
integer, e.g., a3, bb5, etc.
@end itemize

OUTPUT: bool

EXAMPLES:

@example
sage: from sage.databases.cremona import is_optimal_id
sage: is_optimal_id('b1')
True
sage: is_optimal_id('bb1')
True
sage: is_optimal_id('c1')
True
sage: is_optimal_id('c2')
False
@end example
@end deffn

@geindex lmfdb_to_cremona() (in module sage.databases.cremona)
@anchor{sage/databases/cremona sage databases cremona lmfdb_to_cremona}@anchor{2f}
@deffn {Function} sage.databases.cremona.lmfdb_to_cremona (lmfdb_label, CDB=None)

Converts an LMFDB labe into a Cremona label.

See @ref{1d,,parse_lmfdb_label()} for an explanation of LMFDB labels.

INPUT:


@itemize -

@item 
@code{lmfdb_label} -- a string, the LMFDB label of a curve.
This can be the label of a curve (e.g. '990.j1') or of an isogeny
class (e.g. '990.j')

@item 
@code{CDB} -- the Cremona database in which to look up the isogeny
classes of the same conductor.
@end itemize

OUTPUT:


@itemize -

@item 
@code{cremona_label} -- a string, the corresponding Cremona label.
@end itemize

EXAMPLES:

@example
sage: from sage.databases.cremona import cremona_to_lmfdb, lmfdb_to_cremona
sage: lmfdb_to_cremona('990.h3')
'990j1'
sage: cremona_to_lmfdb('990j1')
'990.h3'
@end example
@end deffn

@geindex old_cremona_letter_code() (in module sage.databases.cremona)
@anchor{sage/databases/cremona sage databases cremona old_cremona_letter_code}@anchor{30}
@deffn {Function} sage.databases.cremona.old_cremona_letter_code (n)

Returns the @emph{old} Cremona letter code corresponding to an integer.
integer.

For example:

@example
1  --> A
26 --> Z
27 --> AA
52 --> ZZ
53 --> AAA
etc.
@end example

INPUT:


@itemize -

@item 
@code{n} - int
@end itemize

OUTPUT: str

EXAMPLES:

@example
sage: from sage.databases.cremona import old_cremona_letter_code
sage: old_cremona_letter_code(1)
'A'
sage: old_cremona_letter_code(26)
'Z'
sage: old_cremona_letter_code(27)
'AA'
sage: old_cremona_letter_code(521)
'AAAAAAAAAAAAAAAAAAAAA'
sage: old_cremona_letter_code(53)
'AAA'
sage: old_cremona_letter_code(2005)
'CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC'
@end example
@end deffn

@geindex parse_cremona_label() (in module sage.databases.cremona)
@anchor{sage/databases/cremona sage databases cremona parse_cremona_label}@anchor{31}
@deffn {Function} sage.databases.cremona.parse_cremona_label (label)

Given a Cremona label that defines an elliptic
curve, e.g., 11a1 or 37b3, parse the label and return the
conductor, isogeny class label, and number.

For this function, the curve number may be omitted, in which case
it defaults to 1.  If the curve number and isogeny class are both
omitted (label is just a string representing a conductor), then
the isogeny class defaults to 'a' and the number to 1.  Valid
labels consist of one or more digits, followed by zero or more
letters (either all in upper case for an old Cremona label, or all
in lower case), followed by zero or more digits.

INPUT:


@itemize -

@item 
@code{label} - str
@end itemize

OUTPUT:


@itemize -

@item 
@code{int} - the conductor

@item 
@code{str} - the isogeny class label

@item 
@code{int} - the number
@end itemize

EXAMPLES:

@example
sage: from sage.databases.cremona import parse_cremona_label
sage: parse_cremona_label('37a2')
(37, 'a', 2)
sage: parse_cremona_label('37b1')
(37, 'b', 1)
sage: parse_cremona_label('10bb2')
(10, 'bb', 2)
sage: parse_cremona_label('11a')
(11, 'a', 1)
sage: parse_cremona_label('11')
(11, 'a', 1)
@end example

Valid old Cremona labels are allowed:

@example
sage: parse_cremona_label('17CCCC')
(17, 'dc', 1)
sage: parse_cremona_label('5AB2')
Traceback (most recent call last):
...
ValueError: 5AB2 is not a valid Cremona label
@end example

TESTS:

@example
sage: from sage.databases.cremona import parse_cremona_label
sage: parse_cremona_label('x11')
Traceback (most recent call last):
...
ValueError: x11 is not a valid Cremona label
@end example
@end deffn

@geindex parse_lmfdb_label() (in module sage.databases.cremona)
@anchor{sage/databases/cremona sage databases cremona parse_lmfdb_label}@anchor{1d}
@deffn {Function} sage.databases.cremona.parse_lmfdb_label (label)

Given an LMFDB label that defines an elliptic curve, e.g., 11.a1
or 37.b3, parse the label and return the conductor, isogeny class
label, and number.

The LMFDB label (named after the L-functions and modular forms
database), is determined by the following two orders:


@itemize -

@item 
Isogeny classes with the same conductor are ordered
lexicographically by the coefficients in the q-expansion of the
associated modular form.

@item 
Curves within the same isogeny class are ordered
lexicographically by the a-invariants of the minimal model.
@end itemize

The format is <conductor>.<iso><curve>, where the isogeny class is
encoded using the same base-26 encoding into letters used in
Cremona's labels.  For example, 990.h3 is the same as Cremona's 990j1

For this function, the curve number may be omitted, in which case
it defaults to 1.  If the curve number and isogeny class are both
omitted (label is just a string representing a conductor), then
the isogeny class defaults to 'a' and the number to 1.

INPUT:


@itemize -

@item 
@code{label} - str
@end itemize

OUTPUT:


@itemize -

@item 
@code{int} - the conductor

@item 
@code{str} - the isogeny class label

@item 
@code{int} - the number
@end itemize

EXAMPLES:

@example
sage: from sage.databases.cremona import parse_lmfdb_label
sage: parse_lmfdb_label('37.a2')
(37, 'a', 2)
sage: parse_lmfdb_label('37.b')
(37, 'b', 1)
sage: parse_lmfdb_label('10.bb2')
(10, 'bb', 2)
@end example
@end deffn

@geindex sort_key() (in module sage.databases.cremona)
@anchor{sage/databases/cremona sage databases cremona sort_key}@anchor{32}
@deffn {Function} sage.databases.cremona.sort_key (key1)

Comparison key for curve id strings.

@cartouche
@quotation Note 
Not the same as standard lexicographic order!
@end quotation
@end cartouche

EXAMPLES:

@example
sage: from sage.databases.cremona import sort_key
sage: l = ['ba1', 'z1']
sage: sorted(l, key=sort_key)
['z1', 'ba1']
@end example
@end deffn

@geindex split_code() (in module sage.databases.cremona)
@anchor{sage/databases/cremona sage databases cremona split_code}@anchor{33}
@deffn {Function} sage.databases.cremona.split_code (key)

Splits class+curve id string into its two parts.

EXAMPLES:

@example
sage: import sage.databases.cremona as cremona
sage: cremona.split_code('ba2')
('ba', '2')
@end example
@end deffn

@c nodoctest

@node The Stein-Watkins table of elliptic curves,John Jones's tables of number fields,Cremona's tables of elliptic curves,Top
@anchor{sage/databases/stein_watkins the-stein-watkins-table-of-elliptic-curves}@anchor{34}@anchor{sage/databases/stein_watkins sage-databases-stein-watkins}@anchor{35}@anchor{sage/databases/stein_watkins doc}@anchor{36}
@chapter The Stein-Watkins table of elliptic curves


@c This file has been autogenerated.
@anchor{sage/databases/stein_watkins module-sage databases stein_watkins}@anchor{a}
@geindex sage.databases.stein_watkins (module)

Sage gives access to the Stein-Watkins table of elliptic curves, via an
optional package that you must install. This is a huge database of elliptic
curves. You can install the database (a 2.6GB package) with the command

@example
sage -i database_stein_watkins
@end example

You can also automatically download a small version, which takes much less
time, using the command

@example
sage -i database_stein_watkins_mini
@end example

This database covers a wide range of conductors, but unlike the
@ref{1,,Cremona database}, this database need not list
all curves of a given conductor. It lists the curves whose coefficients are not
"too large" (see @ref{37,,[SteinWatkins]}).


@itemize -

@item 
The command @code{SteinWatkinsAllData(n)} returns an iterator over the curves
in the @math{n}-th Stein-Watkins table, which contains elliptic curves of
conductor between @math{n10^5} and @math{(n+1)10^5}. Here @math{n} can be between 0 and
999, inclusive.

@item 
The command @code{SteinWatkinsPrimeData(n)} returns an iterator over the curves
in the @math{n^@{th@}} Stein-Watkins prime table, which contains prime conductor
elliptic curves of conductor between @math{n10^6} and @math{(n+1)10^6}. Here @math{n}
varies between 0 and 99, inclusive.
@end itemize

EXAMPLES: We obtain the first table of elliptic curves.

@example
sage: d = SteinWatkinsAllData(0)
sage: d
Stein-Watkins Database a.0 Iterator
@end example

We type @code{next(d)} to get each isogeny class of
curves from @code{d}:

@example
sage: C = next(d)                                   # optional - database_stein_watkins
sage: C                                             # optional - database_stein_watkins
Stein-Watkins isogeny class of conductor 11
sage: next(d)                                       # optional - database_stein_watkins
Stein-Watkins isogeny class of conductor 14
sage: next(d)                                       # optional - database_stein_watkins
Stein-Watkins isogeny class of conductor 15
@end example

An isogeny class has a number of attributes that give data about
the isogeny class, such as the rank, equations of curves,
conductor, leading coefficient of @math{L}-function, etc.

@example
sage: C.data                                         # optional - database_stein_watkins
['11', '[11]', '0', '0.253842', '25', '+*1']
sage: C.curves                                       # optional - database_stein_watkins
[[[0, -1, 1, 0, 0], '(1)', '1', '5'],
 [[0, -1, 1, -10, -20], '(5)', '1', '5'],
 [[0, -1, 1, -7820, -263580], '(1)', '1', '1']]
sage: C.conductor                                    # optional - database_stein_watkins
11
sage: C.leading_coefficient                          # optional - database_stein_watkins
'0.253842'
sage: C.modular_degree                               # optional - database_stein_watkins
'+*1'
sage: C.rank                                         # optional - database_stein_watkins
0
sage: C.isogeny_number                               # optional - database_stein_watkins
'25'
@end example

If we were to continue typing @code{next(d)} we would
iterate over all curves in the Stein-Watkins database up to
conductor @math{10^5}. We could also type @code{for C in d:
...}

To access the data file starting at @math{10^5} do the
following:

@example
sage: d = SteinWatkinsAllData(1)
sage: C = next(d)                                  # optional - database_stein_watkins
sage: C                                            # optional - database_stein_watkins
Stein-Watkins isogeny class of conductor 100002
sage: C.curves                                     # optional - database_stein_watkins
[[[1, 1, 0, 112, 0], '(8,1,2,1)', 'X', '2'],
 [[1, 1, 0, -448, -560], '[4,2,1,2]', 'X', '2']]
@end example

Next we access the prime-conductor data:

@example
sage: d = SteinWatkinsPrimeData(0)
sage: C = next(d)                                  # optional - database_stein_watkins
sage: C                                            # optional - database_stein_watkins
Stein-Watkins isogeny class of conductor 11
@end example

Each call @code{next(d)} gives another elliptic curve of
prime conductor:

@example
sage: C = next(d)                                  # optional - database_stein_watkins
sage: C                                            # optional - database_stein_watkins
Stein-Watkins isogeny class of conductor 17
sage: C.curves                                     # optional - database_stein_watkins
[[[1, -1, 1, -1, 0], '[1]', '1', '4'],
 [[1, -1, 1, -6, -4], '[2]', '1', '2x'],
 [[1, -1, 1, -1, -14], '(4)', '1', '4'],
 [[1, -1, 1, -91, -310], '[1]', '1', '2']]
sage: C = next(d)                                  # optional - database_stein_watkins
sage: C                                            # optional - database_stein_watkins
Stein-Watkins isogeny class of conductor 19
@end example

REFERENCE:
@anchor{sage/databases/stein_watkins steinwatkins}@anchor{37}@w{(SteinWatkins)} 
William Stein and Mark Watkins, @emph{A database of elliptic
curves---first report}. In @emph{Algorithmic number theory (ANTS V), Sydney,
2002}, Lecture Notes in Computer Science 2369, Springer, 2002, p267--275.
@indicateurl{http://modular.math.washington.edu/papers/stein-watkins/}

@geindex SteinWatkinsAllData (class in sage.databases.stein_watkins)
@anchor{sage/databases/stein_watkins sage databases stein_watkins SteinWatkinsAllData}@anchor{38}
@deffn {Class} sage.databases.stein_watkins.SteinWatkinsAllData (num)

Class for iterating through one of the Stein-Watkins database files
for all conductors.

@geindex iter_levels() (sage.databases.stein_watkins.SteinWatkinsAllData method)
@anchor{sage/databases/stein_watkins sage databases stein_watkins SteinWatkinsAllData iter_levels}@anchor{39}
@deffn {Method} iter_levels ()

Iterate through the curve classes, but grouped into lists by
level.

EXAMPLE:

@example
sage: d = SteinWatkinsAllData(1)
sage: E = d.iter_levels()
sage: next(E)                             # optional - database_stein_watkins
[Stein-Watkins isogeny class of conductor 100002]
sage: next(E)                             # optional - database_stein_watkins
[Stein-Watkins isogeny class of conductor 100005,
Stein-Watkins isogeny class of conductor 100005]
sage: next(E)                             # optional - database_stein_watkins
[Stein-Watkins isogeny class of conductor 100007]
@end example
@end deffn

@geindex next() (sage.databases.stein_watkins.SteinWatkinsAllData method)
@anchor{sage/databases/stein_watkins sage databases stein_watkins SteinWatkinsAllData next}@anchor{3a}
@deffn {Method} next ()
@end deffn
@end deffn

@geindex SteinWatkinsIsogenyClass (class in sage.databases.stein_watkins)
@anchor{sage/databases/stein_watkins sage databases stein_watkins SteinWatkinsIsogenyClass}@anchor{3b}
@deffn {Class} sage.databases.stein_watkins.SteinWatkinsIsogenyClass (conductor)
@end deffn

@geindex SteinWatkinsPrimeData (class in sage.databases.stein_watkins)
@anchor{sage/databases/stein_watkins sage databases stein_watkins SteinWatkinsPrimeData}@anchor{3c}
@deffn {Class} sage.databases.stein_watkins.SteinWatkinsPrimeData (num)

Bases: @ref{38,,sage.databases.stein_watkins.SteinWatkinsAllData}
@end deffn

@geindex ecdb_num_curves() (in module sage.databases.stein_watkins)
@anchor{sage/databases/stein_watkins sage databases stein_watkins ecdb_num_curves}@anchor{3d}
@deffn {Function} sage.databases.stein_watkins.ecdb_num_curves (max_level=200000)

Return a list whose @math{N}-th entry, for @code{0 <= N <= max_level}, is the
number of elliptic curves of conductor @math{N} in the database.

EXAMPLES:

@example
sage: sage.databases.stein_watkins.ecdb_num_curves(100) # optional - database_stein_watkins
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 6, 8, 0, 4, 0, 3, 4, 6, 0, 0,
 6, 0, 5, 4, 0, 0, 8, 0, 4, 4, 4, 3, 4, 4, 5, 4, 4, 0, 6, 1, 2, 8, 2, 0,
 6, 4, 8, 2, 2, 1, 6, 4, 6, 7, 3, 0, 0, 1, 4, 6, 4, 2, 12, 1, 0, 2, 4, 0,
 6, 2, 0, 12, 1, 6, 4, 1, 8, 0, 2, 1, 6, 2, 0, 0, 1, 3, 16, 4, 3, 0, 2,
 0, 8, 0, 6, 11, 4]
@end example
@end deffn

@c nodoctest

@node John Jones's tables of number fields,The On-Line Encyclopedia of Integer Sequences OEIS,The Stein-Watkins table of elliptic curves,Top
@anchor{sage/databases/jones sage-databases-jones}@anchor{3e}@anchor{sage/databases/jones doc}@anchor{3f}@anchor{sage/databases/jones john-jones-s-tables-of-number-fields}@anchor{40}
@chapter John Jones's tables of number fields


@c This file has been autogenerated.
@anchor{sage/databases/jones module-sage databases jones}@anchor{6}
@geindex sage.databases.jones (module)

In order to use the Jones database, the optional database package
must be installed using the Sage command !sage -i
database_jones_numfield

This is a table of number fields with bounded ramification and
degree @math{\leq 6}. You can query the database for all number
fields in Jones's tables with bounded ramification and degree.

EXAMPLES: First load the database:

@example
sage: J = JonesDatabase()
sage: J
John Jones's table of number fields with bounded ramification and degree <= 6
@end example

List the degree and discriminant of all fields in the database that
have ramification at most at 2:

@example
sage: [(k.degree(), k.disc()) for k in J.unramified_outside([2])]    # optional - database_jones_numfield
[(1, 1), (2, -4), (2, -8), (2, 8), (4, 256), (4, 512), (4, -1024), (4, -2048), (4, 2048), (4, 2048), (4, 2048)]
@end example

List the discriminants of the fields of degree exactly 2 unramified
outside 2:

@example
sage: [k.disc() for k in J.unramified_outside([2],2)]                # optional - database_jones_numfield
[-4, -8, 8]
@end example

List the discriminants of cubic field in the database ramified
exactly at 3 and 5:

@example
sage: [k.disc() for k in J.ramified_at([3,5],3)]                     # optional - database_jones_numfield
[-135, -675, -6075, -6075]
sage: factor(6075)
3^5 * 5^2
sage: factor(675)
3^3 * 5^2
sage: factor(135)
3^3 * 5
@end example

List all fields in the database ramified at 101:

@example
sage: J.ramified_at(101)                                             # optional - database_jones_numfield
[Number Field in a with defining polynomial x^2 - 101,
 Number Field in a with defining polynomial x^4 - x^3 + 13*x^2 - 19*x + 361,
 Number Field in a with defining polynomial x^5 + 2*x^4 + 7*x^3 + 4*x^2 + 11*x - 6,
 Number Field in a with defining polynomial x^5 + x^4 - 6*x^3 - x^2 + 18*x + 4,
 Number Field in a with defining polynomial x^5 - x^4 - 40*x^3 - 93*x^2 - 21*x + 17]
@end example

@geindex JonesDatabase (class in sage.databases.jones)
@anchor{sage/databases/jones sage databases jones JonesDatabase}@anchor{41}
@deffn {Class} sage.databases.jones.JonesDatabase

@geindex get() (sage.databases.jones.JonesDatabase method)
@anchor{sage/databases/jones sage databases jones JonesDatabase get}@anchor{42}
@deffn {Method} get (S, var='a')

Return all fields in the database ramified exactly at
the primes in S.

INPUT:


@itemize -

@item 
@code{S} - list or set of primes, or a single prime

@item 
@code{var} - the name used for the generator of the number fields (default 'a').
@end itemize

EXAMPLES:

@example
sage: J = JonesDatabase()              # optional - database_jones_numfield
sage: J.get(163, var='z')              # optional - database_jones_numfield
[Number Field in z with defining polynomial x^2 + 163,
 Number Field in z with defining polynomial x^3 - x^2 - 54*x + 169,
 Number Field in z with defining polynomial x^4 - x^3 - 7*x^2 + 2*x + 9]
sage: J.get([3, 4])                    # optional - database_jones_numfield
Traceback (most recent call last):
...
ValueError: S must be a list of primes
@end example
@end deffn

@geindex ramified_at() (sage.databases.jones.JonesDatabase method)
@anchor{sage/databases/jones sage databases jones JonesDatabase ramified_at}@anchor{43}
@deffn {Method} ramified_at (S, d=None, var='a')

Return all fields in the database of degree d ramified exactly at
the primes in S.  The fields are ordered by degree and discriminant.

INPUT:


@itemize -

@item 
@code{S} - list or set of primes

@item 
@code{d} - None (default, in which case all fields of degree <= 6 are returned)
or a positive integer giving the degree of the number fields returned.

@item 
@code{var} - the name used for the generator of the number fields (default 'a').
@end itemize

EXAMPLES:

@example
sage: J = JonesDatabase()              # optional - database_jones_numfield
sage: J.ramified_at([101,109])         # optional - database_jones_numfield
[]
sage: J.ramified_at([109])             # optional - database_jones_numfield
[Number Field in a with defining polynomial x^2 - 109,
 Number Field in a with defining polynomial x^3 - x^2 - 36*x + 4,
 Number Field in a with defining polynomial x^4 - x^3 + 14*x^2 + 34*x + 393]
sage: J.ramified_at(101)               # optional - database_jones_numfield
[Number Field in a with defining polynomial x^2 - 101,
 Number Field in a with defining polynomial x^4 - x^3 + 13*x^2 - 19*x + 361,
 Number Field in a with defining polynomial x^5 + 2*x^4 + 7*x^3 + 4*x^2 + 11*x - 6,
 Number Field in a with defining polynomial x^5 + x^4 - 6*x^3 - x^2 + 18*x + 4,
 Number Field in a with defining polynomial x^5 - x^4 - 40*x^3 - 93*x^2 - 21*x + 17]
sage: J.ramified_at((2, 5, 29), 3, 'c') # optional - database_jones_numfield
[Number Field in c with defining polynomial x^3 - x^2 - 8*x - 28,
 Number Field in c with defining polynomial x^3 - x^2 + 10*x + 102,
 Number Field in c with defining polynomial x^3 - x^2 + 97*x - 333,
 Number Field in c with defining polynomial x^3 - x^2 - 48*x - 188]
@end example
@end deffn

@geindex unramified_outside() (sage.databases.jones.JonesDatabase method)
@anchor{sage/databases/jones sage databases jones JonesDatabase unramified_outside}@anchor{44}
@deffn {Method} unramified_outside (S, d=None, var='a')

Return all fields in the database of degree d unramified
outside S. If d is omitted, return fields of any degree up to 6.
The fields are ordered by degree and discriminant.

INPUT:


@itemize -

@item 
@code{S} - list or set of primes, or a single prime

@item 
@code{d} - None (default, in which case all fields of degree <= 6 are returned)
or a positive integer giving the degree of the number fields returned.

@item 
@code{var} - the name used for the generator of the number fields (default 'a').
@end itemize

EXAMPLES:

@example
sage: J = JonesDatabase()             # optional - database_jones_numfield
sage: J.unramified_outside([101,109]) # optional - database_jones_numfield
[Number Field in a with defining polynomial x - 1,
 Number Field in a with defining polynomial x^2 - 101,
 Number Field in a with defining polynomial x^2 - 109,
 Number Field in a with defining polynomial x^3 - x^2 - 36*x + 4,
 Number Field in a with defining polynomial x^4 - x^3 + 13*x^2 - 19*x + 361,
 Number Field in a with defining polynomial x^4 - x^3 + 14*x^2 + 34*x + 393,
 Number Field in a with defining polynomial x^5 + 2*x^4 + 7*x^3 + 4*x^2 + 11*x - 6,
 Number Field in a with defining polynomial x^5 + x^4 - 6*x^3 - x^2 + 18*x + 4,
 Number Field in a with defining polynomial x^5 - x^4 - 40*x^3 - 93*x^2 - 21*x + 17]
@end example
@end deffn
@end deffn

@c nodoctest

@node The On-Line Encyclopedia of Integer Sequences OEIS,Local copy of Sloane On-Line Encyclopedia of Integer Sequences,John Jones's tables of number fields,Top
@anchor{sage/databases/oeis the-on-line-encyclopedia-of-integer-sequences-oeis}@anchor{45}@anchor{sage/databases/oeis doc}@anchor{46}@anchor{sage/databases/oeis sage-databases-oeis}@anchor{47}
@chapter The On-Line Encyclopedia of Integer Sequences (OEIS)


@c This file has been autogenerated.
@anchor{sage/databases/oeis module-sage databases oeis}@anchor{8}
@geindex sage.databases.oeis (module)

You can query the OEIS (Online Database of Integer Sequences) through Sage in
order to:

@quotation


@itemize -

@item 
identify a sequence from its first terms.

@item 
obtain more terms, formulae, references, etc. for a given sequence.
@end itemize
@end quotation

AUTHORS:


@itemize -

@item 
Thierry Monteil (2012-02-10 -- 2013-06-21): initial version.

@item 
Vincent Delecroix (2014): modifies continued fractions because of trac ticket #14567@footnote{https://trac.sagemath.org/14567}

@item 
Moritz Firsching (2016): modifies handling of dead sequence, see trac ticket #17330@footnote{https://trac.sagemath.org/17330}
@end itemize

EXAMPLES:

@example
sage: oeis
The On-Line Encyclopedia of Integer Sequences (http://oeis.org/)
@end example

What about a sequence starting with @math{3@comma{} 7@comma{} 15@comma{} 1} ?

@example
sage: search = oeis([3, 7, 15, 1], max_results=4) ; search  # optional -- internet
0: A001203: Continued fraction expansion of Pi.
1: A082495: a(n) = (2^n - 1) mod n.
2: A165416: Irregular array read by rows: The n-th row contains those distinct positive integers that each, when written in binary, occurs as a substring in binary n.
3: A246674: Run Length Transform of A000225.

sage: [u.id() for u in search]                      # optional -- internet
['A001203', 'A082495', 'A165416', 'A246674']
sage: c = search[0] ; c                             # optional -- internet
A001203: Continued fraction expansion of Pi.
@end example

@example
sage: c.first_terms(15)                             # optional -- internet
(3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1)

sage: c.examples()                                  # optional -- internet
0: Pi = 3.1415926535897932384...
1:    = 3 + 1/(7 + 1/(15 + 1/(1 + 1/(292 + ...))))
2:    = [a_0; a_1, a_2, a_3, ...] = [3; 7, 15, 1, 292, ...]

sage: c.comments()                                  # optional -- internet
0: The first 5,821,569,425 terms were computed by _Eric W. Weisstein_ on Sep 18 2011.
1: The first 10,672,905,501 terms were computed by _Eric W. Weisstein_ on Jul 17 2013.
2: The first 15,000,000,000 terms were computed by _Eric W. Weisstein_ on Jul 27 2013.
@end example

@example
sage: x = c.natural_object() ; type(x)              # optional -- internet
<class 'sage.rings.continued_fraction.ContinuedFraction_periodic'>

sage: x.convergents()[:7]                           # optional -- internet
[3, 22/7, 333/106, 355/113, 103993/33102, 104348/33215, 208341/66317]

sage: RR(x.value())                                 # optional -- internet
3.14159265358979
sage: RR(x.value()) == RR(pi)                       # optional -- internet
True
@end example

What about posets ? Are they hard to count ? To which other structures are they
related ?

@example
sage: [Posets(i).cardinality() for i in range(10)]
[1, 1, 2, 5, 16, 63, 318, 2045, 16999, 183231]
sage: oeis(_)                                       # optional -- internet
0: A000112: Number of partially ordered sets ("posets") with n unlabeled elements.
sage: p = _[0]                                      # optional -- internet
@end example

@example
sage: 'hard' in p.keywords()                        # optional -- internet
True
sage: len(p.formulas())                             # optional -- internet
0
sage: len(p.first_terms())                          # optional -- internet
17
@end example

@example
sage: p.cross_references(fetch=True)                # optional -- internet
0: A000798: Number of different quasi-orders (or topologies, or transitive digraphs) with n labeled elements.
1: A001035: Number of partially ordered sets ("posets") with n labeled elements (or labeled acyclic transitive digraphs).
2: A001930: Number of topologies, or transitive digraphs with n unlabeled nodes.
3: A006057: Number of topologies on n labeled points satisfying axioms T_0-T_4.
4: A079263: Number of constrained mixed models with n factors.
5: A079265: Number of antisymmetric transitive binary relations on n unlabeled points.
@end example

What does the Taylor expansion of the @math{e^(e^x-1)`} function have to do with
primes ?

@example
sage: x = var('x') ; f(x) = e^(e^x - 1)
sage: L = [a*factorial(b) for a,b in taylor(f(x), x, 0, 20).coefficients()] ; L
[1, 1, 2, 5, 15, 52, 203, 877, 4140, 21147, 115975, 678570, 4213597,
27644437, 190899322, 1382958545, 10480142147, 82864869804, 682076806159,
5832742205057, 51724158235372]

sage: oeis(L)                                       # optional -- internet
0: A000110: Bell or exponential numbers: number of ways to partition a set of n labeled elements.

sage: b = _[0]                                      # optional -- internet

sage: b.formulas()[0]                               # optional -- internet
'E.g.f.: exp(exp(x) - 1).'

sage: [i for i in b.comments() if 'prime' in i][-1]     # optional -- internet
'Number n is prime if mod(a(n)-2,n) = 0. -_Dmitry Kruchinin_, Feb 14 2012'

sage: [n for n in range(2, 20) if (b(n)-2) % n == 0]    # optional -- internet
[2, 3, 5, 7, 11, 13, 17, 19]
@end example


@subsubheading See also



@itemize -

@item 
If you plan to do a lot of automatic searches for subsequences, you
should consider installing @ref{9,,SloaneEncyclopedia}, a local partial copy of the OEIS.

@item 
Some infinite OEIS sequences are implemented in Sage, via the
sloane_functions@footnote{../../../../../../html/en/reference/combinat/sage/combinat/sloane_functions.html#module-sage.combinat.sloane_functions} module.
@end itemize


@cartouche
@quotation Todo 

@itemize -

@item 
in case of flood, suggest the user to install the off-line database instead.

@item 
interface with the off-line database (or reimplement it).
@end itemize
@end quotation
@end cartouche

@menu
* Classes and methods:: 

@end menu

@node Classes and methods,,,The On-Line Encyclopedia of Integer Sequences OEIS
@anchor{sage/databases/oeis classes-and-methods}@anchor{48}
@section Classes and methods


@geindex FancyTuple (class in sage.databases.oeis)
@anchor{sage/databases/oeis sage databases oeis FancyTuple}@anchor{49}
@deffn {Class} sage.databases.oeis.FancyTuple

Bases: tuple@footnote{https://docs.python.org/library/functions.html#tuple}

This class inherits from @code{tuple}, it allows to nicely print tuples whose
elements have a one line representation.

EXAMPLES:

@example
sage: from sage.databases.oeis import FancyTuple
sage: t = FancyTuple(['zero', 'one', 'two', 'three', 4]) ; t
0: zero
1: one
2: two
3: three
4: 4

sage: t[2]
'two'
@end example
@end deffn

@geindex OEIS (class in sage.databases.oeis)
@anchor{sage/databases/oeis sage databases oeis OEIS}@anchor{4a}
@deffn {Class} sage.databases.oeis.OEIS

The On-Line Encyclopedia of Integer Sequences.

@code{OEIS} is a class representing the On-Line Encyclopedia of Integer
Sequences. You can query it using its methods, but @code{OEIS} can also be
called directly with three arguments:


@itemize -

@item 
@code{query} - it can be:


@itemize -

@item 
a string representing an OEIS ID (e.g. 'A000045').

@item 
an integer representing an OEIS ID (e.g. 45).

@item 
a list representing a sequence of integers.

@item 
a string, representing a text search.
@end itemize

@item 
@code{max_results} - (integer, default: 30) the maximum number of
results to return, they are sorted according to their relevance. In
any cases, the OEIS website will never provide more than 100 results.

@item 
@code{first_result} - (integer, default: 0) allow to skip the
@code{first_result} first results in the search, to go further.
This is useful if you are looking for a sequence that may appear
after the 100 first found sequences.
@end itemize

OUTPUT:


@itemize -

@item 
if @code{query} is an integer or an OEIS ID (e.g. 'A000045'), returns
the associated OEIS sequence.

@item 
if @code{query} is a string, returns a tuple of OEIS sequences whose
description corresponds to the query. Those sequences can be used
without the need to fetch the database again.

@item 
if @code{query} is a list of integers, returns a tuple of OEIS sequences
containing it as a subsequence. Those sequences can be used without
the need to fetch the database again.
@end itemize

EXAMPLES:

@example
sage: oeis
The On-Line Encyclopedia of Integer Sequences (http://oeis.org/)
@end example

A particular sequence can be called by its A-number or number:

@example
sage: oeis('A000040')                           # optional -- internet
A000040: The prime numbers.

sage: oeis(45)                                  # optional -- internet
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
@end example

The database can be searched by subsequence:

@example
sage: search = oeis([1,2,3,5,8,13]) ; search    # optional -- internet
0: A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
1: A027926: Triangular array T read by rows: T(n,0) = T(n,2n) = 1 for n >= 0; T(n,1) = 1 for n >= 1; T(n,k) = T(n-1,k-2) + T(n-1,k-1) for k = 2..2n-1, n >= 2.
2: A001129: Iccanobif numbers: reverse digits of two previous terms and add.

sage: fibo = search[0]                         # optional -- internet

sage: fibo.name()                               # optional -- internet
'Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.'

sage: fibo.first_terms()                        # optional -- internet
(0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987,
1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393,
196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887,
9227465, 14930352, 24157817, 39088169)

sage: fibo.cross_references()[0]                # optional -- internet
'A039834'

sage: fibo == oeis(45)                          # optional -- internet
True

sage: sfibo = oeis('A039834')                   # optional -- internet
sage: sfibo.first_terms()                       # optional -- internet
(1, 1, 0, 1, -1, 2, -3, 5, -8, 13, -21, 34, -55, 89, -144, 233,
-377, 610, -987, 1597, -2584, 4181, -6765, 10946, -17711, 28657,
-46368, 75025, -121393, 196418, -317811, 514229, -832040, 1346269,
-2178309, 3524578, -5702887, 9227465, -14930352, 24157817)

sage: sfibo.first_terms(absolute_value=True)[2:20] == fibo.first_terms()[:18]   # optional -- internet
True

sage: fibo.formulas()[4]                        # optional -- internet
'F(n) = F(n-1) + F(n-2) = -(-1)^n F(-n).'

sage: fibo.comments()[1]                        # optional -- internet
"F(n+2) = number of binary sequences of length n that have no
consecutive 0's."

sage: fibo.links()[0]                           # optional -- internet
'http://oeis.org/A000045/b000045.txt'
@end example

The database can be searched by description:

@example
sage: oeis('prime gap factorization', max_results=4)                # optional -- internet
0: A073491: Numbers having no prime gaps in their factorization.
1: A073490: Number of prime gaps in factorization of n.
2: A073492: Numbers having at least one prime gap in their factorization.
3: A073493: Numbers having exactly one prime gap in their factorization.
@end example

@cartouche
@quotation Warning 
The following will fetch the OEIS database twice (once for searching the
database, and once again for creating the sequence @code{fibo}):

@example
sage: oeis([1,2,3,5,8,13])                  # optional -- internet
0: A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
1: A027926: Triangular array T read by rows: T(n,0) = T(n,2n) = 1 for n >= 0; T(n,1) = 1 for n >= 1; T(n,k) = T(n-1,k-2) + T(n-1,k-1) for k = 2..2n-1, n >= 2.
2: A001129: Iccanobif numbers: reverse digits of two previous terms and add.

sage: fibo = oeis('A000045')                # optional -- internet
@end example

Do not do this, it is slow, it costs bandwidth and server resources !
Instead, do the following, to reuse the result of the search to create
the sequence:

@example
sage: oeis([1,2,3,5,8,13])                  # optional -- internet
0: A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
1: A027926: Triangular array T read by rows: T(n,0) = T(n,2n) = 1 for n >= 0; T(n,1) = 1 for n >= 1; T(n,k) = T(n-1,k-2) + T(n-1,k-1) for k = 2..2n-1, n >= 2.
2: A001129: Iccanobif numbers: reverse digits of two previous terms and add.

sage: fibo = _[0]                           # optional -- internet
@end example
@end quotation
@end cartouche

@geindex browse() (sage.databases.oeis.OEIS method)
@anchor{sage/databases/oeis sage databases oeis OEIS browse}@anchor{4b}
@deffn {Method} browse ()

Open the OEIS web page in a browser.

EXAMPLES:

@example
sage: oeis.browse()                         # optional -- webbrowser
@end example
@end deffn

@geindex find_by_description() (sage.databases.oeis.OEIS method)
@anchor{sage/databases/oeis sage databases oeis OEIS find_by_description}@anchor{4c}
@deffn {Method} find_by_description (description, max_results=3, first_result=0)

Search for OEIS sequences corresponding to the description.

INPUT:


@itemize -

@item 
@code{description} - (string) the description the searched sequences.

@item 
@code{max_results} - (integer, default: 3) the maximum number of results
we want. In any case, the on-line encyclopedia will not return more
than 100 results.

@item 
@code{first_result} - (integer, default: 0) allow to skip the
@code{first_result} first results in the search, to go further.
This is useful if you are looking for a sequence that may appear
after the 100 first found sequences.
@end itemize

OUTPUT:


@itemize -

@item 
a tuple (with fancy formatting) of at most @code{max_results} OEIS
sequences. Those sequences can be used without the need to fetch the
database again.
@end itemize

EXAMPLES:

@example
sage: oeis.find_by_description('prime gap factorization')       # optional -- internet
0: A073491: Numbers having no prime gaps in their factorization.
1: A073490: Number of prime gaps in factorization of n.
2: A073492: Numbers having at least one prime gap in their factorization.

sage: prime_gaps = _[1] ; prime_gaps        # optional -- internet
A073490: Number of prime gaps in factorization of n.
@end example

@example
sage: oeis('beaver')                        # optional -- internet
0: A028444: Busy Beaver sequence, or Rado's sigma function: ...
1: A060843: Busy Beaver problem: a(n) = maximal number of steps ...
2: A131956: Busy Beaver variation: maximum number of steps for ...

sage: oeis('beaver', max_results=4, first_result=2)     # optional -- internet
0: A131956: Busy Beaver variation: maximum number of steps for ...
1: A141475: Number of Turing machines with n states following ...
2: A131957: Busy Beaver sigma variation: maximum number of 1's ...
3: A052200: Number of n-state, 2-symbol, d+ in @{LEFT, RIGHT@}, ...
@end example
@end deffn

@geindex find_by_id() (sage.databases.oeis.OEIS method)
@anchor{sage/databases/oeis sage databases oeis OEIS find_by_id}@anchor{4d}
@deffn {Method} find_by_id (ident)

INPUT:


@itemize -

@item 
@code{ident} - a string representing the A-number of the sequence
or an integer representing its number.
@end itemize

OUTPUT:


@itemize -

@item 
The OEIS sequence whose A-number or number corresponds to
@code{ident}.
@end itemize

EXAMPLES:

@example
sage: oeis.find_by_id('A000040')            # optional -- internet
A000040: The prime numbers.

sage: oeis.find_by_id(40)                   # optional -- internet
A000040: The prime numbers.
@end example
@end deffn

@geindex find_by_subsequence() (sage.databases.oeis.OEIS method)
@anchor{sage/databases/oeis sage databases oeis OEIS find_by_subsequence}@anchor{4e}
@deffn {Method} find_by_subsequence (subsequence, max_results=3, first_result=0)

Search for OEIS sequences containing the given subsequence.

INPUT:


@itemize -

@item 
@code{subsequence} - a list of integers.

@item 
@code{max_results} - (integer, default: 3), the maximum of results requested.

@item 
@code{first_result} - (integer, default: 0) allow to skip the
@code{first_result} first results in the search, to go further.
This is useful if you are looking for a sequence that may appear
after the 100 first found sequences.
@end itemize

OUTPUT:


@itemize -

@item 
a tuple (with fancy formatting) of at most @code{max_results} OEIS
sequences. Those sequences can be used without the need to fetch the
database again.
@end itemize

EXAMPLES:

@example
sage: oeis.find_by_subsequence([2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377]) # optional -- internet
0: A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
1: A177194: Fibonacci numbers whose decimal expression does not contain any digit 0.
2: A212804: Expansion of (1-x)/(1-x-x^2).

sage: fibo = _[0] ; fibo                    # optional -- internet
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
@end example
@end deffn
@end deffn

@geindex OEISSequence (class in sage.databases.oeis)
@anchor{sage/databases/oeis sage databases oeis OEISSequence}@anchor{4f}
@deffn {Class} sage.databases.oeis.OEISSequence (entry)

Bases: sage.structure.sage_object.SageObject@footnote{../../../../../../html/en/reference/structure/sage/structure/sage_object.html#sage.structure.sage_object.SageObject}

The class of OEIS sequences.

This class implements OEIS sequences. Such sequences are produced from a
string in the OEIS format. They are usually produced by calls to the
On-Line Encyclopedia of Integer Sequences, represented by the class
@ref{4a,,OEIS}.

@cartouche
@quotation Note 
Since some sequences do not start with index 0, there is a difference
between calling and getting item, see @ref{50,,__call__()} for more details

@example
sage: sfibo = oeis('A039834')               # optional -- internet
sage: sfibo.first_terms()[:10]              # optional -- internet
(1, 1, 0, 1, -1, 2, -3, 5, -8, 13)

sage: sfibo(-2)                             # optional -- internet
1
sage: sfibo(3)                              # optional -- internet
2
sage: sfibo.offsets()                       # optional -- internet
(-2, 6)

sage: sfibo[0]                              # optional -- internet
1
sage: sfibo[6]                              # optional -- internet
-3
@end example
@end quotation
@end cartouche

@geindex __call__() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence __call__}@anchor{50}
@deffn {Method} __call__ (k)

Return the element of the sequence @code{self} with index @code{k}.

INPUT:


@itemize -

@item 
@code{k} - integer.
@end itemize

OUTPUT:


@itemize -

@item 
integer.
@end itemize

@cartouche
@quotation Note 
The first index of the sequence @code{self} is not necessarily zero,
it depends on the first offset of @code{self}. If the sequence
represents the decimal expansion of a real number, the index 0
corresponds to the digit right after the decimal point.
@end quotation
@end cartouche

EXAMPLES:

@example
sage: f = oeis(45)                          # optional -- internet
sage: f.first_terms()[:10]                  # optional -- internet
(0, 1, 1, 2, 3, 5, 8, 13, 21, 34)

sage: f(4)                                  # optional -- internet
3
@end example

@example
sage: sfibo = oeis('A039834')               # optional -- internet
sage: sfibo.first_terms()[:10]              # optional -- internet
(1, 1, 0, 1, -1, 2, -3, 5, -8, 13)

sage: sfibo(-2)                             # optional -- internet
1
sage: sfibo(4)                              # optional -- internet
-3
sage: sfibo.offsets()                       # optional -- internet
(-2, 6)
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s(38)
1
sage: s(42)
-1
sage: s(2)
Traceback (most recent call last):
...
ValueError: Sequence A999999 is not defined (or known) for index 2
@end example
@end deffn

@geindex author() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence author}@anchor{51}
@deffn {Method} author ()

Returns the author of the sequence in the encyclopedia.

OUTPUT:


@itemize -

@item 
string.
@end itemize

EXAMPLES:

@example
sage: f = oeis(45) ; f                      # optional -- internet
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.

sage: f.author()                            # optional -- internet
'_N. J. A. Sloane_, Apr 30 1991'
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.author()
'Anonymous.'
@end example
@end deffn

@geindex browse() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence browse}@anchor{52}
@deffn {Method} browse ()

Open the OEIS web page associated to the sequence @code{self} in a browser.

EXAMPLES:

@example
sage: f = oeis(45) ; f                      # optional -- internet webbrowser
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.

sage: f.browse()                            # optional -- internet webbrowser
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()        # optional -- webbrowser
sage: s.browse()                            # optional -- webbrowser
@end example
@end deffn

@geindex comments() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence comments}@anchor{53}
@deffn {Method} comments ()

Return a tuple of comments associated to the sequence @code{self}.

OUTPUT:


@itemize -

@item 
tuple of strings (with fancy formatting).
@end itemize

EXAMPLES:

@example
sage: f = oeis(45) ; f                      # optional -- internet
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.

sage: f.comments()[:3]                      # optional -- internet
0: Also sometimes called Lamé's sequence.
1: F(n+2) = number of binary sequences of length n that have no consecutive 0's.
2: F(n+2) = number of subsets of @{1,2,...,n@} that contain no consecutive integers.
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.comments()
0: 42 is the product of the first 4 prime numbers, except 5 and perhaps 1.
1: Apart from that, i have no comment.
@end example
@end deffn

@geindex cross_references() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence cross_references}@anchor{54}
@deffn {Method} cross_references (fetch=False)

Return a tuple of cross references associated to the sequence
@code{self}.

INPUT:


@itemize -

@item 
@code{fetch} - boolean (default: @code{False}).
@end itemize

OUTPUT:


@itemize -

@item 
if @code{fetch} is @code{False}, return a list of OEIS IDs (strings).

@item 
if @code{fetch} if @code{True}, return a tuple of OEIS sequences.
@end itemize

EXAMPLES:

@example
sage: nbalanced = oeis("A005598") ; nbalanced   # optional -- internet
A005598: a(n)=1+sum((n-i+1)*phi(i),i=1..n).

sage: nbalanced.cross_references()              # optional -- internet
('A049703', 'A049695', 'A103116', 'A000010')

sage: nbalanced.cross_references(fetch=True)    # optional -- internet
0: A049703: a(0) = 0; for n>0, a(n) = A005598(n)/2.
1: A049695: Array T read by diagonals; T(i,j)=number of nonnegative slopes of lines determined by 2 lattice points in [ 0,i ] X [ 0,j ] if i>0; T(0,j)=1 if j>0; T(0,0)=0.
2: A103116: A005598(n) - 1.
3: A000010: Euler totient function phi(n): count numbers <= n and prime to n.

sage: phi = _[3]                                # optional -- internet
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.cross_references()
('A000042', 'A000024')
@end example
@end deffn

@geindex examples() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence examples}@anchor{55}
@deffn {Method} examples ()

Return a tuple of examples associated to the sequence @code{self}.

OUTPUT:


@itemize -

@item 
tuple of strings (with fancy formatting).
@end itemize

EXAMPLES:

@example
sage: c = oeis(1203) ; c                    # optional -- internet
A001203: Continued fraction expansion of Pi.

sage: c.examples()                          # optional -- internet
0: Pi = 3.1415926535897932384...
1:    = 3 + 1/(7 + 1/(15 + 1/(1 + 1/(292 + ...))))
2:    = [a_0; a_1, a_2, a_3, ...] = [3; 7, 15, 1, 292, ...]
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.examples()
0: s(42) + s(43) = 0.
@end example
@end deffn

@geindex extensions_or_errors() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence extensions_or_errors}@anchor{56}
@deffn {Method} extensions_or_errors ()

Return a tuple of extensions or errors associated to the
sequence @code{self}.

OUTPUT:


@itemize -

@item 
tuple of strings (with fancy formatting).
@end itemize

EXAMPLES:

@example
sage: sfibo = oeis('A039834') ; sfibo       # optional -- internet
A039834: a(n+2) = -a(n+1)+a(n) (signed Fibonacci numbers); or Fibonacci numbers (A000045) extended to negative indices.

sage: sfibo.extensions_or_errors()[0]       # optional -- internet
'Signs corrected by _Len Smiley_ and _N. J. A. Sloane_.'
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.extensions_or_errors()
0: This sequence does not contain errors.
@end example
@end deffn

@geindex first_terms() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence first_terms}@anchor{57}
@deffn {Method} first_terms (number=None, absolute_value=False)

INPUT:


@itemize -

@item 
@code{number} - (integer or @code{None}, default: @code{None}) the number of
terms returned (if less than the number of available terms). When set
to None, returns all the known terms.

@item 
@code{absolute_value} - (bool, default: @code{False}) when a sequence has
negative entries, OEIS also stores the absolute values of its first
terms, when @code{absolute_value} is set to @code{True}, you will get them.
@end itemize

OUTPUT:


@itemize -

@item 
tuple of integers.
@end itemize

EXAMPLES:

@example
sage: f = oeis(45) ; f                      # optional -- internet
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.

sage: f.first_terms()[:10]                  # optional -- internet
(0, 1, 1, 2, 3, 5, 8, 13, 21, 34)
@end example

Handle dead sequences: see  trac ticket #17330@footnote{https://trac.sagemath.org/17330}

@example
sage: oeis(17).first_terms(12)              # optional -- internet  
oeis(17).first_terms(12)
.. RuntimeWarning: This sequence is dead  "A000017: Erroneous version of A032522."
warn('This sequence is dead  "'+self.id()+": "+self.name()+'"', RuntimeWarning)
(1, 0, 0, 2, 2, 4, 8, 4, 16, 12, 48, 80)            
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.first_terms()
(1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
sage: s.first_terms(5)
(1, 1, 1, 1, -1)
sage: s.first_terms(5, absolute_value=True)
(1, 1, 1, 1, 1)

sage: s = oeis._imaginary_sequence(keywords='full')
sage: s(40)
Traceback (most recent call last):
...
TypeError: You found a sign inconsistency, please contact OEIS

sage: s = oeis._imaginary_sequence(keywords='sign,full')
sage: s(40)
1

sage: s = oeis._imaginary_sequence(keywords='nonn,full')
sage: s(42)
1
@end example
@end deffn

@geindex formulas() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence formulas}@anchor{58}
@deffn {Method} formulas ()

Return a tuple of formulas associated to the sequence @code{self}.

OUTPUT:


@itemize -

@item 
tuple of strings (with fancy formatting).
@end itemize

EXAMPLES:

@example
sage: f = oeis(45) ; f                      # optional -- internet
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.

sage: f.formulas()[2]                       # optional -- internet
'F(n) = ((1+sqrt(5))^n-(1-sqrt(5))^n)/(2^n*sqrt(5)).'
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.formulas()
0: For n big enough, s(n+1) - s(n) = 0.
@end example
@end deffn

@geindex id() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence id}@anchor{59}
@deffn {Method} id (format='A')

The ID of the sequence @code{self} is the A-number that identifies
@code{self}.

INPUT:


@itemize -

@item 
@code{format} - (string, default: 'A').
@end itemize

OUTPUT:


@itemize -

@item 
if @code{format} is set to 'A', returns a string of the form 'A000123'.

@item 
if @code{format} is set to 'int' returns an integer of the form 123.
@end itemize

EXAMPLES:

@example
sage: f = oeis(45) ; f                      # optional -- internet
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.

sage: f.id()                                # optional -- internet
'A000045'

sage: f.id(format='int')                    # optional -- internet
45
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.id()
'A999999'
sage: s.id(format='int')
999999
@end example
@end deffn

@geindex is_finite() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence is_finite}@anchor{5a}
@deffn {Method} is_finite ()

Tells whether the sequence is finite.

Currently, OEIS only provides a keyword when the sequence is known to
be finite. So, when this keyword is not there, we do not know whether
it is infinite or not.

OUTPUT:


@itemize -

@item 
Returns @code{True} when the sequence is known to be finite.

@item 
Returns @code{Unknown} otherwise.
@end itemize

@cartouche
@quotation Todo 
Ask OEIS for a keyword ensuring that a sequence is infinite.
@end quotation
@end cartouche

EXAMPLES:

@example
sage: s = oeis('A114288') ; s               # optional -- internet
A114288: Lexicographically earliest solution of any 9 X 9 sudoku, read by rows.

sage: s.is_finite()                         # optional -- internet
True
@end example

@example
sage: f = oeis(45) ; f                      # optional -- internet
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.

sage: f.is_finite()                         # optional -- internet
Unknown
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.is_finite()
Unknown

sage: s = oeis._imaginary_sequence('nonn,finit')
sage: s.is_finite()
True
@end example
@end deffn

@geindex is_full() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence is_full}@anchor{5b}
@deffn {Method} is_full ()

Tells whether the sequence @code{self} is full, that is, if all its
elements are listed in @code{self.first_terms()}.

Currently, OEIS only provides a keyword when the sequence is known to
be full. So, when this keyword is not there, we do not know whether
some elements are missing or not.

OUTPUT:


@itemize -

@item 
Returns @code{True} when the sequence is known to be full.

@item 
Returns @code{Unknown} otherwise.
@end itemize

EXAMPLES:

@example
sage: s = oeis('A114288') ; s               # optional -- internet
A114288: Lexicographically earliest solution of any 9 X 9 sudoku, read by rows.

sage: s.is_full()                           # optional -- internet
True
@end example

@example
sage: f = oeis(45) ; f                      # optional -- internet
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.

sage: f.is_full()                           # optional -- internet
Unknown
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.is_full()
Unknown

sage: s = oeis._imaginary_sequence('nonn,full,finit')
sage: s.is_full()
True
@end example
@end deffn

@geindex keywords() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence keywords}@anchor{5c}
@deffn {Method} keywords ()

Return the keywords associated to the sequence @code{self}.

OUTPUT:


@itemize -

@item 
tuple of strings.
@end itemize

EXAMPLES:

@example
sage: f = oeis(53) ; f                      # optional -- internet
A000053: Local stops on New York City Broadway line (IRT #1) subway.

sage: f.keywords()                          # optional -- internet
('nonn', 'fini', 'full')
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.keywords()
('sign', 'easy')

sage: s = oeis._imaginary_sequence(keywords='nonn,hard')
sage: s.keywords()
('nonn', 'hard')
@end example
@end deffn

@geindex links() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence links}@anchor{5d}
@deffn {Method} links (browse=None, format='guess')

Return, display or browse links associated to the sequence @code{self}.

INPUT:


@itemize -

@item 
@code{browse} - an integer, a list of integers, or the word 'all'
(default: @code{None}) : which links to open in a web browser.

@item 
@code{format} - string (default: 'guess') : how to display the links.
@end itemize

OUTPUT:


@itemize -

@item 

@table @asis

@item tuple of strings (with fancy formatting):


@itemize -

@item 
if @code{format} is @code{url}, returns a tuple of absolute links without description.

@item 
if @code{format} is @code{html}, returns nothing but prints a tuple of clickable absolute links in their context.

@item 
if @code{format} is @code{guess}, adapts the output to the context (command line or notebook).

@item 
if @code{format} is @code{raw}, the links as they appear in the database, relative links are not made absolute.
@end itemize
@end table
@end itemize

EXAMPLES:

@example
sage: f = oeis(45) ; f                      # optional -- internet
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.

sage: f.links(format='url')                             # optional -- internet
0: http://oeis.org/A000045/b000045.txt
1: http://www.schoolnet.ca/vp-pv/amof/e_fiboI.htm
...

sage: f.links(format='raw')                 # optional -- internet
0: N. J. A. Sloane, <a href="/A000045/b000045.txt">The first 2000 Fibonacci numbers: Table of n, F(n) for n = 0..2000</a>
1: Amazing Mathematical Object Factory, <a href="http://www.schoolnet.ca/vp-pv/amof/e_fiboI.htm">Information on the Fibonacci sequences</a>
...
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.links(format='raw')[2]
'Do not confuse with the sequence <a href="/A000042">A000042</a> or the sequence <a href="/A000024">A000024</a>'

sage: s.links(format='url')[3]
'http://oeis.org/A000024'

sage: HTML = s.links(format="html");  HTML
0: Wikipedia, <a href="http://en.wikipedia.org/wiki/42_(number)">42 (number)</a>
1: See. also <a href="https://trac.sagemath.org/sage_trac/ticket/42">trac ticket #42</a>
...
sage: type(HTML)
<class 'sage.misc.html.HtmlFragment'>
@end example
@end deffn

@geindex name() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence name}@anchor{5e}
@deffn {Method} name ()

Return the name of the sequence @code{self}.

OUTPUT:


@itemize -

@item 
string.
@end itemize

EXAMPLES:

@example
sage: f = oeis(45) ; f                      # optional -- internet
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.

sage: f.name()                              # optional -- internet
'Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.'
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.name()
'The opposite of twice the characteristic sequence of 42 plus one, starting from 38.'
@end example
@end deffn

@geindex natural_object() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence natural_object}@anchor{5f}
@deffn {Method} natural_object ()

Return the natural object associated to the sequence @code{self}.

OUTPUT:


@itemize -

@item 

@table @asis

@item If the sequence @code{self} corresponds to the digits of a real

number, returns the associated real number (as an element of
RealLazyField()).
@end table

@item 

@table @asis

@item If the sequence @code{self} corresponds to the convergents of a

continued fraction, returns the associated continued fraction.
@end table
@end itemize

@cartouche
@quotation Warning 
This method forgets the fact that the returned sequence may not be
complete.
@end quotation
@end cartouche

@cartouche
@quotation Todo 

@itemize -

@item 
ask OEIS to add a keyword telling whether the sequence comes from
a power series, e.g. for @indicateurl{http://oeis.org/A000182}

@item 
discover other possible conversions.
@end itemize
@end quotation
@end cartouche

EXAMPLES:

@example
sage: g = oeis("A002852") ; g               # optional -- internet
A002852: Continued fraction for Euler's constant (or Euler-Mascheroni constant) gamma.

sage: x = g.natural_object() ; type(x)      # optional -- internet
<class 'sage.rings.continued_fraction.ContinuedFraction_periodic'>

sage: RDF(x) == RDF(euler_gamma)            # optional -- internet
True

sage: cfg = continued_fraction(euler_gamma)
sage: x[:90] == cfg[:90]                    # optional -- internet
True
@end example

@example
sage: ee = oeis('A001113') ; ee             # optional -- internet
A001113: Decimal expansion of e.

sage: x = ee.natural_object() ; x           # optional -- internet
2.718281828459046?

sage: x.parent()                            # optional -- internet
Real Lazy Field

sage: x == RR(e)                            # optional -- internet
True
@end example

@example
sage: av = oeis('A087778') ; av             # optional -- internet
A087778: Decimal expansion of Avogadro's constant.

sage: av.natural_object()                   # optional -- internet
6.022141000000000?e23
@end example

@example
sage: fib = oeis('A000045') ; fib           # optional -- internet
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.

sage: x = fib.natural_object() ; x.universe()         # optional -- internet
Non negative integer semiring
@end example

@example
sage: sfib = oeis('A039834') ; sfib         # optional -- internet
A039834: a(n+2) = -a(n+1)+a(n) (signed Fibonacci numbers); or Fibonacci numbers (A000045) extended to negative indices.

sage: x = sfib.natural_object() ; x.universe()    # optional -- internet
Integer Ring
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence('nonn,cofr')
sage: type(s.natural_object())
<class 'sage.rings.continued_fraction.ContinuedFraction_periodic'>

sage: s = oeis._imaginary_sequence('nonn')
sage: s.natural_object().universe()
Non negative integer semiring

sage: s = oeis._imaginary_sequence()
sage: s.natural_object().universe()
Integer Ring
@end example
@end deffn

@geindex offsets() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence offsets}@anchor{60}
@deffn {Method} offsets ()

Return the offsets of the sequence @code{self}.

The first offset is the subscript of the first term in the sequence
@code{self}. When, the sequence represents the decimal expansion of a real
number, it corresponds to the number of digits of its integer part.

The second offset is the first term in the sequence @code{self} (starting
from 1) whose absolute value is greater than 1. This is set to 1 if all
the terms are 0 or +-1.

OUTPUT:


@itemize -

@item 
tuple of two elements.
@end itemize

EXAMPLES:

@example
sage: f = oeis(45) ; f                      # optional -- internet
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.

sage: f.offsets()                           # optional -- internet
(0, 4)

sage: f.first_terms()[:4]                   # optional -- internet
(0, 1, 1, 2)
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.offsets()
(38, 4)
@end example
@end deffn

@geindex old_IDs() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence old_IDs}@anchor{61}
@deffn {Method} old_IDs ()

Returns the IDs of the sequence @code{self} corresponding to ancestors of OEIS.

OUTPUT:


@itemize -

@item 
a tuple of at most two strings. When the string starts with @math{M}, it
corresponds to the ID of "The Encyclopedia of Integer Sequences" of
1995. When the string starts with @math{N}, it corresponds to the ID of
the "Handbook of Integer Sequences" of 1973.
@end itemize

EXAMPLES:

@example
sage: f = oeis(45) ; f                      # optional -- internet
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.

sage: f.old_IDs()                           # optional -- internet
('M0692', 'N0256')
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.old_IDs()
('M9999', 'N9999')
@end example
@end deffn

@geindex programs() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence programs}@anchor{62}
@deffn {Method} programs (language='other')

Returns programs implementing the sequence @code{self} in the given @code{language}.

INPUT:


@itemize -

@item 
@code{language} - string (default: 'other') - the language of the
program. Current values are: 'maple', 'mathematica' and 'other'.
@end itemize

OUTPUT:


@itemize -

@item 
tuple of strings (with fancy formatting).
@end itemize

@cartouche
@quotation Todo 
ask OEIS to add a "Sage program" field in the database ;)
@end quotation
@end cartouche

EXAMPLES:

@example
sage: ee = oeis('A001113') ; ee             # optional -- internet
A001113: Decimal expansion of e.

sage: ee.programs()[0]                      # optional -- internet
'(PARI) @{ default(realprecision, 50080); x=exp(1); for (n=1, 50000, d=floor(x); x=(x-d)*10; write("b001113.txt", n, " ", d)); @} \\\\ _Harry J. Smith_, Apr 15 2009'
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.programs()
0: (Python)
1: def A999999(n):
2:     assert(isinstance(n, (int, Integer))), "n must be an integer."
3:     if n < 38:
4:         raise ValueError("The value %s is not accepted." %str(n)))
5:     elif n == 42:
6:         return -1
7:     else:
8:         return 1

sage: s.programs('maple')
0: Do not even try, Maple is not able to produce such a sequence.

sage: s.programs('mathematica')
0: Mathematica neither.
@end example
@end deffn

@geindex raw_entry() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence raw_entry}@anchor{63}
@deffn {Method} raw_entry ()

Return the raw entry of the sequence @code{self}, in the OEIS format.

OUTPUT:


@itemize -

@item 
string.
@end itemize

EXAMPLES:

@example
sage: f = oeis(45) ; f                      # optional -- internet
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.

sage: print(f.raw_entry())                  # optional -- internet
%I A000045 M0692 N0256
%S A000045 0,1,1,2,3,5,8,13,21,34,55,89,144,...
%T A000045 10946,17711,28657,46368,...
...
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.raw_entry() == oeis._imaginary_entry('sign,easy')
True
@end example
@end deffn

@geindex references() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence references}@anchor{64}
@deffn {Method} references ()

Return a tuple of references associated to the sequence @code{self}.

OUTPUT:


@itemize -

@item 
tuple of strings (with fancy formatting).
@end itemize

EXAMPLES:

@example
sage: w = oeis(7540) ; w                    # optional -- internet
A007540: Wilson primes: primes p such that (p-1)! == -1 (mod p^2).

sage: w.references()                        # optional -- internet
0: A. H. Beiler, Recreations in the Theory of Numbers, Dover, NY, 1964, p. 52.
1: C. Clawson, Mathematical Mysteries, Plenum Press, 1996, p. 180.
2: R. Crandall and C. Pomerance, Prime Numbers: A Computational Perspective, Springer, NY, 2001; see p. 29.
3: G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, 5th ed., Oxford Univ. Press, 1979, th. 80.
...

sage: _[0]                                  # optional -- internet
'A. H. Beiler, Recreations in the Theory of Numbers, Dover, NY, 1964, p. 52.'
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.references()[1]
'Lewis Carroll, The Hunting of the Snark.'
@end example
@end deffn

@geindex show() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence show}@anchor{65}
@deffn {Method} show ()

Display most available informations about the sequence @code{self}.

EXAMPLES:

@example
sage: s = oeis(12345)                       # optional -- internet
sage: s.show()                              # optional -- internet
ID
A012345
<BLANKLINE>
NAME
Coefficients in the expansion sinh(arcsin(x)*arcsin(x)) = 2*x^2/2!+8*x^4/4!+248*x^6/6!+11328*x^8/8!+...
<BLANKLINE>
FIRST TERMS
(2, 8, 248, 11328, 849312, 94857600, 14819214720, 3091936512000, 831657655349760, 280473756197529600, 115967597965430077440, 57712257892456911912960, 34039765801079493369569280)
<BLANKLINE>
FORMULAS
...
OFFSETS
(0, 1)
<BLANKLINE>
URL
http://oeis.org/A012345
<BLANKLINE>
AUTHOR
Patrick Demichel (patrick.demichel(AT)hp.com)
<BLANKLINE>
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.show()
ID
A999999
<BLANKLINE>
NAME
The opposite of twice the characteristic sequence of 42 plus ...
FIRST TERMS
(1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
<BLANKLINE>
COMMENTS
0: 42 is the product of the first 4 prime numbers, except ...
1: Apart from that, i have no comment.
...
@end example
@end deffn

@geindex url() (sage.databases.oeis.OEISSequence method)
@anchor{sage/databases/oeis sage databases oeis OEISSequence url}@anchor{66}
@deffn {Method} url ()

Return the URL of the page associated to the sequence @code{self}.

OUTPUT:


@itemize -

@item 
string.
@end itemize

EXAMPLES:

@example
sage: f = oeis(45) ; f                      # optional -- internet
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.

sage: f.url()                               # optional -- internet
'http://oeis.org/A000045'
@end example

TESTS:

@example
sage: s = oeis._imaginary_sequence()
sage: s.url()
'http://oeis.org/A999999'
@end example
@end deffn
@end deffn

@geindex to_tuple() (in module sage.databases.oeis)
@anchor{sage/databases/oeis sage databases oeis to_tuple}@anchor{67}
@deffn {Function} sage.databases.oeis.to_tuple (string)
@end deffn

@c nodoctest

@node Local copy of Sloane On-Line Encyclopedia of Integer Sequences,FindStat - the Combinatorial Statistic Finder,The On-Line Encyclopedia of Integer Sequences OEIS,Top
@anchor{sage/databases/sloane sage-databases-sloane}@anchor{68}@anchor{sage/databases/sloane doc}@anchor{69}@anchor{sage/databases/sloane local-copy-of-sloane-on-line-encyclopedia-of-integer-sequences}@anchor{6a}
@chapter Local copy of Sloane On-Line Encyclopedia of Integer Sequences


@c This file has been autogenerated.
@anchor{sage/databases/sloane module-sage databases sloane}@anchor{9}
@geindex sage.databases.sloane (module)

The SloaneEncyclopedia object provides access to a local copy of the database
containing only the sequences and their names. To use this you must download
and install the database using @code{SloaneEncyclopedia.install()}, or
@code{SloaneEncyclopedia.install_from_gz()} if you have already downloaded the
database manually.

To look up a sequence, type

@example
sage: SloaneEncyclopedia[60843]               # optional - sloane_database
[1, 6, 21, 107]
@end example

To get the name of a sequence, type

@example
sage: SloaneEncyclopedia.sequence_name(1)     # optional - sloane_database
'Number of groups of order n.'
@end example

To search locally for a particular subsequence, type

@example
sage: SloaneEncyclopedia.find([1,2,3,4,5], 1)    # optional - sloane_database
[(15, [1, 2, 3, 4, 5, 7, 7, 8, 9, 11, 11, 13, 13, 16, 16, 16, 17, 19, 19, 23, 23, 23, 23, 25, 25, 27, 27, 29, 29, 31, 31, 32, 37, 37, 37, 37, 37, 41, 41, 41, 41, 43, 43, 47, 47, 47, 47, 49, 49, 53, 53, 53, 53, 59, 59, 59, 59, 59, 59, 61, 61, 64, 64, 64, 67, 67, 67, 71, 71, 71, 71, 73])]
@end example

The default maximum number of results is 30, but to return up to
100, type

@example
sage: SloaneEncyclopedia.find([1,2,3,4,5], 100)    # optional - sloane_database
[(15, [1, 2, 3, 4, 5, 7, 7, 8, 9, 11, 11, ...
@end example

Results in either case are of the form [ (number, list) ].


@subsubheading See also



@itemize -

@item 
If you want to get more informations relative to a sequence (references,
links, examples, programs, ...), you can use the On-Line Encyclopedia of
Integer Sequences provided by the @ref{8,,OEIS}
module.

@item 
Some infinite OEIS sequences are implemented in Sage, via the
sloane_functions@footnote{../../../../../../html/en/reference/combinat/sage/combinat/sloane_functions.html#module-sage.combinat.sloane_functions} module.
@end itemize


AUTHORS:


@itemize -

@item 
Steven Sivek (2005-12-22): first version

@item 
Steven Sivek (2006-02-07): updated to correctly handle the new
search form on the Sloane website, and it's now also smarter about
loading the local database in that it doesn't convert a sequence
from string form to a list of integers until absolutely necessary.
This seems to cut the loading time roughly in half.

@item 
Steven Sivek (2009-12-22): added the SloaneEncyclopedia functions
install() and install_from_gz() so users can get the latest versions
of the OEIS without having to get an updated spkg; added
sequence_name() to return the description of a sequence; and changed
the data type for elements of each sequence from int to Integer.

@item 
Thierry Monteil (2012-02-10): deprecate dead code and update related doc and
tests.
@end itemize

@menu
* Classes and methods: Classes and methods<2>. 

@end menu

@node Classes and methods<2>,,,Local copy of Sloane On-Line Encyclopedia of Integer Sequences
@anchor{sage/databases/sloane classes-and-methods}@anchor{6b}
@section Classes and methods


@geindex SloaneEncyclopediaClass (class in sage.databases.sloane)
@anchor{sage/databases/sloane sage databases sloane SloaneEncyclopediaClass}@anchor{6c}
@deffn {Class} sage.databases.sloane.SloaneEncyclopediaClass

A local copy of the Sloane Online Encyclopedia of Integer Sequences
that contains only the sequence numbers and the sequences
themselves.

@geindex find() (sage.databases.sloane.SloaneEncyclopediaClass method)
@anchor{sage/databases/sloane sage databases sloane SloaneEncyclopediaClass find}@anchor{6d}
@deffn {Method} find (seq, maxresults=30)

Return a list of all sequences which have seq as a subsequence, up
to maxresults results. Sequences are returned in the form (number,
list).

INPUT:


@itemize -

@item 
@code{seq} - list

@item 
@code{maxresults} - int
@end itemize

OUTPUT: list of 2-tuples (i, v), where v is a sequence with seq as
a subsequence.
@end deffn

@geindex install() (sage.databases.sloane.SloaneEncyclopediaClass method)
@anchor{sage/databases/sloane sage databases sloane SloaneEncyclopediaClass install}@anchor{6e}
@deffn {Method} install (oeis_url='http://oeis.org/stripped.gz', names_url='http://oeis.org/names.gz', overwrite=False)

Download and install the online encyclopedia, raising an IOError if
either step fails.

INPUT:


@itemize -

@item 
@code{oeis_url} - string (default: "@indicateurl{http://oeis.org}...")
The URL of the stripped.gz encyclopedia file.

@item 
@code{names_url} - string (default: "@indicateurl{http://oeis.org}...")
The URL of the names.gz encyclopedia file.  If you do not want to
download this file, set names_url=None.

@item 
@code{overwrite} - boolean (default: False) If the encyclopedia is
already installed and overwrite=True, download and install the latest
version over the installed one.
@end itemize
@end deffn

@geindex install_from_gz() (sage.databases.sloane.SloaneEncyclopediaClass method)
@anchor{sage/databases/sloane sage databases sloane SloaneEncyclopediaClass install_from_gz}@anchor{6f}
@deffn {Method} install_from_gz (stripped_file, names_file, overwrite=False)

Install the online encyclopedia from a local stripped.gz file.

INPUT:


@itemize -

@item 
@code{stripped_file} - string. The name of the stripped.gz OEIS file.

@item 
@code{names_file} - string.  The name of the names.gz OEIS file, or
None if the user does not want it installed.

@item 
@code{overwrite} - boolean (default: False) If the encyclopedia is
already installed and overwrite=True, install 'filename' over the
old encyclopedia.
@end itemize
@end deffn

@geindex load() (sage.databases.sloane.SloaneEncyclopediaClass method)
@anchor{sage/databases/sloane sage databases sloane SloaneEncyclopediaClass load}@anchor{70}
@deffn {Method} load ()

Load the entire encyclopedia into memory from a file. This is done
automatically if the user tries to perform a lookup or a search.
@end deffn

@geindex sequence_name() (sage.databases.sloane.SloaneEncyclopediaClass method)
@anchor{sage/databases/sloane sage databases sloane SloaneEncyclopediaClass sequence_name}@anchor{71}
@deffn {Method} sequence_name (N)

Return the name of sequence N in the encyclopedia. If sequence N
does not exist, return '@w{'}.  If the names database is not installed,
raise an IOError.

INPUT:


@itemize -

@item 
@code{N} - int
@end itemize

OUTPUT: string

EXAMPLES:

sage: SloaneEncyclopedia.sequence_name(1) # optional - sloane_database
'Number of groups of order n.'
@end deffn

@geindex unload() (sage.databases.sloane.SloaneEncyclopediaClass method)
@anchor{sage/databases/sloane sage databases sloane SloaneEncyclopediaClass unload}@anchor{72}
@deffn {Method} unload ()

Remove the database from memory.
@end deffn
@end deffn

@geindex copy_gz_file() (in module sage.databases.sloane)
@anchor{sage/databases/sloane sage databases sloane copy_gz_file}@anchor{73}
@deffn {Function} sage.databases.sloane.copy_gz_file (gz_source, bz_destination)

Decompress a gzipped file and install the bzipped verson.  This is
used by SloaneEncyclopedia.install_from_gz to install several
gzipped OEIS database files.

INPUT:


@itemize -

@item 
@code{gz_source} - string. The name of the gzipped file.

@item 
@code{bz_destination} - string.  The name of the newly compressed file.
@end itemize
@end deffn

@geindex parse_sequence() (in module sage.databases.sloane)
@anchor{sage/databases/sloane sage databases sloane parse_sequence}@anchor{74}
@deffn {Function} sage.databases.sloane.parse_sequence (text='@w{'})

This internal function was only used by the sloane_find function,
which is now deprecated.

TESTS:

@example
sage: from sage.databases.sloane import parse_sequence
sage: parse_sequence()
doctest:...: DeprecationWarning: The function parse_sequence is not used anymore (2012-01-01).
See http://trac.sagemath.org/10358 for details.
@end example
@end deffn

@geindex sloane_find() (in module sage.databases.sloane)
@anchor{sage/databases/sloane sage databases sloane sloane_find}@anchor{75}
@deffn {Function} sage.databases.sloane.sloane_find (list=[], nresults=30, verbose=True)

This function is broken. It is replaced by the
@ref{8,,OEIS} module.

Type @code{oeis?} for more information.

TESTS:

@example
sage: sloane_find([1,2,3])
doctest:...: DeprecationWarning: The function sloane_find is deprecated. Use oeis() instead (2012-01-01).
See http://trac.sagemath.org/10358 for details.
@end example
@end deffn

@geindex sloane_sequence() (in module sage.databases.sloane)
@anchor{sage/databases/sloane sage databases sloane sloane_sequence}@anchor{76}
@deffn {Function} sage.databases.sloane.sloane_sequence (number=1, verbose=True)

This function is broken. It is replaced by the
@ref{8,,OEIS} module.

Type @code{oeis?} for more information.

TESTS:

@example
sage: sloane_sequence(123)
doctest:...: DeprecationWarning: The function sloane_sequence is deprecated. Use oeis() instead (2012-01-01).
See http://trac.sagemath.org/10358 for details.
@end example
@end deffn

@c nodoctest

@node FindStat - the Combinatorial Statistic Finder,Frank Luebeck's tables of Conway polynomials over finite fields,Local copy of Sloane On-Line Encyclopedia of Integer Sequences,Top
@anchor{sage/databases/findstat sage-databases-findstat}@anchor{77}@anchor{sage/databases/findstat doc}@anchor{78}@anchor{sage/databases/findstat findstat-the-combinatorial-statistic-finder}@anchor{79}
@chapter FindStat - the Combinatorial Statistic Finder.


@c This file has been autogenerated.
@anchor{sage/databases/findstat module-sage databases findstat}@anchor{5}
@geindex sage.databases.findstat (module)

The FindStat database can be found at @indicateurl{http://www.findstat.org} .

Fix the following three notions:


@itemize -

@item 
A @emph{combinatorial collection} is a set @math{S} with interesting combinatorial properties,

@item 
a @emph{combinatorial map} is a combinatorially interesting map @math{f: S \to S'} between combinatorial collections, and

@item 
a @emph{combinatorial statistic} is a combinatorially interesting map @math{s: S \to \ZZ}.
@end itemize

You can use the sage interface to FindStat to:


@itemize -

@item 
identify a combinatorial statistic from the values on a few small objects,

@item 
obtain more terms, formulae, references, etc. for a given statistic,

@item 
edit statistics and submit new statistics.
@end itemize

To access the database, use @ref{7a,,findstat}:

@example
sage: findstat
The Combinatorial Statistic Finder (http://www.findstat.org/)
@end example

AUTHORS:


@itemize -

@item 
Martin Rubey (2015): initial version.
@end itemize

@menu
* A guided tour:: 
* Classes and methods: Classes and methods<3>. 

@end menu

@node A guided tour,Classes and methods<3>,,FindStat - the Combinatorial Statistic Finder
@anchor{sage/databases/findstat a-guided-tour}@anchor{7b}
@section A guided tour


@menu
* Retrieving information:: 
* Editing and submitting statistics:: 

@end menu

@node Retrieving information,Editing and submitting statistics,,A guided tour
@anchor{sage/databases/findstat retrieving-information}@anchor{7c}
@subsection Retrieving information


The most straightforward application of the FindStat interface is to
gather information about a combinatorial statistic.  To do this, we
supply @ref{7a,,findstat} with a list of @math{(object@comma{} value)}
pairs.  For example:

@example
sage: PM8 = PerfectMatchings(8)
sage: r = findstat([(m, m.number_of_nestings()) for m in PM8]); r           # optional -- internet,random
0: (St000041: The number of nestings of a perfect matching. , [], 105)
...
@end example

The result of this query is a list (presented as a
@ref{49,,sage.databases.oeis.FancyTuple}) of triples.  The first
element of each triple is a @ref{7d,,FindStatStatistic} @math{s: S \to \ZZ}, the second element a list of @ref{7e,,FindStatMap}'s @math{f_i: S_i \to S_@{i+1@}}, and the third element is an integer:

@example
sage: (s, list_f, quality) = r[0]                                           # optional -- internet
@end example

The precise meaning of the result is as follows:

@quotation

The composition @math{f_n \circ ... \circ f_2 \circ f_1} applied to
the objects sent to FindStat agrees with @math{quality} many @math{(object@comma{} value)} pairs of @math{s} in the database.  Moreover, there are no
other @math{(object@comma{} value)} pairs of @math{s} stored in the database,
i.e., there is no disagreement of values.
@end quotation

Put differently, if @math{quality} is not too small it is likely that the
statistic sent to FindStat equals @math{s \circ f_n \circ ... \circ f_2 \circ f_1}.

In the case at hand, the list of maps is empty and the integer
@math{quality} equals the number of @math{(object@comma{} value)} pairs passed to
FindStat.  This means, that the set of @math{(object@comma{} value)} pairs of the
statistic @math{s} as stored in the FindStat database is a superset of the
data sent.  We can now retrieve the description from the database:

@example
sage: print(s.description())                                         # optional -- internet,random
The number of nestings of a perfect matching.
<BLANKLINE>
<BLANKLINE>
This is the number of pairs of edges $((a,b), (c,d))$ such that $a\le c\le d\le b$. i.e., the edge $(c,d)$ is nested inside $(a,b)$.
@end example

and check the references:

@example
sage: s.references()                                                        # optional -- internet,random
0: [1] [[MathSciNet:1288802]]
1: [2] [[MathSciNet:1418763]]
@end example

If you prefer, you can look at this information also in your browser:

@example
sage: findstat(41).browse()                                                 # optional -- webbrowser
@end example

Another interesting possibility is to look for equidistributed
statistics.  Instead of submitting a list of pairs, we pass a pair of
lists:

@example
sage: r = findstat((PM8, [m.number_of_nestings() for m in PM8])); r         # optional -- internet,random
0: (St000041: The number of nestings of a perfect matching. , [], 105)
1: (St000042: The number of crossings of a perfect matching. , [], 105)
...
@end example

This results tells us that the database contains another entriy that is
equidistributed with the number of nestings on perfect matchings of
length @math{8}, namely the number of crossings.

Let us now look at a slightly more complicated example, where the
submitted statistic is the composition of a sequence of combinatorial
maps and a statistic known to FindStat.  We use the occasion to
advertise yet another way to pass values to FindStat:

@example
sage: r = findstat(Permutations(4), lambda pi: pi.saliances()[0]); r        # optional -- internet,random
0: (St000051: The size of the left subtree. , [Mp00069: complement, Mp00061: to increasing tree], 24)
...
sage: (s, list_f, quality) = r[0]                                           # optional -- internet
@end example

To obtain the value of the statistic sent to FindStat on a given
object, apply the maps in the list in the given order to this object,
and evaluate the statistic on the result.  For example, let us check
that the result given by FindStat agrees with our statistic on the
following permutation:

@example
sage: pi = Permutation([3,1,4,5,2]); pi.saliances()[0]
3
@end example

We first have to find out, what the maps and the statistic actually do:

@example
sage: print(s.description())                                            # optional -- internet,random
The size of the left subtree.

sage: print(s.code())                                                 # optional -- internet,random
def statistic(T):
    return T[0].node_number()

sage: print(list_f[0].code() + "\r\n" + list_f[1].code())               # optional -- internet,random
def complement(elt):
    n = len(elt)
    return elt.__class__(elt.parent(), map(lambda x: n - x + 1, elt) )
<BLANKLINE>
def increasing_tree_shape(elt, compare=min):
    return elt.increasing_tree(compare).shape()
@end example

So, the following should coincide with what we sent FindStat:

@example
sage: pi.complement().increasing_tree_shape()[0].node_number()
3
@end example

@node Editing and submitting statistics,,Retrieving information,A guided tour
@anchor{sage/databases/findstat editing-and-submitting-statistics}@anchor{7f}
@subsection Editing and submitting statistics


Of course, often a statistic will not be in the database:

@example
sage: findstat([(d, randint(1,1000)) for d in DyckWords(4)])                # optional -- internet
a new statistic on Cc0005: Dyck paths
@end example

In this case, and if the statistic might be "interesting", please
consider submitting it to the database using
@ref{80,,FindStatStatistic.submit()}.

Also, you may notice omissions, typos or even mistakes in the
description, the code and the references.  In this case, simply
replace the value by using @ref{81,,FindStatStatistic.set_description()},
@ref{82,,FindStatStatistic.set_code()} or
@ref{83,,FindStatStatistic.set_references()}, and then
@ref{80,,FindStatStatistic.submit()} your changes for review by the
FindStat team.

@node Classes and methods<3>,,A guided tour,FindStat - the Combinatorial Statistic Finder
@anchor{sage/databases/findstat classes-and-methods}@anchor{84}
@section Classes and methods


@geindex FindStat (class in sage.databases.findstat)
@anchor{sage/databases/findstat sage databases findstat FindStat}@anchor{7a}
@deffn {Class} sage.databases.findstat.FindStat

Bases: sage.structure.sage_object.SageObject@footnote{../../../../../../html/en/reference/structure/sage/structure/sage_object.html#sage.structure.sage_object.SageObject}

The Combinatorial Statistic Finder.

@ref{7a,,FindStat} is a class representing results of queries to
the FindStat database.  This class is also the entry point to
edit statistics and new submissions.  Use the shorthand
@ref{7a,,findstat} to call it.

INPUT:

One of the following:


@itemize -

@item 
an integer or a string representing a valid FindStat identifier
(e.g. 45 or 'St000045').  The keyword arguments @code{depth} and
@code{max_values} are ignored.

@item 
a list of pairs of the form (object, value), or a dictionary
from sage objects to integer values.  The keyword arguments
@code{depth} and @code{max_values} are passed to the finder.

@item 
a list of pairs of the form (list of objects, list of values),
or a single pair of the form (list of objects, list of values).
In each pair there should be as many objects as values.  The
keyword arguments @code{depth} and @code{max_values} are passed to
the finder.

@item 
a collection and a list of pairs of the form (string, value),
or a dictionary from strings to integer values.  The keyword
arguments @code{depth} and @code{max_values} are passed to the
finder.  This should only be used if the collection is not yet
supported.

@item 
a collection and a list of pairs of the form (list of strings,
list of values), or a single pair of the form (list of strings,
list of values).  In each pair there should be as many strings
as values.  The keyword arguments @code{depth} and @code{max_values}
are passed to the finder.  This should only be used if the
collection is not yet supported.

@item 
a collection and a callable.  The callable is used to generate
@code{max_values} (object, value) pairs.  The number of terms
generated may also be controlled by passing an iterable
collection, such as @code{Permutations(3)}.  The keyword arguments
@code{depth} and @code{max_values} are passed to the finder.
@end itemize

OUTPUT:

An instance of a @ref{7d,,FindStatStatistic}, represented by


@itemize -

@item 
the FindStat identifier together with its name, or

@item 
a list of triples, each consisting of

@quotation


@itemize -

@item 
the statistic

@item 
a list of strings naming certain maps

@item 
a number which says how many of the values submitted agree
with the values in the database, when applying the maps in
the given order to the object and then computing the
statistic on the result.
@end itemize
@end quotation
@end itemize

EXAMPLES:

A particular statistic can be retrieved by its St-identifier or
number:

@example
sage: findstat('St000041')                                              # optional -- internet,random
St000041: The number of nestings of a perfect matching.

sage: findstat(51)                                                      # optional -- internet,random
St000051: The size of the left subtree.
@end example

The database can be searched by providing a list of pairs:

@example
sage: q = findstat([(pi, pi.length()) for pi in Permutations(4)]); q    # optional -- internet,random
0: (St000018: The [[/Permutations/Inversions|number of inversions]] of a permutation., [], 24)
1: (St000004: The [[/Permutations/Descents-Major|major index]] of a permutation., [Mp00062: inversion-number to major-index bijection], 24)
...
@end example

or a dictionary:

@example
sage: p = findstat(@{pi: pi.length() for pi in Permutations(4)@}); p      # optional -- internet,random
0: (St000018: The [[/Permutations/Inversions|number of inversions]] of a permutation., [], 24)
1: (St000004: The [[/Permutations/Descents-Major|major index]] of a permutation., [Mp00062: inversion-number to major-index bijection], 24)
...
@end example

Note however, that the results of these two queries are not
necessarily the same, because we compare queries by the data
sent, and the ordering of the data might be different:

@example
sage: p == q                                                            # optional -- internet
False
@end example

Another possibility is to send a collection and a function.  In
this case, the function is applied to the first few objects of
the collection:

@example
sage: findstat("Permutations", lambda pi: pi.length())                  # optional -- internet,random
0: (St000018: The [[/Permutations/Inversions|number of inversions]] of a permutation., [], 200)
...
@end example

To search for a distribution, send a list of lists, or a single pair:

@example
sage: S4 = Permutations(4); findstat((S4, [pi.length() for pi in S4]))  # optional -- internet,random
0: (St000004: The [[/Permutations/Descents-Major|major index]] of a permutation., [], 24)
1: (St000018: The [[/Permutations/Inversions|number of inversions]] of a permutation., [], 24)
...
@end example

Note that there is a limit, @code{FINDSTAT_MAX_DEPTH}, on the number
of elements that may be submitted to FindStat, which is currently
200.  Therefore, the interface tries to truncate queries
appropriately, but this may be impossible, especially with
distribution searches:

@example
sage: S6 = Permutations(6); S6.cardinality()                            # optional -- internet
720
sage: findstat((S6, [1 for a in S6]))                                   # optional -- internet
Traceback (most recent call last):
...
ValueError: After discarding elements not in the range, too few (=0) values remained to send to FindStat.
@end example

@geindex browse() (sage.databases.findstat.FindStat method)
@anchor{sage/databases/findstat sage databases findstat FindStat browse}@anchor{85}
@deffn {Method} browse ()

Open the FindStat web page in a browser.

EXAMPLES:

@example
sage: findstat.browse()                                             # optional -- webbrowser
@end example
@end deffn

@geindex login() (sage.databases.findstat.FindStat method)
@anchor{sage/databases/findstat sage databases findstat FindStat login}@anchor{86}
@deffn {Method} login ()

Open the FindStat login page in a browser.

EXAMPLES:

@example
sage: findstat.login()                                              # optional -- webbrowser
@end example
@end deffn

@geindex set_user() (sage.databases.findstat.FindStat method)
@anchor{sage/databases/findstat sage databases findstat FindStat set_user}@anchor{87}
@deffn {Method} set_user (name=None, email=None)

Set the user for this session.

INPUT:


@itemize -

@item 
@code{name} -- the name of the user.

@item 
@code{email} -- an email address of the user.
@end itemize

This information is used when submitting a statistic with
@ref{80,,FindStatStatistic.submit()}.

EXAMPLES:

@example
sage: findstat.set_user(name="Anonymous", email="invalid@@org")
@end example

@cartouche
@quotation Note 
It is usually more convenient to login into the FindStat
web page using the @ref{86,,login()} method.
@end quotation
@end cartouche
@end deffn
@end deffn

@geindex FindStatCollection (class in sage.databases.findstat)
@anchor{sage/databases/findstat sage databases findstat FindStatCollection}@anchor{88}
@deffn {Class} sage.databases.findstat.FindStatCollection (parent, id, c, sageconstructor_overridden)

Bases: sage.structure.element.Element@footnote{../../../../../../html/en/reference/structure/sage/structure/element.html#sage.structure.element.Element}

A FindStat collection.

@ref{88,,FindStatCollection} is a class representing a
combinatorial collection available in the FindStat database.

Its main use is to allow easy specification of the combinatorial
collection when using @ref{7a,,findstat}.  It also
provides methods to quickly access its FindStat web page
(@ref{89,,browse()}), check whether a particular element is actually
in the range considered by FindStat (@ref{8a,,in_range()}), etc.

INPUT:

One of the following:


@itemize -

@item 
a string eg. 'Dyck paths' or 'DyckPaths', case-insensitive, or

@item 
an integer designating the FindStat id of the collection, or

@item 
a sage object belonging to a collection, or

@item 
an iterable producing a sage object belonging to a collection.
@end itemize

EXAMPLES:

@example
sage: from sage.databases.findstat import FindStatCollection
sage: FindStatCollection("Dyck paths")                                  # optional -- internet
Cc0005: Dyck paths

sage: FindStatCollection(5)                                             # optional -- internet
Cc0005: Dyck paths

sage: FindStatCollection(DyckWord([1,0,1,0]))                           # optional -- internet
Cc0005: Dyck paths

sage: FindStatCollection(DyckWords(2))                                  # optional -- internet
Cc0005: Dyck paths
@end example

SEEALSO:

@ref{8b,,FindStatCollections}

@geindex browse() (sage.databases.findstat.FindStatCollection method)
@anchor{sage/databases/findstat sage databases findstat FindStatCollection browse}@anchor{89}
@deffn {Method} browse ()

Open the FindStat web page of the collection in a browser.

EXAMPLES:

@example
sage: from sage.databases.findstat import FindStatCollection
sage: FindStatCollection("Permutations").browse()                   # optional -- webbrowser
@end example
@end deffn

@geindex first_terms() (sage.databases.findstat.FindStatCollection method)
@anchor{sage/databases/findstat sage databases findstat FindStatCollection first_terms}@anchor{8c}
@deffn {Method} first_terms (statistic, max_values=1200)

Compute the first few terms of the given statistic.

INPUT:


@itemize -

@item 
@code{statistic} -- a callable.

@item 
@code{max_values} -- the number of terms to compute at most.
@end itemize

OUTPUT:

A list of pairs of the form (object, value).

EXAMPLES:

@example
sage: from sage.databases.findstat import FindStatCollection
sage: c = FindStatCollection("GelfandTsetlinPatterns")              # optional -- internet
sage: c.first_terms(lambda x: 1, max_values=10)                     # optional -- internet,random
[([[0]], 1),
 ([[1]], 1),
 ([[2]], 1),
 ([[3]], 1),
 ([[0, 0], [0]], 1),
 ([[1, 0], [0]], 1),
 ([[1, 0], [1]], 1),
 ([[1, 1], [1]], 1),
 ([[2, 0], [0]], 1),
 ([[2, 0], [1]], 1)]
@end example
@end deffn

@geindex from_string() (sage.databases.findstat.FindStatCollection method)
@anchor{sage/databases/findstat sage databases findstat FindStatCollection from_string}@anchor{8d}
@deffn {Method} from_string ()

Return a function that returns the object given the FindStat
normal representation.

OUTPUT:

The function that produces the sage object given its FindStat
normal representation as a string.

EXAMPLES:

@example
sage: from sage.databases.findstat import FindStatCollection
sage: c = FindStatCollection("Posets")                              # optional -- internet
sage: p = c.from_string()('([(0, 2), (2, 1)], 3)')                  # optional -- internet
sage: p.cover_relations()                                           # optional -- internet
[[0, 2], [2, 1]]

sage: c = FindStatCollection("Binary Words")                        # optional -- internet
sage: w = c.from_string()('010101')                                 # optional -- internet
sage: w in c._sageconstructor(6)                                    # optional -- internet
True
@end example
@end deffn

@geindex id() (sage.databases.findstat.FindStatCollection method)
@anchor{sage/databases/findstat sage databases findstat FindStatCollection id}@anchor{8e}
@deffn {Method} id ()

Return the FindStat identifier of the collection.

OUTPUT:

The FindStat identifier of the collection as an integer.

EXAMPLES:

@example
sage: from sage.databases.findstat import FindStatCollection
sage: c = FindStatCollection("GelfandTsetlinPatterns")              # optional -- internet
sage: c.id()                                                        # optional -- internet
18
@end example
@end deffn

@geindex id_str() (sage.databases.findstat.FindStatCollection method)
@anchor{sage/databases/findstat sage databases findstat FindStatCollection id_str}@anchor{8f}
@deffn {Method} id_str ()

Return the FindStat identifier of the collection.

OUTPUT:

The FindStat identifier of the collection as a string.

EXAMPLES:

@example
sage: from sage.databases.findstat import FindStatCollection
sage: c = FindStatCollection("GelfandTsetlinPatterns")              # optional -- internet
sage: c.id_str()                                                    # optional -- internet
'Cc0018'
@end example
@end deffn

@geindex in_range() (sage.databases.findstat.FindStatCollection method)
@anchor{sage/databases/findstat sage databases findstat FindStatCollection in_range}@anchor{8a}
@deffn {Method} in_range (element)

Check whether an element of the collection is in FindStat's precomputed range.

INPUT:


@itemize -

@item 
@code{element} -- a sage object that belongs to the collection.
@end itemize

OUTPUT:

@code{True}, if @code{element} is used by the FindStat search
engine, and @code{False} if it is ignored.

EXAMPLES:

@example
sage: from sage.databases.findstat import FindStatCollection
sage: c = FindStatCollection("GelfandTsetlinPatterns")              # optional -- internet
sage: c.in_range(GelfandTsetlinPattern([[2, 1], [1]]))              # optional -- internet
True
sage: c.in_range(GelfandTsetlinPattern([[3, 1], [1]]))              # optional -- internet
True
sage: c.in_range(GelfandTsetlinPattern([[4, 1], [1]]))              # optional -- internet,random
False
@end example

TESTS:

@example
sage: from sage.databases.findstat import FindStatCollections
sage: l = FindStatCollections()                                     # optional -- internet
sage: long = [9, 12, 14, 20]
sage: for c in l:                                                   # optional -- internet, random
....:     if c.id() not in long and c.is_supported():
....:         f = c.first_terms(lambda x: 1, max_values=10000)
....:         print("@{@} @{@} @{@}".format(c, len(f), all(c.in_range(e) for e, _ in f)))
....:
Cc0001: Permutations 10000 True
Cc0002: Integer partitions 270 True
Cc0005: Dyck paths 2054 True
Cc0006: Integer compositions 510 True
Cc0007: Standard tableaux 3734 True
Cc0010: Binary trees 2054 True
Cc0013: Cores 100 True
Cc0017: Alternating sign matrices 7916 True
Cc0018: Gelfand-Tsetlin patterns 934 True
Cc0019: Semistandard tableaux 10000 True
Cc0021: Ordered trees 2055 True
Cc0022: Finite Cartan types 31 True
Cc0023: Parking functions 10000 True
@end example
@end deffn

@geindex is_supported() (sage.databases.findstat.FindStatCollection method)
@anchor{sage/databases/findstat sage databases findstat FindStatCollection is_supported}@anchor{90}
@deffn {Method} is_supported ()

Check whether the collection is fully supported by the interface.

EXAMPLES:

@example
sage: from sage.databases.findstat import FindStatCollection
sage: FindStatCollection(1).is_supported()                          # optional -- internet
True

sage: FindStatCollection(24).is_supported()                         # optional -- internet, random
False
@end example
@end deffn

@geindex name() (sage.databases.findstat.FindStatCollection method)
@anchor{sage/databases/findstat sage databases findstat FindStatCollection name}@anchor{91}
@deffn {Method} name (style='singular')

Return the name of the FindStat collection.

INPUT:


@itemize -

@item 
a string -- (default:"singular") can be
"singular", or "plural".
@end itemize

OUTPUT:

The name of the FindStat collection, in singular or in plural.

EXAMPLES:

@example
sage: from sage.databases.findstat import FindStatCollection
sage: FindStatCollection("Binary trees").name()                     # optional -- internet
u'Binary tree'

sage: FindStatCollection("Binary trees").name(style="plural")       # optional -- internet
u'Binary trees'
@end example
@end deffn

@geindex to_string() (sage.databases.findstat.FindStatCollection method)
@anchor{sage/databases/findstat sage databases findstat FindStatCollection to_string}@anchor{92}
@deffn {Method} to_string ()

Return a function that returns the FindStat normal
representation given an object.

OUTPUT:

The function that produces the string representation as
needed by the FindStat search webpage.

EXAMPLES:

@example
sage: from sage.databases.findstat import FindStatCollection
sage: p = Poset((range(3), [[0, 1], [1, 2]]))                       # optional -- internet
sage: c = FindStatCollection("Posets")                              # optional -- internet
sage: c.to_string()(p)                                              # optional -- internet
'([(0, 2), (2, 1)], 3)'
@end example
@end deffn
@end deffn

@geindex FindStatCollections (class in sage.databases.findstat)
@anchor{sage/databases/findstat sage databases findstat FindStatCollections}@anchor{8b}
@deffn {Class} sage.databases.findstat.FindStatCollections

Bases: sage.structure.parent.Parent@footnote{../../../../../../html/en/reference/structure/sage/structure/parent.html#sage.structure.parent.Parent}, sage.structure.unique_representation.UniqueRepresentation@footnote{../../../../../../html/en/reference/structure/sage/structure/unique_representation.html#sage.structure.unique_representation.UniqueRepresentation}

The class of FindStat collections.

The elements of this class are combinatorial collections in
FindStat as of August 2015.  If a new collection was added to the
web service since then, the dictionary @code{_findstat_collections}
in this class has to be updated accordingly.

EXAMPLES:

@example
sage: from sage.databases.findstat import FindStatCollections
sage: sorted(c for c in FindStatCollections())                          # optional -- internet, random
[Cc0001: Permutations,
 Cc0002: Integer partitions,
 Cc0005: Dyck paths,
 Cc0006: Integer compositions,
 Cc0007: Standard tableaux,
 Cc0009: Set partitions,
 Cc0010: Binary trees,
 Cc0012: Perfect matchings,
 Cc0013: Cores,
 Cc0014: Posets,
 Cc0017: Alternating sign matrices,
 Cc0018: Gelfand-Tsetlin patterns,
 Cc0019: Semistandard tableaux,
 Cc0020: Graphs,
 Cc0021: Ordered trees,
 Cc0022: Finite Cartan types,
 Cc0023: Parking functions]
@end example

@geindex Element (sage.databases.findstat.FindStatCollections attribute)
@anchor{sage/databases/findstat sage databases findstat FindStatCollections Element}@anchor{93}
@deffn {Attribute} Element

alias of @ref{88,,FindStatCollection}
@end deffn
@end deffn

@geindex FindStatMap (class in sage.databases.findstat)
@anchor{sage/databases/findstat sage databases findstat FindStatMap}@anchor{7e}
@deffn {Class} sage.databases.findstat.FindStatMap (parent, entry)

Bases: sage.structure.element.Element@footnote{../../../../../../html/en/reference/structure/sage/structure/element.html#sage.structure.element.Element}

A FindStat map.

@ref{7e,,FindStatMap} is a class representing a combinatorial
map available in the FindStat database.

The result of a @ref{7a,,findstat} query contains a
(possibly empty) list of such maps.  This class provides methods
to inspect various properties of these maps, in particular
@ref{94,,code()}.

INPUT:


@itemize -

@item 
a string containing the FindStat name of the map, or an integer
representing its FindStat id.
@end itemize

EXAMPLES:

@example
sage: from sage.databases.findstat import FindStatMap
sage: FindStatMap(71)                                                   # optional -- internet
Mp00071: descent composition
sage: FindStatMap("descent composition")                                # optional -- internet
Mp00071: descent composition
@end example

SEEALSO:

@ref{95,,FindStatMaps}

@geindex code() (sage.databases.findstat.FindStatMap method)
@anchor{sage/databases/findstat sage databases findstat FindStatMap code}@anchor{94}
@deffn {Method} code ()

Return the code associated with the map.

OUTPUT:

A string.

EXAMPLES:

@example
sage: from sage.databases.findstat import FindStatMap               # optional -- internet
sage: print(FindStatMap(71).code())                              # optional -- internet
def descents_composition(elt):
    if len(elt) == 0:
        return Composition([])
    d = [-1] + elt.descents() + [len(elt)-1]
    return Composition([ d[i+1]-d[i] for i in range(len(d)-1)])
@end example
@end deffn

@geindex code_name() (sage.databases.findstat.FindStatMap method)
@anchor{sage/databases/findstat sage databases findstat FindStatMap code_name}@anchor{96}
@deffn {Method} code_name ()

Return the name of the function defined by @ref{94,,code()}.

OUTPUT:

A string.

EXAMPLES:

@example
sage: from sage.databases.findstat import FindStatMap               # optional -- internet
sage: print(FindStatMap(71).code_name())                      # optional -- internet
descents_composition
@end example
@end deffn

@geindex codomain() (sage.databases.findstat.FindStatMap method)
@anchor{sage/databases/findstat sage databases findstat FindStatMap codomain}@anchor{97}
@deffn {Method} codomain ()

Return the FindStat collection which is the codomain of the map.

OUTPUT:

The codomain of the map as a @ref{88,,FindStatCollection}.

EXAMPLES:

@example
sage: from sage.databases.findstat import FindStatMap               # optional -- internet
sage: FindStatMap(71).codomain()                                    # optional -- internet
Cc0006: Integer compositions
@end example
@end deffn

@geindex description() (sage.databases.findstat.FindStatMap method)
@anchor{sage/databases/findstat sage databases findstat FindStatMap description}@anchor{98}
@deffn {Method} description ()

Return the FindStat description of the map.

OUTPUT:

The description as a string.

EXAMPLES:

@example
sage: m = findstat("Permutations", lambda pi: pi.length())[1][1][0] # optional -- internet
sage: print(m.description())                                    # optional -- internet,random
Let $\sigma \in \mathcal@{S@}_n$ be a permutation.
<BLANKLINE>
Maps $\sigma$ to the permutation $\tau$ such that the major code of $\tau$ is given by the Lehmer code of $\sigma$.
<BLANKLINE>
In particular, the number of inversions of $\sigma$ equals the major index of $\tau$.
<BLANKLINE>
EXAMPLES:
<BLANKLINE>
$[3,4,1,2] \mapsto [3,1,4,2]$
@end example
@end deffn

@geindex domain() (sage.databases.findstat.FindStatMap method)
@anchor{sage/databases/findstat sage databases findstat FindStatMap domain}@anchor{99}
@deffn {Method} domain ()

Return the FindStat collection which is the domain of the map.

OUTPUT:

The domain of the map as a @ref{88,,FindStatCollection}.

EXAMPLES:

@example
sage: from sage.databases.findstat import FindStatMap               # optional -- internet
sage: FindStatMap(71).domain()                                      # optional -- internet
Cc0001: Permutations
@end example
@end deffn

@geindex id() (sage.databases.findstat.FindStatMap method)
@anchor{sage/databases/findstat sage databases findstat FindStatMap id}@anchor{9a}
@deffn {Method} id ()

Return the FindStat identifier of the map.

OUTPUT:

The FindStat identifier of the map as an integer.

EXAMPLES:

@example
sage: m = findstat("Permutations", lambda pi: pi.length())[1][1][0] # optional -- internet
sage: m.id()                                                        # optional -- internet
62
@end example
@end deffn

@geindex id_str() (sage.databases.findstat.FindStatMap method)
@anchor{sage/databases/findstat sage databases findstat FindStatMap id_str}@anchor{9b}
@deffn {Method} id_str ()

Return the FindStat identifier of the map.

OUTPUT:

The FindStat identifier of the map as a string.

EXAMPLES:

@example
sage: m = findstat("Permutations", lambda pi: pi.length())[1][1][0] # optional -- internet
sage: m.id_str()                                                    # optional -- internet
'Mp00062'
@end example
@end deffn

@geindex name() (sage.databases.findstat.FindStatMap method)
@anchor{sage/databases/findstat sage databases findstat FindStatMap name}@anchor{9c}
@deffn {Method} name ()

Return the FindStat name of the map.

OUTPUT:

The name of the map as a string, as used by FindStat.

EXAMPLES:

@example
sage: m = findstat("Permutations", lambda pi: pi.length())[1][1][0] # optional -- internet
sage: m.name()                                                      # optional -- internet
u'inversion-number to major-index bijection'
@end example
@end deffn
@end deffn

@geindex FindStatMaps (class in sage.databases.findstat)
@anchor{sage/databases/findstat sage databases findstat FindStatMaps}@anchor{95}
@deffn {Class} sage.databases.findstat.FindStatMaps

Bases: sage.structure.parent.Parent@footnote{../../../../../../html/en/reference/structure/sage/structure/parent.html#sage.structure.parent.Parent}, sage.structure.unique_representation.UniqueRepresentation@footnote{../../../../../../html/en/reference/structure/sage/structure/unique_representation.html#sage.structure.unique_representation.UniqueRepresentation}

The class of FindStat maps.

The elements of this class are combinatorial maps currently in
FindStat.

EXAMPLES:

We can print a nice list of maps currently in FindStat, sorted by
domain and codomain:

@example
sage: from sage.databases.findstat import FindStatMap, FindStatMaps
sage: for m in sorted(FindStatMaps(), key=lambda m: (m.domain(), m.codomain)):    # optional -- internet,random
....:     print(m.domain().name().ljust(30)+" "+m.codomain().name().ljust(30)+" "+m.name())
Permutation                    Standard tableau               Robinson-Schensted insertion tableau
Permutation                    Integer partition              Robinson-Schensted tableau shape
Permutation                    Binary tree                    to increasing tree
...
@end example

@geindex Element (sage.databases.findstat.FindStatMaps attribute)
@anchor{sage/databases/findstat sage databases findstat FindStatMaps Element}@anchor{9d}
@deffn {Attribute} Element

alias of @ref{7e,,FindStatMap}
@end deffn
@end deffn

@geindex FindStatStatistic (class in sage.databases.findstat)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic}@anchor{7d}
@deffn {Class} sage.databases.findstat.FindStatStatistic (id, first_terms=None, data=None, function=None, code='@w{'}, collection=None, depth=None)

Bases: sage.structure.sage_object.SageObject@footnote{../../../../../../html/en/reference/structure/sage/structure/sage_object.html#sage.structure.sage_object.SageObject}

The class of FindStat statistics.

Do not instantiate this class directly.  Instead, use
@ref{7a,,findstat}.

@geindex browse() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic browse}@anchor{9e}
@deffn {Method} browse ()

Open the FindStat web page of the statistic in a browser.

EXAMPLES:

@example
sage: findstat(41).browse()                                         # optional -- webbrowser
@end example
@end deffn

@geindex code() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic code}@anchor{9f}
@deffn {Method} code ()

Return the code associated with the statistic.

OUTPUT:

A string.  Contributors are encouraged to submit sage code in the form:

@example
def statistic(x):
    ...
@end example

but the string may also contain code for other computer
algebra systems.

EXAMPLES:

@example
sage: print(findstat(1).code())                                   # optional -- internet,random
def statistic(x):
    return len(x.reduced_words())

sage: print(findstat(118).code())                                 # optional -- internet,random
(* in Mathematica *)
tree = @{@{@{@{@}, @{@}@}, @{@{@}, @{@}@}@}, @{@{@{@}, @{@}@}, @{@{@}, @{@}@}@}@};
Count[tree, @{@{___@}, @{@{___@}, @{@{___@}, @{___@}@}@}@}, @{0, Infinity@}]
@end example
@end deffn

@geindex collection() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic collection}@anchor{a0}
@deffn {Method} collection ()

Return the FindStat collection of the statistic.

OUTPUT:

The FindStat collection of the statistic as an instance of
@ref{88,,FindStatCollection}.

EXAMPLES:

@example
sage: findstat(1).collection()                                      # optional -- internet
Cc0001: Permutations
@end example
@end deffn

@geindex data() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic data}@anchor{a1}
@deffn {Method} data ()

Return the data used for querying the FindStat database.

OUTPUT:

The data provided by the user to query the FindStat database.
When the database was searched using an identifier, @code{data}
is @code{None}.

EXAMPLES:

@example
sage: S4 = Permutations(4); findstat((S4, [pi.length() for pi in S4])).data() # optional -- internet
[(Standard permutations of 4,
  ['[1, 2, 3, 4]',
   '[1, 2, 4, 3]',
   '[1, 3, 2, 4]',
   '[1, 3, 4, 2]',
   '[1, 4, 2, 3]',
   '[1, 4, 3, 2]',
   '[2, 1, 3, 4]',
   '[2, 1, 4, 3]',
   '[2, 3, 1, 4]',
   '[2, 3, 4, 1]',
   '[2, 4, 1, 3]',
   '[2, 4, 3, 1]',
   '[3, 1, 2, 4]',
   '[3, 1, 4, 2]',
   '[3, 2, 1, 4]',
   '[3, 2, 4, 1]',
   '[3, 4, 1, 2]',
   '[3, 4, 2, 1]',
   '[4, 1, 2, 3]',
   '[4, 1, 3, 2]',
   '[4, 2, 1, 3]',
   '[4, 2, 3, 1]',
   '[4, 3, 1, 2]',
   '[4, 3, 2, 1]'],
  [0, 1, 1, 2, 2, 3, 1, 2, 2, 3, 3, 4, 2, 3, 3, 4, 4, 5, 3, 4, 4, 5, 5, 6])]
@end example
@end deffn

@geindex description() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic description}@anchor{a2}
@deffn {Method} description ()

Return the description of the statistic.

OUTPUT:

A string, whose first line is used as the name of the
statistic.

EXAMPLES:

@example
sage: print(findstat(1).description())    # optional -- internet,random
The number of ways to write a permutation as a minimal length product of simple transpositions.
<BLANKLINE>
That is, the number of reduced words for the permutation.  E.g., there are two reduced words for $[3,2,1] = (1,2)(2,3)(1,2) = (2,3)(1,2)(2,3)$.
@end example
@end deffn

@geindex edit() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic edit}@anchor{a3}
@deffn {Method} edit (max_values=1200)

Open the FindStat web page for editing the statistic in a browser.

INPUT:


@itemize -

@item 
@code{max_values} -- integer (default:
@code{FINDSTAT_MAX_SUBMISSION_VALUES}); if @ref{a4,,function()} is
defined and the statistic is a new statistic, use
@ref{8c,,FindStatCollection.first_terms()} to produce at most
@code{max_values} terms.
@end itemize

OUTPUT:


@itemize -

@item 
Raise an error if the query has a match with no
intermediate combinatorial maps.
@end itemize

EXAMPLES:

@example
sage: s = findstat(DyckWords(4), lambda x: randint(1,1000)); s      # optional -- internet
a new statistic on Cc0005: Dyck paths
@end example

The following uses @code{lambda x: randint(1,1000)} to produce
14 terms, because @code{min(DyckWords(4).cardinality(),
FINDSTAT_MAX_SUBMISSION_VALUES)} is 14:

@example
sage: s.submit()                                                    # optional -- webbrowser
@end example
@end deffn

@geindex first_terms() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic first_terms}@anchor{a5}
@deffn {Method} first_terms ()

Return the first terms of the statistic.

OUTPUT:

A list of pairs of the form @code{(object, value)} where
@code{object} is a sage object representing an element of the
appropriate collection and @code{value} is an integer.  If the
statistic is in the FindStat database, the list contains
exactly the pairs in the database.

EXAMPLES:

@example
sage: findstat(1).first_terms()                                     # optional -- internet,random
[([1], 1),
 ([1, 2], 1),
 ([2, 1], 1),
 ([1, 2, 3], 1),
 ([1, 3, 2], 1),
 ([2, 1, 3], 1),
 ...
@end example

TESTS:

@example
sage: r = findstat(@{d: randint(1,1000) for d in DyckWords(4)@}); r   # optional -- internet
a new statistic on Cc0005: Dyck paths

sage: isinstance(r.first_terms(), list)                             # optional -- internet
True
sage: all(isinstance(e, tuple) and len(e)==2 and isinstance(e[1], (ZZ, Integer, int)) for e in r.first_terms())      # optional -- internet
True
@end example
@end deffn

@geindex first_terms_str() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic first_terms_str}@anchor{a6}
@deffn {Method} first_terms_str ()

Return the first terms of the statistic in the format needed
for a FindStat query.

OUTPUT:

A string, where each line is of the form @code{object => value},
where @code{object} is the string representation of an element
of the appropriate collection as used by FindStat and value
is an integer.

EXAMPLES:

@example
sage: findstat(1).first_terms_str()[:10]                            # optional -- internet,random
'[1] => 1\r\n'
@end example
@end deffn

@geindex function() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic function}@anchor{a4}
@deffn {Method} function ()

Return the function used to compute the values of the statistic.

OUTPUT:

The function used to compute the values of the statistic, or
@code{None}.

EXAMPLES:

@example
sage: findstat("Permutations", lambda pi: pi.length()).function()   # optional -- internet
...
<function <lambda> at ...>
@end example
@end deffn

@geindex generating_functions() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic generating_functions}@anchor{a7}
@deffn {Method} generating_functions (style='polynomial')

Return the generating functions of @code{self} in a dictionary.

The keys of this dictionary are the levels for which the
generating function of @code{self} can be computed from the data
of this statistic, and each value represents a generating
function for one level, as a polynomial, as a dictionary, or as
a list of coefficients.

INPUT:


@itemize -

@item 
a string -- (default:"polynomial") can be
"polynomial", "dictionary", or "list".
@end itemize

OUTPUT:


@itemize -

@item 
if @code{style} is @code{"polynomial"}, the generating function is
returned as a polynomial.

@item 
if @code{style} is @code{"dictionary"}, the generating function is
returned as a dictionary representing the monomials of the
generating function.

@item 
if @code{style} is @code{"list"}, the generating function is
returned as a list of coefficients of the generating function.
@end itemize

EXAMPLES:

@example
sage: st = findstat(18)                                             # optional -- internet

sage: st.generating_functions()                                     # optional -- internet,random
@{2: q + 1,
 3: q^3 + 2*q^2 + 2*q + 1,
 4: q^6 + 3*q^5 + 5*q^4 + 6*q^3 + 5*q^2 + 3*q + 1,
 5: q^10 + 4*q^9 + 9*q^8 + 15*q^7 + 20*q^6 + 22*q^5 + 20*q^4 + 15*q^3 + 9*q^2 + 4*q + 1,
 6: q^15 + 5*q^14 + 14*q^13 + 29*q^12 + 49*q^11 + 71*q^10 + 90*q^9 + 101*q^8 + 101*q^7 + 90*q^6 + 71*q^5 + 49*q^4 + 29*q^3 + 14*q^2 + 5*q + 1@}

sage: st.generating_functions(style="dictionary")                   # optional -- internet,random
@{2: @{0: 1, 1: 1@},
 3: @{0: 1, 1: 2, 2: 2, 3: 1@},
 4: @{0: 1, 1: 3, 2: 5, 3: 6, 4: 5, 5: 3, 6: 1@},
 5: @{0: 1, 1: 4, 2: 9, 3: 15, 4: 20, 5: 22, 6: 20, 7: 15, 8: 9, 9: 4, 10: 1@},
 6: @{0: 1,
  1: 5,
  2: 14,
  3: 29,
  4: 49,
  5: 71,
  6: 90,
  7: 101,
  8: 101,
  9: 90,
  10: 71,
  11: 49,
  12: 29,
  13: 14,
  14: 5,
  15: 1@}@}

sage: st.generating_functions(style="list")                         # optional -- internet,random
@{2: [1, 1],
 3: [1, 2, 2, 1],
 4: [1, 3, 5, 6, 5, 3, 1],
 5: [1, 4, 9, 15, 20, 22, 20, 15, 9, 4, 1],
 6: [1, 5, 14, 29, 49, 71, 90, 101, 101, 90, 71, 49, 29, 14, 5, 1]@}
@end example
@end deffn

@geindex id() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic id}@anchor{a8}
@deffn {Method} id ()

Return the FindStat identifier of the statistic.

OUTPUT:

The FindStat identifier of the statistic (or 0), as an integer.

EXAMPLES:

@example
sage: findstat(1).id()                                              # optional -- internet
1
@end example
@end deffn

@geindex id_str() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic id_str}@anchor{a9}
@deffn {Method} id_str ()

Return the FindStat identifier of the statistic.

OUTPUT:

The FindStat identifier of the statistic (or 'St000000'), as a string.

EXAMPLES:

@example
sage: findstat(1).id_str()                                          # optional -- internet
'St000001'
@end example
@end deffn

@geindex modified() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic modified}@anchor{aa}
@deffn {Method} modified ()

Return whether the statistic was modified.

OUTPUT:

True, if the statistic was modified using
@ref{81,,set_description()}, @ref{82,,set_code()},
@ref{83,,set_references()}, etc.  False otherwise.

EXAMPLES:

@example
sage: findstat(41).set_description("")                              # optional -- internet
sage: findstat(41).modified()                                       # optional -- internet
True
@end example
@end deffn

@geindex name() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic name}@anchor{ab}
@deffn {Method} name ()

Return the name of the statistic.

OUTPUT:

A string, which is just the first line of the description of
the statistic.

EXAMPLES:

@example
sage: findstat(1).name()                                            # optional -- internet,random
u'The number of ways to write a permutation as a minimal length product of simple transpositions.'
@end example
@end deffn

@geindex oeis_search() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic oeis_search}@anchor{ac}
@deffn {Method} oeis_search (search_size=32, verbose=True)

Search the OEIS for the generating function of the statistic.

INPUT:


@itemize -

@item 
@code{search_size} (default:32) the number of integers in the
sequence. If too big, the OEIS result is corrupted.

@item 
@code{verbose} (default:True) if true, some information about
the search are printed.
@end itemize

OUTPUT:


@itemize -

@item 
a tuple of OEIS sequences, see
@ref{4c,,sage.databases.oeis.OEIS.find_by_description()} for more
information.
@end itemize

EXAMPLES:

@example
sage: st = findstat(18)                                             # optional -- internet

sage: st.oeis_search()                                              # optional -- internet,random
Searching the OEIS for "1,1  1,2,2,1  1,3,5,6,5,3,1  1,4,9,15,20,22,20,15,9,4,1  1,5,14,29,49,71,90,101"

0: A008302: Triangle of Mahonian numbers T(n,k): coefficients in expansion of Product_@{i=0..n-1@} (1 + x + ... + x^i), where k ranges from 0 to A000217(n-1).

sage: st.oeis_search(search_size=13)                                # optional -- internet,random
Searching the OEIS for "1,1  1,2,2,1  1,3,5,6,5,3,1"

0: A008302: Triangle of Mahonian numbers T(n,k): coefficients in expansion of Product_@{i=0..n-1@} (1 + x + ... + x^i), where k ranges from 0 to A000217(n-1).
1: A115570: Array read by rows: row n (n>= 1) gives the Betti numbers for the n-th element of the Weyl group of type A3 (in Goresky's standard ordering).
2: A187447: Array for all multiset choices (multiset repetition class representatives in Abramowitz-Stegun order).
@end example
@end deffn

@geindex references() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic references}@anchor{ad}
@deffn {Method} references ()

Return the references associated with the statistic.

OUTPUT:

An instance of @ref{49,,sage.databases.oeis.FancyTuple}, each
item corresponds to a reference.

@cartouche
@quotation Todo 
Since the references in the database are sometimes not
formatted properly, this method is unreliable.  The
string representation can be obtained via
@code{_references}.
@end quotation
@end cartouche

EXAMPLES:

@example
sage: findstat(1).references()                                      # optional -- internet,random
0: P. Edelman and C. Greene, Balanced tableaux, Adv. in Math., 63 (1987), pp. 42-99.
1: [[OEIS:A005118]]
2: [[oeis:A246865]]
@end example
@end deffn

@geindex set_code() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic set_code}@anchor{82}
@deffn {Method} set_code (value)

Set the code associated with the statistic.

INPUT:


@itemize -

@item 
a string -- contributors are encouraged to submit sage code
in the form:

@example
def statistic(x):
    ...
@end example
@end itemize

OUTPUT:


@itemize -

@item 
Raise an error if the query has a match with no
intermediate combinatorial maps.
@end itemize

This information is used when submitting the statistic with
@ref{80,,submit()}.

EXAMPLES:

@example
sage: s = findstat([(d, randint(1,1000)) for d in DyckWords(4)])    # optional -- internet
sage: s.set_code("def statistic(x):\r\n    return randint(1,1000)") # optional -- internet
sage: print(s.code())                 # optional -- internet
def statistic(x):
    return randint(1,1000)
@end example
@end deffn

@geindex set_description() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic set_description}@anchor{81}
@deffn {Method} set_description (value)

Set the description of the statistic.

INPUT:


@itemize -

@item 
a string -- the name of the statistic followed by its
description on a separate line.
@end itemize

OUTPUT:


@itemize -

@item 
Raise an error, if the query has a match with no
intermediate combinatorial maps.
@end itemize

This information is used when submitting the statistic with
@ref{80,,submit()}.

EXAMPLES:

@example
sage: s = findstat([(d, randint(1,1000)) for d in DyckWords(4)]); s # optional -- internet
a new statistic on Cc0005: Dyck paths
sage: s.set_description("Random values on Dyck paths.\r\nNot for submission.") # optional -- internet
sage: s                                                             # optional -- internet
a new statistic on Cc0005: Dyck paths
sage: s.name()                                                      # optional -- internet
'Random values on Dyck paths.'
sage: print(s.description())                              # optional -- internet
Random values on Dyck paths.
Not for submission.
@end example
@end deffn

@geindex set_references() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic set_references}@anchor{83}
@deffn {Method} set_references (value)

Set the references associated with the statistic.

INPUT:


@itemize -

@item 
a string -- the individual references should be separated
by FINDSTAT_SEPARATOR_REFERENCES, which is "\r\n".
@end itemize

OUTPUT:


@itemize -

@item 
Raise an error, if the query has a match with no
intermediate combinatorial maps.
@end itemize

This information is used when submitting the statistic with
@ref{80,,submit()}.

EXAMPLES:

@example
sage: s = findstat([(d, randint(1,1000)) for d in DyckWords(4)]); s # optional -- internet
a new statistic on Cc0005: Dyck paths
sage: s.set_references("[1] The wonders of random Dyck paths, Anonymous Coward, [[arXiv:1102.4226]].\r\n[2] [[oeis:A000001]]")  # optional -- internet
sage: s.references()                                                # optional -- internet
0: [1] The wonders of random Dyck paths, Anonymous Coward, [[arXiv:1102.4226]].
1: [2] [[oeis:A000001]]
@end example
@end deffn

@geindex submit() (sage.databases.findstat.FindStatStatistic method)
@anchor{sage/databases/findstat sage databases findstat FindStatStatistic submit}@anchor{80}
@deffn {Method} submit (max_values=1200)

Open the FindStat web page for editing the statistic in a browser.

INPUT:


@itemize -

@item 
@code{max_values} -- integer (default:
@code{FINDSTAT_MAX_SUBMISSION_VALUES}); if @ref{a4,,function()} is
defined and the statistic is a new statistic, use
@ref{8c,,FindStatCollection.first_terms()} to produce at most
@code{max_values} terms.
@end itemize

OUTPUT:


@itemize -

@item 
Raise an error if the query has a match with no
intermediate combinatorial maps.
@end itemize

EXAMPLES:

@example
sage: s = findstat(DyckWords(4), lambda x: randint(1,1000)); s      # optional -- internet
a new statistic on Cc0005: Dyck paths
@end example

The following uses @code{lambda x: randint(1,1000)} to produce
14 terms, because @code{min(DyckWords(4).cardinality(),
FINDSTAT_MAX_SUBMISSION_VALUES)} is 14:

@example
sage: s.submit()                                                    # optional -- webbrowser
@end example
@end deffn
@end deffn

@c nodoctest

@node Frank Luebeck's tables of Conway polynomials over finite fields,Tables of zeros of the Riemann-Zeta function,FindStat - the Combinatorial Statistic Finder,Top
@anchor{sage/databases/conway frank-luebeck-s-tables-of-conway-polynomials-over-finite-fields}@anchor{ae}@anchor{sage/databases/conway sage-databases-conway}@anchor{af}@anchor{sage/databases/conway doc}@anchor{b0}
@chapter Frank Luebeck's tables of Conway polynomials over finite fields


@c This file has been autogenerated.
@anchor{sage/databases/conway module-sage databases conway}@anchor{0}
@geindex sage.databases.conway (module)

@geindex ConwayPolynomials (class in sage.databases.conway)
@anchor{sage/databases/conway sage databases conway ConwayPolynomials}@anchor{b1}
@deffn {Class} sage.databases.conway.ConwayPolynomials

Bases: @code{_abcoll.Mapping}

Initialize the database.

TESTS:

@example
sage: c = ConwayPolynomials()
sage: c
Frank Luebeck's database of Conway polynomials
@end example

@geindex degrees() (sage.databases.conway.ConwayPolynomials method)
@anchor{sage/databases/conway sage databases conway ConwayPolynomials degrees}@anchor{b2}
@deffn {Method} degrees (p)

Return the list of integers @code{n} for which the database of Conway
polynomials contains the polynomial of degree @code{n} over @code{GF(p)}.

EXAMPLES:

@example
sage: c = ConwayPolynomials()
sage: c.degrees(60821)
[1, 2, 3, 4]
sage: c.degrees(next_prime(10^7))
[]
@end example
@end deffn

@geindex has_polynomial() (sage.databases.conway.ConwayPolynomials method)
@anchor{sage/databases/conway sage databases conway ConwayPolynomials has_polynomial}@anchor{b3}
@deffn {Method} has_polynomial (p, n)

Return True if the database of Conway polynomials contains the
polynomial of degree @code{n} over @code{GF(p)}.

INPUT:


@itemize -

@item 
@code{p} -- prime number

@item 
@code{n} -- positive integer
@end itemize

EXAMPLES:

@example
sage: c = ConwayPolynomials()
sage: c.has_polynomial(97, 12)
True
sage: c.has_polynomial(60821, 5)
False
@end example
@end deffn

@geindex polynomial() (sage.databases.conway.ConwayPolynomials method)
@anchor{sage/databases/conway sage databases conway ConwayPolynomials polynomial}@anchor{b4}
@deffn {Method} polynomial (p, n)

Return the Conway polynomial of degree @code{n} over @code{GF(p)},
or raise a RuntimeError if this polynomial is not in the
database.

@cartouche
@quotation Note 
See also the global function @code{conway_polynomial} for
a more user-friendly way of accessing the polynomial.
@end quotation
@end cartouche

INPUT:


@itemize -

@item 
@code{p} -- prime number

@item 
@code{n} -- positive integer
@end itemize

OUTPUT:

List of Python int's giving the coefficients of the corresponding
Conway polynomial in ascending order of degree.

EXAMPLES:

@example
sage: c = ConwayPolynomials()
sage: c.polynomial(3, 21)
(1, 2, 0, 2, 0, 1, 2, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)
sage: c.polynomial(97, 128)
Traceback (most recent call last):
...
RuntimeError: Conway polynomial over F_97 of degree 128 not in database.
@end example
@end deffn

@geindex primes() (sage.databases.conway.ConwayPolynomials method)
@anchor{sage/databases/conway sage databases conway ConwayPolynomials primes}@anchor{b5}
@deffn {Method} primes ()

Return the list of prime numbers @code{p} for which the database of
Conway polynomials contains polynomials over @code{GF(p)}.

EXAMPLES:

@example
sage: c = ConwayPolynomials()
sage: P = c.primes()
sage: 2 in P
True
sage: next_prime(10^7) in P
False
@end example
@end deffn
@end deffn

@geindex DictInMapping (class in sage.databases.conway)
@anchor{sage/databases/conway sage databases conway DictInMapping}@anchor{b6}
@deffn {Class} sage.databases.conway.DictInMapping (dict)

Bases: @code{_abcoll.Mapping}

Places dict into a non-mutable mapping.

TESTS:

@example
sage: from sage.databases.conway import DictInMapping
sage: d = @{@}
sage: m = DictInMapping(d); m
@{@}
sage: d[0] = 1; m
@{0: 1@}
sage: m[2] = 3
Traceback (most recent call last):
...
TypeError: 'DictInMapping' object does not support item assignment
@end example
@end deffn

@c nodoctest

@node Tables of zeros of the Riemann-Zeta function,Ideals from the Symbolic Data project,Frank Luebeck's tables of Conway polynomials over finite fields,Top
@anchor{sage/databases/odlyzko sage-databases-odlyzko}@anchor{b7}@anchor{sage/databases/odlyzko doc}@anchor{b8}@anchor{sage/databases/odlyzko tables-of-zeros-of-the-riemann-zeta-function}@anchor{b9}
@chapter Tables of zeros of the Riemann-Zeta function


@c This file has been autogenerated.
@anchor{sage/databases/odlyzko module-sage databases odlyzko}@anchor{7}
@geindex sage.databases.odlyzko (module)

AUTHORS:


@itemize -

@item 
William Stein: initial version

@item 
Jeroen Demeyer (2015-01-20): convert @code{database_odlyzko_zeta} to
new-style package
@end itemize

@geindex zeta_zeros() (in module sage.databases.odlyzko)
@anchor{sage/databases/odlyzko sage databases odlyzko zeta_zeros}@anchor{ba}
@deffn {Function} sage.databases.odlyzko.zeta_zeros ()

List of the imaginary parts of the first 2,001,052 zeros of the
Riemann zeta function, accurate to within 4e-9.

In order to use @code{zeta_zeros()}, you will need to
install the optional Odlyzko database package:

@example
sage -i database_odlyzko_zeta
@end example

You can see a list of all available optional packages with
@code{sage --optional}.

REFERENCES:


@itemize -

@item 
@indicateurl{http://www.dtc.umn.edu/~odlyzko/zeta_tables/index.html}
@end itemize

EXAMPLES:

The following example prints the imaginary part of the 13th
nontrivial zero of the Riemann zeta function:

@example
sage: zz = zeta_zeros()  # optional - database_odlyzko_zeta
sage: zz[12]             # optional - database_odlyzko_zeta
59.347044003
sage: len(zz)            # optional - database_odlyzko_zeta
2001052
@end example
@end deffn

@c nodoctest

@node Ideals from the Symbolic Data project,Cunningham table,Tables of zeros of the Riemann-Zeta function,Top
@anchor{sage/databases/symbolic_data doc}@anchor{bb}@anchor{sage/databases/symbolic_data ideals-from-the-symbolic-data-project}@anchor{bc}@anchor{sage/databases/symbolic_data sage-databases-symbolic-data}@anchor{bd}
@chapter Ideals from the Symbolic Data project


@c This file has been autogenerated.
@anchor{sage/databases/symbolic_data module-sage databases symbolic_data}@anchor{b}
@geindex sage.databases.symbolic_data (module)

This file implements a thin wrapper for the optional symbolic data set
of ideals as published on @indicateurl{http://www.symbolicdata.org} . From the
project website:

@quotation

For different purposes algorithms and implementations are tested
on certified and reliable data. The development of tools and data
for such tests is usually 'orthogonal' to the main
implementation efforts, it requires different skills and
technologies and is not loved by programmers. On the other hand,
in many cases tools and data could easily be reused - with slight
modifications - across similar projects. The SymbolicData Project
is set out to coordinate such efforts within the Computer Algebra
Community.  Commonly collected certified and reliable data can
also be used to compare otherwise incomparable approaches,
algorithms, and implementations. Benchmark suites and Challenges
for symbolic computations are not as well established as in other
areas of computer science. This is probably due to the fact that
there are not yet well agreed aims of such a
benchmarking. Nevertheless various (often high quality) special
benchmarks are scattered through the literature.  During the last
years efforts toward collection of test data for symbolic
computations were intensified. They focused mainly on the creation
of general benchmarks for different areas of symbolic computation
and the collection of such activities on different Web site.  For
further qualification of these efforts it would be of great
benefit to create a commonly available digital archive of these
special benchmark data scattered through the literature. This
would provide the community with an electronic repository of
certified data that could be addressed and extended during further
development.
@end quotation

EXAMPLES:

@example
sage: sd = SymbolicData(); sd # optional - database_symbolic_data
SymbolicData with 372 ideals

sage: sd.ZeroDim__example_1 # optional - database_symbolic_data
Ideal (x1^2 + x2^2 - 10, x1^2 + x1*x2 + 2*x2^2 - 16) of Multivariate Polynomial Ring in x1, x2 over Rational Field

sage: sd.Katsura_3 # optional - database_symbolic_data
Ideal (u0 + 2*u1 + 2*u2 + 2*u3 - 1,
       u1^2 + 2*u0*u2 + 2*u1*u3 - u2,
       2*u0*u1 + 2*u1*u2 + 2*u2*u3 - u1,
       u0^2 + 2*u1^2 + 2*u2^2 + 2*u3^2 - u0) of Multivariate Polynomial Ring in u0, u1, u2, u3 over Rational Field

sage: sd.get_ideal('Katsura_3',GF(127),'degrevlex') # optional - database_symbolic_data
Ideal (u0 + 2*u1 + 2*u2 + 2*u3 - 1,
       u1^2 + 2*u0*u2 + 2*u1*u3 - u2,
       2*u0*u1 + 2*u1*u2 + 2*u2*u3 - u1,
       u0^2 + 2*u1^2 + 2*u2^2 + 2*u3^2 - u0) of Multivariate Polynomial Ring in u0, u1, u2, u3 over Finite Field of size 127
@end example

AUTHORS:


@itemize -

@item 
Martin Albrecht <@email{martinralbrecht@@googlemail.com}>
@end itemize

@geindex SymbolicData (class in sage.databases.symbolic_data)
@anchor{sage/databases/symbolic_data sage databases symbolic_data SymbolicData}@anchor{be}
@deffn {Class} sage.databases.symbolic_data.SymbolicData

Database of ideals as distributed by the The SymbolicData Project
(@indicateurl{http://symbolicdata.org}).

This class needs the optional @code{database_symbolic_data} package to be
installed.

@geindex get_ideal() (sage.databases.symbolic_data.SymbolicData method)
@anchor{sage/databases/symbolic_data sage databases symbolic_data SymbolicData get_ideal}@anchor{bf}
@deffn {Method} get_ideal (name, base_ring=Rational Field, term_order='degrevlex')

Returns the ideal given by 'name' over the base ring given by
'base_ring' in a polynomial ring with the term order given by
'term_order'.

INPUT:


@itemize -

@item 
@code{name} - name as on the symbolic data website

@item 
@code{base_ring} - base ring for the polynomial ring (default: @code{QQ})

@item 
@code{term_order} - term order for the polynomial ring (default: @code{degrevlex})
@end itemize

OUTPUT:

@quotation

ideal as given by @code{name} in @code{PolynomialRing(base_ring,vars,term_order)}
@end quotation

EXAMPLES:

@example
sage: sd = SymbolicData() # optional - database_symbolic_data
sage: sd.get_ideal('Katsura_3',GF(127),'degrevlex') # optional - database_symbolic_data
Ideal (u0 + 2*u1 + 2*u2 + 2*u3 - 1,
       u1^2 + 2*u0*u2 + 2*u1*u3 - u2,
       2*u0*u1 + 2*u1*u2 + 2*u2*u3 - u1,
       u0^2 + 2*u1^2 + 2*u2^2 + 2*u3^2 - u0) of Multivariate Polynomial Ring in u0, u1, u2, u3 over Finite Field of size 127
@end example
@end deffn

@geindex trait_names() (sage.databases.symbolic_data.SymbolicData method)
@anchor{sage/databases/symbolic_data sage databases symbolic_data SymbolicData trait_names}@anchor{c0}
@deffn {Method} trait_names ()

EXAMPLES:

@example
sage: sd = SymbolicData() # optional - database_symbolic_data
sage: sorted(sd.trait_names())[:10] # optional - database_symbolic_data
['Bjoerk_8',
 'Bronstein-86',
 'Buchberger-87',
 'Butcher',
 'Caprasse',
 'Cassou',
 'Cohn_2',
 'Curves__curve10_20',
 'Curves__curve10_20',
 'Curves__curve10_30']
@end example
@end deffn
@end deffn

@c nodoctest

@node Cunningham table,Database of Hilbert Polynomials,Ideals from the Symbolic Data project,Top
@anchor{sage/databases/cunningham_tables sage-databases-cunningham-tables}@anchor{c1}@anchor{sage/databases/cunningham_tables doc}@anchor{c2}@anchor{sage/databases/cunningham_tables cunningham-table}@anchor{c3}
@chapter Cunningham table


@c This file has been autogenerated.
@anchor{sage/databases/cunningham_tables module-sage databases cunningham_tables}@anchor{2}
@geindex sage.databases.cunningham_tables (module)

@geindex cunningham_prime_factors() (in module sage.databases.cunningham_tables)
@anchor{sage/databases/cunningham_tables sage databases cunningham_tables cunningham_prime_factors}@anchor{c4}
@deffn {Function} sage.databases.cunningham_tables.cunningham_prime_factors ()

List of all the prime numbers occuring in the so called Cunningham table.
They occur in the factorization of numbers of type @math{b^n+1} or @math{b^n-1} with @math{b \in \@{2@comma{}3@comma{}5@comma{}6@comma{}7@comma{}10@comma{}11@comma{}12\@}}.
Data from @indicateurl{http://cage.ugent.be/~jdemeyer/cunningham/}
@end deffn

@c nodoctest

@node Database of Hilbert Polynomials,Database of Modular Polynomials,Cunningham table,Top
@anchor{sage/databases/db_class_polynomials sage-databases-db-class-polynomials}@anchor{c5}@anchor{sage/databases/db_class_polynomials doc}@anchor{c6}@anchor{sage/databases/db_class_polynomials database-of-hilbert-polynomials}@anchor{c7}
@chapter Database of Hilbert Polynomials


@c This file has been autogenerated.
@anchor{sage/databases/db_class_polynomials module-sage databases db_class_polynomials}@anchor{3}
@geindex sage.databases.db_class_polynomials (module)

@geindex AtkinClassPolynomialDatabase (class in sage.databases.db_class_polynomials)
@anchor{sage/databases/db_class_polynomials sage databases db_class_polynomials AtkinClassPolynomialDatabase}@anchor{c8}
@deffn {Class} sage.databases.db_class_polynomials.AtkinClassPolynomialDatabase

Bases: @ref{c9,,sage.databases.db_class_polynomials.ClassPolynomialDatabase}

The database of Atkin class polynomials.
@end deffn

@geindex ClassPolynomialDatabase (class in sage.databases.db_class_polynomials)
@anchor{sage/databases/db_class_polynomials sage databases db_class_polynomials ClassPolynomialDatabase}@anchor{c9}
@deffn {Class} sage.databases.db_class_polynomials.ClassPolynomialDatabase
@end deffn

@geindex DedekindEtaClassPolynomialDatabase (class in sage.databases.db_class_polynomials)
@anchor{sage/databases/db_class_polynomials sage databases db_class_polynomials DedekindEtaClassPolynomialDatabase}@anchor{ca}
@deffn {Class} sage.databases.db_class_polynomials.DedekindEtaClassPolynomialDatabase

Bases: @ref{c9,,sage.databases.db_class_polynomials.ClassPolynomialDatabase}

The database of Dedekind eta class polynomials.
@end deffn

@geindex HilbertClassPolynomialDatabase (class in sage.databases.db_class_polynomials)
@anchor{sage/databases/db_class_polynomials sage databases db_class_polynomials HilbertClassPolynomialDatabase}@anchor{cb}
@deffn {Class} sage.databases.db_class_polynomials.HilbertClassPolynomialDatabase

Bases: @ref{c9,,sage.databases.db_class_polynomials.ClassPolynomialDatabase}

The database of Hilbert class polynomials.

EXAMPLES:

@example
sage: db = HilbertClassPolynomialDatabase()
sage: db[-4]                     # optional - database_kohel
x - 1728
sage: db[-7]                     # optional - database_kohel
x + 3375
sage: f = db[-23]; f             # optional - database_kohel
x^3 + 3491750*x^2 - 5151296875*x + 12771880859375
sage: f.discriminant().factor()  # optional - database_kohel
-1 * 5^18 * 7^12 * 11^4 * 17^2 * 19^2 * 23
sage: db[-23]                    # optional - database_kohel
x^3 + 3491750*x^2 - 5151296875*x + 12771880859375
@end example
@end deffn

@geindex WeberClassPolynomialDatabase (class in sage.databases.db_class_polynomials)
@anchor{sage/databases/db_class_polynomials sage databases db_class_polynomials WeberClassPolynomialDatabase}@anchor{cc}
@deffn {Class} sage.databases.db_class_polynomials.WeberClassPolynomialDatabase

Bases: @ref{c9,,sage.databases.db_class_polynomials.ClassPolynomialDatabase}

The database of Weber class polynomials.
@end deffn

@c nodoctest

@node Database of Modular Polynomials,Indices and Tables,Database of Hilbert Polynomials,Top
@anchor{sage/databases/db_modular_polynomials database-of-modular-polynomials}@anchor{cd}@anchor{sage/databases/db_modular_polynomials doc}@anchor{ce}@anchor{sage/databases/db_modular_polynomials sage-databases-db-modular-polynomials}@anchor{cf}
@chapter Database of Modular Polynomials


@c This file has been autogenerated.
@anchor{sage/databases/db_modular_polynomials module-sage databases db_modular_polynomials}@anchor{4}
@geindex sage.databases.db_modular_polynomials (module)

@geindex AtkinModularCorrespondenceDatabase (class in sage.databases.db_modular_polynomials)
@anchor{sage/databases/db_modular_polynomials sage databases db_modular_polynomials AtkinModularCorrespondenceDatabase}@anchor{d0}
@deffn {Class} sage.databases.db_modular_polynomials.AtkinModularCorrespondenceDatabase

Bases: @ref{d1,,sage.databases.db_modular_polynomials.ModularCorrespondenceDatabase}
@end deffn

@geindex AtkinModularPolynomialDatabase (class in sage.databases.db_modular_polynomials)
@anchor{sage/databases/db_modular_polynomials sage databases db_modular_polynomials AtkinModularPolynomialDatabase}@anchor{d2}
@deffn {Class} sage.databases.db_modular_polynomials.AtkinModularPolynomialDatabase

Bases: @ref{d3,,sage.databases.db_modular_polynomials.ModularPolynomialDatabase}

The database of modular polynomials Phi(x,j) for @math{X_0(p)}, where
x is a function on invariant under the Atkin-Lehner invariant,
with pole of minimal order at infinity.
@end deffn

@geindex ClassicalModularPolynomialDatabase (class in sage.databases.db_modular_polynomials)
@anchor{sage/databases/db_modular_polynomials sage databases db_modular_polynomials ClassicalModularPolynomialDatabase}@anchor{d4}
@deffn {Class} sage.databases.db_modular_polynomials.ClassicalModularPolynomialDatabase

Bases: @ref{d3,,sage.databases.db_modular_polynomials.ModularPolynomialDatabase}

The database of classical modular polynomials, i.e. the polynomials
Phi_N(X,Y) relating the j-functions j(q) and j(q^N).
@end deffn

@geindex DedekindEtaModularCorrespondenceDatabase (class in sage.databases.db_modular_polynomials)
@anchor{sage/databases/db_modular_polynomials sage databases db_modular_polynomials DedekindEtaModularCorrespondenceDatabase}@anchor{d5}
@deffn {Class} sage.databases.db_modular_polynomials.DedekindEtaModularCorrespondenceDatabase

Bases: @ref{d1,,sage.databases.db_modular_polynomials.ModularCorrespondenceDatabase}

The database of modular correspondences in @math{X_0(p) imes X_0(p)}, where
the model of the curves @math{X_0(p) = \Bold@{P@}^1} are specified by quotients of
Dedekind's eta function.
@end deffn

@geindex DedekindEtaModularPolynomialDatabase (class in sage.databases.db_modular_polynomials)
@anchor{sage/databases/db_modular_polynomials sage databases db_modular_polynomials DedekindEtaModularPolynomialDatabase}@anchor{d6}
@deffn {Class} sage.databases.db_modular_polynomials.DedekindEtaModularPolynomialDatabase

Bases: @ref{d3,,sage.databases.db_modular_polynomials.ModularPolynomialDatabase}

The database of modular polynomials Phi_N(X,Y) relating a quotient
of Dedekind eta functions, well-defined on X_0(N), relating x(q) and
the j-function j(q).
@end deffn

@geindex ModularCorrespondenceDatabase (class in sage.databases.db_modular_polynomials)
@anchor{sage/databases/db_modular_polynomials sage databases db_modular_polynomials ModularCorrespondenceDatabase}@anchor{d1}
@deffn {Class} sage.databases.db_modular_polynomials.ModularCorrespondenceDatabase

Bases: @ref{d3,,sage.databases.db_modular_polynomials.ModularPolynomialDatabase}
@end deffn

@geindex ModularPolynomialDatabase (class in sage.databases.db_modular_polynomials)
@anchor{sage/databases/db_modular_polynomials sage databases db_modular_polynomials ModularPolynomialDatabase}@anchor{d3}
@deffn {Class} sage.databases.db_modular_polynomials.ModularPolynomialDatabase
@end deffn

@node Indices and Tables,Python Module Index,Database of Modular Polynomials,Top
@anchor{index indices-and-tables}@anchor{d7}
@unnumbered Indices and Tables



@itemize *

@item 
Index@footnote{../genindex.html}

@item 
Module Index@footnote{../py-modindex.html}

@item 
Search Page@footnote{../search.html}
@end itemize

@node Python Module Index,Index,Indices and Tables,Top
@unnumbered Python Module Index


@menu
* sage.databases.conway: 0. 
* sage.databases.cremona: 1. 
* sage.databases.cunningham_tables: 2. 
* sage.databases.db_class_polynomials: 3. 
* sage.databases.db_modular_polynomials: 4. 
* sage.databases.findstat: 5. 
* sage.databases.jones: 6. 
* sage.databases.odlyzko: 7. 
* sage.databases.oeis: 8. 
* sage.databases.sloane: 9. 
* sage.databases.stein_watkins: a. 
* sage.databases.symbolic_data: b. 
@end menu


@node Index,,Python Module Index,Top
@unnumbered Index


@printindex ge


@c %**end of body
@bye

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#24754: problems with footnotes and a bug with links in emacs info
  2016-10-21  6:42         ` bug#24754: problems with footnotes and a bug with links in emacs info Rubey Martin
@ 2016-10-21 16:01           ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2016-10-21 16:01 UTC (permalink / raw)
  To: Rubey Martin; +Cc: 24754-done

> From: Rubey Martin <martin.rubey@tuwien.ac.at>
> Date: Fri, 21 Oct 2016 06:42:23 +0000
> 
> 1.) problem with footnotes:
> 
> select the fourth menu node
> 
>     The On-Line Encyclopedia of Integer Sequences (OEIS)
> 
> right at the beginning you will see
> 
> =========================================
> AUTHORS:
> 
>    - Thierry Monteil (2012-02-10 – 2013-06-21): initial version.
> 
>    - Vincent Delecroix (2014): modifies continued fractions because of
>      trac ticket #14567(1)
> 
>    - Moritz Firsching (2016): modifies handling of dead sequence, see
>      trac ticket #17330(2)
> =========================================
> 
> and both (2014) and (2016) are interpreted by emacs-info as links.
> 
> I learned that this is actually mandated by the specification, but I think it would be important to be able to switch off footnote links, or, even better, improve them such that makeinfo either escapes non-footnote occurrences of "(12345)", or uses a less easily confused markup.
> 
> Note that in this project (sagemath, a large gpl computer algebra system) non-footnote occurrences of (1), (2) and (3) are very very frequent, but footnotes are used, too.  Therefore, navigating to footnote (1) and clicking on it will send you anywhere.

This was fixed today on the master branch of the Emacs Git repository.

> 2.) A bug with links.  Go back to top, and then visit the node
> 
>     FindStat - the Combinatorial Statistic Finder
> 
> you should see in line 29 the link
> 
>     To access the database, use *note findstat: 7a.:
> 
> but clicking on it does not send me to the line beginning with
> 
>     Class sage.databases.findstat.FindStat
> 
> but a little below.  This problem is much worse in other, larger examples.

This was already fixed in Emacs 25.1.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-21 16:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <ab6062654f4345fe9a54028e26534f41@mbx13b.intern.tuwien.ac.at>
     [not found] ` <83funrt463.fsf@gnu.org>
     [not found]   ` <5eae4209ab1e4e8d8e716453c00b5d22@mbx13b.intern.tuwien.ac.at>
     [not found]     ` <83a8dyu8yk.fsf@gnu.org>
     [not found]       ` <6849fd8187dc4d119fdb2b6f4fbdc0b4@mbx13b.intern.tuwien.ac.at>
2016-10-21  6:42         ` bug#24754: problems with footnotes and a bug with links in emacs info Rubey Martin
2016-10-21 16:01           ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).