|
2 | 2 | # Copyright Peter Luschny. License is MIT. |
3 | 3 | # This file includes parts from Combinatorics.jl in modified form. |
4 | 4 |
|
5 | | -# Version of: UTC 2019-10-24 09:31:01 |
6 | | -# 3af04a00-f630-11e9-1ccb-3f8b137e1871 |
| 5 | +# Version of: UTC 2019-10-26 10:41:45 |
| 6 | +# 71458000-f7cc-11e9-0078-e76d536f0017 |
7 | 7 |
|
8 | 8 | # Do not edit this file, it is generated from the modules and will be overwritten! |
9 | 9 | # Edit the modules in the src directory and build this file with BuildSequences.jl! |
@@ -123,6 +123,7 @@ ModuleSeqUtils, |
123 | 123 | ModuleSeriesExpansion, |
124 | 124 | ModuleSetPartitions, |
125 | 125 | ModuleSetPartitionsMType, |
| 126 | +ModuleSetPartitionsMType, |
126 | 127 | ModuleStirlingNumbers, |
127 | 128 | ModuleSwingFactorial, |
128 | 129 | ModuleTriangles, |
@@ -4764,7 +4765,7 @@ end |
4764 | 4765 | # *** IntPartitions.jl **************** |
4765 | 4766 | """ |
4766 | 4767 |
|
4767 | | -All integer partitions are listet by two orderings: |
| 4768 | +All integer partitions are listed by two orderings: |
4768 | 4769 | IntegerPartitions(n, byNumPart) |
4769 | 4770 | IntegerPartitions(n, byMaxPart) |
4770 | 4771 |
|
@@ -7881,6 +7882,45 @@ Return the numbers of partitions of an ``n``-set into nonempty subsets. |
7881 | 7882 | $(SIGNATURES) |
7882 | 7883 | """ |
7883 | 7884 | SetNumber(n::Int) = Int(Nemo.bell(n)) |
| 7885 | +# *** SetPartitionsByShape.jl **************** |
| 7886 | +""" |
| 7887 | +
|
| 7888 | +general Definition |
| 7889 | +
|
| 7890 | +* exported functions |
| 7891 | +""" |
| 7892 | +const ModuleSetPartitionsMType = "" |
| 7893 | +function P(m, n) |
| 7894 | +R, x = PolynomialRing(ZZ, "x") |
| 7895 | +function recP(m, n, x) |
| 7896 | +n == 0 && return R(1) |
| 7897 | +sum(binomial(m*n, m*k)*recP(m, n-k, x)*x for k in 1:n) |
| 7898 | +end |
| 7899 | +n == 0 && return [ZZ(1)] |
| 7900 | +p = recP(m, n, x) |
| 7901 | +[coeff(p, k) for k in 0:n] |
| 7902 | +end |
| 7903 | +function xmSetPartitions(m, n, k) |
| 7904 | +shapes = (map(x -> x*m, p) for p in IntegerPartitions(n, k)) |
| 7905 | +p = [] |
| 7906 | +if shapes != Nothing |
| 7907 | +for s in shapes |
| 7908 | +if s != Nothing |
| 7909 | +vcat(p, [p for p in SetPartitions(s)]) |>println |
| 7910 | +end end |
| 7911 | +end |
| 7912 | +end |
| 7913 | +function SP_byLength(m, n) |
| 7914 | +n == 0 && return [n] |
| 7915 | +[sum(mSetPartitions(m, n, k)) for k in 1:n] |
| 7916 | +end |
| 7917 | +function SP_byShape(m, n) |
| 7918 | +[p for k in 1:n for p in mSetPartitions(m, n, k)] |
| 7919 | +end |
| 7920 | +RowSum(m, n) = sum(SP_byLength(m, n)) |
| 7921 | +ARowSum(m, n) = sum((-1)^k*sum(mSetPartitions(m, n, k)) for k in 0:n) |
| 7922 | +Diagonal(m,n) = mSetPartitions(m, n, n)[0] |
| 7923 | +Central(m, n) = SP_byLength(m, 2n)[n] |
7884 | 7924 | # *** SetPartitionsMType.jl **************** |
7885 | 7925 | """ |
7886 | 7926 |
|
|
0 commit comments