Rauzy class cardinality¶
Cardinality of Rauzy classes
The following functions implement algorithms relative to article [Del13] and [Boi13] where are given formulas for the cardinality of Rauzy classes of permutations.
c
: number of standard labeled permutations
d
: spin difference of standard labeled permutations
gamma_std
: number of standard permutations (with given profile and marking)
gamma_irr
: number of irreducible permutations (with given profile and marking)
delta_std
: spin difference for standard permutations (with given profile and marking)
delta_irr
: spin difference for irreducible permutations (with given profile and marking)
AUTHOR:
Vincent Delecroix
- surface_dynamics.interval_exchanges.rauzy_class_cardinality.bidecompositions(p)[source]¶
Iterator through the pair of partitions
(q1,q2)
such that the union of the parts ofq1
andq2
equalp
.EXAMPLES:
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rcc sage: list(rcc.bidecompositions(Partition([3,1]))) [([], [3, 1]), ([3], [1]), ([1], [3]), ([3, 1], [])] sage: list(rcc.bidecompositions(Partition([2,1,1]))) [([], [2, 1, 1]), ([2], [1, 1]), ([1], [2, 1]), ([2, 1], [1]), ([1, 1], [2]), ([2, 1, 1], [])]
- surface_dynamics.interval_exchanges.rauzy_class_cardinality.c(p)[source]¶
Number of labeled standard permutations with given profile
There is an explicit formula for this number
\[c(p) = \frac{2 (n-1)!}{n+1} \left( \sum_{q \subset (p_2,p_3,\ldots,p_k)} (-1)^{s(q)-l(q)} \binom{n}{s(q)}^{-1} \right).\]Though, for huge partition p this is not very useful. This function implements an induction formula to compute c(p).
EXAMPLES:
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rcc
Partition of length 1:
sage: n = 7 sage: rcc.c([n]) == 2 * factorial(n-1) / (n+1) True sage: all(rcc.c([n]) == 2 * factorial(n-1) / (n+1) for n in range(11,18,2)) True
Partitions of length 2 with two odd numbers:
sage: p = [5,3] sage: n = sum(p) sage: b = binomial(n,p[0]) sage: rcc.c(p) == 2 * factorial(n-1) * (1 + 1 / binomial(n,p[0])) / (n+1) True sage: p = [13,5] sage: n = sum(p) sage: b = binomial(n,p[0]) sage: rcc.c(p) == 2 * factorial(n-1) * (1 + 1 / binomial(n,p[0])) / (n+1) True
Partitions of length 2 with even numbers:
sage: p = [4,4] sage: n = sum(p) sage: b = binomial(n,p[0]) sage: rcc.c(p) == 2 * factorial(n-1) * (1 - 1 / binomial(n,p[0])) / (n+1) True sage: p = [10,2] sage: n = sum(p) sage: b = binomial(n,p[0]) sage: rcc.c(p) == 2 * factorial(n-1) * (1 - 1 / binomial(n,p[0])) / (n+1) True
Add marked points to an integer partition:
sage: p = [3,2,2] sage: n = sum(p) sage: all(rcc.c(p + [1]*k) == factorial(n+k-1) / factorial(n-1) * rcc.c(p) for k in range(1,6)) True
- surface_dynamics.interval_exchanges.rauzy_class_cardinality.check_marking(p, marking)[source]¶
Tiny internal function that checks that
marking
is compatible withp
.OUTPUT:
A 3-tuple.
EXAMPLES:
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rcc sage: p = Partition([3,2,2]) sage: rcc.check_marking(p, (1,3,1)) (1, 3, 1) sage: rcc.check_marking(p, (1,3,2)) (1, 3, 2) sage: rcc.check_marking(p, (1,3,3)) Traceback (most recent call last): ... ValueError: marking[2] is not good sage: rcc.check_marking(p, (1,3,-1)) Traceback (most recent call last): ... ValueError: marking[2] is not good sage: rcc.check_marking(p, (2,3,2)) (2, 3, 2) sage: rcc.check_marking(p, (2,3,3)) Traceback (most recent call last): ... ValueError: wrong marking type 2
- surface_dynamics.interval_exchanges.rauzy_class_cardinality.check_std_marking(p, marking)[source]¶
Tiny internal function that checks the validity of
marking
on the partitionp
.EXAMPLES:
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rcc sage: p = Partition([3,2,2]) sage: rcc.check_std_marking(p, (1,3,1)) (1, 3, 1) sage: rcc.check_std_marking(p, (1,3,0)) Traceback (most recent call last): ... ValueError: marking[2] is not good
- surface_dynamics.interval_exchanges.rauzy_class_cardinality.collapse(p, i, j)[source]¶
Collapses the i-th term and the j-th term of a permutation
INPUT:
p
- a partitioni,j
- two different indices of p
OUTPUT:
a partition
EXAMPLES:
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rcc sage: p = Partition([4,2,1]) sage: rcc.collapse(p, 0, 1) [5, 1] sage: rcc.collapse(p, 0, 2) [4, 2] sage: rcc.collapse(p, 1, 2) [4, 2]
- surface_dynamics.interval_exchanges.rauzy_class_cardinality.d(p)[source]¶
Difference between the number of odd spin parity and even spin parity standard labeled permutations with given profile
There is an explicit formula
\[d(p) = \frac{(n-1)!}{2^{(n-k)/2}}\]where n is the sum of the partition p and k is its length.
EXAMPLES:
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rcc sage: p = [3,3,1] sage: rcc.d([3,3,1]) == factorial(6) / 2**2 True sage: rcc.d([13]) == factorial(12) / 2**6 True Adding marked points:: sage: p = [5,3,3] sage: n = sum(p) sage: all(rcc.d(p + [1]*k) == factorial(n+k-1) / factorial(n-1) * rcc.d(p) for k in range(1,6)) True
- surface_dynamics.interval_exchanges.rauzy_class_cardinality.delta_irr(profile, marking=None)[source]¶
Spin difference for the given profile and marking
EXAMPLES:
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rcc
The non connected strata in genus 3:
sage: from surface_dynamics import Stratum sage: c_odd = Stratum([2,2], k=1).odd_component() sage: c_hyp = Stratum([2,2], k=1).hyperelliptic_component() sage: c_odd.rauzy_diagram() Rauzy diagram with 294 permutations sage: c_hyp.rauzy_diagram() Rauzy diagram with 63 permutations sage: rcc.delta_irr([3,3]) == 294 - 63 True sage: c_odd = Stratum([4], k=1).odd_component() sage: c_hyp = Stratum([4], k=1).hyperelliptic_component() sage: c_odd.rauzy_diagram() Rauzy diagram with 134 permutations sage: c_hyp.rauzy_diagram() Rauzy diagram with 31 permutations sage: rcc.delta_irr([5]) == 134 - 31 True
A non connected strata in genus 4:
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rdc sage: a = Stratum([6], k=1) sage: c_hyp = a.hyperelliptic_component() sage: c_odd = a.odd_component() sage: c_even = a.even_component() sage: c_hyp.rauzy_diagram() Rauzy diagram with 127 permutations sage: c_hyp.rauzy_class_cardinality() 127 sage: c_odd.rauzy_diagram() Rauzy diagram with 5209 permutations sage: c_odd.rauzy_class_cardinality() 5209 sage: c_even = a.even_component() sage: c_even.rauzy_diagram() Rauzy diagram with 2327 permutations sage: c_even.rauzy_class_cardinality() 2327 sage: 5209 - 2327 - 127 2755 sage: rdc.delta_irr([7]) 2755
An example with a very big Rauzy class:
sage: c = Stratum([6,6], k=1).odd_component() sage: c.rauzy_class_cardinality() 11609364656
- surface_dynamics.interval_exchanges.rauzy_class_cardinality.delta_std(profile, marking=None)[source]¶
Return the difference odd-even in the given stratum
INPUT:
p
- partition with odd termsmarking
- a 3-tuple(1, n1, a)
or(2, n1, n2)
EXAMPLES:
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rcc
A ValueError is raised if the partition does not fulfill the requirement:
sage: rcc.delta_std([5,2]) Traceback (most recent call last): ... ValueError: the profile (=[5, 2]) must contain only odd numbers
Non connected strata in genus 3 has two connected components distinguished by their spin parity:
sage: from surface_dynamics import Stratum sage: cc_odd = Stratum([2,2], k=1).odd_component() sage: cc_hyp = Stratum([2,2], k=1).hyperelliptic_component() sage: d_odd = cc_odd.rauzy_diagram() sage: d_hyp = cc_hyp.rauzy_diagram() sage: d_odd Rauzy diagram with 294 permutations sage: d_hyp Rauzy diagram with 63 permutations sage: n_odd = sum(1 for _ in filter(lambda x: x.is_standard(), d_odd)) sage: n_hyp = sum(1 for _ in filter(lambda x: x.is_standard(), d_hyp)) sage: n_odd - n_hyp == rcc.delta_std([3,3]) True sage: cc_odd = Stratum([4], k=1).odd_component() sage: cc_hyp = Stratum([4], k=1).hyperelliptic_component() sage: d_odd = cc_odd.rauzy_diagram() sage: d_hyp = cc_hyp.rauzy_diagram() sage: d_odd Rauzy diagram with 134 permutations sage: d_hyp Rauzy diagram with 31 permutations sage: n_odd = sum(1 for _ in filter(lambda x: x.is_standard(), d_odd)) sage: n_hyp = sum(1 for _ in filter(lambda x: x.is_standard(), d_hyp)) sage: n_odd - n_hyp == rcc.delta_std([5]) True
- surface_dynamics.interval_exchanges.rauzy_class_cardinality.gamma_irr(profile=None, marking=None)[source]¶
Number of permutations for the given profile and marking
INPUT:
profile
- an integer partition such that its sum plus its length is congruent to 0 modulo 2markings
- None, an element of the profile or a 3-tuple
EXAMPLES:
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rcc
The connected strata in genus 3:
sage: from surface_dynamics import Stratum sage: c = Stratum([1,1,1,1], k=1).unique_component() sage: c.rauzy_diagram() Rauzy diagram with 1255 permutations sage: rcc.gamma_irr([2,2,2,2]) 1255 sage: c = Stratum([2,1,1], k=1).unique_component() sage: c.rauzy_diagram() Rauzy diagram with 2177 permutations sage: rcc.gamma_irr([3,2,2]) 2177 sage: c = Stratum([3,1], k=1).unique_component() sage: c.rauzy_diagram() Rauzy diagram with 770 permutations sage: rcc.gamma_irr([4,2]) 770
The non connected strata in genus 3:
sage: c_odd = Stratum([2,2], k=1).odd_component() sage: c_hyp = Stratum([2,2], k=1).hyperelliptic_component() sage: c_odd.rauzy_diagram() Rauzy diagram with 294 permutations sage: c_hyp.rauzy_diagram() Rauzy diagram with 63 permutations sage: rcc.gamma_irr([3,3]) == 294 + 63 True sage: c_odd = Stratum([4], k=1).odd_component() sage: c_hyp = Stratum([4], k=1).hyperelliptic_component() sage: c_odd.rauzy_diagram() Rauzy diagram with 134 permutations sage: c_hyp.rauzy_diagram() Rauzy diagram with 31 permutations sage: rcc.gamma_irr([5]) == 134 + 31 True
- surface_dynamics.interval_exchanges.rauzy_class_cardinality.gamma_std(profile, marking=None)[source]¶
Return the number of standard permutations of given profile
INPUT:
profile
- an integer partition such that the its sum plus its length is congruent to 0 modulo 2marking
- either None, an element of the profile or a 3-tuple(1, n1, a)
or(2, n1, n2)
EXAMPLES:
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rcc
A ValueError is raised if the partition does not satisfy the requirement:
sage: rcc.gamma_std([5,2]) Traceback (most recent call last): ... ValueError: the sum of the profile (=[5, 2]) plus its length must be congruent to 0 modulo 2
The Rauzy classes associated to connected strata in genus 3:
sage: from surface_dynamics import Stratum sage: cc = Stratum([1,1,1,1], k=1).unique_component() sage: d = cc.rauzy_diagram() sage: d Rauzy diagram with 1255 permutations sage: sum(1 for _ in filter(lambda x: x.is_standard(), d)) == rcc.gamma_std([2,2,2,2]) True sage: cc = Stratum([2,1,1], k=1).unique_component() sage: d = cc.rauzy_diagram() sage: d Rauzy diagram with 2177 permutations sage: sum(1 for _ in filter(lambda x: x.is_standard(), d)) == rcc.gamma_std([3,2,2]) True sage: cc = Stratum([3,1], k=1).unique_component() sage: d = cc.rauzy_diagram() sage: d Rauzy diagram with 770 permutations sage: sum(1 for _ in filter(lambda x: x.is_standard(), d)) == rcc.gamma_std([4,2]) True
The non connected strata in genus 3:
sage: cc_odd = Stratum([2,2], k=1).odd_component() sage: cc_hyp = Stratum([2,2], k=1).hyperelliptic_component() sage: d_odd = cc_odd.rauzy_diagram() sage: d_hyp = cc_hyp.rauzy_diagram() sage: d_odd Rauzy diagram with 294 permutations sage: d_hyp Rauzy diagram with 63 permutations sage: n_odd = sum(1 for _ in filter(lambda x: x.is_standard(), d_odd)) sage: n_hyp = sum(1 for _ in filter(lambda x: x.is_standard(), d_hyp)) sage: n_odd + n_hyp == rcc.gamma_std([3,3]) True sage: cc_odd = Stratum([4], k=1).odd_component() sage: cc_hyp = Stratum([4], k=1).hyperelliptic_component() sage: d_odd = cc_odd.rauzy_diagram() sage: d_hyp = cc_hyp.rauzy_diagram() sage: d_odd Rauzy diagram with 134 permutations sage: d_hyp Rauzy diagram with 31 permutations sage: n_odd = sum(1 for _ in filter(lambda x: x.is_standard(), d_odd)) sage: n_hyp = sum(1 for _ in filter(lambda x: x.is_standard(), d_hyp)) sage: n_odd + n_hyp == rcc.gamma_std([5]) True
- surface_dynamics.interval_exchanges.rauzy_class_cardinality.marking_iterator(profile, left=None, standard=False)[source]¶
Returns the marked profile associated to a partition
EXAMPLES:
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rcc sage: p = Partition([3,2,2]) sage: list(rcc.marking_iterator(p)) [(1, 2, 0), (1, 2, 1), (1, 3, 0), (1, 3, 1), (1, 3, 2), (2, 2, 2), (2, 2, 3), (2, 3, 2)]
- surface_dynamics.interval_exchanges.rauzy_class_cardinality.number_of_irreducible_permutations(profile=None, marking=None)¶
Number of permutations for the given profile and marking
INPUT:
profile
- an integer partition such that its sum plus its length is congruent to 0 modulo 2markings
- None, an element of the profile or a 3-tuple
EXAMPLES:
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rcc
The connected strata in genus 3:
sage: from surface_dynamics import Stratum sage: c = Stratum([1,1,1,1], k=1).unique_component() sage: c.rauzy_diagram() Rauzy diagram with 1255 permutations sage: rcc.gamma_irr([2,2,2,2]) 1255 sage: c = Stratum([2,1,1], k=1).unique_component() sage: c.rauzy_diagram() Rauzy diagram with 2177 permutations sage: rcc.gamma_irr([3,2,2]) 2177 sage: c = Stratum([3,1], k=1).unique_component() sage: c.rauzy_diagram() Rauzy diagram with 770 permutations sage: rcc.gamma_irr([4,2]) 770
The non connected strata in genus 3:
sage: c_odd = Stratum([2,2], k=1).odd_component() sage: c_hyp = Stratum([2,2], k=1).hyperelliptic_component() sage: c_odd.rauzy_diagram() Rauzy diagram with 294 permutations sage: c_hyp.rauzy_diagram() Rauzy diagram with 63 permutations sage: rcc.gamma_irr([3,3]) == 294 + 63 True sage: c_odd = Stratum([4], k=1).odd_component() sage: c_hyp = Stratum([4], k=1).hyperelliptic_component() sage: c_odd.rauzy_diagram() Rauzy diagram with 134 permutations sage: c_hyp.rauzy_diagram() Rauzy diagram with 31 permutations sage: rcc.gamma_irr([5]) == 134 + 31 True
- surface_dynamics.interval_exchanges.rauzy_class_cardinality.number_of_standard_permutations(profile, marking=None)¶
Return the number of standard permutations of given profile
INPUT:
profile
- an integer partition such that the its sum plus its length is congruent to 0 modulo 2marking
- either None, an element of the profile or a 3-tuple(1, n1, a)
or(2, n1, n2)
EXAMPLES:
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rcc
A ValueError is raised if the partition does not satisfy the requirement:
sage: rcc.gamma_std([5,2]) Traceback (most recent call last): ... ValueError: the sum of the profile (=[5, 2]) plus its length must be congruent to 0 modulo 2
The Rauzy classes associated to connected strata in genus 3:
sage: from surface_dynamics import Stratum sage: cc = Stratum([1,1,1,1], k=1).unique_component() sage: d = cc.rauzy_diagram() sage: d Rauzy diagram with 1255 permutations sage: sum(1 for _ in filter(lambda x: x.is_standard(), d)) == rcc.gamma_std([2,2,2,2]) True sage: cc = Stratum([2,1,1], k=1).unique_component() sage: d = cc.rauzy_diagram() sage: d Rauzy diagram with 2177 permutations sage: sum(1 for _ in filter(lambda x: x.is_standard(), d)) == rcc.gamma_std([3,2,2]) True sage: cc = Stratum([3,1], k=1).unique_component() sage: d = cc.rauzy_diagram() sage: d Rauzy diagram with 770 permutations sage: sum(1 for _ in filter(lambda x: x.is_standard(), d)) == rcc.gamma_std([4,2]) True
The non connected strata in genus 3:
sage: cc_odd = Stratum([2,2], k=1).odd_component() sage: cc_hyp = Stratum([2,2], k=1).hyperelliptic_component() sage: d_odd = cc_odd.rauzy_diagram() sage: d_hyp = cc_hyp.rauzy_diagram() sage: d_odd Rauzy diagram with 294 permutations sage: d_hyp Rauzy diagram with 63 permutations sage: n_odd = sum(1 for _ in filter(lambda x: x.is_standard(), d_odd)) sage: n_hyp = sum(1 for _ in filter(lambda x: x.is_standard(), d_hyp)) sage: n_odd + n_hyp == rcc.gamma_std([3,3]) True sage: cc_odd = Stratum([4], k=1).odd_component() sage: cc_hyp = Stratum([4], k=1).hyperelliptic_component() sage: d_odd = cc_odd.rauzy_diagram() sage: d_hyp = cc_hyp.rauzy_diagram() sage: d_odd Rauzy diagram with 134 permutations sage: d_hyp Rauzy diagram with 31 permutations sage: n_odd = sum(1 for _ in filter(lambda x: x.is_standard(), d_odd)) sage: n_hyp = sum(1 for _ in filter(lambda x: x.is_standard(), d_hyp)) sage: n_odd + n_hyp == rcc.gamma_std([5]) True
- surface_dynamics.interval_exchanges.rauzy_class_cardinality.spin_difference_for_irreducible_permutations(profile, marking=None)¶
Spin difference for the given profile and marking
EXAMPLES:
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rcc
The non connected strata in genus 3:
sage: from surface_dynamics import Stratum sage: c_odd = Stratum([2,2], k=1).odd_component() sage: c_hyp = Stratum([2,2], k=1).hyperelliptic_component() sage: c_odd.rauzy_diagram() Rauzy diagram with 294 permutations sage: c_hyp.rauzy_diagram() Rauzy diagram with 63 permutations sage: rcc.delta_irr([3,3]) == 294 - 63 True sage: c_odd = Stratum([4], k=1).odd_component() sage: c_hyp = Stratum([4], k=1).hyperelliptic_component() sage: c_odd.rauzy_diagram() Rauzy diagram with 134 permutations sage: c_hyp.rauzy_diagram() Rauzy diagram with 31 permutations sage: rcc.delta_irr([5]) == 134 - 31 True
A non connected strata in genus 4:
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rdc sage: a = Stratum([6], k=1) sage: c_hyp = a.hyperelliptic_component() sage: c_odd = a.odd_component() sage: c_even = a.even_component() sage: c_hyp.rauzy_diagram() Rauzy diagram with 127 permutations sage: c_hyp.rauzy_class_cardinality() 127 sage: c_odd.rauzy_diagram() Rauzy diagram with 5209 permutations sage: c_odd.rauzy_class_cardinality() 5209 sage: c_even = a.even_component() sage: c_even.rauzy_diagram() Rauzy diagram with 2327 permutations sage: c_even.rauzy_class_cardinality() 2327 sage: 5209 - 2327 - 127 2755 sage: rdc.delta_irr([7]) 2755
An example with a very big Rauzy class:
sage: c = Stratum([6,6], k=1).odd_component() sage: c.rauzy_class_cardinality() 11609364656
- surface_dynamics.interval_exchanges.rauzy_class_cardinality.spin_difference_for_standard_permutations(profile, marking=None)¶
Return the difference odd-even in the given stratum
INPUT:
p
- partition with odd termsmarking
- a 3-tuple(1, n1, a)
or(2, n1, n2)
EXAMPLES:
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rcc
A ValueError is raised if the partition does not fulfill the requirement:
sage: rcc.delta_std([5,2]) Traceback (most recent call last): ... ValueError: the profile (=[5, 2]) must contain only odd numbers
Non connected strata in genus 3 has two connected components distinguished by their spin parity:
sage: from surface_dynamics import Stratum sage: cc_odd = Stratum([2,2], k=1).odd_component() sage: cc_hyp = Stratum([2,2], k=1).hyperelliptic_component() sage: d_odd = cc_odd.rauzy_diagram() sage: d_hyp = cc_hyp.rauzy_diagram() sage: d_odd Rauzy diagram with 294 permutations sage: d_hyp Rauzy diagram with 63 permutations sage: n_odd = sum(1 for _ in filter(lambda x: x.is_standard(), d_odd)) sage: n_hyp = sum(1 for _ in filter(lambda x: x.is_standard(), d_hyp)) sage: n_odd - n_hyp == rcc.delta_std([3,3]) True sage: cc_odd = Stratum([4], k=1).odd_component() sage: cc_hyp = Stratum([4], k=1).hyperelliptic_component() sage: d_odd = cc_odd.rauzy_diagram() sage: d_hyp = cc_hyp.rauzy_diagram() sage: d_odd Rauzy diagram with 134 permutations sage: d_hyp Rauzy diagram with 31 permutations sage: n_odd = sum(1 for _ in filter(lambda x: x.is_standard(), d_odd)) sage: n_hyp = sum(1 for _ in filter(lambda x: x.is_standard(), d_hyp)) sage: n_odd - n_hyp == rcc.delta_std([5]) True
- surface_dynamics.interval_exchanges.rauzy_class_cardinality.split(p, k, i=0)[source]¶
Splits the i-th term of p into two parts of size k and n-k-1
There is a symmetry split(p, k, i) = split(p, p[i]-k-1, i)
INPUT:
p
- a partitionk
- an integer between 2 and p[i]i
- integer - the index of the element to split
OUTPUT: a partition
EXAMPLES:
sage: import surface_dynamics.interval_exchanges.rauzy_class_cardinality as rcc sage: p = Partition([5,1]) sage: rcc.split(p,1,0) [3, 1, 1] sage: rcc.split(p,2,0) [2, 2, 1] sage: rcc.split(p,3,0) [3, 1, 1]