0.0.163 • Published 3 months ago

jsxmath v0.0.163

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

npm version

JsxMath is a Javascript (Typescript) library for symbolic mathematics.

Example

import { assert } from "chai";
import { is_rat } from "math-expression-atoms";
import { create_engine, ExprEngine } from "../src/api/index";
import { State, Stepper } from '../src/clojurescript/runtime/Interpreter';
import { Stack } from "../src/env/Stack";

describe("example", function () {
    it("program", function () {
        const lines: string[] = [
            `(+ 1 2 3 4 5)`,
            `(+ 10 (* 5 2))`,
            `(* (+ 10 5) 2)`
        ];
        const sourceText = lines.join('\n');
        const engine: ExprEngine = create_engine({ syntaxKind: ... });
        const { program, errors } = engine.parseModule(sourceText, {});
        assert.strictEqual(errors.length, 0);
        const runner = new Stepper(program);
        runner.run();
        const stack: Stack<State> = runner.getStateStack();
        assert.strictEqual(stack.length, 1);
        const values = stack.top.values;
        assert.strictEqual(values.length, 3);
        assert.strictEqual(engine.renderAsString(values[0], { format: 'Infix' }), "15");
        assert.strictEqual(is_rat(values[0]), true);
        assert.strictEqual(engine.renderAsString(values[1], { format: 'Infix' }), "20");
        assert.strictEqual(is_rat(values[1]), true);
        assert.strictEqual(engine.renderAsString(values[2], { format: 'Infix' }), "30");
        assert.strictEqual(is_rat(values[2]), true);
        engine.release();
    });
});```

## Features

* arbitrary-precision arithmetic
* complex quantities
* geometric algebra
* trigonometric functions
* special functions
* simplification
* expansion
* substitution
* factoring
* symbolic and numeric roots
* units of measure
* hyperreal numbers
* matrices
* derivatives and gradients
* tensors
* booleans
* integrals
* multi-integrals
* open for extension

## Getting Started

Please take a look at the [tutorial](https://github.com/geometryzen/jsxmath/blob/master/TUTORIAL.md) file.

## Contributing

Please take a look at the [contributing](https://github.com/geometryzen/jsxmath/blob/master/CONTRIBUTING.md) file.

## References

jsxmath is a fork of [Algebrite by Davide Della Casa](https://github.com/davidedc/Algebrite).
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](http://eigenmath.sourceforge.net/Eigenmath.pdf) to TypeScript.
Another fork of EigenMath: [SMIB by Philippe Billet](http://smib.sourceforge.net/).

Another CAS of similar nature is [SymPy](http://www.sympy.org/en/index.html) made in Python.

Three other Javascript CAS are

* [javascript-cas by Anthony Foster](https://github.com/aantthony/javascript-cas) supporting "differentiation, complex numbers, sums, vectors (dot products, cross products, gradient/curl etc)"
* [Coffeequate by Matthew Alger](http://coffeequate.readthedocs.org/) supporting "quadratic and linear equations, simplification of most algebraic expressions, uncertainties propagation, substitutions, variables, constants, and symbolic constants".
* [Algebra.js by Nicole White](http://algebra.js.org) which among other things can build and solve equations via a "chainable" API.
0.0.159

3 months ago

0.0.158

3 months ago

0.0.157

3 months ago

0.0.156

3 months ago

0.0.163

3 months ago

0.0.162

3 months ago

0.0.160

3 months ago

0.0.153

3 months ago

0.0.152

3 months ago

0.0.151

3 months ago

0.0.150

3 months ago

0.0.155

3 months ago

0.0.154

3 months ago

0.0.149

3 months ago

0.0.148

3 months ago

0.0.147

3 months ago

0.0.142

3 months ago

0.0.141

3 months ago

0.0.146

3 months ago

0.0.145

3 months ago

0.0.144

3 months ago

0.0.143

3 months ago

0.0.139

3 months ago

0.0.138

3 months ago

0.0.137

3 months ago

0.0.136

3 months ago

0.0.131

3 months ago

0.0.130

3 months ago

0.0.135

3 months ago

0.0.134

3 months ago

0.0.133

3 months ago

0.0.132

3 months ago

0.0.140

3 months ago

0.0.128

3 months ago

0.0.127

3 months ago

0.0.129

3 months ago

0.0.119

3 months ago

0.0.118

3 months ago

0.0.126

3 months ago

0.0.125

3 months ago

0.0.120

3 months ago

0.0.124

3 months ago

0.0.123

3 months ago

0.0.122

3 months ago

0.0.121

3 months ago

0.0.117

3 months ago

0.0.116

3 months ago

0.0.115

3 months ago

0.0.114

4 months ago

0.0.113

4 months ago

0.0.112

4 months ago

0.0.111

4 months ago

0.0.109

4 months ago

0.0.110

4 months ago

0.0.106

4 months ago

0.0.108

4 months ago

0.0.107

4 months ago

0.0.105

4 months ago

0.0.104

4 months ago

0.0.103

4 months ago

0.0.102

4 months ago

0.0.101

4 months ago

0.0.100

4 months ago

0.0.99

4 months ago

0.0.95

4 months ago

0.0.96

4 months ago

0.0.97

4 months ago

0.0.98

4 months ago

0.0.93

4 months ago

0.0.94

4 months ago

0.0.91

4 months ago

0.0.92

4 months ago

0.0.85

4 months ago

0.0.86

4 months ago

0.0.87

4 months ago

0.0.88

4 months ago

0.0.89

4 months ago

0.0.90

4 months ago

0.0.84

4 months ago

0.0.80

4 months ago

0.0.81

4 months ago

0.0.82

4 months ago

0.0.83

4 months ago

0.0.73

4 months ago

0.0.74

4 months ago

0.0.75

4 months ago

0.0.76

4 months ago

0.0.77

4 months ago

0.0.78

4 months ago

0.0.79

4 months ago

0.0.70

4 months ago

0.0.71

4 months ago

0.0.72

4 months ago

0.0.62

4 months ago

0.0.63

4 months ago

0.0.64

4 months ago

0.0.65

4 months ago

0.0.66

4 months ago

0.0.67

4 months ago

0.0.68

4 months ago

0.0.69

4 months ago

0.0.60

4 months ago

0.0.61

4 months ago

0.0.59

4 months ago

0.0.51

4 months ago

0.0.52

4 months ago

0.0.53

4 months ago

0.0.54

4 months ago

0.0.55

4 months ago

0.0.56

4 months ago

0.0.57

4 months ago

0.0.58

4 months ago

0.0.50

4 months ago

0.0.44

4 months ago

0.0.45

4 months ago

0.0.46

4 months ago

0.0.47

4 months ago

0.0.48

4 months ago

0.0.49

4 months ago

0.0.41

4 months ago

0.0.42

4 months ago

0.0.43

4 months ago

0.0.40

4 months ago

0.0.38

4 months ago

0.0.39

4 months ago

0.0.37

4 months ago

0.0.20

5 months ago

0.0.21

5 months ago

0.0.22

5 months ago

0.0.23

5 months ago

0.0.24

5 months ago

0.0.25

4 months ago

0.0.17

5 months ago

0.0.18

5 months ago

0.0.19

5 months ago

0.0.30

4 months ago

0.0.31

4 months ago

0.0.32

4 months ago

0.0.33

4 months ago

0.0.34

4 months ago

0.0.35

4 months ago

0.0.36

4 months ago

0.0.26

4 months ago

0.0.27

4 months ago

0.0.28

4 months ago

0.0.29

4 months ago

0.0.16

5 months ago

0.0.15

5 months ago

0.0.14

5 months ago

0.0.13

12 months ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago