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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more