HISTORY.md (98741B)
1 # History 2 3 4 # 2022-04-08, version 10.4.3 5 6 - Fix #2508: improve the precision of stirlingS2 (#2509). Thanks @gwhitney. 7 - Fix #2514: implement optional argument `base` in the number implementation 8 of function `log` (#2515). Thanks @gwhitney. 9 - Improve the documentation on operator `;` (#2512). Thanks @gwhitney. 10 11 12 # 2022-03-29, version 10.4.2 13 14 - Fix #2499: different behavior for unit conversion "degC" and "K" (#2501). 15 Also disables getting the sign for units with an offset, which is ambiguous. 16 Thanks @gwhitney. 17 - Fix #2503: fix an issue in `log()` for complex numbers in which the imaginary 18 part is much larger in absolute value than the real part, fixed in 19 `complex.js@2.1.0` (#2505), thanks @gwhitney, @infusion. 20 - Fix #2493: unclear error message when an entity that is not a function 21 is being called as a function (#2494). Thanks @gwhitney. 22 - Some fixes in the docs on units (#2498). Thanks @dvd101x. 23 - Add `forEach` example in embedded docs (#2507). Thanks @dvd101x. 24 - Correct approx.deepEqual() to accept an epsilon argument giving the 25 comparison tolerance. It was already being called this way, but was 26 silently ignoring the tolerance. Thanks @yifanwww. 27 28 29 # 2022-03-23, version 10.4.1 30 31 - Improve TypeScript definitions for function `unit` (#2479). 32 Thanks @SinanAkkoyun. 33 - Add tests for type declarations (#2448). Thanks @samestep. 34 - Further improvement to TypeScript definitions of `std` and `variance` 35 (make dimension parameter optional, #2474). Thanks @NattapongSiri. 36 - Next step (as per #2431) for full publication of "is" functions like 37 `isMatrix` etc: Provide TypeScript definitions of "is" functions and 38 make them type guards. (#2432). Thanks @ChristopherChudzicki. 39 - Fix #2491: Multi line object expressions don't work with comments (#2492). 40 Thanks @gwhitney. 41 - Fix #2478: a bug in calculating the eigenvectors when dealing with complex 42 numbers (#2496). Thanks @gwhitney. 43 - Update project dependencies and devDependencies. 44 45 46 # 2022-03-07, version 10.4.0 47 48 - Fix #2461: make sure `simplifyCore` recurses over all binary nodes (#2462). 49 Thanks @gwhitney. 50 - Fix #2429: fix the TypeScript definitions of functions `std` and `variance` 51 (#2455). Thanks @NattapongSiri. 52 - Fix #1633: implement a `cumsum` function generating cumulative sums of a list 53 of values or a matrix. (#1870). Thanks @hjonasson. 54 - Upgrade to the latest version of `Fraction.js`, having more strict input, 55 only accepting an integer numerator and denominator. See #2427. 56 - Fix typo in documentation example for `format`. (#2468) Thanks @abranhe. 57 - Write unit tests for all jsdoc examples. See #2452. Thanks @gwhitney. 58 59 60 # 2021-03-02, version 10.3.0 61 62 - Fix #1260: implement function `symbolicEqual` (#2424). Thanks @gwhitney. 63 - Fix #2441, #2442: support passing a function as argument to functions created 64 in the expression parser (#2443). Thanks @gwhitney. 65 - Fix #2325: improve documentation of subset indices (#2446). Thanks @gwhitney. 66 - Fix #2439: fix a bug in `complexEigs` in which real-valued norms were 67 inadvertently being typed as complex numbers (#2445). Thanks @gwhitney. 68 - Fix #2436: improve documentation and error message of function `map` (#2457). 69 Thanks @gwhitney. 70 71 72 # 2022-03-01, version 10.2.0 73 74 - Implemented context options to control simplifications allowed in `simplify`, 75 see #2399, #2391. Thanks @gwhitney. 76 - Implemented function `leafCount` as a first simple measure of the complexity 77 of an expression, see #2411, #2389. Thanks @gwhitney. 78 - Fix #2413: improve `combinations` to return an integer result without rounding 79 errors for larger values, see #2414. Thanks @gwhitney. 80 - Fix #2385: function `rotate` missing in TypeScript definitions. 81 Thanks @DIVYA-19. 82 - Fix #2450: Add BigNumber to parameter type in `math.unit` and add TypeScript 83 types for `Unit.simplify` and `Unit.units` (#2353). Thanks @joshhansen. 84 - Fix #2383: detect infinite loops in `simplify` (#2405). Thanks @gwhitney. 85 - Fix #1423: collect like factors and cancel like terms in sums (#2388). 86 Thanks @gwhitney. 87 88 89 # 2022-02-02, version 10.1.1 90 91 - Improvements and fixes in function `simplify`, thanks @gwhitney: 92 - Fix #2393: regression bug in `simplify('2-(x+1)')`. 93 - Ad option `consoleDebug` to `simplify` to see what is going on. 94 - Fix TypeScript definition of `ConfigOptions`, which was missing option 95 `predictable`. 96 97 98 # 2022-01-15, version 10.1.0 99 100 - Implemented function `invmod`, see #2368, #1744. Thanks @thetazero. 101 - Improvements and fixes in function `simplify`, thanks @gwhitney: 102 - Fix #1179, #1290: improve collection of non-constant like terms (#2384). 103 - Fix #2152: do not transform strings into numbers (#2372). 104 - Fix #1913: implement support for array and object simplification (#2382). 105 - Fix #2379: add embedded documentation for function `print`. 106 - Remove broken example from the embedded documentation of function `forEach`. 107 108 109 # 2021-12-29, version 10.0.2 110 111 - Fix #2156: simplify expressions like `-1 / (-x)` to `1/x`. Thanks @ony3000. 112 - Fix #2363: remove a redundant part of the regex to split a number. 113 - Fix #2291: add support for fractions in function `intersect`. 114 Thanks @thetazero. 115 - Fix #2358: bug in `SparseMatrix` when replacing a subset of a matrix with 116 a non-consecutive index. Thanks @Al-0. 117 118 119 # 2021-12-22, version 10.0.1 120 121 - Fix #1681: function `gamma` giving inaccurate complex results in some cases. 122 Thanks @kmdrGroch. 123 - Fixed a typo in an example, see #2366. Thanks @blackwindforce. 124 125 126 # 2021-11-03, version 10.0.0 127 128 !!! BE CAREFUL: BREAKING CHANGES IN THE TYPESCRIPT DEFINITIONS !!! 129 130 - Improvements to the Typescript typings (commit fc5c202e). 131 Thanks @joshhansen. First introduced in v9.5.1, but reverted because 132 it contains breaking changes. 133 134 Breaking changes: interface `MathNode` is now renamed to `MathNodeCommon` 135 and the related interfaces are structured in a different way. 136 137 - Fixed a typo in the TypeScript definition of toHTML. Thanks @TheToto. 138 139 140 # 2021-11-03, version 9.5.2` 141 142 - Revert the improvements to the Typescript typings because they contain 143 breaking changes. The improvements will be published in v10.0.0. See #2339. 144 145 146 # 2021-10-13, version 9.5.1 147 148 - Various improvements to the Typescript typings. 149 Thanks @joshhansen and @DianaTdr. 150 151 152 # 2021-09-22, version 9.5.0 153 154 - Implemented support for calculations with percentage, see #2303. 155 Thanks @rvramesh. 156 - Fix #2319: make the API of `Parser.evaluate` consistent with `math.evaluate`: 157 support a list with expressions as input. 158 - Improved documentation of function `setCartesian`. Thanks @fieldfoxWim. 159 160 161 # 2021-09-15, version 9.4.5 162 163 - Improved the performance of `Node.equals` by improving the internal 164 function `deepStrictEqual`. Thanks @tomlarkworthy. 165 - Fixes in the TypeScript definitions: 166 - Define `hasNumericValue`. Thanks @write2kcl. 167 - Define `MathNode.isRelationalNode`. Thanks @m93a. 168 - Fix typo in `MathNode.isConditionalNode`. Thanks @m93a. 169 170 171 # 2021-07-07, version 9.4.4 172 173 - Fixed `ArrayNode.toTex()`: remove the row delimiter on the last row, 174 see #2267. Thanks @davidtranhq. 175 - Fix #2269: `intersect` not returning `null` for matrix input. Thanks @m93a. 176 - Fix #2245: mathjs not working in IE11 anymore due to a missing polyfill for 177 `Symbol`. The browser bundle now includes the necessary polyfills (it is 178 larger now because of that, see also #2266). Thanks @m93a. 179 - Update dependencies (`complex.js@2.0.15`, `decimal.js@10.3.1`) 180 - Drop official support for node.js 10, which has reached end of life. 181 See #2258. 182 183 184 # 2021-06-23, version 9.4.3 185 186 - Fix #2222: mathjs polluting the `Decimal` prototype. Thanks @m93a. 187 - Fix #2253: expression parser throwing an error when accessing nested object 188 properties named `e`. 189 - Fixes in the TypeScript definitions: 190 - function `floor`, #2159, #2246. Thanks @write2kcl. 191 - function `simplify`, see #2252. Thanks @nitroin. 192 - Upgraded to `decimal.js@10.3.0` 193 194 195 # 2021-06-05, version 9.4.2 196 197 - Implemented iterative eigenvalue finder for `eigs`, making it much more 198 robust. See #2179, #2237. Thanks @m93a. 199 - Improved TypeScript definitions of function `parse`. Thanks @OpportunityLiu. 200 201 202 # 2021-05-24, version 9.4.1 203 204 - Fix #2100: add TypeScript declaration for `eigs`. Thanks @andrebianchessi. 205 - Fix #2220: add TypeScript files to published npm package. Thanks @dhritzkiv. 206 - Update readme regarding TypeScript definition files. Thanks @dhritzkiv. 207 - Update to `fraction.js@4.1.1` 208 209 210 # 2021-05-16, version 9.4.0 211 212 - Implemented support to use objects with a `Map` interface as scope, 213 see #2143, #2166. Thanks @jhugman. 214 - Extend `eigs` to support general complex matrices, see #1741. Thanks @m93a. 215 - DenseMatrix and SparseMatrix are now iterable, see #1184. Thanks @m93a. 216 - Implemented utility functions `matrixFromRows`, `matrixFromColumns`, and 217 `matrixFromFunction`, see #2155, #2153. Thanks @m93a. 218 - Added TypeScript definitions to the project, making it redundant to install 219 `@types/mathjs`, and making it easier to improve the definitions. See #2187, 220 #2192. Thanks @CatsMiaow. 221 - Upgraded dependencies 222 - `complex.js@2.0.13` (fixing #2211). Thanks @infusion 223 - `fraction.js@4.1.0` (`pow` now supporting rational exponents). 224 - Fix #2174: function `pickRandom` having no name. Thanks @HK-SHAO. 225 - Fix #2019: VSCode auto import keeps adding import { null } from 'mathjs'. 226 - Fix #2185: Fix TypeScript definition of unit division, which can also return 227 a number. 228 - Fix #2123: add type definitions for functions `row` and `column`. 229 - Fix some files not exposed in the package, see #2213. Thanks @javiermarinros. 230 231 232 # 2021-04-12, version 9.3.2 233 234 - Fix #2169: mathjs requesting `@babel/runtime` dependency. 235 Regression introduced in `v9.3.1`. 236 237 238 # 2021-04-10, version 9.3.1 239 240 - Fix #2133: strongly improved the performance of `isPrime`, see #2139. 241 Thanks @Yaffle. 242 - Fix #2150: give a clear error "Error: Undefined function ..." instead when 243 evaluating a non-existing function. 244 - Fix #660: expose internal functions `FunctionNode.onUndefinedFunction(name)` 245 and `SymbolNode.onUndefinedSymbol(name)`, allowing to override the behavior. 246 By default, an Error is thrown. 247 248 249 # 2021-03-10, version 9.3.0 250 251 - Implemented support for parsing non decimal numbers with radix point, 252 see #2122, #2121. Thanks @clnhlzmn. 253 - Fix #2128: typo in docs of `luSolveAll` and `usolveAll`. 254 255 256 # 2021-02-03, version 9.2.0 257 258 - Implemented function `count` to count the total elements in a matrix, 259 see #2085. Thanks @Josef37. 260 - Fix #2096: cleanup old reference to external dependency `crypto`. 261 - Some refactoring in the code to remove duplications, see #2093. 262 Thanks @Josef37. 263 264 265 # 2021-01-27, version 9.1.0 266 267 - Extended function `reshape` with support for a wildcard `-1` to automatically 268 calculate the remaining size, like `reshape([1, 2, 3, 4, 5, 6], [-1, 2])` 269 which will output `[[0, 1], [2, 3], [4, 5]]`. See #2075. Thanks @Josef37. 270 - Fix #2087: function `simplify` ignores second argument of `log`, for example 271 in `simplify('log(e, 9)')` . Thanks @quentintruong. 272 273 274 # 2021-01-16, version 9.0.0 275 276 - Improved support for bin, hex, and oct literals. See #1996. Thanks @clnhlzmn. 277 - **Breaking change**: parse literals with prefixes `0b`, `0c`, and `0x` are 278 now unsigned by default. To parse them as signed, you have to specify a 279 suffix specifying the word size such as `i16` or `i32`. 280 - Function `format` now supports more notations: `bin`, 'hex', and `oct`, 281 for example `format(255, {notation: "hex"})`. 282 - The functions `format`, `bin`, `hex`, `oct` now allow specifying a wordSize, 283 like `bin(10, 32)` and `format(10, {notation: "bin", wordSize: 32})`. 284 - BigNumber support for the bin, hex, and oct literals. 285 - Extended and improved the example rocket_trajectory_optimization.html. 286 Thanks @Josef37. 287 288 289 # 2020-12-30, version 8.1.1 290 291 - Improved the performance of parsing and evaluating units a lot, see #2065. 292 Thanks @flaviut. 293 - Upgraded dependency `fraction.js` to `v4.0.13`. 294 - Moved continuous integration testing from Travis CI to Github Workflow, 295 see #2024, #2041. Thanks @harrysarson. 296 297 298 # 2020-12-04, version 8.1.0 299 300 - Implemented units `kilogramforce` (`kgf`). Thanks @rnd-debug. 301 - Fix #2026: Implement a new option `fractionsLimit` for function `simplify`, 302 defaulting to `Infinity`. 303 - Improved the documentation of function `clone`. Thanks @redbar0n. 304 305 306 # 2020-11-09, version 8.0.1 307 308 - Fix #1979: missing "subset" dependency when using "mathjs/number" entry point. 309 - Fix #2022: update pretty printing with MathJax example to the latest version 310 of MathJax. Thanks @pkra. 311 312 313 # 2020-11-06, version 8.0.0 314 315 !!! BE CAREFUL: BREAKING CHANGES !!! 316 317 - You can now use mathjs directly in node.js using ES modules without need for 318 a transpiler (see #1928, #1941, #1962). 319 Automatically loading either commonjs code or ES modules code is improved. 320 All generated code is moved under `/lib`: the browser bundle is moved from 321 `/dist` to `/lib/browser`, ES module files are moved to `/lib/esm`, 322 and commonjs files are moved to `/lib/cjs`. Thanks @GreenImp. 323 - Non-minified bundle `dist/math.js` is no longer provided. Either use the 324 minified bundle, or create a bundle yourself. 325 - Replaced random library `seed-random` with `seedrandom`, see #1955. 326 Thanks @poppinlp. 327 - Breaking changes in `pickRandom`, see #1990, #1976. 328 - Will no longer return the input matrix when the given number is greater 329 than the length of the provided possibles. Instead, the function always 330 returns results with the requested number of picks. 331 - Will now return a `Matrix` as output when input was a `Matrix`. 332 - Introduced a new syntax: 333 334 ``` 335 math.pickRandom(array, { weights, number, elementWise }) 336 ``` 337 - Introduced a new option `elementWise`, which is `true` by default. 338 When setting `elementWise` to false, an array containing arrays will return 339 random pick of arrays instead of the elements inside of the nested arrays. 340 341 342 # 2020-11-02, version 7.6.0 343 344 - Implemented function `rotate(w, theta)`. See #1992, #1160. Thanks @rnd-debug. 345 - Implemented support for custom characters in Units via `Unit.isValidAlpha`. 346 See #1663, #2000. Thanks @rnd-debug. 347 348 349 # 2020-10-10, version 7.5.1 350 351 - Fix object pollution vulnerability in `math.config`. Thanks Snyk. 352 353 354 # 2020-10-07, version 7.5.0 355 356 - Function `pickRandom` now allows randomly picking elements from matrices 357 with 2 or more dimensions instead of only from a vector, see #1974. 358 Thanks @KonradLinkowski. 359 360 361 # 2020-10-07, version 7.4.0 362 363 - Implemented support for passing a precision in functions `ceil`, `floor`, 364 and `fix`, similar to `round`, see #1967, #1901. Thanks @rnd-debug. 365 - Implemented function `rotationMatrix`, see #1160, #1984. Thanks @rnd-debug. 366 - Implement a clear error message when using `sqrtm` with a matrix having 367 more than two dimensions. Thanks @KonradLinkowski. 368 - Update dependency `decimal.js` to `10.2.1`. 369 370 371 # 2020-09-26, version 7.3.0 372 373 - Implemented functions `usolveAll` and `lsolveAll`, see #1916. Thanks @m93a. 374 - Implemented support for units in functions `std` and `variance`, see #1950. 375 Thanks @rnd-debug. 376 - Implemented support for binary, octal, and hexadecimal notation in the 377 expression parser, and implemented functions `bin`, `oct`, and `hex` for 378 formatting. Thanks @clnhlzmn. 379 - Fix #1964: inconsistent calculation of negative dividend modulo for 380 `BigNumber` and `Fraction`. Thanks @ovk. 381 382 383 # 2020-08-24, version 7.2.0 384 385 - Implemented new function `diff`, see #1634, #1920. Thanks @Veeloxfire. 386 - Implemented support for norm 2 for matrices in function `norm`. 387 Thanks @rnd-debug. 388 389 390 # 2020-07-13, version 7.1.0 391 392 - Implement support for recursion (self-referencing) of typed-functions, 393 new in `typed-function@2.0.0`. This fixes #1885: functions which where 394 extended with a new data type did not always work. Thanks @nickewing. 395 - Fix #1899: documentation on expression trees still using old namespace 396 `math.expression.node.*` instead of `math.*`. 397 398 399 # 2020-06-24, version 7.0.2 400 401 - Fix #1882: have `DenseMatrix.resize` and `SparseMatrix.resize` accept 402 `DenseMatrix` and `SparseMatrix` as inputs too, not only `Array`. 403 - Fix functions `sum`, `prod`, `min`, and `max` not throwing a conversion error 404 when passing a single string, like `sum("abc")`. 405 406 407 # 2020-05-30, version 7.0.1 408 409 - Fix #1844: clarify the documentation of function `eigs`. Thanks @Lazersmoke. 410 - Fix #1855: Fix error in the documentation for `math.nthRoots(x)`. 411 - Fix #1856: make the library robust against Object prototype pollution. 412 413 414 # 2020-05-07, version 7.0.0 415 416 Breaking changes: 417 418 - Improvements in calculation of the `dot` product of complex values. 419 The first argument is now conjugated. See #1761. Thanks @m93a. 420 - Dropped official support for Node.js v8 which has reached end of life. 421 - Removed all deprecation warnings introduced in v6. 422 To upgrade smoothly from v5 to v7 or higher, upgrade to v6 first 423 and resolve all deprecation warnings. 424 425 426 # 2020-05-04, version 6.6.5 427 428 - Fix #1834: value `Infinity` cannot be serialized and deserialized. 429 This is solved now with a new `math.replacer` function used as 430 `JSON.stringify(value, math.replacer)`. 431 - Fix #1842: value `Infinity` not turned into the latex symbol `\\infty`. 432 433 434 # 2020-04-15, version 6.6.4 435 436 - Fix published files containing Windows line endings (CRLF instead of LF). 437 438 439 # 2020-04-10, version 6.6.3 440 441 - Fix #1813: bug in engineering notation for numbers of function `format`, 442 sometimes resulting in needless trailing zeros. 443 - Fix #1808: methods `.toNumber()` and `.toNumeric()` not working on a 444 unitless unit. 445 - Fix #1645: not being able to use named operators `mod`, `and`, `not`, `or`, 446 `xor`, `to`, `in` as object keys. Thanks @Veeloxfire. 447 - Fix `eigs` not using `config.epsilon`. 448 449 450 # 2020-03-29, version 6.6.2 451 452 - Fix #1789: Function `eigs` not calculating with BigNumber precision 453 when input contains BigNumbers. 454 - Run the build script during npm `prepare`, so you can use the library 455 directly when installing directly from git. See #1751. Thanks @cinderblock. 456 457 458 # 2020-02-26, version 6.6.1 459 460 - Fix #1725: simplify `a/(b/c)`. Thanks @dbramwell. 461 - Fix examples in documentation of `row` and `column`. 462 463 464 # 2020-02-01, version 6.6.0 465 466 - Implemented function `eigs`, see #1705, #542 #1175. Thanks @arkajitmandal. 467 - Fixed #1727: validate matrix size when creating a `DenseMatrix` using 468 `fromJSON`. 469 - Fixed `DenseMatrix.map` copying the size and datatype from the original 470 matrix instead of checking the returned dimensions and type of the callback. 471 - Add a caret to dependencies (like) `^1.2.3`) to allow downstream updates 472 without having to await a new release of mathjs. 473 474 475 # 2020-01-08, version 6.5.0 476 477 - Implemented `baseName` option for `createUnit`, see #1707. 478 Thanks @ericman314. 479 480 481 # 2020-01-06, version 6.4.0 482 483 - Extended function `dimension` with support for n-dimensional points. 484 Thanks @Veeloxfire. 485 486 487 # 2019-12-31, version 6.3.0 488 489 - Improved performance of `factorial` for `BigNumber` up to a factor two, 490 see #1687. Thanks @kmdrGroch. 491 492 493 # 2019-11-20, version 6.2.5 494 495 - Fixed `IndexNode` using a hardcoded, one-based implementation of `index`, 496 making it impossible to instantiate a zero-based version of the expression 497 parser. See #782. 498 499 500 # 2019-11-20, version 6.2.4 501 502 - Fixed #1669: function 'qr' threw an error if the pivot was zero, 503 thanks @kevinkelleher12 and @harrysarson. 504 - Resolves #942: remove misleading assert in 'qr'. Thanks @harrysarson. 505 - Work around a bug in complex.js where `sign(0)` returns complex NaN. 506 Thanks @harrysarson. 507 508 509 # 2019-10-06, version 6.2.3 510 511 - Fixed #1640: function `mean` not working for units. Thanks @clintonc. 512 - Fixed #1639: function `min` listed twice in the "See also" section of the 513 embedded docs of function `std`. 514 - Improved performance of `isPrime`, see #1641. Thanks @arguiot. 515 516 517 # 2019-09-23, version 6.2.2 518 519 - Fixed methods `map` and `clone` not copying the `dotNotation` property of 520 `IndexNode`. Thanks @rianmcguire. 521 - Fixed a typo in the documentation of `toHTML`. Thanks @maytanthegeek. 522 - Fixed #1615: error in the docs of `isNumeric`. 523 - Fixed #1628: Cannot call methods on empty strings or numbers with value `0`. 524 525 526 # 2019-08-31, version 6.2.1 527 528 - Fixed #1606: function `format` not working for expressions. 529 530 531 # 2019-08-28, version 6.2.0 532 533 - Improved performance of `combinationsWithRep`. Thanks @waseemyusuf. 534 - Add unit aliases `bit` and `byte`. 535 - Fix docs referring to `bit` and `byte` instead of `bits` and `bytes`. 536 - Updated dependency `typed-function@1.1.1`. 537 538 539 # 2019-08-17, version 6.1.0 540 541 - Implemented function `combinationsWithRep` (see #1329). Thanks @waseemyusuf. 542 543 544 # 2019-08-05, version 6.0.4 545 546 - Fixed #1554, #1565: ES Modules where not transpiled to ES5, giving issues on 547 old browsers. Thanks @mockdeep for helping to find a solution. 548 549 550 # 2019-07-07, version 6.0.3 551 552 - Add `unpkg` and `jsdelivr` fields in package.json pointing to UMD build. 553 Thanks @tmcw. 554 - Fix #1550: nested user defined function not receiving variables of an 555 outer user defined function. 556 557 558 # 2019-06-11, version 6.0.2 559 560 - Fix not being able to set configuration after disabling function `import` 561 (regression since v6.0.0). 562 563 564 # 2019-06-09, version 6.0.1 565 566 - Fix function reference not published in npm library. 567 - Fix function `evaluate` and `parse` missing in generated docs. 568 569 570 # 2019-06-08, version 6.0.0 571 572 !!! BE CAREFUL: BREAKING CHANGES !!! 573 574 ### Most notable changes 575 576 1. Full support for **ES modules**. Support for tree-shaking out of the box. 577 578 Load all functions: 579 580 ```js 581 import * as math from 'mathjs' 582 ``` 583 584 Use a few functions: 585 586 ```js 587 import { add, multiply } from 'mathjs' 588 ``` 589 590 Load all functions with custom configuration: 591 592 ```js 593 import { create, all } from 'mathjs' 594 const config = { number: 'BigNumber' } 595 const math = create(all, config) 596 ``` 597 598 Load a few functions with custom configuration: 599 600 ```js 601 import { create, addDependencies, multiplyDependencies } from 'mathjs' 602 const config = { number: 'BigNumber' } 603 const { add, multiply } = create({ 604 addDependencies, 605 multiplyDependencies 606 }, config) 607 ``` 608 609 2. Support for **lightweight, number-only** implementations of all functions: 610 611 ``` 612 import { add, multiply } from 'mathjs/number' 613 ``` 614 615 3. New **dependency injection** solution used under the hood. 616 617 618 ### Breaking changes 619 620 - Node 6 is no longer supported. 621 622 - Functions `config` and `import` are not available anymore in the global 623 context: 624 625 ```js 626 // v5 627 import * as mathjs from 'mathjs' 628 mathjs.config(...) // error in v6.0.0 629 mathjs.import(...) // error in v6.0.0 630 ``` 631 632 Instead, create your own mathjs instance and pass config and imports 633 there: 634 635 ```js 636 // v6 637 import { create, all } from 'mathjs' 638 const config = { number: 'BigNumber' } 639 const mathjs = create(all, config) 640 mathjs.import(...) 641 ``` 642 643 - Renamed function `typeof` to `typeOf`, `var` to `variance`, 644 and `eval` to `evaluate`. (the old function names are reserved keywords 645 which can not be used as a variable name). 646 - Deprecated the `Matrix.storage` function. Use `math.matrix` instead to create 647 a matrix. 648 - Deprecated function `math.expression.parse`, use `math.parse` instead. 649 Was used before for example to customize supported characters by replacing 650 `math.parse.isAlpha`. 651 - Moved all classes like `math.type.Unit` and `math.expression.Parser` to 652 `math.Unit` and `math.Parser` respectively. 653 - Fixed #1428: transform iterating over replaced nodes. New behavior 654 is that it stops iterating when a node is replaced. 655 - Dropped support for renaming factory functions when importing them. 656 - Dropped fake BigNumber support of function `erf`. 657 - Removed all index.js files used to load specific functions instead of all, like: 658 659 ``` 660 // v5 661 // ... set up empty instance of mathjs, then load a set of functions: 662 math.import(require('mathjs/lib/function/arithmetic')) 663 ``` 664 665 Individual functions are now loaded simply like: 666 667 ```js 668 // v6 669 import { add, multiply } from 'mathjs' 670 ``` 671 672 To set a specific configuration on the functions: 673 674 ```js 675 // v6 676 import { create, addDependencies, multiplyDependencies } from 'mathjs' 677 const config = { number: 'BigNumber' } 678 const math = create({ addDependencies, multiplyDependencies }, config) 679 ``` 680 681 See example `advanced/custom_loading.js`. 682 683 - Updated the values of all physical units to their latest official values. 684 See #1529. Thanks @ericman314. 685 686 ### Non breaking changes 687 688 - Implemented units `t`, `tonne`, `bel`, `decibel`, `dB`, and prefixes 689 for `candela`. Thanks @mcvladthegoat. 690 - Fixed `epsilon` setting being applied globally to Complex numbers. 691 - Fix `math.simplify('add(2, 3)')` throwing an error. 692 - Fix #1530: number formatting first applied `lowerExp` and `upperExp` 693 and after that rounded the value instead of the other way around. 694 - Fix #1473: remove `'use strict'` in every file, not needed anymore. 695 696 697 # 2019-05-18, version 5.10.3 698 699 - Fixed dependency `del` being a dependency instead of devDependency. 700 701 702 # 2019-05-18, version 5.10.2 703 704 - Fix #1515, #1516, #1517: broken package due to a naming conflict in 705 the build folder of a util file `typeOf.js` and `typeof.js`. 706 Solved by properly cleaning all build folders before building. 707 708 709 # 2019-05-17, version 5.10.1 710 711 - Fix #1512: format using notation `engineering` can give wrong results 712 when the value has less significant digits than the number of digits in 713 the output. 714 715 716 # 2019-05-08, version 5.10.0 717 718 - Fix `lib/header.js` not having filled in date and version. Thanks @kevjin. 719 - Upgraded dependency `decimal.js@10.2.0`, fixing an issue on node.js 12. 720 721 722 # 2019-04-08, version 5.9.0 723 724 - Implemented functions `row` and `column` (see #1413). Thanks @SzechuanSage. 725 - Fixed #1459: `engineering` notation of function `format` not available 726 for `BigNumber`. 727 - Fixed #1465: `node.toHTML()` not correct for unary operators like 728 `factorial`. 729 730 731 # 2019-03-20, version 5.8.0 732 733 - Implemented new function `apply`. Thanks @bnlcas. 734 - Implemented passing an optional `dimension` argument to `std` and `var`. 735 Thanks @bnlcas. 736 737 738 # 2019-03-10, version 5.7.0 739 740 - Implemented support for `pow()` in `derivative`. Thanks @sam-19. 741 - Gracefully handle round-off errors in fix, ceil, floor, and range 742 (Fixes #1429, see also #1434, #1432). Thanks @ericman314. 743 744 745 # 2019-03-02, version 5.6.0 746 747 - Upgrade decimal.js to v10.1.1 (#1421). 748 - Fixed #1418: missing whitespace when stringifying an expression 749 containing "not". 750 751 752 # 2019-02-20, version 5.5.0 753 754 - Fixed #1401: methods `map` and `forEach` of `SparseMatrix` not working 755 correctly when indexes are unordered. 756 - Fixed #1404: inconsistent rounding of negative numbers. 757 - Upgrade tiny-emitter to v2.1.0 (#1397). 758 759 760 # 2019-01-25, version 5.4.2 761 762 - Fixed `math.format` not working for BigNumbers with a precision above 763 1025 digits (see #1385). Thanks @ericman314. 764 - Fixed incorrect LaTeX output of `RelationalNode`. Thanks @rianmcguire. 765 - Fixed a bug the methods `map`, `forEach`, `traverse`, and `transform` 766 of `FunctionNode`. 767 768 769 # 2019-01-10, version 5.4.1 770 771 - Fix #1378: negative bignumbers not formatted correctly. 772 - Upgrade fraction.js to version 4.0.12 (#1369). 773 774 775 # 2018-12-09, version 5.4.0 776 777 - Extended sum.js to accept a dimension input to calculate the sum over a 778 specific axis. Thanks @bnlcas. 779 - Fix #1328: objects can't be written multi-line. Thanks @GHolk. 780 - Remove side effects caused by `Unit.format` and `Unit.toString`, 781 making changes to the unit on execution. Thanks @ericman314. 782 783 784 # 2018-12-03, version 5.3.1 785 786 - Fixed #1336: Unit.toSI() returning units with prefix like `mm` instead 787 of `m`. Thanks @ericman314. 788 789 790 # 2018-11-29, version 5.3.0 791 792 - Implemented function `hasNumericValue`. Thanks @Sathish-kumar-Subramani. 793 - Fix #1326: non-ascii character in print.js. 794 - Fix #1337: `math.format` not working correctly with `{ precision: 0 }`. 795 Thanks @dkenul. 796 797 798 # 2018-10-30, version 5.2.3 799 800 - Fixed #1293: non-unicode characters in `escape-latex` giving issues in some 801 specific cases. Thanks @dangmai. 802 - Fixed incorrect LaTeX output of function `bitNot`, see #1299. Thanks @FSMaxB. 803 - Fixed #1304: function `pow` not supporting inputs `pow(Unit, BigNumber)`. 804 - Upgraded dependencies (`escape-latex@1.2.0`) 805 806 807 # 2018-10-23, version 5.2.2 808 809 - Fixed #1286: Fixed unit base recognition and formatting for 810 user-defined units. Thanks @ericman314. 811 812 813 # 2018-10-18, version 5.2.1 814 815 - Fixed unit `rod` being defined as `5.02921` instead of `5.0292`. 816 Thanks @ericman314. 817 - Upgraded dependencies (`fraction.js@4.0.10`) 818 - Upgraded devDependencies (`@babel/core@7.1.2`, `nyc@13.1.0`, 819 `webpack@4.21.0`). 820 821 822 # 2018-10-05, version 5.2.0 823 824 - Implemented support for chained conditionals like `10 < x <= 50`. 825 Thanks @ericman314. 826 - Add an example showing a proof of concept of using `BigInt` in mathjs. 827 - Fixed #1269: Bugfix for BigNumber divided by unit. Thanks @ericman314. 828 - Fixed #1240: allow units having just a value and no unit. 829 Thanks @ericman314. 830 831 832 ## 2018-09-09, version 5.1.2 833 834 - Fixed a typo in the docs of `parse`. Thanks @mathiasvr. 835 - Fixed #1222: a typo in the docs of `subset`. 836 - Fixed #1236: `quantileSeq` has inconsistent return. 837 - Fixed #1237: norm sometimes returning a complex number instead of 838 number. 839 - Upgraded dependencies (`fraction.js@4.0.9`) 840 - Upgraded devDependencies (`babel@7`, `karma-webpack@3.0.4`, 841 `nyc@13.0.1`, `standard@12.0.0`, `uglify-js@3.4.9`, `webpack@4.17.2`) 842 843 844 ## 2018-08-21, version 5.1.1 845 846 - Function `isNumeric` now recognizes more types. 847 - Fixed #1214: functions `sqrt`, `max`, `min`, `var`, `std`, `mode`, `mad`, 848 `median`, and `partitionSelect` not neatly handling `NaN` inputs. In some 849 cases (`median`, `mad`, and `partitionSelect`) this resulted in an infinite 850 loop. 851 - Upgraded dependencies (`escape-latex@1.1.1`) 852 - Upgraded devDependencies (`webpack@4.17.0`) 853 854 855 ## 2018-08-12, version 5.1.0 856 857 - Implemented support for strings enclosed in single quotes. 858 Thanks @jean-emmanuel. 859 - Implemented function `getMatrixDataType`. Thanks @JasonShin. 860 - Implemented new `options` argument in `simplify`. Thanks @paulobuchsbaum. 861 - Bug fixes in `rationalize`, see #1173. Thanks @paulobuchsbaum. 862 863 864 ## 2018-07-22, version 5.0.4 865 866 - Strongly improved the performance of functions `factorial` for numbers. 867 This improves performance of functions `gamma`, `permutation`, and 868 `combination` too. See #1170. Thanks @honeybar. 869 - Strongly improved the performance of function `reshape`, thanks to a 870 friend of @honeybar. 871 872 873 ## 2018-07-14, version 5.0.3 874 875 - Fixed many functions (for example `add` and `subtract`) not working 876 with matrices having a `datatype` defined. 877 - Fixed #1147: bug in `format` with `engineering` notation in outputting 878 the correct number of significant figures. Thanks @ericman314. 879 - Fixed #1162: transform functions not being cleaned up when overriding 880 it by importing a factory function with the same name. 881 - Fixed broken links in the documentation. Thanks @stropitek. 882 - Refactored the code of `parse` into a functional approach. 883 Thanks @harrysarson. 884 - Changed `decimal.js` import to ES6. Thanks @weinshel. 885 886 887 ## 2018-07-07, version 5.0.2 888 889 - Fixed #1136: rocket trajectory example broken (since v4.0.0). 890 - Fixed #1137: `simplify` unnecessarily replacing implicit multiplication with 891 explicit multiplication. 892 - Fixed #1146: `rationalize` throwing exceptions for some input with decimals. 893 Thanks @maruta. 894 - Fixed #1088: function arguments not being passed to `rawArgs` functions. 895 - Fixed advanced example `add_new_datatypes`. 896 - Fixed mathjs core constants not working without complex numbers. 897 Thanks @ChristopherChudzicki. 898 - Fixed a broken link in the documentation on units. Thanks @stropitek. 899 - Upgraded dependencies (`typed-function@1.0.4`, `complex.js@2.0.11`). 900 - Upgraded devDependencies (`babel-loader@7.1.5 `, `uglify-js@3.4.3`, 901 `expr-eval@1.2.2`, `webpack@4.15.1`). 902 903 904 ## 2018-07-01, version 5.0.1 905 906 - Improved error messaging when converting units. Thanks @gap777. 907 - Upgraded devDependencies (`kerma`, `uglify-js`, `webpack`). 908 909 910 ## 2018-06-16, version 5.0.0 911 912 !!! BE CAREFUL: BREAKING CHANGES !!! 913 914 - Implemented complex conjugate transpose `math.ctranspose`. See #1097. 915 Thanks @jackschmidt. 916 - Changed the behavior of `A'` (transpose) in the expression parser to 917 calculate the complex conjugate transpose. See #1097. Thanks @jackschmidt. 918 - Added support for `complex({abs: 1, arg: 1})`, and improved the docs on 919 complex numbers. Thanks @ssaket. 920 - Renamed `eye` to `identity`, see #1054. 921 - Math.js code can now contain ES6. The ES6 source code is moved from `lib` 922 to `src`, and `lib` now contains the compiled ES5 code. 923 - Upgraded dependencies: 924 - `decimal.js` from `9.0.1` to `10.0.1` 925 - Upgraded dev dependencies 926 - Changed code style to https://standardjs.com/, run linter on `npm test`. 927 See #1110. 928 - Dropped support for bower. Use npm or an other package manages instead. 929 - Dropped support for (non-primitive) instances of `Number`, `Boolean`, and 930 `String` from functions `clone` and `typeof`. 931 - Dropped official support for IE9 (probably still works, but it's not tested). 932 - Fixed #851: More consistent behavior of sqrt, nthRoot, and pow. 933 Thanks @dakotablair. 934 - Fixed #1103: Calling `toTex` on node that contains `derivative` causing 935 an exception. Thanks @joelhoover. 936 937 938 ## 2018-06-02, version 4.4.2 939 940 - Drastically improved the performance of `det`. Thanks @ericman314. 941 - Fixed #1065, #1121: Fixed wrong documentation of function 942 `compareNatural` and clarified the behavior for strings. 943 - Fixed #1122 a regression in function `inv` (since `v4.4.1`). 944 Thanks @ericman314. 945 946 947 ## 2018-05-29, version 4.4.1 948 949 - Fixed #1109: a bug in `inv` when dealing with values close to zero. 950 Thanks @ericman314. 951 952 953 ## 2018-05-28, version 4.4.0 954 955 - Implemented functions `equalText` and `compareText`. See #1085. 956 957 958 ## 2018-05-21, version 4.3.0 959 960 - Implemented matrix exponential `math.expm`. Thanks @ericman314. 961 - Fixed #1101: math.js bundle not working when loading in a WebWorker. 962 - Upgraded dependencies 963 - `complex.js` from `v2.0.2` to `v2.0.10`. 964 - `fraction.js` from `v4.0.4` to `v4.0.8`. 965 - Upgraded devDependencies (`mocha`, `uglify-js`, `webpack`). 966 967 968 ## 2018-05-05, version 4.2.2 969 970 - Fixed calculating the Frobenius norm of complex matrices correctly, 971 see #1098. Thanks @jackschmidt. 972 - Fixed #1076: cannot use mathjs in React VR by updating to 973 `escape-latex@1.0.3`. 974 975 976 ## 2018-05-02, version 4.2.1 977 978 - Fixed `dist/math.js` being minified. 979 980 981 ## 2018-05-02, version 4.2.0 982 983 - Implemented function `math.sqrtm`. Thanks @ferrolho. 984 - Implemented functions `math.log2`, `math.log1p`, and `math.expm1`. 985 Thanks @BigFav and @harrysarson. 986 - Fixed some unit tests broken on nodejs v10. 987 - Upgraded development dependencies. 988 - Dropped integration testing on nodejs v4. 989 990 991 ## 2018-04-18, version 4.1.2 992 993 - Fixed #1082: implemented support for unit plurals `decades`, `centuries`, 994 and `millennia`. 995 - Fixed #1083: units `decade` and `watt` having a wrong name when stringifying. 996 Thanks @ericman314. 997 998 999 ## 2018-04-11, version 4.1.1 1000 1001 - Fixed #1063: derivative not working when resolving a variable with unary 1002 minus like `math.derivative('-x', 'x')`. 1003 1004 1005 ## 2018-04-08, version 4.1.0 1006 1007 - Extended function `math.print` with support for arrays and matrices. 1008 Thanks @jean-emmanuel. 1009 - Fixed #1077: Serialization/deserialization to JSON with reviver not being 1010 supported by nodes. 1011 - Fixed #1016: Extended `math.typeof` with support for `ResultSet` and nodes 1012 like `SymbolNode`. 1013 - Fixed #1072: Added support for long and short prefixes for the unit `bar` 1014 (i.e. `millibar` and `mbar`). 1015 1016 1017 ## 2018-03-17, version 4.0.1 1018 1019 - Fixed #1062: mathjs not working on ES5 browsers like IE11 and Safari 9.3. 1020 - Fixed #1061: `math.unit` not accepting input like `1/s`. 1021 1022 1023 ## 2018-02-25, version 4.0.0 1024 1025 !!! BE CAREFUL: BREAKING CHANGES !!! 1026 1027 Breaking changes (see also #682): 1028 1029 - **New expression compiler** 1030 1031 The compiler of the expression parser is replaced with one that doesn't use 1032 `eval` internally. See #1019. This means: 1033 1034 - a slightly improved performance on most browsers. 1035 - less risk of security exploits. 1036 - the code of the new compiler is easier to understand, maintain, and debug. 1037 1038 Breaking change here: When using custom nodes in the expression parser, 1039 the syntax of `_compile` has changed. This is an undocumented feature though. 1040 1041 - **Parsed expressions** 1042 1043 - The class `ConstantNode` is changed such that it just holds a value 1044 instead of holding a stringified value and it's type. 1045 `ConstantNode(valueStr, valueType`) is now `ConstantNode(value)` 1046 Stringification uses `math.format`, which may result in differently 1047 formatted numeric output. 1048 1049 - The constants `true`, `false`, `null`, `undefined`, `NaN`, `Infinity`, 1050 and `uninitialized` are now parsed as ConstantNodes instead of 1051 SymbolNodes in the expression parser. See #833. 1052 1053 - **Implicit multiplication** 1054 1055 - Changed the behavior of implicit multiplication to have higher 1056 precedence than explicit multiplication and division, except in 1057 a number of specific cases. This gives a more natural behavior 1058 for implicit multiplications. For example `24h / 6h` now returns `4`, 1059 whilst `1/2 kg` evaluates to `0.5 kg`. Thanks @ericman314. See: #792. 1060 Detailed documentation: https://github.com/josdejong/mathjs/blob/v4/docs/expressions/syntax.md#implicit-multiplication. 1061 1062 - Immediately invoking a function returned by a function like `partialAdd(2)(3)` 1063 is no longer supported, instead these expressions are evaluated as 1064 an implicit multiplication `partialAdd(2) * (3)`. See #1035. 1065 1066 - **String formatting** 1067 1068 - In function `math.format`, the options `{exponential: {lower: number, upper: number}}` 1069 (where `lower` and `upper` are values) are replaced with `{lowerExp: number, upperExp: number}` 1070 (where `lowerExp` and `upperExp` are exponents). See #676. For example: 1071 ```js 1072 math.format(2000, {exponential: {lower: 1e-2, upper: 1e2}}) 1073 ``` 1074 is now: 1075 ```js 1076 math.format(2000, {lowerExp: -2, upperExp: 2}) 1077 ``` 1078 1079 - In function `math.format`, the option `notation: 'fixed'` no longer rounds to 1080 zero digits when no precision is specified: it leaves the digits as is. 1081 See #676. 1082 1083 - **String comparison** 1084 1085 Changed the behavior of relational functions (`compare`, `equal`, 1086 `equalScalar`, `larger`, `largerEq`, `smaller`, `smallerEq`, `unequal`) 1087 to compare strings by their numeric value they contain instead of 1088 alphabetically. This also impacts functions `deepEqual`, `sort`, `min`, 1089 `max`, `median`, and `partitionSelect`. Use `compareNatural` if you 1090 need to sort an array with text. See #680. 1091 1092 - **Angle units** 1093 1094 Changed `rad`, `deg`, and `grad` to have short prefixes, 1095 and introduced `radian`, `degree`, and `gradian` and their plurals 1096 having long prefixes. See #749. 1097 1098 - **Null** 1099 1100 - `null` is no longer implicitly casted to a number `0`, so input like 1101 `math.add(2, null)` is no longer supported. See #830, #353. 1102 1103 - Dropped constant `uninitialized`, which was used to initialize 1104 leave new entries undefined when resizing a matrix is removed. 1105 Use `undefined` instead to indicate entries that are not explicitly 1106 set. See #833. 1107 1108 - **New typed-function library** 1109 1110 - The `typed-function` library used to check the input types 1111 of functions is completely rewritten and doesn't use `eval` under 1112 the hood anymore. This means a reduced security risk, and easier 1113 to debug code. The API is the same, but error messages may differ 1114 a bit. Performance is comparable but may differ in specific 1115 use cases and browsers. 1116 1117 Non breaking changes: 1118 1119 - Thanks to the new expression compiler and `typed-function` implementation, 1120 mathjs doesn't use JavaScript's `eval` anymore under the hood. 1121 This allows using mathjs in environments with security restrictions. 1122 See #401. 1123 - Implemented additional methods `isUnary()` and `isBinary()` on 1124 `OperatorNode`. See #1025. 1125 - Improved error messages for statistical functions. 1126 - Upgraded devDependencies. 1127 - Fixed #1014: `derivative` silently dropping additional arguments 1128 from operator nodes with more than two arguments. 1129 1130 1131 ## 2018-02-07, version 3.20.2 1132 1133 - Upgraded to `typed-function@0.10.7` (bug-fix release). 1134 - Fixed option `implicit` not being copied from an `OperatorNode` 1135 when applying function `map`. Thanks @HarrySarson. 1136 - Fixed #995: spaces and underscores not property being escaped 1137 in `toTex()`. Thanks @FSMaxB. 1138 1139 1140 ## 2018-01-17, version 3.20.1 1141 1142 - Fixed #1018: `simplifyCore` failing in some cases with parentheses. 1143 Thanks @firepick1. 1144 1145 1146 ## 2018-01-14, version 3.20.0 1147 1148 - Implement support for 3 or more arguments for operators `+` and `*` in 1149 `derivative`. Thanks @HarrySarson. See #1002. 1150 - Fixed `simplify` evalution of `simplify` of functions with more than two 1151 arguments wrongly: `simplify('f(x, y, z)') evaluated to `f(f(x, y), z)` 1152 instead of `f(x, y, z)`. Thanks @joelhoover. 1153 - Fixed `simplify` throwing an error in some cases when simplifying unknown 1154 functions, for example `simplify('f(4)')`. Thanks @joelhoover. 1155 - Fixed #1013: `simplify` wrongly simplifing some expressions containing unary 1156 minus, like `0 - -x`. Thanks @joelhoover. 1157 - Fixed an error in an example in the documentation of `xor`. Thanks @denisx. 1158 1159 1160 ## 2018-01-06, version 3.19.0 1161 1162 - Extended functions `distance` and `intersect` with support for BigNumbers. 1163 Thanks @ovk. 1164 - Improvements in function `simplify`: added a rule that allows combining 1165 of like terms in embedded quantities. Thanks @joelhoover. 1166 1167 1168 ## 2017-12-28, version 3.18.1 1169 1170 - Fixed #998: An issue with simplifying an expression containing a subtraction. 1171 Thanks @firepick1. 1172 1173 1174 ## 2017-12-16, version 3.18.0 1175 1176 - Implemented function `rationalize`. Thanks @paulobuchsbaum. 1177 - Upgraded dependencies: 1178 ``` 1179 decimal.js 7.2.3 → 9.0.1 (no breaking changes affecting mathjs) 1180 fraction.js 4.0.2 → 4.0.4 1181 tiny-emitter 2.0.0 → 2.0.2 1182 ``` 1183 - Upgraded dev dependencies. 1184 - Fixed #975: a wrong example in the docs of lusolve. 1185 - Fixed #983: `pickRandom` returning an array instead of single value 1186 when input was an array with just one value. Clarified docs. 1187 - Fixed #969: preven issues with yarn autoclean by renaming an 1188 interally used folder "docs" to "embeddedDocs". 1189 1190 1191 ## 2017-11-18, version 3.17.0 1192 1193 - Improved `simplify` for nested exponentiations. Thanks @IvanVergiliev. 1194 - Fixed a security issue in `typed-function` allowing arbitrary code execution 1195 in the JavaScript engine by creating a typed function with JavaScript code 1196 in the name. Thanks Masato Kinugawa. 1197 - Fixed a security issue where forbidden properties like constructor could be 1198 replaced by using unicode characters when creating an object. No known exploit, 1199 but could possibly allow arbitrary code execution. Thanks Masato Kinugawa. 1200 1201 1202 ## 2017-10-18, version 3.16.5 1203 1204 - Fixed #954: Functions `add` and `multiply` not working when 1205 passing three or more arrays or matrices. 1206 1207 1208 ## 2017-10-01, version 3.16.4 1209 1210 - Fixed #948, #949: function `simplify` returning wrong results or 1211 running into an infinite recursive loop. Thanks @ericman314. 1212 - Fixed many small issues in the embedded docs. Thanks @Schnark. 1213 1214 1215 ## 2017-08-28, version 3.16.3 1216 1217 - Fixed #934: Wrong simplification of unary minus. Thanks @firepick1. 1218 - Fixed #933: function `simplify` reordering operations. Thanks @firepick1. 1219 - Fixed #930: function `isNaN` returning wrong result for complex 1220 numbers having just one of their parts (re/im) being `NaN`. 1221 - Fixed #929: `FibonacciHeap.isEmpty` returning wrong result. 1222 1223 1224 ## 2017-08-20, version 3.16.2 1225 1226 - Fixed #924: a regression in `simplify` not accepting the signature 1227 `simplify(expr, rules, scope)` anymore. Thanks @firepick1. 1228 - Fixed missing parenthesis when stringifying expressions containing 1229 implicit multiplications (see #922). Thanks @FSMaxB. 1230 1231 1232 ## 2017-08-12, version 3.16.1 1233 1234 - For security reasons, type checking is now done in a more strict 1235 way using functions like `isComplex(x)` instead of duck type checking 1236 like `x && x.isComplex === true`. 1237 - Fixed #915: No access to property "name". 1238 - Fixed #901: Simplify units when calling `unit.toNumeric()`. 1239 Thanks @AlexanderBeyn. 1240 - Fixed `toString` of a parsed expression tree containing an 1241 immediately invoked function assignment not being wrapped in 1242 parenthesis (for example `(f(x) = x^2)(4)`). 1243 1244 1245 ## 2017-08-06, version 3.16.0 1246 1247 - Significant performance improvements in `math.simplify`. 1248 Thanks @firepick1. 1249 - Improved API for `math.simplify`, optionally pass a scope with 1250 variables which are resolved, see #907. Thanks @firepick1. 1251 - Fixed #912: math.js didn't work on IE10 anymore (regression 1252 since 3.15.0). 1253 1254 1255 ## 2017-07-29, version 3.15.0 1256 1257 - Added support for the dollar character `$` in symbol names (see #895). 1258 - Allow objects with prototypes as scope again in the expression parser, 1259 this was disabled for security reasons some time ago. See #888, #899. 1260 Thanks @ThomasBrierley. 1261 - Fixed #846: Issues in the functions `map`, `forEach`, and `filter` 1262 when used in the expression parser: 1263 - Not being able to use a function assignment as inline expression 1264 for the callback function. 1265 - Not being able to pass an inline expression as callback for `map` 1266 and `forEach`. 1267 - Index and original array/matrix not passed in `map` and `filter`. 1268 1269 1270 ## 2017-07-05, version 3.14.2 1271 1272 - Upgraded to `fraction.js@4.0.2` 1273 - Fixed #891 using BigNumbers not working in browser environments. 1274 1275 1276 ## 2017-06-30, version 3.14.1 1277 1278 - Reverted to `fraction.js@4.0.0`, there is an issue with `4.0.1` 1279 in the browser. 1280 1281 1282 ## 2017-06-30, version 3.14.0 1283 1284 - Implemented set methods `setCartesian`, `setDifference`, 1285 `setDistinct`, `setIntersect`, `setIsSubset`, `setPowerset`, 1286 `setSize`. Thanks @Nekomajin42. 1287 - Implemented method `toHTML` on nodes. Thanks @Nekomajin42. 1288 - Implemented `compareNatural` and `sort([...], 'natural')`. 1289 - Upgraded dependencies to the latest versions: 1290 - `complex.js@2.0.4` 1291 - `decimal.js@7.2.3` 1292 - `fraction.js@4.0.1` 1293 - `tiny-emitter@2.0.0` 1294 - And all devDependencies. 1295 - Fixed #865: `splitUnit` can now deal with round-off errors. 1296 Thanks @ericman314. 1297 - Fixed #876: incorrect definition for unit `erg`. Thanks @pjhampton. 1298 - More informative error message when using single quotes instead of 1299 double quotes around a string. Thanks @HarrySarson. 1300 1301 1302 ## 2017-05-27, version 3.13.3 1303 1304 - Fixed a bug in function `intersection` of line and plane. 1305 Thanks @viclai. 1306 - Fixed security vulnerabilities. 1307 1308 1309 ## 2017-05-26, version 3.13.2 1310 1311 - Disabled function `chain` inside the expression parser for security 1312 reasons (it's not needed there anyway). 1313 - Fixed #856: function `subset` not returning non-primitive scalars 1314 from Arrays correctly. (like `math.eval('arr[1]', {arr: [math.bignumber(2)]})`. 1315 - Fixed #861: physical constants not available in the expression parser. 1316 1317 1318 ## 2017-05-12, version 3.13.1 1319 1320 - Fixed creating units with an alias not working within the expression 1321 parser. 1322 - Fixed security vulnerabilities. Thanks Sam. 1323 1324 1325 ## 2017-05-12, version 3.13.0 1326 1327 - Command line application can now evaluate inline expressions 1328 like `mathjs 1+2`. Thanks @slavaGanzin. 1329 - Function `derivative` now supports `abs`. Thanks @tetslee. 1330 - Function `simplify` now supports BigNumbers. Thanks @tetslee. 1331 - Prevent against endless loops in `simplify`. Thanks @tetslee. 1332 - Fixed #813: function `simplify` converting small numbers to inexact 1333 Fractions. Thanks @tetslee. 1334 - Fixed #838: Function `simplify` now supports constants like `e`. 1335 Thanks @tetslee. 1336 1337 1338 ## 2017-05-05, version 3.12.3 1339 1340 - Fixed security vulnerabilities. Thanks Dan and Sam. 1341 1342 1343 ## 2017-04-30, version 3.12.2 1344 1345 - Added a rocket trajectory optimization example. 1346 1347 1348 ## 2017-04-24, version 3.12.1 1349 1350 - Fixed #804 1351 - Improved handling of powers of `Infinity`. Thanks @HarrySarson. 1352 - Fixed wrong formatting of complex NaN. 1353 - Fixed security vulnerabilities in the expression parser. 1354 Thanks Sam and Dan. 1355 1356 1357 ## 2017-04-17, version 3.12.0 1358 1359 - Implemented QR decomposition, function `math.qr`. Thanks @HarrySarson. 1360 - Fixed #824: Calling `math.random()` freezes IE and node.js. 1361 1362 1363 ## 2017-04-08, version 3.11.5 1364 1365 - More security measures in the expression parser. 1366 WARNING: the behavior of the expression parser is now more strict, 1367 some undocumented features may not work any longer. 1368 - Accessing and assigning properties is now only allowed on plain 1369 objects, not on classes, arrays, and functions anymore. 1370 - Accessing methods is restricted to a set of known, safe methods. 1371 1372 1373 ## 2017-04-03, version 3.11.4 1374 1375 - Fixed a security vulnerability in the expression parser. Thanks @xfix. 1376 1377 1378 ## 2017-04-03, version 3.11.3 1379 1380 - Fixed a security vulnerability in the expression parser. Thanks @xfix. 1381 1382 1383 ## 2017-04-03, version 3.11.2 1384 1385 - Fixed a security vulnerability in the expression parser. Thanks @xfix. 1386 1387 1388 ## 2017-04-02, version 3.11.1 1389 1390 - Fixed security vulnerabilities in the expression parser. 1391 Thanks Joe Vennix and @xfix. 1392 1393 1394 ## 2017-04-02, version 3.11.0 1395 1396 - Implemented method Unit.toSI() to convert a unit to base SI units. 1397 Thanks @ericman314. 1398 - Fixed #821, #822: security vulnerabilities in the expression parser. 1399 Thanks @comex and @xfix. 1400 1401 1402 ## 2017-03-31, version 3.10.3 1403 1404 - More security fixes related to the ones fixed in `v3.10.2`. 1405 1406 1407 ## 2017-03-31, version 3.10.2 1408 1409 - Fixed a security vulnerability in the expression parser allowing 1410 execution of arbitrary JavaScript. Thanks @CapacitorSet and @denvit. 1411 1412 1413 ## 2017-03-26, version 3.10.1 1414 1415 - Fixed `xgcd` for negative values. Thanks @litmit. 1416 - Fixed #807: function transform of existing functions not being removed when 1417 overriding such a function. 1418 1419 1420 ## 2017-03-05, version 3.10.0 1421 1422 - Implemented function `reshape`. Thanks @patgrasso and @ericman314. 1423 - Implemented configuration option `seedRandom` for deterministic random 1424 numbers. Thanks @morsecodist. 1425 - Small fixes in the docs. Thanks @HarrySarson. 1426 - Dropped support for component package manager (which became deprecated about 1427 one and a half year ago). 1428 1429 1430 ## 2017-02-22, version 3.9.3 1431 1432 - Fixed #797: issue with production builds of React Native projects. 1433 - Fixed `math.round` not accepting inputs `NaN`, `Infinity`, `-Infinity`. 1434 - Upgraded all dependencies. 1435 1436 1437 ## 2017-02-16, version 3.9.2 1438 1439 - Fixed #795: Parse error in case of a multi-line expression with just comments. 1440 1441 1442 ## 2017-02-06, version 3.9.1 1443 1444 - Fixed #789: Math.js not supporting conversion of `string` to `BigNumber`, 1445 `Fraction`, or `Complex` number. 1446 - Fixed #790: Expression parser did not pass function arguments of enclosing 1447 functions via `scope` to functions having `rawArgs = true`. 1448 - Small fixes in the docs. Thanks @HarrySarson. 1449 1450 1451 ## 2017-01-23, version 3.9.0 1452 1453 - Implemented support for algebra: powerful new functions `simplify` and 1454 `derivative`. Thanks @ericman314, @tetslee, and @BigFav. 1455 - Implemented Kronecker Product `kron`. Thanks @adamisntdead. 1456 - Reverted `FunctionNode` not accepting a string as function name anymore. 1457 - Fixed #765: `FunctionAssignmentNode.toString()` returning a string 1458 incompatible with the function assignment syntax. 1459 1460 1461 ## 2016-12-15, version 3.8.1 1462 1463 - Implemented function `mad` (median absolute deviation). Thanks @ruhleder. 1464 - Fixed #762: expression parser failing to invoke a function returned 1465 by a function. 1466 1467 1468 ## 2016-11-18, version 3.8.0 1469 1470 - Functions `add` and `multiply` now accept more than two arguments. See #739. 1471 - `OperatorNode` now supports more than two arguments. See #739. Thanks @FSMaxB. 1472 - Implemented a method `Node.cloneDeep` for the expression nodes. See #745. 1473 - Fixed a bug in `Node.clone()` not cloning implicit multiplication correctly. 1474 Thanks @FSMaxB. 1475 - Fixed #737: Improved algorithm determining the best prefix for units. 1476 It will now retain the original unit like `1 cm` when close enough, 1477 instead of returning `10 mm`. Thanks @ericman314. 1478 - Fixed #732: Allow letter-like unicode characters like Ohm `\u2126`. 1479 - Fixed #749: Units `rad`, `deg`, and `grad` can now have prefixes like `millirad`. 1480 - Some fixes in the docs and comments of examples. Thanks @HarrySarson. 1481 1482 1483 ## 2016-11-05, version 3.7.0 1484 1485 - Implemented method `Node.equals(other)` for all nodes of the expression parser. 1486 - Implemented BigNumber support in function `arg()`. 1487 - Command Line Interface loads faster. 1488 - Implicit conversions between Fractions and BigNumbers throw a neat error now 1489 (See #710). 1490 1491 1492 ## 2016-10-21, version 3.6.0 1493 1494 - Implemented function `erf()`. THanks @patgrasso. 1495 - Extended function `cross()` to support n-d vectors. Thanks @patgrasso. 1496 - Extended function `pickRandom` with the option to pick multiple values from 1497 an array and give the values weights: `pickRandom(possibles, number, weights)`. 1498 Thanks @woylie. 1499 - Parser now exposes test functions like `isAlpha` which can be replaced in 1500 order to adjust the allowed characters in variables names (See #715). 1501 - Fixed #727: Parser not throwing an error for invalid implicit multiplications 1502 like `-2 2` and `2^3 4` (right after the second value of an operator). 1503 - Fixed #688: Describe allowed variable names in the docs. 1504 1505 1506 ## 2016-09-21, version 3.5.3 1507 1508 - Some more fixes regarding numbers ending with a decimal mark (like `2.`). 1509 1510 1511 ## 2016-09-20, version 3.5.2 1512 1513 - Fixed numbers ending with a decimal mark (like `2.`) not being supported by 1514 the parser, solved the underlying ambiguity in the parser. See #707, #711. 1515 1516 1517 ## 2016-09-12, version 3.5.1 1518 1519 - Removed a left over console.log statement. Thanks @eknkc. 1520 1521 1522 ## 2016-09-07, version 3.5.0 1523 1524 - Comments of expressions are are now stored in the parsed nodes. See #690. 1525 - Fixed function `print` not accepting an Object with formatting options as 1526 third parameter Thanks @ThomasBrierley. 1527 - Fixed #707: The expression parser no longer accepts numbers ending with a dot 1528 like `2.`. 1529 1530 1531 ## 2016-08-08, version 3.4.1 1532 1533 - Fixed broken bundle files (`dist/math.js`, `dist/math.min.js`). 1534 - Fixed some layout issues in the function reference docs. 1535 1536 1537 ## 2016-08-07, version 3.4.0 1538 1539 - Implemented support for custom units using `createUnit`. Thanks @ericman314. 1540 - Implemented function `splitUnits`. Thanks @ericman314. 1541 - Implemented function `isPrime`. Thanks @MathBunny. 1542 1543 1544 ## 2016-07-05, version 3.3.0 1545 1546 - Implemented function `isNaN`. 1547 - Function `math.filter` now passes three arguments to the callback function: 1548 value, index, and array. 1549 - Removed the check on the number of arguments from functions defined in the 1550 expression parser (see #665). 1551 - Fixed #665: functions `map`, `forEach`, and `filter` now invoke callbacks 1552 which are a typed-function with the correct number of arguments. 1553 1554 1555 ## 2016-04-26, version 3.2.1 1556 1557 - Fixed #651: unable to perform calculations on "Unit-less" units. 1558 - Fixed matrix.subset mutating the replacement matrix when unsqueezing it. 1559 1560 1561 ## 2016-04-16, version 3.2.0 1562 1563 - Implemented #644: method `Parser.getAll()` to retrieve all defined variables. 1564 - Upgraded dependencies (decimal.js@5.0.8, fraction.js@3.3.1, 1565 typed-function@0.10.4). 1566 - Fixed #601: Issue with unnamed typed-functions by upgrading to 1567 typed-function v0.10.4. 1568 - Fixed #636: More strict `toTex` templates, reckon with number of arguments. 1569 - Fixed #641: Bug in expression parser parsing implicit multiplication with 1570 wrong precedence in specific cases. 1571 - Fixed #645: Added documentation about `engineering` notation of function 1572 `math.format`. 1573 1574 1575 ## 2016-04-03, version 3.1.4 1576 1577 - Using ES6 Math functions like `Math.sinh`, `Math.cbrt`, `Math.sign`, etc when 1578 available. 1579 - Fixed #631: unit aliases `weeks`, `months`, and `years` where missing. 1580 - Fixed #632: problem with escaped backslashes at the end of strings. 1581 - Fixed #635: `Node.toString` options where not passed to function arguments. 1582 - Fixed #629: expression parser throws an error when passing a number with 1583 decimal exponent instead of parsing them as implicit multiplication. 1584 - Fixed #484, #555: inaccuracy of `math.sinh` for values between -1 and 1. 1585 - Fixed #625: Unit `in` (`inch`) not always working due to ambiguity with 1586 the operator `a in b` (alias of `a to b`). 1587 1588 1589 ## 2016-03-24, version 3.1.3 1590 1591 - Fix broken bundle. 1592 1593 1594 ## 2016-03-24, version 3.1.2 1595 1596 - Fix broken npm release. 1597 1598 1599 ## 2016-03-24, version 3.1.1 1600 1601 - Fixed #621: a bug in parsing implicit multiplications like `(2)(3)+4`. 1602 - Fixed #623: `nthRoot` of zero with a negative root returned `0` instead of 1603 `Infinity`. 1604 - Throw an error when functions `min`, `max`, `mean`, or `median` are invoked 1605 with multiple matrices as arguments (see #598). 1606 1607 1608 ## 2016-03-19, version 3.1.0 1609 1610 - Hide multiplication operator by default when outputting `toTex` and `toString` 1611 for implicit multiplications. Implemented and option to output the operator. 1612 - Implemented unit `kip` and alias `kips`. Thanks @hgupta9. 1613 - Added support for prefixes for units `mol` and `mole`. Thanks @stu-blair. 1614 - Restored support for implicit multiplications like `2(3+4)` and `(2+3)(4+5)`. 1615 - Some improvements in the docs. 1616 - Added automatic conversions from `boolean` and `null` to `Fraction`, 1617 and conversions from `Fraction` to `Complex`. 1618 1619 1620 ## 2016-03-04, version 3.0.0 1621 1622 ### breaking changes 1623 1624 - More restricted support for implicit multiplication in the expression 1625 parser: `(...)(...)` is now evaluated as a function invocation, 1626 and `[...][...]` as a matrix subset. 1627 - Matrix multiplication no longer squeezes scalar outputs to a scalar value, 1628 but leaves them as they are: a vector or matrix containing a single value. 1629 See #529. 1630 - Assignments in the expression parser now return the assigned value rather 1631 than the created or updated object (see #533). Example: 1632 1633 ``` 1634 A = eye(3) 1635 A[1,1] = 2 # this assignment now returns 2 instead of A 1636 ``` 1637 1638 - Expression parser now supports objects. This involves a refactoring and 1639 extension in expression nodes: 1640 - Implemented new node `ObjectNode`. 1641 - Refactored `AssignmentNode`, `UpdateNode`, and `IndexNode` are refactored 1642 into `AccessorNode`, `AssignmentNode`, and `IndexNode` having a different API. 1643 - Upgraded the used BigNumber library `decimal.js` to v5. Replaced the 1644 trigonometric functions of math.js with those provided in decimal.js v5. 1645 This can give slightly different behavior qua round-off errors. 1646 - Replaced the internal `Complex.js` class with the `complex.js` library 1647 created by @infusion. 1648 - Entries in a matrix (typically numbers, BigNumbers, Units, etc) are now 1649 considered immutable, they are no longer copied when performing operations on 1650 the entries, improving performance. 1651 - Implemented nearly equal comparison for relational functions (`equal`, 1652 `larger`, `smaller`, etc.) when using BigNumbers. 1653 - Changed the casing of the configuration options `matrix` (`Array` or `Matrix`) 1654 and `number` (`number`, `BigNumber`, `Fraction`) such that they now match 1655 the type returned by `math.typeof`. Wrong casing gives a console warning but 1656 will still work. 1657 - Changed the default config value for `epsilon` from `1e-14` to `1e-12`, 1658 see #561. 1659 1660 ### non-breaking changes 1661 1662 - Extended function `pow` to return the real root for cubic roots of negative 1663 numbers. See #525, #482, #567. 1664 - Implemented support for JSON objects in the expression parser and the 1665 function `math.format`. 1666 - Function `math.fraction` now supports `BigNumber`, and function 1667 `math.bignumber` now supports `Fraction`. 1668 - Expression parser now allows function and/or variable assignments inside 1669 accessors and conditionals, like `A[x=2]` or `a > 2 ? b="ok" : b="fail"`. 1670 - Command line interface: 1671 - Outputs the variable name of assignments. 1672 - Fixed not rounding BigNumbers to 14 digits like numbers. 1673 - Fixed non-working autocompletion of user defined variables. 1674 - Reorganized and extended docs, added docs on classes and more. Thanks @hgupta9. 1675 - Added new units `acre`, `hectare`, `torr`, `bar`, `mmHg`, `mmH2O`, `cmH2O`, 1676 and added new aliases `acres`, `hectares`, `sqfeet`, `sqyard`, `sqmile`, 1677 `sqmiles`, `mmhg`, `mmh2o`, `cmh2o`. Thanks @hgupta9. 1678 - Fixed a bug in the toString method of an IndexNode. 1679 - Fixed angle units `deg`, `rad`, `grad`, `cycle`, `arcsec`, and `arcmin` not 1680 being defined as BigNumbers when configuring to use BigNumbers. 1681 1682 1683 ## 2016-02-03, version 2.7.0 1684 1685 - Added more unit aliases for time: `secs`, `mins`, `hr`, `hrs`. See #551. 1686 - Added support for doing operations with mixed `Fractions` and `BigNumbers`. 1687 - Fixed #540: `math.intersect()` returning null in some cases. Thanks @void42. 1688 - Fixed #546: Cannot import BigNumber, Fraction, Matrix, Array. 1689 Thanks @brettjurgens. 1690 1691 1692 ## 2016-01-08, version 2.6.0 1693 1694 - Implemented (complex) units `VA` and `VAR`. 1695 - Implemented time units for weeks, months, years, decades, centuries, and 1696 millennia. Thanks @owenversteeg. 1697 - Implemented new notation `engineering` in function `math.format`. 1698 Thanks @johnmarinelli. 1699 - Fixed #523: In some circumstances, matrix subset returned a scalar instead 1700 of the correct subset. 1701 - Fixed #536: A bug in an internal method used for sparse matrices. 1702 1703 1704 ## 2015-12-05, version 2.5.0 1705 1706 - Implemented support for numeric types `Fraction` and `BigNumber` in units. 1707 - Implemented new method `toNumeric` for units. 1708 - Implemented new units `arcsec`, `arcsecond`, `arcmin`, `arcminute`. 1709 Thanks @devdevdata222. 1710 - Implemented new unit `Herts` (`Hz`). Thanks @SwamWithTurtles. 1711 - Fixed #485: Scoping issue with variables both used globally as well as in a 1712 function definition. 1713 - Fixed: Function `number` didn't support `Fraction` as input. 1714 1715 1716 ## 2015-11-14, version 2.4.2 1717 1718 - Fixed #502: Issue with `format` in some JavaScript engines. 1719 - Fixed #503: Removed trailing commas and the use of keyword `import` as 1720 property, as this gives issues with old JavaScript engines. 1721 1722 1723 ## 2015-10-29, version 2.4.1 1724 1725 - Fixed #480: `nthRoot` not working on Internet Explorer (up to IE 11). 1726 - Fixed #490: `nthRoot` returning an error for negative values like 1727 `nthRoot(-2, 3)`. 1728 - Fixed #489: an issue with initializing a sparse matrix without data. 1729 Thanks @Retsam. 1730 - Fixed: #493: function `combinations` did not throw an exception for 1731 non-integer values of `k`. 1732 - Fixed: function `import` did not override typed functions when the option 1733 override was set true. 1734 - Fixed: added functions `math.sparse` and `math.index` to the reference docs, 1735 they where missing. 1736 - Fixed: removed memoization from `gamma` and `factorial` functions, this 1737 could blow up memory. 1738 1739 1740 ## 2015-10-09, version 2.4.0 1741 1742 - Added support in the expression parser for mathematical alphanumeric symbols 1743 in the expression parser: unicode range \u{1D400} to \u{1D7FF} excluding 1744 invalid code points. 1745 - Extended function `distance` with more signatures. Thanks @kv-kunalvyas. 1746 - Fixed a bug in functions `sin` and `cos`, which gave wrong results for 1747 BigNumber integer values around multiples of tau (i.e. `sin(bignumber(7))`). 1748 - Fixed value of unit `stone`. Thanks @Esvandiary for finding the error. 1749 1750 1751 ## 2015-09-19, version 2.3.0 1752 1753 - Implemented function `distance`. Thanks @devanp92. 1754 - Implemented support for Fractions in function `lcm`. Thanks @infusion. 1755 - Implemented function `cbrt` for numbers, complex numbers, BigNumbers, Units. 1756 - Implemented function `hypot`. 1757 - Upgraded to fraction.js v3.0.0. 1758 - Fixed #450: issue with non sorted index in sparse matrices. 1759 - Fixed #463, #322: inconsistent handling of implicit multiplication. 1760 - Fixed #444: factorial of infinity not returning infinity. 1761 1762 1763 ## 2015-08-30, version 2.2.0 1764 1765 - Units with powers (like `m^2` and `s^-1`) now output with the best prefix. 1766 - Implemented support for units to `abs`, `cube`, `sign`, `sqrt`, `square`. 1767 Thanks @ericman314. 1768 - Implemented function `catalan` (Combinatorics). Thanks @devanp92. 1769 - Improved the `canDefineProperty` check to return false in case of IE8, which 1770 has a broken implementation of `defineProperty`. Thanks @golmansax. 1771 - Fixed function `to` not working in case of a simplified unit. 1772 - Fixed #437: an issue with row swapping in `lup`, also affecting `lusolve`. 1773 1774 1775 ## 2015-08-12, version 2.1.1 1776 1777 - Fixed wrong values of the physical constants `speedOfLight`, `molarMassC12`, 1778 and `magneticFluxQuantum`. Thanks @ericman314 for finding two of them. 1779 1780 1781 ## 2015-08-11, version 2.1.0 1782 1783 - Implemented derived units (like `110 km/h in m/s`). Thanks @ericman314. 1784 - Implemented support for electric units. Thanks @ericman314. 1785 - Implemented about 50 physical constants like `speedOfLight`, `gravity`, etc. 1786 - Implemented function `kldivergence` (Kullback-Leibler divergence). 1787 Thanks @saromanov. 1788 - Implemented function `mode`. Thanks @kv-kunalvyas. 1789 - Added support for unicode characters in the expression parser: greek letters 1790 and latin letters with accents. See #265. 1791 - Internal functions `Unit.parse` and `Complex.parse` now throw an Error 1792 instead of returning null when passing invalid input. 1793 1794 1795 ## 2015-07-29, version 2.0.1 1796 1797 - Fixed operations with mixed fractions and numbers be converted to numbers 1798 instead of fractions. 1799 1800 1801 ## 2015-07-28, version 2.0.0 1802 1803 - Large internal refactoring: 1804 - performance improvements. 1805 - allows to create custom bundles 1806 - functions are composed using `typed-function` and are extensible 1807 - Implemented support for fractions, powered by the library `fraction.js`. 1808 - Implemented matrix LU decomposition with partial pivoting and a LU based 1809 linear equations solver (functions `lup` and `lusolve`). Thanks @rjbaucells. 1810 - Implemented a new configuration option `predictable`, which can be set to 1811 true in order to ensure predictable function output types. 1812 - Implemented function `intersect`. Thanks @kv-kunalvyas. 1813 - Implemented support for adding `toTex` properties to custom functions. 1814 Thanks @FSMaxB. 1815 - Implemented support for complex values to `nthRoot`. Thanks @gangachris. 1816 - Implemented util functions `isInteger`, `isNegative`, `isNumeric`, 1817 `isPositive`, and `isZero`. 1818 1819 ### breaking changes 1820 1821 - String input is now converted to numbers by default for all functions. 1822 - Adding two strings will no longer concatenate them, but will convert the 1823 strings to numbers and add them. 1824 - Function `index` does no longer accept an array `[start, end, step]`, but 1825 instead accepts an array with arbitrary index values. It also accepts 1826 a `Range` object as input. 1827 - Function `typeof` no longer returns lower case names, but now returns lower 1828 case names for primitives (like `number`, `boolean`, `string`), and 1829 upper-camel-case for non-primitives (like `Array`, `Complex`, `Function`). 1830 - Function `import` no longer supports a module name as argument. Instead, 1831 modules can be loaded using require: `math.import(require('module-name'))`. 1832 - Function `import` has a new option `silent` to ignore errors, and throws 1833 errors on duplicates by default. 1834 - Method `Node.compile()` no longer needs `math` to be passed as argument. 1835 - Reintroduced method `Node.eval([scope])`. 1836 - Function `sum` now returns zero when input is an empty array. Thanks @FSMAxB. 1837 - The size of Arrays is no longer validated. Matrices will validate this on 1838 creation. 1839 1840 1841 ## 2015-07-12, version 1.7.1 1842 1843 - Fixed #397: Inaccuracies in nthRoot for very large values, and wrong results 1844 for very small values. (backported from v2) 1845 - Fixed #405: Parser throws error when defining a function in a multiline 1846 expression. 1847 1848 1849 ## 2015-05-31, version 1.7.0 1850 1851 - Implemented function `quantileSeq` and `partitionSelect`. Thanks @BigFav. 1852 - Implemented functions `stirlingS2`, `bellNumbers`, `composition`, and 1853 `multinomial`. Thanks @devanp92. 1854 - Improved the performance of `median` (see #373). Thanks @BigFav. 1855 - Extended the command line interface with a `mode` option to output either 1856 the expressions result, string representation, or tex representation. 1857 Thanks @FSMaxB. 1858 - Fixed #309: Function median mutating the input matrix. Thanks @FSMaxB. 1859 - Fixed `Node.transform` not recursing over replaced parts of the 1860 node tree (see #349). 1861 - Fixed #381: issue in docs of `randomInt`. 1862 1863 1864 ## 2015-04-22, version 1.6.0 1865 1866 - Improvements in `toTex`. Thanks @FSMaxB. 1867 - Fixed #328: `abs(0 + 0i)` evaluated to `NaN`. 1868 - Fixed not being able to override lazy loaded constants. 1869 1870 1871 ## 2015-04-09, version 1.5.2 1872 1873 - Fixed #313: parsed functions did not handle recursive calls correctly. 1874 - Fixed #251: binary prefix and SI prefix incorrectly used for byte. Now 1875 following SI standards (`1 KiB == 1024 B`, `1 kB == 1000 B`). 1876 - Performance improvements in parsed functions. 1877 1878 1879 ## 2015-04-08, version 1.5.1 1880 1881 - Fixed #316: a bug in rounding values when formatting. 1882 - Fixed #317, #319: a bug in formatting negative values. 1883 1884 1885 ## 2015-03-28, version 1.5.0 1886 1887 - Added unit `stone` (6.35 kg). 1888 - Implemented support for sparse matrices. Thanks @rjbaucells. 1889 - Implemented BigNumber support for function `atan2`. Thanks @BigFav. 1890 - Implemented support for custom LaTeX representations. Thanks @FSMaxB. 1891 - Improvements and bug fixes in outputting parentheses in `Node.toString` and 1892 `Node.toTex` functions. Thanks @FSMaxB. 1893 - Fixed #291: function `format` sometimes returning exponential notation when 1894 it should return a fixed notation. 1895 1896 1897 ## 2015-02-28, version 1.4.0 1898 1899 - Implemented trigonometric functions: 1900 `acosh`, `acoth`, `acsch`, `asech`, `asinh`, `atanh`, `acot`, `acsc`, `asec`. 1901 Thanks @BigFav. 1902 - Added BigNumber support for functions: `cot`, `csc`, `sec`, `coth`, 1903 `csch`, `sech`. Thanks @BigFav. 1904 - Implemented support for serialization and deserialization of math.js data 1905 types. 1906 - Fixed the calculation of `norm()` and `abs()` for large complex numbers. 1907 Thanks @rjbaucells. 1908 - Fixed #281: improved formatting complex numbers. Round the real or imaginary 1909 part to zero when the difference is larger than the configured precision. 1910 1911 1912 ## 2015-02-09, version 1.3.0 1913 1914 - Implemented BigNumber implementations of most trigonometric functions: `sin`, 1915 `cos`, `tan`, `asin`, `acos`, `atan`, `cosh`, `sinh`, `tanh`. Thanks @BigFav. 1916 - Implemented function `trace`. Thanks @pcorey. 1917 - Faster loading of BigNumber configuration with a high precision by lazy 1918 loading constants like `pi` and `e`. 1919 - Fixed constants `NaN` and `Infinity` not being BigNumber objects when 1920 BigNumbers are configured. 1921 - Fixed missing parentheses in the `toTex` representation of function 1922 `permutations`. 1923 - Some minor fixes in the docs. Thanks @KenanY. 1924 1925 1926 ## 2014-12-25, version 1.2.0 1927 1928 - Support for bitwise operations `bitAnd`, `bitNot`, `bitOr`, `bitXor`, 1929 `leftShift`, `rightArithShift`, and `rightLogShift`. Thanks @BigFav. 1930 - Support for boolean operations `and`, `not`, `or`, `xor`. Thanks @BigFav. 1931 - Support for `gamma` function. Thanks @BigFav. 1932 - Converting a unit without value will now result in a unit *with* value, 1933 i.e. `inch in cm` will return `2.54 cm` instead of `cm`. 1934 - Improved accuracy of `sinh` and complex `cos` and `sin`. Thanks @pavpanchekha. 1935 - Renamed function `select` to `chain`. The old function `select` will remain 1936 functional until math.js v2.0. 1937 - Upgraded to decimal.js v4.0.1 (BigNumber library). 1938 1939 1940 ## 2014-11-22, version 1.1.1 1941 1942 - Fixed Unit divided by Number returning zero. 1943 - Fixed BigNumber downgrading to Number for a negative base in `pow`. 1944 - Fixed some typos in error messaging (thanks @andy0130tw) and docs. 1945 1946 1947 ## 2014-11-15, version 1.1.0 1948 1949 - Implemented functions `dot` (dot product), `cross` (cross product), and 1950 `nthRoot`. 1951 - Officially opened up the API of expression trees: 1952 - Documented the API. 1953 - Implemented recursive functions `clone`, `map`, `forEach`, `traverse`, 1954 `transform`, and `filter` for expression trees. 1955 - Parameter `index` in the callbacks of `map` and `forEach` are now cloned 1956 for every callback. 1957 - Some internal refactoring inside nodes to make the API consistent: 1958 - Renamed `params` to `args` and vice versa to make things consistent. 1959 - Renamed `Block.nodes` to `Block.blocks`. 1960 - `FunctionNode` now has a `name: string` instead of a `symbol: SymbolNode`. 1961 - Changed constructor of `RangeNode` to 1962 `new RangeNode(start: Node, end: Node [, step: Node])`. 1963 - Nodes for a `BlockNode` must now be passed via the constructor instead 1964 of via a function `add`. 1965 - Fixed `2e` giving a syntax error instead of being parsed as `2 * e`. 1966 1967 1968 ## 2014-09-12, version 1.0.1 1969 1970 - Disabled array notation for ranges in a matrix index in the expression parser 1971 (it is confusing and redundant there). 1972 - Fixed a regression in the build of function subset not being able to return 1973 a scalar. 1974 - Fixed some missing docs and broken links in the docs. 1975 1976 1977 ## 2014-09-04, version 1.0.0 1978 1979 - Implemented a function `filter(x, test)`. 1980 - Removed `math.distribution` for now, needs some rethinking. 1981 - `math.number` can convert units to numbers (requires a second argument) 1982 - Fixed some precedence issues with the range and conversion operators. 1983 - Fixed an zero-based issue when getting a matrix subset using an index 1984 containing a matrix. 1985 1986 1987 ## 2014-08-21, version 0.27.0 1988 1989 - Implemented functions `sort(x [, compare])` and `flatten(x)`. 1990 - Implemented support for `null` in all functions. 1991 - Implemented support for "rawArgs" functions in the expression parser. Raw 1992 functions are invoked with unevaluated parameters (nodes). 1993 - Expressions in the expression parser can now be spread over multiple lines, 1994 like '2 +\n3'. 1995 - Changed default value of the option `wrap` of function `math.import` to false. 1996 - Changed the default value for new entries in a resized matrix when to zero. 1997 To leave new entries uninitialized, use the new constant `math.uninitialized` 1998 as default value. 1999 - Renamed transform property from `__transform__` to `transform`, and documented 2000 the transform feature. 2001 - Fixed a bug in `math.import` not applying options when passing a module name. 2002 - A returned matrix subset is now only squeezed when the `index` consists of 2003 scalar values, and no longer for ranges resolving into a single value. 2004 2005 2006 ## 2014-08-03, version 0.26.0 2007 2008 - A new instance of math.js can no longer be created like `math([options])`, 2009 to prevent side effects from math being a function instead of an object. 2010 Instead, use the function `math.create([options])` to create a new instance. 2011 - Implemented `BigNumber` support for all constants: `pi`, `tau`, `e`, `phi`, 2012 `E`, `LN2`, `LN10`, `LOG2E`, `LOG10E`, `PI`, `SQRT1_2`, and `SQRT2`. 2013 - Implemented `BigNumber` support for functions `gcd`, `xgcd`, and `lcm`. 2014 - Fixed function `gxcd` returning an Array when math.js was configured 2015 as `{matrix: 'matrix'}`. 2016 - Multi-line expressions now return a `ResultSet` instead of an `Array`. 2017 - Implemented transforms (used right now to transform one-based indices to 2018 zero-based for expressions). 2019 - When used inside the expression parser, functions `concat`, `min`, `max`, 2020 and `mean` expect an one-based dimension number. 2021 - Functions `map` and `forEach` invoke the callback with one-based indices 2022 when used from within the expression parser. 2023 - When adding or removing dimensions when resizing a matrix, the dimensions 2024 are added/removed from the inner side (right) instead of outer side (left). 2025 - Improved index out of range errors. 2026 - Fixed function `concat` not accepting a `BigNumber` for parameter `dim`. 2027 - Function `squeeze` now squeezes both inner and outer singleton dimensions. 2028 - Output of getting a matrix subset is not automatically squeezed anymore 2029 except for scalar output. 2030 - Renamed `FunctionNode` to `FunctionAssignmentNode`, and renamed `ParamsNode` 2031 to `FunctionNode` for more clarity. 2032 - Fixed broken auto completion in CLI. 2033 - Some minor fixes. 2034 2035 2036 ## 2014-07-01, version 0.25.0 2037 2038 - The library now immediately returns a default instance of mathjs, there is 2039 no need to instantiate math.js in a separate step unless one ones to set 2040 configuration options: 2041 2042 // instead of: 2043 var mathjs = require('mathjs'), // load math.js 2044 math = mathjs(); // create an instance 2045 2046 // just do: 2047 var math = require('mathjs'); 2048 - Implemented support for implicit multiplication, like `math.eval('2a', {a:3})` 2049 and `math.eval('(2+3)(1-3)')`. This changes behavior of matrix indexes as 2050 well: an expression like `[...][...]` is not evaluated as taking a subset of 2051 the first matrix, but as an implicit multiplication of two matrices. 2052 - Removed utility function `ifElse`. This function is redundant now the 2053 expression parser has a conditional operator `a ? b : c`. 2054 - Fixed a bug with multiplying a number with a temperature, 2055 like `math.eval('10 * celsius')`. 2056 - Fixed a bug with symbols having value `undefined` not being evaluated. 2057 2058 2059 ## 2014-06-20, version 0.24.1 2060 2061 - Something went wrong with publishing on npm. 2062 2063 2064 ## 2014-06-20, version 0.24.0 2065 2066 - Added constant `null`. 2067 - Functions `equal` and `unequal` support `null` and `undefined` now. 2068 - Function `typeof` now recognizes regular expressions as well. 2069 - Objects `Complex`, `Unit`, and `Help` now return their string representation 2070 when calling `.valueOf()`. 2071 - Changed the default number of significant digits for BigNumbers from 20 to 64. 2072 - Changed the behavior of the conditional operator (a ? b : c) to lazy 2073 evaluating. 2074 - Fixed imported, wrapped functions not accepting `null` and `undefined` as 2075 function arguments. 2076 2077 2078 ## 2014-06-10, version 0.23.0 2079 2080 - Renamed some functions (everything now has a logical, camel case name): 2081 - Renamed functions `edivide`, `emultiply`, and `epow` to `dotDivide`, 2082 `dotMultiply`, and `dotPow` respectively. 2083 - Renamed functions `smallereq` and `largereq` to `smallerEq` and `largerEq`. 2084 - Renamed function `unary` to `unaryMinus` and added support for strings. 2085 - `end` is now a reserved keyword which cannot be used as function or symbol 2086 name in the expression parser, and is not allowed in the scope against which 2087 an expression is evaluated. 2088 - Implemented function `unaryPlus` and unary plus operator. 2089 - Implemented function `deepEqual` for matrix comparisons. 2090 - Added constant `phi`, the golden ratio (`phi = 1.618...`). 2091 - Added constant `version`, returning the version number of math.js as string. 2092 - Added unit `drop` (`gtt`). 2093 - Fixed not being able to load math.js using AMD/require.js. 2094 - Changed signature of `math.parse(expr, nodes)` to `math.parse(expr, options)` 2095 where `options: {nodes: Object.<String, Node>}` 2096 - Removed matrix support from conditional function `ifElse`. 2097 - Removed automatic assignment of expression results to variable `ans`. 2098 This functionality can be restored by pre- or postprocessing every evaluation, 2099 something like: 2100 2101 function evalWithAns (expr, scope) { 2102 var ans = math.eval(expr, scope); 2103 if (scope) { 2104 scope.ans = ans; 2105 } 2106 return ans; 2107 } 2108 2109 2110 ## 2014-05-22, version 0.22.0 2111 2112 - Implemented support to export expressions to LaTeX. Thanks Niels Heisterkamp 2113 (@nheisterkamp). 2114 - Output of matrix multiplication is now consistently squeezed. 2115 - Added reference documentation in the section /docs/reference. 2116 - Fixed a bug in multiplying units without value with a number (like `5 * cm`). 2117 - Fixed a bug in multiplying two matrices containing vectors (worked fine for 2118 arrays). 2119 - Fixed random functions not accepting Matrix as input, and always returning 2120 a Matrix as output. 2121 2122 2123 ## 2014-05-13, version 0.21.1 2124 2125 - Removed `crypto` library from the bundle. 2126 - Deprecated functions `Parser.parse` and `Parser.compile`. Use 2127 `math.parse` and `math.compile` instead. 2128 - Fixed function `add` not adding strings and matrices element wise. 2129 - Fixed parser not being able to evaluate an exponent followed by a unary minus 2130 like `2^-3`, and a transpose followed by an index like `[3]'[1]`. 2131 2132 2133 ## 2014-04-24, version 0.21.0 2134 2135 - Implemented trigonometric hyperbolic functions `cosh`, `coth`, `csch`, 2136 `sech`, `sinh`, `tanh`. Thanks Rogelio J. Baucells (@rjbaucells). 2137 - Added property `type` to all expression nodes in an expression tree. 2138 - Fixed functions `log`, `log10`, `pow`, and `sqrt` not supporting complex 2139 results from BigNumber input (like `sqrt(bignumber(-4))`). 2140 2141 2142 ## 2014-04-16, version 0.20.0 2143 2144 - Switched to module `decimal.js` for BigNumber support, instead of 2145 `bignumber.js`. 2146 - Implemented support for polar coordinates to the `Complex` datatype. 2147 Thanks Finn Pauls (@finnp). 2148 - Implemented BigNumber support for functions `exp`, `log`, and `log10`. 2149 - Implemented conditional operator `a ? b : c` in expression parser. 2150 - Improved floating point comparison: the functions now check whether values 2151 are nearly equal, against a configured maximum relative difference `epsilon`. 2152 Thanks Rogelio J. Baucells (@rjbaucells). 2153 - Implemented function `norm`. Thanks Rogelio J. Baucells (@rjbaucells). 2154 - Improved function `ifElse`, is now specified for special data types too. 2155 - Improved function `det`. Thanks Bryan Cuccioli (@bcuccioli). 2156 - Implemented `BigNumber` support for functions `det` and `diag`. 2157 - Added unit alias `lbs` (pound mass). 2158 - Changed configuration option `decimals` to `precision` (applies to BigNumbers 2159 only). 2160 - Fixed support for element-wise comparisons between a string and a matrix. 2161 - Fixed: expression parser now trows IndexErrors with one-based indices instead 2162 of zero-based. 2163 - Minor bug fixes. 2164 2165 2166 ## 2014-03-30, version 0.19.0 2167 2168 - Implemented functions `compare`, `sum`, `prod`, `var`, `std`, `median`. 2169 - Implemented function `ifElse` Thanks @mtraynham. 2170 - Minor bug fixes. 2171 2172 2173 ## 2014-02-15, version 0.18.1 2174 2175 - Added unit `feet`. 2176 - Implemented function `compile` (shortcut for parsing and then compiling). 2177 - Improved performance of function `pow` for matrices. Thanks @hamadu. 2178 - Fixed broken auto completion in the command line interface. 2179 - Fixed an error in function `combinations` for large numbers, and 2180 improved performance of both functions `combinations` and `permutations`. 2181 2182 2183 ## 2014-01-18, version 0.18.0 2184 2185 - Changed matrix index notation of expression parser from round brackets to 2186 square brackets, for example `A[1, 1:3]` instead of `A(1, 1:3)`. 2187 - Removed need to use the `function` keyword for function assignments in the 2188 expression parser, you can define a function now like `f(x) = x^2`. 2189 - Implemented a compilation step in the expression parser: expressions are 2190 compiled into JavaScript, giving much better performance (easily 10x as fast). 2191 - Renamed unit conversion function and operator `in` to `to`. Operator `in` is 2192 still available in the expression parser as an alias for `to`. Added unit 2193 `in`, an abbreviation for `inch`. Thanks Elijah Insua (@tmpvar). 2194 - Added plurals and aliases for units. 2195 - Implemented an argument `includeEnd` for function `range` (false by default). 2196 - Ranges in the expression parser now support big numbers. 2197 - Implemented functions `permutations` and `combinations`. 2198 Thanks Daniel Levin (@daniel-levin). 2199 - Added lower case abbreviation `l` for unit litre. 2200 2201 2202 ## 2013-12-19, version 0.17.1 2203 2204 - Fixed a bug with negative temperatures. 2205 - Fixed a bug with prefixes of units squared meter `m2` and cubic meter `m3`. 2206 2207 2208 ## 2013-12-12, version 0.17.0 2209 2210 - Renamed and flattened configuration settings: 2211 - `number.defaultType` is now `number`. 2212 - `number.precision` is now `decimals`. 2213 - `matrix.defaultType` is now `matrix`. 2214 - Function `multiply` now consistently outputs a complex number on complex input. 2215 - Fixed `mod` and `in` not working as function (only as operator). 2216 - Fixed support for old browsers (IE8 and older), compatible when using es5-shim. 2217 - Fixed support for Java's ScriptEngine. 2218 2219 2220 ## 2013-11-28, version 0.16.0 2221 2222 - Implemented BigNumber support for arbitrary precision calculations. 2223 Added settings `number.defaultType` and `number.precision` to configure 2224 big numbers. 2225 - Documentation is extended. 2226 - Removed utility functions `isScalar`, `toScalar`, `isVector`, `toVector` 2227 from `Matrix` and `Range`. Use `math.squeeze` and `math.size` instead. 2228 - Implemented functions `get` and `set` on `Matrix`, for easier and faster 2229 retrieval/replacement of elements in a matrix. 2230 - Implemented function `resize`, handling matrices, scalars, and strings. 2231 - Functions `ones` and `zeros` now return an empty matrix instead of a 2232 number 1 or 0 when no arguments are provided. 2233 - Implemented functions `min` and `max` for `Range` and `Index`. 2234 - Resizing matrices now leaves new elements undefined by default instead of 2235 filling them with zeros. Function `resize` now has an extra optional 2236 parameter `defaultValue`. 2237 - Range operator `:` in expression parser has been given a higher precedence. 2238 - Functions don't allow arguments of unknown type anymore. 2239 - Options be set when constructing a math.js instance or using the new function 2240 `config(options`. Options are no longer accessible via `math.options`. 2241 - Renamed `scientific` notation to `exponential` in function `format`. 2242 - Function `format` outputs exponential notation with positive exponents now 2243 always with `+` sign, so outputs `2.1e+3` instead of `2.1e3`. 2244 - Fixed function `squeeze` not being able squeeze into a scalar. 2245 - Some fixes and performance improvements in the `resize` and `subset` 2246 functions. 2247 - Function `size` now adheres to the option `matrix.defaultType` for scalar 2248 input. 2249 - Minor bug fixes. 2250 2251 2252 ## 2013-10-26, version 0.15.0 2253 2254 - Math.js must be instantiated now, static calls are no longer supported. Usage: 2255 - node.js: `var math = require('mathjs')();` 2256 - browser: `var math = mathjs();` 2257 - Implemented support for multiplying vectors with matrices. 2258 - Improved number formatting: 2259 - Function `format` now support various options: precision, different 2260 notations (`fixed`, `scientific`, `auto`), and more. 2261 - Numbers are no longer rounded to 5 digits by default when formatted. 2262 - Implemented a function `format` for `Matrix`, `Complex`, `Unit`, `Range`, 2263 and `Selector` to format using options. 2264 - Function `format` does only stringify values now, and has a new parameter 2265 `precision` to round to a specific number of digits. 2266 - Removed option `math.options.precision`, 2267 use `math.format(value [, precision])` instead. 2268 - Fixed formatting numbers as scientific notation in some cases returning 2269 a zero digit left from the decimal point. (like "0.33333e8" rather than 2270 "3.3333e7"). Thanks @husayt. 2271 - Implemented a function `print` to interpolate values in a template string, 2272 this functionality was moved from the function `format`. 2273 - Implemented statistics function `mean`. Thanks Guillermo Indalecio Fernandez 2274 (@guillermobox). 2275 - Extended and changed `max` and `min` for multi dimensional matrices: they now 2276 return the maximum and minimum of the flattened array. An optional second 2277 argument `dim` allows to calculate the `max` or `min` for specified dimension. 2278 - Renamed option `math.options.matrix.default` to 2279 `math.options.matrix.defaultType`. 2280 - Removed support for comparing complex numbers in functions `smaller`, 2281 `smallereq`, `larger`, `largereq`. Complex numbers cannot be ordered. 2282 2283 2284 ## 2013-10-08, version 0.14.0 2285 2286 - Introduced an option `math.options.matrix.default` which can have values 2287 `matrix` (default) or `array`. This option is used by the functions `eye`, 2288 `ones`, `range`, and `zeros`, to determine the type of matrix output. 2289 - Getting a subset of a matrix will automatically squeeze the resulting subset, 2290 setting a subset of a matrix will automatically unsqueeze the given subset. 2291 - Removed concatenation of nested arrays in the expression parser. 2292 You can now input nested arrays like in JavaScript. Matrices can be 2293 concatenated using the function `concat`. 2294 - The matrix syntax `[...]` in the expression parser now creates 1 dimensional 2295 matrices by default. `math.eval('[1,2,3,4]')` returns a matrix with 2296 size `[4]`, `math.eval('[1,2;3,4]')` returns a matrix with size `[2,2]`. 2297 - Documentation is restructured and extended. 2298 - Fixed non working operator `mod` (modulus operator). 2299 2300 2301 ## 2013-09-03, version 0.13.0 2302 2303 - Implemented support for booleans in all relevant functions. 2304 - Implemented functions `map` and `forEach`. Thanks Sebastien Piquemal (@sebpic). 2305 - All construction functions can be used to convert the type of variables, 2306 also element-wise for all elements in an Array or Matrix. 2307 - Changed matrix indexes of the expression parser to one-based with the 2308 upper-bound included, similar to most math applications. Note that on a 2309 JavaScript level, math.js uses zero-based indexes with excluded upper-bound. 2310 - Removed support for scalars in the function `subset`, it now only supports 2311 Array, Matrix, and String. 2312 - Removed the functions `get` and `set` from a selector, they are a duplicate 2313 of the function `subset`. 2314 - Replaced functions `get` and `set` of `Matrix` with a single function 2315 `subset`. 2316 - Some moving around with code and namespaces: 2317 - Renamed namespace `math.expr` to `math.expression` (contains Scope, Parser, 2318 node objects). 2319 - Renamed namespace `math.docs` to `math.expression.docs`. 2320 - Moved `math.expr.Selector` to `math.chaining.Selector`. 2321 - Fixed some edge cases in functions `lcm` and `xgcd`. 2322 2323 2324 ## 2013-08-22, version 0.12.1 2325 2326 - Fixed outdated version of README.md. 2327 - Fixed a broken unit test. 2328 2329 2330 ## 2013-08-22, version 0.12.0 2331 2332 - Implemented functions `random([min, max])`, `randomInt([min, max])`, 2333 `pickRandom(array)`. Thanks Sebastien Piquemal (@sebpic). 2334 - Implemented function `distribution(name)`, generating a distribution object 2335 with functions `random`, `randomInt`, `pickRandom` for different 2336 distributions. Currently supporting `uniform` and `normal`. 2337 - Changed the behavior of `range` to exclude the upper bound, so `range(1, 4)` 2338 now returns `[1, 2, 3]` instead of `[1, 2, 3, 4]`. 2339 - Changed the syntax of `range`, which is now `range(start, end [, step])` 2340 instead of `range(start, [step, ] end)`. 2341 - Changed the behavior of `ones` and `zeros` to geometric dimensions, for 2342 example `ones(3)` returns a vector with length 3, filled with ones, and 2343 `ones(3,3)` returns a 2D array with size [3, 3]. 2344 - Changed the return type of `ones` and `zeros`: they now return an Array when 2345 arguments are Numbers or an Array, and returns a Matrix when the argument 2346 is a Matrix. 2347 - Change matrix index notation in parser from round brackets to square brackets, 2348 for example `A[0, 0:3]`. 2349 - Removed the feature introduced in v0.10.0 to automatically convert a complex 2350 value with an imaginary part equal to zero to a number. 2351 - Fixed zeros being formatted as null. Thanks @TimKraft. 2352 2353 2354 ## 2013-07-23, version 0.11.1 2355 2356 - Fixed missing development dependency 2357 2358 2359 ## 2013-07-23, version 0.11.0 2360 2361 - Changed math.js from one-based to zero-based indexes. 2362 - Getting and setting matrix subset is now zero-based. 2363 - The dimension argument in function `concat` is now zero-based. 2364 - Improvements in the string output of function help. 2365 - Added constants `true` and `false`. 2366 - Added constructor function `boolean`. 2367 - Fixed function `select` not accepting `0` as input. 2368 Thanks Elijah Manor (@elijahmanor). 2369 - Parser now supports multiple unary minus operators after each other. 2370 - Fixed not accepting empty matrices like `[[], []]`. 2371 - Some fixes in the end user documentation. 2372 2373 2374 ## 2013-07-08, version 0.10.0 2375 2376 - For complex calculations, all functions now automatically replace results 2377 having an imaginary part of zero with a Number. (`2i * 2i` now returns a 2378 Number `-4` instead of a Complex `-4 + 0i`). 2379 - Implemented support for injecting custom node handlers in the parser. Can be 2380 used for example to implement a node handler for plotting a graph. 2381 - Implemented end user documentation and a new `help` function. 2382 - Functions `size` and `squeeze` now return a Matrix instead of an Array as 2383 output on Matrix input. 2384 - Added a constant tau (2 * pi). Thanks Zak Zibrat (@palimpsests). 2385 - Renamed function `unaryminus` to `unary`. 2386 - Fixed a bug in determining node dependencies in function assignments. 2387 2388 2389 ## 2013-06-14, version 0.9.1 2390 2391 - Implemented element-wise functions and operators: `emultiply` (`x .* y`), 2392 `edivide` (`x ./ y`), `epow` (`x .^ y`). 2393 - Added constants `Infinity` and `NaN`. 2394 - Removed support for Workspace to keep the library focused on its core task. 2395 - Fixed a bug in the Complex constructor, not accepting NaN values. 2396 - Fixed division by zero in case of pure complex values. 2397 - Fixed a bug in function multiply multiplying a pure complex value with 2398 Infinity. 2399 2400 2401 ## 2013-05-29, version 0.9.0 2402 2403 - Implemented function `math.parse(expr [,scope])`. Optional parameter scope can 2404 be a plain JavaScript Object containing variables. 2405 - Extended function `math.expr(expr [, scope])` with an additional parameter 2406 `scope`, similar to `parse`. Example: `math.eval('x^a', {x:3, a:2});`. 2407 - Implemented function `subset`, to get or set a subset from a matrix, string, 2408 or other data types. 2409 - Implemented construction functions number and string (mainly useful inside 2410 the parser). 2411 - Improved function `det`. Thanks Bryan Cuccioli (@bcuccioli). 2412 - Moved the parse code from prototype math.expr.Parser to function math.parse, 2413 simplified Parser a little bit. 2414 - Strongly simplified the code of Scope and Workspace. 2415 - Fixed function mod for negative numerators, and added error messages in case 2416 of wrong input. 2417 2418 2419 ## 2013-05-18, version 0.8.2 2420 2421 - Extended the import function and some other minor improvements. 2422 - Fixed a bug in merging one dimensional vectors into a matrix. 2423 - Fixed a bug in function subtract, when subtracting a complex number from a 2424 real number. 2425 2426 2427 ## 2013-05-10, version 0.8.1 2428 2429 - Fixed an npm warning when installing mathjs globally. 2430 2431 2432 ## 2013-05-10, version 0.8.0 2433 2434 - Implemented a command line interface. When math.js is installed globally via 2435 npm, the application is available on your system as 'mathjs'. 2436 - Implemented `end` keyword for index operator, and added support for implicit 2437 start and end (expressions like `a(2,:)` and `b(2:end,3:end-1)` are supported 2438 now). 2439 - Function math.eval is more flexible now: it supports variables and multi-line 2440 expressions. 2441 - Removed the read-only option from Parser and Scope. 2442 - Fixed non-working unequal operator != in the parser. 2443 - Fixed a bug in resizing matrices when replacing a subset. 2444 - Fixed a bug in updating a subset of a non-existing variable. 2445 - Minor bug fixes. 2446 2447 2448 ## 2013-05-04, version 0.7.2 2449 2450 - Fixed method unequal, which was checking for equality instead of inequality. 2451 Thanks @FJS2. 2452 2453 2454 ## 2013-04-27, version 0.7.1 2455 2456 - Improvements in the parser: 2457 - Added support for chained arguments. 2458 - Added support for chained variable assignments. 2459 - Added a function remove(name) to remove a variable from the parsers scope. 2460 - Renamed nodes for more consistency and to resolve naming conflicts. 2461 - Improved stringification of an expression tree. 2462 - Some simplifications in the code. 2463 - Minor bug fixes. 2464 - Fixed a bug in the parser, returning NaN instead of throwing an error for a 2465 number with multiple decimal separators like `2.3.4`. 2466 - Fixed a bug in Workspace.insertAfter. 2467 - Fixed: math.js now works on IE 6-8 too. 2468 2469 2470 ## 2013-04-20, version 0.7.0 2471 2472 - Implemented method `math.eval`, which uses a readonly parser to evaluate 2473 expressions. 2474 - Implemented method `xgcd` (extended eucledian algorithm). Thanks Bart Kiers 2475 (@bkiers). 2476 - Improved math.format, which now rounds values to a maximum number of digits 2477 instead of decimals (default is 5 digits, for example `math.format(math.pi)` 2478 returns `3.1416`). 2479 - Added examples. 2480 - Changed methods square and cube to evaluate matrices element wise (consistent 2481 with all other methods). 2482 - Changed second parameter of method import to an object with options. 2483 - Fixed method math.typeof on IE. 2484 - Minor bug fixes and improvements. 2485 2486 2487 ## 2013-04-13, version 0.6.0 2488 2489 - Implemented chained operations via method math.select(). For example 2490 `math.select(3).add(4).subtract(2).done()` will return `5`. 2491 - Implemented methods gcd and lcm. 2492 - Implemented method `Unit.in(unit)`, which creates a clone of the unit with a 2493 fixed representation. For example `math.unit('5.08 cm').in('inch')` will 2494 return a unit which string representation always is in inch, thus `2 inch`. 2495 `Unit.in(unit)` is the same as method `math.in(x, unit)`. 2496 - Implemented `Unit.toNumber(unit)`, which returns the value of the unit when 2497 represented with given unit. For example 2498 `math.unit('5.08 cm').toNumber('inch')` returns the number `2`, as the 2499 representation of the unit in inches has 2 as value. 2500 - Improved: method `math.in(x, unit)` now supports a string as second parameter, 2501 for example `math.in(math.unit('5.08 cm'), 'inch')`. 2502 - Split the end user documentation of the parser functions from the source 2503 files. 2504 - Removed function help and the built-in documentation from the core library. 2505 - Fixed constant i being defined as -1i instead of 1i. 2506 - Minor bug fixes. 2507 2508 2509 ## 2013-04-06, version 0.5.0 2510 2511 - Implemented data types Matrix and Range. 2512 - Implemented matrix methods clone, concat, det, diag, eye, inv, ones, size, 2513 squeeze, transpose, zeros. 2514 - Implemented range operator `:`, and transpose operator `'` in parser. 2515 - Changed: created construction methods for easy object creation for all data 2516 types and for the parser. For example, a complex value is now created 2517 with `math.complex(2, 3)` instead of `new math.Complex(2, 3)`, and a parser 2518 is now created with `math.parser()` instead of `new math.parser.Parser()`. 2519 - Changed: moved all data types under the namespace math.type, and moved the 2520 Parser, Workspace, etc. under the namespace math.expr. 2521 - Changed: changed operator precedence of the power operator: 2522 - it is now right associative instead of left associative like most scripting 2523 languages. So `2^3^4` is now calculated as `2^(3^4)`. 2524 - it has now higher precedence than unary minus most languages, thus `-3^2` is 2525 now calculated as `-(3^2)`. 2526 - Changed: renamed the parsers method 'put' into 'set'. 2527 - Fixed: method 'in' did not check for units to have the same base. 2528 2529 2530 ## 2013-03-16, version 0.4.0 2531 2532 - Implemented Array support for all methods. 2533 - Implemented Array support in the Parser. 2534 - Implemented method format. 2535 - Implemented parser for units, math.Unit.parse(str). 2536 - Improved parser for complex values math.Complex.parse(str); 2537 - Improved method help: it now evaluates the examples. 2538 - Fixed: a scoping issue with the Parser when defining functions. 2539 - Fixed: method 'typeof' was not working well with minified and mangled code. 2540 - Fixed: errors in determining the best prefix for a unit. 2541 2542 2543 ## 2013-03-09, version 0.3.0 2544 2545 - Implemented Workspace 2546 - Implemented methods cot, csc, sec. 2547 - Implemented Array support for methods with one parameter. 2548 2549 2550 ## 2013-02-25, version 0.2.0 2551 2552 - Parser, Scope, and expression tree with Nodes implemented. 2553 - Implemented method import which makes it easy to extend math.js. 2554 - Implemented methods arg, conj, cube, equal, factorial, im, largereq, 2555 log(x, base), log10, mod, re, sign, smallereq, square, unequal. 2556 2557 2558 ## 2013-02-18, version 0.1.0 2559 2560 - Reached full compatibility with Javascripts built-in Math library. 2561 - More functions implemented. 2562 - Some bugfixes. 2563 2564 2565 ## 2013-02-16, version 0.0.2 2566 2567 - All constants of Math implemented, plus the imaginary unit i. 2568 - Data types Complex and Unit implemented. 2569 - First set of functions implemented. 2570 2571 2572 ## 2013-02-15, version 0.0.1 2573 2574 - First publish of the mathjs package. (package is still empty)