Skip to content

Commit 52e366b

Browse files
committed
initial version of the Franklin-Glaisher bijection
1 parent ab1a517 commit 52e366b

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

src/sage/combinat/partition.py

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,6 +2485,95 @@ def conjugate(self):
24852485
par = Partitions_n(sum(self))
24862486
return par.element_class(par, conjugate(self))
24872487

2488+
def franklin_glaisher(self, s):
2489+
r"""
2490+
Apply the Franklin-Glaisher bijection to ``self``.
2491+
2492+
INPUT:
2493+
2494+
- ``s`` -- positive integer
2495+
2496+
OUTPUT:
2497+
2498+
The Franklin-Glaisher bijection, with parameter `s`, returns
2499+
a partition whose set of parts that are repeated at least `s`
2500+
times equals the set of parts divisible by `s` in ``self``,
2501+
after dividing each part by `s`.
2502+
2503+
EXAMPLES::
2504+
2505+
sage: Partition([4, 3, 2, 2, 1]).franklin_glaisher(2)
2506+
[3, 2, 2, 1, 1, 1, 1, 1]
2507+
2508+
TESTS::
2509+
2510+
sage: d = lambda la, s: set(p / s for p in la if p % s == 0)
2511+
sage: r = lambda la, s: set(p for p in la if list(la).count(p) >= s)
2512+
sage: all(d(mu, s) == r(mu.franklin_glaisher(s), s)
2513+
....: for n in range(20) for mu in Partitions(n)
2514+
....: for s in range(1, 5))
2515+
True
2516+
"""
2517+
mu = []
2518+
for p, m in enumerate(self.to_exp(), 1):
2519+
if not p % s:
2520+
mu.extend([p//s]*(m*s))
2521+
else:
2522+
mu.extend(p * v * s**i for i, v in enumerate(m.digits(s)) if v)
2523+
2524+
P = self.parent()
2525+
return P.element_class(P, sorted(mu, reverse=True))
2526+
2527+
def franklin_glaisher_inverse(self, s):
2528+
r"""
2529+
Apply the inverse of the Franklin-Glaisher bijection to ``self``.
2530+
2531+
INPUT:
2532+
2533+
- ``s`` -- positive integer
2534+
2535+
OUTPUT:
2536+
2537+
The inverse of the Franklin-Glaisher bijection, with
2538+
parameter `s`, returns a partition whose set of parts that
2539+
are divisible by `s`, after dividing each by `s`, equals the
2540+
equals the set of parts repeated at least `s` times in
2541+
``self``.
2542+
2543+
EXAMPLES::
2544+
2545+
sage: Partition([4, 3, 2, 2, 1]).franklin_glaisher(2)
2546+
[3, 2, 2, 1, 1, 1, 1, 1]
2547+
sage: Partition([3, 2, 2, 1, 1, 1, 1, 1]).franklin_glaisher_inverse(2)
2548+
[4, 3, 2, 2, 1]
2549+
2550+
TESTS::
2551+
2552+
sage: d = lambda la, s: set(p / s for p in la if p % s == 0)
2553+
sage: r = lambda la, s: set(p for p in la if list(la).count(p) >= s)
2554+
sage: all(r(mu, s) == d(mu.franklin_glaisher_inverse(s), s)
2555+
....: for n in range(20) for mu in Partitions(n)
2556+
....: for s in range(1, 5))
2557+
True
2558+
"""
2559+
mu = []
2560+
nu = []
2561+
for p, m in enumerate(self.to_exp(), 1):
2562+
mu.extend([p*s]*(m // s))
2563+
nu.extend([p]*(m % s))
2564+
2565+
i = 0
2566+
while i < len(nu):
2567+
p = nu[i]
2568+
if not p % s:
2569+
del nu[i]
2570+
nu.extend([p // s]*s)
2571+
else:
2572+
i += 1
2573+
2574+
P = self.parent()
2575+
return P.element_class(P, sorted(mu + nu, reverse=True))
2576+
24882577
def suter_diagonal_slide(self, n, exp=1):
24892578
r"""
24902579
Return the image of ``self`` in `Y_n` under Suter's diagonal slide

0 commit comments

Comments
 (0)