Publish v7.0.1

This commit is contained in:
josdejong 2020-05-30 14:15:26 +02:00
parent 635e2bf4dc
commit 78223c3cdb
29 changed files with 103 additions and 85 deletions

View File

@ -31,16 +31,17 @@ Parameter | Type | Description
Type | Description
---- | -----------
{values: Array, vectors: Array} | {values: Matrix, vectors: Matrix} | Object containing eigenvalues (Array or Matrix) and eigenvectors (2D Array/Matrix).
{values: Array, vectors: Array} | {values: Matrix, vectors: Matrix} | Object containing eigenvalues (Array or Matrix) and eigenvectors (2D Array/Matrix with eigenvectors as columns).
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
```js
const H = [[5, 2.3], [2.3, 1]]
const ans = math.eigs(H) // returns {values: [E1,E2...sorted], vectors: [v1,v2.... corresponding vectors]}
const ans = math.eigs(H) // returns {values: [E1,E2...sorted], vectors: [v1,v2.... corresponding vectors as columns]}
const E = ans.values
const U = ans.vectors
math.multiply(H, math.column(U, 0)) // returns math.multiply(E[0], math.column(U, 0))
const UTxHxU = math.multiply(math.transpose(U), H, U) // rotates H to the eigen-representation
E[0] == UTxHxU[0][0] // returns true
```

View File

@ -23,13 +23,13 @@ math.nthRoots(x, root)
Parameter | Type | Description
--------- | ---- | -----------
`x` | number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Array &#124; Matrix | Number to be rounded
`x` | number &#124; BigNumber &#124; Fraction &#124; Complex | Number to be rounded
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
Type | Description
---- | -----------
number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Array &#124; Matrix | Rounded value
number &#124; BigNumber &#124; Fraction &#124; Complex | Rounded value
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>

View File

@ -29,7 +29,7 @@ Math.js can be downloaded or linked from various content delivery networks:
<tbody>
<tr>
<td>unpkg</td>
<td><a href="https://unpkg.com/mathjs@7.0.0/">https://unpkg.com/mathjs@7.0.0/</a></td>
<td><a href="https://unpkg.com/mathjs@7.0.1/">https://unpkg.com/mathjs@7.0.1/</a></td>
</tr>
<tr>
<td>cdnjs</td>
@ -47,18 +47,18 @@ Here some direct download links from [unpkg](https://unpkg.com):
<table class="download">
<tr>
<td>
<a href="https://unpkg.com/mathjs@7.0.0/dist/math.js">
Development (version 7.0.0)
<a href="https://unpkg.com/mathjs@7.0.1/dist/math.js">
Development (version 7.0.1)
</a>
</td>
<td>
<span id="development-size">1820 kB</span>, uncompressed with comments
<span id="development-size">1822 kB</span>, uncompressed with comments
</td>
</tr>
<tr>
<td>
<a href="https://unpkg.com/mathjs@7.0.0/dist/math.min.js">
Production (version 7.0.0)
<a href="https://unpkg.com/mathjs@7.0.1/dist/math.min.js">
Production (version 7.0.1)
</a>
</td>
<td>

View File

@ -15,7 +15,7 @@
}
</style>
<script src="https://unpkg.com/mathjs@7.0.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@7.0.1/dist/math.min.js"></script>
</head>
<body>

View File

@ -24,7 +24,7 @@ File: [angle_configuration.html](angle_configuration.html) (click for a live dem
}
</style>
<script src="https://unpkg.com/mathjs@7.0.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@7.0.1/dist/math.min.js"></script>
</head>
<body>

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>math.js | basic usage</title>
<script src="https://unpkg.com/mathjs@7.0.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@7.0.1/dist/math.min.js"></script>
</head>
<body>

View File

@ -12,7 +12,7 @@ File: [basic_usage.html](basic_usage.html) (click for a live demo)
<head>
<meta charset="utf-8">
<title>math.js | basic usage</title>
<script src="https://unpkg.com/mathjs@7.0.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@7.0.1/dist/math.min.js"></script>
</head>
<body>

View File

@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>math.js | currency conversion</title>
<script src="https://unpkg.com/mathjs@7.0.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@7.0.1/dist/math.min.js"></script>
<style>
body,

View File

@ -13,7 +13,7 @@ File: [currency_conversion.html](currency_conversion.html) (click for a live dem
<meta charset="utf-8">
<title>math.js | currency conversion</title>
<script src="https://unpkg.com/mathjs@7.0.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@7.0.1/dist/math.min.js"></script>
<style>
body,

View File

@ -15,7 +15,7 @@
}
</style>
<script src="https://unpkg.com/mathjs@7.0.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@7.0.1/dist/math.min.js"></script>
</head>
<body>

View File

@ -24,7 +24,7 @@ File: [custom_separators.html](custom_separators.html) (click for a live demo)
}
</style>
<script src="https://unpkg.com/mathjs@7.0.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@7.0.1/dist/math.min.js"></script>
</head>
<body>

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>math.js | plot</title>
<script src="https://unpkg.com/mathjs@7.0.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@7.0.1/dist/math.min.js"></script>
<script src="https://cdn.plot.ly/plotly-1.35.2.min.js"></script>

View File

@ -12,7 +12,7 @@ File: [plot.html](plot.html) (click for a live demo)
<head>
<meta charset="utf-8">
<title>math.js | plot</title>
<script src="https://unpkg.com/mathjs@7.0.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@7.0.1/dist/math.min.js"></script>
<script src="https://cdn.plot.ly/plotly-1.35.2.min.js"></script>

View File

@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>math.js | pretty printing with MathJax</title>
<script src="https://unpkg.com/mathjs@7.0.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@7.0.1/dist/math.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.3/MathJax.js?config=TeX-AMS-MML_HTMLorMML.js"></script>
<style>

View File

@ -13,7 +13,7 @@ File: [pretty_printing_with_mathjax.html](pretty_printing_with_mathjax.html) (cl
<meta charset="utf-8">
<title>math.js | pretty printing with MathJax</title>
<script src="https://unpkg.com/mathjs@7.0.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@7.0.1/dist/math.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.3/MathJax.js?config=TeX-AMS-MML_HTMLorMML.js"></script>
<style>

View File

@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>math.js | printing HTML</title>
<script src="https://unpkg.com/mathjs@7.0.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@7.0.1/dist/math.min.js"></script>
<style>
body {

View File

@ -13,7 +13,7 @@ File: [printing_html.html](printing_html.html) (click for a live demo)
<meta charset="utf-8">
<title>math.js | printing HTML</title>
<script src="https://unpkg.com/mathjs@7.0.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@7.0.1/dist/math.min.js"></script>
<style>
body {

View File

@ -9,7 +9,7 @@
<script>
// load math.js using require.js
require(['https://unpkg.com/mathjs@7.0.0/dist/math.min.js'], function (math) {
require(['https://unpkg.com/mathjs@7.0.1/dist/math.min.js'], function (math) {
// evaluate some expression
const result = math.evaluate('1.2 * (2 + 4.5)')
document.write(result)

View File

@ -18,7 +18,7 @@ File: [requirejs_loading.html](requirejs_loading.html) (click for a live demo)
<script>
// load math.js using require.js
require(['https://unpkg.com/mathjs@7.0.0/dist/math.min.js'], function (math) {
require(['https://unpkg.com/mathjs@7.0.1/dist/math.min.js'], function (math) {
// evaluate some expression
const result = math.evaluate('1.2 * (2 + 4.5)')
document.write(result)

View File

@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>math.js | rocket trajectory optimization</title>
<script src="https://unpkg.com/mathjs@7.0.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@7.0.1/dist/math.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script>
<style>

View File

@ -13,7 +13,7 @@ File: [rocket_trajectory_optimization.html](rocket_trajectory_optimization.html)
<meta charset="utf-8">
<title>math.js | rocket trajectory optimization</title>
<script src="https://unpkg.com/mathjs@7.0.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@7.0.1/dist/math.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script>
<style>

View File

@ -92,7 +92,7 @@ File: [webworkers.html](webworkers.html) (click for a live demo)
File: [worker.js](worker.js)
```js
importScripts('https://unpkg.com/mathjs@7.0.0/dist/math.min.js')
importScripts('https://unpkg.com/mathjs@7.0.1/dist/math.min.js')
// create a parser
const parser = self.math.parser()

View File

@ -1,4 +1,4 @@
importScripts('https://unpkg.com/mathjs@7.0.0/dist/math.min.js')
importScripts('https://unpkg.com/mathjs@7.0.1/dist/math.min.js')
// create a parser
const parser = self.math.parser()

View File

@ -4,6 +4,12 @@ layout: default
<h1 id="history">History <a href="#history" title="Permalink">#</a></h1>
<h1 id="20200530-version-701">2020-05-30, version 7.0.1 <a href="#20200530-version-701" title="Permalink">#</a></h1>
- Fix <a href="https://github.com/josdejong/mathjs/issues/1844">#1844</a>: clarify the documentation of function `eigs`. Thanks <a href="https://github.com/Lazersmoke">@Lazersmoke</a>.
- Fix <a href="https://github.com/josdejong/mathjs/issues/1855">#1855</a>: Fix error in the documentation for `math.nthRoots(x)`.
- Fix <a href="https://github.com/josdejong/mathjs/issues/1856">#1856</a>: make the library robust against Object prototype pollution.
<h1 id="20200507-version-700">2020-05-07, version 7.0.0 <a href="#20200507-version-700" title="Permalink">#</a></h1>

View File

@ -6,8 +6,8 @@
* It features real and complex numbers, units, matrices, a large set of
* mathematical functions, and a flexible expression parser.
*
* @version 7.0.0
* @date 2020-05-07
* @version 7.0.1
* @date 2020-05-30
*
* @license
* Copyright (C) 2013-2020 Jos de Jong <wjosdejong@gmail.com>
@ -27598,8 +27598,8 @@ var createNthRoots = /* #__PURE__ */Object(factory["a" /* factory */])(nthRoots_
*
* nthRoot, pow, sqrt
*
* @param {number | BigNumber | Fraction | Complex | Array | Matrix} x Number to be rounded
* @return {number | BigNumber | Fraction | Complex | Array | Matrix} Rounded value
* @param {number | BigNumber | Fraction | Complex} x Number to be rounded
* @return {number | BigNumber | Fraction | Complex} Rounded value
*/
var nthRoots = typed(nthRoots_name, {
Complex: function Complex(x) {
@ -32343,6 +32343,12 @@ function Unit_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "fu
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function Unit_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function Unit_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Unit_ownKeys(Object(source), true).forEach(function (key) { Unit_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Unit_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function Unit_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@ -33028,12 +33034,8 @@ var createUnitClass = /* #__PURE__ */Object(factory["a" /* factory */])(Unit_nam
for (var _i = 0; _i < other.units.length; _i++) {
// Make a deep copy
var inverted = {};
for (var key in other.units[_i]) {
inverted[key] = other.units[_i][key];
}
// Make a shallow copy of every unit
var inverted = Unit_objectSpread({}, other.units[_i]);
res.units.push(inverted);
} // If at least one operand has a value, then the result should also have a value
@ -33068,14 +33070,11 @@ var createUnitClass = /* #__PURE__ */Object(factory["a" /* factory */])(Unit_nam
for (var _i2 = 0; _i2 < other.units.length; _i2++) {
// Make a deep copy
var inverted = {};
// Make a shallow copy of every unit
var inverted = Unit_objectSpread(Unit_objectSpread({}, other.units[_i2]), {}, {
power: -other.units[_i2].power
});
for (var key in other.units[_i2]) {
inverted[key] = other.units[_i2][key];
}
inverted.power = -inverted.power;
res.units.push(inverted);
} // If at least one operand has a value, the result should have a value
@ -33303,9 +33302,11 @@ var createUnitClass = /* #__PURE__ */Object(factory["a" /* factory */])(Unit_nam
var matchingBase;
for (var key in currentUnitSystem) {
if (ret.hasBase(BASE_UNITS[key])) {
matchingBase = key;
break;
if (Object(utils_object["f" /* hasOwnProperty */])(currentUnitSystem, key)) {
if (ret.hasBase(BASE_UNITS[key])) {
matchingBase = key;
break;
}
}
}
@ -33480,11 +33481,13 @@ var createUnitClass = /* #__PURE__ */Object(factory["a" /* factory */])(Unit_nam
}
for (var i in simp.units) {
if (simp.units[i].unit) {
if (simp.units[i].unit.name === 'VA' && isImaginary) {
simp.units[i].unit = UNITS.VAR;
} else if (simp.units[i].unit.name === 'VAR' && !isImaginary) {
simp.units[i].unit = UNITS.VA;
if (Object(utils_object["f" /* hasOwnProperty */])(simp.units, i)) {
if (simp.units[i].unit) {
if (simp.units[i].unit.name === 'VA' && isImaginary) {
simp.units[i].unit = UNITS.VAR;
} else if (simp.units[i].unit.name === 'VAR' && !isImaginary) {
simp.units[i].unit = UNITS.VA;
}
}
}
} // Now apply the best prefix
@ -34370,7 +34373,9 @@ var createUnitClass = /* #__PURE__ */Object(factory["a" /* factory */])(Unit_nam
};
for (var key in BASE_UNITS) {
BASE_UNITS[key].key = key;
if (Object(utils_object["f" /* hasOwnProperty */])(BASE_UNITS, key)) {
BASE_UNITS[key].key = key;
}
}
var BASE_UNIT_NONE = {};
@ -35942,8 +35947,10 @@ var createUnitClass = /* #__PURE__ */Object(factory["a" /* factory */])(Unit_nam
Unit.getUnitSystem = function () {
for (var _key in UNIT_SYSTEMS) {
if (UNIT_SYSTEMS[_key] === currentUnitSystem) {
return _key;
if (Object(utils_object["f" /* hasOwnProperty */])(UNIT_SYSTEMS, _key)) {
if (UNIT_SYSTEMS[_key] === currentUnitSystem) {
return _key;
}
}
}
};
@ -35986,8 +35993,10 @@ var createUnitClass = /* #__PURE__ */Object(factory["a" /* factory */])(Unit_nam
for (var _key2 in UNITS) {
var unit = UNITS[_key2];
unit.dimensions = unit.base.dimensions;
if (Object(utils_object["f" /* hasOwnProperty */])(UNITS, _key2)) {
var unit = UNITS[_key2];
unit.dimensions = unit.base.dimensions;
}
} // Create aliases
@ -49675,14 +49684,11 @@ var createHelpClass = /* #__PURE__ */Object(factory["a" /* factory */])(Help_nam
Help.fromJSON = function (json) {
var doc = {};
for (var prop in json) {
if (prop !== 'mathjs') {
// ignore mathjs field
doc[prop] = json[prop];
}
}
Object.keys(json).filter(function (prop) {
return prop !== 'mathjs';
}).forEach(function (prop) {
doc[prop] = json[prop];
});
return new Help(doc);
};
/**
@ -52958,9 +52964,10 @@ var createEigs = /* #__PURE__ */Object(factory["a" /* factory */])(eigs_name, ei
* Examples:
*
* const H = [[5, 2.3], [2.3, 1]]
* const ans = math.eigs(H) // returns {values: [E1,E2...sorted], vectors: [v1,v2.... corresponding vectors]}
* const ans = math.eigs(H) // returns {values: [E1,E2...sorted], vectors: [v1,v2.... corresponding vectors as columns]}
* const E = ans.values
* const U = ans.vectors
* math.multiply(H, math.column(U, 0)) // returns math.multiply(E[0], math.column(U, 0))
* const UTxHxU = math.multiply(math.transpose(U), H, U) // rotates H to the eigen-representation
* E[0] == UTxHxU[0][0] // returns true
* See also:
@ -52968,7 +52975,7 @@ var createEigs = /* #__PURE__ */Object(factory["a" /* factory */])(eigs_name, ei
* inv
*
* @param {Array | Matrix} x Matrix to be diagonalized
* @return {{values: Array, vectors: Array} | {values: Matrix, vectors: Matrix}} Object containing eigenvalues (Array or Matrix) and eigenvectors (2D Array/Matrix).
* @return {{values: Array, vectors: Array} | {values: Matrix, vectors: Matrix}} Object containing eigenvalues (Array or Matrix) and eigenvectors (2D Array/Matrix with eigenvectors as columns).
*/
var eigs = typed('eigs', {
Array: function Array(x) {
@ -57732,17 +57739,21 @@ var createSimplify = /* #__PURE__ */Object(factory["a" /* factory */])(simplify_
for (var key in match1.placeholders) {
res.placeholders[key] = match1.placeholders[key];
if (Object(utils_object["f" /* hasOwnProperty */])(match1.placeholders, key)) {
res.placeholders[key] = match1.placeholders[key];
if (Object(utils_object["f" /* hasOwnProperty */])(match2.placeholders, key)) {
if (!_exactMatch(match1.placeholders[key], match2.placeholders[key])) {
return null;
if (Object(utils_object["f" /* hasOwnProperty */])(match2.placeholders, key)) {
if (!_exactMatch(match1.placeholders[key], match2.placeholders[key])) {
return null;
}
}
}
}
for (var _key in match2.placeholders) {
res.placeholders[_key] = match2.placeholders[_key];
if (Object(utils_object["f" /* hasOwnProperty */])(match2.placeholders, _key)) {
res.placeholders[_key] = match2.placeholders[_key];
}
}
return res;
@ -59513,7 +59524,7 @@ var createReplacer = /* #__PURE__ */Object(factory["a" /* factory */])(replacer_
};
});
// CONCATENATED MODULE: ./src/version.js
var version = '7.0.0'; // Note: This file is automatically generated when building math.js.
var version = '7.0.1'; // Note: This file is automatically generated when building math.js.
// Changes made in this file will be overwritten.
// CONCATENATED MODULE: ./src/plain/number/constants.js
var constants_pi = Math.PI;

8
js/lib/math.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

6
package-lock.json generated
View File

@ -2319,9 +2319,9 @@
}
},
"mathjs": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/mathjs/-/mathjs-7.0.0.tgz",
"integrity": "sha512-pe2hgDAHSfPRtuwIjNbL6fCKiHZYKKv45PusNfK3JDeVpVmHG1Pdig2vq62svsj2iKZO37tvLAjPUnrz6w+X9w==",
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/mathjs/-/mathjs-7.0.1.tgz",
"integrity": "sha512-ikFnvtvui8EA1KC+RsF7Sse34WA7EGsKnwwv7/lTRx04t25JtWpVWrs0ZcNKxygZVrOIpU9MRgbvXEFYFV3pOQ==",
"requires": {
"complex.js": "^2.0.11",
"decimal.js": "^10.2.0",

View File

@ -6,7 +6,7 @@
"url": "https://github.com/josdejong/mathjs.git"
},
"dependencies": {
"mathjs": "7.0.0"
"mathjs": "7.0.1"
},
"devDependencies": {
"fancy-log": "1.3.3",