Mathematics for Computer Science MIT 6 042 J18

  • Slides: 13
Download presentation
Mathematics for Computer Science MIT 6. 042 J/18. 062 J Asymptotics & Stirling’s Approximation

Mathematics for Computer Science MIT 6. 042 J/18. 062 J Asymptotics & Stirling’s Approximation Copyright © Albert Meyer, 2002. Prof. Albert Meyer & Dr. Radhika Nagpal March 15, 2002 1

Stirling’s Formula Factorial defines a product: Turn product into a sum taking logs: ln(n!)

Stirling’s Formula Factorial defines a product: Turn product into a sum taking logs: ln(n!) = = ln(n) ln(1 · 2 · 3 · · · (n – 1) · n) ln 1 + · · · + ln(n – 1) + = March 15, 2002 2

Stirling’s Formula bound by integral method ln (n) ln n … ln (n+1) ln

Stirling’s Formula bound by integral method ln (n) ln n … ln (n+1) ln 5 ln 4 ln 3 ln 2 ln 3 ln 4 ln 2 1 2 3 ln 5 4 5 … ln ln n n-1 n– 2 n– 1 n March 15, 2002 3

Stirling’s Formula Integral method to bound ln(n!) March 15, 2002 4

Stirling’s Formula Integral method to bound ln(n!) March 15, 2002 4

Stirling’s Formula “~” means: March 15, 2002 5

Stirling’s Formula “~” means: March 15, 2002 5

Asymptotic Notation f(x) = O(g(x)) blue stays below red c g(x) +c f(x) March

Asymptotic Notation f(x) = O(g(x)) blue stays below red c g(x) +c f(x) March 15, 2002 6

Definition 3. 1: Asymptotic Equivalence f(n) is asymptotically equivalent to g(n) when: Denoted by:

Definition 3. 1: Asymptotic Equivalence f(n) is asymptotically equivalent to g(n) when: Denoted by: f(n) ~ g(n) March 15, 2002 7

Definition 3. 1: Asymptotic Equivalence f(n) is asymptotically equivalent to g(n) when: Denoted by:

Definition 3. 1: Asymptotic Equivalence f(n) is asymptotically equivalent to g(n) when: Denoted by: f(n) ~ g(n) March 15, 2002 8

Definition 7. 1: Little Oh f(n) is asymptotically smaller to g(n) when: Denoted by:

Definition 7. 1: Little Oh f(n) is asymptotically smaller to g(n) when: Denoted by: f(n) = o(g(n)) March 15, 2002 9

Definition 7. 2: Big Oh f(n) is asymptotically bounded by g(n) when: Denoted by:

Definition 7. 2: Big Oh f(n) is asymptotically bounded by g(n) when: Denoted by: f(n) = O(g(n)) Note: f~g or f = o(g) f=O(g) March 15, 2002 10

Definition 7. 3: Big Oh Equivalently, f(n) = O(g(n)) iff $c > 0, n

Definition 7. 3: Big Oh Equivalently, f(n) = O(g(n)) iff $c > 0, n 0 n n 0 $|f(n)| c·g(n) March 15, 2002 11

Definition 7. 7: Theta f(n) = (g(n)) iff f(n) = O(g(n)) and g(n) =

Definition 7. 7: Theta f(n) = (g(n)) iff f(n) = O(g(n)) and g(n) = O(f(n)) March 15, 2002 12

Lemma: ln x = o(x) Proof: variable substitution: March 15, 2002 13

Lemma: ln x = o(x) Proof: variable substitution: March 15, 2002 13