Beruflich Dokumente
Kultur Dokumente
PART TWO
Analytic
Combinatorics
3. Combinatorial Parameters
and MGFs
http://ac.cs.princeton.edu
A. SYMBOLIC METHOD
1. OGFs
2. EGFs
3. MGFs
B. COMPLEX ASYMPTOTICS
SYMBOLIC METHOD
specification
5. Applications of R&M
6. Singularity Analysis
7. Applications of SA
8. Saddle point
Analytic
Combinatorics
Philippe Flajolet and
Robert Sedgewick
GF
equation
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
• Basics
^Moment calculations
f©BGF examples
• Labelled classes
http://ac.cs.princeton.edu
II.3a.MGFs.Basics
set partition ?
permutation ?
composition ?
Section S.4
•compute average extrema! values * Ex: Compute average length of the longest list.
a(z,u) = z \ a \ u c ° st (A
size function
object name
a<EA
S v
parameter value
class name
aeA N>0k>0
Terminology.
A. A Nk = [z N ][u k ]A(z,u)
Terminology.
With the symbolic method, we specify the class and at the same time characterize
the OBGF
£>i=2
0 0
0 1
1 0
1 1
£2 = 4
A. Bn= 2"
0 0 0
0 0 1
0 10
Oil
10 0
10 1
110
111
B 3 = 8
0 0 0 0
0 0 0 1
0 0 10
0 0 11
0 10 0
0 10 1
0 110
0 111
10 0 0
10 0 1
10 10
10 11
110 0
110 1
1110
1111
£ 4 =16
fiio = 1
fin = 1
0 0
0 1
1 0
1 1
fi 2 o= 1
fi 2 i = 2
fi22= 1
A ' e “ = C)
0 0 0
0 0 1
0 10
Oil
10 0
10 1
110
111
fi30= 1
fisi = 3
fi32 = 3
fi33= 1
0 0
0 0
0 0
0 0
0 1
0 1
0 1
0 1
1 0
1 0
0
1
1 0
1 0
1 1
1 1
1 1
1 1
fi40
fi41
fi42
fi43
=
fi43
= V(1 +u) N z N
N> 0
= E
k>0
(1 - z) k +'
(horizontal OGF)
(vertical OGF)
1 - z(1 + u)
(OBGF)
horizontal OGF
coefficients
N k '
0
1
■[u k ](1 + u) 7 =
10
Suppose that A and B are classes of unlabelled objects with OBCFs A(z,u) and B(z,u)
where z marks size and u marks a parameter value. Then
operation
notation
semantics
OGF
disjoint union
A + B
A(z, u ) + B(z , u )
Cartesian product
A x B
A(z, u)B(z, u )
sequence
SEQ(A)
1 — A(z, u )
Proofs of correspondences
Ax B
SEQ(A)
A + B
z \c\ u cost(c)
c<EA+B
aeA beB
cEaxb
-Jc| yCOSt(c)
E
z \a\ u c °st(a)\
aEA b(E.B
aG/\ b(zB
A(z , u)B(z , a)
z |b| a cost(b)^
construction OCF
5£Q t (A) = A k
A(z,u) k
beB N>0k>0
Construction
OBGF equation
Expansion
(1 -z) k +'
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
• Basics
^Moment calculations
f©BGF examples
• Labelled classes
http://ac.cs.princeton.edu
II.3a.MGFs.Basics
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
• Moment calculations
f^©BGF examples
• Labelled classes
CAMBRIDGE
http://ac.cs.princeton.edu
II.3b.MGFs.Moments
OBGF
P(z,u) = E z
size function
\p\ u cost(p)
object name
pEP
S' X
parameter value
^>") = EE PNkU k z N
N> 0 k >0
class name
Enumeration
pev
PN = ^2pNk P(Z, 1)
k>0
du
[z N ]Pu(z, 1) Q
[z N ]P(z, 1) Pn
2 [z N ]Puu(z, 1 )
[z«]P(z,1)
+ Pn — P/v
E^ n = EEp^ n
N>0
N >0 Jt>0
Cumulated cost
dP(z , u)
( 7=1
Eq« zN = EE ><PNkZ N
N> 0
N>0k>0
Pn
= E
Pn/c
k>0
= E^-m :
k>0
Variance
Class
B, the class of all binary strings
Example
10111010001000
Size
OBCF
B{z,u) = ^ z l b\ u zeros(b)
Parameter
beB
Construction
OBGF equation
Enumeration
Cumulated cost
B(z,u)
1 - z(1 + u)
[z N ]6(z,1) = [z N ] r i^
= 2
[z N ]^(z,1) = [z N ]
N 1
0 -2z)2
N2
N—1
[z N ]^(z,1)
B u (z,u)
(1 -z-zu) 2
Variance
17
Y Y PNkZ N U k
N> 0 k>0
N> 0
k>0
horizontal OGF
coefficients
A/ ^0123456789
\
0
vertical OGF
coefficients
PS7
<-
MMu)
[z^lqsfz)
18
Moment calculations ("horizontal" OGF)
OBGF.
p( z ,u) = Y^ z
size function
\p\ u cost(p)
peP
s* \
parameter value
"Horizontal" OGF
Enumeration
Cumulated cost
Pn( i)= 1 =p
PEVn
PEVn
Hn
PnO) _ Q
Pn( i) p.
a N —
pM
Pn{ 1)
+ pN ~ PN^
p N kU k z N
N> 0 k>0
Pn(u) = YP NkLjk
k>0
Pn( 1) = Y,P Nk =
k>0
p'nO) = Y k P Nk =
k>0
Variance
OBGF
B(z,u) = , /'ll \
1 — z(1 + U)
"Horizontal" OGF
b N (u) = [z n ]B(z, u) = (1 + u) N
Enumeration
M 1)=2 N
Cumulated cost
6^(1) = N2 n “ 1
Average # 1-bits in a
random N-b\t string
Variance
20
OBGF.
p( z ,u) = E z
size function
\p\ u cost(p)
object name
pEP
S' V
parameter value
class name
^) = EE PNkU k Z N
N> 0 k >0
"Vertical" OGF
Enumeration
Cumulated cost.
P N = [z N ]P(z , 1)
[ Z N iE%( z ) = Qn
Pn —
P,
q k (z) = Y,PNkZ N
N> 0
E%w = EE !<PNkZ N
k N> 0
= E(EW) zN
N> 0 k \
Qn
E kpnk
k>0
Variance
(omitted)
21
OBGF
"Vertical" OGF
Enumeration
Cumulated cost
B(z,u)
1 -z( 1 +tv)
q k (z) = [u k ]B(z, u) =
z
(1 -z) k +'
P n = [z n ]B{z, 1) = 2 n
Average # 1-bits in a
random A/-bit string
= N2 n ~'
Pn/Qn =(n}2) /
^Tkr k ~i
yk
V/, z _
/ 1 _ -7^+1 /"I _ -r \2
(1 -r)
Z E*;
Jc-1
k -1
(1 -z) 2 0 -T^l) 2
(1 -2z)2
22
Moment inequalities and concentration
Let Xn be the value of a parameter for a random object of size N with mean p/v and
std dev cjn.
N—7-00
e <
Xn_
flN
< 1 +e} = 1
23
Moments for letters in M-words with OBGFs
Class
Example
Size
OBGF
Parameter
43552411
W M (z,u) = ^ 2
w£ W M
Construction
OBGF equation
Enumeration
Cumulated cost
Mean # of occurences of a
given letter in a random
M-word with N letters
Variance
[z N ]l/l/(z, 1) = [z N ]
1 - (M- 1 +u)z
N-i
1 — Mz
[z N ]W u (z, 1) = [z™]
N-\
(1 - Mz) 2
= NM
•N -1
Bn —
[z N ]W u ( z,1)
[z N ]W(z, 1)
° z n = [n
[z N ]W(z, 1)
+ BN - Bn = N / M - N/M 2
[z N ]W u (z } 1)
[z N ]W uu (z, 1)
2 3
.|w| ^occ(w)
N(N- 1)/V/ N “ 2
Standard deviation
a N = - N/M 2
24
Algorithms
The Art of
Computer
Programming
Strategy
key hash a
S 2 0
E 0
A 0 2
R 4
C 4
H 4
E 0
X 2
A 0
M 4
P 3
L 3
E 0 12
25
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
• Moment calculations
f^©BGF examples
• Labelled classes
CAMBRIDGE
http://ac.cs.princeton.edu
II.3b.MGFs.Moments
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
• OBGF examples
• Labelled classes
CAMBRIDGE
http://ac.cs.princeton.edu
II.3c.MGFs.0BGFs
1 + 1
1 + 1+1
1 + 2
2 + 1
C 21 = 1
C 22 = 1
C 31 = 1
cumulated cost: 3
average: 1.5
C 32 = 2
C 33 = 1
cumulated cost: 8
average: 2
(ro
1 + 1 + 1 + 1
1 + 1 + 2
1 + 2 + 1
1+3
2 + 1+1
2 + 2
3 + 1
C 4 1 = 1
Caz = 3
C 43 = 3
C 4 4 = 1
cumulated cost: 20
average: 2.5
l+l+l+l + l
1 + 1 + 1 + 2
1 + 1 + 2 + 1
1 + 1+3
1 + 2 + 1 + 1
1 + 2 + 2
1+3 + 1
1 + 4
2 + 1 + 1 + 1
2 + 1 + 2
2 + 2 + 1
2 + 3
3 + 1 + 1
3 + 2
4 + 1
C51 = 1
C52 = 4
C53 = 6
C54 = 4
C55 = 1
cumulated cost: 48
average: 3
Class
Example
1+3 + 1+ 5 + 2 = 12
Size
Parameter
OBCF
Construction
Enumeration
Cumulated cost
C(z, u ) =
1 1 -z
1 — u
1 -z
1 — z(u + 1)
Qv(tv) = [z N ]C(z, a) = (u + 1 ) N — (u + 1 ) N_1
c/v(1) = 2 N — 2 n_1 = 2 n_1
c^(1) = N2 n_1 - (N - 1 )2 n_2 = (N + 1 )2 n “ 2
c n(1 )/ c n(1 )
29
Tree parameters
30
31
•i :
<7-10=1 <7-21 = 1
O 31 = 1 ?
Ch 2=1 °
cumulated cost: 3 X
average: 1.5
0 - 4 1 = 1
042 = 3
043 = 1
cumulated cost: 1 0
average: 2
A A A
l IA
a 5] = i
052 = 3
Oss = 6
O 54 = 1
cumulated cost: 35
average: 2.5
32
Leaves in random trees
OBGF
Construction
Enumeration OGF
G L = uZ+ZxSEQ> 0 ( G L )
~ L , x zG [ (z, u)
C (z,u) = zu + 1 _ G t (Z;0)
C L {z, 1) = C(z)
c " (z ’ 1) = f (1 + 7rbl
[z N ]C[,(z, 1) /N
[z N ]C(z) = -
1 f2N — 2"
[z N ]
v/1 -4z
N V N- 1
33
•i :
C D io = 0 C D 21 = 1
C D 31 = 1 J
C D 32=1 °
cumulated cost: 3 X
average: 1.5
C°4 i = 2
C°42 = 2
C D 4B = 1
A. (next slide)
cumulated cost: 9
average: 1.8
A A A
l IA
A
C D si = 5
C D 52 = 5
Cd 53 = 3
C D 54 = 1
cumulated cost: 28
average: 2
34
Class
Size
OBCF
Example
C L (z, u) =
gee
Construction
G D = Z x SEQ> 0 ( uG D )
N 3
N + 1
Enumeration OGF
C D (z, u)
1 — uG{z)
C D (z, 1) =
C D u {z, 1) = -
C(z)
zC{z)
— G(z)) 2
(1
1
1.5
1.8
2 /
- 1
wTtQ = 2N(2N-\)N
b CnZ) (N+1)NN
N+ 1
35
Rhyming schemes
36
Rhyming schemes
Si i = 1
A B
A A
521 = 1
522 = 1
ABC
ABB
ABA
A A B
AAA
531 = 1
5 32 = 3
S3 3 = 1
A B C D
A B C C
A B C B
A B B C
A B C A
ABAC
A A B C
A A B B
A B A B
ABBA
A B B B
A B A A
A A B A S 4 i = 1
A A A B *2 = 7
A A A A *3 = 6
*4= 1
37
Rhyming schemes
Class
Example
ABCADABE
Size
number of lines
Parameter
OBCF
S(Z,U) = ^ z l s\ u rhymes(s)
ses
Vertical OGF
5/c(z)
Z U ~
/c!
N>0 ^>0
details omitted
(see page 63)
N>0k >0
z N u k
= Bn
r N
N> 0
(horizontal OGF)
"Bell polynomials"
N k -
= E
k>0
vertical OGF
coefficients
1 I
3 1
horizontal OGF
coefficients
-*-
15
25
10
1
31
90
65
15
63
301
350
140
[u k ]B 4 (u)
21 1
39
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
• OBGF examples
• Labelled classes
CAMBRIDGE
http://ac.cs.princeton.edu
II.3c.MGFs.0BGFs
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
^Moment calculations
f^GBGF examples
• Labelled classes
CAMBRIDGE
http://ac.cs.princeton.edu
II.3d.MGFs.EBGFs
object name
size function
z 1
cost(a)
a£A
S' v
a || parameter value
class name
Mz,u) = J2
aeA
yCost(a)
E E w zN “ k
N>0k >0
Terminology.
Terminology.
With the symbolic method, we specify the class and at the same time characterize
the EBGF
42
Suppose that A and B are classes of unlabelled objects with EBCFs A(z,u) and B(z,u)
where z marks size and u marks a parameter value. Then
operation
notation
semantics
OGF
disjoint union
A + B
A(z, u ) + B(z , u )
labelled product
A* B
A(z, u)B(z, u )
sequence
SEQ(A)
1 — A(z, u )
43
3 Wu = 3
cumulated cost: 3
average: 1.5
1 1
1 2
1 3
2 1
2 2
2 3
3 1
32 W21 = 3
33 I/I/2 2 = 6
cumulated cost: 1 5
average: 1.667
111 211
112 2 12
113 2 13
12 1 2 2 1
1 2 2 2 2 2
1 2 3 2 2 3
13 1 2 3 1
1 3 2 2 3 2
1 3 3 2 3 3
3 11
3 12
3 13
3 2 1
3 2 2
3 2 3
3 3 1
3 3 2
3 3 3
cumulated cost: 57
average: 2.111
14/bi = 3
H/32 = 1 8
W33 = 6
44
Class
Example
314641223441
Size
y\w\
W M (z,u)= V
kv !
wE Wm
Parameter
EBGF
Construction
Enumeration EGF
W M (1,z) = e
zM
z(M- 1)
N![z N ] W(1, z)
N mn
2
B
1.667
2.111
45
Class
Example
314641223441
Size
7 m
^ \w !
W(E W/v;
Parameter
EBGF
Construction
EBGF equation from symbolic method
Enumeration EGF
W M (u,z) = (e z + (u -
W M 0,z) = e zM
7 k
W u (1,z) = Me z(M_1) —
k\
occupancy /■
distribution y
46
P21 = 1
P22 = 1
cumulated cost: 3
average: 1.5
Pb 1 = 2
Pb 2 = B
Pb b= 1
cumulated cost: 1 1
average: 1.8333
P41 = 6
P42 = 1 1
P43 = 6
P44 = 1
cumulated cost: 50
average: 2.0833
47
Example
EBCF
Construction
Enumeration EGF
Cumulated cost EGF
P = SET ( u CYC ( Z) )
„i„ 1
P(z. u) = e 1 — z = (1 — z)
P u(z, 1) = —In 1
— U
N H
1.5
B 1.8BB
4 2.083
concentrated: c tn is 0(^log N)
48
N > 0 k >0
k
rN
N\
z N
/ \ •
N >0
1 \/c k
Vl(ln—)
^ /d v 1 -z y
k >0
(1 z) u
(vertical EGF)
(EBGF)
A/
1
1
24
vertical OGF
coefficients
I I
3 1
II 6 1 <-
50 35 10
1 1 ^3
horizontal OGF
coefficients
21 1
49
Number of cycles of a given length in random permutations
Example
EBCF
Construction
1 -,r ,,-,r
, . z uz
In --1-
P(z,u) =e 1 -z r r
PC 1 )
(u-iy/r
1 -z
1 -Z
{ 1 } { 2 } { 3 } { 4 }
{ 1 } (2 3 4 }
{ 2 } {1 3 4 }
{ 3 } {1 2 4 }
{ 4 } {1 2 3 }
{ 1 }
{ 2 }
{ 3 }
{1
2 }
{ 3 }
{ 4 }
{ 1 }
{ 2 }
{ 1 }
{2
3 }
{1
3 }
{ 2 }
{ 4 }
{1
2 }
{ 2 }
{1
3 }
{1
4 }
{ 2 }
{ 3 }
52 =
= 2
{ 3 }
{1
2 }
{2
3 }
{ 1 }
{ 4 }
{ 1 }
{ 2 }
{ 3 }
{2
4 }
{ 1 }
{ 3 }
5 b
= 5
{3
4 }
{ 1 }
{ 2 }
{1 2 } {3 4 }
{1 3 } {2 4 }
{1 4 } {2 3 }
{ 1234 }
5 4 = 1 5
51
Set partitions
{ 1 } { 2 }
W {1 2}
S22 = 1
cumulated cost: 3
average: 1.5
{ 1 } { 2 } { 3 }
{ 1 } (2 3 }
{ 2 } {1 3 }
{ 3 } {1 2 }
{1 2 3 }
531 = 1
5 3 2 = 3
533 = 1
cumulated cost: 1 1
average: 2
{ 1 } { 2 } { 3 } { 4 }
{ 1 }
{2 3
4 }
{ 2 }
{1 3
4 }
{ 3 }
{1 2
4 }
{ 4 }
{1 2
3 }
{1 2 }
{ 3 }
{ 4 }
{1 3 }
{ 2 }
{ 4 }
{1 4 }
{ 2 }
{ 3 }
{2 3 }
{ 1 }
{ 4 }
{2 4 }
{ 1 }
{ 3 }
{3 4 }
{ 1 }
{ 2 }
{1 2 } {3
4 }
{1 3 } {2
4 }
{1 4 } {2
3 }
{ 1234 }
S 4 i = 1
S 4 2= 7
543 = 6
544 = 1
cumulated cost: 37
average: 2.466
52
Class
Example
{1} {2 5 6} {3 7 8} {4}
Size
5<ES 5 '
Parameter
EBGF
Construction
EBGF equation from symbolic method
Enumeration EGF
5(z, u ) — e a ( e — 1)
5(z,1) = e eZ - 1
5„(z, 1) = (e z - 1)e( e
N'.[ zN ]S u (z, 1) _
N\[z N ]S(z, 1)
1 )
N> 0 k>0
N) z
k ) ~N\ U
= J2 Bn (°)
N> 0
= 5]( ez
k>0
(horizontal EGF)
"Bell polynomials"
(vertical EGF)
= e U ^ Z 1 ) (EBGF)
horizontal EGF
coefficients
/C^
6 7
vertical EGF
coefficients
1
4
<-
[(/]5 4 (t/)
15
25
10
31
90
65
15
63
301
350
140
21 1
N![z w ]l(e^-1) 3
54
Mappings
Def. A mapping is a function from the set of integers from 1 to N onto itself.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
32 33 34 35 36 37
9 12 29 33 5 20 30 37 26 20 13 8 2 33 29 2 35 37 33 9 35 21 18 2 25 1 20 33 23 18
29 5 5 9 11 5 11
55
Combinatorial class C, the class of Cayley trees < -labelled, rooted, unordered
Construction
EGF equation
C(z) = ze c<yZ )
Construction
EGF equation
Y(Z) - ln 1 - C(z)
EGF equation
MW-expOn z) )_ z)
56
Mapping parameters
Construction M = SET(uCYC(C))
1 1
Construction M = SET(CYC(uC))
1 1
v 1 - uC{z)' 1 — uC(z)
57
"We shall now stop supplying examples that could be multiplied ad libitum, since
such
calculations greatly simplify when interpreted in the light of asymptotic analysis"
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
^Moment calculations
f^GBGF examples
• Labelled classes
CAMBRIDGE
http://ac.cs.princeton.edu
II.3d.MGFs.EBGFs
ANALYTIC COMBINATORICS
PART TWO
• Moment calculations
s r©BGF examples
• Labelled classes
• Exercises
http://ac.cs.princeton.edu
Analytic
Combinatorics
CAMBRIDGE
II.3e.MGFs.Exercises
Note 111.17
Analytic
Combinatorics
> III-17- Leaves and node-degree profile in Cayley trees. For Cayley trees, the
bivariate EGF
with u marking the number of leaves is the solution to
61
Note 111.21
Analytic
Combinatorics
> 111 . 21 . After Bhaskara Acharya ( circa 1150 ad). Consider all the numbers
formed in decimal
with digit 1 used once, with digit 2 used twice.with digit 9 used nine times. Such
numbers
all have 45 digits. Compute their sum S and discover, much to your amazement that S
equals
This number has a long run of nines (and further nines are hidden!). Is there a
simple explana¬
tion? This exercise is inspired by the Indian mathematician Bhaskara Acharya who
discovered
multinomial coefficients near 1 150ad. <1
45875559600006153219084769286399999999999999954124440399993846780915230713600000
62
Assignments
Analytic
Combinatorics
63
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
3. Combinatorial Parameters
and MGFs
http://ac.cs.princeton.edu