How to use the js function from mathjs

Find comprehensive JavaScript mathjs.js code examples handpicked from public code repositorys.

32
33
34
35
36
37
38
39
40
41
[expressions](http://mathjs.org/docs/expressions.html)
and supports
[chained operations](http://mathjs.org/docs/chained_operations.html).

```js
// load math.js
var math = require('mathjs');

// functions and constants
math.round(math.e, 3);            // 2.718
fork icon6
star icon17
watch icon4

+ 5 other calls in file

-3
fork icon0
star icon5
watch icon28

+ 47 other calls in file

86
87
88
89
90
91
92
93
94
95


## Parser

Math.js contains a flexible and easy to use expression parser.
The parser supports all data types, methods and constants available in math.js.
It has a method `eval` to evaluate expressions,
and `parse` to parse expressions and build a node tree from it.
The parser supports variable and function definitions.
Variables and functions can be manipulated using the methods `get` and `set`.
fork icon0
star icon0
watch icon2

+ 47 other calls in file

22
23
24
25
26
27
28
29
30
31
  support the math.js data types.

Math.js can be extended with functions and variables:

```js
// create an instance of math.js
var math = require('mathjs')();

// define new functions and variables
math.import({
fork icon0
star icon0
watch icon10

+ 29 other calls in file