Published unlisted
Edited
Sep 8, 2021
Insert cell
Insert cell
Insert cell
slope7_table = {
let f = (x) => 7 ** x;
let d = (h) => (f(0 + h) - f(0)) / h;

let div = d3.create("div").style("width", "300px");
let table = div.append("table").style("border-collapse", "collapse");
let header = table
.append("thead")
.append("tr")
.style("border-bottom", "solid 4px black");
header
.append("th")
.append("div")
.style("width", "100px")
.style("margin", "0 auto")
.append(() => tex.block`h`);
header
.append("th")
.style("border-left", "solid 1px black")
.append("div")
.style("width", "200px")
.append(() => tex.block`\frac{7^h-1}{h}`);

let body = table.append("tbody");
d3.range(1, 7).forEach(function (i) {
let row = body.append("tr");
if (i < 6) {
row.style("border-bottom", "solid 1px black");
}
row
.append("td")
.append("div")
.style("width", "150px")
.style("margin", "0 auto")
.append(() => tex.block`${1 / 10 ** i}`);
row
.append("td")
.style("border-left", "solid 1px black")
.append("div")
.style("width", "150px")
.style("margin", "0 auto")
.append(() => tex.block`${d(1 / 10 ** i)}`);
});

return div.node();
}
Insert cell
Insert cell
derivative_table = {
let f = (x) => 5 ** x;
let d = (h) => (f(3 + h) - f(3)) / h;

let div = d3.create("div").style("width", "300px");
let table = div.append("table").style("border-collapse", "collapse");
let header = table
.append("thead")
.append("tr")
.style("border-bottom", "solid 4px black");
header
.append("th")
.append("div")
.style("width", "100px")
.style("margin", "0 auto")
.append(() => tex.block`h`);
header
.append("th")
.style("border-left", "solid 1px black")
.append("div")
.style("width", "200px")
.append(() => tex.block`\frac{f(x+h)-f(x)}{h}`);

let body = table.append("tbody");
d3.range(1, 8).forEach(function (i) {
let row = body.append("tr");
if (i < 7) {
row.style("border-bottom", "solid 1px black");
}
row
.append("td")
.append("div")
.style("width", "150px")
.style("margin", "0 auto")
.append(() => tex.block`${1 / 10 ** i}`);
row
.append("td")
.style("border-left", "solid 1px black")
.append("div")
.style("width", "150px")
.style("margin", "0 auto")
.append(() => tex.block`${d(1 / 10 ** i)}`);
});

return div.node();
}
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