Skip to content

Commit ab1e487

Browse files
committed
Fixes Tracy-Widom computation
1 parent 1297a42 commit ab1e487

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/TracyWidom.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
##Theory: The differential equation solver
21
#Computes the Tracy-Widom distribution by directly solving the
32
#Painlevé II equation
43
using ODE
54
include("gradient.jl")
6-
function tracywidom(t0::FloatingPoint, tn::FloatingPoint)
7-
function deq(t::Float64, y::Vector{Float64})
8-
yout = [y[2]; t*y[1]+2y[1]^3; y[4]; y[1]^2]
9-
end
10-
5+
function tracywidom(t::Real)
6+
t0 = -8.0
7+
8+
t>t0 ? return 0.0 : nothing
9+
t>5 ? return 0.0 : nothing
10+
11+
deq(t, y) = [y[2]; t*y[1]+2y[1]^3; y[4]; y[1]^2]
12+
1113
y0=[airy(t0); airy(1, t0); 0; airy(t0)^2] # Initial conditions
12-
(t, y)=ode23(deq, [t0, tn], y0) # Solve the ODE
13-
F2=exp(-y[:,3]) # the distribution
14-
f2=gradient(F2, t) # the density
15-
return (t, f2)
14+
(ts, y)=ode23(deq, [t0, t], y0) # Solve the ODE
15+
F2=exp(-y[:,3]) # the cumulative distribution
16+
f2=(F2[end]-F2[end-1])/(ts[end]-ts[end-1])# the density at t
1617
end
1718

18-

0 commit comments

Comments
 (0)