Published
Edited
Apr 21, 2019
5 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
factD = {
const z = [];
// here, the call loop is within our generator cell
// as the array length increases, it is yielded for drawing
for (let i = 0; i <= n; ++i) {
z[i] = factorialGenerator(i);
yield z;
}
}
Insert cell
Insert cell
Insert cell
gammaD = {
// here, the loop is moved within a generating function
// every loop from this generator cell yields the next iteration in the generator gamma function
for (const z of gammaGenerator(n)) yield z;
}
Insert cell
Insert cell
function factorialGenerator(i) {
// factorial container
const f = [];
// psuedo-memoization approach
const factorial = (n) => (!n || n === 1) ? 1 : f[n] || factorial(n - 1) * n;
return {x: i, y: factorial(i)};
}
Insert cell
Insert cell
Insert cell
function* gammaGenerator(n) {
const step = 0.01;
const offset = -offsetN * (1 / step),
arrayL = offset + (1 / step) * n;
const z = [],
f = [];

for (let i = 0; i <= arrayL; ++i) {
z[i] = {
x: i * step - offset * step,
y: Lanczos(i * step - offset * step)
};
yield z;
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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