Getting Started

First we need to include Sigma

julia> using Sigma

Then, we create a uniform distribution x and draw 100 samples from it using rand:

julia> x = uniform(0,1)
RandVar{Float64}

julia> rand(x, 100)
100-element Array{Float64,1}:
  0.376264
  0.492391
 ...

Then we can find the probability that x^2 is greater than 0.6:

julia> prob(x^2 > 0.6)
[0.225463867187499 0.225463867187499]

Then we can introduce an exponentially distributed variable y, and find the probability that x^2 is greater than 0.6 under the condition that the sum of x and y is less than 1

julia> y = exponential(0.5)
julia> prob(x^2 > 0.6, x + y < 1)
[0.053548951048950494 0.06132144691466614]

Then, instead of computing conditional probabilities, we can sample from x under the same condition:

julia> rand(x, x + y < 1)
0.04740462764340371