<jupyter_start><jupyter_text>Partitions Notebook Used for experimenting with SageMath's `partition.py` module. ([Documentation](https://doc.sagemath.org/html/en/reference/combinat/sage/combinat/partition.html), [Source Code](https://github.com/sagemath/sage/blob/master/src/sage/combinat/partition.py))  The `Partition` Class - individual partitionsAn instance of the `Partition` class can be constructed in one of the following ways:- list of parts (the default) - e.g. `Partition([6,3,1])`- `'exp'` keyword argument - exponential notation- `'frobenius_coordinates'` keyword argument- `'zero_one'` keyword argument - 0−1 sequence - `'core'` and `'quotient'` keyword argument- `'beta_numbers'``Partition` instances constructed in this way will be elements of the category of all partitions (no restrictions)<jupyter_code># If we create a partition with extra zeros at the end, they will be dropped:
Partition([4,1,0,0]) # [4,1]

# The idea of a partition being followed by infinitely many parts of size 0 is consistent with the get_part method:
p = Partition([5, 2])
p.get_part(0) # 5
p.get_part(10) # 0

# We can go back and forth between the standard and the exponential notations of a partition. 
# The exponential notation can be padded with extra zeros:
Partition([6,4,4,2,1]).to_exp() # [1, 1, 0, 2, 0, 1]
Partition(exp=[1,1,0,2,0,1]) # [6, 4, 4, 2, 1]
Partition([6,4,4,2,1]).to_exp(5) # [1, 1, 0, 2, 0, 1]
Partition([6,4,4,2,1]).to_exp(7) # [1, 1, 0, 2, 0, 1, 0]
Partition([6,4,4,2,1]).to_exp(10) # [1, 1, 0, 2, 0, 1, 0, 0, 0, 0]

# We can get the (zero-based!) coordinates of the corners of a partition:
Partition([4,3,1]).corners() # [(0, 3), (1, 2), (2, 0)]

Partition([2,1]).content(1,0) # -1
p = Partition([3,2])
sum([p.content(*c) for c in p.cells()]) # 2

# return the 3-residue of a cell
Partition([2,1]).content(1,0, multicharge=[IntegerModRing(3)(0)]) # 2

Partition([2,1]).contents_tableau() # [[0, 1], [-1]]
Partition([3,2,1,1]).contents_tableau().pp() 
# 0  1  2
#-1  0
#-2
#-3
Partition([3,2,1,1]).contents_tableau([ IntegerModRing(3)(0)] ).pp()
#0  1  2
#2  0
#1
#0<jupyter_output><empty_output><jupyter_text>Aside: Constructing partitions through parentsGiven an instance of the `Partitions` class, elements of it can be constructed using the following methods: e.g.- `Partitions()(list(mu))`- `Partitions().from_beta_numbers(beta)`- `Partitions().from_exp(exp)`- `Partitions().from_frobenius_coordinates(frobenius_coordinates)`- `Partitions().from_zero_one(seq)`- `Partitions().from_core_and_quotient(core, quotient)` Methods Conversion- `to_exp(l)` pads with extra zeroes if $l > \text{max_part(self)}$; `to_exp_dict()`- `to_list()`- `frobenius_coordinates()`- `beta_numbers(length=None) `- `core(k)`, `quotient(k)`- `to_dyck_word(n=None)` - Dyck path encoding is {N:1, E:0}, opposite to `zero_one_sequence()`- `zero_one_sequence()` - {N:0, E:1} path encoding Categorical, comparison- `parent()`- `category()`- `up_list()`, `down_list()`- `dominates(p)`- `dominated_partitions(rows=None)`- `contains(p)`- `is_empty()`- `is_core(k)`- `is_regular(e)`- `is_restricted(l)` - A partition is $l$-restricted iff $p[i] - p[i+1]  -l$ for all $i$, i.e. $l$-restricted is the same as min_slope > $-l$- `larger_lex(p)`Statistics- `get_part(n)` returns $0$ if $n > \text{length(self)}$- `size()`, `length()`- `arm_length(i,j)`, `leg_length(i,j)`, `hook_length(i,j)`- `arms_legs_coeff(i, j)`- `frobenius_rank()`- `content(r, c, multicharge=(0, ))` - returns $c - r$ with residue option- `residue(r, c, l)` returns $c - r \ (\mathrm{mod}\ l)$Cells- `cells()`- `corners() = inside_corners() = removable_cells()` (for compatibility with partition tuples)- `outside_corners() = addable_cells()` - also known as cocorners- `corners_residue(i, l) = removable_cells_residue(i, l) = inside_corners_residue(i, l)`- `outside_corners_residue(i, l) = addable_cells_residue(i, l)`- `arm_cells(i,j)`, `leg_cells(i,j)`- `rim()` (i.e. inner/border rim of cells), `outer_rim()`Transformation- `conjugate()`- `add_cell(i, j=None)`, `remove_cell(i, j=None)` - returns a new partition, does not change `self`- `add_horizontal_border_strip(k)`, `add_vertical_border_strip(k)` returns a list of partitions- `remove_horizontal_border_strip(k)`- `up()`, `down()`, `up_list()`, `down_list()`Tableau- `ferrers_diagram()` - returns string- `pp()` - pretty print Ferrers diagram in English notation- `arm_lengths(flat=False)`, `leg_lengths(flat=False)`, `hook_lengths()`- `contents_tableau(multicharge=(0, ))`Maybe useful- `outline(variable=None)` returns piecewise linear function drawing outline in Russian notation - could be used for drawing- `attacking_pairs()` I wonder about the applications- `block(e, multicharge=(0,))` related to cores and quotients; $e$ is the modulus- `defect(e, multicharge=(0, ))` related to quotients, uses `block`- `dimension(smaller=[], k=1)` related to cores and quotients- `cell_poset(orientation='SE')` returns a poset, applications to abacus?Probably irrelevant - Representation theory, etc.- `atom()` I don't really understand what this does - related to tableau- `centralizer_size(t=0,q=0) = aut(t=0,q=0)`- `character_polynomial()`- `conjugacy_class_size()`- `crank()`- `degree(e)`- `dual_equivalence_graph(directed=False, coloring=None)`- `evaluation()` same as `to_exp()`- `from_kbounded_to_grassmannian(k)`- `garnir_tableau(*cell)`<jupyter_code>p = Partition([5, 2])
for row in p.contents_tableau():
    print(row)
p.to_dyck_word()
latex(Partition([5, 2]))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18414368650217708, 'fraction_numerical': 0.02830188679245283, 'mean_word_length': 6.15974025974026, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 12, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '183454', 'license': 'MIT', 'n_tokens_mistral': 2174, 'n_tokens_neox': 2014, 'n_words': 532, 'path': 'sage-partitions.ipynb', 'repo_name': 'edwardmpearce/pyparti', 'size': '5512'}