# Code

## Conformal Probability in Julia

My GitHub page provides tools for working with common discrete statistical physics models: the dimer model, the loop-erased random walk, the uniform spanning tree, and the discrete Gaussian free field. The packages are written in Julia, for two reasons:

• It’s simple. Julia’s syntax is readable and standard, so experience with Julia is not a prerequisite for using and modifying the code. Furthermore, Julia can be run online at JuliaBox, so you don’t need to install anything.
• It’s fast. Julia is designed from the ground up to be efficiently just-in-time compiled. This means that, after a small compilation delay on each function’s first call, you can expect to get C-like speed with simple, idiomatic Julia code.

Instructions for getting started are below.

## Examples

### The SLE fan

using AsyPlots
using FractionalGaussianFields
n = 250
h = zeroboundary(torus_gff(n))
κ = 3
χ = 2/sqrt(κ) - sqrt(κ)/2
z0 = (n+1)/2 + im*(n+1)/2
L = 40
C = Colors.colormap("Blues",L)
paths = [Path(flowline(h, z0, χ, θ),color=c)
for (θ,c) in zip(linspace(0,2π,L),C)]
Plot(paths,bgcolor="Black",border=0)


### GFF level lines

using AsyPlots
using Contour
using FractionalGaussianFields
n = 250
h = zeroboundary(torus_gff(n))
levellines = contour(1.0:n,1.0:n,h,0.0)
C = Colors.distinguishable_colors(length(levellines),
lchoices=linspace(90,100,10))
loops = [Polygon(l,color=c) for (c,l) in zip(C.levellines)]
P = Plot(loops,bgcolor="Black")


### A Gaussian free field surface plot

using AsyPlots
using FractionalGaussianFields
h = zeroboundary(torus_gff(50))
plot(h)


### Conformal maps

using AsyPlots
using ConformalMaps
slitdomain = 2*[0.0,
0.495,
0.5 + 0.25*im,
0.505,
1.0,
1.0 + 1.0*im,
im]
f = ConformalMap(slitdomain,1+im)
g = inv(f)
visualize(g)


### Wooded triangulations

using PlanarMaps, AsyPlots
draw(UWT(100),fillfaces=true,linecolor="black")


## Getting Started

Pkg.add("AsyPlots")

3. That’s it! You can learn about the language on the Julia learning page, and you can read the package documentation and see more examples on my GitHub page. To inspect the source code, open the src directory on GitHub and look at PackageName.jl.