Published
Edited
Jan 14, 2022
Insert cell
a = Array.from({length: 100000}, () => random_bm());
Insert cell
function random_bm() {
var u = 0, v = 0;
while(u === 0) u = Math.random(); //Converting [0,1) to (0,1)
while(v === 0) v = Math.random();
return Math.sqrt( -2.0 * Math.log( u ) ) * Math.cos( 2.0 * Math.PI * v );
}
Insert cell
Plot.rectY(a, Plot.binX({y:'count'}, {x:a, thresholds: 50})).plot()
Insert cell
N = 1000;
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
mins = Array.from({length: 10000}, () => minN(N));
Insert cell
mean = mins.reduce((x, y) => x + y) / mins.length
Insert cell
stddev = Math.sqrt(mins.map(x => (x - mean) ** 2).reduce((x, y) => x + y)/mins.length)
Insert cell
function minN(N) {
return Math.min(...Array.from({length: N}, () => random_bm()));
}

Insert cell
Plot.rectY(mins, Plot.binX({y:'count'}, {x:mins, thresholds: 50})).plot()
Insert cell
24 * 30 * 60 / 5
Insert cell
M_n = \min(X_1, X_2, ..., X_n) \text{ where } X_i \text{ i.i.d } N(0, 1)

Insert cell
\text{cdf }M_n = P(M_n \leq x) = 1 - P(M_n > x) = 1 - (P(N(0,1) > x)^n = 1 - (1 - erf(x))^n
Insert cell
Insert cell
\text{pdf }M_n = n (1 - erf(x))^n \frac{2}{\sqrt{\pi}} e^{-x^2}
Insert cell
function mn(n, x) {
return n * (1 - erf(x)) ** (n - 1) * 2 / Math.sqrt(Math.PI) * Math.exp(-(x ** 2));
}
Insert cell
ps = Array.from({length: 1000}, (_, i) => ({x: i / 100 - 3, y: (i / 100 - 3) * mn(N, i / 100 - 3)}));
Insert cell
(1 - erf(-3)) ** 10000
Insert cell
Type Markdown, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more