[ANN] QuasiMonteCarlo.jl

I’ve started a library to make it convenient to do quasi Monte Carlo simulations. This leverages @stevengj’s Sobol.jl, @tkf’s Transducers.jl, and Mose Giordano et al’s Measurements.jl

EDIT: Forgot to link to it: QuasiMonteCarlo.jl

Here’s a little example:

julia> incircle(x) = transpose(x) * x < 1
incircle (generic function with 1 method)

julia> computeπ(tol) = foldl(right, 
              Map(incircle) 
           |> Mean() 
           |> Drop(10) 
           |> Map(x -> x*4) 
           |> TakeWhile(x -> x.err > tol)
           , Quasi(2)
           )
computeπ (generic function with 1 method)

julia> computeπ(0.001)
3.1417 ± 0.001

I’m moving toward implementing other distributions as well; here’s a little demo with normals:

julia> collect(Map(x -> x[1]) |> Mean() |> Take(10), StdNormals(1))
10-element Array{Measurements.Measurement{Float64},1}:
   0.0 ± 0.0 
  0.34 ± 0.24
  -0.0 ± 0.32
 -0.08 ± 0.25
  0.17 ± 0.3 
  0.19 ± 0.25
  -0.0 ± 0.28
 -0.11 ± 0.26
 -0.04 ± 0.24
  0.11 ± 0.26
7 Likes