Download presentation
Presentation is loading. Please wait.
1
Asymptotics & Stirling’s Approximation
Mathematics for Computer Science MIT 6.042J/18.062J Asymptotics & Stirling’s Approximation Copyright © Albert Meyer, 2002. Prof. Albert Meyer & Dr. Radhika Nagpal
2
Factorial defines a product:
Integral Method Factorial defines a product: Turn product into a sum taking logs: ln(n!) = ln(1 · 2 · 3 · · · (n – 1) · n) = ln 1 + ln 2 +· · · + ln(n – 1) + ln(n) =
3
… bound by integral method Integral Method ln (x) … ln (x+1) ln ln n
2 3 1 4 5 n–2 n–1 n … ln (x+1) ln (x) … ln 2 ln 3 ln 4 ln 5 ln n-1 ln n
4
Integral Method Reminder:
5
Integral Method Bounds on ln(n!)
6
In-Class Problem Problem 1
7
Stirling’s Formula So
8
Stirling’s Formula A precise approximation: Stirling’s Formula
9
Asymptotic Equivalence
f(n) ~ g(n)
10
Little Oh Asymptotically smaller: f(n) = o(g(n))
11
Big Oh Asymptotic Order of Growth: f(n) = O(g(n))
12
The Oh’s If f = o(g) or f ~ g then f = O(g) lim = 0 lim = 1 lim <
13
The Oh’s If f = o(g), then g O(f) lim = lim = 0
14
c,n0 0 n n0 |f(n)| c·g(n)
Big Oh Equivalently, f(n) = O(g(n)) c,n0 0 n n0 |f(n)| c·g(n)
15
f(x) = O(g(x)) g(x) c· f(x) Asymptotic Notation ln c
blue stays below red log scale f(x)
16
Lemma: xa = o(xb) for a < b
Little Oh Lemma: xa = o(xb) for a < b Proof: and b - a > 0. So as x , xb-a and
17
Lemma: ln x = o(x) for > 0.
Little Oh Lemma: ln x = o(x) for > 0. Proof: for z 1.
18
Lemma: ln x = o(x) for > 0.
Little Oh Lemma: ln x = o(x) for > 0. Proof: Let for > .
19
f(n) = O(g(n)) and g(n) = O(f(n))
Theta Same Order of Growth: f(n) = (g(n)) f(n) = O(g(n)) and g(n) = O(f(n))
20
In-Class Problem Problems 2--4
21
Big Oh Mistakes False Lemma: Of course really
22
= n· O(1) = O(n). 0 = O(1), 1 = O(1), 2 = O(1),… So each i = O(1). So
Big Oh Mistakes False Lemma: False Proof: 0 = O(1), 1 = O(1), 2 = O(1),… So each i = O(1). So = n· O(1) = O(n).
23
In-Class Problem Problem 5
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.