Public
Edited
Jan 12, 2023
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = {
const xs = d3.range(100).map(x => x * Math.PI), ys = xs.map(f);
return { xs, ys, ewmabc: ys.map(ewmabc(beta)), ewma: ys.map(ewma(beta)) };
}
Insert cell
f = x => Math.cos(x) * Math.exp(.01 * x) - 10 * Math.exp(-.01 * x)
Insert cell
ewma = (beta = .8) => {
let z = 0;
return x => z = beta * z + (1 - beta) * x;
}
Insert cell
ewmabc = (beta = .8, t = 1) => {
let z = 0, bc = beta ** (t - 1) + 1e-8;
return x => (z = beta * z + (1 - beta) * x) / (1 - (bc *= beta));
}
Insert cell
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