Formatted code

This commit is contained in:
Ozzie Gooen 2022-06-05 14:13:56 -07:00
parent d49f7889b0
commit 4409ceb6c7
9 changed files with 169 additions and 205 deletions

View File

@ -9,49 +9,42 @@ title: Dict
(dict<a>):string (dict<a>):string
``` ```
### get ### get
```javascript ```javascript
(dict<a>, string):a (dict<a>, string):a
``` ```
### set ### set
```javascript ```javascript
(dict<a>, string, a):a (dict<a>, string, a):a
``` ```
### toPairs ### toPairs
```javascript ```javascript
(dict<a>):list<list<string|a>> (dict<a>):list<list<string|a>>
``` ```
### keys ### keys
```javascript ```javascript
(dict<a>):list<string> (dict<a>):list<string>
``` ```
### values ### values
```javascript ```javascript
(dict<a>):list<a> (dict<a>):list<a>
``` ```
### merge ### merge
```javascript ```javascript
(dict<a>, dict<b>):dict<a|b> (dict<a>, dict<b>):dict<a|b>
``` ```
### mergeMany ### mergeMany
```javascript ```javascript

View File

@ -2,6 +2,7 @@
sidebar_position: 2 sidebar_position: 2
title: Distribution title: Distribution
--- ---
## Main ## Main
### mixture ### mixture
@ -11,11 +12,13 @@ title: Distribution
``` ```
**Examples** **Examples**
```javascript ```javascript
mixture(normal(5,1), normal(10,1)) mixture(normal(5, 1), normal(10, 1));
``` ```
### sample ### sample
Get one random sample from the distribution Get one random sample from the distribution
```javascript ```javascript
@ -23,11 +26,13 @@ Get one random sample from the distribution
``` ```
**Examples** **Examples**
```javascript ```javascript
sample(normal(5,2)) sample(normal(5, 2));
``` ```
### sampleN ### sampleN
Get n random samples from the distribution Get n random samples from the distribution
```javascript ```javascript
@ -35,11 +40,13 @@ Get n random samples from the distribution
``` ```
**Examples** **Examples**
```javascript ```javascript
sample(normal(5,2), 100) sample(normal(5, 2), 100);
``` ```
### mean ### mean
Get the distribution mean Get the distribution mean
```javascript ```javascript
@ -47,8 +54,9 @@ Get the distribution mean
``` ```
**Examples** **Examples**
```javascript ```javascript
mean(normal(5,2)) mean(normal(5, 2));
``` ```
### stdev ### stdev
@ -57,21 +65,18 @@ mean(normal(5,2))
(distribution):number (distribution):number
``` ```
### variance ### variance
```javascript ```javascript
(distribution):number (distribution):number
``` ```
### mode ### mode
```javascript ```javascript
(distribution):number (distribution):number
``` ```
### cdf ### cdf
```javascript ```javascript
@ -79,8 +84,9 @@ mean(normal(5,2))
``` ```
**Examples** **Examples**
```javascript ```javascript
cdf(normal(5,2), 3) cdf(normal(5, 2), 3);
``` ```
### pdf ### pdf
@ -90,8 +96,9 @@ cdf(normal(5,2), 3)
``` ```
**Examples** **Examples**
```javascript ```javascript
pdf(normal(5,2), 3) pdf(normal(5, 2), 3);
``` ```
### pmf ### pmf
@ -101,8 +108,9 @@ pdf(normal(5,2), 3)
``` ```
**Examples** **Examples**
```javascript ```javascript
pmf(bernoulli(0.3), 0) // 0.7 pmf(bernoulli(0.3), 0); // 0.7
``` ```
### inv ### inv
@ -112,11 +120,13 @@ pmf(bernoulli(0.3), 0) // 0.7
``` ```
**Examples** **Examples**
```javascript ```javascript
inv(normal(5,2), 0.5) inv(normal(5, 2), 0.5);
``` ```
### toPointSet ### toPointSet
Converts a distribution to the pointSet format Converts a distribution to the pointSet format
```javascript ```javascript
@ -124,11 +134,13 @@ Converts a distribution to the pointSet format
``` ```
**Examples** **Examples**
```javascript ```javascript
toPointSet(normal(5,2)) toPointSet(normal(5, 2));
``` ```
### toSampleSet ### toSampleSet
Converts a distribution to the sampleSet format, with n samples Converts a distribution to the sampleSet format, with n samples
```javascript ```javascript
@ -136,11 +148,13 @@ Converts a distribution to the sampleSet format, with n samples
``` ```
**Examples** **Examples**
```javascript ```javascript
toSampleSet(normal(5,2)) toSampleSet(normal(5, 2));
``` ```
### truncateLeft ### truncateLeft
Truncates the left side of a distribution. Returns either a pointSet distribution or a symbolic distribution. Truncates the left side of a distribution. Returns either a pointSet distribution or a symbolic distribution.
```javascript ```javascript
@ -148,11 +162,13 @@ Truncates the left side of a distribution. Returns either a pointSet distributio
``` ```
**Examples** **Examples**
```javascript ```javascript
truncateLeft(normal(5,2), 3) truncateLeft(normal(5, 2), 3);
``` ```
### truncateRight ### truncateRight
Truncates the right side of a distribution. Returns either a pointSet distribution or a symbolic distribution. Truncates the right side of a distribution. Returns either a pointSet distribution or a symbolic distribution.
```javascript ```javascript
@ -160,11 +176,13 @@ Truncates the right side of a distribution. Returns either a pointSet distributi
``` ```
**Examples** **Examples**
```javascript ```javascript
truncateLeft(normal(5,2), 6) truncateLeft(normal(5, 2), 6);
``` ```
### klDivergence ### klDivergence
KullbackLeibler divergence between two distributions KullbackLeibler divergence between two distributions
```javascript ```javascript
@ -172,8 +190,9 @@ KullbackLeibler divergence between two distributions
``` ```
**Examples** **Examples**
```javascript ```javascript
klDivergence(normal(5,2), normal(5,4)) // returns 0.57 klDivergence(normal(5, 2), normal(5, 4)); // returns 0.57
``` ```
### logScore ### logScore
@ -183,8 +202,9 @@ klDivergence(normal(5,2), normal(5,4)) // returns 0.57
``` ```
**Examples** **Examples**
```javascript ```javascript
logScore({estimate: normal(5,2), prior: normal(5.5,4), answer: 2.3}) logScore({ estimate: normal(5, 2), prior: normal(5.5, 4), answer: 2.3 });
``` ```
### toString ### toString
@ -194,11 +214,13 @@ logScore({estimate: normal(5,2), prior: normal(5.5,4), answer: 2.3})
``` ```
**Examples** **Examples**
```javascript ```javascript
toString(normal(5,2)) toString(normal(5, 2));
``` ```
### toSparkline ### toSparkline
Produce a sparkline of length n Produce a sparkline of length n
```javascript ```javascript
@ -206,11 +228,13 @@ Produce a sparkline of length n
``` ```
**Examples** **Examples**
```javascript ```javascript
toSparkline(normal(5,2), 10) toSparkline(normal(5, 2), 10);
``` ```
### inspect ### inspect
Prints the value of the distribution to the Javascript console, then returns the distribution. Prints the value of the distribution to the Javascript console, then returns the distribution.
```javascript ```javascript
@ -218,11 +242,13 @@ Prints the value of the distribution to the Javascript console, then returns the
``` ```
**Examples** **Examples**
```javascript ```javascript
inspect(normal(5,2)) inspect(normal(5, 2));
``` ```
### normalize ### normalize
Normalize a distribution. This means scaling it appropriately so that it's cumulative sum is equal to 1. Normalize a distribution. This means scaling it appropriately so that it's cumulative sum is equal to 1.
```javascript ```javascript
@ -230,11 +256,13 @@ Normalize a distribution. This means scaling it appropriately so that it's cumul
``` ```
**Examples** **Examples**
```javascript ```javascript
normalize(normal(5,2)) normalize(normal(5, 2));
``` ```
### isNormalized ### isNormalized
Check of a distribution is normalized. Most distributions are typically normalized, but there are some commands that could produce non-normalized distributions. Check of a distribution is normalized. Most distributions are typically normalized, but there are some commands that could produce non-normalized distributions.
```javascript ```javascript
@ -242,11 +270,13 @@ Check of a distribution is normalized. Most distributions are typically normaliz
``` ```
**Examples** **Examples**
```javascript ```javascript
isNormalized(normal(5,2)) // returns true isNormalized(normal(5, 2)); // returns true
``` ```
### integralSum ### integralSum
Get the sum of the integral of a distribution. If the distribution is normalized, this will be 1. Get the sum of the integral of a distribution. If the distribution is normalized, this will be 1.
```javascript ```javascript
@ -254,8 +284,9 @@ Get the sum of the integral of a distribution. If the distribution is normalized
``` ```
**Examples** **Examples**
```javascript ```javascript
integralSum(normal(5,2)) integralSum(normal(5, 2));
``` ```
### add ### add
@ -264,171 +295,146 @@ integralSum(normal(5,2))
(distributionLike, distributionLike): distribution (distributionLike, distributionLike): distribution
``` ```
### sum ### sum
```javascript ```javascript
(list<distributionLike>): distribution (list<distributionLike>): distribution
``` ```
### multiply ### multiply
```javascript ```javascript
(distributionLike, distributionLike): distribution (distributionLike, distributionLike): distribution
``` ```
### product ### product
```javascript ```javascript
(list<distributionLike>): distribution (list<distributionLike>): distribution
``` ```
### subtract ### subtract
```javascript ```javascript
(distributionLike, distributionLike): distribution (distributionLike, distributionLike): distribution
``` ```
### divide ### divide
```javascript ```javascript
(distributionLike, distributionLike): distribution (distributionLike, distributionLike): distribution
``` ```
### pow ### pow
```javascript ```javascript
(distributionLike, distributionLike): distribution (distributionLike, distributionLike): distribution
``` ```
### exp ### exp
```javascript ```javascript
(distributionLike, distributionLike): distribution (distributionLike, distributionLike): distribution
``` ```
### log ### log
```javascript ```javascript
(distributionLike, distributionLike): distribution (distributionLike, distributionLike): distribution
``` ```
### log10 ### log10
```javascript ```javascript
(distributionLike, distributionLike):distribution (distributionLike, distributionLike):distribution
``` ```
### unaryMinus ### unaryMinus
```javascript ```javascript
(distribution):distribution (distribution):distribution
``` ```
### dotAdd ### dotAdd
```javascript ```javascript
(distributionLike, distributionLike): distribution (distributionLike, distributionLike): distribution
``` ```
### dotSum ### dotSum
```javascript ```javascript
(list<distributionLike>): distribution (list<distributionLike>): distribution
``` ```
### dotMultiply ### dotMultiply
```javascript ```javascript
(distributionLike, distributionLike): distribution (distributionLike, distributionLike): distribution
``` ```
### dotProduct ### dotProduct
```javascript ```javascript
(list<distributionLike>): distribution (list<distributionLike>): distribution
``` ```
### dotSubtract ### dotSubtract
```javascript ```javascript
(distributionLike, distributionLike): distribution (distributionLike, distributionLike): distribution
``` ```
### dotDivide ### dotDivide
```javascript ```javascript
(distributionLike, distributionLike): distribution (distributionLike, distributionLike): distribution
``` ```
### dotPow ### dotPow
```javascript ```javascript
(distributionLike, distributionLike): distribution (distributionLike, distributionLike): distribution
``` ```
### dotExp ### dotExp
```javascript ```javascript
(distributionLike, distributionLike): distribution (distributionLike, distributionLike): distribution
``` ```
### scaleMultiply ### scaleMultiply
```javascript ```javascript
(distributionLike, distributionLike): distribution (distributionLike, distributionLike): distribution
``` ```
### scalePow ### scalePow
```javascript ```javascript
(distributionLike, distributionLike): distribution (distributionLike, distributionLike): distribution
``` ```
### scaleExp ### scaleExp
```javascript ```javascript
(distributionLike, distributionLike): distribution (distributionLike, distributionLike): distribution
``` ```
### scaleLog ### scaleLog
```javascript ```javascript
(distributionLike, distributionLike): distribution (distributionLike, distributionLike): distribution
``` ```
### scaleLog10 ### scaleLog10
```javascript ```javascript
(distributionLike, distributionLike): distribution (distributionLike, distributionLike): distribution
``` ```
### scaleLogWithThreshold ### scaleLogWithThreshold
```javascript ```javascript
(distributionLike, distributionLike, number): distribution (distributionLike, distributionLike, number): distribution
``` ```

View File

@ -6,114 +6,135 @@ title: Distribution Creation
## Normal Distribution ## Normal Distribution
**Definitions** **Definitions**
```javascript ```javascript
normal(frValueDistOrNumber, frValueDistOrNumber) normal(frValueDistOrNumber, frValueDistOrNumber);
``` ```
```javascript ```javascript
normal(dict<{p5: frValueDistOrNumber, p95: frValueDistOrNumber}>) normal(dict<{p5: frValueDistOrNumber, p95: frValueDistOrNumber}>)
``` ```
```javascript ```javascript
normal(dict<{mean: frValueDistOrNumber, stdev: frValueDistOrNumber}>) normal(dict<{mean: frValueDistOrNumber, stdev: frValueDistOrNumber}>)
``` ```
**Examples** **Examples**
```javascript ```javascript
normal(5,1) normal(5, 1);
normal({p5: 4, p95: 10}) normal({ p5: 4, p95: 10 });
normal({mean: 5, stdev: 2}) normal({ mean: 5, stdev: 2 });
``` ```
## Lognormal Distribution ## Lognormal Distribution
**Definitions** **Definitions**
```javascript ```javascript
lognormal(frValueDistOrNumber, frValueDistOrNumber) lognormal(frValueDistOrNumber, frValueDistOrNumber);
``` ```
```javascript ```javascript
lognormal(dict<{p5: frValueDistOrNumber, p95: frValueDistOrNumber}>) lognormal(dict<{p5: frValueDistOrNumber, p95: frValueDistOrNumber}>)
``` ```
```javascript ```javascript
lognormal(dict<{mean: frValueDistOrNumber, stdev: frValueDistOrNumber}>) lognormal(dict<{mean: frValueDistOrNumber, stdev: frValueDistOrNumber}>)
``` ```
**Examples** **Examples**
```javascript ```javascript
lognormal(0.5, 0.8) lognormal(0.5, 0.8);
lognormal({p5: 4, p95: 10}) lognormal({ p5: 4, p95: 10 });
lognormal({mean: 5, stdev: 2}) lognormal({ mean: 5, stdev: 2 });
``` ```
## Uniform Distribution ## Uniform Distribution
**Definitions** **Definitions**
```javascript ```javascript
uniform(frValueDistOrNumber, frValueDistOrNumber) uniform(frValueDistOrNumber, frValueDistOrNumber);
``` ```
**Examples** **Examples**
```javascript ```javascript
uniform(10, 12) uniform(10, 12);
``` ```
## Beta Distribution ## Beta Distribution
**Definitions** **Definitions**
```javascript ```javascript
beta(frValueDistOrNumber, frValueDistOrNumber) beta(frValueDistOrNumber, frValueDistOrNumber);
``` ```
**Examples** **Examples**
```javascript ```javascript
beta(20, 25) beta(20, 25);
``` ```
## Cauchy Distribution ## Cauchy Distribution
**Definitions** **Definitions**
```javascript ```javascript
cauchy(frValueDistOrNumber, frValueDistOrNumber) cauchy(frValueDistOrNumber, frValueDistOrNumber);
``` ```
**Examples** **Examples**
```javascript ```javascript
cauchy(5, 1) cauchy(5, 1);
``` ```
## Gamma Distribution ## Gamma Distribution
**Definitions** **Definitions**
```javascript ```javascript
gamma(frValueDistOrNumber, frValueDistOrNumber) gamma(frValueDistOrNumber, frValueDistOrNumber);
``` ```
**Examples** **Examples**
```javascript ```javascript
gamma(5, 1) gamma(5, 1);
``` ```
## Logistic Distribution ## Logistic Distribution
**Definitions** **Definitions**
```javascript ```javascript
logistic(frValueDistOrNumber, frValueDistOrNumber) logistic(frValueDistOrNumber, frValueDistOrNumber);
``` ```
**Examples** **Examples**
```javascript ```javascript
gamma(5, 1) gamma(5, 1);
``` ```
## To (Distribution) ## To (Distribution)
**Definitions** **Definitions**
```javascript ```javascript
to(frValueDistOrNumber, frValueDistOrNumber) to(frValueDistOrNumber, frValueDistOrNumber);
``` ```
```javascript ```javascript
credibleIntervalToDistribution(frValueDistOrNumber, frValueDistOrNumber) credibleIntervalToDistribution(frValueDistOrNumber, frValueDistOrNumber);
``` ```
**Examples** **Examples**
```javascript ```javascript
5 to 10 5 to 10
to(5,10) to(5,10)
@ -123,72 +144,85 @@ to(5,10)
## Exponential ## Exponential
**Definitions** **Definitions**
```javascript ```javascript
exponential(frValueDistOrNumber) exponential(frValueDistOrNumber);
``` ```
**Examples** **Examples**
```javascript ```javascript
exponential(2) exponential(2);
``` ```
## Bernoulli ## Bernoulli
**Definitions** **Definitions**
```javascript ```javascript
bernoulli(frValueDistOrNumber) bernoulli(frValueDistOrNumber);
``` ```
**Examples** **Examples**
```javascript ```javascript
bernoulli(0.5) bernoulli(0.5);
``` ```
## toContinuousPointSet ## toContinuousPointSet
Converts a set of points to a continuous distribution Converts a set of points to a continuous distribution
**Definitions** **Definitions**
```javascript ```javascript
toContinuousPointSet(array<dict<{x: numeric, y: numeric}>>) toContinuousPointSet(array<dict<{x: numeric, y: numeric}>>)
``` ```
**Examples** **Examples**
```javascript ```javascript
toContinuousPointSet([ toContinuousPointSet([
{ x: 0, y: 0.1 }, { x: 0, y: 0.1 },
{ x: 1, y: 0.2 }, { x: 1, y: 0.2 },
{ x: 2, y: 0.15 }, { x: 2, y: 0.15 },
{x:3, y: 0.1} { x: 3, y: 0.1 },
]) ]);
``` ```
## toDiscretePointSet ## toDiscretePointSet
Converts a set of points to a discrete distribution Converts a set of points to a discrete distribution
**Definitions** **Definitions**
```javascript ```javascript
toDiscretePointSet(array<dict<{x: numeric, y: numeric}>>) toDiscretePointSet(array<dict<{x: numeric, y: numeric}>>)
``` ```
**Examples** **Examples**
```javascript ```javascript
toDiscretePointSet([ toDiscretePointSet([
{ x: 0, y: 0.1 }, { x: 0, y: 0.1 },
{ x: 1, y: 0.2 }, { x: 1, y: 0.2 },
{ x: 2, y: 0.15 }, { x: 2, y: 0.15 },
{x:3, y: 0.1} { x: 3, y: 0.1 },
]) ]);
``` ```
## Declaration (Continuous Function) ## Declaration (Continuous Function)
Adds metadata to a function of the input ranges. Works now for numeric and date inputs. This is useful when making predictions. It allows you to limit the domain that your prediction will be used and scored within. Adds metadata to a function of the input ranges. Works now for numeric and date inputs. This is useful when making predictions. It allows you to limit the domain that your prediction will be used and scored within.
**Definitions** **Definitions**
```javascript ```javascript
declareFn(dict<{fn: lambda, inputs: array<dict<{min: number, max: number}>>}>) declareFn(dict<{fn: lambda, inputs: array<dict<{min: number, max: number}>>}>)
``` ```
**Examples** **Examples**
```javascript ```javascript
declareFn({ declareFn({
fn: {|a,b| a }, fn: {|a,b| a },

View File

@ -9,84 +9,72 @@ title: Duration
(duration):string (duration):string
``` ```
### minutes ### minutes
```javascript ```javascript
(number):duration (number):duration
``` ```
### hours ### hours
```javascript ```javascript
(number):duration (number):duration
``` ```
### days ### days
```javascript ```javascript
(number):duration (number):duration
``` ```
### years ### years
```javascript ```javascript
(number):duration (number):duration
``` ```
### toHours ### toHours
```javascript ```javascript
(duration):number (duration):number
``` ```
### toMinutes ### toMinutes
```javascript ```javascript
(duration):number (duration):number
``` ```
### toDays ### toDays
```javascript ```javascript
(duration):number (duration):number
``` ```
### toYears ### toYears
```javascript ```javascript
(duration):number (duration):number
``` ```
### add ### add
```javascript ```javascript
(duration, duration):duration (duration, duration):duration
``` ```
### subtract ### subtract
```javascript ```javascript
(duration, duration):duration (duration, duration):duration
``` ```
### multiply ### multiply
```javascript ```javascript
(duration, duration):duration (duration, duration):duration
``` ```
### divide ### divide
```javascript ```javascript

View File

@ -9,175 +9,150 @@ title: List
(list<'a>):string (list<'a>):string
``` ```
### length ### length
```javascript ```javascript
(list<'a>):number (list<'a>):number
``` ```
### get ### get
```javascript ```javascript
(list<a>, number):a (list<a>, number):a
``` ```
### find ### find
```javascript ```javascript
(list<a>, e => bool):a (list<a>, e => bool):a
``` ```
### filter ### filter
```javascript ```javascript
(list<a>, e => bool):a (list<a>, e => bool):a
``` ```
### set ### set
```javascript ```javascript
(list<a>, number, a):a (list<a>, number, a):a
``` ```
### shuffle ### shuffle
```javascript ```javascript
(list<a>):list<a> (list<a>):list<a>
``` ```
### reverse ### reverse
```javascript ```javascript
(list<a>):list<a> (list<a>):list<a>
``` ```
### make ### make
```javascript ```javascript
(number,a):list<a> (number, (index:number => a)):list<a> (pointSetDist):list<number> (number,a):list<a> (number, (index:number => a)):list<a> (pointSetDist):list<number>
``` ```
### range ### range
```javascript ```javascript
(low:number, high:number) => list<number> (low:number, high:number) => list<number>
``` ```
### rangeBy ### rangeBy
```javascript ```javascript
(low:number, high:number, increment: number) => list<number> (low:number, high:number, increment: number) => list<number>
``` ```
### zip ### zip
```javascript ```javascript
(list<a>, list<b>):list<list<a|b>> (list<a>, list<b>):list<list<a|b>>
``` ```
### unzip ### unzip
```javascript ```javascript
(list<list<a|b>>):list<list<a>, list<b>> (list<list<a|b>>):list<list<a>, list<b>>
``` ```
### concat ### concat
```javascript ```javascript
(list<a>, list<b>): list<a|b> (list<a>, list<b>): list<a|b>
``` ```
### concatMany ### concatMany
```javascript ```javascript
(list<list<a>>):list<a> (list<list<a>>):list<a>
``` ```
### slice ### slice
```javascript ```javascript
``` ```
### map ### map
```javascript ```javascript
(list<a>, (a -> b)): list<b> (list<a>, (a -> b)): list<b>
``` ```
### reduce ### reduce
```javascript ```javascript
``` ```
### reduceRight ### reduceRight
```javascript ```javascript
``` ```
### includes ### includes
```javascript ```javascript
(list<'a>, 'a => bool):boolean (list<'a>, 'a => bool):boolean
``` ```
### every ### every
```javascript ```javascript
(list<'a>, 'a => bool):boolean (list<'a>, 'a => bool):boolean
``` ```
### truncate ### truncate
```javascript ```javascript
(list<'a>, number):list<'a> (list<'a>, number):list<'a>
``` ```
### uniq ### uniq
```javascript ```javascript
(list<'a>):list (list<'a>):list
``` ```
### first ### first
```javascript ```javascript
(list<'a>):'a (list<'a>):'a
``` ```
### last ### last
```javascript ```javascript
(list<'a>):'a (list<'a>):'a
``` ```
### sort ### sort
```javascript ```javascript

View File

@ -4,87 +4,87 @@ title: Math
--- ---
### E ### E
Euler's number; ≈ 2.718281828459045 Euler's number; ≈ 2.718281828459045
```javascript ```javascript
number number;
``` ```
### LN2 ### LN2
Natural logarithm of 2; ≈ 0.6931471805599453 Natural logarithm of 2; ≈ 0.6931471805599453
```javascript ```javascript
number number;
``` ```
### LN10 ### LN10
Natural logarithm of 10; ≈ 2.302585092994046 Natural logarithm of 10; ≈ 2.302585092994046
```javascript ```javascript
number number;
``` ```
### LOG2E ### LOG2E
Base 2 logarithm of E; ≈ 1.4426950408889634 Base 2 logarithm of E; ≈ 1.4426950408889634
```javascript ```javascript
number number;
``` ```
### LOG10E ### LOG10E
Base 10 logarithm of E; ≈ 0.4342944819032518 Base 10 logarithm of E; ≈ 0.4342944819032518
```javascript ```javascript
number number;
``` ```
### PI ### PI
Pi - ratio of the circumference to the diameter of a circle; ≈ 3.141592653589793 Pi - ratio of the circumference to the diameter of a circle; ≈ 3.141592653589793
```javascript ```javascript
number number;
``` ```
### SQRT1_2 ### SQRT1_2
Square root of 1/2; ≈ 0.7071067811865476 Square root of 1/2; ≈ 0.7071067811865476
```javascript ```javascript
number number;
``` ```
### SQRT2 ### SQRT2
Square root of 2; ≈ 1.4142135623730951 Square root of 2; ≈ 1.4142135623730951
```javascript ```javascript
number number;
``` ```
### PHI ### PHI
Phi is the golden ratio. 1.618033988749895 Phi is the golden ratio. 1.618033988749895
```javascript ```javascript
number number;
``` ```
### TAU ### TAU
Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi. 6.283185307179586
Tau is the ratio constant of a circle's circumference to radius, equal to 2 \* pi. 6.283185307179586
```javascript ```javascript
number number;
``` ```
### Infinity ### Infinity
```javascript ```javascript
number number;
``` ```

View File

@ -3,189 +3,162 @@ sidebar_position: 6
title: Number title: Number
--- ---
### ceil ### ceil
```javascript ```javascript
(number): number (number): number
``` ```
### floor ### floor
```javascript ```javascript
(number): number (number): number
``` ```
### abs ### abs
```javascript ```javascript
(number): number (number): number
``` ```
### round ### round
```javascript ```javascript
(number): number (number): number
``` ```
### max ### max
```javascript ```javascript
(list<number>): number (list<number>): number
``` ```
### maxBy ### maxBy
```javascript ```javascript
(list<number>, fn(element)):number (list<number>, fn(element)):number
``` ```
### min ### min
```javascript ```javascript
(list<number>): number (list<number>): number
``` ```
### minBy ### minBy
```javascript ```javascript
(list<number>, fn(element)):number (list<number>, fn(element)):number
``` ```
### random ### random
```javascript ```javascript
number number;
``` ```
### randomInt ### randomInt
```javascript ```javascript
number number;
``` ```
### mean ### mean
```javascript ```javascript
(list<number>): number (list<number>): number
``` ```
### median ### median
```javascript ```javascript
(list<number>): number (list<number>): number
``` ```
### mode ### mode
```javascript ```javascript
(list<number>): number (list<number>): number
``` ```
### std ### std
```javascript ```javascript
(list<number>): number (list<number>): number
``` ```
### variance ### variance
```javascript ```javascript
(list<number>): number (list<number>): number
``` ```
### unaryMinus ### unaryMinus
```javascript ```javascript
(number): number (number): number
``` ```
### equal ### equal
```javascript ```javascript
(number, number): boolean (number, number): boolean
``` ```
### add ### add
```javascript ```javascript
(number, number): number (number, number): number
``` ```
### sum ### sum
```javascript ```javascript
(number, number): number (number, number): number
``` ```
### multiply ### multiply
```javascript ```javascript
(number, number): number (number, number): number
``` ```
### product ### product
```javascript ```javascript
(number, number): number (number, number): number
``` ```
### subtract ### subtract
```javascript ```javascript
(number, number): number (number, number): number
``` ```
### divide ### divide
```javascript ```javascript
(number, number): number (number, number): number
``` ```
### pow ### pow
```javascript ```javascript
(number, number): number (number, number): number
``` ```
### exp ### exp
```javascript ```javascript
(number): number (number): number
``` ```
### log ### log
```javascript ```javascript
(number, number=Math.e): number (number, number=Math.e): number
``` ```
### log10 ### log10
```javascript ```javascript

View File

@ -9,14 +9,12 @@ title: Point Set Distribution
(list<{x: number, y: number}>): pointSetDist (list<{x: number, y: number}>): pointSetDist
``` ```
### makeDiscrete ### makeDiscrete
```javascript ```javascript
(list<{x: number, y: number}>): pointSetDist (list<{x: number, y: number}>): pointSetDist
``` ```
### map ### map
```javascript ```javascript

View File

@ -4,6 +4,7 @@ title: Sample Set Distribution
--- ---
### toInternalSampleArray ### toInternalSampleArray
Gets the internal samples of a sampleSet distribution. This is separate from the sampleN() function, which would shuffle the samples. toInternalSampleArray() maintains order and length. Gets the internal samples of a sampleSet distribution. This is separate from the sampleN() function, which would shuffle the samples. toInternalSampleArray() maintains order and length.
```javascript ```javascript
@ -11,8 +12,9 @@ Gets the internal samples of a sampleSet distribution. This is separate from the
``` ```
**Examples** **Examples**
```javascript ```javascript
toInternalSampleArray(toSampleSet(normal(5,2))) toInternalSampleArray(toSampleSet(normal(5, 2)));
``` ```
### kde ### kde
@ -21,35 +23,30 @@ toInternalSampleArray(toSampleSet(normal(5,2)))
(sampleSet):pointSetDist (sampleSet):pointSetDist
``` ```
### toEmpiricalPdf ### toEmpiricalPdf
```javascript ```javascript
(sampleSet):pointSetDist (sampleSet):pointSetDist
``` ```
### map ### map
```javascript ```javascript
(sampleSet, (r => number)): sampleSet (sampleSet, (r => number)): sampleSet
``` ```
### map2 ### map2
```javascript ```javascript
(sampleSet, sampleSet, ((d1, d2)=>number)): sampleSet (sampleSet, sampleSet, ((d1, d2)=>number)): sampleSet
``` ```
### map3 ### map3
```javascript ```javascript
(sampleSet, sampleSet, sampleSet, ((d1, d2, d3)=>number)): sampleSet (sampleSet, sampleSet, sampleSet, ((d1, d2, d3)=>number)): sampleSet
``` ```
### make ### make
```javascript ```javascript