Program
language cheat-sheet
Random variables and constants both use = (constants take a leading let); equality is ==; commands are plain words.
X = Unif({1..6}) | uniform on a set (dice) |
U = Unif(0, 1) | uniform on an interval |
Y = Exp(3) | exponential, rate 3 |
G = Normal(0, 1) | Gaussian (mean, sd) |
| also Bernoulli(p), Binomial(n,p), Poisson(λ), Geometric(p) | |
Z = X + Y | derived — stays coupled to X, Y |
E = (X > 3) | an event — True/False, with P(·) |
C = Coin() · E and C | Boolean(1/2); combine with and/or/not |
let n = 100 | a constant (sizes, parameters) |
V = Sample(Exp(1), n) | n independent copies → a vector |
M = AVERAGE(V) | SUM, AVERAGE, MAX, MIN, STDEV, COUNT |
condition on X^2+Y^2 <= 1 | reject states where it fails (global) |
Y = (X | X > 3) | condition one variable — its own universe |
statistic Cov(X, Y) | track an empirical statistic live |
| also Mean, SD, Var, Corr, Median, Q1, Q3, Percentile, Mode, Entropy, Max, Min | |
plot X · plot X, Y | choose what the right panel shows |
Convention (not enforced): Capitalised names for random variables, lower-case for constants, UPPERCASE for functions.
Values (live)
| variable | value | mean ± sd |
|---|