mathjs 10.2.0 → 10.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/HISTORY.md +12 -0
  2. package/docs/expressions/syntax.md +31 -2
  3. package/docs/reference/functions/map.md +22 -5
  4. package/docs/reference/functions/subset.md +10 -2
  5. package/docs/reference/functions/symbolicEqual.md +62 -0
  6. package/docs/reference/functions.md +2 -1
  7. package/lib/browser/math.js +5 -5
  8. package/lib/browser/math.js.map +1 -1
  9. package/lib/cjs/entry/dependenciesAny/dependenciesSymbolicEqual.generated.js +29 -0
  10. package/lib/cjs/entry/dependenciesAny.generated.js +8 -0
  11. package/lib/cjs/entry/impureFunctionsAny.generated.js +16 -8
  12. package/lib/cjs/entry/pureFunctionsAny.generated.js +9 -9
  13. package/lib/cjs/expression/embeddedDocs/embeddedDocs.js +237 -234
  14. package/lib/cjs/expression/embeddedDocs/function/algebra/symbolicEqual.js +15 -0
  15. package/lib/cjs/expression/embeddedDocs/function/matrix/subset.js +2 -2
  16. package/lib/cjs/expression/node/FunctionNode.js +74 -55
  17. package/lib/cjs/factoriesAny.js +8 -0
  18. package/lib/cjs/function/algebra/simplify.js +8 -0
  19. package/lib/cjs/function/algebra/symbolicEqual.js +88 -0
  20. package/lib/cjs/function/matrix/eigs/complexEigs.js +8 -6
  21. package/lib/cjs/function/matrix/map.js +53 -15
  22. package/lib/cjs/function/matrix/subset.js +15 -5
  23. package/lib/cjs/header.js +2 -2
  24. package/lib/cjs/version.js +1 -1
  25. package/lib/esm/entry/dependenciesAny/dependenciesSymbolicEqual.generated.js +16 -0
  26. package/lib/esm/entry/dependenciesAny.generated.js +1 -0
  27. package/lib/esm/entry/impureFunctionsAny.generated.js +16 -9
  28. package/lib/esm/entry/pureFunctionsAny.generated.js +8 -8
  29. package/lib/esm/expression/embeddedDocs/embeddedDocs.js +218 -216
  30. package/lib/esm/expression/embeddedDocs/function/algebra/symbolicEqual.js +8 -0
  31. package/lib/esm/expression/embeddedDocs/function/matrix/subset.js +2 -2
  32. package/lib/esm/expression/node/FunctionNode.js +70 -53
  33. package/lib/esm/factoriesAny.js +1 -0
  34. package/lib/esm/function/algebra/simplify.js +8 -0
  35. package/lib/esm/function/algebra/symbolicEqual.js +80 -0
  36. package/lib/esm/function/matrix/eigs/complexEigs.js +8 -6
  37. package/lib/esm/function/matrix/map.js +53 -15
  38. package/lib/esm/function/matrix/subset.js +15 -5
  39. package/lib/esm/version.js +1 -1
  40. package/package.json +1 -1
  41. package/types/index.d.ts +4 -4
@@ -77,76 +77,93 @@ export var createFunctionNode = /* #__PURE__ */factory(name, dependencies, _ref
77
77
  var evalArgs = this.args.map(arg => arg._compile(math, argNames));
78
78
 
79
79
  if (isSymbolNode(this.fn)) {
80
- // we can statically determine whether the function has an rawArgs property
81
80
  var _name = this.fn.name;
82
- var fn = _name in math ? getSafeProperty(math, _name) : undefined;
83
- var isRaw = typeof fn === 'function' && fn.rawArgs === true;
84
81
 
85
- var resolveFn = scope => {
86
- if (scope.has(_name)) {
87
- return scope.get(_name);
88
- }
82
+ if (!argNames[_name]) {
83
+ // we can statically determine whether the function has an rawArgs property
84
+ var fn = _name in math ? getSafeProperty(math, _name) : undefined;
85
+ var isRaw = typeof fn === 'function' && fn.rawArgs === true;
89
86
 
90
- if (_name in math) {
91
- return getSafeProperty(math, _name);
92
- }
87
+ var resolveFn = scope => {
88
+ if (scope.has(_name)) {
89
+ return scope.get(_name);
90
+ }
93
91
 
94
- return FunctionNode.onUndefinedFunction(_name);
95
- };
92
+ if (_name in math) {
93
+ return getSafeProperty(math, _name);
94
+ }
96
95
 
97
- if (isRaw) {
98
- // pass unevaluated parameters (nodes) to the function
99
- // "raw" evaluation
100
- var rawArgs = this.args;
101
- return function evalFunctionNode(scope, args, context) {
102
- var fn = resolveFn(scope);
103
- return fn(rawArgs, math, createSubScope(scope, args), scope);
96
+ return FunctionNode.onUndefinedFunction(_name);
104
97
  };
105
- } else {
106
- // "regular" evaluation
107
- switch (evalArgs.length) {
108
- case 0:
109
- return function evalFunctionNode(scope, args, context) {
110
- var fn = resolveFn(scope);
111
- return fn();
112
- };
113
-
114
- case 1:
115
- return function evalFunctionNode(scope, args, context) {
116
- var fn = resolveFn(scope);
117
- var evalArg0 = evalArgs[0];
118
- return fn(evalArg0(scope, args, context));
119
- };
120
-
121
- case 2:
122
- return function evalFunctionNode(scope, args, context) {
123
- var fn = resolveFn(scope);
124
- var evalArg0 = evalArgs[0];
125
- var evalArg1 = evalArgs[1];
126
- return fn(evalArg0(scope, args, context), evalArg1(scope, args, context));
127
- };
128
-
129
- default:
130
- return function evalFunctionNode(scope, args, context) {
131
- var fn = resolveFn(scope);
132
- var values = evalArgs.map(evalArg => evalArg(scope, args, context));
133
- return fn(...values);
134
- };
98
+
99
+ if (isRaw) {
100
+ // pass unevaluated parameters (nodes) to the function
101
+ // "raw" evaluation
102
+ var rawArgs = this.args;
103
+ return function evalFunctionNode(scope, args, context) {
104
+ var fn = resolveFn(scope);
105
+ return fn(rawArgs, math, createSubScope(scope, args), scope);
106
+ };
107
+ } else {
108
+ // "regular" evaluation
109
+ switch (evalArgs.length) {
110
+ case 0:
111
+ return function evalFunctionNode(scope, args, context) {
112
+ var fn = resolveFn(scope);
113
+ return fn();
114
+ };
115
+
116
+ case 1:
117
+ return function evalFunctionNode(scope, args, context) {
118
+ var fn = resolveFn(scope);
119
+ var evalArg0 = evalArgs[0];
120
+ return fn(evalArg0(scope, args, context));
121
+ };
122
+
123
+ case 2:
124
+ return function evalFunctionNode(scope, args, context) {
125
+ var fn = resolveFn(scope);
126
+ var evalArg0 = evalArgs[0];
127
+ var evalArg1 = evalArgs[1];
128
+ return fn(evalArg0(scope, args, context), evalArg1(scope, args, context));
129
+ };
130
+
131
+ default:
132
+ return function evalFunctionNode(scope, args, context) {
133
+ var fn = resolveFn(scope);
134
+ var values = evalArgs.map(evalArg => evalArg(scope, args, context));
135
+ return fn(...values);
136
+ };
137
+ }
135
138
  }
139
+ } else {
140
+ // the function symbol is an argName
141
+ var _rawArgs = this.args;
142
+ return function evalFunctionNode(scope, args, context) {
143
+ var fn = args[_name];
144
+ var isRaw = fn && fn.rawArgs;
145
+
146
+ if (isRaw) {
147
+ return fn(_rawArgs, math, createSubScope(scope, args), scope); // "raw" evaluation
148
+ } else {
149
+ var values = evalArgs.map(evalArg => evalArg(scope, args, context));
150
+ return fn.apply(fn, values);
151
+ }
152
+ };
136
153
  }
137
154
  } else if (isAccessorNode(this.fn) && isIndexNode(this.fn.index) && this.fn.index.isObjectProperty()) {
138
155
  // execute the function with the right context: the object of the AccessorNode
139
156
  var evalObject = this.fn.object._compile(math, argNames);
140
157
 
141
158
  var prop = this.fn.index.getObjectProperty();
142
- var _rawArgs = this.args;
159
+ var _rawArgs2 = this.args;
143
160
  return function evalFunctionNode(scope, args, context) {
144
161
  var object = evalObject(scope, args, context);
145
162
  validateSafeMethod(object, prop);
146
163
  var isRaw = object[prop] && object[prop].rawArgs;
147
164
 
148
165
  if (isRaw) {
149
- return object[prop](_rawArgs, math, createSubScope(scope, args), scope); // "raw" evaluation
166
+ return object[prop](_rawArgs2, math, createSubScope(scope, args), scope); // "raw" evaluation
150
167
  } else {
151
168
  // "regular" evaluation
152
169
  var values = evalArgs.map(evalArg => evalArg(scope, args, context));
@@ -158,13 +175,13 @@ export var createFunctionNode = /* #__PURE__ */factory(name, dependencies, _ref
158
175
  // we have to dynamically determine whether the function has a rawArgs property
159
176
  var evalFn = this.fn._compile(math, argNames);
160
177
 
161
- var _rawArgs2 = this.args;
178
+ var _rawArgs3 = this.args;
162
179
  return function evalFunctionNode(scope, args, context) {
163
180
  var fn = evalFn(scope, args, context);
164
181
  var isRaw = fn && fn.rawArgs;
165
182
 
166
183
  if (isRaw) {
167
- return fn(_rawArgs2, math, createSubScope(scope, args), scope); // "raw" evaluation
184
+ return fn(_rawArgs3, math, createSubScope(scope, args), scope); // "raw" evaluation
168
185
  } else {
169
186
  // "regular" evaluation
170
187
  var values = evalArgs.map(evalArg => evalArg(scope, args, context));
@@ -245,6 +245,7 @@ export { createLeafCount } from './function/algebra/leafCount.js';
245
245
  export { createSimplify } from './function/algebra/simplify.js';
246
246
  export { createSimplifyCore } from './function/algebra/simplifyCore.js';
247
247
  export { createResolve } from './function/algebra/resolve.js';
248
+ export { createSymbolicEqual } from './function/algebra/symbolicEqual.js';
248
249
  export { createDerivative } from './function/algebra/derivative.js';
249
250
  export { createRationalize } from './function/algebra/rationalize.js';
250
251
  export { createReviver } from './json/reviver.js';
@@ -327,6 +327,14 @@ export var createSimplify = /* #__PURE__ */factory(name, dependencies, _ref => {
327
327
  total: true
328
328
  }
329
329
  }
330
+ }, {
331
+ s: 'n-n -> 0',
332
+ // partial alternative when we can't always subtract
333
+ assuming: {
334
+ subtract: {
335
+ total: false
336
+ }
337
+ }
330
338
  }, {
331
339
  s: '-(c*v) -> v * (-c)',
332
340
  // make non-constant terms positive
@@ -0,0 +1,80 @@
1
+ import { isConstantNode } from '../../utils/is.js';
2
+ import { factory } from '../../utils/factory.js';
3
+ var name = 'symbolicEqual';
4
+ var dependencies = ['parse', 'simplify', 'typed', 'OperatorNode'];
5
+ export var createSymbolicEqual = /* #__PURE__ */factory(name, dependencies, _ref => {
6
+ var {
7
+ parse,
8
+ simplify,
9
+ typed,
10
+ OperatorNode
11
+ } = _ref;
12
+
13
+ /**
14
+ * Attempts to determine if two expressions are symbolically equal, i.e.
15
+ * one is the result of valid algebraic manipulations on the other.
16
+ * Currently, this simply checks if the difference of the two expressions
17
+ * simplifies down to 0. So there are two important caveats:
18
+ * 1. whether two expressions are symbolically equal depends on the
19
+ * manipulations allowed. Therefore, this function takes an optional
20
+ * third argument, which are the options that control the behavior
21
+ * as documented for the `simplify()` function.
22
+ * 2. it is in general intractable to find the minimal simplification of
23
+ * an arbitrarily complicated expression. So while a `true` value
24
+ * of `symbolicEqual` ensures that the two expressions can be manipulated
25
+ * to match each other, a `false` value does not absolutely rule this out.
26
+ *
27
+ * Syntax:
28
+ *
29
+ * symbolicEqual(expr1, expr2)
30
+ * symbolicEqual(expr1, expr2, options)
31
+ *
32
+ * Examples:
33
+ *
34
+ * symbolicEqual('x*y', 'y*x') // true
35
+ * symbolicEqual('x*y', 'y*x', {context: {multiply: {commutative: false}}})
36
+ * //false
37
+ * symbolicEqual('x/y', '(y*x^(-1))^(-1)') // true
38
+ * symbolicEqual('abs(x)','x') // false
39
+ * symbolicEqual('abs(x)','x', simplify.positiveContext) // true
40
+ *
41
+ * See also:
42
+ *
43
+ * simplify, evaluate
44
+ *
45
+ * @param {Node|string} expr1 The first expression to compare
46
+ * @param {Node|string} expr2 The second expression to compare
47
+ * @param {Object} [options] Optional option object, passed to simplify
48
+ * @returns {boolean}
49
+ * Returns true if a valid manipulation making the expressions equal
50
+ * is found.
51
+ */
52
+ return typed(name, {
53
+ 'string, string': function stringString(s1, s2) {
54
+ return this(parse(s1), parse(s2), {});
55
+ },
56
+ 'string, string, Object': function stringStringObject(s1, s2, options) {
57
+ return this(parse(s1), parse(s2), options);
58
+ },
59
+ 'Node, string': function NodeString(e1, s2) {
60
+ return this(e1, parse(s2), {});
61
+ },
62
+ 'Node, string, Object': function NodeStringObject(e1, s2, options) {
63
+ return this(e1, parse(s2), options);
64
+ },
65
+ 'string, Node': function stringNode(s1, e2) {
66
+ return this(parse(s1), e2, {});
67
+ },
68
+ 'string, Node, Object': function stringNodeObject(s1, e2, options) {
69
+ return this(parse(s1), e2, options);
70
+ },
71
+ 'Node, Node': function NodeNode(e1, e2) {
72
+ return this(e1, e2, {});
73
+ },
74
+ 'Node, Node, Object': function NodeNodeObject(e1, e2, options) {
75
+ var diff = new OperatorNode('-', 'subtract', [e1, e2]);
76
+ var simplified = simplify(diff, {}, options);
77
+ return isConstantNode(simplified) && !simplified.value;
78
+ }
79
+ });
80
+ });
@@ -84,8 +84,9 @@ export function createComplexEigs(_ref) {
84
84
  function balance(arr, N, prec, type, findVectors) {
85
85
  var big = type === 'BigNumber';
86
86
  var cplx = type === 'Complex';
87
- var zero = big ? bignumber(0) : cplx ? complex(0) : 0;
88
- var one = big ? bignumber(1) : cplx ? complex(1) : 1; // base of the floating-point arithmetic
87
+ var realzero = big ? bignumber(0) : 0;
88
+ var one = big ? bignumber(1) : cplx ? complex(1) : 1;
89
+ var realone = big ? bignumber(1) : 1; // base of the floating-point arithmetic
89
90
 
90
91
  var radix = big ? bignumber(10) : 2;
91
92
  var radixSq = multiplyScalar(radix, radix); // the diagonal transformation matrix R
@@ -106,12 +107,13 @@ export function createComplexEigs(_ref) {
106
107
  for (var i = 0; i < N; i++) {
107
108
  // compute the taxicab norm of i-th column and row
108
109
  // TODO optimize for complex numbers
109
- var colNorm = zero;
110
- var rowNorm = zero;
110
+ var colNorm = realzero;
111
+ var rowNorm = realzero;
111
112
 
112
113
  for (var j = 0; j < N; j++) {
113
114
  if (i === j) continue;
114
- var c = abs(arr[i][j]);
115
+ var c = abs(arr[i][j]); // should be real
116
+
115
117
  colNorm = addScalar(colNorm, c);
116
118
  rowNorm = addScalar(rowNorm, c);
117
119
  }
@@ -120,7 +122,7 @@ export function createComplexEigs(_ref) {
120
122
  // find integer power closest to balancing the matrix
121
123
  // (we want to scale only by integer powers of radix,
122
124
  // so that we don't lose any precision due to round-off)
123
- var f = one;
125
+ var f = realone;
124
126
  var _c = colNorm;
125
127
  var rowDivRadix = divideScalar(rowNorm, radix);
126
128
  var rowMulRadix = multiplyScalar(rowNorm, radix);
@@ -8,8 +8,15 @@ export var createMap = /* #__PURE__ */factory(name, dependencies, _ref => {
8
8
  } = _ref;
9
9
 
10
10
  /**
11
- * Create a new matrix or array with the results of the callback function executed on
12
- * each entry of the matrix/array.
11
+ * Create a new matrix or array with the results of a callback function executed on
12
+ * each entry of a given matrix/array.
13
+ *
14
+ * For each entry of the input, the callback is invoked with three arguments:
15
+ * the value of the entry, the index at which that entry occurs, and the full
16
+ * matrix/array being traversed. Note that because the matrix/array might be
17
+ * multidimensional, the "index" argument is always an array of numbers giving
18
+ * the index in each dimension. This is true even for vectors: the "index"
19
+ * argument is an array of length 1, rather than simply a number.
13
20
  *
14
21
  * Syntax:
15
22
  *
@@ -21,15 +28,25 @@ export var createMap = /* #__PURE__ */factory(name, dependencies, _ref => {
21
28
  * return value * value
22
29
  * }) // returns [1, 4, 9]
23
30
  *
31
+ * // The calling convention for the callback can cause subtleties:
32
+ * math.map([1, 2, 3], math.format)
33
+ * // throws TypeError: map attempted to call 'format(1,[0])' but argument 2 of type Array does not match expected type number or function or Object or string or boolean
34
+ * // [This happens because `format` _can_ take a second argument,
35
+ * // but its semantics don't match that of the 2nd argument `map` provides]
36
+ *
37
+ * // To avoid this error, use a function that takes exactly the
38
+ * // desired arguments:
39
+ * math.map([1, 2, 3], x => math.format(x)) // returns ['1', '2', '3']
40
+ *
24
41
  * See also:
25
42
  *
26
43
  * filter, forEach, sort
27
44
  *
28
- * @param {Matrix | Array} x The matrix to iterate on.
29
- * @param {Function} callback The callback method is invoked with three
30
- * parameters: the value of the element, the index
31
- * of the element, and the matrix being traversed.
32
- * @return {Matrix | array} Transformed map of x
45
+ * @param {Matrix | Array} x The input to iterate on.
46
+ * @param {Function} callback
47
+ * The function to call (as described above) on each entry of the input
48
+ * @return {Matrix | array}
49
+ * Transformed map of x; always has the same type and shape as x
33
50
  */
34
51
  return typed(name, {
35
52
  'Array, function': _map,
@@ -57,14 +74,35 @@ function _map(array, callback) {
57
74
  return recurse(child, index.concat(i));
58
75
  });
59
76
  } else {
60
- // invoke the callback function with the right number of arguments
61
- if (args === 1) {
62
- return callback(value);
63
- } else if (args === 2) {
64
- return callback(value, index);
65
- } else {
66
- // 3 or -1
67
- return callback(value, index, array);
77
+ try {
78
+ // invoke the callback function with the right number of arguments
79
+ if (args === 1) {
80
+ return callback(value);
81
+ } else if (args === 2) {
82
+ return callback(value, index);
83
+ } else {
84
+ // 3 or -1
85
+ return callback(value, index, array);
86
+ }
87
+ } catch (err) {
88
+ // But maybe the arguments still weren't right
89
+ if (err instanceof TypeError && 'data' in err && err.data.category === 'wrongType') {
90
+ var newmsg = "map attempted to call '".concat(err.data.fn, "(").concat(value);
91
+ var indexString = JSON.stringify(index);
92
+
93
+ if (args === 2) {
94
+ newmsg += ',' + indexString;
95
+ } else if (args !== 1) {
96
+ newmsg += ",".concat(indexString, ",").concat(array);
97
+ }
98
+
99
+ newmsg += ")' but argument ".concat(err.data.index + 1, " of type ");
100
+ newmsg += "".concat(err.data.actual, " does not match expected type ");
101
+ newmsg += err.data.expected.join(' or ');
102
+ throw new TypeError(newmsg);
103
+ }
104
+
105
+ throw err;
68
106
  }
69
107
  }
70
108
  };
@@ -28,16 +28,26 @@ export var createSubset = /* #__PURE__ */factory(name, dependencies, _ref => {
28
28
  *
29
29
  * // replace a subset
30
30
  * const e = []
31
- * const f = math.subset(e, math.index(0, [0, 2]), [5, 6]) // f = [[5, 6]]
31
+ * const f = math.subset(e, math.index(0, [0, 2]), [5, 6]) // f = [[5, 6]] and e = [[5, 0, 6]]
32
32
  * const g = math.subset(f, math.index(1, 1), 7, 0) // g = [[5, 6], [0, 7]]
33
33
  *
34
+ * // get submatrix using ranges
35
+ * const M = [
36
+ * [1,2,3],
37
+ * [4,5,6],
38
+ * [7,8,9]
39
+ * ]
40
+ * math.subset(M, math.index(math.range(0,2), math.range(0,3))) // [[1,2,3],[4,5,6]]
41
+ *
34
42
  * See also:
35
43
  *
36
44
  * size, resize, squeeze, index
37
45
  *
38
46
  * @param {Array | Matrix | string} matrix An array, matrix, or string
39
- * @param {Index} index An index containing ranges for each
40
- * dimension
47
+ * @param {Index} index
48
+ * For each dimension of the target, specifies an index or a list of
49
+ * indices to fetch or set. `subset` uses the cartesian product of
50
+ * the indices specified in each dimension.
41
51
  * @param {*} [replacement] An array, matrix, or scalar.
42
52
  * If provided, the subset is replaced with replacement.
43
53
  * If not provided, the subset is returned
@@ -80,7 +90,7 @@ export var createSubset = /* #__PURE__ */factory(name, dependencies, _ref => {
80
90
  /**
81
91
  * Retrieve a subset of a string
82
92
  * @param {string} str string from which to get a substring
83
- * @param {Index} index An index containing ranges for each dimension
93
+ * @param {Index} index An index or list of indices (character positions)
84
94
  * @returns {string} substring
85
95
  * @private
86
96
  */
@@ -109,7 +119,7 @@ function _getSubstring(str, index) {
109
119
  /**
110
120
  * Replace a substring in a string
111
121
  * @param {string} str string to be replaced
112
- * @param {Index} index An index containing ranges for each dimension
122
+ * @param {Index} index An index or list of indices (character positions)
113
123
  * @param {string} replacement Replacement string
114
124
  * @param {string} [defaultValue] Default value to be uses when resizing
115
125
  * the string. is ' ' by default
@@ -1,2 +1,2 @@
1
- export var version = '10.2.0'; // Note: This file is automatically generated when building math.js.
1
+ export var version = '10.3.0'; // Note: This file is automatically generated when building math.js.
2
2
  // Changes made in this file will be overwritten.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mathjs",
3
- "version": "10.2.0",
3
+ "version": "10.3.0",
4
4
  "description": "Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.",
5
5
  "author": "Jos de Jong <wjosdejong@gmail.com> (https://github.com/josdejong)",
6
6
  "homepage": "https://mathjs.org",
package/types/index.d.ts CHANGED
@@ -1723,7 +1723,7 @@ declare namespace math {
1723
1723
  /**
1724
1724
  * Get or set a subset of a matrix or string.
1725
1725
  * @param value An array, matrix, or string
1726
- * @param index An index containing ranges for each dimension
1726
+ * @param index For each dimension, an index or list of indices to get or set.
1727
1727
  * @param replacement An array, matrix, or scalar. If provided, the
1728
1728
  * subset is replaced with replacement. If not provided, the subset is
1729
1729
  * returned
@@ -3218,8 +3218,6 @@ declare namespace math {
3218
3218
  ): MathNode;
3219
3219
 
3220
3220
  rules: SimplifyRule[];
3221
-
3222
- simplifyCore(expr: MathNode): MathNode;
3223
3221
  }
3224
3222
 
3225
3223
  interface UnitDefinition {
@@ -3682,6 +3680,8 @@ declare namespace math {
3682
3680
  */
3683
3681
  simplify(rules?: SimplifyRule[], scope?: object): MathJsChain;
3684
3682
 
3683
+ simplifyCore(expr: MathNode): MathNode;
3684
+
3685
3685
  /**
3686
3686
  * Calculate the Sparse Matrix LU decomposition with full pivoting.
3687
3687
  * Sparse Matrix A is decomposed in two matrices (L, U) and two
@@ -4319,7 +4319,7 @@ declare namespace math {
4319
4319
 
4320
4320
  /**
4321
4321
  * Get or set a subset of a matrix or string.
4322
- * @param index An index containing ranges for each dimension
4322
+ * @param index For each dimension, an index or list of indices to get or set
4323
4323
  * @param replacement An array, matrix, or scalar. If provided, the
4324
4324
  * subset is replaced with replacement. If not provided, the subset is
4325
4325
  * returned