Public
Edited
Jul 5, 2023
Insert cell
Insert cell
Insert cell
f = x => x/(x**2+1)
Insert cell
fprime = x => (-(x**2)+1)/(x**2+1)**2
Insert cell
approx = x => (f(x + delta) - f(x - delta))/(2*delta)
Insert cell
Plot.plot({
x:{domain:[-10,10]},
y:{domain:[-1,1]},
marks:[
Plot.ruleX([0]),
Plot.ruleY([0]),
Plot.line(x,{x:x,y:x.map(x => f(x)),stroke:"red"})
]
})
Insert cell
Plot.plot({
x:{domain:[-10,10]},
y:{domain:[-1,1]},
marks:[
Plot.ruleX([0]),
Plot.ruleY([0]),
Plot.line(x,{x:x,y:x.map(x => fprime(x)),stroke:"red"})
]
})
Insert cell
viewof delta = Inputs.range([.00001,10])
Insert cell
Plot.plot({
x:{domain:[-10,10]},
y:{domain:[-1,1]},
marks:[
Plot.ruleX([0]),
Plot.ruleY([0]),
Plot.line(x,{x:x,y:x.map(x => approx(x)),stroke:"red"})
]
})
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