排列的分拆
Partitions over Permutations

原始链接: https://www.johndcook.com/blog/2026/06/04/partitions-over-permutations/

作者探讨了高斯近似 $e^{-z^2} \approx \frac{1 + \cos(\sin(z) + z)}{2}$ 的行为,指出该近似在实轴上虽然准确,但在虚轴上会显著发散,表现得如同 $e^{e^y}$。 这引出了对双指数函数 $e^{e^x}$ 幂级数的分析。该级数中第 $n$ 项的系数为 $e \cdot \frac{B_n}{n!}$,其中 $B_n$ 是第 $n$ 个贝尔数(代表标记集合的划分),而 $n!$ 是排列数。由于集合划分数量的增长速度几乎与排列数相当,该级数的收敛速度非常缓慢。作者提供了一个简单的 SymPy 实现来计算这一比值,并以利用 Lambert $W$ 函数进行的渐近分析作为总结,用以描述当 $n$ 增加时 $\frac{B_n}{n!}$ 的增长情况。

Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 置换的分区 (johndcook.com) 5 分,由 ibobev 发布于 2 小时前 | 隐藏 | 过往 | 收藏 | 讨论 帮助 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

I was thinking more about the cosine approximation to the Gaussian

exp(−z²) ≈ (1 + cos(sin(z) + z))/2

that I wrote about last week. The two expressions above are close along the real axis but not along the imaginary axis.

If ziy, the right side grows much faster than the left, behaving like exp(exp(y)).

This led to me looking up the power series for the double exponential function exp(exp(y)). This is an interesting series because the coefficient of xn is

e Bn / n!

where Bn is the nth Bell number, which equals the number of ways to partition a set of n labeled items [1]. And of course n! is the number of ways to permute a set of n labeled items. So the nth coefficient in the power series for exp(exp(y)) is the ratio of the number of partitions to permutations for a set of n labeled things, multiplied by e.

The number of ways to partition a set of n things grows quickly as n increases, almost as quickly as the number of permutations, and so the series for the double exponential function converges very slowly.

Computing

SymPy has a function bell for computing Bell numbers, so you could compute the ratio of partitions to permutations as follows.

from sympy import bell, factorial
f = lambda n: bell(n)/factorial(n)

This returns a number of type sympy.core.numbers.Rational and so the result is exact. You can cast it to float for convenience.

Asymptotics

If we look at only the terms in the asymptotic series for log Bn and log n! that grow with n we have

log Bn ~ n log n − n log log n
log n! ~ n log n − ½ log n

and so

log( Bnn! ) ~ ½ log n − n log log n

There’s also an asymptotic series for log( Bnn! ) involving the Lambert W function:

log( Bnn! ) ~ n/r − 1 − n log r

where r = W(n).

Related posts

[1] It’s important that the items are labeled. Partition numbers are the number of partitions of an unlabeled set. Partition numbers are much smaller than Bell numbers.

联系我们 contact @ memedata.com