JSPM

  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q46890F
  • License MIT

Computer Algebra System in TypeScript

Package Exports

  • symbolic-math
  • symbolic-math/dist/cjs/index.js
  • symbolic-math/dist/esm/index.js
  • symbolic-math/dist/umd/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (symbolic-math) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

symbolic-math

npm version

symbolic-math is a Javascript (Typescript) library for symbolic mathematics.

Example

import { assert } from "chai";
import { create_engine } from "../index";

describe("example", function () {
    it("a divided by b", function () {
        const lines: string[] = [
            `a/b`
        ];
        const eng = create_engine();
        const { values } = eng.executeScript(lines.join('\n'));
        assert.strictEqual(eng.renderAsInfix(values[0]), "a/b");
        assert.strictEqual(eng.renderAsSExpr(values[0]), "(* a (power b -1))");
        assert.strictEqual(eng.renderAsLaTeX(values[0]), "\\frac{a}{b}");
        eng.release();
    });
});

Features

  • arbitrary-precision arithmetic
  • complex quantities
  • geometric algebra
  • trigonometric functions
  • special functions
  • simplification
  • expansion
  • substitution
  • factoring
  • symbolic and numeric roots
  • units of measurement
  • matrices
  • derivatives and gradients
  • tensors
  • integrals
  • multi-integrals

Getting Started

Please take a look at the tutorial file.

Contributing

Please take a look at the contributing file.

References

symbolic-math is a fork of Algebrite by Davide Della Casa. The fork adds Geometric Algebra, S.I. Units of Measure, and changes the way that expressions are matched and transformed.

Algebrite started as a port of the EigenMath CAS by George Weigt to TypeScript. Another fork of EigenMath: SMIB by Philippe Billet.

Another CAS of similar nature is SymPy made in Python.

Three other Javascript CAS are

  • javascript-cas by Anthony Foster supporting "differentiation, complex numbers, sums, vectors (dot products, cross products, gradient/curl etc)"
  • Coffeequate by Matthew Alger supporting "quadratic and linear equations, simplification of most algebraic expressions, uncertainties propagation, substitutions, variables, constants, and symbolic constants".
  • Algebra.js by Nicole White which among other things can build and solve equations via a "chainable" API.