mathjs 10.5.0 → 10.5.1
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.
- package/HISTORY.md +12 -0
- package/docs/datatypes/matrices.md +17 -0
- package/docs/expressions/syntax.md +4 -1
- package/docs/reference/functions/fix.md +1 -0
- package/docs/reference/functions/floor.md +4 -0
- package/docs/reference/functions/resolve.md +2 -2
- package/docs/reference/functions/simplifyConstant.md +52 -0
- package/lib/browser/math.js +5 -5
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/entry/dependenciesAny/dependenciesCeil.generated.js +6 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesFix.generated.js +9 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesFloor.generated.js +6 -0
- package/lib/cjs/entry/dependenciesAny/dependenciesIndexNode.generated.js +0 -3
- package/lib/cjs/entry/dependenciesNumber/dependenciesCeil.generated.js +3 -0
- package/lib/cjs/entry/dependenciesNumber/dependenciesFix.generated.js +6 -0
- package/lib/cjs/entry/dependenciesNumber/dependenciesFloor.generated.js +3 -0
- package/lib/cjs/entry/dependenciesNumber/dependenciesIndexNode.generated.js +0 -3
- package/lib/cjs/entry/impureFunctionsAny.generated.js +0 -1
- package/lib/cjs/entry/impureFunctionsNumber.generated.js +6 -7
- package/lib/cjs/entry/pureFunctionsAny.generated.js +10 -3
- package/lib/cjs/entry/pureFunctionsNumber.generated.js +21 -15
- package/lib/cjs/expression/node/IndexNode.js +26 -61
- package/lib/cjs/factoriesNumber.js +29 -24
- package/lib/cjs/function/algebra/resolve.js +3 -3
- package/lib/cjs/function/arithmetic/ceil.js +75 -39
- package/lib/cjs/function/arithmetic/fix.js +54 -16
- package/lib/cjs/function/arithmetic/floor.js +79 -37
- package/lib/cjs/function/arithmetic/nthRoot.js +1 -3
- package/lib/cjs/function/arithmetic/round.js +27 -47
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/plain/number/arithmetic.js +9 -27
- package/lib/cjs/type/matrix/function/sparse.js +6 -0
- package/lib/cjs/utils/lruQueue.js +1 -3
- package/lib/cjs/utils/object.js +3 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/entry/dependenciesAny/dependenciesCeil.generated.js +4 -0
- package/lib/esm/entry/dependenciesAny/dependenciesFix.generated.js +6 -0
- package/lib/esm/entry/dependenciesAny/dependenciesFloor.generated.js +4 -0
- package/lib/esm/entry/dependenciesAny/dependenciesIndexNode.generated.js +0 -2
- package/lib/esm/entry/dependenciesNumber/dependenciesCeil.generated.js +2 -0
- package/lib/esm/entry/dependenciesNumber/dependenciesFix.generated.js +4 -0
- package/lib/esm/entry/dependenciesNumber/dependenciesFloor.generated.js +2 -0
- package/lib/esm/entry/dependenciesNumber/dependenciesIndexNode.generated.js +0 -2
- package/lib/esm/entry/impureFunctionsAny.generated.js +0 -1
- package/lib/esm/entry/impureFunctionsNumber.generated.js +7 -8
- package/lib/esm/entry/pureFunctionsAny.generated.js +10 -3
- package/lib/esm/entry/pureFunctionsNumber.generated.js +16 -10
- package/lib/esm/expression/node/BlockNode.js +3 -3
- package/lib/esm/expression/node/IndexNode.js +22 -59
- package/lib/esm/expression/parse.js +5 -5
- package/lib/esm/factoriesNumber.js +6 -6
- package/lib/esm/function/algebra/decomposition/qr.js +2 -2
- package/lib/esm/function/algebra/resolve.js +3 -3
- package/lib/esm/function/algebra/solver/utils/solveValidation.js +5 -5
- package/lib/esm/function/algebra/sparse/csChol.js +2 -2
- package/lib/esm/function/algebra/sparse/csLeaf.js +2 -2
- package/lib/esm/function/algebra/sparse/csLu.js +3 -3
- package/lib/esm/function/arithmetic/ceil.js +61 -24
- package/lib/esm/function/arithmetic/fix.js +51 -13
- package/lib/esm/function/arithmetic/floor.js +65 -23
- package/lib/esm/function/arithmetic/nthRoot.js +1 -3
- package/lib/esm/function/arithmetic/nthRoots.js +1 -1
- package/lib/esm/function/arithmetic/round.js +25 -43
- package/lib/esm/function/matrix/expm.js +2 -2
- package/lib/esm/function/probability/gamma.js +1 -1
- package/lib/esm/function/string/bin.js +1 -1
- package/lib/esm/function/string/hex.js +1 -1
- package/lib/esm/function/string/oct.js +1 -1
- package/lib/esm/plain/number/arithmetic.js +9 -17
- package/lib/esm/type/complex/Complex.js +2 -2
- package/lib/esm/type/matrix/DenseMatrix.js +2 -2
- package/lib/esm/type/matrix/FibonacciHeap.js +2 -2
- package/lib/esm/type/matrix/SparseMatrix.js +13 -13
- package/lib/esm/type/matrix/function/sparse.js +6 -0
- package/lib/esm/type/unit/Unit.js +7 -7
- package/lib/esm/utils/lruQueue.js +1 -2
- package/lib/esm/utils/number.js +3 -3
- package/lib/esm/utils/object.js +3 -1
- package/lib/esm/version.js +1 -1
- package/package.json +14 -3
- package/types/index.d.ts +1794 -1372
- package/types/index.ts +697 -266
| @@ -1,12 +1,5 @@ | |
| 1 | 
            -
            import _defineProperty from "@babel/runtime/helpers/defineProperty";
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
         | 
| 6 | 
            -
             | 
| 7 1 | 
             
            import { factory } from '../../utils/factory.js';
         | 
| 8 2 | 
             
            import { deepMap } from '../../utils/collection.js';
         | 
| 9 | 
            -
            import { isInteger } from '../../utils/number.js';
         | 
| 10 3 | 
             
            import { createAlgorithm11 } from '../../type/matrix/utils/algorithm11.js';
         | 
| 11 4 | 
             
            import { createAlgorithm12 } from '../../type/matrix/utils/algorithm12.js';
         | 
| 12 5 | 
             
            import { createAlgorithm14 } from '../../type/matrix/utils/algorithm14.js';
         | 
| @@ -70,7 +63,16 @@ export var createRound = /* #__PURE__ */factory(name, dependencies, _ref => { | |
| 70 63 | 
             
               * @return {number | BigNumber | Fraction | Complex | Array | Matrix} Rounded value
         | 
| 71 64 | 
             
               */
         | 
| 72 65 |  | 
| 73 | 
            -
              return typed(name,  | 
| 66 | 
            +
              return typed(name, {
         | 
| 67 | 
            +
                number: roundNumber,
         | 
| 68 | 
            +
                'number, number': roundNumber,
         | 
| 69 | 
            +
                'number, BigNumber': function numberBigNumber(x, n) {
         | 
| 70 | 
            +
                  if (!n.isInteger()) {
         | 
| 71 | 
            +
                    throw new TypeError(NO_INT);
         | 
| 72 | 
            +
                  }
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                  return new BigNumber(x).toDecimalPlaces(n.toNumber());
         | 
| 75 | 
            +
                },
         | 
| 74 76 | 
             
                Complex: function Complex(x) {
         | 
| 75 77 | 
             
                  return x.round();
         | 
| 76 78 | 
             
                },
         | 
| @@ -90,13 +92,6 @@ export var createRound = /* #__PURE__ */factory(name, dependencies, _ref => { | |
| 90 92 |  | 
| 91 93 | 
             
                  return x.round(_n);
         | 
| 92 94 | 
             
                },
         | 
| 93 | 
            -
                'number, BigNumber': function numberBigNumber(x, n) {
         | 
| 94 | 
            -
                  if (!n.isInteger()) {
         | 
| 95 | 
            -
                    throw new TypeError(NO_INT);
         | 
| 96 | 
            -
                  }
         | 
| 97 | 
            -
             | 
| 98 | 
            -
                  return new BigNumber(x).toDecimalPlaces(n.toNumber());
         | 
| 99 | 
            -
                },
         | 
| 100 95 | 
             
                BigNumber: function BigNumber(x) {
         | 
| 101 96 | 
             
                  return x.toDecimalPlaces(0);
         | 
| 102 97 | 
             
                },
         | 
| @@ -117,6 +112,13 @@ export var createRound = /* #__PURE__ */factory(name, dependencies, _ref => { | |
| 117 112 |  | 
| 118 113 | 
             
                  return x.round(n);
         | 
| 119 114 | 
             
                },
         | 
| 115 | 
            +
                'Fraction, BigNumber': function FractionBigNumber(x, n) {
         | 
| 116 | 
            +
                  if (!n.isInteger()) {
         | 
| 117 | 
            +
                    throw new TypeError(NO_INT);
         | 
| 118 | 
            +
                  }
         | 
| 119 | 
            +
             | 
| 120 | 
            +
                  return x.round(n.toNumber());
         | 
| 121 | 
            +
                },
         | 
| 120 122 | 
             
                'Array | Matrix': function ArrayMatrix(x) {
         | 
| 121 123 | 
             
                  // deep map collection, skip zeros since round(0) = 0
         | 
| 122 124 | 
             
                  return deepMap(x, this, true);
         | 
| @@ -127,7 +129,11 @@ export var createRound = /* #__PURE__ */factory(name, dependencies, _ref => { | |
| 127 129 | 
             
                'DenseMatrix, number | BigNumber': function DenseMatrixNumberBigNumber(x, y) {
         | 
| 128 130 | 
             
                  return algorithm14(x, y, this, false);
         | 
| 129 131 | 
             
                },
         | 
| 130 | 
            -
                'number |  | 
| 132 | 
            +
                'Array, number | BigNumber': function ArrayNumberBigNumber(x, y) {
         | 
| 133 | 
            +
                  // use matrix implementation
         | 
| 134 | 
            +
                  return algorithm14(matrix(x), y, this, false).valueOf();
         | 
| 135 | 
            +
                },
         | 
| 136 | 
            +
                'number | Complex | BigNumber | Fraction, SparseMatrix': function numberComplexBigNumberFractionSparseMatrix(x, y) {
         | 
| 131 137 | 
             
                  // check scalar is zero
         | 
| 132 138 | 
             
                  if (equalScalar(x, 0)) {
         | 
| 133 139 | 
             
                    // do not execute algorithm, result will be a zero matrix
         | 
| @@ -136,7 +142,7 @@ export var createRound = /* #__PURE__ */factory(name, dependencies, _ref => { | |
| 136 142 |  | 
| 137 143 | 
             
                  return algorithm12(y, x, this, true);
         | 
| 138 144 | 
             
                },
         | 
| 139 | 
            -
                'number | Complex | BigNumber, DenseMatrix': function  | 
| 145 | 
            +
                'number | Complex | BigNumber | Fraction, DenseMatrix': function numberComplexBigNumberFractionDenseMatrix(x, y) {
         | 
| 140 146 | 
             
                  // check scalar is zero
         | 
| 141 147 | 
             
                  if (equalScalar(x, 0)) {
         | 
| 142 148 | 
             
                    // do not execute algorithm, result will be a zero matrix
         | 
| @@ -145,33 +151,9 @@ export var createRound = /* #__PURE__ */factory(name, dependencies, _ref => { | |
| 145 151 |  | 
| 146 152 | 
             
                  return algorithm14(y, x, this, true);
         | 
| 147 153 | 
             
                },
         | 
| 148 | 
            -
                ' | 
| 149 | 
            -
                  // use matrix implementation
         | 
| 150 | 
            -
                  return algorithm14(matrix(x), y, this, false).valueOf();
         | 
| 151 | 
            -
                },
         | 
| 152 | 
            -
                'number | Complex | BigNumber, Array': function numberComplexBigNumberArray(x, y) {
         | 
| 154 | 
            +
                'number | Complex | BigNumber | Fraction, Array': function numberComplexBigNumberFractionArray(x, y) {
         | 
| 153 155 | 
             
                  // use matrix implementation
         | 
| 154 156 | 
             
                  return algorithm14(matrix(y), x, this, true).valueOf();
         | 
| 155 157 | 
             
                }
         | 
| 156 | 
            -
              }) | 
| 157 | 
            -
            });
         | 
| 158 | 
            -
            var roundNumberSignatures = {
         | 
| 159 | 
            -
              number: roundNumber,
         | 
| 160 | 
            -
              'number, number': function numberNumber(x, n) {
         | 
| 161 | 
            -
                if (!isInteger(n)) {
         | 
| 162 | 
            -
                  throw new TypeError(NO_INT);
         | 
| 163 | 
            -
                }
         | 
| 164 | 
            -
             | 
| 165 | 
            -
                if (n < 0 || n > 15) {
         | 
| 166 | 
            -
                  throw new Error('Number of decimals in function round must be in the range of 0-15');
         | 
| 167 | 
            -
                }
         | 
| 168 | 
            -
             | 
| 169 | 
            -
                return roundNumber(x, n);
         | 
| 170 | 
            -
              }
         | 
| 171 | 
            -
            };
         | 
| 172 | 
            -
            export var createRoundNumber = /* #__PURE__ */factory(name, ['typed'], _ref2 => {
         | 
| 173 | 
            -
              var {
         | 
| 174 | 
            -
                typed
         | 
| 175 | 
            -
              } = _ref2;
         | 
| 176 | 
            -
              return typed(name, roundNumberSignatures);
         | 
| 158 | 
            +
              });
         | 
| 177 159 | 
             
            });
         | 
| @@ -107,7 +107,7 @@ export var createGamma = /* #__PURE__ */factory(name, dependencies, _ref => { | |
| 107 107 | 
             
                var precision = config.precision + (Math.log(n.toNumber()) | 0);
         | 
| 108 108 |  | 
| 109 109 | 
             
                var Big = _BigNumber.clone({
         | 
| 110 | 
            -
                  precision | 
| 110 | 
            +
                  precision
         | 
| 111 111 | 
             
                });
         | 
| 112 112 |  | 
| 113 113 | 
             
                if (n % 2 === 1) {
         | 
| @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            import {  | 
| 1 | 
            +
            import { cbrt, expm1, isInteger, log10, log1p, log2, sign, toFixed } from '../../utils/number.js';
         | 
| 2 2 | 
             
            var n1 = 'number';
         | 
| 3 3 | 
             
            var n2 = 'number, number';
         | 
| 4 4 | 
             
            export function absNumber(a) {
         | 
| @@ -33,10 +33,6 @@ export function cbrtNumber(x) { | |
| 33 33 | 
             
              return cbrt(x);
         | 
| 34 34 | 
             
            }
         | 
| 35 35 | 
             
            cbrtNumber.signature = n1;
         | 
| 36 | 
            -
            export function ceilNumber(x) {
         | 
| 37 | 
            -
              return Math.ceil(x);
         | 
| 38 | 
            -
            }
         | 
| 39 | 
            -
            ceilNumber.signature = n1;
         | 
| 40 36 | 
             
            export function cubeNumber(x) {
         | 
| 41 37 | 
             
              return x * x * x;
         | 
| 42 38 | 
             
            }
         | 
| @@ -49,14 +45,6 @@ export function expm1Number(x) { | |
| 49 45 | 
             
              return expm1(x);
         | 
| 50 46 | 
             
            }
         | 
| 51 47 | 
             
            expm1Number.signature = n1;
         | 
| 52 | 
            -
            export function fixNumber(x) {
         | 
| 53 | 
            -
              return x > 0 ? Math.floor(x) : Math.ceil(x);
         | 
| 54 | 
            -
            }
         | 
| 55 | 
            -
            fixNumber.signature = n1;
         | 
| 56 | 
            -
            export function floorNumber(x) {
         | 
| 57 | 
            -
              return Math.floor(x);
         | 
| 58 | 
            -
            }
         | 
| 59 | 
            -
            floorNumber.signature = n1;
         | 
| 60 48 | 
             
            /**
         | 
| 61 49 | 
             
             * Calculate gcd for numbers
         | 
| 62 50 | 
             
             * @param {number} a
         | 
| @@ -182,11 +170,12 @@ modNumber.signature = n2; | |
| 182 170 | 
             
             * Calculate the nth root of a, solve x^root == a
         | 
| 183 171 | 
             
             * http://rosettacode.org/wiki/Nth_root#JavaScript
         | 
| 184 172 | 
             
             * @param {number} a
         | 
| 185 | 
            -
             * @param {number} root
         | 
| 173 | 
            +
             * @param {number} [2] root
         | 
| 186 174 | 
             
             * @private
         | 
| 187 175 | 
             
             */
         | 
| 188 176 |  | 
| 189 | 
            -
            export function nthRootNumber(a | 
| 177 | 
            +
            export function nthRootNumber(a) {
         | 
| 178 | 
            +
              var root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
         | 
| 190 179 | 
             
              var inv = root < 0;
         | 
| 191 180 |  | 
| 192 181 | 
             
              if (inv) {
         | 
| @@ -236,7 +225,6 @@ export function nthRootNumber(a, root) { | |
| 236 225 | 
             
               return inv ? 1 / x : x
         | 
| 237 226 | 
             
              */
         | 
| 238 227 | 
             
            }
         | 
| 239 | 
            -
            nthRootNumber.signature = n2;
         | 
| 240 228 | 
             
            export function signNumber(x) {
         | 
| 241 229 | 
             
              return sign(x);
         | 
| 242 230 | 
             
            }
         | 
| @@ -325,9 +313,13 @@ powNumber.signature = n2; | |
| 325 313 |  | 
| 326 314 | 
             
            export function roundNumber(value) {
         | 
| 327 315 | 
             
              var decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
         | 
| 316 | 
            +
             | 
| 317 | 
            +
              if (!isInteger(decimals) || decimals < 0 || decimals > 15) {
         | 
| 318 | 
            +
                throw new Error('Number of decimals in function round must be an integer from 0 to 15 inclusive');
         | 
| 319 | 
            +
              }
         | 
| 320 | 
            +
             | 
| 328 321 | 
             
              return parseFloat(toFixed(value, decimals));
         | 
| 329 322 | 
             
            }
         | 
| 330 | 
            -
            roundNumber.signature = n2;
         | 
| 331 323 | 
             
            /**
         | 
| 332 324 | 
             
             * Calculate the norm of a number, the absolute value.
         | 
| 333 325 | 
             
             * @param {number} x
         | 
| @@ -793,7 +793,7 @@ export var createDenseMatrixClass = /* #__PURE__ */factory(name, dependencies, _ | |
| 793 793 |  | 
| 794 794 |  | 
| 795 795 | 
             
                return new DenseMatrix({
         | 
| 796 | 
            -
                  data | 
| 796 | 
            +
                  data,
         | 
| 797 797 | 
             
                  size: [n],
         | 
| 798 798 | 
             
                  datatype: this._datatype
         | 
| 799 799 | 
             
                });
         | 
| @@ -918,7 +918,7 @@ export var createDenseMatrixClass = /* #__PURE__ */factory(name, dependencies, _ | |
| 918 918 |  | 
| 919 919 |  | 
| 920 920 | 
             
                return new DenseMatrix({
         | 
| 921 | 
            -
                  data | 
| 921 | 
            +
                  data,
         | 
| 922 922 | 
             
                  size: [rows, columns]
         | 
| 923 923 | 
             
                });
         | 
| 924 924 | 
             
              };
         | 
| @@ -39,8 +39,8 @@ export var createFibonacciHeapClass = /* #__PURE__ */factory(name, dependencies, | |
| 39 39 | 
             
              FibonacciHeap.prototype.insert = function (key, value) {
         | 
| 40 40 | 
             
                // create node
         | 
| 41 41 | 
             
                var node = {
         | 
| 42 | 
            -
                  key | 
| 43 | 
            -
                  value | 
| 42 | 
            +
                  key,
         | 
| 43 | 
            +
                  value,
         | 
| 44 44 | 
             
                  degree: 0
         | 
| 45 45 | 
             
                }; // check we have a node in the minimum
         | 
| 46 46 |  | 
| @@ -350,10 +350,10 @@ export var createSparseMatrixClass = /* #__PURE__ */factory(name, dependencies, | |
| 350 350 | 
             
                ptr.push(index.length); // return matrix
         | 
| 351 351 |  | 
| 352 352 | 
             
                return new SparseMatrix({
         | 
| 353 | 
            -
                  values | 
| 354 | 
            -
                  index | 
| 355 | 
            -
                  ptr | 
| 356 | 
            -
                  size | 
| 353 | 
            +
                  values,
         | 
| 354 | 
            +
                  index,
         | 
| 355 | 
            +
                  ptr,
         | 
| 356 | 
            +
                  size,
         | 
| 357 357 | 
             
                  datatype: matrix._datatype
         | 
| 358 358 | 
             
                });
         | 
| 359 359 | 
             
              }
         | 
| @@ -1004,9 +1004,9 @@ export var createSparseMatrixClass = /* #__PURE__ */factory(name, dependencies, | |
| 1004 1004 | 
             
                ptr.push(values.length); // return sparse matrix
         | 
| 1005 1005 |  | 
| 1006 1006 | 
             
                return new SparseMatrix({
         | 
| 1007 | 
            -
                  values | 
| 1008 | 
            -
                  index | 
| 1009 | 
            -
                  ptr | 
| 1007 | 
            +
                  values,
         | 
| 1008 | 
            +
                  index,
         | 
| 1009 | 
            +
                  ptr,
         | 
| 1010 1010 | 
             
                  size: [maxRow - minRow + 1, maxColumn - minColumn + 1]
         | 
| 1011 1011 | 
             
                });
         | 
| 1012 1012 | 
             
              }
         | 
| @@ -1273,9 +1273,9 @@ export var createSparseMatrixClass = /* #__PURE__ */factory(name, dependencies, | |
| 1273 1273 | 
             
                ptr.push(values.length); // return matrix
         | 
| 1274 1274 |  | 
| 1275 1275 | 
             
                return new SparseMatrix({
         | 
| 1276 | 
            -
                  values | 
| 1277 | 
            -
                  index | 
| 1278 | 
            -
                  ptr | 
| 1276 | 
            +
                  values,
         | 
| 1277 | 
            +
                  index,
         | 
| 1278 | 
            +
                  ptr,
         | 
| 1279 1279 | 
             
                  size: [n, 1]
         | 
| 1280 1280 | 
             
                });
         | 
| 1281 1281 | 
             
              };
         | 
| @@ -1432,9 +1432,9 @@ export var createSparseMatrixClass = /* #__PURE__ */factory(name, dependencies, | |
| 1432 1432 | 
             
                ptr.push(values.length); // create SparseMatrix
         | 
| 1433 1433 |  | 
| 1434 1434 | 
             
                return new SparseMatrix({
         | 
| 1435 | 
            -
                  values | 
| 1436 | 
            -
                  index | 
| 1437 | 
            -
                  ptr | 
| 1435 | 
            +
                  values,
         | 
| 1436 | 
            +
                  index,
         | 
| 1437 | 
            +
                  ptr,
         | 
| 1438 1438 | 
             
                  size: [rows, columns]
         | 
| 1439 1439 | 
             
                });
         | 
| 1440 1440 | 
             
              };
         | 
| @@ -11,6 +11,9 @@ export var createSparse = /* #__PURE__ */factory(name, dependencies, _ref => { | |
| 11 11 | 
             
               * Create a Sparse Matrix. The function creates a new `math.Matrix` object from
         | 
| 12 12 | 
             
               * an `Array`. A Matrix has utility functions to manipulate the data in the
         | 
| 13 13 | 
             
               * matrix, like getting the size and getting or setting values in the matrix.
         | 
| 14 | 
            +
               * Note that a Sparse Matrix is always 2-dimensional, so for example if
         | 
| 15 | 
            +
               * you create one from a plain array of _n_ numbers, you get an _n_ by 1
         | 
| 16 | 
            +
               * Sparse "column vector".
         | 
| 14 17 | 
             
               *
         | 
| 15 18 | 
             
               * Syntax:
         | 
| 16 19 | 
             
               *
         | 
| @@ -25,6 +28,9 @@ export var createSparse = /* #__PURE__ */factory(name, dependencies, _ref => { | |
| 25 28 | 
             
               *    m.resize([3, 2], 5)
         | 
| 26 29 | 
             
               *    m.valueOf()                     // Array [[1, 2], [3, 4], [5, 5]]
         | 
| 27 30 | 
             
               *    m.get([1, 0])                    // number 3
         | 
| 31 | 
            +
               *    let v = math.sparse([0, 0, 1])
         | 
| 32 | 
            +
               *    v.size()                        // Array [3, 1]
         | 
| 33 | 
            +
               *    v.get([2, 0])                   // number 1
         | 
| 28 34 | 
             
               *
         | 
| 29 35 | 
             
               * See also:
         | 
| 30 36 | 
             
               *
         | 
| @@ -361,7 +361,7 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref => | |
| 361 361 | 
             
                  unit.units.push({
         | 
| 362 362 | 
             
                    unit: res.unit,
         | 
| 363 363 | 
             
                    prefix: res.prefix,
         | 
| 364 | 
            -
                    power | 
| 364 | 
            +
                    power
         | 
| 365 365 | 
             
                  });
         | 
| 366 366 |  | 
| 367 367 | 
             
                  for (var i = 0; i < BASE_DIMENSIONS.length; i++) {
         | 
| @@ -3879,11 +3879,11 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref => | |
| 3879 3879 | 
             
                  newBaseUnit.key = baseName;
         | 
| 3880 3880 | 
             
                  BASE_UNITS[baseName] = newBaseUnit;
         | 
| 3881 3881 | 
             
                  newUnit = {
         | 
| 3882 | 
            -
                    name | 
| 3882 | 
            +
                    name,
         | 
| 3883 3883 | 
             
                    value: 1,
         | 
| 3884 3884 | 
             
                    dimensions: BASE_UNITS[baseName].dimensions.slice(0),
         | 
| 3885 | 
            -
                    prefixes | 
| 3886 | 
            -
                    offset | 
| 3885 | 
            +
                    prefixes,
         | 
| 3886 | 
            +
                    offset,
         | 
| 3887 3887 | 
             
                    base: BASE_UNITS[baseName]
         | 
| 3888 3888 | 
             
                  };
         | 
| 3889 3889 | 
             
                  currentUnitSystem[baseName] = {
         | 
| @@ -3892,11 +3892,11 @@ export var createUnitClass = /* #__PURE__ */factory(name, dependencies, _ref => | |
| 3892 3892 | 
             
                  };
         | 
| 3893 3893 | 
             
                } else {
         | 
| 3894 3894 | 
             
                  newUnit = {
         | 
| 3895 | 
            -
                    name | 
| 3895 | 
            +
                    name,
         | 
| 3896 3896 | 
             
                    value: defUnit.value,
         | 
| 3897 3897 | 
             
                    dimensions: defUnit.dimensions.slice(0),
         | 
| 3898 | 
            -
                    prefixes | 
| 3899 | 
            -
                    offset | 
| 3898 | 
            +
                    prefixes,
         | 
| 3899 | 
            +
                    offset
         | 
| 3900 3900 | 
             
                  }; // Create a new base if no matching base exists
         | 
| 3901 3901 |  | 
| 3902 3902 | 
             
                  var anyMatch = false;
         | 
    
        package/lib/esm/utils/number.js
    CHANGED
    
    
    
        package/lib/esm/utils/object.js
    CHANGED
    
    
    
        package/lib/esm/version.js
    CHANGED
    
    | @@ -1,2 +1,2 @@ | |
| 1 | 
            -
            export var version = '10.5. | 
| 1 | 
            +
            export var version = '10.5.1'; // 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.5. | 
| 3 | 
            +
              "version": "10.5.1",
         | 
| 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",
         | 
| @@ -26,6 +26,7 @@ | |
| 26 26 | 
             
              ],
         | 
| 27 27 | 
             
              "dependencies": {
         | 
| 28 28 | 
             
                "@babel/runtime": "^7.17.9",
         | 
| 29 | 
            +
                "@types/mocha": "^9.1.1",
         | 
| 29 30 | 
             
                "complex.js": "^2.1.1",
         | 
| 30 31 | 
             
                "decimal.js": "^10.3.1",
         | 
| 31 32 | 
             
                "escape-latex": "^1.2.0",
         | 
| @@ -42,6 +43,8 @@ | |
| 42 43 | 
             
                "@babel/preset-env": "7.16.11",
         | 
| 43 44 | 
             
                "@babel/register": "7.17.7",
         | 
| 44 45 | 
             
                "@types/assert": "^1.5.6",
         | 
| 46 | 
            +
                "@typescript-eslint/eslint-plugin": "^5.20.0",
         | 
| 47 | 
            +
                "@typescript-eslint/parser": "^5.20.0",
         | 
| 45 48 | 
             
                "assert": "2.0.0",
         | 
| 46 49 | 
             
                "babel-loader": "8.2.4",
         | 
| 47 50 | 
             
                "benchmark": "2.1.4",
         | 
| @@ -49,6 +52,14 @@ | |
| 49 52 | 
             
                "core-js": "3.22.0",
         | 
| 50 53 | 
             
                "del": "6.0.0",
         | 
| 51 54 | 
             
                "dtslint": "4.2.1",
         | 
| 55 | 
            +
                "eslint": "^8.13.0",
         | 
| 56 | 
            +
                "eslint-config-prettier": "^8.5.0",
         | 
| 57 | 
            +
                "eslint-config-standard": "^17.0.0",
         | 
| 58 | 
            +
                "eslint-plugin-import": "^2.26.0",
         | 
| 59 | 
            +
                "eslint-plugin-mocha": "^10.0.4",
         | 
| 60 | 
            +
                "eslint-plugin-n": "^15.1.0",
         | 
| 61 | 
            +
                "eslint-plugin-prettier": "^4.0.0",
         | 
| 62 | 
            +
                "eslint-plugin-promise": "^6.0.0",
         | 
| 52 63 | 
             
                "expect-type": "^0.13.0",
         | 
| 53 64 | 
             
                "expr-eval": "2.0.2",
         | 
| 54 65 | 
             
                "fancy-log": "2.0.0",
         | 
| @@ -75,8 +86,8 @@ | |
| 75 86 | 
             
                "numericjs": "1.2.6",
         | 
| 76 87 | 
             
                "nyc": "15.1.0",
         | 
| 77 88 | 
             
                "pad-right": "0.2.2",
         | 
| 89 | 
            +
                "prettier": "^2.6.2",
         | 
| 78 90 | 
             
                "process": "0.11.10",
         | 
| 79 | 
            -
                "standard": "16.0.4",
         | 
| 80 91 | 
             
                "sylvester": "0.0.21",
         | 
| 81 92 | 
             
                "ts-node": "10.7.0",
         | 
| 82 93 | 
             
                "typescript": "4.6.3",
         | 
| @@ -135,7 +146,7 @@ | |
| 135 146 | 
             
                "build:docs": "gulp --gulpfile gulpfile.cjs docs",
         | 
| 136 147 | 
             
                "compile": "gulp --gulpfile gulpfile.cjs compile",
         | 
| 137 148 | 
             
                "watch": "gulp --gulpfile gulpfile.cjs watch",
         | 
| 138 | 
            -
                "lint": " | 
| 149 | 
            +
                "lint": "eslint --cache --max-warnings 0 src/ test/ types/",
         | 
| 139 150 | 
             
                "format": "npm run lint -- --fix",
         | 
| 140 151 | 
             
                "validate:ascii": "gulp --gulpfile gulpfile.cjs validate:ascii",
         | 
| 141 152 | 
             
                "test": "npm run test:src && npm run lint",
         |