FindStat - the Combinatorial Statistic Finder.¶
The FindStat database can be found at http://www.findstat.org .
Fix the following three notions:
- A combinatorial collection is a set \(S\) with interesting combinatorial properties,
- a combinatorial map is a combinatorially interesting map \(f: S \to S'\) between combinatorial collections, and
- a combinatorial statistic is a combinatorially interesting map \(s: S \to \ZZ\).
You can use the sage interface to FindStat to:
- identify a combinatorial statistic from the values on a few small objects,
- obtain more terms, formulae, references, etc. for a given statistic,
- edit statistics and submit new statistics.
To access the database, use findstat
:
sage: findstat
The Combinatorial Statistic Finder (http://www.findstat.org/)
AUTHORS:
- Martin Rubey (2015): initial version.
A guided tour¶
Retrieving information¶
The most straightforward application of the FindStat interface is to
gather information about a combinatorial statistic. To do this, we
supply findstat
with a list of \((object, value)\)
pairs. For 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)
...
The result of this query is a list (presented as a
sage.databases.oeis.FancyTuple
) of triples. The first
element of each triple is a FindStatStatistic
\(s: S \to
\ZZ\), the second element a list of FindStatMap
‘s \(f_i: S_i
\to S_{i+1}\), and the third element is an integer:
sage: (s, list_f, quality) = r[0] # optional -- internet
The precise meaning of the result is as follows:
The composition \(f_n \circ ... \circ f_2 \circ f_1\) applied to the objects sent to FindStat agrees with \(quality\) many \((object, value)\) pairs of \(s\) in the database. Moreover, there are no other \((object, value)\) pairs of \(s\) stored in the database, i.e., there is no disagreement of values.
Put differently, if \(quality\) is not too small it is likely that the statistic sent to FindStat equals \(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 \(quality\) equals the number of \((object, value)\) pairs passed to FindStat. This means, that the set of \((object, value)\) pairs of the statistic \(s\) as stored in the FindStat database is a superset of the data sent. We can now retrieve the description from the database:
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)$.
and check the references:
sage: s.references() # optional -- internet,random
0: [1] [[MathSciNet:1288802]]
1: [2] [[MathSciNet:1418763]]
If you prefer, you can look at this information also in your browser:
sage: findstat(41).browse() # optional -- webbrowser
Another interesting possibility is to look for equidistributed statistics. Instead of submitting a list of pairs, we pass a pair of lists:
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)
...
This results tells us that the database contains another entriy that is equidistributed with the number of nestings on perfect matchings of length \(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:
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
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:
sage: pi = Permutation([3,1,4,5,2]); pi.saliances()[0]
3
We first have to find out, what the maps and the statistic actually do:
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()
So, the following should coincide with what we sent FindStat:
sage: pi.complement().increasing_tree_shape()[0].node_number()
3
Editing and submitting statistics¶
Of course, often a statistic will not be in the database:
sage: findstat([(d, randint(1,1000)) for d in DyckWords(4)]) # optional -- internet
a new statistic on Cc0005: Dyck paths
In this case, and if the statistic might be “interesting”, please
consider submitting it to the database using
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 FindStatStatistic.set_description()
,
FindStatStatistic.set_code()
or
FindStatStatistic.set_references()
, and then
FindStatStatistic.submit()
your changes for review by the
FindStat team.
Classes and methods¶
-
class
sage.databases.findstat.
FindStat
¶ Bases:
sage.structure.sage_object.SageObject
The Combinatorial Statistic Finder.
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 shorthandfindstat
to call it.INPUT:
One of the following:
- an integer or a string representing a valid FindStat identifier
(e.g. 45 or ‘St000045’). The keyword arguments
depth
andmax_values
are ignored. - a list of pairs of the form (object, value), or a dictionary
from sage objects to integer values. The keyword arguments
depth
andmax_values
are passed to the finder. - 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
depth
andmax_values
are passed to the finder. - a collection and a list of pairs of the form (string, value),
or a dictionary from strings to integer values. The keyword
arguments
depth
andmax_values
are passed to the finder. This should only be used if the collection is not yet supported. - 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
depth
andmax_values
are passed to the finder. This should only be used if the collection is not yet supported. - a collection and a callable. The callable is used to generate
max_values
(object, value) pairs. The number of terms generated may also be controlled by passing an iterable collection, such asPermutations(3)
. The keyword argumentsdepth
andmax_values
are passed to the finder.
OUTPUT:
An instance of a
FindStatStatistic
, represented bythe FindStat identifier together with its name, or
a list of triples, each consisting of
- the statistic
- a list of strings naming certain maps
- 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.
EXAMPLES:
A particular statistic can be retrieved by its St-identifier or number:
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.
The database can be searched by providing a list of pairs:
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) ...
or a dictionary:
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) ...
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:
sage: p == q # optional -- internet False
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:
sage: findstat("Permutations", lambda pi: pi.length()) # optional -- internet,random 0: (St000018: The [[/Permutations/Inversions|number of inversions]] of a permutation., [], 200) ...
To search for a distribution, send a list of lists, or a single pair:
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) ...
Note that there is a limit,
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: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.
-
browse
()¶ Open the FindStat web page in a browser.
EXAMPLES:
sage: findstat.browse() # optional -- webbrowser
-
login
()¶ Open the FindStat login page in a browser.
EXAMPLES:
sage: findstat.login() # optional -- webbrowser
-
set_user
(name=None, email=None)¶ Set the user for this session.
INPUT:
name
– the name of the user.email
– an email address of the user.
This information is used when submitting a statistic with
FindStatStatistic.submit()
.EXAMPLES:
sage: findstat.set_user(name="Anonymous", email="invalid@org")
Note
It is usually more convenient to login into the FindStat web page using the
login()
method.
- an integer or a string representing a valid FindStat identifier
(e.g. 45 or ‘St000045’). The keyword arguments
-
class
sage.databases.findstat.
FindStatCollection
(parent, id, c, sageconstructor_overridden)¶ Bases:
sage.structure.element.Element
A FindStat collection.
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
findstat
. It also provides methods to quickly access its FindStat web page (browse()
), check whether a particular element is actually in the range considered by FindStat (in_range()
), etc.INPUT:
One of the following:
- a string eg. ‘Dyck paths’ or ‘DyckPaths’, case-insensitive, or
- an integer designating the FindStat id of the collection, or
- a sage object belonging to a collection, or
- an iterable producing a sage object belonging to a collection.
EXAMPLES:
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
SEEALSO:
-
browse
()¶ Open the FindStat web page of the collection in a browser.
EXAMPLES:
sage: from sage.databases.findstat import FindStatCollection sage: FindStatCollection("Permutations").browse() # optional -- webbrowser
-
first_terms
(statistic, max_values=1200)¶ Compute the first few terms of the given statistic.
INPUT:
statistic
– a callable.max_values
– the number of terms to compute at most.
OUTPUT:
A list of pairs of the form (object, value).
EXAMPLES:
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)]
-
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:
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
-
id
()¶ Return the FindStat identifier of the collection.
OUTPUT:
The FindStat identifier of the collection as an integer.
EXAMPLES:
sage: from sage.databases.findstat import FindStatCollection sage: c = FindStatCollection("GelfandTsetlinPatterns") # optional -- internet sage: c.id() # optional -- internet 18
-
id_str
()¶ Return the FindStat identifier of the collection.
OUTPUT:
The FindStat identifier of the collection as a string.
EXAMPLES:
sage: from sage.databases.findstat import FindStatCollection sage: c = FindStatCollection("GelfandTsetlinPatterns") # optional -- internet sage: c.id_str() # optional -- internet 'Cc0018'
-
in_range
(element)¶ Check whether an element of the collection is in FindStat’s precomputed range.
INPUT:
element
– a sage object that belongs to the collection.
OUTPUT:
True
, ifelement
is used by the FindStat search engine, andFalse
if it is ignored.EXAMPLES:
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
TESTS:
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
-
is_supported
()¶ Check whether the collection is fully supported by the interface.
EXAMPLES:
sage: from sage.databases.findstat import FindStatCollection sage: FindStatCollection(1).is_supported() # optional -- internet True sage: FindStatCollection(24).is_supported() # optional -- internet, random False
-
name
(style='singular')¶ Return the name of the FindStat collection.
INPUT:
- a string – (default:”singular”) can be “singular”, or “plural”.
OUTPUT:
The name of the FindStat collection, in singular or in plural.
EXAMPLES:
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'
-
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:
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)'
-
class
sage.databases.findstat.
FindStatCollections
¶ Bases:
sage.structure.parent.Parent
,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
_findstat_collections
in this class has to be updated accordingly.EXAMPLES:
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]
-
Element
¶ alias of
FindStatCollection
-
-
class
sage.databases.findstat.
FindStatMap
(parent, entry)¶ Bases:
sage.structure.element.Element
A FindStat map.
FindStatMap
is a class representing a combinatorial map available in the FindStat database.The result of a
findstat
query contains a (possibly empty) list of such maps. This class provides methods to inspect various properties of these maps, in particularcode()
.INPUT:
- a string containing the FindStat name of the map, or an integer representing its FindStat id.
EXAMPLES:
sage: from sage.databases.findstat import FindStatMap sage: FindStatMap(71) # optional -- internet Mp00071: descent composition sage: FindStatMap("descent composition") # optional -- internet Mp00071: descent composition
SEEALSO:
-
code
()¶ Return the code associated with the map.
OUTPUT:
A string.
EXAMPLES:
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)])
-
code_name
()¶ Return the name of the function defined by
code()
.OUTPUT:
A string.
EXAMPLES:
sage: from sage.databases.findstat import FindStatMap # optional -- internet sage: print(FindStatMap(71).code_name()) # optional -- internet descents_composition
-
codomain
()¶ Return the FindStat collection which is the codomain of the map.
OUTPUT:
The codomain of the map as a
FindStatCollection
.EXAMPLES:
sage: from sage.databases.findstat import FindStatMap # optional -- internet sage: FindStatMap(71).codomain() # optional -- internet Cc0006: Integer compositions
-
description
()¶ Return the FindStat description of the map.
OUTPUT:
The description as a string.
EXAMPLES:
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]$
-
domain
()¶ Return the FindStat collection which is the domain of the map.
OUTPUT:
The domain of the map as a
FindStatCollection
.EXAMPLES:
sage: from sage.databases.findstat import FindStatMap # optional -- internet sage: FindStatMap(71).domain() # optional -- internet Cc0001: Permutations
-
id
()¶ Return the FindStat identifier of the map.
OUTPUT:
The FindStat identifier of the map as an integer.
EXAMPLES:
sage: m = findstat("Permutations", lambda pi: pi.length())[1][1][0] # optional -- internet sage: m.id() # optional -- internet 62
-
id_str
()¶ Return the FindStat identifier of the map.
OUTPUT:
The FindStat identifier of the map as a string.
EXAMPLES:
sage: m = findstat("Permutations", lambda pi: pi.length())[1][1][0] # optional -- internet sage: m.id_str() # optional -- internet 'Mp00062'
-
name
()¶ Return the FindStat name of the map.
OUTPUT:
The name of the map as a string, as used by FindStat.
EXAMPLES:
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'
-
class
sage.databases.findstat.
FindStatMaps
¶ Bases:
sage.structure.parent.Parent
,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:
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 ...
-
Element
¶ alias of
FindStatMap
-
-
class
sage.databases.findstat.
FindStatStatistic
(id, first_terms=None, data=None, function=None, code='', collection=None, depth=None)¶ Bases:
sage.structure.sage_object.SageObject
The class of FindStat statistics.
Do not instantiate this class directly. Instead, use
findstat
.-
browse
()¶ Open the FindStat web page of the statistic in a browser.
EXAMPLES:
sage: findstat(41).browse() # optional -- webbrowser
-
code
()¶ Return the code associated with the statistic.
OUTPUT:
A string. Contributors are encouraged to submit sage code in the form:
def statistic(x): ...
but the string may also contain code for other computer algebra systems.
EXAMPLES:
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}]
-
collection
()¶ Return the FindStat collection of the statistic.
OUTPUT:
The FindStat collection of the statistic as an instance of
FindStatCollection
.EXAMPLES:
sage: findstat(1).collection() # optional -- internet Cc0001: Permutations
-
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,
data
isNone
.EXAMPLES:
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])]
-
description
()¶ Return the description of the statistic.
OUTPUT:
A string, whose first line is used as the name of the statistic.
EXAMPLES:
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)$.
-
edit
(max_values=1200)¶ Open the FindStat web page for editing the statistic in a browser.
INPUT:
max_values
– integer (default:FINDSTAT_MAX_SUBMISSION_VALUES
); iffunction()
is defined and the statistic is a new statistic, useFindStatCollection.first_terms()
to produce at mostmax_values
terms.
OUTPUT:
- Raise an error if the query has a match with no intermediate combinatorial maps.
EXAMPLES:
sage: s = findstat(DyckWords(4), lambda x: randint(1,1000)); s # optional -- internet a new statistic on Cc0005: Dyck paths
The following uses
lambda x: randint(1,1000)
to produce 14 terms, becausemin(DyckWords(4).cardinality(), FINDSTAT_MAX_SUBMISSION_VALUES)
is 14:sage: s.submit() # optional -- webbrowser
-
first_terms
()¶ Return the first terms of the statistic.
OUTPUT:
A list of pairs of the form
(object, value)
whereobject
is a sage object representing an element of the appropriate collection andvalue
is an integer. If the statistic is in the FindStat database, the list contains exactly the pairs in the database.EXAMPLES:
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), ...
TESTS:
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
-
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
object => value
, whereobject
is the string representation of an element of the appropriate collection as used by FindStat and value is an integer.EXAMPLES:
sage: findstat(1).first_terms_str()[:10] # optional -- internet,random '[1] => 1\r\n'
-
function
()¶ Return the function used to compute the values of the statistic.
OUTPUT:
The function used to compute the values of the statistic, or
None
.EXAMPLES:
sage: findstat("Permutations", lambda pi: pi.length()).function() # optional -- internet ... <function <lambda> at ...>
-
generating_functions
(style='polynomial')¶ Return the generating functions of
self
in a dictionary.The keys of this dictionary are the levels for which the generating function of
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:
- a string – (default:”polynomial”) can be “polynomial”, “dictionary”, or “list”.
OUTPUT:
- if
style
is"polynomial"
, the generating function is returned as a polynomial. - if
style
is"dictionary"
, the generating function is returned as a dictionary representing the monomials of the generating function. - if
style
is"list"
, the generating function is returned as a list of coefficients of the generating function.
EXAMPLES:
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]}
-
id
()¶ Return the FindStat identifier of the statistic.
OUTPUT:
The FindStat identifier of the statistic (or 0), as an integer.
EXAMPLES:
sage: findstat(1).id() # optional -- internet 1
-
id_str
()¶ Return the FindStat identifier of the statistic.
OUTPUT:
The FindStat identifier of the statistic (or ‘St000000’), as a string.
EXAMPLES:
sage: findstat(1).id_str() # optional -- internet 'St000001'
-
modified
()¶ Return whether the statistic was modified.
OUTPUT:
True, if the statistic was modified using
set_description()
,set_code()
,set_references()
, etc. False otherwise.EXAMPLES:
sage: findstat(41).set_description("") # optional -- internet sage: findstat(41).modified() # optional -- internet True
-
name
()¶ Return the name of the statistic.
OUTPUT:
A string, which is just the first line of the description of the statistic.
EXAMPLES:
sage: findstat(1).name() # optional -- internet,random u'The number of ways to write a permutation as a minimal length product of simple transpositions.'
-
oeis_search
(search_size=32, verbose=True)¶ Search the OEIS for the generating function of the statistic.
INPUT:
search_size
(default:32) the number of integers in the sequence. If too big, the OEIS result is corrupted.verbose
(default:True) if true, some information about the search are printed.
OUTPUT:
- a tuple of OEIS sequences, see
sage.databases.oeis.OEIS.find_by_description()
for more information.
EXAMPLES:
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).
-
references
()¶ Return the references associated with the statistic.
OUTPUT:
An instance of
sage.databases.oeis.FancyTuple
, each item corresponds to a reference.Todo
Since the references in the database are sometimes not formatted properly, this method is unreliable. The string representation can be obtained via
_references
.EXAMPLES:
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]]
-
set_code
(value)¶ Set the code associated with the statistic.
INPUT:
a string – contributors are encouraged to submit sage code in the form:
def statistic(x): ...
OUTPUT:
- Raise an error if the query has a match with no intermediate combinatorial maps.
This information is used when submitting the statistic with
submit()
.EXAMPLES:
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)
-
set_description
(value)¶ Set the description of the statistic.
INPUT:
- a string – the name of the statistic followed by its description on a separate line.
OUTPUT:
- Raise an error, if the query has a match with no intermediate combinatorial maps.
This information is used when submitting the statistic with
submit()
.EXAMPLES:
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.
-
set_references
(value)¶ Set the references associated with the statistic.
INPUT:
- a string – the individual references should be separated by FINDSTAT_SEPARATOR_REFERENCES, which is “\r\n”.
OUTPUT:
- Raise an error, if the query has a match with no intermediate combinatorial maps.
This information is used when submitting the statistic with
submit()
.EXAMPLES:
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]]
-
submit
(max_values=1200)¶ Open the FindStat web page for editing the statistic in a browser.
INPUT:
max_values
– integer (default:FINDSTAT_MAX_SUBMISSION_VALUES
); iffunction()
is defined and the statistic is a new statistic, useFindStatCollection.first_terms()
to produce at mostmax_values
terms.
OUTPUT:
- Raise an error if the query has a match with no intermediate combinatorial maps.
EXAMPLES:
sage: s = findstat(DyckWords(4), lambda x: randint(1,1000)); s # optional -- internet a new statistic on Cc0005: Dyck paths
The following uses
lambda x: randint(1,1000)
to produce 14 terms, becausemin(DyckWords(4).cardinality(), FINDSTAT_MAX_SUBMISSION_VALUES)
is 14:sage: s.submit() # optional -- webbrowser
-