查看“︁史特靈公式”︁的源代码
←
史特靈公式
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{noteTA |1=zh-hans:斯特林;史特靈 |G1=Math |G2=IT |G4=People }} [[File:Stirling's Approximation.svg|thumb|right|270px|当''n''增加时,(ln ''n''!)与o (''n'' ln ''n'' − ''n'')之比趋于1]] {{函數圖形|title=階乘與史特靈公式|width=200|height=100|number class=複數|nonreal is nan=1|round number=8 |start=-0.815513|end=2.85236|min=0|max=5|sampling=200 |1 = gamma(x+1) | 1 name=n! |2 = sqrt(2*pi*x)*(x/e)^x*((sgn(x)+1)/(sgn(x)+1)) | 2 name=√(2 pi n)(n/e)^n |caption=<math>n!</math>(藍色)、<math>\sqrt{2\pi n}\left(\frac{n}{e}\right)^n</math>(橘色),數字越大<math>\sqrt{2\pi n}\left(\frac{n}{e}\right)^n,</math>會越趨近<math>n!</math>。但<math>\sqrt{2\pi n}\left(\frac{n}{e}\right)^n</math>在負值則會因為出現虛數而無法使用}} '''史特靈公式'''({{lang-en|'''Stirling's formula'''}})是一條用來取n[[階乘]][[近似值]]的[[數學]][[公式]]。一般來說,當n很大的時候,n階乘的計算量十分大,所以史特靈公式十分好用,而且,即使在n很小的時候,史特靈公式的取值已經十分準確。這個公式以{{le|詹姆斯·史特靈 (數學家)|James Stirling (mathematician)|詹姆斯·史特靈}}的名字命名,雖然[[亞伯拉罕·棣美弗]]早於史特靈提出了一個類似的公式,但結果較不精確。<ref name=dutka>{{citation | last = Dutka | first = Jacques | year = 1991 | title = The early history of the factorial function | journal = [[Archive for History of Exact Sciences]] | volume = 43 | issue = 3 | pages = 225–249 | doi = 10.1007/BF00389433}}</ref><ref name=LeCam1986>{{citation | last = Le Cam | first = L. | author-link = Lucien Le Cam | doi = 10.1214/ss/1177013818 | issue = 1 | journal = Statistical Science | jstor = 2245503 | mr = 833276 | pages = 78–96 | title = The central limit theorem around 1935 | volume = 1 | year = 1986}}; see p. 81, "The result, obtained using a formula originally proved by de Moivre but now called Stirling's formula, occurs in his 'Doctrine of Chances' of 1733."</ref><ref name=Pearson1924>{{citation |last=Pearson |first=Karl |year=1924 |title=Historical note on the origin of the normal curve of errors |journal=Biometrika |volume=16 |issue=3/4 |pages=402–404 [p. 403] |quote=I consider that the fact that Stirling showed that De Moivre's arithmetical constant was <math>\sqrt{2\pi}</math> does not entitle him to claim the theorem, [...] |doi=10.2307/2331714|jstor=2331714 }}</ref> 史特靈公式为: :<math>n! \approx \sqrt{2\pi n}\, \left(\frac{n}{e}\right)^{n}.</math> 这就是说,对于足够大的整数''n'',这两个数互为近似值。更加精确地: :<math>\lim_{n \rightarrow \infty} {\frac{n!}{\sqrt{2\pi n}\, \left(\frac{n}{e}\right)^{n}}} = 1</math> 或 :<math>\lim_{n \rightarrow \infty} {\frac{e^n\, n!}{n^n \sqrt{n}}} = \sqrt{2 \pi}.</math> == 历史 == 这个公式是[[亚伯拉罕·棣莫弗]]首先发现的,形式为: :<math>\displaystyle n! \approx c n^{n+\frac{1}{2}} e^{-n}</math>,其中c為常數。 {{link-en|斯特林 (数学家)|James_Stirling_(mathematician)|斯特林}}证明了公式中<math>c=\sqrt{2\pi}</math>,約為{{複變運算|sqrt(2*pi)}}。更加精确的形式是[[雅克·比内]]发现的。 == 推导 == === 方法一 === 这个公式,以及误差的估计,可以推导如下。首先不直接估计''n''!,而是考虑它的[[自然对数]]: :<math>\ln (n!) = \ln 1 + \ln 2 + \cdots + \ln n. </math> 即: :<math>\ln (n!) - \frac{\ln n}{2} = \ln 1 + \ln 2 + \cdots + \ln n - \frac{\ln n}{2}. </math> 这个方程的右面是积分<math>\int_1^n \ln(x)\,dx = n \ln n - n + 1</math>的近似值(利用[[梯形法则]]),而它的[[误差]]由[[欧拉-麦克劳林公式]]给出: :<math>\ln (n!) - \frac{\ln n}{2} = \ln 1 + \ln 2 + \cdots + \ln(n-1) + \frac{\ln n}{2} = n \ln n - n + 1 + \sum_{k=2}^{m} \frac{B_k {(-1)}^k}{k(k-1)} \left( \frac{1}{n^{k-1}} - 1 \right) + R_{m,n}.</math> 其中''B''<sub>''k''</sub>是[[伯努利数]],''R''<sub>m,n</sub>是欧拉-麦克劳林公式中的余项。取极限,可得: :<math>\lim_{n \to \infty} \left( \ln n! - n \ln n + n - \frac{\ln n}{2} \right) = 1 - \sum_{k=2}^{m} \frac{B_k {(-1)}^k}{k(k-1)} + \lim_{n \to \infty} R_{m,n}.</math> 把这个极限记为''y''。由于欧拉-麦克劳林公式中的余项''R''<sub>''m'',''n''</sub>满足: :<math>R_{m,n} = \lim_{n \to \infty} R_{m,n} + O \left( \frac{1}{n^{2m-1}} \right),</math> 其中用到了[[大O符号]],与以上的方程结合,便得出对数形式的近似公式: :<math>\ln n! = n \ln \left( \frac{n}{e} \right) + \frac{\ln n}{2} + y + \sum_{k=2}^{m} \frac{B_k {(-1)}^k}{k(k-1)n^{k-1}} + O \left( \frac{1}{n^{2m-1}} \right).</math> 两边取指数,并选择任何正整数''m'',便得到了一个含有未知数''e''<sup>''y''</sup>的公式。当''m''=''1''时,公式为: :<math>n! = e^{y} \sqrt{n}~{\left( \frac{n}{e} \right)}^n \left[ 1 + O \left( \frac{1}{n} \right) \right]</math> 将上述表达式代入[[沃利斯乘积]]公式,并令''n''趋于无穷,便可以得出''e''<sup>''y''</sup>(<math>e^y = \sqrt{2 \pi}</math>)。因此,我们便得出斯特林公式: :<math>n! = \sqrt{2 \pi n}~{\left( \frac{n}{e} \right)}^n \left[ 1 + O \left( \frac{1}{n} \right) \right]</math> 这个公式也可以反复使用[[分部积分法]]来得出,首项可以通过[[最速下降法]]得到。把以下的和 :<math>\ln(n!) = \sum_{j=1}^{n} \ln j</math> 用积分近似代替,可以得出不含<math>\sqrt{2 \pi n}</math>的因子的斯特林公式(这个因子通常在实际应用中无关): :<math>\sum_{j=1}^{n} \ln j \approx \int_1^n \ln x \, dx = n\ln n - n + 1.</math> === 方法二 === 考虑如下近似关系: :<math>\begin{align}\ln n!&=\sum_{k=1}^n\ln k\\&\approx\int_1^n\ln x\mathrm dx=n\ln n-n+1\\&\approx n\ln n-n\end{align}</math> 以及阶乘的积分形式([[Γ函数]]): :<math>n!=\int_0^\infty\mathrm e^{-x}x^n\mathrm dx</math> 其中被积函数取对数后求导结果可写成: :<math>\frac{\mathrm d}{\mathrm dx}\ln(\mathrm e^{-x}x^n)=\frac{\mathrm d}{\mathrm dx}(n\ln x-x)=\frac nx-1</math> 因此被积函数只有在<math>x=n</math>附近才趋于平稳,现令<math>x\equiv n+\xi</math>且<math>\xi\ll n</math>,并改写成如下形式: :<math>\ln(x^n\mathrm e^{-x})=n\ln x-x=n\ln(n+\xi)-(n+\xi)</math> 于是有: :<math>\begin{align}\ln(n+\xi)&=\ln\left[n\left(1+\frac\xi n\right)\right]=\ln n+\ln\left(1+\frac\xi n\right)\\&=\ln n+\frac\xi n-\frac{\xi^2}{2n^2}+\cdots\end{align}</math> 因此可以得到: :<math>\begin{align}\ln(x^n\mathrm e^{-x})&=n\ln(n+\xi)-(n+\xi)\\&=n\ln n+\xi-\frac{\xi^2}{2n}-n-\xi+\cdots\\&=n\ln n-n-\frac{\xi^2}{2n}+\cdots\end{align}</math> 两边同时作[[指数函数]]运算,变成: :<math>\begin{align}x^n\mathrm e^{-x}&\approx\mathrm e^{n\ln n}\mathrm e^{-n}\mathrm e^{-\frac{\xi^2}{2n}}\\&=n^n\mathrm e^{-n}\mathrm e^{-\frac{\xi^2}{2n}}\end{align}</math> 代入到阶乘的积分表示形式,得到: :<math>\begin{align}n!&\approx\int_{-n}^\infty n^n\mathrm e^{-n}\mathrm e^{-\frac{\xi^2}{2n}}\mathrm d\xi\\&\approx n^n\mathrm e^{-n}\int_{-\infty}^\infty\mathrm e^{-\frac{\xi^2}{2n}}\mathrm d\xi\end{align}</math> 约等号后侧得到的是[[高斯积分]]的形式,计算该积分得出斯特林公式: :<math>n!\approx n^n\mathrm e^{-n}\sqrt{2\pi n}</math> == 收敛速率和误差估计 == [[File:StirlingError1.svg|right|thumb|y轴表示截断的斯特林级数的相对误差,x轴表示所使用的项数。]] 更加精确的近似公式为: :<math>n! = \sqrt{2 \pi n} \; \left(\frac{n}{e}\right)^{n}e^{\lambda_n}</math> 其中: :<math>\frac{1}{12n+1} < \lambda_n < \frac{1}{12n}.</math> 斯特林公式实际上是以下级数(现在称为'''斯特林级数''')的第一个近似值: :<math> n!=\sqrt{2\pi n}\left({n\over e}\right)^n \left( 1 +{1\over12n} +{1\over288n^2} -{139\over51840n^3} -{571\over2488320n^4} + \cdots \right). </math> 当<math>n \to \infty</math>时,截断级数的误差等于第一个省略掉的项。这是[[渐近展开式]]的一个例子。它不是一个[[收敛级数]];对于任何特殊值''n'',级数的准确性只在取有限个项时达到最大,如果再取更多的项,则准确性将变得越来越差。 阶乘的对数的渐近展开式也称为斯特林级数: :<math> \ln n!=n\ln n - n + {1\over 2}\ln(2\pi n) +{1\over12n} -{1\over360n^3} +{1\over1260n^5} -{1\over 1680n^7} +\cdots. </math> 在这种情况下,级数的误差总是与第一个省略掉的项异号,且最多同大小。 == 伽玛函数的斯特林公式 == 对于所有正整数,有: :<math>n! = \Pi(n) = \Gamma(n+1).</math> 然而,[[伽玛函数]]与阶乘不一样,它对于所有复数都有定义。尽管如此,斯特林公式仍然适用。如果<math>\Re(z) > 0</math>,那么: :<math>\ln \Gamma (z) = \left(z-\frac12\right)\ln z -z + \frac{\ln {2 \pi}}{2} + 2 \int_0^\infty \frac{\arctan \frac{t}{z}}{\exp(2 \pi t)-1}\, dt.</math> 反复使用分部积分法,可得以下渐近展开式: :<math>\ln \Gamma (z) = \left(z-\frac12\right)\ln z -z + \frac{\ln {2 \pi}}{2} + \sum_{n=1}^\infty \frac{(-1)^{n-1}B_{n}}{2n(2n-1)z^{2n-1}}</math> 其中''B''<sub>''n''</sub>是第n个[[伯努利数]]。当<math>|\arg z| < \pi - \epsilon</math>,其中ε是正数时,这个公式对于绝对值足够大的''z''是适用的,当使用了最初''m''个项时,误差项为<math>O\left(z^{-m - \frac{1}{2}}\right)</math>。对应的近似值可以写为: :<math>\Gamma(z) = \sqrt{\frac{2 \pi}{ z}}~{\left( \frac{z}{e} \right)}^z \left[ 1 + O \left( \frac{1}{z} \right) \right].</math> == 斯特林公式的收敛形式 == 欲得出斯特林公式的一个收敛形式,我们必须计算: :<math>\int_0^\infty \frac{2\arctan \frac{t}{z}}{\exp(2 \pi t)-1}\, dt = \ln\Gamma (z) - \left( z-\frac12 \right) \ln z +z - \frac12\ln(2\pi). </math> 一种方法是利用含有[[阶乘幂|上升阶乘幂]]的级数。如果<math>z^{\overline n} = z(z+1) \cdots (z+n-1)</math>,那么: :<math>\int_0^\infty \frac{2\arctan \frac{t}{z}}{\exp(2 \pi t)-1} \, dt = \sum_{n=1}^\infty \frac{c_n}{(z+1)^{\overline n}}</math> 其中: :<math> c_n = \frac{1}{n} \int_0^1 x^{\overline n} \left( x-\frac12 \right) \, dx.</math> 从中可以得出斯特林级数的一个收敛形式: :<math>\ln \Gamma (z) = \left( z-\frac12 \right) \ln z -z + \frac{\ln {2 \pi}}{2} </math> :::<math>{} + \frac{1}{12(z+1)} + \frac{1}{12(z+1)(z+2)} + \frac{59}{360(z+1)(z+2)(z+3)} + \frac{29}{60(z+1)(z+2)(z+3)(z+4)} + \cdots</math> 它在<math>\Re(z)>0</math>时收敛。 == 适用于计算器的形式 == 以下的近似值 :<math>\Gamma(z) \approx \sqrt{\frac{2 \pi}{z} } \left( \frac{z}{e} \sqrt{ z \sinh \frac{1}{z} + \frac{1}{810z^6} } \right)^{z},</math> 或 :<math>2 \ln \Gamma(z) \approx \ln(2 \pi) - \ln z + z \left[2 \ln z + \ln \left( z \sinh \frac{1}{z} + \frac{1}{810z^6} \right) - 2 \right],</math> 可以通过把斯特林公式整理,并注意到它的幂级数与[[双曲正弦]]函数的[[泰勒级数]]展开式的相似性来得出。当''z''的实数部分大于8时,这个近似值精确到小数点后8位。2002年,Robert H. Windschitl建议计算器用这个公式来计算伽玛函数。 Gergő Nemes在2007年提出了一个近似公式,它的精确度与Windschitl的公式相等,但更加简单: :<math>\Gamma(z) \approx \sqrt{\frac{2 \pi}{z} } \left[ \frac{1}{e} \left( z + \frac{1}{12z- \frac{1}{10z}} \right) \right]^{z},</math> 或 :<math> \ln \Gamma(z) \approx \frac{1}{2} \left[\ln(2 \pi) - \ln z \right] + z \left[\ln \left( z + \frac{1}{12z- \frac{1}{10z}} \right)-1\right] </math> == 参考文献 == * Abramowitz, M. and Stegun, I., ''Handbook of Mathematical Functions'', http://www.math.hkbu.edu.hk/support/aands/toc.htm{{Wayback|url=http://www.math.hkbu.edu.hk/support/aands/toc.htm |date=20080926174851 }} * 夏慧異,章家順, ''史特靈公式在高等數學中的應用'', http://ordostsg.org.cn:1080/KCMS/detail/detail.aspx?filename=XUSJ200904014&dbcode=CJFR&dbname= * Paris, R. B., and Kaminsky, D., ''Asymptotics and the Mellin-Barnes Integrals'', Cambridge University Press, 2001 * Whittaker, E. T., and Watson, G. N., ''A Course in Modern Analysis'', fourth edition, Cambridge University Press, 1963. ISBN 0-521-58807-3 * {{Cite web | url=http://www.rskey.org/gamma.htm | author= Viktor T. Toth | title="Programmable Calculators: Calculators and the Gamma Function"| year=2006 |accessdate=2018-11-18 | archive-url=https://web.archive.org/web/20070223105756/http://www.rskey.org/gamma.htm | archive-date=2007-02-23}}, modified 2006 * {{MathWorld | urlname=StirlingsApproximation | title=Stirling's Approximation}} * {{PlanetMath | urlname=StirlingsApproximation | title=Stirling's approximation}} [[Category:逼近]] [[Category:渐近分析]] [[Category:解析数论]] [[Category:伽玛及相关函数]] [[Category:分析定理]]
该页面使用的模板:
Template:Citation
(
查看源代码
)
Template:Cite web
(
查看源代码
)
Template:Lang-en
(
查看源代码
)
Template:Le
(
查看源代码
)
Template:Link-en
(
查看源代码
)
Template:MathWorld
(
查看源代码
)
Template:NoteTA
(
查看源代码
)
Template:PlanetMath
(
查看源代码
)
Template:Wayback
(
查看源代码
)
Template:函數圖形
(
查看源代码
)
Template:複變運算
(
查看源代码
)
返回
史特靈公式
。
导航菜单
个人工具
登录
命名空间
页面
讨论
不转换
查看
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
特殊页面
工具
链入页面
相关更改
页面信息