Standard Notation and Common Functions
Transitivity:
f (n) = A ( g (n) ) and g (n) = A ( h (n) ) Þ f (n) = A ( h (n) )
Reflexivity:
f (n) = A ( f (n) ) , A Î { Q, O, W }
Symmetry:
f (n) = Q ( g (n) ) Û g (n) = Q ( f (n) )
Transpose Symmetry:
f (n) = O ( g (n) ) Û g (n) = W ( f (n) )
Heuristics:
Exactly f (n) , g (n) |
Kinda a ,b |
f (n) = O ( g (n) ) |
a £ b |
f (n) = W ( g (n) ) |
a ³ b |
f (n) = Q ( g (n) ) |
a = b |
f (n) = o ( g (n) ) |
a < b |
f (n) = w ( g (n) ) |
a > b |
Trichotomy of real Numbers:
If a and b are real then one of three is true:
- a > b
- a < b
- a = b
There is no analogy for functions
Increasing and Decreasing Functions:
The function 'f' is monotonically increasing if m £ n Þ f (m) £ f (n)
The function 'f' is monotonically decreasing if m £ n Þ f (m) ³ f (n)
The function 'f' is strictly increasing / decreasing if m < n Þ f (m) > / < f (n)
Floor and Ceiling:
" real x :: x - 1 < ë x û £ x £ é x ù
< x + 1
so floor rounds to the left, and ceiling rounds to the right
" integers n :: n = é n/2 ù + ë n/2 û
" integers n, and integers a ¹ 0 ¹ b :: é é n/a ù /b ù
= é n/ab ù and ë ë n/a û /b û = ë n/ab û
Polynomials:
p (n) = |
d
å
j = 1
|
ai ni ,
ad ¹ 0 |
{ ao, ... ,ad } coefficients |
|
p (n) is asymptotically positive if a d > 0. If " a ³ 0 , na then is monotonically increasing.
f (n) is polynomially bounded if f (n) = n O (1) or f (n) = O (n k) for some constant k
Exponentials:
" a ¹ 0, m, n real :: a0 = 1, a1 = a, a -1 = 1 / a
(am) n = a mn , (am) n = (a n )m , ama n = am+n
lim
n ® ¥ |
ab / an = 0 |
, a > 1, b a constant |
Bounds:
ex = 1 + x + x2 / 2! + ... = |
¥
å
j = 0
|
xi / i! |
ex ³ 1 + x, " x
1 + x £ ex £ 1 + x + x2 , |x| £ 1
so ex = 1 + x + Q ( x2 ), and
lim
n ® ¥ |
( 1 + x / n )n |
= ex (compound interest) |
Logarithms: (inverses of exponentials)
lg n = log2 n, ln n = loge n
lgk n = (lg n )k , lg lg n = lg ( lg n )
a = b logb a, logc (ab) = logc a + logc b
logb an = n logba , logb a = logc a / logc b
logb1/a = - logba
logb a = 1 / logab , alogb n = nlogb a
When |x| < 1 ln ( 1 + x ) = { x - x2/2 + x3/3 - ...}
For x > -1 , x / ( x + 1 ) £ ln ( 1 + x ) £ x
f (n) is poly-logarithmically bounded if f (n) = lgO (1) n .
lim
n ® ¥ |
lgb n / 2a lg n = |
lim
n ® ¥ |
= lgb n / na = 0 |
Therefore lgb n = o ( na )
Note: logs < polynomials < exponentials !
Factorials:
n! = 1 if n = 0, and n( n -1 )! if n > 0, so n! = ( 1 * 2 * 3 * ...n)}.
Clearly n! £ nn , however a better bound is Sterling's approximation:
n! = Ö( 2 p n ) * ( n / e )n *
( 1 + Q ( 1 / n ) )
n! = o ( nn ) , and w ( 2n )
Ö( 2 p n ) * ( n / e )n £ n! £ Ö( 2 p n ) * ( n / e )n +1/12n
G ( z ) = 0ò¥tz - 1 e-t dt , G ( n + 1 ) =
n!
The Gamma function gives Stirling's approximation.
G ( z ) = Ö( 2 p ) ez zz-1/2 [ 1 + 1/12z + 1/288z2 - 139/51840z3 ] fleshed out S. A. Þ
Q (1/2) ]
Iterated logarithm or "log star" function:
Define: lg (i) (n) = n if i = 0
lg ( lg (n-i)) if i > 0 & lg (i -
1) > 0
undefined otherwise
Note: lg i (n) ¹ (lg n ) i
lg * n = min { i ³ 0 : lg (i) £ 1 }
n |
2 |
4 |
16 |
216 |
2(216) |
lg * n |
1 |
2 |
3 |
4 |
5 |
2
.
.
.
.
2
tower = lg * n 2
The log * n function counts the size of the tower of exponentials above the 2.
Note that the lg * n is the inverse of the Ackerman function
Fibonacci Numbers
F0 = 0, F1 = 1, Fn + 2 = Fn + 1+ Fn where n = 0,1,2,3...
Fn = The number of rabbits at a generation
New rabbits = old rabbits + born rabbits
What if Fn = c ln
c ln+2 = c ln+1 + c ln if you you divide by c ln
Þ l2 = l + 1, l must solve
f ( ) = l2- l
- 1 = 0,
called the characteristic polynomial of the Fibonacci recursion Fn + 2 = Fn +
1+ Fn
l = (1 +/- Ö
(1 + 4 )) / 2 = (1 +/- Ö5 ) / 2
f = (1 + Ö5)/ 2 = 1.61803...
called the golden ratio
f^ = (1 - Ö5)/ 2 = -.61803...
Fn = c1fn + c2f^n
F0 = c1 + c2 = 0
F1 = c1f + c2f^ = c ( f - f^ )
= 1
f - f^ = (1/2 + Ö5/2 ) - (1/2 - Ö5/2 ) = Ö5
c = 1/Ö5 Þ Fn= ( fn - f^n) /
Ö5
since | f^ | < we have:
Fn = round ( fn / Ö5 )
|