Walker on a strip
Assume the probability of the walker being on some x be denoted by an array called the state vector, denoted by
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
xxxxxxxxxx
1
1
ψ = zeros(Float64, 100); ψ[50] = 1; ψ
Further, every step basically shifts around the probability. Assume that the probability of a particle jumping left is
Another way to look at this is to see influx and outflux.
Now this dynamics has a very important property. It is memoryless. It doesn't matter how we got there, but the previous step determines the next. Mathematically, this means,
such maps are called Markovian maps and they can be represented as a single matrix operation on the state vector.
Explicitly, the matrix is
xxxxxxxxxx
1
1
using LinearAlgebra
M (generic function with 1 method)
xxxxxxxxxx
1
1
M(pl, pr, n) = Tridiagonal(fill(pr, n-1), fill(1-pr-pl, n), fill(pl, n-1))
5×5 Tridiagonal{Float64, Vector{Float64}}:
0.8 0.1 ⋅ ⋅ ⋅
0.1 0.8 0.1 ⋅ ⋅
⋅ 0.1 0.8 0.1 ⋅
⋅ ⋅ 0.1 0.8 0.1
⋅ ⋅ ⋅ 0.1 0.8
xxxxxxxxxx
1
1
M(0.1, 0.1, 5)
xxxxxxxxxx
1
1
using Plots
xxxxxxxxxx
8
1
let
2
ψ = zeros(Float64, 100); ψ[50] = 1; ψ
3
m = M(0.1, 0.1, 100)
4
for i in 1:100
5
ψ .= m*ψ
6
plot(-50:49, ψ, ylims=(0,1))
7
end
8
end
x
12
1
let
2
ψ = zeros(Float64, 99); ψ[50] = 100; ψ
3
m = M(0.3, 0.3, 99)
4
q = plot([0], [100], ylims=(0,120))
5
a = for i in 1:50
6
ψ .= round.(m*ψ)
7
p=plot(-49:49, ψ, ylims=(0,50))
8
push!(q[1][1], sum(ψ))
9
plot(p,q, layout=(2,1))
10
end
11
gif(a)
12
end
x
1
let
2
ψ = zeros(Float64, 99); ψ[50] = 100; ψ
3
m = M(0.1, 0.1, 99)
4
q = plot([0], [100], ylims=(0,120))
5
a = for i in 1:50
6
ψ .= round.(m*ψ)
7
p=plot(-49:49, ψ, ylims=(0,50))
8
push!(q[1][1], sum(ψ))
9
plot(p,q, layout=(2,1))
10
end
11
gif(a)
12
end
x
1
let
2
ψ = zeros(Float64, 99); ψ[[46,54]] .= 75; ψ
3
m = M(0.3, 0.3, 99)
4
q = plot([0], [150], ylims=(0,170))
5
a = for i in 1:100
6
ψ .= round.(m*ψ)
7
p=plot(-49:49, ψ, ylims=(0,50))
8
push!(q[1][1], sum(ψ))
9
plot(p,q, layout=(2,1))
10
end
11
gif(a)
12
end