1 | initial version |
One way to do that is using the conjugate partition.
For any partition, the conjugate partition is the one whose lines are the columns of p; analogue to the transpose for matrices.
Here is how to use it to remove vertical border strip.
sage: p = Partition([5,3,1])
sage: p
[5, 3, 1]
sage: unicode_art(p)
┌┬┬┬┬┐
├┼┼┼┴┘
├┼┴┘
└┘
sage: h = p.remove_horizontal_border_strip(1).list()
sage: h
[[5, 3], [5, 2, 1], [4, 3, 1]]
sage: unicode_art(q)
⎡ ┌┬┬┬┬┐ ┌┬┬┬┐ ⎤
⎢ ┌┬┬┬┬┐ ├┼┼┴┴┘ ├┼┼┼┘ ⎥
⎢ ├┼┼┼┴┘ ├┼┘ ├┼┴┘ ⎥
⎣ └┴┴┘ , └┘ , └┘ ⎦
sage: pc = p.conjugate()
sage: pc
[3, 2, 2, 1, 1]
sage: unicode_art(pc)
┌┬┬┐
├┼┼┘
├┼┤
├┼┘
├┤
└┘
sage: qq = [q.conjugate() for q in pc.remove_horizontal_border_strip(1)]
sage: qq
[[4, 3, 1], [5, 2, 1], [5, 3]]
sage: unicode_art(qq)
⎡ ┌┬┬┬┐ ┌┬┬┬┬┐ ⎤
⎢ ├┼┼┼┘ ├┼┼┴┴┘ ┌┬┬┬┬┐ ⎥
⎢ ├┼┴┘ ├┼┘ ├┼┼┼┴┘ ⎥
⎣ └┘ , └┘ , └┴┴┘ ⎦
To define a function to do it, just do:
def remove_vertical_border_strip(p, k):
pc = p.conjugate()
return [q.conjugate() for q in pc.remove_horizontal_border_strip(k)]
and then you can just do:
sage: p = Partition([5, 3, 1])
sage: qq = remove_vertical_border_strip(p, 1)
sage: unicode_art(qq)
⎡ ┌┬┬┬┐ ┌┬┬┬┬┐ ⎤
⎢ ├┼┼┼┘ ├┼┼┴┴┘ ┌┬┬┬┬┐ ⎥
⎢ ├┼┴┘ ├┼┘ ├┼┼┼┴┘ ⎥
⎣ └┘ , └┘ , └┴┴┘ ⎦
2 | No.2 Revision |
One way to do that is using the conjugate partition.
For any partition, the conjugate partition is the one whose lines are the columns of p; analogue to the transpose for matrices.
Here is how to use it to remove vertical border strip.
sage: p = Partition([5,3,1])
sage: p
[5, 3, 1]
sage: unicode_art(p)
┌┬┬┬┬┐
├┼┼┼┴┘
├┼┴┘
└┘
sage: h = p.remove_horizontal_border_strip(1).list()
sage: h
[[5, 3], [5, 2, 1], [4, 3, 1]]
sage: unicode_art(q)
⎡ ┌┬┬┬┬┐ ┌┬┬┬┐ ⎤
⎢ ┌┬┬┬┬┐ ├┼┼┴┴┘ ├┼┼┼┘ ⎥
⎢ ├┼┼┼┴┘ ├┼┘ ├┼┴┘ ⎥
⎣ └┴┴┘ , └┘ , └┘ ⎦
sage: pc = p.conjugate()
sage: pc
[3, 2, 2, 1, 1]
sage: unicode_art(pc)
┌┬┬┐
├┼┼┘
├┼┤
├┼┘
├┤
└┘
sage: qq = [q.conjugate() for q in pc.remove_horizontal_border_strip(1)]
sage: qq
[[4, 3, 1], [5, 2, 1], [5, 3]]
sage: unicode_art(qq)
⎡ ┌┬┬┬┐ ┌┬┬┬┬┐ ⎤
⎢ ├┼┼┼┘ ├┼┼┴┴┘ ┌┬┬┬┬┐ ⎥
⎢ ├┼┴┘ ├┼┘ ├┼┼┼┴┘ ⎥
⎣ └┘ , └┘ , └┴┴┘ ⎦
To One can define a function to do it, just do:corresponding function:
def remove_vertical_border_strip(p, k):
r"""
Return the partitions obtained from ``p`` by removing
a vertical border strip of length ``k``.
EXAMPLE::
sage: p = Partition([5, 3, 1])
sage: remove_vertical_border_strip(p, 1)
[[4, 3, 1], [5, 2, 1], [5, 3]]
"""
pc = p.conjugate()
return [q.conjugate() for q in pc.remove_horizontal_border_strip(k)]
and then you can just do:use that function:
sage: p = Partition([5, 3, 1])
sage: qq = remove_vertical_border_strip(p, 1)
sage: qq
[[4, 3, 1], [5, 2, 1], [5, 3]]
sage: unicode_art(qq)
⎡ ┌┬┬┬┐ ┌┬┬┬┬┐ ⎤
⎢ ├┼┼┼┘ ├┼┼┴┴┘ ┌┬┬┬┬┐ ⎥
⎢ ├┼┴┘ ├┼┘ ├┼┼┼┴┘ ⎥
⎣ └┘ , └┘ , └┴┴┘ ⎦