Published
Edited
May 15, 2019
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
step = (xMax - xMin) / steps;
Insert cell
fx = (x) => {return 1/x};
Insert cell
sample = f=>[...Array(steps)].map((x,xi)=>f(xi/steps));
Insert cell
samples = sample(fx)
Insert cell
xi = [...Array(steps+1)].map((x, i)=>(i*step+xMin))

Insert cell
yi = xi.map(x => fx(x))

Insert cell
data = xi.map((x, i)=> {return [x, yi[i]]});
Insert cell
sample_min = (f, xMin) =>[...Array(steps)].map((x, i)=>f(i*step+xMin))
Insert cell
fxi = sample_min(fx, xMin)
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