Public
Edited
Jan 9, 2023
1 fork
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// Möbius transformation that maps (0, 1, ∞) to (-1, 0, 1)
function transform_point(x, y) {
const d = (x + 1) * (x + 1) + y * y;
return [(x * x - 1 + y * y) / d, 2 * y / d];
}
Insert cell
// The image of a circle under the Möbius transformation
function transform_circle(x, y, r) {
return circle_through_points(
transform_point(x - r, y),
transform_point(x + r, y),
transform_point(x, y + r)
);
}
Insert cell
// The unique circle passing through three non-collinear points
function circle_through_points([ax, ay], [bx, by], [cx, cy]) {
const na = ax * ax + ay * ay;
const nb = bx * bx + by * by;
const nc = cx * cx + cy * cy;
const dy = 2 * (by - ay) * (bx - cx) - 2 * (ax - bx) * (cy - by);
const y = ((ax - bx) * (nb - nc) - (bx - cx) * (na - nb)) / dy;
const x = (na - nb + 2 * (by - ay) * y) / (2 * (ax - bx));
const r = Math.hypot(x - ax, y - ay);
return [x, y, r];
}
Insert cell
function crot(z, theta) {
return cmul(z, [Math.cos(theta), Math.sin(theta)]);
}
Insert cell
function cmul([wr, wi], [zr, zi]) {
return [wr * zr - wi * zi, wr * zi + wi * zr];
}
Insert cell
root = doyle(p, q)
Insert cell
Insert cell
d3 = require("d3@5")
Insert cell
import {slider, checkbox, color, select} from "@jashkenas/inputs"
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