The Opposite of Numerical Analysis

The Opposite of Numerical Analysis
Des Higham
Department of Mathematics
University of Strathclyde
[email protected]
Numerical Analysis
The Opposite of Numerical Analysis
Des Higham
Department of Mathematics
University of Strathclyde
[email protected]
Overview
General Principles
Greedy Pathlengths on Small World Graphs
Mean Hitting Times in Chemical Reactions
Based on:
A matrix perturbation view of the small world
phenomenon,
D. J. Higham, SIAM Review (SIGEST), 2007.
Greedy pathlengths and small world graphs,
D. J. Higham, Linear Alg. Appl., 2006.
Comparing Hitting Time Behaviour of Markov Jump
Processes and their Diffusion Approximations,
L. Szpruch & D. J. Higham, submitted.
Hairer60
Des Higham
The Opposite of Numerical Analysis
2 / 37
Discrete versus Continuous
Typical steps in applied/computational maths
1: Discrete particle-based model
2: Continuous model
3: Discrete grid-based approximation
Hairer60
Des Higham
The Opposite of Numerical Analysis
3 / 37
Discrete versus Continuous
Typical steps in applied/computational maths
1: Discrete particle-based model
2: Continuous model
3: Discrete grid-based approximation
Numerical analysts look at the issue of
discrete versus continuous for 2–3. But similar questions
arise for 1–2.
Hairer60
Des Higham
The Opposite of Numerical Analysis
3 / 37
Milgram’s Experiment
The Small World Problem
Stanley Milgram, Psychology Today, 1967
“Given any two people in the world,
X and Z,
how many intermediate acquaintance links
are needed before X and Z are connected?”
Led to the phrase 6 degrees of separation
Hairer60
Des Higham
The Opposite of Numerical Analysis
4 / 37
Watts & Strogatz Model
“Collective dynamics of ‘small-world’ networks”
D. J. Watts and S. H. Strogatz, Nature, 1998
Small World Phenomenon arises if we have
Clustering: neighbours of neighbours tend to be
neighbours, and a
Small World: any two nodes can be connected by a
relatively short path.
Watts and Strogatz model: take a regular lattice and
randomly rewire a few nodes.
Interpolates between local and global connectedness.
The navigation issue was raised in
“Navigation in a small world”, J. Kleinberg, Nature, 2000
Hairer60
Des Higham
The Opposite of Numerical Analysis
5 / 37
Nearest neighbours: N nodes on a ring
Hairer60
Des Higham
The Opposite of Numerical Analysis
6 / 37
For each node, independently, add a new
link with probability p
Hairer60
Des Higham
The Opposite of Numerical Analysis
7 / 37
Ring with uniform shortcuts added
j
i
Hairer60
Des Higham
The Opposite of Numerical Analysis
8 / 37
Ring with uniform shortcuts added
j
j
i
i
Greedy Pathlength between nodes i and j: number of
steps to get from i to j where, on each step, we go along
the edge that take us closest to j.
Implicit in the work of Kleinberg, (Nature, 2000)
We will use a Markov chain formulation.
Hairer60
Des Higham
The Opposite of Numerical Analysis
8 / 37
Markov Chain: states
State space: distance from node 0. Size M := ⌊N/2⌋ + 1.
0
1
1
2
2
3
3
i
i
M−3
M−3
M−2
Hairer60
Des Higham
M−1
M−2
The Opposite of Numerical Analysis
9 / 37
Markov chain: transition probabilities
0
1
p*
2
p*
p*
3
1
p*
2
p*
p*
0.5(1−sum)
i−1
3
p*
0.5(1−sum)
i
i
M−3
M−3
M−2
Hairer60
i−1
Des Higham
M−1
M−2
p* := 2p/N
The Opposite of Numerical Analysis
10 / 37
Transition and Hitting
Given that the process in is state i at time n, let pij be the
probability that the process will be in state j at time
n + 1.
The transition matrix P ∈ RM×M is lower triangular and P
highly structured.
Let zi denote the expected number of steps to reach
state 0, starting from state i, and
zave
M−1
1 X
:=
zi
M
i=0
Hairer60
Des Higham
The Opposite of Numerical Analysis
11 / 37
Mean hitting time system



A

z1
z2
..
.
zM−1

 
 
=
 
where A := A1 + A2 + A3 , with . . .
Hairer60
Des Higham

1
1
..
.
1





The Opposite of Numerical Analysis
12 / 37
Mean hitting time system



A

z1
z2
..
.
zM−1


 
 
=
 
where A := A1 + A2 + A3 , with . . .

1
1
..
.
1






1


4p 
A1 := − N 


Hairer60
Des Higham
1
1
1
1
1
.. . . . .
.
.
.
1 ... ...
1
1
1






The Opposite of Numerical Analysis
12 / 37
Mean hitting time system



A

z1
z2
..
.
zM−1

 
 
=
 
where A := A1 + A2 + A3 , with . . .


1
1
..
.
1





 −1 1


−1 1
A2 := (1+ 4pN ) 

.. ..

.
.
−1
Hairer60
Des Higham

1
1






The Opposite of Numerical Analysis
12 / 37
Mean hitting time system



A


z1
z2
..
.
zM−1

 
 
=
 
1
1
..
.
1
where A := A1 + A2 + A3 , with . . .



2p 
A3 := N 


Hairer60
Des Higham






0
5
0
7
0
..
.
..
.
2M−1
0






The Opposite of Numerical Analysis
12 / 37
Continuum Limit
Guess that zi ≈ z(xi ), where
4p 1
−
N ∆x
Z
x
z(y ) dy +(1+
0
4p
2p 2x
)∆xz′ (x)+ (
+1)z(x) = 1
N
N ∆x
with xi = i∆x, ∆x := 1/(M − 1), and z(0) = 0.
Also
Z 1
zave ≈
z(y ) dy
0
Hairer60
Des Higham
The Opposite of Numerical Analysis
13 / 37
Key Lemma
Sequence {zi }M−1
i=1 arises when Euler’s method with
stepsize 2/N is applied to
z′′ (x) + p(Nx + 1)z′ (x) = 0,
z(0) = 0, z′ (0) =
N
2
Solution:
z(x) =
q
−
p √
π
N 2N
e
erf
2p
2
q
q
p √
N 2N π
e
erf
2p
2
Np
x
2
q
+
q p
2N
p
2N
,
Ry
2
where erf(y ) := √2π 0 e−t dt is the error function.
Need to prove convergence.
Relative not absolute.
Hairer60
Des Higham
The Opposite of Numerical Analysis
14 / 37
p = KN , for fixed K , with N → ∞
K=10
1200
N=4000
N=2000
N=1000
1000
z(x)
800
600
400
200
0
0
0.2
0.4
0.6
0.8
1
x
ODE has uniformly bounded global Lipschitz constant, L.
Taylor series plus Gronwall gives
1
sup |zj − z(j∆x)| ≤ C(L) max {|z′′ (x)| + |z′′′ (x)|}
N [0,1]
1≤j≤M−1
Since z′′ (x) and z′′′ (x) are O(N), overall error is O(1).
Hairer60
Des Higham
The Opposite of Numerical Analysis
15 / 37
p = KN , for fixed K , with N → ∞
Theorem
Mean hitting time zi satisfies
√ !
i 2K
+ O(1)
N
√
π
zi = N √ erf
2 2K
and
zave
Hairer60
N
=
2K
√
2K π
erf
2
Des Higham
√
2K
2
!
+e
− 12
!
K −1
+ O(1)
The Opposite of Numerical Analysis
16 / 37
K
N
Reduction ratio: p =
√
zave (K )
2
=
zave (0)
K
√
2K π
erf
2
2K
2
!
+e
1
− K2
!
−1
+ O(N −1 )
Greedy
Global
Mean−field
0.9
0.8
Pathlength
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
−2
10
0
2
10
10
4
10
K
Hairer60
Des Higham
The Opposite of Numerical Analysis
17 / 37
0 < p < 1 constant, with N → ∞
z(x) ≈
q
′
z (x) ≈
p √
N 4N π
e
erf
p
2
N −
e
2
Npx 2 px
−
4
2
√
Np
x
2
+
1
2
q p
N
p=0.5
100
90
80
70
z(x)
60
50
40
30
20
10
N=4000
N=2000
N=1000
0
0
0.2
0.4
0.6
0.8
1
x
x⋆ :=
Hairer60
s
2 ln N
Np
Des Higham
⇒
max
{|z ′′ (x)|, |z ′′′ (x)|}} = O(N −1 )
⋆
[x ,1]
The Opposite of Numerical Analysis
18 / 37
0 < p < 1 constant, with N → ∞
Theorem
Mean hitting time zi satisfies
√
1 p 1
π
zi = N 2 p erf N − 2 i 2p + O (log N)2
2 2p
and
zave
√
π
= N p + O (log N)2 .
2 2p
1
2
Note traditional pathlength is like ln N.
(Greedy alg. is exponentially worse than breadth first
search—similar conclusion on a different model by
Kleinberg, 2000.)
Hairer60
Des Higham
The Opposite of Numerical Analysis
19 / 37
Markov Jump Versus Diffusion
In many applications,including
chemistry,
cell biology,
population dynamics,
epidemiology,
we can model at different levels:
E.g.
CME (Gillespie): what is probability that we have 237
proteins at time t?
CLE: what is probability that the protein concentration
is between 2.7 and 3.1 at time t?
RRE (mass action ODE): what is the protein
concentration at time t?
These modeling regimes ‘converge’ when the population
size increases . . . . . . how do we quantify this?
Hairer60
Des Higham
The Opposite of Numerical Analysis
20 / 37
c=1
Example: S → ∅, start with 10 molecules
12
10
8
6
4
2
0
0
0.5
1
CME
Hairer60
Des Higham
1.5
2
CLE
2.5
3
3.5
4
RRE
The Opposite of Numerical Analysis
21 / 37
c=1
Example: S → ∅, start with 100 molecules
100
90
80
70
60
50
40
30
20
10
0
0
1
CME
Hairer60
Des Higham
2
3
CLE
4
5
RRE
The Opposite of Numerical Analysis
22 / 37
Focus here on mean hitting time
b
x
a
Hairer60
Des Higham
The Opposite of Numerical Analysis
23 / 37
E[T(x)]
Focus here on mean hitting time
a
Hairer60
Des Higham
x
b
The Opposite of Numerical Analysis
24 / 37
Markov jump/birth & death process, Z(t)
Discrete states {0, 1, 2, . . . , M}, with 0 and M absorbing:
P (Z(t + h) = i + 1 | Z(t) = i) = Bi h + o(h),
P (Z(t + h) = i − 1 | Z(t) = i) = Di h + o(h),
P (Z(t + h) = i | Z(t) = i) = 1 − (Bi + Di )h + o(h).
Here, B0 = D0 = BM = DM = 0.
Starting at state Z(0) = j, the expected time to be absorbed
into state 0 or M is given by Uj , where
 (B + D )
1
1
−D2











Hairer60
−B1
(B2 + D2 )
..
.
−B2
..
.
..
.
..
.
..
.
..
.
..
..
Des Higham

.
.
−DM−1
−BM−2
(BM−1 + DM−1 )











U1
U2
U3
.
..
..
.
UM−1
The Opposite of Numerical Analysis


1
  1 

 
  1 

 
  . 
= . 
  . 

 
  .. 
  . 
1

25 / 37
Numerical Analysis Viewpoint
Linear system can be written, for 1 ≤ i ≤ M − 1
Bi + Di
Ui+1 − Ui−1
(Ui+1 − 2Ui + Ui−1 ) + (Bi − Di )
= −1
2
2
Standard finite differences on the 2 point BVP ODE
B(x) + D(x) ′′
u (x) + (B(x) − D(x)) u ′ (x) = −1,
2
with u(a) = u(b) = 0
Here b − a = M and we have ∆x = 1
Interesting regime is M → ∞
Hairer60
Des Higham
The Opposite of Numerical Analysis
26 / 37
Diffusion Approximation
SDE:
dy(t) = (B(y(t)) − D(y(t))) dt
p
p
+ B(y(t)) dW1 (t) − D(y(t)) dW2 (t)
Let w (x) := E[T (x)] be the average first time to hit a or b,
given that y(0) = x.
Then w (x) satisfies the same 2 point BVP ODE.
Want to show that this ODE ‘converges’ to the the finite
difference scheme.
Focus on specific examples . . .
Hairer60
Des Higham
The Opposite of Numerical Analysis
27 / 37
Production from a source
k
∅→X
Bi = k
and
Di = 0
Mean exit times:
Jump process
b−x
k
Diffusion process
1 −e−2x + e−2a −e−2b 2b
2x
e −e
+b−x
k −e−2b + e−2a
2
−e−2x + e−2a
e−2a 2x
2a
a−x +
e −e
+ 1−
−e−2b + e−2a
2
Hairer60
Des Higham
The Opposite of Numerical Analysis
28 / 37
Convergence: fix a = 0 and let b → ∞
With x = αb for fixed α ∈ (0, 1), we have
|Jump − Diffusion| ≤ Ce−b min{2(1−α),α)}
where C is independent of b.
Example: k = 5, a = 0, α = 21 :
0
10
−2
Absolute Difference in Exit Time
10
−4
10
−6
10
−8
10
−10
10
−12
10
−14
10
0
10
1
10
2
10
b
Hairer60
Des Higham
The Opposite of Numerical Analysis
29 / 37
Production
cX
∅→X
Bi = i
and
Di = 0
Mean exit times:
Jump process
b−1
1X1
c s=x s
Diffusion process
Z b 2l
1 e−2x − e−2a
e
−2b
−e
dl + ln b − ln x
c e−2b − e−2a
l
x
Z x 2l e−2x − e−2a
e
−2a
ln a − ln x + e
dl
+ 1 − −2b
−2a
e
−e
l
a
Hairer60
Des Higham
The Opposite of Numerical Analysis
30 / 37
Convergence
With x = αb for fixed α ∈ (0, 1), we have
|Jump (with a = 0) − lim Diffusion| ≤ Cb−2
aց0
where C is independent of b.
Proof Uses the expansions
n
X
1
s
s=1
Z x
= ln n + γ +
1
+ O(n−2 ),
2n
as n → ∞,
et
dt = γ + ln x + o(1), as x → 0,
−∞ t
where the Euler-Mascheroni constant γ = 0.5772 . . ., and
Z x t
e
ex
1
−2
dt =
1 + + O(x ) , as x → ∞.
x
x
−∞ t
Hairer60
Des Higham
The Opposite of Numerical Analysis
31 / 37
Example, c = 5, a = 10−3 , α = 21
−3
Absolute Difference in Exit Time
10
−4
10
−5
10
−6
10
−7
10
1
2
10
10
3
10
b
Hairer60
Des Higham
The Opposite of Numerical Analysis
32 / 37
Degradation
cX
X →∅
Bi = 0 and
Di = i
Mean exit times:
Jump process
x
1 X 1
c
s
s=a+1
Diffusion process
Z b −2l
e2x − e2a 1
e
2b
e
dl − ln b + ln x
e2b − e2a c
l
x
Z x −2l e2x − e2a 1
e
2a
+ [1 − 2b
]
ln x − ln a − e
dl
2a
e −e
c
l
a
Hairer60
Des Higham
The Opposite of Numerical Analysis
33 / 37
Convergence
With x = αb for fixed α ∈ (0, 1), we have
lim lim (Jump − Diffusion) =
aց0 b→∞
− ln 2
c
Proof Uses asymptotic expansions for
Z ∞ −t
e
E1 (x) =
dt,
x > 0.
t
x
Note: the actual hitting times grow like ln(b), so we have
relative convergence like O(1/ ln b).
Hairer60
Des Higham
The Opposite of Numerical Analysis
34 / 37
Example, c = 5, α = 12 , a = 10−2 , 10−4 , 10−8
0.14
Absolute Difference in Exit Time
0.13
0.12
0.11
0.1
0.09
0.08
0.07
0.06
a=1e−2
a=1e−4
a=1e−8
0.05
0.04
0
5
10
15
20
25
30
b
ln 2
= 0.1386 . . .
5
Hairer60
Des Higham
The Opposite of Numerical Analysis
35 / 37
Discussion
This approach of expanding exact solutions breaks down
for more complicated scenarios. E.g.
k
cX
∅→X →∅
involves integrals of the incomplete Gamma function.
Is there a general framework for analysing finite difference
schemes in this non-standard context? At best,
convergence is relative not absolute .
Looking at mean hitting times is practically relevant, and
avoids pitfalls that can arise through the SDE breaking down .
E.g. consider the reversible isometry
c X
1 1
X1 ←→
X2
c2 X2
Hairer60
Des Higham
The Opposite of Numerical Analysis
36 / 37
Take Home Message
Fundamental modelling issues produce some fascinating,
unanswered,
continuous versus discrete
problems that should be attractive to numerical analysts.
Hairer60
Des Higham
The Opposite of Numerical Analysis
37 / 37