moonvec numerical arrays

Playground

Numbers computed here, not drawn here.

Both panels call the library compiled to JavaScript and running in this tab. The page supplies the shape of the question and draws the answer; every value in the answer comes back from the array code.

The compiled engine did not load. It is built from src/examples/browser/ and served at engine/moonvec.js; open this page from the deployed site, or build it with the command in the guide.

Broadcast two shapes

Pick an operand on each side. Compatible shapes stretch and add elementwise; incompatible ones are refused with the library's own message, before anything is read.

add
operand a
operand b
a[3, 1]
b[1, 4]
a + b[3, 4]

Fit a line while you drag

Eight points, and a straight line chosen by least squares. Move a point and the coefficients are computed again by lstsq, which factors the design matrix with Householder reflections.

lstsq

Drag a point. Dashed segments are the residuals the fit is minimising.

slope
—
intercept
—
residual
—

—

What is compiled. The page loads one script built from src/examples/browser/, a package that imports this library and exposes two functions: one broadcasts a pair of shapes, the other fits a line. The drawing code knows nothing about arrays.