chore: publish mathjs@11.10.0

This commit is contained in:
Jos de Jong 2023-08-23 16:06:46 +02:00
parent 2f219963cf
commit 20b1dda665
32 changed files with 162 additions and 52 deletions

View File

@ -335,6 +335,49 @@ method `.set()`, the matrix will be resized. By default, new items will be
initialized with zero, but it is possible to specify an alternative value using
the optional third argument `defaultValue`.
<h2 id="advanced-indexing">Advanced Indexing <a href="#advanced-indexing" title="Permalink">#</a></h2>
Boolean array indexing is a technique that allows you to filter, replace, and set values in an array based on logical conditions. This can be done by creating a boolean array that represents the desired conditions, and then using that array as an index to select the elements of the original array that meet those conditions.
For example, a boolean array can be created to represent all the even numbers in an array, and then used to filter the original array to only include the even numbers. Alternatively, a boolean array can be created to represent all the elements of an array that are greater than a certain value, and then used to replace all the elements of the original array that are greater than that value with a new value.
```js
const q = [1, 2, 3, 4]
math.subset(q, math.index([true, false, true, false])) // Array [1, 3]
// filtering
math.subset(q, math.index(math.larger(q, 2))) // Array [3, 4]
// filtering with no matches
math.subset(q, math.index(math.larger(q, 5))) // Array []
// setting specific values, please note that the replacement value is broadcasted
q = math.subset(q, math.index(math.smaller(q, 3)), 0) // q = [0, 0, 3, 4]
// replacing specific values
math.subset(q, math.index(math.equal(q, 0)), [1, 2]) // q = [1, 2, 3, 4]
```
The same can be accomplished in the parser in a much more compact manner. Please note that everything after `#` are comments.
```js
math.evaluate(`
q = [1, 2, 3, 4]
q[[true, false, true, false]] # Matrix [1, 3]
q[q>2] # Matrix [3, 4]
q[q>5] # Matrix []
q[q <3] = 0 # q = [0, 0, 3, 4]
q[q==0] = [1, 2] # q = [1, 2, 3, 4]
`)
```
The expression inside the index can be as complex as needed as long it evaluates to an array of booleans of the same size.
```js
math.evaluate(`
q = [1, 2, 3, 4]
r = [6, 5, 4, 3]
q[q > 3 and r < 4] # [4]
`)
```
<h2 id="iterating">Iterating <a href="#iterating" title="Permalink">#</a></h2>

View File

@ -236,6 +236,7 @@ Function | Description
Function | Description
---- | -----------
[math.erf(x)](functions/erf.html) | Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x.
[math.zeta(n)](functions/zeta.html) | Compute the Riemann Zeta function of a value using an infinite series for all of the complex plane using Riemann's Functional equation.
<h2 id="statistics-functions">Statistics functions <a href="#statistics-functions" title="Permalink">#</a></h2>

View File

@ -43,13 +43,15 @@ Type | Description
```js
// get a subset
const d = [[1, 2], [3, 4]]
math.subset(d, math.index(1, 0)) // returns 3
math.subset(d, math.index([0, 1], 1)) // returns [[2], [4]]
math.subset(d, math.index(1, 0)) // returns 3
math.subset(d, math.index([0, 1], 1)) // returns [[2], [4]]
math.subset(d, math.index([false, true], 0)) // returns [[3]]
// replace a subset
const e = []
const f = math.subset(e, math.index(0, [0, 2]), [5, 6]) // f = [[5, 6]]
const g = math.subset(f, math.index(1, 1), 7, 0) // g = [[5, 6], [0, 7]]
const f = math.subset(e, math.index(0, [0, 2]), [5, 6]) // f = [[5, 0, 6]]
const g = math.subset(f, math.index(1, 1), 7, 0) // g = [[5, 0, 6], [0, 7, 0]]
math.subset(g, math.index([false, true], 1), 8) // returns [[5, 0, 6], [0, 8, 0]]
// get submatrix using ranges
const M = [
@ -57,7 +59,7 @@ const M = [
[4,5,6],
[7,8,9]
]
math.subset(M, math.index(math.range(0,2), math.range(0,3))) // [[1,2,3],[4,5,6]]
math.subset(M, math.index(math.range(0,2), math.range(0,3))) // [[1, 2, 3], [4, 5, 6]]
```

View File

@ -0,0 +1,54 @@
---
layout: default
---
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
<h1 id="function-zeta">Function zeta <a href="#function-zeta" title="Permalink">#</a></h1>
Compute the Riemann Zeta function of a value using an infinite series for
all of the complex plane using Riemann's Functional equation.
Based off the paper by Xavier Gourdon and Pascal Sebah
( http://numbers.computation.free.fr/Constants/Miscellaneous/zetaevaluations.pdf )
Implementation and slight modification by Anik Patel
Note: the implementation is accurate up to about 6 digits.
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
```js
math.zeta(n)
```
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
Parameter | Type | Description
--------- | ---- | -----------
`s` | number &#124; Complex &#124; BigNumber | A Real, Complex or BigNumber parameter to the Riemann Zeta Function
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
Type | Description
---- | -----------
number &#124; Complex &#124; BigNumber | The Riemann Zeta of `s`
<h3 id="throws">Throws <a href="#throws" title="Permalink">#</a></h3>
Type | Description
---- | -----------
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
```js
math.zeta(5) // returns 1.0369277551433895
math.zeta(-0.5) // returns -0.2078862249773449
math.zeta(math.i) // returns 0.0033002236853253153 - 0.4181554491413212i
```

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.9.1/">https://unpkg.com/mathjs@11.9.1/</a></td>
<td><a href="https://unpkg.com/mathjs@11.10.0/">https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js"
>math.js (version 11.9.1, <span id="size">197 kB</span>, minified and gzipped)</a>
and if needed the <a href="https://unpkg.com/mathjs@11.9.1/lib/browser/math.js.map">source map</a>
href="https://unpkg.com/mathjs@11.10.0/lib/browser/math.js"
>math.js (version 11.10.0, <span id="size">199 kB</span>, minified and gzipped)</a>
and if needed the <a href="https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@11.10.0/lib/browser/math.js"></script>
<style>
body,

View File

@ -15,7 +15,7 @@
}
</style>
<script src="https://unpkg.com/mathjs@11.9.1/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@11.10.0/lib/browser/math.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@11.9.1/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js'], function (math) {
require(['https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js'], function (math) {
require(['https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js"></script>
<script src="https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js')
importScripts('https://unpkg.com/mathjs@11.10.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.9.1/lib/browser/math.js')
importScripts('https://unpkg.com/mathjs@11.10.0/lib/browser/math.js')
// create a parser
const parser = self.math.parser()

View File

@ -4,6 +4,16 @@ layout: default
<h1 id="history">History <a href="#history" title="Permalink">#</a></h1>
<h1 id="20230823-11100">2023-08-23, 11.10.0 <a href="#20230823-11100" title="Permalink">#</a></h1>
- Extend function `quantileSeq` with support for a `dimension` <a href="https://github.com/josdejong/mathjs/issues/3002">#3002</a>).
Thanks <a href="https://github.com/dvd101x">@dvd101x</a>.
- Implement <a href="https://github.com/josdejong/mathjs/issues/2735">#2735</a>: Support indexing with an array of booleans, for
example `a[[true, false, true]]` and `a[a > 2]` <a href="https://github.com/josdejong/mathjs/issues/2994">#2994</a>). Thanks <a href="https://github.com/dvd101x">@dvd101x</a>.
- Implement function `zeta` <a href="https://github.com/josdejong/mathjs/issues/2950">#2950</a>, <a href="https://github.com/josdejong/mathjs/issues/2975">#2975</a>, <a href="https://github.com/josdejong/mathjs/issues/2904">#2904</a>). Thanks <a href="https://github.com/Bobingstern">@Bobingstern</a>.
- Fix <a href="https://github.com/josdejong/mathjs/issues/2990">#2990</a>: `DenseMatrix` can mutate input arrays <a href="https://github.com/josdejong/mathjs/issues/2991">#2991</a>).
<h1 id="20230724-1191">2023-07-24, 11.9.1 <a href="#20230724-1191" title="Permalink">#</a></h1>
- Fix a security vulnerability in `FunctionNode` and `SymbolNode` allowing

File diff suppressed because one or more lines are too long

View File

@ -23,8 +23,8 @@
* It features real and complex numbers, units, matrices, a large set of
* mathematical functions, and a flexible expression parser.
*
* @version 11.9.1
* @date 2023-07-24
* @version 11.10.0
* @date 2023-08-23
*
* @license
* Copyright (C) 2013-2023 Jos de Jong <wjosdejong@gmail.com>

File diff suppressed because one or more lines are too long

@ -1 +1 @@
Subproject commit 563ff63ec0b890067b7806ca48d3be8aece34fb4
Subproject commit c4926ce56f107ae97b4cc06754235b375e2e59f7

32
package-lock.json generated
View File

@ -8,7 +8,7 @@
"name": "mathjs-website",
"version": "1.0.0",
"dependencies": {
"mathjs": "11.9.1"
"mathjs": "11.10.0"
},
"devDependencies": {
"fancy-log": "2.0.0",
@ -17,7 +17,7 @@
"gulp-header": "2.0.9",
"gulp-rename": "2.0.0",
"gulp-replace": "1.1.4",
"handlebars": "4.7.7",
"handlebars": "4.7.8",
"rimraf": "4.4.1"
}
},
@ -2392,13 +2392,13 @@
}
},
"node_modules/handlebars": {
"version": "4.7.7",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz",
"integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==",
"version": "4.7.8",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz",
"integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==",
"dev": true,
"dependencies": {
"minimist": "^1.2.5",
"neo-async": "^2.6.0",
"neo-async": "^2.6.2",
"source-map": "^0.6.1",
"wordwrap": "^1.0.0"
},
@ -3033,9 +3033,9 @@
}
},
"node_modules/mathjs": {
"version": "11.9.1",
"resolved": "https://registry.npmjs.org/mathjs/-/mathjs-11.9.1.tgz",
"integrity": "sha512-VdB9ELZ6Dwda13j5d1eCBETmPO8m9qIJETUdfZmTA9cPnXUiIk7UuoAmvxFqtfAe32XYuRugAec2Ndv0/RfRhg==",
"version": "11.10.0",
"resolved": "https://registry.npmjs.org/mathjs/-/mathjs-11.10.0.tgz",
"integrity": "sha512-PXzIHU+36OUCTJVkc6dwMB2MFMRykxcN9y+EnIhy/HUAIGYQMKEpDJrEjdLb7kCi1JSarmbZqNSpKFGxpZhWzw==",
"dependencies": {
"@babel/runtime": "^7.22.6",
"complex.js": "^2.1.1",
@ -6743,13 +6743,13 @@
}
},
"handlebars": {
"version": "4.7.7",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz",
"integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==",
"version": "4.7.8",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz",
"integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==",
"dev": true,
"requires": {
"minimist": "^1.2.5",
"neo-async": "^2.6.0",
"neo-async": "^2.6.2",
"source-map": "^0.6.1",
"uglify-js": "^3.1.4",
"wordwrap": "^1.0.0"
@ -7255,9 +7255,9 @@
}
},
"mathjs": {
"version": "11.9.1",
"resolved": "https://registry.npmjs.org/mathjs/-/mathjs-11.9.1.tgz",
"integrity": "sha512-VdB9ELZ6Dwda13j5d1eCBETmPO8m9qIJETUdfZmTA9cPnXUiIk7UuoAmvxFqtfAe32XYuRugAec2Ndv0/RfRhg==",
"version": "11.10.0",
"resolved": "https://registry.npmjs.org/mathjs/-/mathjs-11.10.0.tgz",
"integrity": "sha512-PXzIHU+36OUCTJVkc6dwMB2MFMRykxcN9y+EnIhy/HUAIGYQMKEpDJrEjdLb7kCi1JSarmbZqNSpKFGxpZhWzw==",
"requires": {
"@babel/runtime": "^7.22.6",
"complex.js": "^2.1.1",

View File

@ -6,7 +6,7 @@
"url": "https://github.com/josdejong/mathjs.git"
},
"dependencies": {
"mathjs": "11.9.1"
"mathjs": "11.10.0"
},
"devDependencies": {
"fancy-log": "2.0.0",
@ -15,7 +15,7 @@
"gulp-header": "2.0.9",
"gulp-rename": "2.0.0",
"gulp-replace": "1.1.4",
"handlebars": "4.7.7",
"handlebars": "4.7.8",
"rimraf": "4.4.1"
},
"scripts": {