Mathematics for Computer Science MIT 6 042 J18

  • Slides: 24
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

Integral Method Factorial defines a product: Turn product into a sum taking logs: ln(n!)

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) = March 15, 2002 2

Integral Method bound by integral method ln (x) ln n … ln (x+1) ln

Integral Method bound by integral method ln (x) ln n … ln (x+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

Integral Method Reminder: March 15, 2002 4

Integral Method Reminder: March 15, 2002 4

Integral Method Bounds on ln(n!) March 15, 2002 5

Integral Method Bounds on ln(n!) March 15, 2002 5

In-Class Problem 1 March 15, 2002 6

In-Class Problem 1 March 15, 2002 6

Stirling’s Formula So guess: March 15, 2002 7

Stirling’s Formula So guess: March 15, 2002 7

Stirling’s Formula A precise approximation: Stirling’s Formula March 15, 2002 8

Stirling’s Formula A precise approximation: Stirling’s Formula March 15, 2002 8

Asymptotic Equivalence f(n) ~ g(n) March 15, 2002 9

Asymptotic Equivalence f(n) ~ g(n) March 15, 2002 9

Little Oh Asymptotically smaller: f(n) = o(g(n)) March 15, 2002 10

Little Oh Asymptotically smaller: f(n) = o(g(n)) March 15, 2002 10

Big Oh Asymptotic Order of Growth: f(n) = O(g(n)) March 15, 2002 11

Big Oh Asymptotic Order of Growth: f(n) = O(g(n)) March 15, 2002 11

The Oh’s If f = o(g) or f ~ g then f = O(g)

The Oh’s If f = o(g) or f ~ g then f = O(g) lim = 0 lim = 1 lim < March 15, 2002 12

The Oh’s If f = o(g), then g O(f) lim =0 lim = March

The Oh’s If f = o(g), then g O(f) lim =0 lim = March 15, 2002 13

Big Oh Equivalently, f(n) = O(g(n)) c, n 0 0 n n 0 |f(n)|

Big Oh Equivalently, f(n) = O(g(n)) c, n 0 0 n n 0 |f(n)| c·g(n) March 15, 2002 14

Big Oh f(x) = O(g(x)) log scale ln c blue stays below red c·

Big Oh f(x) = O(g(x)) log scale ln c blue stays below red c· g(x) f(x) March 15, 2002 15

Little Oh Lemma: a x = b o(x ) Proof: for a < b

Little Oh Lemma: a x = b o(x ) Proof: for a < b and b - a > 0. So as x , xb-a and . March 15, 2002 16

Little Oh Lemma: ln x = Proof: o(x ) for > 0. for z

Little Oh Lemma: ln x = Proof: o(x ) for > 0. for z 1. March 15, 2002 17

Little Oh Lemma: ln x = Proof: o(x ) for > 0. Let for

Little Oh Lemma: ln x = Proof: o(x ) for > 0. Let for > . March 15, 2002 18

Albert R. Meyer: Little Oh Spring ’ 02: Added after lecture. Other proofs: L’Hopital’s

Albert R. Meyer: Little Oh Spring ’ 02: Added after lecture. Other proofs: L’Hopital’s Rule, Mc. Laurin Series (see a Calculus text) March 15, 2002 19

Theta Same Order of Growth: f(n) = (g(n)) f(n) = O(g(n)) and g(n) =

Theta Same Order of Growth: f(n) = (g(n)) f(n) = O(g(n)) and g(n) = O(f(n)) March 15, 2002 20

In-Class Problems 2 --4 March 15, 2002 21

In-Class Problems 2 --4 March 15, 2002 21

Albert R. Meyer: Big Oh Mistakes Spring ’ 02: We didn’t get to these

Albert R. Meyer: Big Oh Mistakes Spring ’ 02: We didn’t get to these remaining slides or to Problem 5. False Lemma: Of course really March 15, 2002 22

Big Oh Mistakes False Lemma: False Proof: 0 = O(1), 1 = O(1), 2

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). March 15, 2002 23

In-Class Problem 5 March 15, 2002 24

In-Class Problem 5 March 15, 2002 24