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
- Numbers
- Variables and functions
- Lists
- Algebra
- Calculus
- Plotting
- Differential equations
- Built-in reference
- Differences from Mathematica
The notebook
- Shift+Enter evaluates a cell. Enter moves to the next cell, or creates one at the end.
- Evaluated cells get
In[n]:=andOut[n]=labels. Errors consume an In number, exactly as in Mathematica. - Definitions evaluate silently:
f[x_] := x^2produces no Out line, matching Mathematica's Null convention. - Click a cell's right-edge bracket to collapse it to its input line; click again to expand.
- Cell styles: Alt+1 Title, Alt+4 Section, Alt+7 Text, Alt+9 back to Input.
- Save and Open in the header store the whole notebook as a file.
- The kernel session persists across cells: what you define stays defined until
Clearor a restart.
Typing math
Input cells are 2D math fields, and Mathematica-style linear syntax typed literally comes out right:
Plot[Sin[x], {x, 0, 10}]works as typed: square brackets stay calls, braces stay lists.- Consecutive letters form one symbol, as in Mathematica:
xyis the symbol xy, not x times y. Multiplication needs a boundary:2x,2 Sin[x],a*b. ^starts an exponent; type it and arrow right to come back down.=with a plain symbol on the left assigns; with anything else on the left it becomes the equation==. Typing==always means Equal.- Primes are derivatives in equations:
x''[t]is the second derivative of x. - Hover a math cell for the keyboard icon: a full math symbol keyboard with Greek letters, roots, and fractions. A typed integral like
∫ x² dxtranslates toIntegrate[x^2, x]. - Known function names typed with parentheses are accepted:
Sin(x)andPlot(...)normalize to bracket form.
Numbers
Exact values stay exact; the kernel goes numeric only when you ask.
N[expr]forces numeric evaluation.Pi,E, andDegreeresolve under N;Infinityis recognized symbolically.- Floating point noise is cleaned to 12 significant digits, which is why
0.1 + 0.2prints 0.3. - Exact fractions stay symbolic: rational arithmetic is not folded yet, so
1/3 + 1/6stays as written until you apply N.
Variables and functions
=(Set) evaluates the right side once and assigns.:=(SetDelayed) stores the definition and evaluates at each use, silently.x_is a blank pattern: it matches anything and binds it to x. Multiple pattern arguments work.- Definitions are visible everywhere, including inside Plot and NDSolve: define
f[x_] := x^2in one cell andPlot[f[x], {x, 0, 2}]in the next just works. Clear[name]removes a definition.
Lists
Arithmetic does not yet thread over lists: {1, 2} + {10, 20} stays unevaluated. Use Table to build element-wise results.
Algebra
- Solve handles polynomial equations up through quadratics and returns exact roots as replacement rules.
- Simplify performs basic structural simplification; it does not yet know trig identities, so
Simplify[Sin[x]^2 + Cos[x]^2]stays as written.
Calculus
D[f, x]differentiates with the product, quotient, chain, and power rules.Integrate[f, x]knows the standard table: powers, 1/x to Log, Sin, Cos, Exp, linear substitutions, and polynomial expansion. Sine and cosine squares reduce by double-angle rules, and products likeSin[2*Pi*x]*Sin[Pi*x]go through product-to-sum, which is what makes normalization and orthogonality integrals come out exact.- Definite integrals evaluate the antiderivative difference; when no closed form exists but the bounds are numeric, the kernel falls back to numerical quadrature rather than giving up.
Plotting
- Plot samples adaptively: it refines where the curve bends and detects poles, so Tan renders as separate branches instead of vertical lines through the asymptotes.
- Multiple expressions in a list get separate curves and a legend.
- ListPlot draws discrete points, from plain values (x becomes 1, 2, 3, ...) or {x, y} pairs.
- Session definitions resolve inside plots:
data = Table[n^2, {n, 1, 8}]thenListPlot[data]works.
Differential equations
- NDSolve solves scalar first and second order ODEs numerically and plots the trajectory.
- Write the equation with
==, give initial conditions asx[0] == value(andx'[0] == valuefor second order), name the unknown function, and give the range{t, t0, t1}. - Second order equations must be linear in the highest derivative; any textbook form qualifies.
- The desktop build integrates with SUNDIALS CVODE; the browser build uses a pure Rust Dormand-Prince RK5(4). Same input, same answer.
- Cells with a parameter slider, like the damped pendulum demo, re-solve live as the slider moves.
Built-in reference
| Area | Names |
|---|---|
| Trigonometric | Sin Cos Tan Cot Sec Csc ArcSin ArcCos ArcTan Sinh Cosh Tanh |
| Exponential | Exp Log Sqrt Abs |
| Numeric | N Floor Ceiling Round Min Max |
| Constants | Pi E Degree Infinity |
| Structure | {...} Table Range Length Map |
| Definitions | = := Clear, patterns x_ |
| Algebra | Expand Factor Simplify Solve |
| Calculus | D Integrate (indefinite and definite) |
| Numerics and graphics | Plot ListPlot NDSolve |
| Relations and rules | == -> |
Where OpenMat differs from Mathematica today
Honest edges of the v0.01 kernel, so nothing surprises you:
- Solve stops at quadratics; cubics and beyond stay unevaluated.
- NDSolve handles one scalar equation, first or second order. No coupled systems yet.
- Simplify is structural only; trig identities and radical simplification are not applied.
- No
%output history, no/.ReplaceAll operator, no Sum or Product evaluation, no strings-and-formatting layer. - Arithmetic does not thread over lists.
- Exact rational arithmetic is preserved but not folded:
1/3 + 1/6stays symbolic; apply N for a decimal. - Unknown functions stay symbolic rather than erroring, exactly as in Mathematica:
h[2]evaluates toh[2]until h gets a definition.
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.