Académique Documents
Professionnel Documents
Culture Documents
Analytic
Combinatorics
http://ac.cs.princeton.edu
5. Applications of
Rational and Meromor
Asymptotics
PART TWO
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
GF
equation
COMPLEX ASYMPTOTICS
asymptotic
estimate
desired
result !
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
^Applications of
• Bitstrings
• Compositions
http://ac.cs.princeton.edu
II.5a.RMapps.Bitstrings
Warmup: Bitstrings
000
0000
000 1
00 10
0011
0100
001
0101
00
0 10
0 110
0 1
Oil
0 111
10
100
1000
11
101
1001
110
10 10
03
l\j
ll
111
1011
B 3 = 8
1100
1101
1110
1111
Ba= 16
counting sequence
Bn = 2
N >0 N >0
OGF
1 — 2z
~ 1 — 2z
Warmup: Bitstrings
Asymptotics
> f
[z n ]B(z) = 2 n
Residue:
Coefficient of z N :
h -1 =
h -1
rsj -
f(z) 1
g'O) 2
To = 1
Ti = 2
01
10
11
T 2 = 3
Oil
0 10
101
110
111
T 3 = 5
0 10 1
0 110
0111
10 11
10 10
1101
1110
1111
T 4 = 8
0 10 11
01010
0 110 1
oino
0 1111
10 10 1
10110
10111
110 11
11010
1110 1
11110
11111
T 5 =1B
= ] -^- Z 2
[z n ]B 00 (z) = ^=4> n
Residue: /?_i =
g'(4>)
Coefficient of z N \
hi n\ N
V5
C 2 P 2 with
f3 2 = 1.61803
c 2 = 1.17082
y/5 — 1
2
a/5 + 1
2
_ 1 +3
~ 1 + 20
h—i~4, N
0 + 20 2
00 = 1
0 2 = 0 + 1
B4 = Z<4 (E + 1 B4)
> f
B 4 {z) = (1 +z + z 2 +z 3 )( 1 + zB 4 (z))
1 + z + z 2 + z 3
> f
g(z) a + 2a + 3a 2 + 4a 3
Coefficient of z N : [z N ]BAz ) ~ f
[z N ]B 4 (z) ~ c 4/ 3^
with
/3 4 = 1.9276
c 4 = 1.0917
1 + Z
10
Example 1: Bitstrings with restrictions on consecutive Os
n> o
_ 1 +Z + Z 2 +...+z M -' _ 1 -Z M
- 1 - z - z 2 - ... z M “ 1 — 2z + z M+1
N> 0
N> 0
= ^ Pr {1 st N bits of a random bitstring have no runs of M Os}
N> 0
N> 0
12
Autocorrelation
The probability that an A/-bit random bitstring does not contain 0000 is ~1.091 7 x
. 96328^
The expected wait time for the first occurrence of 0000 in a random bitstring is
30.
10111110100101001100111000100111110110110100000111100001
•mismatch for 0000 means 0001, so need to wait four more bits
•mismatch for 0001 means 0000, so next bit could give a match.
Q. What is the probability that an A/-bit random bitstring does not contain 0001?
Q. What is the expected wait time for the first occurrence of 0001 in a random
bitstring?
13
Constructions for strings without specified patterns
Cast of characters:
p — a pattern p 101001010
First construction
Sp + T p = E + Sp x {Zq + Zi }
14
• for each match of / trailing bits with the leading bits include a term z \p\-'
101001010
101001010
101001010
101001010
101001010
101001010
101001010
101001010
101001010
101001010
autocorrelation
polynomial
Cioiooioio(z) — 1 + z 5 + z 7
15
Second construction
p 101001010
a string in T p 10111110101101001100110101001010
f 10111110101101001100110 101001010
strings in S P ^—►1011111010110100110011010100101001010
first tail
is null
101001010
101001010
101001010
101001010
101001010
101001010
10100101001010
101001010
1010010101001010
101001010
Sp x (pi — x
C/# 0
16
OCFs
s p ( z ) = Z z ' s|
sESp
M z ) = Z z ' s|
sETp
Constructions
OGF equations
Solution
Sp + T p — E + S p x {Zq + Zi}
Sp{z)
c,/0
z p + (1 -2 z)Cp(z)
17
Asymptotics
18
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
^Applications of
• Bitstrings
• Compositions
http://ac.cs.princeton.edu
II.5a.RMapps.Bitstrings
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
^Applications of
• Bitstrings
• Compositions
CAMBRIDGE
http://ac.cs.princeton.edu
Example 2: Derangements
Di = 0
®©
Di = 1
©©©
Db = 2
©©©©
J©
J©
©©(
®@i
©© ( 2 )
© (4 s
©®
©
©J® ©IJ©
©^ ©
^ ©J® ©J©
©®
®®
®/®X ®/®\|
©J© ©J©
©s
©s
, ©I V ©^
©J© ©J®|
Da = 9
Example 2: Derangements
D = SET(CYC>i(Z)
> f
D(z)
N\[z n ]D(z) ~
N\
Residue: h _i
m =e -i
g'O)
[z N ]D(z)
h ~^N = 1
1 e
N\/e
Dn
.7357...
2.2072...
8.8291...
9
5
44.1455...
44
22
Example 2: Derangements
Dm = SET(CYC>m(Z)
> f
D m (z)
> f
N\[z n ]D(z) ~
N\
Residue: /?_i
^0 ) _ e -H M
g'O) "
[ Z N ]D(Z)
h -^N = _L
1 e HM
23
24
Example 2: Derangements
e -z-z 2 /2-z 3 /3-z 4 /4-z 5 /5-z 6 /6-z 7 /7-z 8 /8-z 9 /9-z 10 /10
25
Example 3: Surjections
1 2
R} = 1 2 1
Ri = 3
12 1 13 2
1 2 2 2 1 3
2 11 2 3 1
2 12 3 12
2 2 1 3 2 1
Kb = 13
1111
1112
112 1
12 11
2 111
112 2
12 12
2 112
2 12 1
2 2 11
12 2 1
12 2 2
2 12 2
2 2 12
2 2 2 1
Ra = 75
12 3 1
13 2 1
2 13 1
2 3 11
3 12 1
3 2 11
12 13
13 12
2 113
3 112
112 3
113 2
12 3 3
13 2 3
2 13 3
2 3 13
3 12 3
3 2 13
13 3 2
2 3 3 1
3 13 2
3 2 3 1
3 3 12
3 3 2 1
12 3 2
13 2 2
2 13 2
2 3 12
3 12 2
3 2 12
12 2 3
2 12 3
2 3 2 1
3 2 2 1
2 2 13
2 2 3 1
12 3 4
13 2 4
2 13 4
2 3 14
3 12 4
3 2 14
12 4 3
13 4 2
2 14 3
2 3 4 1
3 14 2
3 2 4 1
14 2 3
14 3 2
2 4 13
2 4 3 1
3 4 12
3 4 2 1
4 12 3
4 13 2
4 2 13
4 2 3 1
4 3 12
4 3 2 1
26
Example 3: Surjections
R = SEQ(SET> 0 (Z))
-+-
[z n ]R(z)
1
2(ln2) N + 1
Residue:
1 1
in 2 )
A/!/2(ln 2) w+1
Rn
B.0027...
12.9962...
13
74.9987...
75
Example 3: Surjections
How many words of length N are double surjections for some M ?
12 12
Ri = 1 fh = 1 2 112
2 12 1
2 2 11
12 2 1
/? 4 = 7
11111
1112 2
112 12
112 2 1
12 112
12 12 1
12 2 11
2 1112
2 112 1
2 12 11
2 2 111
112 2 2
12 2 12
2 12 2 1
2 2 112
1 2 2 2 1
2 2 2 1 1
2 12 12
12 12 2
2 112 2
2 2 12 1
R.5 = 21
28
Example 3: Surjections
R, the class of all double surjections
R = SEQ(SET>i(Z)
R{z)
1 — (e z — z — 1)
2 + z — e 2
1 N\
p + 1 p N+1
Singularities where e z = z + 2
i 1 1
Residue: =
g'(p) eP - 1
1.14619
" pTT
29
Example 3: Surjections
2 + z + z 2 / 2 — e z
2 + z + z 2 /2 + z 3 / 6 — e z
30
Example 3: Surjections
Example 4: Alignments
O i = 1
®©
©©
0 2 = B
©@©
©©©
©0®
s©
©©©
©©©
@ §
@ 0
©@©
Ob = 14
OOOO x 24
x 12
°©>
32
Example 3: Alignments
> f
O(z)
1 — In
1 - z
g'O - 1/e.
z = 1
1
On ~
N\
On
2.9129...
1 B.8247...
14
87.4816...
88
Sni = 2 W -1 ABC
S 33 = 1
only B B B... B
disallowed
A B
A B
B
A
A B
A
A
A B
A A
B
B
A B
C
A
S 43
A
C
Ss3= 25
34
> f
(1 z) (1 — 2z)... (1 -rz)
> f
[z N ]S\z) ~
r!
Residue: /7_i
fQA) _ i
g'OA) r ‘ r!
35
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
Philippe Flajolet and
Robert Sedgewick
^Applications of
• Bitstrings
• Compositions
CAMBRIDGE
http://ac.cs.princeton.edu
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
^Applications of
• Bitstrings
• Compositions
CAMBRIDGE
http://ac.cs.princeton.edu
II.5c.RMapps.Compositions
Example 5: Compositions
/i = 1
l + l
2
li = 2
A. In =2 n-i
1 +
1
+
1 +
+ 1
+
3
+ 1
+ 1
1 +
2 +
1
2
k =
2
+
1
3
B + 2
4 + 1
5
Is = 16
38
Example 5: Compositions
> f
In = 1 for N > 0
Singularity: pole at 1
Residue: /7_ n
f(1)
g'(1)
= 1
39
Example 5: Compositions
C= SEQ(/)
40
Example 5: Compositions
1 + 1
+ 1
1 +
1 +
+
= 1
1 +
+ 1
2 +
+ 2
f 2
+ 1
Fb =
3
2 +
f 4 =
A. Fibonacci numbers
2
+
2
+
Fs = 8
41
Example 5: Compositions
F = SEQ(Z + Z 2 )
F n ~
<j) N
7 !
V5
Residue: Ai_i =
Coefficient of z N \
f {4>) _ 1
1+20
/ j _! /'\\ N +1
lN
1 +20
00 = 1
0 ^ — 0+1
1 + 20 =
42
Example 5: Compositions
Pi = 1
2 + 2
P 4 = 1
P3 = 1
2 + 3
B + 2
5
Ps = 3
2 + 2
+ 2
3 +
2
2
Pe =
Pi = 6
+
2
2 +
+ 2
2
2
+
5
Ps
Pg = 10
43
Example 5: Compositions
P, the class of all compositions
composed of primes
P = SEQ(Z 2 + + Z5 + Z 7 + . . .)
"] _ ^2 _ ^3 _ ^5 _ ^7 _ 1 _
> f
P = 1.4762
A = .3037
interesting
calculations
omitted
(see text)
pp. 298-299
44
Qm = 4
l + l + l + l + l + l + l + l + l + l + l + l + l + l
5 + 1 + 1 + 1 + 1 + 1 + 1 + 1+1 + 1+1
5 + 5+1 + 1 + 1 + 1 + 1
5 + 5 + 5
10 + 1 + 1 + 1 + 1 + 1
10 + 5
Qi 5 = 6
45
Q ^ = (1 -z)(1 -z 5 )(1 -z 10 )( 1 -z 25 )
Dominant
na(z) ~
N 3
1 -5 • 10-25 - 3 !
N 3
7500
Residue:
singularity: po/e of order 5 1
4 = lim(1 — z) 4 Q(z)
“ 1 -5-10-25
Iim -- = -t t" = -
z->1 1 + Z + Z 2 + . . . + Z^ 1 f
46
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
^Applications of
• Bitstrings
• Compositions
• Supercritical sequence schema
CAMBRIDGE
http://ac.cs.princeton.edu
II.5c.RMapps.Compositions
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
CAMBRIDGE
^Applications of
• Bitstrings
• Restricted compositions
http://ac.cs.princeton.edu
II.5d.RMapps.SeqSchema
Sequence schema
Enumeration:
F = SEQ( G)
A = 1 fN = [z N }F(z)
1 ~ C ( Z ) gN = [Z N ]C(Z)
F = SEQi u G) — F(z, u) = - - E—
1 — uG(z)
. f*(z, U )
1 - {C{z) + (u - ^g k z k )
49
50
G'(A) A n +t
radius of
convergence of C(z)
Proof sketch:
• G(z) increases from C(0) = 0 to C(p)>l, so X is well defined.
1 1 1
51
1 1
G'(A) A N+1
construction
F(z)
2 - e 2
1 — In
1 -z
compositions C = SEQ( I )
1-2
G(z)
coefficient
asymptotics
e z — 1
In 2
N!
2(ln2) A/+1
In 1
1 -z
N!
2^-i
1 -z
Analytic transfer
Parts in compositions
1 + 1
2
1.5
1 +
+
1
1 +
+ 1
2
1
+ 1
+
2
4
3
+
2
2.5
B + 2
4 + 1
5
53
Components in surjections
What is the expected value of M in a random surjection of size N ?
1 i
1 2
2 1
(1 + 2-2)/3 = 1.666
12 1
12 2
2 11
2 12
2 2 1
1 2 3
1 3 2
2 13
2 3 1
3 1 2
3 2 1
1111
1112
112 1
12 11
2 111
112 2
12 12
2 112
2 12 1
2 2 11
12 2 1
12 2 2
2 12 2
2 2 12
2 2 2 1
12 3 1
13 2 1
2 13 1
2 3 11
3 12 1
3 2 11
12 13
13 12
2 113
3 112
112 3
113 2
12 3 3
13 2 3
2 13 3
2 3 13
3 12 3
3 2 13
13 3 2
2 3 3 1
3 13 2
3 2 3 1
3 3 12
3 3 2 1
12 3 2
13 2 2
2 13 2
2 3 12
3 12 2
3 2 12
12 2 3
2 12 3
2 3 2 1
3 2 2 1
2 2 13
2 2 3 1
12 3 4
13 2 4
2 13 4
2 3 14
3 12 4
3 2 14
12 4 3
13 4 2
2 14 3
2 3 4 1
3 14 2
3 2 4 1
14 2 3
14 3 2
2 4 13
2 4 3 1
3 4 12
3 4 2 1
4 12 3
4 13 2
4 2 13
4 2 3 1
4 3 12
4 3 2 1
3.106
54
Components in alignments
©@©
©8
nj
8 ©
nj
©©©
© 0 ®
©8
nT
(T)
p©
nT
©©©
©@©
©8
(YJ
8 ©
(YJ
©@©
OOOO x 24
OujO
x 6
( 1-12 + 2-16 + 3-36 + 4 - 24)/88 = 2.818
55
Parts in compositions
l+l+l+l+l
Components in surjections
l + l
2
1.5
1 i
1 2
2 1
(1 + 2-2)/3 = 1.666
12 1 13
1 2 2 2 1
2 11 2 3
2 12 3 1
2 2 1 3 2
(1 +2-6 + 3 • 6)/l 3 = 2
1111 17 3 1 1233 1 7 3 4
Components in alignments
OOOO x 24
56
size N is
N + 1
AC'(A)
C"(A)
C'(A)2
with variance
AC"(A) + C'(A)-C'(A)\ ,
A 2 C'(A) 3
A is the root of
C( X) = 1 in (0, p)
Proof idea:
1 [ 7 Nl C ( z )
f N [ J (1-C(Z))2
57
Number of components in supercritical sequence classes
construction
F(z)
C(z)
expected number
of components
compositions
C = SEQ( I )
1 z
1 -z
surjections
R = SEQ (SET> o( Z ))
e z — 1
In 2
N
2 - e z
' 2 In 2
alignments
O = SEQ (CYC( Z ))
1 In 1 1
1 — z
In 1
1 -z
i-l
rsj -
e - 1
A is the root of
C( A) = 1 in (0, p)
58
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
CAMBRIDGE
^Applications of
• Bitstrings
• Restricted compositions
http://ac.cs.princeton.edu
II.5d.RMapps.SeqSchema
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
http://ac.cs.princeton.edu
^Applications of
• Bitstrings
• Summary
II.5e.RMapps.Summary
class
specification
generating function
coefficient asymptotics
bitstrings
B = E + (Zo + Zi ) X B
1 — 2z
2 /v
derangements
D = SET(CYC>o( Z ))
e _z
1 -z
N\
rxj -
surjections
R = SEQ(SET>o(Z))
2 - e z
2(ln2) N+1
alignments
O = SEQ (CYC( Z ))
N\
set partitions
Sr= ZxSEQ(Z)xZxSEQ(Z+Z)x...
z r
(1 - z)... (1 -rz)
r N
r!
integers
1 = SEQ> 0 ( Z ))
1 -z
compositions
C = SEQ(I)
1 z
1 1 -z
2^-i
61
AC via meromophic asymptotics: summary of classic applications (variants)
class
specification
generating function
coefficient
asymptotics
bitstrings
4 = z<4 ( + 2 l B 4 )
1 + z + z 2 + z 3
1.092(1 .928) n
with no 0000
1 — z — z 2 — z 3 — z 4
generalized
derangements
D = SET(CYC>m( Z ))
,2 7 3 7 M
0 Z 2 3 M
N\
1 -z
qHm
double
R = SEQ(SET>i(Z))
N\
400S
surjections
2 + z - e z
• 1 vJ U 9 . \ \ /
(1.146) N
compositions
F = SEQ(Z + Z2)
.4472(1.61 8) n
of 1 s and 2s
1 - z - z 2
compositions
of primes
P = SEQ(Z 2 + Z3 + Z5 + . . .)
.3037(1.476) n
1 — z 2 — z 3 — z 5 — z 7 — . . .
denumerants
Q = MSET(Z + Z5 + Z 10 + Z25)
N 3
7500
62
class
specification
generating function
coefficient asymptotics
bitstrings
B = E + (Zo + Zi)xB
1 — 2z
2 n
derangements
D = SET(CYC>o( Z ))
e~ z
1 -z
N\
surjections
R = SEQ(SET>o(Z))
2 — e z
2(ln2) N+l
alignments
O = SEQ ( CYC( Z ))
’-■“rh
Nl
e(1 — 1 /e) N+1
class
specification
generating function
coefficient
asymptotics
bitstrings
with no 0000
B 4 = Z< 4 (E + ZiB 4 )
1 + z + z 2 + z 3
1 - z - z 2 - z 3 - z 4
1.092(1,928)~
generalized
derangements
D = SET(CYC>m( Z ))
0 z 2 i •- M
1 -z
N! L
double
R = SEQ(SET>i(Z))
1065 M
surjections
2 + z - e 7
compositions
of 1 s and 2s
F = SEQ(Z + Z 2 )
1 - z - z 2
.4472(1.61 8) n
compositions
of primes
P = SEQ(Z 2 + Z3 + Z5 + . . .)
1 - z 2 - z 3 - z 5 - z 7 - .. .
.3037(1.476) n
denumerants
Q = MSET(Z + Z* + Z'o + Z 2 5)
N 3
7500
Next: GFs that are not meromorphic (singularities are not poles).
63
ANALYTIC COMBINATORICS
PART TWO
Analytic
Combinatorics
http://ac.cs.princeton.edu
^Applications of
• Bitstrings
• Restricted compositions
• Summary
II.5e.RMapps.Summary
ANALYTIC COMBINATORICS
PART TWO
^Applications
CAMBRIDGE
http://ac.cs.princeton.edu
• Bitstrings
• Restricted compositions
• Exercises
Analytic
Combinatorics
II.5f.RMapps.Exercises
Patterns in strings.
Analytic
Combinatorics
66
Analytic
Combinatorics
67
Assignments
1. Read pages 289-300 (Applications of R&M Asymptotics) in text. Skim pages 301-
375.
Usual caveat: Try to get a feeling for what's there, not understand every detail.
3. Programming exercise.
Program V.l . In the style of the plots in the lectures slides, plot the
GFs for the set of bitstrings having no occurrence of the pattern
000000000. Do the same for 01 01 01 01 01. (See Web Exercise V.l).
Analytic
Combinatorics
68
ANALYTIC COMBINATORICS
Analytic
Combinatorics
5. Applications of
Rational and Meromor
Asymptotics
PART TWO