chore: publish v12.0.0

This commit is contained in:
Jos de Jong 2023-10-26 12:11:53 +02:00
parent 7e524970cf
commit fc60c6c66d
31 changed files with 118 additions and 53 deletions

View File

@ -138,7 +138,7 @@ Function | Description
[math.diag(X)](functions/diag.html) | Create a diagonal matrix or retrieve the diagonal of a matrix When `x` is a vector, a matrix with vector `x` on the diagonal will be returned.
[math.diff(arr)](functions/diff.html) | Create a new matrix or array of the difference between elements of the given array The optional dim parameter lets you specify the dimension to evaluate the difference of If no dimension parameter is passed it is assumed as dimension 0 Dimension is zero-based in javascript and one-based in the parser and can be a number or bignumber Arrays must be 'rectangular' meaning arrays like [1, 2] If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays.
[math.dot(x, y)](functions/dot.html) | Calculate the dot product of two vectors.
[math.eigs(x, [prec])](functions/eigs.html) | Compute eigenvalues and eigenvectors of a matrix.
[math.eigs(x, [prec])](functions/eigs.html) | Compute eigenvalues and optionally eigenvectors of a square matrix.
[math.expm(x)](functions/expm.html) | Compute the matrix exponential, expm(A) = e^A.
[math.fft(arr)](functions/fft.html) | Calculate N-dimensional fourier transform.
[math.filter(x, test)](functions/filter.html) | Filter the items in an array or one dimensional matrix.

View File

@ -6,17 +6,41 @@ layout: default
<h1 id="function-eigs">Function eigs <a href="#function-eigs" title="Permalink">#</a></h1>
Compute eigenvalues and eigenvectors of a matrix. The eigenvalues are sorted by their absolute value, ascending.
An eigenvalue with multiplicity k will be listed k times. The eigenvectors are returned as columns of a matrix
the eigenvector that belongs to the j-th eigenvalue in the list (eg. `values[j]`) is the j-th column (eg. `column(vectors, j)`).
If the algorithm fails to converge, it will throw an error in that case, however, you may still find useful information
Compute eigenvalues and optionally eigenvectors of a square matrix.
The eigenvalues are sorted by their absolute value, ascending, and
returned as a vector in the `values` property of the returned project.
An eigenvalue with algebraic multiplicity k will be listed k times, so
that the returned `values` vector always has length equal to the size
of the input matrix.
The `eigenvectors` property of the return value provides the eigenvectors.
It is an array of plain objects: the `value` property of each gives the
associated eigenvalue, and the `vector` property gives the eigenvector
itself. Note that the same `value` property will occur as many times in
the list provided by `eigenvectors` as the geometric multiplicity of
that value.
If the algorithm fails to converge, it will throw an error
in that case, however, you may still find useful information
in `err.values` and `err.vectors`.
Note that the 'precision' option does not directly specify the _accuracy_
of the returned eigenvalues. Rather, it determines how small an entry
of the iterative approximations to an upper triangular matrix must be
in order to be considered zero. The actual accuracy of the returned
eigenvalues may be greater or less than the precision, depending on the
conditioning of the matrix and how far apart or close the actual
eigenvalues are. Note that currently, relatively simple, "traditional"
methods of eigenvalue computation are being used; this is not a modern,
high-precision eigenvalue computation. That said, it should typically
produce fairly reasonable results.
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
```js
math.eigs(x, [prec])
math.eigs(x, {options})
```
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
@ -24,13 +48,13 @@ math.eigs(x, [prec])
Parameter | Type | Description
--------- | ---- | -----------
`x` | Array &#124; Matrix | Matrix to be diagonalized
`prec` | number &#124; BigNumber | Precision, default value: 1e-15
`opts` | number &#124; BigNumber &#124; OptsObject | Object with keys `precision`, defaulting to config.epsilon, and `eigenvectors`, defaulting to true and specifying whether to compute eigenvectors. If just a number, specifies precision.
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
Type | Description
---- | -----------
{values: Array &#124; Matrix, vectors: Array &#124; Matrix} | Object containing an array of eigenvalues and a matrix with eigenvectors as columns.
{values: Array &#124; Matrix, eigenvectors?: Array&lt;EVobj&gt;}} Object containing an array of eigenvalues and an array of {value: number &#124; BigNumber, vector: Array &#124; Matrix | objects. The eigenvectors property is undefined if eigenvectors were not requested.
<h3 id="throws">Throws <a href="#throws" title="Permalink">#</a></h3>
@ -42,14 +66,18 @@ Type | Description
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
```js
const { eigs, multiply, column, transpose } = math
const { eigs, multiply, column, transpose, matrixFromColumns } = math
const H = [[5, 2.3], [2.3, 1]]
const ans = eigs(H) // returns {values: [E1,E2...sorted], vectors: [v1,v2.... corresponding vectors as columns]}
const ans = eigs(H) // returns {values: [E1,E2...sorted], eigenvectors: [{value: E1, vector: v2}, {value: e, vector: v2}, ...]
const E = ans.values
const U = ans.vectors
multiply(H, column(U, 0)) // returns multiply(E[0], column(U, 0))
const UTxHxU = multiply(transpose(U), H, U) // diagonalizes H
E[0] == UTxHxU[0][0] // returns true
const V = ans.eigenvectors
multiply(H, V[0].vector)) // returns multiply(E[0], V[0].vector))
const U = matrixFromColumns(...V.map(obj => obj.vector))
const UTxHxU = multiply(transpose(U), H, U) // diagonalizes H if possible
E[0] == UTxHxU[0][0] // returns true always
// Compute only approximate eigenvalues:
const {values} = eigs(H, {eigenvectors: false, precision: 1e-6})
```

View File

@ -27,7 +27,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@11.12.0/">https://unpkg.com/mathjs@11.12.0/</a></td>
<td><a href="https://unpkg.com/mathjs@12.0.0/">https://unpkg.com/mathjs@12.0.0/</a></td>
</tr>
<tr>
<td>cdnjs</td>
@ -48,9 +48,9 @@ Or download the full bundle directly from [unpkg](https://unpkg.com):
<p>
<a
href="https://unpkg.com/mathjs@11.12.0/lib/browser/math.js"
>math.js (version 11.12.0, <span id="size">199 kB</span>, minified and gzipped)</a>
and if needed the <a href="https://unpkg.com/mathjs@11.12.0/lib/browser/math.js.map">source map</a>
href="https://unpkg.com/mathjs@12.0.0/lib/browser/math.js"
>math.js (version 12.0.0, <span id="size">199 kB</span>, minified and gzipped)</a>
and if needed the <a href="https://unpkg.com/mathjs@12.0.0/lib/browser/math.js.map">source map</a>
</p>
Too large for you? Create your own [custom bundle](docs/custom_bundling.html).

View File

@ -15,7 +15,7 @@
}
</style>
<script src="https://unpkg.com/mathjs@11.12.0/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@12.0.0/lib/browser/math.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@11.12.0/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@12.0.0/lib/browser/math.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@11.12.0/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@12.0.0/lib/browser/math.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@11.12.0/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@12.0.0/lib/browser/math.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@11.12.0/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@12.0.0/lib/browser/math.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@11.12.0/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@12.0.0/lib/browser/math.js"></script>
<style>
body,

View File

@ -15,7 +15,7 @@
}
</style>
<script src="https://unpkg.com/mathjs@11.12.0/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@12.0.0/lib/browser/math.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@11.12.0/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@12.0.0/lib/browser/math.js"></script>
</head>
<body>

View File

@ -4,7 +4,7 @@
<head>
<meta charset="UTF-8">
<title>math.js | Lorenz Attractor</title>
<script src="https://unpkg.com/mathjs@11.12.0/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@12.0.0/lib/browser/math.js"></script>
<script src="https://cdn.plot.ly/plotly-2.25.2.min.js" charset="utf-8"></script>
</head>

View File

@ -13,7 +13,7 @@ File: [lorenz.html](lorenz.html) (click for a live demo)
<head>
<meta charset="UTF-8">
<title>math.js | Lorenz Attractor</title>
<script src="https://unpkg.com/mathjs@11.12.0/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@12.0.0/lib/browser/math.js"></script>
<script src="https://cdn.plot.ly/plotly-2.25.2.min.js" charset="utf-8"></script>
</head>

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>math.js | plot</title>
<script src="https://unpkg.com/mathjs@11.12.0/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@12.0.0/lib/browser/math.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@11.12.0/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@12.0.0/lib/browser/math.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@11.12.0/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@12.0.0/lib/browser/math.js"></script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>

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@11.12.0/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@12.0.0/lib/browser/math.js"></script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>

View File

@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>math.js | printing HTML</title>
<script src="https://unpkg.com/mathjs@11.12.0/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@12.0.0/lib/browser/math.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@11.12.0/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@12.0.0/lib/browser/math.js"></script>
<style>
body {

View File

@ -9,7 +9,7 @@
<script>
// load math.js using require.js
require(['https://unpkg.com/mathjs@11.12.0/lib/browser/math.js'], function (math) {
require(['https://unpkg.com/mathjs@12.0.0/lib/browser/math.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@11.12.0/lib/browser/math.js'], function (math) {
require(['https://unpkg.com/mathjs@12.0.0/lib/browser/math.js'], function (math) {
// evaluate some expression
const result = math.evaluate('1.2 * (2 + 4.5)')
document.write(result)

View File

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

View File

@ -14,7 +14,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@11.12.0/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@12.0.0/lib/browser/math.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@11.12.0/lib/browser/math.js')
importScripts('https://unpkg.com/mathjs@12.0.0/lib/browser/math.js')
// create a parser
const parser = self.math.parser()

View File

@ -1,4 +1,4 @@
importScripts('https://unpkg.com/mathjs@11.12.0/lib/browser/math.js')
importScripts('https://unpkg.com/mathjs@12.0.0/lib/browser/math.js')
// create a parser
const parser = self.math.parser()

View File

@ -4,10 +4,47 @@ layout: default
<h1 id="history">History <a href="#history" title="Permalink">#</a></h1>
<h1 id="20231025-11120">2023-10-25, 11.12.0 <a href="#20231025-11120" title="Permalink">#</a></h1>
<h1 id="20231026-1200">2023-10-26, 12.0.0 <a href="#20231026-1200" title="Permalink">#</a></h1>
Breaking changes:
- Fix <a href="https://github.com/josdejong/mathjs/issues/2879">#2879</a>, <a href="https://github.com/josdejong/mathjs/issues/2927">#2927</a>, <a href="https://github.com/josdejong/mathjs/issues/3014">#3014</a>: change the confusing interface of `eigs`.
Before, functions `eigs` returned an object:
```
{ values: MathCollection; vectors: MathCollection }
```
where `vectors` was a 2d matrix of which the columns contained the vectors.
This is changed to `eigs` returning an object:
```
{
values: MathCollection
eigenvectors: Array<{
value: number | BigNumber
vector: MathCollection
}>
}
```
Where `eigenvectors` is an array containing an object with the corresponding
eigenvalue and vector.
- Refactored the TypeScript type definitions to make them work with a `NodeNext`
module resolution <a href="https://github.com/josdejong/mathjs/issues/3079">#3079</a>, <a href="https://github.com/josdejong/mathjs/issues/2919">#2919</a>).
- Type `MathJsStatic` is renamed to `MathJsInstance`.
- Type `FactoryDependencies` is deprecated, use `MathJsFactory` instead, and
import dependency maps directly from the library.
- Change the assignment operator of .toTex output from `:=` to `=` (see <a href="https://github.com/josdejong/mathjs/issues/2980">#2980</a>,
<a href="https://github.com/josdejong/mathjs/issues/3032">#3032</a>).
- Drop official support for Node.js 14 and 16.
Fixes:
- Find eigenvectors of defective matrices <a href="https://github.com/josdejong/mathjs/issues/3037">#3037</a>). Thanks <a href="https://github.com/gwhitney">@gwhitney</a>.
<h1 id="20231026-11120">2023-10-26, 11.12.0 <a href="#20231026-11120" title="Permalink">#</a></h1>
- Implemented function `subtractScalar` <a href="https://github.com/josdejong/mathjs/issues/3081">#3081</a>, <a href="https://github.com/josdejong/mathjs/issues/2643">#2643</a>), thanks <a href="https://github.com/vrushaket">@vrushaket</a>.
- Fix <a href="https://github.com/josdejong/mathjs/issues/3073">#3073</a>: function format not escaping control characters and double
- Fix <a href="https://github.com/josdejong/mathjs/issues/3073">#3073</a>: function format not escaping control characters and double
quotes <a href="https://github.com/josdejong/mathjs/issues/3082">#3082</a>).
- Fix: function `clone` not throwing an error when passing an unsupported
type like a function.

File diff suppressed because one or more lines are too long

View File

@ -23,7 +23,7 @@
* It features real and complex numbers, units, matrices, a large set of
* mathematical functions, and a flexible expression parser.
*
* @version 11.12.0
* @version 12.0.0
* @date 2023-10-26
*
* @license

File diff suppressed because one or more lines are too long

16
package-lock.json generated
View File

@ -8,7 +8,7 @@
"name": "mathjs-website",
"version": "1.0.0",
"dependencies": {
"mathjs": "11.12.0"
"mathjs": "12.0.0"
},
"devDependencies": {
"fancy-log": "2.0.0",
@ -3033,9 +3033,9 @@
}
},
"node_modules/mathjs": {
"version": "11.12.0",
"resolved": "https://registry.npmjs.org/mathjs/-/mathjs-11.12.0.tgz",
"integrity": "sha512-UGhVw8rS1AyedyI55DGz9q1qZ0p98kyKPyc9vherBkoueLntPfKtPBh14x+V4cdUWK0NZV2TBwqRFlvadscSuw==",
"version": "12.0.0",
"resolved": "https://registry.npmjs.org/mathjs/-/mathjs-12.0.0.tgz",
"integrity": "sha512-Oz3swPplNPe7taoP6WrkKhQzhDE2SwvOgLzu8H3EN+hEadw2GjEJUm6Xl+hrioHoB8g2BYb3gfw1glSzhdBKYw==",
"dependencies": {
"@babel/runtime": "^7.23.2",
"complex.js": "^2.1.1",
@ -3051,7 +3051,7 @@
"mathjs": "bin/cli.js"
},
"engines": {
"node": ">= 14"
"node": ">= 18"
}
},
"node_modules/micromatch": {
@ -7264,9 +7264,9 @@
}
},
"mathjs": {
"version": "11.12.0",
"resolved": "https://registry.npmjs.org/mathjs/-/mathjs-11.12.0.tgz",
"integrity": "sha512-UGhVw8rS1AyedyI55DGz9q1qZ0p98kyKPyc9vherBkoueLntPfKtPBh14x+V4cdUWK0NZV2TBwqRFlvadscSuw==",
"version": "12.0.0",
"resolved": "https://registry.npmjs.org/mathjs/-/mathjs-12.0.0.tgz",
"integrity": "sha512-Oz3swPplNPe7taoP6WrkKhQzhDE2SwvOgLzu8H3EN+hEadw2GjEJUm6Xl+hrioHoB8g2BYb3gfw1glSzhdBKYw==",
"requires": {
"@babel/runtime": "^7.23.2",
"complex.js": "^2.1.1",

View File

@ -6,7 +6,7 @@
"url": "https://github.com/josdejong/mathjs.git"
},
"dependencies": {
"mathjs": "11.12.0"
"mathjs": "12.0.0"
},
"devDependencies": {
"fancy-log": "2.0.0",