Published
Edited
Aug 4, 2020
4 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
segmentHeight = k => {
let h = k;
if (h > 0 && h < 1) {
let t0, t1 = Math.pow(12 * h * Math.PI, 1 / 3);
for (let i = 0; i < 10; ++i) {
t0 = t1;
t1 = (Math.sin(t0) - t0 * Math.cos(t0) + 2 * h * Math.PI) / (1 - Math.cos(t0));
}
h = (1 - Math.cos(t1 / 2)) / 2;
}
return h;
}
Insert cell
data = {
const out = [];
for (let k = 0; k <= 1.01; k += 0.01){
const kf = +k.toFixed(2);
out.push([kf, segmentHeight(kf)]);
}
return out;
}
Insert cell
d3 = require("d3@5");
Insert cell
import { drawAxes } from "@harrystevens/linear-algebra";
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