Numpy-Calculator · Scientific Computing Lab

Linear algebra, live.

Paste a matrix and run real decompositions in your browser. Everything on this page is computed here, in JavaScript — no Python or NumPy runs in a static web page. The Python reference implementation (NumPy) lives in scientific.py in the repo, and the two agree on the test cases in test_js_lab.mjs.

Matrix lab

Result appears here…

Square matrices up to 8×8 for determinant / inverse / eigenvalues / solve. Singular matrices are reported as errors, not silently faked — a singular matrix has no inverse and no unique solution. Every result carries a verification check (e.g. A·A⁻¹ ≈ I, or the residual ‖Ax − b‖).

Least-squares fit

Fit appears here…

Solved from the normal equations (XᵀX)c = Xᵀy by Gaussian elimination — the same fit numpy.linalg.lstsq / polyfit gives in least_squares.py. RMSE and R² are computed from your data, not preset.

Why vectorize? — live benchmark, measured here

Not run yet — press Run to measure on your device.

This measures a plain for loop vs the engine's built-in reduction over the same 1,000,000-element Float64Array in this browser — median of 5 runs each. JavaScript has no NumPy, so don't expect a Python-sized gap here: the Python loop-vs-NumPy numbers live in benchmark.py — run python benchmark.py locally for those. Any timing you see above was just measured, never typed in by hand.

Your history (saved in this browser only)

No saved calculations yet.

Your last matrix, vector b, fit inputs and up to 10 recent results are stored in this browser's localStorage — nothing is sent to a server, and there is no account or backend. Clearing your browser data clears them too.