GitHub Viewer
# History
# 2020-10-10, version 7.5.1
- Fix object pollution vulnerability in `math.config`. Thanks Snyk.
# 2020-10-07, version 7.5.0
- Function `pickRandom` now allows randomly picking elements from matrices
with 2 or more dimensions instead of only from a vector, see #1974.
Thanks @KonradLinkowski.
# 2020-10-07, version 7.4.0
- Implemented support for passing a precision in functions `ceil`, `floor`,
and `fix`, similar to `round`, see #1967, #1901. Thanks @rnd-debug.
- Implemented function `rotationMatrix`, see #1160, #1984. Thanks @rnd-debug.
- Implement a clear error message when using `sqrtm` with a matrix having
more than two dimensions. Thanks @KonradLinkowski.
- Update dependency `decimal.js` to `10.2.1`.
# 2020-09-26, version 7.3.0
- Implemented functions `usolveAll` and `lsolveAll`, see #1916. Thanks @m93a.
- Implemented support for units in functions `std` and `variance`, see #1950.
Thanks @rnd-debug.
- Implemented support for binary, octal, and hexadecimal notation in the
expression parser, and implemented functions `bin`, `oct`, and `hex` for
formatting. Thanks @clnhlzmn.
- Fix #1964: inconsistent calculation of negative dividend modulo for
`BigNumber` and `Fraction`. Thanks @ovk.
# 2020-08-24, version 7.2.0
- Implemented new function `diff`, see #1634, #1920. Thanks @Veeloxfire.
- Implemented support for norm 2 for matrices in function `norm`.
Thanks @rnd-debug.
# 2020-07-13, version 7.1.0
- Implement support for recursion (self-referencing) of typed-functions,
new in `typed-function@2.0.0`. This fixes #1885: functions which where
extended with a new data type did not always work. Thanks @nickewing.
- Fix #1899: documentation on expression trees still using old namespace
`math.expression.node.*` instead of `math.*`.
# 2020-06-24, version 7.0.2
- Fix #1882: have `DenseMatrix.resize` and `SparseMatrix.resize` accept
`DenseMatrix` and `SparseMatrix` as inputs too, not only `Array`.
- Fix functions `sum`, `prod`, `min`, and `max` not throwing a conversion error
when passing a single string, like `sum("abc")`.
# 2020-05-30, version 7.0.1
- Fix #1844: clarify the documentation of function `eigs`. Thanks @Lazersmoke.
- Fix #1855: Fix error in the documentation for `math.nthRoots(x)`.
- Fix #1856: make the library robust against Object prototype pollution.
# 2020-05-07, version 7.0.0
Breaking changes:
- Improvements in calculation of the `dot` product of complex values.
The first argument is now conjugated. See #1761. Thanks @m93a.
- Dropped official support for Node.js v8 which has reached end of life.
- Removed all deprecation warnings introduced in v6.
To upgrade smoothly from v5 to v7 or higher, upgrade to v6 first
and resolve all deprecation warnings.
# 2020-05-04, version 6.6.5
- Fix #1834: value `Infinity` cannot be serialized and deserialized.
This is solved now with a new `math.replacer` function used as
`JSON.stringify(value, math.replacer)`.
- Fix #1842: value `Infinity` not turned into the latex symbol `\\infty`.
# 2020-04-15, version 6.6.4
- Fix published files containing Windows line endings (CRLF instead of LF).
# 2020-04-10, version 6.6.3
- Fix #1813: bug in engineering notation for numbers of function `format`,
sometimes resulting in needless trailing zeros.
- Fix #1808: methods `.toNumber()` and `.toNumeric()` not working on a
unitless unit.
- Fix #1645: not being able to use named operators `mod`, `and`, `not`, `or`,
`xor`, `to`, `in` as object keys. Thanks @Veeloxfire.
- Fix `eigs` not using `config.epsilon`.
# 2020-03-29, version 6.6.2
- Fix #1789: Function `eigs` not calculating with BigNumber precision
when input contains BigNumbers.
- Run the build script during npm `prepare`, so you can use the library
directly when installing directly from git. See #1751. Thanks @cinderblock.
# 2020-02-26, version 6.6.1
- Fix #1725: simplify `a/(b/c)`. Thanks @dbramwell.
- Fix examples in documentation of `row` and `column`.
# 2020-02-01, version 6.6.0
- Implemented function `eigs`, see #1705, #542 #1175. Thanks @arkajitmandal.
- Fixed #1727: validate matrix size when creating a `DenseMatrix` using
`fromJSON`.
- Fixed `DenseMatrix.map` copying the size and datatype from the original
matrix instead of checking the returned dimensions and type of the callback.
- Add a caret to dependencies (like) `^1.2.3`) to allow downstream updates
without having to await a new release of mathjs.
# 2020-01-08, version 6.5.0
- Implemented `baseName` option for `createUnit`, see #1707.
Thanks @ericman314.
# 2020-01-06, version 6.4.0
- Extended function `dimension` with support for n-dimensional points.
Thanks @Veeloxfire.
# 2019-12-31, version 6.3.0
- Improved performance of `factorial` for `BigNumber` up to a factor two,
see #1687. Thanks @kmdrGroch.
# 2019-11-20, version 6.2.5
- Fixed `IndexNode` using a hardcoded, one-based implementation of `index`,
making it impossible to instantiate a zero-based version of the expression
parser. See #782.
# 2019-11-20, version 6.2.4
- Fixed #1669: function 'qr' threw an error if the pivot was zero,
thanks @kevinkelleher12 and @harrysarson.
- Resolves #942: remove misleading assert in 'qr'. Thanks @harrysarson.
- Work around a bug in complex.js where `sign(0)` returns complex NaN.
Thanks @harrysarson.
# 2019-10-06, version 6.2.3
- Fixed #1640: function `mean` not working for units. Thanks @clintonc.
- Fixed #1639: function `min` listed twice in the "See also" section of the
embedded docs of function `std`.
- Improved performance of `isPrime`, see #1641. Thanks @arguiot.
# 2019-09-23, version 6.2.2
- Fixed methods `map` and `clone` not copying the `dotNotation` property of
`IndexNode`. Thanks @rianmcguire.
- Fixed a typo in the documentation of `toHTML`. Thanks @maytanthegeek.
- Fixed #1615: error in the docs of `isNumeric`.
- Fixed #1628: Cannot call methods on empty strings or numbers with value `0`.
# 2019-08-31, version 6.2.1
- Fixed #1606: function `format` not working for expressions.
# 2019-08-28, version 6.2.0
- Improved performance of `combinationsWithRep`. Thanks @waseemyusuf.
- Add unit aliases `bit` and `byte`.
- Fix docs referring to `bit` and `byte` instead of `bits` and `bytes`.
- Updated dependency `typed-function@1.1.1`.
# 2019-08-17, version 6.1.0
- Implemented function `combinationsWithRep` (see #1329). Thanks @waseemyusuf.
# 2019-08-05, version 6.0.4
- Fixed #1554, #1565: ES Modules where not transpiled to ES5, giving issues on
old browsers. Thanks @mockdeep for helping to find a solution.
# 2019-07-07, version 6.0.3
- Add `unpkg` and `jsdelivr` fields in package.json pointing to UMD build.
Thanks @tmcw.
- Fix #1550: nested user defined function not receiving variables of an
outer user defined function.
# 2019-06-11, version 6.0.2
- Fix not being able to set configuration after disabling function `import`
(regression since v6.0.0).
# 2019-06-09, version 6.0.1
- Fix function reference not published in npm library.
- Fix function `evaluate` and `parse` missing in generated docs.
# 2019-06-08, version 6.0.0
!!! BE CAREFUL: BREAKING CHANGES !!!
### Most notable changes
1. Full support for **ES modules**. Support for tree-shaking out of the box.
Load all functions:
```js
import * as math from 'mathjs'
```
Use a few functions:
```js
import { add, multiply } from 'mathjs'
```
Load all functions with custom configuration:
```js
import { create, all } from 'mathjs'
const config = { number: 'BigNumber' }
const math = create(all, config)
```
Load a few functions with custom configuration:
```js
import { create, addDependencies, multiplyDependencies } from 'mathjs'
const config = { number: 'BigNumber' }
const { add, multiply } = create({
addDependencies,
multiplyDependencies
}, config)
```
2. Support for **lightweight, number-only** implementations of all functions:
```
import { add, multiply } from 'mathjs/number'
```
3. New **dependency injection** solution used under the hood.
### Breaking changes
- Node 6 is no longer supported.
- Functions `config` and `import` are not available anymore in the global
context:
```js
// v5
import * as mathjs from 'mathjs'
mathjs.config(...) // error in v6.0.0
mathjs.import(...) // error in v6.0.0
```
Instead, create your own mathjs instance and pass config and imports
there:
```js
// v6
import { create, all } from 'mathjs'
const config = { number: 'BigNumber' }
const mathjs = create(all, config)
mathjs.import(...)
```
- Renamed function `typeof` to `typeOf`, `var` to `variance`,
and `eval` to `evaluate`. (the old function names are reserved keywords
which can not be used as a variable name).
- Deprecated the `Matrix.storage` function. Use `math.matrix` instead to create
a matrix.
- Deprecated function `math.expression.parse`, use `math.parse` instead.
Was used before for example to customize supported characters by replacing
`math.parse.isAlpha`.
- Moved all classes like `math.type.Unit` and `math.expression.Parser` to
`math.Unit` and `math.Parser` respectively.
- Fixed #1428: transform iterating over replaced nodes. New behavior
is that it stops iterating when a node is replaced.
- Dropped support for renaming factory functions when importing them.
- Dropped fake BigNumber support of function `erf`.
- Removed all index.js files used to load specific functions instead of all, like:
```
// v5
// ... set up empty instance of mathjs, then load a set of functions:
math.import(require('mathjs/lib/function/arithmetic'))
```
Individual functions are now loaded simply like:
```js
// v6
import { add, multiply } from 'mathjs'
```
To set a specific configuration on the functions:
```js
// v6
import { create, addDependencies, multiplyDependencies } from 'mathjs'
const config = { number: 'BigNumber' }
const math = create({ addDependencies, multiplyDependencies }, config)
```
See example `advanced/custom_loading.js`.
- Updated the values of all physical units to their latest official values.
See #1529. Thanks @ericman314.
### Non breaking changes
- Implemented units `t`, `tonne`, `bel`, `decibel`, `dB`, and prefixes
for `candela`. Thanks @mcvladthegoat.
- Fixed `epsilon` setting being applied globally to Complex numbers.
- Fix `math.simplify('add(2, 3)')` throwing an error.
- Fix #1530: number formatting first applied `lowerExp` and `upperExp`
and after that rounded the value instead of the other way around.
- Fix #1473: remove `'use strict'` in every file, not needed anymore.
# 2019-05-18, version 5.10.3
- Fixed dependency `del` being a dependency instead of devDependency.
# 2019-05-18, version 5.10.2
- Fix #1515, #1516, #1517: broken package due to a naming conflict in
the build folder of a util file `typeOf.js` and `typeof.js`.
Solved by properly cleaning all build folders before building.
# 2019-05-17, version 5.10.1
- Fix #1512: format using notation `engineering` can give wrong results
when the value has less significant digits than the number of digits in
the output.
# 2019-05-08, version 5.10.0
- Fix `lib/header.js` not having filled in date and version. Thanks @kevjin.
- Upgraded dependency `decimal.js@10.2.0`, fixing an issue on node.js 12.
# 2019-04-08, version 5.9.0
- Implemented functions `row` and `column` (see #1413). Thanks @SzechuanSage.
- Fixed #1459: `engineering` notation of function `format` not available
for `BigNumber`.
- Fixed #1465: `node.toHTML()` not correct for unary operators like
`factorial`.
# 2019-03-20, version 5.8.0
- Implemented new function `apply`. Thanks @bnlcas.
- Implemented passing an optional `dimension` argument to `std` and `var`.
Thanks @bnlcas.
# 2019-03-10, version 5.7.0
- Implemented support for `pow()` in `derivative`. Thanks @sam-19.
- Gracefully handle round-off errors in fix, ceil, floor, and range
(Fixes #1429, see also #1434, #1432). Thanks @ericman314.
# 2019-03-02, version 5.6.0
- Upgrade decimal.js to v10.1.1 (#1421).
- Fixed #1418: missing whitespace when stringifying an expression
containing "not".
# 2019-02-20, version 5.5.0
- Fixed #1401: methods `map` and `forEach` of `SparseMatrix` not working
correctly when indexes are unordered.
- Fixed #1404: inconsistent rounding of negative numbers.
- Upgrade tiny-emitter to v2.1.0 (#1397).
# 2019-01-25, version 5.4.2
- Fixed `math.format` not working for BigNumbers with a precision above
1025 digits (see #1385). Thanks @ericman314.
- Fixed incorrect LaTeX output of `RelationalNode`. Thanks @rianmcguire.
- Fixed a bug the methods `map`, `forEach`, `traverse`, and `transform`
of `FunctionNode`.
# 2019-01-10, version 5.4.1
- Fix #1378: negative bignumbers not formatted correctly.
- Upgrade fraction.js to version 4.0.12 (#1369).
# 2018-12-09, version 5.4.0
- Extended sum.js to accept a dimension input to calculate the sum over a
specific axis. Thanks @bnlcas.
- Fix #1328: objects can't be written multi-line. Thanks @GHolk.
- Remove side effects caused by `Unit.format` and `Unit.toString`,
making changes to the unit on execution. Thanks @ericman314.
# 2018-12-03, version 5.3.1
- Fixed #1336: Unit.toSI() returning units with prefix like `mm` instead
of `m`. Thanks @ericman314.
# 2018-11-29, version 5.3.0
- Implemented function `hasNumericValue`. Thanks @Sathish-kumar-Subramani.
- Fix #1326: non-ascii character in print.js.
- Fix #1337: `math.format` not working correctly with `{ precision: 0 }`.
Thanks @dkenul.
# 2018-10-30, version 5.2.3
- Fixed #1293: non-unicode characters in `escape-latex` giving issues in some
specific cases. Thanks @dangmai.
- Fixed incorrect LaTeX output of function `bitNot`, see #1299. Thanks @FSMaxB.
- Fixed #1304: function `pow` not supporting inputs `pow(Unit, BigNumber)`.
- Upgraded dependencies (`escape-latex@1.2.0`)
# 2018-10-23, version 5.2.2
- Fixed #1286: Fixed unit base recognition and formatting for
user-defined units. Thanks @ericman314.
# 2018-10-18, version 5.2.1
- Fixed unit `rod` being defined as `5.02921` instead of `5.0292`.
Thanks @ericman314.
- Upgraded dependencies (`fraction.js@4.0.10`)
- Upgraded devDependencies (`@babel/core@7.1.2`, `nyc@13.1.0`,
`webpack@4.21.0`).
# 2018-10-05, version 5.2.0
- Implemented support for chained conditionals like `10 < x