UNPKG

1.69 kBJavaScriptView Raw
1'use strict';
2
3var core = require('./core/core');
4/**
5 * math.js factory function. Creates a new instance of math.js
6 *
7 * @param {Object} [config] Available configuration options:
8 * {number} epsilon
9 * Minimum relative difference between two
10 * compared values, used by all comparison functions.
11 * {string} matrix
12 * A string 'matrix' (default) or 'array'.
13 * {string} number
14 * A string 'number' (default), 'bignumber', or
15 * 'fraction'
16 * {number} precision
17 * The number of significant digits for BigNumbers.
18 * Not applicable for Numbers.
19 * {boolean} predictable
20 * Predictable output type of functions. When true,
21 * output type depends only on the input types. When
22 * false (default), output type can vary depending
23 * on input values. For example `math.sqrt(-4)`
24 * returns `complex('2i')` when predictable is false, and
25 * returns `NaN` when true.
26 */
27
28
29function create(config) {
30 // create a new math.js instance
31 var math = core.create(config);
32 math.create = create; // import data types, functions, constants, expression parser, etc.
33
34 math['import'](require('./index'));
35 return math;
36} // return a new instance of math.js
37
38
39module.exports = create();
\No newline at end of file