Published
Edited
Nov 26, 2019
1 star
Insert cell
Insert cell
up = (x,y,z)=>[x,y,z,0.5*(x*x+y*y+z*z-1)];
Insert cell
Insert cell
points = [
up(3,3,0),
up(1,5,0),
up(1,3,2),
up(1,1,0)
]
Insert cell
Insert cell
A = points.flat()
Insert cell
Y = points.map(x=>x[3]+1)
Insert cell
Insert cell
Ai = invert(A)
Insert cell
Insert cell
X = mulvec(Ai,Y)
Insert cell
Insert cell
X2 = X.map(x=>x/(1-X[3]));
Insert cell
Insert cell
center = X2.slice(0,3)
Insert cell
radius = (((X2[0]**2+X2[1]**2+X2[2]**2)*0.5 - 0.5 - X2[3])*2)**.5
Insert cell
Insert cell
radius_also = Math.hypot(X2[0]-points[0][0],X2[1]-points[0][1],X2[2]-points[0][2])
Insert cell
Insert cell
Insert cell
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