Published
Edited
Dec 5, 2020
1 fork
11 stars
Chandrupatla’s root-finding methodSidi’s root-finding methodRegular numbersDruidJS workerNatural breaksDistance to a segmentRay out of a convex hullWord Tour: 40k words and their friendsHello, @thi.ng/grid-iteratorsHead/tail breaksPseudo-blue noise shaderHow fast does walk-on-spheres converge?AoC 12: shortest path under constraintsKDE estimationPlot: Correlation heatmapPoisson Finish 2Poisson disk sampling functionsWoS with transportSimple and surprising sortLocal medianTime series topological subsamplingUnion-FindLevel set experiment 1Mean value coordinatesPoisson potentialMiddle-squareWorld of squares (spherical)World of squaresLargest Inscribed SquareHello, PyWaveletsGeothmetic meandianHello, Reorder.js
Geometric Median
Image FFTTransport to a mapDisc TransportTP3: Power Diagram and Semi-Discrete Optimal TransportThe blue waveHello, genetic-jsSliced Optimal TransportDruidJSSelf-Organizing Maps meet DelaunayHello, polygon-clippingseedrandom, minimalWalk on Spheres 2Walk on SpheresHello, AutoencoderKaprekar’s numberVoronoiMap2DHello, ccwt.jsPolygon TriangulationQuantile.invert?Linear congruential generatorHue blurNeedle in a haystackMoving average blurApollo 11 implementation of trigonometric functions, by Margaret H. Hamilton (march 1969)2D curves intersectionThe 2D approximate Newton-Raphson methodInverting Lee’s Tetrahedral projectionLinde–Buzo–Gray stipplingMean shift clustering with kd-tree2D point distributionsShortest pathKahan SummationHello, delatinDijkstra’s algorithm in gpu.jsLloyd’s relaxation on a graphManhattan DiameterManhattan VoronoiMobility landscapes — an introductionDijkstra’s shortest-path treeH3 odditiesProtein MatrixConvex Spectral WeightsSort stuff by similarityKrigingDelaunay.findTrianglen-dimensions binning?Travelling with a self-organizing mapUMAP-o-MaticMNIST & UMAP-jsHello UMAP-jsMean shift clusteringLevenshtein transitionRd quasi-random sequencesAutomated label placement (countries)Phyllotaxis explainedMotionrugsPlanar hull (Andrew’s monotone chain algorithm)South Africa’s medial axisTravelling salesperson approximation with t-SNEDistance to shoreWorkerngraph: pagerank, louvain…t-SNE VoronoiCloud ContoursCircular function drawingKruskal MazeMyceliumTravelling salesperson approximation on the globe, with t-SNEtsne.jstsne.js & worker
Also listed in…
Clustering
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
geometricMedian(points, P)
Insert cell
[
...geometricMedianIterator(points, {
P,
alpha: 0.5
})
]
Insert cell
paths = points.map(p0 => [
p0,
...geometricMedianIterator(points, {
P,
alpha: .2 / P,
precision: .03,
x: p0[0],
y: p0[1]
})
])
Insert cell
// as a function
geometricMedian = (points, options = {}) => {
for (var m of geometricMedianIterator(points, options));
return m;
}
Insert cell
function* geometricMedianIterator(
points,
{ P = 1, alpha = 1, precision = 1e-6, x = 0, y = 0 } = {}
) {
// starting point
let delta,
i = 0;

if (x === undefined) x = y = 0;

do {
let sx = 0;
let sy = 0;
let s = 0;
for (const p of points) {
const d = [x - p[0], y - p[1]];
const n = norm(d);
if (n) {
const np = pow(n, P - 2);
s += np;
sx += p[0] * np;
sy += p[1] * np;
}
}
yield [x, y];
const x_ = x,
y_ = y;
x += alpha * (sx / s - x);
y += alpha * (sy / s - y);
delta = abs(x - x_) + abs(y - y_);
} while (delta > precision && i++ < 1000);

return yield [x, y];
}
Insert cell
function norm(X) {
return Math.hypot(...X);
}
Insert cell
points = (replay,
Array.from({ length: 50 }, () => [random(), random()])
.map(d => [d[0] - 300, d[1] - 50])
.concat(
Array.from({ length: 30 + 40 * Math.random() }, () => [random(), random()])
))
Insert cell
random = d3.randomNormal(0, width / 20)
Insert cell
d3 = require("d3@6")
Insert cell
height = 500
Insert cell
import { abs, pow, tau } from "@fil/math"
Insert cell
import { slider } from "@jashkenas/inputs"
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more