TypeScript numerical computing for the browser

MathJSLab brings a mathematical lab to the web.

MathJSLab simulates a subset of the MATLAB®/Octave language. Use one of the online applications to explore MathJSLab features. Use the npm package mathjslab in your project to run expressions, functions and matrices, with MathML-rendered results and full compatibility in the web browser.

Interpreter npm install mathjslab
>> A = [1 2; 3 4]
A=[1234]
>> det(A)
det(A)=-2
>> f = @(x) a*x^2+b*x+c
f=@(x)a⁢x2+b⁢x+c

Execution flow

How MathJSLab processes an expression

MathJSLab reads the input, parses it into an internal representation, evaluates expressions and commands, and renders mathematical results as MathML for the browser.

Diagram showing the MathJSLab pipeline from user input through parsing, evaluation, command processing and MathML rendering.

Features

MathJSLab is an interpreter with syntax like MATLAB®/Octave, intended for educational purposes and available in the browser.

Interpreter engine

The core package is written in TypeScript and simulates a subset of MATLAB®/Octave syntax.

Mathematical output

The interpreter works with arbitrary precision arithmetic through decimal.js and can generate expressions and results rendered in MathML.

Language and programming

Expressions, matrices, complex numbers, control flow, anonymous and user-defined functions, closures and classes expand the programming possibilities.

Asynchronous and resumable execution

Sessions retain variables and functions between commands. Asynchronous execution supports suspending and resuming calculations; applications integrate Workers and interpreter plot outputs.

Markdown engine

Educational documents with mathjslab-markdown

The companion package mathjslab-markdown brings the project’s Markdown engine into a reusable library. It displays documents in the browser and integrates the mathjslab interpreter when the host application enables executable examples.

Documents and navigation

Markdown rendering, document navigation and the optional <markdown-document> Web Component help other applications present documentation and learning materials.

Educational extensions

Mathematical formulas, Mermaid diagrams and educational visualizations use optional renderers loaded on demand.

Interpreter integration

Executable examples use the mathjslab package, with executors and Workers supplied by the host application. The Markdown engine can also be used independently.

Markdown engine npm install mathjslab-markdown

Ecosystem

Project ecosystem

The mathjslab interpreter is the project’s core. The companion mathjslab-markdown package presents educational documents, and the web applications integrate these capabilities. The GitHub organization also maintains the project website and shared resources.

Publication

Publication and identifiers

The MathJSLab interpreter and its ecosystem are distributed as free software, with reusable packages and publication identifiers.

The mathjslab interpreter and the mathjslab-markdown engine are published separately on npm under the MIT license. The DOI and ISBN records shown below belong to their respective projects.

web application

mathjslab-app

The browser application demonstrates the interpreter, is maintained on GitHub and has its own DOI and ISBN records.

web application

mathjslab-calc

The calculator application offers a simplified prompt interface hosted at calc.mathjslab.com, with its own DOI and project publication badges.

Resources

Resources

Try the application and calculator, install the mathjslab interpreter or the mathjslab-markdown engine, and explore the source code and command help.

MathJSLab is intended for educational purposes, helping teachers and students use a computer-aided calculation tool that runs in the browser.

MathJSLab is not affiliated, sponsored or endorsed by The MathWorks, Inc. MATLAB® is a registered trademark of The MathWorks, Inc.

Contact

Contact

To contact the MathJSLab project organization, write to the address

mathjslab@gmail.com

License

MIT License

MathJSLab is distributed as free software under the MIT License, allowing use, modification and redistribution under the terms below.

MIT License

Copyright (c) 2016-2026 Sergio Lindau, mathjslab.com, ISBN 978-65-00-82338-7

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.