3.growth of functions hsu, lih-hsing. computer theory lab. chapter 3p.2 3.1 asymptotic notation ...
Post on 21-Dec-2015
217 views
TRANSCRIPT
3.Growth of Functions
Hsu, Lih-Hsing
Chapter 3 P.2
Computer Theory Lab.
3.1 Asymptotic notation
g(n) is an asymptotic tight bound for f(n). ``=’’ abuse
}all for
)()()(0 s.t. ,,|)({))((
0
21021
nn
ngcnfngcnccnfng
))(()( ngnf
Chapter 3 P.3
Computer Theory Lab.
The definition of required every member of be asymptotically nonnegative.
n 0
n
c 2g(n)
c 1g(n)
f(n)f n g n( ) ( ( ))
Chapter 3 P.4
Computer Theory Lab.
Example:
)(6
.7 2
3214
23
222
nn
n>ifn
nnn
f n an bn c a, b, c a>
f(n)= (n ).
( ) ,
2
2
0 constants, .
In general,
).(nP(n)
aananp
d
didi
ii
Then
.0ith constant w are where)( 0
Chapter 3 P.5
Computer Theory Lab.
asymptotic upper bound
} )()(0s.t.,|)({))(( 00 nnncgnfncnfngO
n 0
n
cg(n)
f(n)f n O g n( ) ( ( ))
Chapter 3 P.6
Computer Theory Lab.
asymptotic lower bound
} )()(0 s.t. ,|)({))(( 00 nnnfncgncnfng
n 0
n
cg(n)
f(n)f n g n( ) ( ( ))
Chapter 3 P.7
Computer Theory Lab.
Theorem 3.1. For any two functions f(n) and g(n),
if and only if and . f n g n( ) ( ( )) f n O g n( ) ( ( ))
f n g n( ) ( ( ))
Chapter 3 P.8
Computer Theory Lab.
o g n f n c n n n f n cg n( ( )) { ( )| , , ( ) ( )} 0 0 0
f n o g nf ng nn( ) ( ( )) lim( )( )
0
( ( )) { ( )| , , ( ) ( )}g n f n c n n n cg n f n 0 0 0
f n g nf ng nn( ) ( ( )) lim( )( )
Chapter 3 P.9
Computer Theory Lab.
Transitivity
Reflexivity
Symmetry
f n g n g n h n f n h n( ) ( ( )) ( ) ( ( )) ( ) ( ( )) f n O g n g n O h n f n O h n( ) ( ( )) ( ) ( ( )) ( ) ( ( )) f n g n g n h n f n h n( ) ( ( )) ( ) ( ( )) ( ) ( ( )) f n o g n g n o h n f n o h n( ) ( ( )) ( ) ( ( )) ( ) ( ( )) f n g n g n h n f n h n( ) ( ( )) ( ) ( ( )) ( ) ( ( ))
f n f n( ) ( ( ))f n O f n( ) ( ( ))f n f n( ) ( ( ))
f n g n g n f n( ) ( ( )) ( ) ( ( ))
Chapter 3 P.10
Computer Theory Lab.
Transpose symmetry f n O g n g n f n( ) ( ( )) ( ) ( ( )) f n o g n g n f n( ) ( ( )) ( ) ( ( ))
f n O g n a b( ) ( ( )) f n g n a b( ) ( ( )) f n g n a b( ) ( ( )) f n o g n a b( ) ( ( )) f n g n a b( ) ( ( ))
Chapter 3 P.11
Computer Theory Lab.
Trichotomy a < b, a = b, or a > b. e.g., n n n, sin1
n n0 2
Chapter 3 P.12
Computer Theory Lab.
2.2 Standard notations and common functions
Monotonicity: A function f is monotonically increasing if m
n implies f(m) f(n). A function f is monotonically decreasing if m
n implies f(m) f(n). A function f is strictly increasing if m < n implies
f(m) < f(n). A function f is strictly decreasing if m > n implie
s f(m) > f(n).
Chapter 3 P.13
Computer Theory Lab.
Floor and ceiling
x x x x x 1 1
n n n/ /2 2
n a b n ab/ / /
n a b n ab/ / /
bbaba /))1((/
bbaba /))1((/
Chapter 3 P.14
Computer Theory Lab.
Modular arithmetic For any integer a and any positive integer n, the
value a mod n is the remainder (or residue) of the quotient a/n :
a mod n =a -a/nn.
If(a mod n) = (b mod n). We write a b (mod n) and say that a is equivalent to b, modulo n.
We write a ≢ b (mod n) if a is not equivalent to b modulo n.
Chapter 3 P.15
Computer Theory Lab.
Polynomials v.s. Exponentials
Polynomials: A function is polynomial bounded if
. Exponentials:
Any positive exponential function grows faster than any polynomial.
P n a ni i
i
d( )
0 )1()( Onnf n o a ab n ( ) ( )1
xnn
x
i
ix
en
x
xx
xex
i
xe
)1(lim
1|| if 2
11
!2
0
Chapter 3 P.16
Computer Theory Lab.
Logarithms
A function f(n) is polylogarithmically bounded if
for any constant a > 0. Any positive polynomial function grows fast
er than any polylogarithmic function.
ln( ) ... | |12 3 4 5
12 3 4 5
x xx x x x
if x
xx
x x1
1
ln( )
nnf O )1(log)(
)(log ab non
Chapter 3 P.17
Computer Theory Lab.
Factorials Stirling’s approximation
))1
(1()(2!ne
nnn n
n o nn! ( )n n! ( ) 2
log( !) ( log )n n n
nn
ee
nnn
2!
where
nn n 12
1
112
1
Chapter 3 P.18
Computer Theory Lab.
Function iteration
.0))((
,0)( )1(
)(
ifinff
ifinnf i
i
For example, if , thennnf 2)( nnf ii 2)()(
Chapter 3 P.19
Computer Theory Lab.
The iterative logarithm function
nninin
in
n
)(i
)(i
iii
undefined. is lgor 0lg and 0 if undefined0lg and 0 if )lg(lg
0 if
)(lg
1
1
)1()1()(
lg ( ) min{ |lg }* ( )n i i 0 1
lg* 2 1lg* 4 2lg*16 3lg* 65536 4lg* 2 565536
Chapter 3 P.20
Computer Theory Lab.
Since the number of atoms in the observable universe is estimated to be about , which is much less than , we rarely encounter a value of n such that .
8010 655362
5lg* n
Chapter 3 P.21
Computer Theory Lab.
Fibonacci numbers
...61803.02
51
...61803.12
51
5
1
0
21
1
0
ii
i
iii
F
FFF
F
F