Vectors and matrices

Vectors and matrices can be declared with a clean and straightforward syntax. Standard arithmetic and basic linear algebra calculations are built-in.

Literals
// Vectors are represented as simple Javascript arrays. [1m, 2m, 3m] [4,5,6,7] // Matrices are represented as arrays of arrays. [[1,2],[3,4]] [1,2;3,4] // semicolon syntax // ranges 3..8 10..5..25
Indexing
v = [3,4,5,6,7,8,9] // indexing vectors v[2] v[2,3] v[2..5] v[...] A = [1,2,3;4,5,6;7,8,9] // indexing matrices A[0,1] // comma - first and second rows A[0;1] // semicolon - first row, second column A[0,1;1] A[1;...] A[...;1] [1,2;3,4]*[1,2]' // matrix-vector multiplication
Random examples
(1..10).^2 // square numbers from one to ten in a vector // simple matrix inversion A=[1,2;3,4] inv(A) // determinant A=[1+1i,2;3+3i,4] det(A)