Released v3.18.0

This commit is contained in:
jos 2017-12-16 21:22:45 +01:00
parent eea0bad55d
commit 7ce76cb5cf
12 changed files with 8803 additions and 8092 deletions

View File

@ -1,16 +1,16 @@
# History
## not yet released, version 3.18.0
## 2017-12-16, version 3.18.0
- Implemented function `rationalize`. Thanks @paulobuchsbaum.
- Upgraded dependencies:
```
decimal.js 7.2.3 → 7.4.0
fraction.js 4.0.2 → 4.0.3
decimal.js 7.2.3 → 9.0.1 (no breaking changes affecting mathjs)
fraction.js 4.0.2 → 4.0.4
tiny-emitter 2.0.0 → 2.0.2
```
- Upgraded dev dependencies
- Upgraded dev dependencies.
- Fixed #975: a wrong example in the docs of lusolve.
- Fixed #983: `pickRandom` returning an array instead of single value
when input was an array with just one value. Clarified docs.

16787
dist/math.js vendored

File diff suppressed because it is too large Load Diff

1
dist/math.map vendored

File diff suppressed because one or more lines are too long

28
dist/math.min.js vendored

File diff suppressed because one or more lines are too long

1
dist/math.min.map vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -44,6 +44,7 @@ Function | Description
[math.lup(A)](functions/lup.md) | Calculate the Matrix LU decomposition with partial pivoting.
[math.lusolve(A, b)](functions/lusolve.md) | Solves the linear system `A * x = b` where `A` is an [n x n] matrix and `b` is a [n] column vector.
[math.qr(A)](functions/qr.md) | Calculate the Matrix QR decomposition.
[rationalize(expr)](functions/rationalize.md) | Transform a rationalizable expression in a rational fraction.
[simplify(expr)](functions/simplify.md) | Simplify an expression tree.
[math.slu(A, order, threshold)](functions/slu.md) | Calculate the Sparse Matrix LU decomposition with full pivoting.
[math.usolve(U, b)](functions/usolve.md) | Solves the linear equation system by backward substitution.

View File

@ -41,7 +41,7 @@ var x2 = math.lusolve(f, [1, 2, 1, -1]); // x2 = [[1], [1], [1/3], [-0.
var a = [[-2, 3], [2, 1]];
var b = [11, 9];
var x = lusolve(a, b); // [[-5.5], [20]]
var x = math.lusolve(a, b); // [[2], [5]]
```

View File

@ -28,7 +28,7 @@ Parameter | Type | Description
Type | Description
---- | -----------
array | An array of elements of the provided input array
number | Array | Returns a single random value from array when number is 1 or undefined. Returns an array with the configured number of elements when number is > 1.
## Examples

View File

@ -0,0 +1,59 @@
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
# Function rationalize
Transform a rationalizable expression in a rational fraction.
If rational fraction is one variable polynomial then converts
the numerator and denominator in canonical form, with decreasing
exponents, returning the coefficients of numerator.
## Syntax
```js
rationalize(expr)
rationalize(expr, detailed)
rationalize(expr, scope)
rationalize(expr, scope, detailed)
```
### Parameters
Parameter | Type | Description
--------- | ---- | -----------
`expr` | Node &#124; string | The expression to check if is a polynomial expression
`optional` | Object &#124; boolean | scope of expression or true for already evaluated rational expression at input
`detailed` | Boolean | optional True if return an object, false if return expression node (default)
### Returns
Type | Description
---- | -----------
Object &#124; Expression Node | The rational polynomial of `expr` or na object {Object} {Expression Node} expression: node simplified expression {Expression Node} numerator: simplified numerator of expression {Expression Node | boolean} denominator: simplified denominator or false (if there is no denominator) {Array} variables: variable names {Array} coefficients: coefficients of numerator sorted by increased exponent {Expression Node} node simplified expression
## Examples
```js
math.rationalize('sin(x)+y') // Error: There is an unsolved function call
math.rationalize('2x/y - y/(x+1)') // (2*x^2-y^2+2*x)/(x*y+y)
math.rationalize('(2x+1)^6')
// 64*x^6+192*x^5+240*x^4+160*x^3+60*x^2+12*x+1
math.rationalize('2x/( (2x-1) / (3x+2) ) - 5x/ ( (3x+4) / (2x^2-5) ) + 3')
// -20*x^4+28*x^3+104*x^2+6*x-12)/(6*x^2+5*x-4)
math.rationalize('x/(1-x)/(x-2)/(x-3)/(x-4) + 2x/ ( (1-2x)/(2-3x) )/ ((3-4x)/(4-5x) )') =
// (-30*x^7+344*x^6-1506*x^5+3200*x^4-3472*x^3+1846*x^2-381*x)/
// (-8*x^6+90*x^5-383*x^4+780*x^3-797*x^2+390*x-72)
math.rationalize('x+x+x+y',{y:1}) // 3*x+1
math.rationalize('x+x+x+y',{}) // 3*x+y
ret = math.rationalize('x+x+x+y',{},true)
// ret.expression=3*x+y, ret.variables = ["x","y"]
ret = math.rationalize('-2+5x^2',{},true)
// ret.expression=5*x^2-2, ret.variables = ["x"], ret.coefficients=[-2,0,5]
```
## See also
[simplify](simplify.md)

View File

@ -1,3 +1,3 @@
module.exports = '3.17.0';
module.exports = '3.18.0';
// Note: This file is automatically generated when building math.js.
// Changes made in this file will be overwritten.

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "mathjs",
"version": "3.17.0",
"version": "3.18.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "mathjs",
"version": "3.17.0",
"version": "3.18.0",
"description": "Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.",
"author": "Jos de Jong <wjosdejong@gmail.com> (https://github.com/josdejong)",
"contributors": [