History #
20230315, 11.7.0 #
 Implement #2567: accept array as parameter for function
gcd
#2878). Thanks @jakubriegel.  Fix #2908: improvements in the docs and examples of functions
partitionSelect
,diff
,expm1
,round
,nthRoots
,sign
,rigthArithShift
,setIsSubset
,setSize
, and the docs about units. Thanks @tmtron.  Fix #2907: determinant of empty matrix should be 1.
 Refactor index.d.ts by writing function declarations using a generic, reducing a lot of repetition #2913). Thanks @brunoSnoww.
20230224, 11.6.0 #
 Implement broadcasting for the following functions and their corresponding
operator:
add
,dotDivide
,dotMultiply
,dotPow
,gcd
,lcm
,mod
,nthRoot
,subtract
,bitAnd
,bitOr
,bitXor
,leftShift
,rightArithShift
,rightLogShift
,and
,or
,xor
,compare
,compareText
,equal
,larger
,largerEq
,smaller
,smallerEq
,unequal
,atan2
andto
#2895, #2753). Thanks @dvd101x.  Implement support for nonpowerof2 fft #2900, #2577). Thanks @cyavictor88.
 Fix #2888: update type definitions of function
unit
to allow creating a unit from a fraction or complex number.  Fix #2892: an error in the examples of the embedded help of function
sort
.  Fix #2891: functions
column
androw
sometimes returning a scalar number.  Fix #2896: define the fourth argument of function
intersect
as optional in the TypeScript definitions. Thanks @wodndb.  Fix: quantileSeq not accepting a matrix as second argument
prob
(see #2902).  Fix broken examples in functions
to
,distance
,getMatrixDataType
,subset
, andmax
(see #2902).
20230131, 11.5.1 #
 Add type definitions for function
rotationMatrix
#2860). Thanks @brunoSnoww.  Add type signature for
lusolve(LUDecomposition, ...)
#2864). Thanks @evanmiller.  Fix #2873: the rocket_trajectory_optimization.html example being partly broken. Thanks @dvd101x.
 Fix #2871: coverage report broken #2877). Thanks @bornova.
 Fix #2883: update documentation for stat functions, describe missing syntax.
 Fix #2884: fix examples in the embedded docs of function
pow
and some other functions.  Fix type definition of function
complex
for one numeric input #2886), thanks @ariymarkowitz.  Fix type definitions of
map()
andforEach()
#2887), thanks @xiaohk.  Fix #2606: improve type definitions of
dotMultiply
,dotPow
anddotDivide
#2890). Thanks @brunoSnoww.
20221205, 11.5.0 #
 Improve
simplify
rule matches in noncommutative contexts #2841). Thanks @samueltlg.  Simplify: add rules and restructure tests for noncommutative contexts #2847). Thanks @samueltlg.
 Fix function
reshape
mutating the input in case of a matrix (see #2854).  Fix TypeScript types for
multiply()
withnumber[]
andnumber[][]
#2852). Thanks @hfhchan.
20221118, 11.4.0 #
 Implemented more wildcards to describe rules for
simplify
, making it easier for example to describe unary minus #1915). Thanks @thatcomputerguy0101.  Implemented functions
schur
,sylvester
, andlyap
#2646). Thanks @egidioln.  Implemented function
polynomialRoot
, and use it in a benchmark #2839). Thanks @gwhitney.  Fix #2825 partly: improve simplifying operations on constants in noncommutative contexts #2827). Thanks @samueltlg.
 Fix #2840: a bug in the docs and type definitions of
Node.traverse
andNode.forEach
, they do returnvoid
.
20221107, 11.3.3 #
 Fix #2830: Prevent inserting zero values when creating a
SparseMatrix
from aDenseMatrix
#2836). Thanks @AlexandreAlvesDB.  Fix #2835: a regression in the type definitions of
FunctionNode
, introduced inv11.3.2
. See #2733. Thanks @dsteve.
20221025, 11.3.2 #
 Add generics to remaining Node type definitions #2733). Thanks @mattvague.
 Allow unit prefixes for (absolute) temperatures
kelvin
,rankine
,celsius
, andfahrenheit
#2824). Thanks @jfeist
20221019, 11.3.1 #
 Fix #2809: code completion issues in some IDE’s #2812).
 Fix #2818: throw an error when a function assignment has duplicate parameter names #2819).
 Update
decimal.js
to version10.4.2
.
20221011, 11.3.0 #
 Allow creating new subclasses of
Node
in TypeScript #2772). Note that this disables being able to narrow MathNodes by using the.type
property. Use typeguards likeisOperatorNode(...)
instead (see #2810). Thanks @mattvague.  Fix #2793:
flatten()
cloning entries of array/Matrix #2799).  Fix #2627: TypeScript definitions of
pinv
missing #2804). Thanks @HanchaiN.  Update dependencies to
decimal.js@10.4.1
.
20220913, 11.2.1 #
 Fix doc generator being broken, not generating a function reference.
20220912, 11.2.0 #
 Implement function
isRelationalNode
#2731). Thanks @isaacbyr.  Added missing types
'largerEq'
and'or'
inOperatorNodeMap
in the TypeScript definitions. Thanks @ajinkyac03.  Fixed typos in min func type defs #2768). Thanks @mabdullahadeel.
 Improved the TypeScript definitions for
pickRandom
. Thanks @mattvague.  Fixed documentation of unit
min
which meansminutes
, notminim
#2773). Thanks @jasonhornsby.
20220823, 11.1.0 #
 Add Unit constructor from value and pure (valueless) Unit #2628). Thanks @costerwi
 Fix #2144:
examples/advanced/custom_loading.js
was broken.  Fix JSON
replacer
function missing in the TypeScript definitions. Thanks @mattvague.  Update dependencies to
typedfunction@4.1.0
anddecimal.js@10.4.0
.
20220725, version 11.0.1 #
 Fix #2632: TypeScript issue of
simplifyConstant
andsimplifyCore
not having a return type defined.
20220723, version 11.0.0 #
!!! BE CAREFUL: BREAKING CHANGES !!!
Breaking changes:
 Dropped official support for IE11.
 Upgraded to
typedfunction@3
, see josdejong/typedfunction/HISTORY.md. Thanks @gwhitney. Most importantly: Conversions now have preference over
any
.  The
this
variable is no longer bound to the typed function itself.  The properties
typed.types
,typed.conversions
, andtyped.ignore
have been removed.  There are new static functions available like
typed.referTo
,typed.referToSelf
,typed.addTypes
,typed.addConversions
.
 Conversions now have preference over
 Implement amended “Rule 2” for implicit multiplication #2370, #2460):
when having a division followed by an implicit multiplication, the division
gets higher precedence over the implicit multiplication when (a) the
numerator is a constant with optionally a prefix operator (

,+
,~
), and (b) the denominator is a constant. For example: formerly1 / 2 x
was interpreted as1 / (2 * x)
and now it is interpreted as(1 / 2) * x
. Thanks @gwhitney.  Drop elementwise matrix support for trigonometric functions, exp, log, gamma,
square, sqrt, cube, and cbrt to prevent confusion with standard matrix
functions #2440, #2465). Instead, use
math.map(matrix, fn)
. Thanks @gwhitney.  Simplify: convert equivalent function calls into operators, for example,
add(2, x)
will now be simplified into2 + x
#2415, #2466). Thanks @gwhitney.  Removed the automatic conversion from
number
tostring
#2482). Thanks @gwhitney.  Fix #2412: let function
diff
return an empty matrix when the input contains only one element #2422).  Internal refactoring in the
simplifyCore
logic #2490, #2484, #2459). The functionsimplifyCore
will no longer (partially) merge constants, that behavior has been moved tosimplifyConstant
. The combination ofsimplifyConstant
andsimplifyCore
is still close to the old behavior ofsimplifyCore
, but there are some differences. To reproduce the same behavior as the oldsimplifyCore
, you can usemath.simplify(expr, [math.simplifyCore, math.simplifyConstant])
. Thanks to the refactoring,simplify
is more thorough in reducing constants. Thanks @gwhitney.  Disable support for splitting rest parameters in chained calculations
#2485, #2474). For example:
math.chain(3).max(4, 2).done()
will now throw an error rather than return4
, because the rest parameter ofmath.max(...number)
has been split between the contents of the chain and the arguments to the max call. Thanks @gwhitney.  Function
typeOf
now returnsfunction
(lowercase) for a function instead ofFunction
#2560). Thanks @gwhitney.
Nonbreaking changes:
 Fix #2600: improve the TypeScript definitions of
simplify
. Thanks @laureenm and @mattvague.  Fix #2607: improve type definition of
createUnit
. Thanks @egziko.  Fix #2608: clarify the docs on the need to configure a smaller
epsilon
when using BigNumbers.  Fix #2613: describe matrix methods
get
andset
in the docs.  Fix link to
math.rationalize
in the docs #2616). Thanks @nukisman.  Fix #2621: add TypeScript definitions for
count
#2622). Thanks @Hansuku.  Improved TypeScript definitions of
multiply
#2623). Thanks @Windrill.
20220628, version 10.6.4 #
 Improve TypeScript definitions of the
factory
function, thanks @mattvague.
20220624, version 10.6.3 #
 Revert the TypeScript definition fixes for
factory
applied inv10.6.2
, they give some complications.
20220624, version 10.6.2 #
 Improve TypeScript definitions of
ParenthesisNode
. Thanks @mattvague.  Change the TypeScript definition of
MathNodeCommon['type']
into a less strict string, so it is possible to extend with new Node classes. Thanks @mattvague.  Improve TypeScript definitions of the
factory
function, thanks @mattvague.
20220531, version 10.6.1 #
 Improve the TypeScript types For
OperatorNode
: you can now define generic types likeOperatorNode<'+', 'add'>
. Thanks @mattvague.
20220524, version 10.6.0 #
 Implementation of fourier transform functions
fft
andifft
#2540). Thanks @HanchaiN.  Fix TypeScript types not being listed in the exported fields #2569). Thanks @mattvague.
 Large improvements in TypeScript definitions for chained expressions #2537). Thanks @mattvague.
 Fix #2571: improve TypeScript definition of functions
clone
andcloneDeep
#2572). Thanks @mattvague.  Fix the first argument of
derivative
holding the expression not correctly being converted when using.toTex()
#2564). Thanks @mattvague.
20220511, version 10.5.3 #
 Fix #2337: npm package containing examples and docs to solve security vulnerabilities being reported on the examples and their dependencies.
 Fix core, construction, and some other functions missing in docs.
 Drop official support for Node.js 12 which has reached its end of life.
20220509, version 10.5.2 #
 Fix #2553:
@types/mocha
defined independencies
instead ofdevDependencies
, causing problems in projects that use a different version of this dependency. Thanks @Kolahzary.  Fix #2550: remove
examples/node_modules
folder from the npm package.  Fix #2528: improve contribution guidelines #2548).
 Document
SymbolNode.onUndefinedSymbol
andFunctionNode.onUndefinedFunction
.
20220502, version 10.5.1 #
 Fix #2526, #2529: improve TypeScript definitions of function
round
,fix
,floor
,ceil
, andnthRoot
, and improved the number only implementations of those functions #2531, #2539). Thanks @simlaticak and @gwhitney.  Fix #2532: matrix index symbol
end
not working when used inside a subexpression.  Fix #2524: In generating AUTHORS list, ignore a list of specific commits (e.g., to avoid spurious duplicates in list). #2543)
 Add type definitions of function
resolve
#2536). Thanks @mattvague.
20220419, version 10.5.0 #
 Implement #1563: function
pinv
, Moore–Penrose inverse #2521). Thanks @HanchaiN.  Optimize function
det
for integers by switching to the Bareiss algorithm: no more roundoff errors for integer input #2516). Thanks @HanchaiN.  Implement #2463: allow negative integer powers of invertible square matrices #2517). Thanks @HanchaiN.
 Implement the
lgamma
function (defined as log(gamma(z))) for number and Complex types. Supersedes #320. #2417). Thanks @yifanwww.  Fix #2523: update to the latest complex.js to improve
sin(z)
for smallim(z)
#2525). Thanks @gwhitney.  Fix #2526: update TypeScript definition of
ceil
#2531). Thanks @simlaticak  Change mocha reporter to ‘dot’ to avoid excessively long log files. #2520)
20220408, version 10.4.3 #
 Fix #2508: improve the precision of stirlingS2 #2509). Thanks @gwhitney.
 Fix #2514: implement optional argument
base
in the number implementation of functionlog
#2515). Thanks @gwhitney.  Improve the documentation on operator
;
#2512). Thanks @gwhitney.
20220329, version 10.4.2 #
 Fix #2499: different behavior for unit conversion “degC” and “K” #2501). Also disables getting the sign for units with an offset, which is ambiguous. Thanks @gwhitney.
 Fix #2503: fix an issue in
log()
for complex numbers in which the imaginary part is much larger in absolute value than the real part, fixed incomplex.js@2.1.0
#2505), thanks @gwhitney, @infusion.  Fix #2493: unclear error message when an entity that is not a function is being called as a function #2494). Thanks @gwhitney.
 Some fixes in the docs on units #2498). Thanks @dvd101x.
 Add
forEach
example in embedded docs #2507). Thanks @dvd101x.  Correct approx.deepEqual() to accept an epsilon argument giving the comparison tolerance. It was already being called this way, but was silently ignoring the tolerance. Thanks @yifanwww.
20220323, version 10.4.1 #
 Improve TypeScript definitions for function
unit
#2479). Thanks @SinanAkkoyun.  Add tests for type declarations #2448). Thanks @samestep.
 Further improvement to TypeScript definitions of
std
andvariance
(make dimension parameter optional, #2474). Thanks @NattapongSiri.  Next step (as per #2431) for full publication of “is” functions like
isMatrix
etc: Provide TypeScript definitions of “is” functions and make them type guards. #2432). Thanks @ChristopherChudzicki.  Fix #2491: Multi line object expressions don’t work with comments #2492). Thanks @gwhitney.
 Fix #2478: a bug in calculating the eigenvectors when dealing with complex numbers #2496). Thanks @gwhitney.
 Update project dependencies and devDependencies.
20220307, version 10.4.0 #
 Fix #2461: make sure
simplifyCore
recurses over all binary nodes #2462). Thanks @gwhitney.  Fix #2429: fix the TypeScript definitions of functions
std
andvariance
#2455). Thanks @NattapongSiri.  Fix #1633: implement a
cumsum
function generating cumulative sums of a list of values or a matrix. #1870). Thanks @hjonasson.  Upgrade to the latest version of
Fraction.js
, having more strict input, only accepting an integer numerator and denominator. See #2427.  Fix typo in documentation example for
format
. #2468) Thanks @abranhe.  Write unit tests for all jsdoc examples. See #2452. Thanks @gwhitney.
20210302, version 10.3.0 #
 Fix #1260: implement function
symbolicEqual
#2424). Thanks @gwhitney.  Fix #2441, #2442: support passing a function as argument to functions created in the expression parser #2443). Thanks @gwhitney.
 Fix #2325: improve documentation of subset indices #2446). Thanks @gwhitney.
 Fix #2439: fix a bug in
complexEigs
in which realvalued norms were inadvertently being typed as complex numbers #2445). Thanks @gwhitney.  Fix #2436: improve documentation and error message of function
map
#2457). Thanks @gwhitney.
20220301, version 10.2.0 #
 Implemented context options to control simplifications allowed in
simplify
, see #2399, #2391. Thanks @gwhitney.  Implemented function
leafCount
as a first simple measure of the complexity of an expression, see #2411, #2389. Thanks @gwhitney.  Fix #2413: improve
combinations
to return an integer result without rounding errors for larger values, see #2414. Thanks @gwhitney.  Fix #2385: function
rotate
missing in TypeScript definitions. Thanks @DIVYA19.  Fix #2450: Add BigNumber to parameter type in
math.unit
and add TypeScript types forUnit.simplify
andUnit.units
#2353). Thanks @joshhansen.  Fix #2383: detect infinite loops in
simplify
#2405). Thanks @gwhitney.  Fix #1423: collect like factors and cancel like terms in sums #2388). Thanks @gwhitney.
20220202, version 10.1.1 #
 Improvements and fixes in function
simplify
, thanks @gwhitney: Fix #2393: regression bug in
simplify('2(x+1)')
.  Ad option
consoleDebug
tosimplify
to see what is going on.
 Fix #2393: regression bug in
 Fix TypeScript definition of
ConfigOptions
, which was missing optionpredictable
.
20220115, version 10.1.0 #
 Implemented function
invmod
, see #2368, #1744. Thanks @thetazero.  Improvements and fixes in function
simplify
, thanks @gwhitney:  Fix #2379: add embedded documentation for function
print
.  Remove broken example from the embedded documentation of function
forEach
.
20211229, version 10.0.2 #
 Fix #2156: simplify expressions like
1 / (x)
to1/x
. Thanks @ony3000.  Fix #2363: remove a redundant part of the regex to split a number.
 Fix #2291: add support for fractions in function
intersect
. Thanks @thetazero.  Fix #2358: bug in
SparseMatrix
when replacing a subset of a matrix with a nonconsecutive index. Thanks @Al0.
20211222, version 10.0.1 #
 Fix #1681: function
gamma
giving inaccurate complex results in some cases. Thanks @kmdrGroch.  Fixed a typo in an example, see #2366. Thanks @blackwindforce.
20211103, version 10.0.0 #
!!! BE CAREFUL: BREAKING CHANGES IN THE TYPESCRIPT DEFINITIONS !!!

Improvements to the Typescript typings (commit fc5c202e). Thanks @joshhansen. First introduced in v9.5.1, but reverted because it contains breaking changes.
Breaking changes: interface
MathNode
is now renamed toMathNodeCommon
and the related interfaces are structured in a different way. 
Fixed a typo in the TypeScript definition of toHTML. Thanks @TheToto.
20211103, version 9.5.2` #
 Revert the improvements to the Typescript typings because they contain breaking changes. The improvements will be published in v10.0.0. See #2339.
20211013, version 9.5.1 #
 Various improvements to the Typescript typings. Thanks @joshhansen and @DianaTdr.
20210922, version 9.5.0 #
 Implemented support for calculations with percentage, see #2303. Thanks @rvramesh.
 Fix #2319: make the API of
Parser.evaluate
consistent withmath.evaluate
: support a list with expressions as input.  Improved documentation of function
setCartesian
. Thanks @fieldfoxWim.
20210915, version 9.4.5 #
 Improved the performance of
Node.equals
by improving the internal functiondeepStrictEqual
. Thanks @tomlarkworthy.  Fixes in the TypeScript definitions:
 Define
hasNumericValue
. Thanks @write2kcl.  Define
MathNode.isRelationalNode
. Thanks @m93a.  Fix typo in
MathNode.isConditionalNode
. Thanks @m93a.
 Define
20210707, version 9.4.4 #
 Fixed
ArrayNode.toTex()
: remove the row delimiter on the last row, see #2267. Thanks @davidtranhq.  Fix #2269:
intersect
not returningnull
for matrix input. Thanks @m93a.  Fix #2245: mathjs not working in IE11 anymore due to a missing polyfill for
Symbol
. The browser bundle now includes the necessary polyfills (it is larger now because of that, see also #2266). Thanks @m93a.  Update dependencies (
complex.js@2.0.15
,decimal.js@10.3.1
)  Drop official support for node.js 10, which has reached end of life. See #2258.
20210623, version 9.4.3 #
 Fix #2222: mathjs polluting the
Decimal
prototype. Thanks @m93a.  Fix #2253: expression parser throwing an error when accessing nested object
properties named
e
.  Fixes in the TypeScript definitions:
 function
floor
, #2159, #2246. Thanks @write2kcl.  function
simplify
, see #2252. Thanks @nitroin.
 function
 Upgraded to
decimal.js@10.3.0
20210605, version 9.4.2 #
 Implemented iterative eigenvalue finder for
eigs
, making it much more robust. See #2179, #2237. Thanks @m93a.  Improved TypeScript definitions of function
parse
. Thanks @OpportunityLiu.
20210524, version 9.4.1 #
 Fix #2100: add TypeScript declaration for
eigs
. Thanks @andrebianchessi.  Fix #2220: add TypeScript files to published npm package. Thanks @dhritzkiv.
 Update readme regarding TypeScript definition files. Thanks @dhritzkiv.
 Update to
fraction.js@4.1.1
20210516, version 9.4.0 #
 Implemented support to use objects with a
Map
interface as scope, see #2143, #2166. Thanks @jhugman.  Extend
eigs
to support general complex matrices, see #1741. Thanks @m93a.  DenseMatrix and SparseMatrix are now iterable, see #1184. Thanks @m93a.
 Implemented utility functions
matrixFromRows
,matrixFromColumns
, andmatrixFromFunction
, see #2155, #2153. Thanks @m93a.  Added TypeScript definitions to the project, making it redundant to install
@types/mathjs
, and making it easier to improve the definitions. See #2187, #2192. Thanks @CatsMiaow.  Upgraded dependencies
 Fix #2174: function
pickRandom
having no name. Thanks @HKSHAO.  Fix #2019: VSCode auto import keeps adding import { null } from ‘mathjs’.
 Fix #2185: Fix TypeScript definition of unit division, which can also return a number.
 Fix #2123: add type definitions for functions
row
andcolumn
.  Fix some files not exposed in the package, see #2213. Thanks @javiermarinros.
20210412, version 9.3.2 #
 Fix #2169: mathjs requesting
@babel/runtime
dependency. Regression introduced inv9.3.1
.
20210410, version 9.3.1 #
 Fix #2133: strongly improved the performance of
isPrime
, see #2139. Thanks @Yaffle.  Fix #2150: give a clear error “Error: Undefined function …” instead when evaluating a nonexisting function.
 Fix #660: expose internal functions
FunctionNode.onUndefinedFunction(name)
andSymbolNode.onUndefinedSymbol(name)
, allowing to override the behavior. By default, an Error is thrown.
20210310, version 9.3.0 #
 Implemented support for parsing non decimal numbers with radix point, see #2122, #2121. Thanks @clnhlzmn.
 Fix #2128: typo in docs of
luSolveAll
andusolveAll
.
20210203, version 9.2.0 #
 Implemented function
count
to count the total elements in a matrix, see #2085. Thanks @Josef37.  Fix #2096: cleanup old reference to external dependency
crypto
.  Some refactoring in the code to remove duplications, see #2093. Thanks @Josef37.
20210127, version 9.1.0 #
 Extended function
reshape
with support for a wildcard1
to automatically calculate the remaining size, likereshape([1, 2, 3, 4, 5, 6], [1, 2])
which will output[[0, 1], [2, 3], [4, 5]]
. See #2075. Thanks @Josef37.  Fix #2087: function
simplify
ignores second argument oflog
, for example insimplify('log(e, 9)')
. Thanks @quentintruong.
20210116, version 9.0.0 #
 Improved support for bin, hex, and oct literals. See #1996. Thanks @clnhlzmn.
 Breaking change: parse literals with prefixes
0b
,0c
, and0x
are
now unsigned by default. To parse them as signed, you have to specify a suffix specifying the word size such asi16
ori32
.  Function
format
now supports more notations:bin
, ‘hex’, andoct
, for exampleformat(255, {notation: "hex"})
.  The functions
format
,bin
,hex
,oct
now allow specifying a wordSize, likebin(10, 32)
andformat(10, {notation: "bin", wordSize: 32})
.  BigNumber support for the bin, hex, and oct literals.
 Breaking change: parse literals with prefixes
 Extended and improved the example rocket_trajectory_optimization.html. Thanks @Josef37.
20201230, version 8.1.1 #
 Improved the performance of parsing and evaluating units a lot, see #2065. Thanks @flaviut.
 Upgraded dependency
fraction.js
tov4.0.13
.  Moved continuous integration testing from Travis CI to Github Workflow, see #2024, #2041. Thanks @harrysarson.
20201204, version 8.1.0 #
 Implemented units
kilogramforce
(kgf
). Thanks @rnddebug.  Fix #2026: Implement a new option
fractionsLimit
for functionsimplify
, defaulting toInfinity
.  Improved the documentation of function
clone
. Thanks @redbar0n.
20201109, version 8.0.1 #
 Fix #1979: missing “subset” dependency when using “mathjs/number” entry point.
 Fix #2022: update pretty printing with MathJax example to the latest version of MathJax. Thanks @pkra.
20201106, version 8.0.0 #
!!! BE CAREFUL: BREAKING CHANGES !!!
 You can now use mathjs directly in node.js using ES modules without need for
a transpiler (see #1928, #1941, #1962).
Automatically loading either commonjs code or ES modules code is improved.
All generated code is moved under
/lib
: the browser bundle is moved from/dist
to/lib/browser
, ES module files are moved to/lib/esm
, and commonjs files are moved to/lib/cjs
. Thanks @GreenImp.  Nonminified bundle
dist/math.js
is no longer provided. Either use the minified bundle, or create a bundle yourself.  Replaced random library
seedrandom
withseedrandom
, see #1955. Thanks @poppinlp.  Breaking changes in
pickRandom
, see #1990, #1976. Will no longer return the input matrix when the given number is greater than the length of the provided possibles. Instead, the function always returns results with the requested number of picks.
 Will now return a
Matrix
as output when input was aMatrix
. 
Introduced a new syntax:
math.pickRandom(array, { weights, number, elementWise })
 Introduced a new option
elementWise
, which istrue
by default. When settingelementWise
to false, an array containing arrays will return random pick of arrays instead of the elements inside of the nested arrays.
20201102, version 7.6.0 #
 Implemented function
rotate(w, theta)
. See #1992, #1160. Thanks @rnddebug.  Implemented support for custom characters in Units via
Unit.isValidAlpha
. See #1663, #2000. Thanks @rnddebug.
20201010, version 7.5.1 #
 Fix object pollution vulnerability in
math.config
. Thanks Snyk.
20201007, 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.
20201007, version 7.4.0 #
 Implemented support for passing a precision in functions
ceil
,floor
, andfix
, similar toround
, see #1967, #1901. Thanks @rnddebug.  Implemented function
rotationMatrix
, see #1160, #1984. Thanks @rnddebug.  Implement a clear error message when using
sqrtm
with a matrix having more than two dimensions. Thanks @KonradLinkowski.  Update dependency
decimal.js
to10.2.1
.
20200926, version 7.3.0 #
 Implemented functions
usolveAll
andlsolveAll
, see #1916. Thanks @m93a.  Implemented support for units in functions
std
andvariance
, see #1950. Thanks @rnddebug.  Implemented support for binary, octal, and hexadecimal notation in the
expression parser, and implemented functions
bin
,oct
, andhex
for formatting. Thanks @clnhlzmn.  Fix #1964: inconsistent calculation of negative dividend modulo for
BigNumber
andFraction
. Thanks @ovk.
20200824, version 7.2.0 #
 Implemented new function
diff
, see #1634, #1920. Thanks @Veeloxfire.  Implemented support for norm 2 for matrices in function
norm
. Thanks @rnddebug.
20200713, version 7.1.0 #
 Implement support for recursion (selfreferencing) of typedfunctions,
new in
typedfunction@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 ofmath.*
.
20200624, version 7.0.2 #
 Fix #1882: have
DenseMatrix.resize
andSparseMatrix.resize
acceptDenseMatrix
andSparseMatrix
as inputs too, not onlyArray
.  Fix functions
sum
,prod
,min
, andmax
not throwing a conversion error when passing a single string, likesum("abc")
.
20200530, 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.
20200507, 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.
20200504, version 6.6.5 #
 Fix #1834: value
Infinity
cannot be serialized and deserialized. This is solved now with a newmath.replacer
function used asJSON.stringify(value, math.replacer)
.  Fix #1842: value
Infinity
not turned into the latex symbol\\infty
.
20200415, version 6.6.4 #
 Fix published files containing Windows line endings (CRLF instead of LF).
20200410, 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 usingconfig.epsilon
.
20200329, 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.
20200226, version 6.6.1 #
 Fix #1725: simplify
a/(b/c)
. Thanks @dbramwell.  Fix examples in documentation of
row
andcolumn
.
20200201, version 6.6.0 #
 Implemented function
eigs
, see #1705, #542 #1175. Thanks @arkajitmandal.  Fixed #1727: validate matrix size when creating a
DenseMatrix
usingfromJSON
.  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.
20200108, version 6.5.0 #
 Implemented
baseName
option forcreateUnit
, see #1707. Thanks @ericman314.
20200106, version 6.4.0 #
 Extended function
dimension
with support for ndimensional points. Thanks @Veeloxfire.
20191231, version 6.3.0 #
 Improved performance of
factorial
forBigNumber
up to a factor two, see #1687. Thanks @kmdrGroch.
20191120, version 6.2.5 #
 Fixed
IndexNode
using a hardcoded, onebased implementation ofindex
, making it impossible to instantiate a zerobased version of the expression parser. See #782.
20191120, 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.
20191006, 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 functionstd
.  Improved performance of
isPrime
, see #1641. Thanks @arguiot.
20190923, version 6.2.2 #
 Fixed methods
map
andclone
not copying thedotNotation
property ofIndexNode
. 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
.
20190831, version 6.2.1 #
 Fixed #1606: function
format
not working for expressions.
20190828, version 6.2.0 #
 Improved performance of
combinationsWithRep
. Thanks @waseemyusuf.  Add unit aliases
bit
andbyte
.  Fix docs referring to
bit
andbyte
instead ofbits
andbytes
.  Updated dependency
typedfunction@1.1.1
.
20190817, version 6.1.0 #
 Implemented function
combinationsWithRep
(see #1329). Thanks @waseemyusuf.
20190805, 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.
20190707, version 6.0.3 #
 Add
unpkg
andjsdelivr
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.
20190611, version 6.0.2 #
 Fix not being able to set configuration after disabling function
import
(regression since v6.0.0).
20190609, version 6.0.1 #
 Fix function reference not published in npm library.
 Fix function
evaluate
andparse
missing in generated docs.
20190608, version 6.0.0 #
!!! BE CAREFUL: BREAKING CHANGES !!!
Most notable changes #

Full support for ES modules. Support for treeshaking 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, numberonly 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.
20190518, version 5.10.3 #
 Fixed dependency
del
being a dependency instead of devDependency.
20190518, 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
andtypeof.js
. Solved by properly cleaning all build folders before building.
20190517, 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.
20190508, 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.
20190408, version 5.9.0 #
 Implemented functions
row
andcolumn
(see #1413). Thanks @SzechuanSage.  Fixed #1459:
engineering
notation of functionformat
not available forBigNumber
.  Fixed #1465:
node.toHTML()
not correct for unary operators likefactorial
.
20190320, version 5.8.0 #
 Implemented new function
apply
. Thanks @bnlcas.  Implemented passing an optional
dimension
argument tostd
andvar
. Thanks @bnlcas.
20190310, version 5.7.0 #
 Implemented support for
pow()
inderivative
. Thanks @sam19.  Gracefully handle roundoff errors in fix, ceil, floor, and range (Fixes #1429, see also #1434, #1432). Thanks @ericman314.
20190302, version 5.6.0 #
 Upgrade decimal.js to v10.1.1 #1421).
 Fixed #1418: missing whitespace when stringifying an expression containing “not”.
20190220, version 5.5.0 #
 Fixed #1401: methods
map
andforEach
ofSparseMatrix
not working correctly when indexes are unordered.  Fixed #1404: inconsistent rounding of negative numbers.
 Upgrade tinyemitter to v2.1.0 #1397).
20190125, 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
, andtransform
ofFunctionNode
.
20190110, version 5.4.1 #
 Fix #1378: negative bignumbers not formatted correctly.
 Upgrade fraction.js to version 4.0.12 #1369).
20181209, 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 multiline. Thanks @GHolk.
 Remove side effects caused by
Unit.format
andUnit.toString
, making changes to the unit on execution. Thanks @ericman314.
20181203, version 5.3.1 #
 Fixed #1336: Unit.toSI() returning units with prefix like
mm
instead ofm
. Thanks @ericman314.
20181129, version 5.3.0 #
 Implemented function
hasNumericValue
. Thanks @SathishkumarSubramani.  Fix #1326: nonascii character in print.js.
 Fix #1337:
math.format
not working correctly with{ precision: 0 }
. Thanks @dkenul.
20181030, version 5.2.3 #
 Fixed #1293: nonunicode characters in
escapelatex
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 inputspow(Unit, BigNumber)
.  Upgraded dependencies (
escapelatex@1.2.0
)
20181023, version 5.2.2 #
 Fixed #1286: Fixed unit base recognition and formatting for userdefined units. Thanks @ericman314.
20181018, version 5.2.1 #
 Fixed unit
rod
being defined as5.02921
instead of5.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
).
20181005, version 5.2.0 #
 Implemented support for chained conditionals like
10 < x <= 50
. Thanks @ericman314.  Add an example showing a proof of concept of using
BigInt
in mathjs.  Fixed #1269: Bugfix for BigNumber divided by unit. Thanks @ericman314.
 Fixed #1240: allow units having just a value and no unit. Thanks @ericman314.
20180909, version 5.1.2 #
 Fixed a typo in the docs of
parse
. Thanks @mathiasvr.  Fixed #1222: a typo in the docs of
subset
.  Fixed #1236:
quantileSeq
has inconsistent return.  Fixed #1237: norm sometimes returning a complex number instead of number.
 Upgraded dependencies (
fraction.js@4.0.9
)  Upgraded devDependencies (
babel@7
,karmawebpack@3.0.4
,nyc@13.0.1
,standard@12.0.0
,uglifyjs@3.4.9
,webpack@4.17.2
)
20180821, version 5.1.1 #
 Function
isNumeric
now recognizes more types.  Fixed #1214: functions
sqrt
,max
,min
,var
,std
,mode
,mad
,median
, andpartitionSelect
not neatly handlingNaN
inputs. In some cases (median
,mad
, andpartitionSelect
) this resulted in an infinite loop.  Upgraded dependencies (
escapelatex@1.1.1
)  Upgraded devDependencies (
webpack@4.17.0
)
20180812, version 5.1.0 #
 Implemented support for strings enclosed in single quotes. Thanks @jeanemmanuel.
 Implemented function
getMatrixDataType
. Thanks @JasonShin.  Implemented new
options
argument insimplify
. Thanks @paulobuchsbaum.  Bug fixes in
rationalize
, see #1173. Thanks @paulobuchsbaum.
20180722, version 5.0.4 #
 Strongly improved the performance of functions
factorial
for numbers. This improves performance of functionsgamma
,permutation
, andcombination
too. See #1170. Thanks @honeybar.  Strongly improved the performance of function
reshape
, thanks to a friend of @honeybar.
20180714, version 5.0.3 #
 Fixed many functions (for example
add
andsubtract
) not working with matrices having adatatype
defined.  Fixed #1147: bug in
format
withengineering
notation in outputting the correct number of significant figures. Thanks @ericman314.  Fixed #1162: transform functions not being cleaned up when overriding it by importing a factory function with the same name.
 Fixed broken links in the documentation. Thanks @stropitek.
 Refactored the code of
parse
into a functional approach. Thanks @harrysarson.  Changed
decimal.js
import to ES6. Thanks @weinshel.
20180707, version 5.0.2 #
 Fixed #1136: rocket trajectory example broken (since v4.0.0).
 Fixed #1137:
simplify
unnecessarily replacing implicit multiplication with explicit multiplication.  Fixed #1146:
rationalize
throwing exceptions for some input with decimals. Thanks @maruta.  Fixed #1088: function arguments not being passed to
rawArgs
functions.  Fixed advanced example
add_new_datatypes
.  Fixed mathjs core constants not working without complex numbers. Thanks @ChristopherChudzicki.
 Fixed a broken link in the documentation on units. Thanks @stropitek.
 Upgraded dependencies (
typedfunction@1.0.4
,complex.js@2.0.11
).  Upgraded devDependencies (
babelloader@7.1.5
,uglifyjs@3.4.3
,expreval@1.2.2
,webpack@4.15.1
).
20180701, version 5.0.1 #
 Improved error messaging when converting units. Thanks @gap777.
 Upgraded devDependencies (
kerma
,uglifyjs
,webpack
).
20180616, version 5.0.0 #
!!! BE CAREFUL: BREAKING CHANGES !!!
 Implemented complex conjugate transpose
math.ctranspose
. See #1097. Thanks @jackschmidt.  Changed the behavior of
A'
(transpose) in the expression parser to calculate the complex conjugate transpose. See #1097. Thanks @jackschmidt.  Added support for
complex({abs: 1, arg: 1})
, and improved the docs on complex numbers. Thanks @ssaket.  Renamed
eye
toidentity
, see #1054.  Math.js code can now contain ES6. The ES6 source code is moved from
lib
tosrc
, andlib
now contains the compiled ES5 code.  Upgraded dependencies:
decimal.js
from9.0.1
to10.0.1
 Upgraded dev dependencies
 Changed code style to https://standardjs.com/, run linter on
npm test
. See #1110.  Dropped support for bower. Use npm or an other package manages instead.
 Dropped support for (nonprimitive) instances of
Number
,Boolean
, andString
from functionsclone
andtypeof
.  Dropped official support for IE9 (probably still works, but it’s not tested).
 Fixed #851: More consistent behavior of sqrt, nthRoot, and pow. Thanks @dakotablair.
 Fixed #1103: Calling
toTex
on node that containsderivative
causing an exception. Thanks @joelhoover.
20180602, version 4.4.2 #
 Drastically improved the performance of
det
. Thanks @ericman314.  Fixed #1065, #1121: Fixed wrong documentation of function
compareNatural
and clarified the behavior for strings.  Fixed #1122 a regression in function
inv
(sincev4.4.1
). Thanks @ericman314.
20180529, version 4.4.1 #
 Fixed #1109: a bug in
inv
when dealing with values close to zero. Thanks @ericman314.
20180528, version 4.4.0 #
 Implemented functions
equalText
andcompareText
. See #1085.
20180521, version 4.3.0 #
 Implemented matrix exponential
math.expm
. Thanks @ericman314.  Fixed #1101: math.js bundle not working when loading in a WebWorker.
 Upgraded dependencies
complex.js
fromv2.0.2
tov2.0.10
.fraction.js
fromv4.0.4
tov4.0.8
.
 Upgraded devDependencies (
mocha
,uglifyjs
,webpack
).
20180505, version 4.2.2 #
 Fixed calculating the Frobenius norm of complex matrices correctly, see #1098. Thanks @jackschmidt.
 Fixed #1076: cannot use mathjs in React VR by updating to
escapelatex@1.0.3
.
20180502, version 4.2.1 #
 Fixed
dist/math.js
being minified.
20180502, version 4.2.0 #
 Implemented function
math.sqrtm
. Thanks @ferrolho.  Implemented functions
math.log2
,math.log1p
, andmath.expm1
. Thanks @BigFav and @harrysarson.  Fixed some unit tests broken on nodejs v10.
 Upgraded development dependencies.
 Dropped integration testing on nodejs v4.
20180418, version 4.1.2 #
 Fixed #1082: implemented support for unit plurals
decades
,centuries
, andmillennia
.  Fixed #1083: units
decade
andwatt
having a wrong name when stringifying. Thanks @ericman314.
20180411, version 4.1.1 #
 Fixed #1063: derivative not working when resolving a variable with unary
minus like
math.derivative('x', 'x')
.
20180408, version 4.1.0 #
 Extended function
math.print
with support for arrays and matrices. Thanks @jeanemmanuel.  Fixed #1077: Serialization/deserialization to JSON with reviver not being supported by nodes.
 Fixed #1016: Extended
math.typeof
with support forResultSet
and nodes likeSymbolNode
.  Fixed #1072: Added support for long and short prefixes for the unit
bar
(i.e.millibar
andmbar
).
20180317, version 4.0.1 #
 Fixed #1062: mathjs not working on ES5 browsers like IE11 and Safari 9.3.
 Fixed #1061:
math.unit
not accepting input like1/s
.
20180225, version 4.0.0 #
!!! BE CAREFUL: BREAKING CHANGES !!!
Breaking changes (see also #682):

New expression compiler
The compiler of the expression parser is replaced with one that doesn’t use
eval
internally. See #1019. This means: a slightly improved performance on most browsers.
 less risk of security exploits.
 the code of the new compiler is easier to understand, maintain, and debug.
Breaking change here: When using custom nodes in the expression parser, the syntax of
_compile
has changed. This is an undocumented feature though. 
Parsed expressions

The class
ConstantNode
is changed such that it just holds a value instead of holding a stringified value and it’s type.ConstantNode(valueStr, valueType
) is nowConstantNode(value)
Stringification usesmath.format
, which may result in differently formatted numeric output. 
The constants
true
,false
,null
,undefined
,NaN
,Infinity
, anduninitialized
are now parsed as ConstantNodes instead of SymbolNodes in the expression parser. See #833.


Implicit multiplication

Changed the behavior of implicit multiplication to have higher precedence than explicit multiplication and division, except in a number of specific cases. This gives a more natural behavior for implicit multiplications. For example
24h / 6h
now returns4
, whilst1/2 kg
evaluates to0.5 kg
. Thanks @ericman314. See: #792. Detailed documentation: https://github.com/josdejong/mathjs/blob/v4/docs/expressions/syntax.md#implicitmultiplication. 
Immediately invoking a function returned by a function like
partialAdd(2)(3)
is no longer supported, instead these expressions are evaluated as an implicit multiplicationpartialAdd(2) * (3)
. See #1035.


String formatting
 In function
math.format
, the options{exponential: {lower: number, upper: number}}
(wherelower
andupper
are values) are replaced with{lowerExp: number, upperExp: number}
(wherelowerExp
andupperExp
are exponents). See #676. For example:math.format(2000, {exponential: {lower: 1e2, upper: 1e2}})
is now:
math.format(2000, {lowerExp: 2, upperExp: 2})
 In function
math.format
, the optionnotation: 'fixed'
no longer rounds to zero digits when no precision is specified: it leaves the digits as is. See #676.
 In function

String comparison
Changed the behavior of relational functions (
compare
,equal
,equalScalar
,larger
,largerEq
,smaller
,smallerEq
,unequal
) to compare strings by their numeric value they contain instead of alphabetically. This also impacts functionsdeepEqual
,sort
,min
,max
,median
, andpartitionSelect
. UsecompareNatural
if you need to sort an array with text. See #680. 
Angle units
Changed
rad
,deg
, andgrad
to have short prefixes, and introducedradian
,degree
, andgradian
and their plurals having long prefixes. See #749. 
Null

null
is no longer implicitly casted to a number0
, so input likemath.add(2, null)
is no longer supported. See #830, #353. 
Dropped constant
uninitialized
, which was used to initialize leave new entries undefined when resizing a matrix is removed. Useundefined
instead to indicate entries that are not explicitly set. See #833.


New typedfunction library
 The
typedfunction
library used to check the input types of functions is completely rewritten and doesn’t useeval
under the hood anymore. This means a reduced security risk, and easier to debug code. The API is the same, but error messages may differ a bit. Performance is comparable but may differ in specific use cases and browsers.
 The
Non breaking changes:
 Thanks to the new expression compiler and
typedfunction
implementation, mathjs doesn’t use JavaScript’seval
anymore under the hood. This allows using mathjs in environments with security restrictions. See #401.  Implemented additional methods
isUnary()
andisBinary()
onOperatorNode
. See #1025.  Improved error messages for statistical functions.
 Upgraded devDependencies.
 Fixed #1014:
derivative
silently dropping additional arguments from operator nodes with more than two arguments.
20180207, version 3.20.2 #
 Upgraded to
typedfunction@0.10.7
(bugfix release).  Fixed option
implicit
not being copied from anOperatorNode
when applying functionmap
. Thanks @HarrySarson.  Fixed #995: spaces and underscores not property being escaped
in
toTex()
. Thanks @FSMaxB.
20180117, version 3.20.1 #
 Fixed #1018:
simplifyCore
failing in some cases with parentheses. Thanks @firepick1.
20180114, version 3.20.0 #
 Implement support for 3 or more arguments for operators
+
and*
inderivative
. Thanks @HarrySarson. See #1002.  Fixed
simplify
evalution ofsimplify
of functions with more than two arguments wrongly:simplify('f(x, y, z)') evaluated to
f(f(x, y), z)instead of
f(x, y, z)`. Thanks @joelhoover.  Fixed
simplify
throwing an error in some cases when simplifying unknown functions, for examplesimplify('f(4)')
. Thanks @joelhoover.  Fixed #1013:
simplify
wrongly simplifing some expressions containing unary minus, like0  x
. Thanks @joelhoover.  Fixed an error in an example in the documentation of
xor
. Thanks @denisx.
20180106, version 3.19.0 #
 Extended functions
distance
andintersect
with support for BigNumbers. Thanks @ovk.  Improvements in function
simplify
: added a rule that allows combining of like terms in embedded quantities. Thanks @joelhoover.
20171228, version 3.18.1 #
 Fixed #998: An issue with simplifying an expression containing a subtraction. Thanks @firepick1.
20171216, version 3.18.0 #
 Implemented function
rationalize
. Thanks @paulobuchsbaum.  Upgraded dependencies:
decimal.js 7.2.3 → 9.0.1 (no breaking changes affecting mathjs) fraction.js 4.0.2 → 4.0.4 tinyemitter 2.0.0 → 2.0.2
 Upgraded dev dependencies.
 Fixed #975: a wrong example in the docs of lusolve.
 Fixed #983:
pickRandom
returning an array instead of single value when input was an array with just one value. Clarified docs.  Fixed #969: preven issues with yarn autoclean by renaming an interally used folder “docs” to “embeddedDocs”.
20171118, version 3.17.0 #
 Improved
simplify
for nested exponentiations. Thanks @IvanVergiliev.  Fixed a security issue in
typedfunction
allowing arbitrary code execution in the JavaScript engine by creating a typed function with JavaScript code in the name. Thanks Masato Kinugawa.  Fixed a security issue where forbidden properties like constructor could be replaced by using unicode characters when creating an object. No known exploit, but could possibly allow arbitrary code execution. Thanks Masato Kinugawa.
20171018, version 3.16.5 #
 Fixed #954: Functions
add
andmultiply
not working when passing three or more arrays or matrices.
20171001, version 3.16.4 #
 Fixed #948, #949: function
simplify
returning wrong results or running into an infinite recursive loop. Thanks @ericman314.  Fixed many small issues in the embedded docs. Thanks @Schnark.
20170828, version 3.16.3 #
 Fixed #934: Wrong simplification of unary minus. Thanks @firepick1.
 Fixed #933: function
simplify
reordering operations. Thanks @firepick1.  Fixed #930: function
isNaN
returning wrong result for complex numbers having just one of their parts (re/im) beingNaN
.  Fixed #929:
FibonacciHeap.isEmpty
returning wrong result.
20170820, version 3.16.2 #
 Fixed #924: a regression in
simplify
not accepting the signaturesimplify(expr, rules, scope)
anymore. Thanks @firepick1.  Fixed missing parenthesis when stringifying expressions containing implicit multiplications (see #922). Thanks @FSMaxB.
20170812, version 3.16.1 #
 For security reasons, type checking is now done in a more strict
way using functions like
isComplex(x)
instead of duck type checking likex && x.isComplex === true
.  Fixed #915: No access to property “name”.
 Fixed #901: Simplify units when calling
unit.toNumeric()
. Thanks @AlexanderBeyn.  Fixed
toString
of a parsed expression tree containing an immediately invoked function assignment not being wrapped in parenthesis (for example(f(x) = x^2)(4)
).
20170806, version 3.16.0 #
 Significant performance improvements in
math.simplify
. Thanks @firepick1.  Improved API for
math.simplify
, optionally pass a scope with variables which are resolved, see #907. Thanks @firepick1.  Fixed #912: math.js didn’t work on IE10 anymore (regression since 3.15.0).
20170729, version 3.15.0 #
 Added support for the dollar character
$
in symbol names (see #895).  Allow objects with prototypes as scope again in the expression parser, this was disabled for security reasons some time ago. See #888, #899. Thanks @ThomasBrierley.
 Fixed #846: Issues in the functions
map
,forEach
, andfilter
when used in the expression parser: Not being able to use a function assignment as inline expression for the callback function.
 Not being able to pass an inline expression as callback for
map
andforEach
.  Index and original array/matrix not passed in
map
andfilter
.
20170705, version 3.14.2 #
 Upgraded to
fraction.js@4.0.2
 Fixed #891 using BigNumbers not working in browser environments.
20170630, version 3.14.1 #
 Reverted to
fraction.js@4.0.0
, there is an issue with4.0.1
in the browser.
20170630, version 3.14.0 #
 Implemented set methods
setCartesian
,setDifference
,setDistinct
,setIntersect
,setIsSubset
,setPowerset
,setSize
. Thanks @Nekomajin42.  Implemented method
toHTML
on nodes. Thanks @Nekomajin42.  Implemented
compareNatural
andsort([...], 'natural')
.  Upgraded dependencies to the latest versions:
complex.js@2.0.4
decimal.js@7.2.3
fraction.js@4.0.1
tinyemitter@2.0.0
 And all devDependencies.
 Fixed #865:
splitUnit
can now deal with roundoff errors. Thanks @ericman314.  Fixed #876: incorrect definition for unit
erg
. Thanks @pjhampton.  More informative error message when using single quotes instead of double quotes around a string. Thanks @HarrySarson.
20170527, version 3.13.3 #
 Fixed a bug in function
intersection
of line and plane. Thanks @viclai.  Fixed security vulnerabilities.
20170526, version 3.13.2 #
 Disabled function
chain
inside the expression parser for security reasons (it’s not needed there anyway).  Fixed #856: function
subset
not returning nonprimitive scalars from Arrays correctly. (likemath.eval('arr[1]', {arr: [math.bignumber(2)]})
.  Fixed #861: physical constants not available in the expression parser.
20170512, version 3.13.1 #
 Fixed creating units with an alias not working within the expression parser.
 Fixed security vulnerabilities. Thanks Sam.
20170512, version 3.13.0 #
 Command line application can now evaluate inline expressions
like
mathjs 1+2
. Thanks @slavaGanzin.  Function
derivative
now supportsabs
. Thanks @tetslee.  Function
simplify
now supports BigNumbers. Thanks @tetslee.  Prevent against endless loops in
simplify
. Thanks @tetslee.  Fixed #813: function
simplify
converting small numbers to inexact Fractions. Thanks @tetslee.  Fixed #838: Function
simplify
now supports constants likee
. Thanks @tetslee.
20170505, version 3.12.3 #
 Fixed security vulnerabilities. Thanks Dan and Sam.
20170430, version 3.12.2 #
 Added a rocket trajectory optimization example.
20170424, version 3.12.1 #
 Fixed #804
 Improved handling of powers of
Infinity
. Thanks @HarrySarson.  Fixed wrong formatting of complex NaN.
 Improved handling of powers of
 Fixed security vulnerabilities in the expression parser. Thanks Sam and Dan.
20170417, version 3.12.0 #
 Implemented QR decomposition, function
math.qr
. Thanks @HarrySarson.  Fixed #824: Calling
math.random()
freezes IE and node.js.
20170408, version 3.11.5 #
 More security measures in the expression parser.
WARNING: the behavior of the expression parser is now more strict,
some undocumented features may not work any longer.
 Accessing and assigning properties is now only allowed on plain objects, not on classes, arrays, and functions anymore.
 Accessing methods is restricted to a set of known, safe methods.
20170403, version 3.11.4 #
 Fixed a security vulnerability in the expression parser. Thanks @xfix.
20170403, version 3.11.3 #
 Fixed a security vulnerability in the expression parser. Thanks @xfix.
20170403, version 3.11.2 #
 Fixed a security vulnerability in the expression parser. Thanks @xfix.
20170402, version 3.11.1 #
 Fixed security vulnerabilities in the expression parser. Thanks Joe Vennix and @xfix.
20170402, version 3.11.0 #
 Implemented method Unit.toSI() to convert a unit to base SI units. Thanks @ericman314.
 Fixed #821, #822: security vulnerabilities in the expression parser. Thanks @comex and @xfix.
20170331, version 3.10.3 #
 More security fixes related to the ones fixed in
v3.10.2
.
20170331, version 3.10.2 #
 Fixed a security vulnerability in the expression parser allowing execution of arbitrary JavaScript. Thanks @CapacitorSet and @denvit.
20170326, version 3.10.1 #
 Fixed
xgcd
for negative values. Thanks @litmit.  Fixed #807: function transform of existing functions not being removed when overriding such a function.
20170305, version 3.10.0 #
 Implemented function
reshape
. Thanks @patgrasso and @ericman314.  Implemented configuration option
seedRandom
for deterministic random numbers. Thanks @morsecodist.  Small fixes in the docs. Thanks @HarrySarson.
 Dropped support for component package manager (which became deprecated about one and a half year ago).
20170222, version 3.9.3 #
 Fixed #797: issue with production builds of React Native projects.
 Fixed
math.round
not accepting inputsNaN
,Infinity
,Infinity
.  Upgraded all dependencies.
20170216, version 3.9.2 #
 Fixed #795: Parse error in case of a multiline expression with just comments.
20170206, version 3.9.1 #
 Fixed #789: Math.js not supporting conversion of
string
toBigNumber
,Fraction
, orComplex
number.  Fixed #790: Expression parser did not pass function arguments of enclosing
functions via
scope
to functions havingrawArgs = true
.  Small fixes in the docs. Thanks @HarrySarson.
20170123, version 3.9.0 #
 Implemented support for algebra: powerful new functions
simplify
andderivative
. Thanks @ericman314, @tetslee, and @BigFav.  Implemented Kronecker Product
kron
. Thanks @adamisntdead.  Reverted
FunctionNode
not accepting a string as function name anymore.  Fixed #765:
FunctionAssignmentNode.toString()
returning a string incompatible with the function assignment syntax.
20161215, version 3.8.1 #
 Implemented function
mad
(median absolute deviation). Thanks @ruhleder.  Fixed #762: expression parser failing to invoke a function returned by a function.
20161118, version 3.8.0 #
 Functions
add
andmultiply
now accept more than two arguments. See #739. OperatorNode
now supports more than two arguments. See #739. Thanks @FSMaxB. Implemented a method
Node.cloneDeep
for the expression nodes. See #745.  Fixed a bug in
Node.clone()
not cloning implicit multiplication correctly. Thanks @FSMaxB.  Fixed #737: Improved algorithm determining the best prefix for units.
It will now retain the original unit like
1 cm
when close enough, instead of returning10 mm
. Thanks @ericman314.  Fixed #732: Allow letterlike unicode characters like Ohm
\u2126
.  Fixed #749: Units
rad
,deg
, andgrad
can now have prefixes likemillirad
.  Some fixes in the docs and comments of examples. Thanks @HarrySarson.
20161105, version 3.7.0 #
 Implemented method
Node.equals(other)
for all nodes of the expression parser.  Implemented BigNumber support in function
arg()
.  Command Line Interface loads faster.
 Implicit conversions between Fractions and BigNumbers throw a neat error now (See #710).
20161021, version 3.6.0 #
 Implemented function
erf()
. THanks @patgrasso.  Extended function
cross()
to support nd vectors. Thanks @patgrasso.  Extended function
pickRandom
with the option to pick multiple values from an array and give the values weights:pickRandom(possibles, number, weights)
. Thanks @woylie.  Parser now exposes test functions like
isAlpha
which can be replaced in order to adjust the allowed characters in variables names (See #715).  Fixed #727: Parser not throwing an error for invalid implicit multiplications
like
2 2
and2^3 4
(right after the second value of an operator).  Fixed #688: Describe allowed variable names in the docs.
20160921, version 3.5.3 #
 Some more fixes regarding numbers ending with a decimal mark (like
2.
).
20160920, version 3.5.2 #
 Fixed numbers ending with a decimal mark (like
2.
) not being supported by the parser, solved the underlying ambiguity in the parser. See #707, #711.
20160912, version 3.5.1 #
 Removed a left over console.log statement. Thanks @eknkc.
20160907, version 3.5.0 #
 Comments of expressions are are now stored in the parsed nodes. See #690.
 Fixed function
print
not accepting an Object with formatting options as third parameter Thanks @ThomasBrierley.  Fixed #707: The expression parser no longer accepts numbers ending with a dot
like
2.
.
20160808, version 3.4.1 #
 Fixed broken bundle files (
dist/math.js
,dist/math.min.js
).  Fixed some layout issues in the function reference docs.
20160807, version 3.4.0 #
 Implemented support for custom units using
createUnit
. Thanks @ericman314.  Implemented function
splitUnits
. Thanks @ericman314.  Implemented function
isPrime
. Thanks @MathBunny.
20160705, version 3.3.0 #
 Implemented function
isNaN
.  Function
math.filter
now passes three arguments to the callback function: value, index, and array.  Removed the check on the number of arguments from functions defined in the expression parser (see #665).
 Fixed #665: functions
map
,forEach
, andfilter
now invoke callbacks which are a typedfunction with the correct number of arguments.
20160426, version 3.2.1 #
 Fixed #651: unable to perform calculations on “Unitless” units.
 Fixed matrix.subset mutating the replacement matrix when unsqueezing it.
20160416, version 3.2.0 #
 Implemented #644: method
Parser.getAll()
to retrieve all defined variables.  Upgraded dependencies (decimal.js@5.0.8, fraction.js@3.3.1, typedfunction@0.10.4).
 Fixed #601: Issue with unnamed typedfunctions by upgrading to typedfunction v0.10.4.
 Fixed #636: More strict
toTex
templates, reckon with number of arguments.  Fixed #641: Bug in expression parser parsing implicit multiplication with wrong precedence in specific cases.
 Fixed #645: Added documentation about
engineering
notation of functionmath.format
.
20160403, version 3.1.4 #
 Using ES6 Math functions like
Math.sinh
,Math.cbrt
,Math.sign
, etc when available.  Fixed #631: unit aliases
weeks
,months
, andyears
where missing.  Fixed #632: problem with escaped backslashes at the end of strings.
 Fixed #635:
Node.toString
options where not passed to function arguments.  Fixed #629: expression parser throws an error when passing a number with decimal exponent instead of parsing them as implicit multiplication.
 Fixed #484, #555: inaccuracy of
math.sinh
for values between 1 and 1.  Fixed #625: Unit
in
(inch
) not always working due to ambiguity with the operatora in b
(alias ofa to b
).
20160324, version 3.1.3 #
 Fix broken bundle.
20160324, version 3.1.2 #
 Fix broken npm release.
20160324, version 3.1.1 #
 Fixed #621: a bug in parsing implicit multiplications like
(2)(3)+4
.  Fixed #623:
nthRoot
of zero with a negative root returned0
instead ofInfinity
.  Throw an error when functions
min
,max
,mean
, ormedian
are invoked with multiple matrices as arguments (see #598).
20160319, version 3.1.0 #
 Hide multiplication operator by default when outputting
toTex
andtoString
for implicit multiplications. Implemented and option to output the operator.  Implemented unit
kip
and aliaskips
. Thanks @hgupta9.  Added support for prefixes for units
mol
andmole
. Thanks @stublair.  Restored support for implicit multiplications like
2(3+4)
and(2+3)(4+5)
.  Some improvements in the docs.
 Added automatic conversions from
boolean
andnull
toFraction
, and conversions fromFraction
toComplex
.
20160304, version 3.0.0 #
breaking changes #
 More restricted support for implicit multiplication in the expression
parser:
(...)(...)
is now evaluated as a function invocation, and[...][...]
as a matrix subset.  Matrix multiplication no longer squeezes scalar outputs to a scalar value, but leaves them as they are: a vector or matrix containing a single value. See #529.

Assignments in the expression parser now return the assigned value rather than the created or updated object (see #533). Example:
A = eye(3) A[1,1] = 2 # this assignment now returns 2 instead of A
 Expression parser now supports objects. This involves a refactoring and
extension in expression nodes:
 Implemented new node
ObjectNode
.  Refactored
AssignmentNode
,UpdateNode
, andIndexNode
are refactored intoAccessorNode
,AssignmentNode
, andIndexNode
having a different API.
 Implemented new node
 Upgraded the used BigNumber library
decimal.js
to v5. Replaced the trigonometric functions of math.js with those provided in decimal.js v5. This can give slightly different behavior qua roundoff errors.  Replaced the internal
Complex.js
class with thecomplex.js
library created by @infusion.  Entries in a matrix (typically numbers, BigNumbers, Units, etc) are now considered immutable, they are no longer copied when performing operations on the entries, improving performance.
 Implemented nearly equal comparison for relational functions (
equal
,larger
,smaller
, etc.) when using BigNumbers.  Changed the casing of the configuration options
matrix
(Array
orMatrix
) andnumber
(number
,BigNumber
,Fraction
) such that they now match the type returned bymath.typeof
. Wrong casing gives a console warning but will still work.  Changed the default config value for
epsilon
from1e14
to1e12
, see #561.
nonbreaking changes #
 Extended function
pow
to return the real root for cubic roots of negative numbers. See #525, #482, #567.  Implemented support for JSON objects in the expression parser and the
function
math.format
.  Function
math.fraction
now supportsBigNumber
, and functionmath.bignumber
now supportsFraction
.  Expression parser now allows function and/or variable assignments inside
accessors and conditionals, like
A[x=2]
ora > 2 ? b="ok" : b="fail"
.  Command line interface:
 Outputs the variable name of assignments.
 Fixed not rounding BigNumbers to 14 digits like numbers.
 Fixed nonworking autocompletion of user defined variables.
 Reorganized and extended docs, added docs on classes and more. Thanks @hgupta9.
 Added new units
acre
,hectare
,torr
,bar
,mmHg
,mmH2O
,cmH2O
, and added new aliasesacres
,hectares
,sqfeet
,sqyard
,sqmile
,sqmiles
,mmhg
,mmh2o
,cmh2o
. Thanks @hgupta9.  Fixed a bug in the toString method of an IndexNode.
 Fixed angle units
deg
,rad
,grad
,cycle
,arcsec
, andarcmin
not being defined as BigNumbers when configuring to use BigNumbers.
20160203, version 2.7.0 #
 Added more unit aliases for time:
secs
,mins
,hr
,hrs
. See #551.  Added support for doing operations with mixed
Fractions
andBigNumbers
.  Fixed #540:
math.intersect()
returning null in some cases. Thanks @void42.  Fixed #546: Cannot import BigNumber, Fraction, Matrix, Array. Thanks @brettjurgens.
20160108, version 2.6.0 #
 Implemented (complex) units
VA
andVAR
.  Implemented time units for weeks, months, years, decades, centuries, and millennia. Thanks @owenversteeg.
 Implemented new notation
engineering
in functionmath.format
. Thanks @johnmarinelli.  Fixed #523: In some circumstances, matrix subset returned a scalar instead of the correct subset.
 Fixed #536: A bug in an internal method used for sparse matrices.
20151205, version 2.5.0 #
 Implemented support for numeric types
Fraction
andBigNumber
in units.  Implemented new method
toNumeric
for units.  Implemented new units
arcsec
,arcsecond
,arcmin
,arcminute
. Thanks @devdevdata222.  Implemented new unit
Herts
(Hz
). Thanks @SwamWithTurtles.  Fixed #485: Scoping issue with variables both used globally as well as in a function definition.
 Fixed: Function
number
didn’t supportFraction
as input.
20151114, version 2.4.2 #
 Fixed #502: Issue with
format
in some JavaScript engines.  Fixed #503: Removed trailing commas and the use of keyword
import
as property, as this gives issues with old JavaScript engines.
20151029, version 2.4.1 #
 Fixed #480:
nthRoot
not working on Internet Explorer (up to IE11).  Fixed #490:
nthRoot
returning an error for negative values likenthRoot(2, 3)
.  Fixed #489: an issue with initializing a sparse matrix without data. Thanks @Retsam.
 Fixed: #493: function
combinations
did not throw an exception for noninteger values ofk
.  Fixed: function
import
did not override typed functions when the option override was set true.  Fixed: added functions
math.sparse
andmath.index
to the reference docs, they where missing.  Fixed: removed memoization from
gamma
andfactorial
functions, this could blow up memory.
20151009, version 2.4.0 #
 Added support in the expression parser for mathematical alphanumeric symbols in the expression parser: unicode range \u{1D400} to \u{1D7FF} excluding invalid code points.
 Extended function
distance
with more signatures. Thanks @kvkunalvyas.  Fixed a bug in functions
sin
andcos
, which gave wrong results for BigNumber integer values around multiples of tau (i.e.sin(bignumber(7))
).  Fixed value of unit
stone
. Thanks @Esvandiary for finding the error.
20150919, version 2.3.0 #
 Implemented function
distance
. Thanks @devanp92.  Implemented support for Fractions in function
lcm
. Thanks @infusion.  Implemented function
cbrt
for numbers, complex numbers, BigNumbers, Units.  Implemented function
hypot
.  Upgraded to fraction.js v3.0.0.
 Fixed #450: issue with non sorted index in sparse matrices.
 Fixed #463, #322: inconsistent handling of implicit multiplication.
 Fixed #444: factorial of infinity not returning infinity.
20150830, version 2.2.0 #
 Units with powers (like
m^2
ands^1
) now output with the best prefix.  Implemented support for units to
abs
,cube
,sign
,sqrt
,square
. Thanks @ericman314.  Implemented function
catalan
(Combinatorics). Thanks @devanp92.  Improved the
canDefineProperty
check to return false in case of IE8, which has a broken implementation ofdefineProperty
. Thanks @golmansax.  Fixed function
to
not working in case of a simplified unit.  Fixed #437: an issue with row swapping in
lup
, also affectinglusolve
.
20150812, version 2.1.1 #
 Fixed wrong values of the physical constants
speedOfLight
,molarMassC12
, andmagneticFluxQuantum
. Thanks @ericman314 for finding two of them.
20150811, version 2.1.0 #
 Implemented derived units (like
110 km/h in m/s
). Thanks @ericman314.  Implemented support for electric units. Thanks @ericman314.
 Implemented about 50 physical constants like
speedOfLight
,gravity
, etc.  Implemented function
kldivergence
(KullbackLeibler divergence). Thanks @saromanov.  Implemented function
mode
. Thanks @kvkunalvyas.  Added support for unicode characters in the expression parser: greek letters and latin letters with accents. See #265.
 Internal functions
Unit.parse
andComplex.parse
now throw an Error instead of returning null when passing invalid input.
20150729, version 2.0.1 #
 Fixed operations with mixed fractions and numbers be converted to numbers instead of fractions.
20150728, version 2.0.0 #
 Large internal refactoring:
 performance improvements.
 allows to create custom bundles
 functions are composed using
typedfunction
and are extensible
 Implemented support for fractions, powered by the library
fraction.js
.  Implemented matrix LU decomposition with partial pivoting and a LU based
linear equations solver (functions
lup
andlusolve
). Thanks @rjbaucells.  Implemented a new configuration option
predictable
, which can be set to true in order to ensure predictable function output types.  Implemented function
intersect
. Thanks @kvkunalvyas.  Implemented support for adding
toTex
properties to custom functions. Thanks @FSMaxB.  Implemented support for complex values to
nthRoot
. Thanks @gangachris.  Implemented util functions
isInteger
,isNegative
,isNumeric
,isPositive
, andisZero
.
breaking changes #
 String input is now converted to numbers by default for all functions.
 Adding two strings will no longer concatenate them, but will convert the strings to numbers and add them.
 Function
index
does no longer accept an array[start, end, step]
, but instead accepts an array with arbitrary index values. It also accepts aRange
object as input.  Function
typeof
no longer returns lower case names, but now returns lower case names for primitives (likenumber
,boolean
,string
), and uppercamelcase for nonprimitives (likeArray
,Complex
,Function
).  Function
import
no longer supports a module name as argument. Instead, modules can be loaded using require:math.import(require('modulename'))
.  Function
import
has a new optionsilent
to ignore errors, and throws errors on duplicates by default.  Method
Node.compile()
no longer needsmath
to be passed as argument.  Reintroduced method
Node.eval([scope])
.  Function
sum
now returns zero when input is an empty array. Thanks @FSMAxB.  The size of Arrays is no longer validated. Matrices will validate this on creation.
20150712, version 1.7.1 #
 Fixed #397: Inaccuracies in nthRoot for very large values, and wrong results for very small values. (backported from v2)
 Fixed #405: Parser throws error when defining a function in a multiline expression.
20150531, version 1.7.0 #
 Implemented function
quantileSeq
andpartitionSelect
. Thanks @BigFav.  Implemented functions
stirlingS2
,bellNumbers
,composition
, andmultinomial
. Thanks @devanp92.  Improved the performance of
median
(see #373). Thanks @BigFav.  Extended the command line interface with a
mode
option to output either the expressions result, string representation, or tex representation. Thanks @FSMaxB.  Fixed #309: Function median mutating the input matrix. Thanks @FSMaxB.
 Fixed
Node.transform
not recursing over replaced parts of the node tree (see #349).  Fixed #381: issue in docs of
randomInt
.
20150422, version 1.6.0 #
 Improvements in
toTex
. Thanks @FSMaxB.  Fixed #328:
abs(0 + 0i)
evaluated toNaN
.  Fixed not being able to override lazy loaded constants.
20150409, version 1.5.2 #
 Fixed #313: parsed functions did not handle recursive calls correctly.
 Fixed #251: binary prefix and SI prefix incorrectly used for byte. Now
following SI standards (
1 KiB == 1024 B
,1 kB == 1000 B
).  Performance improvements in parsed functions.
20150408, version 1.5.1 #
 Fixed #316: a bug in rounding values when formatting.
 Fixed #317, #319: a bug in formatting negative values.
20150328, version 1.5.0 #
 Added unit
stone
(6.35 kg).  Implemented support for sparse matrices. Thanks @rjbaucells.
 Implemented BigNumber support for function
atan2
. Thanks @BigFav.  Implemented support for custom LaTeX representations. Thanks @FSMaxB.
 Improvements and bug fixes in outputting parentheses in
Node.toString
andNode.toTex
functions. Thanks @FSMaxB.  Fixed #291: function
format
sometimes returning exponential notation when it should return a fixed notation.
20150228, version 1.4.0 #
 Implemented trigonometric functions:
acosh
,acoth
,acsch
,asech
,asinh
,atanh
,acot
,acsc
,asec
. Thanks @BigFav.  Added BigNumber support for functions:
cot
,csc
,sec
,coth
,csch
,sech
. Thanks @BigFav.  Implemented support for serialization and deserialization of math.js data types.
 Fixed the calculation of
norm()
andabs()
for large complex numbers. Thanks @rjbaucells.  Fixed #281: improved formatting complex numbers. Round the real or imaginary part to zero when the difference is larger than the configured precision.
20150209, version 1.3.0 #
 Implemented BigNumber implementations of most trigonometric functions:
sin
,cos
,tan
,asin
,acos
,atan
,cosh
,sinh
,tanh
. Thanks @BigFav.  Implemented function
trace
. Thanks @pcorey.  Faster loading of BigNumber configuration with a high precision by lazy
loading constants like
pi
ande
.  Fixed constants
NaN
andInfinity
not being BigNumber objects when BigNumbers are configured.  Fixed missing parentheses in the
toTex
representation of functionpermutations
.  Some minor fixes in the docs. Thanks @KenanY.
20141225, version 1.2.0 #
 Support for bitwise operations
bitAnd
,bitNot
,bitOr
,bitXor
,leftShift
,rightArithShift
, andrightLogShift
. Thanks @BigFav.  Support for boolean operations
and
,not
,or
,xor
. Thanks @BigFav.  Support for
gamma
function. Thanks @BigFav.  Converting a unit without value will now result in a unit with value,
i.e.
inch in cm
will return2.54 cm
instead ofcm
.  Improved accuracy of
sinh
and complexcos
andsin
. Thanks @pavpanchekha.  Renamed function
select
tochain
. The old functionselect
will remain functional until math.js v2.0.  Upgraded to decimal.js v4.0.1 (BigNumber library).
20141122, version 1.1.1 #
 Fixed Unit divided by Number returning zero.
 Fixed BigNumber downgrading to Number for a negative base in
pow
.  Fixed some typos in error messaging (thanks @andy0130tw) and docs.
20141115, version 1.1.0 #
 Implemented functions
dot
(dot product),cross
(cross product), andnthRoot
.  Officially opened up the API of expression trees:
 Documented the API.
 Implemented recursive functions
clone
,map
,forEach
,traverse
,transform
, andfilter
for expression trees.  Parameter
index
in the callbacks ofmap
andforEach
are now cloned for every callback.  Some internal refactoring inside nodes to make the API consistent:
 Renamed
params
toargs
and vice versa to make things consistent.  Renamed
Block.nodes
toBlock.blocks
. FunctionNode
now has aname: string
instead of asymbol: SymbolNode
. Changed constructor of
RangeNode
tonew RangeNode(start: Node, end: Node [, step: Node])
.  Nodes for a
BlockNode
must now be passed via the constructor instead of via a functionadd
.
 Renamed
 Fixed
2e
giving a syntax error instead of being parsed as2 * e
.
20140912, version 1.0.1 #
 Disabled array notation for ranges in a matrix index in the expression parser (it is confusing and redundant there).
 Fixed a regression in the build of function subset not being able to return a scalar.
 Fixed some missing docs and broken links in the docs.
20140904, version 1.0.0 #
 Implemented a function
filter(x, test)
.  Removed
math.distribution
for now, needs some rethinking. math.number
can convert units to numbers (requires a second argument) Fixed some precedence issues with the range and conversion operators.
 Fixed an zerobased issue when getting a matrix subset using an index containing a matrix.
20140821, version 0.27.0 #
 Implemented functions
sort(x [, compare])
andflatten(x)
.  Implemented support for
null
in all functions.  Implemented support for “rawArgs” functions in the expression parser. Raw functions are invoked with unevaluated parameters (nodes).
 Expressions in the expression parser can now be spread over multiple lines, like ‘2 +\n3’.
 Changed default value of the option
wrap
of functionmath.import
to false.  Changed the default value for new entries in a resized matrix when to zero.
To leave new entries uninitialized, use the new constant
math.uninitialized
as default value.  Renamed transform property from
__transform__
totransform
, and documented the transform feature.  Fixed a bug in
math.import
not applying options when passing a module name.  A returned matrix subset is now only squeezed when the
index
consists of scalar values, and no longer for ranges resolving into a single value.
20140803, version 0.26.0 #
 A new instance of math.js can no longer be created like
math([options])
, to prevent side effects from math being a function instead of an object. Instead, use the functionmath.create([options])
to create a new instance.  Implemented
BigNumber
support for all constants:pi
,tau
,e
,phi
,E
,LN2
,LN10
,LOG2E
,LOG10E
,PI
,SQRT1_2
, andSQRT2
.  Implemented
BigNumber
support for functionsgcd
,xgcd
, andlcm
.  Fixed function
gxcd
returning an Array when math.js was configured as{matrix: 'matrix'}
.  Multiline expressions now return a
ResultSet
instead of anArray
.  Implemented transforms (used right now to transform onebased indices to zerobased for expressions).
 When used inside the expression parser, functions
concat
,min
,max
, andmean
expect an onebased dimension number.  Functions
map
andforEach
invoke the callback with onebased indices when used from within the expression parser.  When adding or removing dimensions when resizing a matrix, the dimensions are added/removed from the inner side (right) instead of outer side (left).
 Improved index out of range errors.
 Fixed function
concat
not accepting aBigNumber
for parameterdim
.  Function
squeeze
now squeezes both inner and outer singleton dimensions.  Output of getting a matrix subset is not automatically squeezed anymore except for scalar output.
 Renamed
FunctionNode
toFunctionAssignmentNode
, and renamedParamsNode
toFunctionNode
for more clarity.  Fixed broken auto completion in CLI.
 Some minor fixes.
20140701, version 0.25.0 #

The library now immediately returns a default instance of mathjs, there is no need to instantiate math.js in a separate step unless one ones to set configuration options:
// instead of: var mathjs = require('mathjs'), // load math.js math = mathjs(); // create an instance // just do: var math = require('mathjs');
 Implemented support for implicit multiplication, like
math.eval('2a', {a:3})
andmath.eval('(2+3)(13)')
. This changes behavior of matrix indexes as well: an expression like[...][...]
is not evaluated as taking a subset of the first matrix, but as an implicit multiplication of two matrices.  Removed utility function
ifElse
. This function is redundant now the expression parser has a conditional operatora ? b : c
.  Fixed a bug with multiplying a number with a temperature,
like
math.eval('10 * celsius')
.  Fixed a bug with symbols having value
undefined
not being evaluated.
20140620, version 0.24.1 #
 Something went wrong with publishing on npm.
20140620, version 0.24.0 #
 Added constant
null
.  Functions
equal
andunequal
supportnull
andundefined
now.  Function
typeof
now recognizes regular expressions as well.  Objects
Complex
,Unit
, andHelp
now return their string representation when calling.valueOf()
.  Changed the default number of significant digits for BigNumbers from 20 to 64.
 Changed the behavior of the conditional operator (a ? b : c) to lazy evaluating.
 Fixed imported, wrapped functions not accepting
null
andundefined
as function arguments.
20140610, version 0.23.0 #
 Renamed some functions (everything now has a logical, camel case name):
 Renamed functions
edivide
,emultiply
, andepow
todotDivide
,dotMultiply
, anddotPow
respectively.  Renamed functions
smallereq
andlargereq
tosmallerEq
andlargerEq
.  Renamed function
unary
tounaryMinus
and added support for strings.
 Renamed functions
end
is now a reserved keyword which cannot be used as function or symbol name in the expression parser, and is not allowed in the scope against which an expression is evaluated. Implemented function
unaryPlus
and unary plus operator.  Implemented function
deepEqual
for matrix comparisons.  Added constant
phi
, the golden ratio (phi = 1.618...
).  Added constant
version
, returning the version number of math.js as string.  Added unit
drop
(gtt
).  Fixed not being able to load math.js using AMD/require.js.
 Changed signature of
math.parse(expr, nodes)
tomath.parse(expr, options)
whereoptions: {nodes: Object.<String, Node>}
 Removed matrix support from conditional function
ifElse
. 
Removed automatic assignment of expression results to variable
ans
. This functionality can be restored by pre or postprocessing every evaluation, something like:function evalWithAns (expr, scope) { var ans = math.eval(expr, scope); if (scope) { scope.ans = ans; } return ans; }
20140522, version 0.22.0 #
 Implemented support to export expressions to LaTeX. Thanks Niels Heisterkamp (@nheisterkamp).
 Output of matrix multiplication is now consistently squeezed.
 Added reference documentation in the section /docs/reference.
 Fixed a bug in multiplying units without value with a number (like
5 * cm
).  Fixed a bug in multiplying two matrices containing vectors (worked fine for arrays).
 Fixed random functions not accepting Matrix as input, and always returning a Matrix as output.
20140513, version 0.21.1 #
 Removed
crypto
library from the bundle.  Deprecated functions
Parser.parse
andParser.compile
. Usemath.parse
andmath.compile
instead.  Fixed function
add
not adding strings and matrices element wise.  Fixed parser not being able to evaluate an exponent followed by a unary minus
like
2^3
, and a transpose followed by an index like[3]'[1]
.
20140424, version 0.21.0 #
 Implemented trigonometric hyperbolic functions
cosh
,coth
,csch
,sech
,sinh
,tanh
. Thanks Rogelio J. Baucells (@rjbaucells).  Added property
type
to all expression nodes in an expression tree.  Fixed functions
log
,log10
,pow
, andsqrt
not supporting complex results from BigNumber input (likesqrt(bignumber(4))
).
20140416, version 0.20.0 #
 Switched to module
decimal.js
for BigNumber support, instead ofbignumber.js
.  Implemented support for polar coordinates to the
Complex
datatype. Thanks Finn Pauls (@finnp).  Implemented BigNumber support for functions
exp
,log
, andlog10
.  Implemented conditional operator
a ? b : c
in expression parser.  Improved floating point comparison: the functions now check whether values
are nearly equal, against a configured maximum relative difference
epsilon
. Thanks Rogelio J. Baucells (@rjbaucells).  Implemented function
norm
. Thanks Rogelio J. Baucells (@rjbaucells).  Improved function
ifElse
, is now specified for special data types too.  Improved function
det
. Thanks Bryan Cuccioli (@bcuccioli).  Implemented
BigNumber
support for functionsdet
anddiag
.  Added unit alias
lbs
(pound mass).  Changed configuration option
decimals
toprecision
(applies to BigNumbers only).  Fixed support for elementwise comparisons between a string and a matrix.
 Fixed: expression parser now trows IndexErrors with onebased indices instead of zerobased.
 Minor bug fixes.
20140330, version 0.19.0 #
 Implemented functions
compare
,sum
,prod
,var
,std
,median
.  Implemented function
ifElse
Thanks @mtraynham.  Minor bug fixes.
20140215, version 0.18.1 #
 Added unit
feet
.  Implemented function
compile
(shortcut for parsing and then compiling).  Improved performance of function
pow
for matrices. Thanks @hamadu.  Fixed broken auto completion in the command line interface.
 Fixed an error in function
combinations
for large numbers, and improved performance of both functionscombinations
andpermutations
.
20140118, version 0.18.0 #
 Changed matrix index notation of expression parser from round brackets to
square brackets, for example
A[1, 1:3]
instead ofA(1, 1:3)
.  Removed need to use the
function
keyword for function assignments in the expression parser, you can define a function now likef(x) = x^2
.  Implemented a compilation step in the expression parser: expressions are compiled into JavaScript, giving much better performance (easily 10x as fast).
 Renamed unit conversion function and operator
in
toto
. Operatorin
is still available in the expression parser as an alias forto
. Added unitin
, an abbreviation forinch
. Thanks Elijah Insua (@tmpvar).  Added plurals and aliases for units.
 Implemented an argument
includeEnd
for functionrange
(false by default).  Ranges in the expression parser now support big numbers.
 Implemented functions
permutations
andcombinations
. Thanks Daniel Levin (@daniellevin).  Added lower case abbreviation
l
for unit litre.
20131219, version 0.17.1 #
 Fixed a bug with negative temperatures.
 Fixed a bug with prefixes of units squared meter
m2
and cubic meterm3
.
20131212, version 0.17.0 #
 Renamed and flattened configuration settings:
number.defaultType
is nownumber
.number.precision
is nowdecimals
.matrix.defaultType
is nowmatrix
.
 Function
multiply
now consistently outputs a complex number on complex input.  Fixed
mod
andin
not working as function (only as operator).  Fixed support for old browsers (IE8 and older), compatible when using es5shim.
 Fixed support for Java’s ScriptEngine.
20131128, version 0.16.0 #
 Implemented BigNumber support for arbitrary precision calculations.
Added settings
number.defaultType
andnumber.precision
to configure big numbers.  Documentation is extended.
 Removed utility functions
isScalar
,toScalar
,isVector
,toVector
fromMatrix
andRange
. Usemath.squeeze
andmath.size
instead.  Implemented functions
get
andset
onMatrix
, for easier and faster retrieval/replacement of elements in a matrix.  Implemented function
resize
, handling matrices, scalars, and strings.  Functions
ones
andzeros
now return an empty matrix instead of a number 1 or 0 when no arguments are provided.  Implemented functions
min
andmax
forRange
andIndex
.  Resizing matrices now leaves new elements undefined by default instead of
filling them with zeros. Function
resize
now has an extra optional parameterdefaultValue
.  Range operator
:
in expression parser has been given a higher precedence.  Functions don’t allow arguments of unknown type anymore.
 Options be set when constructing a math.js instance or using the new function
config(options
. Options are no longer accessible viamath.options
.  Renamed
scientific
notation toexponential
in functionformat
.  Function
format
outputs exponential notation with positive exponents now always with+
sign, so outputs2.1e+3
instead of2.1e3
.  Fixed function
squeeze
not being able squeeze into a scalar.  Some fixes and performance improvements in the
resize
andsubset
functions.  Function
size
now adheres to the optionmatrix.defaultType
for scalar input.  Minor bug fixes.
20131026, version 0.15.0 #
 Math.js must be instantiated now, static calls are no longer supported. Usage:
 node.js:
var math = require('mathjs')();
 browser:
var math = mathjs();
 node.js:
 Implemented support for multiplying vectors with matrices.
 Improved number formatting:
 Function
format
now support various options: precision, different notations (fixed
,scientific
,auto
), and more.  Numbers are no longer rounded to 5 digits by default when formatted.
 Implemented a function
format
forMatrix
,Complex
,Unit
,Range
, andSelector
to format using options.  Function
format
does only stringify values now, and has a new parameterprecision
to round to a specific number of digits.  Removed option
math.options.precision
, usemath.format(value [, precision])
instead.  Fixed formatting numbers as scientific notation in some cases returning a zero digit left from the decimal point. (like “0.33333e8” rather than “3.3333e7”). Thanks @husayt.
 Function
 Implemented a function
print
to interpolate values in a template string, this functionality was moved from the functionformat
.  Implemented statistics function
mean
. Thanks Guillermo Indalecio Fernandez (@guillermobox).  Extended and changed
max
andmin
for multi dimensional matrices: they now return the maximum and minimum of the flattened array. An optional second argumentdim
allows to calculate themax
ormin
for specified dimension.  Renamed option
math.options.matrix.default
tomath.options.matrix.defaultType
.  Removed support for comparing complex numbers in functions
smaller
,smallereq
,larger
,largereq
. Complex numbers cannot be ordered.
20131008, version 0.14.0 #
 Introduced an option
math.options.matrix.default
which can have valuesmatrix
(default) orarray
. This option is used by the functionseye
,ones
,range
, andzeros
, to determine the type of matrix output.  Getting a subset of a matrix will automatically squeeze the resulting subset, setting a subset of a matrix will automatically unsqueeze the given subset.
 Removed concatenation of nested arrays in the expression parser.
You can now input nested arrays like in JavaScript. Matrices can be
concatenated using the function
concat
.  The matrix syntax
[...]
in the expression parser now creates 1 dimensional matrices by default.math.eval('[1,2,3,4]')
returns a matrix with size[4]
,math.eval('[1,2;3,4]')
returns a matrix with size[2,2]
.  Documentation is restructured and extended.
 Fixed non working operator
mod
(modulus operator).
20130903, version 0.13.0 #
 Implemented support for booleans in all relevant functions.
 Implemented functions
map
andforEach
. Thanks Sebastien Piquemal (@sebpic).  All construction functions can be used to convert the type of variables, also elementwise for all elements in an Array or Matrix.
 Changed matrix indexes of the expression parser to onebased with the upperbound included, similar to most math applications. Note that on a JavaScript level, math.js uses zerobased indexes with excluded upperbound.
 Removed support for scalars in the function
subset
, it now only supports Array, Matrix, and String.  Removed the functions
get
andset
from a selector, they are a duplicate of the functionsubset
.  Replaced functions
get
andset
ofMatrix
with a single functionsubset
.  Some moving around with code and namespaces:
 Renamed namespace
math.expr
tomath.expression
(contains Scope, Parser, node objects).  Renamed namespace
math.docs
tomath.expression.docs
.  Moved
math.expr.Selector
tomath.chaining.Selector
.
 Renamed namespace
 Fixed some edge cases in functions
lcm
andxgcd
.
20130822, version 0.12.1 #
 Fixed outdated version of README.md.
 Fixed a broken unit test.
20130822, version 0.12.0 #
 Implemented functions
random([min, max])
,randomInt([min, max])
,pickRandom(array)
. Thanks Sebastien Piquemal (@sebpic).  Implemented function
distribution(name)
, generating a distribution object with functionsrandom
,randomInt
,pickRandom
for different distributions. Currently supportinguniform
andnormal
.  Changed the behavior of
range
to exclude the upper bound, sorange(1, 4)
now returns[1, 2, 3]
instead of[1, 2, 3, 4]
.  Changed the syntax of
range
, which is nowrange(start, end [, step])
instead ofrange(start, [step, ] end)
.  Changed the behavior of
ones
andzeros
to geometric dimensions, for exampleones(3)
returns a vector with length 3, filled with ones, andones(3,3)
returns a 2D array with size [3, 3].  Changed the return type of
ones
andzeros
: they now return an Array when arguments are Numbers or an Array, and returns a Matrix when the argument is a Matrix.  Change matrix index notation in parser from round brackets to square brackets,
for example
A[0, 0:3]
.  Removed the feature introduced in v0.10.0 to automatically convert a complex value with an imaginary part equal to zero to a number.
 Fixed zeros being formatted as null. Thanks @TimKraft.
20130723, version 0.11.1 #
 Fixed missing development dependency
20130723, version 0.11.0 #
 Changed math.js from onebased to zerobased indexes.
 Getting and setting matrix subset is now zerobased.
 The dimension argument in function
concat
is now zerobased.
 Improvements in the string output of function help.
 Added constants
true
andfalse
.  Added constructor function
boolean
.  Fixed function
select
not accepting0
as input. Thanks Elijah Manor (@elijahmanor).  Parser now supports multiple unary minus operators after each other.
 Fixed not accepting empty matrices like
[[], []]
.  Some fixes in the end user documentation.
20130708, version 0.10.0 #
 For complex calculations, all functions now automatically replace results
having an imaginary part of zero with a Number. (
2i * 2i
now returns a Number4
instead of a Complex4 + 0i
).  Implemented support for injecting custom node handlers in the parser. Can be used for example to implement a node handler for plotting a graph.
 Implemented end user documentation and a new
help
function.  Functions
size
andsqueeze
now return a Matrix instead of an Array as output on Matrix input.  Added a constant tau (2 * pi). Thanks Zak Zibrat (@palimpsests).
 Renamed function
unaryminus
tounary
.  Fixed a bug in determining node dependencies in function assignments.
20130614, version 0.9.1 #
 Implemented elementwise functions and operators:
emultiply
(x .* y
),edivide
(x ./ y
),epow
(x .^ y
).  Added constants
Infinity
andNaN
.  Removed support for Workspace to keep the library focused on its core task.
 Fixed a bug in the Complex constructor, not accepting NaN values.
 Fixed division by zero in case of pure complex values.
 Fixed a bug in function multiply multiplying a pure complex value with Infinity.
20130529, version 0.9.0 #
 Implemented function
math.parse(expr [,scope])
. Optional parameter scope can be a plain JavaScript Object containing variables.  Extended function
math.expr(expr [, scope])
with an additional parameterscope
, similar toparse
. Example:math.eval('x^a', {x:3, a:2});
.  Implemented function
subset
, to get or set a subset from a matrix, string, or other data types.  Implemented construction functions number and string (mainly useful inside the parser).
 Improved function
det
. Thanks Bryan Cuccioli (@bcuccioli).  Moved the parse code from prototype math.expr.Parser to function math.parse, simplified Parser a little bit.
 Strongly simplified the code of Scope and Workspace.
 Fixed function mod for negative numerators, and added error messages in case of wrong input.
20130518, version 0.8.2 #
 Extended the import function and some other minor improvements.
 Fixed a bug in merging one dimensional vectors into a matrix.
 Fixed a bug in function subtract, when subtracting a complex number from a real number.
20130510, version 0.8.1 #
 Fixed an npm warning when installing mathjs globally.
20130510, version 0.8.0 #
 Implemented a command line interface. When math.js is installed globally via npm, the application is available on your system as ‘mathjs’.
 Implemented
end
keyword for index operator, and added support for implicit start and end (expressions likea(2,:)
andb(2:end,3:end1)
are supported now).  Function math.eval is more flexible now: it supports variables and multiline expressions.
 Removed the readonly option from Parser and Scope.
 Fixed nonworking unequal operator != in the parser.
 Fixed a bug in resizing matrices when replacing a subset.
 Fixed a bug in updating a subset of a nonexisting variable.
 Minor bug fixes.
20130504, version 0.7.2 #
 Fixed method unequal, which was checking for equality instead of inequality. Thanks @FJS2.
20130427, version 0.7.1 #
 Improvements in the parser:
 Added support for chained arguments.
 Added support for chained variable assignments.
 Added a function remove(name) to remove a variable from the parsers scope.
 Renamed nodes for more consistency and to resolve naming conflicts.
 Improved stringification of an expression tree.
 Some simplifications in the code.
 Minor bug fixes.
 Fixed a bug in the parser, returning NaN instead of throwing an error for a
number with multiple decimal separators like
2.3.4
.  Fixed a bug in Workspace.insertAfter.
 Fixed: math.js now works on IE 68 too.
20130420, version 0.7.0 #
 Implemented method
math.eval
, which uses a readonly parser to evaluate expressions.  Implemented method
xgcd
(extended eucledian algorithm). Thanks Bart Kiers (@bkiers).  Improved math.format, which now rounds values to a maximum number of digits
instead of decimals (default is 5 digits, for example
math.format(math.pi)
returns3.1416
).  Added examples.
 Changed methods square and cube to evaluate matrices element wise (consistent with all other methods).
 Changed second parameter of method import to an object with options.
 Fixed method math.typeof on IE.
 Minor bug fixes and improvements.
20130413, version 0.6.0 #
 Implemented chained operations via method math.select(). For example
math.select(3).add(4).subtract(2).done()
will return5
.  Implemented methods gcd and lcm.
 Implemented method
Unit.in(unit)
, which creates a clone of the unit with a fixed representation. For examplemath.unit('5.08 cm').in('inch')
will return a unit which string representation always is in inch, thus2 inch
.Unit.in(unit)
is the same as methodmath.in(x, unit)
.  Implemented
Unit.toNumber(unit)
, which returns the value of the unit when represented with given unit. For examplemath.unit('5.08 cm').toNumber('inch')
returns the number2
, as the representation of the unit in inches has 2 as value.  Improved: method
math.in(x, unit)
now supports a string as second parameter, for examplemath.in(math.unit('5.08 cm'), 'inch')
.  Split the end user documentation of the parser functions from the source files.
 Removed function help and the builtin documentation from the core library.
 Fixed constant i being defined as 1i instead of 1i.
 Minor bug fixes.
20130406, version 0.5.0 #
 Implemented data types Matrix and Range.
 Implemented matrix methods clone, concat, det, diag, eye, inv, ones, size, squeeze, transpose, zeros.
 Implemented range operator
:
, and transpose operator'
in parser.  Changed: created construction methods for easy object creation for all data
types and for the parser. For example, a complex value is now created
with
math.complex(2, 3)
instead ofnew math.Complex(2, 3)
, and a parser is now created withmath.parser()
instead ofnew math.parser.Parser()
.  Changed: moved all data types under the namespace math.type, and moved the Parser, Workspace, etc. under the namespace math.expr.
 Changed: changed operator precedence of the power operator:
 it is now right associative instead of left associative like most scripting
languages. So
2^3^4
is now calculated as2^(3^4)
.  it has now higher precedence than unary minus most languages, thus
3^2
is now calculated as(3^2)
.
 it is now right associative instead of left associative like most scripting
languages. So
 Changed: renamed the parsers method ‘put’ into ‘set’.
 Fixed: method ‘in’ did not check for units to have the same base.
20130316, version 0.4.0 #
 Implemented Array support for all methods.
 Implemented Array support in the Parser.
 Implemented method format.
 Implemented parser for units, math.Unit.parse(str).
 Improved parser for complex values math.Complex.parse(str);
 Improved method help: it now evaluates the examples.
 Fixed: a scoping issue with the Parser when defining functions.
 Fixed: method ‘typeof’ was not working well with minified and mangled code.
 Fixed: errors in determining the best prefix for a unit.
20130309, version 0.3.0 #
 Implemented Workspace
 Implemented methods cot, csc, sec.
 Implemented Array support for methods with one parameter.
20130225, version 0.2.0 #
 Parser, Scope, and expression tree with Nodes implemented.
 Implemented method import which makes it easy to extend math.js.
 Implemented methods arg, conj, cube, equal, factorial, im, largereq, log(x, base), log10, mod, re, sign, smallereq, square, unequal.
20130218, version 0.1.0 #
 Reached full compatibility with Javascripts builtin Math library.
 More functions implemented.
 Some bugfixes.
20130216, version 0.0.2 #
 All constants of Math implemented, plus the imaginary unit i.
 Data types Complex and Unit implemented.
 First set of functions implemented.
20130215, version 0.0.1 #
 First publish of the mathjs package. (package is still empty)