In [1]:
push!(LOAD_PATH, "$(pwd())/../src"); using PyPlot, StatsBase, Distributions, StochasticProcesses;
In [20]:
type Pearson
a
end
Distributions.pdf(p::Pearson, t) = abs(p.a)*exp(-p.a^2/(2*t))*t^(-3/2)/sqrt(2*pi)
In [32]:
plt[:hist](sim(FirstTime(BrownianMotion(), (t, y) -> y > .5), linspace(0, 10, 10000), 10000), bins=50, normed=true);
let x=linspace(0,10,1000)
plot(x, (x -> pdf(Pearson(.5), x)).(x), color="red");
end
Out[32]:
In [33]:
sim(FirstTime(BrownianMotion(), (t, y) -> y > 1), linspace(0, 1, 10000), 5)
Out[33]:
In [ ]: