Demonstration: Combinatorics (short)

<span id="demo-combinatorics-short"></span>



<h1>Counting</h1>

{{{id=0|
Partitions(100000).cardinality()
///
}}}

<p>Species:</p>

{{{id=1|
from sage.combinat.species.library import *
o   = var(&quot;o&quot;)
BT = CombinatorialSpecies()
Leaf =  SingletonSpecies()
BT.define(Leaf+(BT*BT))
BT.isotypes([o]*5).list()
///
[o*(o*(o*(o*o))), o*(o*((o*o)*o)), o*((o*o)*(o*o)), o*((o*(o*o))*o), o*(((o*o)*o)*o), (o*o)*(o*(o*o)), (o*o)*((o*o)*o), (o*(o*o))*(o*o), ((o*o)*o)*(o*o), (o*(o*(o*o)))*o, (o*((o*o)*o))*o, ((o*o)*(o*o))*o, ((o*(o*o))*o)*o, (((o*o)*o)*o)*o]
}}}

<h1>Words</h1>

{{{id=2|
m = WordMorphism('a-&gt;acabb,b-&gt;bcacacbb,c-&gt;baba')
m.fixed_point('a')
///
word: acabbbabaacabbbcacacbbbcacacbbbcacacbbac...
}}}

<h1>Lattice points of polytopes</h1>

{{{id=3|
A=random_matrix(ZZ,3,6,x=7)
L=LatticePolytope(A)
L.plot3d()
///
}}}


{{{id=4|
L.npoints()  # should be cardinality!
///
28
}}}

<p>This example used PALP and J-mol</p>


<h1>Graphs up to an isomorphism</h1>

{{{id=5|
show(graphs(5, lambda G: G.size() &lt;= 4))
///
}}}

