mathjs v6.0.0 Release Notes
Release Date: 2019-06-08 // almost 5 years ago-
!!! BE CAREFUL: BREAKING CHANGES !!!
Most notable changes
Full support for ES6 modules. Support for tree-shaking out of the box.
Load all functions:
import * as math from 'mathjs'
Use a few functions:
import { add, multiply } from 'mathjs'
Load all functions with custom configuration:
import { create, all } from 'mathjs' const config = { number: 'BigNumber' } const math = create(all, config)
Load a few functions with custom configuration:
import { create, addDependencies, multiplyDependencies } from 'mathjs' const config = { number: 'BigNumber' } const { add, multiply } = create({ addDependencies, multiplyDependencies }, config)
Support for lightweight, number-only implementations of all functions:
import { add, multiply } from 'mathjs/number'
New dependency injection solution used under the hood.
๐ฅ Breaking changes
๐ Node 6 is no longer supported.
Functions
config
andimport
are not available anymore in the global context:
// 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:
// v6 import { create, all } from 'mathjs' const config = { number: 'BigNumber' } const mathjs = create(all, config) mathjs.import(...)
- ๐ Renamed function
typeof
totypeOf
,var
tovariance
, andeval
toevaluate
. (the old function names are reserved keywords which can not be used as a variable name). - ๐ Deprecated the
Matrix.storage
function. Usemath.matrix
instead to create a matrix. - ๐ Deprecated function
math.expression.parse
, usemath.parse
instead. Was used before for example to customize supported characters by replacingmath.parse.isAlpha
. - ๐ Moved all classes like
math.type.Unit
andmath.expression.Parser
tomath.Unit
andmath.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:
// v6 import { add, multiply } from 'mathjs'
To set a specific configuration on the functions:
// 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 forcandela
. 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
andupperExp
and after that rounded the value instead of the other way around. - ๐ Fix #1473: remove
'use strict'
in every file, not needed anymore.