UNPKG

64.1 kBMarkdownView Raw
1# History
2
3
4## 2018-04-18, version 4.1.2
5
6- Fixed #1082: implemented support for unit plurals `decades`, `centuries`,
7 and `millennia`.
8- Fixed #1083: units `decade` and `watt` having a wrong name when stringifying.
9 Thanks @ericman314.
10
11
12## 2018-04-11, version 4.1.1
13
14- Fixed #1063: derivative not working when resolving a variable with unary
15 minus like `math.derivative('-x', 'x')`.
16
17
18## 2018-04-08, version 4.1.0
19
20- Extended function `math.print` with support for arrays and matrices.
21 Thanks @jean-emmanuel.
22- Fixed #1077: Serialization/deserialization to JSON with reviver not being
23 supported by nodes.
24- Fixed #1016: Extended `math.typeof` with support for `ResultSet` and nodes
25 like `SymbolNode`.
26- Fixed #1072: Added support for long and short prefixes for the unit `bar`
27 (i.e. `millibar` and `mbar`).
28
29
30## 2018-03-17, version 4.0.1
31
32- Fixed #1062: mathjs not working on ES5 browsers like IE11 and Safari 9.3.
33- Fixed #1061: `math.unit` not accepting input like `1/s`.
34
35
36## 2018-02-25, version 4.0.0
37
38!!! BE CAREFUL: BREAKING CHANGES !!!
39
40Breaking changes (see also #682):
41
42- **New expression compiler**
43
44 The compiler of the expression parser is replaced with one that doesn't use
45 `eval` internally. See #1019. This means:
46
47 - a slightly improved performance on most browsers.
48 - less risk of security exploits.
49 - the code of the new compiler is easier to understand, maintain, and debug.
50
51 Breaking change here: When using custom nodes in the expression parser,
52 the syntax of `_compile` has changed. This is an undocumented feature though.
53
54- **Parsed expressions**
55
56 - The class `ConstantNode` is changed such that it just holds a value
57 instead of holding a stringified value and it's type.
58 `ConstantNode(valueStr, valueType`) is now `ConstantNode(value)`
59 Stringification uses `math.format`, which may result in differently
60 formatted numeric output.
61
62 - The constants `true`, `false`, `null`, `undefined`, `NaN`, `Infinity`,
63 and `uninitialized` are now parsed as ConstantNodes instead of
64 SymbolNodes in the expression parser. See #833.
65
66- **Implicit multiplication**
67
68 - Changed the behavior of implicit multiplication to have higher
69 precedence than explicit multiplication and division, except in
70 a number of specific cases. This gives a more natural behavior
71 for implicit multiplications. For example `24h / 6h` now returns `4`,
72 whilst `1/2 kg` evaluates to `0.5 kg`. Thanks @ericman314. See: #792.
73 Detailed documentation: https://github.com/josdejong/mathjs/blob/v4/docs/expressions/syntax.md#implicit-multiplication.
74
75 - Immediately invoking a function returned by a function like `partialAdd(2)(3)`
76 is no longer supported, instead these expressions are evaluated as
77 an implicit multiplication `partialAdd(2) * (3)`. See #1035.
78
79- **String formatting**
80
81 - In function `math.format`, the options `{exponential: {lower: number, upper: number}}`
82 (where `lower` and `upper` are values) are replaced with `{lowerExp: number, upperExp: number}`
83 (where `lowerExp` and `upperExp` are exponents). See #676. For example:
84 ```js
85 math.format(2000, {exponential: {lower: 1e-2, upper: 1e2}})
86 ```
87 is now:
88 ```js
89 math.format(2000, {lowerExp: -2, upperExp: 2})
90 ```
91
92 - In function `math.format`, the option `notation: 'fixed'` no longer rounds to
93 zero digits when no precision is specified: it leaves the digits as is.
94 See #676.
95
96- **String comparison**
97
98 Changed the behavior of relational functions (`compare`, `equal`,
99 `equalScalar`, `larger`, `largerEq`, `smaller`, `smallerEq`, `unequal`)
100 to compare strings by their numeric value they contain instead of
101 alphabetically. This also impacts functions `deepEqual`, `sort`, `min`,
102 `max`, `median`, and `partitionSelect`. Use `compareNatural` if you
103 need to sort an array with text. See #680.
104
105- **Angle units**
106
107 Changed `rad`, `deg`, and `grad` to have short prefixes,
108 and introduced `radian`, `degree`, and `gradian` and their plurals
109 having long prefixes. See #749.
110
111- **Null**
112
113 - `null` is no longer implicitly casted to a number `0`, so input like
114 `math.add(2, null)` is no longer supported. See #830, #353.
115
116 - Dropped constant `uninitialized`, which was used to initialize
117 leave new entries undefined when resizing a matrix is removed.
118 Use `undefined` instead to indicate entries that are not explicitly
119 set. See #833.
120
121- **New typed-function library**
122
123 - The `typed-function` library used to check the input types
124 of functions is completely rewritten and doesn't use `eval` under
125 the hood anymore. This means a reduced security risk, and easier
126 to debug code. The API is the same, but error messages may differ
127 a bit. Performance is comparable but may differ in specific
128 use cases and browsers.
129
130Non breaking changes:
131
132- Thanks to the new expression compiler and `typed-function` implementation,
133 mathjs doesn't use JavaScript's `eval` anymore under the hood.
134 This allows using mathjs in environments with security restrictions.
135 See #401.
136- Implemented additional methods `isUnary()` and `isBinary()` on
137 `OperatorNode`. See #1025.
138- Improved error messages for statistical functions.
139- Upgraded devDependencies.
140- Fixed #1014: `derivative` silently dropping additional arguments
141 from operator nodes with more than two arguments.
142
143
144## 2018-02-07, version 3.20.2
145
146- Upgraded to `typed-function@0.10.7` (bug-fix release).
147- Fixed option `implicit` not being copied from an `OperatorNode`
148 when applying function `map`. Thanks @HarraySarson.
149- Fixed #995: spaces and underscores not property being escaped
150 in `toTex()`. Thanks @FSMaxB.
151
152
153## 2018-01-17, version 3.20.1
154
155- Fixed #1018: `simplifyCore` failing in some cases with parentheses.
156 Thanks @firepick1.
157
158
159## 2018-01-14, version 3.20.0
160
161- Implement support for 3 or more arguments for operators `+` and `*` in
162 `derivative`. Thanks @HarrySarson. See #1002.
163- Fixed `simplify` evalution of `simplify` of functions with more than two
164 arguments wrongly: `simplify('f(x, y, z)') evaluated to `f(f(x, y), z)`
165 instead of `f(x, y, z)`. Thanks @joelhoover.
166- Fixed `simplify` throwing an error in some cases when simplifying unknown
167 functions, for example `simplify('f(4)')`. Thanks @joelhoover.
168- Fixed #1013: `simplify` wrongly simplifing some expressions containing unary
169 minus, like `0 - -x`. Thanks @joelhoover.
170- Fixed an error in an example in the documentation of `xor`. Thanks @denisx.
171
172
173## 2018-01-06, version 3.19.0
174
175- Extended functions `distance` and `intersect` with support for BigNumbers.
176 Thanks @ovk.
177- Improvements in function `simplify`: added a rule that allows combining
178 of like terms in embedded quantities. Thanks @joelhoover.
179
180
181## 2017-12-28, version 3.18.1
182
183- Fixed #998: An issue with simplifying an expression containing a subtraction.
184 Thanks @firepick1.
185
186
187## 2017-12-16, version 3.18.0
188
189- Implemented function `rationalize`. Thanks @paulobuchsbaum.
190- Upgraded dependencies:
191 ```
192 decimal.js 7.2.3 → 9.0.1 (no breaking changes affecting mathjs)
193 fraction.js 4.0.2 → 4.0.4
194 tiny-emitter 2.0.0 → 2.0.2
195 ```
196- Upgraded dev dependencies.
197- Fixed #975: a wrong example in the docs of lusolve.
198- Fixed #983: `pickRandom` returning an array instead of single value
199 when input was an array with just one value. Clarified docs.
200- Fixed #969: preven issues with yarn autoclean by renaming an
201 interally used folder "docs" to "embeddedDocs".
202
203
204## 2017-11-18, version 3.17.0
205
206- Improved `simplify` for nested exponentiations. Thanks @IvanVergiliev.
207- Fixed a security issue in `typed-function` allowing arbitrary code execution
208 in the JavaScript engine by creating a typed function with JavaScript code
209 in the name. Thanks Masato Kinugawa.
210- Fixed a security issue where forbidden properties like constructor could be
211 replaced by using unicode characters when creating an object. No known exploit,
212 but could possibly allow arbitrary code execution. Thanks Masato Kinugawa.
213
214
215## 2017-10-18, version 3.16.5
216
217- Fixed #954: Functions `add` and `multiply` not working when
218 passing three or more arrays or matrices.
219
220
221## 2017-10-01, version 3.16.4
222
223- Fixed #948, #949: function `simplify` returning wrong results or
224 running into an infinite recursive loop. Thanks @ericman314.
225- Fixed many small issues in the embedded docs. Thanks @Schnark.
226
227
228## 2017-08-28, version 3.16.3
229
230- Fixed #934: Wrong simplification of unary minus. Thanks @firepick1.
231- Fixed #933: function `simplify` reordering operations. Thanks @firepick1.
232- Fixed #930: function `isNaN` returning wrong result for complex
233 numbers having just one of their parts (re/im) being `NaN`.
234- Fixed #929: `FibonacciHeap.isEmpty` returning wrong result.
235
236
237## 2017-08-20, version 3.16.2
238
239- Fixed #924: a regression in `simplify` not accepting the signature
240 `simplify(expr, rules, scope)` anymore. Thanks @firepick1.
241- Fixed missing parenthesis when stringifying expressions containing
242 implicit multiplications (see #922). Thanks @FSMaxB.
243
244
245## 2017-08-12, version 3.16.1
246
247- For security reasons, type checking is now done in a more strict
248 way using functions like `isComplex(x)` instead of duck type checking
249 like `x && x.isComplex === true`.
250- Fixed #915: No access to property "name".
251- Fixed #901: Simplify units when calling `unit.toNumeric()`.
252 Thanks @AlexanderBeyn.
253- Fixed `toString` of a parsed expression tree containing an
254 immediately invoked function assignment not being wrapped in
255 parenthesis (for example `(f(x) = x^2)(4)`).
256
257
258## 2017-08-06, version 3.16.0
259
260- Significant performance improvements in `math.simplify`.
261 Thanks @firepick1.
262- Improved API for `math.simplify`, optionally pass a scope with
263 variables which are resolved, see #907. Thanks @firepick1.
264- Fixed #912: math.js didn't work on IE10 anymore (regression
265 since 3.15.0).
266
267
268## 2017-07-29, version 3.15.0
269
270- Added support for the dollar character `$` in symbol names (see #895).
271- Allow objects with prototypes as scope again in the expression parser,
272 this was disabled for security reasons some time ago. See #888, #899.
273 Thanks @ThomasBrierley.
274- Fixed #846: Issues in the functions `map`, `forEach`, and `filter`
275 when used in the expression parser:
276 - Not being able to use a function assignment as inline expression
277 for the callback function.
278 - Not being able to pass an inline expression as callback for `map`
279 and `forEach`.
280 - Index and original array/matrix not passed in `map` and `filter`.
281
282
283## 2017-07-05, version 3.14.2
284
285- Upgraded to `fraction.js@4.0.2`
286- Fixed #891 using BigNumbers not working in browser environments.
287
288
289## 2017-06-30, version 3.14.1
290
291- Reverted to `fraction.js@4.0.0`, there is an issue with `4.0.1`
292 in the browser.
293
294
295## 2017-06-30, version 3.14.0
296
297- Implemented set methods `setCartesian`, `setDifference`,
298 `setDistinct`, `setIntersect`, `setIsSubset`, `setPowerset`,
299 `setSize`. Thanks @Nekomajin42.
300- Implemented method `toHTML` on nodes. Thanks @Nekomajin42.
301- Implemented `compareNatural` and `sort([...], 'natural')`.
302- Upgraded dependencies to the latest versions:
303 - `complex.js@2.0.4`
304 - `decimal.js@7.2.3`
305 - `fraction.js@4.0.1`
306 - `tiny-emitter@2.0.0`
307 - And all devDependencies.
308- Fixed #865: `splitUnit` can now deal with round-off errors.
309 Thanks @ericman314.
310- Fixed #876: incorrect definition for unit `erg`. Thanks @pjhampton.
311- More informative error message when using single quotes instead of
312 double quotes around a string. Thanks @HarrySarson.
313
314
315## 2017-05-27, version 3.13.3
316
317- Fixed a bug in function `intersection` of line and plane.
318 Thanks @viclai.
319- Fixed security vulnerabilities.
320
321
322## 2017-05-26, version 3.13.2
323
324- Disabled function `chain` inside the expression parser for security
325 reasons (it's not needed there anyway).
326- Fixed #856: function `subset` not returning non-primitive scalars
327 from Arrays correctly. (like `math.eval('arr[1]', {arr: [math.bignumber(2)]})`.
328- Fixed #861: physical constants not available in the expression parser.
329
330
331## 2017-05-12, version 3.13.1
332
333- Fixed creating units with an alias not working within the expression
334 parser.
335- Fixed security vulnerabilities. Thanks Sam.
336
337
338## 2017-05-12, version 3.13.0
339
340- Command line application can now evaluate inline expressions
341 like `mathjs 1+2`. Thanks @slavaGanzin.
342- Function `derivative` now supports `abs`. Thanks @tetslee.
343- Function `simplify` now supports BigNumbers. Thanks @tetslee.
344- Prevent against endless loops in `simplify`. Thanks @tetslee.
345- Fixed #813: function `simplify` converting small numbers to inexact
346 Fractions. Thanks @tetslee.
347- Fixed #838: Function `simplify` now supports constants like `e`.
348 Thanks @tetslee.
349
350
351## 2017-05-05, version 3.12.3
352
353- Fixed security vulnerabilities. Thanks Dan and Sam.
354
355
356## 2017-04-30, version 3.12.2
357
358- Added a rocket trajectory optimization example.
359
360
361## 2017-04-24, version 3.12.1
362
363- Fixed #804
364 - Improved handling of powers of `Infinity`. Thanks @HarrySarson.
365 - Fixed wrong formatting of complex NaN.
366- Fixed security vulnerabilities in the expression parser.
367 Thanks Sam and Dan.
368
369
370## 2017-04-17, version 3.12.0
371
372- Implemented QR decomposition, function `math.qr`. Thanks @HarrySarson.
373- Fixed #824: Calling `math.random()` freezes IE and node.js.
374
375
376## 2017-04-08, version 3.11.5
377
378- More security measures in the expression parser.
379 WARNING: the behavior of the expression parser is now more strict,
380 some undocumented features may not work any longer.
381 - Accessing and assigning properties is now only allowed on plain
382 objects, not on classes, arrays, and functions anymore.
383 - Accessing methods is restricted to a set of known, safe methods.
384
385
386## 2017-04-03, version 3.11.4
387
388- Fixed a security vulnerability in the expression parser. Thanks @xfix.
389
390
391## 2017-04-03, version 3.11.3
392
393- Fixed a security vulnerability in the expression parser. Thanks @xfix.
394
395
396## 2017-04-03, version 3.11.2
397
398- Fixed a security vulnerability in the expression parser. Thanks @xfix.
399
400
401## 2017-04-02, version 3.11.1
402
403- Fixed security vulnerabilities in the expression parser.
404 Thanks Joe Vennix and @xfix.
405
406
407## 2017-04-02, version 3.11.0
408
409- Implemented method Unit.toSI() to convert a unit to base SI units.
410 Thanks @ericman314.
411- Fixed #821, #822: security vulnerabilities in the expression parser.
412 Thanks @comex and @xfix.
413
414
415## 2017-03-31, version 3.10.3
416
417- More security fixes related to the ones fixed in `v3.10.2`.
418
419
420## 2017-03-31, version 3.10.2
421
422- Fixed a security vulnerability in the expression parser allowing
423 execution of arbitrary JavaScript. Thanks @CapacitorSet and @denvit.
424
425
426## 2017-03-26, version 3.10.1
427
428- Fixed `xgcd` for negative values. Thanks @litmit.
429- Fixed #807: function transform of existing functions not being removed when
430 overriding such a function.
431
432
433## 2017-03-05, version 3.10.0
434
435- Implemented function `reshape`. Thanks @patgrasso and @ericman314.
436- Implemented configuration option `seedRandom` for deterministic random
437 numbers. Thanks @morsecodist.
438- Small fixes in the docs. Thanks @HarrySarson.
439- Dropped support for component package manager (which became deprecated about
440 one and a half year ago).
441
442
443## 2017-02-22, version 3.9.3
444
445- Fixed #797: issue with production builds of React Native projects.
446- Fixed `math.round` not accepting inputs `NaN`, `Infinity`, `-Infinity`.
447- Upgraded all dependencies.
448
449
450## 2017-02-16, version 3.9.2
451
452- Fixed #795: Parse error in case of a multi-line expression with just comments.
453
454
455## 2017-02-06, version 3.9.1
456
457- Fixed #789: Math.js not supporting conversion of `string` to `BigNumber`,
458 `Fraction`, or `Complex` number.
459- Fixed #790: Expression parser did not pass function arguments of enclosing
460 functions via `scope` to functions having `rawArgs = true`.
461- Small fixes in the docs. Thanks @HarrySarson.
462
463
464## 2017-01-23, version 3.9.0
465
466- Implemented support for algebra: powerful new functions `simplify` and
467 `derivative`. Thanks @ericman314, @tetslee, and @BigFav.
468- Implemented Kronecker Product `kron`. Thanks @adamisntdead.
469- Reverted `FunctionNode` not accepting a string as function name anymore.
470- Fixed #765: `FunctionAssignmentNode.toString()` returning a string
471 incompatible with the function assignment syntax.
472
473
474## 2016-12-15, version 3.8.1
475
476- Implemented function `mad` (median absolute deviation). Thanks @ruhleder.
477- Fixed #762: expression parser failing to invoke a function returned
478 by a function.
479
480
481## 2016-11-18, version 3.8.0
482
483- Functions `add` and `multiply` now accept more than two arguments. See #739.
484- `OperatorNode` now supports more than two arguments. See #739. Thanks @FSMaxB.
485- Implemented a method `Node.cloneDeep` for the expression nodes. See #745.
486- Fixed a bug in `Node.clone()` not cloning implicit multiplication correctly.
487 Thanks @FSMaxB.
488- Fixed #737: Improved algorithm determining the best prefix for units.
489 It will now retain the original unit like `1 cm` when close enough,
490 instead of returning `10 mm`. Thanks @ericman314.
491- Fixed #732: Allow letter-like unicode characters like Ohm `\u2126`.
492- Fixed #749: Units `rad`, `deg`, and `grad` can now have prefixes like `millirad`.
493- Some fixes in the docs and comments of examples. Thanks @HarrySarson.
494
495
496## 2016-11-05, version 3.7.0
497
498- Implemented method `Node.equals(other)` for all nodes of the expression parser.
499- Implemented BigNumber support in function `arg()`.
500- Command Line Interface loads faster.
501- Implicit conversions between Fractions and BigNumbers throw a neat error now
502 (See #710).
503
504
505## 2016-10-21, version 3.6.0
506
507- Implemented function `erf()`. THanks @patgrasso.
508- Extended function `cross()` to support n-d vectors. Thanks @patgrasso.
509- Extended function `pickRandom` with the option to pick multiple values from
510 an array and give the values weights: `pickRandom(possibles, number, weights)`.
511 Thanks @woylie.
512- Parser now exposes test functions like `isAlpha` which can be replaced in
513 order to adjust the allowed characters in variables names (See #715).
514- Fixed #727: Parser not throwing an error for invalid implicit multiplications
515 like `-2 2` and `2^3 4` (right after the second value of an operator).
516- Fixed #688: Describe allowed variable names in the docs.
517
518
519## 2016-09-21, version 3.5.3
520
521- Some more fixes regarding numbers ending with a decimal mark (like `2.`).
522
523
524## 2016-09-20, version 3.5.2
525
526- Fixed numbers ending with a decimal mark (like `2.`) not being supported by
527 the parser, solved the underlying ambiguity in the parser. See #707, #711.
528
529
530## 2016-09-12, version 3.5.1
531
532- Removed a left over console.log statement. Thanks @eknkc.
533
534
535## 2016-09-07, version 3.5.0
536
537- Comments of expressions are are now stored in the parsed nodes. See #690.
538- Fixed function `print` not accepting an Object with formatting options as
539 third parameter Thanks @ThomasBrierley.
540- Fixed #707: The expression parser no longer accepts numbers ending with a dot
541 like `2.`.
542
543
544## 2016-08-08, version 3.4.1
545
546- Fixed broken bundle files (`dist/math.js`, `dist/math.min.js`).
547- Fixed some layout issues in the function reference docs.
548
549
550## 2016-08-07, version 3.4.0
551
552- Implemented support for custom units using `createUnit`. Thanks @ericman314.
553- Implemented function `splitUnits`. Thanks @ericman314.
554- Implemented function `isPrime`. Thanks @MathBunny.
555
556
557## 2016-07-05, version 3.3.0
558
559- Implemented function `isNaN`.
560- Function `math.filter` now passes three arguments to the callback function:
561 value, index, and array.
562- Removed the check on the number of arguments from functions defined in the
563 expression parser (see #665).
564- Fixed #665: functions `map`, `forEach`, and `filter` now invoke callbacks
565 which are a typed-function with the correct number of arguments.
566
567
568## 2016-04-26, version 3.2.1
569
570- Fixed #651: unable to perform calculations on "Unit-less" units.
571- Fixed matrix.subset mutating the replacement matrix when unsqueezing it.
572
573
574## 2016-04-16, version 3.2.0
575
576- Implemented #644: method `Parser.getAll()` to retrieve all defined variables.
577- Upgraded dependencies (decimal.js@5.0.8, fraction.js@3.3.1,
578 typed-function@0.10.4).
579- Fixed #601: Issue with unnamed typed-functions by upgrading to
580 typed-function v0.10.4.
581- Fixed #636: More strict `toTex` templates, reckon with number of arguments.
582- Fixed #641: Bug in expression parser parsing implicit multiplication with
583 wrong precedence in specific cases.
584- Fixed #645: Added documentation about `engineering` notation of function
585 `math.format`.
586
587
588## 2016-04-03, version 3.1.4
589
590- Using ES6 Math functions like `Math.sinh`, `Math.cbrt`, `Math.sign`, etc when
591 available.
592- Fixed #631: unit aliases `weeks`, `months`, and `years` where missing.
593- Fixed #632: problem with escaped backslashes at the end of strings.
594- Fixed #635: `Node.toString` options where not passed to function arguments.
595- Fixed #629: expression parser throws an error when passing a number with
596 decimal exponent instead of parsing them as implicit multiplication.
597- Fixed #484, #555: inaccuracy of `math.sinh` for values between -1 and 1.
598- Fixed #625: Unit `in` (`inch`) not always working due to ambiguity with
599 the operator `a in b` (alias of `a to b`).
600
601
602## 2016-03-24, version 3.1.3
603
604- Fix broken bundle.
605
606
607## 2016-03-24, version 3.1.2
608
609- Fix broken npm release.
610
611
612## 2016-03-24, version 3.1.1
613
614- Fixed #621: a bug in parsing implicit multiplications like `(2)(3)+4`.
615- Fixed #623: `nthRoot` of zero with a negative root returned `0` instead of
616 `Infinity`.
617- Throw an error when functions `min`, `max`, `mean`, or `median` are invoked
618 with multiple matrices as arguments (see #598).
619
620
621## 2016-03-19, version 3.1.0
622
623- Hide multiplication operator by default when outputting `toTex` and `toString`
624 for implicit multiplications. Implemented and option to output the operator.
625- Implemented unit `kip` and alias `kips`. Thanks @hgupta9.
626- Added support for prefixes for units `mol` and `mole`. Thanks @stu-blair.
627- Restored support for implicit multiplications like `2(3+4)` and `(2+3)(4+5)`.
628- Some improvements in the docs.
629- Added automatic conversions from `boolean` and `null` to `Fraction`,
630 and conversions from `Fraction` to `Complex`.
631
632
633## 2016-03-04, version 3.0.0
634
635### breaking changes
636
637- More restricted support for implicit multiplication in the expression
638 parser: `(...)(...)` is now evaluated as a function invocation,
639 and `[...][...]` as a matrix subset.
640- Matrix multiplication no longer squeezes scalar outputs to a scalar value,
641 but leaves them as they are: a vector or matrix containing a single value.
642 See #529.
643- Assignments in the expression parser now return the assigned value rather
644 than the created or updated object (see #533). Example:
645
646 ```
647 A = eye(3)
648 A[1,1] = 2 # this assignment now returns 2 instead of A
649 ```
650
651- Expression parser now supports objects. This involves a refactoring and
652 extension in expression nodes:
653 - Implemented new node `ObjectNode`.
654 - Refactored `AssignmentNode`, `UpdateNode`, and `IndexNode` are refactored
655 into `AccessorNode`, `AssignmentNode`, and `IndexNode` having a different API.
656- Upgraded the used BigNumber library `decimal.js` to v5. Replaced the
657 trigonometric functions of math.js with those provided in decimal.js v5.
658 This can give slightly different behavior qua round-off errors.
659- Replaced the internal `Complex.js` class with the `complex.js` library
660 created by @infusion.
661- Entries in a matrix (typically numbers, BigNumbers, Units, etc) are now
662 considered immutable, they are no longer copied when performing operations on
663 the entries, improving performance.
664- Implemented nearly equal comparison for relational functions (`equal`,
665 `larger`, `smaller`, etc.) when using BigNumbers.
666- Changed the casing of the configuration options `matrix` (`Array` or `Matrix`)
667 and `number` (`number`, `BigNumber`, `Fraction`) such that they now match
668 the type returned by `math.typeof`. Wrong casing gives a console warning but
669 will still work.
670- Changed the default config value for `epsilon` from `1e-14` to `1e-12`,
671 see #561.
672
673### non-breaking changes
674
675- Extended function `pow` to return the real root for cubic roots of negative
676 numbers. See #525, #482, #567.
677- Implemented support for JSON objects in the expression parser and the
678 function `math.format`.
679- Function `math.fraction` now supports `BigNumber`, and function
680 `math.bignumber` now supports `Fraction`.
681- Expression parser now allows function and/or variable assignments inside
682 accessors and conditionals, like `A[x=2]` or `a > 2 ? b="ok" : b="fail"`.
683- Command line interface:
684 - Outputs the variable name of assignments.
685 - Fixed not rounding BigNumbers to 14 digits like numbers.
686 - Fixed non-working autocompletion of user defined variables.
687- Reorganized and extended docs, added docs on classes and more. Thanks @hgupta9.
688- Added new units `acre`, `hectare`, `torr`, `bar`, `mmHg`, `mmH2O`, `cmH2O`,
689 and added new aliases `acres`, `hectares`, `sqfeet`, `sqyard`, `sqmile`,
690 `sqmiles`, `mmhg`, `mmh2o`, `cmh2o`. Thanks @hgupta9.
691- Fixed a bug in the toString method of an IndexNode.
692- Fixed angle units `deg`, `rad`, `grad`, `cycle`, `arcsec`, and `arcmin` not
693 being defined as BigNumbers when configuring to use BigNumbers.
694
695
696## 2016-02-03, version 2.7.0
697
698- Added more unit aliases for time: `secs`, `mins`, `hr`, `hrs`. See #551.
699- Added support for doing operations with mixed `Fractions` and `BigNumbers`.
700- Fixed #540: `math.intersect()` returning null in some cases. Thanks @void42.
701- Fixed #546: Cannot import BigNumber, Fraction, Matrix, Array.
702 Thanks @brettjurgens.
703
704
705## 2016-01-08, version 2.6.0
706
707- Implemented (complex) units `VA` and `VAR`.
708- Implemented time units for weeks, months, years, decades, centuries, and
709 millennia. Thanks @owenversteeg.
710- Implemented new notation `engineering` in function `math.format`.
711 Thanks @johnmarinelli.
712- Fixed #523: In some circumstances, matrix subset returned a scalar instead
713 of the correct subset.
714- Fixed #536: A bug in an internal method used for sparse matrices.
715
716
717## 2015-12-05, version 2.5.0
718
719- Implemented support for numeric types `Fraction` and `BigNumber` in units.
720- Implemented new method `toNumeric` for units.
721- Implemented new units `arcsec`, `arcsecond`, `arcmin`, `arcminute`.
722 Thanks @devdevdata222.
723- Implemented new unit `Herts` (`Hz`). Thanks @SwamWithTurtles.
724- Fixed #485: Scoping issue with variables both used globally as well as in a
725 function definition.
726- Fixed: Function `number` didn't support `Fraction` as input.
727
728
729## 2015-11-14, version 2.4.2
730
731- Fixed #502: Issue with `format` in some JavaScript engines.
732- Fixed #503: Removed trailing commas and the use of keyword `import` as
733 property, as this gives issues with old JavaScript engines.
734
735
736## 2015-10-29, version 2.4.1
737
738- Fixed #480: `nthRoot` not working on Internet Explorer (up to IE 11).
739- Fixed #490: `nthRoot` returning an error for negative values like
740 `nthRoot(-2, 3)`.
741- Fixed #489: an issue with initializing a sparse matrix without data.
742 Thanks @Retsam.
743- Fixed: #493: function `combinations` did not throw an exception for
744 non-integer values of `k`.
745- Fixed: function `import` did not override typed functions when the option
746 override was set true.
747- Fixed: added functions `math.sparse` and `math.index` to the reference docs,
748 they where missing.
749- Fixed: removed memoization from `gamma` and `factorial` functions, this
750 could blow up memory.
751
752
753## 2015-10-09, version 2.4.0
754
755- Added support in the expression parser for mathematical alphanumeric symbols
756 in the expression parser: unicode range \u{1D400} to \u{1D7FF} excluding
757 invalid code points.
758- Extended function `distance` with more signatures. Thanks @kv-kunalvyas.
759- Fixed a bug in functions `sin` and `cos`, which gave wrong results for
760 BigNumber integer values around multiples of tau (i.e. `sin(bignumber(7))`).
761- Fixed value of unit `stone`. Thanks @Esvandiary for finding the error.
762
763
764## 2015-09-19, version 2.3.0
765
766- Implemented function `distance`. Thanks @devanp92.
767- Implemented support for Fractions in function `lcm`. Thanks @infusion.
768- Implemented function `cbrt` for numbers, complex numbers, BigNumbers, Units.
769- Implemented function `hypot`.
770- Upgraded to fraction.js v3.0.0.
771- Fixed #450: issue with non sorted index in sparse matrices.
772- Fixed #463, #322: inconsistent handling of implicit multiplication.
773- Fixed #444: factorial of infinity not returning infinity.
774
775
776## 2015-08-30, version 2.2.0
777
778- Units with powers (like `m^2` and `s^-1`) now output with the best prefix.
779- Implemented support for units to `abs`, `cube`, `sign`, `sqrt`, `square`.
780 Thanks @ericman314.
781- Implemented function `catalan` (Combinatorics). Thanks @devanp92.
782- Improved the `canDefineProperty` check to return false in case of IE8, which
783 has a broken implementation of `defineProperty`. Thanks @golmansax.
784- Fixed function `to` not working in case of a simplified unit.
785- Fixed #437: an issue with row swapping in `lup`, also affecting `lusolve`.
786
787
788## 2015-08-12, version 2.1.1
789
790- Fixed wrong values of the physical constants `speedOfLight`, `molarMassC12`,
791 and `magneticFluxQuantum`. Thanks @ericman314 for finding two of them.
792
793
794## 2015-08-11, version 2.1.0
795
796- Implemented derived units (like `110 km/h in m/s`). Thanks @ericman314.
797- Implemented support for electric units. Thanks @ericman314.
798- Implemented about 50 physical constants like `speedOfLight`, `gravity`, etc.
799- Implemented function `kldivergence` (Kullback-Leibler divergence).
800 Thanks @saromanov.
801- Implemented function `mode`. Thanks @kv-kunalvyas.
802- Added support for unicode characters in the expression parser: greek letters
803 and latin letters with accents. See #265.
804- Internal functions `Unit.parse` and `Complex.parse` now throw an Error
805 instead of returning null when passing invalid input.
806
807
808## 2015-07-29, version 2.0.1
809
810- Fixed operations with mixed fractions and numbers be converted to numbers
811 instead of fractions.
812
813
814## 2015-07-28, version 2.0.0
815
816- Large internal refactoring:
817 - performance improvements.
818 - allows to create custom bundles
819 - functions are composed using `typed-function` and are extensible
820- Implemented support for fractions, powered by the library `fraction.js`.
821- Implemented matrix LU decomposition with partial pivoting and a LU based
822 linear equations solver (functions `lup` and `lusolve`). Thanks @rjbaucells.
823- Implemented a new configuration option `predictable`, which can be set to
824 true in order to ensure predictable function output types.
825- Implemented function `intersect`. Thanks @kv-kunalvyas.
826- Implemented support for adding `toTex` properties to custom functions.
827 Thanks @FSMaxB.
828- Implemented support for complex values to `nthRoot`. Thanks @gangachris.
829- Implemented util functions `isInteger`, `isNegative`, `isNumeric`,
830 `isPositive`, and `isZero`.
831
832### breaking changes
833
834- String input is now converted to numbers by default for all functions.
835- Adding two strings will no longer concatenate them, but will convert the
836 strings to numbers and add them.
837- Function `index` does no longer accept an array `[start, end, step]`, but
838 instead accepts an array with arbitrary index values. It also accepts
839 a `Range` object as input.
840- Function `typeof` no longer returns lower case names, but now returns lower
841 case names for primitives (like `number`, `boolean`, `string`), and
842 upper-camel-case for non-primitives (like `Array`, `Complex`, `Function`).
843- Function `import` no longer supports a module name as argument. Instead,
844 modules can be loaded using require: `math.import(require('module-name'))`.
845- Function `import` has a new option `silent` to ignore errors, and throws
846 errors on duplicates by default.
847- Method `Node.compile()` no longer needs `math` to be passed as argument.
848- Reintroduced method `Node.eval([scope])`.
849- Function `sum` now returns zero when input is an empty array. Thanks @FSMAxB.
850- The size of Arrays is no longer validated. Matrices will validate this on
851 creation.
852
853
854## 2015-07-12, version 1.7.1
855
856- Fixed #397: Inaccuracies in nthRoot for very large values, and wrong results
857 for very small values. (backported from v2)
858- Fixed #405: Parser throws error when defining a function in a multiline
859 expression.
860
861
862## 2015-05-31, version 1.7.0
863
864- Implemented function `quantileSeq` and `partitionSelect`. Thanks @BigFav.
865- Implemented functions `stirlingS2`, `bellNumbers`, `composition`, and
866 `multinomial`. Thanks @devanp92.
867- Improved the performance of `median` (see #373). Thanks @BigFav.
868- Extended the command line interface with a `mode` option to output either
869 the expressions result, string representation, or tex representation.
870 Thanks @FSMaxB.
871- Fixed #309: Function median mutating the input matrix. Thanks @FSMaxB.
872- Fixed `Node.transform` not recursing over replaced parts of the
873 node tree (see #349).
874- Fixed #381: issue in docs of `randomInt`.
875
876
877## 2015-04-22, version 1.6.0
878
879- Improvements in `toTex`. Thanks @FSMaxB.
880- Fixed #328: `abs(0 + 0i)` evaluated to `NaN`.
881- Fixed not being able to override lazy loaded constants.
882
883
884## 2015-04-09, version 1.5.2
885
886- Fixed #313: parsed functions did not handle recursive calls correctly.
887- Fixed #251: binary prefix and SI prefix incorrectly used for byte. Now
888 following SI standards (`1 KiB == 1024 B`, `1 kB == 1000 B`).
889- Performance improvements in parsed functions.
890
891
892## 2015-04-08, version 1.5.1
893
894- Fixed #316: a bug in rounding values when formatting.
895- Fixed #317, #319: a bug in formatting negative values.
896
897
898## 2015-03-28, version 1.5.0
899
900- Added unit `stone` (6.35 kg).
901- Implemented support for sparse matrices. Thanks @rjbaucells.
902- Implemented BigNumber support for function `atan2`. Thanks @BigFav.
903- Implemented support for custom LaTeX representations. Thanks @FSMaxB.
904- Improvements and bug fixes in outputting parentheses in `Node.toString` and
905 `Node.toTex` functions. Thanks @FSMaxB.
906- Fixed #291: function `format` sometimes returning exponential notation when
907 it should return a fixed notation.
908
909
910## 2015-02-28, version 1.4.0
911
912- Implemented trigonometric functions:
913 `acosh`, `acoth`, `acsch`, `asech`, `asinh`, `atanh`, `acot`, `acsc`, `asec`.
914 Thanks @BigFav.
915- Added BigNumber support for functions: `cot`, `csc`, `sec`, `coth`,
916 `csch`, `sech`. Thanks @BigFav.
917- Implemented support for serialization and deserialization of math.js data
918 types.
919- Fixed the calculation of `norm()` and `abs()` for large complex numbers.
920 Thanks @rjbaucells.
921- Fixed #281: improved formatting complex numbers. Round the real or imaginary
922 part to zero when the difference is larger than the configured precision.
923
924
925## 2015-02-09, version 1.3.0
926
927- Implemented BigNumber implementations of most trigonometric functions: `sin`,
928 `cos`, `tan`, `asin`, `acos`, `atan`, `cosh`, `sinh`, `tanh`. Thanks @BigFav.
929- Implemented function `trace`. Thanks @pcorey.
930- Faster loading of BigNumber configuration with a high precision by lazy
931 loading constants like `pi` and `e`.
932- Fixed constants `NaN` and `Infinity` not being BigNumber objects when
933 BigNumbers are configured.
934- Fixed missing parentheses in the `toTex` representation of function
935 `permutations`.
936- Some minor fixes in the docs. Thanks @KenanY.
937
938
939## 2014-12-25, version 1.2.0
940
941- Support for bitwise operations `bitAnd`, `bitNot`, `bitOr`, `bitXor`,
942 `leftShift`, `rightArithShift`, and `rightLogShift`. Thanks @BigFav.
943- Support for boolean operations `and`, `not`, `or`, `xor`. Thanks @BigFav.
944- Support for `gamma` function. Thanks @BigFav.
945- Converting a unit without value will now result in a unit *with* value,
946 i.e. `inch in cm` will return `2.54 cm` instead of `cm`.
947- Improved accuracy of `sinh` and complex `cos` and `sin`. Thanks @pavpanchekha.
948- Renamed function `select` to `chain`. The old function `select` will remain
949 functional until math.js v2.0.
950- Upgraded to decimal.js v4.0.1 (BigNumber library).
951
952
953## 2014-11-22, version 1.1.1
954
955- Fixed Unit divided by Number returning zero.
956- Fixed BigNumber downgrading to Number for a negative base in `pow`.
957- Fixed some typos in error messaging (thanks @andy0130tw) and docs.
958
959
960## 2014-11-15, version 1.1.0
961
962- Implemented functions `dot` (dot product), `cross` (cross product), and
963 `nthRoot`.
964- Officially opened up the API of expression trees:
965 - Documented the API.
966 - Implemented recursive functions `clone`, `map`, `forEach`, `traverse`,
967 `transform`, and `filter` for expression trees.
968 - Parameter `index` in the callbacks of `map` and `forEach` are now cloned
969 for every callback.
970 - Some internal refactoring inside nodes to make the API consistent:
971 - Renamed `params` to `args` and vice versa to make things consistent.
972 - Renamed `Block.nodes` to `Block.blocks`.
973 - `FunctionNode` now has a `name: string` instead of a `symbol: SymbolNode`.
974 - Changed constructor of `RangeNode` to
975 `new RangeNode(start: Node, end: Node [, step: Node])`.
976 - Nodes for a `BlockNode` must now be passed via the constructor instead
977 of via a function `add`.
978- Fixed `2e` giving a syntax error instead of being parsed as `2 * e`.
979
980
981## 2014-09-12, version 1.0.1
982
983- Disabled array notation for ranges in a matrix index in the expression parser
984 (it is confusing and redundant there).
985- Fixed a regression in the build of function subset not being able to return
986 a scalar.
987- Fixed some missing docs and broken links in the docs.
988
989
990## 2014-09-04, version 1.0.0
991
992- Implemented a function `filter(x, test)`.
993- Removed `math.distribution` for now, needs some rethinking.
994- `math.number` can convert units to numbers (requires a second argument)
995- Fixed some precedence issues with the range and conversion operators.
996- Fixed an zero-based issue when getting a matrix subset using an index
997 containing a matrix.
998
999
1000## 2014-08-21, version 0.27.0
1001
1002- Implemented functions `sort(x [, compare])` and `flatten(x)`.
1003- Implemented support for `null` in all functions.
1004- Implemented support for "rawArgs" functions in the expression parser. Raw
1005 functions are invoked with unevaluated parameters (nodes).
1006- Expressions in the expression parser can now be spread over multiple lines,
1007 like '2 +\n3'.
1008- Changed default value of the option `wrap` of function `math.import` to false.
1009- Changed the default value for new entries in a resized matrix when to zero.
1010 To leave new entries uninitialized, use the new constant `math.uninitialized`
1011 as default value.
1012- Renamed transform property from `__transform__` to `transform`, and documented
1013 the transform feature.
1014- Fixed a bug in `math.import` not applying options when passing a module name.
1015- A returned matrix subset is now only squeezed when the `index` consists of
1016 scalar values, and no longer for ranges resolving into a single value.
1017
1018
1019## 2014-08-03, version 0.26.0
1020
1021- A new instance of math.js can no longer be created like `math([options])`,
1022 to prevent side effects from math being a function instead of an object.
1023 Instead, use the function `math.create([options])` to create a new instance.
1024- Implemented `BigNumber` support for all constants: `pi`, `tau`, `e`, `phi`,
1025 `E`, `LN2`, `LN10`, `LOG2E`, `LOG10E`, `PI`, `SQRT1_2`, and `SQRT2`.
1026- Implemented `BigNumber` support for functions `gcd`, `xgcd`, and `lcm`.
1027- Fixed function `gxcd` returning an Array when math.js was configured
1028 as `{matrix: 'matrix'}`.
1029- Multi-line expressions now return a `ResultSet` instead of an `Array`.
1030- Implemented transforms (used right now to transform one-based indices to
1031 zero-based for expressions).
1032- When used inside the expression parser, functions `concat`, `min`, `max`,
1033 and `mean` expect an one-based dimension number.
1034- Functions `map` and `forEach` invoke the callback with one-based indices
1035 when used from within the expression parser.
1036- When adding or removing dimensions when resizing a matrix, the dimensions
1037 are added/removed from the inner side (right) instead of outer side (left).
1038- Improved index out of range errors.
1039- Fixed function `concat` not accepting a `BigNumber` for parameter `dim`.
1040- Function `squeeze` now squeezes both inner and outer singleton dimensions.
1041- Output of getting a matrix subset is not automatically squeezed anymore
1042 except for scalar output.
1043- Renamed `FunctionNode` to `FunctionAssignmentNode`, and renamed `ParamsNode`
1044 to `FunctionNode` for more clarity.
1045- Fixed broken auto completion in CLI.
1046- Some minor fixes.
1047
1048
1049## 2014-07-01, version 0.25.0
1050
1051- The library now immediately returns a default instance of mathjs, there is
1052 no need to instantiate math.js in a separate step unless one ones to set
1053 configuration options:
1054
1055 // instead of:
1056 var mathjs = require('mathjs'), // load math.js
1057 math = mathjs(); // create an instance
1058
1059 // just do:
1060 var math = require('mathjs');
1061- Implemented support for implicit multiplication, like `math.eval('2a', {a:3})`
1062 and `math.eval('(2+3)(1-3)')`. This changes behavior of matrix indexes as
1063 well: an expression like `[...][...]` is not evaluated as taking a subset of
1064 the first matrix, but as an implicit multiplication of two matrices.
1065- Removed utility function `ifElse`. This function is redundant now the
1066 expression parser has a conditional operator `a ? b : c`.
1067- Fixed a bug with multiplying a number with a temperature,
1068 like `math.eval('10 * celsius')`.
1069- Fixed a bug with symbols having value `undefined` not being evaluated.
1070
1071
1072## 2014-06-20, version 0.24.1
1073
1074- Something went wrong with publishing on npm.
1075
1076
1077## 2014-06-20, version 0.24.0
1078
1079- Added constant `null`.
1080- Functions `equal` and `unequal` support `null` and `undefined` now.
1081- Function `typeof` now recognizes regular expressions as well.
1082- Objects `Complex`, `Unit`, and `Help` now return their string representation
1083 when calling `.valueOf()`.
1084- Changed the default number of significant digits for BigNumbers from 20 to 64.
1085- Changed the behavior of the conditional operator (a ? b : c) to lazy
1086 evaluating.
1087- Fixed imported, wrapped functions not accepting `null` and `undefined` as
1088 function arguments.
1089
1090
1091## 2014-06-10, version 0.23.0
1092
1093- Renamed some functions (everything now has a logical, camel case name):
1094 - Renamed functions `edivide`, `emultiply`, and `epow` to `dotDivide`,
1095 `dotMultiply`, and `dotPow` respectively.
1096 - Renamed functions `smallereq` and `largereq` to `smallerEq` and `largerEq`.
1097 - Renamed function `unary` to `unaryMinus` and added support for strings.
1098- `end` is now a reserved keyword which cannot be used as function or symbol
1099 name in the expression parser, and is not allowed in the scope against which
1100 an expression is evaluated.
1101- Implemented function `unaryPlus` and unary plus operator.
1102- Implemented function `deepEqual` for matrix comparisons.
1103- Added constant `phi`, the golden ratio (`phi = 1.618...`).
1104- Added constant `version`, returning the version number of math.js as string.
1105- Added unit `drop` (`gtt`).
1106- Fixed not being able to load math.js using AMD/require.js.
1107- Changed signature of `math.parse(expr, nodes)` to `math.parse(expr, options)`
1108 where `options: {nodes: Object.<String, Node>}`
1109- Removed matrix support from conditional function `ifElse`.
1110- Removed automatic assignment of expression results to variable `ans`.
1111 This functionality can be restored by pre- or postprocessing every evaluation,
1112 something like:
1113
1114 function evalWithAns (expr, scope) {
1115 var ans = math.eval(expr, scope);
1116 if (scope) {
1117 scope.ans = ans;
1118 }
1119 return ans;
1120 }
1121
1122
1123## 2014-05-22, version 0.22.0
1124
1125- Implemented support to export expressions to LaTeX. Thanks Niels Heisterkamp
1126 (@nheisterkamp).
1127- Output of matrix multiplication is now consistently squeezed.
1128- Added reference documentation in the section /docs/reference.
1129- Fixed a bug in multiplying units without value with a number (like `5 * cm`).
1130- Fixed a bug in multiplying two matrices containing vectors (worked fine for
1131 arrays).
1132- Fixed random functions not accepting Matrix as input, and always returning
1133 a Matrix as output.
1134
1135
1136## 2014-05-13, version 0.21.1
1137
1138- Removed `crypto` library from the bundle.
1139- Deprecated functions `Parser.parse` and `Parser.compile`. Use
1140 `math.parse` and `math.compile` instead.
1141- Fixed function `add` not adding strings and matrices element wise.
1142- Fixed parser not being able to evaluate an exponent followed by a unary minus
1143 like `2^-3`, and a transpose followed by an index like `[3]'[1]`.
1144
1145
1146## 2014-04-24, version 0.21.0
1147
1148- Implemented trigonometric hyperbolic functions `cosh`, `coth`, `csch`,
1149 `sech`, `sinh`, `tanh`. Thanks Rogelio J. Baucells (@rjbaucells).
1150- Added property `type` to all expression nodes in an expression tree.
1151- Fixed functions `log`, `log10`, `pow`, and `sqrt` not supporting complex
1152 results from BigNumber input (like `sqrt(bignumber(-4))`).
1153
1154
1155## 2014-04-16, version 0.20.0
1156
1157- Switched to module `decimal.js` for BigNumber support, instead of
1158 `bignumber.js`.
1159- Implemented support for polar coordinates to the `Complex` datatype.
1160 Thanks Finn Pauls (@finnp).
1161- Implemented BigNumber support for functions `exp`, `log`, and `log10`.
1162- Implemented conditional operator `a ? b : c` in expression parser.
1163- Improved floating point comparison: the functions now check whether values
1164 are nearly equal, against a configured maximum relative difference `epsilon`.
1165 Thanks Rogelio J. Baucells (@rjbaucells).
1166- Implemented function `norm`. Thanks Rogelio J. Baucells (@rjbaucells).
1167- Improved function `ifElse`, is now specified for special data types too.
1168- Improved function `det`. Thanks Bryan Cuccioli (@bcuccioli).
1169- Implemented `BigNumber` support for functions `det` and `diag`.
1170- Added unit alias `lbs` (pound mass).
1171- Changed configuration option `decimals` to `precision` (applies to BigNumbers
1172 only).
1173- Fixed support for element-wise comparisons between a string and a matrix.
1174- Fixed: expression parser now trows IndexErrors with one-based indices instead
1175 of zero-based.
1176- Minor bug fixes.
1177
1178
1179## 2014-03-30, version 0.19.0
1180
1181- Implemented functions `compare`, `sum`, `prod`, `var`, `std`, `median`.
1182- Implemented function `ifElse` Thanks @mtraynham.
1183- Minor bug fixes.
1184
1185
1186## 2014-02-15, version 0.18.1
1187
1188- Added unit `feet`.
1189- Implemented function `compile` (shortcut for parsing and then compiling).
1190- Improved performance of function `pow` for matrices. Thanks @hamadu.
1191- Fixed broken auto completion in the command line interface.
1192- Fixed an error in function `combinations` for large numbers, and
1193 improved performance of both functions `combinations` and `permutations`.
1194
1195
1196## 2014-01-18, version 0.18.0
1197
1198- Changed matrix index notation of expression parser from round brackets to
1199 square brackets, for example `A[1, 1:3]` instead of `A(1, 1:3)`.
1200- Removed need to use the `function` keyword for function assignments in the
1201 expression parser, you can define a function now like `f(x) = x^2`.
1202- Implemented a compilation step in the expression parser: expressions are
1203 compiled into JavaScript, giving much better performance (easily 10x as fast).
1204- Renamed unit conversion function and operator `in` to `to`. Operator `in` is
1205 still available in the expression parser as an alias for `to`. Added unit
1206 `in`, an abbreviation for `inch`. Thanks Elijah Insua (@tmpvar).
1207- Added plurals and aliases for units.
1208- Implemented an argument `includeEnd` for function `range` (false by default).
1209- Ranges in the expression parser now support big numbers.
1210- Implemented functions `permutations` and `combinations`.
1211 Thanks Daniel Levin (@daniel-levin).
1212- Added lower case abbreviation `l` for unit litre.
1213
1214
1215## 2013-12-19, version 0.17.1
1216
1217- Fixed a bug with negative temperatures.
1218- Fixed a bug with prefixes of units squared meter `m2` and cubic meter `m3`.
1219
1220
1221## 2013-12-12, version 0.17.0
1222
1223- Renamed and flattened configuration settings:
1224 - `number.defaultType` is now `number`.
1225 - `number.precision` is now `decimals`.
1226 - `matrix.defaultType` is now `matrix`.
1227- Function `multiply` now consistently outputs a complex number on complex input.
1228- Fixed `mod` and `in` not working as function (only as operator).
1229- Fixed support for old browsers (IE8 and older), compatible when using es5-shim.
1230- Fixed support for Java's ScriptEngine.
1231
1232
1233## 2013-11-28, version 0.16.0
1234
1235- Implemented BigNumber support for arbitrary precision calculations.
1236 Added settings `number.defaultType` and `number.precision` to configure
1237 big numbers.
1238- Documentation is extended.
1239- Removed utility functions `isScalar`, `toScalar`, `isVector`, `toVector`
1240 from `Matrix` and `Range`. Use `math.squeeze` and `math.size` instead.
1241- Implemented functions `get` and `set` on `Matrix`, for easier and faster
1242 retrieval/replacement of elements in a matrix.
1243- Implemented function `resize`, handling matrices, scalars, and strings.
1244- Functions `ones` and `zeros` now return an empty matrix instead of a
1245 number 1 or 0 when no arguments are provided.
1246- Implemented functions `min` and `max` for `Range` and `Index`.
1247- Resizing matrices now leaves new elements undefined by default instead of
1248 filling them with zeros. Function `resize` now has an extra optional
1249 parameter `defaultValue`.
1250- Range operator `:` in expression parser has been given a higher precedence.
1251- Functions don't allow arguments of unknown type anymore.
1252- Options be set when constructing a math.js instance or using the new function
1253 `config(options`. Options are no longer accessible via `math.options`.
1254- Renamed `scientific` notation to `exponential` in function `format`.
1255- Function `format` outputs exponential notation with positive exponents now
1256 always with `+` sign, so outputs `2.1e+3` instead of `2.1e3`.
1257- Fixed function `squeeze` not being able squeeze into a scalar.
1258- Some fixes and performance improvements in the `resize` and `subset`
1259 functions.
1260- Function `size` now adheres to the option `matrix.defaultType` for scalar
1261 input.
1262- Minor bug fixes.
1263
1264
1265## 2013-10-26, version 0.15.0
1266
1267- Math.js must be instantiated now, static calls are no longer supported. Usage:
1268 - node.js: `var math = require('mathjs')();`
1269 - browser: `var math = mathjs();`
1270- Implemented support for multiplying vectors with matrices.
1271- Improved number formatting:
1272 - Function `format` now support various options: precision, different
1273 notations (`fixed`, `scientific`, `auto`), and more.
1274 - Numbers are no longer rounded to 5 digits by default when formatted.
1275 - Implemented a function `format` for `Matrix`, `Complex`, `Unit`, `Range`,
1276 and `Selector` to format using options.
1277 - Function `format` does only stringify values now, and has a new parameter
1278 `precision` to round to a specific number of digits.
1279 - Removed option `math.options.precision`,
1280 use `math.format(value [, precision])` instead.
1281 - Fixed formatting numbers as scientific notation in some cases returning
1282 a zero digit left from the decimal point. (like "0.33333e8" rather than
1283 "3.3333e7"). Thanks @husayt.
1284- Implemented a function `print` to interpolate values in a template string,
1285 this functionality was moved from the function `format`.
1286- Implemented statistics function `mean`. Thanks Guillermo Indalecio Fernandez
1287 (@guillermobox).
1288- Extended and changed `max` and `min` for multi dimensional matrices: they now
1289 return the maximum and minimum of the flattened array. An optional second
1290 argument `dim` allows to calculate the `max` or `min` for specified dimension.
1291- Renamed option `math.options.matrix.default` to
1292 `math.options.matrix.defaultType`.
1293- Removed support for comparing complex numbers in functions `smaller`,
1294 `smallereq`, `larger`, `largereq`. Complex numbers cannot be ordered.
1295
1296
1297## 2013-10-08, version 0.14.0
1298
1299- Introduced an option `math.options.matrix.default` which can have values
1300 `matrix` (default) or `array`. This option is used by the functions `eye`,
1301 `ones`, `range`, and `zeros`, to determine the type of matrix output.
1302- Getting a subset of a matrix will automatically squeeze the resulting subset,
1303 setting a subset of a matrix will automatically unsqueeze the given subset.
1304- Removed concatenation of nested arrays in the expression parser.
1305 You can now input nested arrays like in JavaScript. Matrices can be
1306 concatenated using the function `concat`.
1307- The matrix syntax `[...]` in the expression parser now creates 1 dimensional
1308 matrices by default. `math.eval('[1,2,3,4]')` returns a matrix with
1309 size `[4]`, `math.eval('[1,2;3,4]')` returns a matrix with size `[2,2]`.
1310- Documentation is restructured and extended.
1311- Fixed non working operator `mod` (modulus operator).
1312
1313
1314## 2013-09-03, version 0.13.0
1315
1316- Implemented support for booleans in all relevant functions.
1317- Implemented functions `map` and `forEach`. Thanks Sebastien Piquemal (@sebpic).
1318- All construction functions can be used to convert the type of variables,
1319 also element-wise for all elements in an Array or Matrix.
1320- Changed matrix indexes of the expression parser to one-based with the
1321 upper-bound included, similar to most math applications. Note that on a
1322 JavaScript level, math.js uses zero-based indexes with excluded upper-bound.
1323- Removed support for scalars in the function `subset`, it now only supports
1324 Array, Matrix, and String.
1325- Removed the functions `get` and `set` from a selector, they are a duplicate
1326 of the function `subset`.
1327- Replaced functions `get` and `set` of `Matrix` with a single function
1328 `subset`.
1329- Some moving around with code and namespaces:
1330 - Renamed namespace `math.expr` to `math.expression` (contains Scope, Parser,
1331 node objects).
1332 - Renamed namespace `math.docs` to `math.expression.docs`.
1333 - Moved `math.expr.Selector` to `math.chaining.Selector`.
1334- Fixed some edge cases in functions `lcm` and `xgcd`.
1335
1336
1337## 2013-08-22, version 0.12.1
1338
1339- Fixed outdated version of README.md.
1340- Fixed a broken unit test.
1341
1342
1343## 2013-08-22, version 0.12.0
1344
1345- Implemented functions `random([min, max])`, `randomInt([min, max])`,
1346 `pickRandom(array)`. Thanks Sebastien Piquemal (@sebpic).
1347- Implemented function `distribution(name)`, generating a distribution object
1348 with functions `random`, `randomInt`, `pickRandom` for different
1349 distributions. Currently supporting `uniform` and `normal`.
1350- Changed the behavior of `range` to exclude the upper bound, so `range(1, 4)`
1351 now returns `[1, 2, 3]` instead of `[1, 2, 3, 4]`.
1352- Changed the syntax of `range`, which is now `range(start, end [, step])`
1353 instead of `range(start, [step, ] end)`.
1354- Changed the behavior of `ones` and `zeros` to geometric dimensions, for
1355 example `ones(3)` returns a vector with length 3, filled with ones, and
1356 `ones(3,3)` returns a 2D array with size [3, 3].
1357- Changed the return type of `ones` and `zeros`: they now return an Array when
1358 arguments are Numbers or an Array, and returns a Matrix when the argument
1359 is a Matrix.
1360- Change matrix index notation in parser from round brackets to square brackets,
1361 for example `A[0, 0:3]`.
1362- Removed the feature introduced in v0.10.0 to automatically convert a complex
1363 value with an imaginary part equal to zero to a number.
1364- Fixed zeros being formatted as null. Thanks @TimKraft.
1365
1366
1367## 2013-07-23, version 0.11.1
1368
1369- Fixed missing development dependency
1370
1371
1372## 2013-07-23, version 0.11.0
1373
1374- Changed math.js from one-based to zero-based indexes.
1375 - Getting and setting matrix subset is now zero-based.
1376 - The dimension argument in function `concat` is now zero-based.
1377- Improvements in the string output of function help.
1378- Added constants `true` and `false`.
1379- Added constructor function `boolean`.
1380- Fixed function `select` not accepting `0` as input.
1381 Thanks Elijah Manor (@elijahmanor).
1382- Parser now supports multiple unary minus operators after each other.
1383- Fixed not accepting empty matrices like `[[], []]`.
1384- Some fixes in the end user documentation.
1385
1386
1387## 2013-07-08, version 0.10.0
1388
1389- For complex calculations, all functions now automatically replace results
1390 having an imaginary part of zero with a Number. (`2i * 2i` now returns a
1391 Number `-4` instead of a Complex `-4 + 0i`).
1392- Implemented support for injecting custom node handlers in the parser. Can be
1393 used for example to implement a node handler for plotting a graph.
1394- Implemented end user documentation and a new `help` function.
1395- Functions `size` and `squeeze` now return a Matrix instead of an Array as
1396 output on Matrix input.
1397- Added a constant tau (2 * pi). Thanks Zak Zibrat (@palimpsests).
1398- Renamed function `unaryminus` to `unary`.
1399- Fixed a bug in determining node dependencies in function assignments.
1400
1401
1402## 2013-06-14, version 0.9.1
1403
1404- Implemented element-wise functions and operators: `emultiply` (`x .* y`),
1405 `edivide` (`x ./ y`), `epow` (`x .^ y`).
1406- Added constants `Infinity` and `NaN`.
1407- Removed support for Workspace to keep the library focused on its core task.
1408- Fixed a bug in the Complex constructor, not accepting NaN values.
1409- Fixed division by zero in case of pure complex values.
1410- Fixed a bug in function multiply multiplying a pure complex value with
1411 Infinity.
1412
1413
1414## 2013-05-29, version 0.9.0
1415
1416- Implemented function `math.parse(expr [,scope])`. Optional parameter scope can
1417 be a plain JavaScript Object containing variables.
1418- Extended function `math.expr(expr [, scope])` with an additional parameter
1419 `scope`, similar to `parse`. Example: `math.eval('x^a', {x:3, a:2});`.
1420- Implemented function `subset`, to get or set a subset from a matrix, string,
1421 or other data types.
1422- Implemented construction functions number and string (mainly useful inside
1423 the parser).
1424- Improved function `det`. Thanks Bryan Cuccioli (@bcuccioli).
1425- Moved the parse code from prototype math.expr.Parser to function math.parse,
1426 simplified Parser a little bit.
1427- Strongly simplified the code of Scope and Workspace.
1428- Fixed function mod for negative numerators, and added error messages in case
1429 of wrong input.
1430
1431
1432## 2013-05-18, version 0.8.2
1433
1434- Extended the import function and some other minor improvements.
1435- Fixed a bug in merging one dimensional vectors into a matrix.
1436- Fixed a bug in function subtract, when subtracting a complex number from a
1437 real number.
1438
1439
1440## 2013-05-10, version 0.8.1
1441
1442- Fixed an npm warning when installing mathjs globally.
1443
1444
1445## 2013-05-10, version 0.8.0
1446
1447- Implemented a command line interface. When math.js is installed globally via
1448 npm, the application is available on your system as 'mathjs'.
1449- Implemented `end` keyword for index operator, and added support for implicit
1450 start and end (expressions like `a(2,:)` and `b(2:end,3:end-1)` are supported
1451 now).
1452- Function math.eval is more flexible now: it supports variables and multi-line
1453 expressions.
1454- Removed the read-only option from Parser and Scope.
1455- Fixed non-working unequal operator != in the parser.
1456- Fixed a bug in resizing matrices when replacing a subset.
1457- Fixed a bug in updating a subset of a non-existing variable.
1458- Minor bug fixes.
1459
1460
1461## 2013-05-04, version 0.7.2
1462
1463- Fixed method unequal, which was checking for equality instead of inequality.
1464 Thanks @FJS2.
1465
1466
1467## 2013-04-27, version 0.7.1
1468
1469- Improvements in the parser:
1470 - Added support for chained arguments.
1471 - Added support for chained variable assignments.
1472 - Added a function remove(name) to remove a variable from the parsers scope.
1473 - Renamed nodes for more consistency and to resolve naming conflicts.
1474 - Improved stringification of an expression tree.
1475 - Some simplifications in the code.
1476 - Minor bug fixes.
1477- Fixed a bug in the parser, returning NaN instead of throwing an error for a
1478 number with multiple decimal separators like `2.3.4`.
1479- Fixed a bug in Workspace.insertAfter.
1480- Fixed: math.js now works on IE 6-8 too.
1481
1482
1483## 2013-04-20, version 0.7.0
1484
1485- Implemented method `math.eval`, which uses a readonly parser to evaluate
1486 expressions.
1487- Implemented method `xgcd` (extended eucledian algorithm). Thanks Bart Kiers
1488 (@bkiers).
1489- Improved math.format, which now rounds values to a maximum number of digits
1490 instead of decimals (default is 5 digits, for example `math.format(math.pi)`
1491 returns `3.1416`).
1492- Added examples.
1493- Changed methods square and cube to evaluate matrices element wise (consistent
1494 with all other methods).
1495- Changed second parameter of method import to an object with options.
1496- Fixed method math.typeof on IE.
1497- Minor bug fixes and improvements.
1498
1499
1500## 2013-04-13, version 0.6.0
1501
1502- Implemented chained operations via method math.select(). For example
1503 `math.select(3).add(4).subtract(2).done()` will return `5`.
1504- Implemented methods gcd and lcm.
1505- Implemented method `Unit.in(unit)`, which creates a clone of the unit with a
1506 fixed representation. For example `math.unit('5.08 cm').in('inch')` will
1507 return a unit which string representation always is in inch, thus `2 inch`.
1508 `Unit.in(unit)` is the same as method `math.in(x, unit)`.
1509- Implemented `Unit.toNumber(unit)`, which returns the value of the unit when
1510 represented with given unit. For example
1511 `math.unit('5.08 cm').toNumber('inch')` returns the number `2`, as the
1512 representation of the unit in inches has 2 as value.
1513- Improved: method `math.in(x, unit)` now supports a string as second parameter,
1514 for example `math.in(math.unit('5.08 cm'), 'inch')`.
1515- Split the end user documentation of the parser functions from the source
1516 files.
1517- Removed function help and the built-in documentation from the core library.
1518- Fixed constant i being defined as -1i instead of 1i.
1519- Minor bug fixes.
1520
1521
1522## 2013-04-06, version 0.5.0
1523
1524- Implemented data types Matrix and Range.
1525- Implemented matrix methods clone, concat, det, diag, eye, inv, ones, size,
1526 squeeze, transpose, zeros.
1527- Implemented range operator `:`, and transpose operator `'` in parser.
1528- Changed: created construction methods for easy object creation for all data
1529 types and for the parser. For example, a complex value is now created
1530 with `math.complex(2, 3)` instead of `new math.Complex(2, 3)`, and a parser
1531 is now created with `math.parser()` instead of `new math.parser.Parser()`.
1532- Changed: moved all data types under the namespace math.type, and moved the
1533 Parser, Workspace, etc. under the namespace math.expr.
1534- Changed: changed operator precedence of the power operator:
1535 - it is now right associative instead of left associative like most scripting
1536 languages. So `2^3^4` is now calculated as `2^(3^4)`.
1537 - it has now higher precedence than unary minus most languages, thus `-3^2` is
1538 now calculated as `-(3^2)`.
1539- Changed: renamed the parsers method 'put' into 'set'.
1540- Fixed: method 'in' did not check for units to have the same base.
1541
1542
1543## 2013-03-16, version 0.4.0
1544
1545- Implemented Array support for all methods.
1546- Implemented Array support in the Parser.
1547- Implemented method format.
1548- Implemented parser for units, math.Unit.parse(str).
1549- Improved parser for complex values math.Complex.parse(str);
1550- Improved method help: it now evaluates the examples.
1551- Fixed: a scoping issue with the Parser when defining functions.
1552- Fixed: method 'typeof' was not working well with minified and mangled code.
1553- Fixed: errors in determining the best prefix for a unit.
1554
1555
1556## 2013-03-09, version 0.3.0
1557
1558- Implemented Workspace
1559- Implemented methods cot, csc, sec.
1560- Implemented Array support for methods with one parameter.
1561
1562
1563## 2013-02-25, version 0.2.0
1564
1565- Parser, Scope, and expression tree with Nodes implemented.
1566- Implemented method import which makes it easy to extend math.js.
1567- Implemented methods arg, conj, cube, equal, factorial, im, largereq,
1568 log(x, base), log10, mod, re, sign, smallereq, square, unequal.
1569
1570
1571## 2013-02-18, version 0.1.0
1572
1573- Reached full compatibility with Javascripts built-in Math library.
1574- More functions implemented.
1575- Some bugfixes.
1576
1577
1578## 2013-02-16, version 0.0.2
1579
1580- All constants of Math implemented, plus the imaginary unit i.
1581- Data types Complex and Unit implemented.
1582- First set of functions implemented.
1583
1584
1585## 2013-02-15, version 0.0.1
1586
1587- First publish of the mathjs package. (package is still empty)
1588
\No newline at end of file