Closed form for n! Mathematics for Computer Science MIT 6.042J/18.062J n ∏ n! ::= 1 ⋅ 2 ⋅ 3 ⋅⋅⋅ (n-1) ⋅ n = i i=1 Factorials: Turn product into a sum taking logs: ln(n!) = ln( 1·2·3···(n – 1)·n ) = Stirling’s Formula ln 1 + ln 2 + · · · + ln(n – 1) + ln(n) n ∑ ln(i) = i= 1 Albert R Meyer, April 10, 2013 Albert R Meyer, April 10, 2013 stirling.1 stirling.2 Closed form for n! Closed form for n! n ∑ ln(i) Integral Method to bound n n n n ∑ ∫ ≤ ∑ ≤ ln(x) dx ln(i) ≤ ≤ nln +1 ln(i) i=1 e i=1 1 i=1 ln(x) ln n n … ln(x+1) n +1 ∫ (n +1)ln ln(x +1) dx +0.6 ln 5 ln 4 e ln ln 3 n-1 ln n 1 ln 2 ln 3 ln 4 ln 5 reminder: ln 2 … x ∫ lnxdx = x ln e 1 2 3 4 5 n–2 n–1 n Albert R Meyer, April 10, 2013 Albert R Meyer, April 10, 2013 stirling.3 stirling.4 1
Closed form for n! Stirling’s Formula n 1 n ∑ A precise approximation: ln(i) ≈ (n + )ln 2 e n i=1 2πn n n! ~ exponentiating: e n n ≈ n! n / e e Albert R Meyer, April 10, 2013 Albert R Meyer, April 10, 2013 stirling.5 stirling.6 2
MIT OpenCourseWare http://ocw.mit.edu 6.042J / 18.062J Mathematics for Computer Science Spring 20 15 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Recommend
More recommend