Squiggle logoSquiggle
API

Sym

The Sym module provides functions to create some common symbolic distributions.

All these functions match the functions for creating sample set distributions, but produce symbolic distributions instead. Symbolic distributions won't capture correlations, but are more performant than sample distributions.

normal

Signatures
Sym.normal(Number, Number) => SymbolicDist
Sym.normal({p5: Number, p95: Number}) => SymbolicDist
Sym.normal({p10: Number, p90: Number}) => SymbolicDist
Sym.normal({p25: Number, p75: Number}) => SymbolicDist
Sym.normal({mean: Number, stdev: Number}) => SymbolicDist
Examples
Sym.normal(5, 1)
Sym.normal({ p5: 4, p95: 10 })
Sym.normal({ p10: 4, p90: 10 })
Sym.normal({ p25: 4, p75: 10 })
Sym.normal({ mean: 5, stdev: 2 })

lognormal

Signatures
Sym.lognormal(Number, Number) => SymbolicDist
Sym.lognormal({p5: Number, p95: Number}) => SymbolicDist
Sym.lognormal({p10: Number, p90: Number}) => SymbolicDist
Sym.lognormal({p25: Number, p75: Number}) => SymbolicDist
Sym.lognormal({mean: Number, stdev: Number}) => SymbolicDist
Examples
Sym.lognormal(0.5, 0.8)
Sym.lognormal({ p5: 4, p95: 10 })
Sym.lognormal({ p10: 4, p90: 10 })
Sym.lognormal({ p25: 4, p75: 10 })
Sym.lognormal({ mean: 5, stdev: 2 })

uniform

Signatures
Sym.uniform(Number, Number) => SymbolicDist
Examples
Sym.uniform(10, 12)

beta

Signatures
Sym.beta(Number, Number) => SymbolicDist
Sym.beta({mean: Number, stdev: Number}) => SymbolicDist
Examples
Sym.beta(20, 25)
Sym.beta({ mean: 0.39, stdev: 0.1 })

cauchy

Signatures
Sym.cauchy(Number, Number) => SymbolicDist
Examples
Sym.cauchy(5, 1)

gamma

Signatures
Sym.gamma(Number, Number) => SymbolicDist
Examples
Sym.gamma(5, 1)

logistic

Signatures
Sym.logistic(Number, Number) => SymbolicDist
Examples
Sym.logistic(5, 1)

exponential

Signatures
Sym.exponential(Number) => SymbolicDist
Examples
Sym.exponential(2)

bernoulli

Signatures
Sym.bernoulli(Number) => SymbolicDist
Examples
Sym.bernoulli(0.5)

pointMass

Point mass distributions are already symbolic, so you can use the regular pointMass function.

Namespace optional
Signatures
Sym.pointMass(Number) => SymbolicDist
Examples
pointMass(0.5)

triangular

Signatures
Sym.triangular(Number, Number, Number) => SymbolicDist
Examples
Sym.triangular(3, 5, 10)

On this page