Published
Edited
Dec 9, 2018
1 fork
6 stars
Insert cell
Insert cell
Insert cell
Insert cell
import {nerdamer} from '@yosuke/nerdamer-all'
Insert cell
Insert cell
Plotly = require("https://cdn.plot.ly/plotly-latest.min.js")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
eq = `x^3+${a}*x^2+${b}*x+${c}`
Insert cell
Insert cell
tex`${nerdamer(eq).toTeX()}`
Insert cell
Insert cell
tex`${nerdamer('diff('+eq+', x)').toTeX()}`
Insert cell
Insert cell
tex`${nerdamer('integrate('+eq+',x)').toTeX()}`
Insert cell
Insert cell
Insert cell
f1 = nerdamer(eq).buildFunction(['x'])
Insert cell
f2 = nerdamer('diff('+eq+',x)').buildFunction(['x'])
Insert cell
f3 = nerdamer('integrate('+eq+',x)').buildFunction(['x'])
Insert cell
Insert cell
{
for (var i=-6, x=[]; i <= 6; i += 0.1) x.push(i);
var d1 = {
name: 'f1', mode: 'lines', type: 'scatter',
x: x, y: x.map(f1)
};
var d2 = {
name: 'f2', mode: 'lines', type: 'scatter',
x: x, y: x.map(f2)
};
var d3 = {
name: 'f3', mode: 'lines', type: 'scatter',
x: x, y: x.map(f3)
};
const div = DOM.element('div');
Plotly.newPlot(div, [d1, d2, d3], {width: width, height: width, yaxis: {range: [-8, 8]}});
return div;
}
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