OpenMat

The OpenMat Language

OpenMat speaks a Wolfram-Language-shaped notation: square brackets apply functions, curly braces build lists, = assigns, == states equations, and capitalized names are built-ins. If you know Mathematica, you already know how to type here. This page documents exactly what the v0.01 kernel understands, so you can use OpenMat entirely by hand, no natural language features required. Every example is real kernel output.

The notebook

Typing math

Input cells are 2D math fields, and Mathematica-style linear syntax typed literally comes out right:

Numbers

Exact values stay exact; the kernel goes numeric only when you ask.

In[1]:=2^10
Out[1]=1024
In[2]:=Sqrt[8]
Out[2]=Sqrt[8]
In[3]:=N[Sqrt[2]]
Out[3]=1.414213562373
In[4]:=0.1 + 0.2
Out[4]=0.3

Variables and functions

In[1]:=a = 5
Out[1]=5
In[2]:=a^2 + 1
Out[2]=26
In[3]:=f[x_] := x^2 + 1
In[4]:=f[3]
Out[4]=10
In[5]:=g[x_, y_] := x*y
In[6]:=g[2, 5]
Out[6]=10

Lists

In[1]:=Table[n^2, {n, 1, 5}]
Out[1]={1, 4, 9, 16, 25}
In[2]:=Range[5]
Out[2]={1, 2, 3, 4, 5}
In[3]:=Length[{1, 2, 3}]
Out[3]=3
In[4]:=Map[f, {1, 2}]
Out[4]={f[1], f[2]}

Arithmetic does not yet thread over lists: {1, 2} + {10, 20} stays unevaluated. Use Table to build element-wise results.

Algebra

In[1]:=Expand[(x + 1)^2]
Out[1]=1 + 2*x + x^2
In[2]:=Factor[x^2 - 1]
Out[2]=(-1 + x)*(1 + x)
In[3]:=Solve[x^2 - 5*x + 6 == 0, x]
Out[3]={{x -> 2}, {x -> 3}}
In[4]:=Solve[x^2 - 2 == 0, x]
Out[4]={{x -> -Sqrt[2]}, {x -> Sqrt[2]}}

Calculus

In[1]:=D[Sin[x]*x, x]
Out[1]=Cos[x]*x + Sin[x]
In[2]:=Integrate[x^2, x]
Out[2]=x^3/3
In[3]:=Integrate[2*Sin[2*Pi*x]^2, {x, 0, 1}]
Out[3]=1.
In[4]:=Integrate[Exp[-x^2/2], {x, 0, 1}]
Out[4]=0.855624391892

Plotting

In[1]:=Plot[Sin[x], {x, 0, 10}]
In[2]:=Plot[{Sin[x], Cos[x]}, {x, 0, 2*Pi}]
In[3]:=Plot[Tan[x], {x, -4, 4}]
In[4]:=ListPlot[{{1, 2}, {2, 4}, {3, 9}}]

Differential equations

In[1]:=NDSolve[{x'[t] == -x[t], x[0] == 1}, x, {t, 0, 5}]
In[2]:=NDSolve[{x''[t] + 0.3*x'[t] + Sin[x[t]] == 0, x[0] == 2, x'[0] == 0}, x, {t, 0, 20}]

Built-in reference

AreaNames
TrigonometricSin Cos Tan Cot Sec Csc ArcSin ArcCos ArcTan Sinh Cosh Tanh
ExponentialExp Log Sqrt Abs
NumericN Floor Ceiling Round Min Max
ConstantsPi E Degree Infinity
Structure{...} Table Range Length Map
Definitions= := Clear, patterns x_
AlgebraExpand Factor Simplify Solve
CalculusD Integrate (indefinite and definite)
Numerics and graphicsPlot ListPlot NDSolve
Relations and rules== ->

Where OpenMat differs from Mathematica today

Honest edges of the v0.01 kernel, so nothing surprises you:

Everything above works today, in the desktop app and in the browser build, on the same Rust kernel. This page tracks the shipped kernel; when the kernel grows, so does this page.