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();
}