diff --git a/.gitignore b/.gitignore index 13fb138245..016b59ea14 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,24 @@ -.idea -_site -coverage -node_modules +# build output +dist/ + +# generated types +.astro/ + +# dependencies +node_modules/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store + +# jetbrains setting folder +.idea/ diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index ae92fb3ac4..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "mathjs-src"] - path = mathjs-src - url = git@github.com:josdejong/mathjs.git diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000000..22a15055d6 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,4 @@ +{ + "recommendations": ["astro-build.astro-vscode"], + "unwantedRecommendations": [] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000000..d642209762 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "command": "./node_modules/.bin/astro dev", + "name": "Development server", + "request": "launch", + "type": "node-terminal" + } + ] +} diff --git a/CNAME b/CNAME deleted file mode 100644 index d06970773b..0000000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -mathjs.org \ No newline at end of file diff --git a/README.md b/README.md index 24569b2897..ff19a3e7ec 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,48 @@ -# math.js website +# Astro Starter Kit: Basics -This project contains the website of math.js, available at https://mathjs.org. -The website is static, and is hosted on [github pages](https://pages.github.com/). +```sh +npm create astro@latest -- --template basics +``` +[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/basics) +[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/basics) +[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/basics/devcontainer.json) -# Update +> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun! -To update the website with the latest version of math.js: +![just-the-basics](https://github.com/withastro/astro/assets/2244813/a0a5533c-a856-4198-8470-2d67b1d7c554) -- Update the version number of math.js in package.json. +## 🚀 Project Structure -- Install the dependencies via npm: +Inside of your Astro project, you'll see the following folders and files: - npm install +```text +/ +├── public/ +│ └── favicon.svg +├── src/ +│ ├── layouts/ +│ │ └── Layout.astro +│ └── pages/ +│ └── index.astro +└── package.json +``` -- Update the docs, examples, and version number via the build tool: +To learn more about the folder structure of an Astro project, refer to [our guide on project structure](https://docs.astro.build/en/basics/project-structure/). - npm run build +## 🧞 Commands - Note that this script will update a git submodule `./mathjs-src` which checks - out the `master` branch and generates the docs and examples fresh from the - source code. +All commands are run from the root of the project, from a terminal: -- Ensure any new pages are added to git. +| Command | Action | +| :------------------------ | :----------------------------------------------- | +| `npm install` | Installs dependencies | +| `npm run dev` | Starts local dev server at `localhost:4321` | +| `npm run build` | Build your production site to `./dist/` | +| `npm run preview` | Preview your build locally, before deploying | +| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | +| `npm run astro -- --help` | Get help using the Astro CLI | -- To generate the website locally using [Jekyll](https://jekyllrb.com/): +## 👀 Want to learn more? - jekyll - - This will generate the static website in the folder `_site`. - -- To test the website locally, use Jekyll as server: - - jekyll --server 4000 - - The website is than available in the browser at http://localhost:4000. - - -# Deploy - -To deploy the website, all that is needed is to commit the changes via git, -and push the changes to the `gh-pages` branch of math.js on github. +Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat). diff --git a/_config.yml b/_config.yml deleted file mode 100644 index 5447fa6fde..0000000000 --- a/_config.yml +++ /dev/null @@ -1,3 +0,0 @@ -exclude: [node_modules, coverage] - -markdown: kramdown diff --git a/_layouts/default.html b/_layouts/default.html deleted file mode 100644 index f9dc2426ec..0000000000 --- a/_layouts/default.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - math.js | an extensive math library for JavaScript and Node.js - - - - - - - - - - - - - - - - - - -
-
- - - -
- - - - - -
- {{content}} -
- -
- - - -
- - Fork me on GitHub - -
- - - - - - - - - - - - - - diff --git a/astro.config.mjs b/astro.config.mjs new file mode 100644 index 0000000000..16167a0305 --- /dev/null +++ b/astro.config.mjs @@ -0,0 +1,10 @@ +// @ts-check +import { defineConfig } from 'astro/config'; +import tailwindcss from "@tailwindcss/vite"; + +// https://astro.build/config +export default defineConfig({ + vite: { + plugins: [tailwindcss()], + }, +}); diff --git a/css/code.css b/css/code.css deleted file mode 100644 index a9edc71e48..0000000000 --- a/css/code.css +++ /dev/null @@ -1,45 +0,0 @@ -pre.highlight { - background-color: #fcfcfc; - border: 1px solid #ddd; - line-height: 1.5em; - padding: 5px; - border-radius: 2px; - font-size: 12px; -} - -pre.highlight code { - padding: 0; -} - -pre.highlight .c, -pre.highlight .c1, -pre.highlight .cm { - color: #808080; -} - -pre.highlight .kd , -pre.highlight .nt { - color: #004ED0; - color: #2B7CE9; -} - -pre.highlight .m, -pre.highlight .mi, -pre.highlight .mf { - color: #dc3912; -} - -pre.highlight .s { - color: #008000; -} - -pre.highlight .cp, -pre.highlight .n, -pre.highlight .na, -pre.highlight .s1 { - color: #ffa500; -} - -pre.highlight .kc { - color: #990099; -} diff --git a/css/commandline.css b/css/commandline.css deleted file mode 100644 index f6134d7d0b..0000000000 --- a/css/commandline.css +++ /dev/null @@ -1,177 +0,0 @@ - -.cle .input, -.cle .results .expr, -.cle .results .res { - font-family: monospace; - font-size: 12px; - color: #363636; -} - -.cle { - position: relative; - width: 100%; - height: 100%; - margin: 0; - padding: 3px; - - border: 1px solid #e5e5e5; - background-color: #f5f5f5; - border-radius: 2px; - - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; -} - -.cle.fullscreen { - position: fixed; - left: 0; - top: 0; - height: 100%; - z-index: 999; -} - -.cle .top-panel { - width: 100%; - height: 100%; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; - margin: 0 0 -30px 0; - padding: 0 0 30px 0; -} - -.cle .bottom-panel { - position: relative; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; - width: 100%; - height: 30px; -} - -.cle button.fullscreen { - position: absolute; - top: 5px; - right: 5px; - width: 16px; - height: 16px; - z-index: 1; - - border: none; - cursor: pointer; - background: url('img/fullscreen.png'); -} - -.cle button.fullscreen:hover { - opacity: 0.5; - filter: alpha(opacity=50); /* For IE8 and earlier */ -} - -.cle.fullscreen button.fullscreen { - background: url('img/fullscreen_exit.png'); -} - -.cle .results { - width: 100%; - height: 100%; - position: relative; - overflow: auto; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; - padding: 4px; - - border: 1px solid #e5e5e5; - background-color: white; - box-shadow: inset 2px 2px 5px rgba(192, 192, 192, 0.1); - line-height: 1.5; -} - -.cle .results .expr { - padding: 0; - margin: 0; -} - -.cle .results .res { - padding: 0; - margin: 0 0 5px 30px; - color: #dc3912; -} - -.cle .results .expr, -.cle .results .res { - background: none; - border: none; - - /* https://css-tricks.com/snippets/css/make-pre-text-wrap/ */ - white-space: pre-wrap; /* css-3 */ - white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ - white-space: -pre-wrap; /* Opera 4-6 */ - white-space: -o-pre-wrap; /* Opera 7 */ - word-wrap: break-word; /* Internet Explorer 5.5+ */ -} - -.cle .input-left { - width: 100%; - height: 100%; - margin: 0 -80px 0 0; - padding: 0 80px 4px 0; - float: left; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; -} - -.cle .input-right { - width: 80px; - height: 100%; - margin: 0; - padding: 0 0 4px 4px; - float: right; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; -} - -.cle .input { - width: 100%; - height: 100%; - margin: 4px 0 0 0; - padding: 2px 4px; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; - - border: 1px solid #e5e5e5; - background-color: white; - box-shadow: inset 2px 2px 5px rgba(192, 192, 192, 0.1); -} - -.cle button.eval { - color: #363636; - width: 100%; - height: 100%; - margin: 4px 0; - padding: 0; -} - -.result-info-icon { - color: white; - background: lightgray; - - border-radius: 3px; - - display: inline-block; - text-align: center; - margin: 0 6px; - padding: 0 3px; - - cursor: pointer; - transition: 0.1s all; -} - -.result-info-icon:hover { - background: darkgray; - transition: 0.3s all; -} \ No newline at end of file diff --git a/css/img/background.png b/css/img/background.png deleted file mode 100644 index 78985e8364..0000000000 Binary files a/css/img/background.png and /dev/null differ diff --git a/css/img/bright_squares.png b/css/img/bright_squares.png deleted file mode 100644 index c75a05a942..0000000000 Binary files a/css/img/bright_squares.png and /dev/null differ diff --git a/css/img/bright_squares.zip b/css/img/bright_squares.zip deleted file mode 100644 index 15a24838c3..0000000000 Binary files a/css/img/bright_squares.zip and /dev/null differ diff --git a/css/img/bright_squares_interlaced.png b/css/img/bright_squares_interlaced.png deleted file mode 100644 index 5d84c3b942..0000000000 Binary files a/css/img/bright_squares_interlaced.png and /dev/null differ diff --git a/css/img/debut_light.png b/css/img/debut_light.png deleted file mode 100644 index 2f4febcb62..0000000000 Binary files a/css/img/debut_light.png and /dev/null differ diff --git a/css/img/debut_light.zip b/css/img/debut_light.zip deleted file mode 100644 index de4f27c084..0000000000 Binary files a/css/img/debut_light.zip and /dev/null differ diff --git a/css/img/forkme_right_darkblue_121621.png b/css/img/forkme_right_darkblue_121621.png deleted file mode 100644 index 146ef8a800..0000000000 Binary files a/css/img/forkme_right_darkblue_121621.png and /dev/null differ diff --git a/css/img/fullscreen.png b/css/img/fullscreen.png deleted file mode 100644 index 6daf482304..0000000000 Binary files a/css/img/fullscreen.png and /dev/null differ diff --git a/css/img/fullscreen_exit.png b/css/img/fullscreen_exit.png deleted file mode 100644 index 93f2c9841c..0000000000 Binary files a/css/img/fullscreen_exit.png and /dev/null differ diff --git a/css/img/furley_bg.png b/css/img/furley_bg.png deleted file mode 100644 index a5e603e504..0000000000 Binary files a/css/img/furley_bg.png and /dev/null differ diff --git a/css/img/furley_bg.zip b/css/img/furley_bg.zip deleted file mode 100644 index 3ce063e9cb..0000000000 Binary files a/css/img/furley_bg.zip and /dev/null differ diff --git a/css/img/lambdatest.svg b/css/img/lambdatest.svg deleted file mode 100644 index 820512f3d6..0000000000 --- a/css/img/lambdatest.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - LOGO - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/css/style.css b/css/style.css deleted file mode 100644 index 1c7bd9c41e..0000000000 --- a/css/style.css +++ /dev/null @@ -1,379 +0,0 @@ - -body { - background: #f5f5f5 url('img/bright_squares_interlaced.png') repeat; - height: 100%; - width: 100%; - max-width: 100%; - padding: 0; - margin: 0; - - font-family: "Poppins", Verdana, Arial, Helvetica, sans-serif; - font-weight: normal; - font-size: 10pt; - line-height: 1.8; - color: #363636; -} - -#page { - position: relative; - width: 800px; - min-height: 700px; - margin: 20px auto 0 auto; - background-color: white; - padding: 40px 50px; - border: 1px solid lightgray; - border-radius: 3px; - /*overflow: hidden;*/ - - box-shadow: 2px 2px 10px rgba(128, 128, 128, 0.2); -} - -#page.small { - width: auto; - margin: 5px 5px 0 5px; - padding: 4%; -} - -#search { - position: absolute; - top: 20px; - right: 40px; - width: 300px; -} - -#search .gsib_a { - padding: 2px 6px; -} - -.small #search { - right: 4%; -} - -.tiny #search { - position: static; - width: 100%; -} - -.gsc-result .gs-title { - height: 1.4em !important; -} - -.gsc-search-button .gsc-search-button { - vertical-align: middle; - margin: 0; -} - -#logo { - width: 330px; - height: 100px; -} - -.small #logo { - width: 220px; - height: 67px; -} - -.tiny #logo { - width: 165px; - height: 50px; -} - -#menu { - background: #5f5f5f; - margin: 40px -50px; - padding: 0 50px; - text-transform: uppercase; - box-shadow: 0 0 15px #d6d6d6; -} - -#menu a { - color: white; - height: 100%; - display: inline-block; - border-right: 2px solid #f5f5f5; - font-weight: bold; - padding: 10px 18px; - margin: 0; - position: relative; - text-decoration: none; - - -webkit-transition: background .2s ease; - transition: background .2s ease; -} - -#menu a:first-child { - border-left: 2px solid #f5f5f5; -} - -#menu a:hover { - background: #808080; -} - -#menu a div.selection { - position: absolute; - bottom: -7px; - left: 0; - height: 5px; - width: 100%; - background: #dc3912; -} - -#page.small #menu { - margin: 40px -4%; - padding: 0 4%; -} - -#page.tiny #menu { - margin: 0; - padding: 0; -} - -#page.tiny #menu a { - display: block; - border-right: none; - border-bottom: 2px solid #f5f5f5; -} - -#page.tiny #menu a div.selection { - left: -7px; - top: 0; - height: 100%; - width: 5px; -} - - -#likes { - min-height: 42px; - margin: 60px 0 20px 0; - padding: 0; - overflow: visible; - display: flex; -} - -div.like { - float: left; - max-width: 100%; - height: 42px; - margin-right: 10px; -} - -div.like.github { - margin-right: 0; -} - -div.like.linkedin { - margin-top: -3px; -} - -div.spacing { - flex: 1; -} - -div.sponsor { - display: flex; - gap: 10px; -} - -#footer { - color: #b4b4b4; - text-align: center; - margin: 5px auto 30px auto; -} - -div.cols { - padding: 0; - margin: 0; -} - -.small div.cols { - width: 100%; -} - -div.cols .left { - float: left; - width: 47%; -} - -div.cols .right { - float: right; - width: 47%; -} - -.small div.cols .left, -.small div.cols .right { - width: 100%; -} - - -div.cols .end { - clear: both; - height: 0; - overflow: hidden; -} - -#content table { - border-collapse: collapse; - margin: 15px 0; -} - -#content table th, -#content table td { - border: 1px solid #ddd; - padding: 6px 13px; -} - -#content table tr:nth-child(2n) { - background-color: #f8f8f8; -} - -pre { - overflow: auto; -} - -code { - padding: 0.2em; - margin: 0; - font-size: 90%; - background-color: rgba(0,0,0,0.04); - border-radius: 3px; -} - -pre code { - margin: inherit; - border: none; - font-size: 100%; - background-color: transparent; - border-radius: inherit; - padding: inherit; -} - -blockquote { - color: #777; - border-left: 0.3em solid #ddd; - margin: 1em 1em; - padding: 0 2em; -} - -#commandline { - width: 100%; - height: 300px; -} - -.tips { - color: #b4b4b4; - margin: 10px 0; - font-size: 80%; -} -.tips ul { - margin: 0; -} - -h1, h2 { - font-size: 120%; - margin-top: 20px; -} - -h3, h4 { - font-size: 100%; -} - -h1, -h2, -h3, -h4, -h5, -h6 { - position: relative; - padding-left: 30px; - margin-left: -30px; -} - -h1 a, -h2 a, -h3 a, -h4 a, -h5 a, -h6 a { - position: absolute; - width: 30px; - left: 0; - top: 0; - display: inline-block; - text-align: center; - visibility: hidden; - text-decoration: none; -} - -.small h1 a, -.small h2 a, -.small h3 a, -.small h4 a, -.small h5 a, -.small h6 a { - position: relative; -} - -h1:hover a, -h2:hover a, -h3:hover a, -h4:hover a, -h5:hover a, -h6:hover a { - visibility: visible; -} - -h1 a:hover, -h2 a:hover, -h3 a:hover, -h4 a:hover, -h5 a:hover, -h6 a:hover { - text-decoration: underline; -} - -#content ul { - list-style-type: square; -} - -#content img { - border: none; -} - -#content a { - color: #dc3912; -} - -#content a:visited { - color: #b82e12; -} - -#content a:hover { - color: #f43f14; -} - -#footer a { - color: #b4b4b4; - text-decoration: none; -} - -#footer a:hover { - color: #dc3912; -} - -#forkme { - position: absolute; - text-align: right; - top: 0; - right: 0; - border: 0; -} - -#forkme.small { - display: none; -} - -.info-warning { - background: #ffff9e; - border: 1px solid #ffe765; - padding: 6px 10px; -} diff --git a/docs/command_line_interface.md b/docs/command_line_interface.md deleted file mode 100644 index c76a5be19d..0000000000 --- a/docs/command_line_interface.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -layout: default ---- - -

Command Line Interface (CLI) #

- -When math.js is installed globally using npm, its expression parser can be used -from the command line. To install math.js globally: - -```bash -$ npm install -g mathjs -``` - -Normally, a global installation must be run with admin rights (precede the -command with `sudo`). After installation, the application `mathjs` is available -via the command line: - -```bash -$ mathjs -> 12 / (2.3 + 0.7) -4 -> 12.7 cm to inch -5 inch -> sin(45 deg) ^ 2 -0.5 -> 9 / 3 + 2i -3 + 2i -> det([-1, 2; 3, 1]) --7 -``` - -The command line interface can be used to open a prompt, to execute a script, -or to pipe input and output streams: - -```bash -$ mathjs # Open a command prompt -$ mathjs script.txt # Run a script file, output to console -$ mathjs script1.txt script2.txt # Run two script files -$ mathjs script.txt > results.txt # Run a script file, output to file -$ cat script.txt | mathjs # Run input stream, output to console -$ cat script.txt | mathjs > results.txt # Run input stream, output to file -``` - -You can also use it to create LaTeX from or sanitize your expressions using the -`--tex` and `--string` options: - -```bash -$ mathjs --tex -> 1/2 -\frac{1}{2} -``` - -```bash -$ mathjs --string -> (1+1+1) -(1 + 1 + 1) -``` - -To change the parenthesis option use the `--parenthesis=` flag: - -```bash -$ mathjs --string --parenthesis=auto -> (1+1+1) -1 + 1 + 1 -``` - -```bash -$ mathjs --string --parenthesis=all -> (1+1+1) -(1 + 1) + 1 -``` - -

Command line debugging (REPL) #

- -The library also provides a REPL (Read Evaluate Print Loop) via `bin/repl.js` which -loads mathjs in a Node.js command line environment. -You can either start it directly (`./bin/repl.js`) or via node (`node bin/repl.js`). - -You can exit using either [ctrl]-[C] or [ctrl]-[D]. - -```bash -$ ./bin/repl.js -> math.parse('1+1') -{ op: '+', - fn: 'add', - args: - [ { value: '1', valueType: 'number' }, - { value: '1', valueType: 'number' } ] } -> -``` diff --git a/docs/core/chaining.md b/docs/core/chaining.md deleted file mode 100644 index 0b6ea61504..0000000000 --- a/docs/core/chaining.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -layout: default ---- - -

Chaining #

- -Math.js supports chaining operations by wrapping a value into a `Chain`. -A chain can be created with the function `math.chain(value)` -(formerly `math.select(value)`). -All functions available in the math namespace can be executed via the chain. -The functions will be executed with the chain's value as the first argument, -followed by extra arguments provided by the function call itself. - -```js -math.chain(3) - .add(4) - .subtract(2) - .done() // 5 - -math.chain( [[1, 2], [3, 4]] ) - .subset(math.index(0, 0), 8) - .multiply(3) - .done() // [[24, 6], [9, 12]] -``` - -

API #

- -A `Chain` is constructed as: - -```js -math.chain() -math.chain(value) -``` - -The `Chain` has all functions available in the `math` namespace, and has -a number of special functions: - - - `done()` - Finalize the chain and return the chain's value. - - `valueOf()` - The same as `done()`, returns the chain's value. - - `toString()` - Executes `math.format(value)` onto the chain's value, returning - a string representation of the value. - -Note that a "rest" or "..." parameter may not be broken across the value -in the chain and a function call. For example - -```js -math.chain(3).median(4,5).done() // throws error -``` - -does not compute the median of 3, 4, and 5. diff --git a/docs/core/configuration.md b/docs/core/configuration.md deleted file mode 100644 index 1eb4b8ded8..0000000000 --- a/docs/core/configuration.md +++ /dev/null @@ -1,162 +0,0 @@ ---- -layout: default ---- - -

Configuration #

- -Math.js contains a number of configuration options. -These options can be applied on a created mathjs instance and changed afterwards. - -```js -import { create, all } from 'mathjs' - -// create a mathjs instance with configuration -const config = { - relTol: 1e-12, - absTol: 1e-15, - matrix: 'Matrix', - number: 'number', - numberFallback: 'number', - precision: 64, - predictable: false, - randomSeed: null -} -const math = create(all, config) - -// read the applied configuration -console.log(math.config()) - -// change the configuration -math.config({ - number: 'BigNumber' -}) -``` - -The following configuration options are available: - -- `relTol`. The minimum relative difference used to test equality between two - compared values. This value is used by all relational functions. - Default value is `1e-12`. - -- `absTol`. The minimum absolute difference used to test equality between two - compared values. This value is used by all relational functions. - Default value is `1e-15`. - -- `matrix`. The default type of matrix output for functions. - Available values are: `'Matrix'` (default) or `'Array'`. - Where possible, the type of matrix output from functions is determined from - the function input: An array as input will return an Array, a Matrix as input - will return a Matrix. In case of no matrix as input, the type of output is - determined by the option `matrix`. In case of mixed matrix - inputs, a matrix will be returned always. - -- `number`. The type used to parse strings into a numeric value or create a new - numeric value internally. - - For most functions, the type of output is determined from the input: - a number as input will return a number as output, a BigNumber as input - returns a BigNumber as output. But for example the functions - `math.evaluate('2+3')`, `math.parse('2+3')`, `math.range('1:10')`, - and `math.unit('5cm')` use the `number` configuration setting. - - Note that `math.sqrt(4)` will always return the number `2` regardless of - the `number` configuration, because the numeric type can be determined from - the input value. - - Available values are: `'number'` (default), `'BigNumber'`, `'bigint'`, or `'Fraction'`. - [BigNumbers](../datatypes/bignumbers.html) have higher precision than the default numbers of JavaScript, - [bigint](../datatypes/bigints.html) can represent large integer numbers, - and [`Fractions`](../datatypes/fractions.html) store values in terms of a numerator and - denominator. - -- `numberFallback`. When `number` is configured for example with value `'bigint'`, - and a value cannot be represented as `bigint` like in `math.evaluate('2.3')`, - the value will be parsed in the type configured with `numberFallback`. - Available values: `'number'` (default) or `'BigNumber'`. - -- `precision`. The maximum number of significant digits for BigNumbers. - This setting only applies to BigNumbers, not to numbers. - Default value is `64`. - -- `predictable`. Predictable output type of functions. When true, output type - depends only on the input types. When false (default), output type can vary - depending on input values. For example `math.sqrt(-4)` returns `complex('2i')` when - predictable is false, and returns `NaN` when true. - Predictable output can be needed when programmatically handling the result of - a calculation, but can be inconvenient for users when evaluating dynamic - equations. - -- `randomSeed`. Set this option to seed pseudo random number generation, making it deterministic. The pseudo random number generator is reset with the seed provided each time this option is set. For example, setting it to `'a'` will cause `math.random()` to return `0.43449421599986604` upon the first call after setting the option every time. Set to `null` to seed the pseudo random number generator with a random seed. Default value is `null`. - - -

Examples #

- -This section shows a number of configuration examples. - -

node.js #

- -```js -import { create, all } from 'mathjs' - -const config = { - matrix: 'Array' // Choose 'Matrix' (default) or 'Array' -} -const math = create(all, config) - -// range will output an Array -math.range(0, 4) // Array [0, 1, 2, 3] - -// change the configuration from Arrays to Matrices -math.config({ - matrix: 'Matrix' // Choose 'Matrix' (default) or 'Array' -}) - -// range will output a Matrix -math.range(0, 4) // Matrix [0, 1, 2, 3] - -// create an instance of math.js with BigNumber configuration -const bigmath = create(all, { - number: 'BigNumber', // Choose 'number' (default), 'BigNumber', or 'Fraction' - precision: 32 // 64 by default, only applicable for BigNumbers -}) - -// parser will parse numbers as BigNumber now: -bigmath.evaluate('1 / 3') // BigNumber, 0.33333333333333333333333333333333 -``` - -

browser #

- - -```html - - - - - - - - - -``` diff --git a/docs/core/extension.md b/docs/core/extension.md deleted file mode 100644 index 7a54829762..0000000000 --- a/docs/core/extension.md +++ /dev/null @@ -1,272 +0,0 @@ ---- -layout: default ---- - -

Extension #

- -The library can easily be extended with functions and variables using the -[`import`](../reference/functions/import.html) function. The `import` function is available on a mathjs instance, which can be created using the `create` function. - -```js -import { create, all } from 'mathjs' - -const math = create(all) - -math.import(/* ... */) -``` - -The function `import` accepts an object with functions and variables, or an array with factory functions. It has the following syntax: - -```js -math.import(functions: Object [, options: Object]) -``` - -Where: - -- `functions` is an object or array containing the functions and/or values to be - imported. `import` support regular values and functions, typed functions - (see section [Typed functions](#typed-functions)), and factory functions - (see section [Factory functions](#factory-functions)). - An array is only applicable when it contains factory functions. - -- `options` is an optional second argument with options. - The following options are available: - - - `{boolean} override` - If `true`, existing functions will be overwritten. The default value is `false`. - - `{boolean} silent` - If `true`, the function will not throw errors on duplicates or invalid - types. Default value is `false`. - - `{boolean} wrap` - If `true`, the functions will be wrapped in a wrapper function which - converts data types like Matrix to primitive data types like Array. - The wrapper is needed when extending math.js with libraries which do not - support the math.js data types. The default value is `false`. - -The following code example shows how to import a function and a value into math.js: - -```js -// define new functions and variables -math.import({ - myvalue: 42, - hello: function (name) { - return 'hello, ' + name + '!' - } -}) - -// defined functions can be used in both JavaScript as well as the parser -math.myvalue * 2 // 84 -math.hello('user') // 'hello, user!' - -const parser = math.parser() -parser.evaluate('myvalue + 10') // 52 -parser.evaluate('hello("user")') // 'hello, user!' -``` - -

Import external libraries #

- -External libraries like -[numbers.js](https://github.com/sjkaliski/numbers.js) and -[numeric.js](https://github.com/sloisel/numeric) can be imported as follows. -The libraries must be installed using npm: - - $ npm install numbers - $ npm install numeric - -The libraries can be easily imported into math.js using `import`. -In order to convert math.js specific data types like `Matrix` to primitive types -like `Array`, the imported functions can be wrapped by enabling `{wrap: true}`. - -```js -import { create, all } from 'mathjs' -import * as numbers from 'numbers' -import * as numeric from 'numeric' - -// create a mathjs instance and import the numbers.js and numeric.js libraries -const math = create(all) -math.import(numbers, {wrap: true, silent: true}) -math.import(numeric, {wrap: true, silent: true}) - -// use functions from numbers.js -math.fibonacci(7) // 13 -math.evaluate('fibonacci(7)') // 13 - -// use functions from numeric.js -math.evaluate('eig([1, 2; 4, 3])').lambda.x // [5, -1] -``` - - -

Typed functions #

- -Typed functions can be created using `math.typed`. A typed function is a function -which does type checking on the input arguments. It can have multiple signatures. -And can automatically convert input types where needed. - -A typed function can be created like: - -```js -const max = typed('max', { - 'number, number': function (a, b) { - return Math.max(a, b) - }, - - 'BigNumber, BigNumber': function (a, b) { - return a.greaterThan(b) ? a : b - } -}) -``` - -Typed functions can be merged as long as there are no conflicts in the signatures. -This allows for extending existing functions in math.js with support for new -data types. - -```js -// create a new data type -function MyType (value) { - this.value = value -} -MyType.prototype.isMyType = true -MyType.prototype.toString = function () { - return 'MyType:' + this.value -} - -// define a new datatype -math.typed.addType({ - name: 'MyType', - test: function (x) { - // test whether x is of type MyType - return x && x.isMyType - } -}) - -// use the type in a new typed function -const add = typed('add', { - 'MyType, MyType': function (a, b) { - return new MyType(a.value + b.value) - } -}) - -// import in math.js, extend the existing function `add` with support for MyType -math.import({add: add}) - -// use the new type -const ans = math.add(new MyType(2), new MyType(3)) // returns MyType(5) -console.log(ans) // outputs 'MyType:5' -``` - -Detailed information on typed functions is available here: -[https://github.com/josdejong/typed-function](https://github.com/josdejong/typed-function) - - - - -

Factory functions #

- -Regular JavaScript functions can be imported in math.js using `math.import`: - -```js -math.import({ - myFunction: function (a, b) { - // ... - } -}) -``` - -The function can be stored in a separate file: - -```js -export function myFunction (a, b) { - // ... -} -``` - -Which can be imported like: - -```js -import { myFunction } from './myFunction.js' - -math.import({ - myFunction -}) -``` - -An issue arises when `myFunction` needs functionality from math.js: -it doesn't have access to the current instance of math.js when in a separate file. -Factory functions can be used to solve this issue. A factory function allows to inject dependencies into a function when creating it. - -A syntax of factory function is: - -```js -factory(name: string, dependencies: string[], create: function, meta?: Object): function -``` - -where: - -- `name` is the name of the created function. -- `dependencies` is an array with names of the dependent functions. -- `create` is a function which creates the function. - An object with the dependencies is passed as first argument. -- `meta` An optional object which can contain any meta data you want. - This will be attached as a property `meta` on the created function. - Known meta data properties used by the mathjs instance are: - - `isClass: boolean` If true, the created function is supposed to be a - class, and for example will not be exposed in the expression parser - for security reasons. - - `lazy: boolean`. By default, everything is imported lazily by `import`. - only as soon as the imported function or constant is actually used, it - will be constructed. A function can be forced to be created immediately - by setting `lazy: false` in the meta data. - - `isTransformFunction: boolean`. If true, the created function is imported - as a transform function. It will not be imported in `math` itself, only - in the internal `mathWithTransform` namespace that is used by the - expression parser. - - `recreateOnConfigChange: boolean`. If true, the imported factory will be - created again when there is a change in the configuration. This is for - example used for the constants like `pi`, which is different depending - on the configsetting `number` which can be numbers or BigNumbers. - - `formerly: string`. If present, the created function will also be - accessible on the instance under the name given by the value of - `formerly` as a (deprecated) synonym for the specified `name`. This - facility should only be used when a function is renamed, to allow - temporary use of the previous name, for backward compatibility. - -Here an example of a factory function which depends on `multiply`: - -```js -import { factory, create, all } from 'mathjs' - -// create a factory function -const name = 'negativeSquare' -const dependencies = ['multiply', 'unaryMinus'] -const createNegativeSquare = factory(name, dependencies, function ({ multiply, unaryMinus }) { - return function negativeSquare (x) { - return unaryMinus(multiply(x, x)) - } - }) - -// create an instance of the function yourself: -const multiply = (a, b) => a * b -const unaryMinus = (a) => -a -const negativeSquare = createNegativeSquare({ multiply, unaryMinus }) -console.log(negativeSquare(3)) // -9 - -// or import the factory in a mathjs instance and use it there -const math = create(all) -math.import(createNegativeSquare) -console.log(math.negativeSquare(4)) // -16 -console.log(math.evaluate('negativeSquare(5)')) // -25 -``` - -You may wonder why you would inject functions `multiply` and `unaryMinus` -instead of just doing these calculations inside the function itself. The -reason is that this makes the factory function `negativeSquare` work for -different implementations: numbers, BigNumbers, units, etc. - -```js -import { Decimal } from 'decimal.js' - -// create an instance of our negativeSquare supporting BigNumbers instead of numbers -const multiply = (a, b) => a.mul(b) -const unaryMinus = (a) => new Decimal(0).minus(a) -const negativeSquare = createNegativeSquare({ multiply, unaryMinus }) -``` \ No newline at end of file diff --git a/docs/core/index.md b/docs/core/index.md deleted file mode 100644 index b08a5738f9..0000000000 --- a/docs/core/index.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -layout: default ---- - -

Core #

- -

Usage #

- -The core of math.js is the `math` namespace containing all functions and constants. There are three ways to do calculations in math.js: - -- Doing regular function calls like `math.add(math.sqrt(4), 2)`. -- Evaluating expressions like `math.evaluate('sqrt(4) + 2')` -- Chaining operations like `math.chain(4).sqrt().add(2)`. - -

Configuration #

- -math.js can be configured using the `math.config()`, see page [Configuration](configuration.html). - -

Extension #

- -math.js can be extended with new functions and constants using the function `math.import()`, see page [Extension](extension.html). - -

Serialization #

- -To persist or exchange data structures like matrices and units, the data types of math.js can be stringified as JSON. This is explained on the page [Serialization](serialization.html). diff --git a/docs/core/serialization.md b/docs/core/serialization.md deleted file mode 100644 index 9b1b7520f9..0000000000 --- a/docs/core/serialization.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - -

Serialization #

- -Math.js has a number of data types like `Matrix`, `Complex`, and `Unit`. These -types are instantiated JavaScript objects. To be able to store these data types -or send them between processes, they must be serialized. The data types of -math.js can be serialized to JSON. Use cases: - -- Store data in a database or on disk. -- Interchange of data between a server and a client. -- Interchange of data between a web worker and the browser. - -Math.js types can be serialized using JavaScript's built-in `JSON.stringify` -function: - -```js -const x = math.complex('2 + 3i') -const str = JSON.stringify(x, math.replacer) -console.log(str) -// outputs a string '{"mathjs":"Complex","re":2,"im":3}' -``` - -> IMPORTANT: in most cases works, serialization correctly without -> passing the `math.replacer` function as second argument. This is because -> in most cases we can rely on the default behavior of JSON.stringify, which -> uses the `.toJSON` method on classes like `Unit` and `Complex` to correctly -> serialize them. However, there are a few special cases like the -> number `Infinity` which does require the replacer function in order to be -> serialized without losing information: without it, `Infinity` will be -> serialized as `"null"` and cannot be deserialized correctly. -> -> So, it's best to always pass the `math.replacer` function to prevent -> weird edge cases. - -In order to deserialize a string, containing math.js data types, `JSON.parse` -can be used. In order to recognize the data types of math.js, `JSON.parse` must -be called with the reviver function of math.js: - -```js -const json = '{"mathjs":"Unit","value":5,"unit":"cm","fixPrefix":false}' -const x = JSON.parse(json, math.reviver) // Unit 5 cm -``` - -Note that if math.js is used in conjunction with other data types, it is -possible to use multiple reviver functions at the same time by cascading them: - -```js -const reviver = function (key, value) { - return reviver1(key, reviver2(key, value)) -} -``` diff --git a/docs/custom_bundling.md b/docs/custom_bundling.md deleted file mode 100644 index d30bb7e33e..0000000000 --- a/docs/custom_bundling.md +++ /dev/null @@ -1,121 +0,0 @@ ---- -layout: default ---- - -

Custom bundling #

- -Math.js is a large library containing many data types and functions. -It is well possible that you only need a small portion of the library. -Math.js allows for picking just the functions and data types you need. -This gives faster load times and smaller browser bundles. Math.js uses -ES modules, and creating small bundles using tree-shaking works out of -the box when using Webpack for example. - -This page describes: - -- How to use just a few functions for faster load times and smaller bundles. -- How to use light-weight, number only implementations of functions. -- What to expect from bundle sizes when using tree-shaking. - -

Using just a few functions #

- -Using the function `create`, a mathjs instance can be created. -The `all` object contains all functionality available in mathjs, -and a mathjs instance containing everything can be created like: - -```js -import { create, all } from 'mathjs' - -const math = create(all) -``` - -To create an instance with just a few functions, you have to pass the -factory functions of the functions you need, and all their dependencies. -For example the function `add` depends on the functions `addScalar`, -`equalScalar`, classes `DenseMatrix` and `SparseMatrix`, and more. -Because it is hard to figure out what the dependencies of a function are, -and the dependencies of the dependencies, mathjs provides ready made -collections of all dependencies for every function. For example all -factory functions of function `add` and its dependencies are available -as `addDependencies`. - -Here is a full example of loading just a few functions in a mathjs instance: - -```js -// file: custom_loading.js - -import { - create, - fractionDependencies, - addDependencies, - divideDependencies, - formatDependencies -} from 'mathjs' - -const config = { - // optionally, you can specify configuration -} - -// Create just the functions we need -const { fraction, add, divide, format } = create({ - fractionDependencies, - addDependencies, - divideDependencies, - formatDependencies -}, config) - -// Use the created functions -const a = fraction(1, 3) -const b = fraction(3, 7) -const c = add(a, b) -const d = divide(a, b) -console.log('c =', format(c)) // outputs "c = 16/21" -console.log('d =', format(d)) // outputs "d = 7/9" -``` - -This example can be bundled using for example Webpack: - -``` -npx webpack custom_loading.js -o custom_loading.bundle.js --mode=production -``` - -Only the used parts of mathjs will be bundled thanks to tree-shaking. - - -

Numbers only #

- -The functions of mathjs support multiple data types out of the box, like -numbers, bignumbers, complex numbers, units, and matrices. Quite commonly however, -only support for numbers is needed and the other data-types are overkill. - -To accomodate for this use case where just the JavaScript `number` type -suffices, mathjs offers light-weight, -number-only implementations of all relevant functions. These are available by -importing from `'mathjs/number'` instead of `'mathjs'`: - -```js -// use light-weight, number-only implementations of functions -import { create, all } from 'mathjs/number' - -const math = create(all) -console.log(math.add(2, 3)) // 5 -``` - -

Bundle size #

- -When using just a few functions of mathjs instead of the whole library, -you may expect the size of the bundle to be just a small fraction of the -complete library. However, to create the function `add` supporting all data -types, all these data types must be included: Unit, BigNumber, Complex, -DenseMatrix, SparseMatrix, etc. A rough idea of the size of different parts of -mathjs: - -- About 5% is coming from core functionality like `create`, `import`, `factory`, - `typed-function`, etc. -- About 30% of the bundle size comes from the data classes `Complex`, `BigNumber`, `Fraction`, `Unit`, `SparseMatrix`, `DenseMatrix`. -- About 25% of the bundle size comes from the expression parser. - Half of this comes from the embedded docs. -- About 40% comes from the about 200 built-in functions and some constants. - -To get a better insight in what is in your JavaScript bundle, you can use -a tool like [source-map-explorer](https://github.com/danvk/source-map-explorer). diff --git a/docs/datatypes/bigints.md b/docs/datatypes/bigints.md deleted file mode 100644 index 3e9bcf7ca0..0000000000 --- a/docs/datatypes/bigints.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -layout: default ---- - -

BigInts #

- -For calculations with large integer numbers, math.js supports the built-in `bigint` data type. - -

Usage #

- -A bigint can be created either by adding the suffix `n` to a `number`, using the `BigInt` constructor function, or using the util function `math.bigint`: - -```js -42n -BigInt('42') -math.bigint('42') -``` - -Most functions can determine the type of output from the type of input: -a `number` as input will return a `number` as output, a `bigint` as input returns -a `bigint` as output. Functions which cannot determine the type of output -from the input (for example `math.evaluate`) use the default number type `number`, -which can be configured when instantiating math.js. To configure the use of -`bigint` instead of [numbers](numbers.html) by default, configure math.js like: - -```js -math.config({ - number: 'bigint' -}) - -// use math -math.evaluate('70000000000000000123') // bigint 70000000000000000123n -``` - -

Support #

- -All basic arithmetic functions in math.js support `bigint`. Since `bigint` can only hold integer values, it is not applicable to for example trigonometric functions. When using a `bigint` in a function that does not support it, like `sqrt`, it will convert the `bigint` into a regular `number` and then execute the function: - -```js -math.sin(2n) // number 0.9092974268256817 -``` - -

Conversion #

- -There are utility functions to convert a `bigint` into a `number` or `BigNumber`: - -```js -// convert a number to bigint or BigNumber -math.bigint(42) // bigint, 42n -math.bignumber(42) // BigNumber, 42 - -// convert a bigint to a number or BigNumber -math.number(42n) // number, 42 -math.bignumber(42n) // BigNumber, 42 - -// losing digits when converting to number -math.number(70000000000000000123n) // number, 7000000000000000000 -``` diff --git a/docs/datatypes/bignumbers.md b/docs/datatypes/bignumbers.md deleted file mode 100644 index 1d97d2f734..0000000000 --- a/docs/datatypes/bignumbers.md +++ /dev/null @@ -1,116 +0,0 @@ ---- -layout: default ---- - -

BigNumbers #

- -For calculations with an arbitrary precision, math.js supports a `BigNumber` -datatype. BigNumber support is powered by -[decimal.js](https://github.com/MikeMcl/decimal.js/). - -

Usage #

- -A BigNumber can be created using the function `bignumber`: - -```js -math.bignumber('2.3e+500') // BigNumber, 2.3e+500 -``` - -Most functions can determine the type of output from the type of input: -a number as input will return a number as output, a BigNumber as input returns -a BigNumber as output. Functions which cannot determine the type of output -from the input (for example `math.evaluate`) use the default number type `number`, -which can be configured when instantiating math.js. To configure the use of -BigNumbers instead of [numbers](numbers.html) by default, configure math.js like: - -```js -math.config({ - number: 'BigNumber', // Default type of number: - // 'number' (default), 'BigNumber', or 'Fraction' - precision: 64, // Number of significant digits for BigNumbers - relTol: 1e-60, - absTol: 1e-63 -}) - -// use math -math.evaluate('0.1 + 0.2') // BigNumber, 0.3 -``` - -The default precision for BigNumber is 64 digits, and can be configured with -the option `precision`. - -Note that we also change the configuration of `relTol` and `absTol` -to be close to the precision limit of our BigNumbers. `relTol` and `absTol` are used for -example in relational and rounding functions (`equal`, `larger`, `smaller`, -`round`, `floor`, etc) to determine when a value is nearly equal, -see [Equality](numbers.html#equality). If we would leave `relTol` and `absTol` unchanged, -having the default value of `1e-12` and `1e-15` respectively, we could get inaccurate and misleading -results since we're now working with a higher precision. - - -

Support #

- -Most functions in math.js support BigNumbers, but not all of them. -For example the function `random` doesn't support BigNumbers. - - -

Round-off errors #

- -Calculations with BigNumber are much slower than calculations with Number, -but they can be executed with an arbitrary precision. By using a higher -precision, it is less likely that round-off errors occur: - -```js -// round-off errors with numbers -math.add(0.1, 0.2) // Number, 0.30000000000000004 -math.divide(0.3, 0.2) // Number, 1.4999999999999998 - -// no round-off errors with BigNumbers :) -math.add(math.bignumber(0.1), math.bignumber(0.2)) // BigNumber, 0.3 -math.divide(math.bignumber(0.3), math.bignumber(0.2)) // BigNumber, 1.5 -``` - - -

Limitations #

- -It's important to realize that BigNumbers do not solve *all* problems related -to precision and round-off errors. Numbers with an infinite number of digits -cannot be represented with a regular number nor a BigNumber. Though a BigNumber -can store a much larger number of digits, the amount of digits remains limited -if only to keep calculations fast enough to remain practical. - -```js -const one = math.bignumber(1) -const three = math.bignumber(3) -const third = math.divide(one, three) -console.log(third.toString()) -// outputs 0.3333333333333333333333333333333333333333333333333333333333333333 - -const ans = math.multiply(third, three) -console.log(ans.toString()) -// outputs 0.9999999999999999999999999999999999999999999999999999999999999999 -// this should be 1 again, but `third` is rounded to a limited number of digits 3 -``` - - -

Conversion #

- -BigNumbers can be converted to numbers and vice versa using the functions -`number` and `bignumber`. When converting a BigNumber to a number, the high -precision of the BigNumber will be lost. When a BigNumber is too large to be represented -as Number, it will be initialized as `Infinity`. - -```js -// converting numbers and BigNumbers -const a = math.number(0.3) // number, 0.3 -const b = math.bignumber(a) // BigNumber, 0.3 -const c = math.number(b) // number, 0.3 - -// exceeding the maximum of a number -const d = math.bignumber('1.2e500') // BigNumber, 1.2e+500 -const e = math.number(d) // number, Infinity - -// loosing precision when converting to number -const f = math.bignumber('0.2222222222222222222') // BigNumber, 0.2222222222222222222 -const g = math.number(f) // number, 0.2222222222222222 -``` diff --git a/docs/datatypes/complex_numbers.md b/docs/datatypes/complex_numbers.md deleted file mode 100644 index 37d98564bd..0000000000 --- a/docs/datatypes/complex_numbers.md +++ /dev/null @@ -1,172 +0,0 @@ ---- -layout: default ---- - -

Complex Numbers #

- -Math.js supports the creation, manipulation, and calculations with complex numbers. -Support of complex numbers is powered by the library [complex.js](https://github.com/infusion/Complex.js). - -In mathematics, a complex number is an expression of the form `a + bi`, -where `a` and `b` are real numbers and `i` represents the imaginary number -defined as `i^2 = -1`. (In other words, `i` is the square root of `-1`.) -The real number `a` is called the real part of the complex number, -and the real number `b` is the imaginary part. For example, `3 + 2i` is a -complex number, having real part `3` and imaginary part `2`. -Complex numbers are often used in applied mathematics, control theory, -signal analysis, fluid dynamics and other fields. - -

Usage #

- -A complex number is created using the function `math.complex`. This function -accepts: - -- two numbers representing the real and imaginary part of the value, -- a single string containing a complex value in the form `a + bi` where `a` - and `b` respectively represent the real and imaginary part of the complex number. -- an object with either properties `re` and `im` for the real and imaginary - part of the value, or two properties `r` and `phi` containing the polar - coordinates of a complex value. -The function returns a `Complex` object. - -Syntax: - -```js -math.complex(re: number) : Complex -math.complex(re: number, im: number) : Complex -math.complex(complex: Complex) : Complex -math.complex({re: Number, im: Number}) : Complex -math.complex({r: number, phi: number}) : Complex -math.complex({abs: number, arg: number}) : Complex -math.complex(str: string) : Complex -``` - -Examples: - -```js -const a = math.complex(2, 3) // Complex 2 + 3i -a.re // Number 2 -a.im // Number 3 - -const b = math.complex('4 - 2i') // Complex 4 - 2i -b.re = 5 // Number 5 -b // Complex 5 - 2i -``` - -

Calculations #

- -Most functions of math.js support complex numbers. Complex and real numbers -can be used together. - -```js -const a = math.complex(2, 3) // Complex 2 + 3i -const b = math.complex('4 - 2i') // Complex 4 - 2i - -math.re(a) // Number 2 -math.im(a) // Number 3 -math.conj(a) // Complex 2 - 3i - -math.add(a, b) // Complex 6 + i -math.multiply(a, 2) // Complex 4 + 6i -math.sqrt(-4) // Complex 2i -``` - -

API #

-A `Complex` object created by `math.complex` contains the following properties and functions: - -

complex.re #

- -A number containing the real part of the complex number. Can be read and replaced. - -

complex.im #

- -A number containing the imaginary part of the complex number. Can be read and replaced. - -

complex.clone() #

- -Create a clone of the complex number. - -

complex.equals(other) #

- -Test whether a complex number equals another complex value. - - Two complex numbers are equal when both their real and imaginary parts are - equal. - -

complex.neg() #

- -Returns a complex number with a real part and an imaginary part equal in magnitude but opposite in sign to the current complex number. - -

complex.conjugate() #

- -Returns a complex number with an equal real part and an imaginary part equal in magnitude but opposite in sign to the current complex number. - -

complex.inverse() #

- -Returns a complex number that is inverse of the current complex number. - -

complex.toVector() #

- -Get the vector representation of the current complex number. Returns an array of size 2. - -

complex.toJSON() #

- -Returns a JSON representation of the complex number, with signature - `{mathjs: 'Complex', re: number, im: number}`. - Used when serializing a complex number, see [Serialization](../core/serialization.html). - -

complex.toPolar() #

- -Get the polar coordinates of the complex number, returns - an object with properties `r` and `phi`. - -

complex.toString() #

- -Returns a string representation of the complex number, formatted - as `a + bi` where `a` is the real part and `b` the imaginary part. - - -

complex.format([precision: number]) #

- -Get a string representation of the complex number, - formatted as `a + bi` where `a` is the real part and `b` the imaginary part. - If precision is defined, the units value will be rounded to the provided - number of digits. - -

Static methods #

-The following static methods can be accessed using `math.Complex` - - -

Complex.fromJSON(json) #

- -Revive a complex number from a JSON object. Accepts - An object `{mathjs: 'Complex', re: number, im: number}`, where the property - `mathjs` is optional. - Used when deserializing a complex number, see [Serialization](../core/serialization.html). - -

Complex.fromPolar(r: number, phi: number) #

- -Create a complex number from polar coordinates. - - -

Complex.compare(a: Complex, b: Complex) #

- -Returns the comparision result of two complex number: - -- Returns 1 when the real part of `a` is larger than the real part of `b` -- Returns -1 when the real part of `a` is smaller than the real part of `b` -- Returns 1 when the real parts are equal - and the imaginary part of `a` is larger than the imaginary part of `b` -- Returns -1 when the real parts are equal - and the imaginary part of `a` is smaller than the imaginary part of `b` -- Returns 0 when both real and imaginary parts are equal. - -Example: -```js -const a = math.complex(2, 3) // Complex 2 + 3i -const b = math.complex(2, 1) // Complex 2 + 1i -math.Complex.compare(a,b) // returns 1 - -//create from json -const c = math.Complex.fromJSON({mathjs: 'Complex', re: 4, im: 3}) // Complex 4 + 3i -``` diff --git a/docs/datatypes/fractions.md b/docs/datatypes/fractions.md deleted file mode 100644 index 2701a54b37..0000000000 --- a/docs/datatypes/fractions.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -layout: default ---- - -

Fractions #

- -For calculations with fractions, math.js supports a `Fraction` data type. -Fraction support is powered by [fraction.js](https://github.com/rawify/Fraction.js). -Unlike [numbers](numbers.html) and [BigNumbers](./bignumbers.html), fractions can -store numbers with infinitely repeating decimals, for example `1/3 = 0.3333333...`, -which can be represented as `0.(3)`, or `2/7` which can be represented as `0.(285714)`. - - -

Usage #

- -A Fraction can be created using the function `fraction`: - -```js -math.fraction('1/3') // Fraction, 1/3 -math.fraction(2, 3) // Fraction, 2/3 -math.fraction('0.(3)') // Fraction, 1/3 -``` - -And can be used in functions like `add` and `multiply` like: - -```js -math.add(math.fraction('1/3'), math.fraction('1/6')) // Fraction, 1/2 -math.multiply(math.fraction('1/4'), math.fraction('1/2')) // Fraction, 1/8 -``` - -Note that not all functions support fractions. For example trigonometric -functions doesn't support fractions. When not supported, the functions -will convert the input to numbers and return a number as result. - -Most functions will determine the type of output from the type of input: -a number as input will return a number as output, a Fraction as input returns -a Fraction as output. Functions which cannot determine the type of output -from the input (for example `math.evaluate`) use the default number type `number`, -which can be configured when instantiating math.js. To configure the use of -fractions instead of [numbers](numbers.html) by default, configure math.js like: - -```js -// Configure the default type of number: 'number' (default), 'BigNumber', or 'Fraction' -math.config({ - number: 'Fraction' -}) - -// use the expression parser -math.evaluate('0.32 + 0.08') // Fraction, 2/5 -``` - -

Support #

- -The following functions support fractions: - -- Arithmetic functions: `abs`, `add`, `ceil`, `cube`, `divide`, `dotDivide`, `dotMultiply`, `fix`, `floor`, `gcd`, `mod`, `multiply`, `round`, `sign`, `square`, `subtract`, `unaryMinus`, `unaryPlus`. -- Construction functions: `fraction`. -- Relational functions: `compare`, `deepEqual`, `equal`, `larger`, `largerEq`, `smaller`, `smallerEq`, `unequal`. -- Utils functions: `format`. - - -

Conversion #

- -Fractions can be converted to numbers and vice versa using the functions -`number` and `fraction`. When converting a Fraction to a number, precision -may be lost when the value cannot represented in 16 digits. - -```js -// converting numbers and fractions -const a = math.number(0.3) // number, 0.3 -const b = math.fraction(a) // Fraction, 3/10 -const c = math.number(b) // number, 0.3 - -// loosing precision when converting to number: a fraction can represent -// a number with an infinite number of repeating decimals, a number just -// stores about 16 digits and cuts consecutive digits. -const d = math.fraction('2/5') // Fraction, 2/5 -const e = math.number(d) // number, 0.4 -``` diff --git a/docs/datatypes/index.md b/docs/datatypes/index.md deleted file mode 100644 index c2c67e64d8..0000000000 --- a/docs/datatypes/index.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -layout: default ---- - -

Data Types #

- -The functions of math.js support multiple data types, both native JavaScript -types as well as more advanced types implemented in math.js. The data types can -be mixed together in calculations, for example by adding a Number to a -Complex number or Array. - -The supported data types are: - -- Boolean -- [Number](numbers.html) -- [BigNumber](bignumbers.html) -- [Complex](complex_numbers.html) -- [Fraction](fractions.html) -- [Array](matrices.html) -- [Matrix](matrices.html) -- [Unit](units.html) -- String - -Function [`math.typeOf(x)`](../reference/functions/typeOf.html) can be used to get -the type of a variable. - -Example usage: - -```js -// use numbers -math.subtract(7.1, 2.3) // 4.8 -math.round(math.pi, 3) // 3.142 -math.sqrt(4.41e2) // 21 - -// use BigNumbers -math.add(math.bignumber(0.1), math.bignumber(0.2)) // BigNumber, 0.3 - -// use bigint -math.add(300000000000000000n, 1n) // 300000000000000001n - -// use Fractions -math.add(math.fraction(1), math.fraction(3)) // Fraction, 0.(3) - -// use strings containing numbers -math.add('2', '3') // 5 -math.concat('2', '3') // '23' -math.max('3', '2', '7') // 7 -math.compareNatural('10', '2') // 1 - -// use complex numbers -const a = math.complex(2, 3) // 2 + 3i -a.re // 2 -a.im // 3 -const b = math.complex('4 - 2i') // 4 - 2i -math.add(a, b) // 6 + i -math.sqrt(-4) // 2i - -// use arrays -const array = [1, 2, 3, 4, 5] -math.factorial(array) // Array, [1, 2, 6, 24, 120] -math.add(array, 3) // Array, [3, 5, 6, 7, 8] - -// use matrices -const matrix = math.matrix([1, 4, 9, 16, 25]) // Matrix, [1, 4, 9, 16, 25] -math.sqrt(matrix) // Matrix, [1, 2, 3, 4, 5] - -// use units -const a = math.unit(55, 'cm') // 550 mm -const b = math.unit('0.1m') // 100 mm -math.add(a, b) // 0.65 m - -// check the type of a variable -math.typeOf(2) // 'number' -math.typeOf(math.unit('2 inch')) // 'Unit' -math.typeOf(math.sqrt(-4)) // 'Complex' -``` diff --git a/docs/datatypes/matrices.md b/docs/datatypes/matrices.md deleted file mode 100644 index 9c14f88e14..0000000000 --- a/docs/datatypes/matrices.md +++ /dev/null @@ -1,501 +0,0 @@ ---- -layout: default ---- - -

Matrices #

- -Math.js supports multi dimensional matrices and arrays. Matrices can be -created, manipulated, and used in calculations. Both regular JavaScript -arrays as well as the matrix type implemented by math.js can be used -interchangeably in all relevant math.js functions. math.js supports both -dense and sparse matrices. - - -

Arrays and matrices #

- -Math.js supports two types of matrices: - -- `Array`, a regular JavaScript array. A multi dimensional array can be created - by nesting arrays. -- `Matrix`, a matrix implementation by math.js. A `Matrix` is an object wrapped - around a regular JavaScript `Array`, providing utility functions for easy - matrix manipulation such as `subset`, `size`, `resize`, `clone`, and more. - -In most cases, the type of matrix output from functions is determined by the -function input: An `Array` as input will return an `Array`, a `Matrix` as input -will return a `Matrix`. In case of mixed input, a `Matrix` is returned. -For functions where the type of output cannot be determined from the -input, the output is determined by the configuration option `matrix`, -which can be a string `'Matrix'` (default) or `'Array'`. - -```js -// create an array and a matrix -const array = [[2, 0], [-1, 3]] // Array -const matrix = math.matrix([[7, 1], [-2, 3]]) // Matrix - -// perform a calculation on an array and matrix -math.map(array, math.square) // Array, [[4, 0], [1, 9]] -math.map(matrix, math.square) // Matrix, [[49, 1], [4, 9]] - -// perform calculations with mixed array and matrix input -math.add(array, matrix) // Matrix, [[9, 1], [-3, 6]] -math.multiply(array, matrix) // Matrix, [[14, 2], [-13, 8]] - -// create a matrix. Type of output of function ones is determined by the -// configuration option `matrix` -math.ones(2, 3) // Matrix, [[1, 1, 1], [1, 1, 1]] -``` - - -

Creation #

- -A matrix can be created from an array using the function `math.matrix`. The -provided array can contain nested arrays in order to create a multi-dimensional matrix. When called without arguments, an empty matrix will be -created. - -```js -// create matrices -math.matrix() // Matrix, size [0] -math.matrix([0, 1, 2]) // Matrix, size [3] -math.matrix([[0, 1], [2, 3], [4, 5]]) // Matrix, size [3, 2] -``` - -Math.js supports regular Arrays. Multiple dimensions can be created -by nesting Arrays in each other. - -```js -// create arrays -[] // Array, size [0] -[0, 1, 2] // Array, size [3] -[[0, 1], [2, 3], [4, 5]] // Array, size [3, 2] -``` - -Matrices can contain different types of values: numbers, complex numbers, -units, or strings. Different types can be mixed together in a single matrix. - -```js -// create a matrix with mixed types -const a = math.matrix([2.3, 'hello', math.complex(3, -4), math.unit('5.2 mm')]) -a.subset(math.index(1)) // 'hello' -``` - - -There are a number of functions to create a matrix with a specific size and -content: `ones`, `zeros`, `identity`. - -```js -// zeros creates a matrix filled with zeros -math.zeros(3) // Matrix, size [3], [0, 0, 0] -math.zeros(3, 2) // Matrix, size [3, 2], [[0, 0], [0, 0], [0, 0]] -math.zeros(2, 2, 2) // Matrix, size [2, 2, 2], - // [[[0, 0], [0, 0]], [[0, 0], [0, 0]]] - -// ones creates a matrix filled with ones -math.ones(3) // Matrix, size [3], [1, 1, 1] -math.multiply(math.ones(2, 2), 5) // Matrix, size [2, 2], [[5, 5], [5, 5]] - -// identity creates an identity matrix -math.identity(3) // Matrix, size [3, 3], [[1, 0, 0], [0, 1, 0], [0, 0, 1]] -math.identity(2, 3) // Matrix, size [2, 3], [[1, 0, 0], [0, 1, 0]] -``` - - -The functions `ones`, `zeros`, and `identity` also accept a single array -or matrix containing the dimensions for the matrix. When the input is an Array, -the functions will output an Array. When the input is a Matrix, the output will -be a Matrix. Note that in case of numbers as arguments, the output is -determined by the option `matrix` as discussed in section -[Arrays and matrices](#arrays-and-matrices). - -```js -// Array as input gives Array as output -math.ones([2, 3]) // Array, size [3, 2], [[1, 1, 1], [1, 1, 1]] -math.ones(math.matrix([2, 3])) // Matrix, size [3, 2], [[1, 1, 1], [1, 1, 1]] -``` - -Ranges can be created using the function `range`. The function `range` is -called with parameters start and end, and optionally a parameter step. -The start of the range is included, the end of the range is excluded. - -```js -math.range(0, 4) // [0, 1, 2, 3] -math.range(0, 8, 2) // [0, 2, 4, 6] -math.range(3, -1, -1) // [3, 2, 1, 0] -``` - - -

Calculations #

- -Most functions of math.js support matrices and arrays. Unary functions can be applied element-wise using via `math.map(matrix, function)`. - -```js -// perform an element-wise operation on a matrix using math.map -const a = math.matrix([1, 4, 9, 16, 25]) // Matrix, [1, 4, 9, 16, 25] -math.map(a, math.sqrt) // Matrix, [1, 2, 3, 4, 5] - -// use a function that has built-in matrix and array support -const b = [1, 2, 3, 4, 5] -math.factorial(b) // Array, [1, 2, 6, 24, 120] - -// multiply an array with a matrix -const c = [[2, 0], [-1, 3]] // Array -const d = math.matrix([[7, 1], [-2, 3]]) // Matrix -math.multiply(c, d) // Matrix, [[14, 2], [-13, 8]] - -// add a number to a matrix (see broadcasting) -math.add(c, 2) // Array, [[4, 2], [1, 5]] - -// calculate the determinant of a matrix -math.det(c) // 6 -math.det(d) // 23 -``` -

Broadcasting #

- -Functions that require two or more matrix like arguments that operate elementwise automatically operate as if the arguments were the same size. - -```js -A = math.matrix([1, 2]) // Matrix, [1, 2] -math.add(A, 3) // Matrix, [3, 4] - -B = math.matrix([[3], [4]]) // Matrix, [[3], [4]] -math.add(A, B) // Matrix, [[4, 5], [5, 6]] -``` -Any index that is in one of the arguments, can be found as if it existed on the others when the size on that dimension is one or not existing. This is valid in N dimensions. - -It's not possible to broadcast in cases where the size in that dimension is higher than one. - -```js -math.add([1, 2], [3, 4, 5]) -// Error: shape missmatch: missmatch is found in arg with shape (2) not possible to broadcast dimension 0 with size 2 to size 3 - -math.add([[1], [2], [3]], [[4], [5]]) -// Error: shape missmatch: missmatch is found in arg with shape (2,1) not possible to broadcast dimension 0 with size 2 to size 3 -``` - -

Size and Dimensions #

- -Math.js uses geometric dimensions: - -- A scalar is zero-dimensional. -- A vector is one-dimensional. -- A matrix is two or multi-dimensional. - -The size of a matrix can be calculated with the function `size`. Function `size` -returns a `Matrix` or `Array`, depending on the configuration option `matrix`. -Furthermore, matrices have a function `size` as well, which always returns -an Array. - -```js -// get the size of a scalar -math.size(2.4) // Matrix, [] -math.size(math.complex(3, 2)) // Matrix, [] -math.size(math.unit('5.3 mm')) // Matrix, [] - -// get the size of a one-dimensional matrix (a vector) and a string -math.size([0, 1, 2, 3]) // Array, [4] -math.size('hello world') // Matrix, [11] - -// get the size of a two-dimensional matrix -const a = [[0, 1, 2, 3]] // Array -const b = math.matrix([[0, 1, 2], [3, 4, 5]]) // Matrix -math.size(a) // Array, [1, 4] -math.size(b) // Matrix, [2, 3] - -// matrices have a function size (always returns an Array) -b.size() // Array, [2, 3] - -// get the size of a multi-dimensional matrix -const c = [[[0, 1, 2], [3, 4, 5]], [[6, 7, 8], [9, 10, 11]]] -math.size(c) // Array, [2, 2, 3] -``` - -Note that the dimensions themselves do not have a meaning attached. -When creating and printing a two dimensional matrix, the first dimension is -normally rendered as the _column_, and the second dimension is rendered as -the _row_. For example: - -```js -console.table(math.zeros([2, 4])) -// 0 0 0 0 -// 0 0 0 0 -``` - -If you have a matrix where the first dimension means `x` and the second -means `y`, this will look confusing since `x` is printed as _column_ -(vertically) and `y` as _row_ (horizontally). - - -

Resizing #

- -Matrices can be resized using their `resize` function. This function is called -with an Array with the new size as the first argument, and accepts an optional -default value. By default, new entries will be set to `0`, but it is possible -to pass a different default value like `null` to clearly indicate that -the entries haven't been explicitly set. - -```js -const a = math.matrix() // Matrix, size [0], [] -a.resize([2, 3]) // Matrix, size [2, 3], [[0, 0, 0], [0, 0, 0]] -a.resize([2, 2, 2]) // Matrix, size [2, 2, 2], - // [[[0, 0], [0, 0]], [[0, 0], [0, 0]]] - -const b = math.matrix() -b.resize([3], 7) // Matrix, size [3], [7, 7, 7] -b.resize([5], 9) // Matrix, size [5], [7, 7, 7, 9, 9] -b.resize([2]) // Matrix, size [2], [7, 7] -``` - - -Outer dimensions of a matrix can be squeezed using the function `squeeze`. When -getting or setting a single value in a matrix using `subset`, the value is automatically squeezed -or unsqueezed too. - -```js -// squeeze a matrix -const a = [[[0, 1, 2]]] -math.squeeze(a) // [0, 1, 2] -math.squeeze([[3]]) // 3 - -// when getting/setting a single value in a matrix using subset, -// it automatically squeeze/unsqueeze the value -const b = math.matrix([[0, 1], [2, 3]]) -b.subset(math.index(1, 0)) // 2 and not [[2]] -``` - - -

Getting or replacing subsets #

- -Subsets of a matrix can be retrieved or replaced using the function `subset`. -Matrices have a `subset` function, which is applied to the matrix itself: -`Matrix.subset(index [, replacement])`. For both matrices and arrays, -the static function `subset(matrix, index [, replacement])` can be used. -When parameter `replacement` is provided, the function will replace a subset -in the matrix, and if not, a subset of the matrix will be returned. - -A subset can be defined using an `Index`. An `Index` contains a single value -or a set of values for each dimension of a matrix. An `Index` can be -created using the function `index`. When getting a single value from a matrix, -`subset` will return the value itself instead of a matrix containing just this -value. - -The function `subset` normally returns a subset, but when getting or setting a -single value in a matrix, the value itself is returned. - - -Matrix indexes in math.js are zero-based, like most programming languages -including JavaScript itself. Note that mathematical applications like Matlab -and Octave work differently, as they use one-based indexes. - -```js -// create some matrices -const a = [0, 1, 2, 3] -const b = [[0, 1], [2, 3]] -const c = math.zeros(2, 2) -const d = math.matrix([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) -const e = math.matrix() - -// get a subset -math.subset(a, math.index(1)) // 1 -math.subset(a, math.index([2, 3])) // Array, [2, 3] -math.subset(a, math.index(math.range(0,4))) // Array, [0, 1, 2, 3] -math.subset(b, math.index(1, 0)) // 2 -math.subset(b, math.index(1, [0, 1])) // Array, [2, 3] -math.subset(b, math.index([0, 1], 0)) // Matrix, [[0], [2]] - -// get a subset -d.subset(math.index([1, 2], [0, 1])) // Matrix, [[3, 4], [6, 7]] -d.subset(math.index(1, 2)) // 5 - -// replace a subset. The subset will be applied to a clone of the matrix -math.subset(b, math.index(1, 0), 9) // Array, [[0, 1], [9, 3]] -math.subset(b, math.index(2, [0, 1]), [4, 5]) // Array, [[0, 1], [2, 3], [4, 5]] - -// replace a subset. The subset will be applied to the matrix itself -c.subset(math.index(0, 1),1) // Matrix, [[0, 1], [0, 0]] -c.subset(math.index(1, [0, 1]), [2, 3]) // Matrix, [[0, 1], [2, 3]] -e.resize([2, 3], 0) // Matrix, [[0, 0, 0], [0, 0, 0]] -e.subset(math.index(1, 2), 5) // Matrix, [[0, 0, 0], [0, 0, 5]] -``` - -

Getting and setting a value in a matrix #

- -There are two methods available on matrices that allow to get or set a single -value inside a matrix. It is important to note that the `set` method will -mutate the matrix. - -```js -const p = math.matrix([[1, 2], [3, 4]]) -p.set([0, 1], 5) -// p is now [[1, 5], [3, 4]] -p.get([1, 0]) // 3 -``` - -When setting a value at a location outside of the current matrix size using the -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`. - -

Advanced Indexing #

- -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] -`) -``` - -

Iterating #

- -Matrices contain functions `map` and `forEach` to iterate over all elements of -the (multidimensional) matrix. The callback function of `map` and `forEach` has -three parameters: `value` (the value of the currently iterated element), -`index` (an array with the index value for each dimension), and `matrix` (the -matrix being iterated). This syntax is similar to the `map` and `forEach` -functions of native JavaScript Arrays, except that the index is no number but -an Array with numbers for each dimension. - -```js -const a = math.matrix([[0, 1], [2, 3], [4, 5]]) - -// The iteration below will output the following in the console: -// value: 0 index: [0, 0] -// value: 1 index: [0, 1] -// value: 2 index: [1, 0] -// value: 3 index: [1, 1] -// value: 4 index: [2, 0] -// value: 5 index: [2, 1] -a.forEach(function (value, index, matrix) { - console.log('value:', value, 'index:', index) -}) - -// Apply a transformation on the matrix -const b = a.map(function (value, index, matrix) { - return math.multiply(math.sin(value), math.exp(math.abs(value))) -}) -console.log(b.format(5)) // [[0, 2.2874], [6.7188, 2.8345], [-41.32, -142.32]] - -// Create a matrix with the cumulative of all elements -let count = 0 -const cum = a.map(function (value, index, matrix) { - count += value - return count -}) -console.log(cum.toString()) // [[0, 1], [3, 6], [10, 15]] -``` - -

Iterating over multiple Matrixes or Arrays #

- -You can iterate over multiple matrices or arrays by using the `map` function. Mapping allows to perform element-wise operations on matrices by automatically adjusting their sizes to match each other. - -To iterate over multiple matrices, you can use the `map` function. The `map` function applies a given function to each element of the matrices and returns a new matrix with the results. - -Here's an example of iterating over two matrices and adding their corresponding elements: - -```js -const a = math.matrix([[1, 2], [3, 4]]); -const b = math.matrix([[5, 6], [7, 8]]); - -const result = math.map(a, b, (x, y) => x + y); - -console.log(result); // [[6, 8], [10, 12]] -``` - -In this example, the `map` function takes matrices as the first two arguments and a callback function `(x, y) => x + y` as the third argument. The callback function is applied to each element of the matrices, where `x` represents the corresponding element from matrix `a` and `y` represents the corresponding element from matrix `b`. The result is a new matrix with the element-wise sum of the two matrices. - -By using broadcasting and the `map` function, you can easily iterate over multiple matrices and perform element-wise operations. - -```js -const a = math.matrix([10, 20]) -const b = math.matrix([[3, 4], [5, 6]]) - -const result = math.map(a, b, (x, y) => x + y) -console.log(result); // [[13, 24], [15, 26]] -``` - -It's also possible to provide a callback with an index and the broadcasted arrays. Like `(valueA, valueB, index)` or even `(valueA, valueB, index, broadcastedMatrixA, broadcastedMatrixB)`. There is no specific limit for the number of matrices `N` that can be mapped. Thus, the callback can have `N` arguments, `N+1` arguments in the case of including the index, or `2N+1` arguments in the case of including the index and the broadcasted matrices in the callback. - -At this moment `forEach` doesn't include the same functionality. - -

Storage types #

- -Math.js supports both dense matrices as well as sparse matrices. Sparse matrices are efficient for matrices largely containing zeros. In that case they save a lot of memory, and calculations can be much faster than for dense matrices. - -Math.js supports two type of matrices: - -- Dense matrix (`'dense'`, `default`) A regular, dense matrix, supporting multi-dimensional matrices. This is the default matrix type. -- Sparse matrix (`'sparse'`): A two dimensional sparse matrix implementation. - -The type of matrix can be selected when creating a matrix using the construction functions `matrix`, `diag`, `identity`, `ones`, and `zeros`. - -```js -// create sparse matrices -const m1 = math.matrix([[0, 1], [0, 0]], 'sparse') -const m2 = math.identity(1000, 1000, 'sparse') -``` - -You can also coerce an array or matrix into sparse storage format with the -`sparse` function. -```js -const md = math.matrix([[0, 1], [0,0]]) // dense -const ms = math.sparse(md) // sparse -``` - -Caution: `sparse` called on a JavaScript array of _n_ plain numbers produces -a matrix with one column and _n_ rows -- in contrast to `matrix`, which -produces a 1-dimensional matrix object with _n_ entries, i.e., a vector -(_not_ a 1 by _n_ "row vector" nor an _n_ by 1 "column vector", but just a plain -vector of length _n_). -```js -const mv = math.matrix([0, 0, 1]) // Has size [3] -const mc = math.sparse([0, 0, 1]) // A "column vector," has size [3, 1] -``` - -

API #

- -All relevant functions in math.js support Matrices and Arrays. Functions like `math.add` and `math.subtract`, `math.sqrt` handle matrices element wise. There is a set of functions specifically for creating or manipulating matrices, such as: - -- Functions like `math.matrix` and `math.sparse`, `math.ones`, `math.zeros`, and `math.identity` to create a matrix. -- Functions like `math.subset` and `math.index` to get or replace a part of a matrix -- Functions like `math.transpose` and `math.diag` to manipulate matrices. - -A full list of matrix functions is available on the [functions reference page](../reference/functions.html#matrix-functions). - -Two types of matrix classes are available in math.js, for storage of dense and sparse matrices. Although they contain public functions documented as follows, using the following API directly is *not* recommended. Prefer using the functions in the "math" namespace wherever possible. - -- [DenseMatrix](../reference/classes/densematrix.html) -- [SparseMatrix](../reference/classes/sparsematrix.html) diff --git a/docs/datatypes/numbers.md b/docs/datatypes/numbers.md deleted file mode 100644 index cb583bb4b3..0000000000 --- a/docs/datatypes/numbers.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -layout: default ---- - -

Numbers #

- -Math.js supports three types of numbers: - -- Number for fast floating point arithmetic, described on this page. -- BigNumber for arbitrary precision arithmetic, described on the page - [BigNumbers](bignumbers.html). -- Fraction, which stores numbers in terms of a numerator and denominators, - described on the page [Fractions](fractions.html). - - -

Configuration #

- -Most functions can determine the type of output from the type of input: -a number as input will return a number as output, a BigNumber as input returns -a BigNumber as output. Functions which cannot determine the type of output -from the input (for example `math.evaluate`) use the default number type, which -can be configured when instantiating math.js: - -```js -math.config({ - number: 'number' // Default type of number: - // 'number' (default), 'BigNumber', or 'Fraction' -}) -``` - -

Round-off errors #

- -Math.js uses the built-in JavaScript Number type. A Number is a floating point -number with a limited precision of 64 bits, about 16 digits. The largest integer -number which can be represented by a JavaScript Number -is `+/- 9007199254740992` (`+/- 2^53`). Because of the limited precision of -floating point numbers round-off errors can occur during calculations. -This can be easily demonstrated: - -```js -// a round-off error -0.1 + 0.2 // 0.30000000000000004 -math.add(0.1, 0.2) // 0.30000000000000004 -``` - -In most cases, round-off errors don't matter: they have no significant -impact on the results. However, it looks ugly when displaying output to a user. -A solution is to limit the precision just below the actual precision of 16 -digits in the displayed output: - -```js -// prevent round-off errors showing up in output -const ans = math.add(0.1, 0.2) // 0.30000000000000004 -math.format(ans, {precision: 14}) // '0.3' -``` - -Alternatives are to use [Fractions](fractions.html) which store a number as a numerator and denominator, [BigNumbers](bignumbers.html) which store a number with a higher precision, or [bigint](bigints.html) which can store larger integer numbers. - - -

Minimum and maximum #

- -A Number can store values between `5e-324` and `1.7976931348623157e+308`. -Values smaller than the minimum are stored as `0`, and values larger than the -maximum are stored as `+/- Infinity`. - -```js -// exceeding the maximum and minimum number -console.log(1e309) // Infinity -console.log(1e-324) // 0 -``` - -

Equality #

- -Because of rounding errors in calculations, it is unsafe to compare JavaScript -Numbers. For example executing `0.1 + 0.2 == 0.3` in JavaScript will return -false, as the addition `0.1 + 0.2` introduces a round-off error and does not -return exactly `0.3`. - -To solve this problem, the relational functions of math.js check whether the -relative and absolute differences between the compared values is smaller than the configured -option `relTol` and `absTol`. In pseudo code (without exceptions for 0, Infinity and NaN): - - abs(a-b) <= max(relTol * max(abs(a), abs(b)), absTol) - -where: - - - `relTol` is the relative tolerance between x and y and `absTol` the absolute tolerance. Relative tolerance and absolute tolerance are configurable and are `1e-12` and `1e-15` respectively by default. See [Configuration](../core/configuration.html). - - `DBL_EPSILON` is the minimum positive floating point number such that - `1.0 + DBL_EPSILON !== 1.0`. This is a constant with a value of approximately - `2.2204460492503130808472633361816e-16`. - -Note that the relational functions cannot be used to compare small values -(`< 2.22e-16`). These values are all considered equal to zero. - -Examples: - -```js -// compare values having a round-off error -console.log(0.1 + 0.2 === 0.3) // false -console.log(math.equal(0.1 + 0.2, 0.3)) // true - -// small values (< 2.22e-16) cannot be compared -console.log(3e-20 === 3.1e-20) // false -console.log(math.equal(3e-20, 3.1e-20)) // true -``` - -The available relational functions are: `compare`, `equal`, `larger`, -`largerEq`, `smaller`, `smallerEq`, `unequal`. diff --git a/docs/datatypes/units.md b/docs/datatypes/units.md deleted file mode 100644 index f6a8a0b6e1..0000000000 --- a/docs/datatypes/units.md +++ /dev/null @@ -1,489 +0,0 @@ ---- -layout: default ---- - -

Units #

- -Math.js supports units. Units can be used to do calculations and to perform -conversions. - -

Usage #

- -Units can be created using the function `math.unit`. This function accepts -either a single string argument containing a value and unit, or two arguments, -the first being a numeric value and the second a string containing a unit. -Most units support prefixes like `k` or `kilo`, and many units have both a -full name and an abbreviation. The returned object is a `Unit`. - -Syntax: - -```js -math.unit(value: number, valuelessUnit: string) : Unit -math.unit(value: number, valuelessUnit: Unit) : Unit -math.unit(unit: string) : Unit -math.unit(unit: Unit) : Unit -``` - -Example usage: - -```js -const a = math.unit(45, 'cm') // Unit 450 mm -const b = math.unit('0.1 kilogram') // Unit 100 gram -const c = math.unit('2 inch') // Unit 2 inch -const d = math.unit('90 km/h') // Unit 90 km/h -const e = math.unit('101325 kg/(m s^2)') // Unit 101325 kg / (m s^2) - -const f = c.to('cm') // Unit 5.08 cm -b.toNumber('gram') // Number 100 -math.number(b, 'gram') // Number 100 - -c.equals(a) // false -c.equals(f) // true -c.equalBase(a) // true -c.equalBase(b) // false - -f.toString() // String "5.08 cm" - -const kph = math.unit('km/h') // valueless Unit km/h -const mps = math.unit('m/s') // valueless Unit m/s -const speed = math.unit(36, kph) // Unit 36 km/h -speed.toNumber(mps) // Number 10 -``` - -Use care when creating a unit with multiple terms in the denominator. Implicit multiplication has the same operator precedence as explicit multiplication and division, which means these three expressions are identical: - -```js -// These three are identical -const correct1 = math.unit('8.314 m^3 Pa / mol / K') // Unit 8.314 (m^3 Pa) / (mol K) -const correct2 = math.unit('8.314 (m^3 Pa) / (mol K)') // Unit 8.314 (m^3 Pa) / (mol K) -const correct3 = math.unit('8.314 (m^3 * Pa) / (mol * K)') // Unit 8.314 (m^3 Pa) / (mol K) -``` -But this expression, which omits the second `/` between `mol` and `K`, results in the wrong value: - -```js -// Missing the second '/' between 'mol' and 'K' -const incorrect = math.unit('8.314 m^3 Pa / mol K') // Unit 8.314 (m^3 Pa K) / mol -``` - -The function `math.unit` has its own small parser. This parser differs a bit from the expression parser `math.evaluate`, and returns the expected result in this case: - -```js -// using math.evaluate instead of math.unit -const correct4 = math.evaluate('8.314 (m^3 * Pa) / (mol * K)') // Unit 8.314 (m^3 Pa) / (mol K) -``` - -In summary: be careful with implicit multiplication. In case of doubt, always use an explicit `*` and parenthesis. - - -

Calculations #

- -The operations that support units are `add`, `subtract`, `multiply`, `divide`, `pow`, `abs`, `sqrt`, `square`, `cube`, and `sign`. -Trigonometric functions like `cos` are also supported when the argument is an angle. - -```js -const a = math.unit(45, 'cm') // Unit 450 mm -const b = math.unit('0.1m') // Unit 100 mm -math.add(a, b) // Unit 0.55 m -math.multiply(b, 2) // Unit 200 mm - -const c = math.unit(45, 'deg') // Unit 45 deg -math.cos(c) // Number 0.7071067811865476 - -// Kinetic energy of average sedan on highway -const d = math.unit('80 mi/h') // Unit 80 mi/h -const e = math.unit('2 tonne') // Unit 2 tonne -const f = math.multiply(0.5, math.multipy(math.pow(d, 2), e)) - // 1.2790064742399996 MJ -``` - -Operations with arrays are supported too: - -```js -// Force on a charged particle moving through a magnetic field -const B = math.evaluate('[1, 0, 0] T') // [1 T, 0 T, 0 T] -const v = math.evaluate('[0, 1, 0] m/s') // [0 m / s, 1 m / s, 0 m / s] -const q = math.evaluate('1 C') // 1 C - -const F = math.multiply(q, math.cross(v, B)) // [0 N, 0 N, -1 N] -``` - -All arithmetic operators act on the value of the unit as it is represented in SI units. -This may lead to surprising behavior when working with temperature scales like `celsius` (or `degC`) and `fahrenheit` (or `degF`). -In general, you should avoid calculations using `celsius` and `fahrenheit`. Rather, use `kelvin` (or `K`) and `rankine` (or `degR`) instead. -This example highlights some problems when using `celsius` and `fahrenheit` in calculations: - -```js -const T_14F = math.unit('14 degF') // Unit 14 degF (263.15 K) -const T_28F = math.multiply(T_14F, 2) // Unit 28 degF (270.93 K), not 526.3 K - -const Tnegative = math.unit(-13, 'degF') // Unit -13 degF (248.15 K) -const Tpositive = math.abs(Tnegative) // Unit -13 degF (248.15 K), not 13 degF -``` - -The expression parser supports units too. This is described in the section about -units on the page [Syntax](../expressions/syntax.html#units). - -

User-Defined Units #

- -You can add your own units to Math.js using the `math.createUnit` function. The following example defines a new unit `furlong`, then uses the user-defined unit in a calculation: - -```js -math.createUnit('furlong', '220 yards') -math.evaluate('1 mile to furlong') // 8 furlong -``` - -If you cannot express the new unit in terms of any existing unit, then the second argument can be omitted. In this case, a new *base unit* is created: - -```js -// A 'foo' cannot be expressed in terms of any other unit. -math.createUnit('foo') -math.evaluate('8 foo * 4 feet') // 32 foo feet -``` - -The second argument to `createUnit` can also be a configuration object consisting of the following properties: - -* **definition** A `string` or `Unit` which defines the user-defined unit in terms of existing built-in or user-defined units. If omitted, a new base unit is created. -* **prefixes** A `string` indicating which prefixes math.js should use with the new unit. Possible values are `'none'`, `'short'`, `'long'`, `'binary_short'`, or `'binary_long'`. Default is `'none'`. -* **offset** A value applied when converting to the unit. This is very helpful for temperature scales that do not share a zero with the absolute temperature scale. For example, if we were defining fahrenheit for the first time, we would use: `math.createUnit('fahrenheit', {definition: '0.555556 kelvin', offset: 459.67})` -* **aliases** An array of strings to alias the new unit. Example: `math.createUnit('knot', {definition: '0.514444 m/s', aliases: ['knots', 'kt', 'kts']})` -* **baseName** A `string` that specifies the name of the new dimension in case one needs to be created. Every unit in math.js has a dimension: length, time, velocity, etc. If the unit's `definition` doesn't match any existing dimension, or it is a new base unit, then `createUnit` will create a new dimension with the name `baseName` and assign it to the new unit. The default is to append `'_STUFF'` to the unit's name. If the unit already matches an existing dimension, this option has no effect. - -An optional `options` object can also be supplied as the last argument to `createUnits`. Currently only the `override` option is supported: - -```js -// Redefine the mile (would not be the first time in history) -math.createUnit('mile', '1609.347218694 m', {override: true}) -``` -Base units created without specifying a definition cannot be overridden. - -

Create several units at once #

-Multiple units can defined using a single call to `createUnit` by passing an object map as the first argument, where each key in the object is the name of a new unit and the value is either a string defining the unit, or an object with the configuration properties listed above. If the value is an empty string or an object lacking a definition property, a new base unit is created. - -For example: - -```js -math.createUnit( { - foo: { - prefixes: 'long', - baseName: 'essence-of-foo' - }, - bar: '40 foo', - baz: { - definition: '1 bar/hour', - prefixes: 'long' - } -}, -{ - override: true -}) -math.evaluate('50000 kilofoo/s') // 4.5 gigabaz -``` - -

Return Value #

-`createUnit` returns the created unit, or, when multiple units are created, the last unit created. Since `createUnit` is also compatible with the expression parser, this allows you to do things like this: - -```js -math.evaluate('45 mile/hour to createUnit("knot", "0.514444m/s")') -// 39.103964668651976 knot -``` - -

Support of custom characters in unit names #

-Per default, the name of a new unit: -- should start by a latin (A-Z or a-z) character -- should contain only numeric (0-9) or latin characters - -It is possible to allow the usage of special characters (such as Greek alphabet, cyrillic alphabet, any Unicode symbols, etc.) by overriding the `Unit.isValidAlpha` static method. For example: -```js -const isAlphaOriginal = math.Unit.isValidAlpha -const isGreekLowercaseChar = function (c) { - const charCode = c.charCodeAt(0) - return charCode > 944 && charCode < 970 -} -math.Unit.isValidAlpha = function (c) { - return isAlphaOriginal(c) || isGreekLowercaseChar(c) -} - -math.createUnit('θ', '1 rad') -math.evaluate('1θ + 3 deg').toNumber('deg') // 60.29577951308232 -``` - -

Numeric type of the value of a unit #

- -The built-in units are always created with a value being a `number`. To turn the value into for example a `BigNumber` or `Fraction`, you can convert the value using the function `math.fraction` and `math.bignumber`: - -```js -math.unit(math.fraction(10), 'inch').toNumeric('cm') // Fraction 127/5 -math.fraction(math.unit(10, 'inch')).toNumeric('cm') // Fraction 127/5 - -math.bignumber(math.unit(10, 'inch')).toNumeric('cm') // BigNumber 25.4 -math.unit(math.bignumber(10), 'inch').toNumeric('cm') // BigNumber 25.4 -``` - -When using the expression parser, it is possible to configure numeric values to be parsed as `Fraction` or `BigNumber`: - -```js -math.config({ number: 'Fraction' }) -math.evaluate('10 inch').toNumeric('cm') // Fraction 127/5 -``` - - -

API #

-A `Unit` object contains the following functions: - -

unit.clone() #

-Clone the unit, returns a new unit with the same parameters. - -

unit.equalBase(unit) #

-Test whether a unit has the same base as an other unit: -length, mass, etc. - -

unit.equals(unit) #

-Test whether a unit equals an other unit. Units are equal -when they have the same base and same value when normalized to SI units. - -

unit.format([options]) #

-Get a string representation of the unit. The function -will determine the best fitting prefix for the unit. See the [Format](../reference/functions/format.html) -page for available options. - -

unit.fromJSON(json) #

-Revive a unit from a JSON object. Accepts -An object `{mathjs: 'Unit', value: number, unit: string, fixPrefix: boolean}`, -where the property `mathjs` and `fixPrefix` are optional. -Used when deserializing a unit, see [Serialization](../core/serialization.html). - -

unit.splitUnit(parts) #

-Split a unit into the specified parts. For example: - -```js -const u = math.unit(1, 'm') -u.splitUnit(['ft', 'in']) // 3 feet,3.3700787401574765 inch -``` - -

unit.to(unitName) #

-Convert the unit to a specific unit name. Returns a clone of -the unit with a fixed prefix and unit. - -

unit.toJSON() #

-Returns a JSON representation of the unit, with signature -`{mathjs: 'Unit', value: number, unit: string, fixPrefix: boolean}`. -Used when serializing a unit, see [Serialization](../core/serialization.html). - -

unit.toNumber(unitName) #

-Get the value of a unit when converted to the -specified unit (a unit with optional prefix but without value). -The type of the returned value is always `number`. - -

unit.toNumeric(unitName) #

-Get the value of a unit when converted to the -specified unit (a unit with optional prefix but without value). -The type of the returned value depends on how the unit was created and -can be `number`, `Fraction`, or `BigNumber`. - -

unit.toSI() #

-Returns a clone of a unit represented in SI units. Works with units with or without a value. - -

unit.toString() #

-Get a string representation of the unit. The function will -determine the best fitting prefix for the unit. - -

unit.valType() #

-Get the string name of the current type of the value of this Unit object, e.g. -'number', 'BigNumber', etc. - -

Unit reference #

- -This section lists all available units, prefixes, and physical constants. These can be used via the Unit object, or via `math.evaluate()`. - -

Reference #

- -Math.js comes with the following built-in units. - -Base | Unit -------------------- | --- -Length | meter (m), inch (in), foot (ft), yard (yd), mile (mi), link (li), rod (rd), chain (ch), angstrom, mil -Surface area | m2, sqin, sqft, sqyd, sqmi, sqrd, sqch, sqmil, acre, hectare -Volume | m3, litre (l, L, lt, liter), cc, cuin, cuft, cuyd, teaspoon, tablespoon -Liquid volume | minim, fluiddram (fldr), fluidounce (floz), gill (gi), cup (cp), pint (pt), quart (qt), gallon (gal), beerbarrel (bbl), oilbarrel (obl), hogshead, drop (gtt) -Angles | rad (radian), deg (degree), grad (gradian), cycle, arcsec (arcsecond), arcmin (arcminute) -Time | second (s, secs, seconds), minute (min, mins, minutes), hour (h, hr, hrs, hours), day (days), week (weeks), month (months), year (years), decade (decades), century (centuries), millennium (millennia) -Frequency | hertz (Hz) -Mass | gram(g), tonne, ton, grain (gr), dram (dr), ounce (oz), poundmass (lbm, lb, lbs), hundredweight (cwt), stick, stone -Electric current | ampere (A) -Temperature | kelvin (K), celsius (degC), fahrenheit (degF), rankine (degR) -Amount of substance | mole (mol) -Luminous intensity | candela (cd) -Force | newton (N), dyne (dyn), poundforce (lbf), kip -Energy | joule (J), erg, Wh, BTU, electronvolt (eV) -Power | watt (W), hp -Pressure | Pa, psi, atm, torr, bar, mmHg, mmH2O, cmH2O -Electricity and magnetism | ampere (A), coulomb (C), watt (W), volt (V), ohm, farad (F), weber (Wb), tesla (T), henry (H), siemens (S), electronvolt (eV) -Binary | bits (b), bytes (B) - -Note: all time units are based on the Julian year, with one month being 1/12th of a Julian year, a year being one Julian year, a decade being 10 Julian years, a century being 100, and a millennium being 1000. - -Note that all relevant units can also be written in plural form, for example `5 meters` instead of `5 meter` or `10 seconds` instead of `10 second`. - -Surface and volume units can alternatively be expressed in terms of length units raised to a power, for example `100 in^2` instead of `100 sqin`. - -

Prefixes #

- -The following decimal prefixes are available. - -Name | Abbreviation | Value -------- | ------------- | ----- -deca | da | 1e1 -hecto | h | 1e2 -kilo | k | 1e3 -mega | M | 1e6 -giga | G | 1e9 -tera | T | 1e12 -peta | P | 1e15 -exa | E | 1e18 -zetta | Z | 1e21 -yotta | Y | 1e24 -ronna | R | 1e27 -quetta | Q | 1e30 - -Name | Abbreviation | Value ------- | ------------- | ----- -deci | d | 1e-1 -centi | c | 1e-2 -milli | m | 1e-3 -micro | u | 1e-6 -nano | n | 1e-9 -pico | p | 1e-12 -femto | f | 1e-15 -atto | a | 1e-18 -zepto | z | 1e-21 -yocto | y | 1e-24 -ronto | r | 1e-27 -quecto | q | 1e-30 - -The following binary prefixes are available. -They can be used with units `bits` (`b`) and `bytes` (`B`). - -Name | Abbreviation | Value ----- | ------------ | ----- -kibi | Ki | 1024 -mebi | Mi | 1024^2 -gibi | Gi | 1024^3 -tebi | Ti | 1024^4 -pebi | Pi | 1024^5 -exi | Ei | 1024^6 -zebi | Zi | 1024^7 -yobi | Yi | 1024^8 - -Name | Abbreviation | Value ------ | ------------ | ----- -kilo | k | 1e3 -mega | M | 1e6 -giga | G | 1e9 -tera | T | 1e12 -peta | P | 1e15 -exa | E | 1e18 -zetta | Z | 1e21 -yotta | Y | 1e24 - - -

Physical Constants #

- -Math.js includes the following physical constants. See [Wikipedia](https://en.wikipedia.org/wiki/Physical_constants) for more information. - - -

Universal constants #

- -Name | Symbol | Value | Unit -----------------------|--------------------------------------------------------|-------------------|------------------------------------------------------- -speedOfLight | c | 299792458 | m · s-1 -gravitationConstant | G | 6.6738480e-11 | m3 · kg-1 · s-2 -planckConstant | h | 6.626069311e-34 | J · s -reducedPlanckConstant | h | 1.05457172647e-34 | J · s - - -

Electromagnetic constants #

- -Name | Symbol | Value | Unit ---------------------------|--------------------------------------------------|-----------------------|---------------------------------------- -magneticConstant | μ0 | 1.2566370614e-6 | N · A-2 -electricConstant | ε0 | 8.854187817e-12 | F · m-1 -vacuumImpedance | Z0 | 376.730313461 | Ω -coulomb | κ | 8.9875517873681764e9 | N · m2 · C-2 -elementaryCharge | e | 1.60217656535e-19 | C -bohrMagneton | μB | 9.2740096820e-24 | J · T-1 -conductanceQuantum | G0 | 7.748091734625e-5 | S -inverseConductanceQuantum | G0-1 | 12906.403721742 | Ω -magneticFluxQuantum | f0 | 2.06783375846e-15 | Wb -nuclearMagneton | μN | 5.0507835311e-27 | J · T-1 -klitzing | RK | 25812.807443484 | Ω - - - - -

Atomic and nuclear constants #

- -Name | Symbol | Value | Unit -------------------------|------------------------------|-----------------------|---------------------------------- -bohrRadius | a0 | 5.291772109217e-11 | m -classicalElectronRadius | re | 2.817940326727e-15 | m -electronMass | me | 9.1093829140e-31 | kg -fermiCoupling | GF | 1.1663645e-5 | GeV-2 -fineStructure | α | 7.297352569824e-3 | - -hartreeEnergy | Eh | 4.3597443419e-18 | J -protonMass | mp | 1.67262177774e-27 | kg -deuteronMass | md | 3.3435830926e-27 | kg -neutronMass | mn | 1.6749271613e-27 | kg -quantumOfCirculation | h / (2me) | 3.636947552024e-4 | m2 · s-1 -rydberg | R | 10973731.56853955 | m-1 -thomsonCrossSection | | 6.65245873413e-29 | m2 -weakMixingAngle | | 0.222321 | - -efimovFactor | | 22.7 | - - - -

Physico-chemical constants #

- -Name | Symbol | Value | Unit ---------------------|------------------------------|---------------------|-------------------------------------------- -atomicMass | mu | 1.66053892173e-27 | kg -avogadro | NA | 6.0221412927e23 | mol-1 -boltzmann | k | 1.380648813e-23 | J · K-1 -faraday | F | 96485.336521 | C · mol-1 -firstRadiation | c1 | 3.7417715317e-16 | W · m2 -loschmidt | n0 | 2.686780524e25 | m-3 -gasConstant | R | 8.314462175 | J · K-1 · mol-1 -molarPlanckConstant | NA · h| 3.990312717628e-10| J · s · mol-1 -molarVolume | Vm | 2.241396820e-10 | m3 · mol-1 -sackurTetrode | | -1.164870823 | - -secondRadiation | c2 | 1.438777013e-2 | m · K -stefanBoltzmann | σ | 5.67037321e-8 | W · m-2 · K-4 -wienDisplacement | b | 2.897772126e-3 | m · K - - - -Note that the values of `loschmidt` and `molarVolume` are at `T = 273.15 K` and `p = 101.325 kPa`. -The value of `sackurTetrode` is at `T = 1 K` and `p = 101.325 kPa`. - - -

Adopted values #

- -Name | Symbol | Value | Unit ---------------|------------------------------|---------|------------------------- -molarMass | Mu | 1e-3 | kg · mol-1 -molarMassC12 | M(12C) | 1.2e-2 | kg · mol-1 -gravity | gn | 9.80665 | m · s-2 -atm | atm | 101325 | Pa - - -

Natural units #

- -Name | Symbol | Value | Unit -------------------|-----------------------|--------------------|----- -planckLength | lP | 1.61619997e-35 | m -planckMass | mP | 2.1765113e-8 | kg -planckTime | tP | 5.3910632e-44 | s -planckCharge | qP | 1.87554595641e-18 | C -planckTemperature | TP | 1.41683385e+32 | K diff --git a/docs/expressions/algebra.md b/docs/expressions/algebra.md deleted file mode 100644 index 0760e89215..0000000000 --- a/docs/expressions/algebra.md +++ /dev/null @@ -1,120 +0,0 @@ ---- -layout: default ---- - -

Algebra (symbolic computation) #

- -math.js has built-in support for symbolic computation ([CAS](https://www.wikiwand.com/en/Computer_algebra_system)). It can parse expressions into an expression tree and do algebraic operations like simplification and derivation on the tree. - -> It's worth mentioning an excellent extension on math.js here: [mathsteps](https://github.com/socraticorg/mathsteps), a step-by-step math solver library that is focused on pedagogy (how best to teach). The math problems it focuses on are pre-algebra and algebra problems involving simplifying expressions. - - -

Simplify #

- -The function [`math.simplify`](../reference/functions/simplify.html) simplifies an expression tree: - -```js -// simplify an expression -console.log(math.simplify('3 + 2 / 4').toString()) // '7 / 2' -console.log(math.simplify('2x + 3x').toString()) // '5 * x' -console.log(math.simplify('x^2 + x + 3 + x^2').toString()) // '2 * x ^ 2 + x + 3' -console.log(math.simplify('x * y * -x / (x ^ 2)').toString()) // '-y' -``` - -The function accepts either a string or an expression tree (`Node`) as input, and outputs a simplified expression tree (`Node`). This node tree can be transformed and evaluated as described in detail on the page [Expression trees](expression_trees.html). - -```js -// work with an expression tree, evaluate results -const f = math.parse('2x + x') -const simplified = math.simplify(f) -console.log(simplified.toString()) // '3 * x' -console.log(simplified.evaluate({x: 4})) // 12 -``` - -Among its other actions, calling `simplify()` on an expression will convert -any functions that have operator equivalents to their operator form: -```js -console.log(math.simplify('multiply(x,3)').toString) // '3 * x' -``` - -Note that `simplify` has an optional argument `scope` that allows the definitions of variables in the expression (as numeric values, or as further expressions) to be specified and used in the simplification, e.g. continuing the previous example, - -```js -console.log(math.simplify(f, {x: 4}).toString()) // 12 -console.log(math.simplify(f, {x: math.parse('y+z')}).toString()) // '3*(y+z)' -``` - -In general, simplification is an inherently dfficult problem; in fact, for certain classes of expressions and algebraic equivalences, it is undecidable whether a given expression is equivalent to zero. Moreover, simplification generally depends on the properties of the operations involved; since multiplication (for example) may have different properties (e.g., it might or might not be commutative) depending on the domain under consideration, different simplifications might be appropriate. - -As a result, `simplify()` has an additional optional argument, `options`, which controls its behavior. This argument is an object specifying any of various properties concerning the simplification process. See the [detailed documentation](../reference/functions/simplify.html) for a complete list, but currently the two most important properties are as follows. Note that the `options` argument may only be specified if the `scope` is as well. - -- `exactFractions` - a boolean which specifies whether non-integer numerical constants should be simplified to rational numbers when possible (true), or always converted to decimal notation (false). -- `context` - an object whose keys are the names of operations ('add', 'multiply', etc.) and whose values specify algebraic properties of the corresponding operation (currently any of 'total', 'trivial', 'commutative', and 'associative'). Simplifications will only be performed if the properties they rely on are true in the given context. For example, -```js -const expr = math.parse('x*y-y*x') -console.log(math.simplify(expr).toString()) // 0; * is commutative by default -console.log(math.simplify(expr, {}, {context: {multiply: {commutative: false}}})) - // 'x*y-y*x'; the order of the right multiplication can't be reversed. -``` - -Note that the default context is very permissive (allows a lot of simplifications) but that there is also a `math.simplify.realContext` that only allows simplifications that are guaranteed to preserve the value of the expression on all real numbers: -```js -const rational = math.parse('(x-1)*x/(x-1)') -console.log(math.simplify(expr, {}, {context: math.simplify.realContext}) - // '(x-1)*x/(x-1)'; canceling the 'x-1' makes the expression defined at 1 -``` - -For more details on the theory of expression simplification, see: - -- [Strategies for simplifying math expressions (Stackoverflow)](https://stackoverflow.com/questions/7540227/strategies-for-simplifying-math-expressions) -- [Symbolic computation - Simplification (Wikipedia)](https://en.wikipedia.org/wiki/Symbolic_computation#Simplification) - - -

Derivative #

- -The function [`math.derivative`](../reference/functions/derivative.html) finds the symbolic derivative of an expression: - -```js -// calculate a derivative -console.log(math.derivative('2x^2 + 3x + 4', 'x').toString()) // '4 * x + 3' -console.log(math.derivative('sin(2x)', 'x').toString()) // '2 * cos(2 * x)' -``` - -Similar to the function `math.simplify`, `math.derivative` accepts either a string or an expression tree (`Node`) as input, and outputs a simplified expression tree (`Node`). - -```js -// work with an expression tree, evaluate results -const h = math.parse('x^2 + x') -const x = math.parse('x') -const dh = math.derivative(h, x) -console.log(dh.toString()) // '2 * x + 1' -console.log(dh.evaluate({x: 3})) // '7' -``` - -The rules used by `math.derivative` can be found on Wikipedia: - -- [Differentiation rules (Wikipedia)](https://en.wikipedia.org/wiki/Differentiation_rules) - - -

Rationalize #

- -The function [`math.rationalize`](../reference/functions/rationalize.html) transforms 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. - -```js - -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+x+x+y',{y:1}) // 3*x+1 -math.rationalize('x+x+x+y',{}) // 3*x+y - -const ret = math.rationalize('x+x+x+y',{},true) - // ret.expression=3*x+y, ret.variables = ["x","y"] -const ret = math.rationalize('-2+5x^2',{},true) - // ret.expression=5*x^2-2, ret.variables = ["x"], ret.coefficients=[-2,0,5] -``` diff --git a/docs/expressions/customization.md b/docs/expressions/customization.md deleted file mode 100644 index 82f3ecf5a3..0000000000 --- a/docs/expressions/customization.md +++ /dev/null @@ -1,387 +0,0 @@ ---- -layout: default ---- - -

Customization #

- -Besides parsing and evaluating expressions, the expression parser supports -a number of features to customize processing and evaluation of expressions -and outputting expressions. - -On this page: - -- [Function transforms](#function-transforms) -- [Custom argument parsing](#custom-argument-parsing) -- [Custom LaTeX handlers](#custom-latex-handlers) -- [Custom HTML, LaTeX and string output](#custom-html-latex-and-string-output) -- [Customize supported characters](#customize-supported-characters) - -

Function transforms #

- -It is possible to preprocess function arguments and post process a functions -return value by writing a *transform* for the function. A transform is a -function wrapping around a function to be transformed or completely replaces -a function. - -For example, the functions for math.js use zero-based matrix indices (as is -common in programing languages), but the expression parser uses one-based -indices. To enable this, all functions dealing with indices have a transform, -which changes input from one-based to zero-based, and transforms output (and -error message) from zero-based to one-based. - -```js -// using plain JavaScript, indices are zero-based: -const a = [[1, 2], [3, 4]] // a 2x2 matrix -math.subset(a, math.index(0, 1)) // returns 2 - -// using the expression parser, indices are transformed to one-based: -const a = [[1, 2], [3, 4]] // a 2x2 matrix -let scope = { - a: a -} -math.evaluate('subset(a, index(1, 2))', scope) // returns 2 -``` - -To create a transform for a function, the transform function must be attached -to the function as property `transform`: - -```js -import { create, all } from 'mathjs' -const math = create(all) - -// create a function -function addIt(a, b) { - return a + b -} - -// attach a transform function to the function addIt -addIt.transform = function (a, b) { - console.log('input: a=' + a + ', b=' + b) - // we can manipulate input here before executing addIt - - const res = addIt(a, b) - - console.log('result: ' + res) - // we can manipulate result here before returning - - return res -} - -// import the function into math.js -math.import({ - addIt: addIt -}) - -// use the function via the expression parser -console.log('Using expression parser:') -console.log('2+4=' + math.evaluate('addIt(2, 4)')) -// This will output: -// -// input: a=2, b=4 -// result: 6 -// 2+4=6 - -// when used via plain JavaScript, the transform is not invoked -console.log('') -console.log('Using plain JavaScript:') -console.log('2+4=' + math.addIt(2, 4)) -// This will output: -// -// 6 -``` - -Functions with a transform must be imported in the `math` namespace, as they -need to be processed at compile time. They are not supported when passed via a -scope at evaluation time. - - -

Custom argument parsing #

- -The expression parser of math.js has support for letting functions -parse and evaluate arguments themselves, instead of calling them with -evaluated arguments. This is useful for example when creating a function -like `plot(f(x), x)` or `integrate(f(x), x, start, end)`, where some of the -arguments need to be processed in a special way. In these cases, the expression -`f(x)` will be evaluated repeatedly by the function, and `x` is not evaluated -but used to specify the variable looping over the function `f(x)`. - -Functions having a property `rawArgs` with value `true` are treated in a special -way by the expression parser: they will be invoked with unevaluated arguments, -allowing the function to process the arguments in a customized way. Raw -functions are called as: - -``` -rawFunction(args: Node[], math: Object, scope: Map) -``` - -Where : - -- `args` is an Array with nodes of the parsed arguments. -- `math` is the math namespace against which the expression was compiled. -- `scope` is a [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) - interface containing the variables defined in the scope - passed via `evaluate(scope)`. The passed scope is always a `Map` interface, - and normally a `PartitionedMap` is used to separate local function variables - like `x` in a custom defined function `f(x) = rawFunction(x) ^ 2` from the - scope variables. Note that a `PartitionedMap` can recursively link to another - `PartitionedMap`. - -Raw functions must be imported in the `math` namespace, as they need to be -processed at compile time. They are not supported when passed via a scope -at evaluation time. - -A simple example: - -```js -function myFunction(args, math, scope) { - // get string representation of the arguments - const str = args.map(function (arg) { - return arg.toString() - }) - - // evaluate the arguments - const res = args.map(function (arg) { - return arg.compile().evaluate(scope) - }) - - return 'arguments: ' + str.join(',') + ', evaluated: ' + res.join(',') -} - -// mark the function as "rawArgs", so it will be called with unevaluated arguments -myFunction.rawArgs = true - -// import the new function in the math namespace -math.import({ - myFunction: myFunction -}) - -// use the function -math.evaluate('myFunction(2 + 3, sqrt(4))') -// returns 'arguments: 2 + 3, sqrt(4), evaluated: 5, 2' -``` - -

Custom LaTeX handlers #

- -You can attach a `toTex` property to your custom functions before importing them to define their LaTeX output. This -`toTex` property can be a handler in the format described in the next section 'Custom LaTeX and String conversion' -or a template string similar to ES6 templates. - -

Template syntax #

- -- `${name}`: Gets replaced by the name of the function -- `${args}`: Gets replaced by a comma separated list of the arguments of the function. -- `${args[0]}`: Gets replaced by the first argument of a function -- `$$`: Gets replaced by `$` - -

Example #

- -```js -const customFunctions = { - plus: function (a, b) { - return a + b - }, - minus: function (a, b) { - return a - b - }, - binom: function (n, k) { - return 1 - } -} - -customFunctions.plus.toTex = '${args[0]}+${args[1]}' //template string -customFunctions.binom.toTex = '\\mathrm{${name}}\\left(${args}\\right)' //template string -customFunctions.minus.toTex = function (node, options) { //handler function - return node.args[0].toTex(options) + node.name + node.args[1].toTex(options) -} - -math.import(customFunctions) - -math.parse('plus(1,2)').toTex() // '1+2' -math.parse('binom(1,2)').toTex() // '\\mathrm{binom}\\left(1,2\\right)' -math.parse('minus(1,2)').toTex() // '1minus2' -``` - -

Custom HTML, LaTeX and string output #

- -All expression nodes have a method `toTex` and `toString` to output an expression respectively in HTML or LaTex format or as regular text . -The functions `toHTML`, `toTex` and `toString` accept an `options` argument to customise output. This object is of the following form: - -```js -{ - parenthesis: 'keep', // parenthesis option - handler: someHandler, // handler to change the output - implicit: 'hide' // how to treat implicit multiplication -} -``` - -

Parenthesis #

- -The `parenthesis` option changes the way parentheses are used in the output. There are three options available: - -- `keep` Keep the parentheses from the input and display them as is. This is the default. -- `auto` Only display parentheses that are necessary. Mathjs tries to get rid of as much parentheses as possible. -- `all` Display all parentheses that are given by the structure of the node tree. This makes the output precedence unambiguous. - -There's two ways of passing callbacks: - -1. Pass an object that maps function names to callbacks. Those callbacks will be used for FunctionNodes with -functions of that name. -2. Pass a function to `toTex`. This function will then be used for every node. - -```js -const expression = math.parse('(1+1+1)') - -expression.toString() // (1 + 1 + 1) -expression.toString({parenthesis: 'keep'}) // (1 + 1 + 1) -expression.toString({parenthesis: 'auto'}) // 1 + 1 + 1 -expression.toString({parenthesis: 'all'}) // (1 + 1) + 1 -``` - -

Handler #

- -You can provide the `toTex` and `toString` functions of an expression with your own custom handlers that override the internal behaviour. This is especially useful to provide LaTeX/string output for your own custom functions. This can be done in two ways: - -1. Pass an object that maps function names to callbacks. Those callbacks will be used for FunctionNodes that contain functions with that name. -2. Pass a callback directly. This callback will run for every node, so you can replace the output of anything you like. - -A callback function has the following form: - -```js -function callback (node, options) { - ... -} -``` -Where `options` is the object passed to `toHTML`/`toTex`/`toString`. Don't forget to pass this on to the child nodes, and `node` is a reference to the current node. - -If a callback returns nothing, the standard output will be used. If your callback returns a string, this string will be used. - -**Although the following examples use `toTex`, it works for `toString` and `toHTML` in the same way** - -

Examples for option 1 #

- -```js -const customFunctions = { - binomial: function (n, k) { - //calculate n choose k - // (do some stuff) - return result - } -} - -const customLaTeX = { - 'binomial': function (node, options) { //provide toTex for your own custom function - return '\\binom{' + node.args[0].toTex(options) + '}{' + node.args[1].toTex(options) + '}' - }, - 'factorial': function (node, options) { //override toTex for builtin functions - return 'factorial\\left(' + node.args[0] + '\\right)' - } -} -``` - -You can simply use your custom toTex functions by passing them to `toTex`: - -```js -math.import(customFunctions) -const expression = math.parse('binomial(factorial(2),1)') -const latex = expression.toTex({handler: customLaTeX}) -// latex now contains "\binom{factorial\\left(2\\right)}{1}" -``` - -

Examples for option 2: #

- -```js -function customLaTeX(node, options) { - if ((node.type === 'OperatorNode') && (node.fn === 'add')) { - //don't forget to pass the options to the toTex functions - return node.args[0].toTex(options) + ' plus ' + node.args[1].toTex(options) - } - else if (node.type === 'ConstantNode') { - if (node.value === 0) { - return '\\mbox{zero}' - } - else if (node.value === 1) { - return '\\mbox{one}' - } - else if (node.value === 2) { - return '\\mbox{two}' - } - else { - return node.value - } - } -} - -const expression = math.parse('1+2') -const latex = expression.toTex({handler: customLaTeX}) -// latex now contains '\mbox{one} plus \mbox{two}' -``` - -Another example in conjunction with custom functions: - -```js -const customFunctions = { - binomial: function (n, k) { - //calculate n choose k - // (do some stuff) - return result - } -} - -function customLaTeX(node, options) { - if ((node.type === 'FunctionNode') && (node.name === 'binomial')) { - return '\\binom{' + node.args[0].toTex(options) + '}{' + node.args[1].toTex(options) + '}' - } -} - -math.import(customFunctions) -const expression = math.parse('binomial(2,1)') -const latex = expression.toTex({handler: customLaTeX}) -// latex now contains "\binom{2}{1}" -``` - -

Implicit multiplication #

- -You can change the way that implicit multiplication is converted to a string or LaTeX. The two options are `hide`, to not show a multiplication operator for implicit multiplication and `show` to show it. - -Example: - -```js -const node = math.parse('2a') - -node.toString() // '2 a' -node.toString({implicit: 'hide'}) // '2 a' -node.toString({implicit: 'show'}) // '2 * a' - -node.toTex() // '2~ a' -node.toTex({implicit: 'hide'}) // '2~ a' -node.toTex({implicit: 'show'}) // '2\\cdot a' -``` - - -

Customize supported characters #

- -It is possible to customize the characters allowed in symbols and digits. -The `parse` function exposes the following test functions: - -- `math.parse.isAlpha(c, cPrev, cNext)` -- `math.parse.isWhitespace(c, nestingLevel)` -- `math.parse.isDecimalMark(c, cNext)` -- `math.parse.isDigitDot(c)` -- `math.parse.isDigit(c)` - -The exact signature and implementation of these functions can be looked up in -the [source code of the parser](https://github.com/josdejong/mathjs/blob/master/src/expression/parse.js). The allowed alpha characters are described here: [Constants and variables](syntax.html#constants-and-variables). - -For example, the phone character is not supported by default. It can be enabled -by replacing the `isAlpha` function: - -```js -const isAlphaOriginal = math.parse.isAlpha -math.parse.isAlpha = function (c, cPrev, cNext) { - return isAlphaOriginal(c, cPrev, cNext) || (c === '\u260E') -} - -// now we can use the \u260E (phone) character in expressions -const result = math.evaluate('\u260Efoo', {'\u260Efoo': 42}) // returns 42 -console.log(result) -``` diff --git a/docs/expressions/expression_trees.md b/docs/expressions/expression_trees.md deleted file mode 100644 index c322e8a983..0000000000 --- a/docs/expressions/expression_trees.md +++ /dev/null @@ -1,715 +0,0 @@ ---- -layout: default ---- - -

Expression trees #

- -When parsing an expression via `math.parse(expr)`, math.js generates an -expression tree and returns the root node of the tree. An expression tree can -be used to analyze, manipulate, and evaluate expressions. - -Example: - -```js -const node = math.parse('sqrt(2 + x)') -``` - -In this case, the expression `sqrt(2 + x)` is parsed as: - -``` - FunctionNode sqrt - | - OperatorNode + - / \ - ConstantNode 2 x SymbolNode -``` - -Alternatively, this expression tree can be built by manually creating nodes: - -```js -const node1 = new math.ConstantNode(2) -const node2 = new math.SymbolNode('x') -const node3 = new math.OperatorNode('+', 'add', [node1, node2]) -const node4 = new math.FunctionNode('sqrt', [node3]) -``` - -The resulting expression tree with root node `node4` is equal to the expression -tree generated by `math.parse('sqrt(2 + x)')`. - - -

API #

- -

Methods #

- -All nodes have the following methods: - -- `clone() : Node` - - Create a shallow clone of the node. - The node itself is cloned, its childs are not cloned. - -- `cloneDeep() : Node` - - Create a deep clone of the node. - Both the node as well as all its childs are cloned recursively. - -- `compile() : Object` - - Compile an expression into optimized JavaScript code. `compile` returns an - object with a function `evaluate([scope])` to evaluate. Example: - - ```js - const node = math.parse('2 + x') // returns the root Node of an expression tree - const code = node.compile() // returns {evaluate: function (scope) {...}} - const evaluate = code.evaluate({x: 3}) // returns 5 - ``` - -- `evaluate([scope]) : Object` - - Compile and evaluate an expression, this is the equivalent of doing - `node.compile().evaluate(scope)`. Example: - - ```js - const node = math.parse('2 + x') // returns the root Node of an expression tree - const evaluate = node.evaluate({x: 3}) // returns 5 - ``` - -- `equals(other: Node) : boolean` - - Test whether this node equals an other node. Does a deep comparison of the - values of both nodes. - -- `filter(callback: function) : Node[]` - - Recursively filter nodes in an expression tree. The `callback` function is - called as `callback(node: Node, path: string, parent: Node) : boolean` for - every node in the tree, and must return a boolean. The function `filter` - returns an array with nodes for which the test returned true. - Parameter `path` is a string containing a relative JSON Path. - - Example: - - ```js - const node = math.parse('x^2 + x/4 + 3*y') - const filtered = node.filter(function (node) { - return node.isSymbolNode && node.name === 'x' - }) - // returns an array with two entries: two SymbolNodes 'x' - ``` - -- `forEach(callback: function) : void` - - Execute a callback for each of the child nodes of this node. The `callback` - function is called as `callback(child: Node, path: string, parent: Node): void`. - Parameter `path` is a string containing a relative JSON Path. - - See also `traverse`, which is a recursive version of `forEach`. - - Example: - - ```js - const node = math.parse('3 * x + 2') - node.forEach(function (node, path, parent) { - switch (node.type) { - case 'OperatorNode': - console.log(node.type, node.op) - break - case 'ConstantNode': - console.log(node.type, node.value) - break - case 'SymbolNode': - console.log(node.type, node.name) - break - default: - console.log(node.type) - } - }) - // outputs: - // OperatorNode * - // ConstantNode 2 - ``` - -- `map(callback: function) : Node[]` - - Transform a node. Creates a new Node having it's childs be the results of - calling the provided callback function for each of the childs of the original - node. The `callback` function is called as `callback(child: Node, path: string, - parent: Node)` and must return a Node. Parameter `path` is a string containing - a relative JSON Path. - - See also `transform`, which is a recursive version of `map`. - -- `toHTML(options: object): string` - - Get a HTML representation of the parsed expression. Example: - - ```js - const node = math.parse('sqrt(2/3)') - node.toHTML() - // returns - // sqrt - // ( - // 2 - // / - // 3 - // ) - ``` - - Information about the available HTML classes in [HTML Classes](html_classes.html). - Information about the options in [Customization](customization.html#custom-html-latex-and-string-output). - -- `toString(options: object) : string` - - Get a string representation of the parsed expression. This is not exactly - the same as the original input. Example: - - ```js - const node = math.parse('3+4*2') - node.toString() // returns '3 + (4 * 2)' - ``` - - Information about the options in [Customization](customization.html#custom-html-latex-and-string-output). - -- `toTex(options: object): string` - - Get a [LaTeX](https://en.wikipedia.org/wiki/LaTeX) representation of the - expression. Example: - - ```js - const node = math.parse('sqrt(2/3)') - node.toTex() // returns '\sqrt{\frac{2}{3}}' - ``` - - Information about the options in [Customization](customization.html#custom-html-latex-and-string-output). - -- `transform(callback: function)` - - Recursively transform an expression tree via a transform function. Similar - to `Array.map`, but recursively executed on all nodes in the expression tree. - The callback function is a mapping function accepting a node, and returning - a replacement for the node or the original node. Function `callback` is - called as `callback(node: Node, path: string, parent: Node)` for every node - in the tree, and must return a `Node`. Parameter `path` is a string containing - a relative JSON Path. - - The transform function will stop iterating when a node is replaced by the - callback function, it will not iterate over replaced nodes. - - For example, to replace all nodes of type `SymbolNode` having name 'x' with a - ConstantNode with value `3`: - - ```js - const node = math.parse('x^2 + 5*x') - const transformed = node.transform(function (node, path, parent) { - if (node.isSymbolNode && node.name === 'x') { - return new math.ConstantNode(3) - } - else { - return node - } - }) - transformed.toString() // returns '3 ^ 2 + 5 * 3' - ``` - -- `traverse(callback: function): void` - - Recursively traverse all nodes in a node tree. Executes given callback for - this node and each of its child nodes. Similar to `Array.forEach`, except - recursive. - The callback function is a mapping function accepting a node, and returning - nothing. Function `callback` is - called as `callback(node: Node, path: string, parent: Node)` for every node - in the tree. Parameter `path` is a string containing a relative JSON Path. - Example: - - ```js - const node = math.parse('3 * x + 2') - node.traverse(function (node, path, parent) { - switch (node.type) { - case 'OperatorNode': - console.log(node.type, node.op) - break - case 'ConstantNode': - console.log(node.type, node.value) - break - case 'SymbolNode': - console.log(node.type, node.name) - break - default: - console.log(node.type) - } - }) - // outputs: - // OperatorNode + - // OperatorNode * - // ConstantNode 3 - // SymbolNode x - // ConstantNode 2 - ``` - - -

Properties #

- -Each `Node` has the following properties: - -- `comment: string` - - A string holding a comment if there was any in the expression, or else the - string will be empty string. A comment can be attached to the root node of - an expression or to each of the childs nodes of a `BlockNode`. - -- `isNode: true` - - Is defined with value `true` on Nodes. Additionally, each type of node - adds it's own flag, for example a `SymbolNode` as has a property - `isSymbolNode: true`. - -- `type: string` - - The type of the node, for example `'SymbolNode'` in case of a `SymbolNode`. - - -

Nodes #

- -math.js has the following types of nodes. All nodes are available at the -namespace `math`. - - -

AccessorNode #

- -Construction: - -``` -new AccessorNode(object: Node, index: IndexNode) -``` - -Properties: - -- `object: Node` -- `index: IndexNode` -- `name: string` (read-only) The function or method name. Returns an empty string when undefined. - -Examples: - -```js -const node1 = math.parse('a[3]') - -const object = new math.SymbolNode('a') -const constant3 = new math.ConstantNode(3) -const index = new math.IndexNode([constant3]) -const node2 = new math.AccessorNode(object, index) -``` - - -

ArrayNode #

- -Construction: - -``` -new ArrayNode(items: Node[]) -``` - -Properties: - -- `items: Node[]` - -Examples: - -```js -const node1 = math.parse('[1, 2, 3]') - -const one = new math.ConstantNode(1) -const two = new math.ConstantNode(2) -const three = new math.ConstantNode(3) -const node2 = new math.ArrayNode([one, two, three]) -``` - - -

AssignmentNode #

- -Construction: - -``` -new AssignmentNode(object: SymbolNode, value: Node) -new AssignmentNode(object: SymbolNode | AccessorNode, index: IndexNode, value: Node) -``` - -Properties: - -- `object: SymbolNode | AccessorNode` -- `index: IndexNode | null` -- `value: Node` -- `name: string` (read-only) The function or method name. Returns an empty string when undefined. - -Examples: - -```js -const node1 = math.parse('a = 3') - -const object = new math.SymbolNode('a') -const value = new math.ConstantNode(3) -const node2 = new math.AssignmentNode(object, value) -``` - - -

BlockNode #

- -A `BlockNode` is created when parsing a multi line expression like `a=2;b=3` or -`a=2\nb=3`. Evaluating a `BlockNode` returns a `ResultSet`. The results can be -retrieved via `ResultSet.entries` or `ResultSet.valueOf()`, which contains -an `Array` with the results of the visible lines (i.e. lines not ending with -a semicolon). - -Construction: - -``` -block = new BlockNode(Array.<{node: Node} | {node: Node, visible: boolean}>) -``` - -Properties: - -- `blocks: Array.<{node: Node, visible: boolean}>` - -Examples: - -```js -const block1 = math.parse('a=1; b=2; c=3') - -const a = new math.SymbolNode('a') -const one = new math.ConstantNode(1) -const ass1 = new math.AssignmentNode(a, one) - -const b = new math.SymbolNode('b') -const two = new math.ConstantNode(2) -const ass2 = new math.AssignmentNode(b, two) - -const c = new math.SymbolNode('c') -const three = new math.ConstantNode(3) -const ass3 = new math.AssignmentNode(c, three) - -const block2 = new BlockNode([ - {node: ass1, visible: false}, - {node: ass2, visible: false}, - {node: ass3, visible: true} -]) -``` - - -

ConditionalNode #

- -Construction: - -``` -new ConditionalNode(condition: Node, trueExpr: Node, falseExpr: Node) -``` - -Properties: - -- `condition: Node` -- `trueExpr: Node` -- `falseExpr: Node` - -Examples: - -```js -const node1 = math.parse('a > 0 ? a : -a') - -const a = new math.SymbolNode('a') -const zero = new math.ConstantNode(0) -const condition = new math.OperatorNode('>', 'larger', [a, zero]) -const trueExpr = a -const falseExpr = new math.OperatorNode('-', 'unaryMinus', [a]) -const node2 = new math.ConditionalNode(condition, trueExpr, falseExpr) -``` - -

ConstantNode #

- -Construction: - -``` -new ConstantNode(value: *) -``` - -Properties: - -- `value: *` - -Examples: - -```js -const node1 = math.parse('2.4') - -const node2 = new math.ConstantNode(2.4) -const node3 = new math.ConstantNode('foo') -``` - - -

FunctionAssignmentNode #

- -Construction: - -``` -new FunctionAssignmentNode(name: string, params: string[], expr: Node) -``` - -Properties: - -- `name: string` -- `params: string[]` -- `expr: Node` - -Examples: - -```js -const node1 = math.parse('f(x) = x^2') - -const x = new math.SymbolNode('x') -const two = new math.ConstantNode(2) -const expr = new math.OperatorNode('^', 'pow', [x, 2]) -const node2 = new math.FunctionAssignmentNode('f', ['x'], expr) -``` - - -

FunctionNode #

- -Construction: - -``` -new FunctionNode(fn: Node | string, args: Node[]) -``` - -Properties: - -- `fn: Node | string` (read-only) The object or function name which to invoke. -- `args: Node[]` - -Static functions: - -- `FunctionNode.onUndefinedFunction(name: string)`. This function is invoked when an undefined function is evaluated. By default, the function throws an exception "Undefined function x". The function can be overwritten to customize this behavior. See also `SymbolNode.onUndefinedSymbol`. - - -Examples: - -```js -const node1 = math.parse('sqrt(4)') - -const four = new math.ConstantNode(4) -const node3 = new math.FunctionNode(new SymbolNode('sqrt'), [four]) -``` - - -

IndexNode #

- -Construction: - -``` -new IndexNode(dimensions: Node[]) -new IndexNode(dimensions: Node[], dotNotation: boolean) -``` - -Each dimension can be a single value, a range, or a property. The values of -indices are one-based, including range end. - -An optional property `dotNotation` can be provided describing whether this index -was written using dot notation like `a.b`, or using bracket notation -like `a["b"]`. Default value is `false`. This information is used when -stringifying the IndexNode. - -Properties: - -- `dimensions: Node[]` -- `dotNotation: boolean` - -Examples: - -```js -const node1 = math.parse('A[1:3, 2]') - -const A = new math.SymbolNode('A') -const one = new math.ConstantNode(1) -const two = new math.ConstantNode(2) -const three = new math.ConstantNode(3) - -const range = new math.RangeNode(one, three) -const index = new math.IndexNode([range, two]) -const node2 = new math.AccessorNode(A, index) -``` - -

ObjectNode #

- -Construction: - -``` -new ObjectNode(properties: Object.) -``` - -Properties: - -- `properties: Object.` - -Examples: - -```js -const node1 = math.parse('{a: 1, b: 2, c: 3}') - -const a = new math.ConstantNode(1) -const b = new math.ConstantNode(2) -const c = new math.ConstantNode(3) -const node2 = new math.ObjectNode({a: a, b: b, c: c}) -``` - - -

OperatorNode #

- -Construction: - -``` -new OperatorNode(op: string, fn: string, args: Node[], implicit: boolean = false) -``` - -Additional methods: - -- `isUnary() : boolean` - - Returns true when the `OperatorNode` contains exactly one argument, - like with a unary minus: - - ```js - const a = new math.ConstantNode(2) - const b = new math.OperatorNode('-', 'unaryMinus', [a]) - b.isUnary() // true - ``` - -- `isBinary() : boolean` - - Returns true when the `OperatorNode` contains exactly two arguments, - like with most regular operators: - - ```js - const a = new math.ConstantNode(2) - const b = new math.ConstantNode(3) - const c = new math.OperatorNode('+', 'add', [a, b]) - c.isBinary() // true - ``` - -Properties: - -- `op: string` -- `fn: string` -- `args: Node[]` -- `implicit: boolean` True in case of an implicit multiplication, false otherwise - -Examples: - -```js -const node1 = math.parse('2.3 + 5') - -const a = new math.ConstantNode(2.3) -const b = new math.ConstantNode(5) -const node2 = new math.OperatorNode('+', 'add', [a, b]) -``` - -

ParenthesisNode #

- -Construction: - -``` -new ParenthesisNode(content: Node) -``` - -Properties: - -- `content: Node` - -Examples: - -```js -const node1 = math.parse('(1)') - -const a = new math.ConstantNode(1) -const node2 = new math.ParenthesisNode(a) -``` - -

RangeNode #

- -Construction: - -``` -new RangeNode(start: Node, end: Node [, step: Node]) -``` - -Properties: - -- `start: Node` -- `end: Node` -- `step: Node | null` - -Examples: - -```js -const node1 = math.parse('1:10') -const node2 = math.parse('0:2:10') - -const zero = new math.ConstantNode(0) -const one = new math.ConstantNode(1) -const two = new math.ConstantNode(2) -const ten = new math.ConstantNode(10) - -const node3 = new math.RangeNode(one, ten) -const node4 = new math.RangeNode(zero, ten, two) -``` - -

RelationalNode #

- -Construction: - -``` -new RelationalNode(conditionals: string[], params: Node[]) -``` - -`conditionals` is an array of strings, each of which may be 'smaller', 'larger', 'smallerEq', 'largerEq', 'equal', or 'unequal'. The `conditionals` array must contain exactly one fewer item than `params`. - -Properties: - -- `conditionals: string[]` -- `params: Node[]` - -A `RelationalNode` efficiently represents a chained conditional expression with two or more comparison operators, such as `10 < x <= 50`. The expression is equivalent to `10 < x and x <= 50`, except that `x` is evaluated only once, and evaluation stops (is "short-circuited") once any condition tests false. Operators that are subject to chaining are `<`, `>`, `<=`, `>=`, `==`, and `!=`. For backward compatibility, `math.parse` will return an `OperatorNode` if only a single conditional is present (such as `x > 2`). - -Examples: - -```js - -const ten = new math.ConstantNode(10) -const x = new math.SymbolNode('x') -const fifty = new math.ConstantNode(50) - -const node1 = new math.RelationalNode(['smaller', 'smallerEq'], [ten, x, fifty]) -const node2 = math.parse('10 < x <= 50') -``` - - -

SymbolNode #

- -Construction: - -``` -new SymbolNode(name: string) -``` - -Properties: - -- `name: string` - -Static functions: - -- `SymbolNode.onUndefinedSymbol(name: string)`. This function is invoked when an undefined symbol is evaluated. By default, the function throws an exception "Undefined symbol x". The function can be overwritten to customize this behavior. See also `FunctionNode.onUndefinedFunction`. - - -Examples: - -```js -const node = math.parse('x') - -const x = new math.SymbolNode('x') -``` diff --git a/docs/expressions/html_classes.md b/docs/expressions/html_classes.md deleted file mode 100644 index 8a269c806c..0000000000 --- a/docs/expressions/html_classes.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -layout: default ---- - -

HTML output #

- -The expression parser can output a HTML string, where every `Node` is -transformed into a `` element with semantic class names. Each class -name begins with the `math-` prefix. These class names can be used in CSS to -highlight the syntax or change the default layout (e.g. spaces around operators). - -

Available class names #

- -- `math-number` -- `math-string` -- `math-boolean` (`true` and `false`) -- `math-undefined` -- `math-function` (function names) -- `math-parameter` (function parameters) -- `math-property` (object members) -- `math-symbol` (variables, units and built-in constants) - - `math-null-symbol` (`null`) - - `math-nan-symbol` (`NaN`) - - `math-infinity-symbol` (`Infinity`) - - `math-imaginary-symbol` (`i`) -- `math-operator` - - `math-unary-operator` - - `math-lefthand-unary-operator` - - `math-righthand-unary-operator` - - `math-binary-operator` - - `math-explicit-binary-operator` - - `math-implicit-binary-operator` (empty element) - - `math-assignment-operator` - - `math-variable-assignment-operator` (`=`) - - `math-property-assignment-operator` (`:` in objects) - - `math-accessor-operator` (`.` in objects) - - `math-range-operator` (`:` in ranges) -- `math-parenthesis` - -`math-round-parenthesis` (`(` and `)`) - -`math-square-parenthesis` (`[` and `]`) - -`math-curly-parenthesis` (`{` and `}`) -- `math-separator` (�,`, `;` and <br />) \ No newline at end of file diff --git a/docs/expressions/index.md b/docs/expressions/index.md deleted file mode 100644 index d89793dc42..0000000000 --- a/docs/expressions/index.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -layout: default ---- - -

Expressions #

- -Math.js contains a flexible and easy to use expression parser. -The parser supports all data types, functions and constants available in math.js. - -Whilst the math.js library is aimed at JavaScript developers, the expression -parser is aimed at end users: mathematicians, engineers, students, pupils. -The syntax of the expression parser differs from JavaScript and the low-level -math.js library. - -This section is divided in the following pages: - -- [Parsing and evaluation](parsing.html) describes how to parse and - evaluate expressions with math.js. -- [Syntax](syntax.html) describes how to write expressions. -- [Expression trees](expression_trees.html) explains how to parse an expression into an - expression tree, and use this to analyse and manipulate the expression. -- [Algebra](algebra.html) describing symbolic computation in math.js. -- [Customization](customization.html) describes how to customize processing and - evaluation of expressions. -- [Security](security.html) about security risks of executing arbitrary expressions. diff --git a/docs/expressions/parsing.md b/docs/expressions/parsing.md deleted file mode 100644 index 752601cd97..0000000000 --- a/docs/expressions/parsing.md +++ /dev/null @@ -1,240 +0,0 @@ ---- -layout: default ---- - -

Expression parsing and evaluation #

- -Expressions can be parsed and evaluated in various ways: - -- Using the function [`math.evaluate(expr [,scope])`](#evaluate). -- Using the function [`math.compile(expr)`](#compile). -- Using the function [`math.parse(expr)`](#parse). -- By creating a [parser](#parser), `math.parser()`, which contains a method - `evaluate` and keeps a scope with assigned variables in memory. - - -

Evaluate #

- -Math.js comes with a function `math.evaluate` to evaluate expressions. Syntax: - -```js -math.evaluate(expr) -math.evaluate(expr, scope) -math.evaluate([expr1, expr2, expr3, ...]) -math.evaluate([expr1, expr2, expr3, ...], scope) -``` - -Function `evaluate` accepts a single expression or an array with -expressions as the first argument and has an optional second argument -containing a `scope` with variables and functions. The scope can be a regular -JavaScript `Map` (recommended), a plain JavaScript `object`, or any custom -class that implements the `Map` interface with methods `get`, `set`, `keys` -and `has`. The scope will be used to resolve symbols, and to write assigned -variables and functions. - -When an `Object` is used as scope, mathjs will internally wrap it in an -`ObjectWrappingMap` interface since the internal functions can only use a `Map` -interface. In case of custom defined functions like `f(x) = x^2`, the scope -will be wrapped in a `PartitionedMap`, which reads and writes the function -variables (like `x` in this example) from a temporary map, and reads and writes -other variables from the original scope. The original scope is never copied, it -is only wrapped around when needed. - -The following code demonstrates how to evaluate expressions. - -```js -// evaluate expressions -math.evaluate('sqrt(3^2 + 4^2)') // 5 -math.evaluate('sqrt(-4)') // 2i -math.evaluate('2 inch to cm') // 5.08 cm -math.evaluate('cos(45 deg)') // 0.7071067811865476 - -// provide a scope -let scope = { - a: 3, - b: 4 -} -math.evaluate('a * b', scope) // 12 -math.evaluate('c = 2.3 + 4.5', scope) // 6.8 -scope.c // 6.8 -``` - - -

Compile #

- -Math.js contains a function `math.compile` which compiles expressions -into JavaScript code. This is a shortcut for first [parsing](#parse) and then -compiling an expression. The syntax is: - -```js -math.compile(expr) -math.compile([expr1, expr2, expr3, ...]) -``` - -Function `compile` accepts a single expression or an array with -expressions as the argument. Function `compile` returns an object with a function -`evaluate([scope])`, which can be executed to evaluate the expression against an -(optional) scope: - -```js -const code = math.compile(expr) // compile an expression -const result = code.evaluate([scope]) // evaluate the code with an optional scope -``` - -An expression needs to be compiled only once, after which the -expression can be evaluated repeatedly and against different scopes. -The optional scope is used to resolve symbols and to write assigned -variables or functions. Parameter [`scope`](#scope) can be a regular Object, or Map. - -Example usage: - -```js -// parse an expression into a node, and evaluate the node -const code1 = math.compile('sqrt(3^2 + 4^2)') -code1.evaluate() // 5 -``` - - -

Parse #

- -Math.js contains a function `math.parse` to parse expressions into an -[expression tree](expression_trees.html). The syntax is: - -```js -math.parse(expr) -math.parse([expr1, expr2, expr3, ...]) -``` - -Function `parse` accepts a single expression or an array with -expressions as the argument. Function `parse` returns the root node of the tree, -which can be successively compiled and evaluated: - -```js -const node = math.parse(expr) // parse expression into a node tree -const code = node.compile() // compile the node tree -const result = code.evaluate([scope]) // evaluate the code with an optional scope -``` - -The API of nodes is described in detail on the page -[Expression trees](expression_trees.html). - -An expression needs to be parsed and compiled only once, after which the -expression can be evaluated repeatedly. On evaluation, an optional scope -can be provided, which is used to resolve symbols and to write assigned -variables or functions. Parameter [`scope`](#scope) is a regular Object or Map. - -Example usage: - -```js -// parse an expression into a node, and evaluate the node -const node1 = math.parse('sqrt(3^2 + 4^2)') -const code1 = node1.compile() -code1.evaluate() // 5 - -// provide a scope -const node2 = math.parse('x^a') -const code2 = node2.compile() -let scope = { - x: 3, - a: 2 -} -code2.evaluate(scope) // 9 - -// change a value in the scope and re-evaluate the node -scope.a = 3 -code2.evaluate(scope) // 27 -``` - -Parsed expressions can be exported to text using `node.toString()`, and can -be exported to LaTeX using `node.toTex()`. The LaTeX export can be used to -pretty print an expression in the browser with a library like -[MathJax](https://www.mathjax.org/). Example usage: - -```js -// parse an expression -const node = math.parse('sqrt(x/x+1)') -node.toString() // returns 'sqrt((x / x) + 1)' -node.toTex() // returns '\sqrt{ {\frac{x}{x} }+{1} }' -``` - - -

Parser #

- -In addition to the static functions [`math.evaluate`](#evaluate) and -[`math.parse`](#parse), math.js contains a parser with functions `evaluate` and -`parse`, which automatically keeps a scope with assigned variables in memory. -The parser also contains some convenience functions to get, set, and remove -variables from memory. - -A parser can be created by: - -```js -const parser = math.parser() -``` - -The parser contains the following functions: - -- `clear()` - Completely clear the parser's scope. -- `evaluate(expr)` - Evaluate an expression. Returns the result of the expression. -- `get(name)` - Retrieve a variable or function from the parser's scope. -- `getAll()` - Retrieve an object with all defined variables in the parser's scope. -- `getAllAsMap()` - Retrieve a map with all defined variables in the parser's scope. -- `remove(name)` - Remove a variable or function from the parser's scope. -- `set(name, value)` - Set a variable or function in the parser's scope. - -The following code shows how to create and use a parser. - -```js -// create a parser -const parser = math.parser() - -// evaluate expressions -parser.evaluate('sqrt(3^2 + 4^2)') // 5 -parser.evaluate('sqrt(-4)') // 2i -parser.evaluate('2 inch to cm') // 5.08 cm -parser.evaluate('cos(45 deg)') // 0.7071067811865476 - -// define variables and functions -parser.evaluate('x = 7 / 2') // 3.5 -parser.evaluate('x + 3') // 6.5 -parser.evaluate('f(x, y) = x^y') // f(x, y) -parser.evaluate('f(2, 3)') // 8 - -// get and set variables and functions -const x = parser.get('x') // x = 3.5 -const f = parser.get('f') // function -const g = f(3, 3) // g = 27 -parser.set('h', 500) -parser.evaluate('h / 2') // 250 -parser.set('hello', function (name) { - return 'hello, ' + name + '!' -}) -parser.evaluate('hello("user")') // "hello, user!" - -// clear defined functions and variables -parser.clear() -``` - -

Scope #

- -The scope is a data-structure used to store and lookup variables and functions defined and used by expressions. - -It is passed to mathjs via calls to [`math.evaluate`](#evaluate) or `simplify`. - -For ease of use, it can be a Plain Javascript Object; for safety it can be a plain `Map` and for flexibility, any object that has -the methods `get`/`set`/`has`/`keys`, seen on `Map`. - -Some care is taken to mutate the same object that is passed into mathjs, so they can collect the definitions from mathjs scripts and expressions. - -`evaluate` will fail if the expression uses a blacklisted symbol, preventing mathjs expressions to escape into Javascript. This is enforced by access to the scope. - -For less reliance on this blacklist, scope can also be a `Map`, which allows mathjs expressions to define variables and functions of any name. - -For more, see [examples of custom scopes](../../examples/advanced/custom_scope_objects.js). diff --git a/docs/expressions/security.md b/docs/expressions/security.md deleted file mode 100644 index 5c8468b057..0000000000 --- a/docs/expressions/security.md +++ /dev/null @@ -1,99 +0,0 @@ ---- -layout: default ---- - -

Security #

- -Executing arbitrary expressions like enabled by the expression parser of -mathjs involves a risk in general. When you're using mathjs to let users -execute arbitrary expressions, it's good to take a moment to think about -possible security and stability implications, especially when running -the code server side. - -

Security risks #

- -A user could try to inject malicious JavaScript code via the expression -parser. The expression parser of mathjs offers a sandboxed environment -to execute expressions which should make this impossible. It's possible -though that there are unknown security vulnerabilities, so it's important -to be careful, especially when allowing server side execution of -arbitrary expressions. - -The expression parser of mathjs parses the input in a controlled -way into an expression tree or abstract syntax tree (AST). -In a "compile" step, it does as much as possible preprocessing on the -static parts of the expression, and creates a fast performing function -which can be used to evaluate the expression repeatedly using a -dynamically passed scope. - -The parser actively prevents access to JavaScripts internal `eval` and -`new Function` which are the main cause of security attacks. Mathjs -versions 4 and newer does not use JavaScript's `eval` under the hood. -Version 3 and older did use `eval` for the compile step. This is not -directly a security issue but results in a larger possible attack surface. - -When running a node.js server, it's good to be aware of the different -types of security risks. The risk when running inside a browser may be -limited, though it's good to be aware of [Cross side scripting (XSS)](https://www.wikiwand.com/en/Cross-site_scripting) vulnerabilities. A nice overview of -the security risks of node.js servers is listed in the article [Node.js security checklist](https://blog.risingstack.com/node-js-security-checklist/) by Gergely Nemeth. - -

Less vulnerable expression parser #

- -There is a small number of functions which yield the biggest security -risk in the expression parser: - -- `import` and `createUnit` which alter the built-in functionality and - allow overriding existing functions and units, and `reviver` which parses - values into class instances. -- `evaluate`, `parse`, `simplify`, `derivative`, and `resolve` which parse - arbitrary input into a manipulable expression tree. - -To make the expression parser less vulnerable whilst still supporting -most functionality, these functions can be disabled: - -```js -import { create, all } from 'mathjs' - -const math = create(all) -const limitedEvaluate = math.evaluate - -math.import({ - // most important (hardly any functional impact) - 'import': function () { throw new Error('Function import is disabled') }, - 'createUnit': function () { throw new Error('Function createUnit is disabled') }, - 'reviver': function () { throw new Error('Function reviver is disabled') }, - - // extra (has functional impact) - 'evaluate': function () { throw new Error('Function evaluate is disabled') }, - 'parse': function () { throw new Error('Function parse is disabled') }, - 'simplify': function () { throw new Error('Function simplify is disabled') }, - 'derivative': function () { throw new Error('Function derivative is disabled') }, - 'resolve': function () { throw new Error('Function resolve is disabled') }, -}, { override: true }) - -console.log(limitedEvaluate('sqrt(16)')) // Ok, 4 -console.log(limitedEvaluate('parse("2+3")')) // Error: Function parse is disabled -``` - - -

Found a security vulnerability? Please report in private! #

- -You found a security vulnerability? Awesome! We hope you don't have bad -intentions and want to help fix the issue. Please report the -vulnerability in a private way by contacting one of the maintainers -via mail or another private channel. That way we can work together -on a fix before sharing the issue with everybody including the bad guys. - -

Stability risks #

- -A user could accidentally or on purpose execute a -heavy expression like creating a huge matrix. That can let the -JavaScript engine run out of memory or freeze it when the CPU goes -to 100% for a long time. - -To protect against this sort of issue, one can run the expression parser -in a separate Web Worker or child_process, so it can't affect the -main process. The workers can be killed when it runs for too -long or consumes too much memory. A useful library in this regard -is [workerpool](https://github.com/josdejong/workerpool), which makes -it easy to manage a pool of workers in both browser and node.js. diff --git a/docs/expressions/syntax.md b/docs/expressions/syntax.md deleted file mode 100644 index 6962d93913..0000000000 --- a/docs/expressions/syntax.md +++ /dev/null @@ -1,830 +0,0 @@ ---- -layout: default ---- - -

Expression syntax #

- -This page describes the syntax of the expression parser of math.js. It describes -how to work with the available data types, functions, operators, variables, -and more. - -

Differences from JavaScript #

- -The expression parser of math.js is aimed at a mathematical audience, -not a programming audience. The syntax is similar to most calculators and -mathematical applications. This is close to JavaScript as well, though there -are a few important differences between the syntax of the expression parser and -the lower level syntax of math.js. Differences are: - -- No need to prefix functions and constants with the `math.*` namespace, - you can just enter `sin(pi / 4)`. -- Matrix indexes are one-based instead of zero-based. -- There are index and range operators which allow more conveniently getting - and setting matrix indexes, like `A[2:4, 1]`. -- Both indexes and ranges and have the upper-bound included. -- There is a differing syntax for defining functions. Example: `f(x) = x^2`. -- There are custom operators like `x + y` instead of `add(x, y)`. -- Some operators are different. For example `^` is used for exponentiation, - not bitwise xor. -- Implicit multiplication, like `2 pi`, is supported and has special rules. -- Relational operators (`<`, `>`, `<=`, `>=`, `==`, and `!=`) are chained, so the expression `5 < x < 10` is equivalent to `5 < x and x < 10`. -- Multi-expression constructs like `a = 1; b = 2; a + b` or - `"a = 1;\n cos(a)\n sin(a)"` (where `\n` denotes newline) - produce a collection ("ResultSet") of values. Those expressions - terminated by `;` are evaluated for side effect only and their values - are suppressed from the result. - -

Operators #

- -The expression parser has operators for all common arithmetic operations such -as addition and multiplication. The expression parser uses conventional infix -notation for operators: an operator is placed between its arguments. -Round parentheses can be used to override the default precedence of operators. - -```js -// use operators -math.evaluate('2 + 3') // 5 -math.evaluate('2 * 3') // 6 - -// use parentheses to override the default precedence -math.evaluate('2 + 3 * 4') // 14 -math.evaluate('(2 + 3) * 4') // 20 -``` - -The following operators are available. Note that almost every operator listed -also has a function form with identical meaning that can be used -interchangeably. For example, `x+y` will always evaluate identically to -`add(x,y)`. For a full list of the equivalences, see the section on -Functions below. - -Operator | Name | Syntax | Associativity | Example | Result ------------ | -------------------------- | ---------- | ------------- | --------------------- | --------------- -`(`, `)` | Grouping | `(x)` | None | `2 * (3 + 4)` | `14` -`[`, `]` | Matrix, Index | `[...]` | None | `[[1,2],[3,4]]` | `[[1,2],[3,4]]` -`{`, `}` | Object | `{...}` | None | `{a: 1, b: 2}` | `{a: 1, b: 2}` -`,` | Parameter separator | `x, y` | Left to right | `max(2, 1, 5)` | `5` -`.` | Property accessor | `obj.prop` | Left to right | `obj={a: 12}; obj.a` | `12` -`;` | Statement separator | `x; y` | Left to right | `a=2; b=3; a*b` | `[6]` -`;` | Row separator | `[x; y]` | Left to right | `[1,2;3,4]` | `[[1,2],[3,4]]` -`\n` | Statement separator | `x \n y` | Left to right | `a=2 \n b=3 \n a*b` | `[2,3,6]` -`+` | Add | `x + y` | Left to right | `4 + 5` | `9` -`+` | Unary plus | `+y` | Right to left | `+4` | `4` -`-` | Subtract | `x - y` | Left to right | `7 - 3` | `4` -`-` | Unary minus | `-y` | Right to left | `-4` | `-4` -`*` | Multiply | `x * y` | Left to right | `2 * 3` | `6` -`.*` | Element-wise multiply | `x .* y` | Left to right | `[1,2,3] .* [1,2,3]` | `[1,4,9]` -`/` | Divide | `x / y` | Left to right | `6 / 2` | `3` -`./` | Element-wise divide | `x ./ y` | Left to right | `[9,6,4] ./ [3,2,2]` | `[3,3,2]` -`%` | Percentage | `x%` | None | `8%` | `0.08` -`%` | Addition with Percentage | `x + y%` | Left to right | `100 + 3%` | `103` -`%` | Subtraction with Percentage| `x - y%` | Left to right | `100 - 3%` | `97` -`%` `mod` | Modulus | `x % y` | Left to right | `8 % 3` | `2` -`^` | Power | `x ^ y` | Right to left | `2 ^ 3` | `8` -`.^` | Element-wise power | `x .^ y` | Right to left | `[2,3] .^ [3,3]` | `[8,27]` -`'` | Transpose | `y'` | Left to right | `[[1,2],[3,4]]'` | `[[1,3],[2,4]]` -`!` | Factorial | `y!` | Left to right | `5!` | `120` -`&` | Bitwise and | `x & y` | Left to right | `5 & 3` | `1` -`~` | Bitwise not | `~x` | Right to left | `~2` | `-3` -| | Bitwise or | x | y | Left to right | 5 | 3 | `7` -^| | Bitwise xor | x ^| y | Left to right | 5 ^| 2 | `7` -`<<` | Left shift | `x << y` | Left to right | `4 << 1` | `8` -`>>` | Right arithmetic shift | `x >> y` | Left to right | `8 >> 1` | `4` -`>>>` | Right logical shift | `x >>> y` | Left to right | `-8 >>> 1` | `2147483644` -`and` | Logical and | `x and y` | Left to right | `true and false` | `false` -`not` | Logical not | `not y` | Right to left | `not true` | `false` -`or` | Logical or | `x or y` | Left to right | `true or false` | `true` -`xor` | Logical xor | `x xor y` | Left to right | `true xor true` | `false` -`=` | Assignment | `x = y` | Right to left | `a = 5` | `5` -`?` `:` | Conditional expression | `x ? y : z` | Right to left | `15 > 100 ? 1 : -1` | `-1` -`:` | Range | `x : y` | Right to left | `1:4` | `[1,2,3,4]` -`to`, `in` | Unit conversion | `x to y` | Left to right | `2 inch to cm` | `5.08 cm` -`==` | Equal | `x == y` | Left to right | `2 == 4 - 2` | `true` -`!=` | Unequal | `x != y` | Left to right | `2 != 3` | `true` -`<` | Smaller | `x < y` | Left to right | `2 < 3` | `true` -`>` | Larger | `x > y` | Left to right | `2 > 3` | `false` -`<=` | Smallereq | `x <= y` | Left to right | `4 <= 3` | `false` -`>=` | Largereq | `x >= y` | Left to right | `2 + 4 >= 6` | `true` - - -

Precedence #

- -The operators have the following precedence, from highest to lowest: - -Operators | Description ---------------------------------- | -------------------- -`(...)`
`[...]`
`{...}` | Grouping
Matrix
Object -`x(...)`
`x[...]`
`obj.prop`
`:`| Function call
Matrix index
Property accessor
Key/value separator -`'` | Matrix transpose -`!` | Factorial -`^`, `.^` | Exponentiation -`+`, `-`, `~`, `not` | Unary plus, unary minus, bitwise not, logical not -See section below | Implicit multiplication -`*`, `/`, `.*`, `./`,`%`, `mod` | Multiply, divide , percentage, modulus -`+`, `-` | Add, subtract -`:` | Range -`to`, `in` | Unit conversion -`<<`, `>>`, `>>>` | Bitwise left shift, bitwise right arithmetic shift, bitwise right logical shift -`==`, `!=`, `<`, `>`, `<=`, `>=` | Relational -`&` | Bitwise and (lazily evaluated) -^| | Bitwise xor -| | Bitwise or (lazily evaluated) -`and` | Logical and (lazily evaluated) -`xor` | Logical xor -`or` | Logical or (lazily evaluated) -`?`, `:` | Conditional expression -`=` | Assignment -`,` | Parameter and column separator -`;` | Row separator -`\n`, `;` | Statement separators - -Lazy evaluation is used where logically possible for bitwise and logical -operators. In the following example, the value of `x` will not even be -evaluated because it cannot effect the final result: -```js -math.evaluate('false and x') // false, no matter what x equals -``` - - -

Functions #

- -Functions are called by entering their name, followed by zero or more -arguments enclosed by parentheses. All available functions are listed on the -page [Functions](../reference/functions.html). - -```js -math.evaluate('sqrt(25)') // 5 -math.evaluate('log(10000, 3 + 7)') // 4 -math.evaluate('sin(pi / 4)') // 0.7071067811865475 -``` - -New functions can be defined by "assigning" an expression to a function call -with one or more variables. Such function assignments are limited: they can -only be defined on a single line. - -```js -const parser = math.parser() - -parser.evaluate('f(x) = x ^ 2 - 5') -parser.evaluate('f(2)') // -1 -parser.evaluate('f(3)') // 4 - -parser.evaluate('g(x, y) = x ^ y') -parser.evaluate('g(2, 3)') // 8 -``` - -Note that these function assignments do _not_ create closures; put another way, -all free variables in mathjs are dynamic: - -```js -const parser = math.parser() - -parser.evaluate('x = 7') -parser.evaluate('h(y) = x + y') -parser.evaluate('h(3)') // 10 -parser.evaluate('x = 3') -parser.evaluate('h(3)') // 6, *not* 10 -``` - -It is however possible to pass functions as parameters: - -```js -const parser = math.parser() - -parser.evaluate('twice(func, x) = func(func(x))') -parser.evaluate('twice(square, 2)') // 16 -parser.evaluate('f(x) = 3*x') -parser.evaluate('twice(f, 2)') // 18 - -// a simplistic "numerical derivative": -parser.evaluate('eps = 1e-10') -parser.evaluate('nd(f, x) = (f(x+eps) - func(x-eps))/(2*eps)') -parser.evaluate('nd(square,2)') // 4.000000330961484 -``` - -Math.js itself heavily uses typed functions, which ensure correct inputs and -throws meaningful errors when the input arguments are invalid. One can create -a [typed-function](https://github.com/josdejong/typed-function) in the -expression parser like: - -```js -const parser = math.parser() - -parser.evaluate('f = typed({"number": f(x) = x ^ 2 - 5})') -``` - -Finally, as mentioned above, there is a function form for nearly every one of -the mathematical operator symbols. Moreover, for some associative operators, -the corresponding function allows arbitrarily many arguments. The table below -gives the full correspondence. - -Operator Expression | Equivalent Function Expression ----------------------|------------------------------- -`a or b` |`or(a,b)` -`a xor b` |`xor(a,b)` -`a and b` |`and(a,b)` -`a \| b` |`bitOr(a,b)` -`a ^\| b` |`bitXor(a,b)` -`a & b` |`bitAnd(a,b)` -`a == b` |`equal(a,b)` -`a != b` |`unequal(a,b)` -`a < b` |`smaller(a,b)` -`a > b` |`larger(a,b)` -`a <= b` |`smallerEq(a,b)` -`a << 3` |`leftShift(a,3)` -`a >> 3` |`rightArithShift(a,3)` -`a >>> 3` |`rightLogShift(a,3)` -`u to cm` |`to(u, cm)` -`a + b + c + ...` |`add(a,b,c,...)` -`a - b` |`subtract(a,b)` -`a * b * c * ...` |`multiply(a,b,c,...)` -`A .* B` |`dotMultiply(A,B)` -`A ./ B` |`dotDivide(A,B)` -`a mod b` |`mod(a,b)` -`+a` |`unaryPlus(a)` -`-a` |`unaryMinus(a)` -`~a` |`bitNot(a)` -`not a` |`not(a)` -`a^b` |`pow(a,b)` -`A .^ B` |`dotPow(A,B)` -`a!` |`factorial(a)` -`A'` |`ctranspose(A)` - -Note that math.js embodies a preference for the operator forms, in that calling -`simplify` (see [Algebra](./algebra.html)) converts any instances of the function -form into the corresponding operator. - -

Methods #

- -Some data types have methods which can be used in the parser using the dot notation, for example: - -```js -const parser = math.parser() - -parser.evaluate('a = 1 m') // Unit 1 m -parser.evaluate('a.toNumber("mm")') // 1000 -``` - -Or a method on a Matrix or Array: - -```js -const parser = math.parser() - -parser.evaluate('M = [4, 9, 25]') // Matrix [4, 9, 25] -parser.evaluate('M.map(sqrt)') // Matrix [2, 3, 5] -``` - -

Map and forEach #

- -The `map` and `forEach` functions can be used to apply a callback function to each element of an array or matrix. - -The callback functions can be functions, typed functions, inline functions (only in the parser) or compiled inline functions (only in the parser). - -The callback can have the following inputs: -- **value**: the current value in the array or matrix. -- **index**: the index of the current value expressed as an array of numbers. -- **array**: the array or matrix being iterated. - -Below is the syntax for both functions: - -

map #

- -The `map` function applies a function to each element of an array and returns a new array with the results. - -```js -const parser = math.parser() - -// Define a square function -parser.evaluate('square(x) = x ^ 2') - -// Apply the square function to each element of the array -parser.evaluate('result = map([1, 2, 3, 4], square)') -// result: [1, 4, 9, 16] - -// Apply an inline function to each element of the array -parser.evaluate('result = map([1, 2, 3, 4], f(x) = x ^ 2)') -// result: [1, 4, 9, 16] - -// Apply a compiled inline function to each element of the array -parser.evaluate('result = map([1, 2, 3, 4], x ^ 2)') -// result: [1, 4, 9, 16] -``` - -

forEach #

-The `forEach` function applies a function to each element of an array or matrix but does not return a new array. It is useful for executing side effects. - -```js -// Define a function that prints each element -math.import({consoleLog: x => console.log(x)}) -const parser = math.parser() - -// Define a squareConsleLog function -parser.evaluate('squareConsoleLog(x) = consoleLog(x ^ 2)') - -// Apply the squareConsleLog function to each element of the array -parser.evaluate('forEach([1, 2, 3, 4], squareConsleLog)') -// Prints: 1, 4, 9, 16 - -// Apply an inline function to each element of the array -parser.evaluate('forEach([1, 2, 3, 4], f(x) = consoleLog(x ^ 2))') -// Prints: 1, 4, 9, 16 - -// Apply a compiled inline function to each element of the array -parser.evaluate('forEach([1, 2, 3, 4], consoleLog(x ^ 2))') -// Prints: 1, 4, 9, 16 -``` - -These functions are useful for performing element-wise operations on arrays or matrices. - -

Constants and variables #

- -Math.js has a number of built-in constants such as `pi` and `e`. -All available constants are listed on he page -[Constants](../reference/constants.html). - -```js -// use constants -math.evaluate('pi') // 3.141592653589793 -math.evaluate('e ^ 2') // 7.3890560989306495 -math.evaluate('log(e)') // 1 -math.evaluate('e ^ (pi * i) + 1') // ~0 (Euler) -``` - -Variables can be defined using the assignment operator `=`, and can be used -like constants. - -```js -const parser = math.parser() - -// define variables -parser.evaluate('a = 3.4') // 3.4 -parser.evaluate('b = 5 / 2') // 2.5 - -// use variables -parser.evaluate('a * b') // 8.5 -``` - -Variable names must: - -- Begin with an "alpha character", which is: - - A latin letter (upper or lower case). Ascii: `a-z`, `A-Z` - - An underscore. Ascii: `_` - - A dollar sign. Ascii: `$` - - A latin letter with accents. Unicode: `\u00C0` - `\u02AF` - - A greek letter. Unicode: `\u0370` - `\u03FF` - - A letter-like character. Unicode: `\u2100` - `\u214F` - - A mathematical alphanumeric symbol. Unicode: `\u{1D400}` - `\u{1D7FF}` excluding invalid code points -- Contain only alpha characters (above) and digits `0-9` -- Not be any of the following: `mod`, `to`, `in`, `and`, `xor`, `or`, `not`, `end`. It is possible to assign to some of these, but that's not recommended. - -It is possible to customize the allowed alpha characters, see [Customize supported characters](customization.html#customize-supported-characters) for more information. - - -

Data types #

- -The expression parser supports booleans, numbers, complex numbers, units, -strings, matrices, and objects. - - -

Booleans #

- -Booleans `true` and `false` can be used in expressions. - -```js -// use booleans -math.evaluate('true') // true -math.evaluate('false') // false -math.evaluate('(2 == 3) == false') // true -``` - -Booleans can be converted to numbers and strings and vice versa using the -functions `number` and `boolean`, and `string`. - -```js -// convert booleans -math.evaluate('number(true)') // 1 -math.evaluate('string(false)') // "false" -math.evaluate('boolean(1)') // true -math.evaluate('boolean("false")') // false -``` - - -

Numbers #

- -The most important and basic data type in math.js are numbers. Numbers use a -point as decimal mark. Numbers can be entered with exponential notation. -Examples: - -```js -// numbers in math.js -math.evaluate('2') // 2 -math.evaluate('3.14') // 3.14 -math.evaluate('1.4e3') // 1400 -math.evaluate('22e-3') // 0.022 -``` - -A number can be converted to a string and vice versa using the functions -`number` and `string`. - -```js -// convert a string into a number -math.evaluate('number("2.3")') // 2.3 -math.evaluate('string(2.3)') // "2.3" -``` - -Math.js uses regular JavaScript numbers, which are floating points with a -limited precision and limited range. The limitations are described in detail -on the page [Numbers](../datatypes/numbers.html). - -```js -math.evaluate('1e-325') // 0 -math.evaluate('1e309') // Infinity -math.evaluate('-1e309') // -Infinity -``` - -When doing calculations with floats, one can very easily get round-off errors: - -```js -// round-off error due to limited floating point precision -math.evaluate('0.1 + 0.2') // 0.30000000000000004 -``` - -When outputting results, the function `math.format` can be used to hide -these round-off errors when outputting results for the user: - -```js -const ans = math.evaluate('0.1 + 0.2') // 0.30000000000000004 -math.format(ans, {precision: 14}) // "0.3" -``` - -Numbers can be expressed as binary, octal, and hexadecimal literals: - -```js -math.evaluate('0b11') // 3 -math.evaluate('0o77') // 63 -math.evaluate('0xff') // 255 -``` - -A word size suffix can be used to change the behavior of non decimal literal evaluation: - -```js -math.evaluate('0xffi8') // -1 -math.evaluate('0xffffffffi32') // -1 -math.evaluate('0xfffffffffi32') // SyntaxError: String "0xfffffffff" is out of range -``` - -Non decimal numbers can include a radix point: -```js -math.evaluate('0b1.1') // 1.5 -math.evaluate('0o1.4') // 1.5 -math.evaluate('0x1.8') // 1.5 -``` - -Numbers can be formatted as binary, octal, and hex strings using the `notation` option of the `format` function: - -```js -math.evaluate('format(3, {notation: "bin"})') // '0b11' -math.evaluate('format(63, {notation: "oct"})') // '0o77' -math.evaluate('format(255, {notation: "hex"})') // '0xff' -math.evaluate('format(-1, {notation: "hex"})') // '-0x1' -math.evaluate('format(2.3, {notation: "hex"})') // '0x2.4cccccccccccc' -``` - -The `format` function accepts a `wordSize` option to use in conjunction with the non binary notations: - -```js -math.evaluate('format(-1, {notation: "hex", wordSize: 8})') // '0xffi8' -``` - -The functions `bin`, `oct`, and `hex` are shorthand for the `format` function with `notation` set accordingly: - -```js -math.evaluate('bin(-1)') // '-0b1' -math.evaluate('bin(-1, 8)') // '0b11111111i8' -``` - -

BigNumbers #

- -Math.js supports BigNumbers for calculations with an arbitrary precision. -The pros and cons of Number and BigNumber are explained in detail on the page -[Numbers](../datatypes/numbers.html). - -BigNumbers are slower but have a higher precision. Calculations with big -numbers are supported only by arithmetic functions. - -BigNumbers can be created using the `bignumber` function: - -```js -math.evaluate('bignumber(0.1) + bignumber(0.2)') // BigNumber, 0.3 -``` - -The default number type of the expression parser can be changed at instantiation -of math.js. The expression parser parses numbers as BigNumber by default: - -```js -// Configure the type of number: 'number' (default), 'BigNumber', or 'Fraction' -math.config({number: 'BigNumber'}) - -// all numbers are parsed as BigNumber -math.evaluate('0.1 + 0.2') // BigNumber, 0.3 -``` - -BigNumbers can be converted to numbers and vice versa using the functions -`number` and `bignumber`. When converting a BigNumber to a Number, the high -precision of the BigNumber will be lost. When a BigNumber is too large to be represented -as Number, it will be initialized as `Infinity`. - - -

Complex numbers #

- -Complex numbers can be created using the imaginary unit `i`, which is defined -as `i^2 = -1`. Complex numbers have a real and complex part, which can be -retrieved using the functions `re` and `im`. - -```js -const parser = math.parser() - -// create complex numbers -parser.evaluate('a = 2 + 3i') // Complex, 2 + 3i -parser.evaluate('b = 4 - i') // Complex, 4 - i - -// get real and imaginary part of a complex number -parser.evaluate('re(a)') // Number, 2 -parser.evaluate('im(a)') // Number, 3 - -// calculations with complex numbers -parser.evaluate('a + b') // Complex, 6 + 2i -parser.evaluate('a * b') // Complex, 11 + 10i -parser.evaluate('i * i') // Number, -1 -parser.evaluate('sqrt(-4)') // Complex, 2i -``` - - -

Units #

- -math.js supports units. Units can be used in the arithmetic operations -add, subtract, multiply, divide, and exponentiation. -Units can also be converted from one to another. -An overview of all available units can be found on the page -[Units](../datatypes/units.html). - -Units can be converted using the operator `to` or `in`. - -```js -// create a unit -math.evaluate('5.4 kg') // Unit, 5.4 kg - -// convert a unit -math.evaluate('2 inch to cm') // Unit, 5.08 cm -math.evaluate('20 celsius in fahrenheit') // Unit, ~68 fahrenheit -math.evaluate('90 km/h to m/s') // Unit, 25 m / s - -// convert a unit to a number -// A second parameter with the unit for the exported number must be provided -math.evaluate('number(5 cm, mm)') // Number, 50 - -// calculations with units -math.evaluate('0.5kg + 33g') // Unit, 0.533 kg -math.evaluate('3 inch + 2 cm') // Unit, 3.7874 inch -math.evaluate('3 inch + 2 cm') // Unit, 3.7874 inch -math.evaluate('12 seconds * 2') // Unit, 24 seconds -math.evaluate('sin(45 deg)') // Number, 0.7071067811865475 -math.evaluate('9.81 m/s^2 * 5 s to mi/h') // Unit, 109.72172512527 mi / h -``` - - -

Strings #

- -Strings are enclosed by double quotes " or single quotes '. Strings can be concatenated using the -function `concat` (not by adding them using `+` like in JavaScript). Parts of -a string can be retrieved or replaced by using indexes. Strings can be converted -to a number using function `number`, and numbers can be converted to a string -using function `string`. - -When setting the value of a character in a string, the character that has been -set is returned. Likewise, when a range of characters is set, that range of -characters is returned. - - -```js -const parser = math.parser() - -// create a string -parser.evaluate('"hello"') // String, "hello" - -// string manipulation -parser.evaluate('a = concat("hello", " world")') // String, "hello world" -parser.evaluate('size(a)') // Matrix [11] -parser.evaluate('a[1:5]') // String, "hello" -parser.evaluate('a[1] = "H"') // String, "H" -parser.evaluate('a[7:12] = "there!"') // String, "there!" -parser.evaluate('a') // String, "Hello there!" - -// string conversion -parser.evaluate('number("300")') // Number, 300 -parser.evaluate('string(300)') // String, "300" -``` - -Strings can be used in the `evaluate` function, to parse expressions inside -the expression parser: - -```js -math.evaluate('evaluate("2 + 3")') // 5 -``` - - -

Matrices #

- -Matrices can be created by entering a series of values between square brackets, -elements are separated by a comma `,`. -A matrix like `[1, 2, 3]` will create a vector, a 1-dimensional matrix with -size `[3]`. To create a multi-dimensional matrix, matrices can be nested into -each other. For easier creation of two-dimensional matrices, a semicolon `;` -can be used to separate rows in a matrix. - -```js -// create a matrix -math.evaluate('[1, 2, 3]') // Matrix, size [3] -math.evaluate('[[1, 2, 3], [4, 5, 6]]') // Matrix, size [2, 3] -math.evaluate('[[[1, 2], [3, 4]], [[5, 6], [7, 8]]]') // Matrix, size [2, 2, 2] - -// create a two dimensional matrix -math.evaluate('[1, 2, 3; 4, 5, 6]') // Matrix, size [2, 3] -``` - -Another way to create filled matrices is using the functions `zeros`, `ones`, -`identity`, and `range`. - -```js -// initialize a matrix with ones or zeros -math.evaluate('zeros(3, 2)') // Matrix, [[0, 0], [0, 0], [0, 0]], size [3, 2] -math.evaluate('ones(3)') // Matrix, [1, 1, 1], size [3] -math.evaluate('5 * ones(2, 2)') // Matrix, [[5, 5], [5, 5]], size [2, 2] - -// create an identity matrix -math.evaluate('identity(2)') // Matrix, [[1, 0], [0, 1]], size [2, 2] - -// create a range -math.evaluate('1:4') // Matrix, [1, 2, 3, 4], size [4] -math.evaluate('0:2:10') // Matrix, [0, 2, 4, 6, 8, 10], size [6] -``` - -A subset can be retrieved from a matrix using indexes and a subset of a matrix -can be replaced by using indexes. Indexes are enclosed in square brackets, and -contain a number or a range for each of the matrix dimensions. A range can have -its start and/or end undefined. When the start is undefined, the range will start -at 1, when the end is undefined, the range will end at the end of the matrix. - -There is a context variable `end` available as well to denote the end of the -matrix. This variable cannot be used in multiple nested indices. In that case, -`end` will be resolved as the end of the innermost matrix. To solve this, -resolving of the nested index needs to be split in two separate operations. - -*IMPORTANT: matrix indexes and ranges work differently from the math.js indexes -in JavaScript: They are one-based with an included upper-bound, similar to most -math applications.* - -```js -parser = math.parser() - -// create matrices -parser.evaluate('a = [1, 2; 3, 4]') // Matrix, [[1, 2], [3, 4]] -parser.evaluate('b = zeros(2, 2)') // Matrix, [[0, 0], [0, 0]] -parser.evaluate('c = 5:9') // Matrix, [5, 6, 7, 8, 9] - -// replace a subset in a matrix -parser.evaluate('b[1, 1:2] = [5, 6]') // Matrix, [[5, 6], [0, 0]] -parser.evaluate('b[2, :] = [7, 8]') // Matrix, [[5, 6], [7, 8]] - -// perform a matrix calculation -parser.evaluate('d = a * b') // Matrix, [[19, 22], [43, 50]] - -// retrieve a subset of a matrix -parser.evaluate('d[2, 1]') // 43 -parser.evaluate('d[2, 1:end]') // Matrix, [[43, 50]] -parser.evaluate('c[end - 1 : -1 : 2]') // Matrix, [8, 7, 6] -``` - -

Objects #

- -Objects in math.js work the same as in languages like JavaScript and Python. -An object is enclosed by curly brackets `{`, `}`, and contains a set of -comma separated key/value pairs. Keys and values are separated by a colon `:`. -Keys can be a symbol like `prop` or a string like `"prop"`. - -```js -math.evaluate('{a: 2 + 1, b: 4}') // {a: 3, b: 4} -math.evaluate('{"a": 2 + 1, "b": 4}') // {a: 3, b: 4} -``` - -Objects can contain objects: - -```js -math.evaluate('{a: 2, b: {c: 3, d: 4}}') // {a: 2, b: {c: 3, d: 4}} -``` - -Object properties can be retrieved or replaced using dot notation or bracket -notation. Unlike JavaScript, when setting a property value, the whole object -is returned, not the property value - -```js -let scope = { - obj: { - prop: 42 - } -} - -// retrieve properties -math.evaluate('obj.prop', scope) // 42 -math.evaluate('obj["prop"]', scope) // 42 - -// set properties (returns the whole object, not the property value!) -math.evaluate('obj.prop = 43', scope) // {prop: 43} -math.evaluate('obj["prop"] = 43', scope) // {prop: 43} -scope.obj // {prop: 43} -``` - - -

Multi-line expressions #

- -An expression can contain multiple lines, and expressions can be spread over -multiple lines. Lines can be separated by a newline character `\n` or by a -semicolon `;`. Output of statements followed by a semicolon will be hidden from -the output, and empty lines are ignored. The output is returned as a `ResultSet`, -with an entry for every visible statement. - -```js -// a multi-line expression -math.evaluate('1 * 3 \n 2 * 3 \n 3 * 3') // ResultSet, [3, 6, 9] - -// semicolon statements are hidden from the output -math.evaluate('a=3; b=4; a + b \n a * b') // ResultSet, [7, 12] - -// single expression spread over multiple lines -math.evaluate('a = 2 +\n 3') // 5 -math.evaluate('[\n 1, 2;\n 3, 4\n]') // Matrix, [[1, 2], [3, 4]] -``` - -The results can be read from a `ResultSet` via the property `ResultSet.entries` -which is an `Array`, or by calling `ResultSet.valueOf()`, which returns the -array with results. - - -

Implicit multiplication #

- -*Implicit multiplication* means the multiplication of two symbols, numbers, or a grouped expression inside parentheses without using the `*` operator. This type of syntax allows a more natural way to enter expressions. For example: - -```js -math.evaluate('2 pi') // 6.283185307179586 -math.evaluate('(1+2)(3+4)') // 21 -``` - -Parentheses are parsed as a function call when there is a symbol or accessor on -the left hand side, like `sqrt(4)` or `obj.method(4)`. In other cases the -parentheses are interpreted as an implicit multiplication. - -Math.js will always evaluate implicit multiplication before explicit multiplication `*`, so that the expression `x * y z` is parsed as `x * (y * z)`. Math.js also gives implicit multiplication higher precedence than division, *except* when the division matches the pattern `[unaryPrefixOp]?[number] / [number] [symbol]` or `[unaryPrefixOp]?[number] / [number] [left paren]`. In that special case, the division is evaluated first: - -```js -math.evaluate('20 kg / 4 kg') // 5 Evaluated as (20 kg) / (4 kg) -math.evaluate('20 / 4 kg') // 5 kg Evaluated as (20 / 4) kg -``` - -The behavior of implicit multiplication can be summarized by these operator precedence rules, listed from highest to lowest precedence: - -- Function calls: `[symbol] [left paren]` -- Explicit division `/` when the division matches this pattern: `[+-~]?[number] / [+-~]?[number] [symbol]` or `[number] / [number] [left paren]` -- Implicit multiplication -- All other division `/` and multiplication `*` - -Implicit multiplication is tricky as there can appear to be ambiguity in how an expression will be evaluated. Experience has shown that the above rules most closely match user intent when entering expressions that could be interpreted different ways. It's also possible that these rules could be tweaked in future major releases. Use implicit multiplication carefully. If you don't like the uncertainty introduced by implicit multiplication, use explicit `*` operators and parentheses to ensure your expression is evaluated the way you intend. - -Here are some more examples using implicit multiplication: - -Expression | Evaluated as | Result ---------------- | ------------------- | ------------------ -(1 + 3) pi | (1 + 3) * pi | 12.566370614359172 -(4 - 1) 2 | (4 - 1) * 2 | 6 -3 / 4 mm | (3 / 4) * mm | 0.75 mm -2 + 3 i | 2 + (3 * i) | 2 + 3i -(1 + 2) (4 - 2) | (1 + 2) * (4 - 2) | 6 -sqrt(4) (1 + 2) | sqrt(4) * (1 + 2) | 6 -8 pi / 2 pi | (8 * pi) / (2 * pi) | 4 -pi / 2 pi | pi / (2 * pi) | 0.5 -1 / 2i | (1 / 2) * i | 0.5 i -8.314 J / mol K | 8.314 J / (mol * K) | 8.314 J / (mol * K) - - -

Comments #

- -Comments can be added to explain or describe calculations in the text. A comment -starts with a sharp sign character `#`, and ends at the end of the line. A line -can contain a comment only, or can contain an expression followed by a comment. - -```js -const parser = math.parser() - -parser.evaluate('# define some variables') -parser.evaluate('width = 3') // 3 -parser.evaluate('height = 4') // 4 -parser.evaluate('width * height # calculate the area') // 12 -``` diff --git a/docs/getting_started.md b/docs/getting_started.md deleted file mode 100644 index e12c510578..0000000000 --- a/docs/getting_started.md +++ /dev/null @@ -1,128 +0,0 @@ ---- -layout: default ---- - -

Getting Started #

- -This getting started describes how to install, load, and use math.js. - - -

Install #

- -Math.js can be installed using various package managers like [npm](https://npmjs.org/), or by just downloading the library from the website: [https://mathjs.org/download.html](https://mathjs.org/download.html). - -To install via npm, run: - - npm install mathjs - -Other ways to install math.js are described on the [website](https://mathjs.org/download.html). - - -

Load #

- -Math.js can be used in node.js and in the browser. The library must be loaded -and instantiated. When creating an instance, one can optionally provide -configuration options as described in -[Configuration](core/configuration.html). - -

ES modules #

- -Load the functions you need and use them: - -```js -import { sqrt } from 'mathjs' - -console.log(sqrt(-4).toString()) // 2i -``` - -To use lightweight, number only implementations of all functions: - -```js -import { sqrt } from 'mathjs/number' - -console.log(sqrt(4).toString()) // 2 -console.log(sqrt(-4).toString()) // NaN -``` - -You can create a mathjs instance allowing [configuration](core/configuration.html) and importing of external functions as follows: - -```js -import { create, all } from 'mathjs' - -const config = { } -const math = create(all, config) - -console.log(math.sqrt(-4).toString()) // 2i -``` - -How to optimize your bundle size using tree-shaking is described on the page -[Custom bundling](custom_bundling.html). - - -

Node.js #

- -Load math.js in [node.js](https://nodejs.org/) (CommonJS module system): - -```js -const { sqrt } = require('mathjs') - -console.log(sqrt(-4).toString()) // 2i -``` - - -

Browser #

- -Math.js can be loaded as a regular JavaScript file in the browser, use the global -variable `math` to access the libary once loaded: - -```html - - - - - - - - - -``` - -

Use #

- -Math.js can be used similar to JavaScript's built-in Math library. Besides that, -math.js can evaluate expressions (see [Expressions](expressions/index.html)) and -supports chaining (see [Chaining](core/chaining.html)). - -The example code below shows how to use math.js. More examples can be found in the -section [Examples](https://mathjs.org/examples/index.html). - -```js -// functions and constants -math.round(math.e, 3) // 2.718 -math.atan2(3, -3) / math.pi // 0.75 -math.log(10000, 10) // 4 -math.sqrt(-4) // 2i -math.pow([[-1, 2], [3, 1]], 2) // [[7, 0], [0, 7]] - -// expressions -math.evaluate('12 / (2.3 + 0.7)') // 4 -math.evaluate('12.7 cm to inch') // 5 inch -math.evaluate('sin(45 deg) ^ 2') // 0.5 -math.evaluate('9 / 3 + 2i') // 3 + 2i -math.evaluate('det([-1, 2; 3, 1])') // -7 - -// chained operations -math.chain(3) - .add(4) - .multiply(2) - .done() // 14 -``` - -

Next #

- -To learn more about math.js, check out the available documentation and examples: - -- [Documentation](index.html) -- [Examples](https://mathjs.org/examples/index.html) diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index 95cd5dc906..0000000000 --- a/docs/index.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -layout: default ---- - -

Documentation #

- -[Math.js](https://mathjs.org) 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. - -Math.js can be used in the browser, in node.js and in any JavaScript engine. Installation and download instructions are available on the [Download page](https://mathjs.org/download.html) of the website. - -

Getting Started #

- -- [Getting Started](getting_started.html) -- [Examples](//mathjs.org/examples/index.html) - -

Documentation #

- -- **[Core](core/index.html)** - - [Configuration](core/configuration.html) - - [Chaining](core/chaining.html) - - [Extension](core/extension.html) - - [Serialization](core/serialization.html) -- **[Expressions](expressions/index.html)** - - [Parsing and evaluation](expressions/parsing.html) - - [Syntax](expressions/syntax.html) - - [Expression trees](expressions/expression_trees.html) - - [Algebra](expressions/algebra.html) - - [Customization](expressions/customization.html) - - [Security](expressions/security.html) -- **[Data Types](datatypes/index.html)** - - [Numbers](datatypes/numbers.html) - - [BigNumbers](datatypes/bignumbers.html) - - [bigints](datatypes/bigints.html) - - [Fractions](datatypes/fractions.html) - - [Complex Numbers](datatypes/complex_numbers.html) - - [Matrices](datatypes/matrices.html) - - [Units](datatypes/units.html) -- **[Reference](reference/index.html)** - - [Classes](reference/classes.html) - - [Functions](reference/functions.html) - - [Constants](reference/constants.html) -- [Custom bundling](custom_bundling.html) -- [Command Line Interface](command_line_interface.html) -- [History](../history.html) diff --git a/docs/reference/classes.md b/docs/reference/classes.md deleted file mode 100644 index a546ca4b91..0000000000 --- a/docs/reference/classes.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -layout: default ---- - - -

Class Reference #

- -This page lists all the various class types in Math.js. Every top-level function is listed here and links to its detailed reference to other parts of the documentation. - -

math #

- -The "math" namespace contains the entire math.js functionality. All of the mathematical functions are available in the "math" namespace, and allow for inputs of various types. - -- [Function reference](functions.html) -- [Constant reference](constants.html) - - -

Unit #

- -Stores values for a scalar unit and its postfix. (eg `100 mm` or `100 kg`). Although the `Unit` class contains public functions documented as follows, using the following API directly is *not* recommended. Prefer using the functions in the "math" namespace wherever possible. - -- [Overview](../datatypes/units.html) -- [Class API](classes/unit.html) - - -

Fraction #

- -Stores values for a fractional number. - -- [Overview](../datatypes/fractions.html) -- [Class API](https://github.com/rawify/Fraction.js) - -

BigNumber #

- -Stores values for a arbitrary-precision floating point number. - -- [Overview](../datatypes/bignumbers.html) -- [Class API](https://mikemcl.github.io/decimal.js/) - - -

Matrix #

- -Two types of matrix classes are available in math.js, for storage of dense and sparse matrices. Although they contain public functions documented as follows, using the following API directly is *not* recommended. Prefer using the functions in the "math" namespace wherever possible. - -- [Overview](../datatypes/matrices.html) -- [DenseMatrix](classes/densematrix.html) -- [SparseMatrix](classes/sparsematrix.html) - -Classes used internally that may be of use to developers: - -- [Index](classes/matrixindex.html) -- [Range](classes/matrixrange.html) -- [ResultSet](classes/resultset.html) -- [FibonacciHeap](classes/fibonacciheap.html) - -

Complex #

- -Stores values for a complex number. - -- [Overview](../datatypes/complex_numbers.html) -- [Class API](https://github.com/infusion/Complex.js/) - -

Parser #

- -The Parser object returned by `math.parser()`. - -- [Overview](../expressions/parsing.html) - -

Node #

- -A node in an expression-tree, which can be used to analyze, manipulate, and evaluate expressions. - -- [Overview](../expressions/expression_trees.html) - -`Node` is the base class of all other node classes: - -- [AccessorNode](../expressions/expression_trees.html#accessornode) -- [ArrayNode](../expressions/expression_trees.html#arraynode) -- [AssignmentNode](../expressions/expression_trees.html#assignmentnode) -- [BlockNode](../expressions/expression_trees.html#blocknode) -- [ConditionalNode](../expressions/expression_trees.html#conditionalnode) -- [ConstantNode](../expressions/expression_trees.html#constantnode) -- [FunctionAssignmentNode](../expressions/expression_trees.html#functionassignmentnode) -- [FunctionNode](../expressions/expression_trees.html#functionnode) -- [IndexNode](../expressions/expression_trees.html#indexnode) -- [ObjectNode](../expressions/expression_trees.html#objectnode) -- [OperatorNode](../expressions/expression_trees.html#operatornode) -- [ParenthesisNode](../expressions/expression_trees.html#parenthesisnode) -- [RangeNode](../expressions/expression_trees.html#rangenode) -- [SymbolNode](../expressions/expression_trees.html#symbolnode) diff --git a/docs/reference/classes/densematrix.md b/docs/reference/classes/densematrix.md deleted file mode 100644 index 2342745fc9..0000000000 --- a/docs/reference/classes/densematrix.md +++ /dev/null @@ -1,251 +0,0 @@ ---- -layout: default ---- - - -

DenseMatrix #

-Dense Matrix implementation. This type implements an efficient Array format -for dense matrices. - -* _instance_ - * [.storage()](#DenseMatrix+storage) ⇒ string - * [.datatype()](#DenseMatrix+datatype) ⇒ string - * [.create(data, [datatype])](#DenseMatrix+create) - * [.subset(index, [replacement], [defaultValue])](#DenseMatrix+subset) - * [.get(index)](#DenseMatrix+get) ⇒ \* - * [.set(index, value, [defaultValue])](#DenseMatrix+set) ⇒ DenseMatrix - * [.resize(size, [defaultValue], [copy])](#DenseMatrix+resize) ⇒ Matrix - * [.clone()](#DenseMatrix+clone) ⇒ DenseMatrix - * [.size()](#DenseMatrix+size) ⇒ Array.<number> - * [.map(callback)](#DenseMatrix+map) ⇒ DenseMatrix - * [.forEach(callback)](#DenseMatrix+forEach) - * [.toArray()](#DenseMatrix+toArray) ⇒ Array - * [.valueOf()](#DenseMatrix+valueOf) ⇒ Array - * [.format([options])](#DenseMatrix+format) ⇒ string - * [.toString()](#DenseMatrix+toString) ⇒ string - * [.toJSON()](#DenseMatrix+toJSON) ⇒ Object - * [.diagonal([k])](#DenseMatrix+diagonal) ⇒ Array - * [.swapRows(i, j)](#DenseMatrix+swapRows) ⇒ Matrix -* _static_ - * [.diagonal(size, value, [k], [defaultValue])](#DenseMatrix.diagonal) ⇒ DenseMatrix - * [.fromJSON(json)](#DenseMatrix.fromJSON) ⇒ DenseMatrix - * [.preprocess(data)](#DenseMatrix.preprocess) ⇒ Array - - -

denseMatrix.storage() ⇒ string #

-Get the storage format used by the matrix. - -Usage: - -```js -const format = matrix.storage() // retrieve storage format -``` - -**Kind**: instance method of DenseMatrix -**Returns**: string - The storage format. - -

denseMatrix.datatype() ⇒ string #

-Get the datatype of the data stored in the matrix. - -Usage: - -```js -const format = matrix.datatype() // retrieve matrix datatype -``` - -**Kind**: instance method of DenseMatrix -**Returns**: string - The datatype. - -

denseMatrix.create(data, [datatype]) #

-Create a new DenseMatrix - -**Kind**: instance method of DenseMatrix - -| Param | Type | -| --- | --- | -| data | Array | -| [datatype] | string | - - -

denseMatrix.subset(index, [replacement], [defaultValue]) #

-Get a subset of the matrix, or replace a subset of the matrix. - -Usage: - -```js -const subset = matrix.subset(index) // retrieve subset -const value = matrix.subset(index, replacement) // replace subset -``` - -**Kind**: instance method of DenseMatrix - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| index | Index | | | -| [replacement] | Array | DenseMatrix| \* | | | -| [defaultValue] | \* | 0 | Default value, filled in on new entries when the matrix is resized. If not provided, new matrix elements will be filled with zeros. | - - -

denseMatrix.get(index) ⇒ \* #

-Get a single element from the matrix. - -**Kind**: instance method of DenseMatrix -**Returns**: \* - value - -| Param | Type | Description | -| --- | --- | --- | -| index | Array.<number> | Zero-based index | - - -

denseMatrix.set(index, value, [defaultValue]) ⇒ DenseMatrix #

-Replace a single element in the matrix. - -**Kind**: instance method of DenseMatrix -**Returns**: DenseMatrix- self - -| Param | Type | Description | -| --- | --- | --- | -| index | Array.<number> | Zero-based index | -| value | \* | | -| [defaultValue] | \* | Default value, filled in on new entries when the matrix is resized. If not provided, new matrix elements will be left undefined. | - - -

denseMatrix.resize(size, [defaultValue], [copy]) ⇒ Matrix #

-Resize the matrix to the given size. Returns a copy of the matrix when -`copy=true`, otherwise return the matrix itself (resize in place). - -**Kind**: instance method of DenseMatrix -**Returns**: Matrix - The resized matrix - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| size | Array.<number> | | The new size the matrix should have. | -| [defaultValue] | \* | 0 | Default value, filled in on new entries. If not provided, the matrix elements will be filled with zeros. | -| [copy] | boolean | | Return a resized copy of the matrix | - - -

denseMatrix.clone() ⇒ DenseMatrix #

-Create a clone of the matrix - -**Kind**: instance method of DenseMatrix -**Returns**: DenseMatrix- clone - -

denseMatrix.size() ⇒ Array.<number> #

-Retrieve the size of the matrix. - -**Kind**: instance method of DenseMatrix -**Returns**: Array.<number> - size - -

denseMatrix.map(callback) ⇒ DenseMatrix #

-Create a new matrix with the results of the callback function executed on -each entry of the matrix. - -**Kind**: instance method of DenseMatrix -**Returns**: DenseMatrix- matrix - -| Param | Type | Description | -| --- | --- | --- | -| callback | function | The callback function is invoked with three parameters: the value of the element, the index of the element, and the Matrix being traversed. | - - -

denseMatrix.forEach(callback) #

-Execute a callback function on each entry of the matrix. - -**Kind**: instance method of DenseMatrix - -| Param | Type | Description | -| --- | --- | --- | -| callback | function | The callback function is invoked with three parameters: the value of the element, the index of the element, and the Matrix being traversed. | - - -

denseMatrix.toArray() ⇒ Array #

-Create an Array with a copy of the data of the DenseMatrix - -**Kind**: instance method of DenseMatrix -**Returns**: Array - array - -

denseMatrix.valueOf() ⇒ Array #

-Get the primitive value of the DenseMatrix: a multidimensional array - -**Kind**: instance method of DenseMatrix -**Returns**: Array - array - -

denseMatrix.format([options]) ⇒ string #

-Get a string representation of the matrix, with optional formatting options. - -**Kind**: instance method of DenseMatrix -**Returns**: string - str - -| Param | Type | Description | -| --- | --- | --- | -| [options] | Object | number | function | Formatting options. See lib/utils/number:format for a description of the available options. | - - -

denseMatrix.toString() ⇒ string #

-Get a string representation of the matrix - -**Kind**: instance method of DenseMatrix -**Returns**: string - str - -

denseMatrix.toJSON() ⇒ Object #

-Get a JSON representation of the matrix - -**Kind**: instance method of DenseMatrix - -

denseMatrix.diagonal([k]) ⇒ Array #

-Get the kth Matrix diagonal. - -**Kind**: instance method of DenseMatrix -**Returns**: Array - The array vector with the diagonal values. - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [k] | number | BigNumber | 0 | The kth diagonal where the vector will retrieved. | - - -

denseMatrix.swapRows(i, j) ⇒ Matrix #

-Swap rows i and j in Matrix. - -**Kind**: instance method of DenseMatrix -**Returns**: Matrix - The matrix reference - -| Param | Type | Description | -| --- | --- | --- | -| i | number | Matrix row index 1 | -| j | number | Matrix row index 2 | - - -

DenseMatrix.diagonal(size, value, [k], [defaultValue]) ⇒ DenseMatrix #

-Create a diagonal matrix. - -**Kind**: static method of DenseMatrix - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| size | Array | | The matrix size. | -| value | number | Array | | The values for the diagonal. | -| [k] | number | BigNumber | 0 | The kth diagonal where the vector will be filled in. | -| [defaultValue] | number | | The default value for non-diagonal | - - -

DenseMatrix.fromJSON(json) ⇒ DenseMatrix #

-Generate a matrix from a JSON object - -**Kind**: static method of DenseMatrix - -| Param | Type | Description | -| --- | --- | --- | -| json | Object | An object structured like `{"mathjs": "DenseMatrix", data: [], size: []}`, where mathjs is optional | - - -

DenseMatrix.preprocess(data) ⇒ Array #

-Preprocess data, which can be an Array or DenseMatrix with nested Arrays and -Matrices. Replaces all nested Matrices with Arrays - -**Kind**: static method of DenseMatrix -**Returns**: Array - data - -| Param | Type | -| --- | --- | -| data | Array | - diff --git a/docs/reference/classes/fibonacciheap.md b/docs/reference/classes/fibonacciheap.md deleted file mode 100644 index 5fc24c007b..0000000000 --- a/docs/reference/classes/fibonacciheap.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -layout: default ---- - - -

FibonacciHeap #

-* [new FibonacciHeap()](#new_FibonacciHeap_new) -* _instance_ - * [.insert()](#FibonacciHeap+insert) - * [.size()](#FibonacciHeap+size) - * [.clear()](#FibonacciHeap+clear) - * [.isEmpty()](#FibonacciHeap+isEmpty) - * [.extractMinimum()](#FibonacciHeap+extractMinimum) - * [.remove()](#FibonacciHeap+remove) -* _static_ - * [._decreaseKey()](#FibonacciHeap._decreaseKey) - * [._cut()](#FibonacciHeap._cut) - * [._cascadingCut()](#FibonacciHeap._cascadingCut) - * [._linkNodes()](#FibonacciHeap._linkNodes) - - -

new FibonacciHeap() #

-Creates a new instance of a Fibonacci Heap. - - -

fibonacciHeap.insert() #

-Inserts a new data element into the heap. No heap consolidation is performed at this time, the new node is simply inserted into the root list of this heap. Running time: O(1) actual. - -**Kind**: instance method of [FibonacciHeap](#FibonacciHeap) - -

fibonacciHeap.size() #

-Returns the number of nodes in heap. Running time: O(1) actual. - -**Kind**: instance method of [FibonacciHeap](#FibonacciHeap) - -

fibonacciHeap.clear() #

-Removes all elements from this heap. - -**Kind**: instance method of [FibonacciHeap](#FibonacciHeap) - -

fibonacciHeap.isEmpty() #

-Returns true if the heap is empty, otherwise false. - -**Kind**: instance method of [FibonacciHeap](#FibonacciHeap) - -

fibonacciHeap.extractMinimum() #

-Extracts the node with minimum key from heap. Amortized running time: O(log n). - -**Kind**: instance method of [FibonacciHeap](#FibonacciHeap) - -

fibonacciHeap.remove() #

-Removes a node from the heap given the reference to the node. The trees in the heap will be consolidated, if necessary. This operation may fail to remove the correct element if there are nodes with key value -Infinity. Running time: O(log n) amortized. - -**Kind**: instance method of [FibonacciHeap](#FibonacciHeap) - -

FibonacciHeap._decreaseKey() #

-Decreases the key value for a heap node, given the new value to take on. The structure of the heap may be changed and will not be consolidated. Running time: O(1) amortized. - -**Kind**: static method of [FibonacciHeap](#FibonacciHeap) - -

FibonacciHeap._cut() #

-The reverse of the link operation: removes node from the child list of parent. This method assumes that min is non-null. Running time: O(1). - -**Kind**: static method of [FibonacciHeap](#FibonacciHeap) - -

FibonacciHeap._cascadingCut() #

-Performs a cascading cut operation. This cuts node from its parent and then does the same for its parent, and so on up the tree. Running time: O(log n); O(1) excluding the recursion. - -**Kind**: static method of [FibonacciHeap](#FibonacciHeap) - -

FibonacciHeap._linkNodes() #

-Make the first node a child of the second one. Running time: O(1) actual. - -**Kind**: static method of [FibonacciHeap](#FibonacciHeap) diff --git a/docs/reference/classes/matrixindex.md b/docs/reference/classes/matrixindex.md deleted file mode 100644 index cf503c5e0e..0000000000 --- a/docs/reference/classes/matrixindex.md +++ /dev/null @@ -1,137 +0,0 @@ ---- -layout: default ---- - - -

Index #

-* [new Index(...ranges)](#new_Index_new) -* _instance_ - * [.valueOf](#Index+valueOf) ⇒ Array - * [.clone()](#Index+clone) ⇒ [Index](#Index) - * [.size()](#Index+size) ⇒ Array.<number> - * [.max()](#Index+max) ⇒ Array.<number> - * [.min()](#Index+min) ⇒ Array.<number> - * [.forEach(callback)](#Index+forEach) - * [.dimension(dim)](#Index+dimension) ⇒ Range | null - * [.isScalar()](#Index+isScalar) ⇒ boolean - * [.toArray()](#Index+toArray) ⇒ Array - * [.toString()](#Index+toString) ⇒ String - * [.toJSON()](#Index+toJSON) ⇒ Object -* _static_ - * [.fromJSON(json)](#Index.fromJSON) ⇒ [Index](#Index) - - -

new Index(...ranges) #

-Create an index. An Index can store ranges and sets for multiple dimensions. -Matrix.get, Matrix.set, and math.subset accept an Index as input. - -Usage: -```js -const index = new Index(range1, range2, matrix1, array1, ...) -``` - -Where each parameter can be any of: - -- A number -- An instance of Range -- An Array with the Set values -- A Matrix with the Set values - -The parameters start, end, and step must be integer numbers. - - -| Param | Type | -| --- | --- | -| ...ranges | \* | - - -

index.valueOf ⇒ Array #

-Get the primitive value of the Index, a two dimensional array. -Equivalent to Index.toArray(). - -**Kind**: instance property of [Index](#Index) -**Returns**: Array - array - -

index.clone() ⇒ [Index](#Index) #

-Create a clone of the index - -**Kind**: instance method of [Index](#Index) -**Returns**: [Index](#Index) - clone - -

index.size() ⇒ Array.<number> #

-Retrieve the size of the index, the number of elements for each dimension. - -**Kind**: instance method of [Index](#Index) -**Returns**: Array.<number> - size - -

index.max() ⇒ Array.<number> #

-Get the maximum value for each of the indexes ranges. - -**Kind**: instance method of [Index](#Index) -**Returns**: Array.<number> - max - -

index.min() ⇒ Array.<number> #

-Get the minimum value for each of the indexes ranges. - -**Kind**: instance method of [Index](#Index) -**Returns**: Array.<number> - min - -

index.forEach(callback) #

-Loop over each of the ranges of the index - -**Kind**: instance method of [Index](#Index) - -| Param | Type | Description | -| --- | --- | --- | -| callback | function | Called for each range with a Range as first argument, the dimension as second, and the index object as third. | - - -

index.dimension(dim) ⇒ Range | null #

-Retrieve the dimension for the given index - -**Kind**: instance method of [Index](#Index) -**Returns**: Range | null - range - -| Param | Type | Description | -| --- | --- | --- | -| dim | Number | Number of the dimension | - - -

index.isScalar() ⇒ boolean #

-Test whether this index contains only a single value. - -This is the case when the index is created with only scalar values as ranges, -not for ranges resolving into a single value. - -**Kind**: instance method of [Index](#Index) -**Returns**: boolean - isScalar - -

index.toArray() ⇒ Array #

-Expand the Index into an array. -For example new Index([0,3], [2,7]) returns [[0,1,2], [2,3,4,5,6]] - -**Kind**: instance method of [Index](#Index) -**Returns**: Array - array - -

index.toString() ⇒ String #

-Get the string representation of the index, for example '[2:6]' or '[0:2:10, 4:7, [1,2,3]]' - -**Kind**: instance method of [Index](#Index) -**Returns**: String - str - -

index.toJSON() ⇒ Object #

-Get a JSON representation of the Index - -**Kind**: instance method of [Index](#Index) -**Returns**: Object - Returns a JSON object structured as: - `{"mathjs": "Index", "ranges": [{"mathjs": "Range", start: 0, end: 10, step:1}, ...]}` - -

Index.fromJSON(json) ⇒ [Index](#Index) #

-Instantiate an Index from a JSON object - -**Kind**: static method of [Index](#Index) - -| Param | Type | Description | -| --- | --- | --- | -| json | Object | A JSON object structured as: `{"mathjs": "Index", "dimensions": [{"mathjs": "Range", start: 0, end: 10, step:1}, ...]}` | - diff --git a/docs/reference/classes/matrixrange.md b/docs/reference/classes/matrixrange.md deleted file mode 100644 index 64ee234f06..0000000000 --- a/docs/reference/classes/matrixrange.md +++ /dev/null @@ -1,162 +0,0 @@ ---- -layout: default ---- - - -

Range #

-* [new Range(start, end, [step])](#new_Range_new) -* _instance_ - * [.size()](#Range+size) ⇒ Array.<number> - * [.min()](#Range+min) ⇒ number | undefined - * [.max()](#Range+max) ⇒ number | undefined - * [.forEach(callback)](#Range+forEach) - * [.map(callback)](#Range+map) ⇒ Array - * [.toArray()](#Range+toArray) ⇒ Array - * [.valueOf()](#Range+valueOf) ⇒ Array - * [.format([options])](#Range+format) ⇒ string - * [.toString()](#Range+toString) ⇒ string - * [.toJSON()](#Range+toJSON) ⇒ Object -* _static_ - * [.parse(str)](#Range.parse) ⇒ [Range](#Range) | null - * [.fromJSON(json)](#Range.fromJSON) ⇒ [Range](#Range) - - -

new Range(start, end, [step]) #

-Create a range. A range has a start, step, and end, and contains functions -to iterate over the range. - -A range can be constructed as: - -```js -const range = new Range(start, end) -const range = new Range(start, end, step) -``` - -To get the result of the range: - -```js -range.forEach(function (x) { - console.log(x) -}) -range.map(function (x) { - return math.sin(x) -}) -range.toArray() -``` - -Example usage: - -```js -const c = new Range(2, 6) // 2:1:5 -c.toArray() // [2, 3, 4, 5] -const d = new Range(2, -3, -1) // 2:-1:-2 -d.toArray() // [2, 1, 0, -1, -2] -``` - -| Param | Type | Description | -| --- | --- | --- | -| start | number | included lower bound | -| end | number | excluded upper bound | -| [step] | number | step size, default value is 1 | - - -

range.size() ⇒ Array.<number> #

-Retrieve the size of the range. -Returns an array containing one number, the number of elements in the range. - -**Kind**: instance method of [Range](#Range) -**Returns**: Array.<number> - size - -

range.min() ⇒ number | undefined #

-Calculate the minimum value in the range - -**Kind**: instance method of [Range](#Range) -**Returns**: number | undefined - min - -

range.max() ⇒ number | undefined #

-Calculate the maximum value in the range - -**Kind**: instance method of [Range](#Range) -**Returns**: number | undefined - max - -

range.forEach(callback) #

-Execute a callback function for each value in the range. - -**Kind**: instance method of [Range](#Range) - -| Param | Type | Description | -| --- | --- | --- | -| callback | function | The callback method is invoked with three parameters: the value of the element, the index of the element, and the Range being traversed. | - - -

range.map(callback) ⇒ Array #

-Execute a callback function for each value in the Range, and return the -results as an array - -**Kind**: instance method of [Range](#Range) -**Returns**: Array - array - -| Param | Type | Description | -| --- | --- | --- | -| callback | function | The callback method is invoked with three parameters: the value of the element, the index of the element, and the Matrix being traversed. | - - -

range.toArray() ⇒ Array #

-Create an Array with a copy of the Ranges data - -**Kind**: instance method of [Range](#Range) -**Returns**: Array - array - -

range.valueOf() ⇒ Array #

-Get the primitive value of the Range, a one dimensional array - -**Kind**: instance method of [Range](#Range) -**Returns**: Array - array - -

range.format([options]) ⇒ string #

-Get a string representation of the range, with optional formatting options. -Output is formatted as 'start:step:end', for example '2:6' or '0:0.2:11' - -**Kind**: instance method of [Range](#Range) -**Returns**: string - str - -| Param | Type | Description | -| --- | --- | --- | -| [options] | Object | number | function | Formatting options. See lib/utils/number:format for a description of the available options. | - - -

range.toString() ⇒ string #

-Get a string representation of the range. - -**Kind**: instance method of [Range](#Range) - -

range.toJSON() ⇒ Object #

-Get a JSON representation of the range - -**Kind**: instance method of [Range](#Range) -**Returns**: Object - Returns a JSON object structured as: - `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}` - -

Range.parse(str) ⇒ [Range](#Range) | null #

-Parse a string into a range, -The string contains the start, optional step, and end, separated by a colon. -If the string does not contain a valid range, null is returned. -For example str='0:2:11'. - -**Kind**: static method of [Range](#Range) -**Returns**: [Range](#Range) | null - range - -| Param | Type | -| --- | --- | -| str | string | - - -

Range.fromJSON(json) ⇒ [Range](#Range) #

-Instantiate a Range from a JSON object - -**Kind**: static method of [Range](#Range) - -| Param | Type | Description | -| --- | --- | --- | -| json | Object | A JSON object structured as: `{"mathjs": "Range", "start": 2, "end": 4, "step": 1}` | - diff --git a/docs/reference/classes/resultset.md b/docs/reference/classes/resultset.md deleted file mode 100644 index 6a66283f5b..0000000000 --- a/docs/reference/classes/resultset.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: default ---- - - -

ResultSet #

-* [new ResultSet(entries)](#new_ResultSet_new) -* _instance_ - * [.valueOf()](#ResultSet+valueOf) ⇒ Array - * [.toString()](#ResultSet+toString) ⇒ string - * [.toJSON()](#ResultSet+toJSON) ⇒ Object -* _static_ - * [.fromJSON(json)](#ResultSet.fromJSON) ⇒ [ResultSet](#ResultSet) - - -

new ResultSet(entries) #

-A ResultSet contains a list or results - - -| Param | Type | -| --- | --- | -| entries | Array | - - -

resultSet.valueOf() ⇒ Array #

-Returns the array with results hold by this ResultSet - -**Kind**: instance method of [ResultSet](#ResultSet) -**Returns**: Array - entries - -

resultSet.toString() ⇒ string #

-Returns the stringified results of the ResultSet - -**Kind**: instance method of [ResultSet](#ResultSet) -**Returns**: string - string - -

resultSet.toJSON() ⇒ Object #

-Get a JSON representation of the ResultSet - -**Kind**: instance method of [ResultSet](#ResultSet) -**Returns**: Object - Returns a JSON object structured as: `{"mathjs": "ResultSet", "entries": [...]}` - -

ResultSet.fromJSON(json) ⇒ [ResultSet](#ResultSet) #

-Instantiate a ResultSet from a JSON object - -**Kind**: static method of [ResultSet](#ResultSet) - -| Param | Type | Description | -| --- | --- | --- | -| json | Object | A JSON object structured as: `{"mathjs": "ResultSet", "entries": [...]}` | - diff --git a/docs/reference/classes/sparsematrix.md b/docs/reference/classes/sparsematrix.md deleted file mode 100644 index fed2fa9fc3..0000000000 --- a/docs/reference/classes/sparsematrix.md +++ /dev/null @@ -1,249 +0,0 @@ ---- -layout: default ---- - - -

SparseMatrix #

-Sparse Matrix implementation. This type implements a Compressed Column Storage format -for sparse matrices. - -* _instance_ - * [.storage()](#SparseMatrix+storage) ⇒ string - * [.datatype()](#SparseMatrix+datatype) ⇒ string - * [.create(data, [datatype])](#SparseMatrix+create) - * [.density()](#SparseMatrix+density) ⇒ number - * [.subset(index, [replacement], [defaultValue])](#SparseMatrix+subset) - * [.get(index)](#SparseMatrix+get) ⇒ \* - * [.set(index, value, [defaultValue])](#SparseMatrix+set) ⇒ [SparseMatrix](#SparseMatrix) - * [.resize(size, [defaultValue], [copy])](#SparseMatrix+resize) ⇒ Matrix - * [.clone()](#SparseMatrix+clone) ⇒ [SparseMatrix](#SparseMatrix) - * [.size()](#SparseMatrix+size) ⇒ Array.<number> - * [.map(callback, [skipZeros])](#SparseMatrix+map) ⇒ [SparseMatrix](#SparseMatrix) - * [.forEach(callback, [skipZeros])](#SparseMatrix+forEach) - * [.toArray()](#SparseMatrix+toArray) ⇒ Array - * [.valueOf()](#SparseMatrix+valueOf) ⇒ Array - * [.format([options])](#SparseMatrix+format) ⇒ string - * [.toString()](#SparseMatrix+toString) ⇒ string - * [.toJSON()](#SparseMatrix+toJSON) ⇒ Object - * [.diagonal([k])](#SparseMatrix+diagonal) ⇒ Matrix - * [.swapRows(i, j)](#SparseMatrix+swapRows) ⇒ Matrix -* _static_ - * [.fromJSON(json)](#SparseMatrix.fromJSON) ⇒ [SparseMatrix](#SparseMatrix) - * [.diagonal(size, value, [k], [datatype])](#SparseMatrix.diagonal) ⇒ [SparseMatrix](#SparseMatrix) - - -

sparseMatrix.storage() ⇒ string #

-Get the storage format used by the matrix. - -Usage: -```js -const format = matrix.storage() // retrieve storage format -``` - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) -**Returns**: string - The storage format. - -

sparseMatrix.datatype() ⇒ string #

-Get the datatype of the data stored in the matrix. - -Usage: -```js -const format = matrix.datatype() // retrieve matrix datatype -``` - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) -**Returns**: string - The datatype. - -

sparseMatrix.create(data, [datatype]) #

-Create a new SparseMatrix - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) - -| Param | Type | -| --- | --- | -| data | Array | -| [datatype] | string | - - -

sparseMatrix.density() ⇒ number #

-Get the matrix density. - -Usage: -```js -const density = matrix.density() // retrieve matrix density -``` - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) -**Returns**: number - The matrix density. - -

sparseMatrix.subset(index, [replacement], [defaultValue]) #

-Get a subset of the matrix, or replace a subset of the matrix. - -Usage: -```js -const subset = matrix.subset(index) // retrieve subset -const value = matrix.subset(index, replacement) // replace subset -``` - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| index | Index | | | -| [replacement] | Array | Maytrix | \* | | | -| [defaultValue] | \* | 0 | Default value, filled in on new entries when the matrix is resized. If not provided, new matrix elements will be filled with zeros. | - - -

sparseMatrix.get(index) ⇒ \* #

-Get a single element from the matrix. - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) -**Returns**: \* - value - -| Param | Type | Description | -| --- | --- | --- | -| index | Array.<number> | Zero-based index | - - -

sparseMatrix.set(index, value, [defaultValue]) ⇒ [SparseMatrix](#SparseMatrix) #

-Replace a single element in the matrix. - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) -**Returns**: [SparseMatrix](#SparseMatrix) - self - -| Param | Type | Description | -| --- | --- | --- | -| index | Array.<number> | Zero-based index | -| value | \* | | -| [defaultValue] | \* | Default value, filled in on new entries when the matrix is resized. If not provided, new matrix elements will be set to zero. | - - -

sparseMatrix.resize(size, [defaultValue], [copy]) ⇒ Matrix #

-Resize the matrix to the given size. Returns a copy of the matrix when -`copy=true`, otherwise return the matrix itself (resize in place). - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) -**Returns**: Matrix - The resized matrix - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| size | Array.<number> | | The new size the matrix should have. | -| [defaultValue] | \* | 0 | Default value, filled in on new entries. If not provided, the matrix elements will be filled with zeros. | -| [copy] | boolean | | Return a resized copy of the matrix | - - -

sparseMatrix.clone() ⇒ [SparseMatrix](#SparseMatrix) #

-Create a clone of the matrix - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) -**Returns**: [SparseMatrix](#SparseMatrix) - clone - -

sparseMatrix.size() ⇒ Array.<number> #

-Retrieve the size of the matrix. - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) -**Returns**: Array.<number> - size - -

sparseMatrix.map(callback, [skipZeros]) ⇒ [SparseMatrix](#SparseMatrix) #

-Create a new matrix with the results of the callback function executed on -each entry of the matrix. - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) -**Returns**: [SparseMatrix](#SparseMatrix) - matrix - -| Param | Type | Description | -| --- | --- | --- | -| callback | function | The callback function is invoked with three parameters: the value of the element, the index of the element, and the Matrix being traversed. | -| [skipZeros] | boolean | Invoke callback function for non-zero values only. | - - -

sparseMatrix.forEach(callback, [skipZeros]) #

-Execute a callback function on each entry of the matrix. - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) - -| Param | Type | Description | -| --- | --- | --- | -| callback | function | The callback function is invoked with three parameters: the value of the element, the index of the element, and the Matrix being traversed. | -| [skipZeros] | boolean | Invoke callback function for non-zero values only. | - - -

sparseMatrix.toArray() ⇒ Array #

-Create an Array with a copy of the data of the SparseMatrix - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) -**Returns**: Array - array - -

sparseMatrix.valueOf() ⇒ Array #

-Get the primitive value of the SparseMatrix: a two dimensions array - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) -**Returns**: Array - array - -

sparseMatrix.format([options]) ⇒ string #

-Get a string representation of the matrix, with optional formatting options. - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) -**Returns**: string - str - -| Param | Type | Description | -| --- | --- | --- | -| [options] | Object | number | function | Formatting options. See lib/utils/number:format for a description of the available options. | - - -

sparseMatrix.toString() ⇒ string #

-Get a string representation of the matrix - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) -**Returns**: string - str - -

sparseMatrix.toJSON() ⇒ Object #

-Get a JSON representation of the matrix - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) - -

sparseMatrix.diagonal([k]) ⇒ Matrix #

-Get the kth Matrix diagonal. - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) -**Returns**: Matrix - The matrix vector with the diagonal values. - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [k] | number | BigNumber | 0 | The kth diagonal where the vector will retrieved. | - - -

sparseMatrix.swapRows(i, j) ⇒ Matrix #

-Swap rows i and j in Matrix. - -**Kind**: instance method of [SparseMatrix](#SparseMatrix) -**Returns**: Matrix - The matrix reference - -| Param | Type | Description | -| --- | --- | --- | -| i | number | Matrix row index 1 | -| j | number | Matrix row index 2 | - - -

SparseMatrix.fromJSON(json) ⇒ [SparseMatrix](#SparseMatrix) #

-Generate a matrix from a JSON object - -**Kind**: static method of [SparseMatrix](#SparseMatrix) - -| Param | Type | Description | -| --- | --- | --- | -| json | Object | An object structured like `{"mathjs": "SparseMatrix", "values": [], "index": [], "ptr": [], "size": []}`, where mathjs is optional | - - -

SparseMatrix.diagonal(size, value, [k], [datatype]) ⇒ [SparseMatrix](#SparseMatrix) #

-Create a diagonal matrix. - -**Kind**: static method of [SparseMatrix](#SparseMatrix) - -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| size | Array | | The matrix size. | -| value | number | Array | Matrix | | The values for the diagonal. | -| [k] | number | BigNumber | 0 | The kth diagonal where the vector will be filled in. | -| [datatype] | string | | The Matrix datatype, values must be of this datatype. | - diff --git a/docs/reference/classes/unit.md b/docs/reference/classes/unit.md deleted file mode 100644 index cb6cdb13dc..0000000000 --- a/docs/reference/classes/unit.md +++ /dev/null @@ -1,246 +0,0 @@ ---- -layout: default ---- - - -

Unit #

-* [new Unit([value], [name])](#new_Unit_new) -* _instance_ - * [.valueOf](#Unit+valueOf) ⇒ string - * [.clone()](#Unit+clone) ⇒ Unit - * [._isDerived()](#Unit+_isDerived) ⇒ boolean - * [.hasBase(base)](#Unit+hasBase) - * [.equalBase(other)](#Unit+equalBase) ⇒ boolean - * [.equals(other)](#Unit+equals) ⇒ boolean - * [.multiply(other)](#Unit+multiply) ⇒ Unit - * [.divide(other)](#Unit+divide) ⇒ Unit - * [.pow(p)](#Unit+pow) ⇒ Unit - * [.abs(x)](#Unit+abs) ⇒ Unit - * [.to(valuelessUnit)](#Unit+to) ⇒ Unit - * [.toNumber(valuelessUnit)](#Unit+toNumber) ⇒ number - * [.toNumeric(valuelessUnit)](#Unit+toNumeric) ⇒ number | BigNumber | Fraction - * [.toString()](#Unit+toString) ⇒ string - * [.toJSON()](#Unit+toJSON) ⇒ Object - * [.formatUnits()](#Unit+formatUnits) ⇒ string - * [.format([options])](#Unit+format) ⇒ string -* _static_ - * [.parse(str)](#Unit.parse) ⇒ Unit - * [.isValuelessUnit(name)](#Unit.isValuelessUnit) ⇒ boolean - * [.fromJSON(json)](#Unit.fromJSON) ⇒ Unit - - -

new Unit([value], [name]) #

-A unit can be constructed in the following ways: - -```js -const a = new Unit(value, name) -const b = new Unit(null, name) -const c = Unit.parse(str) -``` - -Example usage: - -```js -const a = new Unit(5, 'cm') // 50 mm -const b = Unit.parse('23 kg') // 23 kg -const c = math.in(a, new Unit(null, 'm') // 0.05 m -const d = new Unit(9.81, "m/s^2") // 9.81 m/s^2 -``` - -| Param | Type | Description | -| --- | --- | --- | -| [value] | number | BigNumber | Fraction | Complex | boolean | A value like 5.2 | -| [name] | string | A unit name like "cm" or "inch", or a derived unit of the form: "u1[^ex1] [u2[^ex2] ...] [/ u3[^ex3] [u4[^ex4]]]", such as "kg m^2/s^2", where each unit appearing after the forward slash is taken to be in the denominator. "kg m^2 s^-2" is a synonym and is also acceptable. Any of the units can include a prefix. | - - -

unit.valueOf ⇒ string #

-Returns the string representation of the unit. - -**Kind**: instance property of Unit - -

unit.clone() ⇒ Unit #

-create a copy of this unit - -**Kind**: instance method of Unit -**Returns**: Unit - Returns a cloned version of the unit - -

unit._isDerived() ⇒ boolean #

-Return whether the unit is derived (such as m/s, or cm^2, but not N) - -**Kind**: instance method of Unit -**Returns**: boolean - True if the unit is derived - -

unit.hasBase(base) #

-check if this unit has given base unit -If this unit is a derived unit, this will ALWAYS return false, since by definition base units are not derived. - -**Kind**: instance method of Unit - -| Param | Type | -| --- | --- | -| base | BASE_UNITS | STRING | undefined | - - -

unit.equalBase(other) ⇒ boolean #

-Check if this unit has a base or bases equal to another base or bases -For derived units, the exponent on each base also must match - -**Kind**: instance method of Unit -**Returns**: boolean - true if equal base - -| Param | Type | -| --- | --- | -| other | Unit | - - -

unit.equals(other) ⇒ boolean #

-Check if this unit equals another unit - -**Kind**: instance method of Unit -**Returns**: boolean - true if both units are equal - -| Param | Type | -| --- | --- | -| other | Unit | - - -

unit.multiply(other) ⇒ Unit #

-Multiply this unit with another one - -**Kind**: instance method of Unit -**Returns**: Unit - product of this unit and the other unit - -| Param | Type | -| --- | --- | -| other | Unit | - - -

unit.divide(other) ⇒ Unit #

-Divide this unit by another one - -**Kind**: instance method of Unit -**Returns**: Unit - result of dividing this unit by the other unit - -| Param | Type | -| --- | --- | -| other | Unit | - - -

unit.pow(p) ⇒ Unit #

-Calculate the power of a unit - -**Kind**: instance method of Unit -**Returns**: Unit - The result: this^p - -| Param | Type | -| --- | --- | -| p | number | Fraction | BigNumber | - - -

unit.abs(x) ⇒ Unit #

-Calculate the absolute value of a unit - -**Kind**: instance method of Unit -**Returns**: Unit - The result: |x|, absolute value of x - -| Param | Type | -| --- | --- | -| x | number | Fraction | BigNumber | - - -

unit.to(valuelessUnit) ⇒ Unit #

-Convert the unit to a specific unit name. - -**Kind**: instance method of Unit -**Returns**: Unit - Returns a clone of the unit with a fixed prefix and unit. - -| Param | Type | Description | -| --- | --- | --- | -| valuelessUnit | string | Unit | A unit without value. Can have prefix, like "cm" | - - -

unit.toNumber(valuelessUnit) ⇒ number #

-Return the value of the unit when represented with given valueless unit - -**Kind**: instance method of Unit -**Returns**: number - Returns the unit value as number. - -| Param | Type | Description | -| --- | --- | --- | -| valuelessUnit | string | Unit | For example 'cm' or 'inch' | - - -

unit.toNumeric(valuelessUnit) ⇒ number | BigNumber | Fraction #

-Return the value of the unit in the original numeric type - -**Kind**: instance method of Unit -**Returns**: number | BigNumber | Fraction - Returns the unit value - -| Param | Type | Description | -| --- | --- | --- | -| valuelessUnit | string | Unit | For example 'cm' or 'inch' | - - -

unit.toString() ⇒ string #

-Get a string representation of the unit. - -**Kind**: instance method of Unit - -

unit.toJSON() ⇒ Object #

-Get a JSON representation of the unit - -**Kind**: instance method of Unit -**Returns**: Object - Returns a JSON object structured as: - `{"mathjs": "Unit", "value": 2, "unit": "cm", "fixPrefix": false}` - -

unit.formatUnits() ⇒ string #

-Get a string representation of the units of this Unit, without the value. - -**Kind**: instance method of Unit - -

unit.format([options]) ⇒ string #

-Get a string representation of the Unit, with optional formatting options. - -**Kind**: instance method of Unit - -| Param | Type | Description | -| --- | --- | --- | -| [options] | Object | number | function | Formatting options. See lib/utils/number:format for a description of the available options. | - - -

Unit.parse(str) ⇒ Unit #

-Parse a string into a unit. The value of the unit is parsed as number, -BigNumber, or Fraction depending on the math.js config setting `number`. - -Throws an exception if the provided string does not contain a valid unit or -cannot be parsed. - -**Kind**: static method of Unit -**Returns**: Unit - unit - -| Param | Type | Description | -| --- | --- | --- | -| str | string | A string like "5.2 inch", "4e2 cm/s^2" | - - -

Unit.isValuelessUnit(name) ⇒ boolean #

-Test if the given expression is a unit. -The unit can have a prefix but cannot have a value. - -**Kind**: static method of Unit -**Returns**: boolean - true if the given string is a unit - -| Param | Type | Description | -| --- | --- | --- | -| name | string | A string to be tested whether it is a value less unit. The unit can have prefix, like "cm" | - - -

Unit.fromJSON(json) ⇒ Unit #

-Instantiate a Unit from a JSON object - -**Kind**: static method of Unit - -| Param | Type | Description | -| --- | --- | --- | -| json | Object | A JSON object structured as: `{"mathjs": "Unit", "value": 2, "unit": "cm", "fixPrefix": false}` | - diff --git a/docs/reference/constants.md b/docs/reference/constants.md deleted file mode 100644 index 5ee5e97a65..0000000000 --- a/docs/reference/constants.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -layout: default ---- - -

Constant reference #

- -Math.js contains the following constants. - -Constant | Description | Value ---------------- | ----------- | ----- -`e`, `E` | Euler's number, the base of the natural logarithm. | 2.718281828459045 -`i` | Imaginary unit, defined as `i * i = -1`. A complex number is described as `a + b * i`, where a is the real part, and b is the imaginary part. | `sqrt(-1)` -`Infinity` | Infinity, a number which is larger than the maximum number that can be handled by a floating point number. | `Infinity` -`LN2` | Returns the natural logarithm of 2. | `0.6931471805599453` -`LN10` | Returns the natural logarithm of 10. | `2.302585092994046` -`LOG2E` | Returns the base-2 logarithm of E. | `1.4426950408889634` -`LOG10E` | Returns the base-10 logarithm of E. | `0.4342944819032518` -`NaN` | Not a number. | `NaN` -`null` | Value null. | `null` -`phi` | Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` | `1.618033988749895` -`pi`, `PI` | The number pi is a mathematical constant that is the ratio of a circle\'s circumference to its diameter. | `3.141592653589793` -`SQRT1_2` | Returns the square root of 1/2. | `0.7071067811865476` -`SQRT2` | Returns the square root of 2. | `1.4142135623730951` -`tau` | Tau is the ratio constant of a circle\'s circumference to radius, equal to `2 * pi`. | `6.283185307179586` -`undefined` | An undefined value. Preferably, use `null` to indicate undefined values. | `undefined` -`version` | Returns the version number of math.js. | For example `0.24.1` - -Example usage: - -```js -math.sin(math.pi / 4) // 0.70711 -math.multiply(math.i, math.i) // -1 -``` diff --git a/docs/reference/functions.md b/docs/reference/functions.md deleted file mode 100644 index e8131920c8..0000000000 --- a/docs/reference/functions.md +++ /dev/null @@ -1,323 +0,0 @@ ---- -layout: default ---- - -

Function reference #

- -

Expression functions #

- -Function | Description ----- | ----------- -[math.compile(expr)](functions/compile.html) | Parse and compile an expression. -[math.evaluate(expr [, scope])](functions/evaluate.html) | Evaluate an expression. -[math.help(search)](functions/help.html) | Retrieve help on a function or data type. -[math.parser()](functions/parser.html) | Create a `math. - -

Algebra functions #

- -Function | Description ----- | ----------- -[math.derivative(expr, variable)](functions/derivative.html) | Takes the derivative of an expression expressed in parser Nodes. -[math.leafCount(expr)](functions/leafCount.html) | Gives the number of "leaf nodes" in the parse tree of the given expression A leaf node is one that has no subexpressions, essentially either a symbol or a constant. -[math.lsolve(L, b)](functions/lsolve.html) | Finds one solution of a linear equation system by forwards substitution. -[math.lsolveAll(L, b)](functions/lsolveAll.html) | Finds all solutions of a linear equation system by forwards substitution. -[math.lup(A)](functions/lup.html) | Calculate the Matrix LU decomposition with partial pivoting. -[math.lusolve(A, b)](functions/lusolve.html) | Solves the linear system `A * x = b` where `A` is an [n x n] matrix and `b` is a [n] column vector. -[math.lyap(A, Q)](functions/lyap.html) | Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P, where Q is an input matrix. -[math.polynomialRoot(constant, linearCoeff, quadraticCoeff, cubicCoeff)](functions/polynomialRoot.html) | Finds the numerical values of the distinct roots of a polynomial with real or complex coefficients. -[math.qr(A)](functions/qr.html) | Calculate the Matrix QR decomposition. -[math.rationalize(expr)](functions/rationalize.html) | Transform a rationalizable expression in a rational fraction. -[math.resolve(expr, scope)](functions/resolve.html) | resolve(expr, scope) replaces variable nodes with their scoped values. -[math.schur(A)](functions/schur.html) | Performs a real Schur decomposition of the real matrix A = UTU' where U is orthogonal and T is upper quasi-triangular. -[math.simplify(expr)](functions/simplify.html) | Simplify an expression tree. -[math.simplifyConstant(expr)](functions/simplifyConstant.html) | simplifyConstant() takes a mathjs expression (either a Node representing a parse tree or a string which it parses to produce a node), and replaces any subexpression of it consisting entirely of constants with the computed value of that subexpression. -[math.simplifyCore(expr)](functions/simplifyCore.html) | simplifyCore() performs single pass simplification suitable for applications requiring ultimate performance. -[math.slu(A, order, threshold)](functions/slu.html) | Calculate the Sparse Matrix LU decomposition with full pivoting. -[math.sylvester(A, B, C)](functions/sylvester.html) | Solves the real-valued Sylvester equation AX+XB=C for X, where A, B and C are matrices of appropriate dimensions, being A and B squared. -[math.symbolicEqual(expr1, expr2)](functions/symbolicEqual.html) | Attempts to determine if two expressions are symbolically equal, i. -[math.usolve(U, b)](functions/usolve.html) | Finds one solution of a linear equation system by backward substitution. -[math.usolveAll(U, b)](functions/usolveAll.html) | Finds all solutions of a linear equation system by backward substitution. - -

Arithmetic functions #

- -Function | Description ----- | ----------- -[math.abs(x)](functions/abs.html) | Calculate the absolute value of a number. -[math.add(x, y)](functions/add.html) | Add two or more values, `x + y`. -[math.cbrt(x [, allRoots])](functions/cbrt.html) | Calculate the cubic root of a value. -[math.ceil(x)](functions/ceil.html) | Round a value towards plus infinity If `x` is complex, both real and imaginary part are rounded towards plus infinity. -[math.cube(x)](functions/cube.html) | Compute the cube of a value, `x * x * x`. -[math.divide(x, y)](functions/divide.html) | Divide two values, `x / y`. -[math.dotDivide(x, y)](functions/dotDivide.html) | Divide two matrices element wise. -[math.dotMultiply(x, y)](functions/dotMultiply.html) | Multiply two matrices element wise. -[math.dotPow(x, y)](functions/dotPow.html) | Calculates the power of x to y element wise. -[math.exp(x)](functions/exp.html) | Calculate the exponential of a value. -[math.expm1(x)](functions/expm1.html) | Calculate the value of subtracting 1 from the exponential value. -[math.fix(x)](functions/fix.html) | Round a value towards zero. -[math.floor(x)](functions/floor.html) | Round a value towards minus infinity. -[math.gcd(a, b)](functions/gcd.html) | Calculate the greatest common divisor for two or more values or arrays. -[math.hypot(a, b, ...)](functions/hypot.html) | Calculate the hypotenuse of a list with values. -[math.invmod(a, b)](functions/invmod.html) | Calculate the (modular) multiplicative inverse of a modulo b. -[math.lcm(a, b)](functions/lcm.html) | Calculate the least common multiple for two or more values or arrays. -[math.log(x [, base])](functions/log.html) | Calculate the logarithm of a value. -[math.log10(x)](functions/log10.html) | Calculate the 10-base logarithm of a value. -[math.log1p(x)](functions/log1p.html) | Calculate the logarithm of a `value+1`. -[math.log2(x)](functions/log2.html) | Calculate the 2-base of a value. -[math.mod(x, y)](functions/mod.html) | Calculates the modulus, the remainder of an integer division. -[math.multiply(x, y)](functions/multiply.html) | Multiply two or more values, `x * y`. -[math.norm(x [, p])](functions/norm.html) | Calculate the norm of a number, vector or matrix. -[math.nthRoot(a)](functions/nthRoot.html) | Calculate the nth root of a value. -[math.nthRoots(x)](functions/nthRoots.html) | Calculate the nth roots of a value. -[math.pow(x, y)](functions/pow.html) | Calculates the power of x to y, `x ^ y`. -[math.round(x [, n])](functions/round.html) | Round a value towards the nearest rounded value. -[math.sign(x)](functions/sign.html) | Compute the sign of a value. -[math.sqrt(x)](functions/sqrt.html) | Calculate the square root of a value. -[math.square(x)](functions/square.html) | Compute the square of a value, `x * x`. -[math.subtract(x, y)](functions/subtract.html) | Subtract two values, `x - y`. -[math.unaryMinus(x)](functions/unaryMinus.html) | Inverse the sign of a value, apply a unary minus operation. -[math.unaryPlus(x)](functions/unaryPlus.html) | Unary plus operation. -[math.xgcd(a, b)](functions/xgcd.html) | Calculate the extended greatest common divisor for two values. - -

Bitwise functions #

- -Function | Description ----- | ----------- -[math.bitAnd(x, y)](functions/bitAnd.html) | Bitwise AND two values, `x & y`. -[math.bitNot(x)](functions/bitNot.html) | Bitwise NOT value, `~x`. -[math.bitOr(x, y)](functions/bitOr.html) | Bitwise OR two values, `x | y`. -[math.bitXor(x, y)](functions/bitXor.html) | Bitwise XOR two values, `x ^ y`. -[math.leftShift(x, y)](functions/leftShift.html) | Bitwise left logical shift of a value x by y number of bits, `x << y`. -[math.rightArithShift(x, y)](functions/rightArithShift.html) | Bitwise right arithmetic shift of a value x by y number of bits, `x >> y`. -[math.rightLogShift(x, y)](functions/rightLogShift.html) | Bitwise right logical shift of value x by y number of bits, `x >>> y`. - -

Combinatorics functions #

- -Function | Description ----- | ----------- -[math.bellNumbers(n)](functions/bellNumbers.html) | The Bell Numbers count the number of partitions of a set. -[math.catalan(n)](functions/catalan.html) | The Catalan Numbers enumerate combinatorial structures of many different types. -[math.composition(n, k)](functions/composition.html) | The composition counts of n into k parts. -[math.stirlingS2(n, k)](functions/stirlingS2.html) | The Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. - -

Complex functions #

- -Function | Description ----- | ----------- -[math.arg(x)](functions/arg.html) | Compute the argument of a complex value. -[math.conj(x)](functions/conj.html) | Compute the complex conjugate of a complex value. -[math.im(x)](functions/im.html) | Get the imaginary part of a complex number. -[math.re(x)](functions/re.html) | Get the real part of a complex number. - -

Geometry functions #

- -Function | Description ----- | ----------- -[math.distance([x1,y1], [x2,y2])](functions/distance.html) | Calculates: The eucledian distance between two points in N-dimensional spaces. -[math.intersect(endPoint1Line1, endPoint2Line1, endPoint1Line2, endPoint2Line2)](functions/intersect.html) | Calculates the point of intersection of two lines in two or three dimensions and of a line and a plane in three dimensions. - -

Logical functions #

- -Function | Description ----- | ----------- -[math.and(x, y)](functions/and.html) | Logical `and`. -[math.not(x)](functions/not.html) | Logical `not`. -[math.or(x, y)](functions/or.html) | Logical `or`. -[math.xor(x, y)](functions/xor.html) | Logical `xor`. - -

Matrix functions #

- -Function | Description ----- | ----------- -[math.column(value, index)](functions/column.html) | Return a column from a Matrix. -[math.concat(a, b, c, ... [, dim])](functions/concat.html) | Concatenate two or more matrices. -[math.count(x)](functions/count.html) | Count the number of elements of a matrix, array or string. -[math.cross(x, y)](functions/cross.html) | Calculate the cross product for two vectors in three dimensional space. -[math.ctranspose(x)](functions/ctranspose.html) | Transpose and complex conjugate a matrix. -[math.det(x)](functions/det.html) | Calculate the determinant of a matrix. -[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 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. -[math.flatten(x)](functions/flatten.html) | Flatten a multidimensional matrix into a single dimensional matrix. -[math.forEach(x, callback)](functions/forEach.html) | Iterate over all elements of a matrix/array, and executes the given callback function. -[math.getMatrixDataType(x)](functions/getMatrixDataType.html) | Find the data type of all elements in a matrix or array, for example 'number' if all items are a number and 'Complex' if all values are complex numbers. -[math.identity(n)](functions/identity.html) | Create a 2-dimensional identity matrix with size m x n or n x n. -[math.ifft(arr)](functions/ifft.html) | Calculate N-dimensional inverse Fourier transform. -[math.inv(x)](functions/inv.html) | Calculate the inverse of a square matrix. -[math.kron(x, y)](functions/kron.html) | Calculates the Kronecker product of 2 matrices or vectors. -[math.map(x, callback)](functions/map.html) | Create a new matrix or array with the results of a callback function executed on each entry of a given matrix/array. -[math.mapSlices(A, dim, callback)](functions/mapSlices.html) | Apply a function that maps an array to a scalar along a given axis of a matrix or array. -[math.matrixFromColumns(...arr)](functions/matrixFromColumns.html) | Create a dense matrix from vectors as individual columns. -[math.matrixFromFunction(size, fn)](functions/matrixFromFunction.html) | Create a matrix by evaluating a generating function at each index. -[math.matrixFromRows(...arr)](functions/matrixFromRows.html) | Create a dense matrix from vectors as individual rows. -[math.ones(m, n, p, ...)](functions/ones.html) | Create a matrix filled with ones. -[math.partitionSelect(x, k)](functions/partitionSelect.html) | Partition-based selection of an array or 1D matrix. -[math.pinv(x)](functions/pinv.html) | Calculate the Moore–Penrose inverse of a matrix. -[math.range(start, end [, step])](functions/range.html) | Create an array from a range. -[math.reshape(x, sizes)](functions/reshape.html) | Reshape a multi dimensional array to fit the specified dimensions. -[math.resize(x, size [, defaultValue])](functions/resize.html) | Resize a matrix. -[math.rotate(w, theta)](functions/rotate.html) | Rotate a vector of size 1x2 counter-clockwise by a given angle Rotate a vector of size 1x3 counter-clockwise by a given angle around the given axis. -[math.rotationMatrix(theta)](functions/rotationMatrix.html) | Create a 2-dimensional counter-clockwise rotation matrix (2x2) for a given angle (expressed in radians). -[math.row(value, index)](functions/row.html) | Return a row from a Matrix. -[math.size(x)](functions/size.html) | Calculate the size of a matrix or scalar. -[math.sort(x)](functions/sort.html) | Sort the items in a matrix. -[math.sqrtm(A)](functions/sqrtm.html) | Calculate the principal square root of a square matrix. -[math.squeeze(x)](functions/squeeze.html) | Squeeze a matrix, remove inner and outer singleton dimensions from a matrix. -[math.subset(x, index [, replacement])](functions/subset.html) | Get or set a subset of a matrix or string. -[math.trace(x)](functions/trace.html) | Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix. -[math.transpose(x)](functions/transpose.html) | Transpose a matrix. -[math.zeros(m, n, p, ...)](functions/zeros.html) | Create a matrix filled with zeros. - -

Numeric functions #

- -Function | Description ----- | ----------- -[math.solveODE(func, tspan, y0)](functions/solveODE.html) | Numerical Integration of Ordinary Differential Equations Two variable step methods are provided: - "RK23": Bogacki–Shampine method - "RK45": Dormand-Prince method RK5(4)7M (default) The arguments are expected as follows. - -

Probability functions #

- -Function | Description ----- | ----------- -[math.combinations(n, k)](functions/combinations.html) | Compute the number of ways of picking `k` unordered outcomes from `n` possibilities. -[math.combinationsWithRep(n, k)](functions/combinationsWithRep.html) | Compute the number of ways of picking `k` unordered outcomes from `n` possibilities, allowing individual outcomes to be repeated more than once. -[math.factorial(n)](functions/factorial.html) | Compute the factorial of a value Factorial only supports an integer value as argument. -[math.gamma(n)](functions/gamma.html) | Compute the gamma function of a value using Lanczos approximation for small values, and an extended Stirling approximation for large values. -[math.kldivergence(x, y)](functions/kldivergence.html) | Calculate the Kullback-Leibler (KL) divergence between two distributions. -[math.lgamma(n)](functions/lgamma.html) | Logarithm of the gamma function for real, positive numbers and complex numbers, using Lanczos approximation for numbers and Stirling series for complex numbers. -[math.multinomial(a)](functions/multinomial.html) | Multinomial Coefficients compute the number of ways of picking a1, a2, . -[math.permutations(n [, k])](functions/permutations.html) | Compute the number of ways of obtaining an ordered subset of `k` elements from a set of `n` elements. -[math.pickRandom(array)](functions/pickRandom.html) | Random pick one or more values from a one dimensional array. -[math.random([min, max])](functions/random.html) | Return a random number larger or equal to `min` and smaller than `max` using a uniform distribution. -[math.randomInt([min, max])](functions/randomInt.html) | Return a random integer number larger or equal to `min` and smaller than `max` using a uniform distribution. - -

Relational functions #

- -Function | Description ----- | ----------- -[math.compare(x, y)](functions/compare.html) | Compare two values. -[math.compareNatural(x, y)](functions/compareNatural.html) | Compare two values of any type in a deterministic, natural way. -[math.compareText(x, y)](functions/compareText.html) | Compare two strings lexically. -[math.deepEqual(x, y)](functions/deepEqual.html) | Test element wise whether two matrices are equal. -[math.equal(x, y)](functions/equal.html) | Test whether two values are equal. -[math.equalText(x, y)](functions/equalText.html) | Check equality of two strings. -[math.larger(x, y)](functions/larger.html) | Test whether value x is larger than y. -[math.largerEq(x, y)](functions/largerEq.html) | Test whether value x is larger or equal to y. -[math.smaller(x, y)](functions/smaller.html) | Test whether value x is smaller than y. -[math.smallerEq(x, y)](functions/smallerEq.html) | Test whether value x is smaller or equal to y. -[math.unequal(x, y)](functions/unequal.html) | Test whether two values are unequal. - -

Set functions #

- -Function | Description ----- | ----------- -[math.setCartesian(set1, set2)](functions/setCartesian.html) | Create the cartesian product of two (multi)sets. -[math.setDifference(set1, set2)](functions/setDifference.html) | Create the difference of two (multi)sets: every element of set1, that is not the element of set2. -[math.setDistinct(set)](functions/setDistinct.html) | Collect the distinct elements of a multiset. -[math.setIntersect(set1, set2)](functions/setIntersect.html) | Create the intersection of two (multi)sets. -[math.setIsSubset(set1, set2)](functions/setIsSubset.html) | Check whether a (multi)set is a subset of another (multi)set. -[math.setMultiplicity(element, set)](functions/setMultiplicity.html) | Count the multiplicity of an element in a multiset. -[math.setPowerset(set)](functions/setPowerset.html) | Create the powerset of a (multi)set. -[math.setSize(set)](functions/setSize.html) | Count the number of elements of a (multi)set. -[math.setSymDifference(set1, set2)](functions/setSymDifference.html) | Create the symmetric difference of two (multi)sets. -[math.setUnion(set1, set2)](functions/setUnion.html) | Create the union of two (multi)sets. - -

Signal functions #

- -Function | Description ----- | ----------- -[math.freqz(b, a)](functions/freqz.html) | Calculates the frequency response of a filter given its numerator and denominator coefficients. -[math.zpk2tf(z, p, k)](functions/zpk2tf.html) | Compute the transfer function of a zero-pole-gain model. - -

Special functions #

- -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. - -

Statistics functions #

- -Function | Description ----- | ----------- -[math.corr(A, B)](functions/corr.html) | Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated. -[math.cumsum(a, b, c, ...)](functions/cumsum.html) | Compute the cumulative sum of a matrix or a list with values. -[math.mad(a, b, c, ...)](functions/mad.html) | Compute the median absolute deviation of a matrix or a list with values. -[math.max(a, b, c, ...)](functions/max.html) | Compute the maximum value of a matrix or a list with values. -[math.mean(a, b, c, ...)](functions/mean.html) | Compute the mean value of matrix or a list with values. -[math.median(a, b, c, ...)](functions/median.html) | Compute the median of a matrix or a list with values. -[math.min(a, b, c, ...)](functions/min.html) | Compute the minimum value of a matrix or a list of values. -[math.mode(a, b, c, ...)](functions/mode.html) | Computes the mode of a set of numbers or a list with values(numbers or characters). -[math.prod(a, b, c, ...)](functions/prod.html) | Compute the product of a matrix or a list with values. -[math.quantileSeq(A, prob[, sorted])](functions/quantileSeq.html) | Compute the prob order quantile of a matrix or a list with values. -[math.std(a, b, c, ...)](functions/std.html) | Compute the standard deviation of a matrix or a list with values. -[math.sum(a, b, c, ...)](functions/sum.html) | Compute the sum of a matrix or a list with values. -[math.variance(a, b, c, ...)](functions/variance.html) | Compute the variance of a matrix or a list with values. - -

String functions #

- -Function | Description ----- | ----------- -[math.bin(value)](functions/bin.html) | Format a number as binary. -[math.format(value [, precision])](functions/format.html) | Format a value of any type into a string. -[math.hex(value)](functions/hex.html) | Format a number as hexadecimal. -[math.oct(value)](functions/oct.html) | Format a number as octal. -[math.print(template, values [, precision])](functions/print.html) | Interpolate values into a string template. - -

Trigonometry functions #

- -Function | Description ----- | ----------- -[math.acos(x)](functions/acos.html) | Calculate the inverse cosine of a value. -[math.acosh(x)](functions/acosh.html) | Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`. -[math.acot(x)](functions/acot.html) | Calculate the inverse cotangent of a value, defined as `acot(x) = atan(1/x)`. -[math.acoth(x)](functions/acoth.html) | Calculate the inverse hyperbolic tangent of a value, defined as `acoth(x) = atanh(1/x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`. -[math.acsc(x)](functions/acsc.html) | Calculate the inverse cosecant of a value, defined as `acsc(x) = asin(1/x)`. -[math.acsch(x)](functions/acsch.html) | Calculate the inverse hyperbolic cosecant of a value, defined as `acsch(x) = asinh(1/x) = ln(1/x + sqrt(1/x^2 + 1))`. -[math.asec(x)](functions/asec.html) | Calculate the inverse secant of a value. -[math.asech(x)](functions/asech.html) | Calculate the hyperbolic arcsecant of a value, defined as `asech(x) = acosh(1/x) = ln(sqrt(1/x^2 - 1) + 1/x)`. -[math.asin(x)](functions/asin.html) | Calculate the inverse sine of a value. -[math.asinh(x)](functions/asinh.html) | Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`. -[math.atan(x)](functions/atan.html) | Calculate the inverse tangent of a value. -[math.atan2(y, x)](functions/atan2.html) | Calculate the inverse tangent function with two arguments, y/x. -[math.atanh(x)](functions/atanh.html) | Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`. -[math.cos(x)](functions/cos.html) | Calculate the cosine of a value. -[math.cosh(x)](functions/cosh.html) | Calculate the hyperbolic cosine of a value, defined as `cosh(x) = 1/2 * (exp(x) + exp(-x))`. -[math.cot(x)](functions/cot.html) | Calculate the cotangent of a value. -[math.coth(x)](functions/coth.html) | Calculate the hyperbolic cotangent of a value, defined as `coth(x) = 1 / tanh(x)`. -[math.csc(x)](functions/csc.html) | Calculate the cosecant of a value, defined as `csc(x) = 1/sin(x)`. -[math.csch(x)](functions/csch.html) | Calculate the hyperbolic cosecant of a value, defined as `csch(x) = 1 / sinh(x)`. -[math.sec(x)](functions/sec.html) | Calculate the secant of a value, defined as `sec(x) = 1/cos(x)`. -[math.sech(x)](functions/sech.html) | Calculate the hyperbolic secant of a value, defined as `sech(x) = 1 / cosh(x)`. -[math.sin(x)](functions/sin.html) | Calculate the sine of a value. -[math.sinh(x)](functions/sinh.html) | Calculate the hyperbolic sine of a value, defined as `sinh(x) = 1/2 * (exp(x) - exp(-x))`. -[math.tan(x)](functions/tan.html) | Calculate the tangent of a value. -[math.tanh(x)](functions/tanh.html) | Calculate the hyperbolic tangent of a value, defined as `tanh(x) = (exp(2 * x) - 1) / (exp(2 * x) + 1)`. - -

Unit functions #

- -Function | Description ----- | ----------- -[math.to(x, unit)](functions/to.html) | Change the unit of a value. - -

Utils functions #

- -Function | Description ----- | ----------- -[math.clone(x)](functions/clone.html) | Clone an object. -[math.hasNumericValue(x)](functions/hasNumericValue.html) | Test whether a value is an numeric value. -[math.isInteger(x)](functions/isInteger.html) | Test whether a value is an integer number. -[math.isNaN(x)](functions/isNaN.html) | Test whether a value is NaN (not a number). -[math.isNegative(x)](functions/isNegative.html) | Test whether a value is negative: smaller than zero. -[math.isNumeric(x)](functions/isNumeric.html) | Test whether a value is an numeric value. -[math.isPositive(x)](functions/isPositive.html) | Test whether a value is positive: larger than zero. -[math.isPrime(x)](functions/isPrime.html) | Test whether a value is prime: has no divisors other than itself and one. -[math.isZero(x)](functions/isZero.html) | Test whether a value is zero. -[math.numeric(x)](functions/numeric.html) | Convert a numeric input to a specific numeric type: number, BigNumber, bigint, or Fraction. -[math.typeOf(x)](functions/typeOf.html) | Determine the type of an entity. - - - - diff --git a/docs/reference/functions/abs.md b/docs/reference/functions/abs.md deleted file mode 100644 index 73176957e6..0000000000 --- a/docs/reference/functions/abs.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -layout: default ---- - - - -

Function abs #

- -Calculate the absolute value of a number. For matrices, the function is -evaluated element wise. - - -

Syntax #

- -```js -math.abs(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | Complex | Array | Matrix | Unit | A number or matrix for which to get the absolute value - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Fraction | Complex | Array | Matrix | Unit | Absolute value of `x` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.abs(3.5) // returns number 3.5 -math.abs(-4.2) // returns number 4.2 - -math.abs([3, -5, -1, 0, 2]) // returns Array [3, 5, 1, 0, 2] -``` - - -

See also #

- -[sign](sign.html) diff --git a/docs/reference/functions/acos.md b/docs/reference/functions/acos.md deleted file mode 100644 index 4557f836fb..0000000000 --- a/docs/reference/functions/acos.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function acos #

- -Calculate the inverse cosine of a value. - -To avoid confusion with the matrix arccosine, this function does not -apply to matrices. - - -

Syntax #

- -```js -math.acos(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | The arc cosine of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.acos(0.5) // returns number 1.0471975511965979 -math.acos(math.cos(1.5)) // returns number 1.5 - -math.acos(2) // returns Complex 0 + 1.3169578969248166 i -``` - - -

See also #

- -[cos](cos.html), -[atan](atan.html), -[asin](asin.html) diff --git a/docs/reference/functions/acosh.md b/docs/reference/functions/acosh.md deleted file mode 100644 index 2a856306ae..0000000000 --- a/docs/reference/functions/acosh.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: default ---- - - - -

Function acosh #

- -Calculate the hyperbolic arccos of a value, -defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`. - -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.acosh(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Hyperbolic arccosine of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.acosh(1.5) // returns 0.9624236501192069 -``` - - -

See also #

- -[cosh](cosh.html), -[asinh](asinh.html), -[atanh](atanh.html) diff --git a/docs/reference/functions/acot.md b/docs/reference/functions/acot.md deleted file mode 100644 index b28f3e8787..0000000000 --- a/docs/reference/functions/acot.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -layout: default ---- - - - -

Function acot #

- -Calculate the inverse cotangent of a value, defined as `acot(x) = atan(1/x)`. - -To avoid confusion with the matrix arccotanget, this function does not -apply to matrices. - - -

Syntax #

- -```js -math.acot(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | The arc cotangent of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.acot(0.5) // returns number 1.1071487177940904 -math.acot(2) // returns number 0.4636476090008061 -math.acot(math.cot(1.5)) // returns number 1.5 -``` - - -

See also #

- -[cot](cot.html), -[atan](atan.html) diff --git a/docs/reference/functions/acoth.md b/docs/reference/functions/acoth.md deleted file mode 100644 index 9c97f24f27..0000000000 --- a/docs/reference/functions/acoth.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: default ---- - - - -

Function acoth #

- -Calculate the inverse hyperbolic tangent of a value, -defined as `acoth(x) = atanh(1/x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`. - -To avoid confusion with the matrix inverse hyperbolic tangent, this -function does not apply to matrices. - - -

Syntax #

- -```js -math.acoth(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Hyperbolic arccotangent of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.acoth(0.5) // returns 0.5493061443340548 - 1.5707963267948966i -``` - - -

See also #

- -[acsch](acsch.html), -[asech](asech.html) diff --git a/docs/reference/functions/acsc.md b/docs/reference/functions/acsc.md deleted file mode 100644 index 2719fad966..0000000000 --- a/docs/reference/functions/acsc.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -layout: default ---- - - - -

Function acsc #

- -Calculate the inverse cosecant of a value, defined as `acsc(x) = asin(1/x)`. - -To avoid confusion with the matrix arccosecant, this function does not -apply to matrices. - - -

Syntax #

- -```js -math.acsc(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | The arc cosecant of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.acsc(2) // returns 0.5235987755982989 -math.acsc(0.5) // returns Complex 1.5707963267948966 -1.3169578969248166i -math.acsc(math.csc(1.5)) // returns number 1.5 -``` - - -

See also #

- -[csc](csc.html), -[asin](asin.html), -[asec](asec.html) diff --git a/docs/reference/functions/acsch.md b/docs/reference/functions/acsch.md deleted file mode 100644 index a20af40b7c..0000000000 --- a/docs/reference/functions/acsch.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: default ---- - - - -

Function acsch #

- -Calculate the inverse hyperbolic cosecant of a value, -defined as `acsch(x) = asinh(1/x) = ln(1/x + sqrt(1/x^2 + 1))`. - -To avoid confusion with the matrix inverse hyperbolic cosecant, this function -does not apply to matrices. - - -

Syntax #

- -```js -math.acsch(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Hyperbolic arccosecant of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.acsch(0.5) // returns 1.4436354751788103 -``` - - -

See also #

- -[asech](asech.html), -[acoth](acoth.html) diff --git a/docs/reference/functions/add.md b/docs/reference/functions/add.md deleted file mode 100644 index e664c7850d..0000000000 --- a/docs/reference/functions/add.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -layout: default ---- - - - -

Function add #

- -Add two or more values, `x + y`. -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.add(x, y) -math.add(x, y, z, ...) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix | First value to add -`y` | number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix | Second value to add - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix | Sum of `x` and `y` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.add(2, 3) // returns number 5 -math.add(2, 3, 4) // returns number 9 - -const a = math.complex(2, 3) -const b = math.complex(-4, 1) -math.add(a, b) // returns Complex -2 + 4i - -math.add([1, 2, 3], 4) // returns Array [5, 6, 7] - -const c = math.unit('5 cm') -const d = math.unit('2.1 mm') -math.add(c, d) // returns Unit 52.1 mm - -math.add("2.3", "4") // returns number 6.3 -``` - - -

See also #

- -[subtract](subtract.html), -[sum](sum.html) diff --git a/docs/reference/functions/and.md b/docs/reference/functions/and.md deleted file mode 100644 index 7927cb4362..0000000000 --- a/docs/reference/functions/and.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: default ---- - - - -

Function and #

- -Logical `and`. Test whether two values are both defined with a nonzero/nonempty value. -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.and(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Complex | Unit | Array | Matrix | First value to check -`y` | number | BigNumber | bigint | Complex | Unit | Array | Matrix | Second value to check - -

Returns #

- -Type | Description ----- | ----------- -boolean | Array | Matrix | Returns true when both inputs are defined with a nonzero/nonempty value. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.and(2, 4) // returns true - -a = [2, 0, 0] -b = [3, 7, 0] -c = 0 - -math.and(a, b) // returns [true, false, false] -math.and(a, c) // returns [false, false, false] -``` - - -

See also #

- -[not](not.html), -[or](or.html), -[xor](xor.html) diff --git a/docs/reference/functions/apply.md b/docs/reference/functions/apply.md deleted file mode 100644 index 40cf1dfec7..0000000000 --- a/docs/reference/functions/apply.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -layout: default ---- - - - -

Function apply #

- -Apply a function that maps an array to a scalar -along a given axis of a matrix or array. -Returns a new matrix or array with one less dimension than the input. - - -

Syntax #

- -```js -math.apply(A, dim, callback) -``` - -

Where #

- -- `dim: number` is a zero-based dimension over which to concatenate the matrices. - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`array` | Array | Matrix | The input Matrix -`dim` | number | The dimension along which the callback is applied -`callback` | Function | The callback function that is applied. This Function should take an array or 1-d matrix as an input and return a number. - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | res The residual matrix with the function applied over some dimension. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const A = [[1, 2], [3, 4]] -const sum = math.sum - -math.apply(A, 0, sum) // returns [4, 6] -math.apply(A, 1, sum) // returns [3, 7] -``` - - -

See also #

- -[map](map.html), -[filter](filter.html), -[forEach](forEach.html) diff --git a/docs/reference/functions/arg.md b/docs/reference/functions/arg.md deleted file mode 100644 index 06f723f839..0000000000 --- a/docs/reference/functions/arg.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: default ---- - - - -

Function arg #

- -Compute the argument of a complex value. -For a complex number `a + bi`, the argument is computed as `atan2(b, a)`. - -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.arg(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Array | Matrix | A complex number or array with complex numbers - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Array | Matrix | The argument of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const a = math.complex(2, 2) -math.arg(a) / math.pi // returns number 0.25 - -const b = math.complex('2 + 3i') -math.arg(b) // returns number 0.982793723247329 -math.atan2(3, 2) // returns number 0.982793723247329 -``` - - -

See also #

- -[re](re.html), -[im](im.html), -[conj](conj.html), -[abs](abs.html) diff --git a/docs/reference/functions/asec.md b/docs/reference/functions/asec.md deleted file mode 100644 index d78ddadeaf..0000000000 --- a/docs/reference/functions/asec.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function asec #

- -Calculate the inverse secant of a value. Defined as `asec(x) = acos(1/x)`. - -To avoid confusion with the matrix arcsecant, this function does not -apply to matrices. - - -

Syntax #

- -```js -math.asec(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | The arc secant of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.asec(2) // returns 1.0471975511965979 -math.asec(math.sec(1.5)) // returns 1.5 - -math.asec(0.5) // returns Complex 0 + 1.3169578969248166i -``` - - -

See also #

- -[acos](acos.html), -[acot](acot.html), -[acsc](acsc.html) diff --git a/docs/reference/functions/asech.md b/docs/reference/functions/asech.md deleted file mode 100644 index afa894b712..0000000000 --- a/docs/reference/functions/asech.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: default ---- - - - -

Function asech #

- -Calculate the hyperbolic arcsecant of a value, -defined as `asech(x) = acosh(1/x) = ln(sqrt(1/x^2 - 1) + 1/x)`. - -To avoid confusion with the matrix hyperbolic arcsecant, this function -does not apply to matrices. - - -

Syntax #

- -```js -math.asech(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Hyperbolic arcsecant of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.asech(0.5) // returns 1.3169578969248166 -``` - - -

See also #

- -[acsch](acsch.html), -[acoth](acoth.html) diff --git a/docs/reference/functions/asin.md b/docs/reference/functions/asin.md deleted file mode 100644 index 8f1a531594..0000000000 --- a/docs/reference/functions/asin.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function asin #

- -Calculate the inverse sine of a value. - -To avoid confusion with the matric arcsine, this function does not apply -to matrices. - - -

Syntax #

- -```js -math.asin(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | The arc sine of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.asin(0.5) // returns number 0.5235987755982989 -math.asin(math.sin(1.5)) // returns number 1.5 - -math.asin(2) // returns Complex 1.5707963267948966 -1.3169578969248166i -``` - - -

See also #

- -[sin](sin.html), -[atan](atan.html), -[acos](acos.html) diff --git a/docs/reference/functions/asinh.md b/docs/reference/functions/asinh.md deleted file mode 100644 index 59e37615ea..0000000000 --- a/docs/reference/functions/asinh.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: default ---- - - - -

Function asinh #

- -Calculate the hyperbolic arcsine of a value, -defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`. - -To avoid confusion with the matrix hyperbolic arcsine, this function -does not apply to matrices. - - -

Syntax #

- -```js -math.asinh(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Hyperbolic arcsine of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.asinh(0.5) // returns 0.48121182505960347 -``` - - -

See also #

- -[acosh](acosh.html), -[atanh](atanh.html) diff --git a/docs/reference/functions/atan.md b/docs/reference/functions/atan.md deleted file mode 100644 index 4ec8cebb81..0000000000 --- a/docs/reference/functions/atan.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -layout: default ---- - - - -

Function atan #

- -Calculate the inverse tangent of a value. - -To avoid confusion with matrix arctangent, this function does not apply -to matrices. - - -

Syntax #

- -```js -math.atan(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | The arc tangent of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.atan(0.5) // returns number 0.4636476090008061 -math.atan(2) // returns number 1.1071487177940904 -math.atan(math.tan(1.5)) // returns number 1.5 -``` - - -

See also #

- -[tan](tan.html), -[asin](asin.html), -[acos](acos.html) diff --git a/docs/reference/functions/atan2.md b/docs/reference/functions/atan2.md deleted file mode 100644 index fb37d1217d..0000000000 --- a/docs/reference/functions/atan2.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -layout: default ---- - - - -

Function atan2 #

- -Calculate the inverse tangent function with two arguments, y/x. -By providing two arguments, the right quadrant of the computed angle can be -determined. - -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.atan2(y, x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`y` | number | Array | Matrix | Second dimension -`x` | number | Array | Matrix | First dimension - -

Returns #

- -Type | Description ----- | ----------- -number | Array | Matrix | Four-quadrant inverse tangent - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.atan2(2, 2) / math.pi // returns number 0.25 - -const angle = math.unit(60, 'deg') -const x = math.cos(angle) -const y = math.sin(angle) -math.atan2(y, x) * 180 / math.pi // returns 60 - -math.atan(2) // returns number 1.1071487177940904 -``` - - -

See also #

- -[tan](tan.html), -[atan](atan.html), -[sin](sin.html), -[cos](cos.html) diff --git a/docs/reference/functions/atanh.md b/docs/reference/functions/atanh.md deleted file mode 100644 index be0087abcd..0000000000 --- a/docs/reference/functions/atanh.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: default ---- - - - -

Function atanh #

- -Calculate the hyperbolic arctangent of a value, -defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`. - -To avoid confusion with the matrix hyperbolic arctangent, this function -does not apply to matrices. - - -

Syntax #

- -```js -math.atanh(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Hyperbolic arctangent of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.atanh(0.5) // returns 0.5493061443340549 -``` - - -

See also #

- -[acosh](acosh.html), -[asinh](asinh.html) diff --git a/docs/reference/functions/bellNumbers.md b/docs/reference/functions/bellNumbers.md deleted file mode 100644 index c2d757a516..0000000000 --- a/docs/reference/functions/bellNumbers.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -layout: default ---- - - - -

Function bellNumbers #

- -The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. -bellNumbers only takes integer arguments. -The following condition must be enforced: n >= 0 - - -

Syntax #

- -```js -math.bellNumbers(n) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`n` | Number | BigNumber | Total number of objects in the set - -

Returns #

- -Type | Description ----- | ----------- -Number | BigNumber | B(n) - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.bellNumbers(3) // returns 5 -math.bellNumbers(8) // returns 4140 -``` - - -

See also #

- -[stirlingS2](stirlingS2.html) diff --git a/docs/reference/functions/bignumber.md b/docs/reference/functions/bignumber.md deleted file mode 100644 index f9415b5128..0000000000 --- a/docs/reference/functions/bignumber.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: default ---- - - - -

Function bignumber #

- -Create a BigNumber, which can store numbers with arbitrary precision. -When a matrix is provided, all elements will be converted to BigNumber. - - -

Syntax #

- -```js -math.bignumber(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`value` | number | string | Fraction | BigNumber | Array | Matrix | boolean | null | Value for the big number, 0 by default. - -

Returns #

- -Type | Description ----- | ----------- -BigNumber | The created bignumber - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -0.1 + 0.2 // returns number 0.30000000000000004 -math.bignumber(0.1) + math.bignumber(0.2) // returns BigNumber 0.3 - - -7.2e500 // returns number Infinity -math.bignumber('7.2e500') // returns BigNumber 7.2e500 -``` - - -

See also #

- -[boolean](boolean.html), -[complex](complex.html), -[index](index.html), -[matrix](matrix.html), -[string](string.html), -[unit](unit.html) diff --git a/docs/reference/functions/bin.md b/docs/reference/functions/bin.md deleted file mode 100644 index 3f867d6c63..0000000000 --- a/docs/reference/functions/bin.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -layout: default ---- - - - -

Function bin #

- -Format a number as binary. - - -

Syntax #

- -```js -math.bin(value) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`value` | number | BigNumber | Value to be stringified -`wordSize` | number | BigNumber | Optional word size (see `format`) - -

Returns #

- -Type | Description ----- | ----------- -string | The formatted value - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -//the following outputs "0b10" -math.bin(2) -``` - - -

See also #

- -[oct](oct.html), -[hex](hex.html) diff --git a/docs/reference/functions/bitAnd.md b/docs/reference/functions/bitAnd.md deleted file mode 100644 index 2e001495e3..0000000000 --- a/docs/reference/functions/bitAnd.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -layout: default ---- - - - -

Function bitAnd #

- -Bitwise AND two values, `x & y`. -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.bitAnd(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Array | Matrix | First value to and -`y` | number | BigNumber | bigint | Array | Matrix | Second value to and - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Array | Matrix | AND of `x` and `y` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.bitAnd(53, 131) // returns number 1 - -math.bitAnd([1, 12, 31], 42) // returns Array [0, 8, 10] -``` - - -

See also #

- -[bitNot](bitNot.html), -[bitOr](bitOr.html), -[bitXor](bitXor.html), -[leftShift](leftShift.html), -[rightArithShift](rightArithShift.html), -[rightLogShift](rightLogShift.html) diff --git a/docs/reference/functions/bitNot.md b/docs/reference/functions/bitNot.md deleted file mode 100644 index e3e00dcc7a..0000000000 --- a/docs/reference/functions/bitNot.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -layout: default ---- - - - -

Function bitNot #

- -Bitwise NOT value, `~x`. -For matrices, the function is evaluated element wise. -For units, the function is evaluated on the best prefix base. - - -

Syntax #

- -```js -math.bitNot(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Array | Matrix | Value to not - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Array | Matrix | NOT of `x` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.bitNot(1) // returns number -2 - -math.bitNot([2, -3, 4]) // returns Array [-3, 2, -5] -``` - - -

See also #

- -[bitAnd](bitAnd.html), -[bitOr](bitOr.html), -[bitXor](bitXor.html), -[leftShift](leftShift.html), -[rightArithShift](rightArithShift.html), -[rightLogShift](rightLogShift.html) diff --git a/docs/reference/functions/bitOr.md b/docs/reference/functions/bitOr.md deleted file mode 100644 index bdfe9628e5..0000000000 --- a/docs/reference/functions/bitOr.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default ---- - - - -

Function bitOr #

- -Bitwise OR two values, `x | y`. -For matrices, the function is evaluated element wise. -For units, the function is evaluated on the lowest print base. - - -

Syntax #

- -```js -math.bitOr(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Array | Matrix | First value to or -`y` | number | BigNumber | bigint | Array | Matrix | Second value to or - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Array | Matrix | OR of `x` and `y` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.bitOr(1, 2) // returns number 3 - -math.bitOr([1, 2, 3], 4) // returns Array [5, 6, 7] -``` - - -

See also #

- -[bitAnd](bitAnd.html), -[bitNot](bitNot.html), -[bitXor](bitXor.html), -[leftShift](leftShift.html), -[rightArithShift](rightArithShift.html), -[rightLogShift](rightLogShift.html) diff --git a/docs/reference/functions/bitXor.md b/docs/reference/functions/bitXor.md deleted file mode 100644 index 75c631f8dc..0000000000 --- a/docs/reference/functions/bitXor.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -layout: default ---- - - - -

Function bitXor #

- -Bitwise XOR two values, `x ^ y`. -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.bitXor(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Array | Matrix | First value to xor -`y` | number | BigNumber | bigint | Array | Matrix | Second value to xor - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Array | Matrix | XOR of `x` and `y` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.bitXor(1, 2) // returns number 3 - -math.bitXor([2, 3, 4], 4) // returns Array [6, 7, 0] -``` - - -

See also #

- -[bitAnd](bitAnd.html), -[bitNot](bitNot.html), -[bitOr](bitOr.html), -[leftShift](leftShift.html), -[rightArithShift](rightArithShift.html), -[rightLogShift](rightLogShift.html) diff --git a/docs/reference/functions/boolean.md b/docs/reference/functions/boolean.md deleted file mode 100644 index 324044f755..0000000000 --- a/docs/reference/functions/boolean.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -layout: default ---- - - - -

Function boolean #

- -Create a boolean or convert a string or number to a boolean. -In case of a number, `true` is returned for non-zero numbers, and `false` in -case of zero. -Strings can be `'true'` or `'false'`, or can contain a number. -When value is a matrix, all elements will be converted to boolean. - - -

Syntax #

- -```js -math.boolean(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`value` | string | number | boolean | Array | Matrix | null | A value of any type - -

Returns #

- -Type | Description ----- | ----------- -boolean | Array | Matrix | The boolean value - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.boolean(0) // returns false -math.boolean(1) // returns true -math.boolean(-3) // returns true -math.boolean('true') // returns true -math.boolean('false') // returns false -math.boolean([1, 0, 1, 1]) // returns [true, false, true, true] -``` - - -

See also #

- -[bignumber](bignumber.html), -[complex](complex.html), -[index](index.html), -[matrix](matrix.html), -[string](string.html), -[unit](unit.html) diff --git a/docs/reference/functions/catalan.md b/docs/reference/functions/catalan.md deleted file mode 100644 index d180490e56..0000000000 --- a/docs/reference/functions/catalan.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -layout: default ---- - - - -

Function catalan #

- -The Catalan Numbers enumerate combinatorial structures of many different types. -catalan only takes integer arguments. -The following condition must be enforced: n >= 0 - - -

Syntax #

- -```js -math.catalan(n) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`n` | Number | BigNumber | nth Catalan number - -

Returns #

- -Type | Description ----- | ----------- -Number | BigNumber | Cn(n) - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.catalan(3) // returns 5 -math.catalan(8) // returns 1430 -``` - - -

See also #

- -[bellNumbers](bellNumbers.html) diff --git a/docs/reference/functions/cbrt.md b/docs/reference/functions/cbrt.md deleted file mode 100644 index d03d00a1fc..0000000000 --- a/docs/reference/functions/cbrt.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -layout: default ---- - - - -

Function cbrt #

- -Calculate the cubic root of a value. - -To avoid confusion with the matrix cube root, this function does not -apply to matrices. For a matrix, to take the cube root elementwise, -see the examples. - - -

Syntax #

- -```js -math.cbrt(x) -math.cbrt(x, allRoots) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Unit | Value for which to calculate the cubic root. -`allRoots` | boolean | Optional, false by default. Only applicable when `x` is a number or complex number. If true, all complex roots are returned, if false (default) the principal root is returned. - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Unit | Returns the cubic root of `x` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.cbrt(27) // returns 3 -math.cube(3) // returns 27 -math.cbrt(-64) // returns -4 -math.cbrt(math.unit('27 m^3')) // returns Unit 3 m -math.map([27, 64, 125], x => math.cbrt(x)) // returns [3, 4, 5] - -const x = math.complex('8i') -math.cbrt(x) // returns Complex 1.7320508075689 + i -math.cbrt(x, true) // returns Matrix [ - // 1.7320508075689 + i - // -1.7320508075689 + i - // -2i - // ] -``` - - -

See also #

- -[square](square.html), -[sqrt](sqrt.html), -[cube](cube.html) diff --git a/docs/reference/functions/ceil.md b/docs/reference/functions/ceil.md deleted file mode 100644 index 0a5db9218c..0000000000 --- a/docs/reference/functions/ceil.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -layout: default ---- - - - -

Function ceil #

- -Round a value towards plus infinity -If `x` is complex, both real and imaginary part are rounded towards plus infinity. -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.ceil(x) -math.ceil(x, n) -math.ceil(unit, valuelessUnit) -math.ceil(unit, n, valuelessUnit) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Value to be rounded -`n` | number | BigNumber | Array | Number of decimals Default value: 0. -`valuelessUnit` | Unit | A valueless unit - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Rounded value - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.ceil(3.2) // returns number 4 -math.ceil(3.8) // returns number 4 -math.ceil(-4.2) // returns number -4 -math.ceil(-4.7) // returns number -4 - -math.ceil(3.212, 2) // returns number 3.22 -math.ceil(3.288, 2) // returns number 3.29 -math.ceil(-4.212, 2) // returns number -4.21 -math.ceil(-4.782, 2) // returns number -4.78 - -const c = math.complex(3.24, -2.71) -math.ceil(c) // returns Complex 4 - 2i -math.ceil(c, 1) // returns Complex 3.3 - 2.7i - -const unit = math.unit('3.241 cm') -const cm = math.unit('cm') -const mm = math.unit('mm') -math.ceil(unit, 1, cm) // returns Unit 3.3 cm -math.ceil(unit, 1, mm) // returns Unit 32.5 mm - -math.ceil([3.2, 3.8, -4.7]) // returns Array [4, 4, -4] -math.ceil([3.21, 3.82, -4.71], 1) // returns Array [3.3, 3.9, -4.7] -``` - - -

See also #

- -[floor](floor.html), -[fix](fix.html), -[round](round.html) diff --git a/docs/reference/functions/chain.md b/docs/reference/functions/chain.md deleted file mode 100644 index 70c8fa6da9..0000000000 --- a/docs/reference/functions/chain.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -layout: default ---- - - - -

Function chain #

- -Wrap any value in a chain, allowing to perform chained operations on -the value. - -All methods available in the math.js library can be called upon the chain, -and then will be evaluated with the value itself as first argument. -The chain can be closed by executing `chain.done()`, which returns -the final value. - -The chain has a number of special functions: - -- `done()` Finalize the chain and return the chain's value. -- `valueOf()` The same as `done()` -- `toString()` Executes `math.format()` onto the chain's value, returning - a string representation of the value. - - -

Syntax #

- -```js -math.chain(value) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`value` | * | A value of any type on which to start a chained operation. - -

Returns #

- -Type | Description ----- | ----------- -math.Chain | The created chain - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.chain(3) - .add(4) - .subtract(2) - .done() // 5 - -math.chain( [[1, 2], [3, 4]] ) - .subset(math.index(0, 0), 8) - .multiply(3) - .done() // [[24, 6], [9, 12]] -``` - - diff --git a/docs/reference/functions/clone.md b/docs/reference/functions/clone.md deleted file mode 100644 index 9d1041388b..0000000000 --- a/docs/reference/functions/clone.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -layout: default ---- - - - -

Function clone #

- -Clone an object. Will make a deep copy of the data. - - -

Syntax #

- -```js -math.clone(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | * | Object to be cloned - -

Returns #

- -Type | Description ----- | ----------- -* | A clone of object x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.clone(3.5) // returns number 3.5 -math.clone(math.complex('2-4i')) // returns Complex 2 - 4i -math.clone(math.unit(45, 'deg')) // returns Unit 45 deg -math.clone([[1, 2], [3, 4]]) // returns Array [[1, 2], [3, 4]] -math.clone("hello world") // returns string "hello world" -``` - - diff --git a/docs/reference/functions/column.md b/docs/reference/functions/column.md deleted file mode 100644 index 441d5c9104..0000000000 --- a/docs/reference/functions/column.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -layout: default ---- - - - -

Function column #

- -Return a column from a Matrix. - - -

Syntax #

- -```js -math.column(value, index) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`value` | Array | Matrix | An array or matrix -`column` | number | The index of the column - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | The retrieved column - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -// get a column -const d = [[1, 2], [3, 4]] -math.column(d, 1) // returns [[2], [4]] -``` - - -

See also #

- -[row](row.html) diff --git a/docs/reference/functions/combinations.md b/docs/reference/functions/combinations.md deleted file mode 100644 index f222c34a71..0000000000 --- a/docs/reference/functions/combinations.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -layout: default ---- - - - -

Function combinations #

- -Compute the number of ways of picking `k` unordered outcomes from `n` -possibilities. - -Combinations only takes integer arguments. -The following condition must be enforced: k <= n. - - -

Syntax #

- -```js -math.combinations(n, k) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`n` | number | BigNumber | Total number of objects in the set -`k` | number | BigNumber | Number of objects in the subset - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Number of possible combinations. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.combinations(7, 5) // returns 21 -``` - - -

See also #

- -[combinationsWithRep](combinationsWithRep.html), -[permutations](permutations.html), -[factorial](factorial.html) diff --git a/docs/reference/functions/combinationsWithRep.md b/docs/reference/functions/combinationsWithRep.md deleted file mode 100644 index 035966b48b..0000000000 --- a/docs/reference/functions/combinationsWithRep.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -layout: default ---- - - - -

Function combinationsWithRep #

- -Compute the number of ways of picking `k` unordered outcomes from `n` -possibilities, allowing individual outcomes to be repeated more than once. - -CombinationsWithRep only takes integer arguments. -The following condition must be enforced: k <= n + k -1. - - -

Syntax #

- -```js -math.combinationsWithRep(n, k) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`n` | number | BigNumber | Total number of objects in the set -`k` | number | BigNumber | Number of objects in the subset - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Number of possible combinations with replacement. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.combinationsWithRep(7, 5) // returns 462 -``` - - -

See also #

- -[combinations](combinations.html), -[permutations](permutations.html), -[factorial](factorial.html) diff --git a/docs/reference/functions/compare.md b/docs/reference/functions/compare.md deleted file mode 100644 index 3c192579d0..0000000000 --- a/docs/reference/functions/compare.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -layout: default ---- - - - -

Function compare #

- -Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y. - -x and y are considered equal when the relative difference between x and y -is smaller than the configured absTol and relTol. The function cannot be used to -compare values smaller than approximately 2.22e-16. - -For matrices, the function is evaluated element wise. -Strings are compared by their numerical value. - - -

Syntax #

- -```js -math.compare(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | Unit | string | Array | Matrix | First value to compare -`y` | number | BigNumber | bigint | Fraction | Unit | string | Array | Matrix | Second value to compare - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Fraction | Array | Matrix | Returns the result of the comparison: 1 when x > y, -1 when x < y, and 0 when x == y. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.compare(6, 1) // returns 1 -math.compare(2, 3) // returns -1 -math.compare(7, 7) // returns 0 -math.compare('10', '2') // returns 1 -math.compare('1000', '1e3') // returns 0 - -const a = math.unit('5 cm') -const b = math.unit('40 mm') -math.compare(a, b) // returns 1 - -math.compare(2, [1, 2, 3]) // returns [1, 0, -1] -``` - - -

See also #

- -[equal](equal.html), -[unequal](unequal.html), -[smaller](smaller.html), -[smallerEq](smallerEq.html), -[larger](larger.html), -[largerEq](largerEq.html), -[compareNatural](compareNatural.html), -[compareText](compareText.html) diff --git a/docs/reference/functions/compareNatural.md b/docs/reference/functions/compareNatural.md deleted file mode 100644 index 033afccba2..0000000000 --- a/docs/reference/functions/compareNatural.md +++ /dev/null @@ -1,96 +0,0 @@ ---- -layout: default ---- - - - -

Function compareNatural #

- -Compare two values of any type in a deterministic, natural way. - -For numeric values, the function works the same as `math.compare`. -For types of values that can't be compared mathematically, -the function compares in a natural way. - -For numeric values, x and y are considered equal when the relative -difference between x and y is smaller than the configured relTol and absTol. -The function cannot be used to compare values smaller than -approximately 2.22e-16. - -For Complex numbers, first the real parts are compared. If equal, -the imaginary parts are compared. - -Strings are compared with a natural sorting algorithm, which -orders strings in a "logic" way following some heuristics. -This differs from the function `compare`, which converts the string -into a numeric value and compares that. The function `compareText` -on the other hand compares text lexically. - -Arrays and Matrices are compared value by value until there is an -unequal pair of values encountered. Objects are compared by sorted -keys until the keys or their values are unequal. - - -

Syntax #

- -```js -math.compareNatural(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | * | First value to compare -`y` | * | Second value to compare - -

Returns #

- -Type | Description ----- | ----------- -number | Returns the result of the comparison: 1 when x > y, -1 when x < y, and 0 when x == y. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.compareNatural(6, 1) // returns 1 -math.compareNatural(2, 3) // returns -1 -math.compareNatural(7, 7) // returns 0 - -math.compareNatural('10', '2') // returns 1 -math.compareText('10', '2') // returns -1 -math.compare('10', '2') // returns 1 - -math.compareNatural('Answer: 10', 'Answer: 2') // returns 1 -math.compareText('Answer: 10', 'Answer: 2') // returns -1 -math.compare('Answer: 10', 'Answer: 2') - // Error: Cannot convert "Answer: 10" to a number - -const a = math.unit('5 cm') -const b = math.unit('40 mm') -math.compareNatural(a, b) // returns 1 - -const c = math.complex('2 + 3i') -const d = math.complex('2 + 4i') -math.compareNatural(c, d) // returns -1 - -math.compareNatural([1, 2, 4], [1, 2, 3]) // returns 1 -math.compareNatural([1, 2, 3], [1, 2]) // returns 1 -math.compareNatural([1, 5], [1, 2, 3]) // returns 1 -math.compareNatural([1, 2], [1, 2]) // returns 0 - -math.compareNatural({a: 2}, {a: 4}) // returns -1 -``` - - -

See also #

- -[compare](compare.html), -[compareText](compareText.html) diff --git a/docs/reference/functions/compareText.md b/docs/reference/functions/compareText.md deleted file mode 100644 index e24f606a18..0000000000 --- a/docs/reference/functions/compareText.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -layout: default ---- - - - -

Function compareText #

- -Compare two strings lexically. Comparison is case sensitive. -Returns 1 when x > y, -1 when x < y, and 0 when x == y. - -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.compareText(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | string | Array | DenseMatrix | First string to compare -`y` | string | Array | DenseMatrix | Second string to compare - -

Returns #

- -Type | Description ----- | ----------- -number | Array | DenseMatrix | Returns the result of the comparison: 1 when x > y, -1 when x < y, and 0 when x == y. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.compareText('B', 'A') // returns 1 -math.compareText('2', '10') // returns 1 -math.compare('2', '10') // returns -1 -math.compareNatural('2', '10') // returns -1 - -math.compareText('B', ['A', 'B', 'C']) // returns [1, 0, -1] -``` - - -

See also #

- -[equal](equal.html), -[equalText](equalText.html), -[compare](compare.html), -[compareNatural](compareNatural.html) diff --git a/docs/reference/functions/compile.md b/docs/reference/functions/compile.md deleted file mode 100644 index 329eedabdb..0000000000 --- a/docs/reference/functions/compile.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -layout: default ---- - - - -

Function compile #

- -Parse and compile an expression. -Returns a an object with a function `evaluate([scope])` to evaluate the -compiled expression. - - -

Syntax #

- -```js -math.compile(expr) // returns one node -math.compile([expr1, expr2, expr3, ...]) // returns an array with nodes -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`expr` | string | string[] | Array | Matrix | The expression to be compiled - -

Returns #

- -Type | Description ----- | ----------- -{evaluate: Function} | Array.<{evaluate: Function}> | code An object with the compiled expression - - -

Throws #

- -Type | Description ----- | ----------- -Error | - -

Examples #

- -```js -const code1 = math.compile('sqrt(3^2 + 4^2)') -code1.evaluate() // 5 - -let scope = {a: 3, b: 4} -const code2 = math.compile('a * b') // 12 -code2.evaluate(scope) // 12 -scope.a = 5 -code2.evaluate(scope) // 20 - -const nodes = math.compile(['a = 3', 'b = 4', 'a * b']) -nodes[2].evaluate() // 12 -``` - - -

See also #

- -[parse](parse.html), -[evaluate](evaluate.html) diff --git a/docs/reference/functions/complex.md b/docs/reference/functions/complex.md deleted file mode 100644 index 860d0b80af..0000000000 --- a/docs/reference/functions/complex.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -layout: default ---- - - - -

Function complex #

- -Create a complex value or convert a value to a complex value. - - -

Syntax #

- -```js -math.complex() // creates a complex value with zero - // as real and imaginary part. -math.complex(re : number, im : string) // creates a complex value with provided - // values for real and imaginary part. -math.complex(re : number) // creates a complex value with provided - // real value and zero imaginary part. -math.complex(complex : Complex) // clones the provided complex value. -math.complex(arg : string) // parses a string into a complex value. -math.complex(array : Array) // converts the elements of the array - // or matrix element wise into a - // complex value. -math.complex({re: number, im: number}) // creates a complex value with provided - // values for real an imaginary part. -math.complex({r: number, phi: number}) // creates a complex value with provided - // polar coordinates -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`args` | * | Array | Matrix | Arguments specifying the real and imaginary part of the complex number - -

Returns #

- -Type | Description ----- | ----------- -Complex | Array | Matrix | Returns a complex value - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const a = math.complex(3, -4) // a = Complex 3 - 4i -a.re = 5 // a = Complex 5 - 4i -const i = a.im // Number -4 -const b = math.complex('2 + 6i') // Complex 2 + 6i -const c = math.complex() // Complex 0 + 0i -const d = math.add(a, b) // Complex 5 + 2i -``` - - -

See also #

- -[bignumber](bignumber.html), -[boolean](boolean.html), -[index](index.html), -[matrix](matrix.html), -[number](number.html), -[string](string.html), -[unit](unit.html) diff --git a/docs/reference/functions/composition.md b/docs/reference/functions/composition.md deleted file mode 100644 index 15cf21e07f..0000000000 --- a/docs/reference/functions/composition.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -layout: default ---- - - - -

Function composition #

- -The composition counts of n into k parts. - -composition only takes integer arguments. -The following condition must be enforced: k <= n. - - -

Syntax #

- -```js -math.composition(n, k) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`n` | Number | BigNumber | Total number of objects in the set -`k` | Number | BigNumber | Number of objects in the subset - -

Returns #

- -Type | Description ----- | ----------- -Number | BigNumber | Returns the composition counts of n into k parts. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.composition(5, 3) // returns 6 -``` - - -

See also #

- -[combinations](combinations.html) diff --git a/docs/reference/functions/concat.md b/docs/reference/functions/concat.md deleted file mode 100644 index 2a5a6f7ec6..0000000000 --- a/docs/reference/functions/concat.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -layout: default ---- - - - -

Function concat #

- -Concatenate two or more matrices. - - -

Syntax #

- -```js -math.concat(A, B, C, ...) -math.concat(A, B, C, ..., dim) -``` - -

Where #

- -- `dim: number` is a zero-based dimension over which to concatenate the matrices. - By default the last dimension of the matrices. - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`args` | ... Array | Matrix | Two or more matrices - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | Concatenated matrix - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const A = [[1, 2], [5, 6]] -const B = [[3, 4], [7, 8]] - -math.concat(A, B) // returns [[1, 2, 3, 4], [5, 6, 7, 8]] -math.concat(A, B, 0) // returns [[1, 2], [5, 6], [3, 4], [7, 8]] -math.concat('hello', ' ', 'world') // returns 'hello world' -``` - - -

See also #

- -[size](size.html), -[squeeze](squeeze.html), -[subset](subset.html), -[transpose](transpose.html) diff --git a/docs/reference/functions/config.md b/docs/reference/functions/config.md deleted file mode 100644 index 5f144d4c58..0000000000 --- a/docs/reference/functions/config.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function config #

- -Set configuration options for math.js, and get current options. -Will emit a 'config' event, with arguments (curr, prev, changes). - -This function is only available on a mathjs instance created using `create`. - - -

Syntax #

- -```js -math.config(config: Object): Object -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`options` | Object | Available options: {number} epsilon Minimum relative difference between two compared values, used by all comparison functions. {string} matrix A string 'Matrix' (default) or 'Array'. {string} number A string 'number' (default), 'BigNumber', or 'Fraction' {number} precision The number of significant digits for BigNumbers. Not applicable for Numbers. {string} parenthesis How to display parentheses in LaTeX and string output. {string} randomSeed Random seed for seeded pseudo random number generator. Set to null to randomly seed. - -

Returns #

- -Type | Description ----- | ----------- -Object | Returns the current configuration - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -import { create, all } from 'mathjs' - -// create a mathjs instance -const math = create(all) - -math.config().number // outputs 'number' -math.evaluate('0.4') // outputs number 0.4 -math.config({number: 'Fraction'}) -math.evaluate('0.4') // outputs Fraction 2/5 -``` - - diff --git a/docs/reference/functions/conj.md b/docs/reference/functions/conj.md deleted file mode 100644 index 63305ec7c4..0000000000 --- a/docs/reference/functions/conj.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function conj #

- -Compute the complex conjugate of a complex value. -If `x = a+bi`, the complex conjugate of `x` is `a - bi`. - -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.conj(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Array | Matrix | Unit | A complex number or array with complex numbers - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Array | Matrix | Unit | The complex conjugate of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.conj(math.complex('2 + 3i')) // returns Complex 2 - 3i -math.conj(math.complex('2 - 3i')) // returns Complex 2 + 3i -math.conj(math.complex('-5.2i')) // returns Complex 5.2i -``` - - -

See also #

- -[re](re.html), -[im](im.html), -[arg](arg.html), -[abs](abs.html) diff --git a/docs/reference/functions/corr.md b/docs/reference/functions/corr.md deleted file mode 100644 index 3e0dc97d7f..0000000000 --- a/docs/reference/functions/corr.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default ---- - - - -

Function corr #

- -Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated. - - -

Syntax #

- -```js -math.corr(A, B) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`A` | Array | Matrix | The first array or matrix to compute correlation coefficient -`B` | Array | Matrix | The second array or matrix to compute correlation coefficient - -

Returns #

- -Type | Description ----- | ----------- -* | The correlation coefficient - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.corr([1, 2, 3, 4, 5], [4, 5, 6, 7, 8]) // returns 1 -math.corr([1, 2.2, 3, 4.8, 5], [4, 5.3, 6.6, 7, 8]) //returns 0.9569941688503644 -math.corr([[1, 2.2, 3, 4.8, 5], [4, 5.3, 6.6, 7, 8]],[[1, 2.2, 3, 4.8, 5], [4, 5.3, 6.6, 7, 8]]) // returns [1,1] -``` - - -

See also #

- -[median](median.html), -[mean](mean.html), -[min](min.html), -[max](max.html), -[sum](sum.html), -[prod](prod.html), -[std](std.html), -[variance](variance.html) diff --git a/docs/reference/functions/cos.md b/docs/reference/functions/cos.md deleted file mode 100644 index 739887014b..0000000000 --- a/docs/reference/functions/cos.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default ---- - - - -

Function cos #

- -Calculate the cosine of a value. - -To avoid confusion with the matrix cosine, this function does not -apply to matrices. - - -

Syntax #

- -```js -math.cos(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Unit | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Cosine of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.cos(2) // returns number -0.4161468365471422 -math.cos(math.pi / 4) // returns number 0.7071067811865475 -math.cos(math.unit(180, 'deg')) // returns number -1 -math.cos(math.unit(60, 'deg')) // returns number 0.5 - -const angle = 0.2 -math.pow(math.sin(angle), 2) + math.pow(math.cos(angle), 2) // returns number 1 -``` - - -

See also #

- -[cos](cos.html), -[tan](tan.html) diff --git a/docs/reference/functions/cosh.md b/docs/reference/functions/cosh.md deleted file mode 100644 index 6fc1794a46..0000000000 --- a/docs/reference/functions/cosh.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: default ---- - - - -

Function cosh #

- -Calculate the hyperbolic cosine of a value, -defined as `cosh(x) = 1/2 * (exp(x) + exp(-x))`. - -To avoid confusion with the matrix hyperbolic cosine, this function does -not apply to matrices. - - -

Syntax #

- -```js -math.cosh(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Hyperbolic cosine of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.cosh(0.5) // returns number 1.1276259652063807 -``` - - -

See also #

- -[sinh](sinh.html), -[tanh](tanh.html) diff --git a/docs/reference/functions/cot.md b/docs/reference/functions/cot.md deleted file mode 100644 index effb2d2caa..0000000000 --- a/docs/reference/functions/cot.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -layout: default ---- - - - -

Function cot #

- -Calculate the cotangent of a value. Defined as `cot(x) = 1 / tan(x)`. - -To avoid confusion with the matrix cotangent, this function does not -apply to matrices. - - -

Syntax #

- -```js -math.cot(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | Complex | Unit | Array | Matrix | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | Complex | Array | Matrix | Cotangent of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.cot(2) // returns number -0.45765755436028577 -1 / math.tan(2) // returns number -0.45765755436028577 -``` - - -

See also #

- -[tan](tan.html), -[sec](sec.html), -[csc](csc.html) diff --git a/docs/reference/functions/coth.md b/docs/reference/functions/coth.md deleted file mode 100644 index 5a9ffc95e2..0000000000 --- a/docs/reference/functions/coth.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function coth #

- -Calculate the hyperbolic cotangent of a value, -defined as `coth(x) = 1 / tanh(x)`. - -To avoid confusion with the matrix hyperbolic cotangent, this function -does not apply to matrices. - - -

Syntax #

- -```js -math.coth(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Hyperbolic cotangent of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -// coth(x) = 1 / tanh(x) -math.coth(2) // returns 1.0373147207275482 -1 / math.tanh(2) // returns 1.0373147207275482 -``` - - -

See also #

- -[sinh](sinh.html), -[tanh](tanh.html), -[cosh](cosh.html) diff --git a/docs/reference/functions/count.md b/docs/reference/functions/count.md deleted file mode 100644 index 8c355787c0..0000000000 --- a/docs/reference/functions/count.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -layout: default ---- - - - -

Function count #

- -Count the number of elements of a matrix, array or string. - - -

Syntax #

- -```js -math.count(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | string | Array | Matrix | A matrix or string - -

Returns #

- -Type | Description ----- | ----------- -number | An integer with the elements in `x`. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.count('hello world') // returns 11 -const A = [[1, 2, 3], [4, 5, 6]] -math.count(A) // returns 6 -math.count(math.range(1,6)) // returns 5 -``` - - -

See also #

- -[size](size.html) diff --git a/docs/reference/functions/createUnit.md b/docs/reference/functions/createUnit.md deleted file mode 100644 index 4b68d4bbe2..0000000000 --- a/docs/reference/functions/createUnit.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -layout: default ---- - - - -

Function createUnit #

- -Create a user-defined unit and register it with the Unit type. - - -

Syntax #

- -```js -math.createUnit({ - baseUnit1: { - aliases: [string, ...] - prefixes: object - }, - unit2: { - definition: string, - aliases: [string, ...] - prefixes: object, - offset: number - }, - unit3: string // Shortcut -}) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`name` | string | The name of the new unit. Must be unique. Example: 'knot' -`definition` | string, UnitDefinition, Unit | Definition of the unit in terms of existing units. For example, '0.514444444 m / s'. -`options` | Object | (optional) An object containing any of the following properties:
- `prefixes {string}` "none", "short", "long", "binary_short", or "binary_long". The default is "none".
- `aliases {Array}` Array of strings. Example: ['knots', 'kt', 'kts']
- `offset {Numeric}` An offset to apply when converting from the unit. For example, the offset for celsius is 273.15. Default is 0. - -

Returns #

- -Type | Description ----- | ----------- -Unit | The new unit - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.createUnit('foo') -math.createUnit('knot', {definition: '0.514444444 m/s', aliases: ['knots', 'kt', 'kts']}) -math.createUnit('mph', '1 mile/hour') -math.createUnit('km', math.unit(1000, 'm')) -``` - - -

See also #

- -[unit](unit.html) diff --git a/docs/reference/functions/cross.md b/docs/reference/functions/cross.md deleted file mode 100644 index 7b3b5cef36..0000000000 --- a/docs/reference/functions/cross.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -layout: default ---- - - - -

Function cross #

- -Calculate the cross product for two vectors in three dimensional space. -The cross product of `A = [a1, a2, a3]` and `B = [b1, b2, b3]` is defined -as: - - cross(A, B) = [ - a2 * b3 - a3 * b2, - a3 * b1 - a1 * b3, - a1 * b2 - a2 * b1 - ] - -If one of the input vectors has a dimension greater than 1, the output -vector will be a 1x3 (2-dimensional) matrix. - - -

Syntax #

- -```js -math.cross(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Array | Matrix | First vector -`y` | Array | Matrix | Second vector - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | Returns the cross product of `x` and `y` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.cross([1, 1, 0], [0, 1, 1]) // Returns [1, -1, 1] -math.cross([3, -3, 1], [4, 9, 2]) // Returns [-15, -2, 39] -math.cross([2, 3, 4], [5, 6, 7]) // Returns [-3, 6, -3] -math.cross([[1, 2, 3]], [[4], [5], [6]]) // Returns [[-3, 6, -3]] -``` - - -

See also #

- -[dot](dot.html), -[multiply](multiply.html) diff --git a/docs/reference/functions/csc.md b/docs/reference/functions/csc.md deleted file mode 100644 index ffe3bf0cf3..0000000000 --- a/docs/reference/functions/csc.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -layout: default ---- - - - -

Function csc #

- -Calculate the cosecant of a value, defined as `csc(x) = 1/sin(x)`. - -To avoid confusion with the matrix cosecant, this function does not -apply to matrices. - - -

Syntax #

- -```js -math.csc(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Unit | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Cosecant of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.csc(2) // returns number 1.099750170294617 -1 / math.sin(2) // returns number 1.099750170294617 -``` - - -

See also #

- -[sin](sin.html), -[sec](sec.html), -[cot](cot.html) diff --git a/docs/reference/functions/csch.md b/docs/reference/functions/csch.md deleted file mode 100644 index 58f2cd9341..0000000000 --- a/docs/reference/functions/csch.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function csch #

- -Calculate the hyperbolic cosecant of a value, -defined as `csch(x) = 1 / sinh(x)`. - -To avoid confusion with the matrix hyperbolic cosecant, this function -does not apply to matrices. - - -

Syntax #

- -```js -math.csch(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Hyperbolic cosecant of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -// csch(x) = 1/ sinh(x) -math.csch(0.5) // returns 1.9190347513349437 -1 / math.sinh(0.5) // returns 1.9190347513349437 -``` - - -

See also #

- -[sinh](sinh.html), -[sech](sech.html), -[coth](coth.html) diff --git a/docs/reference/functions/ctranspose.md b/docs/reference/functions/ctranspose.md deleted file mode 100644 index e89c7de0c4..0000000000 --- a/docs/reference/functions/ctranspose.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function ctranspose #

- -Transpose and complex conjugate a matrix. All values of the matrix are -reflected over its main diagonal and then the complex conjugate is -taken. This is equivalent to complex conjugation for scalars and -vectors. - - -

Syntax #

- -```js -math.ctranspose(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Array | Matrix | Matrix to be ctransposed - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | The ctransposed matrix - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const A = [[1, 2, 3], [4, 5, math.complex(6,7)]] -math.ctranspose(A) // returns [[1, 4], [2, 5], [3, {re:6,im:-7}]] -``` - - -

See also #

- -[transpose](transpose.html), -[diag](diag.html), -[inv](inv.html), -[subset](subset.html), -[squeeze](squeeze.html) diff --git a/docs/reference/functions/cube.md b/docs/reference/functions/cube.md deleted file mode 100644 index a62947aae7..0000000000 --- a/docs/reference/functions/cube.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default ---- - - - -

Function cube #

- -Compute the cube of a value, `x * x * x`. -To avoid confusion with `pow(M,3)`, this function does not apply to matrices. -If you wish to cube every entry of a matrix, see the examples. - - -

Syntax #

- -```js -math.cube(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | Complex | Unit | Number for which to calculate the cube - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Fraction | Complex | Unit | Cube of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.cube(2) // returns number 8 -math.pow(2, 3) // returns number 8 -math.cube(4) // returns number 64 -4 * 4 * 4 // returns number 64 - -math.map([1, 2, 3, 4], math.cube) // returns Array [1, 8, 27, 64] -``` - - -

See also #

- -[multiply](multiply.html), -[square](square.html), -[pow](pow.html), -[cbrt](cbrt.html) diff --git a/docs/reference/functions/cumsum.md b/docs/reference/functions/cumsum.md deleted file mode 100644 index c10837527b..0000000000 --- a/docs/reference/functions/cumsum.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -layout: default ---- - - - -

Function cumsum #

- -Compute the cumulative sum of a matrix or a list with values. -In case of a (multi dimensional) array or matrix, the cumulative sums -along a specified dimension (defaulting to the first) will be calculated. - - -

Syntax #

- -```js -math.cumsum(a, b, c, ...) -math.cumsum(A) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`args` | ... * | A single matrix or or multiple scalar values - -

Returns #

- -Type | Description ----- | ----------- -* | The cumulative sum of all values - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.cumsum(2, 1, 4, 3) // returns [2, 3, 7, 10] -math.cumsum([2, 1, 4, 3]) // returns [2, 3, 7, 10] -math.cumsum([[1, 2], [3, 4]]) // returns [[1, 2], [4, 6]] -math.cumsum([[1, 2], [3, 4]], 0) // returns [[1, 2], [4, 6]] -math.cumsum([[1, 2], [3, 4]], 1) // returns [[1, 3], [3, 7]] -math.cumsum([[2, 5], [4, 3], [1, 7]]) // returns [[2, 5], [6, 8], [7, 15]] -``` - - -

See also #

- -[mean](mean.html), -[median](median.html), -[min](min.html), -[max](max.html), -[prod](prod.html), -[std](std.html), -[variance](variance.html), -[sum](sum.html) diff --git a/docs/reference/functions/deepEqual.md b/docs/reference/functions/deepEqual.md deleted file mode 100644 index 24888d6a10..0000000000 --- a/docs/reference/functions/deepEqual.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: default ---- - - - -

Function deepEqual #

- -Test element wise whether two matrices are equal. -The function accepts both matrices and scalar values. - -Strings are compared by their numerical value. - - -

Syntax #

- -```js -math.deepEqual(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | First matrix to compare -`y` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Second matrix to compare - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Returns true when the input matrices have the same size and each of their elements is equal. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.deepEqual(2, 4) // returns false - -a = [2, 5, 1] -b = [2, 7, 1] - -math.deepEqual(a, b) // returns false -math.equal(a, b) // returns [true, false, true] -``` - - -

See also #

- -[equal](equal.html), -[unequal](unequal.html) diff --git a/docs/reference/functions/derivative.md b/docs/reference/functions/derivative.md deleted file mode 100644 index c671648e6c..0000000000 --- a/docs/reference/functions/derivative.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -layout: default ---- - - - -

Function derivative #

- -Takes the derivative of an expression expressed in parser Nodes. -The derivative will be taken over the supplied variable in the -second parameter. If there are multiple variables in the expression, -it will return a partial derivative. - -This uses rules of differentiation which can be found here: - -- [Differentiation rules (Wikipedia)](https://en.wikipedia.org/wiki/Differentiation_rules) - - -

Syntax #

- -```js -math.derivative(expr, variable) -math.derivative(expr, variable, options) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`expr` | Node | string | The expression to differentiate -`variable` | SymbolNode | string | The variable over which to differentiate -`options` | {simplify: boolean} | There is one option available, `simplify`, which is true by default. When false, output will not be simplified. - -

Returns #

- -Type | Description ----- | ----------- -ConstantNode | SymbolNode | ParenthesisNode | FunctionNode | OperatorNode | The derivative of `expr` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.derivative('x^2', 'x') // Node '2 * x' -math.derivative('x^2', 'x', {simplify: false}) // Node '2 * 1 * x ^ (2 - 1)' -math.derivative('sin(2x)', 'x')) // Node '2 * cos(2 * x)' -math.derivative('2*x', 'x').evaluate() // number 2 -math.derivative('x^2', 'x').evaluate({x: 4}) // number 8 -const f = math.parse('x^2') -const x = math.parse('x') -math.derivative(f, x) // Node {2 * x} -``` - - -

See also #

- -[simplify](simplify.html), -[parse](parse.html), -[evaluate](evaluate.html) diff --git a/docs/reference/functions/det.md b/docs/reference/functions/det.md deleted file mode 100644 index d8a62eb737..0000000000 --- a/docs/reference/functions/det.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -layout: default ---- - - - -

Function det #

- -Calculate the determinant of a matrix. - - -

Syntax #

- -```js -math.det(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Array | Matrix | A matrix - -

Returns #

- -Type | Description ----- | ----------- -number | The determinant of `x` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.det([[1, 2], [3, 4]]) // returns -2 - -const A = [ - [-2, 2, 3], - [-1, 1, 3], - [2, 0, -1] -] -math.det(A) // returns 6 -``` - - -

See also #

- -[inv](inv.html) diff --git a/docs/reference/functions/diag.md b/docs/reference/functions/diag.md deleted file mode 100644 index b60a326c47..0000000000 --- a/docs/reference/functions/diag.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -layout: default ---- - - - -

Function diag #

- -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. -When `x` is a two dimensional matrix, the matrixes `k`th diagonal will be returned as vector. -When k is positive, the values are placed on the super diagonal. -When k is negative, the values are placed on the sub diagonal. - - -

Syntax #

- -```js -math.diag(X) -math.diag(X, format) -math.diag(X, k) -math.diag(X, k, format) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Matrix | Array | A two dimensional matrix or a vector -`k` | number | BigNumber | The diagonal where the vector will be filled in or retrieved. Default value: 0. -`format` | string | The matrix storage format. Default value: 'dense'. - -

Returns #

- -Type | Description ----- | ----------- -Matrix | Array | Diagonal matrix from input vector, or diagonal from input matrix. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js - // create a diagonal matrix - math.diag([1, 2, 3]) // returns [[1, 0, 0], [0, 2, 0], [0, 0, 3]] - math.diag([1, 2, 3], 1) // returns [[0, 1, 0, 0], [0, 0, 2, 0], [0, 0, 0, 3]] - math.diag([1, 2, 3], -1) // returns [[0, 0, 0], [1, 0, 0], [0, 2, 0], [0, 0, 3]] - -// retrieve the diagonal from a matrix -const a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] -math.diag(a) // returns [1, 5, 9] -``` - - -

See also #

- -[ones](ones.html), -[zeros](zeros.html), -[identity](identity.html) diff --git a/docs/reference/functions/diff.md b/docs/reference/functions/diff.md deleted file mode 100644 index 4dc5c55b48..0000000000 --- a/docs/reference/functions/diff.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -layout: default ---- - - - -

Function diff #

- -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 - - -

Syntax #

- -```js -math.diff(arr) -math.diff(arr, dim) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`arr` | Array | Matrix | An array or matrix -`dim` | number | BigNumber | Dimension - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | Difference between array elements in given dimension - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const arr = [1, 2, 4, 7, 0] -math.diff(arr) // returns [1, 2, 3, -7] (no dimension passed so 0 is assumed) -math.diff(math.matrix(arr)) // returns Matrix [1, 2, 3, -7] - -const arr = [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [9, 8, 7, 6, 4]] -math.diff(arr) // returns [[0, 0, 0, 0, 0], [8, 6, 4, 2, -1]] -math.diff(arr, 0) // returns [[0, 0, 0, 0, 0], [8, 6, 4, 2, -1]] -math.diff(arr, 1) // returns [[1, 1, 1, 1], [1, 1, 1, 1], [-1, -1, -1, -2]] -math.diff(arr, math.bignumber(1)) // returns [[1, 1, 1, 1], [1, 1, 1, 1], [-1, -1, -1, -2]] - -math.diff(arr, 2) // throws RangeError as arr is 2 dimensional not 3 -math.diff(arr, -1) // throws RangeError as negative dimensions are not allowed - -// These will all produce the same result -math.diff([[1, 2], [3, 4]]) -math.diff([math.matrix([1, 2]), math.matrix([3, 4])]) -math.diff([[1, 2], math.matrix([3, 4])]) -math.diff([math.matrix([1, 2]), [3, 4]]) -// They do not produce the same result as math.diff(math.matrix([[1, 2], [3, 4]])) as this returns a matrix -``` - - -

See also #

- -[sum](sum.html), -[subtract](subtract.html), -[partitionSelect](partitionSelect.html) diff --git a/docs/reference/functions/distance.md b/docs/reference/functions/distance.md deleted file mode 100644 index d4dc103f86..0000000000 --- a/docs/reference/functions/distance.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -layout: default ---- - - - -

Function distance #

- -Calculates: - The eucledian distance between two points in N-dimensional spaces. - Distance between point and a line in 2 and 3 dimensional spaces. - Pairwise distance between a set of 2D or 3D points -NOTE: - When substituting coefficients of a line(a, b and c), use ax + by + c = 0 instead of ax + by = c - For parametric equation of a 3D line, x0, y0, z0, a, b, c are from: (x−x0, y−y0, z−z0) = t(a, b, c) - - -

Syntax #

- -```js -math.distance([x1,y1], [x2,y2]) -math.distance({pointOneX, pointOneY}, {pointTwoX, pointTwoY}) -math.distance([x1,y1,z1], [x2,y2,z2]) -math.distance({pointOneX, pointOneY, pointOneZ}, {pointTwoX, pointTwoY, pointTwoZ}) -math.distance([x1,y1,z1,a1], [x2,y2,z2,a2]) -math.distance([[x1,y1], [x2,y2], [x3,y3]]) -math.distance([[x1,y1,z1], [x2,y2,z2], [x3,y3,z3]]) -math.distance([pointX,pointY], [a,b,c]) -math.distance([pointX,pointY], [lineOnePtX,lineOnePtY], [lineTwoPtX,lineTwoPtY]) -math.distance({pointX, pointY}, {lineOnePtX, lineOnePtY}, {lineTwoPtX, lineTwoPtY}) -math.distance([pointX,pointY,pointZ], [x0, y0, z0, a, b, c]) -math.distance({pointX, pointY, pointZ}, {x0, y0, z0, a, b, c}) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Array | Matrix | Object | Co-ordinates of first point -`y` | Array | Matrix | Object | Co-ordinates of second point - -

Returns #

- -Type | Description ----- | ----------- -Number | BigNumber | Returns the distance from two/three points - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.distance([0,0], [4,4]) // Returns 5.656854249492381 -math.distance( - {pointOneX: 0, pointOneY: 0}, - {pointTwoX: 10, pointTwoY: 10}) // Returns 14.142135623730951 -math.distance([1, 0, 1], [4, -2, 2]) // Returns 3.7416573867739413 -math.distance( - {pointOneX: 4, pointOneY: 5, pointOneZ: 8}, - {pointTwoX: 2, pointTwoY: 7, pointTwoZ: 9}) // Returns 3 -math.distance([1, 0, 1, 0], [0, -1, 0, -1]) // Returns 2 -math.distance([[1, 2], [1, 2], [1, 3]]) // Returns [0, 1, 1] -math.distance([[1,2,4], [1,2,6], [8,1,3]]) // Returns [2, 7.14142842854285, 7.681145747868608] -math.distance([10, 10], [8, 1, 3]) // Returns 11.535230316796387 -math.distance([0, 0], [3, 0], [0, 4]) // Returns 2.4 -math.distance( - {pointX: 0, pointY: 0}, - {lineOnePtX: 3, lineOnePtY: 0}, - {lineTwoPtX: 0, lineTwoPtY: 4}) // Returns 2.4 -math.distance([2, 3, 1], [1, 1, 2, 5, 0, 1]) // Returns 2.3204774044612857 -math.distance( - {pointX: 2, pointY: 3, pointZ: 1}, - {x0: 1, y0: 1, z0: 2, a: 5, b: 0, c: 1}) // Returns 2.3204774044612857 -``` - - diff --git a/docs/reference/functions/divide.md b/docs/reference/functions/divide.md deleted file mode 100644 index cea620d327..0000000000 --- a/docs/reference/functions/divide.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -layout: default ---- - - - -

Function divide #

- -Divide two values, `x / y`. -To divide matrices, `x` is multiplied with the inverse of `y`: `x * inv(y)`. - - -

Syntax #

- -```js -math.divide(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix | Numerator -`y` | number | BigNumber | bigint | Fraction | Complex | Array | Matrix | Denominator - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix | Quotient, `x / y` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.divide(2, 3) // returns number 0.6666666666666666 - -const a = math.complex(5, 14) -const b = math.complex(4, 1) -math.divide(a, b) // returns Complex 2 + 3i - -const c = [[7, -6], [13, -4]] -const d = [[1, 2], [4, 3]] -math.divide(c, d) // returns Array [[-9, 4], [-11, 6]] - -const e = math.unit('18 km') -math.divide(e, 4.5) // returns Unit 4 km -``` - - -

See also #

- -[multiply](multiply.html) diff --git a/docs/reference/functions/dot.md b/docs/reference/functions/dot.md deleted file mode 100644 index 6f9e8b2c45..0000000000 --- a/docs/reference/functions/dot.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -layout: default ---- - - - -

Function dot #

- -Calculate the dot product of two vectors. The dot product of -`A = [a1, a2, ..., an]` and `B = [b1, b2, ..., bn]` is defined as: - - dot(A, B) = conj(a1) * b1 + conj(a2) * b2 + ... + conj(an) * bn - - -

Syntax #

- -```js -math.dot(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Array | Matrix | First vector -`y` | Array | Matrix | Second vector - -

Returns #

- -Type | Description ----- | ----------- -number | Returns the dot product of `x` and `y` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.dot([2, 4, 1], [2, 2, 3]) // returns number 15 -math.multiply([2, 4, 1], [2, 2, 3]) // returns number 15 -``` - - -

See also #

- -[multiply](multiply.html), -[cross](cross.html) diff --git a/docs/reference/functions/dotDivide.md b/docs/reference/functions/dotDivide.md deleted file mode 100644 index 7ca0ff9227..0000000000 --- a/docs/reference/functions/dotDivide.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default ---- - - - -

Function dotDivide #

- -Divide two matrices element wise. The function accepts both matrices and -scalar values. - - -

Syntax #

- -```js -math.dotDivide(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Numerator -`y` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Denominator - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Quotient, `x ./ y` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.dotDivide(2, 4) // returns 0.5 - -a = [[9, 5], [6, 1]] -b = [[3, 2], [5, 2]] - -math.dotDivide(a, b) // returns [[3, 2.5], [1.2, 0.5]] -math.divide(a, b) // returns [[1.75, 0.75], [-1.75, 2.25]] -``` - - -

See also #

- -[divide](divide.html), -[multiply](multiply.html), -[dotMultiply](dotMultiply.html) diff --git a/docs/reference/functions/dotMultiply.md b/docs/reference/functions/dotMultiply.md deleted file mode 100644 index d7a6faec49..0000000000 --- a/docs/reference/functions/dotMultiply.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default ---- - - - -

Function dotMultiply #

- -Multiply two matrices element wise. The function accepts both matrices and -scalar values. - - -

Syntax #

- -```js -math.dotMultiply(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Left hand value -`y` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Right hand value - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Multiplication of `x` and `y` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.dotMultiply(2, 4) // returns 8 - -a = [[9, 5], [6, 1]] -b = [[3, 2], [5, 2]] - -math.dotMultiply(a, b) // returns [[27, 10], [30, 2]] -math.multiply(a, b) // returns [[52, 28], [23, 14]] -``` - - -

See also #

- -[multiply](multiply.html), -[divide](divide.html), -[dotDivide](dotDivide.html) diff --git a/docs/reference/functions/dotPow.md b/docs/reference/functions/dotPow.md deleted file mode 100644 index 6073fea3ed..0000000000 --- a/docs/reference/functions/dotPow.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -layout: default ---- - - - -

Function dotPow #

- -Calculates the power of x to y element wise. - - -

Syntax #

- -```js -math.dotPow(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Unit | Array | Matrix | The base -`y` | number | BigNumber | Complex | Unit | Array | Matrix | The exponent - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Unit | Array | Matrix | The value of `x` to the power `y` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.dotPow(2, 3) // returns number 8 - -const a = [[1, 2], [4, 3]] -math.dotPow(a, 2) // returns Array [[1, 4], [16, 9]] -math.pow(a, 2) // returns Array [[9, 8], [16, 17]] -``` - - -

See also #

- -[pow](pow.html), -[sqrt](sqrt.html), -[multiply](multiply.html) diff --git a/docs/reference/functions/eigs.md b/docs/reference/functions/eigs.md deleted file mode 100644 index 1fd0d2d483..0000000000 --- a/docs/reference/functions/eigs.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -layout: default ---- - - - -

Function eigs #

- -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. - - -

Syntax #

- -```js -math.eigs(x, [prec]) -math.eigs(x, {options}) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Array | Matrix | Matrix to be diagonalized -`opts` | number | BigNumber | OptsObject | Object with keys `precision`, defaulting to config.relTol, and `eigenvectors`, defaulting to true and specifying whether to compute eigenvectors. If just a number, specifies precision. - -

Returns #

- -Type | Description ----- | ----------- -{values: Array | Matrix, eigenvectors?: Array<EVobj>}} Object containing an array of eigenvalues and an array of {value: number | BigNumber, vector: Array | Matrix | objects. The eigenvectors property is undefined if eigenvectors were not requested. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const { eigs, multiply, column, transpose, matrixFromColumns } = math -const H = [[5, 2.3], [2.3, 1]] -const ans = eigs(H) // returns {values: [E1,E2...sorted], eigenvectors: [{value: E1, vector: v2}, {value: e, vector: v2}, ...] -const E = ans.values -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}) -``` - - -

See also #

- -[inv](inv.html) diff --git a/docs/reference/functions/equal.md b/docs/reference/functions/equal.md deleted file mode 100644 index eb81e4d9cd..0000000000 --- a/docs/reference/functions/equal.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -layout: default ---- - - - -

Function equal #

- -Test whether two values are equal. - -The function tests whether the relative difference between x and y is -smaller than the configured relTol and absTol. The function cannot be used to -compare values smaller than approximately 2.22e-16. - -For matrices, the function is evaluated element wise. -In case of complex numbers, x.re must equal y.re, and x.im must equal y.im. - -Values `null` and `undefined` are compared strictly, thus `null` is only -equal to `null` and nothing else, and `undefined` is only equal to -`undefined` and nothing else. Strings are compared by their numerical value. - - -

Syntax #

- -```js -math.equal(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | boolean | Complex | Unit | string | Array | Matrix | First value to compare -`y` | number | BigNumber | bigint | boolean | Complex | Unit | string | Array | Matrix | Second value to compare - -

Returns #

- -Type | Description ----- | ----------- -boolean | Array | Matrix | Returns true when the compared values are equal, else returns false - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.equal(2 + 2, 3) // returns false -math.equal(2 + 2, 4) // returns true - -const a = math.unit('50 cm') -const b = math.unit('5 m') -math.equal(a, b) // returns true - -const c = [2, 5, 1] -const d = [2, 7, 1] - -math.equal(c, d) // returns [true, false, true] -math.deepEqual(c, d) // returns false - -math.equal("1000", "1e3") // returns true -math.equal(0, null) // returns false -``` - - -

See also #

- -[unequal](unequal.html), -[smaller](smaller.html), -[smallerEq](smallerEq.html), -[larger](larger.html), -[largerEq](largerEq.html), -[compare](compare.html), -[deepEqual](deepEqual.html), -[equalText](equalText.html) diff --git a/docs/reference/functions/equalText.md b/docs/reference/functions/equalText.md deleted file mode 100644 index dad15732ec..0000000000 --- a/docs/reference/functions/equalText.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: default ---- - - - -

Function equalText #

- -Check equality of two strings. Comparison is case sensitive. - -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.equalText(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | string | Array | DenseMatrix | First string to compare -`y` | string | Array | DenseMatrix | Second string to compare - -

Returns #

- -Type | Description ----- | ----------- -number | Array | DenseMatrix | Returns true if the values are equal, and false if not. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.equalText('Hello', 'Hello') // returns true -math.equalText('a', 'A') // returns false -math.equal('2e3', '2000') // returns true -math.equalText('2e3', '2000') // returns false - -math.equalText('B', ['A', 'B', 'C']) // returns [false, true, false] -``` - - -

See also #

- -[equal](equal.html), -[compareText](compareText.html), -[compare](compare.html), -[compareNatural](compareNatural.html) diff --git a/docs/reference/functions/erf.md b/docs/reference/functions/erf.md deleted file mode 100644 index 110ccd004f..0000000000 --- a/docs/reference/functions/erf.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default ---- - - - -

Function erf #

- -Compute the erf function of a value using a rational Chebyshev -approximations for different intervals of x. - -This is a translation of W. J. Cody's Fortran implementation from 1987 -( https://www.netlib.org/specfun/erf ). See the AMS publication -"Rational Chebyshev Approximations for the Error Function" by W. J. Cody -for an explanation of this process. - -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.erf(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | Array | Matrix | A real number - -

Returns #

- -Type | Description ----- | ----------- -number | Array | Matrix | The erf of `x` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.erf(0.2) // returns 0.22270258921047847 -math.erf(-0.5) // returns -0.5204998778130465 -math.erf(4) // returns 0.9999999845827421 -``` - - -

See also #

- -[zeta](zeta.html) diff --git a/docs/reference/functions/evaluate.md b/docs/reference/functions/evaluate.md deleted file mode 100644 index 9c3874d617..0000000000 --- a/docs/reference/functions/evaluate.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -layout: default ---- - - - -

Function evaluate #

- -Evaluate an expression. - -The expression parser does not use JavaScript. Its syntax is close -to JavaScript but more suited for mathematical expressions. -See [https://mathjs.org/docs/expressions/syntax.html](https://mathjs.org/docs/expressions/syntax.html) to learn -the syntax and get an overview of the exact differences from JavaScript. - -Note the evaluating arbitrary expressions may involve security risks, -see [https://mathjs.org/docs/expressions/security.html](https://mathjs.org/docs/expressions/security.html) for more information. - - -

Syntax #

- -```js -math.evaluate(expr) -math.evaluate(expr, scope) -math.evaluate([expr1, expr2, expr3, ...]) -math.evaluate([expr1, expr2, expr3, ...], scope) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`expr` | string | string[] | Matrix | The expression to be evaluated -`scope` | Object | Scope to read/write variables - -

Returns #

- -Type | Description ----- | ----------- -* | The result of the expression - - -

Throws #

- -Type | Description ----- | ----------- -Error | - -

Examples #

- -```js -math.evaluate('(2+3)/4') // 1.25 -math.evaluate('sqrt(3^2 + 4^2)') // 5 -math.evaluate('sqrt(-4)') // 2i -math.evaluate(['a=3', 'b=4', 'a*b']) // [3, 4, 12] - -let scope = {a:3, b:4} -math.evaluate('a * b', scope) // 12 -``` - - -

See also #

- -[parse](parse.html), -[compile](compile.html) diff --git a/docs/reference/functions/exp.md b/docs/reference/functions/exp.md deleted file mode 100644 index dcf7539438..0000000000 --- a/docs/reference/functions/exp.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -layout: default ---- - - - -

Function exp #

- -Calculate the exponential of a value. -For matrices, if you want the matrix exponential of square matrix, use -the `expm` function; if you want to take the exponential of each element, -see the examples. - - -

Syntax #

- -```js -math.exp(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | A number to exponentiate - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Exponential of `x` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.exp(2) // returns number 7.3890560989306495 -math.pow(math.e, 2) // returns number 7.3890560989306495 -math.log(math.exp(2)) // returns number 2 - -math.map([1, 2, 3], math.exp) -// returns Array [ -// 2.718281828459045, -// 7.3890560989306495, -// 20.085536923187668 -// ] -``` - - -

See also #

- -[expm1](expm1.html), -[expm](expm.html), -[log](log.html), -[pow](pow.html) diff --git a/docs/reference/functions/expm.md b/docs/reference/functions/expm.md deleted file mode 100644 index f35ca532fa..0000000000 --- a/docs/reference/functions/expm.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -layout: default ---- - - - -

Function expm #

- -Compute the matrix exponential, expm(A) = e^A. The matrix must be square. -Not to be confused with exp(a), which performs element-wise -exponentiation. - -The exponential is calculated using the Padé approximant with scaling and -squaring; see "Nineteen Dubious Ways to Compute the Exponential of a -Matrix," by Moler and Van Loan. - - -

Syntax #

- -```js -math.expm(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Matrix | A square Matrix - -

Returns #

- -Type | Description ----- | ----------- -Matrix | The exponential of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const A = [[0,2],[0,0]] -math.expm(A) // returns [[1,2],[0,1]] -``` - - -

See also #

- -[exp](exp.html) diff --git a/docs/reference/functions/expm1.md b/docs/reference/functions/expm1.md deleted file mode 100644 index 24ebf0f7b9..0000000000 --- a/docs/reference/functions/expm1.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -layout: default ---- - - - -

Function expm1 #

- -Calculate the value of subtracting 1 from the exponential value. -This function is more accurate than `math.exp(x)-1` when `x` is near 0 -To avoid ambiguity with the matrix exponential `expm`, this function -does not operate on matrices; if you wish to apply it elementwise, see -the examples. - - -

Syntax #

- -```js -math.expm1(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | The number to exponentiate - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Exponential of `x`, minus one - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.expm1(2) // returns number 6.38905609893065 -math.pow(math.e, 2) - 1 // returns number 6.3890560989306495 -math.expm1(1e-8) // returns number 1.0000000050000001e-8 -math.exp(1e-8) - 1 // returns number 9.9999999392253e-9 -math.log(math.expm1(2) + 1) // returns number 2 - -math.map([1, 2, 3], math.expm1) -// returns Array [ -// 1.718281828459045, -// 6.3890560989306495, -// 19.085536923187668 -// ] -``` - - -

See also #

- -[exp](exp.html), -[expm](expm.html), -[log](log.html), -[pow](pow.html) diff --git a/docs/reference/functions/factorial.md b/docs/reference/functions/factorial.md deleted file mode 100644 index 9feeaf3563..0000000000 --- a/docs/reference/functions/factorial.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -layout: default ---- - - - -

Function factorial #

- -Compute the factorial of a value - -Factorial only supports an integer value as argument. -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.factorial(n) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`n` | number | BigNumber | Array | Matrix | An integer number - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Array | Matrix | The factorial of `n` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.factorial(5) // returns 120 -math.factorial(3) // returns 6 -``` - - -

See also #

- -[combinations](combinations.html), -[combinationsWithRep](combinationsWithRep.html), -[gamma](gamma.html), -[permutations](permutations.html) diff --git a/docs/reference/functions/fft.md b/docs/reference/functions/fft.md deleted file mode 100644 index 45a7bb8c73..0000000000 --- a/docs/reference/functions/fft.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -layout: default ---- - - - -

Function fft #

- -Calculate N-dimensional Fourier transform - - -

Syntax #

- -```js -math.fft(arr) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`arr` | Array | Matrix | An array or matrix - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | N-dimensional Fourier transformation of the array - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.fft([[1, 0], [1, 0]]) // returns [[{re:2, im:0}, {re:2, im:0}], [{re:0, im:0}, {re:0, im:0}]] - -``` - - -

See also #

- -[ifft](ifft.html) diff --git a/docs/reference/functions/filter.md b/docs/reference/functions/filter.md deleted file mode 100644 index 30a254741e..0000000000 --- a/docs/reference/functions/filter.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -layout: default ---- - - - -

Function filter #

- -Filter the items in an array or one dimensional matrix. - -The callback is invoked with three arguments: the current value, -the current index, and the matrix operated upon. -Note that because the matrix/array might be -multidimensional, the "index" argument is always an array of numbers giving -the index in each dimension. This is true even for vectors: the "index" -argument is an array of length 1, rather than simply a number. - - -

Syntax #

- -```js -math.filter(x, test) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Matrix | Array | A one dimensional matrix or array to filter -`test` | Function | RegExp | A function or regular expression to test items. All entries for which `test` returns true are returned. When `test` is a function, it is invoked with three parameters: the value of the element, the index of the element, and the matrix/array being traversed. The function must return a boolean. - -

Returns #

- -Type | Description ----- | ----------- -Matrix | Array | Returns the filtered matrix. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -function isPositive (x) { - return x > 0 -} -math.filter([6, -2, -1, 4, 3], isPositive) // returns [6, 4, 3] - -math.filter(["23", "foo", "100", "55", "bar"], /[0-9]+/) // returns ["23", "100", "55"] -``` - - -

See also #

- -[forEach](forEach.html), -[map](map.html), -[sort](sort.html) diff --git a/docs/reference/functions/fix.md b/docs/reference/functions/fix.md deleted file mode 100644 index ee1b4234c9..0000000000 --- a/docs/reference/functions/fix.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -layout: default ---- - - - -

Function fix #

- -Round a value towards zero. -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.fix(x) -math.fix(x,n) -math.fix(unit, valuelessUnit) -math.fix(unit, n, valuelessUnit) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Value to be rounded -`n` | number | BigNumber | Array | Number of decimals Default value: 0. -`valuelessUnit` | Unit | A valueless unit - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Rounded value - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.fix(3.2) // returns number 3 -math.fix(3.8) // returns number 3 -math.fix(-4.2) // returns number -4 -math.fix(-4.7) // returns number -4 - -math.fix(3.12, 1) // returns number 3.1 -math.fix(3.18, 1) // returns number 3.1 -math.fix(-4.12, 1) // returns number -4.1 -math.fix(-4.17, 1) // returns number -4.1 - -const c = math.complex(3.22, -2.78) -math.fix(c) // returns Complex 3 - 2i -math.fix(c, 1) // returns Complex 3.2 -2.7i - -const unit = math.unit('3.241 cm') -const cm = math.unit('cm') -const mm = math.unit('mm') -math.fix(unit, 1, cm) // returns Unit 3.2 cm -math.fix(unit, 1, mm) // returns Unit 32.4 mm - -math.fix([3.2, 3.8, -4.7]) // returns Array [3, 3, -4] -math.fix([3.2, 3.8, -4.7], 1) // returns Array [3.2, 3.8, -4.7] -``` - - -

See also #

- -[ceil](ceil.html), -[floor](floor.html), -[round](round.html) diff --git a/docs/reference/functions/flatten.md b/docs/reference/functions/flatten.md deleted file mode 100644 index aada9f8f9f..0000000000 --- a/docs/reference/functions/flatten.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -layout: default ---- - - - -

Function flatten #

- -Flatten a multidimensional matrix into a single dimensional matrix. -A new matrix is returned, the original matrix is left untouched. - - -

Syntax #

- -```js -math.flatten(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Matrix | Array | Matrix to be flattened - -

Returns #

- -Type | Description ----- | ----------- -Matrix | Array | Returns the flattened matrix - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.flatten([[1,2], [3,4]]) // returns [1, 2, 3, 4] -``` - - -

See also #

- -[concat](concat.html), -[resize](resize.html), -[size](size.html), -[squeeze](squeeze.html) diff --git a/docs/reference/functions/floor.md b/docs/reference/functions/floor.md deleted file mode 100644 index 1b367b5e86..0000000000 --- a/docs/reference/functions/floor.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -layout: default ---- - - - -

Function floor #

- -Round a value towards minus infinity. -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.floor(x) -math.floor(x, n) -math.floor(unit, valuelessUnit) -math.floor(unit, n, valuelessUnit) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Value to be rounded -`n` | number | BigNumber | Array | Number of decimals Default value: 0. -`valuelessUnit` | Unit | A valueless unit - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Rounded value - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.floor(3.2) // returns number 3 -math.floor(3.8) // returns number 3 -math.floor(-4.2) // returns number -5 -math.floor(-4.7) // returns number -5 - -math.floor(3.212, 2) // returns number 3.21 -math.floor(3.288, 2) // returns number 3.28 -math.floor(-4.212, 2) // returns number -4.22 -math.floor(-4.782, 2) // returns number -4.79 - -const c = math.complex(3.24, -2.71) -math.floor(c) // returns Complex 3 - 3i -math.floor(c, 1) // returns Complex 3.2 -2.8i - -const unit = math.unit('3.241 cm') -const cm = math.unit('cm') -const mm = math.unit('mm') -math.floor(unit, 1, cm) // returns Unit 3.2 cm -math.floor(unit, 1, mm) // returns Unit 32.4 mm - -math.floor([3.2, 3.8, -4.7]) // returns Array [3, 3, -5] -math.floor([3.21, 3.82, -4.71], 1) // returns Array [3.2, 3.8, -4.8] - -math.floor(math.tau, [2, 3]) // returns Array [6.28, 6.283] - -// Note that floor(array, array) currently not implemented. -``` - - -

See also #

- -[ceil](ceil.html), -[fix](fix.html), -[round](round.html) diff --git a/docs/reference/functions/forEach.md b/docs/reference/functions/forEach.md deleted file mode 100644 index 4c1a07be32..0000000000 --- a/docs/reference/functions/forEach.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -layout: default ---- - - - -

Function forEach #

- -Iterate over all elements of a matrix/array, and executes the given callback function. - -The callback is invoked with three arguments: the current value, -the current index, and the matrix operated upon. -Note that because the matrix/array might be -multidimensional, the "index" argument is always an array of numbers giving -the index in each dimension. This is true even for vectors: the "index" -argument is an array of length 1, rather than simply a number. - - -

Syntax #

- -```js -math.forEach(x, callback) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Matrix | Array | The matrix to iterate on. -`callback` | Function | The callback function is invoked with three parameters: the value of the element, the index of the element, and the Matrix/array being traversed. - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.forEach([1, 2, 3], function(value) { - console.log(value) -}) -// outputs 1, 2, 3 -``` - - -

See also #

- -[filter](filter.html), -[map](map.html), -[sort](sort.html) diff --git a/docs/reference/functions/format.md b/docs/reference/functions/format.md deleted file mode 100644 index 611cd30f99..0000000000 --- a/docs/reference/functions/format.md +++ /dev/null @@ -1,131 +0,0 @@ ---- -layout: default ---- - - - -

Function format #

- -Format a value of any type into a string. - - -

Syntax #

- -```js -math.format(value) -math.format(value, options) -math.format(value, precision) -math.format(value, callback) -``` - -

Where #

- - - `value: *` - The value to be formatted - - `options: Object` - An object with formatting options. Available options: - - `notation: string` - Number notation. Choose from: - - `'fixed'` - Always use regular number notation. - For example `'123.40'` and `'14000000'` - - `'exponential'` - Always use exponential notation. - For example `'1.234e+2'` and `'1.4e+7'` - - `'engineering'` - Always use engineering notation: always have exponential notation, - and select the exponent to be a multiple of `3`. - For example `'123.4e+0'` and `'14.0e+6'` - - `'auto'` (default) - Regular number notation for numbers having an absolute value between - `lower` and `upper` bounds, and uses exponential notation elsewhere. - Lower bound is included, upper bound is excluded. - For example `'123.4'` and `'1.4e7'`. - - `'bin'`, `'oct'`, or `'hex'` - Format the number using binary, octal, or hexadecimal notation. - For example `'0b1101'` and `'0x10fe'`. - - `wordSize: number | BigNumber` - The word size in bits to use for formatting in binary, octal, or - hexadecimal notation. To be used only with `'bin'`, `'oct'`, or `'hex'` - values for `notation` option. When this option is defined the value - is formatted as a signed twos complement integer of the given word - size and the size suffix is appended to the output. - For example `format(-1, {notation: 'hex', wordSize: 8}) === '0xffi8'`. - Default value is undefined. - - `precision: number | BigNumber` - Limit the number of digits of the formatted value. - For regular numbers, must be a number between `0` and `16`. - For bignumbers, the maximum depends on the configured precision, - see function `config()`. - In case of notations `'exponential'`, `'engineering'`, and `'auto'`, - `precision` defines the total number of significant digits returned. - In case of notation `'fixed'`, `precision` defines the number of - significant digits after the decimal point. - `precision` is undefined by default. - - `lowerExp: number` - Exponent determining the lower boundary for formatting a value with - an exponent when `notation='auto'`. Default value is `-3`. - - `upperExp: number` - Exponent determining the upper boundary for formatting a value with - an exponent when `notation='auto'`. Default value is `5`. - - `fraction: string`. Available values: `'ratio'` (default) or `'decimal'`. - For example `format(fraction(1, 3))` will output `'1/3'` when `'ratio'` - is configured, and will output `'0.(3)'` when `'decimal'` is configured. - - `truncate: number`. Specifies the maximum allowed length of the - returned string. If it had been longer, the excess characters - are deleted and replaced with `'...'`. -- `callback: function` - A custom formatting function, invoked for all numeric elements in `value`, - for example all elements of a matrix, or the real and imaginary - parts of a complex number. This callback can be used to override the - built-in numeric notation with any type of formatting. Function `callback` - is called with `value` as parameter and must return a string. - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`value` | * | Value to be stringified -`options` | Object | Function | number | Formatting options - -

Returns #

- -Type | Description ----- | ----------- -string | The formatted value - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.format(6.4) // returns '6.4' -math.format(1240000) // returns '1.24e+6' -math.format(1/3) // returns '0.3333333333333333' -math.format(1/3, 3) // returns '0.333' -math.format(21385, 2) // returns '21000' -math.format(12e8, {notation: 'fixed'}) // returns '1200000000' -math.format(2.3, {notation: 'fixed', precision: 4}) // returns '2.3000' -math.format(52.8, {notation: 'exponential'}) // returns '5.28e+1' -math.format(12400, {notation: 'engineering'}) // returns '12.4e+3' -math.format(2000, {lowerExp: -2, upperExp: 2}) // returns '2e+3' - -function formatCurrency(value) { - // return currency notation with two digits: - return '$' + value.toFixed(2) - - // you could also use math.format inside the callback: - // return '$' + math.format(value, {notation: 'fixed', precision: 2}) -} -math.format([2.1, 3, 0.016], formatCurrency) // returns '[$2.10, $3.00, $0.02]' -``` - - -

See also #

- -[print](print.html) diff --git a/docs/reference/functions/fraction.md b/docs/reference/functions/fraction.md deleted file mode 100644 index 9f630fafff..0000000000 --- a/docs/reference/functions/fraction.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -layout: default ---- - - - -

Function fraction #

- -Create a fraction or convert a value to a fraction. - -With one numeric argument, produces the closest rational approximation to the -input. -With two arguments, the first is the numerator and the second is the denominator, -and creates the corresponding fraction. Both numerator and denominator must be -integers. -With one object argument, looks for the integer numerator as the value of property -'n' and the integer denominator as the value of property 'd'. -With a matrix argument, creates a matrix of the same shape with entries -converted into fractions. - - -

Syntax #

- -```js -math.fraction(value) -math.fraction(numerator, denominator) -math.fraction({n: numerator, d: denominator}) -math.fraction(matrix: Array | Matrix) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`args` | number | string | Fraction | BigNumber | Array | Matrix | Arguments specifying the value, or numerator and denominator of the fraction - -

Returns #

- -Type | Description ----- | ----------- -Fraction | Array | Matrix | Returns a fraction - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.fraction(6.283) // returns Fraction 6283/1000 -math.fraction(1, 3) // returns Fraction 1/3 -math.fraction('2/3') // returns Fraction 2/3 -math.fraction({n: 2, d: 3}) // returns Fraction 2/3 -math.fraction([0.2, 0.25, 1.25]) // returns Array [1/5, 1/4, 5/4] -math.fraction(4, 5.1) // throws Error: Parameters must be integer -``` - - -

See also #

- -[bignumber](bignumber.html), -[number](number.html), -[string](string.html), -[unit](unit.html) diff --git a/docs/reference/functions/freqz.md b/docs/reference/functions/freqz.md deleted file mode 100644 index 2f59b43879..0000000000 --- a/docs/reference/functions/freqz.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -layout: default ---- - - - -

Function freqz #

- -Calculates the frequency response of a filter given its numerator and denominator coefficients. - - -

Syntax #

- -```js -math.freqz(b, a) -math.freqz(b, a, w) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`b` | Array.<number> | The numerator coefficients of the filter. -`a` | Array.<number> | The denominator coefficients of the filter. -`w` | Array.<number> | A vector of frequencies (in radians/sample) at which the frequency response is to be computed or the number of points to compute (if a number is not provided, the default is 512 points) - -

Returns #

- -Type | Description ----- | ----------- -Object | An object with two properties: h, a vector containing the complex frequency response, and w, a vector containing the normalized frequencies (in radians/sample) at which the response was computed. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.freqz([1, 2], [1, 2, 3], 4) // returns { h: [0.5 + 0i, 0.4768589245763655 + 0.2861153547458193i, 0.25000000000000006 + 0.75i, -0.770976571635189 + 0.4625859429811135i], w: [0, 0.7853981633974483, 1.5707963267948966, 2.356194490192345 ] } -math.freqz([1, 2], [1, 2, 3], [0, 1]) // returns { h: [0.5 + 0i, 0.45436781 + 0.38598051i], w: [0, 1] } -``` - - -

See also #

- -[zpk2tf](zpk2tf.html) diff --git a/docs/reference/functions/gamma.md b/docs/reference/functions/gamma.md deleted file mode 100644 index e104512831..0000000000 --- a/docs/reference/functions/gamma.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function gamma #

- -Compute the gamma function of a value using Lanczos approximation for -small values, and an extended Stirling approximation for large values. - -To avoid confusion with the matrix Gamma function, this function does -not apply to matrices. - - -

Syntax #

- -```js -math.gamma(n) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`n` | number | BigNumber | Complex | A real or complex number - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | The gamma of `n` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.gamma(5) // returns 24 -math.gamma(-0.5) // returns -3.5449077018110335 -math.gamma(math.i) // returns -0.15494982830180973 - 0.49801566811835596i -``` - - -

See also #

- -[combinations](combinations.html), -[factorial](factorial.html), -[permutations](permutations.html) diff --git a/docs/reference/functions/gcd.md b/docs/reference/functions/gcd.md deleted file mode 100644 index 686a2199e5..0000000000 --- a/docs/reference/functions/gcd.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function gcd #

- -Calculate the greatest common divisor for two or more values or arrays. - -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.gcd(a, b) -math.gcd(a, b, c, ...) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`args` | ... number | BigNumber | Fraction | Array | Matrix | Two or more integer numbers - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Fraction | Array | Matrix | The greatest common divisor - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.gcd(8, 12) // returns 4 -math.gcd(-4, 6) // returns 2 -math.gcd(25, 15, -10) // returns 5 - -math.gcd([8, -4], [12, 6]) // returns [4, 2] -``` - - -

See also #

- -[lcm](lcm.html), -[xgcd](xgcd.html) diff --git a/docs/reference/functions/getMatrixDataType.md b/docs/reference/functions/getMatrixDataType.md deleted file mode 100644 index fdb35f9524..0000000000 --- a/docs/reference/functions/getMatrixDataType.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -layout: default ---- - - - -

Function getMatrixDataType #

- -Find the data type of all elements in a matrix or array, -for example 'number' if all items are a number and 'Complex' if all values -are complex numbers. -If a matrix contains more than one data type, it will return 'mixed'. - - -

Syntax #

- -```js -math.getMatrixDataType(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | ...Matrix | Array | The Matrix with values. - -

Returns #

- -Type | Description ----- | ----------- -string | A string representation of the matrix type - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const x = [ [1, 2, 3], [4, 5, 6] ] -const mixedX = [ [1, true], [2, 3] ] -const fractionX = [ [math.fraction(1, 3)], [math.fraction(1, 3)] ] -const unitX = [ [math.unit('5cm')], [math.unit('5cm')] ] -const bigNumberX = [ [math.bignumber(1)], [math.bignumber(0)] ] -const sparse = math.sparse(x) -const dense = math.matrix(x) -math.getMatrixDataType(x) // returns 'number' -math.getMatrixDataType(sparse) // returns 'number' -math.getMatrixDataType(dense) // returns 'number' -math.getMatrixDataType(mixedX) // returns 'mixed' -math.getMatrixDataType(fractionX) // returns 'Fraction' -math.getMatrixDataType(unitX) // returns 'Unit' -math.getMatrixDataType(bigNumberX) // return 'BigNumber' -``` - - -

See also #

- -[SparseMatrix](SparseMatrix.html), -[DenseMatrix](DenseMatrix.html) diff --git a/docs/reference/functions/hasNumericValue.md b/docs/reference/functions/hasNumericValue.md deleted file mode 100644 index 47a0f93543..0000000000 --- a/docs/reference/functions/hasNumericValue.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -layout: default ---- - - - -

Function hasNumericValue #

- -Test whether a value is an numeric value. - -In case of a string, true is returned if the string contains a numeric value. - - -

Syntax #

- -```js -math.hasNumericValue(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | * | Value to be tested - -

Returns #

- -Type | Description ----- | ----------- -boolean | Returns true when `x` is a `number`, `BigNumber`, `Fraction`, `Boolean`, or a `String` containing number. Returns false for other types. Throws an error in case of unknown types. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.hasNumericValue(2) // returns true -math.hasNumericValue('2') // returns true -math.isNumeric('2') // returns false -math.hasNumericValue(0) // returns true -math.hasNumericValue(math.bignumber('500')) // returns true -math.hasNumericValue(math.bigint('42')) // returns true -math.hasNumericValue(42n) // returns true -math.hasNumericValue(math.fraction(4)) // returns true -math.hasNumericValue(math.complex('2-4i')) // returns false -math.hasNumericValue(false) // returns true -math.hasNumericValue([2.3, 'foo', false]) // returns [true, false, true] -``` - - -

See also #

- -[isZero](isZero.html), -[isPositive](isPositive.html), -[isNegative](isNegative.html), -[isInteger](isInteger.html), -[isNumeric](isNumeric.html) diff --git a/docs/reference/functions/help.md b/docs/reference/functions/help.md deleted file mode 100644 index b1a534d7fa..0000000000 --- a/docs/reference/functions/help.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -layout: default ---- - - - -

Function help #

- -Retrieve help on a function or data type. -Help files are retrieved from the embedded documentation in math.docs. - - -

Syntax #

- -```js -math.help(search) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`search` | Function | string | Object | A function or function name for which to get help - -

Returns #

- -Type | Description ----- | ----------- -Help | A help object - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -console.log(math.help('sin').toString()) -console.log(math.help(math.add).toString()) -console.log(math.help(math.add).toJSON()) -``` - - diff --git a/docs/reference/functions/hex.md b/docs/reference/functions/hex.md deleted file mode 100644 index 113b26018c..0000000000 --- a/docs/reference/functions/hex.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -layout: default ---- - - - -

Function hex #

- -Format a number as hexadecimal. - - -

Syntax #

- -```js -math.hex(value) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`value` | number | BigNumber | Value to be stringified -`wordSize` | number | BigNumber | Optional word size (see `format`) - -

Returns #

- -Type | Description ----- | ----------- -string | The formatted value - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.hex(240) // returns "0xf0" -``` - - -

See also #

- -[oct](oct.html), -[bin](bin.html) diff --git a/docs/reference/functions/hypot.md b/docs/reference/functions/hypot.md deleted file mode 100644 index 0fb1f58122..0000000000 --- a/docs/reference/functions/hypot.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -layout: default ---- - - - -

Function hypot #

- -Calculate the hypotenuse of a list with values. The hypotenuse is defined as: - - hypot(a, b, c, ...) = sqrt(a^2 + b^2 + c^2 + ...) - -For matrix input, the hypotenuse is calculated for all values in the matrix. - - -

Syntax #

- -```js -math.hypot(a, b, ...) -math.hypot([a, b, c, ...]) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`args` | ... number | BigNumber | Array | Matrix | A list with numeric values or an Array or Matrix. Matrix and Array input is flattened and returns a single number for the whole matrix. - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Returns the hypothenusa of the input values. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.hypot(3, 4) // 5 -math.hypot(3, 4, 5) // 7.0710678118654755 -math.hypot([3, 4, 5]) // 7.0710678118654755 -math.hypot(-2) // 2 -``` - - -

See also #

- -[abs](abs.html), -[norm](norm.html) diff --git a/docs/reference/functions/identity.md b/docs/reference/functions/identity.md deleted file mode 100644 index e950f7f548..0000000000 --- a/docs/reference/functions/identity.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -layout: default ---- - - - -

Function identity #

- -Create a 2-dimensional identity matrix with size m x n or n x n. -The matrix has ones on the diagonal and zeros elsewhere. - - -

Syntax #

- -```js -math.identity(n) -math.identity(n, format) -math.identity(m, n) -math.identity(m, n, format) -math.identity([m, n]) -math.identity([m, n], format) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`size` | ...number | Matrix | Array | The size for the matrix -`format` | string | The Matrix storage format - -

Returns #

- -Type | Description ----- | ----------- -Matrix | Array | number | A matrix with ones on the diagonal. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.identity(3) // returns [[1, 0, 0], [0, 1, 0], [0, 0, 1]] -math.identity(3, 2) // returns [[1, 0], [0, 1], [0, 0]] - -const A = [[1, 2, 3], [4, 5, 6]] -math.identity(math.size(A)) // returns [[1, 0, 0], [0, 1, 0]] -``` - - -

See also #

- -[diag](diag.html), -[ones](ones.html), -[zeros](zeros.html), -[size](size.html), -[range](range.html) diff --git a/docs/reference/functions/ifft.md b/docs/reference/functions/ifft.md deleted file mode 100644 index dbb2b8b6bd..0000000000 --- a/docs/reference/functions/ifft.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -layout: default ---- - - - -

Function ifft #

- -Calculate N-dimensional inverse Fourier transform - - -

Syntax #

- -```js -math.ifft(arr) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`arr` | Array | Matrix | An array or matrix - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | N-dimensional Fourier transformation of the array - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.ifft([[2, 2], [0, 0]]) // returns [[{re:1, im:0}, {re:0, im:0}], [{re:1, im:0}, {re:0, im:0}]] -``` - - -

See also #

- -[fft](fft.html) diff --git a/docs/reference/functions/im.md b/docs/reference/functions/im.md deleted file mode 100644 index 15de1bf643..0000000000 --- a/docs/reference/functions/im.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: default ---- - - - -

Function im #

- -Get the imaginary part of a complex number. -For a complex number `a + bi`, the function returns `b`. - -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.im(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Array | Matrix | A complex number or array with complex numbers - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Array | Matrix | The imaginary part of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const a = math.complex(2, 3) -math.re(a) // returns number 2 -math.im(a) // returns number 3 - -math.re(math.complex('-5.2i')) // returns number -5.2 -math.re(math.complex(2.4)) // returns number 0 -``` - - -

See also #

- -[re](re.html), -[conj](conj.html), -[abs](abs.html), -[arg](arg.html) diff --git a/docs/reference/functions/import.md b/docs/reference/functions/import.md deleted file mode 100644 index 0a7265b83d..0000000000 --- a/docs/reference/functions/import.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -layout: default ---- - - - -

Function import #

- -Import functions from an object or a module. - -This function is only available on a mathjs instance created using `create`. - - -

Syntax #

- -```js -math.import(functions) -math.import(functions, options) -``` - -

Where #

- -- `functions: Object` - An object with functions or factories to be imported. -- `options: Object` An object with import options. Available options: - - `override: boolean` - If true, existing functions will be overwritten. False by default. - - `silent: boolean` - If true, the function will not throw errors on duplicates or invalid - types. False by default. - - `wrap: boolean` - If true, the functions will be wrapped in a wrapper function - which converts data types like Matrix to primitive data types like Array. - The wrapper is needed when extending math.js with libraries which do not - support these data type. False by default. - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`functions` | Object | Array | Object with functions to be imported. -`options` | Object | Import options. - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -import { create, all } from 'mathjs' -import * as numbers from 'numbers' - -// create a mathjs instance -const math = create(all) - -// define new functions and variables -math.import({ - myvalue: 42, - hello: function (name) { - return 'hello, ' + name + '!' - } -}) - -// use the imported function and variable -math.myvalue * 2 // 84 -math.hello('user') // 'hello, user!' - -// import the npm module 'numbers' -// (must be installed first with `npm install numbers`) -math.import(numbers, {wrap: true}) - -math.fibonacci(7) // returns 13 -``` - - diff --git a/docs/reference/functions/index.md b/docs/reference/functions/index.md deleted file mode 100644 index 521f1b37cd..0000000000 --- a/docs/reference/functions/index.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -layout: default ---- - - - -

Function index #

- -Create an index. An Index can store ranges having start, step, and end -for multiple dimensions. -Matrix.get, Matrix.set, and math.subset accept an Index as input. - - -

Syntax #

- -```js -math.index(range1, range2, ...) -``` - -

Where #

- -- A number -- A string for getting/setting an object property -- An instance of `Range` -- A one-dimensional Array or a Matrix with numbers - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`ranges` | ...* | Zero or more ranges or numbers. - -

Returns #

- -Type | Description ----- | ----------- -Index | Returns the created index - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const b = [1, 2, 3, 4, 5] -math.subset(b, math.index([1, 2, 3])) // returns [2, 3, 4] - -const a = math.matrix([[1, 2], [3, 4]]) -a.subset(math.index(0, 1)) // returns 2 -``` - - -

See also #

- -[bignumber](bignumber.html), -[boolean](boolean.html), -[complex](complex.html), -[matrix](matrix.html), -[number](number.html), -[string](string.html), -[unit](unit.html) diff --git a/docs/reference/functions/intersect.md b/docs/reference/functions/intersect.md deleted file mode 100644 index ddc87981bf..0000000000 --- a/docs/reference/functions/intersect.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function intersect #

- -Calculates the point of intersection of two lines in two or three dimensions -and of a line and a plane in three dimensions. The inputs are in the form of -arrays or 1 dimensional matrices. The line intersection functions return null -if the lines do not meet. - -Note: Fill the plane coefficients as `x + y + z = c` and not as `x + y + z + c = 0`. - - -

Syntax #

- -```js -math.intersect(endPoint1Line1, endPoint2Line1, endPoint1Line2, endPoint2Line2) -math.intersect(endPoint1, endPoint2, planeCoefficients) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`w` | Array | Matrix | Co-ordinates of first end-point of first line -`x` | Array | Matrix | Co-ordinates of second end-point of first line -`y` | Array | Matrix | Co-ordinates of first end-point of second line OR Co-efficients of the plane's equation -`z` | Array | Matrix | Co-ordinates of second end-point of second line OR undefined if the calculation is for line and plane - -

Returns #

- -Type | Description ----- | ----------- -Array | Returns the point of intersection of lines/lines-planes - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.intersect([0, 0], [10, 10], [10, 0], [0, 10]) // Returns [5, 5] -math.intersect([0, 0, 0], [10, 10, 0], [10, 0, 0], [0, 10, 0]) // Returns [5, 5, 0] -math.intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6]) // Returns [7, -4, 3] -``` - - diff --git a/docs/reference/functions/inv.md b/docs/reference/functions/inv.md deleted file mode 100644 index 96ba379bd3..0000000000 --- a/docs/reference/functions/inv.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -layout: default ---- - - - -

Function inv #

- -Calculate the inverse of a square matrix. - - -

Syntax #

- -```js -math.inv(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | Complex | Array | Matrix | Matrix to be inversed - -

Returns #

- -Type | Description ----- | ----------- -number | Complex | Array | Matrix | The inverse of `x`. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.inv([[1, 2], [3, 4]]) // returns [[-2, 1], [1.5, -0.5]] -math.inv(4) // returns 0.25 -1 / 4 // returns 0.25 -``` - - -

See also #

- -[det](det.html), -[transpose](transpose.html) diff --git a/docs/reference/functions/invmod.md b/docs/reference/functions/invmod.md deleted file mode 100644 index 8d84961975..0000000000 --- a/docs/reference/functions/invmod.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: default ---- - - - -

Function invmod #

- -Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation `ax ≣ 1 (mod b)` -See https://en.wikipedia.org/wiki/Modular_multiplicative_inverse. - - -

Syntax #

- -```js -math.invmod(a, b) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`a` | number | BigNumber | An integer number -`b` | number | BigNumber | An integer number - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Returns an integer number where `invmod(a,b)*a ≣ 1 (mod b)` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.invmod(8, 12) // returns NaN -math.invmod(7, 13) // returns 2 -math.invmod(15151, 15122) // returns 10429 -``` - - -

See also #

- -[gcd](gcd.html), -[xgcd](xgcd.html) diff --git a/docs/reference/functions/isInteger.md b/docs/reference/functions/isInteger.md deleted file mode 100644 index d4dbad23ef..0000000000 --- a/docs/reference/functions/isInteger.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -layout: default ---- - - - -

Function isInteger #

- -Test whether a value is an integer number. -The function supports `number`, `BigNumber`, and `Fraction`. - -The function is evaluated element-wise in case of Array or Matrix input. - - -

Syntax #

- -```js -math.isInteger(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | Array | Matrix | Value to be tested - -

Returns #

- -Type | Description ----- | ----------- -boolean | Returns true when `x` contains a numeric, integer value. Throws an error in case of an unknown data type. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.isInteger(2) // returns true -math.isInteger(0) // returns true -math.isInteger(0.5) // returns false -math.isInteger(math.bignumber(500)) // returns true -math.isInteger(math.fraction(4)) // returns true -math.isInteger('3') // returns true -math.isInteger([3, 0.5, -2]) // returns [true, false, true] -math.isInteger(math.complex('2-4i')) // throws TypeError -``` - - -

See also #

- -[isNumeric](isNumeric.html), -[isPositive](isPositive.html), -[isNegative](isNegative.html), -[isZero](isZero.html) diff --git a/docs/reference/functions/isNaN.md b/docs/reference/functions/isNaN.md deleted file mode 100644 index 4ee7f6803a..0000000000 --- a/docs/reference/functions/isNaN.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -layout: default ---- - - - -

Function isNaN #

- -Test whether a value is NaN (not a number). -The function supports types `number`, `BigNumber`, `Fraction`, `Unit` and `Complex`. - -The function is evaluated element-wise in case of Array or Matrix input. - - -

Syntax #

- -```js -math.isNaN(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | Unit | Array | Matrix | Value to be tested - -

Returns #

- -Type | Description ----- | ----------- -boolean | Returns true when `x` is NaN. Throws an error in case of an unknown data type. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.isNaN(3) // returns false -math.isNaN(NaN) // returns true -math.isNaN(0) // returns false -math.isNaN(math.bignumber(NaN)) // returns true -math.isNaN(math.bignumber(0)) // returns false -math.isNaN(math.fraction(-2, 5)) // returns false -math.isNaN('-2') // returns false -math.isNaN([2, 0, -3, NaN]) // returns [false, false, false, true] -``` - - -

See also #

- -[isNumeric](isNumeric.html), -[isNegative](isNegative.html), -[isPositive](isPositive.html), -[isZero](isZero.html), -[isInteger](isInteger.html) diff --git a/docs/reference/functions/isNegative.md b/docs/reference/functions/isNegative.md deleted file mode 100644 index 563e23b13f..0000000000 --- a/docs/reference/functions/isNegative.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -layout: default ---- - - - -

Function isNegative #

- -Test whether a value is negative: smaller than zero. -The function supports types `number`, `BigNumber`, `Fraction`, and `Unit`. - -The function is evaluated element-wise in case of Array or Matrix input. - - -

Syntax #

- -```js -math.isNegative(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | Unit | Array | Matrix | Value to be tested - -

Returns #

- -Type | Description ----- | ----------- -boolean | Returns true when `x` is larger than zero. Throws an error in case of an unknown data type. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.isNegative(3) // returns false -math.isNegative(-2) // returns true -math.isNegative(0) // returns false -math.isNegative(-0) // returns false -math.isNegative(math.bignumber(2)) // returns false -math.isNegative(math.fraction(-2, 5)) // returns true -math.isNegative('-2') // returns true -math.isNegative([2, 0, -3]) // returns [false, false, true] -``` - - -

See also #

- -[isNumeric](isNumeric.html), -[isPositive](isPositive.html), -[isZero](isZero.html), -[isInteger](isInteger.html) diff --git a/docs/reference/functions/isNumeric.md b/docs/reference/functions/isNumeric.md deleted file mode 100644 index f5992ae257..0000000000 --- a/docs/reference/functions/isNumeric.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -layout: default ---- - - - -

Function isNumeric #

- -Test whether a value is an numeric value. - -The function is evaluated element-wise in case of Array or Matrix input. - - -

Syntax #

- -```js -math.isNumeric(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | * | Value to be tested - -

Returns #

- -Type | Description ----- | ----------- -boolean | Returns true when `x` is a `number`, `BigNumber`, `Fraction`, or `boolean`. Returns false for other types. Throws an error in case of unknown types. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.isNumeric(2) // returns true -math.isNumeric('2') // returns false -math.hasNumericValue('2') // returns true -math.isNumeric(0) // returns true -math.isNumeric(math.bignumber('42')) // returns true -math.isNumeric(math.bigint('42')) // returns true -math.isNumeric(math.fraction(4)) // returns true -math.isNumeric(math.complex('2-4i')) // returns false -math.isNumeric([2.3, 'foo', false]) // returns [true, false, true] -``` - - -

See also #

- -[isZero](isZero.html), -[isPositive](isPositive.html), -[isNegative](isNegative.html), -[isInteger](isInteger.html), -[hasNumericValue](hasNumericValue.html) diff --git a/docs/reference/functions/isPositive.md b/docs/reference/functions/isPositive.md deleted file mode 100644 index dc6f3133a8..0000000000 --- a/docs/reference/functions/isPositive.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -layout: default ---- - - - -

Function isPositive #

- -Test whether a value is positive: larger than zero. -The function supports types `number`, `BigNumber`, `Fraction`, and `Unit`. - -The function is evaluated element-wise in case of Array or Matrix input. - - -

Syntax #

- -```js -math.isPositive(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | Unit | Array | Matrix | Value to be tested - -

Returns #

- -Type | Description ----- | ----------- -boolean | Returns true when `x` is larger than zero. Throws an error in case of an unknown data type. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.isPositive(3) // returns true -math.isPositive(-2) // returns false -math.isPositive(0) // returns false -math.isPositive(-0) // returns false -math.isPositive(0.5) // returns true -math.isPositive(math.bignumber(2)) // returns true -math.isPositive(math.fraction(-2, 5)) // returns false -math.isPositive(math.fraction(1, 3)) // returns true -math.isPositive('2') // returns true -math.isPositive([2, 0, -3]) // returns [true, false, false] -``` - - -

See also #

- -[isNumeric](isNumeric.html), -[isZero](isZero.html), -[isNegative](isNegative.html), -[isInteger](isInteger.html) diff --git a/docs/reference/functions/isPrime.md b/docs/reference/functions/isPrime.md deleted file mode 100644 index 97100c67b2..0000000000 --- a/docs/reference/functions/isPrime.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -layout: default ---- - - - -

Function isPrime #

- -Test whether a value is prime: has no divisors other than itself and one. -The function supports type `number`, `bignumber`. - -The function is evaluated element-wise in case of Array or Matrix input. - - -

Syntax #

- -```js -math.isPrime(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Array | Matrix | Value to be tested - -

Returns #

- -Type | Description ----- | ----------- -boolean | Returns true when `x` is larger than zero. Throws an error in case of an unknown data type. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.isPrime(3) // returns true -math.isPrime(-2) // returns false -math.isPrime(0) // returns false -math.isPrime(-0) // returns false -math.isPrime(0.5) // returns false -math.isPrime('2') // returns true -math.isPrime([2, 17, 100]) // returns [true, true, false] -``` - - -

See also #

- -[isNumeric](isNumeric.html), -[isZero](isZero.html), -[isNegative](isNegative.html), -[isInteger](isInteger.html) diff --git a/docs/reference/functions/isZero.md b/docs/reference/functions/isZero.md deleted file mode 100644 index f516866b66..0000000000 --- a/docs/reference/functions/isZero.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -layout: default ---- - - - -

Function isZero #

- -Test whether a value is zero. -The function can check for zero for types `number`, `BigNumber`, `Fraction`, -`Complex`, and `Unit`. - -The function is evaluated element-wise in case of Array or Matrix input. - - -

Syntax #

- -```js -math.isZero(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Complex | Fraction | Unit | Array | Matrix | Value to be tested - -

Returns #

- -Type | Description ----- | ----------- -boolean | Returns true when `x` is zero. Throws an error in case of an unknown data type. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.isZero(0) // returns true -math.isZero(2) // returns false -math.isZero(0.5) // returns false -math.isZero(math.bignumber(0)) // returns true -math.isZero(math.fraction(0)) // returns true -math.isZero(math.fraction(1,3)) // returns false -math.isZero(math.complex('2 - 4i')) // returns false -math.isZero(math.complex('0i')) // returns true -math.isZero('0') // returns true -math.isZero('2') // returns false -math.isZero([2, 0, -3]) // returns [false, true, false] -``` - - -

See also #

- -[isNumeric](isNumeric.html), -[isPositive](isPositive.html), -[isNegative](isNegative.html), -[isInteger](isInteger.html) diff --git a/docs/reference/functions/kldivergence.md b/docs/reference/functions/kldivergence.md deleted file mode 100644 index dbbf064925..0000000000 --- a/docs/reference/functions/kldivergence.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -layout: default ---- - - - -

Function kldivergence #

- -Calculate the Kullback-Leibler (KL) divergence between two distributions - - -

Syntax #

- -```js -math.kldivergence(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`q` | Array | Matrix | First vector -`p` | Array | Matrix | Second vector - -

Returns #

- -Type | Description ----- | ----------- -number | Returns distance between q and p - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5]) //returns 0.24376698773121153 - -``` - - diff --git a/docs/reference/functions/kron.md b/docs/reference/functions/kron.md deleted file mode 100644 index 7a3f783ca7..0000000000 --- a/docs/reference/functions/kron.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: default ---- - - - -

Function kron #

- -Calculates the Kronecker product of 2 matrices or vectors. - -NOTE: If a one dimensional vector / matrix is given, it will be -wrapped so its two dimensions. -See the examples. - - -

Syntax #

- -```js -math.kron(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Array | Matrix | First vector -`y` | Array | Matrix | Second vector - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | Returns the Kronecker product of `x` and `y` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.kron([[1, 0], [0, 1]], [[1, 2], [3, 4]]) -// returns [ [ 1, 2, 0, 0 ], [ 3, 4, 0, 0 ], [ 0, 0, 1, 2 ], [ 0, 0, 3, 4 ] ] - -math.kron([1,1], [2,3,4]) -// returns [ [ 2, 3, 4, 2, 3, 4 ] ] -``` - - -

See also #

- -[multiply](multiply.html), -[dot](dot.html), -[cross](cross.html) diff --git a/docs/reference/functions/larger.md b/docs/reference/functions/larger.md deleted file mode 100644 index 9ff0c67003..0000000000 --- a/docs/reference/functions/larger.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -layout: default ---- - - - -

Function larger #

- -Test whether value x is larger than y. - -The function returns true when x is larger than y and the relative -difference between x and y is larger than the configured relTol and absTol. The -function cannot be used to compare values smaller than approximately 2.22e-16. - -For matrices, the function is evaluated element wise. -Strings are compared by their numerical value. - - -

Syntax #

- -```js -math.larger(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix | First value to compare -`y` | number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix | Second value to compare - -

Returns #

- -Type | Description ----- | ----------- -boolean | Array | Matrix | Returns true when the x is larger than y, else returns false - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.larger(2, 3) // returns false -math.larger(5, 2 + 2) // returns true - -const a = math.unit('5 cm') -const b = math.unit('2 inch') -math.larger(a, b) // returns false -``` - - -

See also #

- -[equal](equal.html), -[unequal](unequal.html), -[smaller](smaller.html), -[smallerEq](smallerEq.html), -[largerEq](largerEq.html), -[compare](compare.html) diff --git a/docs/reference/functions/largerEq.md b/docs/reference/functions/largerEq.md deleted file mode 100644 index 1b61d1c19a..0000000000 --- a/docs/reference/functions/largerEq.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -layout: default ---- - - - -

Function largerEq #

- -Test whether value x is larger or equal to y. - -The function returns true when x is larger than y or the relative -difference between x and y is smaller than the configured relTol and absTol. The -function cannot be used to compare values smaller than approximately 2.22e-16. - -For matrices, the function is evaluated element wise. -Strings are compared by their numerical value. - - -

Syntax #

- -```js -math.largerEq(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix | First value to compare -`y` | number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix | Second value to compare - -

Returns #

- -Type | Description ----- | ----------- -boolean | Array | Matrix | Returns true when the x is larger or equal to y, else returns false - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.larger(2, 1 + 1) // returns false -math.largerEq(2, 1 + 1) // returns true -``` - - -

See also #

- -[equal](equal.html), -[unequal](unequal.html), -[smaller](smaller.html), -[smallerEq](smallerEq.html), -[larger](larger.html), -[compare](compare.html) diff --git a/docs/reference/functions/lcm.md b/docs/reference/functions/lcm.md deleted file mode 100644 index f086246cf2..0000000000 --- a/docs/reference/functions/lcm.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -layout: default ---- - - - -

Function lcm #

- -Calculate the least common multiple for two or more values or arrays. - -lcm is defined as: - - lcm(a, b) = abs(a * b) / gcd(a, b) - -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.lcm(a, b) -math.lcm(a, b, c, ...) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`args` | ... number | BigNumber | Array | Matrix | Two or more integer numbers - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Array | Matrix | The least common multiple - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.lcm(4, 6) // returns 12 -math.lcm(6, 21) // returns 42 -math.lcm(6, 21, 5) // returns 210 - -math.lcm([4, 6], [6, 21]) // returns [12, 42] -``` - - -

See also #

- -[gcd](gcd.html), -[xgcd](xgcd.html) diff --git a/docs/reference/functions/leafCount.md b/docs/reference/functions/leafCount.md deleted file mode 100644 index fcca19ca8f..0000000000 --- a/docs/reference/functions/leafCount.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default ---- - - - -

Function leafCount #

- -Gives the number of "leaf nodes" in the parse tree of the given expression -A leaf node is one that has no subexpressions, essentially either a -symbol or a constant. Note that `5!` has just one leaf, the '5'; the -unary factorial operator does not add a leaf. On the other hand, -function symbols do add leaves, so `sin(x)/cos(x)` has four leaves. - -The `simplify()` function should generally not increase the `leafCount()` -of an expression, although currently there is no guarantee that it never -does so. In many cases, `simplify()` reduces the leaf count. - - -

Syntax #

- -```js -math.leafCount(expr) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`expr` | Node | string | The expression to count the leaves of - -

Returns #

- -Type | Description ----- | ----------- -number | The number of leaves of `expr` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.leafCount('x') // 1 -math.leafCount(math.parse('a*d-b*c')) // 4 -math.leafCount('[a,b;c,d][0,1]') // 6 -``` - - -

See also #

- -[simplify](simplify.html) diff --git a/docs/reference/functions/leftShift.md b/docs/reference/functions/leftShift.md deleted file mode 100644 index 2c294acd4b..0000000000 --- a/docs/reference/functions/leftShift.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default ---- - - - -

Function leftShift #

- -Bitwise left logical shift of a value x by y number of bits, `x << y`. -For matrices, the function is evaluated element wise. -For units, the function is evaluated on the best prefix base. - - -

Syntax #

- -```js -math.leftShift(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Array | Matrix | Value to be shifted -`y` | number | BigNumber | bigint | Amount of shifts - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Array | Matrix | `x` shifted left `y` times - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.leftShift(1, 2) // returns number 4 - -math.leftShift([1, 2, 4], 4) // returns Array [16, 32, 64] -``` - - -

See also #

- -[leftShift](leftShift.html), -[bitNot](bitNot.html), -[bitOr](bitOr.html), -[bitXor](bitXor.html), -[rightArithShift](rightArithShift.html), -[rightLogShift](rightLogShift.html) diff --git a/docs/reference/functions/lgamma.md b/docs/reference/functions/lgamma.md deleted file mode 100644 index b118cb2649..0000000000 --- a/docs/reference/functions/lgamma.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -layout: default ---- - - - -

Function lgamma #

- -Logarithm of the gamma function for real, positive numbers and complex numbers, -using Lanczos approximation for numbers and Stirling series for complex numbers. - - -

Syntax #

- -```js -math.lgamma(n) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`n` | number | Complex | A real or complex number - -

Returns #

- -Type | Description ----- | ----------- -number | Complex | The log gamma of `n` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.lgamma(5) // returns 3.178053830347945 -math.lgamma(0) // returns Infinity -math.lgamma(-0.5) // returns NaN -math.lgamma(math.i) // returns -0.6509231993018536 - 1.8724366472624294i -``` - - -

See also #

- -[gamma](gamma.html) diff --git a/docs/reference/functions/log.md b/docs/reference/functions/log.md deleted file mode 100644 index 8c70ae9586..0000000000 --- a/docs/reference/functions/log.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -layout: default ---- - - - -

Function log #

- -Calculate the logarithm of a value. - -To avoid confusion with the matrix logarithm, this function does not -apply to matrices. - - -

Syntax #

- -```js -math.log(x) -math.log(x, base) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Fraction | Complex | Value for which to calculate the logarithm. -`base` | number | BigNumber | Fraction | Complex | Optional base for the logarithm. If not provided, the natural logarithm of `x` is calculated. Default value: e. - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Fraction | Complex | Returns the logarithm of `x` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.log(3.5) // returns 1.252762968495368 -math.exp(math.log(2.4)) // returns 2.4 - -math.pow(10, 4) // returns 10000 -math.log(10000, 10) // returns 4 -math.log(10000) / math.log(10) // returns 4 - -math.log(1024, 2) // returns 10 -math.pow(2, 10) // returns 1024 -``` - - -

See also #

- -[exp](exp.html), -[log2](log2.html), -[log10](log10.html), -[log1p](log1p.html) diff --git a/docs/reference/functions/log10.md b/docs/reference/functions/log10.md deleted file mode 100644 index 2983f9e526..0000000000 --- a/docs/reference/functions/log10.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function log10 #

- -Calculate the 10-base logarithm of a value. This is the same as calculating `log(x, 10)`. - -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.log10(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Array | Matrix | Value for which to calculate the logarithm. - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Array | Matrix | Returns the 10-base logarithm of `x` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.log10(0.00001) // returns -5 -math.log10(10000) // returns 4 -math.log(10000) / math.log(10) // returns 4 -math.pow(10, 4) // returns 10000 -``` - - -

See also #

- -[exp](exp.html), -[log](log.html), -[log1p](log1p.html), -[log2](log2.html) diff --git a/docs/reference/functions/log1p.md b/docs/reference/functions/log1p.md deleted file mode 100644 index 21de459642..0000000000 --- a/docs/reference/functions/log1p.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -layout: default ---- - - - -

Function log1p #

- -Calculate the logarithm of a `value+1`. - -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.log1p(x) -math.log1p(x, base) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Array | Matrix | Value for which to calculate the logarithm of `x+1`. -`base` | number | BigNumber | Complex | Optional base for the logarithm. If not provided, the natural logarithm of `x+1` is calculated. Default value: e. - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Array | Matrix | Returns the logarithm of `x+1` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.log1p(2.5) // returns 1.252762968495368 -math.exp(math.log1p(1.4)) // returns 2.4 - -math.pow(10, 4) // returns 10000 -math.log1p(9999, 10) // returns 4 -math.log1p(9999) / math.log(10) // returns 4 -``` - - -

See also #

- -[exp](exp.html), -[log](log.html), -[log2](log2.html), -[log10](log10.html) diff --git a/docs/reference/functions/log2.md b/docs/reference/functions/log2.md deleted file mode 100644 index 3015ee5964..0000000000 --- a/docs/reference/functions/log2.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function log2 #

- -Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`. - -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.log2(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Array | Matrix | Value for which to calculate the logarithm. - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Array | Matrix | Returns the 2-base logarithm of `x` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.log2(0.03125) // returns -5 -math.log2(16) // returns 4 -math.log2(16) / math.log2(2) // returns 4 -math.pow(2, 4) // returns 16 -``` - - -

See also #

- -[exp](exp.html), -[log](log.html), -[log1p](log1p.html), -[log10](log10.html) diff --git a/docs/reference/functions/lsolve.md b/docs/reference/functions/lsolve.md deleted file mode 100644 index 9a9a9d5363..0000000000 --- a/docs/reference/functions/lsolve.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -layout: default ---- - - - -

Function lsolve #

- -Finds one solution of a linear equation system by forwards substitution. Matrix must be a lower triangular matrix. Throws an error if there's no solution. - -`L * x = b` - - -

Syntax #

- -```js -math.lsolve(L, b) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`L` | Matrix, Array | A N x N matrix or array (L) -`b` | Matrix, Array | A column vector with the b values - -

Returns #

- -Type | Description ----- | ----------- -DenseMatrix | Array | A column vector with the linear system solution (x) - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const a = [[-2, 3], [2, 1]] -const b = [11, 9] -const x = lsolve(a, b) // [[-5.5], [20]] -``` - - -

See also #

- -[lsolveAll](lsolveAll.html), -[lup](lup.html), -[slu](slu.html), -[usolve](usolve.html), -[lusolve](lusolve.html) diff --git a/docs/reference/functions/lsolveAll.md b/docs/reference/functions/lsolveAll.md deleted file mode 100644 index 16c0756590..0000000000 --- a/docs/reference/functions/lsolveAll.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -layout: default ---- - - - -

Function lsolveAll #

- -Finds all solutions of a linear equation system by forwards substitution. Matrix must be a lower triangular matrix. - -`L * x = b` - - -

Syntax #

- -```js -math.lsolveAll(L, b) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`L` | Matrix, Array | A N x N matrix or array (L) -`b` | Matrix, Array | A column vector with the b values - -

Returns #

- -Type | Description ----- | ----------- -DenseMatrix[] | Array[] | An array of affine-independent column vectors (x) that solve the linear system - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const a = [[-2, 3], [2, 1]] -const b = [11, 9] -const x = lsolveAll(a, b) // [ [[-5.5], [20]] ] -``` - - -

See also #

- -[lsolve](lsolve.html), -[lup](lup.html), -[slu](slu.html), -[usolve](usolve.html), -[lusolve](lusolve.html) diff --git a/docs/reference/functions/lup.md b/docs/reference/functions/lup.md deleted file mode 100644 index a32c2226f7..0000000000 --- a/docs/reference/functions/lup.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default ---- - - - -

Function lup #

- -Calculate the Matrix LU decomposition with partial pivoting. Matrix `A` is decomposed in two matrices (`L`, `U`) and a -row permutation vector `p` where `A[p,:] = L * U` - - -

Syntax #

- -```js -math.lup(A) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`A` | Matrix | Array | A two dimensional matrix or array for which to get the LUP decomposition. - -

Returns #

- -Type | Description ----- | ----------- -{L: Array | Matrix, U: Array | Matrix, P: Array.<number>} | The lower triangular matrix, the upper triangular matrix and the permutation matrix. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const m = [[2, 1], [1, 4]] -const r = math.lup(m) -// r = { -// L: [[1, 0], [0.5, 1]], -// U: [[2, 1], [0, 3.5]], -// P: [0, 1] -// } -``` - - -

See also #

- -[slu](slu.html), -[lsolve](lsolve.html), -[lusolve](lusolve.html), -[usolve](usolve.html) diff --git a/docs/reference/functions/lusolve.md b/docs/reference/functions/lusolve.md deleted file mode 100644 index 8c5acfdeb9..0000000000 --- a/docs/reference/functions/lusolve.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -layout: default ---- - - - -

Function lusolve #

- -Solves the linear system `A * x = b` where `A` is an [n x n] matrix and `b` is a [n] column vector. - - -

Syntax #

- -```js -math.lusolve(A, b) // returns column vector with the solution to the linear system A * x = b -math.lusolve(lup, b) // returns column vector with the solution to the linear system A * x = b, lup = math.lup(A) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`A` | Matrix | Array | Object | Invertible Matrix or the Matrix LU decomposition -`b` | Matrix | Array | Column Vector -`order` | number | The Symbolic Ordering and Analysis order, see slu for details. Matrix must be a SparseMatrix -`threshold` | Number | Partial pivoting threshold (1 for partial pivoting), see slu for details. Matrix must be a SparseMatrix. - -

Returns #

- -Type | Description ----- | ----------- -DenseMatrix | Array | Column vector with the solution to the linear system A * x = b - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const m = [[1, 0, 0, 0], [0, 2, 0, 0], [0, 0, 3, 0], [0, 0, 0, 4]] - -const x = math.lusolve(m, [-1, -1, -1, -1]) // x = [[-1], [-0.5], [-1/3], [-0.25]] - -const f = math.lup(m) -const x1 = math.lusolve(f, [-1, -1, -1, -1]) // x1 = [[-1], [-0.5], [-1/3], [-0.25]] -const x2 = math.lusolve(f, [1, 2, 1, -1]) // x2 = [[1], [1], [1/3], [-0.25]] - -const a = [[-2, 3], [2, 1]] -const b = [11, 9] -const x = math.lusolve(a, b) // [[2], [5]] -``` - - -

See also #

- -[lup](lup.html), -[slu](slu.html), -[lsolve](lsolve.html), -[usolve](usolve.html) diff --git a/docs/reference/functions/lyap.md b/docs/reference/functions/lyap.md deleted file mode 100644 index 66744625ec..0000000000 --- a/docs/reference/functions/lyap.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function lyap #

- -Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P, where -Q is an input matrix. When Q is symmetric, P is also symmetric. Notice -that different equivalent definitions exist for the Continuous-time -Lyapunov equation. -https://en.wikipedia.org/wiki/Lyapunov_equation - - -

Syntax #

- -```js -math.lyap(A, Q) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`A` | Matrix | Array | Matrix A -`Q` | Matrix | Array | Matrix Q - -

Returns #

- -Type | Description ----- | ----------- -Matrix | Array | Matrix P solution to the Continuous-time Lyapunov equation AP+PA'=Q - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const A = [[-2, 0], [1, -4]] -const Q = [[3, 1], [1, 3]] -const P = math.lyap(A, Q) -``` - - -

See also #

- -[sylvester](sylvester.html), -[schur](schur.html) diff --git a/docs/reference/functions/mad.md b/docs/reference/functions/mad.md deleted file mode 100644 index f12cccc8c9..0000000000 --- a/docs/reference/functions/mad.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function mad #

- -Compute the median absolute deviation of a matrix or a list with values. -The median absolute deviation is defined as the median of the absolute -deviations from the median. - - -

Syntax #

- -```js -math.mad(a, b, c, ...) -math.mad(A) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`array` | Array | Matrix | A single matrix or multiple scalar values. - -

Returns #

- -Type | Description ----- | ----------- -* | The median absolute deviation. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.mad(10, 20, 30) // returns 10 -math.mad([1, 2, 3]) // returns 1 -math.mad([[1, 2, 3], [4, 5, 6]]) // returns 1.5 -``` - - -

See also #

- -[median](median.html), -[mean](mean.html), -[std](std.html), -[abs](abs.html) diff --git a/docs/reference/functions/map.md b/docs/reference/functions/map.md deleted file mode 100644 index eb53616e22..0000000000 --- a/docs/reference/functions/map.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -layout: default ---- - - - -

Function map #

- -Create a new matrix or array with the results of a callback function executed on -each entry of a given matrix/array. - -For each entry of the input, - -the callback is invoked with 2N + 1 arguments: -the N values of the entry, the index at which that entry occurs, and the N full -broadcasted matrix/array being traversed where N is the number of matrices being traversed. -Note that because the matrix/array might be -multidimensional, the "index" argument is always an array of numbers giving -the index in each dimension. This is true even for vectors: the "index" -argument is an array of length 1, rather than simply a number. - - -

Syntax #

- -```js -math.map(x, callback) -math.map(x, y, ..., callback) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Matrix | Array | The input to iterate on. -`callback` | Function | The function to call (as described above) on each entry of the input - -

Returns #

- -Type | Description ----- | ----------- -Matrix | array | Transformed map of x; always has the same type and shape as x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.map([1, 2, 3], function(value) { - return value * value -}) // returns [1, 4, 9] -math.map([1, 2], [3, 4], function(a, b) { - return a + b -}) // returns [4, 6] - -// The callback is normally called with three arguments: -// callback(value, index, Array) -// If you want to call with only one argument, use: -math.map([1, 2, 3], x => math.format(x)) // returns ['1', '2', '3'] -// It can also be called with 2N + 1 arguments: for N arrays -// callback(value1, value2, index, BroadcastedArray1, BroadcastedArray2) -``` - - -

See also #

- -[filter](filter.html), -[forEach](forEach.html), -[sort](sort.html) diff --git a/docs/reference/functions/mapSlices.md b/docs/reference/functions/mapSlices.md deleted file mode 100644 index 6c72291fe3..0000000000 --- a/docs/reference/functions/mapSlices.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -layout: default ---- - - - -

Function mapSlices #

- -Apply a function that maps an array to a scalar -along a given axis of a matrix or array. -Returns a new matrix or array with one less dimension than the input. - - -

Syntax #

- -```js -math.mapSlices(A, dim, callback) -``` - -

Where #

- -- `dim: number` is a zero-based dimension over which to concatenate the matrices. - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`array` | Array | Matrix | The input Matrix -`dim` | number | The dimension along which the callback is applied -`callback` | Function | The callback function that is applied. This Function should take an array or 1-d matrix as an input and return a number. - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | res The residual matrix with the function mapped on the slices over some dimension. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const A = [[1, 2], [3, 4]] -const sum = math.sum - -math.mapSlices(A, 0, sum) // returns [4, 6] -math.mapSlices(A, 1, sum) // returns [3, 7] -``` - - -

See also #

- -[map](map.html), -[filter](filter.html), -[forEach](forEach.html) diff --git a/docs/reference/functions/matrix.md b/docs/reference/functions/matrix.md deleted file mode 100644 index ea6a8aba87..0000000000 --- a/docs/reference/functions/matrix.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -layout: default ---- - - - -

Function matrix #

- -Create a Matrix. The function creates a new `math.Matrix` object from -an `Array`. A Matrix has utility functions to manipulate the data in the -matrix, like getting the size and getting or setting values in the matrix. -Supported storage formats are 'dense' and 'sparse'. - - -

Syntax #

- -```js -math.matrix() // creates an empty matrix using default storage format (dense). -math.matrix(data) // creates a matrix with initial data using default storage format (dense). -math.matrix('dense') // creates an empty matrix using the given storage format. -math.matrix(data, 'dense') // creates a matrix with initial data using the given storage format. -math.matrix(data, 'sparse') // creates a sparse matrix with initial data. -math.matrix(data, 'sparse', 'number') // creates a sparse matrix with initial data, number data type. -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`data` | Array | Matrix | A multi dimensional array -`format` | string | The Matrix storage format, either `'dense'` or `'sparse'` -`datatype` | string | Type of the values - -

Returns #

- -Type | Description ----- | ----------- -Matrix | The created matrix - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -let m = math.matrix([[1, 2], [3, 4]]) -m.size() // Array [2, 2] -m.resize([3, 2], 5) -m.valueOf() // Array [[1, 2], [3, 4], [5, 5]] -m.get([1, 0]) // number 3 -``` - - -

See also #

- -[bignumber](bignumber.html), -[boolean](boolean.html), -[complex](complex.html), -[index](index.html), -[number](number.html), -[string](string.html), -[unit](unit.html), -[sparse](sparse.html) diff --git a/docs/reference/functions/matrixFromColumns.md b/docs/reference/functions/matrixFromColumns.md deleted file mode 100644 index 59976bbb07..0000000000 --- a/docs/reference/functions/matrixFromColumns.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -layout: default ---- - - - -

Function matrixFromColumns #

- -Create a dense matrix from vectors as individual columns. -If you pass row vectors, they will be transposed (but not conjugated!) - - -

Syntax #

- -```js -math.matrixFromColumns(...arr) -math.matrixFromColumns(col1, col2) -math.matrixFromColumns(col1, col2, col3) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`cols` | ... Array | Matrix | Multiple columns - -

Returns #

- -Type | Description ----- | ----------- -number[][] | Matrix | if at least one of the arguments is an array, an array will be returned - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.matrixFromColumns([1, 2, 3], [[4],[5],[6]]) -math.matrixFromColumns(...vectors) -``` - - -

See also #

- -[matrix](matrix.html), -[matrixFromRows](matrixFromRows.html), -[matrixFromFunction](matrixFromFunction.html), -[zeros](zeros.html) diff --git a/docs/reference/functions/matrixFromFunction.md b/docs/reference/functions/matrixFromFunction.md deleted file mode 100644 index 5e3ac8853e..0000000000 --- a/docs/reference/functions/matrixFromFunction.md +++ /dev/null @@ -1,92 +0,0 @@ ---- -layout: default ---- - - - -

Function matrixFromFunction #

- -Create a matrix by evaluating a generating function at each index. -The simplest overload returns a multi-dimensional array as long as `size` -is an array. -Passing `size` as a Matrix or specifying a `format` will result in -returning a Matrix. - - -

Syntax #

- -```js -math.matrixFromFunction(size, fn) -math.matrixFromFunction(size, fn, format) -math.matrixFromFunction(size, fn, format, datatype) -math.matrixFromFunction(size, format, fn) -math.matrixFromFunction(size, format, datatype, fn) -``` - -

Where #

- - - `size: (number[] | Matrix)` - A vector giving the extent of the array to be created in each - dimension. If size has one entry, a vector is created; if it - has two, a rectangular array/Matrix is created; if three, a - three-dimensional array/Matrix is created; and so on. - - `fn: (index: number[]) => MathType` - The callback function that will generate the entries of the - matrix. It is called in turn with the index of each entry of - the matrix. The index is always an ordinary array of numbers - with the same length as _size_. So for vectors, you will get - indices like `[0]` or `[1]`, whereas for matrices, you will - get indices like `[2, 0]` or `[1,3]`. The return value may - be any type that can go in an array or Matrix entry, although - if you supply the _datatype_ argument, you must yourself ensure - the type of the return value matches. Note that currently, - your callback _fn_ will receive 0-based indices for the matrix - entries, regardless of whether matrixFromFunction is invoked - directly from JavaScript or via the mathjs expression language. - - `format: 'dense'|'sparse'` - Specifies the storage format for the resulting Matrix. Note that - if this argument is given, the return value will always be a - Matrix (rather than possibly an Array). - - `datatype: string` - Specifies the data type of entries of the new matrix. If given, - it should be the name of a data type that mathjs supports, as - returned by the math.typeOf function. It is up to the caller - to make certain that all values returned by _fn_ are consistent - with this datatype if specified. - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`size` | Array | Matrix | The size of the matrix to be created -`fn` | function | Callback function invoked for every entry in the matrix -`format` | string | The Matrix storage format, either `'dense'` or `'sparse'` -`datatype` | string | Type of the values - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | Returns the created matrix - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.matrixFromFunction([3,3], i => i[0] - i[1]) // an antisymmetric matrix -math.matrixFromFunction([100, 100], 'sparse', i => i[0] - i[1] === 1 ? 4 : 0) // a sparse subdiagonal matrix -math.matrixFromFunction([5], i => math.random()) // a random vector -``` - - -

See also #

- -[matrix](matrix.html), -[typeOf](typeOf.html), -[zeros](zeros.html) diff --git a/docs/reference/functions/matrixFromRows.md b/docs/reference/functions/matrixFromRows.md deleted file mode 100644 index e2a1a3d5d0..0000000000 --- a/docs/reference/functions/matrixFromRows.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -layout: default ---- - - - -

Function matrixFromRows #

- -Create a dense matrix from vectors as individual rows. -If you pass column vectors, they will be transposed (but not conjugated!) - - -

Syntax #

- -```js -math.matrixFromRows(...arr) -math.matrixFromRows(row1, row2) -math.matrixFromRows(row1, row2, row3) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`rows` | ... Array | Matrix | Multiple rows - -

Returns #

- -Type | Description ----- | ----------- -number[][] | Matrix | if at least one of the arguments is an array, an array will be returned - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.matrixFromRows([1, 2, 3], [[4],[5],[6]]) -math.matrixFromRows(...vectors) -``` - - -

See also #

- -[matrix](matrix.html), -[matrixFromColumns](matrixFromColumns.html), -[matrixFromFunction](matrixFromFunction.html), -[zeros](zeros.html) diff --git a/docs/reference/functions/max.md b/docs/reference/functions/max.md deleted file mode 100644 index 354eb2ae22..0000000000 --- a/docs/reference/functions/max.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -layout: default ---- - - - -

Function max #

- -Compute the maximum value of a matrix or a list with values. -In case of a multidimensional array, the maximum of the flattened array -will be calculated. When `dim` is provided, the maximum over the selected -dimension will be calculated. Parameter `dim` is zero-based. - - -

Syntax #

- -```js -math.max(a, b, c, ...) -math.max(A) -math.max(A, dimension) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`args` | ... * | A single matrix or or multiple scalar values - -

Returns #

- -Type | Description ----- | ----------- -* | The maximum value - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.max(2, 1, 4, 3) // returns 4 -math.max([2, 1, 4, 3]) // returns 4 - -// maximum over a specified dimension (zero-based) -math.max([[2, 5], [4, 3], [1, 7]], 0) // returns [4, 7] -math.max([[2, 5], [4, 3], [1, 7]], 1) // returns [5, 4, 7] - -math.max(2.7, 7.1, -4.5, 2.0, 4.1) // returns 7.1 -math.min(2.7, 7.1, -4.5, 2.0, 4.1) // returns -4.5 -``` - - -

See also #

- -[mean](mean.html), -[median](median.html), -[min](min.html), -[prod](prod.html), -[std](std.html), -[sum](sum.html), -[variance](variance.html) diff --git a/docs/reference/functions/mean.md b/docs/reference/functions/mean.md deleted file mode 100644 index 4b90df4589..0000000000 --- a/docs/reference/functions/mean.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -layout: default ---- - - - -

Function mean #

- -Compute the mean value of matrix or a list with values. -In case of a multidimensional array, the mean of the flattened array -will be calculated. When `dim` is provided, the maximum over the selected -dimension will be calculated. Parameter `dim` is zero-based. - - -

Syntax #

- -```js -math.mean(a, b, c, ...) -math.mean(A) -math.mean(A, dimension) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`args` | ... * | A single matrix or or multiple scalar values - -

Returns #

- -Type | Description ----- | ----------- -* | The mean of all values - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.mean(2, 1, 4, 3) // returns 2.5 -math.mean([1, 2.7, 3.2, 4]) // returns 2.725 - -math.mean([[2, 5], [6, 3], [1, 7]], 0) // returns [3, 5] -math.mean([[2, 5], [6, 3], [1, 7]], 1) // returns [3.5, 4.5, 4] -``` - - -

See also #

- -[median](median.html), -[min](min.html), -[max](max.html), -[sum](sum.html), -[prod](prod.html), -[std](std.html), -[variance](variance.html) diff --git a/docs/reference/functions/median.md b/docs/reference/functions/median.md deleted file mode 100644 index 02cea8ce45..0000000000 --- a/docs/reference/functions/median.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -layout: default ---- - - - -

Function median #

- -Compute the median of a matrix or a list with values. The values are -sorted and the middle value is returned. In case of an even number of -values, the average of the two middle values is returned. -Supported types of values are: Number, BigNumber, Unit - -In case of a (multi dimensional) array or matrix, the median of all -elements will be calculated. - - -

Syntax #

- -```js -math.median(a, b, c, ...) -math.median(A) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`args` | ... * | A single matrix or or multiple scalar values - -

Returns #

- -Type | Description ----- | ----------- -* | The median - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.median(5, 2, 7) // returns 5 -math.median([3, -1, 5, 7]) // returns 4 -``` - - -

See also #

- -[mean](mean.html), -[min](min.html), -[max](max.html), -[sum](sum.html), -[prod](prod.html), -[std](std.html), -[variance](variance.html), -[quantileSeq](quantileSeq.html) diff --git a/docs/reference/functions/min.md b/docs/reference/functions/min.md deleted file mode 100644 index 8f659fa06b..0000000000 --- a/docs/reference/functions/min.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -layout: default ---- - - - -

Function min #

- -Compute the minimum value of a matrix or a list of values. -In case of a multidimensional array, the minimum of the flattened array -will be calculated. When `dim` is provided, the minimum over the selected -dimension will be calculated. Parameter `dim` is zero-based. - - -

Syntax #

- -```js -math.min(a, b, c, ...) -math.min(A) -math.min(A, dimension) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`args` | ... * | A single matrix or or multiple scalar values - -

Returns #

- -Type | Description ----- | ----------- -* | The minimum value - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.min(2, 1, 4, 3) // returns 1 -math.min([2, 1, 4, 3]) // returns 1 - -// minimum over a specified dimension (zero-based) -math.min([[2, 5], [4, 3], [1, 7]], 0) // returns [1, 3] -math.min([[2, 5], [4, 3], [1, 7]], 1) // returns [2, 3, 1] - -math.max(2.7, 7.1, -4.5, 2.0, 4.1) // returns 7.1 -math.min(2.7, 7.1, -4.5, 2.0, 4.1) // returns -4.5 -``` - - -

See also #

- -[mean](mean.html), -[median](median.html), -[max](max.html), -[prod](prod.html), -[std](std.html), -[sum](sum.html), -[variance](variance.html) diff --git a/docs/reference/functions/mod.md b/docs/reference/functions/mod.md deleted file mode 100644 index 85696ab5a2..0000000000 --- a/docs/reference/functions/mod.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -layout: default ---- - - - -

Function mod #

- -Calculates the modulus, the remainder of an integer division. - -For matrices, the function is evaluated element wise. - -The modulus is defined as: - - x - y * floor(x / y) - -See https://en.wikipedia.org/wiki/Modulo_operation. - - -

Syntax #

- -```js -math.mod(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | Array | Matrix | Dividend -`y` | number | BigNumber | bigint | Fraction | Array | Matrix | Divisor - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Fraction | Array | Matrix | Returns the remainder of `x` divided by `y`. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.mod(8, 3) // returns 2 -math.mod(11, 2) // returns 1 - -function isOdd(x) { - return math.mod(x, 2) != 0 -} - -isOdd(2) // returns false -isOdd(3) // returns true -``` - - -

See also #

- -[divide](divide.html) diff --git a/docs/reference/functions/mode.md b/docs/reference/functions/mode.md deleted file mode 100644 index 2a593c68d3..0000000000 --- a/docs/reference/functions/mode.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function mode #

- -Computes the mode of a set of numbers or a list with values(numbers or characters). -If there are multiple modes, it returns a list of those values. - - -

Syntax #

- -```js -math.mode(a, b, c, ...) -math.mode(A) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`args` | ... * | A single matrix - -

Returns #

- -Type | Description ----- | ----------- -* | The mode of all values - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.mode(2, 1, 4, 3, 1) // returns [1] -math.mode([1, 2.7, 3.2, 4, 2.7]) // returns [2.7] -math.mode(1, 4, 6, 1, 6) // returns [1, 6] -math.mode('a','a','b','c') // returns ["a"] -math.mode(1, 1.5, 'abc') // returns [1, 1.5, "abc"] -``` - - -

See also #

- -[median](median.html), -[](.html), -[mean](mean.html) diff --git a/docs/reference/functions/multinomial.md b/docs/reference/functions/multinomial.md deleted file mode 100644 index db1bc1b2e9..0000000000 --- a/docs/reference/functions/multinomial.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -layout: default ---- - - - -

Function multinomial #

- -Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities. - -multinomial takes one array of integers as an argument. -The following condition must be enforced: every ai <= 0 - - -

Syntax #

- -```js -math.multinomial(a) // a is an array type -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`a` | number[] | BigNumber[] | Integer numbers of objects in the subset - -

Returns #

- -Type | Description ----- | ----------- -Number | BigNumber | Multinomial coefficient. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.multinomial([1,2,1]) // returns 12 -``` - - -

See also #

- -[combinations](combinations.html), -[factorial](factorial.html) diff --git a/docs/reference/functions/multiply.md b/docs/reference/functions/multiply.md deleted file mode 100644 index af87de2653..0000000000 --- a/docs/reference/functions/multiply.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -layout: default ---- - - - -

Function multiply #

- -Multiply two or more values, `x * y`. -For matrices, the matrix product is calculated. - - -

Syntax #

- -```js -math.multiply(x, y) -math.multiply(x, y, z, ...) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix | First value to multiply -`y` | number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix | Second value to multiply - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix | Multiplication of `x` and `y` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.multiply(4, 5.2) // returns number 20.8 -math.multiply(2, 3, 4) // returns number 24 - -const a = math.complex(2, 3) -const b = math.complex(4, 1) -math.multiply(a, b) // returns Complex 5 + 14i - -const c = [[1, 2], [4, 3]] -const d = [[1, 2, 3], [3, -4, 7]] -math.multiply(c, d) // returns Array [[7, -6, 17], [13, -4, 33]] - -const e = math.unit('2.1 km') -math.multiply(3, e) // returns Unit 6.3 km -``` - - -

See also #

- -[divide](divide.html), -[prod](prod.html), -[cross](cross.html), -[dot](dot.html) diff --git a/docs/reference/functions/norm.md b/docs/reference/functions/norm.md deleted file mode 100644 index 3264c40e31..0000000000 --- a/docs/reference/functions/norm.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -layout: default ---- - - - -

Function norm #

- -Calculate the norm of a number, vector or matrix. - -The second parameter p is optional. If not provided, it defaults to 2. - - -

Syntax #

- -```js -math.norm(x) -math.norm(x, p) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Array | Matrix | Value for which to calculate the norm -`p` | number | BigNumber | string | Vector space. Supported numbers include Infinity and -Infinity. Supported strings are: 'inf', '-inf', and 'fro' (The Frobenius norm) Default value: 2. - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | the p-norm - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.abs(-3.5) // returns 3.5 -math.norm(-3.5) // returns 3.5 - -math.norm(math.complex(3, -4)) // returns 5 - -math.norm([1, 2, -3], Infinity) // returns 3 -math.norm([1, 2, -3], -Infinity) // returns 1 - -math.norm([3, 4], 2) // returns 5 - -math.norm([[1, 2], [3, 4]], 1) // returns 6 -math.norm([[1, 2], [3, 4]], 'inf') // returns 7 -math.norm([[1, 2], [3, 4]], 'fro') // returns 5.477225575051661 -``` - - -

See also #

- -[abs](abs.html), -[hypot](hypot.html) diff --git a/docs/reference/functions/not.md b/docs/reference/functions/not.md deleted file mode 100644 index f299b2a6e7..0000000000 --- a/docs/reference/functions/not.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function not #

- -Logical `not`. Flips boolean value of a given parameter. -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.not(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Complex | Unit | Array | Matrix | First value to check - -

Returns #

- -Type | Description ----- | ----------- -boolean | Array | Matrix | Returns true when input is a zero or empty value. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.not(2) // returns false -math.not(0) // returns true -math.not(true) // returns false - -a = [2, -7, 0] -math.not(a) // returns [false, false, true] -``` - - -

See also #

- -[and](and.html), -[or](or.html), -[xor](xor.html) diff --git a/docs/reference/functions/nthRoot.md b/docs/reference/functions/nthRoot.md deleted file mode 100644 index 968e0bc3e5..0000000000 --- a/docs/reference/functions/nthRoot.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: default ---- - - - -

Function nthRoot #

- -Calculate the nth root of a value. -The principal nth root of a positive real number A, is the positive real -solution of the equation - - x^root = A - -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.nthRoot(a) -math.nthRoot(a, root) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`a` | number | BigNumber | Array | Matrix | Complex | Value for which to calculate the nth root -`root` | number | BigNumber | The root. Default value: 2. - -

Returns #

- -Type | Description ----- | ----------- -number | Complex | Array | Matrix | Returns the nth root of `a` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.nthRoot(9, 2) // returns 3 (since 3^2 == 9) -math.sqrt(9) // returns 3 (since 3^2 == 9) -math.nthRoot(64, 3) // returns 4 (since 4^3 == 64) -``` - - -

See also #

- -[sqrt](sqrt.html), -[pow](pow.html) diff --git a/docs/reference/functions/nthRoots.md b/docs/reference/functions/nthRoots.md deleted file mode 100644 index 2d97283f59..0000000000 --- a/docs/reference/functions/nthRoots.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -layout: default ---- - - - -

Function nthRoots #

- -Calculate the nth roots of a value. -An nth root of a positive real number A, -is a positive real solution of the equation "x^root = A". -This function returns an array of complex values. - - -

Syntax #

- -```js -math.nthRoots(x) -math.nthRoots(x, root) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Fraction | Complex | Number to be rounded -`root` | number | Optional root, default value is 2 Default value: 2. - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Fraction | Complex | Returns the nth roots - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.nthRoots(1) -// returns [ -// {re: 1, im: 0}, -// {re: -1, im: 0} -// ] -math.nthRoots(1, 3) -// returns [ -// { re: 1, im: 0 }, -// { re: -0.4999999999999998, im: 0.8660254037844387 }, -// { re: -0.5000000000000004, im: -0.8660254037844385 } -// ] -``` - - -

See also #

- -[nthRoot](nthRoot.html), -[pow](pow.html), -[sqrt](sqrt.html) diff --git a/docs/reference/functions/number.md b/docs/reference/functions/number.md deleted file mode 100644 index 421c97f2a4..0000000000 --- a/docs/reference/functions/number.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -layout: default ---- - - - -

Function number #

- -Create a number or convert a string, boolean, or unit to a number. -When value is a matrix, all elements will be converted to number. - - -

Syntax #

- -```js -math.number(value) -math.number(unit, valuelessUnit) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`value` | string | number | BigNumber | Fraction | boolean | Array | Matrix | Unit | null | Value to be converted -`valuelessUnit` | Unit | string | A valueless unit, used to convert a unit to a number - -

Returns #

- -Type | Description ----- | ----------- -number | Array | Matrix | The created number - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.number(2) // returns number 2 -math.number('7.2') // returns number 7.2 -math.number(true) // returns number 1 -math.number([true, false, true, true]) // returns [1, 0, 1, 1] -math.number(math.unit('52cm'), 'm') // returns 0.52 -``` - - -

See also #

- -[bignumber](bignumber.html), -[boolean](boolean.html), -[complex](complex.html), -[index](index.html), -[matrix](matrix.html), -[string](string.html), -[unit](unit.html) diff --git a/docs/reference/functions/numeric.md b/docs/reference/functions/numeric.md deleted file mode 100644 index e161309911..0000000000 --- a/docs/reference/functions/numeric.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -layout: default ---- - - - -

Function numeric #

- -Convert a numeric input to a specific numeric type: number, BigNumber, bigint, or Fraction. - - -

Syntax #

- -```js -math.numeric(x) -math.numeric(value, outputType) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`value` | string | number | BigNumber | bigint | Fraction | A numeric value or a string containing a numeric value -`outputType` | string | Desired numeric output type. Available values: 'number', 'BigNumber', or 'Fraction' - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Fraction | Returns an instance of the numeric in the requested type - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.numeric('4') // returns 4 -math.numeric('4', 'number') // returns 4 -math.numeric('4', 'bigint') // returns 4n -math.numeric('4', 'BigNumber') // returns BigNumber 4 -math.numeric('4', 'Fraction') // returns Fraction 4 -math.numeric(4, 'Fraction') // returns Fraction 4 -math.numeric(math.fraction(2, 5), 'number') // returns 0.4 -``` - - -

See also #

- -[number](number.html), -[fraction](fraction.html), -[bignumber](bignumber.html), -[bigint](bigint.html), -[string](string.html), -[format](format.html) diff --git a/docs/reference/functions/oct.md b/docs/reference/functions/oct.md deleted file mode 100644 index ece9068972..0000000000 --- a/docs/reference/functions/oct.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -layout: default ---- - - - -

Function oct #

- -Format a number as octal. - - -

Syntax #

- -```js -math.oct(value) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`value` | number | BigNumber | Value to be stringified -`wordSize` | number | BigNumber | Optional word size (see `format`) - -

Returns #

- -Type | Description ----- | ----------- -string | The formatted value - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -//the following outputs "0o70" -math.oct(56) -``` - - -

See also #

- -[bin](bin.html), -[hex](hex.html) diff --git a/docs/reference/functions/ones.md b/docs/reference/functions/ones.md deleted file mode 100644 index 695962b6af..0000000000 --- a/docs/reference/functions/ones.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -layout: default ---- - - - -

Function ones #

- -Create a matrix filled with ones. The created matrix can have one or -multiple dimensions. - - -

Syntax #

- -```js -math.ones(m) -math.ones(m, format) -math.ones(m, n) -math.ones(m, n, format) -math.ones([m, n]) -math.ones([m, n], format) -math.ones([m, n, p, ...]) -math.ones([m, n, p, ...], format) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`size` | ...(number | BigNumber) | Array | The size of each dimension of the matrix -`format` | string | The Matrix storage format - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | number | A matrix filled with ones - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.ones() // returns [] -math.ones(3) // returns [1, 1, 1] -math.ones(3, 2) // returns [[1, 1], [1, 1], [1, 1]] -math.ones(3, 2, 'dense') // returns Dense Matrix [[1, 1], [1, 1], [1, 1]] - -const A = [[1, 2, 3], [4, 5, 6]] -math.ones(math.size(A)) // returns [[1, 1, 1], [1, 1, 1]] -``` - - -

See also #

- -[zeros](zeros.html), -[identity](identity.html), -[size](size.html), -[range](range.html) diff --git a/docs/reference/functions/or.md b/docs/reference/functions/or.md deleted file mode 100644 index c1b64026bb..0000000000 --- a/docs/reference/functions/or.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: default ---- - - - -

Function or #

- -Logical `or`. Test if at least one value is defined with a nonzero/nonempty value. -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.or(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Complex | Unit | Array | Matrix | First value to check -`y` | number | BigNumber | bigint | Complex | Unit | Array | Matrix | Second value to check - -

Returns #

- -Type | Description ----- | ----------- -boolean | Array | Matrix | Returns true when one of the inputs is defined with a nonzero/nonempty value. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.or(2, 4) // returns true - -a = [2, 5, 0] -b = [0, 22, 0] -c = 0 - -math.or(a, b) // returns [true, true, false] -math.or(b, c) // returns [false, true, false] -``` - - -

See also #

- -[and](and.html), -[not](not.html), -[xor](xor.html) diff --git a/docs/reference/functions/parse.md b/docs/reference/functions/parse.md deleted file mode 100644 index d098c01c70..0000000000 --- a/docs/reference/functions/parse.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -layout: default ---- - - - -

Function parse #

- -Parse an expression. Returns a node tree, which can be evaluated by -invoking node.evaluate(). - -Note the evaluating arbitrary expressions may involve security risks, -see [https://mathjs.org/docs/expressions/security.html](https://mathjs.org/docs/expressions/security.html) for more information. - - -

Syntax #

- -```js -math.parse(expr) -math.parse(expr, options) -math.parse([expr1, expr2, expr3, ...]) -math.parse([expr1, expr2, expr3, ...], options) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`expr` | string | string[] | Matrix | Expression to be parsed -`options` | {nodes: Object<string, Node>} | Available options:
- `nodes` a set of custom nodes - -

Returns #

- -Type | Description ----- | ----------- -Node | Node[] | node - - -

Throws #

- -Type | Description ----- | ----------- -Error | - -

Examples #

- -```js -const node1 = math.parse('sqrt(3^2 + 4^2)') -node1.compile().evaluate() // 5 - -let scope = {a:3, b:4} -const node2 = math.parse('a * b') // 12 -const code2 = node2.compile() -code2.evaluate(scope) // 12 -scope.a = 5 -code2.evaluate(scope) // 20 - -const nodes = math.parse(['a = 3', 'b = 4', 'a * b']) -nodes[2].compile().evaluate() // 12 -``` - - -

See also #

- -[evaluate](evaluate.html), -[compile](compile.html) diff --git a/docs/reference/functions/parser.md b/docs/reference/functions/parser.md deleted file mode 100644 index 5ef3f3527e..0000000000 --- a/docs/reference/functions/parser.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -layout: default ---- - - - -

Function parser #

- -Create a `math.Parser` object that keeps a context of variables and their values, allowing the evaluation of expressions in that context. - - -

Syntax #

- -```js -math.parser() -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- - - -

Returns #

- -Type | Description ----- | ----------- -Parser | Parser - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const parser = new math.parser() - -// evaluate expressions -const a = parser.evaluate('sqrt(3^2 + 4^2)') // 5 -const b = parser.evaluate('sqrt(-4)') // 2i -const c = parser.evaluate('2 inch in cm') // 5.08 cm -const d = parser.evaluate('cos(45 deg)') // 0.7071067811865476 - -// define variables and functions -parser.evaluate('x = 7 / 2') // 3.5 -parser.evaluate('x + 3') // 6.5 -parser.evaluate('f(x, y) = x^y') // f(x, y) -parser.evaluate('f(2, 3)') // 8 - -// get and set variables and functions -const x = parser.get('x') // 3.5 -const f = parser.get('f') // function -const g = f(3, 2) // 9 -parser.set('h', 500) -const i = parser.evaluate('h / 2') // 250 -parser.set('hello', function (name) { - return 'hello, ' + name + '!' -}) -parser.evaluate('hello("user")') // "hello, user!" - -// clear defined functions and variables -parser.clear() -``` - - -

See also #

- -[evaluate](evaluate.html), -[compile](compile.html), -[parse](parse.html) diff --git a/docs/reference/functions/partitionSelect.md b/docs/reference/functions/partitionSelect.md deleted file mode 100644 index e08ab9d419..0000000000 --- a/docs/reference/functions/partitionSelect.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -layout: default ---- - - - -

Function partitionSelect #

- -Partition-based selection of an array or 1D matrix. -Will find the kth smallest value, and mutates the input array. -Uses Quickselect. - - -

Syntax #

- -```js -math.partitionSelect(x, k) -math.partitionSelect(x, k, compare) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Matrix | Array | A one dimensional matrix or array to sort -`k` | Number | The kth smallest value to be retrieved zero-based index -`compare` | Function | 'asc' | 'desc' | An optional comparator function. The function is called as `compare(a, b)`, and must return 1 when a > b, -1 when a < b, and 0 when a == b. Default value: 'asc'. - -

Returns #

- -Type | Description ----- | ----------- -* | Returns the kth lowest value. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.partitionSelect([5, 10, 1], 2) // returns 10 -math.partitionSelect(['C', 'B', 'A', 'D'], 1, math.compareText) // returns 'B' - -function sortByLength (a, b) { - return a.length - b.length -} -math.partitionSelect(['Langdon', 'Tom', 'Sara'], 2, sortByLength) // returns 'Langdon' - -// the input array is mutated -arr = [5, 2, 1] -math.partitionSelect(arr, 0) // returns 1, arr is now: [1, 2, 5] -math.partitionSelect(arr, 1, 'desc') // returns 2, arr is now: [5, 2, 1] -``` - - -

See also #

- -[sort](sort.html) diff --git a/docs/reference/functions/permutations.md b/docs/reference/functions/permutations.md deleted file mode 100644 index 4221b96792..0000000000 --- a/docs/reference/functions/permutations.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -layout: default ---- - - - -

Function permutations #

- -Compute the number of ways of obtaining an ordered subset of `k` elements -from a set of `n` elements. - -Permutations only takes integer arguments. -The following condition must be enforced: k <= n. - - -

Syntax #

- -```js -math.permutations(n) -math.permutations(n, k) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`n` | number | BigNumber | The number of objects in total -`k` | number | BigNumber | The number of objects in the subset - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | The number of permutations - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.permutations(5) // 120 -math.permutations(5, 3) // 60 -``` - - -

See also #

- -[combinations](combinations.html), -[combinationsWithRep](combinationsWithRep.html), -[factorial](factorial.html) diff --git a/docs/reference/functions/pickRandom.md b/docs/reference/functions/pickRandom.md deleted file mode 100644 index 81ce6dc612..0000000000 --- a/docs/reference/functions/pickRandom.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -layout: default ---- - - - -

Function pickRandom #

- -Random pick one or more values from a one dimensional array. -Array elements are picked using a random function with uniform or weighted distribution. - - -

Syntax #

- -```js -math.pickRandom(array) -math.pickRandom(array, number) -math.pickRandom(array, weights) -math.pickRandom(array, number, weights) -math.pickRandom(array, weights, number) -math.pickRandom(array, { weights, number, elementWise }) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`array` | Array | Matrix | A one dimensional array -`number` | Int | An int or float -`weights` | Array | Matrix | An array of ints or floats - -

Returns #

- -Type | Description ----- | ----------- -number | Array | Returns a single random value from array when number is undefined. Returns an array with the configured number of elements when number is defined. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.pickRandom([3, 6, 12, 2]) // returns one of the values in the array -math.pickRandom([3, 6, 12, 2], 2) // returns an array of two of the values in the array -math.pickRandom([3, 6, 12, 2], { number: 2 }) // returns an array of two of the values in the array -math.pickRandom([3, 6, 12, 2], [1, 3, 2, 1]) // returns one of the values in the array with weighted distribution -math.pickRandom([3, 6, 12, 2], 2, [1, 3, 2, 1]) // returns an array of two of the values in the array with weighted distribution -math.pickRandom([3, 6, 12, 2], [1, 3, 2, 1], 2) // returns an array of two of the values in the array with weighted distribution - -math.pickRandom([{x: 1.0, y: 2.0}, {x: 1.1, y: 2.0}], { elementWise: false }) - // returns one of the items in the array -``` - - -

See also #

- -[random](random.html), -[randomInt](randomInt.html) diff --git a/docs/reference/functions/pinv.md b/docs/reference/functions/pinv.md deleted file mode 100644 index aa2af05da1..0000000000 --- a/docs/reference/functions/pinv.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -layout: default ---- - - - -

Function pinv #

- -Calculate the Moore–Penrose inverse of a matrix. - - -

Syntax #

- -```js -math.pinv(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | Complex | Array | Matrix | Matrix to be inversed - -

Returns #

- -Type | Description ----- | ----------- -number | Complex | Array | Matrix | The inverse of `x`. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.pinv([[1, 2], [3, 4]]) // returns [[-2, 1], [1.5, -0.5]] -math.pinv([[1, 0], [0, 1], [0, 1]]) // returns [[1, 0, 0], [0, 0.5, 0.5]] -math.pinv(4) // returns 0.25 -``` - - -

See also #

- -[inv](inv.html) diff --git a/docs/reference/functions/polynomialRoot.md b/docs/reference/functions/polynomialRoot.md deleted file mode 100644 index 58562bc573..0000000000 --- a/docs/reference/functions/polynomialRoot.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -layout: default ---- - - - -

Function polynomialRoot #

- -Finds the numerical values of the distinct roots of a polynomial with real or complex coefficients. -Currently operates only on linear, quadratic, and cubic polynomials using the standard -formulas for the roots. - - -

Syntax #

- -```js -math.polynomialRoot(constant, linearCoeff, quadraticCoeff, cubicCoeff) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`coeffs` | ... number | Complex | The coefficients of the polynomial, starting with with the constant coefficent, followed by the linear coefficient and subsequent coefficients of increasing powers. - -

Returns #

- -Type | Description ----- | ----------- -Array | The distinct roots of the polynomial - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -// linear -math.polynomialRoot(6, 3) // [-2] -math.polynomialRoot(math.complex(6,3), 3) // [-2 - i] -math.polynomialRoot(math.complex(6,3), math.complex(2,1)) // [-3 + 0i] -// quadratic -math.polynomialRoot(2, -3, 1) // [2, 1] -math.polynomialRoot(8, 8, 2) // [-2] -math.polynomialRoot(-2, 0, 1) // [1.4142135623730951, -1.4142135623730951] -math.polynomialRoot(2, -2, 1) // [1 + i, 1 - i] -math.polynomialRoot(math.complex(1,3), math.complex(-3, -2), 1) // [2 + i, 1 + i] -// cubic -math.polynomialRoot(-6, 11, -6, 1) // [1, 3, 2] -math.polynomialRoot(-8, 0, 0, 1) // [-1 - 1.7320508075688774i, 2, -1 + 1.7320508075688774i] -math.polynomialRoot(0, 8, 8, 2) // [0, -2] -math.polynomialRoot(1, 1, 1, 1) // [-1 + 0i, 0 - i, 0 + i] -``` - - -

See also #

- -[cbrt](cbrt.html), -[sqrt](sqrt.html) diff --git a/docs/reference/functions/pow.md b/docs/reference/functions/pow.md deleted file mode 100644 index 060c3d0e44..0000000000 --- a/docs/reference/functions/pow.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -layout: default ---- - - - -

Function pow #

- -Calculates the power of x to y, `x ^ y`. - -Matrix exponentiation is supported for square matrices `x` and integers `y`: -when `y` is nonnegative, `x` may be any square matrix; and when `y` is -negative, `x` must be invertible, and then this function returns -inv(x)^(-y). - -For cubic roots of negative numbers, the function returns the principal -root by default. In order to let the function return the real root, -math.js can be configured with `math.config({predictable: true})`. -To retrieve all cubic roots of a value, use `math.cbrt(x, true)`. - - -

Syntax #

- -```js -math.pow(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Complex | Unit | Array | Matrix | The base -`y` | number | BigNumber | bigint | Complex | The exponent - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Complex | Array | Matrix | The value of `x` to the power `y` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.pow(2, 3) // returns number 8 - -const a = math.complex(2, 3) -math.pow(a, 2) // returns Complex -5 + 12i - -const b = [[1, 2], [4, 3]] -math.pow(b, 2) // returns Array [[9, 8], [16, 17]] - -const c = [[1, 2], [4, 3]] -math.pow(c, -1) // returns Array [[-0.6, 0.4], [0.8, -0.2]] -``` - - -

See also #

- -[multiply](multiply.html), -[sqrt](sqrt.html), -[cbrt](cbrt.html), -[nthRoot](nthRoot.html) diff --git a/docs/reference/functions/print.md b/docs/reference/functions/print.md deleted file mode 100644 index edfa3a0d16..0000000000 --- a/docs/reference/functions/print.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -layout: default ---- - - - -

Function print #

- -Interpolate values into a string template. - - -

Syntax #

- -```js -math.print(template, values) -math.print(template, values, precision) -math.print(template, values, options) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`template` | string | A string containing variable placeholders. -`values` | Object | Array | Matrix | An object or array containing variables which will be filled in in the template. -`options` | number | Object | Formatting options, or the number of digits to format numbers. See function math.format for a description of all options. - -

Returns #

- -Type | Description ----- | ----------- -string | Interpolated string - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -// the following outputs: 'Lucy is 5 years old' -math.print('Lucy is $age years old', {age: 5}) - -// the following outputs: 'The value of pi is 3.141592654' -math.print('The value of pi is $pi', {pi: math.pi}, 10) - -// the following outputs: 'Hello Mary! The date is 2013-03-23' -math.print('Hello $user.name! The date is $date', { - user: { - name: 'Mary', - }, - date: '2013-03-23' -}) - -// the following outputs: 'My favorite fruits are apples and bananas !' -math.print('My favorite fruits are $0 and $1 !', [ - 'apples', - 'bananas' -]) -``` - - -

See also #

- -[format](format.html) diff --git a/docs/reference/functions/prod.md b/docs/reference/functions/prod.md deleted file mode 100644 index 35d9cda2b1..0000000000 --- a/docs/reference/functions/prod.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -layout: default ---- - - - -

Function prod #

- -Compute the product of a matrix or a list with values. -In case of a multidimensional array or matrix, the sum of all -elements will be calculated. - - -

Syntax #

- -```js -math.prod(a, b, c, ...) -math.prod(A) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`args` | ... * | A single matrix or or multiple scalar values - -

Returns #

- -Type | Description ----- | ----------- -* | The product of all values - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.multiply(2, 3) // returns 6 -math.prod(2, 3) // returns 6 -math.prod(2, 3, 4) // returns 24 -math.prod([2, 3, 4]) // returns 24 -math.prod([[2, 5], [4, 3]]) // returns 120 -``` - - -

See also #

- -[mean](mean.html), -[median](median.html), -[min](min.html), -[max](max.html), -[sum](sum.html), -[std](std.html), -[variance](variance.html) diff --git a/docs/reference/functions/qr.md b/docs/reference/functions/qr.md deleted file mode 100644 index 040f67cef9..0000000000 --- a/docs/reference/functions/qr.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -layout: default ---- - - - -

Function qr #

- -Calculate the Matrix QR decomposition. Matrix `A` is decomposed in -two matrices (`Q`, `R`) where `Q` is an -orthogonal matrix and `R` is an upper triangular matrix. - - -

Syntax #

- -```js -math.qr(A) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`A` | Matrix | Array | A two dimensional matrix or array for which to get the QR decomposition. - -

Returns #

- -Type | Description ----- | ----------- -{Q: Array | Matrix, R: Array | Matrix} | Q: the orthogonal matrix and R: the upper triangular matrix - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const m = [ - [1, -1, 4], - [1, 4, -2], - [1, 4, 2], - [1, -1, 0] -] -const result = math.qr(m) -// r = { -// Q: [ -// [0.5, -0.5, 0.5], -// [0.5, 0.5, -0.5], -// [0.5, 0.5, 0.5], -// [0.5, -0.5, -0.5], -// ], -// R: [ -// [2, 3, 2], -// [0, 5, -2], -// [0, 0, 4], -// [0, 0, 0] -// ] -// } -``` - - -

See also #

- -[lup](lup.html), -[lusolve](lusolve.html) diff --git a/docs/reference/functions/quantileSeq.md b/docs/reference/functions/quantileSeq.md deleted file mode 100644 index df3e4c2975..0000000000 --- a/docs/reference/functions/quantileSeq.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -layout: default ---- - - - -

Function quantileSeq #

- -Compute the prob order quantile of a matrix or a list with values. -The sequence is sorted and the middle value is returned. -Supported types of sequence values are: Number, BigNumber, Unit -Supported types of probability are: Number, BigNumber - -In case of a multidimensional array or matrix, the prob order quantile -of all elements will be calculated. - - -

Syntax #

- -```js -math.quantileSeq(A, prob[, sorted]) -math.quantileSeq(A, [prob1, prob2, ...][, sorted]) -math.quantileSeq(A, N[, sorted]) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`data` | Array, Matrix | A single matrix or Array -`probOrN` | Number, BigNumber, Array | prob is the order of the quantile, while N is the amount of evenly distributed steps of probabilities; only one of these options can be provided -`sorted` | Boolean | =false is data sorted in ascending order - -

Returns #

- -Type | Description ----- | ----------- -Number, BigNumber, Unit, Array | Quantile(s) - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.quantileSeq([3, -1, 5, 7], 0.5) // returns 4 -math.quantileSeq([3, -1, 5, 7], [1/3, 2/3]) // returns [3, 5] -math.quantileSeq([3, -1, 5, 7], 2) // returns [3, 5] -math.quantileSeq([-1, 3, 5, 7], 0.5, true) // returns 4 -``` - - -

See also #

- -[median](median.html), -[mean](mean.html), -[min](min.html), -[max](max.html), -[sum](sum.html), -[prod](prod.html), -[std](std.html), -[variance](variance.html) diff --git a/docs/reference/functions/random.md b/docs/reference/functions/random.md deleted file mode 100644 index da6217311a..0000000000 --- a/docs/reference/functions/random.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -layout: default ---- - - - -

Function random #

- -Return a random number larger or equal to `min` and smaller than `max` -using a uniform distribution. - - -

Syntax #

- -```js -math.random() // generate a random number between 0 and 1 -math.random(max) // generate a random number between 0 and max -math.random(min, max) // generate a random number between min and max -math.random(size) // generate a matrix with random numbers between 0 and 1 -math.random(size, max) // generate a matrix with random numbers between 0 and max -math.random(size, min, max) // generate a matrix with random numbers between min and max -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`size` | Array | Matrix | If provided, an array or matrix with given size and filled with random values is returned -`min` | number | Minimum boundary for the random value, included -`max` | number | Maximum boundary for the random value, excluded - -

Returns #

- -Type | Description ----- | ----------- -number | Array | Matrix | A random number - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.random() // returns a random number between 0 and 1 -math.random(100) // returns a random number between 0 and 100 -math.random(30, 40) // returns a random number between 30 and 40 -math.random([2, 3]) // returns a 2x3 matrix with random numbers between 0 and 1 -``` - - -

See also #

- -[randomInt](randomInt.html), -[pickRandom](pickRandom.html) diff --git a/docs/reference/functions/randomInt.md b/docs/reference/functions/randomInt.md deleted file mode 100644 index 8f910be9ec..0000000000 --- a/docs/reference/functions/randomInt.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: default ---- - - - -

Function randomInt #

- -Return a random integer number larger or equal to `min` and smaller than `max` -using a uniform distribution. - - -

Syntax #

- -```js -math.randomInt() // generate either 0 or 1, randomly -math.randomInt(max) // generate a random integer between 0 and max -math.randomInt(min, max) // generate a random integer between min and max -math.randomInt(size) // generate a matrix with random integer between 0 and 1 -math.randomInt(size, max) // generate a matrix with random integer between 0 and max -math.randomInt(size, min, max) // generate a matrix with random integer between min and max -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`size` | Array | Matrix | If provided, an array or matrix with given size and filled with random values is returned -`min` | number | Minimum boundary for the random value, included -`max` | number | Maximum boundary for the random value, excluded - -

Returns #

- -Type | Description ----- | ----------- -number | Array | Matrix | A random integer value - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.randomInt(100) // returns a random integer between 0 and 100 -math.randomInt(30, 40) // returns a random integer between 30 and 40 -math.randomInt([2, 3]) // returns a 2x3 matrix with random integers between 0 and 1 -``` - - -

See also #

- -[random](random.html), -[pickRandom](pickRandom.html) diff --git a/docs/reference/functions/range.md b/docs/reference/functions/range.md deleted file mode 100644 index c2d17c1f78..0000000000 --- a/docs/reference/functions/range.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -layout: default ---- - - - -

Function range #

- -Create an array from a range. -By default, the range end is excluded. This can be customized by providing -an extra parameter `includeEnd`. - - -

Syntax #

- -```js -math.range(str [, includeEnd]) // Create a range from a string, - // where the string contains the - // start, optional step, and end, - // separated by a colon. -math.range(start, end [, includeEnd]) // Create a range with start and - // end and a step size of 1. -math.range(start, end, step [, includeEnd]) // Create a range with start, step, - // and end. -``` - -

Where #

- -- `str: string` - A string 'start:end' or 'start:step:end' -- `start: {number | bigint | BigNumber | Fraction | Unit}` - Start of the range -- `end: number | bigint | BigNumber | Fraction | Unit` - End of the range, excluded by default, included when parameter includeEnd=true -- `step: number | bigint | BigNumber | Fraction | Unit` - Step size. Default value is 1. -- `includeEnd: boolean` - Option to specify whether to include the end or not. False by default. - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`args` | * | Parameters describing the range's `start`, `end`, and optional `step`. - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | range - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.range(2, 6) // [2, 3, 4, 5] -math.range(2, -3, -1) // [2, 1, 0, -1, -2] -math.range('2:1:6') // [2, 3, 4, 5] -math.range(2, 6, true) // [2, 3, 4, 5, 6] -math.range(2, math.fraction(8,3), math.fraction(1,3)) // [fraction(2), fraction(7,3)] -math.range(math.unit(2, 'm'), math.unit(-3, 'm'), math.unit(-1, 'm')) // [2 m, 1 m, 0 m , -1 m, -2 m] -``` - - -

See also #

- -[ones](ones.html), -[zeros](zeros.html), -[size](size.html), -[subset](subset.html) diff --git a/docs/reference/functions/rationalize.md b/docs/reference/functions/rationalize.md deleted file mode 100644 index 5fbc1915cf..0000000000 --- a/docs/reference/functions/rationalize.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -layout: default ---- - - - -

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 -math.rationalize(expr) -math.rationalize(expr, detailed) -math.rationalize(expr, scope) -math.rationalize(expr, scope, detailed) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`expr` | Node | string | The expression to check if is a polynomial expression -`optional` | Object | 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 | Node | The rational polynomial of `expr` or an object `{expression, numerator, denominator, variables, coefficients}`, where `expression` is a `Node` with the node simplified expression, `numerator` is a `Node` with the simplified numerator of expression, `denominator` is a `Node` or `boolean` with the simplified denominator or `false` (if there is no denominator), `variables` is an array with variable names, and `coefficients` is an array with coefficients of numerator sorted by increased exponent {Expression Node} node simplified expression - - -

Throws #

- -Type | Description ----- | ----------- - - -

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 - -const ret = math.rationalize('x+x+x+y',{},true) - // ret.expression=3*x+y, ret.variables = ["x","y"] -const 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.html) diff --git a/docs/reference/functions/re.md b/docs/reference/functions/re.md deleted file mode 100644 index d450be5af6..0000000000 --- a/docs/reference/functions/re.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: default ---- - - - -

Function re #

- -Get the real part of a complex number. -For a complex number `a + bi`, the function returns `a`. - -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.re(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Array | Matrix | A complex number or array with complex numbers - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Array | Matrix | The real part of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const a = math.complex(2, 3) -math.re(a) // returns number 2 -math.im(a) // returns number 3 - -math.re(math.complex('-5.2i')) // returns number 0 -math.re(math.complex(2.4)) // returns number 2.4 -``` - - -

See also #

- -[im](im.html), -[conj](conj.html), -[abs](abs.html), -[arg](arg.html) diff --git a/docs/reference/functions/reshape.md b/docs/reference/functions/reshape.md deleted file mode 100644 index 2066c498be..0000000000 --- a/docs/reference/functions/reshape.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -layout: default ---- - - - -

Function reshape #

- -Reshape a multi dimensional array to fit the specified dimensions - - -

Syntax #

- -```js -math.reshape(x, sizes) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Array | Matrix | * | Matrix to be reshaped -`sizes` | number[] | One dimensional array with integral sizes for each dimension. One -1 is allowed as wildcard, which calculates this dimension automatically. - -

Returns #

- -Type | Description ----- | ----------- -* | Array | Matrix | A reshaped clone of matrix `x` - - -

Throws #

- -Type | Description ----- | ----------- -TypeError | If `sizes` does not contain solely integers -DimensionError | If the product of the new dimension sizes does not equal that of the old ones - -

Examples #

- -```js - math.reshape([1, 2, 3, 4, 5, 6], [2, 3]) - // returns Array [[1, 2, 3], [4, 5, 6]] - - math.reshape([[1, 2], [3, 4]], [1, 4]) - // returns Array [[1, 2, 3, 4]] - - math.reshape([[1, 2], [3, 4]], [4]) - // returns Array [1, 2, 3, 4] - - const x = math.matrix([1, 2, 3, 4, 5, 6, 7, 8]) - math.reshape(x, [2, 2, 2]) - // returns Matrix [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] - -math.reshape([1, 2, 3, 4], [-1, 2]) -// returns Matrix [[1, 2], [3, 4]] -``` - - -

See also #

- -[size](size.html), -[squeeze](squeeze.html), -[resize](resize.html) diff --git a/docs/reference/functions/resize.md b/docs/reference/functions/resize.md deleted file mode 100644 index 125534a337..0000000000 --- a/docs/reference/functions/resize.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -layout: default ---- - - - -

Function resize #

- -Resize a matrix - - -

Syntax #

- -```js -math.resize(x, size) -math.resize(x, size, defaultValue) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Array | Matrix | * | Matrix to be resized -`size` | Array | Matrix | One dimensional array with numbers -`defaultValue` | number | string | Zero by default, except in case of a string, in that case defaultValue = ' ' Default value: 0. - -

Returns #

- -Type | Description ----- | ----------- -* | Array | Matrix | A resized clone of matrix `x` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.resize([1, 2, 3, 4, 5], [3]) // returns Array [1, 2, 3] -math.resize([1, 2, 3], [5], 0) // returns Array [1, 2, 3, 0, 0] -math.resize(2, [2, 3], 0) // returns Matrix [[2, 0, 0], [0, 0, 0]] -math.resize("hello", [8], "!") // returns string 'hello!!!' -``` - - -

See also #

- -[size](size.html), -[squeeze](squeeze.html), -[subset](subset.html), -[reshape](reshape.html) diff --git a/docs/reference/functions/resolve.md b/docs/reference/functions/resolve.md deleted file mode 100644 index 039beb6d5e..0000000000 --- a/docs/reference/functions/resolve.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -layout: default ---- - - - -

Function resolve #

- -resolve(expr, scope) replaces variable nodes with their scoped values - - -

Syntax #

- -```js -math.resolve(expr, scope) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`node` | Node | Node[] | The expression tree (or trees) to be simplified -`scope` | Object | Scope specifying variables to be resolved - -

Returns #

- -Type | Description ----- | ----------- -Node | Node[] | Returns `node` with variables recursively substituted. - - -

Throws #

- -Type | Description ----- | ----------- -ReferenceError | If there is a cyclic dependency among the variables in `scope`, resolution is impossible and a ReferenceError is thrown. - -

Examples #

- -```js -math.resolve('x + y', {x:1, y:2}) // Node '1 + 2' -math.resolve(math.parse('x+y'), {x:1, y:2}) // Node '1 + 2' -math.simplify('x+y', {x:2, y: math.parse('x+x')}).toString() // "6" -``` - - -

See also #

- -[simplify](simplify.html), -[evaluate](evaluate.html) diff --git a/docs/reference/functions/rightArithShift.md b/docs/reference/functions/rightArithShift.md deleted file mode 100644 index 243c74b2f0..0000000000 --- a/docs/reference/functions/rightArithShift.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default ---- - - - -

Function rightArithShift #

- -Bitwise right arithmetic shift of a value x by y number of bits, `x >> y`. -For matrices, the function is evaluated element wise. -For units, the function is evaluated on the best prefix base. - - -

Syntax #

- -```js -math.rightArithShift(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Array | Matrix | Value to be shifted -`y` | number | BigNumber | bigint | Amount of shifts - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Array | Matrix | `x` zero-filled shifted right `y` times - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.rightArithShift(4, 2) // returns number 1 - -math.rightArithShift([16, -32, 64], 4) // returns Array [1, -2, 4] -``` - - -

See also #

- -[bitAnd](bitAnd.html), -[bitNot](bitNot.html), -[bitOr](bitOr.html), -[bitXor](bitXor.html), -[rightArithShift](rightArithShift.html), -[rightLogShift](rightLogShift.html) diff --git a/docs/reference/functions/rightLogShift.md b/docs/reference/functions/rightLogShift.md deleted file mode 100644 index 4d744b6ce6..0000000000 --- a/docs/reference/functions/rightLogShift.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default ---- - - - -

Function rightLogShift #

- -Bitwise right logical shift of value x by y number of bits, `x >>> y`. -For matrices, the function is evaluated element wise. -For units, the function is evaluated on the best prefix base. - - -

Syntax #

- -```js -math.rightLogShift(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | Array | Matrix | Value to be shifted -`y` | number | Amount of shifts - -

Returns #

- -Type | Description ----- | ----------- -number | Array | Matrix | `x` zero-filled shifted right `y` times - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.rightLogShift(4, 2) // returns number 1 - -math.rightLogShift([16, 32, 64], 4) // returns Array [1, 2, 4] -``` - - -

See also #

- -[bitAnd](bitAnd.html), -[bitNot](bitNot.html), -[bitOr](bitOr.html), -[bitXor](bitXor.html), -[leftShift](leftShift.html), -[rightLogShift](rightLogShift.html) diff --git a/docs/reference/functions/rotate.md b/docs/reference/functions/rotate.md deleted file mode 100644 index acbf0138bc..0000000000 --- a/docs/reference/functions/rotate.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: default ---- - - - -

Function rotate #

- -Rotate a vector of size 1x2 counter-clockwise by a given angle -Rotate a vector of size 1x3 counter-clockwise by a given angle around the given axis - - -

Syntax #

- -```js -math.rotate(w, theta) -math.rotate(w, theta, v) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`w` | Array | Matrix | Vector to rotate -`theta` | number | BigNumber | Complex | Unit | Rotation angle -`v` | Array | Matrix | Rotation axis - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | Multiplication of the rotation matrix and w - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.rotate([11, 12], math.pi / 2) // returns [-12, 11] -math.rotate(matrix([11, 12]), math.pi / 2) // returns [-12, 11] - -math.rotate([1, 0, 0], unit('90deg'), [0, 0, 1]) // returns [0, 1, 0] -math.rotate(matrix([1, 0, 0]), unit('90deg'), [0, 0, 1]) // returns Matrix [0, 1, 0] - -math.rotate([1, 0], math.complex(1 + i)) // returns [cos(1 + i) - sin(1 + i), sin(1 + i) + cos(1 + i)] -``` - - -

See also #

- -[matrix](matrix.html), -[rotationMatrix](rotationMatrix.html) diff --git a/docs/reference/functions/rotationMatrix.md b/docs/reference/functions/rotationMatrix.md deleted file mode 100644 index e9b666d5dc..0000000000 --- a/docs/reference/functions/rotationMatrix.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -layout: default ---- - - - -

Function rotationMatrix #

- -Create a 2-dimensional counter-clockwise rotation matrix (2x2) for a given angle (expressed in radians). -Create a 2-dimensional counter-clockwise rotation matrix (3x3) by a given angle (expressed in radians) around a given axis (1x3). - - -

Syntax #

- -```js -math.rotationMatrix(theta) -math.rotationMatrix(theta, format) -math.rotationMatrix(theta, [v]) -math.rotationMatrix(theta, [v], format) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`theta` | number | BigNumber | Complex | Unit | Rotation angle -`v` | Array | Matrix | Rotation axis -`format` | string | Result Matrix storage format - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | Rotation matrix - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.rotationMatrix(math.pi / 2) // returns [[0, -1], [1, 0]] -math.rotationMatrix(math.bignumber(1)) // returns [[bignumber(cos(1)), bignumber(-sin(1))], [bignumber(sin(1)), bignumber(cos(1))]] -math.rotationMatrix(math.complex(1 + i)) // returns [[cos(1 + i), -sin(1 + i)], [sin(1 + i), cos(1 + i)]] -math.rotationMatrix(math.unit('1rad')) // returns [[cos(1), -sin(1)], [sin(1), cos(1)]] - -math.rotationMatrix(math.pi / 2, [0, 1, 0]) // returns [[0, 0, 1], [0, 1, 0], [-1, 0, 0]] -math.rotationMatrix(math.pi / 2, matrix([0, 1, 0])) // returns matrix([[0, 0, 1], [0, 1, 0], [-1, 0, 0]]) - -``` - - -

See also #

- -[matrix](matrix.html), -[cos](cos.html), -[sin](sin.html) diff --git a/docs/reference/functions/round.md b/docs/reference/functions/round.md deleted file mode 100644 index a8dc2ae1ab..0000000000 --- a/docs/reference/functions/round.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -layout: default ---- - - - -

Function round #

- -Round a value towards the nearest rounded value. -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.round(x) -math.round(x, n) -math.round(unit, valuelessUnit) -math.round(unit, n, valuelessUnit) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Value to be rounded -`n` | number | BigNumber | Array | Number of decimals Default value: 0. -`valuelessUnit` | Unit | A valueless unit - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Rounded value - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.round(3.22) // returns number 3 -math.round(3.82) // returns number 4 -math.round(-4.2) // returns number -4 -math.round(-4.7) // returns number -5 -math.round(3.22, 1) // returns number 3.2 -math.round(3.88, 1) // returns number 3.9 -math.round(-4.21, 1) // returns number -4.2 -math.round(-4.71, 1) // returns number -4.7 -math.round(math.pi, 3) // returns number 3.142 -math.round(123.45678, 2) // returns number 123.46 - -const c = math.complex(3.2, -2.7) -math.round(c) // returns Complex 3 - 3i - -const unit = math.unit('3.241 cm') -const cm = math.unit('cm') -const mm = math.unit('mm') -math.round(unit, 1, cm) // returns Unit 3.2 cm -math.round(unit, 1, mm) // returns Unit 32.4 mm - -math.round([3.2, 3.8, -4.7]) // returns Array [3, 4, -5] -``` - - -

See also #

- -[ceil](ceil.html), -[fix](fix.html), -[floor](floor.html) diff --git a/docs/reference/functions/row.md b/docs/reference/functions/row.md deleted file mode 100644 index e9cf86cd4a..0000000000 --- a/docs/reference/functions/row.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -layout: default ---- - - - -

Function row #

- -Return a row from a Matrix. - - -

Syntax #

- -```js -math.row(value, index) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`value` | Array | Matrix | An array or matrix -`row` | number | The index of the row - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | The retrieved row - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -// get a row -const d = [[1, 2], [3, 4]] -math.row(d, 1) // returns [[3, 4]] -``` - - -

See also #

- -[column](column.html) diff --git a/docs/reference/functions/schur.md b/docs/reference/functions/schur.md deleted file mode 100644 index 6c4fd370ac..0000000000 --- a/docs/reference/functions/schur.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: default ---- - - - -

Function schur #

- -Performs a real Schur decomposition of the real matrix A = UTU' where U is orthogonal -and T is upper quasi-triangular. -https://en.wikipedia.org/wiki/Schur_decomposition - - -

Syntax #

- -```js -math.schur(A) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`A` | Array | Matrix | Matrix A - -

Returns #

- -Type | Description ----- | ----------- -{U: Array | Matrix, T: Array | Matrix} | Object containing both matrix U and T of the Schur Decomposition A=UTU' - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const A = [[1, 0], [-4, 3]] -math.schur(A) // returns {T: [[3, 4], [0, 1]], R: [[0, 1], [-1, 0]]} -``` - - -

See also #

- -[sylvester](sylvester.html), -[lyap](lyap.html), -[qr](qr.html) diff --git a/docs/reference/functions/sec.md b/docs/reference/functions/sec.md deleted file mode 100644 index 3a0559185f..0000000000 --- a/docs/reference/functions/sec.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -layout: default ---- - - - -

Function sec #

- -Calculate the secant of a value, defined as `sec(x) = 1/cos(x)`. - -To avoid confusion with the matrix secant, this function does not -apply to matrices. - - -

Syntax #

- -```js -math.sec(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Unit | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Secant of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.sec(2) // returns number -2.4029979617223822 -1 / math.cos(2) // returns number -2.4029979617223822 -``` - - -

See also #

- -[cos](cos.html), -[csc](csc.html), -[cot](cot.html) diff --git a/docs/reference/functions/sech.md b/docs/reference/functions/sech.md deleted file mode 100644 index 7d376bacfc..0000000000 --- a/docs/reference/functions/sech.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function sech #

- -Calculate the hyperbolic secant of a value, -defined as `sech(x) = 1 / cosh(x)`. - -To avoid confusion with the matrix hyperbolic secant, this function does -not apply to matrices. - - -

Syntax #

- -```js -math.sech(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Hyperbolic secant of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -// sech(x) = 1/ cosh(x) -math.sech(0.5) // returns 0.886818883970074 -1 / math.cosh(0.5) // returns 0.886818883970074 -``` - - -

See also #

- -[cosh](cosh.html), -[csch](csch.html), -[coth](coth.html) diff --git a/docs/reference/functions/setCartesian.md b/docs/reference/functions/setCartesian.md deleted file mode 100644 index e350dd9f64..0000000000 --- a/docs/reference/functions/setCartesian.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -layout: default ---- - - - -

Function setCartesian #

- -Create the cartesian product of two (multi)sets. -Multi-dimension arrays will be converted to single-dimension arrays -and the values will be sorted in ascending order before the operation. - - -

Syntax #

- -```js -math.setCartesian(set1, set2) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`a1` | Array | Matrix | A (multi)set -`a2` | Array | Matrix | A (multi)set - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | The cartesian product of two (multi)sets - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.setCartesian([1, 2], [3, 4]) // returns [[1, 3], [1, 4], [2, 3], [2, 4]] -math.setCartesian([4, 3], [2, 1]) // returns [[3, 1], [3, 2], [4, 1], [4, 2]] -``` - - -

See also #

- -[setUnion](setUnion.html), -[setIntersect](setIntersect.html), -[setDifference](setDifference.html), -[setPowerset](setPowerset.html) diff --git a/docs/reference/functions/setDifference.md b/docs/reference/functions/setDifference.md deleted file mode 100644 index 05ec12491e..0000000000 --- a/docs/reference/functions/setDifference.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: default ---- - - - -

Function setDifference #

- -Create the difference of two (multi)sets: every element of set1, that is not the element of set2. -Multi-dimension arrays will be converted to single-dimension arrays before the operation. - - -

Syntax #

- -```js -math.setDifference(set1, set2) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`a1` | Array | Matrix | A (multi)set -`a2` | Array | Matrix | A (multi)set - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | The difference of two (multi)sets - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.setDifference([1, 2, 3, 4], [3, 4, 5, 6]) // returns [1, 2] -math.setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]]) // returns [1, 2] -``` - - -

See also #

- -[setUnion](setUnion.html), -[setIntersect](setIntersect.html), -[setSymDifference](setSymDifference.html) diff --git a/docs/reference/functions/setDistinct.md b/docs/reference/functions/setDistinct.md deleted file mode 100644 index 17919ccb93..0000000000 --- a/docs/reference/functions/setDistinct.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -layout: default ---- - - - -

Function setDistinct #

- -Collect the distinct elements of a multiset. -A multi-dimension array will be converted to a single-dimension array before the operation. - - -

Syntax #

- -```js -math.setDistinct(set) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`a` | Array | Matrix | A multiset - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | A set containing the distinc elements of the multiset - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.setDistinct([1, 1, 1, 2, 2, 3]) // returns [1, 2, 3] -``` - - -

See also #

- -[setMultiplicity](setMultiplicity.html) diff --git a/docs/reference/functions/setIntersect.md b/docs/reference/functions/setIntersect.md deleted file mode 100644 index 5ed3556dd2..0000000000 --- a/docs/reference/functions/setIntersect.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -layout: default ---- - - - -

Function setIntersect #

- -Create the intersection of two (multi)sets. -Multi-dimension arrays will be converted to single-dimension arrays before the operation. - - -

Syntax #

- -```js -math.setIntersect(set1, set2) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`a1` | Array | Matrix | A (multi)set -`a2` | Array | Matrix | A (multi)set - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | The intersection of two (multi)sets - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.setIntersect([1, 2, 3, 4], [3, 4, 5, 6]) // returns [3, 4] -math.setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]]) // returns [3, 4] -``` - - -

See also #

- -[setUnion](setUnion.html), -[setDifference](setDifference.html) diff --git a/docs/reference/functions/setIsSubset.md b/docs/reference/functions/setIsSubset.md deleted file mode 100644 index 63903ad2e7..0000000000 --- a/docs/reference/functions/setIsSubset.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: default ---- - - - -

Function setIsSubset #

- -Check whether a (multi)set is a subset of another (multi)set. (Every element of set1 is the element of set2.) -Multi-dimension arrays will be converted to single-dimension arrays before the operation. - - -

Syntax #

- -```js -math.setIsSubset(set1, set2) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`a1` | Array | Matrix | A (multi)set -`a2` | Array | Matrix | A (multi)set - -

Returns #

- -Type | Description ----- | ----------- -boolean | Returns true when a1 is a subset of a2, returns false otherwise - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.setIsSubset([1, 2], [3, 4, 5, 6]) // returns false -math.setIsSubset([3, 4], [3, 4, 5, 6]) // returns true -``` - - -

See also #

- -[setUnion](setUnion.html), -[setIntersect](setIntersect.html), -[setDifference](setDifference.html) diff --git a/docs/reference/functions/setMultiplicity.md b/docs/reference/functions/setMultiplicity.md deleted file mode 100644 index e4270693d5..0000000000 --- a/docs/reference/functions/setMultiplicity.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -layout: default ---- - - - -

Function setMultiplicity #

- -Count the multiplicity of an element in a multiset. -A multi-dimension array will be converted to a single-dimension array before the operation. - - -

Syntax #

- -```js -math.setMultiplicity(element, set) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`e` | number | BigNumber | Fraction | Complex | An element in the multiset -`a` | Array | Matrix | A multiset - -

Returns #

- -Type | Description ----- | ----------- -number | The number of how many times the multiset contains the element - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.setMultiplicity(1, [1, 2, 2, 4]) // returns 1 -math.setMultiplicity(2, [1, 2, 2, 4]) // returns 2 -``` - - -

See also #

- -[setDistinct](setDistinct.html), -[setSize](setSize.html) diff --git a/docs/reference/functions/setPowerset.md b/docs/reference/functions/setPowerset.md deleted file mode 100644 index eef9d4372a..0000000000 --- a/docs/reference/functions/setPowerset.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -layout: default ---- - - - -

Function setPowerset #

- -Create the powerset of a (multi)set. (The powerset contains very possible subsets of a (multi)set.) -A multi-dimension array will be converted to a single-dimension array before the operation. - - -

Syntax #

- -```js -math.setPowerset(set) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`a` | Array | Matrix | A (multi)set - -

Returns #

- -Type | Description ----- | ----------- -Array | The powerset of the (multi)set - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.setPowerset([1, 2, 3]) // returns [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]] -``` - - -

See also #

- -[setCartesian](setCartesian.html) diff --git a/docs/reference/functions/setSize.md b/docs/reference/functions/setSize.md deleted file mode 100644 index d6e8e6ade3..0000000000 --- a/docs/reference/functions/setSize.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -layout: default ---- - - - -

Function setSize #

- -Count the number of elements of a (multi)set. When a second parameter is 'true', count only the unique values. -A multi-dimension array will be converted to a single-dimension array before the operation. - - -

Syntax #

- -```js -math.setSize(set) -math.setSize(set, unique) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`a` | Array | Matrix | A multiset -`unique` | boolean | If true, only the unique values are counted. False by default - -

Returns #

- -Type | Description ----- | ----------- -number | The number of elements of the (multi)set - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.setSize([1, 2, 2, 4]) // returns 4 -math.setSize([1, 2, 2, 4], true) // returns 3 -``` - - -

See also #

- -[setUnion](setUnion.html), -[setIntersect](setIntersect.html), -[setDifference](setDifference.html) diff --git a/docs/reference/functions/setSymDifference.md b/docs/reference/functions/setSymDifference.md deleted file mode 100644 index 8ddf3a8b29..0000000000 --- a/docs/reference/functions/setSymDifference.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: default ---- - - - -

Function setSymDifference #

- -Create the symmetric difference of two (multi)sets. -Multi-dimension arrays will be converted to single-dimension arrays before the operation. - - -

Syntax #

- -```js -math.setSymDifference(set1, set2) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`a1` | Array | Matrix | A (multi)set -`a2` | Array | Matrix | A (multi)set - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | The symmetric difference of two (multi)sets - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.setSymDifference([1, 2, 3, 4], [3, 4, 5, 6]) // returns [1, 2, 5, 6] -math.setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]]) // returns [1, 2, 5, 6] -``` - - -

See also #

- -[setUnion](setUnion.html), -[setIntersect](setIntersect.html), -[setDifference](setDifference.html) diff --git a/docs/reference/functions/setUnion.md b/docs/reference/functions/setUnion.md deleted file mode 100644 index a6abab5ef4..0000000000 --- a/docs/reference/functions/setUnion.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -layout: default ---- - - - -

Function setUnion #

- -Create the union of two (multi)sets. -Multi-dimension arrays will be converted to single-dimension arrays before the operation. - - -

Syntax #

- -```js -math.setUnion(set1, set2) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`a1` | Array | Matrix | A (multi)set -`a2` | Array | Matrix | A (multi)set - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | The union of two (multi)sets - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.setUnion([1, 2, 3, 4], [3, 4, 5, 6]) // returns [1, 2, 3, 4, 5, 6] -math.setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]]) // returns [1, 2, 3, 4, 5, 6] -``` - - -

See also #

- -[setIntersect](setIntersect.html), -[setDifference](setDifference.html) diff --git a/docs/reference/functions/sign.md b/docs/reference/functions/sign.md deleted file mode 100644 index 441b9cf281..0000000000 --- a/docs/reference/functions/sign.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default ---- - - - -

Function sign #

- -Compute the sign of a value. The sign of a value x is: - -- 1 when x > 0 -- -1 when x < 0 -- 0 when x == 0 - -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.sign(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | Complex | Array | Matrix | Unit | The number for which to determine the sign - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Fraction | Complex | Array | Matrix | Unit | The sign of `x` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.sign(3.5) // returns 1 -math.sign(-4.2) // returns -1 -math.sign(0) // returns 0 - -math.sign([3, 5, -2, 0, 2]) // returns [1, 1, -1, 0, 1] -``` - - -

See also #

- -[abs](abs.html) diff --git a/docs/reference/functions/simplify.md b/docs/reference/functions/simplify.md deleted file mode 100644 index 3c17ba88da..0000000000 --- a/docs/reference/functions/simplify.md +++ /dev/null @@ -1,145 +0,0 @@ ---- -layout: default ---- - - - -

Function simplify #

- -Simplify an expression tree. - -A list of rules are applied to an expression, repeating over the list until -no further changes are made. -It's possible to pass a custom set of rules to the function as second -argument. A rule can be specified as an object, string, or function: - - const rules = [ - { l: 'n1*n3 + n2*n3', r: '(n1+n2)*n3' }, - 'n1*n3 + n2*n3 -> (n1+n2)*n3', - function (node) { - // ... return a new node or return the node unchanged - return node - } - ] - -String and object rules consist of a left and right pattern. The left is -used to match against the expression and the right determines what matches -are replaced with. The main difference between a pattern and a normal -expression is that variables starting with the following characters are -interpreted as wildcards: - -- 'n' - Matches any node [Node] -- 'c' - Matches a constant literal (5 or 3.2) [ConstantNode] -- 'cl' - Matches a constant literal; same as c [ConstantNode] -- 'cd' - Matches a decimal literal (5 or -3.2) [ConstantNode or unaryMinus wrapping a ConstantNode] -- 'ce' - Matches a constant expression (-5 or √3) [Expressions consisting of only ConstantNodes, functions, and operators] -- 'v' - Matches a variable; anything not matched by c (-5 or x) [Node that is not a ConstantNode] -- 'vl' - Matches a variable literal (x or y) [SymbolNode] -- 'vd' - Matches a non-decimal expression; anything not matched by cd (x or √3) [Node that is not a ConstantNode or unaryMinus that is wrapping a ConstantNode] -- 've' - Matches a variable expression; anything not matched by ce (x or 2x) [Expressions that contain a SymbolNode or other non-constant term] - -The default list of rules is exposed on the function as `simplify.rules` -and can be used as a basis to built a set of custom rules. Note that since -the `simplifyCore` function is in the default list of rules, by default -simplify will convert any function calls in the expression that have -operator equivalents to their operator forms. - -To specify a rule as a string, separate the left and right pattern by '->' -When specifying a rule as an object, the following keys are meaningful: -- l - the left pattern -- r - the right pattern -- s - in lieu of l and r, the string form that is broken at -> to give them -- repeat - whether to repeat this rule until the expression stabilizes -- assuming - gives a context object, as in the 'context' option to - simplify. Every property in the context object must match the current - context in order, or else the rule will not be applied. -- imposeContext - gives a context object, as in the 'context' option to - simplify. Any settings specified will override the incoming context - for all matches of this rule. - -For more details on the theory, see: - -- [Strategies for simplifying math expressions (Stackoverflow)](https://stackoverflow.com/questions/7540227/strategies-for-simplifying-math-expressions) -- [Symbolic computation - Simplification (Wikipedia)](https://en.wikipedia.org/wiki/Symbolic_computation#Simplification) - - An optional `options` argument can be passed as last argument of `simplify`. - Currently available options (defaults in parentheses): - - `consoleDebug` (false): whether to write the expression being simplified - and any changes to it, along with the rule responsible, to console - - `context` (simplify.defaultContext): an object giving properties of - each operator, which determine what simplifications are allowed. The - currently meaningful properties are commutative, associative, - total (whether the operation is defined for all arguments), and - trivial (whether the operation applied to a single argument leaves - that argument unchanged). The default context is very permissive and - allows almost all simplifications. Only properties differing from - the default need to be specified; the default context is used as a - fallback. Additional contexts `simplify.realContext` and - `simplify.positiveContext` are supplied to cause simplify to perform - just simplifications guaranteed to preserve all values of the expression - assuming all variables and subexpressions are real numbers or - positive real numbers, respectively. (Note that these are in some cases - more restrictive than the default context; for example, the default - context will allow `x/x` to simplify to 1, whereas - `simplify.realContext` will not, as `0/0` is not equal to 1.) - - `exactFractions` (true): whether to try to convert all constants to - exact rational numbers. - - `fractionsLimit` (10000): when `exactFractions` is true, constants will - be expressed as fractions only when both numerator and denominator - are smaller than `fractionsLimit`. - - -

Syntax #

- -```js -math.simplify(expr) -math.simplify(expr, rules) -math.simplify(expr, rules) -math.simplify(expr, rules, scope) -math.simplify(expr, rules, scope, options) -math.simplify(expr, scope) -math.simplify(expr, scope, options) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`expr` | Node | string | The expression to be simplified -`rules` | SimplifyRule[] | Optional list with custom rules -`scope` | Object | Optional scope with variables -`options` | SimplifyOptions | Optional configuration settings - -

Returns #

- -Type | Description ----- | ----------- -Node | Returns the simplified form of `expr` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.simplify('2 * 1 * x ^ (2 - 1)') // Node "2 * x" -math.simplify('2 * 3 * x', {x: 4}) // Node "24" -const f = math.parse('2 * 1 * x ^ (2 - 1)') -math.simplify(f) // Node "2 * x" -math.simplify('0.4 * x', {}, {exactFractions: true}) // Node "x * 2 / 5" -math.simplify('0.4 * x', {}, {exactFractions: false}) // Node "0.4 * x" -``` - - -

See also #

- -[simplifyCore](simplifyCore.html), -[derivative](derivative.html), -[evaluate](evaluate.html), -[parse](parse.html), -[rationalize](rationalize.html), -[resolve](resolve.html) diff --git a/docs/reference/functions/simplifyConstant.md b/docs/reference/functions/simplifyConstant.md deleted file mode 100644 index d8be7c1ccc..0000000000 --- a/docs/reference/functions/simplifyConstant.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default ---- - - - -

Function simplifyConstant #

- -simplifyConstant() takes a mathjs expression (either a Node representing -a parse tree or a string which it parses to produce a node), and replaces -any subexpression of it consisting entirely of constants with the computed -value of that subexpression. - - -

Syntax #

- -```js -math.simplifyConstant(expr) -math.simplifyConstant(expr, options) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`node` | Node | string | The expression to be simplified -`options` | Object | Simplification options, as per simplify() - -

Returns #

- -Type | Description ----- | ----------- -Node | Returns expression with constant subexpressions evaluated - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.simplifyConstant('x + 4*3/6') // Node "x + 2" -math.simplifyConstant('z cos(0)') // Node "z 1" -math.simplifyConstant('(5.2 + 1.08)t', {exactFractions: false}) // Node "6.28 t" -``` - - -

See also #

- -[simplify](simplify.html), -[simplifyCore](simplifyCore.html), -[resolve](resolve.html), -[derivative](derivative.html) diff --git a/docs/reference/functions/simplifyCore.md b/docs/reference/functions/simplifyCore.md deleted file mode 100644 index d7a4b611ac..0000000000 --- a/docs/reference/functions/simplifyCore.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -layout: default ---- - - - -

Function simplifyCore #

- -simplifyCore() performs single pass simplification suitable for -applications requiring ultimate performance. To roughly summarize, -it handles cases along the lines of simplifyConstant() but where -knowledge of a single argument is sufficient to determine the value. -In contrast, simplify() extends simplifyCore() with additional passes -to provide deeper simplification (such as gathering like terms). - -Specifically, simplifyCore: - -* Converts all function calls with operator equivalents to their - operator forms. -* Removes operators or function calls that are guaranteed to have no - effect (such as unary '+'). -* Removes double unary '-', '~', and 'not' -* Eliminates addition/subtraction of 0 and multiplication/division/powers - by 1 or 0. -* Converts addition of a negation into subtraction. -* Eliminates logical operations with constant true or false leading - arguments. -* Puts constants on the left of a product, if multiplication is - considered commutative by the options (which is the default) - - -

Syntax #

- -```js -math.simplifyCore(expr) -math.simplifyCore(expr, options) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`node` | Node | string | The expression to be simplified -`options` | Object | Simplification options, as per simplify() - -

Returns #

- -Type | Description ----- | ----------- -Node | Returns expression with basic simplifications applied - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const f = math.parse('2 * 1 * x ^ (1 - 0)') -math.simplifyCore(f) // Node "2 * x" -math.simplify('2 * 1 * x ^ (1 - 0)', [math.simplifyCore]) // Node "2 * x" -``` - - -

See also #

- -[simplify](simplify.html), -[simplifyConstant](simplifyConstant.html), -[resolve](resolve.html), -[derivative](derivative.html) diff --git a/docs/reference/functions/sin.md b/docs/reference/functions/sin.md deleted file mode 100644 index b20e1abd37..0000000000 --- a/docs/reference/functions/sin.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default ---- - - - -

Function sin #

- -Calculate the sine of a value. - -To avoid confusion with the matrix sine, this function does not apply -to matrices. - - -

Syntax #

- -```js -math.sin(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Unit | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Sine of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.sin(2) // returns number 0.9092974268256813 -math.sin(math.pi / 4) // returns number 0.7071067811865475 -math.sin(math.unit(90, 'deg')) // returns number 1 -math.sin(math.unit(30, 'deg')) // returns number 0.5 - -const angle = 0.2 -math.pow(math.sin(angle), 2) + math.pow(math.cos(angle), 2) // returns number 1 -``` - - -

See also #

- -[cos](cos.html), -[tan](tan.html) diff --git a/docs/reference/functions/sinh.md b/docs/reference/functions/sinh.md deleted file mode 100644 index 057fb39fc8..0000000000 --- a/docs/reference/functions/sinh.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: default ---- - - - -

Function sinh #

- -Calculate the hyperbolic sine of a value, -defined as `sinh(x) = 1/2 * (exp(x) - exp(-x))`. - -To avoid confusion with the matrix hyperbolic sine, this function does -not apply to matrices. - - -

Syntax #

- -```js -math.sinh(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Hyperbolic sine of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.sinh(0.5) // returns number 0.5210953054937474 -``` - - -

See also #

- -[cosh](cosh.html), -[tanh](tanh.html) diff --git a/docs/reference/functions/size.md b/docs/reference/functions/size.md deleted file mode 100644 index 1fc91e763d..0000000000 --- a/docs/reference/functions/size.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function size #

- -Calculate the size of a matrix or scalar. - - -

Syntax #

- -```js -math.size(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | boolean | number | Complex | Unit | string | Array | Matrix | A matrix - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | A vector with size of `x`. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.size(2.3) // returns [] -math.size('hello world') // returns [11] - -const A = [[1, 2, 3], [4, 5, 6]] -math.size(A) // returns [2, 3] -math.size(math.range(1,6).toArray()) // returns [5] -``` - - -

See also #

- -[count](count.html), -[resize](resize.html), -[squeeze](squeeze.html), -[subset](subset.html) diff --git a/docs/reference/functions/slu.md b/docs/reference/functions/slu.md deleted file mode 100644 index 1154d65b88..0000000000 --- a/docs/reference/functions/slu.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -layout: default ---- - - - -

Function slu #

- -Calculate the Sparse Matrix LU decomposition with full pivoting. Sparse Matrix `A` is decomposed in two matrices (`L`, `U`) and two permutation vectors (`pinv`, `q`) where - -`P * A * Q = L * U` - - -

Syntax #

- -```js -math.slu(A, order, threshold) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`A` | SparseMatrix | A two dimensional sparse matrix for which to get the LU decomposition. -`order` | Number | The Symbolic Ordering and Analysis order: 0 - Natural ordering, no permutation vector q is returned 1 - Matrix must be square, symbolic ordering and analisis is performed on M = A + A' 2 - Symbolic ordering and analisis is performed on M = A' * A. Dense columns from A' are dropped, A recreated from A'. This is appropriatefor LU factorization of unsymmetric matrices. 3 - Symbolic ordering and analisis is performed on M = A' * A. This is best used for LU factorization is matrix M has no dense rows. A dense row is a row with more than 10*sqr(columns) entries. -`threshold` | Number | Partial pivoting threshold (1 for partial pivoting) - -

Returns #

- -Type | Description ----- | ----------- -Object | The lower triangular matrix, the upper triangular matrix and the permutation vectors. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const A = math.sparse([[4,3], [6, 3]]) -math.slu(A, 1, 0.001) -// returns: -// { -// L: [[1, 0], [1.5, 1]] -// U: [[4, 3], [0, -1.5]] -// p: [0, 1] -// q: [0, 1] -// } -``` - - -

See also #

- -[lup](lup.html), -[lsolve](lsolve.html), -[usolve](usolve.html), -[lusolve](lusolve.html) diff --git a/docs/reference/functions/smaller.md b/docs/reference/functions/smaller.md deleted file mode 100644 index 9e0e5a4fe0..0000000000 --- a/docs/reference/functions/smaller.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -layout: default ---- - - - -

Function smaller #

- -Test whether value x is smaller than y. - -The function returns true when x is smaller than y and the relative -difference between x and y is smaller than the configured relTol and absTol. The -function cannot be used to compare values smaller than approximately 2.22e-16. - -For matrices, the function is evaluated element wise. -Strings are compared by their numerical value. - - -

Syntax #

- -```js -math.smaller(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix | First value to compare -`y` | number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix | Second value to compare - -

Returns #

- -Type | Description ----- | ----------- -boolean | Array | Matrix | Returns true when the x is smaller than y, else returns false - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.smaller(2, 3) // returns true -math.smaller(5, 2 * 2) // returns false - -const a = math.unit('5 cm') -const b = math.unit('2 inch') -math.smaller(a, b) // returns true -``` - - -

See also #

- -[equal](equal.html), -[unequal](unequal.html), -[smallerEq](smallerEq.html), -[smaller](smaller.html), -[smallerEq](smallerEq.html), -[compare](compare.html) diff --git a/docs/reference/functions/smallerEq.md b/docs/reference/functions/smallerEq.md deleted file mode 100644 index 641ddd47c6..0000000000 --- a/docs/reference/functions/smallerEq.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -layout: default ---- - - - -

Function smallerEq #

- -Test whether value x is smaller or equal to y. - -The function returns true when x is smaller than y or the relative -difference between x and y is smaller than the configured relTol and absTol. The -function cannot be used to compare values smaller than approximately 2.22e-16. - -For matrices, the function is evaluated element wise. -Strings are compared by their numerical value. - - -

Syntax #

- -```js -math.smallerEq(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix | First value to compare -`y` | number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix | Second value to compare - -

Returns #

- -Type | Description ----- | ----------- -boolean | Array | Matrix | Returns true when the x is smaller than y, else returns false - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.smaller(1 + 2, 3) // returns false -math.smallerEq(1 + 2, 3) // returns true -``` - - -

See also #

- -[equal](equal.html), -[unequal](unequal.html), -[smaller](smaller.html), -[larger](larger.html), -[largerEq](largerEq.html), -[compare](compare.html) diff --git a/docs/reference/functions/solveODE.md b/docs/reference/functions/solveODE.md deleted file mode 100644 index e21fc6c057..0000000000 --- a/docs/reference/functions/solveODE.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -layout: default ---- - - - -

Function solveODE #

- -Numerical Integration of Ordinary Differential Equations - -Two variable step methods are provided: -- "RK23": Bogacki–Shampine method -- "RK45": Dormand-Prince method RK5(4)7M (default) - -The arguments are expected as follows. - -- `func` should be the forcing function `f(t, y)` -- `tspan` should be a vector of two numbers or units `[tStart, tEnd]` -- `y0` the initial state values, should be a scalar or a flat array -- `options` should be an object with the following information: - - `method` ('RK45'): ['RK23', 'RK45'] - - `tol` (1e-3): Numeric tolerance of the method, the solver keeps the error estimates less than this value - - `firstStep`: Initial step size - - `minStep`: minimum step size of the method - - `maxStep`: maximum step size of the method - - `minDelta` (0.2): minimum ratio of change for the step - - `maxDelta` (5): maximum ratio of change for the step - - `maxIter` (1e4): maximum number of iterations - -The returned value is an object with `{t, y}` please note that even though `t` means time, it can represent any other independant variable like `x`: -- `t` an array of size `[n]` -- `y` the states array can be in two ways - - **if `y0` is a scalar:** returns an array-like of size `[n]` - - **if `y0` is a flat array-like of size [m]:** returns an array like of size `[n, m]` - - -

Syntax #

- -```js -math.solveODE(func, tspan, y0) -math.solveODE(func, tspan, y0, options) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`func` | function | The forcing function f(t,y) -`tspan` | Array | Matrix | The time span -`y0` | number | BigNumber | Unit | Array | Matrix | The initial value -`options` | Object | Optional configuration options - -

Returns #

- -Type | Description ----- | ----------- -Object | Return an object with t and y values as arrays - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -function func(t, y) {return y} -const tspan = [0, 4] -const y0 = 1 -math.solveODE(func, tspan, y0) -math.solveODE(func, tspan, [1, 2]) -math.solveODE(func, tspan, y0, { method:"RK23", maxStep:0.1 }) -``` - - -

See also #

- -[derivative](derivative.html), -[simplifyCore](simplifyCore.html) diff --git a/docs/reference/functions/sort.md b/docs/reference/functions/sort.md deleted file mode 100644 index 2a223cc4cd..0000000000 --- a/docs/reference/functions/sort.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -layout: default ---- - - - -

Function sort #

- -Sort the items in a matrix. - - -

Syntax #

- -```js -math.sort(x) -math.sort(x, compare) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Matrix | Array | A one dimensional matrix or array to sort -`compare` | Function | 'asc' | 'desc' | 'natural' | An optional _comparator function or name. The function is called as `compare(a, b)`, and must return 1 when a > b, -1 when a < b, and 0 when a == b. Default value: 'asc'. - -

Returns #

- -Type | Description ----- | ----------- -Matrix | Array | Returns the sorted matrix. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.sort([5, 10, 1]) // returns [1, 5, 10] -math.sort(['C', 'B', 'A', 'D'], math.compareNatural) -// returns ['A', 'B', 'C', 'D'] - -function sortByLength (a, b) { - return a.length - b.length -} -math.sort(['Langdon', 'Tom', 'Sara'], sortByLength) -// returns ['Tom', 'Sara', 'Langdon'] -``` - - -

See also #

- -[filter](filter.html), -[forEach](forEach.html), -[map](map.html), -[compare](compare.html), -[compareNatural](compareNatural.html) diff --git a/docs/reference/functions/sparse.md b/docs/reference/functions/sparse.md deleted file mode 100644 index 2f1fc5913f..0000000000 --- a/docs/reference/functions/sparse.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -layout: default ---- - - - -

Function sparse #

- -Create a Sparse Matrix. The function creates a new `math.Matrix` object from -an `Array`. A Matrix has utility functions to manipulate the data in the -matrix, like getting the size and getting or setting values in the matrix. -Note that a Sparse Matrix is always 2-dimensional, so for example if -you create one from a plain array of _n_ numbers, you get an _n_ by 1 -Sparse "column vector". - - -

Syntax #

- -```js -math.sparse() // creates an empty sparse matrix. -math.sparse(data) // creates a sparse matrix with initial data. -math.sparse(data, 'number') // creates a sparse matrix with initial data, number datatype. -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`data` | Array | Matrix | A two dimensional array - -

Returns #

- -Type | Description ----- | ----------- -Matrix | The created matrix - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -let m = math.sparse([[1, 2], [3, 4]]) -m.size() // Array [2, 2] -m.resize([3, 2], 5) -m.valueOf() // Array [[1, 2], [3, 4], [5, 5]] -m.get([1, 0]) // number 3 -let v = math.sparse([0, 0, 1]) -v.size() // Array [3, 1] -v.get([2, 0]) // number 1 -``` - - -

See also #

- -[bignumber](bignumber.html), -[boolean](boolean.html), -[complex](complex.html), -[index](index.html), -[number](number.html), -[string](string.html), -[unit](unit.html), -[matrix](matrix.html) diff --git a/docs/reference/functions/splitUnit.md b/docs/reference/functions/splitUnit.md deleted file mode 100644 index 679f09df49..0000000000 --- a/docs/reference/functions/splitUnit.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -layout: default ---- - - - -

Function splitUnit #

- -Split a unit in an array of units whose sum is equal to the original unit. - - -

Syntax #

- -```js -splitUnit(unit: Unit, parts: Array.) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`parts` | Array | An array of strings or valueless units. - -

Returns #

- -Type | Description ----- | ----------- -Array | An array of units. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.splitUnit(new Unit(1, 'm'), ['feet', 'inch']) -// [ 3 feet, 3.3700787401575 inch ] -``` - - -

See also #

- -[unit](unit.html) diff --git a/docs/reference/functions/sqrt.md b/docs/reference/functions/sqrt.md deleted file mode 100644 index b9941a1250..0000000000 --- a/docs/reference/functions/sqrt.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default ---- - - - -

Function sqrt #

- -Calculate the square root of a value. - -For matrices, if you want the matrix square root of a square matrix, -use the `sqrtm` function. If you wish to apply `sqrt` elementwise to -a matrix M, use `math.map(M, math.sqrt)`. - - -

Syntax #

- -```js -math.sqrt(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Unit | Value for which to calculate the square root. - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Unit | Returns the square root of `x` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.sqrt(25) // returns 5 -math.square(5) // returns 25 -math.sqrt(-4) // returns Complex 2i -``` - - -

See also #

- -[square](square.html), -[multiply](multiply.html), -[cube](cube.html), -[cbrt](cbrt.html), -[sqrtm](sqrtm.html) diff --git a/docs/reference/functions/sqrtm.md b/docs/reference/functions/sqrtm.md deleted file mode 100644 index 6ba64f4d55..0000000000 --- a/docs/reference/functions/sqrtm.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -layout: default ---- - - - -

Function sqrtm #

- -Calculate the principal square root of a square matrix. -The principal square root matrix `X` of another matrix `A` is such that `X * X = A`. - -https://en.wikipedia.org/wiki/Square_root_of_a_matrix - - -

Syntax #

- -```js -math.sqrtm(A) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`A` | Array | Matrix | The square matrix `A` - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | The principal square root of matrix `A` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.sqrtm([[33, 24], [48, 57]]) // returns [[5, 2], [4, 7]] -``` - - -

See also #

- -[sqrt](sqrt.html), -[pow](pow.html) diff --git a/docs/reference/functions/square.md b/docs/reference/functions/square.md deleted file mode 100644 index f6ea16609c..0000000000 --- a/docs/reference/functions/square.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: default ---- - - - -

Function square #

- -Compute the square of a value, `x * x`. -To avoid confusion with multiplying a square matrix by itself, -this function does not apply to matrices. If you wish to square -every element of a matrix, see the examples. - - -

Syntax #

- -```js -math.square(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | Complex | Unit | Number for which to calculate the square - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Fraction | Complex | Unit | Squared value - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.square(2) // returns number 4 -math.square(3) // returns number 9 -math.pow(3, 2) // returns number 9 -math.multiply(3, 3) // returns number 9 - -math.map([1, 2, 3, 4], math.square) // returns Array [1, 4, 9, 16] -``` - - -

See also #

- -[multiply](multiply.html), -[cube](cube.html), -[sqrt](sqrt.html), -[pow](pow.html) diff --git a/docs/reference/functions/squeeze.md b/docs/reference/functions/squeeze.md deleted file mode 100644 index 7f3dee550a..0000000000 --- a/docs/reference/functions/squeeze.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: default ---- - - - -

Function squeeze #

- -Squeeze a matrix, remove inner and outer singleton dimensions from a matrix. - - -

Syntax #

- -```js -math.squeeze(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Matrix | Array | Matrix to be squeezed - -

Returns #

- -Type | Description ----- | ----------- -Matrix | Array | Squeezed matrix - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.squeeze([3]) // returns 3 -math.squeeze([[3]]) // returns 3 - -const A = math.zeros(3, 1) // returns [[0], [0], [0]] (size 3x1) -math.squeeze(A) // returns [0, 0, 0] (size 3) - -const B = math.zeros(1, 3) // returns [[0, 0, 0]] (size 1x3) -math.squeeze(B) // returns [0, 0, 0] (size 3) - -// only inner and outer dimensions are removed -const C = math.zeros(2, 1, 3) // returns [[[0, 0, 0]], [[0, 0, 0]]] (size 2x1x3) -math.squeeze(C) // returns [[[0, 0, 0]], [[0, 0, 0]]] (size 2x1x3) -``` - - -

See also #

- -[subset](subset.html) diff --git a/docs/reference/functions/std.md b/docs/reference/functions/std.md deleted file mode 100644 index b18703c1e5..0000000000 --- a/docs/reference/functions/std.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -layout: default ---- - - - -

Function std #

- -Compute the standard deviation of a matrix or a list with values. -The standard deviations is defined as the square root of the variance: -`std(A) = sqrt(variance(A))`. -In case of a (multi dimensional) array or matrix, the standard deviation -over all elements will be calculated by default, unless an axis is specified -in which case the standard deviation will be computed along that axis. - -Additionally, it is possible to compute the standard deviation along the rows -or columns of a matrix by specifying the dimension as the second argument. - -Optionally, the type of normalization can be specified as the final -parameter. The parameter `normalization` can be one of the following values: - -- 'unbiased' (default) The sum of squared errors is divided by (n - 1) -- 'uncorrected' The sum of squared errors is divided by n -- 'biased' The sum of squared errors is divided by (n + 1) - - -

Syntax #

- -```js -math.std(a, b, c, ...) -math.std(A) -math.std(A, normalization) -math.std(A, dimension) -math.std(A, dimension, normalization) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`array` | Array | Matrix | A single matrix or or multiple scalar values -`normalization` | string | Determines how to normalize the variance. Choose 'unbiased' (default), 'uncorrected', or 'biased'. Default value: 'unbiased'. - -

Returns #

- -Type | Description ----- | ----------- -* | The standard deviation - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.std(2, 4, 6) // returns 2 -math.std([2, 4, 6, 8]) // returns 2.581988897471611 -math.std([2, 4, 6, 8], 'uncorrected') // returns 2.23606797749979 -math.std([2, 4, 6, 8], 'biased') // returns 2 - -math.std([[1, 2, 3], [4, 5, 6]]) // returns 1.8708286933869707 -math.std([[1, 2, 3], [4, 6, 8]], 0) // returns [2.1213203435596424, 2.8284271247461903, 3.5355339059327378] -math.std([[1, 2, 3], [4, 6, 8]], 1) // returns [1, 2] -math.std([[1, 2, 3], [4, 6, 8]], 1, 'biased') // returns [0.7071067811865476, 1.4142135623730951] -``` - - -

See also #

- -[mean](mean.html), -[median](median.html), -[max](max.html), -[min](min.html), -[prod](prod.html), -[sum](sum.html), -[variance](variance.html) diff --git a/docs/reference/functions/stirlingS2.md b/docs/reference/functions/stirlingS2.md deleted file mode 100644 index 360b061a0a..0000000000 --- a/docs/reference/functions/stirlingS2.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default ---- - - - -

Function stirlingS2 #

- -The Stirling numbers of the second kind, counts the number of ways to partition -a set of n labelled objects into k nonempty unlabelled subsets. -stirlingS2 only takes integer arguments. -The following condition must be enforced: k <= n. - - If n = k or k = 1 <= n, then s(n,k) = 1 - If k = 0 < n, then s(n,k) = 0 - -Note that if either n or k is supplied as a BigNumber, the result will be -as well. - - -

Syntax #

- -```js -math.stirlingS2(n, k) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`n` | Number | BigNumber | Total number of objects in the set -`k` | Number | BigNumber | Number of objects in the subset - -

Returns #

- -Type | Description ----- | ----------- -Number | BigNumber | S(n,k) - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.stirlingS2(5, 3) //returns 25 -``` - - -

See also #

- -[bellNumbers](bellNumbers.html) diff --git a/docs/reference/functions/string.md b/docs/reference/functions/string.md deleted file mode 100644 index 3728c532e5..0000000000 --- a/docs/reference/functions/string.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -layout: default ---- - - - -

Function string #

- -Create a string or convert any object into a string. -Elements of Arrays and Matrices are processed element wise. - - -

Syntax #

- -```js -math.string(value) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`value` | * | Array | Matrix | null | A value to convert to a string - -

Returns #

- -Type | Description ----- | ----------- -string | Array | Matrix | The created string - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.string(4.2) // returns string '4.2' -math.string(math.complex(3, 2) // returns string '3 + 2i' - -const u = math.unit(5, 'km') -math.string(u.to('m')) // returns string '5000 m' - -math.string([true, false]) // returns ['true', 'false'] -``` - - -

See also #

- -[bignumber](bignumber.html), -[boolean](boolean.html), -[complex](complex.html), -[index](index.html), -[matrix](matrix.html), -[number](number.html), -[unit](unit.html) diff --git a/docs/reference/functions/subset.md b/docs/reference/functions/subset.md deleted file mode 100644 index 6991dd6695..0000000000 --- a/docs/reference/functions/subset.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -layout: default ---- - - - -

Function subset #

- -Get or set a subset of a matrix or string. - - -

Syntax #

- -```js -math.subset(value, index) // retrieve a subset -math.subset(value, index, replacement [, defaultValue]) // replace a subset -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`matrix` | Array | Matrix | string | An array, matrix, or string -`index` | Index | For each dimension of the target, specifies an index or a list of indices to fetch or set. `subset` uses the cartesian product of the indices specified in each dimension. -`replacement` | * | An array, matrix, or scalar. If provided, the subset is replaced with replacement. If not provided, the subset is returned -`defaultValue` | * | Default value, filled in on new entries when the matrix is resized. If not provided, math.matrix elements will be left undefined. Default value: undefined. - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | string | Either the retrieved subset or the updated matrix. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```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([false, true], 0)) // returns [[3]] - -// replace a subset -const e = [] -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 = [ - [1,2,3], - [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]] -``` - - -

See also #

- -[size](size.html), -[resize](resize.html), -[squeeze](squeeze.html), -[index](index.html) diff --git a/docs/reference/functions/subtract.md b/docs/reference/functions/subtract.md deleted file mode 100644 index 00e22f2e6a..0000000000 --- a/docs/reference/functions/subtract.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -layout: default ---- - - - -

Function subtract #

- -Subtract two values, `x - y`. -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.subtract(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix | Initial value -`y` | number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix | Value to subtract from `x` - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix | Subtraction of `x` and `y` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.subtract(5.3, 2) // returns number 3.3 - -const a = math.complex(2, 3) -const b = math.complex(4, 1) -math.subtract(a, b) // returns Complex -2 + 2i - -math.subtract([5, 7, 4], 4) // returns Array [1, 3, 0] - -const c = math.unit('2.1 km') -const d = math.unit('500m') -math.subtract(c, d) // returns Unit 1.6 km -``` - - -

See also #

- -[add](add.html) diff --git a/docs/reference/functions/sum.md b/docs/reference/functions/sum.md deleted file mode 100644 index e7951dac8c..0000000000 --- a/docs/reference/functions/sum.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -layout: default ---- - - - -

Function sum #

- -Compute the sum of a matrix or a list with values. -In case of a multidimensional array or matrix, the sum of all -elements will be calculated. - - -

Syntax #

- -```js -math.sum(a, b, c, ...) -math.sum(A) -math.sum(A, dimension) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`args` | ... * | A single matrix or multiple scalar values - -

Returns #

- -Type | Description ----- | ----------- -* | The sum of all values - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.sum(2, 1, 4, 3) // returns 10 -math.sum([2, 1, 4, 3]) // returns 10 -math.sum([[2, 5], [4, 3], [1, 7]]) // returns 22 -``` - - -

See also #

- -[mean](mean.html), -[median](median.html), -[min](min.html), -[max](max.html), -[prod](prod.html), -[std](std.html), -[variance](variance.html), -[cumsum](cumsum.html) diff --git a/docs/reference/functions/sylvester.md b/docs/reference/functions/sylvester.md deleted file mode 100644 index 109b083b08..0000000000 --- a/docs/reference/functions/sylvester.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: default ---- - - - -

Function sylvester #

- -Solves the real-valued Sylvester equation AX+XB=C for X, where A, B and C are -matrices of appropriate dimensions, being A and B squared. Notice that other -equivalent definitions for the Sylvester equation exist and this function -assumes the one presented in the original publication of the the Bartels- -Stewart algorithm, which is implemented by this function. -https://en.wikipedia.org/wiki/Sylvester_equation - - -

Syntax #

- -```js -math.sylvester(A, B, C) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`A` | Matrix | Array | Matrix A -`B` | Matrix | Array | Matrix B -`C` | Matrix | Array | Matrix C - -

Returns #

- -Type | Description ----- | ----------- -Matrix | Array | Matrix X, solving the Sylvester equation - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const A = [[-1, -2], [1, 1]] -const B = [[2, -1], [1, -2]] -const C = [[-3, 2], [3, 0]] -math.sylvester(A, B, C) // returns DenseMatrix [[-0.25, 0.25], [1.5, -1.25]] -``` - - -

See also #

- -[schur](schur.html), -[lyap](lyap.html) diff --git a/docs/reference/functions/symbolicEqual.md b/docs/reference/functions/symbolicEqual.md deleted file mode 100644 index e87d502044..0000000000 --- a/docs/reference/functions/symbolicEqual.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -layout: default ---- - - - -

Function symbolicEqual #

- -Attempts to determine if two expressions are symbolically equal, i.e. -one is the result of valid algebraic manipulations on the other. -Currently, this simply checks if the difference of the two expressions -simplifies down to 0. So there are two important caveats: -1. whether two expressions are symbolically equal depends on the - manipulations allowed. Therefore, this function takes an optional - third argument, which are the options that control the behavior - as documented for the `simplify()` function. -2. it is in general intractable to find the minimal simplification of - an arbitrarily complicated expression. So while a `true` value - of `symbolicEqual` ensures that the two expressions can be manipulated - to match each other, a `false` value does not absolutely rule this out. - - -

Syntax #

- -```js -math.symbolicEqual(expr1, expr2) -math.symbolicEqual(expr1, expr2, options) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`expr1` | Node | string | The first expression to compare -`expr2` | Node | string | The second expression to compare -`options` | Object | Optional option object, passed to simplify - -

Returns #

- -Type | Description ----- | ----------- -boolean | Returns true if a valid manipulation making the expressions equal is found. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.symbolicEqual('x*y', 'y*x') // Returns true -math.symbolicEqual('x*y', 'y*x', {context: {multiply: {commutative: false}}}) // Returns false -math.symbolicEqual('x/y', '(y*x^(-1))^(-1)') // Returns true -math.symbolicEqual('abs(x)','x') // Returns false -math.symbolicEqual('abs(x)','x', simplify.positiveContext) // Returns true -``` - - -

See also #

- -[simplify](simplify.html), -[evaluate](evaluate.html) diff --git a/docs/reference/functions/tan.md b/docs/reference/functions/tan.md deleted file mode 100644 index 12101e54f2..0000000000 --- a/docs/reference/functions/tan.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function tan #

- -Calculate the tangent of a value. `tan(x)` is equal to `sin(x) / cos(x)`. - -To avoid confusion with the matrix tangent, this function does not apply -to matrices. - - -

Syntax #

- -```js -math.tan(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Unit | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Tangent of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.tan(0.5) // returns number 0.5463024898437905 -math.sin(0.5) / math.cos(0.5) // returns number 0.5463024898437905 -math.tan(math.pi / 4) // returns number 1 -math.tan(math.unit(45, 'deg')) // returns number 1 -``` - - -

See also #

- -[atan](atan.html), -[sin](sin.html), -[cos](cos.html) diff --git a/docs/reference/functions/tanh.md b/docs/reference/functions/tanh.md deleted file mode 100644 index ba30121c36..0000000000 --- a/docs/reference/functions/tanh.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -layout: default ---- - - - -

Function tanh #

- -Calculate the hyperbolic tangent of a value, -defined as `tanh(x) = (exp(2 * x) - 1) / (exp(2 * x) + 1)`. - -To avoid confusion with matrix hyperbolic tangent, this function does -not apply to matrices. - - -

Syntax #

- -```js -math.tanh(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Complex | Function input - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | Complex | Hyperbolic tangent of x - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -// tanh(x) = sinh(x) / cosh(x) = 1 / coth(x) -math.tanh(0.5) // returns 0.46211715726000974 -math.sinh(0.5) / math.cosh(0.5) // returns 0.46211715726000974 -1 / math.coth(0.5) // returns 0.46211715726000974 -``` - - -

See also #

- -[sinh](sinh.html), -[cosh](cosh.html), -[coth](coth.html) diff --git a/docs/reference/functions/to.md b/docs/reference/functions/to.md deleted file mode 100644 index b05e647e44..0000000000 --- a/docs/reference/functions/to.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: default ---- - - - -

Function to #

- -Change the unit of a value. - -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.to(x, unit) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Unit | Array | Matrix | The unit to be converted. -`unit` | Unit | Array | Matrix | New unit. Can be a string like "cm" or a unit without value. - -

Returns #

- -Type | Description ----- | ----------- -Unit | Array | Matrix | value with changed, fixed unit. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.to(math.unit('2 inch'), 'cm') // returns Unit 5.08 cm -math.to(math.unit('2 inch'), math.unit('cm')) // returns Unit 5.08 cm -math.to(math.unit(16, 'bytes'), 'bits') // returns Unit 128 bits -``` - - -

See also #

- -[unit](unit.html) diff --git a/docs/reference/functions/trace.md b/docs/reference/functions/trace.md deleted file mode 100644 index 375cee2888..0000000000 --- a/docs/reference/functions/trace.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -layout: default ---- - - - -

Function trace #

- -Calculate the trace of a matrix: the sum of the elements on the main -diagonal of a square matrix. - - -

Syntax #

- -```js -math.trace(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Array | Matrix | A matrix - -

Returns #

- -Type | Description ----- | ----------- -number | The trace of `x` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.trace([[1, 2], [3, 4]]) // returns 5 - -const A = [ - [1, 2, 3], - [-1, 2, 3], - [2, 0, 3] -] -math.trace(A) // returns 6 -``` - - -

See also #

- -[diag](diag.html) diff --git a/docs/reference/functions/transpose.md b/docs/reference/functions/transpose.md deleted file mode 100644 index 074f62f2ca..0000000000 --- a/docs/reference/functions/transpose.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -layout: default ---- - - - -

Function transpose #

- -Transpose a matrix. All values of the matrix are reflected over its -main diagonal. Only applicable to two dimensional matrices containing -a vector (i.e. having size `[1,n]` or `[n,1]`). One dimensional -vectors and scalars return the input unchanged. - - -

Syntax #

- -```js -math.transpose(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | Array | Matrix | Matrix to be transposed - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | The transposed matrix - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const A = [[1, 2, 3], [4, 5, 6]] -math.transpose(A) // returns [[1, 4], [2, 5], [3, 6]] -``` - - -

See also #

- -[diag](diag.html), -[inv](inv.html), -[subset](subset.html), -[squeeze](squeeze.html) diff --git a/docs/reference/functions/typeOf.md b/docs/reference/functions/typeOf.md deleted file mode 100644 index 7ab5488863..0000000000 --- a/docs/reference/functions/typeOf.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -layout: default ---- - - - -

Function typeOf #

- -Determine the type of an entity. - - -

Syntax #

- -```js -math.typeOf(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | * | The variable for which to test the type. - -

Returns #

- -Type | Description ----- | ----------- -string | Returns the name of the type. Primitive types are lower case, non-primitive types are upper-camel-case. For example 'number', 'string', 'Array', 'Date'. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -// This list is intended to include all relevant types, for testing -// purposes: -math.typeOf(3.5) // returns 'number' -math.typeOf(42n) // returns 'bigint' -math.typeOf(math.complex('2-4i')) // returns 'Complex' -math.typeOf(math.unit('45 deg')) // returns 'Unit' -math.typeOf('hello world') // returns 'string' -math.typeOf(null) // returns 'null' -math.typeOf(true) // returns 'boolean' -math.typeOf([1, 2, 3]) // returns 'Array' -math.typeOf(new Date()) // returns 'Date' -math.typeOf(function () {}) // returns 'function' -math.typeOf({a: 2, b: 3}) // returns 'Object' -math.typeOf(/a regexp/) // returns 'RegExp' -math.typeOf(undefined) // returns 'undefined' -math.typeOf(math.bignumber('23e99')) // returns 'BigNumber' -math.typeOf(math.chain(2)) // returns 'Chain' -math.typeOf(math.fraction(1, 3)) // returns 'Fraction' -math.typeOf(math.help('sqrt')) // returns 'Help' -math.typeOf(math.index(1, 3)) // returns 'Index' -math.typeOf(math.matrix([[1],[3]])) // returns 'DenseMatrix' -math.typeOf(math.matrix([],'sparse')) // returns 'SparseMatrix' -math.typeOf(new math.Range(0, 10)) // returns 'Range' -math.typeOf(math.evaluate('a=2\na')) // returns 'ResultSet' -math.typeOf(math.parse('A[2]')) // returns 'AccessorNode' -math.typeOf(math.parse('[1,2,3]')) // returns 'ArrayNode' -math.typeOf(math.parse('x=2')) // returns 'AssignmentNode' -math.typeOf(math.parse('a=2; b=3')) // returns 'BlockNode' -math.typeOf(math.parse('x<0?-1:1')) // returns 'ConditionalNode' -math.typeOf(math.parse('2.3')) // returns 'ConstantNode' -math.typeOf(math.parse('f(x)=x^2')) // returns 'FunctionAssignmentNode' -math.typeOf(math.parse('sqrt(4)')) // returns 'FunctionNode' -math.typeOf(math.parse('A[2]').index) // returns 'IndexNode' -math.typeOf(math.parse('{a:2}')) // returns 'ObjectNode' -math.typeOf(math.parse('(2+3)')) // returns 'ParenthesisNode' -math.typeOf(math.parse('1:10')) // returns 'RangeNode' -math.typeOf(math.parse('a - -

Function typed #

- -Create a typed-function which checks the types of the arguments and -can match them against multiple provided signatures. The typed-function -automatically converts inputs in order to find a matching signature. -Typed functions throw informative errors in case of wrong input arguments. - -See the library [typed-function](https://github.com/josdejong/typed-function) -for detailed documentation. - - -

Syntax #

- -```js -math.typed(name, signatures) : function -math.typed(signatures) : function -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`name` | string | Optional name for the typed-function -`signatures` | Object<string, function> | Object with one or multiple function signatures - -

Returns #

- -Type | Description ----- | ----------- -function | The created typed-function. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -// create a typed function with multiple types per argument (type union) -const fn2 = typed({ - 'number | boolean': function (b) { - return 'b is a number or boolean' - }, - 'string, number | boolean': function (a, b) { - return 'a is a string, b is a number or boolean' - } -}) - -// create a typed function with an any type argument -const log = typed({ - 'string, any': function (event, data) { - console.log('event: ' + event + ', data: ' + JSON.stringify(data)) - } -}) -``` - - diff --git a/docs/reference/functions/unaryMinus.md b/docs/reference/functions/unaryMinus.md deleted file mode 100644 index fc142ca173..0000000000 --- a/docs/reference/functions/unaryMinus.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -layout: default ---- - - - -

Function unaryMinus #

- -Inverse the sign of a value, apply a unary minus operation. - -For matrices, the function is evaluated element wise. Boolean values and -strings will be converted to a number. For complex numbers, both real and -complex value are inverted. - - -

Syntax #

- -```js -math.unaryMinus(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix | Number to be inverted. - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix | Returns the value with inverted sign. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.unaryMinus(3.5) // returns -3.5 -math.unaryMinus(-4.2) // returns 4.2 -``` - - -

See also #

- -[add](add.html), -[subtract](subtract.html), -[unaryPlus](unaryPlus.html) diff --git a/docs/reference/functions/unaryPlus.md b/docs/reference/functions/unaryPlus.md deleted file mode 100644 index 1a24a9475e..0000000000 --- a/docs/reference/functions/unaryPlus.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -layout: default ---- - - - -

Function unaryPlus #

- -Unary plus operation. -Boolean values and strings will be converted to a number, numeric values will be returned as is. - -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.unaryPlus(x) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Fraction | string | Complex | Unit | Array | Matrix | Input value - -

Returns #

- -Type | Description ----- | ----------- -number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix | Returns the input value when numeric, converts to a number when input is non-numeric. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.unaryPlus(3.5) // returns 3.5 -math.unaryPlus(1) // returns 1 -``` - - -

See also #

- -[unaryMinus](unaryMinus.html), -[add](add.html), -[subtract](subtract.html) diff --git a/docs/reference/functions/unequal.md b/docs/reference/functions/unequal.md deleted file mode 100644 index 6134c82449..0000000000 --- a/docs/reference/functions/unequal.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -layout: default ---- - - - -

Function unequal #

- -Test whether two values are unequal. - -The function tests whether the relative difference between x and y is -larger than the configured relTol and absTol. The function cannot be used to compare -values smaller than approximately 2.22e-16. - -For matrices, the function is evaluated element wise. -In case of complex numbers, x.re must unequal y.re, or x.im must unequal y.im. -Strings are compared by their numerical value. - -Values `null` and `undefined` are compared strictly, thus `null` is unequal -with everything except `null`, and `undefined` is unequal with everything -except `undefined`. - - -

Syntax #

- -```js -math.unequal(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | Fraction | boolean | Complex | Unit | string | Array | Matrix | undefined | First value to compare -`y` | number | BigNumber | Fraction | boolean | Complex | Unit | string | Array | Matrix | undefined | Second value to compare - -

Returns #

- -Type | Description ----- | ----------- -boolean | Array | Matrix | Returns true when the compared values are unequal, else returns false - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.unequal(2 + 2, 3) // returns true -math.unequal(2 + 2, 4) // returns false - -const a = math.unit('50 cm') -const b = math.unit('5 m') -math.unequal(a, b) // returns false - -const c = [2, 5, 1] -const d = [2, 7, 1] - -math.unequal(c, d) // returns [false, true, false] -math.deepEqual(c, d) // returns false - -math.unequal(0, null) // returns true -``` - - -

See also #

- -[equal](equal.html), -[deepEqual](deepEqual.html), -[smaller](smaller.html), -[smallerEq](smallerEq.html), -[larger](larger.html), -[largerEq](largerEq.html), -[compare](compare.html) diff --git a/docs/reference/functions/unit.md b/docs/reference/functions/unit.md deleted file mode 100644 index 43ccb0f075..0000000000 --- a/docs/reference/functions/unit.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -layout: default ---- - - - -

Function unit #

- -Create a unit. Depending on the passed arguments, the function -will create and return a new math.Unit object. -When a matrix is provided, all elements will be converted to units. - - -

Syntax #

- -```js -math.unit(unit : string) -math.unit(value : number, unit : string) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`args` | * | Array | Matrix | A number and unit. - -

Returns #

- -Type | Description ----- | ----------- -Unit | Array | Matrix | The created unit - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const a = math.unit(5, 'cm') // returns Unit 50 mm -const b = math.unit('23 kg') // returns Unit 23 kg -a.to('m') // returns Unit 0.05 m -``` - - -

See also #

- -[bignumber](bignumber.html), -[boolean](boolean.html), -[complex](complex.html), -[index](index.html), -[matrix](matrix.html), -[number](number.html), -[string](string.html), -[createUnit](createUnit.html) diff --git a/docs/reference/functions/usolve.md b/docs/reference/functions/usolve.md deleted file mode 100644 index 5a080a759f..0000000000 --- a/docs/reference/functions/usolve.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -layout: default ---- - - - -

Function usolve #

- -Finds one solution of a linear equation system by backward substitution. Matrix must be an upper triangular matrix. Throws an error if there's no solution. - -`U * x = b` - - -

Syntax #

- -```js -math.usolve(U, b) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`U` | Matrix, Array | A N x N matrix or array (U) -`b` | Matrix, Array | A column vector with the b values - -

Returns #

- -Type | Description ----- | ----------- -DenseMatrix | Array | A column vector with the linear system solution (x) - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const a = [[-2, 3], [2, 1]] -const b = [11, 9] -const x = usolve(a, b) // [[8], [9]] -``` - - -

See also #

- -[usolveAll](usolveAll.html), -[lup](lup.html), -[slu](slu.html), -[usolve](usolve.html), -[lusolve](lusolve.html) diff --git a/docs/reference/functions/usolveAll.md b/docs/reference/functions/usolveAll.md deleted file mode 100644 index 22e3882981..0000000000 --- a/docs/reference/functions/usolveAll.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -layout: default ---- - - - -

Function usolveAll #

- -Finds all solutions of a linear equation system by backward substitution. Matrix must be an upper triangular matrix. - -`U * x = b` - - -

Syntax #

- -```js -math.usolveAll(U, b) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`U` | Matrix, Array | A N x N matrix or array (U) -`b` | Matrix, Array | A column vector with the b values - -

Returns #

- -Type | Description ----- | ----------- -DenseMatrix[] | Array[] | An array of affine-independent column vectors (x) that solve the linear system - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -const a = [[-2, 3], [2, 1]] -const b = [11, 9] -const x = usolveAll(a, b) // [ [[8], [9]] ] -``` - - -

See also #

- -[usolve](usolve.html), -[lup](lup.html), -[slu](slu.html), -[usolve](usolve.html), -[lusolve](lusolve.html) diff --git a/docs/reference/functions/variance.md b/docs/reference/functions/variance.md deleted file mode 100644 index c387766e35..0000000000 --- a/docs/reference/functions/variance.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -layout: default ---- - - - -

Function variance #

- -Compute the variance of a matrix or a list with values. -In case of a multidimensional array or matrix, the variance over all -elements will be calculated. - -Additionally, it is possible to compute the variance along the rows -or columns of a matrix by specifying the dimension as the second argument. - -Optionally, the type of normalization can be specified as the final -parameter. The parameter `normalization` can be one of the following values: - -- 'unbiased' (default) The sum of squared errors is divided by (n - 1) -- 'uncorrected' The sum of squared errors is divided by n -- 'biased' The sum of squared errors is divided by (n + 1) - - -Note that older browser may not like the variable name `var`. In that -case, the function can be called as `math['var'](...)` instead of -`math.var(...)`. - - -

Syntax #

- -```js -math.variance(a, b, c, ...) -math.variance(A) -math.variance(A, normalization) -math.variance(A, dimension) -math.variance(A, dimension, normalization) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`array` | Array | Matrix | A single matrix or or multiple scalar values -`normalization` | string | Determines how to normalize the variance. Choose 'unbiased' (default), 'uncorrected', or 'biased'. Default value: 'unbiased'. - -

Returns #

- -Type | Description ----- | ----------- -* | The variance - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.variance(2, 4, 6) // returns 4 -math.variance([2, 4, 6, 8]) // returns 6.666666666666667 -math.variance([2, 4, 6, 8], 'uncorrected') // returns 5 -math.variance([2, 4, 6, 8], 'biased') // returns 4 - -math.variance([[1, 2, 3], [4, 5, 6]]) // returns 3.5 -math.variance([[1, 2, 3], [4, 6, 8]], 0) // returns [4.5, 8, 12.5] -math.variance([[1, 2, 3], [4, 6, 8]], 1) // returns [1, 4] -math.variance([[1, 2, 3], [4, 6, 8]], 1, 'biased') // returns [0.5, 2] -``` - - -

See also #

- -[mean](mean.html), -[median](median.html), -[max](max.html), -[min](min.html), -[prod](prod.html), -[std](std.html), -[sum](sum.html) diff --git a/docs/reference/functions/xgcd.md b/docs/reference/functions/xgcd.md deleted file mode 100644 index a641d76055..0000000000 --- a/docs/reference/functions/xgcd.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: default ---- - - - -

Function xgcd #

- -Calculate the extended greatest common divisor for two values. -See https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm. - - -

Syntax #

- -```js -math.xgcd(a, b) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`a` | number | BigNumber | An integer number -`b` | number | BigNumber | An integer number - -

Returns #

- -Type | Description ----- | ----------- -Array | Returns an array containing 3 integers `[div, m, n]` where `div = gcd(a, b)` and `a*m + b*n = div` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.xgcd(8, 12) // returns [4, -1, 1] -math.gcd(8, 12) // returns 4 -math.xgcd(36163, 21199) // returns [1247, -7, 12] -``` - - -

See also #

- -[gcd](gcd.html), -[lcm](lcm.html) diff --git a/docs/reference/functions/xor.md b/docs/reference/functions/xor.md deleted file mode 100644 index 3b7aba996d..0000000000 --- a/docs/reference/functions/xor.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: default ---- - - - -

Function xor #

- -Logical `xor`. Test whether one and only one value is defined with a nonzero/nonempty value. -For matrices, the function is evaluated element wise. - - -

Syntax #

- -```js -math.xor(x, y) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`x` | number | BigNumber | bigint | Complex | Unit | Array | Matrix | First value to check -`y` | number | BigNumber | bigint | Complex | Unit | Array | Matrix | Second value to check - -

Returns #

- -Type | Description ----- | ----------- -boolean | Array | Matrix | Returns true when one and only one input is defined with a nonzero/nonempty value. - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.xor(2, 4) // returns false - -a = [2, 0, 0] -b = [2, 7, 0] -c = 0 - -math.xor(a, b) // returns [false, true, false] -math.xor(a, c) // returns [true, false, false] -``` - - -

See also #

- -[and](and.html), -[not](not.html), -[or](or.html) diff --git a/docs/reference/functions/zeros.md b/docs/reference/functions/zeros.md deleted file mode 100644 index 085d20e6e9..0000000000 --- a/docs/reference/functions/zeros.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -layout: default ---- - - - -

Function zeros #

- -Create a matrix filled with zeros. The created matrix can have one or -multiple dimensions. - - -

Syntax #

- -```js -math.zeros(m) -math.zeros(m, format) -math.zeros(m, n) -math.zeros(m, n, format) -math.zeros([m, n]) -math.zeros([m, n], format) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`size` | ...(number | BigNumber) | Array | The size of each dimension of the matrix -`format` | string | The Matrix storage format - -

Returns #

- -Type | Description ----- | ----------- -Array | Matrix | A matrix filled with zeros - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.zeros() // returns [] -math.zeros(3) // returns [0, 0, 0] -math.zeros(3, 2) // returns [[0, 0], [0, 0], [0, 0]] -math.zeros(3, 'dense') // returns [0, 0, 0] - -const A = [[1, 2, 3], [4, 5, 6]] -math.zeros(math.size(A)) // returns [[0, 0, 0], [0, 0, 0]] -``` - - -

See also #

- -[ones](ones.html), -[identity](identity.html), -[size](size.html), -[range](range.html) diff --git a/docs/reference/functions/zeta.md b/docs/reference/functions/zeta.md deleted file mode 100644 index 6b41740661..0000000000 --- a/docs/reference/functions/zeta.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default ---- - - - -

Function zeta #

- -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. - - -

Syntax #

- -```js -math.zeta(n) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`s` | number | Complex | BigNumber | A Real, Complex or BigNumber parameter to the Riemann Zeta Function - -

Returns #

- -Type | Description ----- | ----------- -number | Complex | BigNumber | The Riemann Zeta of `s` - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.zeta(5) // returns 1.0369277551433895 -math.zeta(-0.5) // returns -0.2078862249773449 -math.zeta(math.i) // returns 0.0033002236853253153 - 0.4181554491413212i -``` - - -

See also #

- -[erf](erf.html) diff --git a/docs/reference/functions/zpk2tf.md b/docs/reference/functions/zpk2tf.md deleted file mode 100644 index a92b6efa8c..0000000000 --- a/docs/reference/functions/zpk2tf.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -layout: default ---- - - - -

Function zpk2tf #

- -Compute the transfer function of a zero-pole-gain model. - - -

Syntax #

- -```js -math.zpk2tf(z, p, k) -``` - -

Parameters #

- -Parameter | Type | Description ---------- | ---- | ----------- -`z` | Array | Array of zeros values -`p` | Array | Array of poles values -`k` | number | Gain value - -

Returns #

- -Type | Description ----- | ----------- -Array | Two dimensional array containing the numerator (first row) and denominator (second row) polynomials - - -

Throws #

- -Type | Description ----- | ----------- - - -

Examples #

- -```js -math.zpk2tf([1, 2], [-1, -2], 1) // returns [[1, -3, 2], [1, 3, 2]] -``` - - -

See also #

- -[freqz](freqz.html) diff --git a/docs/reference/index.md b/docs/reference/index.md deleted file mode 100644 index 09ae5a936b..0000000000 --- a/docs/reference/index.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -layout: default ---- - -

Reference #

- -- [Classes](classes.html) -- [Constants](constants.html) -- [Functions](functions.html) diff --git a/download.md b/download.md deleted file mode 100644 index a7e80d3b47..0000000000 --- a/download.md +++ /dev/null @@ -1,117 +0,0 @@ ---- -layout: default ---- - -

Install #

- - -Math.js can be installed via [npm](https://npmjs.org/): - -``` -npm install mathjs -``` - -When installed globally with [npm](https://npmjs.org/) (using the `-g` option), math.js is available as a command line application `mathjs`, see documentation on [Command Line Interface](docs/command_line_interface.html). Math.js ships with built-in TypeScript type definitions. - -

Download #

- -Math.js can be downloaded or linked from various content delivery networks: - - - - - - - - - - - - - - - - - - - - - - - - - - -
CDNUrl
unpkghttps://unpkg.com/mathjs@14.5.2/
cdnjshttps://cdnjs.com/libraries/mathjs
jsDelivrhttps://www.jsdelivr.com/package/npm/mathjs
PageCDN https://pagecdn.com/lib/mathjs
- -Or download the full bundle directly from [unpkg](https://unpkg.com): - -

- math.js (version 14.5.2, 186 kB, minified and gzipped) - and if needed the source map -

- -Too large for you? Create your own [custom bundle](docs/custom_bundling.html). - - -

Web Service #

- -Math.js is available as a RESTful web service: https://api.mathjs.org - - -

Extensions #

- -Here some notable extensions for mathjs: - -Extension | Description ---------- | ----------- -[mathsteps](https://github.com/socraticorg/mathsteps) | A step-by-step math solver library that is focused on pedagogy (how best to teach). The math problems it focuses on are pre-algebra and algebra problems involving simplifying expressions. -[mathjs‑expression‑parser](https://github.com/josdejong/mathjs-expression-parser) | This custom build of mathjs contains just the expression parser and basic arithmetic functions for numbers. About four times as small as the full mathjs library. -[mathjs-simple-integral](https://github.com/joelhoover/mathjs-simple-integral) | Extends Math.js to be able to compute simple integrals. -[math.diff.js](https://github.com/hausen/math.diff.js) | Symbolic differentiation plugin for Math.js -[postcss-math](https://github.com/shauns/postcss-math) | PostCSS plugin for making calculations with math.js - - -

Other math libraries #

- -Here some other interesting JavaScript math libraries. Some can be imported into math.js using `math.import`. - -Extension | Description ---------- | ----------- -[math‑expression‑evaluator](https://www.npmjs.com/package/math-expression-evaluator) | An extremely efficient, flexible and amazing evaluator for Math expression in Javascript. -[numbers.js](https://github.com/numbers/numbers.js) | Advanced Mathematics Library for Node.js and JavaScript -[numeric.js](https://github.com/sloisel/numeric) | Numerical analysis in Javascript -[decimal.js](https://github.com/MikeMcl/decimal.js/) | An arbitrary-precision Decimal type for JavaScript. Used by mathjs for BigNumber support. -[ndarray](https://github.com/scijs/ndarray) | Multidimensional arrays for JavaScript -[Algebrite](https://github.com/davidedc/Algebrite) | Computer Algebra System in Javascript (Coffeescript) -[algebra.js](https://github.com/nicolewhite/algebra.js) | Build, display, and solve algebraic equations -[Nerdamer](https://nerdamer.com) | Symbolic Math for Javascript -[numeral-js](https://github.com/adamwdraper/Numeral-js) | A javascript library for formatting and manipulating numbers -[Cortex Compute Engine](https://github.com/cortex-js/compute-engine) | The Cortex Compute Engine can parse LaTeX to MathJSON, serialize MathJSON to LaTeX, format, simplify and evaluate MathJSON expressions - - -

History #

- -A changelog describing the changes with each release is available on the page [History](history.html). - - -

Browser support #

- - -Math.js works on any ES5 compatible JavaScript engine: node.js, Chrome, Firefox, Safari, Edge, and IE11. - -Though there is no official support for older browsers, math.js should still work on older browsers -when using the [es5-shim](https://github.com/kriskowal/es5-shim). - - -

Source code #

- -The source code of math.js is available on GitHub: [https://github.com/josdejong/mathjs](https://github.com/josdejong/mathjs). - - -

License #

- -Math.js is open source and licensed under the -[Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0) diff --git a/examples/advanced/convert_fraction_to_bignumber.js b/examples/advanced/convert_fraction_to_bignumber.js deleted file mode 100644 index 989dfb15f5..0000000000 --- a/examples/advanced/convert_fraction_to_bignumber.js +++ /dev/null @@ -1,57 +0,0 @@ -// Convert from Fraction to BigNumber -// -// In the configuration of math.js one can specify the default number type to -// be `number`, `BigNumber`, or `Fraction`. Not all functions support `Fraction` -// or `BigNumber`, and if not supported these input types will be converted to -// numbers. -// -// When `Fraction` is configured, one may want to fallback to `BigNumber` -// instead of `number`. Also, one may want to be able to mix `Fraction` and -// `BigNumber` in operations like summing them up. This can be achieved by -// adding an extra conversion to the list of conversions as demonstrated in -// this example. - -// Create an empty math.js instance, with only typed -// (every instance contains `import` and `config` also out of the box) -import { create, typedDependencies, all } from 'mathjs' -const math = create({ - typedDependencies -}) - -// TODO: this should be much easier -const allExceptLoaded = Object.keys(all) - .map(key => all[key]) - .filter(factory => math[factory.fn] === undefined) - -// Configure to use fractions by default -math.config({ number: 'Fraction' }) - -// Add a conversion from Faction -> BigNumber -// This conversion will to override the existing conversion from Fraction to -// BigNumber. It must be added *after* the default conversions are loaded -// and *before* the actual functions are imported into math.js. -math.typed.addConversion({ - from: 'Fraction', - to: 'BigNumber', - convert: (fraction) => new math.BigNumber(fraction.n).div(fraction.d) -}, { override: true }) - -// Import all data types, functions, constants, the expression parser, etc. -math.import(allExceptLoaded) - -// Operators `add` and `divide` do have support for Fractions, so the result -// will simply be a Fraction (default behavior of math.js). -const ans1 = math.evaluate('1/3 + 1/4') -console.log(math.typeOf(ans1), math.format(ans1)) -// outputs "Fraction 7/12" - -// Function sqrt doesn't have Fraction support, will now fall back to BigNumber -// instead of number. -const ans2 = math.evaluate('sqrt(4)') -console.log(math.typeOf(ans2), math.format(ans2)) -// outputs "BigNumber 2" - -// We can now do operations with mixed Fractions and BigNumbers -const ans3 = math.add(math.fraction(2, 5), math.bignumber(3)) -console.log(math.typeOf(ans3), math.format(ans3)) -// outputs "BigNumber 3.4" diff --git a/examples/advanced/convert_fraction_to_bignumber.js.md b/examples/advanced/convert_fraction_to_bignumber.js.md deleted file mode 100644 index 9f6b687828..0000000000 --- a/examples/advanced/convert_fraction_to_bignumber.js.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -layout: default ---- - -# Convert fraction to bignumber - -File: [convert_fraction_to_bignumber.js](convert_fraction_to_bignumber.js) - -```js -// Convert from Fraction to BigNumber -// -// In the configuration of math.js one can specify the default number type to -// be `number`, `BigNumber`, or `Fraction`. Not all functions support `Fraction` -// or `BigNumber`, and if not supported these input types will be converted to -// numbers. -// -// When `Fraction` is configured, one may want to fallback to `BigNumber` -// instead of `number`. Also, one may want to be able to mix `Fraction` and -// `BigNumber` in operations like summing them up. This can be achieved by -// adding an extra conversion to the list of conversions as demonstrated in -// this example. - -// Create an empty math.js instance, with only typed -// (every instance contains `import` and `config` also out of the box) -import { create, typedDependencies, all } from 'mathjs' -const math = create({ - typedDependencies -}) - -// TODO: this should be much easier -const allExceptLoaded = Object.keys(all) - .map(key => all[key]) - .filter(factory => math[factory.fn] === undefined) - -// Configure to use fractions by default -math.config({ number: 'Fraction' }) - -// Add a conversion from Faction -> BigNumber -// This conversion will to override the existing conversion from Fraction to -// BigNumber. It must be added *after* the default conversions are loaded -// and *before* the actual functions are imported into math.js. -math.typed.addConversion({ - from: 'Fraction', - to: 'BigNumber', - convert: (fraction) => new math.BigNumber(fraction.n).div(fraction.d) -}, { override: true }) - -// Import all data types, functions, constants, the expression parser, etc. -math.import(allExceptLoaded) - -// Operators `add` and `divide` do have support for Fractions, so the result -// will simply be a Fraction (default behavior of math.js). -const ans1 = math.evaluate('1/3 + 1/4') -console.log(math.typeOf(ans1), math.format(ans1)) -// outputs "Fraction 7/12" - -// Function sqrt doesn't have Fraction support, will now fall back to BigNumber -// instead of number. -const ans2 = math.evaluate('sqrt(4)') -console.log(math.typeOf(ans2), math.format(ans2)) -// outputs "BigNumber 2" - -// We can now do operations with mixed Fractions and BigNumbers -const ans3 = math.add(math.fraction(2, 5), math.bignumber(3)) -console.log(math.typeOf(ans3), math.format(ans3)) -// outputs "BigNumber 3.4" - -``` - - - diff --git a/examples/advanced/custom_argument_parsing.js b/examples/advanced/custom_argument_parsing.js deleted file mode 100644 index 27d3eed6e5..0000000000 --- a/examples/advanced/custom_argument_parsing.js +++ /dev/null @@ -1,94 +0,0 @@ -/** - * The expression parser of math.js has support for letting functions - * parse and evaluate arguments themselves, instead of calling them with - * evaluated arguments. - * - * By adding a property `raw` with value true to a function, the function - * will be invoked with unevaluated arguments, allowing the function - * to process the arguments in a customized way. - */ -import { create, all } from 'mathjs' -const math = create(all) - -/** - * Calculate the numeric integration of a function - * @param {Function} f - * @param {number} start - * @param {number} end - * @param {number} [step=0.01] - */ -function integrate (f, start, end, step) { - let total = 0 - step = step || 0.01 - for (let x = start; x < end; x += step) { - total += f(x + step / 2) * step - } - return total -} - -/** - * A transformation for the integrate function. This transformation will be - * invoked when the function is used via the expression parser of math.js. - * - * Syntax: - * - * integrate(integrand, variable, start, end) - * integrate(integrand, variable, start, end, step) - * - * Usage: - * - * math.evaluate('integrate(2*x, x, 0, 2)') - * math.evaluate('integrate(2*x, x, 0, 2, 0.01)') - * - * @param {Array.} args - * Expects the following arguments: [f, x, start, end, step] - * @param {Object} math - * @param {Map} [scope] - */ -integrate.transform = function (args, math, scope) { - // determine the variable name - if (!args[1].isSymbolNode) { - throw new Error('Second argument must be a symbol') - } - const variable = args[1].name - - // evaluate start, end, and step - const start = args[2].compile().evaluate(scope) - const end = args[3].compile().evaluate(scope) - const step = args[4] && args[4].compile().evaluate(scope) // step is optional - - // construct a function which evaluates the first parameter f after applying - // a value for parameter x. - const fnCode = args[0].compile() - const f = function (x) { - scope.set(variable, x) - return fnCode.evaluate(scope) - } - - // execute the integration - return integrate(f, start, end, step) -} - -// mark the transform function with a "rawArgs" property, so it will be called -// with uncompiled, unevaluated arguments. -integrate.transform.rawArgs = true - -// import the function into math.js. Raw functions must be imported in the -// math namespace, they can't be used via `evaluate(scope)`. -math.import({ - integrate -}) - -// use the function in JavaScript -function f (x) { - return math.pow(x, 0.5) -} -console.log(math.integrate(f, 0, 1)) // outputs 0.6667254718034714 - -// use the function via the expression parser -console.log(math.evaluate('integrate(x^0.5, x, 0, 1)')) // outputs 0.6667254718034714 - -// use the function via the expression parser (2) -const scope = new Map() -math.evaluate('f(x) = 2 * x', scope) -console.log(math.evaluate('integrate(f(x), x, 0, 2)', scope)) // outputs 4.000000000000003 diff --git a/examples/advanced/custom_argument_parsing.js.md b/examples/advanced/custom_argument_parsing.js.md deleted file mode 100644 index cb9a5de63c..0000000000 --- a/examples/advanced/custom_argument_parsing.js.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -layout: default ---- - -# Custom argument parsing - -File: [custom_argument_parsing.js](custom_argument_parsing.js) - -```js -/** - * The expression parser of math.js has support for letting functions - * parse and evaluate arguments themselves, instead of calling them with - * evaluated arguments. - * - * By adding a property `raw` with value true to a function, the function - * will be invoked with unevaluated arguments, allowing the function - * to process the arguments in a customized way. - */ -import { create, all } from 'mathjs' -const math = create(all) - -/** - * Calculate the numeric integration of a function - * @param {Function} f - * @param {number} start - * @param {number} end - * @param {number} [step=0.01] - */ -function integrate (f, start, end, step) { - let total = 0 - step = step || 0.01 - for (let x = start; x < end; x += step) { - total += f(x + step / 2) * step - } - return total -} - -/** - * A transformation for the integrate function. This transformation will be - * invoked when the function is used via the expression parser of math.js. - * - * Syntax: - * - * integrate(integrand, variable, start, end) - * integrate(integrand, variable, start, end, step) - * - * Usage: - * - * math.evaluate('integrate(2*x, x, 0, 2)') - * math.evaluate('integrate(2*x, x, 0, 2, 0.01)') - * - * @param {Array.} args - * Expects the following arguments: [f, x, start, end, step] - * @param {Object} math - * @param {Map} [scope] - */ -integrate.transform = function (args, math, scope) { - // determine the variable name - if (!args[1].isSymbolNode) { - throw new Error('Second argument must be a symbol') - } - const variable = args[1].name - - // evaluate start, end, and step - const start = args[2].compile().evaluate(scope) - const end = args[3].compile().evaluate(scope) - const step = args[4] && args[4].compile().evaluate(scope) // step is optional - - // construct a function which evaluates the first parameter f after applying - // a value for parameter x. - const fnCode = args[0].compile() - const f = function (x) { - scope.set(variable, x) - return fnCode.evaluate(scope) - } - - // execute the integration - return integrate(f, start, end, step) -} - -// mark the transform function with a "rawArgs" property, so it will be called -// with uncompiled, unevaluated arguments. -integrate.transform.rawArgs = true - -// import the function into math.js. Raw functions must be imported in the -// math namespace, they can't be used via `evaluate(scope)`. -math.import({ - integrate -}) - -// use the function in JavaScript -function f (x) { - return math.pow(x, 0.5) -} -console.log(math.integrate(f, 0, 1)) // outputs 0.6667254718034714 - -// use the function via the expression parser -console.log(math.evaluate('integrate(x^0.5, x, 0, 1)')) // outputs 0.6667254718034714 - -// use the function via the expression parser (2) -const scope = new Map() -math.evaluate('f(x) = 2 * x', scope) -console.log(math.evaluate('integrate(f(x), x, 0, 2)', scope)) // outputs 4.000000000000003 - -``` - - - diff --git a/examples/advanced/custom_datatype.js b/examples/advanced/custom_datatype.js deleted file mode 100644 index 43c61ed9de..0000000000 --- a/examples/advanced/custom_datatype.js +++ /dev/null @@ -1,57 +0,0 @@ -// This example demonstrates importing a custom data type, -// and extending an existing function (add) with support for this data type. - -import { all, create, factory } from 'mathjs' - -const math = create(all) - -// factory function which defines a new data type CustomValue -const createCustomValue = factory('CustomValue', ['typed'], ({ typed }) => { - // create a new data type - function CustomValue (value) { - this.value = value - } - CustomValue.prototype.isCustomValue = true - CustomValue.prototype.toString = function () { - return 'CustomValue:' + this.value - } - - // define a new data type with typed-function - typed.addType({ - name: 'CustomValue', - test: function (x) { - // test whether x is of type CustomValue - return x && x.isCustomValue === true - } - }) - - return CustomValue -}) - -// function add which can add the CustomValue data type -// When imported in math.js, the existing function `add` with support for -// CustomValue, because both implementations are typed-functions and do not -// have conflicting signatures. -const createAddCustomValue = factory('add', ['typed', 'CustomValue'], ({ typed, CustomValue }) => { - return typed('add', { - 'CustomValue, CustomValue': function (a, b) { - return new CustomValue(a.value + b.value) - } - }) -}) - -// import the new data type and function -math.import([ - createCustomValue, - createAddCustomValue -]) - -// use the new type -const ans1 = math.add(new math.CustomValue(2), new math.CustomValue(3)) -console.log(ans1.toString()) -// outputs 'CustomValue:5' - -// you can automatically use the new type in functions which use `add` under the hood: -const ans2 = math.sum(new math.CustomValue(6), new math.CustomValue(1), new math.CustomValue(2)) -console.log(ans2.toString()) -// outputs 'CustomValue:9' diff --git a/examples/advanced/custom_datatype.js.md b/examples/advanced/custom_datatype.js.md deleted file mode 100644 index b6aaa71510..0000000000 --- a/examples/advanced/custom_datatype.js.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -layout: default ---- - -# Custom datatype - -File: [custom_datatype.js](custom_datatype.js) - -```js -// This example demonstrates importing a custom data type, -// and extending an existing function (add) with support for this data type. - -import { all, create, factory } from 'mathjs' - -const math = create(all) - -// factory function which defines a new data type CustomValue -const createCustomValue = factory('CustomValue', ['typed'], ({ typed }) => { - // create a new data type - function CustomValue (value) { - this.value = value - } - CustomValue.prototype.isCustomValue = true - CustomValue.prototype.toString = function () { - return 'CustomValue:' + this.value - } - - // define a new data type with typed-function - typed.addType({ - name: 'CustomValue', - test: function (x) { - // test whether x is of type CustomValue - return x && x.isCustomValue === true - } - }) - - return CustomValue -}) - -// function add which can add the CustomValue data type -// When imported in math.js, the existing function `add` with support for -// CustomValue, because both implementations are typed-functions and do not -// have conflicting signatures. -const createAddCustomValue = factory('add', ['typed', 'CustomValue'], ({ typed, CustomValue }) => { - return typed('add', { - 'CustomValue, CustomValue': function (a, b) { - return new CustomValue(a.value + b.value) - } - }) -}) - -// import the new data type and function -math.import([ - createCustomValue, - createAddCustomValue -]) - -// use the new type -const ans1 = math.add(new math.CustomValue(2), new math.CustomValue(3)) -console.log(ans1.toString()) -// outputs 'CustomValue:5' - -// you can automatically use the new type in functions which use `add` under the hood: -const ans2 = math.sum(new math.CustomValue(6), new math.CustomValue(1), new math.CustomValue(2)) -console.log(ans2.toString()) -// outputs 'CustomValue:9' - -``` - - - diff --git a/examples/advanced/custom_evaluate_using_factories.js b/examples/advanced/custom_evaluate_using_factories.js deleted file mode 100644 index 654b991925..0000000000 --- a/examples/advanced/custom_evaluate_using_factories.js +++ /dev/null @@ -1,22 +0,0 @@ -// we use the number only implementation in order to not pull in -// the `Unit` class for example. when using as library, -// use import 'mathjs/number' -import { create, evaluateDependencies, factory } from 'mathjs/number' - -// custom implementations of all functions you want to support -const add = (a, b) => a + b -const subtract = (a, b) => a - b -const multiply = (a, b) => a * b -const divide = (a, b) => a / b - -// create factories for the functions, and create an evaluate function with those -// these functions will also be used by the classes like Unit. -const { evaluate } = create({ - evaluateDependencies, - createAdd: factory('add', [], () => add), - createSubtract: factory('subtract', [], () => subtract), - createMultiply: factory('multiply', [], () => multiply), - createDivide: factory('divide', [], () => divide) -}) - -console.log(evaluate('2 + 3 * 4')) // 14 diff --git a/examples/advanced/custom_evaluate_using_factories.js.md b/examples/advanced/custom_evaluate_using_factories.js.md deleted file mode 100644 index a1365c7054..0000000000 --- a/examples/advanced/custom_evaluate_using_factories.js.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -layout: default ---- - -# Custom evaluate using factories - -File: [custom_evaluate_using_factories.js](custom_evaluate_using_factories.js) - -```js -// we use the number only implementation in order to not pull in -// the `Unit` class for example. when using as library, -// use import 'mathjs/number' -import { create, evaluateDependencies, factory } from 'mathjs/number' - -// custom implementations of all functions you want to support -const add = (a, b) => a + b -const subtract = (a, b) => a - b -const multiply = (a, b) => a * b -const divide = (a, b) => a / b - -// create factories for the functions, and create an evaluate function with those -// these functions will also be used by the classes like Unit. -const { evaluate } = create({ - evaluateDependencies, - createAdd: factory('add', [], () => add), - createSubtract: factory('subtract', [], () => subtract), - createMultiply: factory('multiply', [], () => multiply), - createDivide: factory('divide', [], () => divide) -}) - -console.log(evaluate('2 + 3 * 4')) // 14 - -``` - - - diff --git a/examples/advanced/custom_evaluate_using_import.js b/examples/advanced/custom_evaluate_using_import.js deleted file mode 100644 index 7df8553fd9..0000000000 --- a/examples/advanced/custom_evaluate_using_import.js +++ /dev/null @@ -1,21 +0,0 @@ -// we use the number only implementation in order to not pull in -// the `Unit` class for example. when using as library, -// use require('mathjs/number') -import { create, evaluateDependencies } from 'mathjs/number' - -// custom implementations of all functions you want to support -const add = (a, b) => a + b -const subtract = (a, b) => a - b -const multiply = (a, b) => a * b -const divide = (a, b) => a / b - -// create a mathjs instance with hardly any functions -// there are some functions created which are used internally by evaluate though, -// for example by the Unit class which has dependencies on addScalar, subtractScalar, -// multiplyScalar, etc. -const math = create(evaluateDependencies) - -// import your own functions -math.import({ add, subtract, multiply, divide }, { override: true }) - -console.log(math.evaluate('2 + 3 * 4')) // 14 diff --git a/examples/advanced/custom_evaluate_using_import.js.md b/examples/advanced/custom_evaluate_using_import.js.md deleted file mode 100644 index 141d9e2432..0000000000 --- a/examples/advanced/custom_evaluate_using_import.js.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -layout: default ---- - -# Custom evaluate using import - -File: [custom_evaluate_using_import.js](custom_evaluate_using_import.js) - -```js -// we use the number only implementation in order to not pull in -// the `Unit` class for example. when using as library, -// use require('mathjs/number') -import { create, evaluateDependencies } from 'mathjs/number' - -// custom implementations of all functions you want to support -const add = (a, b) => a + b -const subtract = (a, b) => a - b -const multiply = (a, b) => a * b -const divide = (a, b) => a / b - -// create a mathjs instance with hardly any functions -// there are some functions created which are used internally by evaluate though, -// for example by the Unit class which has dependencies on addScalar, subtractScalar, -// multiplyScalar, etc. -const math = create(evaluateDependencies) - -// import your own functions -math.import({ add, subtract, multiply, divide }, { override: true }) - -console.log(math.evaluate('2 + 3 * 4')) // 14 - -``` - - - diff --git a/examples/advanced/custom_loading.js b/examples/advanced/custom_loading.js deleted file mode 100644 index 55ed67555a..0000000000 --- a/examples/advanced/custom_loading.js +++ /dev/null @@ -1,36 +0,0 @@ -import { - addDependencies, - create, - divideDependencies, - formatDependencies, - fractionDependencies -} from 'mathjs' - -const config = { - // optionally, you can specify configuration -} - -// Create just the functions we need -const { fraction, add, divide, format } = create({ - fractionDependencies, - addDependencies, - divideDependencies, - formatDependencies -}, config) - -// Use the created functions -const a = fraction(1, 3) -const b = fraction(3, 7) -const c = add(a, b) -const d = divide(a, b) -console.log('c =', format(c)) // outputs "c = 16/21" -console.log('d =', format(d)) // outputs "d = 7/9" - -// Now, when bundling your application for use in the browser, only the used -// parts of math.js will be bundled. For example to create a bundle using Webpack: -// -// npx webpack-cli ./custom_loading.mjs --output-path custom_loading_bundle --mode=production -// -// Read more about what bundle sizes you can expect here: -// -// https://mathjs.org/docs/custom_bundling.html diff --git a/examples/advanced/custom_loading.js.md b/examples/advanced/custom_loading.js.md deleted file mode 100644 index db13492fd8..0000000000 --- a/examples/advanced/custom_loading.js.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -layout: default ---- - -# Custom loading - -File: [custom_loading.js](custom_loading.js) - -```js -import { - addDependencies, - create, - divideDependencies, - formatDependencies, - fractionDependencies -} from 'mathjs' - -const config = { - // optionally, you can specify configuration -} - -// Create just the functions we need -const { fraction, add, divide, format } = create({ - fractionDependencies, - addDependencies, - divideDependencies, - formatDependencies -}, config) - -// Use the created functions -const a = fraction(1, 3) -const b = fraction(3, 7) -const c = add(a, b) -const d = divide(a, b) -console.log('c =', format(c)) // outputs "c = 16/21" -console.log('d =', format(d)) // outputs "d = 7/9" - -// Now, when bundling your application for use in the browser, only the used -// parts of math.js will be bundled. For example to create a bundle using Webpack: -// -// npx webpack-cli ./custom_loading.mjs --output-path custom_loading_bundle --mode=production -// -// Read more about what bundle sizes you can expect here: -// -// https://mathjs.org/docs/custom_bundling.html - -``` - - - diff --git a/examples/advanced/custom_relational_functions.js b/examples/advanced/custom_relational_functions.js deleted file mode 100644 index 5a8860cd55..0000000000 --- a/examples/advanced/custom_relational_functions.js +++ /dev/null @@ -1,62 +0,0 @@ -import { all, create, factory } from 'mathjs' - -// First let's see what the default behavior is: -// strings are compared by their numerical value -console.log('default (compare string by their numerical value)') -const { evaluate } = create(all) -evaluateAndLog(evaluate, '2 < 10') // true -evaluateAndLog(evaluate, '"2" < "10"') // true -evaluateAndLog(evaluate, '"a" == "b"') // Error: Cannot convert "a" to a number -evaluateAndLog(evaluate, '"a" == "a"') // Error: Cannot convert "a" to a number -console.log('') - -// Suppose we want different behavior for string comparisons. To achieve -// this we can replace the factory functions for all relational functions -// with our own. In this simple example we use the JavaScript implementation. -console.log('custom (compare strings lexically)') - -const allWithCustomFunctions = { - ...all, - - createEqual: factory('equal', [], () => function equal (a, b) { - return a === b - }), - - createUnequal: factory('unequal', [], () => function unequal (a, b) { - return a !== b - }), - - createSmaller: factory('smaller', [], () => function smaller (a, b) { - return a < b - }), - - createSmallerEq: factory('smallerEq', [], () => function smallerEq (a, b) { - return a <= b - }), - - createLarger: factory('larger', [], () => function larger (a, b) { - return a > b - }), - - createLargerEq: factory('largerEq', [], () => function largerEq (a, b) { - return a >= b - }), - - createCompare: factory('compare', [], () => function compare (a, b) { - return a > b ? 1 : a < b ? -1 : 0 - }) -} -const evaluateCustom = create(allWithCustomFunctions).evaluate -evaluateAndLog(evaluateCustom, '2 < 10') // true -evaluateAndLog(evaluateCustom, '"2" < "10"') // false -evaluateAndLog(evaluateCustom, '"a" == "b"') // false -evaluateAndLog(evaluateCustom, '"a" == "a"') // true - -// helper function to evaluate an expression and print the results -function evaluateAndLog (evaluate, expression) { - try { - console.log(expression, evaluate(expression)) - } catch (err) { - console.error(expression, err.toString()) - } -} diff --git a/examples/advanced/custom_relational_functions.js.md b/examples/advanced/custom_relational_functions.js.md deleted file mode 100644 index 44f2f9ccef..0000000000 --- a/examples/advanced/custom_relational_functions.js.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -layout: default ---- - -# Custom relational functions - -File: [custom_relational_functions.js](custom_relational_functions.js) - -```js -import { all, create, factory } from 'mathjs' - -// First let's see what the default behavior is: -// strings are compared by their numerical value -console.log('default (compare string by their numerical value)') -const { evaluate } = create(all) -evaluateAndLog(evaluate, '2 < 10') // true -evaluateAndLog(evaluate, '"2" < "10"') // true -evaluateAndLog(evaluate, '"a" == "b"') // Error: Cannot convert "a" to a number -evaluateAndLog(evaluate, '"a" == "a"') // Error: Cannot convert "a" to a number -console.log('') - -// Suppose we want different behavior for string comparisons. To achieve -// this we can replace the factory functions for all relational functions -// with our own. In this simple example we use the JavaScript implementation. -console.log('custom (compare strings lexically)') - -const allWithCustomFunctions = { - ...all, - - createEqual: factory('equal', [], () => function equal (a, b) { - return a === b - }), - - createUnequal: factory('unequal', [], () => function unequal (a, b) { - return a !== b - }), - - createSmaller: factory('smaller', [], () => function smaller (a, b) { - return a < b - }), - - createSmallerEq: factory('smallerEq', [], () => function smallerEq (a, b) { - return a <= b - }), - - createLarger: factory('larger', [], () => function larger (a, b) { - return a > b - }), - - createLargerEq: factory('largerEq', [], () => function largerEq (a, b) { - return a >= b - }), - - createCompare: factory('compare', [], () => function compare (a, b) { - return a > b ? 1 : a < b ? -1 : 0 - }) -} -const evaluateCustom = create(allWithCustomFunctions).evaluate -evaluateAndLog(evaluateCustom, '2 < 10') // true -evaluateAndLog(evaluateCustom, '"2" < "10"') // false -evaluateAndLog(evaluateCustom, '"a" == "b"') // false -evaluateAndLog(evaluateCustom, '"a" == "a"') // true - -// helper function to evaluate an expression and print the results -function evaluateAndLog (evaluate, expression) { - try { - console.log(expression, evaluate(expression)) - } catch (err) { - console.error(expression, err.toString()) - } -} - -``` - - - diff --git a/examples/advanced/custom_scope_objects.js b/examples/advanced/custom_scope_objects.js deleted file mode 100644 index aedc11a253..0000000000 --- a/examples/advanced/custom_scope_objects.js +++ /dev/null @@ -1,109 +0,0 @@ -import { all, create } from 'mathjs' - -const math = create(all) - -// The expression evaluator accepts an optional scope Map or object that can -// be used to keep additional variables and functions. - -// Scope can be a bare object. -function withObjectScope () { - const scope = { x: 3 } - - math.evaluate('x', scope) // 1 - math.evaluate('y = 2 x', scope) - math.evaluate('scalar = 1', scope) - math.evaluate('area(length, width) = length * width * scalar', scope) - math.evaluate('A = area(x, y)', scope) - - console.log('Object scope:', scope) -} - -// Where flexibility is important, scope can duck type appear to be a Map. -function withMapScope (scope, name) { - scope.set('x', 3) - - math.evaluate('x', scope) // 1 - math.evaluate('y = 2 x', scope) - math.evaluate('scalar = 1', scope) - math.evaluate('area(length, width) = length * width * scalar', scope) - math.evaluate('A = area(x, y)', scope) - - console.log(`Map-like scope (${name}):`, scope) -} - -// This is a minimal set of functions to look like a Map. -class CustomMap { - constructor () { - this.localScope = new Map() - } - - get (key) { - // Remember to sanitize your inputs, or use - // a datastructure that isn't a footgun. - return this.localScope.get(key) - } - - set (key, value) { - return this.localScope.set(key, value) - } - - has (key) { - return this.localScope.has(key) - } - - keys () { - return this.localScope.keys() - } -} - -/* - * This is a more fully featured example, with all methods - * used in mathjs. - * - */ -class AdvancedCustomMap extends CustomMap { - constructor (parent) { - super() - this.parentScope = parent - } - - get (key) { - return this.localScope.get(key) ?? this.parentScope?.get(key) - } - - has (key) { - return this.localScope.has(key) ?? this.parentScope?.get(key) - } - - keys () { - if (this.parentScope) { - return new Set([...this.localScope.keys(), ...this.parentScope.keys()]) - } else { - return this.localScope.keys() - } - } - - delete () { - return this.localScope.delete() - } - - clear () { - return this.localScope.clear() - } - - toString () { - return this.localScope.toString() - } -} - -// Use a plain JavaScript object -withObjectScope() - -// use a Map (recommended) -withMapScope(new Map(), 'Map example') - -// Use a custom Map implementation -withMapScope(new CustomMap(), 'CustomMap example') - -// Use a more advanced custom Map implementation -withMapScope(new AdvancedCustomMap(), 'AdvancedCustomMap example') diff --git a/examples/advanced/custom_scope_objects.js.md b/examples/advanced/custom_scope_objects.js.md deleted file mode 100644 index f40c59939d..0000000000 --- a/examples/advanced/custom_scope_objects.js.md +++ /dev/null @@ -1,123 +0,0 @@ ---- -layout: default ---- - -# Custom scope objects - -File: [custom_scope_objects.js](custom_scope_objects.js) - -```js -import { all, create } from 'mathjs' - -const math = create(all) - -// The expression evaluator accepts an optional scope Map or object that can -// be used to keep additional variables and functions. - -// Scope can be a bare object. -function withObjectScope () { - const scope = { x: 3 } - - math.evaluate('x', scope) // 1 - math.evaluate('y = 2 x', scope) - math.evaluate('scalar = 1', scope) - math.evaluate('area(length, width) = length * width * scalar', scope) - math.evaluate('A = area(x, y)', scope) - - console.log('Object scope:', scope) -} - -// Where flexibility is important, scope can duck type appear to be a Map. -function withMapScope (scope, name) { - scope.set('x', 3) - - math.evaluate('x', scope) // 1 - math.evaluate('y = 2 x', scope) - math.evaluate('scalar = 1', scope) - math.evaluate('area(length, width) = length * width * scalar', scope) - math.evaluate('A = area(x, y)', scope) - - console.log(`Map-like scope (${name}):`, scope) -} - -// This is a minimal set of functions to look like a Map. -class CustomMap { - constructor () { - this.localScope = new Map() - } - - get (key) { - // Remember to sanitize your inputs, or use - // a datastructure that isn't a footgun. - return this.localScope.get(key) - } - - set (key, value) { - return this.localScope.set(key, value) - } - - has (key) { - return this.localScope.has(key) - } - - keys () { - return this.localScope.keys() - } -} - -/* - * This is a more fully featured example, with all methods - * used in mathjs. - * - */ -class AdvancedCustomMap extends CustomMap { - constructor (parent) { - super() - this.parentScope = parent - } - - get (key) { - return this.localScope.get(key) ?? this.parentScope?.get(key) - } - - has (key) { - return this.localScope.has(key) ?? this.parentScope?.get(key) - } - - keys () { - if (this.parentScope) { - return new Set([...this.localScope.keys(), ...this.parentScope.keys()]) - } else { - return this.localScope.keys() - } - } - - delete () { - return this.localScope.delete() - } - - clear () { - return this.localScope.clear() - } - - toString () { - return this.localScope.toString() - } -} - -// Use a plain JavaScript object -withObjectScope() - -// use a Map (recommended) -withMapScope(new Map(), 'Map example') - -// Use a custom Map implementation -withMapScope(new CustomMap(), 'CustomMap example') - -// Use a more advanced custom Map implementation -withMapScope(new AdvancedCustomMap(), 'AdvancedCustomMap example') - -``` - - - diff --git a/examples/advanced/expression_trees.js b/examples/advanced/expression_trees.js deleted file mode 100644 index bb5c3162cf..0000000000 --- a/examples/advanced/expression_trees.js +++ /dev/null @@ -1,55 +0,0 @@ -import { parse, ConstantNode } from 'mathjs' - -// Filter an expression tree -console.log('Filter all symbol nodes "x" in the expression "x^2 + x/4 + 3*y"') -const node = parse('x^2 + x/4 + 3*y') -const filtered = node.filter(function (node) { - return node.isSymbolNode && node.name === 'x' -}) -// returns an array with two entries: two SymbolNodes 'x' - -filtered.forEach(function (node) { - console.log(node.type, node.toString()) -}) -// outputs: -// SymbolNode x -// SymbolNode x - -// Traverse an expression tree -console.log() -console.log('Traverse the expression tree of expression "3 * x + 2"') -const node1 = parse('3 * x + 2') -node1.traverse(function (node, path, parent) { - switch (node.type) { - case 'OperatorNode': - console.log(node.type, node.op) - break - case 'ConstantNode': - console.log(node.type, node.value) - break - case 'SymbolNode': - console.log(node.type, node.name) - break - default: console.log(node.type) - } -}) -// outputs: -// OperatorNode + -// OperatorNode * -// ConstantNode 3 -// SymbolNode x -// ConstantNode 2 - -// transform an expression tree -console.log() -console.log('Replace all symbol nodes "x" in expression "x^2 + 5*x" with a constant 3') -const node2 = parse('x^2 + 5*x') -const transformed = node2.transform(function (node, path, parent) { - if (node.isSymbolNode && node.name === 'x') { - return new ConstantNode(3) - } else { - return node - } -}) -console.log(transformed.toString()) -// outputs: '3 ^ 2 + 5 * 3' diff --git a/examples/advanced/expression_trees.js.md b/examples/advanced/expression_trees.js.md deleted file mode 100644 index 7579fb1757..0000000000 --- a/examples/advanced/expression_trees.js.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -layout: default ---- - -# Expression trees - -File: [expression_trees.js](expression_trees.js) - -```js -import { parse, ConstantNode } from 'mathjs' - -// Filter an expression tree -console.log('Filter all symbol nodes "x" in the expression "x^2 + x/4 + 3*y"') -const node = parse('x^2 + x/4 + 3*y') -const filtered = node.filter(function (node) { - return node.isSymbolNode && node.name === 'x' -}) -// returns an array with two entries: two SymbolNodes 'x' - -filtered.forEach(function (node) { - console.log(node.type, node.toString()) -}) -// outputs: -// SymbolNode x -// SymbolNode x - -// Traverse an expression tree -console.log() -console.log('Traverse the expression tree of expression "3 * x + 2"') -const node1 = parse('3 * x + 2') -node1.traverse(function (node, path, parent) { - switch (node.type) { - case 'OperatorNode': - console.log(node.type, node.op) - break - case 'ConstantNode': - console.log(node.type, node.value) - break - case 'SymbolNode': - console.log(node.type, node.name) - break - default: console.log(node.type) - } -}) -// outputs: -// OperatorNode + -// OperatorNode * -// ConstantNode 3 -// SymbolNode x -// ConstantNode 2 - -// transform an expression tree -console.log() -console.log('Replace all symbol nodes "x" in expression "x^2 + 5*x" with a constant 3') -const node2 = parse('x^2 + 5*x') -const transformed = node2.transform(function (node, path, parent) { - if (node.isSymbolNode && node.name === 'x') { - return new ConstantNode(3) - } else { - return node - } -}) -console.log(transformed.toString()) -// outputs: '3 ^ 2 + 5 * 3' - -``` - - - diff --git a/examples/advanced/function_transform.js b/examples/advanced/function_transform.js deleted file mode 100644 index b950d2bc0e..0000000000 --- a/examples/advanced/function_transform.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Function transforms - * - * When using functions via the expression parser, it is possible to preprocess - * function arguments and post process a functions return value by writing a - * *transform* for the function. A transform is a function wrapping around a - * function to be transformed or completely replaces a function. - */ -import { all, create } from 'mathjs' -const math = create(all) - -// create a function -function addIt (a, b) { - return a + b -} - -// attach a transform function to the function addIt -addIt.transform = function (a, b) { - console.log('input: a=' + a + ', b=' + b) - // we can manipulate the input arguments here before executing addIt - - const res = addIt(a, b) - - console.log('result: ' + res) - // we can manipulate the result here before returning - - return res -} - -// import the function into math.js -math.import({ - addIt: addIt -}) - -// use the function via the expression parser -console.log('Using expression parser:') -console.log('2+4=' + math.evaluate('addIt(2, 4)')) -// This will output: -// -// input: a=2, b=4 -// result: 6 -// 2+4=6 - -// when used via plain JavaScript, the transform is not invoked -console.log('') -console.log('Using plain JavaScript:') -console.log('2+4=' + math.addIt(2, 4)) -// This will output: -// -// 6 diff --git a/examples/advanced/function_transform.js.md b/examples/advanced/function_transform.js.md deleted file mode 100644 index bee123efdf..0000000000 --- a/examples/advanced/function_transform.js.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -layout: default ---- - -# Function transform - -File: [function_transform.js](function_transform.js) - -```js -/** - * Function transforms - * - * When using functions via the expression parser, it is possible to preprocess - * function arguments and post process a functions return value by writing a - * *transform* for the function. A transform is a function wrapping around a - * function to be transformed or completely replaces a function. - */ -import { all, create } from 'mathjs' -const math = create(all) - -// create a function -function addIt (a, b) { - return a + b -} - -// attach a transform function to the function addIt -addIt.transform = function (a, b) { - console.log('input: a=' + a + ', b=' + b) - // we can manipulate the input arguments here before executing addIt - - const res = addIt(a, b) - - console.log('result: ' + res) - // we can manipulate the result here before returning - - return res -} - -// import the function into math.js -math.import({ - addIt: addIt -}) - -// use the function via the expression parser -console.log('Using expression parser:') -console.log('2+4=' + math.evaluate('addIt(2, 4)')) -// This will output: -// -// input: a=2, b=4 -// result: 6 -// 2+4=6 - -// when used via plain JavaScript, the transform is not invoked -console.log('') -console.log('Using plain JavaScript:') -console.log('2+4=' + math.addIt(2, 4)) -// This will output: -// -// 6 - -``` - - - diff --git a/examples/advanced/more_secure_eval.js b/examples/advanced/more_secure_eval.js deleted file mode 100644 index 0fc73dd6be..0000000000 --- a/examples/advanced/more_secure_eval.js +++ /dev/null @@ -1,36 +0,0 @@ -// Expression parser security -// -// Executing arbitrary expressions like enabled by the expression parser of -// mathjs involves a risk in general. When you're using mathjs to let users -// execute arbitrary expressions, it's good to take a moment to think about -// possible security and stability implications, especially when running the -// code server side. -// -// There is a small number of functions which yield the biggest security risk -// in the expression parser of math.js: -// -// - `import` and `createUnit` which alter the built-in functionality and allow -// overriding existing functions and units. -// - `evaluate`, `parse`, `simplify`, and `derivative` which parse arbitrary input -// into a manipulable expression tree. -// -// To make the expression parser less vulnerable whilst still supporting most -// functionality, these functions can be disabled, as demonstrated in this -// example. - -import { all, create } from 'mathjs' -const math = create(all) - -const limitedEvaluate = math.evaluate - -math.import({ - import: function () { throw new Error('Function import is disabled') }, - createUnit: function () { throw new Error('Function createUnit is disabled') }, - evaluate: function () { throw new Error('Function evaluate is disabled') }, - parse: function () { throw new Error('Function parse is disabled') }, - simplify: function () { throw new Error('Function simplify is disabled') }, - derivative: function () { throw new Error('Function derivative is disabled') } -}, { override: true }) - -console.log(limitedEvaluate('sqrt(16)')) // Ok, 4 -console.log(limitedEvaluate('parse("2+3")')) // Error: Function parse is disabled diff --git a/examples/advanced/more_secure_eval.js.md b/examples/advanced/more_secure_eval.js.md deleted file mode 100644 index b443aeb702..0000000000 --- a/examples/advanced/more_secure_eval.js.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -layout: default ---- - -# More secure eval - -File: [more_secure_eval.js](more_secure_eval.js) - -```js -// Expression parser security -// -// Executing arbitrary expressions like enabled by the expression parser of -// mathjs involves a risk in general. When you're using mathjs to let users -// execute arbitrary expressions, it's good to take a moment to think about -// possible security and stability implications, especially when running the -// code server side. -// -// There is a small number of functions which yield the biggest security risk -// in the expression parser of math.js: -// -// - `import` and `createUnit` which alter the built-in functionality and allow -// overriding existing functions and units. -// - `evaluate`, `parse`, `simplify`, and `derivative` which parse arbitrary input -// into a manipulable expression tree. -// -// To make the expression parser less vulnerable whilst still supporting most -// functionality, these functions can be disabled, as demonstrated in this -// example. - -import { all, create } from 'mathjs' -const math = create(all) - -const limitedEvaluate = math.evaluate - -math.import({ - import: function () { throw new Error('Function import is disabled') }, - createUnit: function () { throw new Error('Function createUnit is disabled') }, - evaluate: function () { throw new Error('Function evaluate is disabled') }, - parse: function () { throw new Error('Function parse is disabled') }, - simplify: function () { throw new Error('Function simplify is disabled') }, - derivative: function () { throw new Error('Function derivative is disabled') } -}, { override: true }) - -console.log(limitedEvaluate('sqrt(16)')) // Ok, 4 -console.log(limitedEvaluate('parse("2+3")')) // Error: Function parse is disabled - -``` - - - diff --git a/examples/advanced/web_server/index.md b/examples/advanced/web_server/index.md deleted file mode 100644 index 19c939d24f..0000000000 --- a/examples/advanced/web_server/index.md +++ /dev/null @@ -1,124 +0,0 @@ ---- -layout: default ---- - -# Web server - -File: [math_worker.js](math_worker.js) - -```js -const { create, all } = require('../../..') -const workerpool = require('workerpool') -const math = create(all) - -// disable the import function so the math.js instance cannot be changed -function noImport () { - throw new Error('function import is disabled.') -} -math.import({ import: noImport }, { override: true }) - -/** - * Evaluate an expression - * @param {string} expr - * @return {string} result - */ -function evaluate (expr) { - const ans = math.evaluate(expr) - return math.format(ans) -} - -// create a worker and register public functions -workerpool.worker({ - evaluate: evaluate -}) - -``` - -File: [server.js](server.js) - -```js -/** - * This example demonstrates how to run math.js in a child process with limited - * execution time. - * - * Prerequisites: - * - * npm install express workerpool - * - * Start the server: - * - * node ./server.js - * - * Make a request to the server: - * - * GET http://localhost:8080/mathjs?expr=sqrt(16) - * - * Note that the query parameter `expr` should be properly url encoded. - */ -const path = require('path') - -let express -let workerpool -try { - express = require('express') - workerpool = require('workerpool') -} catch (err) { - console.log('Error: To run this example, install express and workerpool first via:\n\n' + - ' npm install express workerpool\n') - process.exit() -} - -const app = express() -const pool = workerpool.pool(path.join(__dirname, '/math_worker.js')) - -const TIMEOUT = 10000 // milliseconds - -/** - * GET /mathjs?expr=... - */ -app.get('/mathjs', function (req, res) { - const expr = req.query.expr - if (expr === undefined) { - return res.status(400).send('Error: Required query parameter "expr" missing in url.') - } - - pool.exec('evaluate', [expr]) - .timeout(TIMEOUT) - .then(function (result) { - res.send(result) - }) - .catch(function (err) { - res.status(400).send(formatError(err)) - }) -}) - -/** - * Format error messages as string - * @param {Error} err - * @return {String} message - */ -function formatError (err) { - if (err instanceof workerpool.Promise.TimeoutError) { - return 'TimeoutError: Evaluation exceeded maximum duration of ' + TIMEOUT / 1000 + ' seconds' - } else { - return err.toString() - } -} - -// handle uncaught exceptions so the application cannot crash -process.on('uncaughtException', function (err) { - console.log('Caught exception: ' + err) - console.trace() -}) - -// start the server -const PORT = process.env.PORT || 8080 -app.listen(PORT, function () { - console.log('Listening at http://localhost:' + PORT) - console.log('Example request:\n GET http://localhost:' + PORT + '/mathjs?expr=sqrt(16)') -}) - -``` - - - diff --git a/examples/advanced/web_server/math_worker.js b/examples/advanced/web_server/math_worker.js deleted file mode 100644 index 56cd4973c7..0000000000 --- a/examples/advanced/web_server/math_worker.js +++ /dev/null @@ -1,24 +0,0 @@ -const { create, all } = require('../../..') -const workerpool = require('workerpool') -const math = create(all) - -// disable the import function so the math.js instance cannot be changed -function noImport () { - throw new Error('function import is disabled.') -} -math.import({ import: noImport }, { override: true }) - -/** - * Evaluate an expression - * @param {string} expr - * @return {string} result - */ -function evaluate (expr) { - const ans = math.evaluate(expr) - return math.format(ans) -} - -// create a worker and register public functions -workerpool.worker({ - evaluate: evaluate -}) diff --git a/examples/advanced/web_server/server.js b/examples/advanced/web_server/server.js deleted file mode 100644 index 24dba89a44..0000000000 --- a/examples/advanced/web_server/server.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * This example demonstrates how to run math.js in a child process with limited - * execution time. - * - * Prerequisites: - * - * npm install express workerpool - * - * Start the server: - * - * node ./server.js - * - * Make a request to the server: - * - * GET http://localhost:8080/mathjs?expr=sqrt(16) - * - * Note that the query parameter `expr` should be properly url encoded. - */ -const path = require('path') - -let express -let workerpool -try { - express = require('express') - workerpool = require('workerpool') -} catch (err) { - console.log('Error: To run this example, install express and workerpool first via:\n\n' + - ' npm install express workerpool\n') - process.exit() -} - -const app = express() -const pool = workerpool.pool(path.join(__dirname, '/math_worker.js')) - -const TIMEOUT = 10000 // milliseconds - -/** - * GET /mathjs?expr=... - */ -app.get('/mathjs', function (req, res) { - const expr = req.query.expr - if (expr === undefined) { - return res.status(400).send('Error: Required query parameter "expr" missing in url.') - } - - pool.exec('evaluate', [expr]) - .timeout(TIMEOUT) - .then(function (result) { - res.send(result) - }) - .catch(function (err) { - res.status(400).send(formatError(err)) - }) -}) - -/** - * Format error messages as string - * @param {Error} err - * @return {String} message - */ -function formatError (err) { - if (err instanceof workerpool.Promise.TimeoutError) { - return 'TimeoutError: Evaluation exceeded maximum duration of ' + TIMEOUT / 1000 + ' seconds' - } else { - return err.toString() - } -} - -// handle uncaught exceptions so the application cannot crash -process.on('uncaughtException', function (err) { - console.log('Caught exception: ' + err) - console.trace() -}) - -// start the server -const PORT = process.env.PORT || 8080 -app.listen(PORT, function () { - console.log('Listening at http://localhost:' + PORT) - console.log('Example request:\n GET http://localhost:' + PORT + '/mathjs?expr=sqrt(16)') -}) diff --git a/examples/algebra.js b/examples/algebra.js deleted file mode 100644 index 9180e885ef..0000000000 --- a/examples/algebra.js +++ /dev/null @@ -1,32 +0,0 @@ -// algebra -// -// math.js has support for symbolic computation (CAS). It can parse -// expressions in an expression tree and do algebraic operations like -// simplification and derivation on this tree. -import { simplify, parse, derivative } from 'mathjs' - -// simplify an expression -console.log('simplify expressions') -console.log(simplify('3 + 2 / 4').toString()) // '7 / 2' -console.log(simplify('2x + 3x').toString()) // '5 * x' -console.log(simplify('2 * 3 * x', { x: 4 }).toString()) // '24' -console.log(simplify('x^2 + x + 3 + x^2').toString()) // '2 * x ^ 2 + x + 3' -console.log(simplify('x * y * -x / (x ^ 2)').toString()) // '-y' - -// work with an expression tree, evaluate results -const f = parse('2x + x') -const simplified = simplify(f) -console.log(simplified.toString()) // '3 * x' -console.log(simplified.evaluate({ x: 4 })) // 12 -console.log() - -// calculate a derivative -console.log('calculate derivatives') -console.log(derivative('2x^2 + 3x + 4', 'x').toString()) // '4 * x + 3' -console.log(derivative('sin(2x)', 'x').toString()) // '2 * cos(2 * x)' - -// work with an expression tree, evaluate results -const h = parse('x^2 + x') -const dh = derivative(h, 'x') -console.log(dh.toString()) // '2 * x + 1' -console.log(dh.evaluate({ x: 3 })) // '7' diff --git a/examples/algebra.js.md b/examples/algebra.js.md deleted file mode 100644 index 0530885833..0000000000 --- a/examples/algebra.js.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -layout: default ---- - -# Algebra - -File: [algebra.js](algebra.js) - -```js -// algebra -// -// math.js has support for symbolic computation (CAS). It can parse -// expressions in an expression tree and do algebraic operations like -// simplification and derivation on this tree. -import { simplify, parse, derivative } from 'mathjs' - -// simplify an expression -console.log('simplify expressions') -console.log(simplify('3 + 2 / 4').toString()) // '7 / 2' -console.log(simplify('2x + 3x').toString()) // '5 * x' -console.log(simplify('2 * 3 * x', { x: 4 }).toString()) // '24' -console.log(simplify('x^2 + x + 3 + x^2').toString()) // '2 * x ^ 2 + x + 3' -console.log(simplify('x * y * -x / (x ^ 2)').toString()) // '-y' - -// work with an expression tree, evaluate results -const f = parse('2x + x') -const simplified = simplify(f) -console.log(simplified.toString()) // '3 * x' -console.log(simplified.evaluate({ x: 4 })) // 12 -console.log() - -// calculate a derivative -console.log('calculate derivatives') -console.log(derivative('2x^2 + 3x + 4', 'x').toString()) // '4 * x + 3' -console.log(derivative('sin(2x)', 'x').toString()) // '2 * cos(2 * x)' - -// work with an expression tree, evaluate results -const h = parse('x^2 + x') -const dh = derivative(h, 'x') -console.log(dh.toString()) // '2 * x + 1' -console.log(dh.evaluate({ x: 3 })) // '7' - -``` - - - diff --git a/examples/basic_usage.js b/examples/basic_usage.js deleted file mode 100644 index 1cbf96ab3b..0000000000 --- a/examples/basic_usage.js +++ /dev/null @@ -1,64 +0,0 @@ -// basic usage -import { - add, - atan2, - chain, - derivative, - e, - evaluate, - format, - log, - matrix, - multiply, - pi, - pow, - round, - sqrt, - subtract, - unit -} from 'mathjs' - -// functions and constants -console.log('functions and constants') -print(round(e, 3)) // 2.718 -print(atan2(3, -3) / pi) // 0.75 -print(log(10000, 10)) // 4 -print(sqrt(-4)) // 2i -print(pow([[-1, 2], [3, 1]], 2)) // [[7, 0], [0, 7]] -print(derivative('x^2 + x', 'x')) // 2 * x + 1 -console.log() - -// expressions -console.log('expressions') -print(evaluate('1.2 * (2 + 4.5)')) // 7.8 -print(evaluate('12.7 cm to inch')) // 5 inch -print(evaluate('sin(45 deg) ^ 2')) // 0.5 -print(evaluate('9 / 3 + 2i')) // 3 + 2i -print(evaluate('det([-1, 2; 3, 1])')) // -7 -console.log() - -// chained operations -console.log('chained operations') -const a = chain(3) - .add(4) - .multiply(2) - .done() -print(a) // 14 -console.log() - -// mixed use of different data types in functions -console.log('mixed use of data types') -print(add(4, [5, 6])) // number + Array, [9, 10] -print(multiply(unit('5 mm'), 3)) // Unit * number, 15 mm -print(subtract([2, 3, 4], 5)) // Array - number, [-3, -2, -1] -print(add(matrix([2, 3]), [4, 5])) // Matrix + Array, [6, 8] -console.log() - -/** - * Helper function to output a value in the console. Value will be formatted. - * @param {*} value - */ -function print (value) { - const precision = 14 - console.log(format(value, precision)) -} diff --git a/examples/basic_usage.js.md b/examples/basic_usage.js.md deleted file mode 100644 index b943bf3a19..0000000000 --- a/examples/basic_usage.js.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -layout: default ---- - -# Basic usage - -File: [basic_usage.js](basic_usage.js) - -```js -// basic usage -import { - add, - atan2, - chain, - derivative, - e, - evaluate, - format, - log, - matrix, - multiply, - pi, - pow, - round, - sqrt, - subtract, - unit -} from 'mathjs' - -// functions and constants -console.log('functions and constants') -print(round(e, 3)) // 2.718 -print(atan2(3, -3) / pi) // 0.75 -print(log(10000, 10)) // 4 -print(sqrt(-4)) // 2i -print(pow([[-1, 2], [3, 1]], 2)) // [[7, 0], [0, 7]] -print(derivative('x^2 + x', 'x')) // 2 * x + 1 -console.log() - -// expressions -console.log('expressions') -print(evaluate('1.2 * (2 + 4.5)')) // 7.8 -print(evaluate('12.7 cm to inch')) // 5 inch -print(evaluate('sin(45 deg) ^ 2')) // 0.5 -print(evaluate('9 / 3 + 2i')) // 3 + 2i -print(evaluate('det([-1, 2; 3, 1])')) // -7 -console.log() - -// chained operations -console.log('chained operations') -const a = chain(3) - .add(4) - .multiply(2) - .done() -print(a) // 14 -console.log() - -// mixed use of different data types in functions -console.log('mixed use of data types') -print(add(4, [5, 6])) // number + Array, [9, 10] -print(multiply(unit('5 mm'), 3)) // Unit * number, 15 mm -print(subtract([2, 3, 4], 5)) // Array - number, [-3, -2, -1] -print(add(matrix([2, 3]), [4, 5])) // Matrix + Array, [6, 8] -console.log() - -/** - * Helper function to output a value in the console. Value will be formatted. - * @param {*} value - */ -function print (value) { - const precision = 14 - console.log(format(value, precision)) -} - -``` - - - diff --git a/examples/bignumbers.js b/examples/bignumbers.js deleted file mode 100644 index 56a8fc9df6..0000000000 --- a/examples/bignumbers.js +++ /dev/null @@ -1,49 +0,0 @@ -// BigNumbers -import { create, all } from 'mathjs' - -// configure the default type of numbers as BigNumbers -const config = { - // Default type of number - // Available options: 'number' (default), 'BigNumber', or 'Fraction' - number: 'BigNumber', - - // Number of significant digits for BigNumbers - precision: 20 -} -const math = create(all, config) - -console.log('round-off errors with numbers') -print(math.add(0.1, 0.2)) // number, 0.30000000000000004 -print(math.divide(0.3, 0.2)) // number, 1.4999999999999998 -console.log() - -console.log('no round-off errors with BigNumbers') -print(math.add(math.bignumber(0.1), math.bignumber(0.2))) // BigNumber, 0.3 -print(math.divide(math.bignumber(0.3), math.bignumber(0.2))) // BigNumber, 1.5 -console.log() - -console.log('create BigNumbers from strings when exceeding the range of a number') -print(math.bignumber(1.2e+500)) // BigNumber, Infinity WRONG -print(math.bignumber('1.2e+500')) // BigNumber, 1.2e+500 -console.log() - -console.log('BigNumbers still have a limited precision and are no silve bullet') -const third = math.divide(math.bignumber(1), math.bignumber(3)) -const total = math.add(third, third, third) -print(total) // BigNumber, 0.99999999999999999999 -console.log() - -// one can work conveniently with BigNumbers using the expression parser. -// note though that BigNumbers are only supported in arithmetic functions -console.log('use BigNumbers in the expression parser') -print(math.evaluate('0.1 + 0.2')) // BigNumber, 0.3 -print(math.evaluate('0.3 / 0.2')) // BigNumber, 1.5 -console.log() - -/** - * Helper function to output a value in the console. Value will be formatted. - * @param {*} value - */ -function print (value) { - console.log(math.format(value)) -} diff --git a/examples/bignumbers.js.md b/examples/bignumbers.js.md deleted file mode 100644 index 2ca8999f59..0000000000 --- a/examples/bignumbers.js.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -layout: default ---- - -# Bignumbers - -File: [bignumbers.js](bignumbers.js) - -```js -// BigNumbers -import { create, all } from 'mathjs' - -// configure the default type of numbers as BigNumbers -const config = { - // Default type of number - // Available options: 'number' (default), 'BigNumber', or 'Fraction' - number: 'BigNumber', - - // Number of significant digits for BigNumbers - precision: 20 -} -const math = create(all, config) - -console.log('round-off errors with numbers') -print(math.add(0.1, 0.2)) // number, 0.30000000000000004 -print(math.divide(0.3, 0.2)) // number, 1.4999999999999998 -console.log() - -console.log('no round-off errors with BigNumbers') -print(math.add(math.bignumber(0.1), math.bignumber(0.2))) // BigNumber, 0.3 -print(math.divide(math.bignumber(0.3), math.bignumber(0.2))) // BigNumber, 1.5 -console.log() - -console.log('create BigNumbers from strings when exceeding the range of a number') -print(math.bignumber(1.2e+500)) // BigNumber, Infinity WRONG -print(math.bignumber('1.2e+500')) // BigNumber, 1.2e+500 -console.log() - -console.log('BigNumbers still have a limited precision and are no silve bullet') -const third = math.divide(math.bignumber(1), math.bignumber(3)) -const total = math.add(third, third, third) -print(total) // BigNumber, 0.99999999999999999999 -console.log() - -// one can work conveniently with BigNumbers using the expression parser. -// note though that BigNumbers are only supported in arithmetic functions -console.log('use BigNumbers in the expression parser') -print(math.evaluate('0.1 + 0.2')) // BigNumber, 0.3 -print(math.evaluate('0.3 / 0.2')) // BigNumber, 1.5 -console.log() - -/** - * Helper function to output a value in the console. Value will be formatted. - * @param {*} value - */ -function print (value) { - console.log(math.format(value)) -} - -``` - - - diff --git a/examples/browser/angle_configuration.html b/examples/browser/angle_configuration.html deleted file mode 100644 index ce8803a723..0000000000 --- a/examples/browser/angle_configuration.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - math.js | angle configuration - - - - - - -

- This code example extends the trigonometric functions of math.js with configurable angles: degrees, radians, or gradians. -

- - - - - - - - - - - - - - -
Angles - -
Expression - - -
Result
- - - - - - \ No newline at end of file diff --git a/examples/browser/angle_configuration.html.md b/examples/browser/angle_configuration.html.md deleted file mode 100644 index 9f965b36a1..0000000000 --- a/examples/browser/angle_configuration.html.md +++ /dev/null @@ -1,147 +0,0 @@ ---- -layout: default ---- - -# Angle configuration - -File: [angle_configuration.html](angle_configuration.html) (click for a live demo) - -```html - - - - - math.js | angle configuration - - - - - - -

- This code example extends the trigonometric functions of math.js with configurable angles: degrees, radians, or gradians. -

- - - - - - - - - - - - - - -
Angles - -
Expression - - -
Result
- - - - - - -``` - - - diff --git a/examples/browser/basic_usage.html b/examples/browser/basic_usage.html deleted file mode 100644 index 82b74c1bb5..0000000000 --- a/examples/browser/basic_usage.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - math.js | basic usage - - - - - - - - \ No newline at end of file diff --git a/examples/browser/basic_usage.html.md b/examples/browser/basic_usage.html.md deleted file mode 100644 index dd6663f309..0000000000 --- a/examples/browser/basic_usage.html.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -layout: default ---- - -# Basic usage - -File: [basic_usage.html](basic_usage.html) (click for a live demo) - -```html - - - - - math.js | basic usage - - - - - - - - -``` - - - diff --git a/examples/browser/currency_conversion.html b/examples/browser/currency_conversion.html deleted file mode 100644 index 47aa5a5479..0000000000 --- a/examples/browser/currency_conversion.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - math.js | currency conversion - - - - - - - -

Currency conversion with math.js

- -

- This example demonstrates how you can fetch actual currencies from fixer.io and use them in math.js. -

- -

- Create a (free) account at fixer.io and fill in your API access key below: -

- -
- - -
- -

-

- - - - - \ No newline at end of file diff --git a/examples/browser/currency_conversion.html.md b/examples/browser/currency_conversion.html.md deleted file mode 100644 index 0b42d483a3..0000000000 --- a/examples/browser/currency_conversion.html.md +++ /dev/null @@ -1,138 +0,0 @@ ---- -layout: default ---- - -# Currency conversion - -File: [currency_conversion.html](currency_conversion.html) (click for a live demo) - -```html - - - - - math.js | currency conversion - - - - - - - -

Currency conversion with math.js

- -

- This example demonstrates how you can fetch actual currencies from fixer.io and use them in math.js. -

- -

- Create a (free) account at fixer.io and fill in your API access key below: -

- -
- - -
- -

-

- - - - - -``` - - - diff --git a/examples/browser/custom_separators.html b/examples/browser/custom_separators.html deleted file mode 100644 index c69f637c2f..0000000000 --- a/examples/browser/custom_separators.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - math.js | custom separators - - - - - - -

- This code example shows how to apply custom separators for function arguments and decimal separator. -

- - - - - - - - - - - - - - - - - - -
Argument separator - -
Decimal separator - -
Expression - - -
Result
- - - - - - \ No newline at end of file diff --git a/examples/browser/custom_separators.html.md b/examples/browser/custom_separators.html.md deleted file mode 100644 index 7ca24aa64f..0000000000 --- a/examples/browser/custom_separators.html.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -layout: default ---- - -# Custom separators - -File: [custom_separators.html](custom_separators.html) (click for a live demo) - -```html - - - - - math.js | custom separators - - - - - - -

- This code example shows how to apply custom separators for function arguments and decimal separator. -

- - - - - - - - - - - - - - - - - - -
Argument separator - -
Decimal separator - -
Expression - - -
Result
- - - - - - -``` - - - diff --git a/examples/browser/lorenz.html b/examples/browser/lorenz.html deleted file mode 100644 index 6408cc885b..0000000000 --- a/examples/browser/lorenz.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - math.js | Lorenz Attractor - - - - - - - -
- - - - \ No newline at end of file diff --git a/examples/browser/lorenz.html.md b/examples/browser/lorenz.html.md deleted file mode 100644 index 69ac9aae77..0000000000 --- a/examples/browser/lorenz.html.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -layout: default ---- - -# Lorenz - -File: [lorenz.html](lorenz.html) (click for a live demo) - -```html - - - - - - math.js | Lorenz Attractor - - - - - - - -
- - - - -``` - - - diff --git a/examples/browser/lorenz_interactive.html b/examples/browser/lorenz_interactive.html deleted file mode 100644 index 5b0d5958a4..0000000000 --- a/examples/browser/lorenz_interactive.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - math.js | Lorenz Attractor - - - - - - - - - -
-
-
- Inputs: - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - - - - - -
- - - -
-
-
- - - - diff --git a/examples/browser/lorenz_interactive.html.md b/examples/browser/lorenz_interactive.html.md deleted file mode 100644 index 21704f2e33..0000000000 --- a/examples/browser/lorenz_interactive.html.md +++ /dev/null @@ -1,207 +0,0 @@ ---- -layout: default ---- - -# Lorenz interactive - -File: [lorenz_interactive.html](lorenz_interactive.html) (click for a live demo) - -```html - - - - - - math.js | Lorenz Attractor - - - - - - - - - -
-
-
- Inputs: - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - - - - - -
- - - -
-
-
- - - - - -``` - - - diff --git a/examples/browser/plot.html b/examples/browser/plot.html deleted file mode 100644 index 88ef4c6bf9..0000000000 --- a/examples/browser/plot.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - math.js | plot - - - - - - - - -
- - - -
- -
- -

- Used plot library: Plotly -

- - - - - diff --git a/examples/browser/plot.html.md b/examples/browser/plot.html.md deleted file mode 100644 index bfd47eb20e..0000000000 --- a/examples/browser/plot.html.md +++ /dev/null @@ -1,92 +0,0 @@ ---- -layout: default ---- - -# Plot - -File: [plot.html](plot.html) (click for a live demo) - -```html - - - - - math.js | plot - - - - - - - - -
- - - -
- -
- -

- Used plot library: Plotly -

- - - - - - -``` - - - diff --git a/examples/browser/pretty_printing_with_mathjax.html b/examples/browser/pretty_printing_with_mathjax.html deleted file mode 100644 index 1198c5df4c..0000000000 --- a/examples/browser/pretty_printing_with_mathjax.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - math.js | pretty printing with MathJax - - - - - - - - -

- Expression evaluation with math.js, pretty printing with MathJax -

- - - - - - - - - - - - - - -
Expression
Pretty print
Result
-Parenthesis option: -keep -auto -all -
-Implicit multiplication: -hide -show - - - - - - diff --git a/examples/browser/pretty_printing_with_mathjax.html.md b/examples/browser/pretty_printing_with_mathjax.html.md deleted file mode 100644 index 499ed5950c..0000000000 --- a/examples/browser/pretty_printing_with_mathjax.html.md +++ /dev/null @@ -1,135 +0,0 @@ ---- -layout: default ---- - -# Pretty printing with mathjax - -File: [pretty_printing_with_mathjax.html](pretty_printing_with_mathjax.html) (click for a live demo) - -```html - - - - - math.js | pretty printing with MathJax - - - - - - - - -

- Expression evaluation with math.js, pretty printing with MathJax -

- - - - - - - - - - - - - - -
Expression
Pretty print
Result
-Parenthesis option: -keep -auto -all -
-Implicit multiplication: -hide -show - - - - - - - -``` - - - diff --git a/examples/browser/printing_html.html b/examples/browser/printing_html.html deleted file mode 100644 index 4effc369be..0000000000 --- a/examples/browser/printing_html.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - math.js | printing HTML - - - - - - -

Expression evaluation and HTML code generation with math.js

-
-
- Parenthesis option: - - - -
-
- Implicit multiplication: - - -
-
- - - - - - - - - - - - - - - - - -
Expression
Result
HTML output
$$$$
HTML code
$$$$
- - - diff --git a/examples/browser/printing_html.html.md b/examples/browser/printing_html.html.md deleted file mode 100644 index 53b0d64016..0000000000 --- a/examples/browser/printing_html.html.md +++ /dev/null @@ -1,184 +0,0 @@ ---- -layout: default ---- - -# Printing html - -File: [printing_html.html](printing_html.html) (click for a live demo) - -```html - - - - - math.js | printing HTML - - - - - - -

Expression evaluation and HTML code generation with math.js

-
-
- Parenthesis option: - - - -
-
- Implicit multiplication: - - -
-
- - - - - - - - - - - - - - - - - -
Expression
Result
HTML output
$$$$
HTML code
$$$$
- - - - -``` - - - diff --git a/examples/browser/requirejs_loading.html b/examples/browser/requirejs_loading.html deleted file mode 100644 index 6e4d4085cd..0000000000 --- a/examples/browser/requirejs_loading.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - math.js | require.js loading - - - - - - - - \ No newline at end of file diff --git a/examples/browser/requirejs_loading.html.md b/examples/browser/requirejs_loading.html.md deleted file mode 100644 index 9cf64ed155..0000000000 --- a/examples/browser/requirejs_loading.html.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -layout: default ---- - -# Requirejs loading - -File: [requirejs_loading.html](requirejs_loading.html) (click for a live demo) - -```html - - - - - math.js | require.js loading - - - - - - - - -``` - - - diff --git a/examples/browser/rocket_trajectory_optimization.html b/examples/browser/rocket_trajectory_optimization.html deleted file mode 100644 index 1dc843db6f..0000000000 --- a/examples/browser/rocket_trajectory_optimization.html +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - math.js | rocket trajectory optimization - - - - - - - - -

Rocket trajectory optimization

-

- This example simulates the launch of a SpaceX Falcon 9 modeled using a system of ordinary differential equations. -

- - -
- - - - - diff --git a/examples/browser/rocket_trajectory_optimization.html.md b/examples/browser/rocket_trajectory_optimization.html.md deleted file mode 100644 index 1a78795358..0000000000 --- a/examples/browser/rocket_trajectory_optimization.html.md +++ /dev/null @@ -1,318 +0,0 @@ ---- -layout: default ---- - -# Rocket trajectory optimization - -File: [rocket_trajectory_optimization.html](rocket_trajectory_optimization.html) (click for a live demo) - -```html - - - - - - math.js | rocket trajectory optimization - - - - - - - - -

Rocket trajectory optimization

-

- This example simulates the launch of a SpaceX Falcon 9 modeled using a system of ordinary differential equations. -

- - -
- - - - - - -``` - - - diff --git a/examples/browser/webworkers/index.md b/examples/browser/webworkers/index.md deleted file mode 100644 index 7580f6c67c..0000000000 --- a/examples/browser/webworkers/index.md +++ /dev/null @@ -1,127 +0,0 @@ ---- -layout: default ---- - -# Webworkers - -File: [webworkers.html](webworkers.html) (click for a live demo) - -```html - - - - - math.js | web workers - - - -

- In this example, a math.js parser is running in a separate - web worker, - preventing the user interface from freezing during heavy calculations. -

- -

- - - - - -``` - -File: [worker.js](worker.js) - -```js -importScripts('https://unpkg.com/mathjs@14.5.2/lib/browser/math.js') - -// create a parser -const parser = self.math.parser() - -self.addEventListener('message', function (event) { - const request = JSON.parse(event.data) - let result = null - let err = null - - try { - // evaluate the expression - result = parser.evaluate(request.expr) - } catch (e) { - // return the error - err = e - } - - // build a response - const response = { - id: request.id, - result: self.math.format(result), - err: err - } - - // send the response back - self.postMessage(JSON.stringify(response)) -}, false) - -``` - - - diff --git a/examples/browser/webworkers/webworkers.html b/examples/browser/webworkers/webworkers.html deleted file mode 100644 index 26a230c7f3..0000000000 --- a/examples/browser/webworkers/webworkers.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - math.js | web workers - - - -

- In this example, a math.js parser is running in a separate - web worker, - preventing the user interface from freezing during heavy calculations. -

- -

- - - - - \ No newline at end of file diff --git a/examples/browser/webworkers/worker.js b/examples/browser/webworkers/worker.js deleted file mode 100644 index 452c9b678e..0000000000 --- a/examples/browser/webworkers/worker.js +++ /dev/null @@ -1,28 +0,0 @@ -importScripts('https://unpkg.com/mathjs@14.5.2/lib/browser/math.js') - -// create a parser -const parser = self.math.parser() - -self.addEventListener('message', function (event) { - const request = JSON.parse(event.data) - let result = null - let err = null - - try { - // evaluate the expression - result = parser.evaluate(request.expr) - } catch (e) { - // return the error - err = e - } - - // build a response - const response = { - id: request.id, - result: self.math.format(result), - err: err - } - - // send the response back - self.postMessage(JSON.stringify(response)) -}, false) diff --git a/examples/chaining.js b/examples/chaining.js deleted file mode 100644 index 950aa70585..0000000000 --- a/examples/chaining.js +++ /dev/null @@ -1,54 +0,0 @@ -// chaining -import { chain, format, index, pi } from 'mathjs' - -// create a chained operation using the function `chain(value)` -// end a chain using done(). Let's calculate (3 + 4) * 2 -const a = chain(3) - .add(4) - .multiply(2) - .done() -print(a) // 14 - -// Another example, calculate square(sin(pi / 4)) -const b = chain(pi) - .divide(4) - .sin() - .square() - .done() -print(b) // 0.5 - -// A chain has a few special methods: done, toString, valueOf, get, and set. -// these are demonstrated in the following examples - -// toString will return a string representation of the chain's value -const myChain = chain(2).divide(3) -const str = myChain.toString() -print(str) // "0.6666666666666666" - -// a chain has a function .valueOf(), which returns the value hold by the chain. -// This allows using it in regular operations. The function valueOf() acts the -// same as function done(). -print(myChain.valueOf()) // 0.66666666666667 -print(myChain + 2) // 2.6666666666667 - -// the function subset can be used to get or replace sub matrices -const array = [[1, 2], [3, 4]] -const v = chain(array) - .subset(index(1, 0)) - .done() -print(v) // 3 - -const m = chain(array) - .subset(index(0, 0), 8) - .multiply(3) - .done() -print(m) // [[24, 6], [9, 12]] - -/** - * Helper function to output a value in the console. Value will be formatted. - * @param {*} value - */ -function print (value) { - const precision = 14 - console.log(format(value, precision)) -} diff --git a/examples/chaining.js.md b/examples/chaining.js.md deleted file mode 100644 index 82f9753bb5..0000000000 --- a/examples/chaining.js.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -layout: default ---- - -# Chaining - -File: [chaining.js](chaining.js) - -```js -// chaining -import { chain, format, index, pi } from 'mathjs' - -// create a chained operation using the function `chain(value)` -// end a chain using done(). Let's calculate (3 + 4) * 2 -const a = chain(3) - .add(4) - .multiply(2) - .done() -print(a) // 14 - -// Another example, calculate square(sin(pi / 4)) -const b = chain(pi) - .divide(4) - .sin() - .square() - .done() -print(b) // 0.5 - -// A chain has a few special methods: done, toString, valueOf, get, and set. -// these are demonstrated in the following examples - -// toString will return a string representation of the chain's value -const myChain = chain(2).divide(3) -const str = myChain.toString() -print(str) // "0.6666666666666666" - -// a chain has a function .valueOf(), which returns the value hold by the chain. -// This allows using it in regular operations. The function valueOf() acts the -// same as function done(). -print(myChain.valueOf()) // 0.66666666666667 -print(myChain + 2) // 2.6666666666667 - -// the function subset can be used to get or replace sub matrices -const array = [[1, 2], [3, 4]] -const v = chain(array) - .subset(index(1, 0)) - .done() -print(v) // 3 - -const m = chain(array) - .subset(index(0, 0), 8) - .multiply(3) - .done() -print(m) // [[24, 6], [9, 12]] - -/** - * Helper function to output a value in the console. Value will be formatted. - * @param {*} value - */ -function print (value) { - const precision = 14 - console.log(format(value, precision)) -} - -``` - - - diff --git a/examples/code editor/README.md b/examples/code editor/README.md deleted file mode 100644 index 9be41f658a..0000000000 --- a/examples/code editor/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Code Editor Example - -This is an example for using [mathjs](https://mathjs.org) with a code editor. - -To run your own you need to install the dependancies with. -``` -npm install -``` - -You can start development mode with: -``` -npm run dev -``` - -Or build the project with: -``` -npm run build -``` \ No newline at end of file diff --git a/examples/code editor/getExpressions.js b/examples/code editor/getExpressions.js deleted file mode 100644 index e61ed19d50..0000000000 --- a/examples/code editor/getExpressions.js +++ /dev/null @@ -1,59 +0,0 @@ -import { parse } from 'mathjs' - -/** - * Extracts parsable expressions from a multiline string. - * - * @param {string} str - The multiline string containing expressions. - * @returns {Array<{from: number, to: number, source: string}>} An array of objects, - * where each object represents a parsable expression and contains: - * - from: The starting line number of the expression within the original string. - * - to: The ending line number of the expression within the original string. - * - source: The actual string content of the expression. - */ -export default function getExpressions(str) { - const lines = str.split('\n'); - let nextLineToParse = 0; - const result = []; - - for (let lineID = 0; lineID < lines.length; lineID++) { - const linesToTest = lines.slice(nextLineToParse, lineID + 1).join('\n'); - if (canBeParsed(linesToTest)) { - if (!isEmptyString(linesToTest)) { - result.push({ from: nextLineToParse, to: lineID, source: linesToTest }); - } - // Start the next parsing attempt from the line after the successfully parsed expression. - nextLineToParse = lineID + 1; - } - } - // Handle any remaining lines that couldn't be parsed as expressions. - const linesToTest = lines.slice(nextLineToParse).join('\n'); - if (!isEmptyString(linesToTest)) { - result.push({ from: nextLineToParse, to: lines.length - 1, source: linesToTest }); - } - return result; -} - -/** - * Determines whether a given expression can be successfully parsed. - * - * @param {string} expression - The expression to parse. - * @returns {boolean} True if the expression can be parsed, false otherwise. - */ -function canBeParsed(expression) { - try { - parse(expression) - return true - } catch (error) { - return false - } -} - -/** - * Checks if a given string is empty or only contains whitespace characters. - * - * @param {string} str - The string to check. - * @returns {boolean} True if the string is empty or only contains whitespace, false otherwise. - */ -function isEmptyString(str) { - return str.trim() === "" -} \ No newline at end of file diff --git a/examples/code editor/index.html b/examples/code editor/index.html deleted file mode 100644 index d8f86f276c..0000000000 --- a/examples/code editor/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - math.js | code editor - - - -
-
-
-
- - - - \ No newline at end of file diff --git a/examples/code editor/main.js b/examples/code editor/main.js deleted file mode 100644 index 3d8ece502a..0000000000 --- a/examples/code editor/main.js +++ /dev/null @@ -1,214 +0,0 @@ -import './style.css' -import 'github-markdown-css/github-markdown.css' -import 'katex/dist/katex.min.css' -import { StreamLanguage } from '@codemirror/language' -import { EditorState } from '@codemirror/state' -import { basicSetup, EditorView } from 'codemirror' -import katex from 'katex' -import { all, create } from 'mathjs' -import getExpressions from './getExpressions' -import { mathjsLang } from './mathjs-lang.js' - -const timeout = 250 // milliseconds -const digits = 14 - -const math = create(all) -const parser = math.parser() -const editorDOM = document.querySelector('#editor') -const resultsDOM = document.querySelector('#result') - -let processedExpressions -let previousSelectedExpressionIndex -let timer - -const doc = [ - "round(e, 3)", - "atan2(3, -3) / pi", - "log(10000, 10)", - "sqrt(-4)", - "derivative('x^2 + x', 'x')", - "pow([[-1, 2], [3, 1]], 2)", - "# expressions", - "1.2 * (2 + 4.5)", - "12.7 cm to inch", - "sin(45 deg) ^ 2", - "9 / 3 + 2i", - "det([-1, 2; 3, 1])" -].join('\n') - -let startState = EditorState.create({ - doc, - extensions: [ - basicSetup, - StreamLanguage.define(mathjsLang(math)), - EditorView.lineWrapping, - EditorView.updateListener.of((update) => { - if (update.docChanged) { - // if doc changed debounce and update results after a timeout - clearTimeout(timer) - timer = setTimeout(() => { - updateResults() - previousSelectedExpressionIndex = null - updateSelection() - }, timeout) - } else if (update.selectionSet) { - updateSelection() - } - }) - ], -}) - -let editor = new EditorView({ - state: startState, - parent: editorDOM -}) - -/** - * Evaluates a given expression using a parser. - * - * @param {string} expression - The expression to evaluate. - * @returns {any} The result of the evaluation, or the error message if an error occurred. -*/ -function calc(expression) { - let result - try { - result = parser.evaluate(expression) - } catch (error) { - result = error.toString() - } - return result -} - -/** - * Formats result depending on the type of result - * - * @param {number, string, Help, any} result - The result to format - * @returns {string} The string in HTML with the formated result - */ -const formatResult = math.typed({ - 'number': result => math.format(result, { precision: digits }), - 'string': result => `${result}`, - 'Help': result => `
${math.format(result)}
`, - 'any': math.typed.referTo( - 'number', - fnumber => result => katex.renderToString(math.parse(fnumber(result)).toTex()) - ) -}) - -/** - * Processes an array of expressions by evaluating them, formatting the results, - * and determining their visibility. - * - * @param {Array<{from: number, to: number, source: string}>} expressions - An array of objects representing expressions, - * where each object has `from`, `to`, and `source` properties. - * @returns {Array<{from: number, to: number, source: string, outputs: any, visible: boolean}>} An array of processed expressions, - * where each object has additional `outputs` and `visible` properties. - */ -function processExpressions(expressions) { - parser.clear() - return expressions.map(expression => { - const result = calc(expression.source) - const outputs = formatResult(result) - // Determine visibility based on the result type: - // - Undefined results are hidden. - // - Results with an `isResultSet` property are hidden when empty. - // - All other results are visible. - const visible = result === undefined ? false : (result.isResultSet && result.entries.length === 0) ? false : true - return ({ - ...expression, - outputs, - visible - }) - }) -} - -/** - * Updates the displayed results based on the editor's current content. - * - * @function updateResults - * @requires getExpressions, processExpressions, resultsToHTML - * - * @description - * 1. Extracts expressions from the editor's content. - * 2. Evaluates and analyzes the expressions. - * 3. Generates HTML to display the processed results. - * 4. Renders the generated HTML in the designated results container. - */ -function updateResults() { - // Extract expressions from the editor's content. - const expressions = getExpressions(editor.state.doc.toString()); - - // Evaluate and analyze the expressions. - processedExpressions = processExpressions(expressions); - - // Generate HTML to display the results. - const resultsHtml = resultsToHTML(processedExpressions); - - // Render the generated HTML in the results container. - resultsDOM.innerHTML = resultsHtml; -} - -/** -* Updates the visual highlighting of results based on the current line selection in the editor. -* -* @function updateSelection -* @requires editor, processedExpressions -* -* @description -* 1. Determines the current line number in the editor's selection. -* 2. Finds the corresponding result (processed expression) that matches the current line. -* 3. If a different result is selected than before: -* - Removes highlighting from the previously selected result. -* - Highlights the newly selected result. -* - Scrolls the newly selected result into view. -*/ -function updateSelection() { - const selectedLine = editor.state.doc.lineAt( - editor.state.selection.ranges[editor.state.selection.mainIndex].from - ).number - 1; - - let selectedExpressionIndex; - - processedExpressions.forEach((result, index) => { - if ((selectedLine >= result.from) && (selectedLine <= result.to)) { - selectedExpressionIndex = index; - } - }); - - if (selectedExpressionIndex !== previousSelectedExpressionIndex) { - const previouslyHighlightedResult = document.querySelector('#result').children[previousSelectedExpressionIndex]; - if (previouslyHighlightedResult !== undefined) { - previouslyHighlightedResult.className = null; - } - - const currentlySelectedResult = document.querySelector('#result').children[selectedExpressionIndex]; - if (currentlySelectedResult !== undefined) { - currentlySelectedResult.className = 'highlighted'; - currentlySelectedResult.scrollIntoView({ block: 'nearest', inline: 'start' }); - } - - previousSelectedExpressionIndex = selectedExpressionIndex; - } -} - -/** -* Converts an array of processed results into HTML elements for display. -* -* @function resultsToHTML -* @param {Array<{from: number, to: number, source: string, outputs: any, visible: boolean}>} results - An array of processed results, where each object has: -* - from: The starting line number of the expression. -* - to: The ending line number of the expression. -* - source: The original expression string. -* - outputs: The formatted result of evaluating the expression. -* - visible: A boolean indicating whether the result should be displayed or hidden. -* @returns {string} A string of HTML elements representing the results, where each result is enclosed in a
 tag with appropriate styling based on its visibility.
-*/
-function resultsToHTML(results) {
-  return results.map(el => {
-    const elementStyle = el.visible ? '' : 'style="display:none"'
-    return `
${el.outputs}
` - } - ).join('') -} - -updateResults() diff --git a/examples/code editor/mathjs-lang.js b/examples/code editor/mathjs-lang.js deleted file mode 100644 index 137086ea3b..0000000000 --- a/examples/code editor/mathjs-lang.js +++ /dev/null @@ -1,244 +0,0 @@ -/** - * Create mathjs syntax highlighting for CodeMirror - * - * TODO: this is using CodeMirror v5 functionality, upgrade this to v6 - * - * @param {Object} math A mathjs instance - */ -export function mathjsLang(math) { - function wordRegexp(words) { - return new RegExp('^((' + words.join(')|(') + '))\\b') - } - - const singleOperators = new RegExp("^[-+*/&|^~<>!%']") - const singleDelimiters = new RegExp('^[([{},:=;.?]') - const doubleOperators = new RegExp('^((==)|(!=)|(<=)|(>=)|(<<)|(>>)|(\\.[-+*/^]))') - const doubleDelimiters = new RegExp('^((!=)|(^\\|))') - const tripleDelimiters = new RegExp('^((>>>)|(<<<))') - const expressionEnd = new RegExp('^[\\])]') - const identifiers = new RegExp('^[_A-Za-z\xa1-\uffff][_A-Za-z0-9\xa1-\uffff]*') - - const mathFunctions = [] - const mathPhysicalConstants = [] - const mathIgnore = ['expr', 'type'] - const numberLiterals = [ - 'e', - 'E', - 'i', - 'Infinity', - 'LN2', - 'LN10', - 'LOG2E', - 'LOG10E', - 'NaN', - 'null', - 'phi', - 'pi', - 'PI', - 'SQRT1_2', - 'SQRT2', - 'tau', - 'undefined', - 'version' - ] - - // based on https://github.com/josdejong/mathjs/blob/develop/bin/cli.js - for (const expr in math.expression.mathWithTransform) { - if (!mathIgnore.includes(expr)) { - if (typeof math[expr] === 'function') { - mathFunctions.push(expr) - } else if (!numberLiterals.includes(expr)) { - mathPhysicalConstants.push(expr) - } - } - } - - // generates a list of all valid units in mathjs - const listOfUnits = [] - for (const unit in math.Unit.UNITS) { - for (const prefix in math.Unit.UNITS[unit].prefixes) { - listOfUnits.push(prefix + unit) - } - } - - const builtins = wordRegexp(mathFunctions) - - const keywords = wordRegexp(['to', 'in', 'and', 'not', 'or', 'xor', 'mod']) - - const units = wordRegexp(Array.from(new Set(listOfUnits))) - const physicalConstants = wordRegexp(mathPhysicalConstants) - - // tokenizers - function tokenTranspose(stream, state) { - if (!stream.sol() && stream.peek() === "'") { - stream.next() - state.tokenize = tokenBase - return 'operator' - } - state.tokenize = tokenBase - return tokenBase(stream, state) - } - - function tokenComment(stream, state) { - if (stream.match(/^.*#}/)) { - state.tokenize = tokenBase - return 'comment' - } - stream.skipToEnd() - return 'comment' - } - - function tokenBase(stream, state) { - // whitespaces - if (stream.eatSpace()) return null - - // Handle one line Comments - if (stream.match('#{')) { - state.tokenize = tokenComment - stream.skipToEnd() - return 'comment' - } - - if (stream.match(/^#/)) { - stream.skipToEnd() - return 'comment' - } - - // Handle Number Literals - if (stream.match(/^[0-9.+-]/, false)) { - if (stream.match(/^[+-]?0x[0-9a-fA-F]+[ij]?/)) { - stream.tokenize = tokenBase - return 'number' - } - if (stream.match(/^[+-]?\d*\.\d+([EeDd][+-]?\d+)?[ij]?/)) { - return 'number' - } - if (stream.match(/^[+-]?\d+([EeDd][+-]?\d+)?[ij]?/)) { - return 'number' - } - } - if (stream.match(wordRegexp(numberLiterals))) { - return 'number' - } - - // Handle Strings - let m = stream.match(/^"(?:[^"]|"")*("|$)/) || stream.match(/^'(?:[^']|'')*('|$)/) - if (m) { - return m[1] ? 'string' : 'string error' - } - - // Handle words - if (stream.match(keywords)) { - return 'keyword' - } - if (stream.match(builtins)) { - return 'builtin' - } - if (stream.match(physicalConstants)) { - return 'tag' - } - if (stream.match(units)) { - return 'attribute' - } - if (stream.match(identifiers)) { - return 'variable' - } - if (stream.match(singleOperators) || stream.match(doubleOperators)) { - return 'operator' - } - if ( - stream.match(singleDelimiters) || - stream.match(doubleDelimiters) || - stream.match(tripleDelimiters) - ) { - return null - } - if (stream.match(expressionEnd)) { - state.tokenize = tokenTranspose - return null - } - // Handle non-detected items - stream.next() - return 'error' - } - - return { - name: 'mathjs', - - startState: function () { - return { - tokenize: tokenBase - } - }, - - token: function (stream, state) { - const style = state.tokenize(stream, state) - if (style === 'number' || style === 'variable') { - state.tokenize = tokenTranspose - } - return style - }, - - languageData: { - commentTokens: { line: '#' }, - autocomplete: myCompletions - } - } - - function myCompletions(context) { - let word = context.matchBefore(/\w*/) - if (word.from == word.to && !context.explicit) return null - let options = [] - mathFunctions.forEach((func) => options.push({ label: func, type: 'function' })) - - mathPhysicalConstants.forEach((constant) => options.push({ label: constant, type: 'constant' })) - - numberLiterals.forEach((number) => options.push({ label: number, type: 'variable' })) - - // units as enum - for (const name in math.Unit.UNITS) { - if (hasOwnPropertySafe(math.Unit.UNITS, name)) { - if (name.startsWith(word.text)) { - options.push({ label: name, type: 'enum' }) - } - } - } - for (const name in math.Unit.PREFIXES) { - if (hasOwnPropertySafe(math.Unit.PREFIXES, name)) { - const prefixes = math.Unit.PREFIXES[name] - for (const prefix in prefixes) { - if (hasOwnPropertySafe(prefixes, prefix)) { - if (prefix.startsWith(word.text)) { - options.push({ label: prefix, type: 'enum' }) - } else if (word.text.startsWith(prefix)) { - const unitKeyword = word.text.substring(prefix.length) - for (const n in math.Unit.UNITS) { - const fullUnit = prefix + n - if (hasOwnPropertySafe(math.Unit.UNITS, n)) { - if ( - !options.includes(fullUnit) && - n.startsWith(unitKeyword) && - math.Unit.isValuelessUnit(fullUnit) - ) { - options.push({ label: fullUnit, type: 'enum' }) - } - } - } - } - } - } - } - } - - return { - from: word.from, - options - } - } -} - -// helper function to safely check whether an object has a property -// copy from the function in object.js which is ES6 -function hasOwnPropertySafe(object, property) { - return object && Object.hasOwnProperty.call(object, property) -} \ No newline at end of file diff --git a/examples/code editor/package-lock.json b/examples/code editor/package-lock.json deleted file mode 100644 index b6614b9b2d..0000000000 --- a/examples/code editor/package-lock.json +++ /dev/null @@ -1,1120 +0,0 @@ -{ - "name": "code-editor", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "code-editor", - "version": "1.0.0", - "dependencies": { - "@codemirror/language": "6.10.2", - "@codemirror/state": "6.4.1", - "codemirror": "6.0.1", - "github-markdown-css": "5.6.1", - "katex": "0.16.11", - "mathjs": "13.0.2" - }, - "devDependencies": { - "vite": "5.3.3" - } - }, - "node_modules/@babel/runtime": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.7.tgz", - "integrity": "sha512-UwgBRMjJP+xv857DCngvqXI3Iq6J4v0wXmwc6sapg+zyhbwmQX67LUEFrkK5tbyJ30jGuG3ZvWpBiB9LCy1kWw==", - "license": "MIT", - "dependencies": { - "regenerator-runtime": "^0.14.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@codemirror/autocomplete": { - "version": "6.10.2", - "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.10.2.tgz", - "integrity": "sha512-3dCL7b0j2GdtZzWN5j7HDpRAJ26ip07R4NGYz7QYthIYMiX8I4E4TNrYcdTayPJGeVQtd/xe7lWU4XL7THFb/w==", - "dependencies": { - "@codemirror/language": "^6.0.0", - "@codemirror/state": "^6.0.0", - "@codemirror/view": "^6.17.0", - "@lezer/common": "^1.0.0" - }, - "peerDependencies": { - "@codemirror/language": "^6.0.0", - "@codemirror/state": "^6.0.0", - "@codemirror/view": "^6.0.0", - "@lezer/common": "^1.0.0" - } - }, - "node_modules/@codemirror/commands": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.3.0.tgz", - "integrity": "sha512-tFfcxRIlOWiQDFhjBSWJ10MxcvbCIsRr6V64SgrcaY0MwNk32cUOcCuNlWo8VjV4qRQCgNgUAnIeo0svkk4R5Q==", - "dependencies": { - "@codemirror/language": "^6.0.0", - "@codemirror/state": "^6.2.0", - "@codemirror/view": "^6.0.0", - "@lezer/common": "^1.1.0" - } - }, - "node_modules/@codemirror/language": { - "version": "6.10.2", - "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.10.2.tgz", - "integrity": "sha512-kgbTYTo0Au6dCSc/TFy7fK3fpJmgHDv1sG1KNQKJXVi+xBTEeBPY/M30YXiU6mMXeH+YIDLsbrT4ZwNRdtF+SA==", - "license": "MIT", - "dependencies": { - "@codemirror/state": "^6.0.0", - "@codemirror/view": "^6.23.0", - "@lezer/common": "^1.1.0", - "@lezer/highlight": "^1.0.0", - "@lezer/lr": "^1.0.0", - "style-mod": "^4.0.0" - } - }, - "node_modules/@codemirror/lint": { - "version": "6.4.2", - "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.4.2.tgz", - "integrity": "sha512-wzRkluWb1ptPKdzlsrbwwjYCPLgzU6N88YBAmlZi8WFyuiEduSd05MnJYNogzyc8rPK7pj6m95ptUApc8sHKVA==", - "dependencies": { - "@codemirror/state": "^6.0.0", - "@codemirror/view": "^6.0.0", - "crelt": "^1.0.5" - } - }, - "node_modules/@codemirror/search": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-6.5.4.tgz", - "integrity": "sha512-YoTrvjv9e8EbPs58opjZKyJ3ewFrVSUzQ/4WXlULQLSDDr1nGPJ67mMXFNNVYwdFhybzhrzrtqgHmtpJwIF+8g==", - "dependencies": { - "@codemirror/state": "^6.0.0", - "@codemirror/view": "^6.0.0", - "crelt": "^1.0.5" - } - }, - "node_modules/@codemirror/state": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.4.1.tgz", - "integrity": "sha512-QkEyUiLhsJoZkbumGZlswmAhA7CBU02Wrz7zvH4SrcifbsqwlXShVXg65f3v/ts57W3dqyamEriMhij1Z3Zz4A==", - "license": "MIT" - }, - "node_modules/@codemirror/view": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.23.0.tgz", - "integrity": "sha512-/51px9N4uW8NpuWkyUX+iam5+PM6io2fm+QmRnzwqBy5v/pwGg9T0kILFtYeum8hjuvENtgsGNKluOfqIICmeQ==", - "dependencies": { - "@codemirror/state": "^6.4.0", - "style-mod": "^4.1.0", - "w3c-keyname": "^2.2.4" - } - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", - "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", - "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", - "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", - "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", - "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", - "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", - "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", - "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", - "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", - "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", - "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", - "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", - "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", - "cpu": [ - "mips64el" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", - "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", - "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", - "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", - "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", - "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", - "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", - "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", - "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", - "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", - "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@lezer/common": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.1.0.tgz", - "integrity": "sha512-XPIN3cYDXsoJI/oDWoR2tD++juVrhgIago9xyKhZ7IhGlzdDM9QgC8D8saKNCz5pindGcznFr2HBSsEQSWnSjw==" - }, - "node_modules/@lezer/highlight": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/@lezer/highlight/-/highlight-1.1.6.tgz", - "integrity": "sha512-cmSJYa2us+r3SePpRCjN5ymCqCPv+zyXmDl0ciWtVaNiORT/MxM7ZgOMQZADD0o51qOaOg24qc/zBViOIwAjJg==", - "dependencies": { - "@lezer/common": "^1.0.0" - } - }, - "node_modules/@lezer/lr": { - "version": "1.3.13", - "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.3.13.tgz", - "integrity": "sha512-RLAbau/4uSzKgIKj96mI5WUtG1qtiR0Frn0Ei9zhPj8YOkHM+1Bb8SgdVvmR/aWJCFIzjo2KFnDiRZ75Xf5NdQ==", - "dependencies": { - "@lezer/common": "^1.0.0" - } - }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.18.0.tgz", - "integrity": "sha512-Tya6xypR10giZV1XzxmH5wr25VcZSncG0pZIjfePT0OVBvqNEurzValetGNarVrGiq66EBVAFn15iYX4w6FKgQ==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.18.0.tgz", - "integrity": "sha512-avCea0RAP03lTsDhEyfy+hpfr85KfyTctMADqHVhLAF3MlIkq83CP8UfAHUssgXTYd+6er6PaAhx/QGv4L1EiA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.18.0.tgz", - "integrity": "sha512-IWfdwU7KDSm07Ty0PuA/W2JYoZ4iTj3TUQjkVsO/6U+4I1jN5lcR71ZEvRh52sDOERdnNhhHU57UITXz5jC1/w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.18.0.tgz", - "integrity": "sha512-n2LMsUz7Ynu7DoQrSQkBf8iNrjOGyPLrdSg802vk6XT3FtsgX6JbE8IHRvposskFm9SNxzkLYGSq9QdpLYpRNA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.18.0.tgz", - "integrity": "sha512-C/zbRYRXFjWvz9Z4haRxcTdnkPt1BtCkz+7RtBSuNmKzMzp3ZxdM28Mpccn6pt28/UWUCTXa+b0Mx1k3g6NOMA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.18.0.tgz", - "integrity": "sha512-l3m9ewPgjQSXrUMHg93vt0hYCGnrMOcUpTz6FLtbwljo2HluS4zTXFy2571YQbisTnfTKPZ01u/ukJdQTLGh9A==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.18.0.tgz", - "integrity": "sha512-rJ5D47d8WD7J+7STKdCUAgmQk49xuFrRi9pZkWoRD1UeSMakbcepWXPF8ycChBoAqs1pb2wzvbY6Q33WmN2ftw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.18.0.tgz", - "integrity": "sha512-be6Yx37b24ZwxQ+wOQXXLZqpq4jTckJhtGlWGZs68TgdKXJgw54lUUoFYrg6Zs/kjzAQwEwYbp8JxZVzZLRepQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.18.0.tgz", - "integrity": "sha512-hNVMQK+qrA9Todu9+wqrXOHxFiD5YmdEi3paj6vP02Kx1hjd2LLYR2eaN7DsEshg09+9uzWi2W18MJDlG0cxJA==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.18.0.tgz", - "integrity": "sha512-ROCM7i+m1NfdrsmvwSzoxp9HFtmKGHEqu5NNDiZWQtXLA8S5HBCkVvKAxJ8U+CVctHwV2Gb5VUaK7UAkzhDjlg==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.18.0.tgz", - "integrity": "sha512-0UyyRHyDN42QL+NbqevXIIUnKA47A+45WyasO+y2bGJ1mhQrfrtXUpTxCOrfxCR4esV3/RLYyucGVPiUsO8xjg==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.18.0.tgz", - "integrity": "sha512-xuglR2rBVHA5UsI8h8UbX4VJ470PtGCf5Vpswh7p2ukaqBGFTnsfzxUBetoWBWymHMxbIG0Cmx7Y9qDZzr648w==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.18.0.tgz", - "integrity": "sha512-LKaqQL9osY/ir2geuLVvRRs+utWUNilzdE90TpyoX0eNqPzWjRm14oMEE+YLve4k/NAqCdPkGYDaDF5Sw+xBfg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.18.0.tgz", - "integrity": "sha512-7J6TkZQFGo9qBKH0pk2cEVSRhJbL6MtfWxth7Y5YmZs57Pi+4x6c2dStAUvaQkHQLnEQv1jzBUW43GvZW8OFqA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.18.0.tgz", - "integrity": "sha512-Txjh+IxBPbkUB9+SXZMpv+b/vnTEtFyfWZgJ6iyCmt2tdx0OF5WhFowLmnh8ENGNpfUlUZkdI//4IEmhwPieNg==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.18.0.tgz", - "integrity": "sha512-UOo5FdvOL0+eIVTgS4tIdbW+TtnBLWg1YBCcU2KWM7nuNwRz9bksDX1bekJJCpu25N1DVWaCwnT39dVQxzqS8g==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@types/estree": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", - "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", - "dev": true, - "license": "MIT" - }, - "node_modules/codemirror": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-6.0.1.tgz", - "integrity": "sha512-J8j+nZ+CdWmIeFIGXEFbFPtpiYacFMDR8GlHK3IyHQJMCaVRfGx9NT+Hxivv1ckLWPvNdZqndbr/7lVhrf/Svg==", - "dependencies": { - "@codemirror/autocomplete": "^6.0.0", - "@codemirror/commands": "^6.0.0", - "@codemirror/language": "^6.0.0", - "@codemirror/lint": "^6.0.0", - "@codemirror/search": "^6.0.0", - "@codemirror/state": "^6.0.0", - "@codemirror/view": "^6.0.0" - } - }, - "node_modules/commander": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", - "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", - "engines": { - "node": ">= 12" - } - }, - "node_modules/complex.js": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/complex.js/-/complex.js-2.1.1.tgz", - "integrity": "sha512-8njCHOTtFFLtegk6zQo0kkVX1rngygb/KQI6z1qZxlFI3scluC+LVTCFbrkWjBv4vvLlbQ9t88IPMC6k95VTTg==", - "engines": { - "node": "*" - }, - "funding": { - "type": "patreon", - "url": "https://www.patreon.com/infusion" - } - }, - "node_modules/crelt": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz", - "integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==" - }, - "node_modules/decimal.js": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", - "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==" - }, - "node_modules/esbuild": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", - "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.21.5", - "@esbuild/android-arm": "0.21.5", - "@esbuild/android-arm64": "0.21.5", - "@esbuild/android-x64": "0.21.5", - "@esbuild/darwin-arm64": "0.21.5", - "@esbuild/darwin-x64": "0.21.5", - "@esbuild/freebsd-arm64": "0.21.5", - "@esbuild/freebsd-x64": "0.21.5", - "@esbuild/linux-arm": "0.21.5", - "@esbuild/linux-arm64": "0.21.5", - "@esbuild/linux-ia32": "0.21.5", - "@esbuild/linux-loong64": "0.21.5", - "@esbuild/linux-mips64el": "0.21.5", - "@esbuild/linux-ppc64": "0.21.5", - "@esbuild/linux-riscv64": "0.21.5", - "@esbuild/linux-s390x": "0.21.5", - "@esbuild/linux-x64": "0.21.5", - "@esbuild/netbsd-x64": "0.21.5", - "@esbuild/openbsd-x64": "0.21.5", - "@esbuild/sunos-x64": "0.21.5", - "@esbuild/win32-arm64": "0.21.5", - "@esbuild/win32-ia32": "0.21.5", - "@esbuild/win32-x64": "0.21.5" - } - }, - "node_modules/escape-latex": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/escape-latex/-/escape-latex-1.2.0.tgz", - "integrity": "sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw==" - }, - "node_modules/fraction.js": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz", - "integrity": "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==", - "license": "MIT", - "engines": { - "node": "*" - }, - "funding": { - "type": "patreon", - "url": "https://github.com/sponsors/rawify" - } - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/github-markdown-css": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/github-markdown-css/-/github-markdown-css-5.6.1.tgz", - "integrity": "sha512-DItLFgHd+s7HQmk63YN4/TdvLeRqk1QP7pPKTTPrDTYoI5x7f/luJWSOZxesmuxBI2srHp8RDyoZd+9WF+WK8Q==", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/javascript-natural-sort": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz", - "integrity": "sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==" - }, - "node_modules/katex": { - "version": "0.16.11", - "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.11.tgz", - "integrity": "sha512-RQrI8rlHY92OLf3rho/Ts8i/XvjgguEjOkO1BEXcU3N8BqPpSzBNwV/G0Ukr+P/l3ivvJUE/Fa/CwbS6HesGNQ==", - "funding": [ - "https://opencollective.com/katex", - "https://github.com/sponsors/katex" - ], - "license": "MIT", - "dependencies": { - "commander": "^8.3.0" - }, - "bin": { - "katex": "cli.js" - } - }, - "node_modules/mathjs": { - "version": "13.0.2", - "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-13.0.2.tgz", - "integrity": "sha512-8vK/+InU4FTphRTWsrnvRsgSjbyNupRQYDDIXLuEGDZtJsGdbA9dVV4HZ0amBQb+RXplRjVJNGZZfB0WoHWFWA==", - "license": "Apache-2.0", - "dependencies": { - "@babel/runtime": "^7.24.7", - "complex.js": "^2.1.1", - "decimal.js": "^10.4.3", - "escape-latex": "^1.2.0", - "fraction.js": "^4.3.7", - "javascript-natural-sort": "^0.7.1", - "seedrandom": "^3.0.5", - "tiny-emitter": "^2.1.0", - "typed-function": "^4.2.1" - }, - "bin": { - "mathjs": "bin/cli.js" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/picocolors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", - "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", - "dev": true, - "license": "ISC" - }, - "node_modules/postcss": { - "version": "8.4.39", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.39.tgz", - "integrity": "sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "nanoid": "^3.3.7", - "picocolors": "^1.0.1", - "source-map-js": "^1.2.0" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/regenerator-runtime": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", - "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", - "license": "MIT" - }, - "node_modules/rollup": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.18.0.tgz", - "integrity": "sha512-QmJz14PX3rzbJCN1SG4Xe/bAAX2a6NpCP8ab2vfu2GiUr8AQcr2nCV/oEO3yneFarB67zk8ShlIyWb2LGTb3Sg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "1.0.5" - }, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.18.0", - "@rollup/rollup-android-arm64": "4.18.0", - "@rollup/rollup-darwin-arm64": "4.18.0", - "@rollup/rollup-darwin-x64": "4.18.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.18.0", - "@rollup/rollup-linux-arm-musleabihf": "4.18.0", - "@rollup/rollup-linux-arm64-gnu": "4.18.0", - "@rollup/rollup-linux-arm64-musl": "4.18.0", - "@rollup/rollup-linux-powerpc64le-gnu": "4.18.0", - "@rollup/rollup-linux-riscv64-gnu": "4.18.0", - "@rollup/rollup-linux-s390x-gnu": "4.18.0", - "@rollup/rollup-linux-x64-gnu": "4.18.0", - "@rollup/rollup-linux-x64-musl": "4.18.0", - "@rollup/rollup-win32-arm64-msvc": "4.18.0", - "@rollup/rollup-win32-ia32-msvc": "4.18.0", - "@rollup/rollup-win32-x64-msvc": "4.18.0", - "fsevents": "~2.3.2" - } - }, - "node_modules/seedrandom": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz", - "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==" - }, - "node_modules/source-map-js": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", - "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/style-mod": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.0.tgz", - "integrity": "sha512-Ca5ib8HrFn+f+0n4N4ScTIA9iTOQ7MaGS1ylHcoVqW9J7w2w8PzN6g9gKmTYgGEBH8e120+RCmhpje6jC5uGWA==" - }, - "node_modules/tiny-emitter": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", - "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==" - }, - "node_modules/typed-function": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/typed-function/-/typed-function-4.2.1.tgz", - "integrity": "sha512-EGjWssW7Tsk4DGfE+5yluuljS1OGYWiI1J6e8puZz9nTMM51Oug8CD5Zo4gWMsOhq5BI+1bF+rWTm4Vbj3ivRA==", - "license": "MIT", - "engines": { - "node": ">= 18" - } - }, - "node_modules/vite": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.3.3.tgz", - "integrity": "sha512-NPQdeCU0Dv2z5fu+ULotpuq5yfCS1BzKUIPhNbP3YBfAMGJXbt2nS+sbTFu+qchaqWTD+H3JK++nRwr6XIcp6A==", - "dev": true, - "license": "MIT", - "dependencies": { - "esbuild": "^0.21.3", - "postcss": "^8.4.39", - "rollup": "^4.13.0" - }, - "bin": { - "vite": "bin/vite.js" - }, - "engines": { - "node": "^18.0.0 || >=20.0.0" - }, - "funding": { - "url": "https://github.com/vitejs/vite?sponsor=1" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - }, - "peerDependencies": { - "@types/node": "^18.0.0 || >=20.0.0", - "less": "*", - "lightningcss": "^1.21.0", - "sass": "*", - "stylus": "*", - "sugarss": "*", - "terser": "^5.4.0" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "less": { - "optional": true - }, - "lightningcss": { - "optional": true - }, - "sass": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - } - } - }, - "node_modules/w3c-keyname": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", - "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==" - } - } -} diff --git a/examples/code editor/package.json b/examples/code editor/package.json deleted file mode 100644 index 6a732ec62d..0000000000 --- a/examples/code editor/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "code-editor", - "private": true, - "version": "1.0.0", - "type": "module", - "scripts": { - "dev": "vite", - "build": "vite build", - "preview": "vite preview" - }, - "devDependencies": { - "vite": "5.3.3" - }, - "dependencies": { - "@codemirror/language": "6.10.2", - "@codemirror/state": "6.4.1", - "codemirror": "6.0.1", - "github-markdown-css": "5.6.1", - "katex": "0.16.11", - "mathjs": "13.0.2" - } -} diff --git a/examples/code editor/style.css b/examples/code editor/style.css deleted file mode 100644 index bc4a5d2dbf..0000000000 --- a/examples/code editor/style.css +++ /dev/null @@ -1,60 +0,0 @@ -html, -body { - margin: 0; - padding: 0; - height: 100vh; - overflow: hidden; -} - -body { - display: flex; - flex-direction: column; -} - -#app { - display: flex; - overflow: hidden; - flex: 1; - flex-direction: row; -} - -#editor { - flex: 1; - height: auto; - display: flex; - overflow: auto; -} - -#editor>.cm-editor { - flex: 1; - overflow: scroll; -} - -#app>article { - flex: 1; - overflow: auto; - box-sizing: border-box; -} - -article.markdown-body .results { - padding: 0.5em; - margin: 0.5em; -} - -article.markdown-body > .highlighted { - background-color: rgba(0, 150, 255, 0.2); -} - -article.markdown-body { - box-sizing: border-box; - min-width: 200px; - max-width: 980px; - margin: 0 auto; - padding: 1em; -} - -@media (max-width: 767px) { - .markdown-body { - padding: 15px; - } -} \ No newline at end of file diff --git a/examples/complex_numbers.js b/examples/complex_numbers.js deleted file mode 100644 index 0d44041548..0000000000 --- a/examples/complex_numbers.js +++ /dev/null @@ -1,65 +0,0 @@ -// complex numbers -import { complex, add, multiply, sin, sqrt, pi, equal, sort, format } from 'mathjs' - -// create a complex number with a numeric real and complex part -console.log('create and manipulate complex numbers') -const a = complex(2, 3) -print(a) // 2 + 3i - -// read the real and complex parts of the complex number -print(a.re) // 2 -print(a.im) // 3 - -// clone a complex value -const clone = a.clone() -print(clone) // 2 + 3i - -// adjust the complex value -a.re = 5 -print(a) // 5 + 3i - -// create a complex number by providing a string with real and complex parts -const b = complex('3-7i') -print(b) // 3 - 7i -console.log() - -// perform operations with complex numbers -console.log('perform operations') -print(add(a, b)) // 8 - 4i -print(multiply(a, b)) // 36 - 26i -print(sin(a)) // -9.6541254768548 + 2.8416922956064i - -// some operations will return a complex number depending on the arguments -print(sqrt(4)) // 2 -print(sqrt(-4)) // 2i -console.log() - -// create a complex number from polar coordinates -console.log('create complex numbers with polar coordinates') -const c = complex({ r: sqrt(2), phi: pi / 4 }) -print(c) // 1 + i - -// get polar coordinates of a complex number -const d = complex(3, 4) -console.log(d.abs(), d.arg()) // radius = 5, phi = 0.9272952180016122 -console.log() - -// comparision operations -// note that there is no mathematical ordering defined for complex numbers -// we can only check equality. To sort a list with complex numbers, -// the natural sorting can be used -console.log('\ncomparision and sorting operations') -console.log('equal', equal(a, b)) // returns false -const values = [a, b, c] -console.log('values:', format(values, 14)) // [5 + 3i, 3 - 7i, 1 + i] -sort(values, 'natural') -console.log('sorted:', format(values, 14)) // [1 + i, 3 - 7i, 5 + 3i] - -/** - * Helper function to output a value in the console. Value will be formatted. - * @param {*} value - */ -function print (value) { - const precision = 14 - console.log(format(value, precision)) -} diff --git a/examples/complex_numbers.js.md b/examples/complex_numbers.js.md deleted file mode 100644 index df7de481ae..0000000000 --- a/examples/complex_numbers.js.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -layout: default ---- - -# Complex numbers - -File: [complex_numbers.js](complex_numbers.js) - -```js -// complex numbers -import { complex, add, multiply, sin, sqrt, pi, equal, sort, format } from 'mathjs' - -// create a complex number with a numeric real and complex part -console.log('create and manipulate complex numbers') -const a = complex(2, 3) -print(a) // 2 + 3i - -// read the real and complex parts of the complex number -print(a.re) // 2 -print(a.im) // 3 - -// clone a complex value -const clone = a.clone() -print(clone) // 2 + 3i - -// adjust the complex value -a.re = 5 -print(a) // 5 + 3i - -// create a complex number by providing a string with real and complex parts -const b = complex('3-7i') -print(b) // 3 - 7i -console.log() - -// perform operations with complex numbers -console.log('perform operations') -print(add(a, b)) // 8 - 4i -print(multiply(a, b)) // 36 - 26i -print(sin(a)) // -9.6541254768548 + 2.8416922956064i - -// some operations will return a complex number depending on the arguments -print(sqrt(4)) // 2 -print(sqrt(-4)) // 2i -console.log() - -// create a complex number from polar coordinates -console.log('create complex numbers with polar coordinates') -const c = complex({ r: sqrt(2), phi: pi / 4 }) -print(c) // 1 + i - -// get polar coordinates of a complex number -const d = complex(3, 4) -console.log(d.abs(), d.arg()) // radius = 5, phi = 0.9272952180016122 -console.log() - -// comparision operations -// note that there is no mathematical ordering defined for complex numbers -// we can only check equality. To sort a list with complex numbers, -// the natural sorting can be used -console.log('\ncomparision and sorting operations') -console.log('equal', equal(a, b)) // returns false -const values = [a, b, c] -console.log('values:', format(values, 14)) // [5 + 3i, 3 - 7i, 1 + i] -sort(values, 'natural') -console.log('sorted:', format(values, 14)) // [1 + i, 3 - 7i, 5 + 3i] - -/** - * Helper function to output a value in the console. Value will be formatted. - * @param {*} value - */ -function print (value) { - const precision = 14 - console.log(format(value, precision)) -} - -``` - - - diff --git a/examples/expressions.js b/examples/expressions.js deleted file mode 100644 index 68067d4281..0000000000 --- a/examples/expressions.js +++ /dev/null @@ -1,186 +0,0 @@ -/** - * Expressions can be evaluated in various ways: - * - * 1. using the function evaluate - * 2. using the function parse - * 3. using a parser. A parser contains functions evaluate and parse, - * and keeps a scope with assigned variables in memory - */ -import { compile, evaluate, format, parse, parser } from 'mathjs' - -// 1. using the function evaluate -// -// Function `evaluate` accepts a single expression or an array with -// expressions as first argument, and has an optional second argument -// containing a scope with variables and functions. The scope is a regular -// JavaScript Object. The scope will be used to resolve symbols, and to write -// assigned variables or function. -console.log('1. USING FUNCTION MATH.EVAL') - -// evaluate expressions -console.log('\nevaluate expressions') -print(evaluate('sqrt(3^2 + 4^2)')) // 5 -print(evaluate('sqrt(-4)')) // 2i -print(evaluate('2 inch to cm')) // 5.08 cm -print(evaluate('cos(45 deg)')) // 0.70711 - -// evaluate multiple expressions at once -console.log('\nevaluate multiple expressions at once') -print(evaluate([ - 'f = 3', - 'g = 4', - 'f * g' -])) // [3, 4, 12] - -// provide a scope (just a regular JavaScript Object) -console.log('\nevaluate expressions providing a scope with variables and functions') -const scope = { - a: 3, - b: 4 -} - -// variables can be read from the scope -print(evaluate('a * b', scope)) // 12 - -// variable assignments are written to the scope -print(evaluate('c = 2.3 + 4.5', scope)) // 6.8 -print(scope.c) // 6.8 - -// scope can contain both variables and functions -scope.hello = function (name) { - return 'hello, ' + name + '!' -} -print(evaluate('hello("hero")', scope)) // "hello, hero!" - -// define a function as an expression -const f = evaluate('f(x) = x ^ a', scope) -print(f(2)) // 8 -print(scope.f(2)) // 8 - -// 2. using function parse -// -// Function `parse` parses expressions into a node tree. The syntax is -// similar to function `evaluate`. -// Function `parse` accepts a single expression or an array with -// expressions as first argument. The function returns a node tree, which -// then can be compiled against math, and then evaluated against an (optional -// scope. This scope is a regular JavaScript Object. The scope will be used -// to resolve symbols, and to write assigned variables or function. -console.log('\n2. USING FUNCTION MATH.PARSE') - -// parse an expression -console.log('\nparse an expression into a node tree') -const node1 = parse('sqrt(3^2 + 4^2)') -print(node1.toString()) // "sqrt((3 ^ 2) + (4 ^ 2))" - -// compile and evaluate the compiled code -// you could also do this in two steps: node1.compile().evaluate() -print(node1.evaluate()) // 5 - -// provide a scope -console.log('\nprovide a scope') -const node2 = parse('x^a') -const code2 = node2.compile() -print(node2.toString()) // "x ^ a" -const scope2 = { - x: 3, - a: 2 -} -print(code2.evaluate(scope2)) // 9 - -// change a value in the scope and re-evaluate the node -scope2.a = 3 -print(code2.evaluate(scope2)) // 27 - -// 3. using function compile -// -// Function `compile` compiles expressions into a node tree. The syntax is -// similar to function `evaluate`. -// Function `compile` accepts a single expression or an array with -// expressions as first argument, and returns an object with a function evaluate -// to evaluate the compiled expression. On evaluation, an optional scope can -// be provided. This scope will be used to resolve symbols, and to write -// assigned variables or function. -console.log('\n3. USING FUNCTION MATH.COMPILE') - -// parse an expression -console.log('\ncompile an expression') -const code3 = compile('sqrt(3^2 + 4^2)') - -// evaluate the compiled code -print(code3.evaluate()) // 5 - -// provide a scope for the variable assignment -console.log('\nprovide a scope') -const code4 = compile('a = a + 3') -const scope3 = { - a: 7 -} -code4.evaluate(scope3) -print(scope3.a) // 10 - -// 4. using a parser -// -// In addition to the static functions `evaluate` and `parse`, js -// contains a parser with functions `evaluate` and `parse`, which automatically -// keeps a scope with assigned variables in memory. The parser also contains -// some convenience methods to get, set, and remove variables from memory. -console.log('\n4. USING A PARSER') -const myParser = parser() - -// evaluate with parser -console.log('\nevaluate expressions') -print(myParser.evaluate('sqrt(3^2 + 4^2)')) // 5 -print(myParser.evaluate('sqrt(-4)')) // 2i -print(myParser.evaluate('2 inch to cm')) // 5.08 cm -print(myParser.evaluate('cos(45 deg)')) // 0.70710678118655 - -// define variables and functions -console.log('\ndefine variables and functions') -print(myParser.evaluate('x = 7 / 2')) // 3.5 -print(myParser.evaluate('x + 3')) // 6.5 -print(myParser.evaluate('f2(x, y) = x^y')) // f2(x, y) -print(myParser.evaluate('f2(2, 3)')) // 8 - -// manipulate matrices -// Note that matrix indexes in the expression parser are one-based with the -// upper-bound included. On a JavaScript level however, js uses zero-based -// indexes with an excluded upper-bound. -console.log('\nmanipulate matrices') -print(myParser.evaluate('k = [1, 2; 3, 4]')) // [[1, 2], [3, 4]] -print(myParser.evaluate('l = zeros(2, 2)')) // [[0, 0], [0, 0]] -print(myParser.evaluate('l[1, 1:2] = [5, 6]')) // [5, 6] -print(myParser.evaluate('l')) // [[5, 6], [0, 0]] -print(myParser.evaluate('l[2, :] = [7, 8]')) // [7, 8] -print(myParser.evaluate('l')) // [[5, 6], [7, 8]] -print(myParser.evaluate('m = k * l')) // [[19, 22], [43, 50]] -print(myParser.evaluate('n = m[2, 1]')) // 43 -print(myParser.evaluate('n = m[:, 1]')) // [[19], [43]] - -// get and set variables and functions -console.log('\nget and set variables and function in the scope of the parser') -const x = myParser.get('x') -console.log('x =', x) // x = 3.5 -const f2 = myParser.get('f2') -console.log('f2 =', format(f2)) // f2 = f2(x, y) -const h = f2(3, 3) -console.log('h =', h) // h = 27 - -myParser.set('i', 500) -print(myParser.evaluate('i / 2')) // 250 -myParser.set('hello', function (name) { - return 'hello, ' + name + '!' -}) -print(myParser.evaluate('hello("hero")')) // "hello, hero!" - -// clear defined functions and variables -myParser.clear() - -/** - * Helper function to output a value in the console. Value will be formatted. - * @param {*} value - */ -function print (value) { - const precision = 14 - console.log(format(value, precision)) -} diff --git a/examples/expressions.js.md b/examples/expressions.js.md deleted file mode 100644 index d123e776ab..0000000000 --- a/examples/expressions.js.md +++ /dev/null @@ -1,200 +0,0 @@ ---- -layout: default ---- - -# Expressions - -File: [expressions.js](expressions.js) - -```js -/** - * Expressions can be evaluated in various ways: - * - * 1. using the function evaluate - * 2. using the function parse - * 3. using a parser. A parser contains functions evaluate and parse, - * and keeps a scope with assigned variables in memory - */ -import { compile, evaluate, format, parse, parser } from 'mathjs' - -// 1. using the function evaluate -// -// Function `evaluate` accepts a single expression or an array with -// expressions as first argument, and has an optional second argument -// containing a scope with variables and functions. The scope is a regular -// JavaScript Object. The scope will be used to resolve symbols, and to write -// assigned variables or function. -console.log('1. USING FUNCTION MATH.EVAL') - -// evaluate expressions -console.log('\nevaluate expressions') -print(evaluate('sqrt(3^2 + 4^2)')) // 5 -print(evaluate('sqrt(-4)')) // 2i -print(evaluate('2 inch to cm')) // 5.08 cm -print(evaluate('cos(45 deg)')) // 0.70711 - -// evaluate multiple expressions at once -console.log('\nevaluate multiple expressions at once') -print(evaluate([ - 'f = 3', - 'g = 4', - 'f * g' -])) // [3, 4, 12] - -// provide a scope (just a regular JavaScript Object) -console.log('\nevaluate expressions providing a scope with variables and functions') -const scope = { - a: 3, - b: 4 -} - -// variables can be read from the scope -print(evaluate('a * b', scope)) // 12 - -// variable assignments are written to the scope -print(evaluate('c = 2.3 + 4.5', scope)) // 6.8 -print(scope.c) // 6.8 - -// scope can contain both variables and functions -scope.hello = function (name) { - return 'hello, ' + name + '!' -} -print(evaluate('hello("hero")', scope)) // "hello, hero!" - -// define a function as an expression -const f = evaluate('f(x) = x ^ a', scope) -print(f(2)) // 8 -print(scope.f(2)) // 8 - -// 2. using function parse -// -// Function `parse` parses expressions into a node tree. The syntax is -// similar to function `evaluate`. -// Function `parse` accepts a single expression or an array with -// expressions as first argument. The function returns a node tree, which -// then can be compiled against math, and then evaluated against an (optional -// scope. This scope is a regular JavaScript Object. The scope will be used -// to resolve symbols, and to write assigned variables or function. -console.log('\n2. USING FUNCTION MATH.PARSE') - -// parse an expression -console.log('\nparse an expression into a node tree') -const node1 = parse('sqrt(3^2 + 4^2)') -print(node1.toString()) // "sqrt((3 ^ 2) + (4 ^ 2))" - -// compile and evaluate the compiled code -// you could also do this in two steps: node1.compile().evaluate() -print(node1.evaluate()) // 5 - -// provide a scope -console.log('\nprovide a scope') -const node2 = parse('x^a') -const code2 = node2.compile() -print(node2.toString()) // "x ^ a" -const scope2 = { - x: 3, - a: 2 -} -print(code2.evaluate(scope2)) // 9 - -// change a value in the scope and re-evaluate the node -scope2.a = 3 -print(code2.evaluate(scope2)) // 27 - -// 3. using function compile -// -// Function `compile` compiles expressions into a node tree. The syntax is -// similar to function `evaluate`. -// Function `compile` accepts a single expression or an array with -// expressions as first argument, and returns an object with a function evaluate -// to evaluate the compiled expression. On evaluation, an optional scope can -// be provided. This scope will be used to resolve symbols, and to write -// assigned variables or function. -console.log('\n3. USING FUNCTION MATH.COMPILE') - -// parse an expression -console.log('\ncompile an expression') -const code3 = compile('sqrt(3^2 + 4^2)') - -// evaluate the compiled code -print(code3.evaluate()) // 5 - -// provide a scope for the variable assignment -console.log('\nprovide a scope') -const code4 = compile('a = a + 3') -const scope3 = { - a: 7 -} -code4.evaluate(scope3) -print(scope3.a) // 10 - -// 4. using a parser -// -// In addition to the static functions `evaluate` and `parse`, js -// contains a parser with functions `evaluate` and `parse`, which automatically -// keeps a scope with assigned variables in memory. The parser also contains -// some convenience methods to get, set, and remove variables from memory. -console.log('\n4. USING A PARSER') -const myParser = parser() - -// evaluate with parser -console.log('\nevaluate expressions') -print(myParser.evaluate('sqrt(3^2 + 4^2)')) // 5 -print(myParser.evaluate('sqrt(-4)')) // 2i -print(myParser.evaluate('2 inch to cm')) // 5.08 cm -print(myParser.evaluate('cos(45 deg)')) // 0.70710678118655 - -// define variables and functions -console.log('\ndefine variables and functions') -print(myParser.evaluate('x = 7 / 2')) // 3.5 -print(myParser.evaluate('x + 3')) // 6.5 -print(myParser.evaluate('f2(x, y) = x^y')) // f2(x, y) -print(myParser.evaluate('f2(2, 3)')) // 8 - -// manipulate matrices -// Note that matrix indexes in the expression parser are one-based with the -// upper-bound included. On a JavaScript level however, js uses zero-based -// indexes with an excluded upper-bound. -console.log('\nmanipulate matrices') -print(myParser.evaluate('k = [1, 2; 3, 4]')) // [[1, 2], [3, 4]] -print(myParser.evaluate('l = zeros(2, 2)')) // [[0, 0], [0, 0]] -print(myParser.evaluate('l[1, 1:2] = [5, 6]')) // [5, 6] -print(myParser.evaluate('l')) // [[5, 6], [0, 0]] -print(myParser.evaluate('l[2, :] = [7, 8]')) // [7, 8] -print(myParser.evaluate('l')) // [[5, 6], [7, 8]] -print(myParser.evaluate('m = k * l')) // [[19, 22], [43, 50]] -print(myParser.evaluate('n = m[2, 1]')) // 43 -print(myParser.evaluate('n = m[:, 1]')) // [[19], [43]] - -// get and set variables and functions -console.log('\nget and set variables and function in the scope of the parser') -const x = myParser.get('x') -console.log('x =', x) // x = 3.5 -const f2 = myParser.get('f2') -console.log('f2 =', format(f2)) // f2 = f2(x, y) -const h = f2(3, 3) -console.log('h =', h) // h = 27 - -myParser.set('i', 500) -print(myParser.evaluate('i / 2')) // 250 -myParser.set('hello', function (name) { - return 'hello, ' + name + '!' -}) -print(myParser.evaluate('hello("hero")')) // "hello, hero!" - -// clear defined functions and variables -myParser.clear() - -/** - * Helper function to output a value in the console. Value will be formatted. - * @param {*} value - */ -function print (value) { - const precision = 14 - console.log(format(value, precision)) -} - -``` - - - diff --git a/examples/fractions.js b/examples/fractions.js deleted file mode 100644 index d1239b0fdd..0000000000 --- a/examples/fractions.js +++ /dev/null @@ -1,72 +0,0 @@ -// Fractions -import { create, all } from 'mathjs' - -// configure the default type of numbers as Fractions -const config = { - // Default type of number - // Available options: 'number' (default), 'BigNumber', or 'Fraction' - number: 'Fraction' -} - -// create a mathjs instance with everything included -const math = create(all, config) - -console.log('basic usage') -printRatio(math.fraction(0.125)) // Fraction, 1/8 -printRatio(math.fraction(0.32)) // Fraction, 8/25 -printRatio(math.fraction('1/3')) // Fraction, 1/3 -printRatio(math.fraction('0.(3)')) // Fraction, 1/3 -printRatio(math.fraction(2, 3)) // Fraction, 2/3 -printRatio(math.fraction('0.(285714)')) // Fraction, 2/7 -console.log() - -console.log('round-off errors with numbers') -print(math.add(0.1, 0.2)) // number, 0.30000000000000004 -print(math.divide(0.3, 0.2)) // number, 1.4999999999999998 -console.log() - -console.log('no round-off errors with fractions :)') -print(math.add(math.fraction(0.1), math.fraction(0.2))) // Fraction, 0.3 -print(math.divide(math.fraction(0.3), math.fraction(0.2))) // Fraction, 1.5 -console.log() - -console.log('represent an infinite number of repeating digits') -print(math.fraction('1/3')) // Fraction, 0.(3) -print(math.fraction('2/7')) // Fraction, 0.(285714) -print(math.fraction('23/11')) // Fraction, 2.(09) -console.log() - -// one can work conveniently with fractions using the expression parser. -// note though that Fractions are only supported by basic arithmetic functions -console.log('use fractions in the expression parser') -printRatio(math.evaluate('0.1 + 0.2')) // Fraction, 3/10 -printRatio(math.evaluate('0.3 / 0.2')) // Fraction, 3/2 -printRatio(math.evaluate('23 / 11')) // Fraction, 23/11 -console.log() - -// output formatting -console.log('output formatting of fractions') -const a = math.fraction('2/3') -console.log(math.format(a)) // Fraction, 2/3 -console.log(math.format(a, { fraction: 'ratio' })) // Fraction, 2/3 -console.log(math.format(a, { fraction: 'decimal' })) // Fraction, 0.(6) -console.log(a.toString()) // Fraction, 0.(6) -console.log() - -/** - * Helper function to output a value in the console. - * Fractions will be formatted as ratio, like '1/3'. - * @param {*} value - */ -function printRatio (value) { - console.log(math.format(value, { fraction: 'ratio' })) -} - -/** - * Helper function to output a value in the console. - * Fractions will be formatted as decimal, like '0.(3)'. - * @param {*} value - */ -function print (value) { - console.log(math.format(value, { fraction: 'decimal' })) -} diff --git a/examples/fractions.js.md b/examples/fractions.js.md deleted file mode 100644 index 536383b97f..0000000000 --- a/examples/fractions.js.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -layout: default ---- - -# Fractions - -File: [fractions.js](fractions.js) - -```js -// Fractions -import { create, all } from 'mathjs' - -// configure the default type of numbers as Fractions -const config = { - // Default type of number - // Available options: 'number' (default), 'BigNumber', or 'Fraction' - number: 'Fraction' -} - -// create a mathjs instance with everything included -const math = create(all, config) - -console.log('basic usage') -printRatio(math.fraction(0.125)) // Fraction, 1/8 -printRatio(math.fraction(0.32)) // Fraction, 8/25 -printRatio(math.fraction('1/3')) // Fraction, 1/3 -printRatio(math.fraction('0.(3)')) // Fraction, 1/3 -printRatio(math.fraction(2, 3)) // Fraction, 2/3 -printRatio(math.fraction('0.(285714)')) // Fraction, 2/7 -console.log() - -console.log('round-off errors with numbers') -print(math.add(0.1, 0.2)) // number, 0.30000000000000004 -print(math.divide(0.3, 0.2)) // number, 1.4999999999999998 -console.log() - -console.log('no round-off errors with fractions :)') -print(math.add(math.fraction(0.1), math.fraction(0.2))) // Fraction, 0.3 -print(math.divide(math.fraction(0.3), math.fraction(0.2))) // Fraction, 1.5 -console.log() - -console.log('represent an infinite number of repeating digits') -print(math.fraction('1/3')) // Fraction, 0.(3) -print(math.fraction('2/7')) // Fraction, 0.(285714) -print(math.fraction('23/11')) // Fraction, 2.(09) -console.log() - -// one can work conveniently with fractions using the expression parser. -// note though that Fractions are only supported by basic arithmetic functions -console.log('use fractions in the expression parser') -printRatio(math.evaluate('0.1 + 0.2')) // Fraction, 3/10 -printRatio(math.evaluate('0.3 / 0.2')) // Fraction, 3/2 -printRatio(math.evaluate('23 / 11')) // Fraction, 23/11 -console.log() - -// output formatting -console.log('output formatting of fractions') -const a = math.fraction('2/3') -console.log(math.format(a)) // Fraction, 2/3 -console.log(math.format(a, { fraction: 'ratio' })) // Fraction, 2/3 -console.log(math.format(a, { fraction: 'decimal' })) // Fraction, 0.(6) -console.log(a.toString()) // Fraction, 0.(6) -console.log() - -/** - * Helper function to output a value in the console. - * Fractions will be formatted as ratio, like '1/3'. - * @param {*} value - */ -function printRatio (value) { - console.log(math.format(value, { fraction: 'ratio' })) -} - -/** - * Helper function to output a value in the console. - * Fractions will be formatted as decimal, like '0.(3)'. - * @param {*} value - */ -function print (value) { - console.log(math.format(value, { fraction: 'decimal' })) -} - -``` - - - diff --git a/examples/import.js b/examples/import.js deleted file mode 100644 index 0b941d3dc7..0000000000 --- a/examples/import.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Math.js can easily be extended with functions and variables using the - * `import` function. The function `import` accepts a module name or an object - * containing functions and variables. - */ -import { create, all } from 'mathjs' -const math = create(all) - -/** - * Define new functions and variables - */ -math.import({ - myConstant: 42, - hello: function (name) { - return 'hello, ' + name + '!' - } -}) - -// defined methods can be used in both JavaScript as well as the parser -print(math.myConstant * 2) // 84 -print(math.hello('user')) // 'hello, user!' - -print(math.evaluate('myConstant + 10')) // 52 -print(math.evaluate('hello("user")')) // 'hello, user!' - -/** - * Import the math library numbers.js, https://github.com/sjkaliski/numbers.js - * The library must be installed first using npm: - * npm install numbers - */ -try { - // load the numbers.js library - const numbers = require('numbers') - - // import the numbers.js library into math.js - math.import(numbers, { wrap: true, silent: true }) - - if (math.fibonacci) { - // calculate fibonacci - print(math.fibonacci(7)) // 13 - print(math.evaluate('fibonacci(7)')) // 13 - } -} catch (err) { - console.log('Warning: To use numbers.js, the library must ' + - 'be installed first via `npm install numbers`.') -} - -/** - * Import the math library numeric.js, https://github.com/sloisel/numeric - * The library must be installed first using npm: - * npm install numeric - */ -try { - // load the numeric.js library - const numeric = require('numeric') - - // import the numeric.js library into math.js - math.import(numeric, { wrap: true, silent: true }) - - if (math.eig) { - // calculate eigenvalues of a matrix - print(math.evaluate('eig([1, 2; 4, 3])').lambda.x) // [5, -1] - - // solve AX = b - const A = math.evaluate('[1, 2, 3; 2, -1, 1; 3, 0, -1]') - const b = [9, 8, 3] - print(math.solve(A, b)) // [2, -1, 3] - } -} catch (err) { - console.log('Warning: To use numeric.js, the library must ' + - 'be installed first via `npm install numeric`.') -} - -/** - * By default, the function import does not allow overriding existing functions. - * Existing functions can be overridden by specifying option `override: true` - */ -math.import({ - pi: 3.14 -}, { - override: true -}) - -print(math.pi) // returns 3.14 instead of 3.141592653589793 - -/** - * Helper function to output a value in the console. Value will be formatted. - * @param {*} value - */ -function print (value) { - const precision = 14 - console.log(math.format(value, precision)) -} diff --git a/examples/import.js.md b/examples/import.js.md deleted file mode 100644 index 7a1a0e218a..0000000000 --- a/examples/import.js.md +++ /dev/null @@ -1,107 +0,0 @@ ---- -layout: default ---- - -# Import - -File: [import.js](import.js) - -```js -/** - * Math.js can easily be extended with functions and variables using the - * `import` function. The function `import` accepts a module name or an object - * containing functions and variables. - */ -import { create, all } from 'mathjs' -const math = create(all) - -/** - * Define new functions and variables - */ -math.import({ - myConstant: 42, - hello: function (name) { - return 'hello, ' + name + '!' - } -}) - -// defined methods can be used in both JavaScript as well as the parser -print(math.myConstant * 2) // 84 -print(math.hello('user')) // 'hello, user!' - -print(math.evaluate('myConstant + 10')) // 52 -print(math.evaluate('hello("user")')) // 'hello, user!' - -/** - * Import the math library numbers.js, https://github.com/sjkaliski/numbers.js - * The library must be installed first using npm: - * npm install numbers - */ -try { - // load the numbers.js library - const numbers = require('numbers') - - // import the numbers.js library into math.js - math.import(numbers, { wrap: true, silent: true }) - - if (math.fibonacci) { - // calculate fibonacci - print(math.fibonacci(7)) // 13 - print(math.evaluate('fibonacci(7)')) // 13 - } -} catch (err) { - console.log('Warning: To use numbers.js, the library must ' + - 'be installed first via `npm install numbers`.') -} - -/** - * Import the math library numeric.js, https://github.com/sloisel/numeric - * The library must be installed first using npm: - * npm install numeric - */ -try { - // load the numeric.js library - const numeric = require('numeric') - - // import the numeric.js library into math.js - math.import(numeric, { wrap: true, silent: true }) - - if (math.eig) { - // calculate eigenvalues of a matrix - print(math.evaluate('eig([1, 2; 4, 3])').lambda.x) // [5, -1] - - // solve AX = b - const A = math.evaluate('[1, 2, 3; 2, -1, 1; 3, 0, -1]') - const b = [9, 8, 3] - print(math.solve(A, b)) // [2, -1, 3] - } -} catch (err) { - console.log('Warning: To use numeric.js, the library must ' + - 'be installed first via `npm install numeric`.') -} - -/** - * By default, the function import does not allow overriding existing functions. - * Existing functions can be overridden by specifying option `override: true` - */ -math.import({ - pi: 3.14 -}, { - override: true -}) - -print(math.pi) // returns 3.14 instead of 3.141592653589793 - -/** - * Helper function to output a value in the console. Value will be formatted. - * @param {*} value - */ -function print (value) { - const precision = 14 - console.log(math.format(value, precision)) -} - -``` - - - diff --git a/examples/index.md b/examples/index.md deleted file mode 100644 index b20393389b..0000000000 --- a/examples/index.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -layout: default ---- - -# Examples - -- [Algebra](algebra.js.html) -- [Basic usage](basic_usage.js.html) -- [Bignumbers](bignumbers.js.html) -- [Chaining](chaining.js.html) -- [Complex numbers](complex_numbers.js.html) -- [Expressions](expressions.js.html) -- [Fractions](fractions.js.html) -- [Import](import.js.html) -- [Matrices](matrices.js.html) -- [Objects](objects.js.html) -- [Serialization](serialization.js.html) -- [Sparse matrices](sparse_matrices.js.html) -- [Units](units.js.html) - -# Browser examples - -- [Angle configuration](browser\angle_configuration.html.html) -- [Basic usage](browser\basic_usage.html.html) -- [Currency conversion](browser\currency_conversion.html.html) -- [Custom separators](browser\custom_separators.html.html) -- [Lorenz](browser\lorenz.html.html) -- [Lorenz interactive](browser\lorenz_interactive.html.html) -- [Plot](browser\plot.html.html) -- [Pretty printing with mathjax](browser\pretty_printing_with_mathjax.html.html) -- [Printing html](browser\printing_html.html.html) -- [Requirejs loading](browser\requirejs_loading.html.html) -- [Rocket trajectory optimization](browser\rocket_trajectory_optimization.html.html) -- [Webworkers](browser\webworkers\index.html) - -# Advanced examples - -- [Convert fraction to bignumber](advanced\convert_fraction_to_bignumber.js.html) -- [Custom argument parsing](advanced\custom_argument_parsing.js.html) -- [Custom datatype](advanced\custom_datatype.js.html) -- [Custom evaluate using factories](advanced\custom_evaluate_using_factories.js.html) -- [Custom evaluate using import](advanced\custom_evaluate_using_import.js.html) -- [Custom loading](advanced\custom_loading.js.html) -- [Custom relational functions](advanced\custom_relational_functions.js.html) -- [Custom scope objects](advanced\custom_scope_objects.js.html) -- [Expression trees](advanced\expression_trees.js.html) -- [Function transform](advanced\function_transform.js.html) -- [More secure eval](advanced\more_secure_eval.js.html) -- [Web server](advanced\web_server\index.html) - - - diff --git a/examples/matrices.js b/examples/matrices.js deleted file mode 100644 index 760a553743..0000000000 --- a/examples/matrices.js +++ /dev/null @@ -1,109 +0,0 @@ -// matrices -import { diag, factorial, format, index, map, matrix, multiply, ones, range, sqrt } from 'mathjs' - -// create matrices and arrays. a matrix is just a wrapper around an Array, -// providing some handy utilities. -console.log('create a matrix') -const a = matrix([1, 4, 9, 16, 25]) -print(a) // [1, 4, 9, 16, 25] -const b = matrix(ones([2, 3])) -print(b) // [[1, 1, 1], [1, 1, 1]] -print(b.size()) // [2, 3] - -// the Array data of a Matrix can be retrieved using valueOf() -const array = a.valueOf() -print(array) // [1, 4, 9, 16, 25] - -// Matrices can be cloned -const clone = a.clone() -print(clone) // [1, 4, 9, 16, 25] -console.log() - -// perform operations with matrices -console.log('perform operations') -print(map(a, sqrt)) // [1, 2, 3, 4, 5] -const c = [1, 2, 3, 4, 5] -print(factorial(c)) // [1, 2, 6, 24, 120] -console.log() - -// create and manipulate matrices. Arrays and Matrices can be used mixed. -console.log('manipulate matrices') -const d = [[1, 2], [3, 4]] -print(d) // [[1, 2], [3, 4]] -const e = matrix([[5, 6], [1, 1]]) -print(e) // [[5, 6], [1, 1]] - -// set a submatrix -// Matrix indexes are zero-based. -e.subset(index(1, [0, 1]), [[7, 8]]) -print(e) // [[5, 6], [7, 8]] -const f = multiply(d, e) -print(f) // [[19, 22], [43, 50]] -const g = f.subset(index(1, 0)) -print(g) // 43 -console.log() - -// get a sub matrix -// Matrix indexes are zero-based. -console.log('get a sub matrix') -const h = diag(range(1, 4)) -print(h) // [[1, 0, 0], [0, 2, 0], [0, 0, 3]] -print(h.subset(index([1, 2], [1, 2]))) // [[2, 0], [0, 3]] -const i = range(1, 6) -print(i) // [1, 2, 3, 4, 5] -print(i.subset(index(range(1, 4)))) // [2, 3, 4] -console.log() - -// replace a single value in a matrix -// this will mutate the matrix -console.log('set and get a value') -const p = matrix([[1, 2], [3, 4]]) -p.set([0, 1], 5) -print(p) // [[1, 5], [3, 4]] -const p21 = p.get([1, 0]) -print(p21) // 3 -console.log() - -// resize a multi dimensional matrix -console.log('resizing a matrix') -const j = matrix() -let defaultValue = 0 -j.resize([2, 2, 2], defaultValue) -print(j) // [[[0, 0], [0, 0]], [[0, 0], [0, 0]]] -print(j.size()) // [2, 2, 2] -j.resize([2, 2]) -print(j) // [[0, 0], [0, 0]] -print(j.size()) // [2, 2] -console.log() - -// setting a value outside the matrices range will resize the matrix. -// new elements will be initialized with zero. -console.log('set a value outside a matrices range') -const k = matrix() -k.subset(index(2), 6) -print(k) // [0, 0, 6] -console.log() - -console.log('set a value outside a matrices range, setting other new entries to null') -const m = matrix() -defaultValue = null -m.subset(index(2), 6, defaultValue) -print(m) // [null, null, 6] -console.log() - -// create ranges -console.log('create ranges') -print(range(1, 6)) // [1, 2, 3, 4, 5] -print(range(0, 18, 3)) // [0, 3, 6, 9, 12, 15] -print(range('2:-1:-3')) // [2, 1, 0, -1, -2] -print(factorial(range('1:6'))) // [1, 2, 6, 24, 120] -console.log() - -/** - * Helper function to output a value in the console. Value will be formatted. - * @param {*} value - */ -function print (value) { - const precision = 14 - console.log(format(value, precision)) -} diff --git a/examples/matrices.js.md b/examples/matrices.js.md deleted file mode 100644 index 0ae1b0e72c..0000000000 --- a/examples/matrices.js.md +++ /dev/null @@ -1,123 +0,0 @@ ---- -layout: default ---- - -# Matrices - -File: [matrices.js](matrices.js) - -```js -// matrices -import { diag, factorial, format, index, map, matrix, multiply, ones, range, sqrt } from 'mathjs' - -// create matrices and arrays. a matrix is just a wrapper around an Array, -// providing some handy utilities. -console.log('create a matrix') -const a = matrix([1, 4, 9, 16, 25]) -print(a) // [1, 4, 9, 16, 25] -const b = matrix(ones([2, 3])) -print(b) // [[1, 1, 1], [1, 1, 1]] -print(b.size()) // [2, 3] - -// the Array data of a Matrix can be retrieved using valueOf() -const array = a.valueOf() -print(array) // [1, 4, 9, 16, 25] - -// Matrices can be cloned -const clone = a.clone() -print(clone) // [1, 4, 9, 16, 25] -console.log() - -// perform operations with matrices -console.log('perform operations') -print(map(a, sqrt)) // [1, 2, 3, 4, 5] -const c = [1, 2, 3, 4, 5] -print(factorial(c)) // [1, 2, 6, 24, 120] -console.log() - -// create and manipulate matrices. Arrays and Matrices can be used mixed. -console.log('manipulate matrices') -const d = [[1, 2], [3, 4]] -print(d) // [[1, 2], [3, 4]] -const e = matrix([[5, 6], [1, 1]]) -print(e) // [[5, 6], [1, 1]] - -// set a submatrix -// Matrix indexes are zero-based. -e.subset(index(1, [0, 1]), [[7, 8]]) -print(e) // [[5, 6], [7, 8]] -const f = multiply(d, e) -print(f) // [[19, 22], [43, 50]] -const g = f.subset(index(1, 0)) -print(g) // 43 -console.log() - -// get a sub matrix -// Matrix indexes are zero-based. -console.log('get a sub matrix') -const h = diag(range(1, 4)) -print(h) // [[1, 0, 0], [0, 2, 0], [0, 0, 3]] -print(h.subset(index([1, 2], [1, 2]))) // [[2, 0], [0, 3]] -const i = range(1, 6) -print(i) // [1, 2, 3, 4, 5] -print(i.subset(index(range(1, 4)))) // [2, 3, 4] -console.log() - -// replace a single value in a matrix -// this will mutate the matrix -console.log('set and get a value') -const p = matrix([[1, 2], [3, 4]]) -p.set([0, 1], 5) -print(p) // [[1, 5], [3, 4]] -const p21 = p.get([1, 0]) -print(p21) // 3 -console.log() - -// resize a multi dimensional matrix -console.log('resizing a matrix') -const j = matrix() -let defaultValue = 0 -j.resize([2, 2, 2], defaultValue) -print(j) // [[[0, 0], [0, 0]], [[0, 0], [0, 0]]] -print(j.size()) // [2, 2, 2] -j.resize([2, 2]) -print(j) // [[0, 0], [0, 0]] -print(j.size()) // [2, 2] -console.log() - -// setting a value outside the matrices range will resize the matrix. -// new elements will be initialized with zero. -console.log('set a value outside a matrices range') -const k = matrix() -k.subset(index(2), 6) -print(k) // [0, 0, 6] -console.log() - -console.log('set a value outside a matrices range, setting other new entries to null') -const m = matrix() -defaultValue = null -m.subset(index(2), 6, defaultValue) -print(m) // [null, null, 6] -console.log() - -// create ranges -console.log('create ranges') -print(range(1, 6)) // [1, 2, 3, 4, 5] -print(range(0, 18, 3)) // [0, 3, 6, 9, 12, 15] -print(range('2:-1:-3')) // [2, 1, 0, -1, -2] -print(factorial(range('1:6'))) // [1, 2, 6, 24, 120] -console.log() - -/** - * Helper function to output a value in the console. Value will be formatted. - * @param {*} value - */ -function print (value) { - const precision = 14 - console.log(format(value, precision)) -} - -``` - - - diff --git a/examples/objects.js b/examples/objects.js deleted file mode 100644 index 57f73ad4c0..0000000000 --- a/examples/objects.js +++ /dev/null @@ -1,33 +0,0 @@ -// objects -import { evaluate, format } from 'mathjs' - -// create an object. Keys can be symbols or strings -print(evaluate('{x: 2 + 1, y: 4}')) // {"x": 3, "y": 4} -print(evaluate('{"name": "John"}')) // {"name": "John"} - -// create an object containing an object -print(evaluate('{a: 2, b: {c: 3, d: 4}}')) // {"a": 2, "b": {"c": 3, "d": 4}} - -const scope = { - obj: { - prop: 42 - } -} - -// retrieve properties using dot notation or bracket notation -print(evaluate('obj.prop', scope)) // 42 -print(evaluate('obj["prop"]', scope)) // 42 - -// set properties (returns the whole object, not the property value!) -print(evaluate('obj.prop = 43', scope)) // 43 -print(evaluate('obj["prop"] = 43', scope)) // 43 -print(scope.obj) // {"prop": 43} - -/** - * Helper function to output a value in the console. Value will be formatted. - * @param {*} value - */ -function print (value) { - const precision = 14 - console.log(format(value, precision)) -} diff --git a/examples/objects.js.md b/examples/objects.js.md deleted file mode 100644 index 0b6d6b2d6d..0000000000 --- a/examples/objects.js.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -layout: default ---- - -# Objects - -File: [objects.js](objects.js) - -```js -// objects -import { evaluate, format } from 'mathjs' - -// create an object. Keys can be symbols or strings -print(evaluate('{x: 2 + 1, y: 4}')) // {"x": 3, "y": 4} -print(evaluate('{"name": "John"}')) // {"name": "John"} - -// create an object containing an object -print(evaluate('{a: 2, b: {c: 3, d: 4}}')) // {"a": 2, "b": {"c": 3, "d": 4}} - -const scope = { - obj: { - prop: 42 - } -} - -// retrieve properties using dot notation or bracket notation -print(evaluate('obj.prop', scope)) // 42 -print(evaluate('obj["prop"]', scope)) // 42 - -// set properties (returns the whole object, not the property value!) -print(evaluate('obj.prop = 43', scope)) // 43 -print(evaluate('obj["prop"] = 43', scope)) // 43 -print(scope.obj) // {"prop": 43} - -/** - * Helper function to output a value in the console. Value will be formatted. - * @param {*} value - */ -function print (value) { - const precision = 14 - console.log(format(value, precision)) -} - -``` - - - diff --git a/examples/serialization.js b/examples/serialization.js deleted file mode 100644 index eb0cf4ab4f..0000000000 --- a/examples/serialization.js +++ /dev/null @@ -1,16 +0,0 @@ -// serialization -import { complex, replacer, reviver, typeOf } from 'mathjs' - -// serialize a math.js data type into a JSON string -// the replacer function is needed to correctly stringify a value like Infinity -const x = complex('2+3i') -const str1 = JSON.stringify(x, replacer) -console.log(str1) -// outputs {"mathjs":"Complex","re":2,"im":3} - -// deserialize a JSON string into a math.js data type -// note that the reviver of math.js is needed for this: -const str2 = '{"mathjs":"Unit","value":5,"unit":"cm"}' -const y = JSON.parse(str2, reviver) -console.log(typeOf(y)) // 'Unit' -console.log(y.toString()) // 5 cm diff --git a/examples/serialization.js.md b/examples/serialization.js.md deleted file mode 100644 index e600c5e722..0000000000 --- a/examples/serialization.js.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -layout: default ---- - -# Serialization - -File: [serialization.js](serialization.js) - -```js -// serialization -import { complex, replacer, reviver, typeOf } from 'mathjs' - -// serialize a math.js data type into a JSON string -// the replacer function is needed to correctly stringify a value like Infinity -const x = complex('2+3i') -const str1 = JSON.stringify(x, replacer) -console.log(str1) -// outputs {"mathjs":"Complex","re":2,"im":3} - -// deserialize a JSON string into a math.js data type -// note that the reviver of math.js is needed for this: -const str2 = '{"mathjs":"Unit","value":5,"unit":"cm"}' -const y = JSON.parse(str2, reviver) -console.log(typeOf(y)) // 'Unit' -console.log(y.toString()) // 5 cm - -``` - - - diff --git a/examples/sparse_matrices.js b/examples/sparse_matrices.js deleted file mode 100644 index f65d415154..0000000000 --- a/examples/sparse_matrices.js +++ /dev/null @@ -1,19 +0,0 @@ -// Sparse matrices -import { identity, multiply, transpose, complex } from 'mathjs' - -// create a sparse matrix -console.log('creating a 1000x1000 sparse matrix...') -const a = identity(1000, 1000, 'sparse') - -// do operations with a sparse matrix -console.log('doing some operations on the sparse matrix...') -const b = multiply(a, a) -const c = multiply(b, complex(2, 2)) -const d = transpose(c) -const e = multiply(d, a) -console.log('size(e)=', e.size()) - -// we will not print the output, but doing the same operations -// with a dense matrix are very slow, try it for yourself. -console.log('already done') -console.log('now try this with a dense matrix :)') diff --git a/examples/sparse_matrices.js.md b/examples/sparse_matrices.js.md deleted file mode 100644 index fccea2b554..0000000000 --- a/examples/sparse_matrices.js.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -layout: default ---- - -# Sparse matrices - -File: [sparse_matrices.js](sparse_matrices.js) - -```js -// Sparse matrices -import { identity, multiply, transpose, complex } from 'mathjs' - -// create a sparse matrix -console.log('creating a 1000x1000 sparse matrix...') -const a = identity(1000, 1000, 'sparse') - -// do operations with a sparse matrix -console.log('doing some operations on the sparse matrix...') -const b = multiply(a, a) -const c = multiply(b, complex(2, 2)) -const d = transpose(c) -const e = multiply(d, a) -console.log('size(e)=', e.size()) - -// we will not print the output, but doing the same operations -// with a dense matrix are very slow, try it for yourself. -console.log('already done') -console.log('now try this with a dense matrix :)') - -``` - - - diff --git a/examples/units.js b/examples/units.js deleted file mode 100644 index 6f7e9c0f73..0000000000 --- a/examples/units.js +++ /dev/null @@ -1,106 +0,0 @@ -// units -import { add, cross, divide, evaluate, format as _format, multiply, number, pow, to, unit } from 'mathjs' - -// units can be created by providing a value and unit name, or by providing -// a string with a valued unit. -console.log('create units') -const a = unit(45, 'cm') -const b = unit('0.1m') -print(a) // 45 cm -print(b) // 0.1 m -console.log() - -// units can be added, subtracted, and multiplied or divided by numbers and by other units -console.log('perform operations') -print(add(a, b)) // 55 cm -print(multiply(b, 2)) // 0.2 m -print(divide(unit('1 m'), unit('1 s'))) // 1 m / s -print(pow(unit('12 in'), 3)) // 1728 in^3 -console.log() - -// units can be converted to a specific type, or to a number -console.log('convert to another type or to a number') -print(b.to('cm')) // 10 cm Alternatively: to(b, 'cm') -print(to(b, 'inch')) // 3.9370078740157 inch -print(b.toNumber('cm')) // 10 -print(number(b, 'cm')) // 10 -console.log() - -// the expression parser supports units too -console.log('parse expressions') -print(evaluate('2 inch to cm')) // 5.08 cm -print(evaluate('cos(45 deg)')) // 0.70710678118655 -print(evaluate('90 km/h to m/s')) // 25 m / s -console.log() - -// convert a unit to a number -// A second parameter with the unit for the exported number must be provided -print(evaluate('number(5 cm, mm)')) // number, 50 -console.log() - -// simplify units -console.log('simplify units') -print(evaluate('100000 N / m^2')) // 100 kPa -print(evaluate('9.81 m/s^2 * 100 kg * 40 m')) // 39.24 kJ -console.log() - -// example engineering calculations -console.log('compute molar volume of ideal gas at 65 Fahrenheit, 14.7 psi in L/mol') -const Rg = unit('8.314 N m / (mol K)') -const T = unit('65 degF') -const P = unit('14.7 psi') -const v = divide(multiply(Rg, T), P) -console.log('gas constant (Rg) = ', format(Rg)) -console.log('P = ' + format(P)) -console.log('T = ' + format(T)) -console.log('v = Rg * T / P = ' + format(to(v, 'L/mol'))) -// 23.910432393453 L / mol -console.log() - -console.log('compute speed of fluid flowing out of hole in a container') -const g = unit('9.81 m / s^2') -const h = unit('1 m') -const v2 = pow(multiply(2, multiply(g, h)), 0.5) // Can also use sqrt -console.log('g = ' + format(g)) -console.log('h = ' + format(h)) -console.log('v = (2 g h) ^ 0.5 = ' + format(v2)) -// 4.42944691807 m / s -console.log() - -console.log('electrical power consumption:') -const expr1 = '460 V * 20 A * 30 days to kWh' -console.log(expr1 + ' = ' + evaluate(expr1)) // 6624 kWh -console.log() - -console.log('circuit design:') -const expr2 = '24 V / (6 mA)' -console.log(expr2 + ' = ' + evaluate(expr2)) // 4 kohm -console.log() - -console.log('operations on arrays:') -const B = evaluate('[1, 0, 0] T') -const v3 = evaluate('[0, 1, 0] m/s') -const q = evaluate('1 C') -const F = multiply(q, cross(v3, B)) -console.log('B (magnetic field strength) = ' + format(B)) // [1 T, 0 T, 0 T] -console.log('v (particle velocity) = ' + format(v3)) // [0 m / s, 1 m / s, 0 m / s] -console.log('q (particle charge) = ' + format(q)) // 1 C -console.log('F (force) = q (v cross B) = ' + format(F)) // [0 N, 0 N, -1 N] - -/** - * Helper function to output a value in the console. Value will be formatted. - * @param {*} value - */ -function print (value) { - console.log(format(value)) -} - -/** - * Helper function to format an output a value. - * @param {*} value - * @return {string} Returns the formatted value - */ -function format (value) { - const precision = 14 - return _format(value, precision) -} diff --git a/examples/units.js.md b/examples/units.js.md deleted file mode 100644 index 5b127e2990..0000000000 --- a/examples/units.js.md +++ /dev/null @@ -1,120 +0,0 @@ ---- -layout: default ---- - -# Units - -File: [units.js](units.js) - -```js -// units -import { add, cross, divide, evaluate, format as _format, multiply, number, pow, to, unit } from 'mathjs' - -// units can be created by providing a value and unit name, or by providing -// a string with a valued unit. -console.log('create units') -const a = unit(45, 'cm') -const b = unit('0.1m') -print(a) // 45 cm -print(b) // 0.1 m -console.log() - -// units can be added, subtracted, and multiplied or divided by numbers and by other units -console.log('perform operations') -print(add(a, b)) // 55 cm -print(multiply(b, 2)) // 0.2 m -print(divide(unit('1 m'), unit('1 s'))) // 1 m / s -print(pow(unit('12 in'), 3)) // 1728 in^3 -console.log() - -// units can be converted to a specific type, or to a number -console.log('convert to another type or to a number') -print(b.to('cm')) // 10 cm Alternatively: to(b, 'cm') -print(to(b, 'inch')) // 3.9370078740157 inch -print(b.toNumber('cm')) // 10 -print(number(b, 'cm')) // 10 -console.log() - -// the expression parser supports units too -console.log('parse expressions') -print(evaluate('2 inch to cm')) // 5.08 cm -print(evaluate('cos(45 deg)')) // 0.70710678118655 -print(evaluate('90 km/h to m/s')) // 25 m / s -console.log() - -// convert a unit to a number -// A second parameter with the unit for the exported number must be provided -print(evaluate('number(5 cm, mm)')) // number, 50 -console.log() - -// simplify units -console.log('simplify units') -print(evaluate('100000 N / m^2')) // 100 kPa -print(evaluate('9.81 m/s^2 * 100 kg * 40 m')) // 39.24 kJ -console.log() - -// example engineering calculations -console.log('compute molar volume of ideal gas at 65 Fahrenheit, 14.7 psi in L/mol') -const Rg = unit('8.314 N m / (mol K)') -const T = unit('65 degF') -const P = unit('14.7 psi') -const v = divide(multiply(Rg, T), P) -console.log('gas constant (Rg) = ', format(Rg)) -console.log('P = ' + format(P)) -console.log('T = ' + format(T)) -console.log('v = Rg * T / P = ' + format(to(v, 'L/mol'))) -// 23.910432393453 L / mol -console.log() - -console.log('compute speed of fluid flowing out of hole in a container') -const g = unit('9.81 m / s^2') -const h = unit('1 m') -const v2 = pow(multiply(2, multiply(g, h)), 0.5) // Can also use sqrt -console.log('g = ' + format(g)) -console.log('h = ' + format(h)) -console.log('v = (2 g h) ^ 0.5 = ' + format(v2)) -// 4.42944691807 m / s -console.log() - -console.log('electrical power consumption:') -const expr1 = '460 V * 20 A * 30 days to kWh' -console.log(expr1 + ' = ' + evaluate(expr1)) // 6624 kWh -console.log() - -console.log('circuit design:') -const expr2 = '24 V / (6 mA)' -console.log(expr2 + ' = ' + evaluate(expr2)) // 4 kohm -console.log() - -console.log('operations on arrays:') -const B = evaluate('[1, 0, 0] T') -const v3 = evaluate('[0, 1, 0] m/s') -const q = evaluate('1 C') -const F = multiply(q, cross(v3, B)) -console.log('B (magnetic field strength) = ' + format(B)) // [1 T, 0 T, 0 T] -console.log('v (particle velocity) = ' + format(v3)) // [0 m / s, 1 m / s, 0 m / s] -console.log('q (particle charge) = ' + format(q)) // 1 C -console.log('F (force) = q (v cross B) = ' + format(F)) // [0 N, 0 N, -1 N] - -/** - * Helper function to output a value in the console. Value will be formatted. - * @param {*} value - */ -function print (value) { - console.log(format(value)) -} - -/** - * Helper function to format an output a value. - * @param {*} value - * @return {string} Returns the formatted value - */ -function format (value) { - const precision = 14 - return _format(value, precision) -} - -``` - - - diff --git a/googlea47c4a0b36d11021.html b/googlea47c4a0b36d11021.html deleted file mode 100644 index 9ac6df3dd9..0000000000 --- a/googlea47c4a0b36d11021.html +++ /dev/null @@ -1 +0,0 @@ -google-site-verification: googlea47c4a0b36d11021.html \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index afb2dcc8f0..0000000000 --- a/gulpfile.js +++ /dev/null @@ -1,335 +0,0 @@ -var fs = require('fs'); -var path = require('path'); -var zlib = require('zlib'); -var { globSync } = require('glob'); -var { rimraf } = require('rimraf'); -var gulp = require('gulp'); -var log = require('fancy-log'); -var replace = require('gulp-replace'); -var rename = require('gulp-rename'); -var header = require('gulp-header'); -var handlebars = require('handlebars'); - -var DEP_MATHJS = './node_modules/mathjs' -var DEP_MATHJS_SRC = './mathjs-src' -var LIB_SRC = DEP_MATHJS + '/lib/browser/*'; -var LIB_DEST = './js/lib'; -var DOCS_SRC = DEP_MATHJS_SRC + '/docs/**/*.md'; -var DOCS_DEST = './docs'; -var EXAMPLES_SRC = DEP_MATHJS_SRC + '/examples/**/*'; -var EXAMPLES_DEST = './examples'; -var HISTORY_SRC = DEP_MATHJS_SRC + '/HISTORY.md'; -var HISTORY_DEST = '.'; -var MATHJS = LIB_DEST + '/math.js'; -var DOWNLOAD = './download.md'; - -var MD_HEADER = - '---\n' + - 'layout: default\n' + - '---\n' + - '\n'; - -var EXAMPLE_TEMPLATE = MD_HEADER + - '# {{title}}\n\n' + - '{{#each files}}' + - 'File: [{{url}}]({{url}}){{#if_eq type "html"}} (click for a live demo){{/if_eq}}\n\n' + - '```{{type}}\n' + - '{{{code}}}' + - '\n```\n\n' + - '{{/each}}' + - '\n\n'; - -var INDEX_TEMPLATE = MD_HEADER + - '# Examples\n\n' + - '{{#each files}}' + - '- [{{title}}]({{url}})\n' + - '{{/each}}' + - '\n' + - '\n' + - '# Browser examples\n\n' + - '{{#each browserFiles}}' + - '- [{{title}}]({{url}})\n' + - '{{/each}}' + - '\n' + - '\n' + - '# Advanced examples\n\n' + - '{{#each advancedFiles}}' + - '- [{{title}}]({{url}})\n' + - '{{/each}}' + - '\n' + - '\n' + - '\n\n'; - -// source: https://stackoverflow.com/questions/15088215/handlebars-js-if-block-helper -handlebars.registerHelper('if_eq', function(a, b, opts) { - if(a === b) - return opts.fn(this); - else - return opts.inverse(this); -}); - -// get version of math.js -function version() { - return require('mathjs/package.json').version; -} - -// inject permalinks in markdown files in a gulp pipe -var fn = function (header, level, title) { - // for example: - // header is '## My Header', - // level is '##', - // title is 'My Header' - var tag = 'h' + level.length; // for example 'h2' - var id = title.toLowerCase() // for example 'my-header' - .replace(/[^\w\s]/g, '') - .replace(/\s/g, '-'); - var link = '#'; // clickable link to header - - // returns for example '

My Header #

' - return '<' + tag + ' id="' + id + '">' + title + ' ' + link + ''; -}; -var injectPermalinks = replace(/^(#+) (.*)$/mg, fn); -var injectPermalinks2 = replace(/^(#+) (.*)$/mg, fn); -var injectClickableIssueTags = replace(/([ (])(#(\d+))/mg, function (match, pre, tag, number) { - return pre + '' + tag + '' -}); -var injectClickableUserTags = replace(/ (@([0-9a-zA-Z_-]+))/mg, function (match, tag, username) { - return ' ' + tag + '' -}); - -/** - * Verify whether we have the same version numbers in both mathjs and mathjs-src - * - * The mathjs library itself is purely used to validate whether the library - * is published and whether we've an up-to-date version of the master branch - * with the source code. - */ -gulp.task('verify', function (cb) { - const mathjsVersion = require(DEP_MATHJS + '/package.json').version; - const mathjsSrcVersion = require(DEP_MATHJS_SRC + '/package.json').version; - - if (mathjsVersion !== mathjsSrcVersion) { - throw new Error('Version numbers of mathjs and mathjs-src do not correspond'+ - `(mathjs: ${mathjsVersion}, mathjs-src: ${mathjsSrcVersion})`); - } - - cb(); -}); - -/** - * copy math.js - */ -gulp.task('copy', function () { - return gulp.src(LIB_SRC) - .pipe(gulp.dest(LIB_DEST)); -}); - -/** - * Clean all examples and docs - */ -gulp.task('clean', async function () { - await rimraf(DOCS_DEST); - await rimraf(EXAMPLES_DEST); -}); - -/** - * Import docs and preprocess them for the static HTML web page: - * - Add a markdown header containing the layout page - * - Replace internal links to other markdown documents with *.html - */ -gulp.task('docs', function () { - return gulp.src(DOCS_SRC) - .pipe(replace(/HISTORY.md/g, 'history.html')) // change links to history.md to lowercase - .pipe(replace(/(\([\w\./]*).md([)#])/g, '$1.html$2')) // replace urls to *.md with *.html - .pipe(injectPermalinks) // create headers with an id - .pipe(header(MD_HEADER)) // add banner with markdown layout - .pipe(gulp.dest(DOCS_DEST)); -}); - -/** - * Copy all examples - */ -gulp.task('copyExamples', function () { - // TODO: make these script replacements more robust - var script = 'https://unpkg.com/mathjs@' + version() + '/lib/browser/math.js'; - console.log('copy examples', version(), { url: script }) - return gulp.src(EXAMPLES_SRC) - .pipe(replace(/src=".*lib\/browser\/math.js"/, 'src="' + script + '"')) - .pipe(replace(/'.*lib\/browser\/math.js'/, "'" + script + "'")) - .pipe(replace("from '../lib/esm/index.js'", "from 'mathjs'")) - .pipe(replace("from '../../lib/esm/index.js'", "from 'mathjs'")) - .pipe(replace("from '../../lib/esm/number.js'", "from 'mathjs/number'")) - .pipe(gulp.dest(EXAMPLES_DEST)); -}); - -/** - * Create markdown pages for every example - */ -gulp.task('markdownExamples', function (cb) { - var template = handlebars.compile(EXAMPLE_TEMPLATE); - - function createPage (files, title, url) { - if (!Array.isArray(files)) { - files = [files]; - } - - var page = template({ - title: title, // for example 'Basic usage' - files: files - .sort(function (a, b) { - if (path.basename(a) == 'index.js' || path.basename(a) == 'index.html') return -1; - if (path.basename(b) == 'index.js' || path.basename(b) == 'index.html') return 1; - return 0; - }) - .map(function (file) { - return { - url: path.basename(file), // for example 'basic_usage.js' - type: path.extname(file).substring(1), // for example 'js' - code: fs.readFileSync(file) // the actual code contents - }; - }) - }); - - // TODO: inject permalinks - - fs.writeFileSync(url, page); - } - - function generate(pattern, callback) { - const files = globSync(EXAMPLES_DEST + '/' + pattern) - - files.sort(); - - var results = files.map(function (file) { - var isDir = fs.statSync(file).isDirectory(); - var extension = path.extname(file); - var title = path.basename(file, extension) // filename without extension - .replace(/^\w/g, function (c) { // replace first character with upper case letter - return c.toUpperCase(); - }) - .replace(/_/g, ' '); // replace underscores with spaces - - if (isDir) { - var files = fs.readdirSync(file).map(function (f) { - return file + '/' + f; - }); - file = file + '/index'; - createPage(files, title, file + '.md'); - } - else { - createPage(file, title, file + '.md'); - } - - return { - title: title, // for example 'Basic usage' - url: path.relative(EXAMPLES_DEST, file + '.html') // for example 'basic_usage.js.html' - }; - }); - - callback(results); - } - - // TODO: write a more generic script for this - generate('*.js', function (files) { - generate('browser/*', function (browserFiles) { - generate('advanced/*', function (advancedFiles) { - // create an index page - var template = handlebars.compile(INDEX_TEMPLATE); - var page = template({ - files: files, - browserFiles: browserFiles, - advancedFiles: advancedFiles - }); - // TODO: inject permalinks - - fs.writeFileSync(EXAMPLES_DEST + '/index.md', page); - - cb(); - }); - }); - }); -}); - -/** - * Copy and preprocess the history file - */ -gulp.task('history', function () { - return gulp.src(HISTORY_SRC) - .pipe(header(MD_HEADER)) // add header with markdown layout - .pipe(injectClickableIssueTags) // must be done before injectPermalinks - .pipe(injectClickableUserTags) // must be done before injectPermalinks - .pipe(injectPermalinks2) - .pipe(rename('history.md')) // rename to lower case - .pipe(gulp.dest(HISTORY_DEST)); -}); - -/** - * Update size and version number on the downloads page - */ -gulp.task('version', function (cb) { - // get (gzipped) bundle size - function productionSize(callback) { - fs.readFile(MATHJS, function (err, data) { - if (!err) { - zlib.gzip(data, function (err, data) { - if (!err) { - var size = Math.round(data.length / 1024) + ' kB'; - callback(null, size) - } - else { - callback(err); - } - }); - } - else { - callback(err); - } - }); - } - - // update version and library sizes in index.md - function updateVersion(productionSize, callback) { - log('bundle size: ' + productionSize); - log('version: ' + version()); - - fs.readFile(DOWNLOAD, function (err, data) { - if (!err) { - data = String(data); - - // replace version - data = data.replace(/\(version [0-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT)?,/g, '(version ' + version() + ','); - data = data.replace(/\/[0-9]+\.[0-9]+\.[0-9]+?(-SNAPSHOT)?\//g, '/' + version() + '/'); - data = data.replace(/\/mathjs@[0-9]+\.[0-9]+\.[0-9]+?(-SNAPSHOT)?\//g, '/mathjs@' + version() + '/'); - - // replace bundle size - data = data.replace(/([\w\s]*)<\/span>/g, - '' + productionSize + ''); - - fs.writeFile(DOWNLOAD, data, callback); - } - else { - callback(err); - } - }); - } - - productionSize(function (err, prodSize) { - if (prodSize) { - updateVersion(prodSize, cb); - } - else { - cb(new Error('Failed to calculate development size or production size')); - } - }); -}); - -gulp.task('default', gulp.series( - 'verify', - 'clean', - 'copy', - 'docs', - 'copyExamples', - 'markdownExamples', - 'history', - 'version' -)); diff --git a/history.md b/history.md deleted file mode 100644 index 8e2236ae23..0000000000 --- a/history.md +++ /dev/null @@ -1,3090 +0,0 @@ ---- -layout: default ---- - -

History #

- -

2025-05-30, 14.5.2 #

- -- Fix: add embedded docs for the deprecated physical constant `coulomb`, - see #3472. -- Fix: #3469 add `ResultSet` interface and improve `isResultSet` typing - (#3481). Thanks @ranidam. - -

2025-05-28, 14.5.1 #

- -- Fix: #3482 mathjs throwing an error related to `BigInt` when loading in - specific environments. -- Fix: syntax section of function `numeric` (see #3448). -- Fix: #3472 rename physical constant `coulomb` to `coulombConstant`. The old - name is still available for backward compatibility. -- Fix: support multiplication of arrays with units (#3456). Thanks @Delaney. - -

2025-05-21, 14.5.0 #

- -- Feat: improve the performance of the `map` and `forEach` methods of - `DenseMatrix` (#3446). Thanks @dvd101x. -- Feat: improve the performance of `subset` (#3467). Thanks @dvd101x. -- Feat: define embedded docs for `compile`, `evaluate`, `parse`, and `parser`, - and add tests for the examples in embedded docs (#3413). Thanks @dvd101x. -- Fix: #3450 support multiplication of valueless units by arbitrary types - (#3454). -- Fix: #3474 correctly parse `(lbf in)` (#3476). Thanks @costerwi. - -

2025-03-28, 14.4.0 #

- -- Feat: improve the performance of function `flatten` (#3400). Thanks @dvd101x. -- Feat: improve the performance of `map` and `forEach` (#3409). - Thanks @dvd101x. -- Feat: add LaTeX representation for fractions (#3434, #3419). Thanks @orelbn. -- Fix: #3422 allow dot operators after symbol E (#3425). -- Fix: issue in the `nthRoots` latex function template string (#3427). - Thanks @aitee. -- Fix: upgrade to the latest version of `@babel/runtime`. - -

2025-03-06, 14.3.1 #

- -- Fix: #3350 cannot import a constant that is a complex number. - -

2025-02-28, 14.3.0 #

- -- Feat: improved performance of function `flatten` (#3354). Thanks @dvd101x. -- Feat: improved performance of `DenseMatrix` Symbol.iterator (#3395). - Thanks @dvd101x. -- Feat: improved performance of functions `map` and `forEach` (#3399). - Thanks @dvd101x. -- Fix: #3390 issue in callback optimization and add error handling for invalid - argument types (#3394). Thanks @dvd101x. -- Fix: #3356 add missing eigsDependencies export to TypeScript definitions - (#3397). Thanks @porst17. -- Fix: #3406 infer the correct type for multi-dimensional arrays in function - `multiply` (#3408). Thanks @orelbn. -- Fix: #3387 use utility `math.isNaN` for consistent `max` and `min` results - (#3389). Thanks @orelbn. - -

2025-02-05, 14.2.1 #

- -- Fix: #3377 remove redundant dependency `@lambdatest/node-tunnel`. - -

2025-01-30, 14.2.0 #

- -- Feat: #3041, #3340 rename `apply` to `mapSlices` (#3357). Function - `apply` is still available but is now marked deprecated. Thanks @gwhitney. -- Fix: #3247 don't override type-native floor/ceil within tolerance of value - (#3369). Thanks @gwhitney. -- Fix: #3360 add bigint support to matrix indices and ranges (#3361). - Thanks @gwhitney. -- Fix: #3115 type definitions for matrixFrom* (#3371). Thanks @Hudsxn - and @gwhitney. - -

2025-01-24, 14.1.0 #

- -- Feat: implement `bigint` support in functions `log`, `log2`, `log10`, - `larger`, `smaller`, `max`, `min` (#3345). Thanks @gwhitney. -- Fix: #3342 hexadecimal input not turned into a `bigint` (#3348). -- Fix `randomInt()` not working (#3345). -- Docs: fixed description of `sign` in the embedded docs (#3338). - Thanks @witer33. - -

2024-12-11, 14.0.1 #

- -- Fix: make derivative much faster (#3322). Thanks @paulftw. -- Fix: #3317 export `Fraction` type from the `fraction.js` library instead of - using a custom interface (#3330). Thanks @fchu. - -

2024-11-20, 14.0.0 #

- -!!! BE CAREFUL: BREAKING CHANGES !!! - -- Feat: Upgrade to `fraction.js@5`, using `bigint` under the hood (#3283). -- Feat: Implement support for `Unit` in functions `ceil`, `floor`, and `fix`. - Possible breaking changes in the type definitions of arrays and matrices - due to the introduction of generics (#3269). Thanks @orelbn. -- Feat: Implement support for `log(x: Fraction, base: Fraction)`. -- Fix: #3301 precedence of `%` (mod) being higher than `*` and `/` (#3311). - Thanks @nkumawat34. -- Fix: #3222 prevent `math.import(...)` from overriding units unless you - specify `{ override: true }` (#3225). -- Fix: #3219 let functions `dotDivide`, `dotPow`, `bitXor`, `xor`, `equal`, - `larger`, `largerEq`, `smaller`, `smallerEq`, and `unequal` return a sparse - matrix when the input is two sparse matrices (#3307). Thanks @Aakash-Rana. -- Fix: Improve type definitions of arrays (#3306). Thanks @orelbn. - -

2024-11-20, 13.2.3 #

- -- Fix: #3260 improve type definitions and documentation on the callback - indices of `map`, `filter`, and `forEach`. -- Fix: #3323 support functions in function `clone`. -- Docs: fix a broken link in the documentation (#3316). - Thanks @emmanuel-ferdman. - -

2024-11-13, 13.2.2 #

- -- Fix: #1455 implicit multiplication of a fraction with unit `in` is incorrect - (#3315). Thanks @nkumawat34. - -

2024-11-06, 13.2.1 #

- -- Update to the latest version of `complex.js`. -- Fix `Index.dimension(dim)` accepting non-numeric input. -- Fix: #3290 should validate variables names in method `Parser.set` (#3308). - Thanks @nkumawat34. - -

2024-10-02, 13.2.0 #

- -- Feat: improve performance of functions `map`, `filter` and `forEach` (#3256). - Thanks @dvd101x. -- Feat: improve performance of the methods `map()` and `forEach()` - of `DenseMatrix` (#3251). Thanks @Galm007. -- Fix: #3253 cannot use identifiers containing special characters in function - `derivative`. -- Fix: improve the type definitions of `ConstantNode` to support all data - types (#3257). Thanks @smith120bh. -- Fix: #3259 function `symbolicEqual` missing in the TypeScript definitions. -- Fix: #3246 function `leafCount` missing in the TypeScript definitions. -- Fix: #3267 implicit multiplication with a negative number and unit `in`. -- Docs: fix broken links on the Configuration page. Thanks @vassudanagunta. -- Docs: document the syntax of `map` and `forEach` in the expression parser - (#3272). Thanks @dvd101x. - -

2024-08-27, 13.1.1 #

- -- Fix security vulnerability in the CLI and web API allowing to call functions - `import`, `createUnit` and `reviver`, allowing to get access to the internal - math namespace and allowing arbitrary code execution. Thanks @StarlightPWN. -- Fix security vulnerability: when overwriting a `rawArgs` function with a - non-`rawArgs` function, it was still called with raw arguments. This was both - a functional issue and a security issue. Thanks @StarlightPWN. -- Fix security vulnerability: ensure that `ObjectWrappingMap` cannot delete - unsafe properties. Thanks @StarlightPWN. -- Fix: not being able to use methods and properties on arrays inside the - expression parser. - -

2024-08-26, 13.1.0 #

- -- Feat: support multiple inputs in function `map` (#3228, #3196). - Thanks @dvd101x. -- Feat: add matrix datatypes in more cases (#3235). Thanks @dvd101x. -- Feat: export util functions `isMap`, `isPartitionedMap`, and - `isObjectWrappingMap`. -- Fix: #3241 function `map` not always working with matrices (#3242). - Thanks @dvd101x. -- Fix: #3244 fix broken link to `ResultSet` in the docs about classes. -- Docs: add a link to the documentation page about the syntax expression - from the function `evaluate` (see #3238). -- Docs: improve the documentation of `scope` and fix the example - `custom_scope_objects.js` (#3150) -- Docs: spelling fixes in the embedded docs (#3252). Thanks @dvd101x. - -

2024-07-19, 13.0.3 #

- -- Fix: #3232 fix type definitions of function `format` to support notations - `hex`, `bin`, and `oct`. -- Fix: use more precise definitions for US liquid volume units (#3229). - Thanks @Vistinum. -- Fix: #2286 types static methods and members for Unit class (#3230). - Thanks @orelbn. - -

2024-07-04, 13.0.2 #

- -- Fix an error in the type definitions of `quantileSeq` (#3223). - Thanks @domdomegg. - -

2024-06-28, 13.0.1 #

- -- Fix: #3227 generated bundle containing `catch` blocks without parameters. -- Fix: #2348 update type definitions of the `Parser` methods (#3226). - Thanks @orelbn. - -

2024-05-31, 13.0.0 #

- -Breaking changes: - -- Change `isZero`, `isPositive`, and `isNegative` to respect `config.epsilon` - (#3139, #2838). Thanks @dvd101x. -- Change the behavior of the internal `nearlyEqual` to align with Python and - Julia (#3152, #2838). Thanks @dvd101x. -- Upgrade to `fraction.js@4.3.7`, - see . -- Dropped support for JavaScript engines that do not fully support ES6 or - `bigint`, or are not actively maintained. ES2020 is now the minimum required - EcmaScript version. - -Non-breaking changes: - -- Implemented support for `bigint` (#3207, #3207) -- Implemented a new config option `config.numberFallback` needed for `bigint` - (#3207). -- Internal: refactored tooling to ES modules and upgraded all devDependencies. - -

2024-05-31, 12.4.3 #

- -- Fix: serialization of Units without a value, see #1240. -- Fix: outdated, incorrect documentation about the order of precedence for - operator modulus `%`. See #3189. -- Fix: #3197 improve `quantileSeq` type definitions (#3198). Thanks @domdomegg. - -

2024-04-24, 12.4.2 #

- -- Fix #3192: function `isNaN` returns `false` for `NaN` units in a matrix or - array (#3193). Thanks @lgerin. -- Fix: #3180 fix type definitions of functions `add` and `multiply` to allow - more than two arguments. -- Docs: correct the docs about `traverse` returning void (#3177). - Thanks @rohildshah. - -

2024-03-13, 12.4.1 #

- -- Docs: implement an interactive version of the Lorenz example, and show the - chart full screen (#3151). Thanks @dvd101x. -- Fix #3172: simplify `"true and true"`. -- Fix #3163: `toTex` wrongly returning `Infinity` for large BigNumbers. -- Fix #3162: add license information about CSParse (#3164). -- Fix #3175: cannot delete units using `math.Unit.deleteUnit`. -- Fix: faster startup time of the CLI and REPL by loading the bundle. -- Fix: remove using polyfill.io inside the example - `pretty_printing_with_mathjax.html` (#3167). Thanks @SukkaW. - -

2024-02-22, 12.4.0 #

- -- Feat: implement support for trailing commas in matrices (#3154, #2968). - Thanks @dvd101x. -- Feat: improve the performance of `multiply` a lot by adding matrix type - inferencing (#3149). Thanks @RandomGamingDev. -- Fix: #3100 function `round` not handling round-off errors (#3136). - Thanks @BrianFugate. -- Fix: `PartitionedMap` and `ObjectWrappingMap` missing a property - `Symbol.iterator`, causing problems when trying `new Map(scope)` (#3156). -- Fix: type definitions of function `mode` (#3153). Thanks @rich-martinez. -- Docs: describe method `getAllAsMap` in the Parser docs (#3158, #3157). - Thanks @dvd101x. - -

2024-02-08, 12.3.2 #

- -- Improved the performance of custom defined functions in the expression - parser (#3150). -- Fix: #3143 cannot use `and` and `or` inside a function definition. - Regression since `v12.1.0` (#3150). - -

2024-02-01, 12.3.1 #

- -- Improved the typings of the arguments of `ArrayNode`, `FunctionNode`, - `IndexNode`, `OperatorNode`, and `RelationalNode` (#3123). Thanks @sylee957. -- Added a fully featured code editor example with CodeMirror and Katex (#3027). - Thanks @dvd101x. -- Fix: #3114 build warnings related to a number of wrong `/* #__PURE__ */` - annotations. -- Fix: #3142 support BigNumber values for the options of function `format`: - `precision`, `wordSize`, `lowerExp`, `upperExp`. Support BigNumber values - for the option `wordSize` in the functions `hex`, `bin`, and `oct`. -- Fix: #3125 type definitions of function `hypot` (#3144). - Thanks @silentmissile. -- Fix: #3141 `help(config)` altering the actual `config` when evaluating the - examples. -- Docs: #3145 fix documentation about REPL, it does require a build step - nowadays. - -

2024-01-12, 12.3.0 #

- -- Implement support new metric prefixes: `ronna` (`R`), `quetta` (`Q`), - `ronto` (`r`), and `quecto` (`q`) (#3113, #3112). Thanks @AlexEdgcomb. -- Fix a bug converting a unitless unit (#3117). Thanks @costerwi. -- Fix: #3097 `toSI()` wrongly converting `degC` (#3118). Thanks @costerwi. - -

2023-12-20, 12.2.1 #

- -- Fix #3109: method `Node.toHTML` not accepting a custom `handler`. - -

2023-12-08, 12.2.0 #

- -- Feat: lazy evaluation of operators `and`, `or`, `&`, `|` (#3090, #3101, - #2766). Thanks @smith120bh. -- Fix: passing a 4th argument with a scope to raw functions. -- Fix: #3096 embedded docs of eigs throwing an error. - -

2023-11-17, 12.1.0 #

- -- Feat: Extend function `round` with support for units (#2761, #3095). -- Feat: Extend function `mod` with support for negative divisors in when - using `BigNumber` or `Fraction` (#3087). -- Fix: #3092 a typo in an error message when converting a string into a number. -- Fix: #3094 function `derivative` mutates the input expression when it fails. - -

2023-10-26, 12.0.0 #

- -Breaking changes: - -- Fix #2879, #2927, #3014: change the confusing interface of `eigs` (#3037), - thanks @gwhitney. - 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 (#3079, #2919). - - 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 - #2980, #2987). -- Drop official support for Node.js 14 and 16. - -Features: - -- Function `eigs` now has an option to turn off calculation of eigenvectors - (#3057, #2180). Thanks @gwhitney. - -Fixes: - -- Find eigenvectors of defective matrices (#3037). Thanks @gwhitney. - -

2023-10-26, 11.12.0 #

- -- Implemented function `subtractScalar` (#3081, #2643), thanks @vrushaket. -- Fix #3073: function format not escaping control characters and double - quotes (#3082). -- Fix: function `clone` not throwing an error when passing an unsupported - type like a function. -- Fix: #2960 add type definition of function `symbolicEqual` (#3035), - thanks @juancodeaudio. - -

2023-10-11, 11.11.2 #

- -- Fix #3025: improve handling of matrices and error handling - in function `corr` (#3030). Thanks @vrushaket. -- Fix #3074: improve error message when using function `max` in `derivative`. -- Fix #3073: fix parsing quotes inside a string. -- Fix #2027: cannot use named operators like `to` or `mod` as property name. - -

2023-09-20, 11.11.1 #

- -- Fix #2989: use one-based indices in `print` in the parser (#3009). - Thanks @dvd101x. -- Fix #2936: `mod` sometimes giving wrong results due to internal round-off - errors (#3011). Thanks @praisennamonu1. -- Internal refactor of `quantileSeq`, and fixed the embedded help (#3003). - Thanks @dvd101x. -- Updated dependencies and devDependencies. - -

2023-09-05, 11.11.0 #

- -- Implement function `corr` to calculate the correlation between two matrices - (#3015, #2624). Thanks @vrushaket. -- Lock `fraction.js` at version `4.3.4` for now, see #3024, 3022, - . - -

2023-08-31, 11.10.1 #

- -- Upgrade to `fraction.js@4.3.4`, see #3022. -- Fix #3020: `lruQueue` using the global `hasOwnProperty` which may be - polluted. -- Add support for prefixes for the unit `erg`, and restrict prefixes of the - unit `joule` to only long prefixes like `kilo` and no short prefixes - like `k` (#3019). Thanks @costerwi. -- Add a new browser example `examples/browser/lorenz.html` that uses `solveODE` - and plots the result in a chart (#3018). Thanks @dvd101x. - -

2023-08-23, 11.10.0 #

- -- Extend function `quantileSeq` with support for a `dimension` (#3002). - Thanks @dvd101x. -- Implement #2735: Support indexing with an array of booleans, for - example `a[[true, false, true]]` and `a[a > 2]` (#2994). Thanks @dvd101x. -- Implement function `zeta` (#2950, #2975, #2904). Thanks @Bobingstern. -- Fix #2990: `DenseMatrix` can mutate input arrays (#2991). - -

2023-07-24, 11.9.1 #

- -- Fix a security vulnerability in `FunctionNode` and `SymbolNode` allowing - arbitrary code execution via `math.evaluate`. Thanks Harry Chen. -- Fix #3001: mathjs bundle containing `new Function(...)` (CSP issue). - -

2023-07-19, 11.9.0 #

- -- Implement function `solveODE` (#2958). Thanks @dvd101x. -- Implement functions `zpk2tf` and `freqz` (#2988, #2969). Thanks @alykhaled. -- Implement support for units in function `range` (#2997). Thanks @dvd101x. -- Fix #2974: `simplify` puts plus and minus signs next to each other (#2981). - Thanks @MaybePixem. -- Fix #2973: fixes and improvements in the embedded docs (#2976). - Thanks @dvd101x. -- Fix #2996: two errors in the examples in the documentation about Expression - trees. -- Fix round-off errors near zero when converting temperatures (#2962). - Thanks @costerwi. -- Refactored function `range`, reducing the amount of code (#2995). - Thanks @dvd101x. - -

2023-06-20, 11.8.2 #

- -- Fix #2971: improve typings of statistics functions `min`, `max`, `mean`, - `median`, `mode`, `std`, `sum`, `prod`, `variance`. Fixes a regression - introduced in v11.8.1. -- Fix #2972: type definitions of `Unit.divide(Unit)` have a wrong return type. - -

2023-06-13, 11.8.1 #

- -- Fix #2964: issue in function `distance` when calculate the distance from - a point to a line (#2965). Thanks @Kiku-CN. -- Fix `math.format` not working correctly for `engineering` notation when using - BigNumbers and for `fixed` notation with `precision: 0` configured (#2956). - Thanks @mgreminger. -- Fix #2880: not possible to map cube root `cbrt`. -- Fix #2938: make the syntax description of all functions consistent in the - docs (#2941). Thanks @dvd101x. -- Fix #2954: improve the TypeScript definitions the return type of functions - `min` and `max` (#2955). Thanks @Maxim-Mazurok. -- Fix #2959: typo in an example in the docs. Thanks @kunalagrwl. -- Drop official support for Node.js 14, has reached end of life. - -

2023-04-03, 11.8.0 #

- -- Extended functions `fraction`, `bignumber`, and `number` with support for - units, see #2918 (#2926). -- Implemented aliases `amp` and `amps` for unit `ampere` (#2917). - Thanks @veggiesaurus. -- Improve TypeScript definitions of function `gcd` (#2922). Thanks @brunoSnoww. -- Fix #2923: improve docs of the function `distance` (#2924). Thanks @tmtron. - -

2023-03-15, 11.7.0 #

- -- Implement #2567: accept array as parameter for function `gcd` (#2878). - Thanks @jakubriegel. -- Fix #2908: improvements in the docs and examples of functions - `partitionSelect`, `diff`, `expm1`, `round`, `nthRoots`, `sign`, - `rigthArithShift`, `setIsSubset`, `setSize`, and the docs about units. - Thanks @tmtron. -- Fix #2907: determinant of empty matrix should be 1. -- Refactor index.d.ts by writing function declarations using a generic, - reducing a lot of repetition (#2913). Thanks @brunoSnoww. - -

2023-02-24, 11.6.0 #

- -- Implement broadcasting for the following functions and their corresponding - operator: `add`, `dotDivide`, `dotMultiply`, `dotPow`, `gcd`, `lcm`, `mod`, - `nthRoot`, `subtract`, `bitAnd`, `bitOr`, `bitXor`, `leftShift`, - `rightArithShift`, `rightLogShift`, `and`, `or`, `xor`, `compare`, - `compareText`, `equal`, `larger`, `largerEq`, `smaller`, `smallerEq`, - `unequal`, `atan2` and `to` (#2895, #2753). Thanks @dvd101x. -- Implement support for non-power-of-2 fft (#2900, #2577). Thanks @cyavictor88. -- Fix #2888: update type definitions of function `unit` to allow creating a - unit from a fraction or complex number. -- Fix #2892: an error in the examples of the embedded help of function `sort`. -- Fix #2891: functions `column` and `row` sometimes returning a scalar number. -- Fix #2896: define the fourth argument of function `intersect` as optional - in the TypeScript definitions. Thanks @wodndb. -- Fix: quantileSeq not accepting a matrix as second argument `prob` (see #2902). -- Fix broken examples in functions `to`, `distance`, `getMatrixDataType`, - `subset`, and `max` (see #2902). - -

2023-01-31, 11.5.1 #

- -- Add type definitions for function `rotationMatrix` (#2860). - Thanks @brunoSnoww. -- Add type signature for `lusolve(LUDecomposition, ...)` (#2864). - Thanks @evanmiller. -- Fix #2873: the rocket_trajectory_optimization.html example being partly - broken. Thanks @dvd101x. -- Fix #2871: coverage report broken (#2877). Thanks @bornova. -- Fix #2883: update documentation for stat functions, describe missing syntax. -- Fix #2884: fix examples in the embedded docs of function `pow` and some other - functions. -- Fix type definition of function `complex` for one numeric input (#2886), - thanks @ariymarkowitz. -- Fix type definitions of `map()` and `forEach()` (#2887), thanks @xiaohk. -- Fix #2606: improve type definitions of `dotMultiply`, `dotPow` and - `dotDivide` (#2890). Thanks @brunoSnoww. - -

2022-12-05, 11.5.0 #

- -- Improve `simplify` rule matches in non-commutative contexts (#2841). - Thanks @samueltlg. -- Simplify: add rules and restructure tests for non-commutative contexts - (#2847). Thanks @samueltlg. -- Fix function `reshape` mutating the input in case of a matrix (see #2854). -- Fix TypeScript types for `multiply()` with `number[]` and `number[][]` - (#2852). Thanks @hfhchan. - -

2022-11-18, 11.4.0 #

- -- Implemented more wildcards to describe rules for `simplify`, making it easier - for example to describe unary minus (#1915). Thanks @thatcomputerguy0101. -- Implemented functions `schur`, `sylvester`, and `lyap` (#2646). - Thanks @egidioln. -- Implemented function `polynomialRoot`, and use it in a benchmark (#2839). - Thanks @gwhitney. -- Fix #2825 partly: improve simplifying operations on constants in - non-commutative contexts (#2827). Thanks @samueltlg. -- Fix #2840: a bug in the docs and type definitions of `Node.traverse` and - `Node.forEach`, they do return `void`. - -

2022-11-07, 11.3.3 #

- -- Fix #2830: Prevent inserting zero values when creating a `SparseMatrix` from a - `DenseMatrix` (#2836). Thanks @AlexandreAlvesDB. -- Fix #2835: a regression in the type definitions of `FunctionNode`, introduced - in `v11.3.2`. See #2733. Thanks @dsteve. - -

2022-10-25, 11.3.2 #

- -- Add generics to remaining Node type definitions (#2733). Thanks @mattvague. -- Allow unit prefixes for (absolute) temperatures `kelvin`, `rankine`, - `celsius`, and `fahrenheit` (#2824). Thanks @jfeist - -

2022-10-19, 11.3.1 #

- -- Fix #2809: code completion issues in some IDE's (#2812). -- Fix #2818: throw an error when a function assignment has duplicate - parameter names (#2819). -- Update `decimal.js` to version `10.4.2`. - -

2022-10-11, 11.3.0 #

- -- Allow creating new subclasses of `Node` in TypeScript (#2772). - Note that this disables being able to narrow MathNodes by using the `.type` - property. Use typeguards like `isOperatorNode(...)` instead (see #2810). - Thanks @mattvague. -- Fix #2793: `flatten()` cloning entries of array/Matrix (#2799). -- Fix #2627: TypeScript definitions of `pinv` missing (#2804). - Thanks @HanchaiN. -- Update dependencies to `decimal.js@10.4.1`. - -

2022-09-13, 11.2.1 #

- -- Fix doc generator being broken, not generating a function reference. - -

2022-09-12, 11.2.0 #

- -- Implement function `isRelationalNode` (#2731). Thanks @isaacbyr. -- Added missing types `'largerEq'` and `'or'` in `OperatorNodeMap` in the - TypeScript definitions. Thanks @ajinkyac03. -- Fixed typos in min func type defs (#2768). Thanks @mabdullahadeel. -- Improved the TypeScript definitions for `pickRandom`. Thanks @mattvague. -- Fixed documentation of unit `min` which means `minutes`, not `minim` (#2773). - Thanks @jasonhornsby. - -

2022-08-23, 11.1.0 #

- -- Add Unit constructor from value and pure (valueless) Unit (#2628). - Thanks @costerwi -- Fix #2144: `examples/advanced/custom_loading.js` was broken. -- Fix JSON `replacer` function missing in the TypeScript definitions. - Thanks @mattvague. -- Update dependencies to `typed-function@4.1.0` and `decimal.js@10.4.0`. - -

2022-07-25, version 11.0.1 #

- -- Fix #2632: TypeScript issue of `simplifyConstant` and `simplifyCore` - not having a return type defined. - -

2022-07-23, version 11.0.0 #

- -!!! BE CAREFUL: BREAKING CHANGES !!! - -Breaking changes: - -- Dropped official support for IE11. -- Upgraded to `typed-function@3`, see [josdejong/typed-function/HISTORY.md](https://github.com/josdejong/typed-function/blob/develop/HISTORY.md#2022-05-12-version-300). Thanks @gwhitney. Most importantly: - - Conversions now have preference over `any`. - - The `this` variable is no longer bound to the typed function itself. - - The properties `typed.types`, `typed.conversions`, and `typed.ignore` - have been removed. - - There are new static functions available like `typed.referTo`, - `typed.referToSelf`, `typed.addTypes`, `typed.addConversions`. -- Implement amended "Rule 2" for implicit multiplication (#2370, #2460): - when having a division followed by an implicit multiplication, the division - gets higher precedence over the implicit multiplication when (a) the - numerator is a constant with optionally a prefix operator (`-`, `+`, `~`), - and (b) the denominator is a constant. For example: formerly `-1 / 2 x` was - interpreted as `-1 / (2 * x)` and now it is interpreted as `(-1 / 2) * x`. - Thanks @gwhitney. -- Drop elementwise matrix support for trigonometric functions, exp, log, gamma, - square, sqrt, cube, and cbrt to prevent confusion with standard matrix - functions (#2440, #2465). Instead, use `math.map(matrix, fn)`. - Thanks @gwhitney. -- Simplify: convert equivalent function calls into operators, for example, - `add(2, x)` will now be simplified into `2 + x` (#2415, #2466). - Thanks @gwhitney. -- Removed the automatic conversion from `number` to `string` (#2482). - Thanks @gwhitney. -- Fix #2412: let function `diff` return an empty matrix when the input contains - only one element (#2422). -- Internal refactoring in the `simplifyCore` logic (#2490, #2484, #2459). - The function `simplifyCore` will no longer (partially) merge constants, that - behavior has been moved to `simplifyConstant`. The combination of - `simplifyConstant` and `simplifyCore` is still close to the old behavior - of `simplifyCore`, but there are some differences. To reproduce the same - behavior as the old `simplifyCore`, you can use - `math.simplify(expr, [math.simplifyCore, math.simplifyConstant])`. - Thanks to the refactoring, `simplify` is more thorough in reducing constants. - Thanks @gwhitney. -- Disable support for splitting rest parameters in chained calculations - (#2485, #2474). For example: `math.chain(3).max(4, 2).done()` will now throw - an error rather than return `4`, because the rest parameter of - `math.max(...number)` has been split between the contents of the chain and - the arguments to the max call. Thanks @gwhitney. -- Function `typeOf` now returns `function` (lowercase) for a function instead - of `Function` (#2560). Thanks @gwhitney. - -Non-breaking changes: - -- Fix #2600: improve the TypeScript definitions of `simplify`. - Thanks @laureen-m and @mattvague. -- Fix #2607: improve type definition of `createUnit`. Thanks @egziko. -- Fix #2608: clarify the docs on the need to configure a smaller `epsilon` - when using BigNumbers. -- Fix #2613: describe matrix methods `get` and `set` in the docs. -- Fix link to `math.rationalize` in the docs (#2616). Thanks @nukisman. -- Fix #2621: add TypeScript definitions for `count` (#2622). Thanks @Hansuku. -- Improved TypeScript definitions of `multiply` (#2623). Thanks @Windrill. - -

2022-06-28, version 10.6.4 #

- -- Improve TypeScript definitions of the `factory` function, thanks @mattvague. - -

2022-06-24, version 10.6.3 #

- -- Revert the TypeScript definition fixes for `factory` applied in `v10.6.2`, - they give some complications. - -

2022-06-24, version 10.6.2 #

- -- Improve TypeScript definitions of `ParenthesisNode`. Thanks @mattvague. -- Change the TypeScript definition of `MathNodeCommon['type']` into a less - strict string, so it is possible to extend with new Node classes. - Thanks @mattvague. -- Improve TypeScript definitions of the `factory` function, thanks @mattvague. - -

2022-05-31, version 10.6.1 #

- -- Improve the TypeScript types For `OperatorNode`: you can now define generic - types like `OperatorNode<'+', 'add'>`. Thanks @mattvague. - -

2022-05-24, version 10.6.0 #

- -- Implementation of Fourier transform functions `fft` and `ifft` (#2540). - Thanks @HanchaiN. -- Fix TypeScript types not being listed in the exported fields (#2569). - Thanks @mattvague. -- Large improvements in TypeScript definitions for chained expressions (#2537). - Thanks @mattvague. -- Fix #2571: improve TypeScript definition of functions `clone` and `cloneDeep` - (#2572). Thanks @mattvague. -- Fix the first argument of `derivative` holding the expression not correctly - being converted when using `.toTex()` (#2564). Thanks @mattvague. - -

2022-05-11, version 10.5.3 #

- -- Fix #2337: npm package containing examples and docs to solve security - vulnerabilities being reported on the examples and their dependencies. -- Fix core, construction, and some other functions missing in docs. -- Drop official support for Node.js 12 which has reached its end of life. - -

2022-05-09, version 10.5.2 #

- -- Fix #2553: `@types/mocha` defined in `dependencies` instead of - `devDependencies`, causing problems in projects that use a different version - of this dependency. Thanks @Kolahzary. -- Fix #2550: remove `examples/node_modules` folder from the npm package. -- Fix #2528: improve contribution guidelines (#2548). -- Document `SymbolNode.onUndefinedSymbol` and - `FunctionNode.onUndefinedFunction`. - -

2022-05-02, version 10.5.1 #

- -- Fix #2526, #2529: improve TypeScript definitions of function `round`, `fix`, - `floor`, `ceil`, and `nthRoot`, and improved the number only implementations - of those functions (#2531, #2539). Thanks @simlaticak and @gwhitney. -- Fix #2532: matrix index symbol `end` not working when used inside - a sub-expression. -- Fix #2524: In generating AUTHORS list, ignore a list of specific commits - (e.g., to avoid spurious duplicates in list). (#2543) -- Add type definitions of function `resolve` (#2536). Thanks @mattvague. - -

2022-04-19, version 10.5.0 #

- -- Implement #1563: function `pinv`, Moore–Penrose inverse (#2521). - Thanks @HanchaiN. -- Optimize function `det` for integers by switching to the Bareiss algorithm: - no more round-off errors for integer input (#2516). Thanks @HanchaiN. -- Implement #2463: allow negative integer powers of invertible square matrices - (#2517). Thanks @HanchaiN. -- Implement the `lgamma` function (defined as log(gamma(z))) for number and - Complex types. Supersedes #320. (#2417). Thanks @yifanwww. -- Fix #2523: update to the latest complex.js to improve `sin(z)` for small - `im(z)` (#2525). Thanks @gwhitney. -- Fix #2526: update TypeScript definition of `ceil` (#2531). Thanks @simlaticak -- Change mocha reporter to 'dot' to avoid excessively long log files. (#2520) - -

2022-04-08, version 10.4.3 #

- -- Fix #2508: improve the precision of stirlingS2 (#2509). Thanks @gwhitney. -- Fix #2514: implement optional argument `base` in the number implementation - of function `log` (#2515). Thanks @gwhitney. -- Improve the documentation on operator `;` (#2512). Thanks @gwhitney. - -

2022-03-29, version 10.4.2 #

- -- Fix #2499: different behavior for unit conversion "degC" and "K" (#2501). - Also disables getting the sign for units with an offset, which is ambiguous. - Thanks @gwhitney. -- Fix #2503: fix an issue in `log()` for complex numbers in which the imaginary - part is much larger in absolute value than the real part, fixed in - `complex.js@2.1.0` (#2505), thanks @gwhitney, @infusion. -- Fix #2493: unclear error message when an entity that is not a function - is being called as a function (#2494). Thanks @gwhitney. -- Some fixes in the docs on units (#2498). Thanks @dvd101x. -- Add `forEach` example in embedded docs (#2507). Thanks @dvd101x. -- Correct approx.deepEqual() to accept an epsilon argument giving the - comparison tolerance. It was already being called this way, but was - silently ignoring the tolerance. Thanks @yifanwww. - -

2022-03-23, version 10.4.1 #

- -- Improve TypeScript definitions for function `unit` (#2479). - Thanks @SinanAkkoyun. -- Add tests for type declarations (#2448). Thanks @samestep. -- Further improvement to TypeScript definitions of `std` and `variance` - (make dimension parameter optional, #2474). Thanks @NattapongSiri. -- Next step (as per #2431) for full publication of "is" functions like - `isMatrix` etc: Provide TypeScript definitions of "is" functions and - make them type guards. (#2432). Thanks @ChristopherChudzicki. -- Fix #2491: Multi line object expressions don't work with comments (#2492). - Thanks @gwhitney. -- Fix #2478: a bug in calculating the eigenvectors when dealing with complex - numbers (#2496). Thanks @gwhitney. -- Update project dependencies and devDependencies. - -

2022-03-07, version 10.4.0 #

- -- Fix #2461: make sure `simplifyCore` recurses over all binary nodes (#2462). - Thanks @gwhitney. -- Fix #2429: fix the TypeScript definitions of functions `std` and `variance` - (#2455). Thanks @NattapongSiri. -- Fix #1633: implement a `cumsum` function generating cumulative sums of a list - of values or a matrix. (#1870). Thanks @hjonasson. -- Upgrade to the latest version of `Fraction.js`, having more strict input, - only accepting an integer numerator and denominator. See #2427. -- Fix typo in documentation example for `format`. (#2468) Thanks @abranhe. -- Write unit tests for all jsdoc examples. See #2452. Thanks @gwhitney. - -

2021-03-02, version 10.3.0 #

- -- Fix #1260: implement function `symbolicEqual` (#2424). Thanks @gwhitney. -- Fix #2441, #2442: support passing a function as argument to functions created - in the expression parser (#2443). Thanks @gwhitney. -- Fix #2325: improve documentation of subset indices (#2446). Thanks @gwhitney. -- Fix #2439: fix a bug in `complexEigs` in which real-valued norms were - inadvertently being typed as complex numbers (#2445). Thanks @gwhitney. -- Fix #2436: improve documentation and error message of function `map` (#2457). - Thanks @gwhitney. - -

2022-03-01, version 10.2.0 #

- -- Implemented context options to control simplifications allowed in `simplify`, - see #2399, #2391. Thanks @gwhitney. -- Implemented function `leafCount` as a first simple measure of the complexity - of an expression, see #2411, #2389. Thanks @gwhitney. -- Fix #2413: improve `combinations` to return an integer result without rounding - errors for larger values, see #2414. Thanks @gwhitney. -- Fix #2385: function `rotate` missing in TypeScript definitions. - Thanks @DIVYA-19. -- Fix #2450: Add BigNumber to parameter type in `math.unit` and add TypeScript - types for `Unit.simplify` and `Unit.units` (#2353). Thanks @joshhansen. -- Fix #2383: detect infinite loops in `simplify` (#2405). Thanks @gwhitney. -- Fix #1423: collect like factors and cancel like terms in sums (#2388). - Thanks @gwhitney. - -

2022-02-02, version 10.1.1 #

- -- Improvements and fixes in function `simplify`, thanks @gwhitney: - - Fix #2393: regression bug in `simplify('2-(x+1)')`. - - Ad option `consoleDebug` to `simplify` to see what is going on. -- Fix TypeScript definition of `ConfigOptions`, which was missing option - `predictable`. - -

2022-01-15, version 10.1.0 #

- -- Implemented function `invmod`, see #2368, #1744. Thanks @thetazero. -- Improvements and fixes in function `simplify`, thanks @gwhitney: - - Fix #1179, #1290: improve collection of non-constant like terms (#2384). - - Fix #2152: do not transform strings into numbers (#2372). - - Fix #1913: implement support for array and object simplification (#2382). -- Fix #2379: add embedded documentation for function `print`. -- Remove broken example from the embedded documentation of function `forEach`. - -

2021-12-29, version 10.0.2 #

- -- Fix #2156: simplify expressions like `-1 / (-x)` to `1/x`. Thanks @ony3000. -- Fix #2363: remove a redundant part of the regex to split a number. -- Fix #2291: add support for fractions in function `intersect`. - Thanks @thetazero. -- Fix #2358: bug in `SparseMatrix` when replacing a subset of a matrix with - a non-consecutive index. Thanks @Al-0. - -

2021-12-22, version 10.0.1 #

- -- Fix #1681: function `gamma` giving inaccurate complex results in some cases. - Thanks @kmdrGroch. -- Fixed a typo in an example, see #2366. Thanks @blackwindforce. - -

2021-11-03, version 10.0.0 #

- -!!! BE CAREFUL: BREAKING CHANGES IN THE TYPESCRIPT DEFINITIONS !!! - -- Improvements to the Typescript typings (commit fc5c202e). - Thanks @joshhansen. First introduced in v9.5.1, but reverted because - it contains breaking changes. - - Breaking changes: interface `MathNode` is now renamed to `MathNodeCommon` - and the related interfaces are structured in a different way. - -- Fixed a typo in the TypeScript definition of toHTML. Thanks @TheToto. - -

2021-11-03, version 9.5.2` #

- -- Revert the improvements to the Typescript typings because they contain - breaking changes. The improvements will be published in v10.0.0. See #2339. - -

2021-10-13, version 9.5.1 #

- -- Various improvements to the Typescript typings. - Thanks @joshhansen and @DianaTdr. - -

2021-09-22, version 9.5.0 #

- -- Implemented support for calculations with percentage, see #2303. - Thanks @rvramesh. -- Fix #2319: make the API of `Parser.evaluate` consistent with `math.evaluate`: - support a list with expressions as input. -- Improved documentation of function `setCartesian`. Thanks @fieldfoxWim. - -

2021-09-15, version 9.4.5 #

- -- Improved the performance of `Node.equals` by improving the internal - function `deepStrictEqual`. Thanks @tomlarkworthy. -- Fixes in the TypeScript definitions: - - Define `hasNumericValue`. Thanks @write2kcl. - - Define `MathNode.isRelationalNode`. Thanks @m93a. - - Fix typo in `MathNode.isConditionalNode`. Thanks @m93a. - -

2021-07-07, version 9.4.4 #

- -- Fixed `ArrayNode.toTex()`: remove the row delimiter on the last row, - see #2267. Thanks @davidtranhq. -- Fix #2269: `intersect` not returning `null` for matrix input. Thanks @m93a. -- Fix #2245: mathjs not working in IE11 anymore due to a missing polyfill for - `Symbol`. The browser bundle now includes the necessary polyfills (it is - larger now because of that, see also #2266). Thanks @m93a. -- Update dependencies (`complex.js@2.0.15`, `decimal.js@10.3.1`) -- Drop official support for node.js 10, which has reached end of life. - See #2258. - -

2021-06-23, version 9.4.3 #

- -- Fix #2222: mathjs polluting the `Decimal` prototype. Thanks @m93a. -- Fix #2253: expression parser throwing an error when accessing nested object - properties named `e`. -- Fixes in the TypeScript definitions: - - function `floor`, #2159, #2246. Thanks @write2kcl. - - function `simplify`, see #2252. Thanks @nitroin. -- Upgraded to `decimal.js@10.3.0` - -

2021-06-05, version 9.4.2 #

- -- Implemented iterative eigenvalue finder for `eigs`, making it much more - robust. See #2179, #2237. Thanks @m93a. -- Improved TypeScript definitions of function `parse`. Thanks @OpportunityLiu. - -

2021-05-24, version 9.4.1 #

- -- Fix #2100: add TypeScript declaration for `eigs`. Thanks @andrebianchessi. -- Fix #2220: add TypeScript files to published npm package. Thanks @dhritzkiv. -- Update readme regarding TypeScript definition files. Thanks @dhritzkiv. -- Update to `fraction.js@4.1.1` - -

2021-05-16, version 9.4.0 #

- -- Implemented support to use objects with a `Map` interface as scope, - see #2143, #2166. Thanks @jhugman. -- Extend `eigs` to support general complex matrices, see #1741. Thanks @m93a. -- DenseMatrix and SparseMatrix are now iterable, see #1184. Thanks @m93a. -- Implemented utility functions `matrixFromRows`, `matrixFromColumns`, and - `matrixFromFunction`, see #2155, #2153. Thanks @m93a. -- Added TypeScript definitions to the project, making it redundant to install - `@types/mathjs`, and making it easier to improve the definitions. See #2187, - #2192. Thanks @CatsMiaow. -- Upgraded dependencies - - `complex.js@2.0.13` (fixing #2211). Thanks @infusion - - `fraction.js@4.1.0` (`pow` now supporting rational exponents). -- Fix #2174: function `pickRandom` having no name. Thanks @HK-SHAO. -- Fix #2019: VSCode auto import keeps adding import { null } from 'mathjs'. -- Fix #2185: Fix TypeScript definition of unit division, which can also return - a number. -- Fix #2123: add type definitions for functions `row` and `column`. -- Fix some files not exposed in the package, see #2213. Thanks @javiermarinros. - -

2021-04-12, version 9.3.2 #

- -- Fix #2169: mathjs requesting `@babel/runtime` dependency. - Regression introduced in `v9.3.1`. - -

2021-04-10, version 9.3.1 #

- -- Fix #2133: strongly improved the performance of `isPrime`, see #2139. - Thanks @Yaffle. -- Fix #2150: give a clear error "Error: Undefined function ..." instead when - evaluating a non-existing function. -- Fix #660: expose internal functions `FunctionNode.onUndefinedFunction(name)` - and `SymbolNode.onUndefinedSymbol(name)`, allowing to override the behavior. - By default, an Error is thrown. - -

2021-03-10, version 9.3.0 #

- -- Implemented support for parsing non decimal numbers with radix point, - see #2122, #2121. Thanks @clnhlzmn. -- Fix #2128: typo in docs of `luSolveAll` and `usolveAll`. - -

2021-02-03, version 9.2.0 #

- -- Implemented function `count` to count the total elements in a matrix, - see #2085. Thanks @Josef37. -- Fix #2096: cleanup old reference to external dependency `crypto`. -- Some refactoring in the code to remove duplications, see #2093. - Thanks @Josef37. - -

2021-01-27, version 9.1.0 #

- -- Extended function `reshape` with support for a wildcard `-1` to automatically - calculate the remaining size, like `reshape([1, 2, 3, 4, 5, 6], [-1, 2])` - which will output `[[0, 1], [2, 3], [4, 5]]`. See #2075. Thanks @Josef37. -- Fix #2087: function `simplify` ignores second argument of `log`, for example - in `simplify('log(e, 9)')` . Thanks @quentintruong. - -

2021-01-16, version 9.0.0 #

- -- Improved support for bin, hex, and oct literals. See #1996. Thanks @clnhlzmn. - - **Breaking change**: parse literals with prefixes `0b`, `0c`, and `0x` are - now unsigned by default. To parse them as signed, you have to specify a - suffix specifying the word size such as `i16` or `i32`. - - Function `format` now supports more notations: `bin`, 'hex', and `oct`, - for example `format(255, {notation: "hex"})`. - - The functions `format`, `bin`, `hex`, `oct` now allow specifying a wordSize, - like `bin(10, 32)` and `format(10, {notation: "bin", wordSize: 32})`. - - BigNumber support for the bin, hex, and oct literals. -- Extended and improved the example rocket_trajectory_optimization.html. - Thanks @Josef37. - -

2020-12-30, version 8.1.1 #

- -- Improved the performance of parsing and evaluating units a lot, see #2065. - Thanks @flaviut. -- Upgraded dependency `fraction.js` to `v4.0.13`. -- Moved continuous integration testing from Travis CI to Github Workflow, - see #2024, #2041. Thanks @harrysarson. - -

2020-12-04, version 8.1.0 #

- -- Implemented units `kilogramforce` (`kgf`). Thanks @rnd-debug. -- Fix #2026: Implement a new option `fractionsLimit` for function `simplify`, - defaulting to `Infinity`. -- Improved the documentation of function `clone`. Thanks @redbar0n. - -

2020-11-09, version 8.0.1 #

- -- Fix #1979: missing "subset" dependency when using "mathjs/number" entry point. -- Fix #2022: update pretty printing with MathJax example to the latest version - of MathJax. Thanks @pkra. - -

2020-11-06, version 8.0.0 #

- -!!! BE CAREFUL: BREAKING CHANGES !!! - -- You can now use mathjs directly in node.js using ES modules without need for - a transpiler (see #1928, #1941, #1962). - Automatically loading either commonjs code or ES modules code is improved. - All generated code is moved under `/lib`: the browser bundle is moved from - `/dist` to `/lib/browser`, ES module files are moved to `/lib/esm`, - and commonjs files are moved to `/lib/cjs`. Thanks @GreenImp. -- Non-minified bundle `dist/math.js` is no longer provided. Either use the - minified bundle, or create a bundle yourself. -- Replaced random library `seed-random` with `seedrandom`, see #1955. - Thanks @poppinlp. -- Breaking changes in `pickRandom`, see #1990, #1976. - - Will no longer return the input matrix when the given number is greater - than the length of the provided possibles. Instead, the function always - returns results with the requested number of picks. - - Will now return a `Matrix` as output when input was a `Matrix`. - - Introduced a new syntax: - - ``` - math.pickRandom(array, { weights, number, elementWise }) - ``` - - - Introduced a new option `elementWise`, which is `true` by default. - When setting `elementWise` to false, an array containing arrays will return - random pick of arrays instead of the elements inside of the nested arrays. - -

2020-11-02, version 7.6.0 #

- -- Implemented function `rotate(w, theta)`. See #1992, #1160. Thanks @rnd-debug. -- Implemented support for custom characters in Units via `Unit.isValidAlpha`. - See #1663, #2000. Thanks @rnd-debug. - -

2020-10-10, version 7.5.1 #

- -- Fix object pollution vulnerability in `math.config`. Thanks Snyk. - -

2020-10-07, version 7.5.0 #

- -- Function `pickRandom` now allows randomly picking elements from matrices - with 2 or more dimensions instead of only from a vector, see #1974. - Thanks @KonradLinkowski. - -

2020-10-07, version 7.4.0 #

- -- Implemented support for passing a precision in functions `ceil`, `floor`, - and `fix`, similar to `round`, see #1967, #1901. Thanks @rnd-debug. -- Implemented function `rotationMatrix`, see #1160, #1984. Thanks @rnd-debug. -- Implement a clear error message when using `sqrtm` with a matrix having - more than two dimensions. Thanks @KonradLinkowski. -- Update dependency `decimal.js` to `10.2.1`. - -

2020-09-26, version 7.3.0 #

- -- Implemented functions `usolveAll` and `lsolveAll`, see #1916. Thanks @m93a. -- Implemented support for units in functions `std` and `variance`, see #1950. - Thanks @rnd-debug. -- Implemented support for binary, octal, and hexadecimal notation in the - expression parser, and implemented functions `bin`, `oct`, and `hex` for - formatting. Thanks @clnhlzmn. -- Fix #1964: inconsistent calculation of negative dividend modulo for - `BigNumber` and `Fraction`. Thanks @ovk. - -

2020-08-24, version 7.2.0 #

- -- Implemented new function `diff`, see #1634, #1920. Thanks @Veeloxfire. -- Implemented support for norm 2 for matrices in function `norm`. - Thanks @rnd-debug. - -

2020-07-13, version 7.1.0 #

- -- Implement support for recursion (self-referencing) of typed-functions, - new in `typed-function@2.0.0`. This fixes #1885: functions which where - extended with a new data type did not always work. Thanks @nickewing. -- Fix #1899: documentation on expression trees still using old namespace - `math.expression.node.*` instead of `math.*`. - -

2020-06-24, version 7.0.2 #

- -- Fix #1882: have `DenseMatrix.resize` and `SparseMatrix.resize` accept - `DenseMatrix` and `SparseMatrix` as inputs too, not only `Array`. -- Fix functions `sum`, `prod`, `min`, and `max` not throwing a conversion error - when passing a single string, like `sum("abc")`. - -

2020-05-30, version 7.0.1 #

- -- Fix #1844: clarify the documentation of function `eigs`. Thanks @Lazersmoke. -- Fix #1855: Fix error in the documentation for `math.nthRoots(x)`. -- Fix #1856: make the library robust against Object prototype pollution. - -

2020-05-07, version 7.0.0 #

- -Breaking changes: - -- Improvements in calculation of the `dot` product of complex values. - The first argument is now conjugated. See #1761. Thanks @m93a. -- Dropped official support for Node.js v8 which has reached end of life. -- Removed all deprecation warnings introduced in v6. - To upgrade smoothly from v5 to v7 or higher, upgrade to v6 first - and resolve all deprecation warnings. - -

2020-05-04, version 6.6.5 #

- -- Fix #1834: value `Infinity` cannot be serialized and deserialized. - This is solved now with a new `math.replacer` function used as - `JSON.stringify(value, math.replacer)`. -- Fix #1842: value `Infinity` not turned into the latex symbol `\\infty`. - -

2020-04-15, version 6.6.4 #

- -- Fix published files containing Windows line endings (CRLF instead of LF). - -

2020-04-10, version 6.6.3 #

- -- Fix #1813: bug in engineering notation for numbers of function `format`, - sometimes resulting in needless trailing zeros. -- Fix #1808: methods `.toNumber()` and `.toNumeric()` not working on a - unitless unit. -- Fix #1645: not being able to use named operators `mod`, `and`, `not`, `or`, - `xor`, `to`, `in` as object keys. Thanks @Veeloxfire. -- Fix `eigs` not using `config.epsilon`. - -

2020-03-29, version 6.6.2 #

- -- Fix #1789: Function `eigs` not calculating with BigNumber precision - when input contains BigNumbers. -- Run the build script during npm `prepare`, so you can use the library - directly when installing directly from git. See #1751. Thanks @cinderblock. - -

2020-02-26, version 6.6.1 #

- -- Fix #1725: simplify `a/(b/c)`. Thanks @dbramwell. -- Fix examples in documentation of `row` and `column`. - -

2020-02-01, version 6.6.0 #

- -- Implemented function `eigs`, see #1705, #542 #1175. Thanks @arkajitmandal. -- Fixed #1727: validate matrix size when creating a `DenseMatrix` using - `fromJSON`. -- Fixed `DenseMatrix.map` copying the size and datatype from the original - matrix instead of checking the returned dimensions and type of the callback. -- Add a caret to dependencies (like) `^1.2.3`) to allow downstream updates - without having to await a new release of mathjs. - -

2020-01-08, version 6.5.0 #

- -- Implemented `baseName` option for `createUnit`, see #1707. - Thanks @ericman314. - -

2020-01-06, version 6.4.0 #

- -- Extended function `dimension` with support for n-dimensional points. - Thanks @Veeloxfire. - -

2019-12-31, version 6.3.0 #

- -- Improved performance of `factorial` for `BigNumber` up to a factor two, - see #1687. Thanks @kmdrGroch. - -

2019-11-20, version 6.2.5 #

- -- Fixed `IndexNode` using a hardcoded, one-based implementation of `index`, - making it impossible to instantiate a zero-based version of the expression - parser. See #782. - -

2019-11-20, version 6.2.4 #

- -- Fixed #1669: function 'qr' threw an error if the pivot was zero, - thanks @kevinkelleher12 and @harrysarson. -- Resolves #942: remove misleading assert in 'qr'. Thanks @harrysarson. -- Work around a bug in complex.js where `sign(0)` returns complex NaN. - Thanks @harrysarson. - -

2019-10-06, version 6.2.3 #

- -- Fixed #1640: function `mean` not working for units. Thanks @clintonc. -- Fixed #1639: function `min` listed twice in the "See also" section of the - embedded docs of function `std`. -- Improved performance of `isPrime`, see #1641. Thanks @arguiot. - -

2019-09-23, version 6.2.2 #

- -- Fixed methods `map` and `clone` not copying the `dotNotation` property of - `IndexNode`. Thanks @rianmcguire. -- Fixed a typo in the documentation of `toHTML`. Thanks @maytanthegeek. -- Fixed #1615: error in the docs of `isNumeric`. -- Fixed #1628: Cannot call methods on empty strings or numbers with value `0`. - -

2019-08-31, version 6.2.1 #

- -- Fixed #1606: function `format` not working for expressions. - -

2019-08-28, version 6.2.0 #

- -- Improved performance of `combinationsWithRep`. Thanks @waseemyusuf. -- Add unit aliases `bit` and `byte`. -- Fix docs referring to `bit` and `byte` instead of `bits` and `bytes`. -- Updated dependency `typed-function@1.1.1`. - -

2019-08-17, version 6.1.0 #

- -- Implemented function `combinationsWithRep` (see #1329). Thanks @waseemyusuf. - -

2019-08-05, version 6.0.4 #

- -- Fixed #1554, #1565: ES Modules where not transpiled to ES5, giving issues on - old browsers. Thanks @mockdeep for helping to find a solution. - -

2019-07-07, version 6.0.3 #

- -- Add `unpkg` and `jsdelivr` fields in package.json pointing to UMD build. - Thanks @tmcw. -- Fix #1550: nested user defined function not receiving variables of an - outer user defined function. - -

2019-06-11, version 6.0.2 #

- -- Fix not being able to set configuration after disabling function `import` - (regression since v6.0.0). - -

2019-06-09, version 6.0.1 #

- -- Fix function reference not published in npm library. -- Fix function `evaluate` and `parse` missing in generated docs. - -

2019-06-08, version 6.0.0 #

- -!!! BE CAREFUL: BREAKING CHANGES !!! - -

Most notable changes #

- -1. Full support for **ES modules**. Support for tree-shaking out of the box. - - Load all functions: - - ```js - import * as math from 'mathjs' - ``` - - Use a few functions: - - ```js - import { add, multiply } from 'mathjs' - ``` - - Load all functions with custom configuration: - - ```js - import { create, all } from 'mathjs' - const config = { number: 'BigNumber' } - const math = create(all, config) - ``` - - Load a few functions with custom configuration: - - ```js - import { create, addDependencies, multiplyDependencies } from 'mathjs' - const config = { number: 'BigNumber' } - const { add, multiply } = create({ - addDependencies, - multiplyDependencies - }, config) - ``` - -2. Support for **lightweight, number-only** implementations of all functions: - - ``` - import { add, multiply } from 'mathjs/number' - ``` - -3. New **dependency injection** solution used under the hood. - -

Breaking changes #

- -- Node 6 is no longer supported. - -- Functions `config` and `import` are not available anymore in the global - context: - - ```js - // v5 - import * as mathjs from 'mathjs' - mathjs.config(...) // error in v6.0.0 - mathjs.import(...) // error in v6.0.0 - ``` - - Instead, create your own mathjs instance and pass config and imports - there: - - ```js - // v6 - import { create, all } from 'mathjs' - const config = { number: 'BigNumber' } - const mathjs = create(all, config) - mathjs.import(...) - ``` - -- Renamed function `typeof` to `typeOf`, `var` to `variance`, - and `eval` to `evaluate`. (the old function names are reserved keywords - which can not be used as a variable name). -- Deprecated the `Matrix.storage` function. Use `math.matrix` instead to create - a matrix. -- Deprecated function `math.expression.parse`, use `math.parse` instead. - Was used before for example to customize supported characters by replacing - `math.parse.isAlpha`. -- Moved all classes like `math.type.Unit` and `math.expression.Parser` to - `math.Unit` and `math.Parser` respectively. -- Fixed #1428: transform iterating over replaced nodes. New behavior - is that it stops iterating when a node is replaced. -- Dropped support for renaming factory functions when importing them. -- Dropped fake BigNumber support of function `erf`. -- Removed all index.js files used to load specific functions instead of all, like: - - ``` - // v5 - // ... set up empty instance of mathjs, then load a set of functions: - math.import(require('mathjs/lib/function/arithmetic')) - ``` - - Individual functions are now loaded simply like: - - ```js - // v6 - import { add, multiply } from 'mathjs' - ``` - - To set a specific configuration on the functions: - - ```js - // v6 - import { create, addDependencies, multiplyDependencies } from 'mathjs' - const config = { number: 'BigNumber' } - const math = create({ addDependencies, multiplyDependencies }, config) - ``` - - See example `advanced/custom_loading.js`. - -- Updated the values of all physical units to their latest official values. - See #1529. Thanks @ericman314. - -

Non breaking changes #

- -- Implemented units `t`, `tonne`, `bel`, `decibel`, `dB`, and prefixes - for `candela`. Thanks @mcvladthegoat. -- Fixed `epsilon` setting being applied globally to Complex numbers. -- Fix `math.simplify('add(2, 3)')` throwing an error. -- Fix #1530: number formatting first applied `lowerExp` and `upperExp` - and after that rounded the value instead of the other way around. -- Fix #1473: remove `'use strict'` in every file, not needed anymore. - -

2019-05-18, version 5.10.3 #

- -- Fixed dependency `del` being a dependency instead of devDependency. - -

2019-05-18, version 5.10.2 #

- -- Fix #1515, #1516, #1517: broken package due to a naming conflict in - the build folder of a util file `typeOf.js` and `typeof.js`. - Solved by properly cleaning all build folders before building. - -

2019-05-17, version 5.10.1 #

- -- Fix #1512: format using notation `engineering` can give wrong results - when the value has less significant digits than the number of digits in - the output. - -

2019-05-08, version 5.10.0 #

- -- Fix `lib/header.js` not having filled in date and version. Thanks @kevjin. -- Upgraded dependency `decimal.js@10.2.0`, fixing an issue on node.js 12. - -

2019-04-08, version 5.9.0 #

- -- Implemented functions `row` and `column` (see #1413). Thanks @SzechuanSage. -- Fixed #1459: `engineering` notation of function `format` not available - for `BigNumber`. -- Fixed #1465: `node.toHTML()` not correct for unary operators like - `factorial`. - -

2019-03-20, version 5.8.0 #

- -- Implemented new function `apply`. Thanks @bnlcas. -- Implemented passing an optional `dimension` argument to `std` and `var`. - Thanks @bnlcas. - -

2019-03-10, version 5.7.0 #

- -- Implemented support for `pow()` in `derivative`. Thanks @sam-19. -- Gracefully handle round-off errors in fix, ceil, floor, and range - (Fixes #1429, see also #1434, #1432). Thanks @ericman314. - -

2019-03-02, version 5.6.0 #

- -- Upgrade decimal.js to v10.1.1 (#1421). -- Fixed #1418: missing whitespace when stringifying an expression - containing "not". - -

2019-02-20, version 5.5.0 #

- -- Fixed #1401: methods `map` and `forEach` of `SparseMatrix` not working - correctly when indexes are unordered. -- Fixed #1404: inconsistent rounding of negative numbers. -- Upgrade tiny-emitter to v2.1.0 (#1397). - -

2019-01-25, version 5.4.2 #

- -- Fixed `math.format` not working for BigNumbers with a precision above - 1025 digits (see #1385). Thanks @ericman314. -- Fixed incorrect LaTeX output of `RelationalNode`. Thanks @rianmcguire. -- Fixed a bug the methods `map`, `forEach`, `traverse`, and `transform` - of `FunctionNode`. - -

2019-01-10, version 5.4.1 #

- -- Fix #1378: negative bignumbers not formatted correctly. -- Upgrade fraction.js to version 4.0.12 (#1369). - -

2018-12-09, version 5.4.0 #

- -- Extended sum.js to accept a dimension input to calculate the sum over a - specific axis. Thanks @bnlcas. -- Fix #1328: objects can't be written multi-line. Thanks @GHolk. -- Remove side effects caused by `Unit.format` and `Unit.toString`, - making changes to the unit on execution. Thanks @ericman314. - -

2018-12-03, version 5.3.1 #

- -- Fixed #1336: Unit.toSI() returning units with prefix like `mm` instead - of `m`. Thanks @ericman314. - -

2018-11-29, version 5.3.0 #

- -- Implemented function `hasNumericValue`. Thanks @Sathish-kumar-Subramani. -- Fix #1326: non-ascii character in print.js. -- Fix #1337: `math.format` not working correctly with `{ precision: 0 }`. - Thanks @dkenul. - -

2018-10-30, version 5.2.3 #

- -- Fixed #1293: non-unicode characters in `escape-latex` giving issues in some - specific cases. Thanks @dangmai. -- Fixed incorrect LaTeX output of function `bitNot`, see #1299. Thanks @FSMaxB. -- Fixed #1304: function `pow` not supporting inputs `pow(Unit, BigNumber)`. -- Upgraded dependencies (`escape-latex@1.2.0`) - -

2018-10-23, version 5.2.2 #

- -- Fixed #1286: Fixed unit base recognition and formatting for - user-defined units. Thanks @ericman314. - -

2018-10-18, version 5.2.1 #

- -- Fixed unit `rod` being defined as `5.02921` instead of `5.0292`. - Thanks @ericman314. -- Upgraded dependencies (`fraction.js@4.0.10`) -- Upgraded devDependencies (`@babel/core@7.1.2`, `nyc@13.1.0`, - `webpack@4.21.0`). - -

2018-10-05, version 5.2.0 #

- -- Implemented support for chained conditionals like `10 < x <= 50`. - Thanks @ericman314. -- Add an example showing a proof of concept of using `BigInt` in mathjs. -- Fixed #1269: Bugfix for BigNumber divided by unit. Thanks @ericman314. -- Fixed #1240: allow units having just a value and no unit. - Thanks @ericman314. - -

2018-09-09, version 5.1.2 #

- -- Fixed a typo in the docs of `parse`. Thanks @mathiasvr. -- Fixed #1222: a typo in the docs of `subset`. -- Fixed #1236: `quantileSeq` has inconsistent return. -- Fixed #1237: norm sometimes returning a complex number instead of - number. -- Upgraded dependencies (`fraction.js@4.0.9`) -- Upgraded devDependencies (`babel@7`, `karma-webpack@3.0.4`, - `nyc@13.0.1`, `standard@12.0.0`, `uglify-js@3.4.9`, `webpack@4.17.2`) - -

2018-08-21, version 5.1.1 #

- -- Function `isNumeric` now recognizes more types. -- Fixed #1214: functions `sqrt`, `max`, `min`, `var`, `std`, `mode`, `mad`, - `median`, and `partitionSelect` not neatly handling `NaN` inputs. In some - cases (`median`, `mad`, and `partitionSelect`) this resulted in an infinite - loop. -- Upgraded dependencies (`escape-latex@1.1.1`) -- Upgraded devDependencies (`webpack@4.17.0`) - -

2018-08-12, version 5.1.0 #

- -- Implemented support for strings enclosed in single quotes. - Thanks @jean-emmanuel. -- Implemented function `getMatrixDataType`. Thanks @JasonShin. -- Implemented new `options` argument in `simplify`. Thanks @paulobuchsbaum. -- Bug fixes in `rationalize`, see #1173. Thanks @paulobuchsbaum. - -

2018-07-22, version 5.0.4 #

- -- Strongly improved the performance of functions `factorial` for numbers. - This improves performance of functions `gamma`, `permutation`, and - `combination` too. See #1170. Thanks @honeybar. -- Strongly improved the performance of function `reshape`, thanks to a - friend of @honeybar. - -

2018-07-14, version 5.0.3 #

- -- Fixed many functions (for example `add` and `subtract`) not working - with matrices having a `datatype` defined. -- Fixed #1147: bug in `format` with `engineering` notation in outputting - the correct number of significant figures. Thanks @ericman314. -- Fixed #1162: transform functions not being cleaned up when overriding - it by importing a factory function with the same name. -- Fixed broken links in the documentation. Thanks @stropitek. -- Refactored the code of `parse` into a functional approach. - Thanks @harrysarson. -- Changed `decimal.js` import to ES6. Thanks @weinshel. - -

2018-07-07, version 5.0.2 #

- -- Fixed #1136: rocket trajectory example broken (since v4.0.0). -- Fixed #1137: `simplify` unnecessarily replacing implicit multiplication with - explicit multiplication. -- Fixed #1146: `rationalize` throwing exceptions for some input with decimals. - Thanks @maruta. -- Fixed #1088: function arguments not being passed to `rawArgs` functions. -- Fixed advanced example `add_new_datatypes`. -- Fixed mathjs core constants not working without complex numbers. - Thanks @ChristopherChudzicki. -- Fixed a broken link in the documentation on units. Thanks @stropitek. -- Upgraded dependencies (`typed-function@1.0.4`, `complex.js@2.0.11`). -- Upgraded devDependencies (`babel-loader@7.1.5`, `uglify-js@3.4.3`, - `expr-eval@1.2.2`, `webpack@4.15.1`). - -

2018-07-01, version 5.0.1 #

- -- Improved error messaging when converting units. Thanks @gap777. -- Upgraded devDependencies (`kerma`, `uglify-js`, `webpack`). - -

2018-06-16, version 5.0.0 #

- -!!! BE CAREFUL: BREAKING CHANGES !!! - -- Implemented complex conjugate transpose `math.ctranspose`. See #1097. - Thanks @jackschmidt. -- Changed the behavior of `A'` (transpose) in the expression parser to - calculate the complex conjugate transpose. See #1097. Thanks @jackschmidt. -- Added support for `complex({abs: 1, arg: 1})`, and improved the docs on - complex numbers. Thanks @ssaket. -- Renamed `eye` to `identity`, see #1054. -- Math.js code can now contain ES6. The ES6 source code is moved from `lib` - to `src`, and `lib` now contains the compiled ES5 code. -- Upgraded dependencies: - - `decimal.js` from `9.0.1` to `10.0.1` - - Upgraded dev dependencies -- Changed code style to , run linter on `npm test`. - See #1110. -- Dropped support for bower. Use npm or an other package manages instead. -- Dropped support for (non-primitive) instances of `Number`, `Boolean`, and - `String` from functions `clone` and `typeof`. -- Dropped official support for IE9 (probably still works, but it's not tested). -- Fixed #851: More consistent behavior of sqrt, nthRoot, and pow. - Thanks @dakotablair. -- Fixed #1103: Calling `toTex` on node that contains `derivative` causing - an exception. Thanks @joelhoover. - -

2018-06-02, version 4.4.2 #

- -- Drastically improved the performance of `det`. Thanks @ericman314. -- Fixed #1065, #1121: Fixed wrong documentation of function - `compareNatural` and clarified the behavior for strings. -- Fixed #1122 a regression in function `inv` (since `v4.4.1`). - Thanks @ericman314. - -

2018-05-29, version 4.4.1 #

- -- Fixed #1109: a bug in `inv` when dealing with values close to zero. - Thanks @ericman314. - -

2018-05-28, version 4.4.0 #

- -- Implemented functions `equalText` and `compareText`. See #1085. - -

2018-05-21, version 4.3.0 #

- -- Implemented matrix exponential `math.expm`. Thanks @ericman314. -- Fixed #1101: math.js bundle not working when loading in a WebWorker. -- Upgraded dependencies - - `complex.js` from `v2.0.2` to `v2.0.10`. - - `fraction.js` from `v4.0.4` to `v4.0.8`. -- Upgraded devDependencies (`mocha`, `uglify-js`, `webpack`). - -

2018-05-05, version 4.2.2 #

- -- Fixed calculating the Frobenius norm of complex matrices correctly, - see #1098. Thanks @jackschmidt. -- Fixed #1076: cannot use mathjs in React VR by updating to - `escape-latex@1.0.3`. - -

2018-05-02, version 4.2.1 #

- -- Fixed `dist/math.js` being minified. - -

2018-05-02, version 4.2.0 #

- -- Implemented function `math.sqrtm`. Thanks @ferrolho. -- Implemented functions `math.log2`, `math.log1p`, and `math.expm1`. - Thanks @BigFav and @harrysarson. -- Fixed some unit tests broken on nodejs v10. -- Upgraded development dependencies. -- Dropped integration testing on nodejs v4. - -

2018-04-18, version 4.1.2 #

- -- Fixed #1082: implemented support for unit plurals `decades`, `centuries`, - and `millennia`. -- Fixed #1083: units `decade` and `watt` having a wrong name when stringifying. - Thanks @ericman314. - -

2018-04-11, version 4.1.1 #

- -- Fixed #1063: derivative not working when resolving a variable with unary - minus like `math.derivative('-x', 'x')`. - -

2018-04-08, version 4.1.0 #

- -- Extended function `math.print` with support for arrays and matrices. - Thanks @jean-emmanuel. -- Fixed #1077: Serialization/deserialization to JSON with reviver not being - supported by nodes. -- Fixed #1016: Extended `math.typeof` with support for `ResultSet` and nodes - like `SymbolNode`. -- Fixed #1072: Added support for long and short prefixes for the unit `bar` - (i.e. `millibar` and `mbar`). - -

2018-03-17, version 4.0.1 #

- -- Fixed #1062: mathjs not working on ES5 browsers like IE11 and Safari 9.3. -- Fixed #1061: `math.unit` not accepting input like `1/s`. - -

2018-02-25, version 4.0.0 #

- -!!! BE CAREFUL: BREAKING CHANGES !!! - -Breaking changes (see also #682): - -- **New expression compiler** - - The compiler of the expression parser is replaced with one that doesn't use - `eval` internally. See #1019. This means: - - - a slightly improved performance on most browsers. - - less risk of security exploits. - - the code of the new compiler is easier to understand, maintain, and debug. - - Breaking change here: When using custom nodes in the expression parser, - the syntax of `_compile` has changed. This is an undocumented feature though. - -- **Parsed expressions** - - - The class `ConstantNode` is changed such that it just holds a value - instead of holding a stringified value and it's type. - `ConstantNode(valueStr, valueType`) is now `ConstantNode(value)` - Stringification uses `math.format`, which may result in differently - formatted numeric output. - - - The constants `true`, `false`, `null`, `undefined`, `NaN`, `Infinity`, - and `uninitialized` are now parsed as ConstantNodes instead of - SymbolNodes in the expression parser. See #833. - -- **Implicit multiplication** - - - Changed the behavior of implicit multiplication to have higher - precedence than explicit multiplication and division, except in - a number of specific cases. This gives a more natural behavior - for implicit multiplications. For example `24h / 6h` now returns `4`, - whilst `1/2 kg` evaluates to `0.5 kg`. Thanks @ericman314. See: #792. - Detailed documentation: . - - - Immediately invoking a function returned by a function like `partialAdd(2)(3)` - is no longer supported, instead these expressions are evaluated as - an implicit multiplication `partialAdd(2) * (3)`. See #1035. - -- **String formatting** - - - In function `math.format`, the options `{exponential: {lower: number, upper: number}}` - (where `lower` and `upper` are values) are replaced with `{lowerExp: number, upperExp: number}` - (where `lowerExp` and `upperExp` are exponents). See #676. For example: - - ```js - math.format(2000, {exponential: {lower: 1e-2, upper: 1e2}}) - ``` - - is now: - - ```js - math.format(2000, {lowerExp: -2, upperExp: 2}) - ``` - - - In function `math.format`, the option `notation: 'fixed'` no longer rounds to - zero digits when no precision is specified: it leaves the digits as is. - See #676. - -- **String comparison** - - Changed the behavior of relational functions (`compare`, `equal`, - `equalScalar`, `larger`, `largerEq`, `smaller`, `smallerEq`, `unequal`) - to compare strings by their numeric value they contain instead of - alphabetically. This also impacts functions `deepEqual`, `sort`, `min`, - `max`, `median`, and `partitionSelect`. Use `compareNatural` if you - need to sort an array with text. See #680. - -- **Angle units** - - Changed `rad`, `deg`, and `grad` to have short prefixes, - and introduced `radian`, `degree`, and `gradian` and their plurals - having long prefixes. See #749. - -- **Null** - - - `null` is no longer implicitly casted to a number `0`, so input like - `math.add(2, null)` is no longer supported. See #830, #353. - - - Dropped constant `uninitialized`, which was used to initialize - leave new entries undefined when resizing a matrix is removed. - Use `undefined` instead to indicate entries that are not explicitly - set. See #833. - -- **New typed-function library** - - - The `typed-function` library used to check the input types - of functions is completely rewritten and doesn't use `eval` under - the hood anymore. This means a reduced security risk, and easier - to debug code. The API is the same, but error messages may differ - a bit. Performance is comparable but may differ in specific - use cases and browsers. - -Non breaking changes: - -- Thanks to the new expression compiler and `typed-function` implementation, - mathjs doesn't use JavaScript's `eval` anymore under the hood. - This allows using mathjs in environments with security restrictions. - See #401. -- Implemented additional methods `isUnary()` and `isBinary()` on - `OperatorNode`. See #1025. -- Improved error messages for statistical functions. -- Upgraded devDependencies. -- Fixed #1014: `derivative` silently dropping additional arguments - from operator nodes with more than two arguments. - -

2018-02-07, version 3.20.2 #

- -- Upgraded to `typed-function@0.10.7` (bug-fix release). -- Fixed option `implicit` not being copied from an `OperatorNode` - when applying function `map`. Thanks @HarrySarson. -- Fixed #995: spaces and underscores not property being escaped - in `toTex()`. Thanks @FSMaxB. - -

2018-01-17, version 3.20.1 #

- -- Fixed #1018: `simplifyCore` failing in some cases with parentheses. - Thanks @firepick1. - -

2018-01-14, version 3.20.0 #

- -- Implement support for 3 or more arguments for operators `+` and `*` in - `derivative`. Thanks @HarrySarson. See #1002. -- Fixed `simplify` evalution of `simplify` of functions with more than two - arguments wrongly: `simplify('f(x, y, z)') evaluated to`f(f(x, y), z)` - instead of `f(x, y, z)`. Thanks @joelhoover. -- Fixed `simplify` throwing an error in some cases when simplifying unknown - functions, for example `simplify('f(4)')`. Thanks @joelhoover. -- Fixed #1013: `simplify` wrongly simplifing some expressions containing unary - minus, like `0 - -x`. Thanks @joelhoover. -- Fixed an error in an example in the documentation of `xor`. Thanks @denisx. - -

2018-01-06, version 3.19.0 #

- -- Extended functions `distance` and `intersect` with support for BigNumbers. - Thanks @ovk. -- Improvements in function `simplify`: added a rule that allows combining - of like terms in embedded quantities. Thanks @joelhoover. - -

2017-12-28, version 3.18.1 #

- -- Fixed #998: An issue with simplifying an expression containing a subtraction. - Thanks @firepick1. - -

2017-12-16, version 3.18.0 #

- -- Implemented function `rationalize`. Thanks @paulobuchsbaum. -- Upgraded dependencies: - - ``` - 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. -- 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. -- Fixed #969: preven issues with yarn autoclean by renaming an - interally used folder "docs" to "embeddedDocs". - -

2017-11-18, version 3.17.0 #

- -- Improved `simplify` for nested exponentiations. Thanks @IvanVergiliev. -- Fixed a security issue in `typed-function` allowing arbitrary code execution - in the JavaScript engine by creating a typed function with JavaScript code - in the name. Thanks Masato Kinugawa. -- Fixed a security issue where forbidden properties like constructor could be - replaced by using unicode characters when creating an object. No known exploit, - but could possibly allow arbitrary code execution. Thanks Masato Kinugawa. - -

2017-10-18, version 3.16.5 #

- -- Fixed #954: Functions `add` and `multiply` not working when - passing three or more arrays or matrices. - -

2017-10-01, version 3.16.4 #

- -- Fixed #948, #949: function `simplify` returning wrong results or - running into an infinite recursive loop. Thanks @ericman314. -- Fixed many small issues in the embedded docs. Thanks @Schnark. - -

2017-08-28, version 3.16.3 #

- -- Fixed #934: Wrong simplification of unary minus. Thanks @firepick1. -- Fixed #933: function `simplify` reordering operations. Thanks @firepick1. -- Fixed #930: function `isNaN` returning wrong result for complex - numbers having just one of their parts (re/im) being `NaN`. -- Fixed #929: `FibonacciHeap.isEmpty` returning wrong result. - -

2017-08-20, version 3.16.2 #

- -- Fixed #924: a regression in `simplify` not accepting the signature - `simplify(expr, rules, scope)` anymore. Thanks @firepick1. -- Fixed missing parenthesis when stringifying expressions containing - implicit multiplications (see #922). Thanks @FSMaxB. - -

2017-08-12, version 3.16.1 #

- -- For security reasons, type checking is now done in a more strict - way using functions like `isComplex(x)` instead of duck type checking - like `x && x.isComplex === true`. -- Fixed #915: No access to property "name". -- Fixed #901: Simplify units when calling `unit.toNumeric()`. - Thanks @AlexanderBeyn. -- Fixed `toString` of a parsed expression tree containing an - immediately invoked function assignment not being wrapped in - parenthesis (for example `(f(x) = x^2)(4)`). - -

2017-08-06, version 3.16.0 #

- -- Significant performance improvements in `math.simplify`. - Thanks @firepick1. -- Improved API for `math.simplify`, optionally pass a scope with - variables which are resolved, see #907. Thanks @firepick1. -- Fixed #912: math.js didn't work on IE10 anymore (regression - since 3.15.0). - -

2017-07-29, version 3.15.0 #

- -- Added support for the dollar character `$` in symbol names (see #895). -- Allow objects with prototypes as scope again in the expression parser, - this was disabled for security reasons some time ago. See #888, #899. - Thanks @ThomasBrierley. -- Fixed #846: Issues in the functions `map`, `forEach`, and `filter` - when used in the expression parser: - - Not being able to use a function assignment as inline expression - for the callback function. - - Not being able to pass an inline expression as callback for `map` - and `forEach`. - - Index and original array/matrix not passed in `map` and `filter`. - -

2017-07-05, version 3.14.2 #

- -- Upgraded to `fraction.js@4.0.2` -- Fixed #891 using BigNumbers not working in browser environments. - -

2017-06-30, version 3.14.1 #

- -- Reverted to `fraction.js@4.0.0`, there is an issue with `4.0.1` - in the browser. - -

2017-06-30, version 3.14.0 #

- -- Implemented set methods `setCartesian`, `setDifference`, - `setDistinct`, `setIntersect`, `setIsSubset`, `setPowerset`, - `setSize`. Thanks @Nekomajin42. -- Implemented method `toHTML` on nodes. Thanks @Nekomajin42. -- Implemented `compareNatural` and `sort([...], 'natural')`. -- Upgraded dependencies to the latest versions: - - `complex.js@2.0.4` - - `decimal.js@7.2.3` - - `fraction.js@4.0.1` - - `tiny-emitter@2.0.0` - - And all devDependencies. -- Fixed #865: `splitUnit` can now deal with round-off errors. - Thanks @ericman314. -- Fixed #876: incorrect definition for unit `erg`. Thanks @pjhampton. -- More informative error message when using single quotes instead of - double quotes around a string. Thanks @HarrySarson. - -

2017-05-27, version 3.13.3 #

- -- Fixed a bug in function `intersection` of line and plane. - Thanks @viclai. -- Fixed security vulnerabilities. - -

2017-05-26, version 3.13.2 #

- -- Disabled function `chain` inside the expression parser for security - reasons (it's not needed there anyway). -- Fixed #856: function `subset` not returning non-primitive scalars - from Arrays correctly. (like `math.eval('arr[1]', {arr: [math.bignumber(2)]})`. -- Fixed #861: physical constants not available in the expression parser. - -

2017-05-12, version 3.13.1 #

- -- Fixed creating units with an alias not working within the expression - parser. -- Fixed security vulnerabilities. Thanks Sam. - -

2017-05-12, version 3.13.0 #

- -- Command line application can now evaluate inline expressions - like `mathjs 1+2`. Thanks @slavaGanzin. -- Function `derivative` now supports `abs`. Thanks @tetslee. -- Function `simplify` now supports BigNumbers. Thanks @tetslee. -- Prevent against endless loops in `simplify`. Thanks @tetslee. -- Fixed #813: function `simplify` converting small numbers to inexact - Fractions. Thanks @tetslee. -- Fixed #838: Function `simplify` now supports constants like `e`. - Thanks @tetslee. - -

2017-05-05, version 3.12.3 #

- -- Fixed security vulnerabilities. Thanks Dan and Sam. - -

2017-04-30, version 3.12.2 #

- -- Added a rocket trajectory optimization example. - -

2017-04-24, version 3.12.1 #

- -- Fixed #804 - - Improved handling of powers of `Infinity`. Thanks @HarrySarson. - - Fixed wrong formatting of complex NaN. -- Fixed security vulnerabilities in the expression parser. - Thanks Sam and Dan. - -

2017-04-17, version 3.12.0 #

- -- Implemented QR decomposition, function `math.qr`. Thanks @HarrySarson. -- Fixed #824: Calling `math.random()` freezes IE and node.js. - -

2017-04-08, version 3.11.5 #

- -- More security measures in the expression parser. - WARNING: the behavior of the expression parser is now more strict, - some undocumented features may not work any longer. - - Accessing and assigning properties is now only allowed on plain - objects, not on classes, arrays, and functions anymore. - - Accessing methods is restricted to a set of known, safe methods. - -

2017-04-03, version 3.11.4 #

- -- Fixed a security vulnerability in the expression parser. Thanks @xfix. - -

2017-04-03, version 3.11.3 #

- -- Fixed a security vulnerability in the expression parser. Thanks @xfix. - -

2017-04-03, version 3.11.2 #

- -- Fixed a security vulnerability in the expression parser. Thanks @xfix. - -

2017-04-02, version 3.11.1 #

- -- Fixed security vulnerabilities in the expression parser. - Thanks Joe Vennix and @xfix. - -

2017-04-02, version 3.11.0 #

- -- Implemented method Unit.toSI() to convert a unit to base SI units. - Thanks @ericman314. -- Fixed #821, #822: security vulnerabilities in the expression parser. - Thanks @comex and @xfix. - -

2017-03-31, version 3.10.3 #

- -- More security fixes related to the ones fixed in `v3.10.2`. - -

2017-03-31, version 3.10.2 #

- -- Fixed a security vulnerability in the expression parser allowing - execution of arbitrary JavaScript. Thanks @CapacitorSet and @denvit. - -

2017-03-26, version 3.10.1 #

- -- Fixed `xgcd` for negative values. Thanks @litmit. -- Fixed #807: function transform of existing functions not being removed when - overriding such a function. - -

2017-03-05, version 3.10.0 #

- -- Implemented function `reshape`. Thanks @patgrasso and @ericman314. -- Implemented configuration option `seedRandom` for deterministic random - numbers. Thanks @morsecodist. -- Small fixes in the docs. Thanks @HarrySarson. -- Dropped support for component package manager (which became deprecated about - one and a half year ago). - -

2017-02-22, version 3.9.3 #

- -- Fixed #797: issue with production builds of React Native projects. -- Fixed `math.round` not accepting inputs `NaN`, `Infinity`, `-Infinity`. -- Upgraded all dependencies. - -

2017-02-16, version 3.9.2 #

- -- Fixed #795: Parse error in case of a multi-line expression with just comments. - -

2017-02-06, version 3.9.1 #

- -- Fixed #789: Math.js not supporting conversion of `string` to `BigNumber`, - `Fraction`, or `Complex` number. -- Fixed #790: Expression parser did not pass function arguments of enclosing - functions via `scope` to functions having `rawArgs = true`. -- Small fixes in the docs. Thanks @HarrySarson. - -

2017-01-23, version 3.9.0 #

- -- Implemented support for algebra: powerful new functions `simplify` and - `derivative`. Thanks @ericman314, @tetslee, and @BigFav. -- Implemented Kronecker Product `kron`. Thanks @adamisntdead. -- Reverted `FunctionNode` not accepting a string as function name anymore. -- Fixed #765: `FunctionAssignmentNode.toString()` returning a string - incompatible with the function assignment syntax. - -

2016-12-15, version 3.8.1 #

- -- Implemented function `mad` (median absolute deviation). Thanks @ruhleder. -- Fixed #762: expression parser failing to invoke a function returned - by a function. - -

2016-11-18, version 3.8.0 #

- -- Functions `add` and `multiply` now accept more than two arguments. See #739. -- `OperatorNode` now supports more than two arguments. See #739. Thanks @FSMaxB. -- Implemented a method `Node.cloneDeep` for the expression nodes. See #745. -- Fixed a bug in `Node.clone()` not cloning implicit multiplication correctly. - Thanks @FSMaxB. -- Fixed #737: Improved algorithm determining the best prefix for units. - It will now retain the original unit like `1 cm` when close enough, - instead of returning `10 mm`. Thanks @ericman314. -- Fixed #732: Allow letter-like unicode characters like Ohm `\u2126`. -- Fixed #749: Units `rad`, `deg`, and `grad` can now have prefixes like `millirad`. -- Some fixes in the docs and comments of examples. Thanks @HarrySarson. - -

2016-11-05, version 3.7.0 #

- -- Implemented method `Node.equals(other)` for all nodes of the expression parser. -- Implemented BigNumber support in function `arg()`. -- Command Line Interface loads faster. -- Implicit conversions between Fractions and BigNumbers throw a neat error now - (See #710). - -

2016-10-21, version 3.6.0 #

- -- Implemented function `erf()`. THanks @patgrasso. -- Extended function `cross()` to support n-d vectors. Thanks @patgrasso. -- Extended function `pickRandom` with the option to pick multiple values from - an array and give the values weights: `pickRandom(possibles, number, weights)`. - Thanks @woylie. -- Parser now exposes test functions like `isAlpha` which can be replaced in - order to adjust the allowed characters in variables names (See #715). -- Fixed #727: Parser not throwing an error for invalid implicit multiplications - like `-2 2` and `2^3 4` (right after the second value of an operator). -- Fixed #688: Describe allowed variable names in the docs. - -

2016-09-21, version 3.5.3 #

- -- Some more fixes regarding numbers ending with a decimal mark (like `2.`). - -

2016-09-20, version 3.5.2 #

- -- Fixed numbers ending with a decimal mark (like `2.`) not being supported by - the parser, solved the underlying ambiguity in the parser. See #707, #711. - -

2016-09-12, version 3.5.1 #

- -- Removed a left over console.log statement. Thanks @eknkc. - -

2016-09-07, version 3.5.0 #

- -- Comments of expressions are are now stored in the parsed nodes. See #690. -- Fixed function `print` not accepting an Object with formatting options as - third parameter Thanks @ThomasBrierley. -- Fixed #707: The expression parser no longer accepts numbers ending with a dot - like `2.`. - -

2016-08-08, version 3.4.1 #

- -- Fixed broken bundle files (`dist/math.js`, `dist/math.min.js`). -- Fixed some layout issues in the function reference docs. - -

2016-08-07, version 3.4.0 #

- -- Implemented support for custom units using `createUnit`. Thanks @ericman314. -- Implemented function `splitUnits`. Thanks @ericman314. -- Implemented function `isPrime`. Thanks @MathBunny. - -

2016-07-05, version 3.3.0 #

- -- Implemented function `isNaN`. -- Function `math.filter` now passes three arguments to the callback function: - value, index, and array. -- Removed the check on the number of arguments from functions defined in the - expression parser (see #665). -- Fixed #665: functions `map`, `forEach`, and `filter` now invoke callbacks - which are a typed-function with the correct number of arguments. - -

2016-04-26, version 3.2.1 #

- -- Fixed #651: unable to perform calculations on "Unit-less" units. -- Fixed matrix.subset mutating the replacement matrix when unsqueezing it. - -

2016-04-16, version 3.2.0 #

- -- Implemented #644: method `Parser.getAll()` to retrieve all defined variables. -- Upgraded dependencies (decimal.js@5.0.8, fraction.js@3.3.1, - typed-function@0.10.4). -- Fixed #601: Issue with unnamed typed-functions by upgrading to - typed-function v0.10.4. -- Fixed #636: More strict `toTex` templates, reckon with number of arguments. -- Fixed #641: Bug in expression parser parsing implicit multiplication with - wrong precedence in specific cases. -- Fixed #645: Added documentation about `engineering` notation of function - `math.format`. - -

2016-04-03, version 3.1.4 #

- -- Using ES6 Math functions like `Math.sinh`, `Math.cbrt`, `Math.sign`, etc when - available. -- Fixed #631: unit aliases `weeks`, `months`, and `years` where missing. -- Fixed #632: problem with escaped backslashes at the end of strings. -- Fixed #635: `Node.toString` options where not passed to function arguments. -- Fixed #629: expression parser throws an error when passing a number with - decimal exponent instead of parsing them as implicit multiplication. -- Fixed #484, #555: inaccuracy of `math.sinh` for values between -1 and 1. -- Fixed #625: Unit `in` (`inch`) not always working due to ambiguity with - the operator `a in b` (alias of `a to b`). - -

2016-03-24, version 3.1.3 #

- -- Fix broken bundle. - -

2016-03-24, version 3.1.2 #

- -- Fix broken npm release. - -

2016-03-24, version 3.1.1 #

- -- Fixed #621: a bug in parsing implicit multiplications like `(2)(3)+4`. -- Fixed #623: `nthRoot` of zero with a negative root returned `0` instead of - `Infinity`. -- Throw an error when functions `min`, `max`, `mean`, or `median` are invoked - with multiple matrices as arguments (see #598). - -

2016-03-19, version 3.1.0 #

- -- Hide multiplication operator by default when outputting `toTex` and `toString` - for implicit multiplications. Implemented and option to output the operator. -- Implemented unit `kip` and alias `kips`. Thanks @hgupta9. -- Added support for prefixes for units `mol` and `mole`. Thanks @stu-blair. -- Restored support for implicit multiplications like `2(3+4)` and `(2+3)(4+5)`. -- Some improvements in the docs. -- Added automatic conversions from `boolean` and `null` to `Fraction`, - and conversions from `Fraction` to `Complex`. - -

2016-03-04, version 3.0.0 #

- -

breaking changes #

- -- More restricted support for implicit multiplication in the expression - parser: `(...)(...)` is now evaluated as a function invocation, - and `[...][...]` as a matrix subset. -- Matrix multiplication no longer squeezes scalar outputs to a scalar value, - but leaves them as they are: a vector or matrix containing a single value. - See #529. -- Assignments in the expression parser now return the assigned value rather - than the created or updated object (see #533). Example: - - ``` - A = eye(3) - A[1,1] = 2 # this assignment now returns 2 instead of A - ``` - -- Expression parser now supports objects. This involves a refactoring and - extension in expression nodes: - - Implemented new node `ObjectNode`. - - Refactored `AssignmentNode`, `UpdateNode`, and `IndexNode` are refactored - into `AccessorNode`, `AssignmentNode`, and `IndexNode` having a different API. -- Upgraded the used BigNumber library `decimal.js` to v5. Replaced the - trigonometric functions of math.js with those provided in decimal.js v5. - This can give slightly different behavior qua round-off errors. -- Replaced the internal `Complex.js` class with the `complex.js` library - created by @infusion. -- Entries in a matrix (typically numbers, BigNumbers, Units, etc) are now - considered immutable, they are no longer copied when performing operations on - the entries, improving performance. -- Implemented nearly equal comparison for relational functions (`equal`, - `larger`, `smaller`, etc.) when using BigNumbers. -- Changed the casing of the configuration options `matrix` (`Array` or `Matrix`) - and `number` (`number`, `BigNumber`, `Fraction`) such that they now match - the type returned by `math.typeof`. Wrong casing gives a console warning but - will still work. -- Changed the default config value for `epsilon` from `1e-14` to `1e-12`, - see #561. - -

non-breaking changes #

- -- Extended function `pow` to return the real root for cubic roots of negative - numbers. See #525, #482, #567. -- Implemented support for JSON objects in the expression parser and the - function `math.format`. -- Function `math.fraction` now supports `BigNumber`, and function - `math.bignumber` now supports `Fraction`. -- Expression parser now allows function and/or variable assignments inside - accessors and conditionals, like `A[x=2]` or `a > 2 ? b="ok" : b="fail"`. -- Command line interface: - - Outputs the variable name of assignments. - - Fixed not rounding BigNumbers to 14 digits like numbers. - - Fixed non-working autocompletion of user defined variables. -- Reorganized and extended docs, added docs on classes and more. Thanks @hgupta9. -- Added new units `acre`, `hectare`, `torr`, `bar`, `mmHg`, `mmH2O`, `cmH2O`, - and added new aliases `acres`, `hectares`, `sqfeet`, `sqyard`, `sqmile`, - `sqmiles`, `mmhg`, `mmh2o`, `cmh2o`. Thanks @hgupta9. -- Fixed a bug in the toString method of an IndexNode. -- Fixed angle units `deg`, `rad`, `grad`, `cycle`, `arcsec`, and `arcmin` not - being defined as BigNumbers when configuring to use BigNumbers. - -

2016-02-03, version 2.7.0 #

- -- Added more unit aliases for time: `secs`, `mins`, `hr`, `hrs`. See #551. -- Added support for doing operations with mixed `Fractions` and `BigNumbers`. -- Fixed #540: `math.intersect()` returning null in some cases. Thanks @void42. -- Fixed #546: Cannot import BigNumber, Fraction, Matrix, Array. - Thanks @brettjurgens. - -

2016-01-08, version 2.6.0 #

- -- Implemented (complex) units `VA` and `VAR`. -- Implemented time units for weeks, months, years, decades, centuries, and - millennia. Thanks @owenversteeg. -- Implemented new notation `engineering` in function `math.format`. - Thanks @johnmarinelli. -- Fixed #523: In some circumstances, matrix subset returned a scalar instead - of the correct subset. -- Fixed #536: A bug in an internal method used for sparse matrices. - -

2015-12-05, version 2.5.0 #

- -- Implemented support for numeric types `Fraction` and `BigNumber` in units. -- Implemented new method `toNumeric` for units. -- Implemented new units `arcsec`, `arcsecond`, `arcmin`, `arcminute`. - Thanks @devdevdata222. -- Implemented new unit `Herts` (`Hz`). Thanks @SwamWithTurtles. -- Fixed #485: Scoping issue with variables both used globally as well as in a - function definition. -- Fixed: Function `number` didn't support `Fraction` as input. - -

2015-11-14, version 2.4.2 #

- -- Fixed #502: Issue with `format` in some JavaScript engines. -- Fixed #503: Removed trailing commas and the use of keyword `import` as - property, as this gives issues with old JavaScript engines. - -

2015-10-29, version 2.4.1 #

- -- Fixed #480: `nthRoot` not working on Internet Explorer (up to IE11). -- Fixed #490: `nthRoot` returning an error for negative values like - `nthRoot(-2, 3)`. -- Fixed #489: an issue with initializing a sparse matrix without data. - Thanks @Retsam. -- Fixed: #493: function `combinations` did not throw an exception for - non-integer values of `k`. -- Fixed: function `import` did not override typed functions when the option - override was set true. -- Fixed: added functions `math.sparse` and `math.index` to the reference docs, - they where missing. -- Fixed: removed memoization from `gamma` and `factorial` functions, this - could blow up memory. - -

2015-10-09, version 2.4.0 #

- -- Added support in the expression parser for mathematical alphanumeric symbols - in the expression parser: unicode range \u{1D400} to \u{1D7FF} excluding - invalid code points. -- Extended function `distance` with more signatures. Thanks @kv-kunalvyas. -- Fixed a bug in functions `sin` and `cos`, which gave wrong results for - BigNumber integer values around multiples of tau (i.e. `sin(bignumber(7))`). -- Fixed value of unit `stone`. Thanks @Esvandiary for finding the error. - -

2015-09-19, version 2.3.0 #

- -- Implemented function `distance`. Thanks @devanp92. -- Implemented support for Fractions in function `lcm`. Thanks @infusion. -- Implemented function `cbrt` for numbers, complex numbers, BigNumbers, Units. -- Implemented function `hypot`. -- Upgraded to fraction.js v3.0.0. -- Fixed #450: issue with non sorted index in sparse matrices. -- Fixed #463, #322: inconsistent handling of implicit multiplication. -- Fixed #444: factorial of infinity not returning infinity. - -

2015-08-30, version 2.2.0 #

- -- Units with powers (like `m^2` and `s^-1`) now output with the best prefix. -- Implemented support for units to `abs`, `cube`, `sign`, `sqrt`, `square`. - Thanks @ericman314. -- Implemented function `catalan` (Combinatorics). Thanks @devanp92. -- Improved the `canDefineProperty` check to return false in case of IE8, which - has a broken implementation of `defineProperty`. Thanks @golmansax. -- Fixed function `to` not working in case of a simplified unit. -- Fixed #437: an issue with row swapping in `lup`, also affecting `lusolve`. - -

2015-08-12, version 2.1.1 #

- -- Fixed wrong values of the physical constants `speedOfLight`, `molarMassC12`, - and `magneticFluxQuantum`. Thanks @ericman314 for finding two of them. - -

2015-08-11, version 2.1.0 #

- -- Implemented derived units (like `110 km/h in m/s`). Thanks @ericman314. -- Implemented support for electric units. Thanks @ericman314. -- Implemented about 50 physical constants like `speedOfLight`, `gravity`, etc. -- Implemented function `kldivergence` (Kullback-Leibler divergence). - Thanks @saromanov. -- Implemented function `mode`. Thanks @kv-kunalvyas. -- Added support for unicode characters in the expression parser: greek letters - and latin letters with accents. See #265. -- Internal functions `Unit.parse` and `Complex.parse` now throw an Error - instead of returning null when passing invalid input. - -

2015-07-29, version 2.0.1 #

- -- Fixed operations with mixed fractions and numbers be converted to numbers - instead of fractions. - -

2015-07-28, version 2.0.0 #

- -- Large internal refactoring: - - performance improvements. - - allows to create custom bundles - - functions are composed using `typed-function` and are extensible -- Implemented support for fractions, powered by the library `fraction.js`. -- Implemented matrix LU decomposition with partial pivoting and a LU based - linear equations solver (functions `lup` and `lusolve`). Thanks @rjbaucells. -- Implemented a new configuration option `predictable`, which can be set to - true in order to ensure predictable function output types. -- Implemented function `intersect`. Thanks @kv-kunalvyas. -- Implemented support for adding `toTex` properties to custom functions. - Thanks @FSMaxB. -- Implemented support for complex values to `nthRoot`. Thanks @gangachris. -- Implemented util functions `isInteger`, `isNegative`, `isNumeric`, - `isPositive`, and `isZero`. - -

breaking changes #

- -- String input is now converted to numbers by default for all functions. -- Adding two strings will no longer concatenate them, but will convert the - strings to numbers and add them. -- Function `index` does no longer accept an array `[start, end, step]`, but - instead accepts an array with arbitrary index values. It also accepts - a `Range` object as input. -- Function `typeof` no longer returns lower case names, but now returns lower - case names for primitives (like `number`, `boolean`, `string`), and - upper-camel-case for non-primitives (like `Array`, `Complex`, `Function`). -- Function `import` no longer supports a module name as argument. Instead, - modules can be loaded using require: `math.import(require('module-name'))`. -- Function `import` has a new option `silent` to ignore errors, and throws - errors on duplicates by default. -- Method `Node.compile()` no longer needs `math` to be passed as argument. -- Reintroduced method `Node.eval([scope])`. -- Function `sum` now returns zero when input is an empty array. Thanks @FSMAxB. -- The size of Arrays is no longer validated. Matrices will validate this on - creation. - -

2015-07-12, version 1.7.1 #

- -- Fixed #397: Inaccuracies in nthRoot for very large values, and wrong results - for very small values. (backported from v2) -- Fixed #405: Parser throws error when defining a function in a multiline - expression. - -

2015-05-31, version 1.7.0 #

- -- Implemented function `quantileSeq` and `partitionSelect`. Thanks @BigFav. -- Implemented functions `stirlingS2`, `bellNumbers`, `composition`, and - `multinomial`. Thanks @devanp92. -- Improved the performance of `median` (see #373). Thanks @BigFav. -- Extended the command line interface with a `mode` option to output either - the expressions result, string representation, or tex representation. - Thanks @FSMaxB. -- Fixed #309: Function median mutating the input matrix. Thanks @FSMaxB. -- Fixed `Node.transform` not recursing over replaced parts of the - node tree (see #349). -- Fixed #381: issue in docs of `randomInt`. - -

2015-04-22, version 1.6.0 #

- -- Improvements in `toTex`. Thanks @FSMaxB. -- Fixed #328: `abs(0 + 0i)` evaluated to `NaN`. -- Fixed not being able to override lazy loaded constants. - -

2015-04-09, version 1.5.2 #

- -- Fixed #313: parsed functions did not handle recursive calls correctly. -- Fixed #251: binary prefix and SI prefix incorrectly used for byte. Now - following SI standards (`1 KiB == 1024 B`, `1 kB == 1000 B`). -- Performance improvements in parsed functions. - -

2015-04-08, version 1.5.1 #

- -- Fixed #316: a bug in rounding values when formatting. -- Fixed #317, #319: a bug in formatting negative values. - -

2015-03-28, version 1.5.0 #

- -- Added unit `stone` (6.35 kg). -- Implemented support for sparse matrices. Thanks @rjbaucells. -- Implemented BigNumber support for function `atan2`. Thanks @BigFav. -- Implemented support for custom LaTeX representations. Thanks @FSMaxB. -- Improvements and bug fixes in outputting parentheses in `Node.toString` and - `Node.toTex` functions. Thanks @FSMaxB. -- Fixed #291: function `format` sometimes returning exponential notation when - it should return a fixed notation. - -

2015-02-28, version 1.4.0 #

- -- Implemented trigonometric functions: - `acosh`, `acoth`, `acsch`, `asech`, `asinh`, `atanh`, `acot`, `acsc`, `asec`. - Thanks @BigFav. -- Added BigNumber support for functions: `cot`, `csc`, `sec`, `coth`, - `csch`, `sech`. Thanks @BigFav. -- Implemented support for serialization and deserialization of math.js data - types. -- Fixed the calculation of `norm()` and `abs()` for large complex numbers. - Thanks @rjbaucells. -- Fixed #281: improved formatting complex numbers. Round the real or imaginary - part to zero when the difference is larger than the configured precision. - -

2015-02-09, version 1.3.0 #

- -- Implemented BigNumber implementations of most trigonometric functions: `sin`, - `cos`, `tan`, `asin`, `acos`, `atan`, `cosh`, `sinh`, `tanh`. Thanks @BigFav. -- Implemented function `trace`. Thanks @pcorey. -- Faster loading of BigNumber configuration with a high precision by lazy - loading constants like `pi` and `e`. -- Fixed constants `NaN` and `Infinity` not being BigNumber objects when - BigNumbers are configured. -- Fixed missing parentheses in the `toTex` representation of function - `permutations`. -- Some minor fixes in the docs. Thanks @KenanY. - -

2014-12-25, version 1.2.0 #

- -- Support for bitwise operations `bitAnd`, `bitNot`, `bitOr`, `bitXor`, - `leftShift`, `rightArithShift`, and `rightLogShift`. Thanks @BigFav. -- Support for boolean operations `and`, `not`, `or`, `xor`. Thanks @BigFav. -- Support for `gamma` function. Thanks @BigFav. -- Converting a unit without value will now result in a unit *with* value, - i.e. `inch in cm` will return `2.54 cm` instead of `cm`. -- Improved accuracy of `sinh` and complex `cos` and `sin`. Thanks @pavpanchekha. -- Renamed function `select` to `chain`. The old function `select` will remain - functional until math.js v2.0. -- Upgraded to decimal.js v4.0.1 (BigNumber library). - -

2014-11-22, version 1.1.1 #

- -- Fixed Unit divided by Number returning zero. -- Fixed BigNumber downgrading to Number for a negative base in `pow`. -- Fixed some typos in error messaging (thanks @andy0130tw) and docs. - -

2014-11-15, version 1.1.0 #

- -- Implemented functions `dot` (dot product), `cross` (cross product), and - `nthRoot`. -- Officially opened up the API of expression trees: - - Documented the API. - - Implemented recursive functions `clone`, `map`, `forEach`, `traverse`, - `transform`, and `filter` for expression trees. - - Parameter `index` in the callbacks of `map` and `forEach` are now cloned - for every callback. - - Some internal refactoring inside nodes to make the API consistent: - - Renamed `params` to `args` and vice versa to make things consistent. - - Renamed `Block.nodes` to `Block.blocks`. - - `FunctionNode` now has a `name: string` instead of a `symbol: SymbolNode`. - - Changed constructor of `RangeNode` to - `new RangeNode(start: Node, end: Node [, step: Node])`. - - Nodes for a `BlockNode` must now be passed via the constructor instead - of via a function `add`. -- Fixed `2e` giving a syntax error instead of being parsed as `2 * e`. - -

2014-09-12, version 1.0.1 #

- -- Disabled array notation for ranges in a matrix index in the expression parser - (it is confusing and redundant there). -- Fixed a regression in the build of function subset not being able to return - a scalar. -- Fixed some missing docs and broken links in the docs. - -

2014-09-04, version 1.0.0 #

- -- Implemented a function `filter(x, test)`. -- Removed `math.distribution` for now, needs some rethinking. -- `math.number` can convert units to numbers (requires a second argument) -- Fixed some precedence issues with the range and conversion operators. -- Fixed an zero-based issue when getting a matrix subset using an index - containing a matrix. - -

2014-08-21, version 0.27.0 #

- -- Implemented functions `sort(x [, compare])` and `flatten(x)`. -- Implemented support for `null` in all functions. -- Implemented support for "rawArgs" functions in the expression parser. Raw - functions are invoked with unevaluated parameters (nodes). -- Expressions in the expression parser can now be spread over multiple lines, - like '2 +\n3'. -- Changed default value of the option `wrap` of function `math.import` to false. -- Changed the default value for new entries in a resized matrix when to zero. - To leave new entries uninitialized, use the new constant `math.uninitialized` - as default value. -- Renamed transform property from `__transform__` to `transform`, and documented - the transform feature. -- Fixed a bug in `math.import` not applying options when passing a module name. -- A returned matrix subset is now only squeezed when the `index` consists of - scalar values, and no longer for ranges resolving into a single value. - -

2014-08-03, version 0.26.0 #

- -- A new instance of math.js can no longer be created like `math([options])`, - to prevent side effects from math being a function instead of an object. - Instead, use the function `math.create([options])` to create a new instance. -- Implemented `BigNumber` support for all constants: `pi`, `tau`, `e`, `phi`, - `E`, `LN2`, `LN10`, `LOG2E`, `LOG10E`, `PI`, `SQRT1_2`, and `SQRT2`. -- Implemented `BigNumber` support for functions `gcd`, `xgcd`, and `lcm`. -- Fixed function `gxcd` returning an Array when math.js was configured - as `{matrix: 'matrix'}`. -- Multi-line expressions now return a `ResultSet` instead of an `Array`. -- Implemented transforms (used right now to transform one-based indices to - zero-based for expressions). -- When used inside the expression parser, functions `concat`, `min`, `max`, - and `mean` expect an one-based dimension number. -- Functions `map` and `forEach` invoke the callback with one-based indices - when used from within the expression parser. -- When adding or removing dimensions when resizing a matrix, the dimensions - are added/removed from the inner side (right) instead of outer side (left). -- Improved index out of range errors. -- Fixed function `concat` not accepting a `BigNumber` for parameter `dim`. -- Function `squeeze` now squeezes both inner and outer singleton dimensions. -- Output of getting a matrix subset is not automatically squeezed anymore - except for scalar output. -- Renamed `FunctionNode` to `FunctionAssignmentNode`, and renamed `ParamsNode` - to `FunctionNode` for more clarity. -- Fixed broken auto completion in CLI. -- Some minor fixes. - -

2014-07-01, version 0.25.0 #

- -- The library now immediately returns a default instance of mathjs, there is - no need to instantiate math.js in a separate step unless one ones to set - configuration options: - - // instead of: - var mathjs = require('mathjs'), // load math.js - math = mathjs(); // create an instance - - // just do: - var math = require('mathjs'); -- Implemented support for implicit multiplication, like `math.eval('2a', {a:3})` - and `math.eval('(2+3)(1-3)')`. This changes behavior of matrix indexes as - well: an expression like `[...][...]` is not evaluated as taking a subset of - the first matrix, but as an implicit multiplication of two matrices. -- Removed utility function `ifElse`. This function is redundant now the - expression parser has a conditional operator `a ? b : c`. -- Fixed a bug with multiplying a number with a temperature, - like `math.eval('10 * celsius')`. -- Fixed a bug with symbols having value `undefined` not being evaluated. - -

2014-06-20, version 0.24.1 #

- -- Something went wrong with publishing on npm. - -

2014-06-20, version 0.24.0 #

- -- Added constant `null`. -- Functions `equal` and `unequal` support `null` and `undefined` now. -- Function `typeof` now recognizes regular expressions as well. -- Objects `Complex`, `Unit`, and `Help` now return their string representation - when calling `.valueOf()`. -- Changed the default number of significant digits for BigNumbers from 20 to 64. -- Changed the behavior of the conditional operator (a ? b : c) to lazy - evaluating. -- Fixed imported, wrapped functions not accepting `null` and `undefined` as - function arguments. - -

2014-06-10, version 0.23.0 #

- -- Renamed some functions (everything now has a logical, camel case name): - - Renamed functions `edivide`, `emultiply`, and `epow` to `dotDivide`, - `dotMultiply`, and `dotPow` respectively. - - Renamed functions `smallereq` and `largereq` to `smallerEq` and `largerEq`. - - Renamed function `unary` to `unaryMinus` and added support for strings. -- `end` is now a reserved keyword which cannot be used as function or symbol - name in the expression parser, and is not allowed in the scope against which - an expression is evaluated. -- Implemented function `unaryPlus` and unary plus operator. -- Implemented function `deepEqual` for matrix comparisons. -- Added constant `phi`, the golden ratio (`phi = 1.618...`). -- Added constant `version`, returning the version number of math.js as string. -- Added unit `drop` (`gtt`). -- Fixed not being able to load math.js using AMD/require.js. -- Changed signature of `math.parse(expr, nodes)` to `math.parse(expr, options)` - where `options: {nodes: Object.}` -- Removed matrix support from conditional function `ifElse`. -- Removed automatic assignment of expression results to variable `ans`. - This functionality can be restored by pre- or postprocessing every evaluation, - something like: - - function evalWithAns (expr, scope) { - var ans = math.eval(expr, scope); - if (scope) { - scope.ans = ans; - } - return ans; - } - -

2014-05-22, version 0.22.0 #

- -- Implemented support to export expressions to LaTeX. Thanks Niels Heisterkamp - (@nheisterkamp). -- Output of matrix multiplication is now consistently squeezed. -- Added reference documentation in the section /docs/reference. -- Fixed a bug in multiplying units without value with a number (like `5 * cm`). -- Fixed a bug in multiplying two matrices containing vectors (worked fine for - arrays). -- Fixed random functions not accepting Matrix as input, and always returning - a Matrix as output. - -

2014-05-13, version 0.21.1 #

- -- Removed `crypto` library from the bundle. -- Deprecated functions `Parser.parse` and `Parser.compile`. Use - `math.parse` and `math.compile` instead. -- Fixed function `add` not adding strings and matrices element wise. -- Fixed parser not being able to evaluate an exponent followed by a unary minus - like `2^-3`, and a transpose followed by an index like `[3]'[1]`. - -

2014-04-24, version 0.21.0 #

- -- Implemented trigonometric hyperbolic functions `cosh`, `coth`, `csch`, - `sech`, `sinh`, `tanh`. Thanks Rogelio J. Baucells (@rjbaucells). -- Added property `type` to all expression nodes in an expression tree. -- Fixed functions `log`, `log10`, `pow`, and `sqrt` not supporting complex - results from BigNumber input (like `sqrt(bignumber(-4))`). - -

2014-04-16, version 0.20.0 #

- -- Switched to module `decimal.js` for BigNumber support, instead of - `bignumber.js`. -- Implemented support for polar coordinates to the `Complex` datatype. - Thanks Finn Pauls (@finnp). -- Implemented BigNumber support for functions `exp`, `log`, and `log10`. -- Implemented conditional operator `a ? b : c` in expression parser. -- Improved floating point comparison: the functions now check whether values - are nearly equal, against a configured maximum relative difference `epsilon`. - Thanks Rogelio J. Baucells (@rjbaucells). -- Implemented function `norm`. Thanks Rogelio J. Baucells (@rjbaucells). -- Improved function `ifElse`, is now specified for special data types too. -- Improved function `det`. Thanks Bryan Cuccioli (@bcuccioli). -- Implemented `BigNumber` support for functions `det` and `diag`. -- Added unit alias `lbs` (pound mass). -- Changed configuration option `decimals` to `precision` (applies to BigNumbers - only). -- Fixed support for element-wise comparisons between a string and a matrix. -- Fixed: expression parser now trows IndexErrors with one-based indices instead - of zero-based. -- Minor bug fixes. - -

2014-03-30, version 0.19.0 #

- -- Implemented functions `compare`, `sum`, `prod`, `var`, `std`, `median`. -- Implemented function `ifElse` Thanks @mtraynham. -- Minor bug fixes. - -

2014-02-15, version 0.18.1 #

- -- Added unit `feet`. -- Implemented function `compile` (shortcut for parsing and then compiling). -- Improved performance of function `pow` for matrices. Thanks @hamadu. -- Fixed broken auto completion in the command line interface. -- Fixed an error in function `combinations` for large numbers, and - improved performance of both functions `combinations` and `permutations`. - -

2014-01-18, version 0.18.0 #

- -- Changed matrix index notation of expression parser from round brackets to - square brackets, for example `A[1, 1:3]` instead of `A(1, 1:3)`. -- Removed need to use the `function` keyword for function assignments in the - expression parser, you can define a function now like `f(x) = x^2`. -- Implemented a compilation step in the expression parser: expressions are - compiled into JavaScript, giving much better performance (easily 10x as fast). -- Renamed unit conversion function and operator `in` to `to`. Operator `in` is - still available in the expression parser as an alias for `to`. Added unit - `in`, an abbreviation for `inch`. Thanks Elijah Insua (@tmpvar). -- Added plurals and aliases for units. -- Implemented an argument `includeEnd` for function `range` (false by default). -- Ranges in the expression parser now support big numbers. -- Implemented functions `permutations` and `combinations`. - Thanks Daniel Levin (@daniel-levin). -- Added lower case abbreviation `l` for unit litre. - -

2013-12-19, version 0.17.1 #

- -- Fixed a bug with negative temperatures. -- Fixed a bug with prefixes of units squared meter `m2` and cubic meter `m3`. - -

2013-12-12, version 0.17.0 #

- -- Renamed and flattened configuration settings: - - `number.defaultType` is now `number`. - - `number.precision` is now `decimals`. - - `matrix.defaultType` is now `matrix`. -- Function `multiply` now consistently outputs a complex number on complex input. -- Fixed `mod` and `in` not working as function (only as operator). -- Fixed support for old browsers (IE8 and older), compatible when using es5-shim. -- Fixed support for Java's ScriptEngine. - -

2013-11-28, version 0.16.0 #

- -- Implemented BigNumber support for arbitrary precision calculations. - Added settings `number.defaultType` and `number.precision` to configure - big numbers. -- Documentation is extended. -- Removed utility functions `isScalar`, `toScalar`, `isVector`, `toVector` - from `Matrix` and `Range`. Use `math.squeeze` and `math.size` instead. -- Implemented functions `get` and `set` on `Matrix`, for easier and faster - retrieval/replacement of elements in a matrix. -- Implemented function `resize`, handling matrices, scalars, and strings. -- Functions `ones` and `zeros` now return an empty matrix instead of a - number 1 or 0 when no arguments are provided. -- Implemented functions `min` and `max` for `Range` and `Index`. -- Resizing matrices now leaves new elements undefined by default instead of - filling them with zeros. Function `resize` now has an extra optional - parameter `defaultValue`. -- Range operator `:` in expression parser has been given a higher precedence. -- Functions don't allow arguments of unknown type anymore. -- Options be set when constructing a math.js instance or using the new function - `config(options`. Options are no longer accessible via `math.options`. -- Renamed `scientific` notation to `exponential` in function `format`. -- Function `format` outputs exponential notation with positive exponents now - always with `+` sign, so outputs `2.1e+3` instead of `2.1e3`. -- Fixed function `squeeze` not being able squeeze into a scalar. -- Some fixes and performance improvements in the `resize` and `subset` - functions. -- Function `size` now adheres to the option `matrix.defaultType` for scalar - input. -- Minor bug fixes. - -

2013-10-26, version 0.15.0 #

- -- Math.js must be instantiated now, static calls are no longer supported. Usage: - - node.js: `var math = require('mathjs')();` - - browser: `var math = mathjs();` -- Implemented support for multiplying vectors with matrices. -- Improved number formatting: - - Function `format` now support various options: precision, different - notations (`fixed`, `scientific`, `auto`), and more. - - Numbers are no longer rounded to 5 digits by default when formatted. - - Implemented a function `format` for `Matrix`, `Complex`, `Unit`, `Range`, - and `Selector` to format using options. - - Function `format` does only stringify values now, and has a new parameter - `precision` to round to a specific number of digits. - - Removed option `math.options.precision`, - use `math.format(value [, precision])` instead. - - Fixed formatting numbers as scientific notation in some cases returning - a zero digit left from the decimal point. (like "0.33333e8" rather than - "3.3333e7"). Thanks @husayt. -- Implemented a function `print` to interpolate values in a template string, - this functionality was moved from the function `format`. -- Implemented statistics function `mean`. Thanks Guillermo Indalecio Fernandez - (@guillermobox). -- Extended and changed `max` and `min` for multi dimensional matrices: they now - return the maximum and minimum of the flattened array. An optional second - argument `dim` allows to calculate the `max` or `min` for specified dimension. -- Renamed option `math.options.matrix.default` to - `math.options.matrix.defaultType`. -- Removed support for comparing complex numbers in functions `smaller`, - `smallereq`, `larger`, `largereq`. Complex numbers cannot be ordered. - -

2013-10-08, version 0.14.0 #

- -- Introduced an option `math.options.matrix.default` which can have values - `matrix` (default) or `array`. This option is used by the functions `eye`, - `ones`, `range`, and `zeros`, to determine the type of matrix output. -- Getting a subset of a matrix will automatically squeeze the resulting subset, - setting a subset of a matrix will automatically unsqueeze the given subset. -- Removed concatenation of nested arrays in the expression parser. - You can now input nested arrays like in JavaScript. Matrices can be - concatenated using the function `concat`. -- The matrix syntax `[...]` in the expression parser now creates 1 dimensional - matrices by default. `math.eval('[1,2,3,4]')` returns a matrix with - size `[4]`, `math.eval('[1,2;3,4]')` returns a matrix with size `[2,2]`. -- Documentation is restructured and extended. -- Fixed non working operator `mod` (modulus operator). - -

2013-09-03, version 0.13.0 #

- -- Implemented support for booleans in all relevant functions. -- Implemented functions `map` and `forEach`. Thanks Sebastien Piquemal (@sebpic). -- All construction functions can be used to convert the type of variables, - also element-wise for all elements in an Array or Matrix. -- Changed matrix indexes of the expression parser to one-based with the - upper-bound included, similar to most math applications. Note that on a - JavaScript level, math.js uses zero-based indexes with excluded upper-bound. -- Removed support for scalars in the function `subset`, it now only supports - Array, Matrix, and String. -- Removed the functions `get` and `set` from a selector, they are a duplicate - of the function `subset`. -- Replaced functions `get` and `set` of `Matrix` with a single function - `subset`. -- Some moving around with code and namespaces: - - Renamed namespace `math.expr` to `math.expression` (contains Scope, Parser, - node objects). - - Renamed namespace `math.docs` to `math.expression.docs`. - - Moved `math.expr.Selector` to `math.chaining.Selector`. -- Fixed some edge cases in functions `lcm` and `xgcd`. - -

2013-08-22, version 0.12.1 #

- -- Fixed outdated version of README.md. -- Fixed a broken unit test. - -

2013-08-22, version 0.12.0 #

- -- Implemented functions `random([min, max])`, `randomInt([min, max])`, - `pickRandom(array)`. Thanks Sebastien Piquemal (@sebpic). -- Implemented function `distribution(name)`, generating a distribution object - with functions `random`, `randomInt`, `pickRandom` for different - distributions. Currently supporting `uniform` and `normal`. -- Changed the behavior of `range` to exclude the upper bound, so `range(1, 4)` - now returns `[1, 2, 3]` instead of `[1, 2, 3, 4]`. -- Changed the syntax of `range`, which is now `range(start, end [, step])` - instead of `range(start, [step, ] end)`. -- Changed the behavior of `ones` and `zeros` to geometric dimensions, for - example `ones(3)` returns a vector with length 3, filled with ones, and - `ones(3,3)` returns a 2D array with size [3, 3]. -- Changed the return type of `ones` and `zeros`: they now return an Array when - arguments are Numbers or an Array, and returns a Matrix when the argument - is a Matrix. -- Change matrix index notation in parser from round brackets to square brackets, - for example `A[0, 0:3]`. -- Removed the feature introduced in v0.10.0 to automatically convert a complex - value with an imaginary part equal to zero to a number. -- Fixed zeros being formatted as null. Thanks @TimKraft. - -

2013-07-23, version 0.11.1 #

- -- Fixed missing development dependency - -

2013-07-23, version 0.11.0 #

- -- Changed math.js from one-based to zero-based indexes. - - Getting and setting matrix subset is now zero-based. - - The dimension argument in function `concat` is now zero-based. -- Improvements in the string output of function help. -- Added constants `true` and `false`. -- Added constructor function `boolean`. -- Fixed function `select` not accepting `0` as input. - Thanks Elijah Manor (@elijahmanor). -- Parser now supports multiple unary minus operators after each other. -- Fixed not accepting empty matrices like `[[], []]`. -- Some fixes in the end user documentation. - -

2013-07-08, version 0.10.0 #

- -- For complex calculations, all functions now automatically replace results - having an imaginary part of zero with a Number. (`2i * 2i` now returns a - Number `-4` instead of a Complex `-4 + 0i`). -- Implemented support for injecting custom node handlers in the parser. Can be - used for example to implement a node handler for plotting a graph. -- Implemented end user documentation and a new `help` function. -- Functions `size` and `squeeze` now return a Matrix instead of an Array as - output on Matrix input. -- Added a constant tau (2 * pi). Thanks Zak Zibrat (@palimpsests). -- Renamed function `unaryminus` to `unary`. -- Fixed a bug in determining node dependencies in function assignments. - -

2013-06-14, version 0.9.1 #

- -- Implemented element-wise functions and operators: `emultiply` (`x .* y`), - `edivide` (`x ./ y`), `epow` (`x .^ y`). -- Added constants `Infinity` and `NaN`. -- Removed support for Workspace to keep the library focused on its core task. -- Fixed a bug in the Complex constructor, not accepting NaN values. -- Fixed division by zero in case of pure complex values. -- Fixed a bug in function multiply multiplying a pure complex value with - Infinity. - -

2013-05-29, version 0.9.0 #

- -- Implemented function `math.parse(expr [,scope])`. Optional parameter scope can - be a plain JavaScript Object containing variables. -- Extended function `math.expr(expr [, scope])` with an additional parameter - `scope`, similar to `parse`. Example: `math.eval('x^a', {x:3, a:2});`. -- Implemented function `subset`, to get or set a subset from a matrix, string, - or other data types. -- Implemented construction functions number and string (mainly useful inside - the parser). -- Improved function `det`. Thanks Bryan Cuccioli (@bcuccioli). -- Moved the parse code from prototype math.expr.Parser to function math.parse, - simplified Parser a little bit. -- Strongly simplified the code of Scope and Workspace. -- Fixed function mod for negative numerators, and added error messages in case - of wrong input. - -

2013-05-18, version 0.8.2 #

- -- Extended the import function and some other minor improvements. -- Fixed a bug in merging one dimensional vectors into a matrix. -- Fixed a bug in function subtract, when subtracting a complex number from a - real number. - -

2013-05-10, version 0.8.1 #

- -- Fixed an npm warning when installing mathjs globally. - -

2013-05-10, version 0.8.0 #

- -- Implemented a command line interface. When math.js is installed globally via - npm, the application is available on your system as 'mathjs'. -- Implemented `end` keyword for index operator, and added support for implicit - start and end (expressions like `a(2,:)` and `b(2:end,3:end-1)` are supported - now). -- Function math.eval is more flexible now: it supports variables and multi-line - expressions. -- Removed the read-only option from Parser and Scope. -- Fixed non-working unequal operator != in the parser. -- Fixed a bug in resizing matrices when replacing a subset. -- Fixed a bug in updating a subset of a non-existing variable. -- Minor bug fixes. - -

2013-05-04, version 0.7.2 #

- -- Fixed method unequal, which was checking for equality instead of inequality. - Thanks @FJS2. - -

2013-04-27, version 0.7.1 #

- -- Improvements in the parser: - - Added support for chained arguments. - - Added support for chained variable assignments. - - Added a function remove(name) to remove a variable from the parsers scope. - - Renamed nodes for more consistency and to resolve naming conflicts. - - Improved stringification of an expression tree. - - Some simplifications in the code. - - Minor bug fixes. -- Fixed a bug in the parser, returning NaN instead of throwing an error for a - number with multiple decimal separators like `2.3.4`. -- Fixed a bug in Workspace.insertAfter. -- Fixed: math.js now works on IE 6-8 too. - -

2013-04-20, version 0.7.0 #

- -- Implemented method `math.eval`, which uses a readonly parser to evaluate - expressions. -- Implemented method `xgcd` (extended eucledian algorithm). Thanks Bart Kiers - (@bkiers). -- Improved math.format, which now rounds values to a maximum number of digits - instead of decimals (default is 5 digits, for example `math.format(math.pi)` - returns `3.1416`). -- Added examples. -- Changed methods square and cube to evaluate matrices element wise (consistent - with all other methods). -- Changed second parameter of method import to an object with options. -- Fixed method math.typeof on IE. -- Minor bug fixes and improvements. - -

2013-04-13, version 0.6.0 #

- -- Implemented chained operations via method math.select(). For example - `math.select(3).add(4).subtract(2).done()` will return `5`. -- Implemented methods gcd and lcm. -- Implemented method `Unit.in(unit)`, which creates a clone of the unit with a - fixed representation. For example `math.unit('5.08 cm').in('inch')` will - return a unit which string representation always is in inch, thus `2 inch`. - `Unit.in(unit)` is the same as method `math.in(x, unit)`. -- Implemented `Unit.toNumber(unit)`, which returns the value of the unit when - represented with given unit. For example - `math.unit('5.08 cm').toNumber('inch')` returns the number `2`, as the - representation of the unit in inches has 2 as value. -- Improved: method `math.in(x, unit)` now supports a string as second parameter, - for example `math.in(math.unit('5.08 cm'), 'inch')`. -- Split the end user documentation of the parser functions from the source - files. -- Removed function help and the built-in documentation from the core library. -- Fixed constant i being defined as -1i instead of 1i. -- Minor bug fixes. - -

2013-04-06, version 0.5.0 #

- -- Implemented data types Matrix and Range. -- Implemented matrix methods clone, concat, det, diag, eye, inv, ones, size, - squeeze, transpose, zeros. -- Implemented range operator `:`, and transpose operator `'` in parser. -- Changed: created construction methods for easy object creation for all data - types and for the parser. For example, a complex value is now created - with `math.complex(2, 3)` instead of `new math.Complex(2, 3)`, and a parser - is now created with `math.parser()` instead of `new math.parser.Parser()`. -- Changed: moved all data types under the namespace math.type, and moved the - Parser, Workspace, etc. under the namespace math.expr. -- Changed: changed operator precedence of the power operator: - - it is now right associative instead of left associative like most scripting - languages. So `2^3^4` is now calculated as `2^(3^4)`. - - it has now higher precedence than unary minus most languages, thus `-3^2` is - now calculated as `-(3^2)`. -- Changed: renamed the parsers method 'put' into 'set'. -- Fixed: method 'in' did not check for units to have the same base. - -

2013-03-16, version 0.4.0 #

- -- Implemented Array support for all methods. -- Implemented Array support in the Parser. -- Implemented method format. -- Implemented parser for units, math.Unit.parse(str). -- Improved parser for complex values math.Complex.parse(str); -- Improved method help: it now evaluates the examples. -- Fixed: a scoping issue with the Parser when defining functions. -- Fixed: method 'typeof' was not working well with minified and mangled code. -- Fixed: errors in determining the best prefix for a unit. - -

2013-03-09, version 0.3.0 #

- -- Implemented Workspace -- Implemented methods cot, csc, sec. -- Implemented Array support for methods with one parameter. - -

2013-02-25, version 0.2.0 #

- -- Parser, Scope, and expression tree with Nodes implemented. -- Implemented method import which makes it easy to extend math.js. -- Implemented methods arg, conj, cube, equal, factorial, im, largereq, - log(x, base), log10, mod, re, sign, smallereq, square, unequal. - -

2013-02-18, version 0.1.0 #

- -- Reached full compatibility with Javascripts built-in Math library. -- More functions implemented. -- Some bugfixes. - -

2013-02-16, version 0.0.2 #

- -- All constants of Math implemented, plus the imaginary unit i. -- Data types Complex and Unit implemented. -- First set of functions implemented. - -

2013-02-15, version 0.0.1 #

- -- First publish of the mathjs package. (package is still empty) diff --git a/index.md b/index.md deleted file mode 100644 index bc22c23548..0000000000 --- a/index.md +++ /dev/null @@ -1,121 +0,0 @@ ---- -layout: default -title: Home ---- - -

An extensive math library for JavaScript and Node.js #

- -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. Powerful and easy to use. - -

Features #

- -- Supports numbers, big numbers, bigint, complex numbers, fractions, units, strings, arrays, and matrices. -- Is compatible with JavaScript's built-in Math library. -- Contains a flexible expression parser. -- Does symbolic computation. -- Comes with a large set of built-in functions and constants. -- Can be used as a command line application as well. -- Runs on any JavaScript engine. -- Is easily extensible. -- Open source. - -
-
-

Example #

-

- Here some example code demonstrating how to use the library. - Click here to fiddle around. -

-
-
// functions and constants
-math.round(math.e, 3)                // 2.718
-math.atan2(3, -3) / math.pi          // 0.75
-math.log(10000, 10)                  // 4
-math.sqrt(-4)                        // 2i
-math.derivative('x^2 + x', 'x')      // 2*x+1
-math.pow([[-1, 2], [3, 1]], 2)
-     // [[7, 0], [0, 7]]
-
-// expressions
-math.evaluate('1.2 * (2 + 4.5)')     // 7.8
-math.evaluate('12.7 cm to inch')     // 5 inch
-math.evaluate('sin(45 deg) ^ 2')     // 0.5
-math.evaluate('9 / 3 + 2i')          // 3 + 2i
-math.evaluate('det([-1, 2; 3, 1])')  // -7
-
-// chaining
-math.chain(3)
-    .add(4)
-    .multiply(2)
-    .done() // 14
-
-
-
-

Demo #

-

- Try the expression parser below.
- See Math Notepad for a full application. -

-
loading...
-
- Shortcut keys: -
    -
  • Press S to set focus to the input field
  • -
  • Press Ctrl+F11 to toggle full screen
  • -
  • Press Tab to autocomplete (repeat to cycle choices)
  • -
  • Enter "clear" to clear history
  • -
-
-
-
 
-
- -
- - - - - - - - - - - - - - - - -
- - - -
-
diff --git a/js/commandline.js b/js/commandline.js deleted file mode 100644 index 5475bbce43..0000000000 --- a/js/commandline.js +++ /dev/null @@ -1,619 +0,0 @@ -/** - * A small command line editor to demonstrate the math.js parser. - * @param {Object} params Configuration parameter. Available: - * {HTMLElement} container DOM Element to contain - * the editor - * {Object} [math] An instance of math.js - * {String} [id] Optional id for the editor, - * used to persist data. - * "default" by default. - */ -function CommandLineEditor (params) { - // get instance of math.js from params, or create one - var math = params.math || mathjs(); - - // object with utility methods - var util = {}; - - /** - * Returns the version of Internet Explorer or a -1 - * (indicating the use of another browser). - * Source: https://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx - * @return {Number} Internet Explorer version, or -1 in case of an other browser - */ - util.getInternetExplorerVersion = function getInternetExplorerVersion () { - var rv = -1; // Return value assumes failure. - if (navigator.appName == 'Microsoft Internet Explorer') - { - var ua = navigator.userAgent; - var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); - if (re.exec(ua) != null) { - rv = parseFloat( RegExp.$1 ); - } - } - return rv; - }; - - /** - * Add and event listener - * @param {Element} element An html element - * @param {string} action The action, for example "click", - * without the prefix "on" - * @param {function} listener The callback function to be executed - */ - util.addEventListener = function addEventListener(element, action, listener) { - if (element.addEventListener) { - element.addEventListener(action, listener, false); - } else { - element.attachEvent('on' + action, listener); // IE browsers - } - }; - - /** - * Remove an event listener from an element - * @param {Element} element An html dom element - * @param {string} action The name of the event, for example "mousedown" - * @param {function} listener The listener function - */ - util.removeEventListener = function removeEventListener (element, action, listener) { - if (element.removeEventListener) { - element.removeEventListener(action, listener, false); - } else { - element.detachEvent('on' + action, listener); // IE browsers - } - }; - - /** - * Stop event propagation - */ - util.stopPropagation = function stopPropagation (event) { - if (event.stopPropagation) { - event.stopPropagation(); // non-IE browsers - } - else { - event.cancelBubble = true; // IE browsers - } - }; - - /** - * Cancels the event if it is cancelable, without stopping further propagation of the event. - */ - util.preventDefault = function preventDefault (event) { - if (event.preventDefault) { - event.preventDefault(); // non-IE browsers - } - else { - event.returnValue = false; // IE browsers - } - }; - - /** - * Clear all DOM childs from an element - * @param {HTMLElement} element - */ - util.clearDOM = function clearDOM (element) { - while (element.firstChild) { - element.removeChild(element.firstChild); - } - }; - - // read the parameters - var container = (params && params.container) ? params.container : undefined; - if (!container) { - throw new Error('Required parameter "container" missing in configuration parameters'); - } - var id = (params && params.id) ? String(params.id) : 'default'; - - // clear the container - util.clearDOM(container); - - // validate if math.js is loaded. - var error; - if (typeof math === 'undefined' || !math.parser) { - error = document.createElement('div'); - error.appendChild(document.createTextNode( - 'Cannot create parser, math.js not loaded.')); - error.style.color = 'red'; - container.appendChild(error); - return; - } - - // validate browser - // the editor does not work well on IE7 - // TODO: make the demo working on IE7 - var ieVersion = util.getInternetExplorerVersion(); - if (ieVersion == 6 || ieVersion == 7) { - error = document.createElement('div'); - error.appendChild(document.createTextNode( - 'Sorry, this demo is not available on IE7 and older. The math.js ' + - 'library itself works fine on every version of IE though.')); - error.style.color = 'red'; - container.appendChild(error); - return; - } - - // define parameters - var dom = {}, - fullscreen = false, - history = [], - historyIndex = -1, - parser = math.parser(); - - function resize() { - // position the full screen button in the top right - var top = 8; - var right = (dom.topPanel.clientWidth - dom.results.clientWidth) + 6; - dom.fullscreen.style.top = top + 'px'; - dom.fullscreen.style.right = right + 'px'; - } - - function toggleFullscreen() { - if (fullscreen) { - exitFullscreen(); - } - else { - showFullscreen() - } - } - - function showFullscreen() { - dom.frame.className = 'cle fullscreen'; - document.body.style.overflow = 'hidden'; // (works only if body.style.height is defined) - fullscreen = true; - resize(); - scrollDown(); - dom.input.focus(); - } - - function exitFullscreen() { - dom.frame.className = 'cle'; - document.body.style.overflow = ''; - fullscreen = false; - resize(); - scrollDown(); - } - - function scrollDown() { - dom.results.scrollTop = dom.results.scrollHeight; - } - - var completionMatches = [] - var completionIndex = -1 - - // Auto complete current input - function autoComplete () { - var name; - var text = dom.input.value; - var end = /[a-zA-Z_0-9]+$/.exec(text); - if (end) { - var keyword = end[0]; - - if (completionIndex >= 0 - && completionIndex < completionMatches.length - && keyword === completionMatches[completionIndex]) { - // keyword is exactly what we last filled in; cycle through the matches - ++completionIndex; - if (completionIndex === completionMatches.length) completionIndex = 0 - } else { - completionMatches = []; - completionIndex = 0 - // Look in various places in turn to find completions: - // scope variables - for (const def in parser.getAll()) { - if (def.indexOf(keyword) == 0) { - completionMatches.push(def); - } - } - - // commandline keywords - if ('clear'.indexOf(keyword) == 0 - && !completionMatches.includes('clear')) { - completionMatches.push('clear'); - } - - // math functions and constants - for (var func in math) { - if (math.expression.mathWithTransform.hasOwnProperty(func)) { - if (func.indexOf(keyword) == 0 - && !completionMatches.includes(func)) { - completionMatches.push(func); - } - } - } - - // units - var Unit = math.Unit; - for (name in Unit.UNITS) { - if (Unit.UNITS.hasOwnProperty(name)) { - if (name.indexOf(keyword) == 0 - && !completionMatches.includes(name)) { - completionMatches.push(name); - } - } - } - for (name in Unit.PREFIXES) { - if (Unit.PREFIXES.hasOwnProperty(name)) { - var prefixes = Unit.PREFIXES[name]; - for (var prefix in prefixes) { - if (prefixes.hasOwnProperty(prefix)) { - if (prefix.indexOf(keyword) == 0 - && !completionMatches.includes(prefix)) { - completionMatches.push(prefix); - } - else if (keyword.indexOf(prefix) == 0) { - var unitKeyword = keyword.substring(prefix.length); - - for (var n in Unit.UNITS) { - if (Unit.UNITS.hasOwnProperty(n)) { - if (n.indexOf(unitKeyword) == 0 - && Unit.isValuelessUnit(prefix + n) - && !completionMatches.includes(prefix + n)) { - completionMatches.push(prefix + n); - } - } - } - } - } - } - } - } - } - // TODO: in case of multiple matches, show a drop-down box to select one - // but for now, just cycle through them - const match = completionMatches[completionIndex]; - if (match) { - text = text.substring(0, text.length - keyword.length) + match; - dom.input.value = text; - } - } - } - - /** - * KeyDown event handler to catch global key presses in the window - * @param {Event} event - */ - function onWindowKeyDown (event) { - if (dom.frame.parentNode != container) { - destroy(); - } - - event = event || window.event; - var target = event.target || event.srcElement; - var keynum = event.which || event.keyCode; - if (keynum == 83) { // s - if (target.nodeName.toUpperCase() != 'INPUT') { - dom.input.focus(); - util.preventDefault(event); - util.stopPropagation(event); - } - } - else if (keynum == 71) { // g - if (target.nodeName.toUpperCase() != 'INPUT') { - var search = document.getElementById('gsc-i-id1'); - if (search) search.focus(); - util.preventDefault(event); - util.stopPropagation(event); - } - } - else if (keynum == 27) { // ESC - if (fullscreen) { - exitFullscreen(); - util.preventDefault(event); - util.stopPropagation(event); - } - } - else if (event.ctrlKey && keynum == 122) { // Ctrl+F11 - toggleFullscreen(); - if (fullscreen) { - dom.input.focus(); - } - util.preventDefault(event); - util.stopPropagation(event); - } - } - - /** - * Resize event handler - */ - function onWindowResize () { - if (dom.frame.parentNode != container) { - destroy(); - } - - resize(); - } - - /** - * KeyDown handler for the input field - * @param event - * @returns {boolean} - */ - function onKeyDown (event) { - event = event || window.event; - - var keynum = event.which || event.keyCode; - switch (keynum) { - case 9: // Tab - autoComplete(); - util.preventDefault(event); - util.stopPropagation(event); - return false; - break; - - case 13: // Enter - evalInput(); - util.preventDefault(event); - util.stopPropagation(event); - return false; - break; - - case 38: // Arrow up - if (historyIndex > 0) { - historyIndex--; - dom.input.value = history[historyIndex] || ''; - util.preventDefault(event); - util.stopPropagation(event); - } - return false; - break; - - case 40: // Arrow down - if (historyIndex < history.length) { - historyIndex++; - dom.input.value = history[historyIndex] || ''; - util.preventDefault(event); - util.stopPropagation(event); - } - return false; - break; - - default: - historyIndex = history.length; - break; - } - - return true; - } - - /** - * Destroy the editor: cleanup HTML DOM and global event listeners - */ - function create() { - // create main frame for the editor - dom.frame = document.createElement('div'); - dom.frame.className = 'cle'; - container.appendChild(dom.frame); - - // create two panels for the layout - dom.topPanel = document.createElement('div'); - dom.topPanel.className = 'top-panel'; - dom.frame.appendChild(dom.topPanel); - dom.bottomPanel = document.createElement('div'); - dom.bottomPanel.className = 'bottom-panel'; - dom.frame.appendChild(dom.bottomPanel); - - // create div to hold the results - dom.results = document.createElement('div'); - dom.results.className = 'results'; - dom.topPanel.appendChild(dom.results); - - // create fullscreen button - dom.fullscreen = document.createElement('button'); - dom.fullscreen.className = 'fullscreen'; - dom.fullscreen.title = 'Toggle full screen display (Ctrl+F11)'; - dom.fullscreen.onclick = toggleFullscreen; - dom.topPanel.appendChild(dom.fullscreen); - - // panels for the input field and button - dom.inputLeft = document.createElement('div'); - dom.inputLeft.className = 'input-left'; - dom.bottomPanel.appendChild(dom.inputLeft); - dom.inputRight = document.createElement('div'); - dom.inputRight.className = 'input-right'; - dom.bottomPanel.appendChild(dom.inputRight); - - dom.input = document.createElement('input'); - dom.input.className = 'input'; - dom.input.title = 'Enter an expression'; - dom.input.onkeydown = onKeyDown; - dom.inputLeft.appendChild(dom.input); - - // create an eval button - dom.btnEval = document.createElement('button'); - dom.btnEval.appendChild(document.createTextNode('Evaluate')); - dom.btnEval.className = 'eval'; - dom.btnEval.title = 'Evaluate the expression (Enter)'; - dom.btnEval.onclick = evalInput; - dom.inputRight.appendChild(dom.btnEval); - - // create global event listeners - util.addEventListener(window, 'keydown', onWindowKeyDown); - util.addEventListener(window, 'resize', onWindowResize); - } - - /** - * Destroy the editor: cleanup HTML DOM and global event listeners - */ - function destroy() { - // destroy DOM - if (dom.frame.parentNode) { - dom.frame.parentNode.removeChild(dom.frame); - } - - // destroy event listeners - util.removeEventListener(window, 'keydown', onWindowKeyDown); - util.removeEventListener(window, 'resize', onWindowResize); - } - - /** - * Trim a string - * https://stackoverflow.com/a/498995/1262753 - * @param str - * @return {*|void} - */ - function trim(str) { - return str.replace(/^\s+|\s+$/g, ''); - } - - /** - * Load saved expressions or example expressions - */ - function load() { - var expressions; - if (localStorage) { - // load expressions from local storage - var data = localStorage[id]; - if (data) { - expressions = JSON.parse(data); - } - } - if (!expressions || !(expressions instanceof Array)) { - // load some example expressions - expressions = [ - '1.2 / (3.3 + 1.7)', - 'a = 5.08 cm + 2 inch', - 'a to inch', - 'sin(90 deg)', - 'f(x, y) = x ^ y', - 'f(2, 3)' - ]; - } - - // evaluate all expressions - expressions.forEach(function (expr) { - eval(expr); - }); - } - - /** - * Save executed expressions - */ - function save() { - if (localStorage) { - localStorage[id] = JSON.stringify(history); - } - } - - function clear() { - history = []; - historyIndex = -1; - parser.clear(); - - util.clearDOM(dom.results); - dom.input.value = ''; - resize(); - // save(); // TODO: save expressions (first we need a method to restore the examples) - } - - function eval (expr) { - expr = trim(expr); - - if (expr == 'clear') { - clear(); - return; - } - - if (expr) { - history.push(expr); - historyIndex = history.length; - - var res, resStr, info; - try { - res = parser.evaluate(expr); - resStr = math.format(res, { precision: 14 }); - var unRoundedStr = math.format(res); - if (unRoundedStr.length - resStr.length > 4) { - info = [ - createDiv('This result contains a round-off error which is hidden from the output. The unrounded result is:'), - createDiv(unRoundedStr), - createA('read more...', 'docs/datatypes/numbers.html#roundoff-errors', '_blank') - ]; - } - } - catch (err) { - resStr = err.toString(); - } - - var preExpr = document.createElement('pre'); - preExpr.className = 'expr'; - preExpr.appendChild(document.createTextNode(expr)); - dom.results.appendChild(preExpr); - - var preRes = document.createElement('pre'); - preRes.className = 'res'; - preRes.appendChild(document.createTextNode(resStr)); - if (info) { - var divInfo = document.createElement('div'); - info.forEach(function (elem) { - divInfo.appendChild(elem); - }); - divInfo.style.display = 'none'; - - var divInfoIcon = document.createElement('span'); - divInfoIcon.appendChild(document.createTextNode('round-off error')); - divInfoIcon.className = 'result-info-icon'; - divInfoIcon.title = 'Click to see more info'; - divInfoIcon.onclick = function () { - // toggle display - divInfo.style.display = (divInfo.style.display == '') ? 'none' : ''; - resize(); - }; - - preRes.appendChild(divInfoIcon); - preRes.appendChild(divInfo); - } - dom.results.appendChild(preRes); - - scrollDown(); - dom.input.value = ''; - - resize(); - // save(); // TODO: save expressions (first we need a method to restore the examples) - } - } - - function evalInput() { - eval(dom.input.value); - } - - create(); - load(); -} - -var container = document.getElementById('commandline'); -if (container) { - var editor = new CommandLineEditor({ - container: container, - math: math - }); -} - - -/** - * Test whether the child rect fits completely inside the parent rect. - * @param {ClientRect} parent - * @param {ClientRect} child - * @param {number} margin - */ -function insideRect (parent, child, margin) { - var _margin = margin !== undefined ? margin : 0; - return child.left - _margin >= parent.left - && child.right + _margin <= parent.right - && child.top - _margin >= parent.top - && child.bottom + _margin <= parent.bottom; -} - -function createDiv (text) { - var div = document.createElement('div'); - div.appendChild(document.createTextNode(text)); - return div; -} - -function createA (text, href, target) { - var a = document.createElement('a'); - a.href = href; - a.target = target || ''; - a.appendChild(document.createTextNode(text)); - - return a; -} diff --git a/js/lib/math.js b/js/lib/math.js deleted file mode 100644 index a6eb5a3b82..0000000000 --- a/js/lib/math.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! For license information please see math.js.LICENSE.txt */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.math=t():e.math=t()}(this,(()=>(()=>{var e={34:(e,t,n)=>{"use strict";var r=n(4901);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},81:(e,t,n)=>{"use strict";var r=n(9565),i=n(9306),o=n(8551),a=n(6823),s=n(851),u=TypeError;e.exports=function(e,t){var n=arguments.length<2?s(e):t;if(i(n))return o(r(n,e));throw new u(a(e)+" is not iterable")}},116:(e,t,n)=>{"use strict";var r=n(6518),i=n(9565),o=n(2652),a=n(9306),s=n(8551),u=n(1767),c=n(9539),l=n(4549)("find",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:l},{find:function(e){s(this);try{a(e)}catch(e){c(this,"throw",e)}if(l)return i(l,this,e);var t=u(this),n=0;return o(t,(function(t,r){if(e(t,n++))return r(t)}),{IS_RECORD:!0,INTERRUPTED:!0}).result}})},280:(e,t,n)=>{"use strict";var r=n(6518),i=n(7751),o=n(6395),a=n(550),s=n(916).CONSTRUCTOR,u=n(3438),c=i("Promise"),l=o&&!s;r({target:"Promise",stat:!0,forced:o||s},{resolve:function(e){return u(l&&this===c?a:this,e)}})},283:(e,t,n)=>{"use strict";var r=n(9504),i=n(9039),o=n(4901),a=n(9297),s=n(3724),u=n(350).CONFIGURABLE,c=n(3706),l=n(1181),f=l.enforce,p=l.get,m=String,h=Object.defineProperty,d=r("".slice),g=r("".replace),y=r([].join),x=s&&!i((function(){return 8!==h((function(){}),"length",{value:8}).length})),b=String(String).split("String"),v=e.exports=function(e,t,n){"Symbol("===d(m(t),0,7)&&(t="["+g(m(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!a(e,"name")||u&&e.name!==t)&&(s?h(e,"name",{value:t,configurable:!0}):e.name=t),x&&n&&a(n,"arity")&&e.length!==n.arity&&h(e,"length",{value:n.arity});try{n&&a(n,"constructor")&&n.constructor?s&&h(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=f(e);return a(r,"source")||(r.source=y(b,"string"==typeof t?t:"")),e};Function.prototype.toString=v((function(){return o(this)&&p(this).source||c(this)}),"toString")},350:(e,t,n)=>{"use strict";var r=n(3724),i=n(9297),o=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,s=i(o,"name"),u=s&&"something"===function(){}.name,c=s&&(!r||r&&a(o,"name").configurable);e.exports={EXISTS:s,PROPER:u,CONFIGURABLE:c}},397:(e,t,n)=>{"use strict";var r=n(7751);e.exports=r("document","documentElement")},421:e=>{"use strict";e.exports={}},436:(e,t,n)=>{"use strict";var r,i,o,a=n(6518),s=n(6395),u=n(6193),c=n(4576),l=n(9565),f=n(6840),p=n(2967),m=n(687),h=n(7633),d=n(9306),g=n(4901),y=n(34),x=n(679),b=n(2293),v=n(9225).set,w=n(1955),N=n(3138),E=n(1103),A=n(8265),S=n(1181),M=n(550),C=n(916),T=n(6043),B="Promise",D=C.CONSTRUCTOR,F=C.REJECTION_EVENT,O=C.SUBCLASSING,_=S.getterFor(B),I=S.set,z=M&&M.prototype,k=M,R=z,q=c.TypeError,P=c.document,j=c.process,U=T.f,L=U,$=!!(P&&P.createEvent&&c.dispatchEvent),H="unhandledrejection",G=function(e){var t;return!(!y(e)||!g(t=e.then))&&t},V=function(e,t){var n,r,i,o=t.value,a=1===t.state,s=a?e.ok:e.fail,u=e.resolve,c=e.reject,f=e.domain;try{s?(a||(2===t.rejection&&X(t),t.rejection=1),!0===s?n=o:(f&&f.enter(),n=s(o),f&&(f.exit(),i=!0)),n===e.promise?c(new q("Promise-chain cycle")):(r=G(n))?l(r,n,u,c):u(n)):c(o)}catch(e){f&&!i&&f.exit(),c(e)}},Z=function(e,t){e.notified||(e.notified=!0,w((function(){for(var n,r=e.reactions;n=r.get();)V(n,e);e.notified=!1,t&&!e.rejection&&Y(e)})))},W=function(e,t,n){var r,i;$?((r=P.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),c.dispatchEvent(r)):r={promise:t,reason:n},!F&&(i=c["on"+e])?i(r):e===H&&N("Unhandled promise rejection",n)},Y=function(e){l(v,c,(function(){var t,n=e.facade,r=e.value;if(J(e)&&(t=E((function(){u?j.emit("unhandledRejection",r,n):W(H,n,r)})),e.rejection=u||J(e)?2:1,t.error))throw t.value}))},J=function(e){return 1!==e.rejection&&!e.parent},X=function(e){l(v,c,(function(){var t=e.facade;u?j.emit("rejectionHandled",t):W("rejectionhandled",t,e.value)}))},Q=function(e,t,n){return function(r){e(t,r,n)}},K=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,Z(e,!0))},ee=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw new q("Promise can't be resolved itself");var r=G(t);r?w((function(){var n={done:!1};try{l(r,t,Q(ee,n,e),Q(K,n,e))}catch(t){K(n,t,e)}})):(e.value=t,e.state=1,Z(e,!1))}catch(t){K({done:!1},t,e)}}};if(D&&(R=(k=function(e){x(this,R),d(e),l(r,this);var t=_(this);try{e(Q(ee,t),Q(K,t))}catch(e){K(t,e)}}).prototype,(r=function(e){I(this,{type:B,done:!1,notified:!1,parent:!1,reactions:new A,rejection:!1,state:0,value:null})}).prototype=f(R,"then",(function(e,t){var n=_(this),r=U(b(this,k));return n.parent=!0,r.ok=!g(e)||e,r.fail=g(t)&&t,r.domain=u?j.domain:void 0,0===n.state?n.reactions.add(r):w((function(){V(r,n)})),r.promise})),i=function(){var e=new r,t=_(e);this.promise=e,this.resolve=Q(ee,t),this.reject=Q(K,t)},T.f=U=function(e){return e===k||void 0===e?new i(e):L(e)},!s&&g(M)&&z!==Object.prototype)){o=z.then,O||f(z,"then",(function(e,t){var n=this;return new k((function(e,t){l(o,n,e,t)})).then(e,t)}),{unsafe:!0});try{delete z.constructor}catch(e){}p&&p(z,R)}a({global:!0,constructor:!0,wrap:!0,forced:D},{Promise:k}),m(k,B,!1,!0),h(B)},537:(e,t,n)=>{"use strict";var r=n(550),i=n(4428),o=n(916).CONSTRUCTOR;e.exports=o||!i((function(e){r.all(e).then(void 0,(function(){}))}))},550:(e,t,n)=>{"use strict";var r=n(4576);e.exports=r.Promise},616:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},655:(e,t,n)=>{"use strict";var r=n(6955),i=String;e.exports=function(e){if("Symbol"===r(e))throw new TypeError("Cannot convert a Symbol value to a string");return i(e)}},679:(e,t,n)=>{"use strict";var r=n(1625),i=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new i("Incorrect invocation")}},687:(e,t,n)=>{"use strict";var r=n(4913).f,i=n(9297),o=n(8227)("toStringTag");e.exports=function(e,t,n){e&&!n&&(e=e.prototype),e&&!i(e,o)&&r(e,o,{configurable:!0,value:t})}},741:e=>{"use strict";var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},757:(e,t,n)=>{"use strict";var r=n(7751),i=n(4901),o=n(1625),a=n(7040),s=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return i(t)&&o(t.prototype,s(e))}},788:(e,t,n)=>{"use strict";var r=n(34),i=n(2195),o=n(8227)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[o])?!!t:"RegExp"===i(e))}},851:(e,t,n)=>{"use strict";var r=n(6955),i=n(5966),o=n(4117),a=n(6269),s=n(8227)("iterator");e.exports=function(e){if(!o(e))return i(e,s)||i(e,"@@iterator")||a[r(e)]}},916:(e,t,n)=>{"use strict";var r=n(4576),i=n(550),o=n(4901),a=n(2796),s=n(3706),u=n(8227),c=n(4215),l=n(6395),f=n(9519),p=i&&i.prototype,m=u("species"),h=!1,d=o(r.PromiseRejectionEvent),g=a("Promise",(function(){var e=s(i),t=e!==String(i);if(!t&&66===f)return!0;if(l&&(!p.catch||!p.finally))return!0;if(!f||f<51||!/native code/.test(e)){var n=new i((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};if((n.constructor={})[m]=r,!(h=n.then((function(){}))instanceof r))return!0}return!(t||"BROWSER"!==c&&"DENO"!==c||d)}));e.exports={CONSTRUCTOR:g,REJECTION_EVENT:d,SUBCLASSING:h}},926:(e,t,n)=>{"use strict";var r=n(9306),i=n(8981),o=n(7055),a=n(6198),s=TypeError,u="Reduce of empty array with no initial value",c=function(e){return function(t,n,c,l){var f=i(t),p=o(f),m=a(f);if(r(n),0===m&&c<2)throw new s(u);var h=e?m-1:0,d=e?-1:1;if(c<2)for(;;){if(h in p){l=p[h],h+=d;break}if(h+=d,e?h<0:m<=h)throw new s(u)}for(;e?h>=0:m>h;h+=d)h in p&&(l=n(l,p[h],h,f));return l}};e.exports={left:c(!1),right:c(!0)}},1034:(e,t,n)=>{"use strict";var r=n(9565),i=n(9297),o=n(1625),a=n(7979),s=RegExp.prototype;e.exports=function(e){var t=e.flags;return void 0!==t||"flags"in s||i(e,"flags")||!o(s,e)?t:r(a,e)}},1056:(e,t,n)=>{"use strict";var r=n(4913).f;e.exports=function(e,t,n){n in e||r(e,n,{configurable:!0,get:function(){return t[n]},set:function(e){t[n]=e}})}},1072:(e,t,n)=>{"use strict";var r=n(1828),i=n(8727);e.exports=Object.keys||function(e){return r(e,i)}},1103:e=>{"use strict";e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},1148:(e,t,n)=>{"use strict";var r=n(6518),i=n(9565),o=n(2652),a=n(9306),s=n(8551),u=n(1767),c=n(9539),l=n(4549)("every",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:l},{every:function(e){s(this);try{a(e)}catch(e){c(this,"throw",e)}if(l)return i(l,this,e);var t=u(this),n=0;return!o(t,(function(t,r){if(!e(t,n++))return r()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},1181:(e,t,n)=>{"use strict";var r,i,o,a=n(8622),s=n(4576),u=n(34),c=n(6699),l=n(9297),f=n(7629),p=n(6119),m=n(421),h="Object already initialized",d=s.TypeError,g=s.WeakMap;if(a||f.state){var y=f.state||(f.state=new g);y.get=y.get,y.has=y.has,y.set=y.set,r=function(e,t){if(y.has(e))throw new d(h);return t.facade=e,y.set(e,t),t},i=function(e){return y.get(e)||{}},o=function(e){return y.has(e)}}else{var x=p("state");m[x]=!0,r=function(e,t){if(l(e,x))throw new d(h);return t.facade=e,c(e,x,t),t},i=function(e){return l(e,x)?e[x]:{}},o=function(e){return l(e,x)}}e.exports={set:r,get:i,has:o,enforce:function(e){return o(e)?i(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!u(t)||(n=i(t)).type!==e)throw new d("Incompatible receiver, "+e+" required");return n}}}},1234:()=>{},1291:(e,t,n)=>{"use strict";var r=n(741);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},1454:(e,t,n)=>{"use strict";n(1701)},1481:(e,t,n)=>{"use strict";var r=n(6518),i=n(6043);r({target:"Promise",stat:!0,forced:n(916).CONSTRUCTOR},{reject:function(e){var t=i.f(this);return(0,t.reject)(e),t.promise}})},1504:e=>{function t(){}t.prototype={on:function(e,t,n){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var r=this;function i(){r.off(e,i),t.apply(n,arguments)}return i._=t,this.on(e,i,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),r=0,i=n.length;r{"use strict";var r=n(9504);e.exports=r({}.isPrototypeOf)},1701:(e,t,n)=>{"use strict";var r=n(6518),i=n(9565),o=n(9306),a=n(8551),s=n(1767),u=n(9462),c=n(6319),l=n(9539),f=n(4549),p=n(6395),m=!p&&f("map",TypeError),h=u((function(){var e=this.iterator,t=a(i(this.next,e));if(!(this.done=!!t.done))return c(e,this.mapper,[t.value,this.counter++],!0)}));r({target:"Iterator",proto:!0,real:!0,forced:p||m},{map:function(e){a(this);try{o(e)}catch(e){l(this,"throw",e)}return m?i(m,this,e):new h(s(this),{mapper:e})}})},1767:e=>{"use strict";e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},1795:(e,t,n)=>{"use strict";n(1806)},1806:(e,t,n)=>{"use strict";var r=n(6518),i=n(8551),o=n(2652),a=n(1767),s=[].push;r({target:"Iterator",proto:!0,real:!0},{toArray:function(){var e=[];return o(a(i(this)),s,{that:e,IS_RECORD:!0}),e}})},1828:(e,t,n)=>{"use strict";var r=n(9504),i=n(9297),o=n(5397),a=n(9617).indexOf,s=n(421),u=r([].push);e.exports=function(e,t){var n,r=o(e),c=0,l=[];for(n in r)!i(s,n)&&i(r,n)&&u(l,n);for(;t.length>c;)i(r,n=t[c++])&&(~a(l,n)||u(l,n));return l}},1880:e=>{e.exports=function e(t,n){"use strict";var r,i,o=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,a=/(^[ ]*|[ ]*$)/g,s=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,u=/^0x[0-9a-f]+$/i,c=/^0/,l=function(t){return e.insensitive&&(""+t).toLowerCase()||""+t},f=l(t).replace(a,"")||"",p=l(n).replace(a,"")||"",m=f.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=p.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),d=parseInt(f.match(u),16)||1!==m.length&&f.match(s)&&Date.parse(f),g=parseInt(p.match(u),16)||d&&p.match(s)&&Date.parse(p)||null;if(g){if(dg)return 1}for(var y=0,x=Math.max(m.length,h.length);yi)return 1}return 0}},1955:(e,t,n)=>{"use strict";var r,i,o,a,s,u=n(4576),c=n(3389),l=n(6080),f=n(9225).set,p=n(8265),m=n(9544),h=n(4265),d=n(7860),g=n(6193),y=u.MutationObserver||u.WebKitMutationObserver,x=u.document,b=u.process,v=u.Promise,w=c("queueMicrotask");if(!w){var N=new p,E=function(){var e,t;for(g&&(e=b.domain)&&e.exit();t=N.get();)try{t()}catch(e){throw N.head&&r(),e}e&&e.enter()};m||g||d||!y||!x?!h&&v&&v.resolve?((a=v.resolve(void 0)).constructor=v,s=l(a.then,a),r=function(){s(E)}):g?r=function(){b.nextTick(E)}:(f=l(f,u),r=function(){f(E)}):(i=!0,o=x.createTextNode(""),new y(E).observe(o,{characterData:!0}),r=function(){o.data=i=!i}),w=function(e){N.head||r(),N.add(e)}}e.exports=w},2003:(e,t,n)=>{"use strict";var r=n(6518),i=n(6395),o=n(916).CONSTRUCTOR,a=n(550),s=n(7751),u=n(4901),c=n(6840),l=a&&a.prototype;if(r({target:"Promise",proto:!0,forced:o,real:!0},{catch:function(e){return this.then(void 0,e)}}),!i&&u(a)){var f=s("Promise").prototype.catch;l.catch!==f&&c(l,"catch",f,{unsafe:!0})}},2106:(e,t,n)=>{"use strict";var r=n(283),i=n(4913);e.exports=function(e,t,n){return n.get&&r(n.get,t,{getter:!0}),n.set&&r(n.set,t,{setter:!0}),i.f(e,t,n)}},2140:(e,t,n)=>{"use strict";var r={};r[n(8227)("toStringTag")]="z",e.exports="[object z]"===String(r)},2195:(e,t,n)=>{"use strict";var r=n(9504),i=r({}.toString),o=r("".slice);e.exports=function(e){return o(i(e),8,-1)}},2211:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},2293:(e,t,n)=>{"use strict";var r=n(8551),i=n(5548),o=n(4117),a=n(8227)("species");e.exports=function(e,t){var n,s=r(e).constructor;return void 0===s||o(n=r(s)[a])?t:i(n)}},2360:(e,t,n)=>{"use strict";var r,i=n(8551),o=n(6801),a=n(8727),s=n(421),u=n(397),c=n(4055),l=n(6119),f="prototype",p="script",m=l("IE_PROTO"),h=function(){},d=function(e){return"<"+p+">"+e+""},g=function(e){e.write(d("")),e.close();var t=e.parentWindow.Object;return e=null,t},y=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}var e,t,n;y="undefined"!=typeof document?document.domain&&r?g(r):(t=c("iframe"),n="java"+p+":",t.style.display="none",u.appendChild(t),t.src=String(n),(e=t.contentWindow.document).open(),e.write(d("document.F=Object")),e.close(),e.F):g(r);for(var i=a.length;i--;)delete y[f][a[i]];return y()};s[m]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(h[f]=i(e),n=new h,h[f]=null,n[m]=e):n=y(),void 0===t?n:o.f(n,t)}},2369:function(e){e.exports=function(){"use strict";function e(){return!0}function t(){return!1}function n(){}const r="Argument is not a typed-function.";return function i(){function o(e){return"object"==typeof e&&null!==e&&e.constructor===Object}const a=[{name:"number",test:function(e){return"number"==typeof e}},{name:"string",test:function(e){return"string"==typeof e}},{name:"boolean",test:function(e){return"boolean"==typeof e}},{name:"Function",test:function(e){return"function"==typeof e}},{name:"Array",test:Array.isArray},{name:"Date",test:function(e){return e instanceof Date}},{name:"RegExp",test:function(e){return e instanceof RegExp}},{name:"Object",test:o},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],s={name:"any",test:e,isAny:!0};let u,c,l=0,f={createCount:0};function p(e){const t=u.get(e);if(t)return t;let n='Unknown type "'+e+'"';const r=e.toLowerCase();let i;for(i of c)if(i.toLowerCase()===r){n+='. Did you mean "'+i+'" ?';break}throw new TypeError(n)}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"any";const n=t?p(t).index:c.length,r=[];for(let t=0;t{const n=u.get(t);return!n.isAny&&n.test(e)}));return t.length?t:["any"]}function g(e){return e&&"function"==typeof e&&"_typedFunctionData"in e}function y(e,t,n){if(!g(e))throw new TypeError(r);const i=n&&n.exact,o=N(Array.isArray(t)?t.join(","):t),a=x(o);if(!i||a in e.signatures){const t=e._typedFunctionData.signatureMap.get(a);if(t)return t}const s=o.length;let u,c;if(i){let t;for(t in u=[],e.signatures)u.push(e._typedFunctionData.signatureMap.get(t))}else u=e._typedFunctionData.signatures;for(let e=0;e!e.has(t.name))))continue}n.push(r)}}if(u=n,0===u.length)break}for(c of u)if(c.params.length<=s)return c;throw new TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+x(o,", ")+"))")}function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return e.map((e=>e.name)).join(t)}function b(e){const t=0===e.indexOf("..."),n=(t?e.length>3?e.slice(3):"any":e).split("|").map((e=>p(e.trim())));let r=!1,i=t?"...":"";return{types:n.map((function(e){return r=e.isAny||r,i+=e.name+"|",{name:e.name,typeIndex:e.index,test:e.test,isAny:e.isAny,conversion:null,conversionIndex:-1}})),name:i.slice(0,-1),hasAny:r,hasConversion:!1,restParam:t}}function v(e){const t=function(e){if(0===e.length)return[];const t=e.map(p);e.length>1&&t.sort(((e,t)=>e.index-t.index));let n=t[0].conversionsTo;if(1===e.length)return n;n=n.concat([]);const r=new Set(e);for(let e=1;ee.name)));let n=e.hasAny,r=e.name;const i=t.map((function(e){const t=p(e.from);return n=t.isAny||n,r+="|"+e.from,{name:e.from,typeIndex:t.index,test:t.test,isAny:t.isAny,conversion:e,conversionIndex:e.index}}));return{types:e.types.concat(i),name:r,hasAny:n,hasConversion:i.length>0,restParam:e.restParam}}function w(e){return e.typeSet||(e.typeSet=new Set,e.types.forEach((t=>e.typeSet.add(t.name)))),e.typeSet}function N(e){const t=[];if("string"!=typeof e)throw new TypeError("Signatures must be strings");const n=e.trim();if(""===n)return t;const r=n.split(",");for(let e=0;e=n+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(n=A(e[0]),function(e){return n(e[0])&&1===e.length}):2===e.length?(n=A(e[0]),r=A(e[1]),function(e){return n(e[0])&&r(e[1])&&2===e.length}):(t=e.map(A),function(e){for(let n=0;n{const r=C(e.params,t);let i;for(i of r)n.add(i)})),n.has("any")?["any"]:Array.from(n)}function D(e,t,n){let r,i;const o=e||"unnamed";let a,s=n;for(a=0;a{const r=A(M(n.params,a));(a0){const e=d(t[a]);return r=new TypeError("Unexpected type of argument in function "+o+" (expected: "+i.join(" or ")+", actual: "+e.join(" | ")+", index: "+a+")"),r.data={category:"wrongType",fn:o,index:a,actual:e,expected:i},r}}else s=e}const u=s.map((function(e){return E(e.params)?1/0:e.params.length}));if(t.lengthc)return r=new TypeError("Too many arguments in function "+o+" (expected: "+c+", actual: "+t.length+")"),r.data={category:"tooManyArgs",fn:o,index:t.length,expectedLength:c},r;const l=[];for(let e=0;e0)return 1;const r=O(e)-O(t);return r<0?-1:r>0?1:0}function I(e,t){const n=e.params,r=t.params,i=H(n),o=H(r),a=E(n),s=E(r);if(a&&i.hasAny){if(!s||!o.hasAny)return 1}else if(s&&o.hasAny)return-1;let u,c=0,l=0;for(u of n)u.hasAny&&++c,u.hasConversion&&++l;let f=0,p=0;for(u of r)u.hasAny&&++f,u.hasConversion&&++p;if(c!==f)return c-f;if(a&&i.hasConversion){if(!s||!o.hasConversion)return 1}else if(s&&o.hasConversion)return-1;if(l!==p)return l-p;if(a){if(!s)return 1}else if(s)return-1;const m=(n.length-r.length)*(a?-1:1);if(0!==m)return m;const h=[];let d,g=0;for(let e=0;ee.hasConversion))){const r=E(e),i=e.map(k);n=function(){const e=[],n=r?arguments.length-1:arguments.length;for(let t=0;te.name)).join("|"),hasAny:e.some((e=>e.isAny)),hasConversion:!1,restParam:!0}),s.push(a)}else s=a.types.map((function(e){return{types:[e],name:e.name,hasAny:e.isAny,hasConversion:e.conversion,restParam:!1}}));return i=s,o=function(i){return e(t,n+1,r.concat([i]))},Array.prototype.concat.apply([],i.map(o))}var i,o;return[r]}(e,0,[])}function q(e,t){const n=Math.max(e.length,t.length);for(let r=0;r=r:a?r>=i:r===i}function P(e,t,n){const r=[];let i;for(i of e){let e=n[i];if("number"!=typeof e)throw new TypeError('No definition for referenced signature "'+i+'"');if(e=t[e],"function"!=typeof e)return!1;r.push(e)}return r}function j(e,t,n){const r=function(e){return e.map((e=>Y(e)?Z(e.referToSelf.callback):W(e)?V(e.referTo.references,e.referTo.callback):e))}(e),i=new Array(r.length).fill(!1);let o=!0;for(;o;){o=!1;let e=!0;for(let a=0;a{const r=e[n];if(t.test(r.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")}))}(r);const i=[],o=[],a={},s=[];let u;for(u in r){if(!Object.prototype.hasOwnProperty.call(r,u))continue;const e=N(u);if(!e)continue;i.forEach((function(t){if(q(t,e))throw new TypeError('Conflicting signatures "'+x(t)+'" and "'+x(e)+'".')})),i.push(e);const t=o.length;o.push(r[u]);const n=e.map(v);let c;for(c of R(n)){const e=x(c);s.push({params:c,name:e,fn:t}),c.every((e=>!e.hasConversion))&&(a[e]=t)}}s.sort(I);const c=j(o,a,se);let l;for(l in a)Object.prototype.hasOwnProperty.call(a,l)&&(a[l]=c[a[l]]);const p=[],m=new Map;for(l of s)m.has(l.name)||(l.fn=c[l.fn],p.push(l),m.set(l.name,l));const h=p[0]&&p[0].params.length<=2&&!E(p[0].params),d=p[1]&&p[1].params.length<=2&&!E(p[1].params),g=p[2]&&p[2].params.length<=2&&!E(p[2].params),y=p[3]&&p[3].params.length<=2&&!E(p[3].params),b=p[4]&&p[4].params.length<=2&&!E(p[4].params),w=p[5]&&p[5].params.length<=2&&!E(p[5].params),M=h&&d&&g&&y&&b&&w;for(let e=0;ee.test)),oe=p.map((e=>e.implementation)),ae=function(){for(let e=ne;ex(N(e)))),t=H(arguments);if("function"!=typeof t)throw new TypeError("Callback function expected as last argument");return V(e,t)},f.referToSelf=Z,f.convert=function(e,t){const n=p(t);if(n.test(e))return e;const r=n.conversionsTo;if(0===r.length)throw new Error("There are no conversions to "+t+" defined.");for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:{override:!1};ee(e);const n=p(e.to),r=n.conversionsTo.find((t=>t.from===e.from));if(r){if(!t||!t.override)throw new Error('There is already a conversion from "'+e.from+'" to "'+n.name+'"');f.removeConversion({from:r.from,to:e.to,convert:r.convert})}n.conversionsTo.push({from:e.from,convert:e.convert,index:l++})},f.addConversions=function(e,t){e.forEach((e=>f.addConversion(e,t)))},f.removeConversion=function(e){ee(e);const t=p(e.to),n=function(e,t){for(let n=0;nt.from===e.from));if(!n)throw new Error("Attempt to remove nonexistent conversion from "+e.from+" to "+e.to);if(n.convert!==e.convert)throw new Error("Conversion to remove does not match existing conversion");const r=t.conversionsTo.indexOf(n);t.conversionsTo.splice(r,1)},f.resolve=function(e,t){if(!g(e))throw new TypeError(r);const n=e._typedFunctionData.signatures;for(let e=0;e{"use strict";var r=n(9504),i=n(8981),o=Math.floor,a=r("".charAt),s=r("".replace),u=r("".slice),c=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,l=/\$([$&'`]|\d{1,2})/g;e.exports=function(e,t,n,r,f,p){var m=n+e.length,h=r.length,d=l;return void 0!==f&&(f=i(f),d=c),s(p,d,(function(i,s){var c;switch(a(s,0)){case"$":return"$";case"&":return e;case"`":return u(t,0,n);case"'":return u(t,m);case"<":c=f[u(s,1,-1)];break;default:var l=+s;if(0===l)return i;if(l>h){var p=o(l/10);return 0===p?i:p<=h?void 0===r[p-1]?a(s,1):r[p-1]+a(s,1):i}c=r[l-1]}return void 0===c?"":c}))}},2489:(e,t,n)=>{"use strict";var r=n(6518),i=n(9565),o=n(9306),a=n(8551),s=n(1767),u=n(9462),c=n(6319),l=n(6395),f=n(9539),p=n(4549),m=!l&&p("filter",TypeError),h=u((function(){for(var e,t,n=this.iterator,r=this.predicate,o=this.next;;){if(e=a(i(o,n)),this.done=!!e.done)return;if(t=e.value,c(n,r,[t,this.counter++],!0))return t}}));r({target:"Iterator",proto:!0,real:!0,forced:l||m},{filter:function(e){a(this);try{o(e)}catch(e){f(this,"throw",e)}return m?i(m,this,e):new h(s(this),{predicate:e})}})},2529:e=>{"use strict";e.exports=function(e,t){return{value:e,done:t}}},2577:(e,t,n)=>{"use strict";n(116)},2652:(e,t,n)=>{"use strict";var r=n(6080),i=n(9565),o=n(8551),a=n(6823),s=n(4209),u=n(6198),c=n(1625),l=n(81),f=n(851),p=n(9539),m=TypeError,h=function(e,t){this.stopped=e,this.result=t},d=h.prototype;e.exports=function(e,t,n){var g,y,x,b,v,w,N,E=n&&n.that,A=!(!n||!n.AS_ENTRIES),S=!(!n||!n.IS_RECORD),M=!(!n||!n.IS_ITERATOR),C=!(!n||!n.INTERRUPTED),T=r(t,E),B=function(e){return g&&p(g,"normal",e),new h(!0,e)},D=function(e){return A?(o(e),C?T(e[0],e[1],B):T(e[0],e[1])):C?T(e,B):T(e)};if(S)g=e.iterator;else if(M)g=e;else{if(!(y=f(e)))throw new m(a(e)+" is not iterable");if(s(y)){for(x=0,b=u(e);b>x;x++)if((v=D(e[x]))&&c(d,v))return v;return new h(!1)}g=l(e,y)}for(w=S?e.next:g.next;!(N=i(w,g)).done;){try{v=D(N.value)}catch(e){p(g,"throw",e)}if("object"==typeof v&&v&&c(d,v))return v}return new h(!1)}},2712:(e,t,n)=>{"use strict";var r=n(6518),i=n(926).left,o=n(4598),a=n(9519);r({target:"Array",proto:!0,forced:!n(6193)&&a>79&&a<83||!o("reduce")},{reduce:function(e){var t=arguments.length;return i(this,e,t,t>1?arguments[1]:void 0)}})},2777:(e,t,n)=>{"use strict";var r=n(9565),i=n(34),o=n(757),a=n(5966),s=n(4270),u=n(8227),c=TypeError,l=u("toPrimitive");e.exports=function(e,t){if(!i(e)||o(e))return e;var n,u=a(e,l);if(u){if(void 0===t&&(t="default"),n=r(u,e,t),!i(n)||o(n))return n;throw new c("Can't convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},2787:(e,t,n)=>{"use strict";var r=n(9297),i=n(4901),o=n(8981),a=n(6119),s=n(2211),u=a("IE_PROTO"),c=Object,l=c.prototype;e.exports=s?c.getPrototypeOf:function(e){var t=o(e);if(r(t,u))return t[u];var n=t.constructor;return i(n)&&t instanceof n?n.prototype:t instanceof c?l:null}},2796:(e,t,n)=>{"use strict";var r=n(9039),i=n(4901),o=/#|\.prototype\./,a=function(e,t){var n=u[s(e)];return n===l||n!==c&&(i(t)?r(t):!!t)},s=a.normalize=function(e){return String(e).replace(o,".").toLowerCase()},u=a.data={},c=a.NATIVE="N",l=a.POLYFILL="P";e.exports=a},2812:e=>{"use strict";var t=TypeError;e.exports=function(e,n){if(e{"use strict";var r=n(4576).navigator,i=r&&r.userAgent;e.exports=i?String(i):""},2967:(e,t,n)=>{"use strict";var r=n(6706),i=n(34),o=n(7750),a=n(3506);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=r(Object.prototype,"__proto__","set"))(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return o(n),a(r),i(n)?(t?e(n,r):n.__proto__=r,n):n}}():void 0)},3031:function(e,t,n){var r;!function(e,i){function o(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r>>4),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function s(e,t){var n=new o(e),r=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,r&&("object"==typeof r&&a(r,n),i.state=function(){return a(n,{})}),i}i&&i.exports?i.exports=s:n.amdD&&n.amdO?void 0===(r=function(){return s}.call(t,n,t,i))||(i.exports=r):this.xorwow=s}(0,e=n.nmd(e),n.amdD)},3110:(e,t,n)=>{"use strict";var r=n(6518),i=n(7751),o=n(8745),a=n(9565),s=n(9504),u=n(9039),c=n(4901),l=n(757),f=n(7680),p=n(6933),m=n(4495),h=String,d=i("JSON","stringify"),g=s(/./.exec),y=s("".charAt),x=s("".charCodeAt),b=s("".replace),v=s(1..toString),w=/[\uD800-\uDFFF]/g,N=/^[\uD800-\uDBFF]$/,E=/^[\uDC00-\uDFFF]$/,A=!m||u((function(){var e=i("Symbol")("stringify detection");return"[null]"!==d([e])||"{}"!==d({a:e})||"{}"!==d(Object(e))})),S=u((function(){return'"\\udf06\\ud834"'!==d("\udf06\ud834")||'"\\udead"'!==d("\udead")})),M=function(e,t){var n=f(arguments),r=p(t);if(c(r)||void 0!==e&&!l(e))return n[1]=function(e,t){if(c(r)&&(t=a(r,this,h(e),t)),!l(t))return t},o(d,null,n)},C=function(e,t,n){var r=y(n,t-1),i=y(n,t+1);return g(N,e)&&!g(E,i)||g(E,e)&&!g(N,r)?"\\u"+v(x(e,0),16):e};d&&r({target:"JSON",stat:!0,arity:3,forced:A||S},{stringify:function(e,t,n){var r=f(arguments),i=o(A?M:d,null,r);return S&&"string"==typeof i?b(i,w,C):i}})},3138:e=>{"use strict";e.exports=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}}},3144:e=>{"use strict";var t=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},a=o.preserveFormatting,s=void 0!==a&&a,u=o.escapeMapFn,c=void 0===u?i:u,l=String(e),f="",p=c(t({},n),s?t({},r):{}),m=Object.keys(p),h=function(){var e=!1;m.forEach((function(t,n){e||l.length>=t.length&&l.slice(0,t.length)===t&&(f+=p[m[n]],l=l.slice(t.length,l.length),e=!0)})),e||(f+=l.slice(0,1),l=l.slice(1,l.length))};l;)h();return f}},3167:(e,t,n)=>{"use strict";var r=n(4901),i=n(34),o=n(2967);e.exports=function(e,t,n){var a,s;return o&&r(a=t.constructor)&&a!==n&&i(s=a.prototype)&&s!==n.prototype&&o(e,s),e}},3181:function(e,t,n){var r;!function(e,i){function o(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,r&&("object"==typeof r&&a(r,n),i.state=function(){return a(n,{})}),i}i&&i.exports?i.exports=s:n.amdD&&n.amdO?void 0===(r=function(){return s}.call(t,n,t,i))||(i.exports=r):this.xor128=s}(0,e=n.nmd(e),n.amdD)},3215:(e,t,n)=>{"use strict";n(1148)},3362:(e,t,n)=>{"use strict";n(436),n(6499),n(2003),n(7743),n(1481),n(280)},3389:(e,t,n)=>{"use strict";var r=n(4576),i=n(3724),o=Object.getOwnPropertyDescriptor;e.exports=function(e){if(!i)return r[e];var t=o(r,e);return t&&t.value}},3392:(e,t,n)=>{"use strict";var r=n(9504),i=0,o=Math.random(),a=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++i+o,36)}},3438:(e,t,n)=>{"use strict";var r=n(8551),i=n(34),o=n(6043);e.exports=function(e,t){if(r(e),i(t)&&t.constructor===e)return t;var n=o.f(e);return(0,n.resolve)(t),n.promise}},3506:(e,t,n)=>{"use strict";var r=n(3925),i=String,o=TypeError;e.exports=function(e){if(r(e))return e;throw new o("Can't set "+i(e)+" as a prototype")}},3517:(e,t,n)=>{"use strict";var r=n(9504),i=n(9039),o=n(4901),a=n(6955),s=n(7751),u=n(3706),c=function(){},l=s("Reflect","construct"),f=/^\s*(?:class|function)\b/,p=r(f.exec),m=!f.test(c),h=function(e){if(!o(e))return!1;try{return l(c,[],e),!0}catch(e){return!1}},d=function(e){if(!o(e))return!1;switch(a(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return m||!!p(f,u(e))}catch(e){return!0}};d.sham=!0,e.exports=!l||i((function(){var e;return h(h.call)||!h(Object)||!h((function(){e=!0}))||e}))?d:h},3579:(e,t,n)=>{"use strict";var r=n(6518),i=n(9565),o=n(2652),a=n(9306),s=n(8551),u=n(1767),c=n(9539),l=n(4549)("some",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:l},{some:function(e){s(this);try{a(e)}catch(e){c(this,"throw",e)}if(l)return i(l,this,e);var t=u(this),n=0;return o(t,(function(t,r){if(e(t,n++))return r()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},3607:(e,t,n)=>{"use strict";var r=n(2839).match(/AppleWebKit\/(\d+)\./);e.exports=!!r&&+r[1]},3635:(e,t,n)=>{"use strict";var r=n(9039),i=n(4576).RegExp;e.exports=r((function(){var e=i(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)}))},3706:(e,t,n)=>{"use strict";var r=n(9504),i=n(4901),o=n(7629),a=r(Function.toString);i(o.inspectSource)||(o.inspectSource=function(e){return a(e)}),e.exports=o.inspectSource},3709:(e,t,n)=>{"use strict";var r=n(2839).match(/firefox\/(\d+)/i);e.exports=!!r&&+r[1]},3717:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},3724:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},3763:(e,t,n)=>{"use strict";var r=n(2839);e.exports=/MSIE|Trident/.test(r)},3921:(e,t,n)=>{"use strict";var r=n(6518),i=n(2652),o=n(4659);r({target:"Object",stat:!0},{fromEntries:function(e){var t={};return i(e,(function(e,n){o(t,e,n)}),{AS_ENTRIES:!0}),t}})},3925:(e,t,n)=>{"use strict";var r=n(34);e.exports=function(e){return r(e)||null===e}},3949:(e,t,n)=>{"use strict";n(7588)},4055:(e,t,n)=>{"use strict";var r=n(4576),i=n(34),o=r.document,a=i(o)&&i(o.createElement);e.exports=function(e){return a?o.createElement(e):{}}},4117:e=>{"use strict";e.exports=function(e){return null==e}},4209:(e,t,n)=>{"use strict";var r=n(8227),i=n(6269),o=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||a[o]===e)}},4215:(e,t,n)=>{"use strict";var r=n(4576),i=n(2839),o=n(2195),a=function(e){return i.slice(0,e.length)===e};e.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":r.Bun&&"string"==typeof Bun.version?"BUN":r.Deno&&"object"==typeof Deno.version?"DENO":"process"===o(r.process)?"NODE":r.window&&r.document?"BROWSER":"REST"},4265:(e,t,n)=>{"use strict";var r=n(2839);e.exports=/ipad|iphone|ipod/i.test(r)&&"undefined"!=typeof Pebble},4270:(e,t,n)=>{"use strict";var r=n(9565),i=n(4901),o=n(34),a=TypeError;e.exports=function(e,t){var n,s;if("string"===t&&i(n=e.toString)&&!o(s=r(n,e)))return s;if(i(n=e.valueOf)&&!o(s=r(n,e)))return s;if("string"!==t&&i(n=e.toString)&&!o(s=r(n,e)))return s;throw new a("Can't convert object to primitive value")}},4376:(e,t,n)=>{"use strict";var r=n(2195);e.exports=Array.isArray||function(e){return"Array"===r(e)}},4423:(e,t,n)=>{"use strict";var r=n(6518),i=n(9617).includes,o=n(9039),a=n(6469);r({target:"Array",proto:!0,forced:o((function(){return!Array(1).includes()}))},{includes:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),a("includes")},4428:(e,t,n)=>{"use strict";var r=n(8227)("iterator"),i=!1;try{var o=0,a={next:function(){return{done:!!o++}},return:function(){i=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){try{if(!t&&!i)return!1}catch(e){return!1}var n=!1;try{var o={};o[r]=function(){return{next:function(){return{done:n=!0}}}},e(o)}catch(e){}return n}},4488:(e,t,n)=>{"use strict";var r=n(7680),i=Math.floor,o=function(e,t){var n=e.length;if(n<8)for(var a,s,u=1;u0;)e[s]=e[--s];s!==u++&&(e[s]=a)}else for(var c=i(n/2),l=o(r(e,0,c),t),f=o(r(e,c),t),p=l.length,m=f.length,h=0,d=0;h{"use strict";var r=n(9519),i=n(9039),o=n(4576).String;e.exports=!!Object.getOwnPropertySymbols&&!i((function(){var e=Symbol("symbol detection");return!o(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},4520:(e,t,n)=>{"use strict";n(2489)},4549:(e,t,n)=>{"use strict";var r=n(4576);e.exports=function(e,t){var n=r.Iterator,i=n&&n.prototype,o=i&&i[e],a=!1;if(o)try{o.call({next:function(){return{done:!0}},return:function(){a=!0}},-1)}catch(e){e instanceof t||(a=!1)}if(!a)return o}},4576:function(e){"use strict";var t=function(e){return e&&e.Math===Math&&e};e.exports=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof global&&global)||t("object"==typeof this&&this)||function(){return this}()||Function("return this")()},4598:(e,t,n)=>{"use strict";var r=n(9039);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){return 1},1)}))}},4606:(e,t,n)=>{"use strict";var r=n(6823),i=TypeError;e.exports=function(e,t){if(!delete e[t])throw new i("Cannot delete property "+r(t)+" of "+r(e))}},4659:(e,t,n)=>{"use strict";var r=n(3724),i=n(4913),o=n(6980);e.exports=function(e,t,n){r?i.f(e,t,o(0,n)):e[t]=n}},4801:function(e,t,n){var r;!function(i,o,a){var s,u=256,c=a.pow(u,6),l=a.pow(2,52),f=2*l,p=255;function m(e,t,n){var r=[],p=y(g((t=1==t?{entropy:!0}:t||{}).entropy?[e,x(o)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(u):(e=new Uint8Array(u),(i.crypto||i.msCrypto).getRandomValues(e)),x(e)}catch(e){var t=i.navigator,n=t&&t.plugins;return[+new Date,i,n,i.screen,x(o)]}}():e,3),r),m=new h(r),b=function(){for(var e=m.g(6),t=c,n=0;e=f;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return 0|m.g(4)},b.quick=function(){return m.g(4)/4294967296},b.double=b,y(x(m.S),o),(t.pass||n||function(e,t,n,r){return r&&(r.S&&d(r,m),e.state=function(){return d(m,{})}),n?(a.random=e,t):e})(b,p,"global"in t?t.global:this==a,t.state)}function h(e){var t,n=e.length,r=this,i=0,o=r.i=r.j=0,a=r.S=[];for(n||(e=[n++]);i{"use strict";var r=n(3724),i=n(4576),o=n(9504),a=n(2796),s=n(3167),u=n(6699),c=n(2360),l=n(8480).f,f=n(1625),p=n(788),m=n(655),h=n(1034),d=n(8429),g=n(1056),y=n(6840),x=n(9039),b=n(9297),v=n(1181).enforce,w=n(7633),N=n(8227),E=n(3635),A=n(8814),S=N("match"),M=i.RegExp,C=M.prototype,T=i.SyntaxError,B=o(C.exec),D=o("".charAt),F=o("".replace),O=o("".indexOf),_=o("".slice),I=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,z=/a/g,k=/a/g,R=new M(z)!==z,q=d.MISSED_STICKY,P=d.UNSUPPORTED_Y;if(a("RegExp",r&&(!R||q||E||A||x((function(){return k[S]=!1,M(z)!==z||M(k)===k||"/a/i"!==String(M(z,"i"))}))))){for(var j=function(e,t){var n,r,i,o,a,l,d=f(C,this),g=p(e),y=void 0===t,x=[],w=e;if(!d&&g&&y&&e.constructor===j)return e;if((g||f(C,e))&&(e=e.source,y&&(t=h(w))),e=void 0===e?"":m(e),t=void 0===t?"":m(t),w=e,E&&"dotAll"in z&&(r=!!t&&O(t,"s")>-1)&&(t=F(t,/s/g,"")),n=t,q&&"sticky"in z&&(i=!!t&&O(t,"y")>-1)&&P&&(t=F(t,/y/g,"")),A&&(o=function(e){for(var t,n=e.length,r=0,i="",o=[],a=c(null),s=!1,u=!1,l=0,f="";r<=n;r++){if("\\"===(t=D(e,r)))t+=D(e,++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:if(i+=t,"?:"===_(e,r+1,r+3))continue;B(I,_(e,r+1))&&(r+=2,u=!0),l++;continue;case">"===t&&u:if(""===f||b(a,f))throw new T("Invalid capture group name");a[f]=!0,o[o.length]=[f,l],u=!1,f="";continue}u?f+=t:i+=t}return[i,o]}(e),e=o[0],x=o[1]),a=s(M(e,t),d?this:C,j),(r||i||x.length)&&(l=v(a),r&&(l.dotAll=!0,l.raw=j(function(e){for(var t,n=e.length,r=0,i="",o=!1;r<=n;r++)"\\"!==(t=D(e,r))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+D(e,++r);return i}(e),n)),i&&(l.sticky=!0),x.length&&(l.groups=x)),e!==w)try{u(a,"source",""===w?"(?:)":w)}catch(e){}return a},U=l(M),L=0;U.length>L;)g(j,M,U[L++]);C.constructor=j,j.prototype=C,y(i,"RegExp",j,{constructor:!0})}w("RegExp")},4901:e=>{"use strict";var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},4913:(e,t,n)=>{"use strict";var r=n(3724),i=n(5917),o=n(8686),a=n(8551),s=n(6969),u=TypeError,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,f="enumerable",p="configurable",m="writable";t.f=r?o?function(e,t,n){if(a(e),t=s(t),a(n),"function"==typeof e&&"prototype"===t&&"value"in n&&m in n&&!n[m]){var r=l(e,t);r&&r[m]&&(e[t]=n.value,n={configurable:p in n?n[p]:r[p],enumerable:f in n?n[f]:r[f],writable:!1})}return c(e,t,n)}:c:function(e,t,n){if(a(e),t=s(t),a(n),i)try{return c(e,t,n)}catch(e){}if("get"in n||"set"in n)throw new u("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},5031:(e,t,n)=>{"use strict";var r=n(7751),i=n(9504),o=n(8480),a=n(3717),s=n(8551),u=i([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=o.f(s(e)),n=a.f;return n?u(t,n(e)):t}},5397:(e,t,n)=>{"use strict";var r=n(7055),i=n(7750);e.exports=function(e){return r(i(e))}},5440:(e,t,n)=>{"use strict";var r=n(8745),i=n(9565),o=n(9504),a=n(9228),s=n(9039),u=n(8551),c=n(4901),l=n(34),f=n(1291),p=n(8014),m=n(655),h=n(7750),d=n(7829),g=n(5966),y=n(2478),x=n(6682),b=n(8227)("replace"),v=Math.max,w=Math.min,N=o([].concat),E=o([].push),A=o("".indexOf),S=o("".slice),M="$0"==="a".replace(/./,"$0"),C=!!/./[b]&&""===/./[b]("a","$0");a("replace",(function(e,t,n){var o=C?"$":"$0";return[function(e,n){var r=h(this),o=l(e)?g(e,b):void 0;return o?i(o,e,r,n):i(t,m(r),e,n)},function(e,i){var a=u(this),s=m(e);if("string"==typeof i&&-1===A(i,o)&&-1===A(i,"$<")){var l=n(t,a,s,i);if(l.done)return l.value}var h=c(i);h||(i=m(i));var g,b=a.global;b&&(g=a.unicode,a.lastIndex=0);for(var M,C=[];null!==(M=x(a,s))&&(E(C,M),b);)""===m(M[0])&&(a.lastIndex=d(s,p(a.lastIndex),g));for(var T,B="",D=0,F=0;F=D&&(B+=S(s,D,I)+O,D=I+_.length)}return B+S(s,D)}]}),!!s((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$")}))||!M||C)},5548:(e,t,n)=>{"use strict";var r=n(3517),i=n(6823),o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(i(e)+" is not a constructor")}},5610:(e,t,n)=>{"use strict";var r=n(1291),i=Math.max,o=Math.min;e.exports=function(e,t){var n=r(e);return n<0?i(n+t,0):o(n,t)}},5745:(e,t,n)=>{"use strict";var r=n(7629);e.exports=function(e,t){return r[e]||(r[e]=t||{})}},5917:(e,t,n)=>{"use strict";var r=n(3724),i=n(9039),o=n(4055);e.exports=!r&&!i((function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},5966:(e,t,n)=>{"use strict";var r=n(9306),i=n(4117);e.exports=function(e,t){var n=e[t];return i(n)?void 0:r(n)}},6043:(e,t,n)=>{"use strict";var r=n(9306),i=TypeError,o=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw new i("Bad Promise constructor");t=e,n=r})),this.resolve=r(t),this.reject=r(n)};e.exports.f=function(e){return new o(e)}},6080:(e,t,n)=>{"use strict";var r=n(7476),i=n(9306),o=n(616),a=r(r.bind);e.exports=function(e,t){return i(e),void 0===t?e:o?a(e,t):function(){return e.apply(t,arguments)}}},6098:function(e,t,n){var r;!function(e,i){function o(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,i=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^i,i=i-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^i,t.a=i-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,r&&("object"==typeof r&&a(r,n),i.state=function(){return a(n,{})}),i}i&&i.exports?i.exports=s:n.amdD&&n.amdO?void 0===(r=function(){return s}.call(t,n,t,i))||(i.exports=r):this.tychei=s}(0,e=n.nmd(e),n.amdD)},6119:(e,t,n)=>{"use strict";var r=n(5745),i=n(3392),o=r("keys");e.exports=function(e){return o[e]||(o[e]=i(e))}},6193:(e,t,n)=>{"use strict";var r=n(4215);e.exports="NODE"===r},6198:(e,t,n)=>{"use strict";var r=n(8014);e.exports=function(e){return r(e.length)}},6269:e=>{"use strict";e.exports={}},6279:(e,t,n)=>{"use strict";var r=n(6840);e.exports=function(e,t,n){for(var i in t)r(e,i,t[i],n);return e}},6319:(e,t,n)=>{"use strict";var r=n(8551),i=n(9539);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){i(e,"throw",t)}}},6395:e=>{"use strict";e.exports=!1},6469:(e,t,n)=>{"use strict";var r=n(8227),i=n(2360),o=n(4913).f,a=r("unscopables"),s=Array.prototype;void 0===s[a]&&o(s,a,{configurable:!0,value:i(null)}),e.exports=function(e){s[a][e]=!0}},6499:(e,t,n)=>{"use strict";var r=n(6518),i=n(9565),o=n(9306),a=n(6043),s=n(1103),u=n(2652);r({target:"Promise",stat:!0,forced:n(537)},{all:function(e){var t=this,n=a.f(t),r=n.resolve,c=n.reject,l=s((function(){var n=o(t.resolve),a=[],s=0,l=1;u(e,(function(e){var o=s++,u=!1;l++,i(n,t,e).then((function(e){u||(u=!0,a[o]=e,--l||r(a))}),c)})),--l||r(a)}));return l.error&&c(l.value),n.promise}})},6518:(e,t,n)=>{"use strict";var r=n(4576),i=n(7347).f,o=n(6699),a=n(6840),s=n(9433),u=n(7740),c=n(2796);e.exports=function(e,t){var n,l,f,p,m,h=e.target,d=e.global,g=e.stat;if(n=d?r:g?r[h]||s(h,{}):r[h]&&r[h].prototype)for(l in t){if(p=t[l],f=e.dontCallGetSet?(m=i(n,l))&&m.value:n[l],!c(d?l:h+(g?".":"#")+l,e.forced)&&void 0!==f){if(typeof p==typeof f)continue;u(p,f)}(e.sham||f&&f.sham)&&o(p,"sham",!0),a(n,l,p,e)}}},6682:(e,t,n)=>{"use strict";var r=n(9565),i=n(8551),o=n(4901),a=n(2195),s=n(7323),u=TypeError;e.exports=function(e,t){var n=e.exec;if(o(n)){var c=r(n,e,t);return null!==c&&i(c),c}if("RegExp"===a(e))return r(s,e,t);throw new u("RegExp#exec called on incompatible receiver")}},6699:(e,t,n)=>{"use strict";var r=n(3724),i=n(4913),o=n(6980);e.exports=r?function(e,t,n){return i.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},6706:(e,t,n)=>{"use strict";var r=n(9504),i=n(9306);e.exports=function(e,t,n){try{return r(i(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}}},6801:(e,t,n)=>{"use strict";var r=n(3724),i=n(8686),o=n(4913),a=n(8551),s=n(5397),u=n(1072);t.f=r&&!i?Object.defineProperties:function(e,t){a(e);for(var n,r=s(t),i=u(t),c=i.length,l=0;c>l;)o.f(e,n=i[l++],r[n]);return e}},6823:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},6833:function(e,t,n){var r;!function(e,i){function o(e){var t=this;t.next=function(){var e,n,r=t.w,i=t.X,o=t.i;return t.w=r=r+1640531527|0,n=i[o+34&127],e=i[o=o+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=i[o]=n^e,t.i=o,n+(r^r>>>16)|0},function(e,t){var n,r,i,o,a,s=[],u=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,u=Math.max(u,t.length)),i=0,o=-32;o>>15,r^=r<<4,r^=r>>>13,o>=0&&(a=a+1640531527|0,i=0==(n=s[127&o]^=r+a)?i+1:0);for(i>=128&&(s[127&(t&&t.length||0)]=-1),i=127,o=512;o>0;--o)r=s[i+34&127],n=s[i=i+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[i]=r^n;e.w=a,e.X=s,e.i=i}(t,e)}function a(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function s(e,t){null==e&&(e=+new Date);var n=new o(e),r=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,r&&(r.X&&a(r,n),i.state=function(){return a(n,{})}),i}i&&i.exports?i.exports=s:n.amdD&&n.amdO?void 0===(r=function(){return s}.call(t,n,t,i))||(i.exports=r):this.xor4096=s}(0,e=n.nmd(e),n.amdD)},6840:(e,t,n)=>{"use strict";var r=n(4901),i=n(4913),o=n(283),a=n(9433);e.exports=function(e,t,n,s){s||(s={});var u=s.enumerable,c=void 0!==s.name?s.name:t;if(r(n)&&o(n,c,s),s.global)u?e[t]=n:a(t,n);else{try{s.unsafe?e[t]&&(u=!0):delete e[t]}catch(e){}u?e[t]=n:i.f(e,t,{value:n,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return e}},6910:(e,t,n)=>{"use strict";var r=n(6518),i=n(9504),o=n(9306),a=n(8981),s=n(6198),u=n(4606),c=n(655),l=n(9039),f=n(4488),p=n(4598),m=n(3709),h=n(3763),d=n(9519),g=n(3607),y=[],x=i(y.sort),b=i(y.push),v=l((function(){y.sort(void 0)})),w=l((function(){y.sort(null)})),N=p("sort"),E=!l((function(){if(d)return d<70;if(!(m&&m>3)){if(h)return!0;if(g)return g<603;var e,t,n,r,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:n=3;break;case 68:case 71:n=4;break;default:n=2}for(r=0;r<47;r++)y.push({k:t+r,v:n})}for(y.sort((function(e,t){return t.v-e.v})),r=0;rc(n)?1:-1}}(e)),n=s(i),r=0;r{"use strict";var r=n(9504),i=n(4376),o=n(4901),a=n(2195),s=n(655),u=r([].push);e.exports=function(e){if(o(e))return e;if(i(e)){for(var t=e.length,n=[],r=0;r{"use strict";var r=n(2140),i=n(4901),o=n(2195),a=n(8227)("toStringTag"),s=Object,u="Arguments"===o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=s(e),a))?n:u?o(t):"Object"===(r=o(t))&&i(t.callee)?"Arguments":r}},6969:(e,t,n)=>{"use strict";var r=n(2777),i=n(757);e.exports=function(e){var t=r(e,"string");return i(t)?t:t+""}},6980:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},7040:(e,t,n)=>{"use strict";var r=n(4495);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},7055:(e,t,n)=>{"use strict";var r=n(9504),i=n(9039),o=n(2195),a=Object,s=r("".split);e.exports=i((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"===o(e)?s(e,""):a(e)}:a},7180:function(e,t,n){var r;!function(e,i){function o(e){var t,n=this,r=(t=4022871197,function(e){e=String(e);for(var n=0;n>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function s(e,t){var n=new o(e),r=t&&t.state,i=n.next;return i.int32=function(){return 4294967296*n.next()|0},i.double=function(){return i()+11102230246251565e-32*(2097152*i()|0)},i.quick=i,r&&("object"==typeof r&&a(r,n),i.state=function(){return a(n,{})}),i}i&&i.exports?i.exports=s:n.amdD&&n.amdO?void 0===(r=function(){return s}.call(t,n,t,i))||(i.exports=r):this.alea=s}(0,e=n.nmd(e),n.amdD)},7323:(e,t,n)=>{"use strict";var r,i,o=n(9565),a=n(9504),s=n(655),u=n(7979),c=n(8429),l=n(5745),f=n(2360),p=n(1181).get,m=n(3635),h=n(8814),d=l("native-string-replace",String.prototype.replace),g=RegExp.prototype.exec,y=g,x=a("".charAt),b=a("".indexOf),v=a("".replace),w=a("".slice),N=(i=/b*/g,o(g,r=/a/,"a"),o(g,i,"a"),0!==r.lastIndex||0!==i.lastIndex),E=c.BROKEN_CARET,A=void 0!==/()??/.exec("")[1];(N||A||E||m||h)&&(y=function(e){var t,n,r,i,a,c,l,m=this,h=p(m),S=s(e),M=h.raw;if(M)return M.lastIndex=m.lastIndex,t=o(y,M,S),m.lastIndex=M.lastIndex,t;var C=h.groups,T=E&&m.sticky,B=o(u,m),D=m.source,F=0,O=S;if(T&&(B=v(B,"y",""),-1===b(B,"g")&&(B+="g"),O=w(S,m.lastIndex),m.lastIndex>0&&(!m.multiline||m.multiline&&"\n"!==x(S,m.lastIndex-1))&&(D="(?: "+D+")",O=" "+O,F++),n=new RegExp("^(?:"+D+")",B)),A&&(n=new RegExp("^"+D+"$(?!\\s)",B)),N&&(r=m.lastIndex),i=o(g,T?n:m,O),T?i?(i.input=w(i.input,F),i[0]=w(i[0],F),i.index=m.lastIndex,m.lastIndex+=i[0].length):m.lastIndex=0:N&&i&&(m.lastIndex=m.global?i.index+i[0].length:r),A&&i&&i.length>1&&o(d,i[0],n,(function(){for(a=1;a{"use strict";var r=n(3724),i=n(9565),o=n(8773),a=n(6980),s=n(5397),u=n(6969),c=n(9297),l=n(5917),f=Object.getOwnPropertyDescriptor;t.f=r?f:function(e,t){if(e=s(e),t=u(t),l)try{return f(e,t)}catch(e){}if(c(e,t))return a(!i(o.f,e,t),e[t])}},7391:(e,t,n)=>{var r=n(7180),i=n(3181),o=n(3031),a=n(9067),s=n(6833),u=n(6098),c=n(4801);c.alea=r,c.xor128=i,c.xorwow=o,c.xorshift7=a,c.xor4096=s,c.tychei=u,e.exports=c},7465:(e,t,n)=>{"use strict";var r=n(3724),i=n(3635),o=n(2195),a=n(2106),s=n(1181).get,u=RegExp.prototype,c=TypeError;r&&i&&a(u,"dotAll",{configurable:!0,get:function(){if(this!==u){if("RegExp"===o(this))return!!s(this).dotAll;throw new c("Incompatible receiver, RegExp required")}}})},7476:(e,t,n)=>{"use strict";var r=n(2195),i=n(9504);e.exports=function(e){if("Function"===r(e))return i(e)}},7495:(e,t,n)=>{"use strict";var r=n(6518),i=n(7323);r({target:"RegExp",proto:!0,forced:/./.exec!==i},{exec:i})},7550:(e,t,n)=>{"use strict";n(3579)},7588:(e,t,n)=>{"use strict";var r=n(6518),i=n(9565),o=n(2652),a=n(9306),s=n(8551),u=n(1767),c=n(9539),l=n(4549)("forEach",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:l},{forEach:function(e){s(this);try{a(e)}catch(e){c(this,"throw",e)}if(l)return i(l,this,e);var t=u(this),n=0;o(t,(function(t){e(t,n++)}),{IS_RECORD:!0})}})},7629:(e,t,n)=>{"use strict";var r=n(6395),i=n(4576),o=n(9433),a="__core-js_shared__",s=e.exports=i[a]||o(a,{});(s.versions||(s.versions=[])).push({version:"3.42.0",mode:r?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.42.0/LICENSE",source:"https://github.com/zloirock/core-js"})},7633:(e,t,n)=>{"use strict";var r=n(7751),i=n(2106),o=n(8227),a=n(3724),s=o("species");e.exports=function(e){var t=r(e);a&&t&&!t[s]&&i(t,s,{configurable:!0,get:function(){return this}})}},7657:(e,t,n)=>{"use strict";var r,i,o,a=n(9039),s=n(4901),u=n(34),c=n(2360),l=n(2787),f=n(6840),p=n(8227),m=n(6395),h=p("iterator"),d=!1;[].keys&&("next"in(o=[].keys())?(i=l(l(o)))!==Object.prototype&&(r=i):d=!0),!u(r)||a((function(){var e={};return r[h].call(e)!==e}))?r={}:m&&(r=c(r)),s(r[h])||f(r,h,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:d}},7680:(e,t,n)=>{"use strict";var r=n(9504);e.exports=r([].slice)},7740:(e,t,n)=>{"use strict";var r=n(9297),i=n(5031),o=n(7347),a=n(4913);e.exports=function(e,t,n){for(var s=i(t),u=a.f,c=o.f,l=0;l{"use strict";var r=n(6518),i=n(9565),o=n(9306),a=n(6043),s=n(1103),u=n(2652);r({target:"Promise",stat:!0,forced:n(537)},{race:function(e){var t=this,n=a.f(t),r=n.reject,c=s((function(){var a=o(t.resolve);u(e,(function(e){i(a,t,e).then(n.resolve,r)}))}));return c.error&&r(c.value),n.promise}})},7750:(e,t,n)=>{"use strict";var r=n(4117),i=TypeError;e.exports=function(e){if(r(e))throw new i("Can't call method on "+e);return e}},7751:(e,t,n)=>{"use strict";var r=n(4576),i=n(4901);e.exports=function(e,t){return arguments.length<2?(n=r[e],i(n)?n:void 0):r[e]&&r[e][t];var n}},7829:(e,t,n)=>{"use strict";var r=n(8183).charAt;e.exports=function(e,t,n){return t+(n?r(e,t).length:1)}},7860:(e,t,n)=>{"use strict";var r=n(2839);e.exports=/web0s(?!.*chrome)/i.test(r)},7979:(e,t,n)=>{"use strict";var r=n(8551);e.exports=function(){var e=r(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t}},8014:(e,t,n)=>{"use strict";var r=n(1291),i=Math.min;e.exports=function(e){var t=r(e);return t>0?i(t,9007199254740991):0}},8111:(e,t,n)=>{"use strict";var r=n(6518),i=n(4576),o=n(679),a=n(8551),s=n(4901),u=n(2787),c=n(2106),l=n(4659),f=n(9039),p=n(9297),m=n(8227),h=n(7657).IteratorPrototype,d=n(3724),g=n(6395),y="constructor",x="Iterator",b=m("toStringTag"),v=TypeError,w=i[x],N=g||!s(w)||w.prototype!==h||!f((function(){w({})})),E=function(){if(o(this,h),u(this)===h)throw new v("Abstract class Iterator not directly constructable")},A=function(e,t){d?c(h,e,{configurable:!0,get:function(){return t},set:function(t){if(a(this),this===h)throw new v("You can't redefine this property");p(this,e)?this[e]=t:l(this,e,t)}}):h[e]=t};p(h,b)||A(b,x),!N&&p(h,y)&&h[y]!==Object||A(y,E),E.prototype=h,r({global:!0,constructor:!0,forced:N},{Iterator:E})},8183:(e,t,n)=>{"use strict";var r=n(9504),i=n(1291),o=n(655),a=n(7750),s=r("".charAt),u=r("".charCodeAt),c=r("".slice),l=function(e){return function(t,n){var r,l,f=o(a(t)),p=i(n),m=f.length;return p<0||p>=m?e?"":void 0:(r=u(f,p))<55296||r>56319||p+1===m||(l=u(f,p+1))<56320||l>57343?e?s(f,p):r:e?c(f,p,p+2):l-56320+(r-55296<<10)+65536}};e.exports={codeAt:l(!1),charAt:l(!0)}},8227:(e,t,n)=>{"use strict";var r=n(4576),i=n(5745),o=n(9297),a=n(3392),s=n(4495),u=n(7040),c=r.Symbol,l=i("wks"),f=u?c.for||c:c&&c.withoutSetter||a;e.exports=function(e){return o(l,e)||(l[e]=s&&o(c,e)?c[e]:f("Symbol."+e)),l[e]}},8237:(e,t,n)=>{"use strict";var r=n(6518),i=n(2652),o=n(9306),a=n(8551),s=n(1767),u=n(9539),c=n(4549),l=n(8745),f=n(9039),p=TypeError,m=f((function(){[].keys().reduce((function(){}),void 0)})),h=!m&&c("reduce",p);r({target:"Iterator",proto:!0,real:!0,forced:m||h},{reduce:function(e){a(this);try{o(e)}catch(e){u(this,"throw",e)}var t=arguments.length<2,n=t?void 0:arguments[1];if(h)return l(h,this,t?[e]:[e,n]);var r=s(this),c=0;if(i(r,(function(r){t?(t=!1,n=r):n=e(n,r,c),c++}),{IS_RECORD:!0}),t)throw new p("Reduce of empty iterator with no initial value");return n}})},8265:e=>{"use strict";var t=function(){this.head=null,this.tail=null};t.prototype={add:function(e){var t={item:e,next:null},n=this.tail;n?n.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}},e.exports=t},8429:(e,t,n)=>{"use strict";var r=n(9039),i=n(4576).RegExp,o=r((function(){var e=i("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),a=o||r((function(){return!i("a","y").sticky})),s=o||r((function(){var e=i("^r","gy");return e.lastIndex=2,null!==e.exec("str")}));e.exports={BROKEN_CARET:s,MISSED_STICKY:a,UNSUPPORTED_Y:o}},8480:(e,t,n)=>{"use strict";var r=n(1828),i=n(8727).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},8551:(e,t,n)=>{"use strict";var r=n(34),i=String,o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(i(e)+" is not an object")}},8622:(e,t,n)=>{"use strict";var r=n(4576),i=n(4901),o=r.WeakMap;e.exports=i(o)&&/native code/.test(String(o))},8686:(e,t,n)=>{"use strict";var r=n(3724),i=n(9039);e.exports=r&&i((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},8727:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},8745:(e,t,n)=>{"use strict";var r=n(616),i=Function.prototype,o=i.apply,a=i.call;e.exports="object"==typeof Reflect&&Reflect.apply||(r?a.bind(o):function(){return a.apply(o,arguments)})},8773:(e,t)=>{"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,i=r&&!n.call({1:2},1);t.f=i?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},8814:(e,t,n)=>{"use strict";var r=n(9039),i=n(4576).RegExp;e.exports=r((function(){var e=i("(?b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$c")}))},8872:(e,t,n)=>{"use strict";n(8237)},8981:(e,t,n)=>{"use strict";var r=n(7750),i=Object;e.exports=function(e){return i(r(e))}},8992:(e,t,n)=>{"use strict";n(8111)},9039:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},9067:function(e,t,n){var r;!function(e,i){function o(e){var t=this;t.next=function(){var e,n,r=t.x,i=t.i;return e=r[i],n=(e^=e>>>7)^e<<24,n^=(e=r[i+1&7])^e>>>10,n^=(e=r[i+3&7])^e>>>3,n^=(e=r[i+4&7])^e<<7,e=r[i+7&7],n^=(e^=e<<13)^e<<9,r[i]=n,t.i=i+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n0;--n)e.next()}(t,e)}function a(e,t){return t.x=e.x.slice(),t.i=e.i,t}function s(e,t){null==e&&(e=+new Date);var n=new o(e),r=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,r&&(r.x&&a(r,n),i.state=function(){return a(n,{})}),i}i&&i.exports?i.exports=s:n.amdD&&n.amdO?void 0===(r=function(){return s}.call(t,n,t,i))||(i.exports=r):this.xorshift7=s}(0,e=n.nmd(e),n.amdD)},9225:(e,t,n)=>{"use strict";var r,i,o,a,s=n(4576),u=n(8745),c=n(6080),l=n(4901),f=n(9297),p=n(9039),m=n(397),h=n(7680),d=n(4055),g=n(2812),y=n(9544),x=n(6193),b=s.setImmediate,v=s.clearImmediate,w=s.process,N=s.Dispatch,E=s.Function,A=s.MessageChannel,S=s.String,M=0,C={},T="onreadystatechange";p((function(){r=s.location}));var B=function(e){if(f(C,e)){var t=C[e];delete C[e],t()}},D=function(e){return function(){B(e)}},F=function(e){B(e.data)},O=function(e){s.postMessage(S(e),r.protocol+"//"+r.host)};b&&v||(b=function(e){g(arguments.length,1);var t=l(e)?e:E(e),n=h(arguments,1);return C[++M]=function(){u(t,void 0,n)},i(M),M},v=function(e){delete C[e]},x?i=function(e){w.nextTick(D(e))}:N&&N.now?i=function(e){N.now(D(e))}:A&&!y?(a=(o=new A).port2,o.port1.onmessage=F,i=c(a.postMessage,a)):s.addEventListener&&l(s.postMessage)&&!s.importScripts&&r&&"file:"!==r.protocol&&!p(O)?(i=O,s.addEventListener("message",F,!1)):i=T in d("script")?function(e){m.appendChild(d("script"))[T]=function(){m.removeChild(this),B(e)}}:function(e){setTimeout(D(e),0)}),e.exports={set:b,clear:v}},9228:(e,t,n)=>{"use strict";n(7495);var r=n(9565),i=n(6840),o=n(7323),a=n(9039),s=n(8227),u=n(6699),c=s("species"),l=RegExp.prototype;e.exports=function(e,t,n,f){var p=s(e),m=!a((function(){var t={};return t[p]=function(){return 7},7!==""[e](t)})),h=m&&!a((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[c]=function(){return n},n.flags="",n[p]=/./[p]),n.exec=function(){return t=!0,null},n[p](""),!t}));if(!m||!h||n){var d=/./[p],g=t(p,""[e],(function(e,t,n,i,a){var s=t.exec;return s===o||s===l.exec?m&&!a?{done:!0,value:r(d,t,n,i)}:{done:!0,value:r(e,n,t,i)}:{done:!1}}));i(String.prototype,e,g[0]),i(l,p,g[1])}f&&u(l[p],"sham",!0)}},9297:(e,t,n)=>{"use strict";var r=n(9504),i=n(8981),o=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(i(e),t)}},9306:(e,t,n)=>{"use strict";var r=n(4901),i=n(6823),o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(i(e)+" is not a function")}},9433:(e,t,n)=>{"use strict";var r=n(4576),i=Object.defineProperty;e.exports=function(e,t){try{i(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},9462:(e,t,n)=>{"use strict";var r=n(9565),i=n(2360),o=n(6699),a=n(6279),s=n(8227),u=n(1181),c=n(5966),l=n(7657).IteratorPrototype,f=n(2529),p=n(9539),m=s("toStringTag"),h="IteratorHelper",d="WrapForValidIterator",g=u.set,y=function(e){var t=u.getterFor(e?d:h);return a(i(l),{next:function(){var n=t(this);if(e)return n.nextHandler();if(n.done)return f(void 0,!0);try{var r=n.nextHandler();return n.returnHandlerResult?r:f(r,n.done)}catch(e){throw n.done=!0,e}},return:function(){var n=t(this),i=n.iterator;if(n.done=!0,e){var o=c(i,"return");return o?r(o,i):f(void 0,!0)}if(n.inner)try{p(n.inner.iterator,"normal")}catch(e){return p(i,"throw",e)}return i&&p(i,"normal"),f(void 0,!0)}})},x=y(!0),b=y(!1);o(b,m,"Iterator Helper"),e.exports=function(e,t,n){var r=function(r,i){i?(i.iterator=r.iterator,i.next=r.next):i=r,i.type=t?d:h,i.returnHandlerResult=!!n,i.nextHandler=e,i.counter=0,i.done=!1,g(this,i)};return r.prototype=t?x:b,r}},9463:(e,t,n)=>{"use strict";var r=n(6518),i=n(3724),o=n(4576),a=n(9504),s=n(9297),u=n(4901),c=n(1625),l=n(655),f=n(2106),p=n(7740),m=o.Symbol,h=m&&m.prototype;if(i&&u(m)&&(!("description"in h)||void 0!==m().description)){var d={},g=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:l(arguments[0]),t=c(h,this)?new m(e):void 0===e?m():m(e);return""===e&&(d[t]=!0),t};p(g,m),g.prototype=h,h.constructor=g;var y="Symbol(description detection)"===String(m("description detection")),x=a(h.valueOf),b=a(h.toString),v=/^Symbol\((.*)\)[^)]+$/,w=a("".replace),N=a("".slice);f(h,"description",{configurable:!0,get:function(){var e=x(this);if(s(d,e))return"";var t=b(e),n=y?N(t,7,-1):w(t,v,"$1");return""===n?void 0:n}}),r({global:!0,constructor:!0,forced:!0},{Symbol:g})}},9504:(e,t,n)=>{"use strict";var r=n(616),i=Function.prototype,o=i.call,a=r&&i.bind.bind(o,o);e.exports=r?a:function(e){return function(){return o.apply(e,arguments)}}},9519:(e,t,n)=>{"use strict";var r,i,o=n(4576),a=n(2839),s=o.process,u=o.Deno,c=s&&s.versions||u&&u.version,l=c&&c.v8;l&&(i=(r=l.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!i&&a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(i=+r[1]),e.exports=i},9539:(e,t,n)=>{"use strict";var r=n(9565),i=n(8551),o=n(5966);e.exports=function(e,t,n){var a,s;i(e);try{if(!(a=o(e,"return"))){if("throw"===t)throw n;return n}a=r(a,e)}catch(e){s=!0,a=e}if("throw"===t)throw n;if(s)throw a;return i(a),n}},9544:(e,t,n)=>{"use strict";var r=n(2839);e.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(r)},9565:(e,t,n)=>{"use strict";var r=n(616),i=Function.prototype.call;e.exports=r?i.bind(i):function(){return i.apply(i,arguments)}},9617:(e,t,n)=>{"use strict";var r=n(5397),i=n(5610),o=n(6198),a=function(e){return function(t,n,a){var s=r(t),u=o(s);if(0===u)return!e&&-1;var c,l=i(a,u);if(e&&n!=n){for(;u>l;)if((c=s[l++])!=c)return!0}else for(;u>l;l++)if((e||l in s)&&s[l]===n)return e||l||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};return(()=>{"use strict";n.d(r,{default:()=>cx});var e={};n.r(e),n.d(e,{createAbs:()=>To,createAccessorNode:()=>Rp,createAcos:()=>Jl,createAcosh:()=>gf,createAcot:()=>xf,createAcoth:()=>vf,createAcsc:()=>Nf,createAcsch:()=>Af,createAdd:()=>wp,createAddScalar:()=>_o,createAnd:()=>Vc,createAndTransform:()=>Ky,createArg:()=>vs,createArrayNode:()=>Pp,createAsec:()=>Mf,createAsech:()=>Tf,createAsin:()=>Df,createAsinh:()=>Ff,createAssignmentNode:()=>Vp,createAtan:()=>Of,createAtan2:()=>If,createAtanh:()=>kf,createAtomicMass:()=>ty,createAvogadro:()=>ny,createBellNumbers:()=>Bd,createBigNumberClass:()=>On,createBigint:()=>Ri,createBignumber:()=>Li,createBin:()=>tc,createBitAnd:()=>ps,createBitAndTransform:()=>tx,createBitNot:()=>hs,createBitOr:()=>gs,createBitOrTransform:()=>nx,createBitXor:()=>bs,createBlockNode:()=>Wp,createBohrMagneton:()=>zg,createBohrRadius:()=>Ug,createBoltzmann:()=>ry,createBoolean:()=>Ui,createCatalan:()=>Fd,createCbrt:()=>Ro,createCeil:()=>Go,createChain:()=>sh,createChainClass:()=>eh,createClassicalElectronRadius:()=>Lg,createClone:()=>ri,createColumn:()=>ks,createColumnTransform:()=>Sy,createCombinations:()=>Vh,createCombinationsWithRep:()=>Yh,createCompare:()=>Wc,createCompareNatural:()=>Qc,createCompareText:()=>tl,createCompile:()=>Cm,createComplex:()=>$i,createComplexClass:()=>Un,createComposition:()=>_d,createConcat:()=>Is,createConcatTransform:()=>Uy,createConditionalNode:()=>Jp,createConductanceQuantum:()=>kg,createConj:()=>Ns,createConstantNode:()=>om,createCorr:()=>Lh,createCos:()=>qf,createCosh:()=>jf,createCot:()=>Uf,createCoth:()=>$f,createCoulomb:()=>Og,createCoulombConstant:()=>_g,createCount:()=>qs,createCreateUnit:()=>Wl,createCross:()=>js,createCsc:()=>Hf,createCsch:()=>Vf,createCtranspose:()=>_u,createCube:()=>Zo,createCumSum:()=>Bh,createCumSumTransform:()=>Wy,createDeepEqual:()=>vl,createDenseMatrixClass:()=>ti,createDerivative:()=>Zd,createDet:()=>uh,createDeuteronMass:()=>Wg,createDiag:()=>Ls,createDiff:()=>ou,createDiffTransform:()=>$y,createDistance:()=>Sh,createDivide:()=>Eh,createDivideScalar:()=>mc,createDot:()=>Mp,createDotDivide:()=>Tc,createDotMultiply:()=>Wa,createDotPow:()=>Mc,createE:()=>pg,createEfimovFactor:()=>ey,createEigs:()=>ph,createElectricConstant:()=>Dg,createElectronMass:()=>$g,createElementaryCharge:()=>Ig,createEqual:()=>rl,createEqualScalar:()=>Ii,createEqualText:()=>al,createErf:()=>ju,createEvaluate:()=>Bm,createExp:()=>Wo,createExpm:()=>hh,createExpm1:()=>Jo,createFactorial:()=>ud,createFalse:()=>ag,createFaraday:()=>iy,createFermiCoupling:()=>Hg,createFft:()=>ku,createFibonacciHeapClass:()=>_l,createFilter:()=>$s,createFilterTransform:()=>Dy,createFineStructure:()=>Gg,createFirstRadiation:()=>oy,createFix:()=>ea,createFlatten:()=>Vs,createFloor:()=>oa,createForEach:()=>Ws,createForEachTransform:()=>Fy,createFormat:()=>ec,createFraction:()=>Hi,createFractionClass:()=>ir,createFreqz:()=>Kd,createFunctionAssignmentNode:()=>sm,createFunctionNode:()=>Em,createGamma:()=>id,createGasConstant:()=>sy,createGcd:()=>va,createGetMatrixDataType:()=>Xs,createGravitationConstant:()=>Mg,createGravity:()=>gy,createHartreeEnergy:()=>Vg,createHasNumericValue:()=>Ei,createHelp:()=>oh,createHelpClass:()=>Km,createHex:()=>rc,createHypot:()=>Ep,createI:()=>vg,createIdentity:()=>Ks,createIfft:()=>qu,createIm:()=>Es,createImmutableDenseMatrixClass:()=>Dl,createIndex:()=>Bp,createIndexClass:()=>Fl,createIndexNode:()=>cm,createIndexTransform:()=>Oy,createInfinity:()=>ug,createIntersect:()=>Mh,createInv:()=>ch,createInverseConductanceQuantum:()=>Rg,createInvmod:()=>Ga,createIsInteger:()=>pi,createIsNaN:()=>Bi,createIsNegative:()=>bi,createIsNumeric:()=>wi,createIsPositive:()=>Si,createIsPrime:()=>lc,createIsZero:()=>Ci,createKldivergence:()=>ld,createKlitzing:()=>jg,createKron:()=>tu,createLN10:()=>dg,createLN2:()=>hg,createLOG10E:()=>yg,createLOG2E:()=>gg,createLarger:()=>hl,createLargerEq:()=>yl,createLcm:()=>Na,createLeafCount:()=>zd,createLeftShift:()=>Uc,createLgamma:()=>ad,createLog:()=>vc,createLog10:()=>Ca,createLog1p:()=>Nc,createLog2:()=>Ba,createLoschmidt:()=>ay,createLsolve:()=>Fc,createLsolveAll:()=>zc,createLup:()=>_m,createLusolve:()=>Jm,createLyap:()=>Nh,createMad:()=>Ih,createMagneticConstant:()=>Bg,createMagneticFluxQuantum:()=>qg,createMap:()=>ru,createMapSlices:()=>Do,createMapSlicesTransform:()=>Ay,createMapTransform:()=>_y,createMatrix:()=>Vi,createMatrixClass:()=>ar,createMatrixFromColumns:()=>Qi,createMatrixFromFunction:()=>Wi,createMatrixFromRows:()=>Ji,createMax:()=>Tl,createMaxTransform:()=>zy,createMean:()=>Fh,createMeanTransform:()=>ky,createMedian:()=>_h,createMin:()=>Bl,createMinTransform:()=>Ry,createMod:()=>pa,createMode:()=>Yu,createMolarMass:()=>hy,createMolarMassC12:()=>dy,createMolarPlanckConstant:()=>uy,createMolarVolume:()=>cy,createMultinomial:()=>pd,createMultiply:()=>Oa,createMultiplyScalar:()=>Da,createNaN:()=>cg,createNeutronMass:()=>Yg,createNode:()=>Fp,createNorm:()=>Sp,createNot:()=>Ds,createNthRoot:()=>Ia,createNthRoots:()=>Ac,createNuclearMagneton:()=>Pg,createNull:()=>sg,createNumber:()=>ki,createNumeric:()=>fc,createObjectNode:()=>fm,createOct:()=>nc,createOnes:()=>au,createOperatorNode:()=>hm,createOr:()=>Fs,createOrTransform:()=>ex,createParenthesisNode:()=>gm,createParse:()=>Sm,createParser:()=>Om,createParserClass:()=>Dm,createPartitionSelect:()=>Sl,createPermutations:()=>hd,createPhi:()=>mg,createPi:()=>lg,createPickRandom:()=>vd,createPinv:()=>fh,createPlanckCharge:()=>vy,createPlanckConstant:()=>Cg,createPlanckLength:()=>yy,createPlanckMass:()=>xy,createPlanckTemperature:()=>wy,createPlanckTime:()=>by,createPolynomialRoot:()=>Qm,createPow:()=>hc,createPrint:()=>ac,createPrintTransform:()=>Qy,createProd:()=>Qu,createProtonMass:()=>Zg,createQr:()=>Im,createQuantileSeq:()=>Ph,createQuantileSeqTransform:()=>Vy,createQuantumOfCirculation:()=>Jg,createRandom:()=>Ed,createRandomInt:()=>Sd,createRange:()=>fu,createRangeClass:()=>or,createRangeNode:()=>xm,createRangeTransform:()=>qy,createRationalize:()=>Yd,createRe:()=>As,createReducedPlanckConstant:()=>Tg,createRelationalNode:()=>vm,createReplacer:()=>tg,createReshape:()=>mu,createResize:()=>hu,createResolve:()=>$d,createResultSet:()=>Ze,createReviver:()=>eg,createRightArithShift:()=>$c,createRightLogShift:()=>Gc,createRotate:()=>gu,createRotationMatrix:()=>xu,createRound:()=>yc,createRow:()=>bu,createRowTransform:()=>Py,createRydberg:()=>Xg,createSQRT1_2:()=>xg,createSQRT2:()=>bg,createSackurTetrode:()=>ly,createSchur:()=>vh,createSec:()=>Zf,createSech:()=>Yf,createSecondRadiation:()=>fy,createSetCartesian:()=>np,createSetDifference:()=>ip,createSetDistinct:()=>ap,createSetIntersect:()=>up,createSetIsSubset:()=>lp,createSetMultiplicity:()=>pp,createSetPowerset:()=>hp,createSetSize:()=>gp,createSetSymDifference:()=>xp,createSetUnion:()=>vp,createSign:()=>ka,createSimplify:()=>Pd,createSimplifyConstant:()=>jd,createSimplifyCore:()=>Ld,createSin:()=>Jf,createSinh:()=>Qf,createSize:()=>wu,createSlu:()=>Zm,createSmaller:()=>ul,createSmallerEq:()=>fl,createSolveODE:()=>Pu,createSort:()=>Cl,createSpaClass:()=>Il,createSparse:()=>Vl,createSparseMatrixClass:()=>zi,createSpeedOfLight:()=>Sg,createSplitUnit:()=>eo,createSqrt:()=>Ra,createSqrtm:()=>gh,createSquare:()=>Pa,createSqueeze:()=>Eu,createStd:()=>jh,createStdTransform:()=>Hy,createStefanBoltzmann:()=>py,createStirlingS2:()=>Cd,createString:()=>Pi,createSubset:()=>Su,createSubsetTransform:()=>jy,createSubtract:()=>Ua,createSubtractScalar:()=>zo,createSum:()=>Ch,createSumTransform:()=>Gy,createSylvester:()=>xh,createSymbolNode:()=>wm,createSymbolicEqual:()=>Gd,createTan:()=>Kf,createTanh:()=>ep,createTau:()=>fg,createThomsonCrossSection:()=>Qg,createTo:()=>uc,createTrace:()=>Cp,createTranspose:()=>Fu,createTrue:()=>og,createTypeOf:()=>Fi,createTyped:()=>$e,createUnaryMinus:()=>So,createUnaryPlus:()=>Co,createUnequal:()=>Nl,createUnitClass:()=>Ll,createUnitFunction:()=>Hl,createUppercaseE:()=>Ng,createUppercasePi:()=>wg,createUsolve:()=>_c,createUsolveAll:()=>Rc,createVacuumImpedance:()=>Fg,createVariance:()=>Rh,createVarianceTransform:()=>Jy,createVersion:()=>Eg,createWeakMixingAngle:()=>Kg,createWienDisplacement:()=>my,createXgcd:()=>$a,createXor:()=>Os,createZeros:()=>zu,createZeta:()=>Zu,createZpk2tf:()=>Xd}),n(4423),n(7495),n(8992),n(7550);var t=n(2369);function i(e,t){if(a(e,t))return e[t];if("function"==typeof e[t]&&s(e,t))throw new Error('Cannot access method "'+t+'" as a property');throw new Error('No access to property "'+t+'"')}function o(e,t,n){if(a(e,t))return e[t]=n,n;throw new Error('No access to property "'+t+'"')}function a(e,t){return!(!function(e){return"object"==typeof e&&e&&e.constructor===Object}(e)&&!Array.isArray(e)||!me(u,t)&&(t in Object.prototype||t in Function.prototype))}function s(e,t){return!(null==e||"function"!=typeof e[t]||me(e,t)&&Object.getPrototypeOf&&t in Object.getPrototypeOf(e)||!me(c,t)&&(t in Object.prototype||t in Function.prototype))}n(6910),n(3215),n(4520),n(3949),n(1454),n(4864),n(7465);const u={length:!0,name:!0},c={toString:!0,valueOf:!0,toLocaleString:!0};class l{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).filter((e=>this.has(e))).values()}get(e){return i(this.wrappedObject,e)}set(e,t){return o(this.wrappedObject,e,t),this}has(e){return a(this.wrappedObject,e)&&e in this.wrappedObject}entries(){return p(this.keys(),(e=>[e,this.get(e)]))}forEach(e){for(const t of this.keys())e(this.get(t),t,this)}delete(e){a(this.wrappedObject,e)&&delete this.wrappedObject[e]}clear(){for(const e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}}class f{constructor(e,t,n){this.a=e,this.b=t,this.bKeys=n,this[Symbol.iterator]=this.entries}get(e){return this.bKeys.has(e)?this.b.get(e):this.a.get(e)}set(e,t){return this.bKeys.has(e)?this.b.set(e,t):this.a.set(e,t),this}has(e){return this.b.has(e)||this.a.has(e)}keys(){return new Set([...this.a.keys(),...this.b.keys()])[Symbol.iterator]()}entries(){return p(this.keys(),(e=>[e,this.get(e)]))}forEach(e){for(const t of this.keys())e(this.get(t),t,this)}delete(e){return this.bKeys.has(e)?this.b.delete(e):this.a.delete(e)}clear(){this.a.clear(),this.b.clear()}get size(){return[...this.keys()].length}}function p(e,t){return{next:()=>{const n=e.next();return n.done?n:{value:t(n.value),done:!1}}}}function m(){return new Map}function h(e){if(!e)return m();if(k(e))return e;if(z(e))return new l(e);throw new Error("createMap can create maps from objects or Maps")}function d(e){return"number"==typeof e}function g(e){return!(!e||"object"!=typeof e||"function"!=typeof e.constructor)&&(!0===e.isBigNumber&&"object"==typeof e.constructor.prototype&&!0===e.constructor.prototype.isBigNumber||"function"==typeof e.constructor.isDecimal&&!0===e.constructor.isDecimal(e))}function y(e){return"bigint"==typeof e}function x(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function b(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function v(e){return e&&!0===e.constructor.prototype.isUnit||!1}function w(e){return"string"==typeof e}const N=Array.isArray;function E(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function A(e){return Array.isArray(e)||E(e)}function S(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function M(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function C(e){return e&&!0===e.constructor.prototype.isRange||!1}function T(e){return e&&!0===e.constructor.prototype.isIndex||!1}function B(e){return"boolean"==typeof e}function D(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function F(e){return e&&!0===e.constructor.prototype.isHelp||!1}function O(e){return"function"==typeof e}function _(e){return e instanceof Date}function I(e){return e instanceof RegExp}function z(e){return!(!e||"object"!=typeof e||e.constructor!==Object||x(e)||b(e))}function k(e){return!!e&&(e instanceof Map||e instanceof l||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}function R(e){return k(e)&&k(e.a)&&k(e.b)}function q(e){return k(e)&&z(e.wrappedObject)}function P(e){return null===e}function j(e){return void 0===e}function U(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function L(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function $(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function H(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function G(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function V(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function Z(e){return V(e)||K(e)&&1===e.args.length&&V(e.args[0])&&"-+~".includes(e.op)}function W(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function Y(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function J(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function X(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function Q(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function K(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function ee(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function te(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function ne(e){return e&&!0===e.isRelationalNode&&!0===e.constructor.prototype.isNode||!1}function re(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function ie(e){return e&&!0===e.constructor.prototype.isChain||!1}function oe(e){const t=typeof e;return"object"===t?null===e?"null":g(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":t}function ae(e){const t=typeof e;if("number"===t||"bigint"===t||"string"===t||"boolean"===t||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map((function(e){return ae(e)}));if(e instanceof Date)return new Date(e.valueOf());if(g(e))return e;if(z(e))return function(e,t){const n={};for(const r in e)me(e,r)&&(n[r]=t(e[r]));return n}(e,ae);if("function"===t)return e;throw new TypeError(`Cannot clone: unknown type of value (value: ${e})`)}function se(e,t){for(const n in t)me(t,n)&&(e[n]=t[n]);return e}function ue(e,t){if(Array.isArray(t))throw new TypeError("Arrays are not supported by deepExtend");for(const n in t)if(me(t,n)&&!(n in Object.prototype)&&!(n in Function.prototype))if(t[n]&&t[n].constructor===Object)void 0===e[n]&&(e[n]={}),e[n]&&e[n].constructor===Object?ue(e[n],t[n]):e[n]=t[n];else{if(Array.isArray(t[n]))throw new TypeError("Arrays are not supported by deepExtend");e[n]=t[n]}return e}function ce(e,t){let n,r,i;if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(r=0,i=e.length;r!function(e){return e&&"?"===e[0]}(e))).every((e=>void 0!==n[e]))){const r=t.filter((e=>void 0===n[e]));throw new Error(`Cannot create function "${e}", some dependencies are missing: ${r.map((e=>`"${e}"`)).join(", ")}.`)}}(e,t,r),n(i)}return i.isFactory=!0,i.fn=e,i.dependencies=t.slice().sort(),r&&(i.meta=r),i}function de(e){return"function"==typeof e&&"string"==typeof e.fn&&Array.isArray(e.dependencies)}function ge(e){return e&&"?"===e[0]?e.slice(1):e}function ye(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}function xe(e,t){if("bigint"===t.number)try{BigInt(e)}catch(e){return t.numberFallback}return t.number}n(5440);const be=Math.sign||function(e){return e>0?1:e<0?-1:0},ve=Math.log2||function(e){return Math.log(e)/Math.LN2},we=Math.log10||function(e){return Math.log(e)/Math.LN10},Ne=Math.log1p||function(e){return Math.log(e+1)},Ee=Math.cbrt||function(e){if(0===e)return e;const t=e<0;let n;return t&&(e=-e),isFinite(e)?(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3):n=e,t?-n:n},Ae=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function Se(e,t,n){const r={2:"0b",8:"0o",16:"0x"}[t];let i="";if(n){if(n<1)throw new Error("size must be in greater than 0");if(!ye(n))throw new Error("size must be an integer");if(e>2**(n-1)-1||e<-(2**(n-1)))throw new Error(`Value must be in range [-2^${n-1}, 2^${n-1}-1]`);if(!ye(e))throw new Error("Value must be an integer");e<0&&(e+=2**n),i=`i${n}`}let o="";return e<0&&(e=-e,o="-"),`${o}${r}${e.toString(t)}${i}`}function Me(e,t){if("function"==typeof t)return t(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";const{notation:n,precision:r,wordSize:i}=Ce(t);switch(n){case"fixed":return Be(e,r);case"exponential":return De(e,r);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);const n=Fe(Te(e),t),r=n.exponent,i=n.coefficients,o=r%3==0?r:r<0?r-3-r%3:r-r%3;if(d(t))for(;t>i.length||r-o+1>i.length;)i.push(0);else{const e=Math.abs(r-o)-(i.length-1);for(let t=0;t0;)s++,a--;const u=i.slice(s).join(""),c=d(t)&&u.length||u.match(/[1-9]/)?"."+u:"",l=i.slice(0,s).join("")+c+"e"+(r>=0?"+":"")+o.toString();return n.sign+l}(e,r);case"bin":return Se(e,2,i);case"oct":return Se(e,8,i);case"hex":return Se(e,16,i);case"auto":return function(e,t,n){if(isNaN(e)||!isFinite(e))return String(e);const r=Ue(null==n?void 0:n.lowerExp,-3),i=Ue(null==n?void 0:n.upperExp,5),o=Te(e),a=t?Fe(o,t):o;if(a.exponent=i)return De(e,t);{let e=a.coefficients;const n=a.exponent;e.length0?n:0;return r{throw new Error('Option "precision" must be a number or BigNumber')}))),void 0!==e.wordSize&&(n=je(e.wordSize,(()=>{throw new Error('Option "wordSize" must be a number or BigNumber')}))),e.notation&&(r=e.notation)}return{notation:r,precision:t,wordSize:n}}function Te(e){const t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw new SyntaxError("Invalid number "+e);const n=t[1],r=t[2];let i=parseFloat(t[4]||"0");const o=r.indexOf(".");i+=-1!==o?o-1:r.length-1;const a=r.replace(".","").replace(/^0*/,(function(e){return i-=e.length,""})).replace(/0*$/,"").split("").map((function(e){return parseInt(e)}));return 0===a.length&&(a.push(0),i++),{sign:n,coefficients:a,exponent:i}}function Be(e,t){if(isNaN(e)||!isFinite(e))return String(e);const n=Te(e),r="number"==typeof t?Fe(n,n.exponent+1+t):n;let i=r.coefficients,o=r.exponent+1;const a=o+(t||0);return i.length0?"."+i.join(""):"")+"e"+(o>=0?"+":"")+o}function Fe(e,t){const n={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},r=n.coefficients;for(;t<=0;)r.unshift(0),n.exponent++,t++;if(r.length>t&&r.splice(t,r.length-t)[0]>=5){let e=t-1;for(r[e]++;10===r[e];)r.pop(),0===e&&(r.unshift(0),n.exponent++,e++),e--,r[e]++}return n}function Oe(e){const t=[];for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:1e-8,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(n<=0)throw new Error("Relative tolerance must be greater than 0");if(r<0)throw new Error("Absolute tolerance must be at least 0");return!isNaN(e)&&!isNaN(t)&&(isFinite(e)&&isFinite(t)?e===t||Math.abs(e-t)<=Math.max(n*Math.max(Math.abs(e),Math.abs(t)),r):e===t)}const Ie=Math.acosh||function(e){return Math.log(Math.sqrt(e*e-1)+e)},ze=Math.asinh||function(e){return Math.log(Math.sqrt(e*e+1)+e)},ke=Math.atanh||function(e){return Math.log((1+e)/(1-e))/2},Re=Math.cosh||function(e){return(Math.exp(e)+Math.exp(-e))/2},qe=Math.sinh||function(e){return(Math.exp(e)-Math.exp(-e))/2},Pe=Math.tanh||function(e){const t=Math.exp(2*e);return(t-1)/(t+1)};function je(e,t){return d(e)?e:g(e)?e.toNumber():void t()}function Ue(e,t){return d(e)?e:g(e)?e.toNumber():t}let Le=function(){return Le=t.create,t};const $e=he("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],(function(e){let{BigNumber:t,Complex:n,DenseMatrix:r,Fraction:i}=e;const o=Le();return o.clear(),o.addTypes([{name:"number",test:d},{name:"Complex",test:x},{name:"BigNumber",test:g},{name:"bigint",test:y},{name:"Fraction",test:b},{name:"Unit",test:v},{name:"identifier",test:e=>w&&/^[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u{10000}-\u{1000B}\u{1000D}-\u{10026}\u{10028}-\u{1003A}\u{1003C}\u{1003D}\u{1003F}-\u{1004D}\u{10050}-\u{1005D}\u{10080}-\u{100FA}\u{10280}-\u{1029C}\u{102A0}-\u{102D0}\u{10300}-\u{1031F}\u{1032D}-\u{10340}\u{10342}-\u{10349}\u{10350}-\u{10375}\u{10380}-\u{1039D}\u{103A0}-\u{103C3}\u{103C8}-\u{103CF}\u{10400}-\u{1049D}\u{104B0}-\u{104D3}\u{104D8}-\u{104FB}\u{10500}-\u{10527}\u{10530}-\u{10563}\u{10570}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{105C0}-\u{105F3}\u{10600}-\u{10736}\u{10740}-\u{10755}\u{10760}-\u{10767}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10860}-\u{10876}\u{10880}-\u{1089E}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{10900}-\u{10915}\u{10920}-\u{10939}\u{10980}-\u{109B7}\u{109BE}\u{109BF}\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A60}-\u{10A7C}\u{10A80}-\u{10A9C}\u{10AC0}-\u{10AC7}\u{10AC9}-\u{10AE4}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B60}-\u{10B72}\u{10B80}-\u{10B91}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10D00}-\u{10D23}\u{10D4A}-\u{10D65}\u{10D6F}-\u{10D85}\u{10E80}-\u{10EA9}\u{10EB0}\u{10EB1}\u{10EC2}-\u{10EC4}\u{10F00}-\u{10F1C}\u{10F27}\u{10F30}-\u{10F45}\u{10F70}-\u{10F81}\u{10FB0}-\u{10FC4}\u{10FE0}-\u{10FF6}\u{11003}-\u{11037}\u{11071}\u{11072}\u{11075}\u{11083}-\u{110AF}\u{110D0}-\u{110E8}\u{11103}-\u{11126}\u{11144}\u{11147}\u{11150}-\u{11172}\u{11176}\u{11183}-\u{111B2}\u{111C1}-\u{111C4}\u{111DA}\u{111DC}\u{11200}-\u{11211}\u{11213}-\u{1122B}\u{1123F}\u{11240}\u{11280}-\u{11286}\u{11288}\u{1128A}-\u{1128D}\u{1128F}-\u{1129D}\u{1129F}-\u{112A8}\u{112B0}-\u{112DE}\u{11305}-\u{1130C}\u{1130F}\u{11310}\u{11313}-\u{11328}\u{1132A}-\u{11330}\u{11332}\u{11333}\u{11335}-\u{11339}\u{1133D}\u{11350}\u{1135D}-\u{11361}\u{11380}-\u{11389}\u{1138B}\u{1138E}\u{11390}-\u{113B5}\u{113B7}\u{113D1}\u{113D3}\u{11400}-\u{11434}\u{11447}-\u{1144A}\u{1145F}-\u{11461}\u{11480}-\u{114AF}\u{114C4}\u{114C5}\u{114C7}\u{11580}-\u{115AE}\u{115D8}-\u{115DB}\u{11600}-\u{1162F}\u{11644}\u{11680}-\u{116AA}\u{116B8}\u{11700}-\u{1171A}\u{11740}-\u{11746}\u{11800}-\u{1182B}\u{118A0}-\u{118DF}\u{118FF}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}\u{11916}\u{11918}-\u{1192F}\u{1193F}\u{11941}\u{119A0}-\u{119A7}\u{119AA}-\u{119D0}\u{119E1}\u{119E3}\u{11A00}\u{11A0B}-\u{11A32}\u{11A3A}\u{11A50}\u{11A5C}-\u{11A89}\u{11A9D}\u{11AB0}-\u{11AF8}\u{11BC0}-\u{11BE0}\u{11C00}-\u{11C08}\u{11C0A}-\u{11C2E}\u{11C40}\u{11C72}-\u{11C8F}\u{11D00}-\u{11D06}\u{11D08}\u{11D09}\u{11D0B}-\u{11D30}\u{11D46}\u{11D60}-\u{11D65}\u{11D67}\u{11D68}\u{11D6A}-\u{11D89}\u{11D98}\u{11EE0}-\u{11EF2}\u{11F02}\u{11F04}-\u{11F10}\u{11F12}-\u{11F33}\u{11FB0}\u{12000}-\u{12399}\u{12480}-\u{12543}\u{12F90}-\u{12FF0}\u{13000}-\u{1342F}\u{13441}-\u{13446}\u{13460}-\u{143FA}\u{14400}-\u{14646}\u{16100}-\u{1611D}\u{16800}-\u{16A38}\u{16A40}-\u{16A5E}\u{16A70}-\u{16ABE}\u{16AD0}-\u{16AED}\u{16B00}-\u{16B2F}\u{16B40}-\u{16B43}\u{16B63}-\u{16B77}\u{16B7D}-\u{16B8F}\u{16D40}-\u{16D6C}\u{16E40}-\u{16E7F}\u{16F00}-\u{16F4A}\u{16F50}\u{16F93}-\u{16F9F}\u{16FE0}\u{16FE1}\u{16FE3}\u{17000}-\u{187F7}\u{18800}-\u{18CD5}\u{18CFF}-\u{18D08}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1B000}-\u{1B122}\u{1B132}\u{1B150}-\u{1B152}\u{1B155}\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1BC00}-\u{1BC6A}\u{1BC70}-\u{1BC7C}\u{1BC80}-\u{1BC88}\u{1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}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B739}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}\u{2EBF0}-\u{2EE5D}\u{2F800}-\u{2FA1D}\u{30000}-\u{3134A}\u{31350}-\u{323AF}][0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u{10000}-\u{1000B}\u{1000D}-\u{10026}\u{10028}-\u{1003A}\u{1003C}\u{1003D}\u{1003F}-\u{1004D}\u{10050}-\u{1005D}\u{10080}-\u{100FA}\u{10280}-\u{1029C}\u{102A0}-\u{102D0}\u{10300}-\u{1031F}\u{1032D}-\u{10340}\u{10342}-\u{10349}\u{10350}-\u{10375}\u{10380}-\u{1039D}\u{103A0}-\u{103C3}\u{103C8}-\u{103CF}\u{10400}-\u{1049D}\u{104B0}-\u{104D3}\u{104D8}-\u{104FB}\u{10500}-\u{10527}\u{10530}-\u{10563}\u{10570}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{105C0}-\u{105F3}\u{10600}-\u{10736}\u{10740}-\u{10755}\u{10760}-\u{10767}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10860}-\u{10876}\u{10880}-\u{1089E}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{10900}-\u{10915}\u{10920}-\u{10939}\u{10980}-\u{109B7}\u{109BE}\u{109BF}\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A60}-\u{10A7C}\u{10A80}-\u{10A9C}\u{10AC0}-\u{10AC7}\u{10AC9}-\u{10AE4}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B60}-\u{10B72}\u{10B80}-\u{10B91}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10D00}-\u{10D23}\u{10D4A}-\u{10D65}\u{10D6F}-\u{10D85}\u{10E80}-\u{10EA9}\u{10EB0}\u{10EB1}\u{10EC2}-\u{10EC4}\u{10F00}-\u{10F1C}\u{10F27}\u{10F30}-\u{10F45}\u{10F70}-\u{10F81}\u{10FB0}-\u{10FC4}\u{10FE0}-\u{10FF6}\u{11003}-\u{11037}\u{11071}\u{11072}\u{11075}\u{11083}-\u{110AF}\u{110D0}-\u{110E8}\u{11103}-\u{11126}\u{11144}\u{11147}\u{11150}-\u{11172}\u{11176}\u{11183}-\u{111B2}\u{111C1}-\u{111C4}\u{111DA}\u{111DC}\u{11200}-\u{11211}\u{11213}-\u{1122B}\u{1123F}\u{11240}\u{11280}-\u{11286}\u{11288}\u{1128A}-\u{1128D}\u{1128F}-\u{1129D}\u{1129F}-\u{112A8}\u{112B0}-\u{112DE}\u{11305}-\u{1130C}\u{1130F}\u{11310}\u{11313}-\u{11328}\u{1132A}-\u{11330}\u{11332}\u{11333}\u{11335}-\u{11339}\u{1133D}\u{11350}\u{1135D}-\u{11361}\u{11380}-\u{11389}\u{1138B}\u{1138E}\u{11390}-\u{113B5}\u{113B7}\u{113D1}\u{113D3}\u{11400}-\u{11434}\u{11447}-\u{1144A}\u{1145F}-\u{11461}\u{11480}-\u{114AF}\u{114C4}\u{114C5}\u{114C7}\u{11580}-\u{115AE}\u{115D8}-\u{115DB}\u{11600}-\u{1162F}\u{11644}\u{11680}-\u{116AA}\u{116B8}\u{11700}-\u{1171A}\u{11740}-\u{11746}\u{11800}-\u{1182B}\u{118A0}-\u{118DF}\u{118FF}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}\u{11916}\u{11918}-\u{1192F}\u{1193F}\u{11941}\u{119A0}-\u{119A7}\u{119AA}-\u{119D0}\u{119E1}\u{119E3}\u{11A00}\u{11A0B}-\u{11A32}\u{11A3A}\u{11A50}\u{11A5C}-\u{11A89}\u{11A9D}\u{11AB0}-\u{11AF8}\u{11BC0}-\u{11BE0}\u{11C00}-\u{11C08}\u{11C0A}-\u{11C2E}\u{11C40}\u{11C72}-\u{11C8F}\u{11D00}-\u{11D06}\u{11D08}\u{11D09}\u{11D0B}-\u{11D30}\u{11D46}\u{11D60}-\u{11D65}\u{11D67}\u{11D68}\u{11D6A}-\u{11D89}\u{11D98}\u{11EE0}-\u{11EF2}\u{11F02}\u{11F04}-\u{11F10}\u{11F12}-\u{11F33}\u{11FB0}\u{12000}-\u{12399}\u{12480}-\u{12543}\u{12F90}-\u{12FF0}\u{13000}-\u{1342F}\u{13441}-\u{13446}\u{13460}-\u{143FA}\u{14400}-\u{14646}\u{16100}-\u{1611D}\u{16800}-\u{16A38}\u{16A40}-\u{16A5E}\u{16A70}-\u{16ABE}\u{16AD0}-\u{16AED}\u{16B00}-\u{16B2F}\u{16B40}-\u{16B43}\u{16B63}-\u{16B77}\u{16B7D}-\u{16B8F}\u{16D40}-\u{16D6C}\u{16E40}-\u{16E7F}\u{16F00}-\u{16F4A}\u{16F50}\u{16F93}-\u{16F9F}\u{16FE0}\u{16FE1}\u{16FE3}\u{17000}-\u{187F7}\u{18800}-\u{18CD5}\u{18CFF}-\u{18D08}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1B000}-\u{1B122}\u{1B132}\u{1B150}-\u{1B152}\u{1B155}\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1BC00}-\u{1BC6A}\u{1BC70}-\u{1BC7C}\u{1BC80}-\u{1BC88}\u{1BC90}-\u{1BC99}\u{1D400}-\u{1D454}\u{1D456}-\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D51E}-\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D552}-\u{1D6A5}\u{1D6A8}-\u{1D6C0}\u{1D6C2}-\u{1D6DA}\u{1D6DC}-\u{1D6FA}\u{1D6FC}-\u{1D714}\u{1D716}-\u{1D734}\u{1D736}-\u{1D74E}\u{1D750}-\u{1D76E}\u{1D770}-\u{1D788}\u{1D78A}-\u{1D7A8}\u{1D7AA}-\u{1D7C2}\u{1D7C4}-\u{1D7CB}\u{1DF00}-\u{1DF1E}\u{1DF25}-\u{1DF2A}\u{1E030}-\u{1E06D}\u{1E100}-\u{1E12C}\u{1E137}-\u{1E13D}\u{1E14E}\u{1E290}-\u{1E2AD}\u{1E2C0}-\u{1E2EB}\u{1E4D0}-\u{1E4EB}\u{1E5D0}-\u{1E5ED}\u{1E5F0}\u{1E7E0}-\u{1E7E6}\u{1E7E8}-\u{1E7EB}\u{1E7ED}\u{1E7EE}\u{1E7F0}-\u{1E7FE}\u{1E800}-\u{1E8C4}\u{1E900}-\u{1E943}\u{1E94B}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B739}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}\u{2EBF0}-\u{2EE5D}\u{2F800}-\u{2FA1D}\u{30000}-\u{3134A}\u{31350}-\u{323AF}]*$/u.test(e)},{name:"string",test:w},{name:"Chain",test:ie},{name:"Array",test:N},{name:"Matrix",test:E},{name:"DenseMatrix",test:S},{name:"SparseMatrix",test:M},{name:"Range",test:C},{name:"Index",test:T},{name:"boolean",test:B},{name:"ResultSet",test:D},{name:"Help",test:F},{name:"function",test:O},{name:"Date",test:_},{name:"RegExp",test:I},{name:"null",test:P},{name:"undefined",test:j},{name:"AccessorNode",test:U},{name:"ArrayNode",test:L},{name:"AssignmentNode",test:$},{name:"BlockNode",test:H},{name:"ConditionalNode",test:G},{name:"ConstantNode",test:V},{name:"FunctionNode",test:Y},{name:"FunctionAssignmentNode",test:W},{name:"IndexNode",test:J},{name:"Node",test:X},{name:"ObjectNode",test:Q},{name:"OperatorNode",test:K},{name:"ParenthesisNode",test:ee},{name:"RangeNode",test:te},{name:"RelationalNode",test:ne},{name:"SymbolNode",test:re},{name:"Map",test:k},{name:"Object",test:z}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(e){if(t||He(e),e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+e+"). Use function bignumber(x) to convert to BigNumber.");return new t(e)}},{from:"number",to:"Complex",convert:function(e){return n||Ge(e),new n(e,0)}},{from:"BigNumber",to:"Complex",convert:function(e){return n||Ge(e),new n(e.toNumber(),0)}},{from:"bigint",to:"number",convert:function(e){if(e>Number.MAX_SAFE_INTEGER)throw new TypeError("Cannot implicitly convert bigint to number: value exceeds the max safe integer value (value: "+e+")");return Number(e)}},{from:"bigint",to:"BigNumber",convert:function(e){return t||He(e),new t(e.toString())}},{from:"bigint",to:"Fraction",convert:function(e){return i||Ve(e),new i(e)}},{from:"Fraction",to:"BigNumber",convert:function(e){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(e){return n||Ge(e),new n(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||Ve(e);const t=new i(e);if(t.valueOf()!==e)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+e+"). Use function fraction(x) to convert to Fraction.");return t}},{from:"string",to:"number",convert:function(e){const t=Number(e);if(isNaN(t))throw new Error('Cannot convert "'+e+'" to a number');return t}},{from:"string",to:"BigNumber",convert:function(e){t||He(e);try{return new t(e)}catch(t){throw new Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"bigint",convert:function(e){try{return BigInt(e)}catch(t){throw new Error('Cannot convert "'+e+'" to BigInt')}}},{from:"string",to:"Fraction",convert:function(e){i||Ve(e);try{return new i(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){n||Ge(e);try{return new n(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(e){return t||He(e),new t(+e)}},{from:"boolean",to:"bigint",convert:function(e){return BigInt(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||Ve(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return r||function(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new r(e)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}]),o.onMismatch=(e,t,n)=>{const r=o.createError(e,t,n);if(["wrongType","mismatch"].includes(r.data.category)&&1===t.length&&A(t[0])&&n.some((e=>!e.params.includes(",")))){const t=new TypeError(`Function '${e}' doesn't apply to matrices. To call it elementwise on a matrix 'M', try 'map(M, ${e})'.`);throw t.data=r.data,t}throw r},o.onMismatch=(e,t,n)=>{const r=o.createError(e,t,n);if(["wrongType","mismatch"].includes(r.data.category)&&1===t.length&&A(t[0])&&n.some((e=>!e.params.includes(",")))){const t=new TypeError(`Function '${e}' doesn't apply to matrices. To call it elementwise on a matrix 'M', try 'map(M, ${e})'.`);throw t.data=r.data,t}throw r},o}));function He(e){throw new Error(`Cannot convert value ${e} into a BigNumber: no class 'BigNumber' provided`)}function Ge(e){throw new Error(`Cannot convert value ${e} into a Complex number: no class 'Complex' provided`)}function Ve(e){throw new Error(`Cannot convert value ${e} into a Fraction, no class 'Fraction' provided.`)}const Ze=he("ResultSet",[],(()=>{function e(t){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");this.entries=t||[]}return e.prototype.type="ResultSet",e.prototype.isResultSet=!0,e.prototype.valueOf=function(){return this.entries},e.prototype.toString=function(){return"["+this.entries.map(String).join(", ")+"]"},e.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},e.fromJSON=function(t){return new e(t.entries)},e}),{isClass:!0});var We,Ye,Je=9e15,Xe=1e9,Qe="0123456789abcdef",Ke="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",et="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",tt={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Je,maxE:Je,crypto:!1},nt=!0,rt="[DecimalError] ",it=rt+"Invalid argument: ",ot=rt+"Precision limit exceeded",at=rt+"crypto unavailable",st="[object Decimal]",ut=Math.floor,ct=Math.pow,lt=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,ft=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,pt=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,mt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ht=1e7,dt=Ke.length-1,gt=et.length-1,yt={toStringTag:st};function xt(e){var t,n,r,i=e.length-1,o="",a=e[0];if(i>0){for(o+=a,t=1;tn)throw Error(it+e)}function vt(e,t,n,r){var i,o,a,s;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),o=ct(10,7-t),s=e[i]%o|0,null==r?t<3?(0==t?s=s/100|0:1==t&&(s=s/10|0),a=n<4&&99999==s||n>3&&49999==s||5e4==s||0==s):a=(n<4&&s+1==o||n>3&&s+1==o/2)&&(e[i+1]/o/100|0)==ct(10,t-2)-1||(s==o/2||0==s)&&!(e[i+1]/o/100|0):t<4?(0==t?s=s/1e3|0:1==t?s=s/100|0:2==t&&(s=s/10|0),a=(r||n<4)&&9999==s||!r&&n>3&&4999==s):a=((r||n<4)&&s+1==o||!r&&n>3&&s+1==o/2)&&(e[i+1]/o/1e3|0)==ct(10,t-3)-1,a}function wt(e,t,n){for(var r,i,o=[0],a=0,s=e.length;an-1&&(void 0===o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}yt.absoluteValue=yt.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Et(e)},yt.ceil=function(){return Et(new this.constructor(this),this.e+1,2)},yt.clampedTo=yt.clamp=function(e,t){var n=this,r=n.constructor;if(e=new r(e),t=new r(t),!e.s||!t.s)return new r(NaN);if(e.gt(t))throw Error(it+t);return n.cmp(e)<0?e:n.cmp(t)>0?t:new r(n)},yt.comparedTo=yt.cmp=function(e){var t,n,r,i,o=this,a=o.d,s=(e=new o.constructor(e)).d,u=o.s,c=e.s;if(!a||!s)return u&&c?u!==c?u:a===s?0:!a^u<0?1:-1:NaN;if(!a[0]||!s[0])return a[0]?u:s[0]?-c:0;if(u!==c)return u;if(o.e!==e.e)return o.e>e.e^u<0?1:-1;for(t=0,n=(r=a.length)<(i=s.length)?r:i;ts[t]^u<0?1:-1;return r===i?0:r>i^u<0?1:-1},yt.cosine=yt.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(e,t){var n,r,i;if(t.isZero())return t;(r=t.d.length)<32?i=(1/Pt(4,n=Math.ceil(r/3))).toString():(n=16,i="2.3283064365386962890625e-10"),e.precision+=n,t=qt(e,1,t.times(i),new e(1));for(var o=n;o--;){var a=t.times(t);t=a.times(a).minus(a).times(8).plus(1)}return e.precision-=n,t}(r,jt(r,n)),r.precision=e,r.rounding=t,Et(2==Ye||3==Ye?n.neg():n,e,t,!0)):new r(1):new r(NaN)},yt.cubeRoot=yt.cbrt=function(){var e,t,n,r,i,o,a,s,u,c,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(nt=!1,(o=l.s*ct(l.s*l,1/3))&&Math.abs(o)!=1/0?r=new f(o.toString()):(n=xt(l.d),(o=((e=l.e)-n.length+1)%3)&&(n+=1==o||-2==o?"0":"00"),o=ct(n,1/3),e=ut((e+1)/3)-(e%3==(e<0?-1:2)),(r=new f(n=o==1/0?"5e"+e:(n=o.toExponential()).slice(0,n.indexOf("e")+1)+e)).s=l.s),a=(e=f.precision)+3;;)if(c=(u=(s=r).times(s).times(s)).plus(l),r=Nt(c.plus(l).times(s),c.plus(u),a+2,1),xt(s.d).slice(0,a)===(n=xt(r.d)).slice(0,a)){if("9999"!=(n=n.slice(a-3,a+1))&&(i||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(Et(r,e+1,1),t=!r.times(r).times(r).eq(l));break}if(!i&&(Et(s,e+1,0),s.times(s).times(s).eq(l))){r=s;break}a+=4,i=1}return nt=!0,Et(r,e,f.rounding,t)},yt.decimalPlaces=yt.dp=function(){var e,t=this.d,n=NaN;if(t){if(n=7*((e=t.length-1)-ut(this.e/7)),e=t[e])for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},yt.dividedBy=yt.div=function(e){return Nt(this,new this.constructor(e))},yt.dividedToIntegerBy=yt.divToInt=function(e){var t=this.constructor;return Et(Nt(this,new t(e),0,1,1),t.precision,t.rounding)},yt.equals=yt.eq=function(e){return 0===this.cmp(e)},yt.floor=function(){return Et(new this.constructor(this),this.e+1,3)},yt.greaterThan=yt.gt=function(e){return this.cmp(e)>0},yt.greaterThanOrEqualTo=yt.gte=function(e){var t=this.cmp(e);return 1==t||0===t},yt.hyperbolicCosine=yt.cosh=function(){var e,t,n,r,i,o=this,a=o.constructor,s=new a(1);if(!o.isFinite())return new a(o.s?1/0:NaN);if(o.isZero())return s;n=a.precision,r=a.rounding,a.precision=n+Math.max(o.e,o.sd())+4,a.rounding=1,(i=o.d.length)<32?t=(1/Pt(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),o=qt(a,1,o.times(t),new a(1),!0);for(var u,c=e,l=new a(8);c--;)u=o.times(o),o=s.minus(u.times(l.minus(u.times(l))));return Et(o,a.precision=n,a.rounding=r,!0)},yt.hyperbolicSine=yt.sinh=function(){var e,t,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,n=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,(r=i.d.length)<3)i=qt(o,2,i,i,!0);else{e=(e=1.4*Math.sqrt(r))>16?16:0|e,i=qt(o,2,i=i.times(1/Pt(5,e)),i,!0);for(var a,s=new o(5),u=new o(16),c=new o(20);e--;)a=i.times(i),i=i.times(s.plus(a.times(u.times(a).plus(c))))}return o.precision=t,o.rounding=n,Et(i,t,n,!0)},yt.hyperbolicTangent=yt.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,Nt(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)},yt.inverseCosine=yt.acos=function(){var e=this,t=e.constructor,n=e.abs().cmp(1),r=t.precision,i=t.rounding;return-1!==n?0===n?e.isNeg()?Ct(t,r,i):new t(0):new t(NaN):e.isZero()?Ct(t,r+4,i).times(.5):(t.precision=r+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=r,t.rounding=i,e.times(2))},yt.inverseHyperbolicCosine=yt.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,nt=!1,n=n.times(n).minus(1).sqrt().plus(n),nt=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)},yt.inverseHyperbolicSine=yt.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,nt=!1,n=n.times(n).plus(1).sqrt().plus(n),nt=!0,r.precision=e,r.rounding=t,n.ln())},yt.inverseHyperbolicTangent=yt.atanh=function(){var e,t,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,r=i.sd(),Math.max(r,e)<2*-i.e-1?Et(new o(i),e,t,!0):(o.precision=n=r-i.e,i=Nt(i.plus(1),new o(1).minus(i),n+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5))):new o(NaN)},yt.inverseSine=yt.asin=function(){var e,t,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),n=o.precision,r=o.rounding,-1!==t?0===t?((e=Ct(o,n+4,r).times(.5)).s=i.s,e):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))},yt.inverseTangent=yt.atan=function(){var e,t,n,r,i,o,a,s,u,c=this,l=c.constructor,f=l.precision,p=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&f+4<=gt)return(a=Ct(l,f+4,p).times(.25)).s=c.s,a}else{if(!c.s)return new l(NaN);if(f+4<=gt)return(a=Ct(l,f+4,p).times(.5)).s=c.s,a}for(l.precision=s=f+10,l.rounding=1,e=n=Math.min(28,s/7+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(nt=!1,t=Math.ceil(s/7),r=1,u=c.times(c),a=new l(c),i=c;-1!==e;)if(i=i.times(u),o=a.minus(i.div(r+=2)),i=i.times(u),void 0!==(a=o.plus(i.div(r+=2))).d[t])for(e=t;a.d[e]===o.d[e]&&e--;);return n&&(a=a.times(2<this.d.length-2},yt.isNaN=function(){return!this.s},yt.isNegative=yt.isNeg=function(){return this.s<0},yt.isPositive=yt.isPos=function(){return this.s>0},yt.isZero=function(){return!!this.d&&0===this.d[0]},yt.lessThan=yt.lt=function(e){return this.cmp(e)<0},yt.lessThanOrEqualTo=yt.lte=function(e){return this.cmp(e)<1},yt.logarithm=yt.log=function(e){var t,n,r,i,o,a,s,u,c=this,l=c.constructor,f=l.precision,p=l.rounding;if(null==e)e=new l(10),t=!0;else{if(n=(e=new l(e)).d,e.s<0||!n||!n[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(n=c.d,c.s<0||!n||!n[0]||c.eq(1))return new l(n&&!n[0]?-1/0:1!=c.s?NaN:n?0:1/0);if(t)if(n.length>1)o=!0;else{for(i=n[0];i%10==0;)i/=10;o=1!==i}if(nt=!1,a=It(c,s=f+5),r=t?Mt(l,s+10):It(e,s),vt((u=Nt(a,r,s,1)).d,i=f,p))do{if(a=It(c,s+=10),r=t?Mt(l,s+10):It(e,s),u=Nt(a,r,s,1),!o){+xt(u.d).slice(i+1,i+15)+1==1e14&&(u=Et(u,f+1,0));break}}while(vt(u.d,i+=10,p));return nt=!0,Et(u,f,p)},yt.minus=yt.sub=function(e){var t,n,r,i,o,a,s,u,c,l,f,p,m=this,h=m.constructor;if(e=new h(e),!m.d||!e.d)return m.s&&e.s?m.d?e.s=-e.s:e=new h(e.d||m.s!==e.s?m:NaN):e=new h(NaN),e;if(m.s!=e.s)return e.s=-e.s,m.plus(e);if(c=m.d,p=e.d,s=h.precision,u=h.rounding,!c[0]||!p[0]){if(p[0])e.s=-e.s;else{if(!c[0])return new h(3===u?-0:0);e=new h(m)}return nt?Et(e,s,u):e}if(n=ut(e.e/7),l=ut(m.e/7),c=c.slice(),o=l-n){for((f=o<0)?(t=c,o=-o,a=p.length):(t=p,n=l,a=c.length),o>(r=Math.max(Math.ceil(s/7),a)+2)&&(o=r,t.length=1),t.reverse(),r=o;r--;)t.push(0);t.reverse()}else{for((f=(r=c.length)<(a=p.length))&&(a=r),r=0;r0;--r)c[a++]=0;for(r=p.length;r>o;){if(c[--r](a=(o=Math.ceil(s/7))>a?o+1:a+1)&&(i=a,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((a=c.length)-(i=l.length)<0&&(i=a,n=l,l=c,c=n),t=0;i;)t=(c[--i]=c[i]+l[i]+t)/ht|0,c[i]%=ht;for(t&&(c.unshift(t),++r),a=c.length;0==c[--a];)c.pop();return e.d=c,e.e=St(c,r),nt?Et(e,s,u):e},yt.precision=yt.sd=function(e){var t,n=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(it+e);return n.d?(t=Tt(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t},yt.round=function(){var e=this,t=e.constructor;return Et(new t(e),e.e+1,t.rounding)},yt.sine=yt.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:qt(e,2,t,t);n=(n=1.4*Math.sqrt(r))>16?16:0|n,t=qt(e,2,t=t.times(1/Pt(5,n)),t);for(var i,o=new e(5),a=new e(16),s=new e(20);n--;)i=t.times(t),t=t.times(o.plus(i.times(a.times(i).minus(s))));return t}(r,jt(r,n)),r.precision=e,r.rounding=t,Et(Ye>2?n.neg():n,e,t,!0)):new r(NaN)},yt.squareRoot=yt.sqrt=function(){var e,t,n,r,i,o,a=this,s=a.d,u=a.e,c=a.s,l=a.constructor;if(1!==c||!s||!s[0])return new l(!c||c<0&&(!s||s[0])?NaN:s?a:1/0);for(nt=!1,0==(c=Math.sqrt(+a))||c==1/0?(((t=xt(s)).length+u)%2==0&&(t+="0"),c=Math.sqrt(t),u=ut((u+1)/2)-(u<0||u%2),r=new l(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):r=new l(c.toString()),n=(u=l.precision)+3;;)if(r=(o=r).plus(Nt(a,o,n+2,1)).times(.5),xt(o.d).slice(0,n)===(t=xt(r.d)).slice(0,n)){if("9999"!=(t=t.slice(n-3,n+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(Et(r,u+1,1),e=!r.times(r).eq(a));break}if(!i&&(Et(o,u+1,0),o.times(o).eq(a))){r=o;break}n+=4,i=1}return nt=!0,Et(r,u,l.rounding,e)},yt.tangent=yt.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,(n=n.sin()).s=1,n=Nt(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,Et(2==Ye||4==Ye?n.neg():n,e,t,!0)):new r(NaN)},yt.times=yt.mul=function(e){var t,n,r,i,o,a,s,u,c,l=this,f=l.constructor,p=l.d,m=(e=new f(e)).d;if(e.s*=l.s,!(p&&p[0]&&m&&m[0]))return new f(!e.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:p&&m?0*e.s:e.s/0);for(n=ut(l.e/7)+ut(e.e/7),(u=p.length)<(c=m.length)&&(o=p,p=m,m=o,a=u,u=c,c=a),o=[],r=a=u+c;r--;)o.push(0);for(r=c;--r>=0;){for(t=0,i=u+r;i>r;)s=o[i]+m[r]*p[i-r-1]+t,o[i--]=s%ht|0,t=s/ht|0;o[i]=(o[i]+t)%ht|0}for(;!o[--a];)o.pop();return t?++n:o.shift(),e.d=o,e.e=St(o,n),nt?Et(e,f.precision,f.rounding):e},yt.toBinary=function(e,t){return Ut(this,2,e,t)},yt.toDecimalPlaces=yt.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),void 0===e?n:(bt(e,0,Xe),void 0===t?t=r.rounding:bt(t,0,8),Et(n,e+n.e+1,t))},yt.toExponential=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=At(r,!0):(bt(e,0,Xe),void 0===t?t=i.rounding:bt(t,0,8),n=At(r=Et(new i(r),e+1,t),!0,e+1)),r.isNeg()&&!r.isZero()?"-"+n:n},yt.toFixed=function(e,t){var n,r,i=this,o=i.constructor;return void 0===e?n=At(i):(bt(e,0,Xe),void 0===t?t=o.rounding:bt(t,0,8),n=At(r=Et(new o(i),e+i.e+1,t),!1,e+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},yt.toFraction=function(e){var t,n,r,i,o,a,s,u,c,l,f,p,m=this,h=m.d,d=m.constructor;if(!h)return new d(m);if(c=n=new d(1),r=u=new d(0),a=(o=(t=new d(r)).e=Tt(h)-m.e-1)%7,t.d[0]=ct(10,a<0?7+a:a),null==e)e=o>0?t:c;else{if(!(s=new d(e)).isInt()||s.lt(c))throw Error(it+s);e=s.gt(t)?o>0?t:c:s}for(nt=!1,s=new d(xt(h)),l=d.precision,d.precision=o=7*h.length*2;f=Nt(s,t,0,1,1),1!=(i=n.plus(f.times(r))).cmp(e);)n=r,r=i,i=c,c=u.plus(f.times(i)),u=i,i=t,t=s.minus(f.times(i)),s=i;return i=Nt(e.minus(n),r,0,1,1),u=u.plus(i.times(c)),n=n.plus(i.times(r)),u.s=c.s=m.s,p=Nt(c,r,o,1).minus(m).abs().cmp(Nt(u,n,o,1).minus(m).abs())<1?[c,r]:[u,n],d.precision=l,nt=!0,p},yt.toHexadecimal=yt.toHex=function(e,t){return Ut(this,16,e,t)},yt.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),null==e){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),void 0===t?t=r.rounding:bt(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(nt=!1,n=Nt(n,e,0,t,1).times(e),nt=!0,Et(n)):(e.s=n.s,n=e),n},yt.toNumber=function(){return+this},yt.toOctal=function(e,t){return Ut(this,8,e,t)},yt.toPower=yt.pow=function(e){var t,n,r,i,o,a,s=this,u=s.constructor,c=+(e=new u(e));if(!(s.d&&e.d&&s.d[0]&&e.d[0]))return new u(ct(+s,c));if((s=new u(s)).eq(1))return s;if(r=u.precision,o=u.rounding,e.eq(1))return Et(s,r,o);if((t=ut(e.e/7))>=e.d.length-1&&(n=c<0?-c:c)<=9007199254740991)return i=Dt(u,s,n,r),e.s<0?new u(1).div(i):Et(i,r,o);if((a=s.s)<0){if(tu.maxE+1||t0?a/0:0):(nt=!1,u.rounding=s.s=1,n=Math.min(12,(t+"").length),(i=_t(e.times(It(s,r+n)),r)).d&&vt((i=Et(i,r+5,1)).d,r,o)&&(t=r+10,+xt((i=Et(_t(e.times(It(s,t+n)),t),t+5,1)).d).slice(r+1,r+15)+1==1e14&&(i=Et(i,r+1,0))),i.s=a,nt=!0,u.rounding=o,Et(i,r,o))},yt.toPrecision=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=At(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(bt(e,1,Xe),void 0===t?t=i.rounding:bt(t,0,8),n=At(r=Et(new i(r),e,t),e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?"-"+n:n},yt.toSignificantDigits=yt.toSD=function(e,t){var n=this.constructor;return void 0===e?(e=n.precision,t=n.rounding):(bt(e,1,Xe),void 0===t?t=n.rounding:bt(t,0,8)),Et(new n(this),e,t)},yt.toString=function(){var e=this,t=e.constructor,n=At(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n},yt.truncated=yt.trunc=function(){return Et(new this.constructor(this),this.e+1,1)},yt.valueOf=yt.toJSON=function(){var e=this,t=e.constructor,n=At(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+n:n};var Nt=function(){function e(e,t,n){var r,i=0,o=e.length;for(e=e.slice();o--;)r=e[o]*t+i,e[o]=r%n|0,i=r/n|0;return i&&e.unshift(i),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]1;)e.shift()}return function(r,i,o,a,s,u){var c,l,f,p,m,h,d,g,y,x,b,v,w,N,E,A,S,M,C,T,B=r.constructor,D=r.s==i.s?1:-1,F=r.d,O=i.d;if(!(F&&F[0]&&O&&O[0]))return new B(r.s&&i.s&&(F?!O||F[0]!=O[0]:O)?F&&0==F[0]||!O?0*D:D/0:NaN);for(u?(m=1,l=r.e-i.e):(u=ht,m=7,l=ut(r.e/m)-ut(i.e/m)),C=O.length,S=F.length,x=(y=new B(D)).d=[],f=0;O[f]==(F[f]||0);f++);if(O[f]>(F[f]||0)&&l--,null==o?(N=o=B.precision,a=B.rounding):N=s?o+(r.e-i.e)+1:o,N<0)x.push(1),h=!0;else{if(N=N/m+2|0,f=0,1==C){for(p=0,O=O[0],N++;(f1&&(O=e(O,p,u),F=e(F,p,u),C=O.length,S=F.length),A=C,v=(b=F.slice(0,C)).length;v=u/2&&++M;do{p=0,(c=t(O,b,C,v))<0?(w=b[0],C!=v&&(w=w*u+(b[1]||0)),(p=w/M|0)>1?(p>=u&&(p=u-1),1==(c=t(d=e(O,p,u),b,g=d.length,v=b.length))&&(p--,n(d,C=10;p/=10)f++;y.e=f+l*m-1,Et(y,s?o+y.e+1:o,a,h)}return y}}();function Et(e,t,n,r){var i,o,a,s,u,c,l,f,p,m=e.constructor;e:if(null!=t){if(!(f=e.d))return e;for(i=1,s=f[0];s>=10;s/=10)i++;if((o=t-i)<0)o+=7,a=t,u=(l=f[p=0])/ct(10,i-a-1)%10|0;else if((p=Math.ceil((o+1)/7))>=(s=f.length)){if(!r)break e;for(;s++<=p;)f.push(0);l=u=0,i=1,a=(o%=7)-7+1}else{for(l=s=f[p],i=1;s>=10;s/=10)i++;u=(a=(o%=7)-7+i)<0?0:l/ct(10,i-a-1)%10|0}if(r=r||t<0||void 0!==f[p+1]||(a<0?l:l%ct(10,i-a-1)),c=n<4?(u||r)&&(0==n||n==(e.s<0?3:2)):u>5||5==u&&(4==n||r||6==n&&(o>0?a>0?l/ct(10,i-a):0:f[p-1])%10&1||n==(e.s<0?8:7)),t<1||!f[0])return f.length=0,c?(t-=e.e+1,f[0]=ct(10,(7-t%7)%7),e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=p,s=1,p--):(f.length=p+1,s=ct(10,7-o),f[p]=a>0?(l/ct(10,i-a)%ct(10,a)|0)*s:0),c)for(;;){if(0==p){for(o=1,a=f[0];a>=10;a/=10)o++;for(a=f[0]+=s,s=1;a>=10;a/=10)s++;o!=s&&(e.e++,f[0]==ht&&(f[0]=1));break}if(f[p]+=s,f[p]!=ht)break;f[p--]=0,s=1}for(o=f.length;0===f[--o];)f.pop()}return nt&&(e.e>m.maxE?(e.d=null,e.e=NaN):e.e0?o=o.charAt(0)+"."+o.slice(1)+Bt(r):a>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+Bt(-i-1)+o,n&&(r=n-a)>0&&(o+=Bt(r))):i>=a?(o+=Bt(i+1-a),n&&(r=n-i-1)>0&&(o=o+"."+Bt(r))):((r=i+1)0&&(i+1===a&&(o+="."),o+=Bt(r))),o}function St(e,t){var n=e[0];for(t*=7;n>=10;n/=10)t++;return t}function Mt(e,t,n){if(t>dt)throw nt=!0,n&&(e.precision=n),Error(ot);return Et(new e(Ke),t,1,!0)}function Ct(e,t,n){if(t>gt)throw Error(ot);return Et(new e(et),t,n,!0)}function Tt(e){var t=e.length-1,n=7*t+1;if(t=e[t]){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function Bt(e){for(var t="";e--;)t+="0";return t}function Dt(e,t,n,r){var i,o=new e(1),a=Math.ceil(r/7+4);for(nt=!1;;){if(n%2&&Lt((o=o.times(t)).d,a)&&(i=!0),0===(n=ut(n/2))){n=o.d.length-1,i&&0===o.d[n]&&++o.d[n];break}Lt((t=t.times(t)).d,a)}return nt=!0,o}function Ft(e){return 1&e.d[e.d.length-1]}function Ot(e,t,n){for(var r,i,o=new e(t[0]),a=0;++a17)return new p(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(null==t?(nt=!1,u=h):u=t,s=new p(.03125);e.e>-2;)e=e.times(s),f+=5;for(u+=r=Math.log(ct(2,f))/Math.LN10*2+5|0,n=o=a=new p(1),p.precision=u;;){if(o=Et(o.times(e),u,1),n=n.times(++l),xt((s=a.plus(Nt(o,n,u,1))).d).slice(0,u)===xt(a.d).slice(0,u)){for(i=f;i--;)a=Et(a.times(a),u,1);if(null!=t)return p.precision=h,a;if(!(c<3&&vt(a.d,u-r,m,c)))return Et(a,p.precision=h,m,nt=!0);p.precision=u+=10,n=o=s=new p(1),l=0,c++}a=s}}function It(e,t){var n,r,i,o,a,s,u,c,l,f,p,m=1,h=e,d=h.d,g=h.constructor,y=g.rounding,x=g.precision;if(h.s<0||!d||!d[0]||!h.e&&1==d[0]&&1==d.length)return new g(d&&!d[0]?-1/0:1!=h.s?NaN:d?0:h);if(null==t?(nt=!1,l=x):l=t,g.precision=l+=10,r=(n=xt(d)).charAt(0),!(Math.abs(o=h.e)<15e14))return c=Mt(g,l+2,x).times(o+""),h=It(new g(r+"."+n.slice(1)),l-10).plus(c),g.precision=x,null==t?Et(h,x,y,nt=!0):h;for(;r<7&&1!=r||1==r&&n.charAt(1)>3;)r=(n=xt((h=h.times(e)).d)).charAt(0),m++;for(o=h.e,r>1?(h=new g("0."+n),o++):h=new g(r+"."+n.slice(1)),f=h,u=a=h=Nt(h.minus(1),h.plus(1),l,1),p=Et(h.times(h),l,1),i=3;;){if(a=Et(a.times(p),l,1),xt((c=u.plus(Nt(a,new g(i),l,1))).d).slice(0,l)===xt(u.d).slice(0,l)){if(u=u.times(2),0!==o&&(u=u.plus(Mt(g,l+2,x).times(o+""))),u=Nt(u,new g(m),l,1),null!=t)return g.precision=x,u;if(!vt(u.d,l-10,y,s))return Et(u,g.precision=x,y,nt=!0);g.precision=l+=10,c=a=h=Nt(f.minus(1),f.plus(1),l,1),p=Et(h.times(h),l,1),i=s=1}u=c,i+=2}}function zt(e){return String(e.s*e.s/0)}function kt(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;48===t.charCodeAt(r);r++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(r,i)){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%7,n<0&&(r+=7),re.constructor.maxE?(e.d=null,e.e=NaN):e.e-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),mt.test(t))return kt(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(ft.test(t))n=16,t=t.toLowerCase();else if(lt.test(t))n=2;else{if(!pt.test(t))throw Error(it+t);n=8}for((o=t.search(/p/i))>0?(u=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),a=(o=t.indexOf("."))>=0,r=e.constructor,a&&(o=(s=(t=t.replace(".","")).length)-o,i=Dt(r,new r(n),o,2*o)),o=l=(c=wt(t,n,ht)).length-1;0===c[o];--o)c.pop();return o<0?new r(0*e.s):(e.e=St(c,l),e.d=c,nt=!1,a&&(e=Nt(e,i,4*s)),u&&(e=e.times(Math.abs(u)<54?ct(2,u):Dn.pow(2,u))),nt=!0,e)}function qt(e,t,n,r,i){var o,a,s,u,c=e.precision,l=Math.ceil(c/7);for(nt=!1,u=n.times(n),s=new e(r);;){if(a=Nt(s.times(u),new e(t++*t++),c,1),s=i?r.plus(a):r.minus(a),r=Nt(a.times(u),new e(t++*t++),c,1),void 0!==(a=s.plus(r)).d[l]){for(o=l;a.d[o]===s.d[o]&&o--;);if(-1==o)break}o=s,s=r,r=a,a=o}return nt=!0,a.d.length=l+1,a}function Pt(e,t){for(var n=e;--t;)n*=e;return n}function jt(e,t){var n,r=t.s<0,i=Ct(e,e.precision,1),o=i.times(.5);if((t=t.abs()).lte(o))return Ye=r?4:1,t;if((n=t.divToInt(i)).isZero())Ye=r?3:2;else{if((t=t.minus(n.times(i))).lte(o))return Ye=Ft(n)?r?2:3:r?4:1,t;Ye=Ft(n)?r?1:4:r?3:2}return t.minus(i).abs()}function Ut(e,t,n,r){var i,o,a,s,u,c,l,f,p,m=e.constructor,h=void 0!==n;if(h?(bt(n,1,Xe),void 0===r?r=m.rounding:bt(r,0,8)):(n=m.precision,r=m.rounding),e.isFinite()){for(h?(i=2,16==t?n=4*n-3:8==t&&(n=3*n-2)):i=t,(a=(l=At(e)).indexOf("."))>=0&&(l=l.replace(".",""),(p=new m(1)).e=l.length-a,p.d=wt(At(p),10,i),p.e=p.d.length),o=u=(f=wt(l,10,i)).length;0==f[--u];)f.pop();if(f[0]){if(a<0?o--:((e=new m(e)).d=f,e.e=o,f=(e=Nt(e,p,n,r,0,i)).d,o=e.e,c=We),a=f[n],s=i/2,c=c||void 0!==f[n+1],c=r<4?(void 0!==a||c)&&(0===r||r===(e.s<0?3:2)):a>s||a===s&&(4===r||c||6===r&&1&f[n-1]||r===(e.s<0?8:7)),f.length=n,c)for(;++f[--n]>i-1;)f[n]=0,n||(++o,f.unshift(1));for(u=f.length;!f[u-1];--u);for(a=0,l="";a1)if(16==t||8==t){for(a=16==t?4:3,--u;u%a;u++)l+="0";for(u=(f=wt(l,i,t)).length;!f[u-1];--u);for(a=1,l="1.";au)for(o-=u;o--;)l+="0";else ot)return e.length=t,!0}function $t(e){return new this(e).abs()}function Ht(e){return new this(e).acos()}function Gt(e){return new this(e).acosh()}function Vt(e,t){return new this(e).plus(t)}function Zt(e){return new this(e).asin()}function Wt(e){return new this(e).asinh()}function Yt(e){return new this(e).atan()}function Jt(e){return new this(e).atanh()}function Xt(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,o=r+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(n=t.s<0?Ct(this,r,i):new this(0)).s=e.s:!e.d||t.isZero()?(n=Ct(this,o,1).times(.5)).s=e.s:t.s<0?(this.precision=o,this.rounding=1,n=this.atan(Nt(e,t,o,1)),t=Ct(this,o,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(Nt(e,t,o,1)):(n=Ct(this,o,1).times(t.s>0?.25:.75)).s=e.s:n=new this(NaN),n}function Qt(e){return new this(e).cbrt()}function Kt(e){return Et(e=new this(e),e.e+1,2)}function en(e,t,n){return new this(e).clamp(t,n)}function tn(e){if(!e||"object"!=typeof e)throw Error(rt+"Object expected");var t,n,r,i=!0===e.defaults,o=["precision",1,Xe,"rounding",0,8,"toExpNeg",-Je,0,"toExpPos",0,Je,"maxE",0,Je,"minE",-Je,0,"modulo",0,9];for(t=0;t=o[t+1]&&r<=o[t+2]))throw Error(it+n+": "+r);this[n]=r}if(n="crypto",i&&(this[n]=tt[n]),void 0!==(r=e[n])){if(!0!==r&&!1!==r&&0!==r&&1!==r)throw Error(it+n+": "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(at);this[n]=!0}else this[n]=!1}return this}function nn(e){return new this(e).cos()}function rn(e){return new this(e).cosh()}function on(e,t){return new this(e).div(t)}function an(e){return new this(e).exp()}function sn(e){return Et(e=new this(e),e.e+1,3)}function un(){var e,t,n=new this(0);for(nt=!1,e=0;e=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:s[o++]=i%1e7;else{if(!crypto.randomBytes)throw Error(at);for(t=crypto.randomBytes(r*=4);o=214e7?crypto.randomBytes(4).copy(t,o):(s.push(i%1e7),o+=4);o=r/4}else for(;o=10;i/=10)r++;r<7&&(n-=7-r)}return a.e=n,a.d=s,a}function vn(e){return Et(e=new this(e),e.e+1,this.rounding)}function wn(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function Nn(e){return new this(e).sin()}function En(e){return new this(e).sinh()}function An(e){return new this(e).sqrt()}function Sn(e,t){return new this(e).sub(t)}function Mn(){var e=0,t=arguments,n=new this(t[e]);for(nt=!1;n.s&&++eo.maxE?(i.e=NaN,i.d=null):e.e=10;n/=10)t++;return void(nt?t>o.maxE?(i.e=NaN,i.d=null):t{let{on:t,config:n}=e;const r=Fn.clone({precision:n.precision,modulo:Fn.EUCLID});return r.prototype=Object.create(r.prototype),r.prototype.type="BigNumber",r.prototype.isBigNumber=!0,r.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},r.fromJSON=function(e){return new r(e.value)},t&&t("config",(function(e,t){e.precision!==t.precision&&r.config({precision:e.precision})})),r}),{isClass:!0}),_n=Math.cosh||function(e){return Math.abs(e)<1e-9?1-e:.5*(Math.exp(e)+Math.exp(-e))},In=Math.sinh||function(e){return Math.abs(e)<1e-9?e:.5*(Math.exp(e)-Math.exp(-e))},zn=function(e,t){return(e=Math.abs(e))<(t=Math.abs(t))&&([e,t]=[t,e]),e<1e8?Math.sqrt(e*e+t*t):(t/=e,e*Math.sqrt(1+t*t))},kn=function(){throw SyntaxError("Invalid Param")};function Rn(e,t){const n=Math.abs(e),r=Math.abs(t);return 0===e?Math.log(r):0===t?Math.log(n):n<3e3&&r<3e3?.5*Math.log(e*e+t*t):(e*=.5,t*=.5,.5*Math.log(e*e+t*t)+Math.LN2)}const qn={re:0,im:0},Pn=function(e,t){const n=qn;if(null==e)n.re=n.im=0;else if(void 0!==t)n.re=e,n.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)n.re=e.re,n.im=e.im;else if("abs"in e&&"arg"in e){if(!isFinite(e.abs)&&isFinite(e.arg))return jn.INFINITY;n.re=e.abs*Math.cos(e.arg),n.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!isFinite(e.r)&&isFinite(e.phi))return jn.INFINITY;n.re=e.r*Math.cos(e.phi),n.im=e.r*Math.sin(e.phi)}else 2===e.length?(n.re=e[0],n.im=e[1]):kn();break;case"string":n.im=n.re=0;const t=e.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g);let r=1,i=0;null===t&&kn();for(let e=0;e0&&kn();break;case"number":n.im=0,n.re=e;break;default:kn()}return isNaN(n.re)||isNaN(n.im),n};function jn(e,t){if(!(this instanceof jn))return new jn(e,t);const n=Pn(e,t);this.re=n.re,this.im=n.im}jn.prototype={re:0,im:0,sign:function(){const e=zn(this.re,this.im);return new jn(this.re/e,this.im/e)},add:function(e,t){const n=Pn(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im));return r||i?r&&i?jn.NAN:jn.INFINITY:new jn(this.re+n.re,this.im+n.im)},sub:function(e,t){const n=Pn(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im));return r||i?r&&i?jn.NAN:jn.INFINITY:new jn(this.re-n.re,this.im-n.im)},mul:function(e,t){const n=Pn(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im)),o=0===this.re&&0===this.im,a=0===n.re&&0===n.im;return r&&a||i&&o?jn.NAN:r||i?jn.INFINITY:0===n.im&&0===this.im?new jn(this.re*n.re,0):new jn(this.re*n.re-this.im*n.im,this.re*n.im+this.im*n.re)},div:function(e,t){const n=Pn(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im)),o=0===this.re&&0===this.im,a=0===n.re&&0===n.im;if(o&&a||r&&i)return jn.NAN;if(a||r)return jn.INFINITY;if(o||i)return jn.ZERO;if(0===n.im)return new jn(this.re/n.re,this.im/n.re);if(Math.abs(n.re)0)return new jn(Math.pow(this.re,n.re),0);if(0===this.re)switch((n.re%4+4)%4){case 0:return new jn(Math.pow(this.im,n.re),0);case 1:return new jn(0,Math.pow(this.im,n.re));case 2:return new jn(-Math.pow(this.im,n.re),0);case 3:return new jn(0,-Math.pow(this.im,n.re))}}if(r&&n.re>0)return jn.ZERO;const i=Math.atan2(this.im,this.re),o=Rn(this.re,this.im);let a=Math.exp(n.re*o-n.im*i),s=n.im*o+n.re*i;return new jn(a*Math.cos(s),a*Math.sin(s))},sqrt:function(){const e=this.re,t=this.im;if(0===t)return e>=0?new jn(Math.sqrt(e),0):new jn(0,Math.sqrt(-e));const n=zn(e,t);let r=Math.sqrt(.5*(n+Math.abs(e))),i=Math.abs(t)/(2*r);return e>=0?new jn(r,t<0?-i:i):new jn(i,t<0?-r:r)},exp:function(){const e=Math.exp(this.re);return 0===this.im?new jn(e,0):new jn(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){const e=this.re,t=this.im;return new jn(Math.expm1(e)*Math.cos(t)+function(e){const t=Math.PI/4;if(-t>e||e>t)return Math.cos(e)-1;const n=e*e;return n*(n*(n*(n*(n*(n*(n*(n/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-.5)}(t),Math.exp(e)*Math.sin(t))},log:function(){const e=this.re,t=this.im;return 0===t&&e>0?new jn(Math.log(e),0):new jn(Rn(e,t),Math.atan2(t,e))},abs:function(){return zn(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){const e=this.re,t=this.im;return new jn(Math.sin(e)*_n(t),Math.cos(e)*In(t))},cos:function(){const e=this.re,t=this.im;return new jn(Math.cos(e)*_n(t),-Math.sin(e)*In(t))},tan:function(){const e=2*this.re,t=2*this.im,n=Math.cos(e)+_n(t);return new jn(Math.sin(e)/n,In(t)/n)},cot:function(){const e=2*this.re,t=2*this.im,n=Math.cos(e)-_n(t);return new jn(-Math.sin(e)/n,In(t)/n)},sec:function(){const e=this.re,t=this.im,n=.5*_n(2*t)+.5*Math.cos(2*e);return new jn(Math.cos(e)*_n(t)/n,Math.sin(e)*In(t)/n)},csc:function(){const e=this.re,t=this.im,n=.5*_n(2*t)-.5*Math.cos(2*e);return new jn(Math.sin(e)*_n(t)/n,-Math.cos(e)*In(t)/n)},asin:function(){const e=this.re,t=this.im,n=new jn(t*t-e*e+1,-2*e*t).sqrt(),r=new jn(n.re-t,n.im+e).log();return new jn(r.im,-r.re)},acos:function(){const e=this.re,t=this.im,n=new jn(t*t-e*e+1,-2*e*t).sqrt(),r=new jn(n.re-t,n.im+e).log();return new jn(Math.PI/2-r.im,r.re)},atan:function(){const e=this.re,t=this.im;if(0===e){if(1===t)return new jn(0,1/0);if(-1===t)return new jn(0,-1/0)}const n=e*e+(1-t)*(1-t),r=new jn((1-t*t-e*e)/n,-2*e/n).log();return new jn(-.5*r.im,.5*r.re)},acot:function(){const e=this.re,t=this.im;if(0===t)return new jn(Math.atan2(1,e),0);const n=e*e+t*t;return 0!==n?new jn(e/n,-t/n).atan():new jn(0!==e?e/0:0,0!==t?-t/0:0).atan()},asec:function(){const e=this.re,t=this.im;if(0===e&&0===t)return new jn(0,1/0);const n=e*e+t*t;return 0!==n?new jn(e/n,-t/n).acos():new jn(0!==e?e/0:0,0!==t?-t/0:0).acos()},acsc:function(){const e=this.re,t=this.im;if(0===e&&0===t)return new jn(Math.PI/2,1/0);const n=e*e+t*t;return 0!==n?new jn(e/n,-t/n).asin():new jn(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){const e=this.re,t=this.im;return new jn(In(e)*Math.cos(t),_n(e)*Math.sin(t))},cosh:function(){const e=this.re,t=this.im;return new jn(_n(e)*Math.cos(t),In(e)*Math.sin(t))},tanh:function(){const e=2*this.re,t=2*this.im,n=_n(e)+Math.cos(t);return new jn(In(e)/n,Math.sin(t)/n)},coth:function(){const e=2*this.re,t=2*this.im,n=_n(e)-Math.cos(t);return new jn(In(e)/n,-Math.sin(t)/n)},csch:function(){const e=this.re,t=this.im,n=Math.cos(2*t)-_n(2*e);return new jn(-2*In(e)*Math.cos(t)/n,2*_n(e)*Math.sin(t)/n)},sech:function(){const e=this.re,t=this.im,n=Math.cos(2*t)+_n(2*e);return new jn(2*_n(e)*Math.cos(t)/n,-2*In(e)*Math.sin(t)/n)},asinh:function(){let e=this.im;this.im=-this.re,this.re=e;const t=this.asin();return this.re=-this.im,this.im=e,e=t.re,t.re=-t.im,t.im=e,t},acosh:function(){const e=this.acos();if(e.im<=0){const t=e.re;e.re=-e.im,e.im=t}else{const t=e.im;e.im=-e.re,e.re=t}return e},atanh:function(){const e=this.re,t=this.im,n=e>1&&0===t,r=1-e,i=1+e,o=r*r+t*t,a=0!==o?new jn((i*r-t*t)/o,(t*r+i*t)/o):new jn(-1!==e?e/0:0,0!==t?t/0:0),s=a.re;return a.re=Rn(a.re,a.im)/2,a.im=Math.atan2(a.im,s)/2,n&&(a.im=-a.im),a},acoth:function(){const e=this.re,t=this.im;if(0===e&&0===t)return new jn(0,Math.PI/2);const n=e*e+t*t;return 0!==n?new jn(e/n,-t/n).atanh():new jn(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){const e=this.re,t=this.im;if(0===t)return new jn(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);const n=e*e+t*t;return 0!==n?new jn(e/n,-t/n).asinh():new jn(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){const e=this.re,t=this.im;if(this.isZero())return jn.INFINITY;const n=e*e+t*t;return 0!==n?new jn(e/n,-t/n).acosh():new jn(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return jn.INFINITY;if(this.isInfinite())return jn.ZERO;const e=this.re,t=this.im,n=e*e+t*t;return new jn(e/n,-t/n)},conjugate:function(){return new jn(this.re,-this.im)},neg:function(){return new jn(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new jn(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new jn(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new jn(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){const n=Pn(e,t);return Math.abs(n.re-this.re)<=jn.EPSILON&&Math.abs(n.im-this.im)<=jn.EPSILON},clone:function(){return new jn(this.re,this.im)},toString:function(){let e=this.re,t=this.im,n="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)(Object.defineProperty(jn,"name",{value:"Complex"}),jn.prototype.constructor=jn,jn.prototype.type="Complex",jn.prototype.isComplex=!0,jn.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},jn.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},jn.prototype.format=function(e){let t="",n=this.im,r=this.re;const i=Me(this.re,e),o=Me(this.im,e),a=d(e)?e:e?e.precision:null;if(null!==a){const e=Math.pow(10,-a);Math.abs(r/n)t.re?1:e.ret.im?1:e.im1&&(t[n]=(t[n]||Ln)+$n):t[e]=(t[e]||Ln)+$n,t}const Qn=function(e,t){let n=Ln,r=$n,i=$n;if(null==e);else if(void 0!==t){if("bigint"==typeof e)n=e;else{if(isNaN(e))throw nr();if(e%1!=0)throw rr();n=BigInt(e)}if("bigint"==typeof t)r=t;else{if(isNaN(t))throw nr();if(t%1!=0)throw rr();r=BigInt(t)}i=n*r}else if("object"==typeof e){if("d"in e&&"n"in e)n=BigInt(e.n),r=BigInt(e.d),"s"in e&&(n*=BigInt(e.s));else if(0 in e)n=BigInt(e[0]),1 in e&&(r=BigInt(e[1]));else{if("bigint"!=typeof e)throw nr();n=e}i=n*r}else if("number"==typeof e){if(isNaN(e))throw nr();if(e<0&&(i=-$n,e=-e),e%1==0)n=BigInt(e);else{let t=1,i=0,o=1,a=1,s=1,u=1e7;for(e>=1&&(t=10**Math.floor(1+Math.log10(e)),e/=t);o<=u&&s<=u;){let t=(i+a)/(o+s);if(e===t){o+s<=u?(n=i+a,r=o+s):s>o?(n=a,r=s):(n=i,r=o);break}e>t?(i+=a,o+=s):(a+=i,s+=o),o>u?(n=a,r=s):(n=i,r=o)}n=BigInt(n)*BigInt(t),r=BigInt(r)}}else if("string"==typeof e){let t=0,o=Ln,a=Ln,s=Ln,u=$n,c=$n,l=e.replace(/_/g,"").match(/\d+|./g);if(null===l)throw nr();if("-"===l[t]?(i=-$n,t++):"+"===l[t]&&t++,l.length===t+1?a=Wn(l[t++],i):"."===l[t+1]||"."===l[t]?("."!==l[t]&&(o=Wn(l[t++],i)),t++,(t+1===l.length||"("===l[t+1]&&")"===l[t+3]||"'"===l[t+1]&&"'"===l[t+3])&&(a=Wn(l[t],i),u=Vn**BigInt(l[t].length),t++),("("===l[t]&&")"===l[t+2]||"'"===l[t]&&"'"===l[t+2])&&(s=Wn(l[t+1],i),c=Vn**BigInt(l[t+1].length)-$n,t+=3)):"/"===l[t+1]||":"===l[t+1]?(a=Wn(l[t],i),u=Wn(l[t+2],$n),t+=3):"/"===l[t+3]&&" "===l[t+1]&&(o=Wn(l[t],i),a=Wn(l[t+2],i),u=Wn(l[t+4],$n),t+=5),!(l.length<=t))throw nr();r=u*c,i=n=s+r*o+c*a}else{if("bigint"!=typeof e)throw nr();n=e,i=e,r=$n}if(r===Ln)throw tr();Zn.s=iZn.s*Zn.n*this.d},gte:function(e,t){return Qn(e,t),this.s*this.n*Zn.d>=Zn.s*Zn.n*this.d},compare:function(e,t){Qn(e,t);let n=this.s*this.n*Zn.d-Zn.s*Zn.n*this.d;return(LnLn&&this.s>=Ln?$n:Ln),e)},floor:function(e){return e=Vn**BigInt(e||0),Jn(Yn(this.s*e*this.n/this.d)-(e*this.n%this.d>Ln&&this.s=Ln?$n:Ln)+Hn*(e*this.n%this.d)>this.d?$n:Ln),e)},roundTo:function(e,t){Qn(e,t);const n=this.n*Zn.d,r=this.d*Zn.n,i=n%r;let o=Yn(n/r);return i+i>=r&&o++,Jn(this.s*o*Zn.n,Zn.d)},divisible:function(e,t){return Qn(e,t),!(!(Zn.n*this.d)||this.n*Zn.d%(Zn.n*this.d))},valueOf:function(){return Number(this.s*this.n)/Number(this.d)},toString:function(e){let t=this.n,n=this.d;e=e||15;let r=function(e,t){for(;t%Hn===Ln;t/=Hn);for(;t%Gn===Ln;t/=Gn);if(t===$n)return Ln;let n=Vn%t,r=1;for(;n!==$n;r++)if(n=n*Vn%t,r>2e3)return Ln;return BigInt(r)}(0,n),i=function(e,t,n){let r=$n,i=function(e,t,n){let r=$n;for(;t>Ln;e=e*e%n,t>>=$n)t&$n&&(r=r*e%n);return r}(Vn,n,t);for(let e=0;e<300;e++){if(r===i)return BigInt(e);r=r*Vn%t,i=i*Vn%t}return 0}(0,n,r),o=this.sLn&&(r+=i,r+=" ",t%=n),r+=t,r+="/",r+=n}return r},toLatex:function(e){let t=this.n,n=this.d,r=this.sLn&&(r+=i,t%=n),r+="\\frac{",r+=t,r+="}{",r+=n,r+="}"}return r},toContinued:function(){let e=this.n,t=this.d,n=[];do{n.push(Yn(e/t));let r=e%t;e=t,t=r}while(e!==$n);return n},simplify:function(e){const t=BigInt(1/(e||.001)|0),n=this.abs(),r=n.toContinued();for(let e=1;e=0;t--)i=i.inverse().add(r[t]);let o=i.sub(n);if(o.n*t(Object.defineProperty(er,"name",{value:"Fraction"}),er.prototype.constructor=er,er.prototype.type="Fraction",er.prototype.isFraction=!0,er.prototype.toJSON=function(){return{mathjs:"Fraction",n:String(this.s*this.n),d:String(this.d)}},er.fromJSON=function(e){return new er(e)},er)),{isClass:!0});n(3362),n(1795);const or=he("Range",[],(()=>{function e(t,n,r){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");const i=null!=t,o=null!=n,a=null!=r;if(i)if(g(t))t=t.toNumber();else if("number"!=typeof t&&!y(t))throw new TypeError("Parameter start must be a number or bigint");if(o)if(g(n))n=n.toNumber();else if("number"!=typeof n&&!y(n))throw new TypeError("Parameter end must be a number or bigint");if(a)if(g(r))r=r.toNumber();else if("number"!=typeof r&&!y(r))throw new TypeError("Parameter step must be a number or bigint");this.start=i?parseFloat(t):0,this.end=o?parseFloat(n):0,this.step=a?parseFloat(r):1}return e.prototype.type="Range",e.prototype.isRange=!0,e.parse=function(t){if("string"!=typeof t)return null;const n=t.split(":").map((function(e){return parseFloat(e)}));if(n.some((function(e){return isNaN(e)})))return null;switch(n.length){case 2:return new e(n[0],n[1]);case 3:return new e(n[0],n[2],n[1]);default:return null}},e.prototype.clone=function(){return new e(this.start,this.end,this.step)},e.prototype.size=function(){let e=0;const t=this.start,n=this.step,r=this.end-t;return be(n)===be(r)?e=Math.ceil(r/n):0===r&&(e=0),isNaN(e)&&(e=0),[e]},e.prototype.min=function(){const e=this.size()[0];return e>0?this.step>0?this.start:this.start+(e-1)*this.step:void 0},e.prototype.max=function(){const e=this.size()[0];return e>0?this.step>0?this.start+(e-1)*this.step:this.start:void 0},e.prototype.forEach=function(e){let t=this.start;const n=this.step,r=this.end;let i=0;if(n>0)for(;tr;)e(t,[i],this),t+=n,i++},e.prototype.map=function(e){const t=[];return this.forEach((function(n,r,i){t[r[0]]=e(n,r,i)})),t},e.prototype.toArray=function(){const e=[];return this.forEach((function(t,n){e[n[0]]=t})),e},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(e){let t=Me(this.start,e);return 1!==this.step&&(t+=":"+Me(this.step,e)),t+=":"+Me(this.end,e),t},e.prototype.toString=function(){return this.format()},e.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},e.fromJSON=function(t){return new e(t.start,t.end,t.step)},e}),{isClass:!0}),ar=he("Matrix",[],(()=>{function e(){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(e,t,n){throw new Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(e,t,n){throw new Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},e}),{isClass:!0});function sr(){return sr=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0?"+":"")+r.toString()}(e,r);case"bin":return ur(e,2,i);case"oct":return ur(e,8,i);case"hex":return ur(e,16,i);case"auto":{const n=lr(null==t?void 0:t.lowerExp,-3),i=lr(null==t?void 0:t.upperExp,5);if(e.isZero())return"0";let o;const a=e.toSignificantDigits(r),s=a.e;return o=s>=n&&smr(n)+": "+pr(e[n],t))).join(", ")+"}":String(e)}(e,t);return t&&"object"==typeof t&&"truncate"in t&&n.length>t.truncate?n.substring(0,t.truncate-3)+"...":n}function mr(e){const t=String(e);let n="",r=0;for(;r/g,">"),t}function gr(e,t){if(Array.isArray(e)){let n="[";const r=e.length;for(let i=0;it?1:-1}function xr(e,t,n){if(!(this instanceof xr))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=n,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=(new Error).stack}function br(e,t,n){if(!(this instanceof br))throw new SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=n),void 0!==this.min&&this.index=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=(new Error).stack}function vr(e){const t=[];for(;Array.isArray(e);)t.push(e.length),e=e[0];return t}function wr(e,t,n){let r;const i=e.length;if(i!==t[n])throw new xr(i,t[n]);if(n")}function Nr(e,t){if(0===t.length){if(Array.isArray(e))throw new xr(e.length,0)}else wr(e,t,0)}function Er(e,t){const n=e.isMatrix?e._size:vr(e);t._sourceSize.forEach(((e,t)=>{if(null!==e&&e!==n[t])throw new xr(e,n[t])}))}function Ar(e,t){if(void 0!==e){if(!d(e)||!ye(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new br(e,t)}}function Sr(e){for(let t=0;t=0){if(t%n!=0)throw new Error("Could not replace wildcard, since "+t+" is no multiple of "+-n);r[i]=-t/n}return r}function Dr(e){return e.reduce(((e,t)=>e*t),1)}function Fr(e,t){const n=t||vr(e);for(;Array.isArray(e)&&1===e.length;)e=e[0],n.shift();let r=n.length;for(;1===n[r-1];)r--;return r1&&void 0!==arguments[1]&&arguments[1];if(!Array.isArray(e))return e;if("boolean"!=typeof t)throw new TypeError("Boolean expected for second argument of flatten");const n=[];return t?function e(t){if(Array.isArray(t[0]))for(let n=0;nt.test(e)))}function jr(e,t){return Array.prototype.join.call(e,t)}function Ur(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;const t=[];let n=0;t[0]={value:e[0],identifier:0};for(let r=1;r1)return e.slice(1).reduce((function(e,n){return Hr(e,n,t,0)}),e[0]);throw new Error("Wrong number of arguments in function concat")}function Vr(){for(var e=arguments.length,t=new Array(e),n=0;ne.length)),i=Math.max(...r),o=new Array(i).fill(null);for(let e=0;eo[t]&&(o[t]=n[e])}}for(let e=0;e1||e[i]>t[o])throw new Error(`shape mismatch: mismatch is found in arg with shape (${e}) not possible to broadcast dimension ${r} with size ${e[i]} to size ${t[o]}`)}}function Wr(e,t){let n=vr(e);if(ce(n,t))return e;Zr(n,t);const r=Vr(n,t),i=r.length,o=[...Array(i-n.length).fill(1),...n];let a=function(e){return sr([],e)}(e);n.lengthe[t]),e)}function Jr(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(0===e.length)return[];if(n)return function e(n){if(Array.isArray(n)){const t=n.length,r=Array(t);for(let i=0;i2&&void 0!==arguments[2]&&arguments[2];if(0===e.length)return;if(n)return void function e(n){if(Array.isArray(n)){const t=n.length;for(let r=0;r3&&void 0!==arguments[3]&&arguments[3];if(t.isTypedFunction(e)){let o,a;if(i)o=1;else{const r=(n.isMatrix?n.size():vr(n)).map((()=>0)),i=n.isMatrix?n.get(r):Yr(n,r);o=function(e,n,r,i){const o=[n,r,i];for(let n=3;n>0;n--){const r=o.slice(0,n);if(null!==t.resolve(e,r))return n}}(e,i,r,n)}if(n.isMatrix&&"mixed"!==n.dataType&&void 0!==n.dataType){const t=function(e,t){const n=[];if(Object.entries(e.signatures).forEach((e=>{let[r,i]=e;r.split(",").length===t&&n.push(i)})),1===n.length)return n[0]}(e,o);a=void 0!==t?t:e}else a=e;return o>=1&&o<=3?{isUnary:1===o,fn:function(){for(var t=arguments.length,n=new Array(t),i=0;i=2&&e.push(`index: ${oe(t[1])}`),t.length>=3&&e.push(`array: ${oe(t[2])}`),new TypeError(`Function ${n} cannot apply callback arguments ${r}(${e.join(", ")}) at index ${JSON.stringify(t[1])}`)}throw new TypeError(`Function ${n} cannot apply callback arguments to function ${r}: ${e.message}`)}(e,t,n,r)}}xr.prototype=new RangeError,xr.prototype.constructor=RangeError,xr.prototype.name="DimensionError",xr.prototype.isDimensionError=!0,br.prototype=new RangeError,br.prototype.constructor=RangeError,br.prototype.name="IndexError",br.prototype.isIndexError=!0,n(3110);const ti=he("DenseMatrix",["Matrix"],(e=>{let{Matrix:t}=e;function n(e,t){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!w(t))throw new Error("Invalid datatype: "+t);if(E(e))"DenseMatrix"===e.type?(this._data=ae(e._data),this._size=ae(e._size),this._datatype=t||e._datatype):(this._data=e.toArray(),this._size=e.size(),this._datatype=t||e._datatype);else if(e&&N(e.data)&&N(e.size))this._data=e.data,this._size=e.size,Nr(this._data,this._size),this._datatype=t||e.datatype;else if(N(e))this._data=o(e),this._size=vr(this._data),Nr(this._data,this._size),this._datatype=t;else{if(e)throw new TypeError("Unsupported type of data ("+oe(e)+")");this._data=[],this._size=[0],this._datatype=t}}function r(e,t,n){if(0===t.length){let t=e._data;for(;N(t);)t=t[0];return t}return e._size=t.slice(0),e._data=Mr(e._data,e._size,n),e}function i(e,t,n){const i=e._size.slice(0);let o=!1;for(;i.lengthi[e]&&(i[e]=t[e],o=!0);o&&r(e,i,n)}function o(e){return E(e)?o(e.valueOf()):N(e)?e.map(o):e}return n.prototype=new t,n.prototype.createDenseMatrix=function(e,t){return new n(e,t)},Object.defineProperty(n,"name",{value:"DenseMatrix"}),n.prototype.constructor=n,n.prototype.type="DenseMatrix",n.prototype.isDenseMatrix=!0,n.prototype.getDataType=function(){return $r(this._data,oe)},n.prototype.storage=function(){return"dense"},n.prototype.datatype=function(){return this._datatype},n.prototype.create=function(e,t){return new n(e,t)},n.prototype.subset=function(e,t,r){switch(arguments.length){case 1:return function(e,t){if(!T(t))throw new TypeError("Invalid index");if(t.isScalar())return e.get(t.min());{const r=t.size();if(r.length!==e._size.length)throw new xr(r.length,e._size.length);const i=t.min(),o=t.max();for(let t=0,n=e._size.length;t1&&void 0!==arguments[1]?arguments[1]:0;const a=t.dimension(o);return r[o]=a.size()[0],o(Ar(t,i.length),e(i[t],o+1)))).valueOf():a.map((e=>(Ar(e,i.length),i[e]))).valueOf()}(e),size:r}}(e._data,t);return a._size=s.size,a._datatype=e._datatype,a._data=s.data,a}}(this,e);case 2:case 3:return function(e,t,n,r){if(!t||!0!==t.isIndex)throw new TypeError("Invalid index");const o=t.size(),a=t.isScalar();let s;if(E(n)?(s=n.size(),n=n.valueOf()):s=vr(n),a){if(0!==s.length)throw new TypeError("Scalar expected");e.set(t.min(),n,r)}else{if(!ce(s,o))try{s=vr(n=0===s.length?Wr([n],o):Wr(n,o))}catch(e){}if(o.length");i(e,t.max().map((function(e){return e+1})),r),function(e,t,n){const r=t.size().length-1;!function e(n,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const a=t.dimension(o);o{Ar(t,n.length),e(n[t],i[r[0]],o+1)})):a.forEach(((e,t)=>{Ar(e,n.length),n[e]=i[t[0]]}))}(e,n)}(e._data,t,n)}return e}(this,e,t,r);default:throw new SyntaxError("Wrong number of arguments")}},n.prototype.get=function(e){return Yr(this._data,e)},n.prototype.set=function(e,t,n){if(!N(e))throw new TypeError("Array expected");if(e.lengthArray.isArray(e)&&1===e.length?e[0]:e));return r(n?this.clone():this,i,t)},n.prototype.reshape=function(e,t){const n=t?this.clone():this;n._data=Tr(n._data,e);const r=n._size.reduce(((e,t)=>e*t));return n._size=Br(e,r),n},n.prototype.clone=function(){return new n({data:ae(this._data),size:ae(this._size),datatype:this._datatype})},n.prototype.size=function(){return this._size.slice(0)},n.prototype.map=function(e){let t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=this,r=n._size.length-1;if(r<0)return n.clone();const i=Qr(e,n,"map",t),o=i.fn,a=n.create(void 0,n._datatype);if(a._size=n._size,t||i.isUnary)return a._data=function e(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=Array(t.length);if(n1&&void 0!==arguments[1]?arguments[1]:0;const a=Array(t.length);if(i2&&void 0!==arguments[2]&&arguments[2];const n=this,r=n._size.length-1;if(r<0)return;const i=Qr(e,n,"map",t),o=i.fn;if(t||i.isUnary)return void function e(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(n1&&void 0!==arguments[1]?arguments[1]:0;if(i[e[i]]));e.push(new n(t,this._datatype))}return e},n.prototype.toArray=function(){return ae(this._data)},n.prototype.valueOf=function(){return this._data},n.prototype.format=function(e){return pr(this._data,e)},n.prototype.toString=function(){return pr(this._data)},n.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.prototype.diagonal=function(e){if(e){if(g(e)&&(e=e.toNumber()),!d(e)||!ye(e))throw new TypeError("The parameter k must be an integer number")}else e=0;const t=e>0?e:0,r=e<0?-e:0,i=this._size[0],o=this._size[1],a=Math.min(i-r,o-t),s=[];for(let e=0;e0?r:0,a=r<0?-r:0,s=e[0],u=e[1],c=Math.min(s-a,u-o);let l;if(N(t)){if(t.length!==c)throw new Error("Invalid value array length");l=function(e){return t[e]}}else if(E(t)){const e=t.size();if(1!==e.length||e[0]!==c)throw new Error("Invalid matrix length");l=function(e){return t.get([e])}}else l=function(){return t};i||(i=g(l(0))?l(0).mul(0):0);let f=[];if(e.length>0){f=Mr(f,e,i);for(let e=0;e{let{typed:t}=e;return t(ni,{any:ae})}));function ii(e){const t=e.length,n=e[0].length;let r,i;const o=[];for(i=0;it(e)),!1,!0):Xr(e,t,!0)}function si(e,t,n){if(!n)return E(e)?e.map((e=>t(e)),!1,!0):Jr(e,t,!0);const r=e=>0===e?e:t(e);return E(e)?e.map((e=>r(e)),!1,!0):Jr(e,r,!0)}function ui(e,t,n){const r=Array.isArray(e)?vr(e):e.size();if(t<0||t>=r.length)throw new br(t,r.length);return E(e)?e.create(ci(e.valueOf(),t,n),e.datatype()):ci(e,t,n)}function ci(e,t,n){let r,i,o,a;if(t<=0){if(Array.isArray(e[0])){for(a=ii(e),i=[],r=0;r{let{typed:t}=e;return t(fi,{number:ye,BigNumber:function(e){return e.isInt()},bigint:function(e){return!0},Fraction:function(e){return 1n===e.d},"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})}));n(2577);const mi="number";function hi(e){return e<0}function di(e){return e>0}function gi(e){return Number.isNaN(e)}function yi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-9,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(n<=0)throw new Error("Relative tolerance must be greater than 0");if(r<0)throw new Error("Absolute tolerance must be at least 0");return!e.isNaN()&&!t.isNaN()&&(e.isFinite()&&t.isFinite()?!!e.eq(t)||e.minus(t).abs().lte(e.constructor.max(e.constructor.max(e.abs(),t.abs()).mul(n),r)):e.eq(t))}hi.signature=mi,di.signature=mi,gi.signature=mi;const xi="isNegative",bi=he(xi,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(xi,{number:e=>!_e(e,0,n.relTol,n.absTol)&&hi(e),BigNumber:e=>!yi(e,new e.constructor(0),n.relTol,n.absTol)&&e.isNeg()&&!e.isZero()&&!e.isNaN(),bigint:e=>e<0n,Fraction:e=>e.s<0n,Unit:t.referToSelf((e=>n=>t.find(e,n.valueType())(n.value))),"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),vi="isNumeric",wi=he(vi,["typed"],(e=>{let{typed:t}=e;return t(vi,{"number | BigNumber | bigint | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),Ni="hasNumericValue",Ei=he(Ni,["typed","isNumeric"],(e=>{let{typed:t,isNumeric:n}=e;return t(Ni,{boolean:()=>!0,string:function(e){return e.trim().length>0&&!isNaN(Number(e))},any:function(e){return n(e)}})})),Ai="isPositive",Si=he(Ai,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(Ai,{number:e=>!_e(e,0,n.relTol,n.absTol)&&di(e),BigNumber:e=>!(yi(e,new e.constructor(0),n.relTol,n.absTol)||e.isNeg()||e.isZero()||e.isNaN()),bigint:e=>e>0n,Fraction:e=>e.s>0n&&e.n>0n,Unit:t.referToSelf((e=>n=>t.find(e,n.valueType())(n.value))),"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),Mi="isZero",Ci=he(Mi,["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return t(Mi,{"number | BigNumber | Complex | Fraction":e=>n(e,0),bigint:e=>0n===e,Unit:t.referToSelf((e=>n=>t.find(e,n.valueType())(n.value))),"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),Ti="isNaN",Bi=he(Ti,["typed"],(e=>{let{typed:t}=e;return t(Ti,{number:gi,BigNumber:function(e){return e.isNaN()},bigint:function(e){return!1},Fraction:function(e){return!1},Complex:function(e){return e.isNaN()},Unit:function(e){return Number.isNaN(e.value)},"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),Di="typeOf",Fi=he(Di,["typed"],(e=>{let{typed:t}=e;return t(Di,{any:oe})})),Oi=he("compareUnits",["typed"],(e=>{let{typed:t}=e;return{"Unit, Unit":t.referToSelf((e=>(n,r)=>{if(!n.equalBase(r))throw new Error("Cannot compare units with different base");return t.find(e,[n.valueType(),r.valueType()])(n.value,r.value)}))}})),_i="equalScalar",Ii=he(_i,["typed","config"],(e=>{let{typed:t,config:n}=e;const r=Oi({typed:t});return t(_i,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return _e(e,t,n.relTol,n.absTol)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||yi(e,t,n.relTol,n.absTol)},"bigint, bigint":function(e,t){return e===t},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){return function(e,t,n,r){return _e(e.re,t.re,n,r)&&_e(e.im,t.im,n,r)}(e,t,n.relTol,n.absTol)}},r)})),zi=(he(_i,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(_i,{"number, number":function(e,t){return _e(e,t,n.relTol,n.absTol)}})})),he("SparseMatrix",["typed","equalScalar","Matrix"],(e=>{let{typed:t,equalScalar:n,Matrix:r}=e;function i(e,t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!w(t))throw new Error("Invalid datatype: "+t);if(E(e))!function(e,t,n){"SparseMatrix"===t.type?(e._values=t._values?ae(t._values):void 0,e._index=ae(t._index),e._ptr=ae(t._ptr),e._size=ae(t._size),e._datatype=n||t._datatype):o(e,t.valueOf(),n||t._datatype)}(this,e,t);else if(e&&N(e.index)&&N(e.ptr)&&N(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=t||e.datatype;else if(N(e))o(this,e,t);else{if(e)throw new TypeError("Unsupported type of data ("+oe(e)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}}function o(e,r,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;const o=r.length;let a=0,s=n,u=0;if(w(i)&&(s=t.find(n,[i,i])||n,u=t.convert(0,i)),o>0){let t=0;do{e._ptr.push(e._index.length);for(let n=0;nh){for(p=h;pl){if(c){let t=0;for(p=0;pr-1&&(e._values.splice(m,1),e._index.splice(m,1),t++)}e._ptr[p]=e._values.length}return e._size[0]=r,e._size[1]=i,e}function c(e,t,n,r,i){const o=r[0],a=r[1],s=[];let u,c;for(u=0;u");if(1===i.length)t.dimension(0).forEach((function(t,i){Ar(t),e.set([t,0],n[i[0]],r)}));else{const i=t.dimension(0),o=t.dimension(1);i.forEach((function(t,i){Ar(t),o.forEach((function(o,a){Ar(o),e.set([t,o],n[i[0]][a[0]],r)}))}))}}return e}(this,e,t,n);default:throw new SyntaxError("Wrong number of arguments")}},i.prototype.get=function(e){if(!N(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new xr(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");const t=e[0],n=e[1];Ar(t,this._size[0]),Ar(n,this._size[1]);const r=a(t,this._ptr[n],this._ptr[n+1],this._index);return rl-1||c>f-1)&&(u(this,Math.max(o+1,l),Math.max(c+1,f),i),l=this._size[0],f=this._size[1]),Ar(o,l),Ar(c,f);const h=a(o,this._ptr[c],this._ptr[c+1],this._index);return hArray.isArray(e)&&1===e.length?e[0]:e));if(2!==r.length)throw new Error("Only two dimensions matrix are supported");return r.forEach((function(e){if(!d(e)||!ye(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+pr(r)+")")})),u(n?this.clone():this,r[0],r[1],t)},i.prototype.reshape=function(e,t){if(!N(e))throw new TypeError("Array expected");if(2!==e.length)throw new Error("Sparse matrices can only be reshaped in two dimensions");e.forEach((function(t){if(!d(t)||!ye(t)||t<=-2||0===t)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+pr(e)+")")}));const n=this._size[0]*this._size[1];if(n!==(e=Br(e,n))[0]*e[1])throw new Error("Reshaping sparse matrix will result in the wrong number of elements");const r=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return r;const i=[];for(let e=0;e=0&&n<=a&&y(e._values[i],n-0,t-0)}else{const i={};for(let t=n;t "+(this._values?pr(this._values[o],e):"X")}return i},i.prototype.toString=function(){return pr(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(e){if(e){if(g(e)&&(e=e.toNumber()),!d(e)||!ye(e))throw new TypeError("The parameter k must be an integer number")}else e=0;const t=e>0?e:0,n=e<0?-e:0,r=this._size[0],o=this._size[1],a=Math.min(r-n,o-t),s=[],u=[],c=[];c[0]=0;for(let e=t;e0?o:0,f=o<0?-o:0,p=e[0],m=e[1],h=Math.min(p-f,m-l);let y;if(N(r)){if(r.length!==h)throw new Error("Invalid value array length");y=function(e){return r[e]}}else if(E(r)){const e=r.size();if(1!==e.length||e[0]!==h)throw new Error("Invalid matrix length");y=function(e){return r.get([e])}}else y=function(){return r};const x=[],b=[],v=[];for(let e=0;e=0&&t=u||i[l]!==t)){const e=r?r[c]:void 0;i.splice(l,0,t),r&&r.splice(l,0,e),i.splice(l<=c?c+1:c,1),r&&r.splice(l<=c?c+1:c,1)}else if(l=u||i[c]!==e)){const t=r?r[l]:void 0;i.splice(c,0,e),r&&r.splice(c,0,t),i.splice(c<=l?l+1:l,1),r&&r.splice(c<=l?l+1:l,1)}}},i}),{isClass:!0})),ki=he("number",["typed"],(e=>{let{typed:t}=e;const n=t("number",{"":function(){return 0},number:function(e){return e},string:function(e){if("NaN"===e)return NaN;const t=function(e){const t=e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);return t?{input:e,radix:{"0b":2,"0o":8,"0x":16}[t[1]],integerPart:t[2],fractionalPart:t[3]}:null}(e);if(t)return function(e){const t=parseInt(e.integerPart,e.radix);let n=0;for(let t=0;t2**n-1)throw new SyntaxError(`String "${e}" is out of range`);i>=2**(n-1)&&(i-=2**n)}return i},BigNumber:function(e){return e.toNumber()},bigint:function(e){return Number(e)},Fraction:function(e){return e.valueOf()},Unit:t.referToSelf((e=>t=>{const n=t.clone();return n.value=e(t.value),n})),null:function(e){return 0},"Unit, string | Unit":function(e,t){return e.toNumber(t)},"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))});return n.fromJSON=function(e){return parseFloat(e.value)},n})),Ri=he("bigint",["typed"],(e=>{let{typed:t}=e;const n=t("bigint",{"":function(){return 0n},bigint:function(e){return e},number:function(e){return BigInt(e.toFixed())},BigNumber:function(e){return BigInt(e.round().toString())},Fraction:function(e){return BigInt(e.valueOf().toFixed())},"string | boolean":function(e){return BigInt(e)},null:function(e){return 0n},"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))});return n.fromJSON=function(e){return BigInt(e.value)},n})),qi="string",Pi=he(qi,["typed"],(e=>{let{typed:t}=e;return t(qi,{"":function(){return""},number:Me,null:function(e){return"null"},boolean:function(e){return e+""},string:function(e){return e},"Array | Matrix":t.referToSelf((e=>t=>si(t,e))),any:function(e){return String(e)}})})),ji="boolean",Ui=he(ji,["typed"],(e=>{let{typed:t}=e;return t(ji,{"":function(){return!1},boolean:function(e){return e},number:function(e){return!!e},null:function(e){return!1},BigNumber:function(e){return!e.isZero()},string:function(e){const t=e.toLowerCase();if("true"===t)return!0;if("false"===t)return!1;const n=Number(e);if(""!==e&&!isNaN(n))return!!n;throw new Error('Cannot convert "'+e+'" to a boolean')},"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),Li=he("bignumber",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t("bignumber",{"":function(){return new n(0)},number:function(e){return new n(e+"")},string:function(e){const t=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(t){const r=t[2],i=n(t[1]),o=new n(2).pow(Number(r));if(i.gt(o.sub(1)))throw new SyntaxError(`String "${e}" is out of range`);const a=new n(2).pow(Number(r)-1);return i.gte(a)?i.sub(o):i}return new n(e)},BigNumber:function(e){return e},bigint:function(e){return new n(e.toString())},Unit:t.referToSelf((e=>t=>{const n=t.clone();return n.value=e(t.value),n})),Fraction:function(e){return new n(String(e.n)).div(String(e.d)).times(String(e.s))},null:function(e){return new n(0)},"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),$i=he("complex",["typed","Complex"],(e=>{let{typed:t,Complex:n}=e;return t("complex",{"":function(){return n.ZERO},number:function(e){return new n(e,0)},"number, number":function(e,t){return new n(e,t)},"BigNumber, BigNumber":function(e,t){return new n(e.toNumber(),t.toNumber())},Fraction:function(e){return new n(e.valueOf(),0)},Complex:function(e){return e.clone()},string:function(e){return n(e)},null:function(e){return n(0)},Object:function(e){if("re"in e&&"im"in e)return new n(e.re,e.im);if("r"in e&&"phi"in e||"abs"in e&&"arg"in e)return new n(e);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),Hi=he("fraction",["typed","Fraction"],(e=>{let{typed:t,Fraction:n}=e;return t("fraction",{number:function(e){if(!isFinite(e)||isNaN(e))throw new Error(e+" cannot be represented as a fraction");return new n(e)},string:function(e){return new n(e)},"number, number":function(e,t){return new n(e,t)},"bigint, bigint":function(e,t){return new n(e,t)},null:function(e){return new n(0)},BigNumber:function(e){return new n(e.toString())},bigint:function(e){return new n(e.toString())},Fraction:function(e){return e},Unit:t.referToSelf((e=>t=>{const n=t.clone();return n.value=e(t.value),n})),Object:function(e){return new n(e)},"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),Gi="matrix",Vi=he(Gi,["typed","Matrix","DenseMatrix","SparseMatrix"],(e=>{let{typed:t,Matrix:n,DenseMatrix:r,SparseMatrix:i}=e;return t(Gi,{"":function(){return o([])},string:function(e){return o([],e)},"string, string":function(e,t){return o([],e,t)},Array:function(e){return o(e)},Matrix:function(e){return o(e,e.storage())},"Array | Matrix, string":o,"Array | Matrix, string, string":o});function o(e,t,n){if("dense"===t||"default"===t||void 0===t)return new r(e,n);if("sparse"===t)return new i(e,n);throw new TypeError("Unknown matrix type "+JSON.stringify(t)+".")}})),Zi="matrixFromFunction",Wi=he(Zi,["typed","matrix","isZero"],(e=>{let{typed:t,matrix:n,isZero:r}=e;return t(Zi,{"Array | Matrix, function, string, string":function(e,t,n,r){return i(e,t,n,r)},"Array | Matrix, function, string":function(e,t,n){return i(e,t,n)},"Matrix, function":function(e,t){return i(e,t,"dense")},"Array, function":function(e,t){return i(e,t,"dense").toArray()},"Array | Matrix, string, function":function(e,t,n){return i(e,n,t)},"Array | Matrix, string, string, function":function(e,t,n,r){return i(e,r,t,n)}});function i(e,t,i,o){let a;return a=void 0!==o?n(i,o):n(i),a.resize(e),a.forEach((function(e,n){const i=t(n);r(i)||a.set(n,i)})),a}})),Yi="matrixFromRows",Ji=he(Yi,["typed","matrix","flatten","size"],(e=>{let{typed:t,matrix:n,flatten:r,size:i}=e;return t(Yi,{"...Array":function(e){return o(e)},"...Matrix":function(e){return n(o(e.map((e=>e.toArray()))))}});function o(e){if(0===e.length)throw new TypeError("At least one row is needed to construct a matrix.");const t=a(e[0]),n=[];for(const i of e){const e=a(i);if(e!==t)throw new TypeError("The vectors had different length: "+(0|t)+" ≠ "+(0|e));n.push(r(i))}return n}function a(e){const t=i(e);if(1===t.length)return t[0];if(2===t.length){if(1===t[0])return t[1];if(1===t[1])return t[0];throw new TypeError("At least one of the arguments is not a vector.")}throw new TypeError("Only one- or two-dimensional vectors are supported.")}})),Xi="matrixFromColumns",Qi=he(Xi,["typed","matrix","flatten","size"],(e=>{let{typed:t,matrix:n,flatten:r,size:i}=e;return t(Xi,{"...Array":function(e){return o(e)},"...Matrix":function(e){return n(o(e.map((e=>e.toArray()))))}});function o(e){if(0===e.length)throw new TypeError("At least one column is needed to construct a matrix.");const t=a(e[0]),n=[];for(let e=0;e{let{typed:t}=e;return t(Ki,{"Unit, Array":function(e,t){return e.splitUnit(t)}})})),to="number",no="number, number";function ro(e){return Math.abs(e)}function io(e,t){return e+t}function oo(e,t){return e-t}function ao(e,t){return e*t}function so(e){return-e}function uo(e){return e}function co(e){return Ee(e)}function lo(e){return e*e*e}function fo(e){return Math.exp(e)}function po(e){return Ae(e)}function mo(e,t){if(!ye(e)||!ye(t))throw new Error("Parameters in function lcm must be integer numbers");if(0===e||0===t)return 0;let n;const r=e*t;for(;0!==t;)n=t,t=e%n,e=n;return Math.abs(r/e)}function ho(e,t){return t?Math.log(e)/Math.log(t):Math.log(e)}function go(e){return we(e)}function yo(e){return ve(e)}function xo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const n=t<0;if(n&&(t=-t),0===t)throw new Error("Root must be non-zero");if(e<0&&Math.abs(t)%2!=1)throw new Error("Root must be odd when a is negative.");if(0===e)return n?1/0:0;if(!isFinite(e))return n?0:e;let r=Math.pow(Math.abs(e),1/t);return r=e<0?-r:r,n?1/r:r}function bo(e){return be(e)}function vo(e){return e*e}function wo(e,t){let n,r,i,o,a=0,s=1,u=1,c=0;if(!ye(e)||!ye(t))throw new Error("Parameters in function xgcd must be integer numbers");for(;t;)r=Math.floor(e/t),i=e-r*t,n=a,a=s-r*a,s=n,n=u,u=c-r*u,c=n,e=t,t=i;return o=e<0?[-e,-s,-c]:[e,e?s:0,c],o}function No(e,t){return e*e<1&&t===1/0||e*e>1&&t===-1/0?0:Math.pow(e,t)}function Eo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!ye(t)||t<0||t>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(Be(e,t))}ro.signature=to,io.signature=no,oo.signature=no,ao.signature=no,so.signature=to,uo.signature=to,co.signature=to,lo.signature=to,fo.signature=to,po.signature=to,mo.signature=no,go.signature=to,yo.signature=to,bo.signature=to,vo.signature=to,wo.signature=no,No.signature=no;const Ao="unaryMinus",So=he(Ao,["typed"],(e=>{let{typed:t}=e;return t(Ao,{number:so,"Complex | BigNumber | Fraction":e=>e.neg(),bigint:e=>-e,Unit:t.referToSelf((e=>n=>{const r=n.clone();return r.value=t.find(e,r.valueType())(n.value),r})),"Array | Matrix":t.referToSelf((e=>t=>si(t,e,!0)))})})),Mo="unaryPlus",Co=he(Mo,["typed","config","numeric"],(e=>{let{typed:t,config:n,numeric:r}=e;return t(Mo,{number:uo,Complex:function(e){return e},BigNumber:function(e){return e},bigint:function(e){return e},Fraction:function(e){return e},Unit:function(e){return e.clone()},"Array | Matrix":t.referToSelf((e=>t=>si(t,e,!0))),boolean:function(e){return r(e?1:0,n.number)},string:function(e){return r(e,xe(e,n))}})})),To=he("abs",["typed"],(e=>{let{typed:t}=e;return t("abs",{number:ro,"Complex | BigNumber | Fraction | Unit":e=>e.abs(),bigint:e=>e<0n?-e:e,"Array | Matrix":t.referToSelf((e=>t=>si(t,e,!0)))})})),Bo="mapSlices",Do=he(Bo,["typed","isInteger"],(e=>{let{typed:t,isInteger:n}=e;return t(Bo,{"Array | Matrix, number | BigNumber, function":function(e,t,r){if(!n(t))throw new TypeError("Integer number expected for dimension");const i=Array.isArray(e)?vr(e):e.size();if(t<0||t>=i.length)throw new br(t,i.length);return E(e)?e.create(Fo(e.valueOf(),t,r),e.datatype()):Fo(e,t,r)}})}),{formerly:"apply"});function Fo(e,t,n){let r,i,o;if(t<=0){if(Array.isArray(e[0])){for(o=function(e){const t=e.length,n=e[0].length;let r,i;const o=[];for(i=0;i{let{typed:t}=e;return t(Oo,{"number, number":io,"Complex, Complex":function(e,t){return e.add(t)},"BigNumber, BigNumber":function(e,t){return e.plus(t)},"bigint, bigint":function(e,t){return e+t},"Fraction, Fraction":function(e,t){return e.add(t)},"Unit, Unit":t.referToSelf((e=>(n,r)=>{if(null===n.value||void 0===n.value)throw new Error("Parameter x contains a unit with undefined value");if(null===r.value||void 0===r.value)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(r))throw new Error("Units do not match");const i=n.clone();return i.value=t.find(e,[i.valueType(),r.valueType()])(i.value,r.value),i.fixPrefix=!1,i}))})})),Io="subtractScalar",zo=he(Io,["typed"],(e=>{let{typed:t}=e;return t(Io,{"number, number":oo,"Complex, Complex":function(e,t){return e.sub(t)},"BigNumber, BigNumber":function(e,t){return e.minus(t)},"bigint, bigint":function(e,t){return e-t},"Fraction, Fraction":function(e,t){return e.sub(t)},"Unit, Unit":t.referToSelf((e=>(n,r)=>{if(null===n.value||void 0===n.value)throw new Error("Parameter x contains a unit with undefined value");if(null===r.value||void 0===r.value)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(r))throw new Error("Units do not match");const i=n.clone();return i.value=t.find(e,[i.valueType(),r.valueType()])(i.value,r.value),i.fixPrefix=!1,i}))})})),ko="cbrt",Ro=he(ko,["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],(e=>{let{config:t,typed:n,isNegative:r,unaryMinus:i,matrix:o,Complex:a,BigNumber:s,Fraction:u}=e;return n(ko,{number:co,Complex:c,"Complex, boolean":c,BigNumber:function(e){return e.cbrt()},Unit:function(e){if(e.value&&x(e.value)){let t=e.clone();return t.value=1,t=t.pow(1/3),t.value=c(e.value),t}{const t=r(e.value);let n;t&&(e.value=i(e.value)),n=g(e.value)?new s(1).div(3):b(e.value)?new u(1,3):1/3;const o=e.pow(n);return t&&(o.value=i(o.value)),o}}});function c(e,n){const r=e.arg()/3,i=e.abs(),s=new a(co(i),0).mul(new a(0,r).exp());if(n){const e=[s,new a(co(i),0).mul(new a(0,r+2*Math.PI/3).exp()),new a(co(i),0).mul(new a(0,r-2*Math.PI/3).exp())];return"Array"===t.matrix?e:o(e)}return s}})),qo=he("matAlgo11xS0s",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i,o){const a=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!a)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");const f=c[0],p=c[1];let m,h=n,d=0,g=i;"string"==typeof l&&(m=l,h=t.find(n,[m,m]),d=t.convert(0,m),r=t.convert(r,m),g=t.find(i,[m,m]));const y=[],x=[],b=[];for(let e=0;e{let{typed:t,DenseMatrix:n}=e;return function(e,r,i,o){const a=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!a)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");const f=c[0],p=c[1];let m,h=i;"string"==typeof l&&(m=l,r=t.convert(r,m),h=t.find(i,[m,m]));const d=[],g=[],y=[];for(let e=0;e{let{typed:t}=e;return function(e,r,i,o){const a=e._data,s=e._size,u=e._datatype;let c,l=i;"string"==typeof u&&(c=u,r=t.convert(r,c),l=t.find(i,[c,c]));const f=s.length>0?n(l,0,s,s[0],a,r,o):[];return e.createDenseMatrix({data:f,size:ae(s),datatype:c})};function n(e,t,r,i,o,a,s){const u=[];if(t===r.length-1)for(let t=0;t{let{typed:t,config:n,round:r}=e;function i(e){const t=Math.ceil(e),i=r(e);return t===i?t:_e(e,i,n.relTol,n.absTol)&&!_e(e,t,n.relTol,n.absTol)?i:t}return t(Uo,{number:i,"number, number":function(e,t){if(!ye(t))throw new RangeError("number of decimals in function ceil must be an integer");if(t<0||t>15)throw new RangeError("number of decimals in ceil number must be in range 0-15");const n=10**t;return i(e*n)/n}})})),Go=he(Uo,Lo,(e=>{let{typed:t,config:n,round:r,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s}=e;const u=qo({typed:t,equalScalar:o}),c=Po({typed:t,DenseMatrix:s}),l=jo({typed:t}),f=Ho({typed:t,config:n,round:r});function p(e){const t=(e,t)=>yi(e,t,n.relTol,n.absTol),i=e.ceil(),o=r(e);return i.eq(o)?i:t(e,o)&&!t(e,i)?o:i}return t("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(e){return e.ceil()},"Complex, number":function(e,t){return e.ceil(t)},"Complex, BigNumber":function(e,t){return e.ceil(t.toNumber())},BigNumber:p,"BigNumber, BigNumber":function(e,t){const n=$o.pow(t);return p(e.mul(n)).div(n)},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.ceil()},"Fraction, number":function(e,t){return e.ceil(t)},"Fraction, BigNumber":function(e,t){return e.ceil(t.toNumber())},"Unit, number, Unit":t.referToSelf((e=>function(t,n,r){const i=t.toNumeric(r);return r.multiply(e(i,n))})),"Unit, BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>e(t,n.toNumber(),r))),"Array | Matrix, number | BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>si(t,(t=>e(t,n,r)),!0))),"Array | Matrix | Unit, Unit":t.referToSelf((e=>(t,n)=>e(t,0,n))),"Array | Matrix":t.referToSelf((e=>t=>si(t,e,!0))),"Array, number | BigNumber":t.referToSelf((e=>(t,n)=>si(t,(t=>e(t,n)),!0))),"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>u(t,n,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>l(t,n,e,!1))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((e=>(t,n)=>l(i(n),t,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((e=>(t,n)=>o(t,0)?a(n.size(),n.storage()):"dense"===n.storage()?l(n,t,e,!0):c(n,t,e,!0)))})})),Vo="cube",Zo=he(Vo,["typed"],(e=>{let{typed:t}=e;return t(Vo,{number:lo,Complex:function(e){return e.mul(e).mul(e)},BigNumber:function(e){return e.times(e).times(e)},bigint:function(e){return e*e*e},Fraction:function(e){return e.pow(3)},Unit:function(e){return e.pow(3)}})})),Wo=he("exp",["typed"],(e=>{let{typed:t}=e;return t("exp",{number:fo,Complex:function(e){return e.exp()},BigNumber:function(e){return e.exp()}})})),Yo="expm1",Jo=he(Yo,["typed","Complex"],(e=>{let{typed:t,Complex:n}=e;return t(Yo,{number:po,Complex:function(e){const t=Math.exp(e.re);return new n(t*Math.cos(e.im)-1,t*Math.sin(e.im))},BigNumber:function(e){return e.exp().minus(1)}})})),Xo="fix",Qo=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],Ko=he(Xo,["typed","ceil","floor"],(e=>{let{typed:t,ceil:n,floor:r}=e;return t(Xo,{number:function(e){return e>0?r(e):n(e)},"number, number":function(e,t){return e>0?r(e,t):n(e,t)}})})),ea=he(Xo,Qo,(e=>{let{typed:t,Complex:n,matrix:r,ceil:i,floor:o,equalScalar:a,zeros:s,DenseMatrix:u}=e;const c=Po({typed:t,DenseMatrix:u}),l=jo({typed:t}),f=Ko({typed:t,ceil:i,floor:o});return t("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(e){return new n(e.re>0?Math.floor(e.re):Math.ceil(e.re),e.im>0?Math.floor(e.im):Math.ceil(e.im))},"Complex, number":function(e,t){return new n(e.re>0?o(e.re,t):i(e.re,t),e.im>0?o(e.im,t):i(e.im,t))},"Complex, BigNumber":function(e,t){const r=t.toNumber();return new n(e.re>0?o(e.re,r):i(e.re,r),e.im>0?o(e.im,r):i(e.im,r))},BigNumber:function(e){return e.isNegative()?i(e):o(e)},"BigNumber, number | BigNumber":function(e,t){return e.isNegative()?i(e,t):o(e,t)},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.s<0n?e.ceil():e.floor()},"Fraction, number | BigNumber":function(e,t){return e.s<0n?i(e,t):o(e,t)},"Unit, number, Unit":t.referToSelf((e=>function(t,n,r){const i=t.toNumeric(r);return r.multiply(e(i,n))})),"Unit, BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>e(t,n.toNumber(),r))),"Array | Matrix, number | BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>si(t,(t=>e(t,n,r)),!0))),"Array | Matrix | Unit, Unit":t.referToSelf((e=>(t,n)=>e(t,0,n))),"Array | Matrix":t.referToSelf((e=>t=>si(t,e,!0))),"Array | Matrix, number | BigNumber":t.referToSelf((e=>(t,n)=>si(t,(t=>e(t,n)),!0))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((e=>(t,n)=>l(r(n),t,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((e=>(t,n)=>a(t,0)?s(n.size(),n.storage()):"dense"===n.storage()?l(n,t,e,!0):c(n,t,e,!0)))})})),ta="floor",na=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],ra=new Fn(10),ia=he(ta,["typed","config","round"],(e=>{let{typed:t,config:n,round:r}=e;function i(e){const t=Math.floor(e),i=r(e);return t===i?t:_e(e,i,n.relTol,n.absTol)&&!_e(e,t,n.relTol,n.absTol)?i:t}return t(ta,{number:i,"number, number":function(e,t){if(!ye(t))throw new RangeError("number of decimals in function floor must be an integer");if(t<0||t>15)throw new RangeError("number of decimals in floor number must be in range 0 - 15");const n=10**t;return i(e*n)/n}})})),oa=he(ta,na,(e=>{let{typed:t,config:n,round:r,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s}=e;const u=qo({typed:t,equalScalar:o}),c=Po({typed:t,DenseMatrix:s}),l=jo({typed:t}),f=ia({typed:t,config:n,round:r});function p(e){const t=(e,t)=>yi(e,t,n.relTol,n.absTol),i=e.floor(),o=r(e);return i.eq(o)?i:t(e,o)&&!t(e,i)?o:i}return t("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(e){return e.floor()},"Complex, number":function(e,t){return e.floor(t)},"Complex, BigNumber":function(e,t){return e.floor(t.toNumber())},BigNumber:p,"BigNumber, BigNumber":function(e,t){const n=ra.pow(t);return p(e.mul(n)).div(n)},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.floor()},"Fraction, number":function(e,t){return e.floor(t)},"Fraction, BigNumber":function(e,t){return e.floor(t.toNumber())},"Unit, number, Unit":t.referToSelf((e=>function(t,n,r){const i=t.toNumeric(r);return r.multiply(e(i,n))})),"Unit, BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>e(t,n.toNumber(),r))),"Array | Matrix, number | BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>si(t,(t=>e(t,n,r)),!0))),"Array | Matrix | Unit, Unit":t.referToSelf((e=>(t,n)=>e(t,0,n))),"Array | Matrix":t.referToSelf((e=>t=>si(t,e,!0))),"Array, number | BigNumber":t.referToSelf((e=>(t,n)=>si(t,(t=>e(t,n)),!0))),"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>u(t,n,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>l(t,n,e,!1))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((e=>(t,n)=>l(i(n),t,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((e=>(t,n)=>o(t,0)?a(n.size(),n.storage()):"dense"===n.storage()?l(n,t,e,!0):c(n,t,e,!0)))})})),aa=he("matAlgo02xDS0",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i,o){const a=e._data,s=e._size,u=e._datatype||e.getDataType(),c=r._values,l=r._index,f=r._ptr,p=r._size,m=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(s.length!==p.length)throw new xr(s.length,p.length);if(s[0]!==p[0]||s[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");const h=s[0],d=s[1];let g,y=n,x=0,b=i;"string"==typeof u&&u===m&&"mixed"!==u&&(g=u,y=t.find(n,[g,g]),x=t.convert(0,g),b=t.find(i,[g,g]));const v=[],w=[],N=[];for(let e=0;e{let{typed:t}=e;return function(e,n,r,i){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=n._values,c=n._index,l=n._ptr,f=n._size,p=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(a.length!==f.length)throw new xr(a.length,f.length);if(a[0]!==f[0]||a[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+f+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");const m=a[0],h=a[1];let d,g=0,y=r;"string"==typeof s&&s===p&&"mixed"!==s&&(d=s,g=t.convert(0,d),y=t.find(r,[d,d]));const x=[];for(let e=0;e{let{typed:t,equalScalar:n}=e;return function(e,r,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=r._values,f=r._index,p=r._ptr,m=r._size,h=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(u.length!==m.length)throw new xr(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");const d=u[0],g=u[1];let y,x=n,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(n,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=o&&l?[]:void 0,N=[],E=[],A=w?[]:void 0,S=w?[]:void 0,M=[],C=[];let T,B,D,F;for(B=0;B{let{typed:t}=e;return function(e,r,i){const o=e._data,a=e._size,s=e._datatype,u=r._data,c=r._size,l=r._datatype,f=[];if(a.length!==c.length)throw new xr(a.length,c.length);for(let e=0;e0?n(m,0,f,f[0],o,u):[];return e.createDenseMatrix({data:h,size:f,datatype:p})};function n(e,t,r,i,o,a){const s=[];if(t===r.length-1)for(let t=0;tfunction(e,t){return ce(e.size(),t)?e:e.create(Wr(e.valueOf(),t),e.datatype())}(e,n)))}const fa=he("matrixAlgorithmSuite",["typed","matrix"],(e=>{let{typed:t,matrix:n}=e;const r=ca({typed:t}),i=jo({typed:t});return function(e){const o=e.elop,a=e.SD||e.DS;let s;o?(s={"DenseMatrix, DenseMatrix":(e,t)=>r(...la(e,t),o),"Array, Array":(e,t)=>r(...la(n(e),n(t)),o).valueOf(),"Array, DenseMatrix":(e,t)=>r(...la(n(e),t),o),"DenseMatrix, Array":(e,t)=>r(...la(e,n(t)),o)},e.SS&&(s["SparseMatrix, SparseMatrix"]=(t,n)=>e.SS(...la(t,n),o,!1)),e.DS&&(s["DenseMatrix, SparseMatrix"]=(t,n)=>e.DS(...la(t,n),o,!1),s["Array, SparseMatrix"]=(t,r)=>e.DS(...la(n(t),r),o,!1)),a&&(s["SparseMatrix, DenseMatrix"]=(e,t)=>a(...la(t,e),o,!0),s["SparseMatrix, Array"]=(e,t)=>a(...la(n(t),e),o,!0))):(s={"DenseMatrix, DenseMatrix":t.referToSelf((e=>(t,n)=>r(...la(t,n),e))),"Array, Array":t.referToSelf((e=>(t,i)=>r(...la(n(t),n(i)),e).valueOf())),"Array, DenseMatrix":t.referToSelf((e=>(t,i)=>r(...la(n(t),i),e))),"DenseMatrix, Array":t.referToSelf((e=>(t,i)=>r(...la(t,n(i)),e)))},e.SS&&(s["SparseMatrix, SparseMatrix"]=t.referToSelf((t=>(n,r)=>e.SS(...la(n,r),t,!1)))),e.DS&&(s["DenseMatrix, SparseMatrix"]=t.referToSelf((t=>(n,r)=>e.DS(...la(n,r),t,!1))),s["Array, SparseMatrix"]=t.referToSelf((t=>(r,i)=>e.DS(...la(n(r),i),t,!1)))),a&&(s["SparseMatrix, DenseMatrix"]=t.referToSelf((e=>(t,n)=>a(...la(n,t),e,!0))),s["SparseMatrix, Array"]=t.referToSelf((e=>(t,r)=>a(...la(n(r),t),e,!0)))));const u=e.scalar||"any";(e.Ds||e.Ss)&&(o?(s["DenseMatrix,"+u]=(e,t)=>i(e,t,o,!1),s[u+", DenseMatrix"]=(e,t)=>i(t,e,o,!0),s["Array,"+u]=(e,t)=>i(n(e),t,o,!1).valueOf(),s[u+", Array"]=(e,t)=>i(n(t),e,o,!0).valueOf()):(s["DenseMatrix,"+u]=t.referToSelf((e=>(t,n)=>i(t,n,e,!1))),s[u+", DenseMatrix"]=t.referToSelf((e=>(t,n)=>i(n,t,e,!0))),s["Array,"+u]=t.referToSelf((e=>(t,r)=>i(n(t),r,e,!1).valueOf())),s[u+", Array"]=t.referToSelf((e=>(t,r)=>i(n(r),t,e,!0).valueOf()))));const c=void 0!==e.sS?e.sS:e.Ss;return o?(e.Ss&&(s["SparseMatrix,"+u]=(t,n)=>e.Ss(t,n,o,!1)),c&&(s[u+", SparseMatrix"]=(e,t)=>c(t,e,o,!0))):(e.Ss&&(s["SparseMatrix,"+u]=t.referToSelf((t=>(n,r)=>e.Ss(n,r,t,!1)))),c&&(s[u+", SparseMatrix"]=t.referToSelf((e=>(t,n)=>c(n,t,e,!0))))),o&&o.signatures&&se(s,o.signatures),s}})),pa=he("mod",["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,config:n,round:r,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s,concat:u}=e;const c=oa({typed:t,config:n,round:r,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s}),l=aa({typed:t,equalScalar:o}),f=sa({typed:t}),p=ua({typed:t,equalScalar:o}),m=qo({typed:t,equalScalar:o}),h=Po({typed:t,DenseMatrix:s});return t("mod",{"number, number":function(e,t){return 0===t?e:e-t*c(e/t)},"BigNumber, BigNumber":function(e,t){return t.isZero()?e:e.sub(t.mul(c(e.div(t))))},"bigint, bigint":function(e,t){if(0n===t)return e;if(e<0){const n=e%t;return 0n===n?n:n+t}return e%t},"Fraction, Fraction":function(e,t){return t.equals(0)?e:e.sub(t.mul(c(e.div(t))))}},fa({typed:t,matrix:i,concat:u})({SS:p,DS:f,SD:l,Ss:m,sS:h}))})),ma=he("matAlgo01xDSid",["typed"],(e=>{let{typed:t}=e;return function(e,n,r,i){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=n._values,c=n._index,l=n._ptr,f=n._size,p=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(a.length!==f.length)throw new xr(a.length,f.length);if(a[0]!==f[0]||a[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+f+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");const m=a[0],h=a[1],d="string"==typeof s&&"mixed"!==s&&s===p?s:void 0,g=d?t.find(r,[d,d]):r;let y,x;const b=[];for(y=0;y{let{typed:t,equalScalar:n}=e;return function(e,r,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=r._values,f=r._index,p=r._ptr,m=r._size,h=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(u.length!==m.length)throw new xr(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");const d=u[0],g=u[1];let y,x=n,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(n,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=o&&l?[]:void 0,N=[],E=[],A=o&&l?[]:void 0,S=o&&l?[]:void 0,M=[],C=[];let T,B,D,F,O;for(B=0;B{let{typed:t,DenseMatrix:n}=e;return function(e,r,i,o){const a=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!a)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");const f=c[0],p=c[1];let m,h=i;"string"==typeof l&&(m=l,r=t.convert(r,m),h=t.find(i,[m,m]));const d=[],g=[],y=[];for(let e=0;eArray.isArray(e)))}const va=he("gcd",["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,config:r,round:i,equalScalar:o,zeros:a,BigNumber:s,DenseMatrix:u,concat:c}=e;const l=pa({typed:t,config:r,round:i,matrix:n,equalScalar:o,zeros:a,DenseMatrix:u,concat:c}),f=ma({typed:t}),p=ha({typed:t,equalScalar:o}),m=da({typed:t,DenseMatrix:u});return t("gcd",{"number, number":function(e,t){if(!ye(e)||!ye(t))throw new Error("Parameters in function gcd must be integer numbers");let n;for(;0!==t;)n=l(e,t),e=t,t=n;return e<0?-e:e},"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function gcd must be integer numbers");const n=new s(0);for(;!t.isZero();){const n=l(e,t);e=t,t=n}return e.lt(n)?e.neg():e},"Fraction, Fraction":(e,t)=>e.gcd(t)},fa({typed:t,matrix:n,concat:c})({SS:p,DS:f,Ss:m}),{[xa]:t.referToSelf((e=>(t,n,r)=>{let i=e(t,n);for(let t=0;tt=>{if(1===t.length&&Array.isArray(t[0])&&ba(t[0]))return e(...t[0]);if(ba(t))return e(...t);throw new ga("gcd() supports only 1d matrices!")})),Matrix:t.referToSelf((e=>t=>e(t.toArray())))})})),wa=he("matAlgo06xS0S0",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i){const o=e._values,a=e._size,s=e._datatype||void 0===e._data?e._datatype:e.getDataType(),u=r._values,c=r._size,l=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(a.length!==c.length)throw new xr(a.length,c.length);if(a[0]!==c[0]||a[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+c+")");const f=a[0],p=a[1];let m,h=n,d=0,g=i;"string"==typeof s&&s===l&&"mixed"!==s&&(m=s,h=t.find(n,[m,m]),d=t.convert(0,m),g=t.find(i,[m,m]));const y=o&&u?[]:void 0,x=[],b=[],v=y?[]:void 0,w=[],N=[];for(let t=0;t{let{typed:t,matrix:n,equalScalar:r,concat:i}=e;const o=aa({typed:t,equalScalar:r}),a=wa({typed:t,equalScalar:r}),s=qo({typed:t,equalScalar:r}),u=fa({typed:t,matrix:n,concat:i}),c="number | BigNumber | Fraction | Matrix | Array",l={};return l[`${c}, ${c}, ...${c}`]=t.referToSelf((e=>(t,n,r)=>{let i=e(t,n);for(let t=0;te.lcm(t)},u({SS:a,DS:o,Ss:s}),l)}));function Ea(e,t,n,r){return function(i){if(i>0||n.predictable){if(i<=0)return NaN;const n=i.toString(16),r=n.substring(0,15);return e*(n.length-r.length)+t(Number("0x"+r))}return r(i.toNumber())}}const Aa="log10",Sa=["typed","config","Complex"],Ma=go(16),Ca=he(Aa,Sa,(e=>{let{typed:t,config:n,Complex:r}=e;function i(e){return e.log().div(Math.LN10)}function o(e){return i(new r(e,0))}return t(Aa,{number:function(e){return e>=0||n.predictable?go(e):o(e)},bigint:Ea(Ma,go,n,o),Complex:i,BigNumber:function(e){return!e.isNegative()||n.predictable?e.log():o(e.toNumber())},"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),Ta="log2",Ba=he(Ta,["typed","config","Complex"],(e=>{let{typed:t,config:n,Complex:r}=e;function i(e){return o(new r(e,0))}return t(Ta,{number:function(e){return e>=0||n.predictable?yo(e):i(e)},bigint:Ea(4,yo,n,i),Complex:o,BigNumber:function(e){return!e.isNegative()||n.predictable?e.log(2):i(e.toNumber())},"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))});function o(e){const t=Math.sqrt(e.re*e.re+e.im*e.im);return new r(Math.log2?Math.log2(t):Math.log(t)/Math.LN2,Math.atan2(e.im,e.re)/Math.LN2)}})),Da=he("multiplyScalar",["typed"],(e=>{let{typed:t}=e;return t("multiplyScalar",{"number, number":ao,"Complex, Complex":function(e,t){return e.mul(t)},"BigNumber, BigNumber":function(e,t){return e.times(t)},"bigint, bigint":function(e,t){return e*t},"Fraction, Fraction":function(e,t){return e.mul(t)},"number | Fraction | BigNumber | Complex, Unit":(e,t)=>t.multiply(e),"Unit, number | Fraction | BigNumber | Complex | Unit":(e,t)=>e.multiply(t)})})),Fa="multiply",Oa=he(Fa,["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],(e=>{let{typed:t,matrix:n,addScalar:r,multiplyScalar:i,equalScalar:o,dot:a}=e;const s=qo({typed:t,equalScalar:o}),u=jo({typed:t});function c(e,t){switch(e.length){case 1:switch(t.length){case 1:if(e[0]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(e[0]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+e[0]+") must match Matrix rows ("+t[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;case 2:switch(t.length){case 1:if(e[1]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+e[1]+") must match Vector length ("+t[0]+")");break;case 2:if(e[1]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+e[1]+") must match Matrix B rows ("+t[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+e.length+" dimensions)")}}const l=t("_multiplyMatrixVector",{"DenseMatrix, any":function(e,n){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=n._data,c=n._datatype||n.getDataType(),l=a[0],f=a[1];let p,m=r,h=i;s&&c&&s===c&&"string"==typeof s&&"mixed"!==s&&(p=s,m=t.find(r,[p,p]),h=t.find(i,[p,p]));const d=[];for(let e=0;et){let e=0;for(let r=0;r(t,r)=>{c(vr(t),vr(r));const i=e(n(t),n(r));return E(i)?i.valueOf():i})),"Matrix, Matrix":function(e,n){const o=e.size(),s=n.size();return c(o,s),1===o.length?1===s.length?function(e,t,n){if(0===n)throw new Error("Cannot multiply two empty vectors");return a(e,t)}(e,n,o[0]):function(e,n){if("dense"!==n.storage())throw new Error("Support for SparseMatrix not implemented");return function(e,n){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=n._data,c=n._size,l=n._datatype||n.getDataType(),f=a[0],p=c[1];let m,h=r,d=i;s&&l&&s===l&&"string"==typeof s&&"mixed"!==s&&(m=s,h=t.find(r,[m,m]),d=t.find(i,[m,m]));const g=[];for(let e=0;e(t,r)=>e(t,n(r)))),"Array, Matrix":t.referToSelf((e=>(t,r)=>e(n(t,r.storage()),r))),"SparseMatrix, any":function(e,t){return s(e,t,i,!1)},"DenseMatrix, any":function(e,t){return u(e,t,i,!1)},"any, SparseMatrix":function(e,t){return s(t,e,i,!0)},"any, DenseMatrix":function(e,t){return u(t,e,i,!0)},"Array, any":function(e,t){return u(n(e),t,i,!1).valueOf()},"any, Array":function(e,t){return u(n(t),e,i,!0).valueOf()},"any, any":i,"any, any, ...any":t.referToSelf((e=>(t,n,r)=>{let i=e(t,n);for(let t=0;t{let{typed:t,matrix:n,equalScalar:r,BigNumber:i,concat:o}=e;const a=ma({typed:t}),s=aa({typed:t,equalScalar:r}),u=wa({typed:t,equalScalar:r}),c=qo({typed:t,equalScalar:r}),l=fa({typed:t,matrix:n,concat:o});function f(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return t(_a,{number:xo,"number, number":xo,BigNumber:e=>p(e,new i(2)),"BigNumber, BigNumber":p,Complex:f,"Complex, number":f,Array:t.referTo("DenseMatrix,number",(e=>t=>e(n(t),2).valueOf())),DenseMatrix:t.referTo("DenseMatrix,number",(e=>t=>e(t,2))),SparseMatrix:t.referTo("SparseMatrix,number",(e=>t=>e(t,2))),"SparseMatrix, SparseMatrix":t.referToSelf((e=>(t,n)=>{if(1===n.density())return u(t,n,e);throw new Error("Root must be non-zero")})),"DenseMatrix, SparseMatrix":t.referToSelf((e=>(t,n)=>{if(1===n.density())return a(t,n,e,!1);throw new Error("Root must be non-zero")})),"Array, SparseMatrix":t.referTo("DenseMatrix,SparseMatrix",(e=>(t,r)=>e(n(t),r))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,n)=>{if(1===n.density())return c(n,t,e,!0);throw new Error("Root must be non-zero")}))},l({scalar:"number | BigNumber",SD:s,Ss:c,sS:!1}));function p(e,t){const n=i.precision,r=i.clone({precision:n+2}),o=new i(0),a=new r(1),s=t.isNegative();if(s&&(t=t.neg()),t.isZero())throw new Error("Root must be non-zero");if(e.isNegative()&&!t.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(e.isZero())return s?new r(1/0):0;if(!e.isFinite())return s?o:e;let u=e.abs().pow(a.div(t));return u=e.isNeg()?u.neg():u,new i((s?a.div(u):u).toPrecision(n))}})),za="sign",ka=he(za,["typed","BigNumber","Fraction","complex"],(e=>{let{typed:t,BigNumber:n,complex:r,Fraction:i}=e;return t(za,{number:bo,Complex:function(e){return 0===e.im?r(bo(e.re)):e.sign()},BigNumber:function(e){return new n(e.cmp(0))},bigint:function(e){return e>0n?1n:e<0n?-1n:0n},Fraction:function(e){return new i(e.s)},"Array | Matrix":t.referToSelf((e=>t=>si(t,e,!0))),Unit:t.referToSelf((e=>n=>{if(!n._isDerived()&&0!==n.units[0].unit.offset)throw new TypeError("sign is ambiguous for units with offset");return t.find(e,n.valueType())(n.value)}))})})),Ra=he("sqrt",["config","typed","Complex"],(e=>{let{config:t,typed:n,Complex:r}=e;return n("sqrt",{number:i,Complex:function(e){return e.sqrt()},BigNumber:function(e){return!e.isNegative()||t.predictable?e.sqrt():i(e.toNumber())},Unit:function(e){return e.pow(.5)}});function i(e){return isNaN(e)?NaN:e>=0||t.predictable?Math.sqrt(e):new r(e,0).sqrt()}})),qa="square",Pa=he(qa,["typed"],(e=>{let{typed:t}=e;return t(qa,{number:vo,Complex:function(e){return e.mul(e)},BigNumber:function(e){return e.times(e)},bigint:function(e){return e*e},Fraction:function(e){return e.mul(e)},Unit:function(e){return e.pow(2)}})})),ja="subtract",Ua=he(ja,["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,subtractScalar:i,unaryMinus:o,DenseMatrix:a,concat:s}=e;const u=ma({typed:t}),c=sa({typed:t}),l=ua({typed:t,equalScalar:r}),f=da({typed:t,DenseMatrix:a}),p=Po({typed:t,DenseMatrix:a}),m=fa({typed:t,matrix:n,concat:s});return t(ja,{"any, any":i},m({elop:i,SS:l,DS:u,SD:c,Ss:p,sS:f}))})),La="xgcd",$a=he(La,["typed","config","matrix","BigNumber"],(e=>{let{typed:t,config:n,matrix:r,BigNumber:i}=e;return t(La,{"number, number":function(e,t){const i=wo(e,t);return"Array"===n.matrix?i:r(i)},"BigNumber, BigNumber":function(e,t){let o,a,s;const u=new i(0),c=new i(1);let l,f=u,p=c,m=c,h=u;if(!e.isInt()||!t.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!t.isZero();)a=e.div(t).floor(),s=e.mod(t),o=f,f=p.minus(a.times(f)),p=o,o=m,m=h.minus(a.times(m)),h=o,e=t,t=s;return l=e.lt(u)?[e.neg(),p.neg(),h.neg()]:[e,e.isZero()?0:p,h],"Array"===n.matrix?l:r(l)}})})),Ha="invmod",Ga=he(Ha,["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],(e=>{let{typed:t,config:n,BigNumber:r,xgcd:i,equal:o,smaller:a,mod:s,add:u,isInteger:c}=e;return t(Ha,{"number, number":l,"BigNumber, BigNumber":l});function l(e,t){if(!c(e)||!c(t))throw new Error("Parameters in function invmod must be integer numbers");if(e=s(e,t),o(t,0))throw new Error("Divisor must be non zero");let n=i(e,t);n=n.valueOf();let[l,f]=n;return o(l,r(1))?(f=s(f,t),a(f,r(0))&&(f=u(f,t)),f):NaN}})),Va=he("matAlgo09xS0Sf",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=r._values,f=r._index,p=r._ptr,m=r._size,h=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(u.length!==m.length)throw new xr(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");const d=u[0],g=u[1];let y,x=n,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(n,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=o&&l?[]:void 0,N=[],E=[],A=w?[]:void 0,S=[];let M,C,T,B,D;for(C=0;C{let{typed:t,matrix:n,equalScalar:r,multiplyScalar:i,concat:o}=e;const a=aa({typed:t,equalScalar:r}),s=Va({typed:t,equalScalar:r}),u=qo({typed:t,equalScalar:r}),c=fa({typed:t,matrix:n,concat:o});return t(Za,c({elop:i,SS:s,DS:a,Ss:u}))}));function Ya(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitAnd");const n=e.constructor;if(e.isNaN()||t.isNaN())return new n(NaN);if(e.isZero()||t.eq(-1)||e.eq(t))return e;if(t.isZero()||e.eq(-1))return t;if(!e.isFinite()||!t.isFinite()){if(!e.isFinite()&&!t.isFinite())return e.isNegative()===t.isNegative()?e:new n(0);if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new n(0):t;if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new n(0):e}return Qa(e,t,(function(e,t){return e&t}))}function Ja(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");const t=e.constructor,n=t.precision;t.config({precision:1e9});const r=e.plus(new t(1));return r.s=-r.s||null,t.config({precision:n}),r}function Xa(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitOr");const n=e.constructor;if(e.isNaN()||t.isNaN())return new n(NaN);const r=new n(-1);return e.isZero()||t.eq(r)||e.eq(t)?t:t.isZero()||e.eq(r)?e:e.isFinite()&&t.isFinite()?Qa(e,t,(function(e,t){return e|t})):!e.isFinite()&&!e.isNegative()&&t.isNegative()||e.isNegative()&&!t.isNegative()&&!t.isFinite()?r:e.isNegative()&&t.isNegative()?e.isFinite()?e:t:e.isFinite()?t:e}function Qa(e,t,n){const r=e.constructor;let i,o;const a=+(e.s<0),s=+(t.s<0);if(a){i=Ka(Ja(e));for(let e=0;e0;)n(u[--f],c[--p])===m&&(h=h.plus(d)),d=d.times(g);for(;p>0;)n(l,c[--p])===m&&(h=h.plus(d)),d=d.times(g);return r.config({precision:y}),0===m&&(h.s=-h.s),h}function Ka(e){const t=e.d;let n=t[0]+"";for(let e=1;e0)if(++i>a)for(i-=a;i--;)o+="0";else i1&&(null!==s[e+1]&&void 0!==s[e+1]||(s[e+1]=0),s[e+1]+=s[e]>>1,s[e]&=1)}return s.reverse()}function es(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitXor");const n=e.constructor;if(e.isNaN()||t.isNaN())return new n(NaN);if(e.isZero())return t;if(t.isZero())return e;if(e.eq(t))return new n(0);const r=new n(-1);return e.eq(r)?Ja(t):t.eq(r)?Ja(e):e.isFinite()&&t.isFinite()?Qa(e,t,(function(e,t){return e^t})):e.isFinite()||t.isFinite()?new n(e.isNegative()===t.isNegative()?1/0:-1/0):r}function ts(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function leftShift");const n=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new n(NaN):e.isZero()||t.isZero()?e:e.isFinite()||t.isFinite()?t.lt(55)?e.times(Math.pow(2,t.toNumber())+""):e.times(new n(2).pow(t)):new n(NaN)}function ns(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function rightArithShift");const n=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new n(NaN):e.isZero()||t.isZero()?e:t.isFinite()?t.lt(55)?e.div(Math.pow(2,t.toNumber())+"").floor():e.div(new n(2).pow(t)).floor():e.isNegative()?new n(-1):e.isFinite()?new n(0):new n(NaN)}const rs="number, number";function is(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function bitAnd");return e&t}function os(e){if(!ye(e))throw new Error("Integer expected in function bitNot");return~e}function as(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function bitOr");return e|t}function ss(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function bitXor");return e^t}function us(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function leftShift");return e<>t}function ls(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function rightLogShift");return e>>>t}is.signature=rs,os.signature="number",as.signature=rs,ss.signature=rs,us.signature=rs,cs.signature=rs,ls.signature=rs;const fs="bitAnd",ps=he(fs,["typed","matrix","equalScalar","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,concat:i}=e;const o=aa({typed:t,equalScalar:r}),a=wa({typed:t,equalScalar:r}),s=qo({typed:t,equalScalar:r}),u=fa({typed:t,matrix:n,concat:i});return t(fs,{"number, number":is,"BigNumber, BigNumber":Ya,"bigint, bigint":(e,t)=>e&t},u({SS:a,DS:o,Ss:s}))})),ms="bitNot",hs=he(ms,["typed"],(e=>{let{typed:t}=e;return t(ms,{number:os,BigNumber:Ja,bigint:e=>~e,"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),ds="bitOr",gs=he(ds,["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o}=e;const a=ma({typed:t}),s=ha({typed:t,equalScalar:r}),u=da({typed:t,DenseMatrix:i}),c=fa({typed:t,matrix:n,concat:o});return t(ds,{"number, number":as,"BigNumber, BigNumber":Xa,"bigint, bigint":(e,t)=>e|t},c({SS:s,DS:a,Ss:u}))})),ys=he("matAlgo07xSSf",["typed","SparseMatrix"],(e=>{let{typed:t,SparseMatrix:n}=e;return function(e,i,o){const a=e._size,s=e._datatype||void 0===e._data?e._datatype:e.getDataType(),u=i._size,c=i._datatype||void 0===i._data?i._datatype:i.getDataType();if(a.length!==u.length)throw new xr(a.length,u.length);if(a[0]!==u[0]||a[1]!==u[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+u+")");const l=a[0],f=a[1];let p,m=0,h=o;"string"==typeof s&&s===c&&"mixed"!==s&&(p=s,m=t.convert(0,p),h=t.find(o,[p,p]));const d=[],g=[],y=new Array(f+1).fill(0),x=[],b=[],v=[],w=[];for(let t=0;t{let{typed:t,matrix:n,DenseMatrix:r,concat:i,SparseMatrix:o}=e;const a=sa({typed:t}),s=ys({typed:t,SparseMatrix:o}),u=Po({typed:t,DenseMatrix:r}),c=fa({typed:t,matrix:n,concat:i});return t(xs,{"number, number":ss,"BigNumber, BigNumber":es,"bigint, bigint":(e,t)=>e^t},c({SS:s,DS:a,Ss:u}))})),vs=he("arg",["typed"],(e=>{let{typed:t}=e;return t("arg",{number:function(e){return Math.atan2(0,e)},BigNumber:function(e){return e.constructor.atan2(0,e)},Complex:function(e){return e.arg()},"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),ws="conj",Ns=he(ws,["typed"],(e=>{let{typed:t}=e;return t(ws,{"number | BigNumber | Fraction":e=>e,Complex:e=>e.conjugate(),Unit:t.referToSelf((e=>t=>new t.constructor(e(t.toNumeric()),t.formatUnits()))),"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),Es=he("im",["typed"],(e=>{let{typed:t}=e;return t("im",{number:()=>0,"BigNumber | Fraction":e=>e.mul(0),Complex:e=>e.im,"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),As=he("re",["typed"],(e=>{let{typed:t}=e;return t("re",{"number | BigNumber | Fraction":e=>e,Complex:e=>e.re,"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),Ss="number, number";function Ms(e){return!e}function Cs(e,t){return!(!e&&!t)}function Ts(e,t){return!!e!=!!t}function Bs(e,t){return!(!e||!t)}Ms.signature="number",Cs.signature=Ss,Ts.signature=Ss,Bs.signature=Ss;const Ds=he("not",["typed"],(e=>{let{typed:t}=e;return t("not",{"null | undefined":()=>!0,number:Ms,Complex:function(e){return 0===e.re&&0===e.im},BigNumber:function(e){return e.isZero()||e.isNaN()},bigint:e=>!e,Unit:t.referToSelf((e=>n=>t.find(e,n.valueType())(n.value))),"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),Fs=he("or",["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o}=e;const a=sa({typed:t}),s=ua({typed:t,equalScalar:r}),u=Po({typed:t,DenseMatrix:i}),c=fa({typed:t,matrix:n,concat:o});return t("or",{"number, number":Cs,"Complex, Complex":function(e,t){return 0!==e.re||0!==e.im||0!==t.re||0!==t.im},"BigNumber, BigNumber":function(e,t){return!e.isZero()&&!e.isNaN()||!t.isZero()&&!t.isNaN()},"bigint, bigint":Cs,"Unit, Unit":t.referToSelf((e=>(t,n)=>e(t.value||0,n.value||0)))},c({SS:s,DS:a,Ss:u}))})),Os=he("xor",["typed","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,matrix:n,DenseMatrix:r,concat:i,SparseMatrix:o}=e;const a=sa({typed:t}),s=ys({typed:t,SparseMatrix:o}),u=Po({typed:t,DenseMatrix:r}),c=fa({typed:t,matrix:n,concat:i});return t("xor",{"number, number":Ts,"Complex, Complex":function(e,t){return(0!==e.re||0!==e.im)!=(0!==t.re||0!==t.im)},"bigint, bigint":Ts,"BigNumber, BigNumber":function(e,t){return(!e.isZero()&&!e.isNaN())!=(!t.isZero()&&!t.isNaN())},"Unit, Unit":t.referToSelf((e=>(t,n)=>e(t.value||0,n.value||0)))},c({SS:s,DS:a,Ss:u}))})),_s="concat",Is=he(_s,["typed","matrix","isInteger"],(e=>{let{typed:t,matrix:n,isInteger:r}=e;return t(_s,{"...Array | Matrix | number | BigNumber":function(e){let t;const i=e.length;let o,a=-1,s=!1;const u=[];for(t=0;t0&&a>o)throw new br(a,o+1)}else{const e=ae(n).valueOf(),r=vr(e);if(u[t]=e,o=a,a=r.length-1,t>0&&a!==o)throw new xr(o+1,a+1)}}if(0===u.length)throw new SyntaxError("At least one matrix expected");let c=u.shift();for(;u.length;)c=Gr(c,u.shift(),a);return s?n(c):c},"...string":function(e){return e.join("")}})})),zs="column",ks=he(zs,["typed","Index","matrix","range"],(e=>{let{typed:t,Index:n,matrix:r,range:i}=e;return t(zs,{"Matrix, number":o,"Array, number":function(e,t){return o(r(ae(e)),t).valueOf()}});function o(e,t){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");Ar(t,e.size()[1]);const o=i(0,e.size()[0]),a=new n(o,t),s=e.subset(a);return E(s)?s:r([[s]])}})),Rs="count",qs=he(Rs,["typed","size","prod"],(e=>{let{typed:t,size:n,prod:r}=e;return t(Rs,{string:function(e){return e.length},"Matrix | Array":function(e){return r(n(e))}})})),Ps="cross",js=he(Ps,["typed","matrix","subtract","multiply"],(e=>{let{typed:t,matrix:n,subtract:r,multiply:i}=e;return t(Ps,{"Matrix, Matrix":function(e,t){return n(o(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return n(o(e.toArray(),t))},"Array, Matrix":function(e,t){return n(o(e,t.toArray()))},"Array, Array":o});function o(e,t){const n=Math.max(vr(e).length,vr(t).length);e=Fr(e),t=Fr(t);const o=vr(e),a=vr(t);if(1!==o.length||1!==a.length||3!==o[0]||3!==a[0])throw new RangeError("Vectors with length 3 expected (Size A = ["+o.join(", ")+"], B = ["+a.join(", ")+"])");const s=[r(i(e[1],t[2]),i(e[2],t[1])),r(i(e[2],t[0]),i(e[0],t[2])),r(i(e[0],t[1]),i(e[1],t[0]))];return n>1?[s]:s}})),Us="diag",Ls=he(Us,["typed","matrix","DenseMatrix","SparseMatrix"],(e=>{let{typed:t,matrix:n,DenseMatrix:r,SparseMatrix:i}=e;return t(Us,{Array:function(e){return o(e,0,vr(e),null)},"Array, number":function(e,t){return o(e,t,vr(e),null)},"Array, BigNumber":function(e,t){return o(e,t.toNumber(),vr(e),null)},"Array, string":function(e,t){return o(e,0,vr(e),t)},"Array, number, string":function(e,t,n){return o(e,t,vr(e),n)},"Array, BigNumber, string":function(e,t,n){return o(e,t.toNumber(),vr(e),n)},Matrix:function(e){return o(e,0,e.size(),e.storage())},"Matrix, number":function(e,t){return o(e,t,e.size(),e.storage())},"Matrix, BigNumber":function(e,t){return o(e,t.toNumber(),e.size(),e.storage())},"Matrix, string":function(e,t){return o(e,0,e.size(),t)},"Matrix, number, string":function(e,t,n){return o(e,t,e.size(),n)},"Matrix, BigNumber, string":function(e,t,n){return o(e,t.toNumber(),e.size(),n)}});function o(e,t,o,a){if(!ye(t))throw new TypeError("Second parameter in function diag must be an integer");const s=t>0?t:0,u=t<0?-t:0;switch(o.length){case 1:return function(e,t,n,o,a,s){const u=[o+a,o+s];if(n&&"sparse"!==n&&"dense"!==n)throw new TypeError(`Unknown matrix type ${n}"`);const c="sparse"===n?i.diagonal(u,e,t):r.diagonal(u,e,t);return null!==n?c:c.valueOf()}(e,t,a,o[0],u,s);case 2:return function(e,t,r,i,o,a){if(E(e)){const i=e.diagonal(t);return null!==r?r!==i.storage()?n(i,r):i:i.valueOf()}const s=Math.min(i[0]-o,i[1]-a),u=[];for(let t=0;t{let{typed:t}=e;return t("filter",{"Array, function":Hs,"Matrix, function":function(e,t){return e.create(Hs(e.valueOf(),t),e.datatype())},"Array, RegExp":Pr,"Matrix, RegExp":function(e,t){return e.create(Pr(e.valueOf(),t),e.datatype())}})}));function Hs(e,t){const n=Qr(t,e,"filter");return n.isUnary?qr(e,n.fn):qr(e,(function(e,t,r){return n.fn(e,[t],r)}))}const Gs="flatten",Vs=he(Gs,["typed"],(e=>{let{typed:t}=e;return t(Gs,{Array:function(e){return zr(e)},Matrix:function(e){return e.create(zr(e.valueOf(),!0),e.datatype())}})})),Zs="forEach",Ws=he(Zs,["typed"],(e=>{let{typed:t}=e;return t(Zs,{"Array, function":Ys,"Matrix, function":function(e,t){e.forEach(t)}})}));function Ys(e,t){const n=Qr(t,e,Zs);Xr(e,n.fn,n.isUnary)}const Js="getMatrixDataType",Xs=he(Js,["typed"],(e=>{let{typed:t}=e;return t(Js,{Array:function(e){return $r(e,oe)},Matrix:function(e){return e.getDataType()}})})),Qs="identity",Ks=he(Qs,["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],(e=>{let{typed:t,config:n,matrix:r,BigNumber:i,DenseMatrix:o,SparseMatrix:a}=e;return t(Qs,{"":function(){return"Matrix"===n.matrix?r([]):[]},string:function(e){return r(e)},"number | BigNumber":function(e){return u(e,e,"Matrix"===n.matrix?"dense":void 0)},"number | BigNumber, string":function(e,t){return u(e,e,t)},"number | BigNumber, number | BigNumber":function(e,t){return u(e,t,"Matrix"===n.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(e,t,n){return u(e,t,n)},Array:function(e){return s(e)},"Array, string":function(e,t){return s(e,t)},Matrix:function(e){return s(e.valueOf(),e.storage())},"Matrix, string":function(e,t){return s(e.valueOf(),t)}});function s(e,t){switch(e.length){case 0:return t?r(t):[];case 1:return u(e[0],e[0],t);case 2:return u(e[0],e[1],t);default:throw new Error("Vector containing two values expected")}}function u(e,t,n){const r=g(e)||g(t)?i:null;if(g(e)&&(e=e.toNumber()),g(t)&&(t=t.toNumber()),!ye(e)||e<1)throw new Error("Parameters in function identity must be positive integers");if(!ye(t)||t<1)throw new Error("Parameters in function identity must be positive integers");const s=r?new i(1):1,u=r?new r(0):0,c=[e,t];if(n){if("sparse"===n)return a.diagonal(c,s,0,u);if("dense"===n)return o.diagonal(c,s,0,u);throw new TypeError(`Unknown matrix type "${n}"`)}const l=Mr([],c,u),f=e{let{typed:t,matrix:n,multiplyScalar:r}=e;return t(eu,{"Matrix, Matrix":function(e,t){return n(i(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return n(i(e.toArray(),t))},"Array, Matrix":function(e,t){return n(i(e,t.toArray()))},"Array, Array":i});function i(e,t){if(1===vr(e).length&&(e=[e]),1===vr(t).length&&(t=[t]),vr(e).length>2||vr(t).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(e.length)+", y = "+JSON.stringify(t.length)+")");const n=[];let i=[];return e.map((function(e){return t.map((function(t){return i=[],n.push(i),e.map((function(e){return t.map((function(t){return i.push(r(e,t))}))}))}))}))&&n}})),nu="map",ru=he(nu,["typed"],(e=>{let{typed:t}=e;return t(nu,{"Array, function":n,"Matrix, function":function(e,t){return e.map(t)},"Array|Matrix, Array|Matrix, ...Array|Matrix|function":(e,r,i)=>function(e,r){if("function"!=typeof r)throw new Error("Last argument must be a callback function");const i=e[0].isMatrix,o=Vr(...e.map((e=>e.isMatrix?e.size():vr(e)))),a=i?(e,t)=>e.get(t):Yr,s=i?e.map((t=>t.isMatrix?t.create(Wr(t.toArray(),o),t.datatype()):e[0].create(Wr(t.valueOf(),o)))):e.map((e=>e.isMatrix?Wr(e.toArray(),o):Wr(e,o)));let u;if(t.isTypedFunction(r)){const e=o.map((()=>0)),n=s.map((t=>a(t,e))),i=function(e,n,r,i){return null!==t.resolve(e,[...n,r,...i])?2:null!==t.resolve(e,[...n,r])?1:(t.resolve(e,n),0)}(r,n,e,s);u=l(i)}else{const t=e.length,n=function(e,t){return e.length>t+1?2:e.length===t+1?1:0}(r,t);u=l(n)}const c=(e,t)=>u([e,...s.slice(1).map((e=>a(e,t)))],t);return i?s[0].map(c):n(s[0],c);function l(e){switch(e){case 0:return e=>r(...e);case 1:return(e,t)=>r(...e,t);case 2:return(e,t)=>r(...e,t,...s)}}}([e,r,...i.slice(0,i.length-1)],i[i.length-1])});function n(e,t){const n=Qr(t,e,nu);return Jr(e,n.fn,n.isUnary)}})),iu="diff",ou=he(iu,["typed","matrix","subtract","number"],(e=>{let{typed:t,matrix:n,subtract:r,number:i}=e;return t(iu,{"Array | Matrix":function(e){return E(e)?n(a(e.toArray())):a(e)},"Array | Matrix, number":function(e,t){if(!ye(t))throw new RangeError("Dimension must be a whole number");return E(e)?n(o(e.toArray(),t)):o(e,t)},"Array, BigNumber":t.referTo("Array,number",(e=>(t,n)=>e(t,i(n)))),"Matrix, BigNumber":t.referTo("Matrix,number",(e=>(t,n)=>e(t,i(n))))});function o(e,t){if(E(e)&&(e=e.toArray()),!Array.isArray(e))throw RangeError("Array/Matrix does not have that many dimensions");if(t>0){const n=[];return e.forEach((e=>{n.push(o(e,t-1))})),n}if(0===t)return a(e);throw RangeError("Cannot have negative dimension")}function a(e){const t=[],n=e.length;for(let r=1;r{let{typed:t,config:n,matrix:r,BigNumber:i}=e;return t("ones",{"":function(){return"Array"===n.matrix?o([]):o([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){const t=e.pop();return o(e,t)}return"Array"===n.matrix?o(e):o(e,"default")},Array:o,Matrix:function(e){const t=e.storage();return o(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return o(e.valueOf(),t)}});function o(e,t){const n=function(e){let t=!1;return e.forEach((function(e,n,r){g(e)&&(t=!0,r[n]=e.toNumber())})),t}(e),o=n?new i(1):1;if(function(e){e.forEach((function(e){if("number"!=typeof e||!ye(e)||e<0)throw new Error("Parameters in function ones must be positive integers")}))}(e),t){const n=r(t);return e.length>0?n.resize(e,o):n}{const t=[];return e.length>0?Mr(t,e,o):t}}}));function su(){throw new Error('No "bignumber" implementation available')}function uu(){throw new Error('No "fraction" implementation available')}function cu(){throw new Error('No "matrix" implementation available')}const lu="range",fu=he(lu,["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],(e=>{let{typed:t,config:n,matrix:r,bignumber:i,smaller:o,smallerEq:a,larger:s,largerEq:u,add:c,isPositive:l}=e;return t(lu,{string:p,"string, boolean":p,number:function(e){throw new TypeError(`Too few arguments to function range(): ${e}`)},boolean:function(e){throw new TypeError(`Unexpected type of argument 1 to function range(): ${e}, number|bigint|BigNumber|Fraction`)},"number, number":function(e,t){return f(m(e,t,1,!1))},"number, number, number":function(e,t,n){return f(m(e,t,n,!1))},"number, number, boolean":function(e,t,n){return f(m(e,t,1,n))},"number, number, number, boolean":function(e,t,n,r){return f(m(e,t,n,r))},"bigint, bigint|number":function(e,t){return f(m(e,t,1n,!1))},"number, bigint":function(e,t){return f(m(BigInt(e),t,1n,!1))},"bigint, bigint|number, bigint|number":function(e,t,n){return f(m(e,t,BigInt(n),!1))},"number, bigint, bigint|number":function(e,t,n){return f(m(BigInt(e),t,BigInt(n),!1))},"bigint, bigint|number, boolean":function(e,t,n){return f(m(e,t,1n,n))},"number, bigint, boolean":function(e,t,n){return f(m(BigInt(e),t,1n,n))},"bigint, bigint|number, bigint|number, boolean":function(e,t,n,r){return f(m(e,t,BigInt(n),r))},"number, bigint, bigint|number, boolean":function(e,t,n,r){return f(m(BigInt(e),t,BigInt(n),r))},"BigNumber, BigNumber":function(e,t){return f(m(e,t,new(0,e.constructor)(1),!1))},"BigNumber, BigNumber, BigNumber":function(e,t,n){return f(m(e,t,n,!1))},"BigNumber, BigNumber, boolean":function(e,t,n){return f(m(e,t,new(0,e.constructor)(1),n))},"BigNumber, BigNumber, BigNumber, boolean":function(e,t,n,r){return f(m(e,t,n,r))},"Fraction, Fraction":function(e,t){return f(m(e,t,1,!1))},"Fraction, Fraction, Fraction":function(e,t,n){return f(m(e,t,n,!1))},"Fraction, Fraction, boolean":function(e,t,n){return f(m(e,t,1,n))},"Fraction, Fraction, Fraction, boolean":function(e,t,n,r){return f(m(e,t,n,r))},"Unit, Unit, Unit":function(e,t,n){return f(m(e,t,n,!1))},"Unit, Unit, Unit, boolean":function(e,t,n,r){return f(m(e,t,n,r))}});function f(e){return"Matrix"===n.matrix?r?r(e):cu():e}function p(e,t){const r=function(e){const t=e.split(":").map((function(e){return Number(e)}));if(t.some((function(e){return isNaN(e)})))return null;switch(t.length){case 2:return{start:t[0],end:t[1],step:1};case 3:return{start:t[0],end:t[2],step:t[1]};default:return null}}(e);if(!r)throw new SyntaxError('String "'+e+'" is no valid range');return"BigNumber"===n.number?(void 0===i&&su(),f(m(i(r.start),i(r.end),i(r.step)))):f(m(r.start,r.end,r.step,t))}function m(e,t,n,r){const i=[],f=l(n)?r?a:o:r?u:s;let p=e;for(;f(p,t);)i.push(p),p=c(p,n);return i}})),pu="reshape",mu=he(pu,["typed","isInteger","matrix"],(e=>{let{typed:t,isInteger:n}=e;return t(pu,{"Matrix, Array":function(e,t){return e.reshape(t,!0)},"Array, Array":function(e,t){return t.forEach((function(e){if(!n(e))throw new TypeError("Invalid size for dimension: "+e)})),Tr(e,t)}})})),hu=he("resize",["config","matrix"],(e=>{let{config:t,matrix:n}=e;return function(e,r,i){if(2!==arguments.length&&3!==arguments.length)throw new ga("resize",arguments.length,2,3);if(E(r)&&(r=r.valueOf()),g(r[0])&&(r=r.map((function(e){return g(e)?e.toNumber():e}))),E(e))return e.resize(r,i,!0);if("string"==typeof e)return function(e,t,n){if(void 0!==n){if("string"!=typeof n||1!==n.length)throw new TypeError("Single character expected as defaultValue")}else n=" ";if(1!==t.length)throw new xr(t.length,1);const r=t[0];if("number"!=typeof r||!ye(r))throw new TypeError("Invalid size, must contain positive integers (size: "+pr(t)+")");if(e.length>r)return e.substring(0,r);if(e.length{let{typed:t,multiply:n,rotationMatrix:r}=e;return t(du,{"Array , number | BigNumber | Complex | Unit":function(e,t){return i(e,2),n(r(t),e).toArray()},"Matrix , number | BigNumber | Complex | Unit":function(e,t){return i(e,2),n(r(t),e)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(e,t,o){return i(e,3),n(r(t,o),e)},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(e,t,o){return i(e,3),n(r(t,o),e)}});function i(e,t){const n=Array.isArray(e)?vr(e):e.size();if(n.length>2)throw new RangeError(`Vector must be of dimensions 1x${t}`);if(2===n.length&&1!==n[1])throw new RangeError(`Vector must be of dimensions 1x${t}`);if(n[0]!==t)throw new RangeError(`Vector must be of dimensions 1x${t}`)}})),yu="rotationMatrix",xu=he(yu,["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],(e=>{let{typed:t,config:n,multiplyScalar:r,addScalar:i,unaryMinus:o,norm:a,BigNumber:s,matrix:u,DenseMatrix:c,SparseMatrix:l,cos:f,sin:p}=e;return t(yu,{"":function(){return"Matrix"===n.matrix?u([]):[]},string:function(e){return u(e)},"number | BigNumber | Complex | Unit":function(e){return m(e,"Matrix"===n.matrix?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(e,t){return m(e,t)},"number | BigNumber | Complex | Unit, Array":function(e,t){const n=u(t);return h(n),x(e,n,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(e,t){h(t);const r=t.storage()||("Matrix"===n.matrix?"dense":void 0);return x(e,t,r)},"number | BigNumber | Complex | Unit, Array, string":function(e,t,n){const r=u(t);return h(r),x(e,r,n)},"number | BigNumber | Complex | Unit, Matrix, string":function(e,t,n){return h(t),x(e,t,n)}});function m(e,t){const n=g(e)?new s(-1):-1,i=f(e),o=p(e);return y([[i,r(n,o)],[o,i]],t)}function h(e){const t=e.size();if(t.length<1||3!==t[0])throw new RangeError("Vector must be of dimensions 1x3")}function d(e){return e.reduce(((e,t)=>r(e,t)))}function y(e,t){if(t){if("sparse"===t)return new l(e);if("dense"===t)return new c(e);throw new TypeError(`Unknown matrix type "${t}"`)}return e}function x(e,t,n){const r=a(t);if(0===r)throw new RangeError("Rotation around zero vector");const u=g(e)?s:null,c=u?new u(1):1,l=u?new u(-1):-1,m=u?new u(t.get([0])/r):t.get([0])/r,h=u?new u(t.get([1])/r):t.get([1])/r,x=u?new u(t.get([2])/r):t.get([2])/r,b=f(e),v=i(c,o(b)),w=p(e);return y([[i(b,d([m,m,v])),i(d([m,h,v]),d([l,x,w])),i(d([m,x,v]),d([h,w]))],[i(d([m,h,v]),d([x,w])),i(b,d([h,h,v])),i(d([h,x,v]),d([l,m,w]))],[i(d([m,x,v]),d([l,h,w])),i(d([h,x,v]),d([m,w])),i(b,d([x,x,v]))]],n)}})),bu=he("row",["typed","Index","matrix","range"],(e=>{let{typed:t,Index:n,matrix:r,range:i}=e;return t("row",{"Matrix, number":o,"Array, number":function(e,t){return o(r(ae(e)),t).valueOf()}});function o(e,t){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");Ar(t,e.size()[0]);const o=i(0,e.size()[1]),a=new n(t,o),s=e.subset(a);return E(s)?s:r([[s]])}})),vu="size",wu=he(vu,["typed","config","?matrix"],(e=>{let{typed:t,config:n,matrix:r}=e;return t(vu,{Matrix:function(e){return e.create(e.size(),"number")},Array:vr,string:function(e){return"Array"===n.matrix?[e.length]:r([e.length],"dense","number")},"number | Complex | BigNumber | Unit | boolean | null":function(e){return"Array"===n.matrix?[]:r?r([],"dense","number"):cu()}})})),Nu="squeeze",Eu=he(Nu,["typed"],(e=>{let{typed:t}=e;return t(Nu,{Array:function(e){return Fr(ae(e))},Matrix:function(e){const t=Fr(e.toArray());return Array.isArray(t)?e.create(t,e.datatype()):t},any:function(e){return ae(e)}})})),Au="subset",Su=he(Au,["typed","matrix","zeros","add"],(e=>{let{typed:t,matrix:n,zeros:r,add:i}=e;return t(Au,{"Matrix, Index":function(e,t){return Sr(t)?n():(Er(e,t),e.subset(t))},"Array, Index":t.referTo("Matrix, Index",(function(e){return function(t,r){const i=e(n(t),r);return r.isScalar()?i:i.valueOf()}})),"Object, Index":Tu,"string, Index":Mu,"Matrix, Index, any, any":function(e,t,n,o){return Sr(t)?e:(Er(e,t),e.clone().subset(t,function(e,t){if("string"==typeof e)throw new Error("can't boradcast a string");if(t._isScalar)return e;const n=t.size();if(!n.every((e=>e>0)))return e;try{return i(e,r(n))}catch(t){return e}}(n,t),o))},"Array, Index, any, any":t.referTo("Matrix, Index, any, any",(function(e){return function(t,r,i,o){const a=e(n(t),r,i,o);return a.isMatrix?a.valueOf():a}})),"Array, Index, any":t.referTo("Matrix, Index, any, any",(function(e){return function(t,r,i){return e(n(t),r,i,void 0).valueOf()}})),"Matrix, Index, any":t.referTo("Matrix, Index, any, any",(function(e){return function(t,n,r){return e(t,n,r,void 0)}})),"string, Index, string":Cu,"string, Index, string, string":Cu,"Object, Index, any":Bu})}));function Mu(e,t){if(!T(t))throw new TypeError("Index expected");if(Sr(t))return"";if(Er(Array.from(e),t),1!==t.size().length)throw new xr(t.size().length,1);const n=e.length;Ar(t.min()[0],n),Ar(t.max()[0],n);const r=t.dimension(0);let i="";return r.forEach((function(t){i+=e.charAt(t)})),i}function Cu(e,t,n,r){if(!t||!0!==t.isIndex)throw new TypeError("Index expected");if(Sr(t))return e;if(Er(Array.from(e),t),1!==t.size().length)throw new xr(t.size().length,1);if(void 0!==r){if("string"!=typeof r||1!==r.length)throw new TypeError("Single character expected as defaultValue")}else r=" ";const i=t.dimension(0);if(i.size()[0]!==n.length)throw new xr(i.size()[0],n.length);const o=e.length;Ar(t.min()[0]),Ar(t.max()[0]);const a=[];for(let t=0;to)for(let e=o-1,t=a.length;e{let{typed:t,matrix:n}=e;return t(Du,{Array:e=>r(n(e)).valueOf(),Matrix:r,any:ae});function r(e){const t=e.size();let n;switch(t.length){case 1:n=e.clone();break;case 2:{const r=t[0],i=t[1];if(0===i)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+pr(t)+")");switch(e.storage()){case"dense":n=function(e,t,n){const r=e._data,i=[];let o;for(let e=0;e{let{typed:t,transpose:n,conj:r}=e;return t(Ou,{any:function(e){return r(n(e))}})})),Iu="zeros",zu=he(Iu,["typed","config","matrix","BigNumber"],(e=>{let{typed:t,config:n,matrix:r,BigNumber:i}=e;return t(Iu,{"":function(){return"Array"===n.matrix?o([]):o([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){const t=e.pop();return o(e,t)}return"Array"===n.matrix?o(e):o(e,"default")},Array:o,Matrix:function(e){const t=e.storage();return o(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return o(e.valueOf(),t)}});function o(e,t){const n=function(e){let t=!1;return e.forEach((function(e,n,r){g(e)&&(t=!0,r[n]=e.toNumber())})),t}(e),o=n?new i(0):0;if(function(e){e.forEach((function(e){if("number"!=typeof e||!ye(e)||e<0)throw new Error("Parameters in function zeros must be positive integers")}))}(e),t){const n=r(t);return e.length>0?n.resize(e,o):n}{const t=[];return e.length>0?Mr(t,e,o):t}}})),ku=he("fft",["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],(e=>{let{typed:t,matrix:n,addScalar:r,multiplyScalar:i,divideScalar:o,exp:a,tau:s,i:u,dotDivide:c,conj:l,pow:f,ceil:p,log2:m}=e;return t("fft",{Array:h,Matrix:function(e){return e.create(h(e.valueOf()),e.datatype())}});function h(e){const t=vr(e);return 1===t.length?g(e,t[0]):d(e.map((e=>h(e,t.slice(1)))),0)}function d(e,t){const n=vr(e);if(0!==t)return new Array(n[0]).fill(0).map(((n,r)=>d(e[r],t-1)));if(1===n.length)return g(e);function r(e){const t=vr(e);return new Array(t[1]).fill(0).map(((n,r)=>new Array(t[0]).fill(0).map(((t,n)=>e[n][r]))))}return r(d(r(e),1))}function g(e){const t=e.length;if(1===t)return[e[0]];if(t%2==0){const n=[...g(e.filter(((e,t)=>t%2==0))),...g(e.filter(((e,t)=>t%2==1)))];for(let e=0;ei(e[o],r[t-1+o]))),...new Array(d-t).fill(0)],x=[...new Array(t+t-1).fill(0).map(((e,t)=>o(1,r[t]))),...new Array(d-(t+t-1)).fill(0)],b=g(y),v=g(x),w=new Array(d).fill(0).map(((e,t)=>i(b[t],v[t]))),N=c(l(h(l(w))),d),E=[];for(let e=t-1;e{let{typed:t,fft:n,dotDivide:r,conj:i}=e;return t(Ru,{"Array | Matrix":function(e){const t=E(e)?e.size():vr(e);return r(i(n(i(e))),t.reduce(((e,t)=>e*t),1))}})})),Pu=he("solveODE",["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],(e=>{let{typed:t,add:n,subtract:r,multiply:i,divide:o,max:a,map:s,abs:u,isPositive:c,isNegative:l,larger:f,smaller:p,matrix:m,bignumber:h,unaryMinus:y}=e;function x(e){return function(t,m,d,x){if(2!==m.length||!m.every(E)&&!m.every(v))throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');const b=m[0],w=m[1],N=f(w,b),A=x.firstStep;if(void 0!==A&&!c(A))throw new Error('"firstStep" must be positive');const S=x.maxStep;if(void 0!==S&&!c(S))throw new Error('"maxStep" must be positive');const M=x.minStep;if(M&&l(M))throw new Error('"minStep" must be positive or zero');const C=[b,w,A,M,S].filter((e=>void 0!==e));if(!C.every(E)&&!C.every(v))throw new Error('Inconsistent type of "t" dependant variables');const T=x.tol?x.tol:1e-4,B=x.minDelta?x.minDelta:.2,D=x.maxDelta?x.maxDelta:5,F=x.maxIter?x.maxIter:1e4,O=[b,w,...d,S,M].some(g),[_,I,z,k]=O?[h(e.a),h(e.c),h(e.b),h(e.bp)]:[e.a,e.c,e.b,e.bp];let R=A?N?A:y(A):o(r(w,b),1);const q=[b],P=[d],j=r(z,k);let U=0,L=0;const $=function(e){return e?p:f}(N),H=function(e){const t=e?f:p;return function(e,i,o){const a=n(e,o);return t(a,i)?r(i,e):o}}(N);for(;$(q[U],w);){const e=[];R=H(q[U],w,R),e.push(t(q[U],P[U]));for(let r=1;rv(e)?e.value:e))));r1/4&&(q.push(n(q[U],R)),P.push(n(P[U],i(R,z,e))),U++);let o=.84*(T/r)**.2;if(p(o,B)?o=B:f(o,D)&&(o=D),o=O?h(o):o,R=i(R,o),S&&f(u(R),S)?R=N?S:y(S):M&&p(u(R),M)&&(R=N?M:y(M)),L++,L>F)throw new Error("Maximum number of iterations reached, try changing options")}return{t:q,y:P}}}function b(e,t,n,r){return x({a:[[],[.5],[0,3/4],[2/9,1/3,4/9]],c:[null,.5,3/4,1],b:[2/9,1/3,4/9,0],bp:[7/24,1/4,1/3,1/8]})(e,t,n,r)}function w(e,t,n,r){return x({a:[[],[.2],[3/40,9/40],[44/45,-56/15,32/9],[19372/6561,-25360/2187,64448/6561,-212/729],[9017/3168,-355/33,46732/5247,49/176,-5103/18656],[35/384,0,500/1113,125/192,-2187/6784,11/84]],c:[null,.2,.3,.8,8/9,1,1],b:[35/384,0,500/1113,125/192,-2187/6784,11/84,0],bp:[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40]})(e,t,n,r)}function N(e,t,n,r){const i=r.method?r.method:"RK45",o={RK23:b,RK45:w};if(i.toUpperCase()in o){const a={...r};return delete a.method,o[i.toUpperCase()](e,t,n,a)}{const e=Object.keys(o).map((e=>`"${e}"`)),t=`${e.slice(0,-1).join(", ")} and ${e.slice(-1)}`;throw new Error(`Unavailable method "${i}". Available methods are ${t}`)}}function E(e){return g(e)||d(e)}function A(e,t,n,r){const i=N(e,t.toArray(),n.toArray(),r);return{t:m(i.t),y:m(i.y)}}return t("solveODE",{"function, Array, Array, Object":N,"function, Matrix, Matrix, Object":A,"function, Array, Array":(e,t,n)=>N(e,t,n,{}),"function, Matrix, Matrix":(e,t,n)=>A(e,t,n,{}),"function, Array, number | BigNumber | Unit":(e,t,n)=>{const r=N(e,t,[n],{});return{t:r.t,y:r.y.map((e=>e[0]))}},"function, Matrix, number | BigNumber | Unit":(e,t,n)=>{const r=N(e,t.toArray(),[n],{});return{t:m(r.t),y:m(r.y.map((e=>e[0])))}},"function, Array, number | BigNumber | Unit, Object":(e,t,n,r)=>{const i=N(e,t,[n],r);return{t:i.t,y:i.y.map((e=>e[0]))}},"function, Matrix, number | BigNumber | Unit, Object":(e,t,n,r)=>{const i=N(e,t.toArray(),[n],r);return{t:m(i.t),y:m(i.y.map((e=>e[0])))}}})})),ju=he("erf",["typed"],(e=>{let{typed:t}=e;return t("name",{number:function(e){const t=Math.abs(e);return t>=Gu?be(e):t<=Uu?be(e)*function(e){const t=e*e;let n,r=$u[0][4]*t,i=t;for(n=0;n<3;n+=1)r=(r+$u[0][n])*t,i=(i+Hu[0][n])*t;return e*(r+$u[0][3])/(i+Hu[0][3])}(t):t<=4?be(e)*(1-function(e){let t,n=$u[1][8]*e,r=e;for(t=0;t<7;t+=1)n=(n+$u[1][t])*e,r=(r+Hu[1][t])*e;const i=(n+$u[1][7])/(r+Hu[1][7]),o=parseInt(16*e)/16,a=(e-o)*(e+o);return Math.exp(-o*o)*Math.exp(-a)*i}(t)):be(e)*(1-function(e){let t,n=1/(e*e),r=$u[2][5]*n,i=n;for(t=0;t<4;t+=1)r=(r+$u[2][t])*n,i=(i+Hu[2][t])*n;let o=n*(r+$u[2][4])/(i+Hu[2][4]);o=(Lu-o)/e,n=parseInt(16*e)/16;const a=(e-n)*(e+n);return Math.exp(-n*n)*Math.exp(-a)*o}(t))},"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),Uu=.46875,Lu=.5641895835477563,$u=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,2.1531153547440383e-8],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],Hu=[[23.601290952344122,244.02463793444417,1282.6165260773723,2844.236833439171],[15.744926110709835,117.6939508913125,537.1811018620099,1621.3895745666903,3290.7992357334597,4362.619090143247,3439.3676741437216,1230.3393548037495],[2.568520192289822,1.8729528499234604,.5279051029514285,.06051834131244132,.0023352049762686918]],Gu=Math.pow(2,53),Vu="zeta",Zu=he(Vu,["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],(e=>{let{typed:t,config:n,multiply:r,pow:i,divide:o,factorial:a,equal:s,smallerEq:u,isNegative:c,gamma:l,sin:f,subtract:p,add:m,Complex:h,BigNumber:d,pi:g}=e;return t(Vu,{number:e=>y(e,(e=>e),(()=>20)),BigNumber:e=>y(e,(e=>new d(e)),(()=>Math.abs(Math.log10(n.relTol)))),Complex:function(e){return 0===e.re&&0===e.im?new h(-.5):1===e.re?new h(NaN,NaN):e.re===1/0&&0===e.im?new h(1):e.im===1/0||e.re===-1/0?new h(NaN,NaN):x(e,(e=>e),(e=>Math.round(19.5+.9*Math.abs(e.im))),(e=>e.re))}});function y(e,t,n){return s(e,0)?t(-.5):s(e,1)?t(NaN):isFinite(e)?x(e,t,n,(e=>e)):c(e)?t(NaN):t(1)}function x(e,t,n,a){const s=n(e);if(a(e)>-(s-1)/2)return function(e,t,n){const a=o(1,r(b(n(0),t),p(1,i(2,p(1,e)))));let s=n(0);for(let a=n(1);u(a,t);a=m(a,1))s=m(s,o(r((-1)**(a-1),b(a,t)),i(a,e)));return r(a,s)}(e,t(s),t);{let s=r(i(2,e),i(t(g),p(e,1)));return s=r(s,f(r(o(t(g),2),e))),s=r(s,l(p(1,e))),r(s,x(p(1,e),t,n,a))}}function b(e,t){let n=e;for(let s=e;u(s,t);s=m(s,1)){const e=o(r(a(m(t,p(s,1))),i(4,s)),r(a(p(t,s)),a(r(2,s))));n=m(n,e)}return r(t,n)}})),Wu="mode",Yu=he(Wu,["typed","isNaN","isNumeric"],(e=>{let{typed:t,isNaN:n,isNumeric:r}=e;return t(Wu,{"Array | Matrix":i,"...":function(e){return i(e)}});function i(e){if(0===(e=zr(e.valueOf())).length)throw new Error("Cannot calculate mode of an empty array");const t={};let i=[],o=0;for(let a=0;ao&&(o=t[s],i=[s])}return i}}));function Ju(e,t,n){let r;return String(e).includes("Unexpected type")?(r=arguments.length>2?" (type: "+oe(n)+", value: "+JSON.stringify(n)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+t+", unexpected type of argument"+r)):String(e).includes("complex numbers")?(r=arguments.length>2?" (type: "+oe(n)+", value: "+JSON.stringify(n)+")":"",new TypeError("Cannot calculate "+t+", no ordering relation is defined for complex numbers"+r)):e}const Xu="prod",Qu=he(Xu,["typed","config","multiplyScalar","numeric"],(e=>{let{typed:t,config:n,multiplyScalar:r,numeric:i}=e;return t(Xu,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("prod(A, dim) is not yet supported")},"...":function(e){return o(e)}});function o(e){let t;if(ai(e,(function(e){try{t=void 0===t?e:r(t,e)}catch(t){throw Ju(t,"prod",e)}})),"string"==typeof t&&(t=i(t,xe(t,n))),void 0===t)throw new Error("Cannot calculate prod of an empty array");return t}})),Ku="format",ec=he(Ku,["typed"],(e=>{let{typed:t}=e;return t(Ku,{any:pr,"any, Object | function | number | BigNumber":pr})})),tc=he("bin",["typed","format"],(e=>{let{typed:t,format:n}=e;return t("bin",{"number | BigNumber":function(e){return n(e,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(e,t){return n(e,{notation:"bin",wordSize:t})}})})),nc=he("oct",["typed","format"],(e=>{let{typed:t,format:n}=e;return t("oct",{"number | BigNumber":function(e){return n(e,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(e,t){return n(e,{notation:"oct",wordSize:t})}})})),rc=he("hex",["typed","format"],(e=>{let{typed:t,format:n}=e;return t("hex",{"number | BigNumber":function(e){return n(e,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(e,t){return n(e,{notation:"hex",wordSize:t})}})})),ic=/\$([\w.]+)/g,oc="print",ac=he(oc,["typed"],(e=>{let{typed:t}=e;return t(oc,{"string, Object | Array":sc,"string, Object | Array, number | Object":sc})}));function sc(e,t,n){return e.replace(ic,(function(e,r){const i=r.split(".");let o=t[i.shift()];for(void 0!==o&&o.isMatrix&&(o=o.toArray());i.length&&void 0!==o;){const e=i.shift();o=e?o[e]:o+"."}return void 0!==o?w(o)?o:pr(o,n):e}))}const uc=he("to",["typed","matrix","concat"],(e=>{let{typed:t,matrix:n,concat:r}=e;return t("to",{"Unit, Unit | string":(e,t)=>e.to(t)},fa({typed:t,matrix:n,concat:r})({Ds:!0}))})),cc="isPrime",lc=he(cc,["typed"],(e=>{let{typed:t}=e;return t(cc,{number:function(e){if(e<=3)return e>1;if(e%2==0||e%3==0)return!1;for(let t=5;t*t<=e;t+=6)if(e%t==0||e%(t+2)==0)return!1;return!0},bigint:function(e){if(e<=3n)return e>1n;if(e%2n===0n||e%3n===0n)return!1;for(let t=5n;t*t<=e;t+=6n)if(e%t===0n||e%(t+2n)===0n)return!1;return!0},BigNumber:function(e){if(e.lte(3))return e.gt(1);if(e.mod(2).eq(0)||e.mod(3).eq(0))return!1;if(e.lt(Math.pow(2,32))){const t=e.toNumber();for(let e=5;e*e<=t;e+=6)if(t%e==0||t%(e+2)==0)return!1;return!0}function t(e,t,n){let r=1;for(;!t.eq(0);)t.mod(2).eq(0)?(t=t.div(2),e=e.mul(e).mod(n)):(t=t.sub(1),r=e.mul(r).mod(n));return r}const n=e.constructor.clone({precision:2*e.toFixed(0).length});let r=0,i=(e=new n(e)).sub(1);for(;i.mod(2).eq(0);)i=i.div(2),r+=1;let o=null;if(e.lt("3317044064679887385961981"))o=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter((t=>tt=>si(t,e)))})})),fc=he("numeric",["number","?bignumber","?fraction"],(e=>{let{number:t,bignumber:n,fraction:r}=e;const i={string:!0,number:!0,BigNumber:!0,Fraction:!0},o={number:e=>t(e),BigNumber:n?e=>n(e):su,bigint:e=>BigInt(e),Fraction:r?e=>r(e):uu};return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number";if(void 0!==(arguments.length>2?arguments[2]:void 0))throw new SyntaxError("numeric() takes one or two arguments");const n=oe(e);if(!(n in i))throw new TypeError("Cannot convert "+e+' of type "'+n+'"; valid input types are '+Object.keys(i).join(", "));if(!(t in o))throw new TypeError("Cannot convert "+e+' to type "'+t+'"; valid output types are '+Object.keys(o).join(", "));return t===n?e:o[t](e)}})),pc="divideScalar",mc=he(pc,["typed","numeric"],(e=>{let{typed:t,numeric:n}=e;return t(pc,{"number, number":function(e,t){return e/t},"Complex, Complex":function(e,t){return e.div(t)},"BigNumber, BigNumber":function(e,t){return e.div(t)},"bigint, bigint":function(e,t){return e/t},"Fraction, Fraction":function(e,t){return e.div(t)},"Unit, number | Complex | Fraction | BigNumber | Unit":(e,t)=>e.divide(t),"number | Fraction | Complex | BigNumber, Unit":(e,t)=>t.divideInto(e)})})),hc=he("pow",["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],(e=>{let{typed:t,config:n,identity:r,multiply:i,matrix:o,inv:a,number:s,fraction:u,Complex:c}=e;return t("pow",{"number, number":l,"Complex, Complex":function(e,t){return e.pow(t)},"BigNumber, BigNumber":function(e,t){return t.isInteger()||e>=0||n.predictable?e.pow(t):new c(e.toNumber(),0).pow(t.toNumber(),0)},"bigint, bigint":(e,t)=>e**t,"Fraction, Fraction":function(e,t){const r=e.pow(t);if(null!=r)return r;if(n.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return l(e.valueOf(),t.valueOf())},"Array, number":f,"Array, BigNumber":function(e,t){return f(e,t.toNumber())},"Matrix, number":p,"Matrix, BigNumber":function(e,t){return p(e,t.toNumber())},"Unit, number | BigNumber":function(e,t){return e.pow(t)}});function l(e,t){if(n.predictable&&!ye(t)&&e<0)try{const n=u(t),r=s(n);if((t===r||Math.abs((t-r)/t)<1e-14)&&n.d%2n===1n)return(n.n%2n===0n?1:-1)*Math.pow(-e,t)}catch(e){}return n.predictable&&(e<-1&&t===1/0||e>-1&&e<0&&t===-1/0)?NaN:ye(t)||e>=0||n.predictable?No(e,t):e*e<1&&t===1/0||e*e>1&&t===-1/0?0:new c(e,0).pow(t,0)}function f(e,t){if(!ye(t))throw new TypeError("For A^b, b must be an integer (value is "+t+")");const n=vr(e);if(2!==n.length)throw new Error("For A^b, A must be 2 dimensional (A has "+n.length+" dimensions)");if(n[0]!==n[1])throw new Error("For A^b, A must be square (size is "+n[0]+"x"+n[1]+")");if(t<0)try{return f(a(e),-t)}catch(e){if("Cannot calculate inverse, determinant is zero"===e.message)throw new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+t+")");throw e}let o=r(n[0]).valueOf(),s=e;for(;t>=1;)1&~t||(o=i(s,o)),t>>=1,s=i(s,s);return o}function p(e,t){return o(f(e.valueOf(),t))}})),dc="Number of decimals in function round must be an integer",gc="round",yc=he(gc,["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],(e=>{let{typed:t,config:n,matrix:r,equalScalar:i,zeros:o,BigNumber:a,DenseMatrix:s}=e;const u=qo({typed:t,equalScalar:i}),c=Po({typed:t,DenseMatrix:s}),l=jo({typed:t});function f(e){return Math.abs(Te(e).exponent)}return t(gc,{number:function(e){const t=Eo(e,f(n.relTol));return Eo(_e(e,t,n.relTol,n.absTol)?t:e)},"number, number":function(e,t){const r=f(n.relTol);if(t>=r)return Eo(e,t);const i=Eo(e,r);return Eo(_e(e,i,n.relTol,n.absTol)?i:e,t)},"number, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(dc);return new a(e).toDecimalPlaces(t.toNumber())},Complex:function(e){return e.round()},"Complex, number":function(e,t){if(t%1)throw new TypeError(dc);return e.round(t)},"Complex, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(dc);const n=t.toNumber();return e.round(n)},BigNumber:function(e){const t=new a(e).toDecimalPlaces(f(n.relTol));return(yi(e,t,n.relTol,n.absTol)?t:e).toDecimalPlaces(0)},"BigNumber, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(dc);const r=f(n.relTol);if(t>=r)return e.toDecimalPlaces(t.toNumber());const i=e.toDecimalPlaces(r);return(yi(e,i,n.relTol,n.absTol)?i:e).toDecimalPlaces(t.toNumber())},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.round()},"Fraction, number":function(e,t){if(t%1)throw new TypeError(dc);return e.round(t)},"Fraction, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(dc);return e.round(t.toNumber())},"Unit, number, Unit":t.referToSelf((e=>function(t,n,r){const i=t.toNumeric(r);return r.multiply(e(i,n))})),"Unit, BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>e(t,n.toNumber(),r))),"Array | Matrix, number | BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>si(t,(t=>e(t,n,r)),!0))),"Array | Matrix | Unit, Unit":t.referToSelf((e=>(t,n)=>e(t,0,n))),"Array | Matrix":t.referToSelf((e=>t=>si(t,e,!0))),"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>u(t,n,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>l(t,n,e,!1))),"Array, number | BigNumber":t.referToSelf((e=>(t,n)=>l(r(t),n,e,!1).valueOf())),"number | Complex | BigNumber | Fraction, SparseMatrix":t.referToSelf((e=>(t,n)=>i(t,0)?o(n.size(),n.storage()):c(n,t,e,!0))),"number | Complex | BigNumber | Fraction, DenseMatrix":t.referToSelf((e=>(t,n)=>i(t,0)?o(n.size(),n.storage()):l(n,t,e,!0))),"number | Complex | BigNumber | Fraction, Array":t.referToSelf((e=>(t,n)=>l(r(n),t,e,!0).valueOf()))})})),xc=["config","typed","typeOf","divideScalar","Complex"],bc=Math.log(16),vc=he("log",xc,(e=>{let{typed:t,typeOf:n,config:r,divideScalar:i,Complex:o}=e;function a(e){return e.log()}function s(e){return a(new o(e,0))}return t("log",{number:function(e){return e>=0||r.predictable?ho(e):s(e)},bigint:Ea(bc,ho,r,s),Complex:a,BigNumber:function(e){return!e.isNegative()||r.predictable?e.ln():s(e.toNumber())},"any, any":t.referToSelf((e=>(t,r)=>{if("Fraction"===n(t)&&"Fraction"===n(r)){const e=t.log(r);if(null!==e)return e}return i(e(t),e(r))}))})})),wc="log1p",Nc=he(wc,["typed","config","divideScalar","log","Complex"],(e=>{let{typed:t,config:n,divideScalar:r,log:i,Complex:o}=e;return t(wc,{number:function(e){return e>=-1||n.predictable?Ne(e):a(new o(e,0))},Complex:a,BigNumber:function(e){const t=e.plus(1);return!t.isNegative()||n.predictable?t.ln():a(new o(e.toNumber(),0))},"Array | Matrix":t.referToSelf((e=>t=>si(t,e))),"any, any":t.referToSelf((e=>(t,n)=>r(e(t),i(n))))});function a(e){const t=e.re+1;return new o(Math.log(Math.sqrt(t*t+e.im*e.im)),Math.atan2(e.im,t))}})),Ec="nthRoots",Ac=he(Ec,["config","typed","divideScalar","Complex"],(e=>{let{typed:t,config:n,divideScalar:r,Complex:i}=e;const o=[function(e){return new i(e,0)},function(e){return new i(0,e)},function(e){return new i(-e,0)},function(e){return new i(0,-e)}];function a(e,t){if(t<0)throw new Error("Root must be greater than zero");if(0===t)throw new Error("Root must be non-zero");if(t%1!=0)throw new Error("Root must be an integer");if(0===e||0===e.abs())return[new i(0,0)];const n="number"==typeof e;let r;(n||0===e.re||0===e.im)&&(r=n?2*+(e<0):0===e.im?2*+(e.re<0):2*+(e.im<0)+1);const a=e.arg(),s=e.abs(),u=[],c=Math.pow(s,1/t);for(let e=0;e{let{typed:t,equalScalar:n,matrix:r,pow:i,DenseMatrix:o,concat:a,SparseMatrix:s}=e;const u=sa({typed:t}),c=ys({typed:t,SparseMatrix:s}),l=qo({typed:t,equalScalar:n}),f=Po({typed:t,DenseMatrix:o}),p=fa({typed:t,matrix:r,concat:a}),m={};for(const e in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,e)&&(e.includes("Matrix")||e.includes("Array")||(m[e]=i.signatures[e]));const h=t(m);return t(Sc,p({elop:h,SS:c,DS:u,Ss:l,sS:f}))})),Cc="dotDivide",Tc=he(Cc,["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,matrix:n,equalScalar:r,divideScalar:i,DenseMatrix:o,concat:a,SparseMatrix:s}=e;const u=aa({typed:t,equalScalar:r}),c=sa({typed:t}),l=ys({typed:t,SparseMatrix:s}),f=qo({typed:t,equalScalar:r}),p=Po({typed:t,DenseMatrix:o}),m=fa({typed:t,matrix:n,concat:a});return t(Cc,m({elop:i,SS:l,DS:c,SD:u,Ss:f,sS:p}))}));function Bc(e){let{DenseMatrix:t}=e;return function(e,n,r){const i=e.size();if(2!==i.length)throw new RangeError("Matrix must be two dimensional (size: "+pr(i)+")");const o=i[0];if(o!==i[1])throw new RangeError("Matrix must be square (size: "+pr(i)+")");let a=[];if(E(n)){const e=n.size(),i=n._data;if(1===e.length){if(e[0]!==o)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(let e=0;e{let{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=Bc({DenseMatrix:s});return t(Dc,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const n=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr,h=[];for(let e=0;ee&&(u.push(f[t]),c.push(n))}if(a(s,0))throw new Error("Linear system cannot be solved since matrix is singular");const g=r(t,s);for(let e=0,t=c.length;e{let{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=Bc({DenseMatrix:s});return t(Oc,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const n=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr,h=[];for(let e=l-1;e>=0;e--){const t=n[e][0]||0;if(a(t,0))h[e]=[0];else{let s=0;const u=[],c=[],l=m[e];for(let t=m[e+1]-1;t>=l;t--){const n=p[t];n===e?s=f[t]:n=0;e--){const t=n[e][0]||0;let s;if(a(t,0))s=0;else{const u=p[e][e];if(a(u,0))throw new Error("Linear system cannot be solved since matrix is singular");s=r(t,u);for(let t=e-1;t>=0;t--)n[t]=[o(n[t][0]||0,i(s,p[t][e]))]}f[e]=[s]}return new s({data:f,size:[c,1]})}})),Ic="lsolveAll",zc=he(Ic,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{let{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=Bc({DenseMatrix:s});return t(Ic,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const n=[u(e,t,!0)._data.map((e=>e[0]))],c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr;for(let e=0;ee&&(c.push(f[t]),l.push(n))}if(a(g,0))if(a(u[e],0)){if(0===s){const t=[...u];t[e]=1;for(let e=0,n=l.length;enew s({data:e.map((e=>[e])),size:[c,1]})))}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(n(e),t).map((e=>e.valueOf()))}});function c(e,t){const n=[u(e,t,!0)._data.map((e=>e[0]))],c=e._data,l=e._size[0],f=e._size[1];for(let e=0;enew s({data:e.map((e=>[e])),size:[l,1]})))}})),kc="usolveAll",Rc=he(kc,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{let{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=Bc({DenseMatrix:s});return t(kc,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const n=[u(e,t,!0)._data.map((e=>e[0]))],c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr;for(let e=l-1;e>=0;e--){let t=n.length;for(let s=0;s=h;t--){const n=p[t];n===e?d=f[t]:nnew s({data:e.map((e=>[e])),size:[c,1]})))}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(n(e),t).map((e=>e.valueOf()))}});function c(e,t){const n=[u(e,t,!0)._data.map((e=>e[0]))],c=e._data,l=e._size[0];for(let t=e._size[1]-1;t>=0;t--){let e=n.length;for(let s=0;s=0;n--)e[n]=o(e[n],c[n][t]);n.push(e)}}else{if(0===s)return[];n.splice(s,1),s-=1,e-=1}else{u[t]=r(u[t],c[t][t]);for(let e=t-1;e>=0;e--)u[e]=o(u[e],i(u[t],c[e][t]))}}}return n.map((e=>new s({data:e.map((e=>[e])),size:[l,1]})))}})),qc=he("matAlgo08xS0Sid",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=r._values,f=r._index,p=r._ptr,m=r._size,h=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(u.length!==m.length)throw new xr(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");if(!o||!l)throw new Error("Cannot perform operation on Pattern Sparse Matrices");const d=u[0],g=u[1];let y,x=n,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(n,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=[],N=[],E=[],A=[],S=[];let M,C,T,B;for(let e=0;e{let{typed:t,matrix:n}=e;return{"Array, number":t.referTo("DenseMatrix, number",(e=>(t,r)=>e(n(t),r).valueOf())),"Array, BigNumber":t.referTo("DenseMatrix, BigNumber",(e=>(t,r)=>e(n(t),r).valueOf())),"number, Array":t.referTo("number, DenseMatrix",(e=>(t,r)=>e(t,n(r)).valueOf())),"BigNumber, Array":t.referTo("BigNumber, DenseMatrix",(e=>(t,r)=>e(t,n(r)).valueOf()))}})),jc="leftShift",Uc=he(jc,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,zeros:i,DenseMatrix:o,concat:a}=e;const s=ma({typed:t}),u=aa({typed:t,equalScalar:r}),c=qc({typed:t,equalScalar:r}),l=da({typed:t,DenseMatrix:o}),f=qo({typed:t,equalScalar:r}),p=jo({typed:t}),m=fa({typed:t,matrix:n,concat:a}),h=Pc({typed:t,matrix:n});return t(jc,{"number, number":us,"BigNumber, BigNumber":ts,"bigint, bigint":(e,t)=>e<(t,n)=>r(n,0)?t.clone():f(t,n,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>r(n,0)?t.clone():p(t,n,e,!1))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):l(n,t,e,!0))),"number | BigNumber, DenseMatrix":t.referToSelf((e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):p(n,t,e,!0)))},h,m({SS:c,DS:s,SD:u}))})),Lc="rightArithShift",$c=he(Lc,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,zeros:i,DenseMatrix:o,concat:a}=e;const s=ma({typed:t}),u=aa({typed:t,equalScalar:r}),c=qc({typed:t,equalScalar:r}),l=da({typed:t,DenseMatrix:o}),f=qo({typed:t,equalScalar:r}),p=jo({typed:t}),m=fa({typed:t,matrix:n,concat:a}),h=Pc({typed:t,matrix:n});return t(Lc,{"number, number":cs,"BigNumber, BigNumber":ns,"bigint, bigint":(e,t)=>e>>t,"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>r(n,0)?t.clone():f(t,n,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>r(n,0)?t.clone():p(t,n,e,!1))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):l(n,t,e,!0))),"number | BigNumber, DenseMatrix":t.referToSelf((e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):p(n,t,e,!0)))},h,m({SS:c,DS:s,SD:u}))})),Hc="rightLogShift",Gc=he(Hc,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,zeros:i,DenseMatrix:o,concat:a}=e;const s=ma({typed:t}),u=aa({typed:t,equalScalar:r}),c=qc({typed:t,equalScalar:r}),l=da({typed:t,DenseMatrix:o}),f=qo({typed:t,equalScalar:r}),p=jo({typed:t}),m=fa({typed:t,matrix:n,concat:a}),h=Pc({typed:t,matrix:n});return t(Hc,{"number, number":ls,"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>r(n,0)?t.clone():f(t,n,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>r(n,0)?t.clone():p(t,n,e,!1))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):l(n,t,e,!0))),"number | BigNumber, DenseMatrix":t.referToSelf((e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):p(n,t,e,!0)))},h,m({SS:c,DS:s,SD:u}))})),Vc=he("and",["typed","matrix","equalScalar","zeros","not","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,zeros:i,not:o,concat:a}=e;const s=aa({typed:t,equalScalar:r}),u=wa({typed:t,equalScalar:r}),c=qo({typed:t,equalScalar:r}),l=jo({typed:t}),f=fa({typed:t,matrix:n,concat:a});return t("and",{"number, number":Bs,"Complex, Complex":function(e,t){return!(0===e.re&&0===e.im||0===t.re&&0===t.im)},"BigNumber, BigNumber":function(e,t){return!(e.isZero()||t.isZero()||e.isNaN()||t.isNaN())},"bigint, bigint":Bs,"Unit, Unit":t.referToSelf((e=>(t,n)=>e(t.value||0,n.value||0))),"SparseMatrix, any":t.referToSelf((e=>(t,n)=>o(n)?i(t.size(),t.storage()):c(t,n,e,!1))),"DenseMatrix, any":t.referToSelf((e=>(t,n)=>o(n)?i(t.size(),t.storage()):l(t,n,e,!1))),"any, SparseMatrix":t.referToSelf((e=>(t,n)=>o(t)?i(t.size(),t.storage()):c(n,t,e,!0))),"any, DenseMatrix":t.referToSelf((e=>(t,n)=>o(t)?i(t.size(),t.storage()):l(n,t,e,!0))),"Array, any":t.referToSelf((e=>(t,r)=>e(n(t),r).valueOf())),"any, Array":t.referToSelf((e=>(t,r)=>e(t,n(r)).valueOf()))},f({SS:u,DS:s}))})),Zc="compare",Wc=he(Zc,["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],(e=>{let{typed:t,config:n,equalScalar:r,matrix:i,BigNumber:o,Fraction:a,DenseMatrix:s,concat:u}=e;const c=sa({typed:t}),l=ua({typed:t,equalScalar:r}),f=Po({typed:t,DenseMatrix:s}),p=fa({typed:t,matrix:i,concat:u}),m=Oi({typed:t});return t(Zc,Yc({typed:t,config:n}),{"boolean, boolean":function(e,t){return e===t?0:e>t?1:-1},"BigNumber, BigNumber":function(e,t){return yi(e,t,n.relTol,n.absTol)?new o(0):new o(e.cmp(t))},"bigint, bigint":function(e,t){return e===t?0n:e>t?1n:-1n},"Fraction, Fraction":function(e,t){return new a(e.compare(t))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},m,p({SS:l,DS:c,Ss:f}))})),Yc=he(Zc,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(Zc,{"number, number":function(e,t){return _e(e,t,n.relTol,n.absTol)?0:e>t?1:-1}})}));var Jc=n(1880);const Xc="compareNatural",Qc=he(Xc,["typed","compare"],(e=>{let{typed:t,compare:n}=e;const r=n.signatures["boolean,boolean"];return t(Xc,{"any, any":function e(t,a){const s=oe(t),u=oe(a);let c;if(!("number"!==s&&"BigNumber"!==s&&"Fraction"!==s||"number"!==u&&"BigNumber"!==u&&"Fraction"!==u))return c=n(t,a),"0"!==c.toString()?c>0?1:-1:Jc(s,u);const l=["Array","DenseMatrix","SparseMatrix"];if(l.includes(s)||l.includes(u))return c=i(e,t,a),0!==c?c:Jc(s,u);if(s!==u)return Jc(s,u);if("Complex"===s)return function(e,t){return e.re>t.re?1:e.ret.im?1:e.imn.length?1:t.length{let{typed:t,matrix:n,concat:r}=e;const i=fa({typed:t,matrix:n,concat:r});return t(Kc,yr,i({elop:yr,Ds:!0}))})),nl="equal",rl=he(nl,["typed","matrix","equalScalar","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o,SparseMatrix:a}=e;const s=sa({typed:t}),u=ys({typed:t,SparseMatrix:a}),c=Po({typed:t,DenseMatrix:i}),l=fa({typed:t,matrix:n,concat:o});return t(nl,il({typed:t,equalScalar:r}),l({elop:r,SS:u,DS:s,Ss:c}))})),il=he(nl,["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return t(nl,{"any, any":function(e,t){return null===e?null===t:null===t?null===e:void 0===e?void 0===t:void 0===t?void 0===e:n(e,t)}})})),ol="equalText",al=he(ol,["typed","compareText","isZero"],(e=>{let{typed:t,compareText:n,isZero:r}=e;return t(ol,{"any, any":function(e,t){return r(n(e,t))}})})),sl="smaller",ul=he(sl,["typed","config","bignumber","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,config:n,bignumber:r,matrix:i,DenseMatrix:o,concat:a,SparseMatrix:s}=e;const u=sa({typed:t}),c=ys({typed:t,SparseMatrix:s}),l=Po({typed:t,DenseMatrix:o}),f=fa({typed:t,matrix:i,concat:a}),p=Oi({typed:t});function m(e,t){return e.lt(t)&&!yi(e,t,n.relTol,n.absTol)}return t(sl,cl({typed:t,config:n}),{"boolean, boolean":(e,t)=>ee-1===e.compare(t),"Fraction, BigNumber":function(e,t){return m(r(e),t)},"BigNumber, Fraction":function(e,t){return m(e,r(t))},"Complex, Complex":function(e,t){throw new TypeError("No ordering relation is defined for complex numbers")}},p,f({SS:c,DS:u,Ss:l}))})),cl=he(sl,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(sl,{"number, number":function(e,t){return e{let{typed:t,config:n,matrix:r,DenseMatrix:i,concat:o,SparseMatrix:a}=e;const s=sa({typed:t}),u=ys({typed:t,SparseMatrix:a}),c=Po({typed:t,DenseMatrix:i}),l=fa({typed:t,matrix:r,concat:o}),f=Oi({typed:t});return t(ll,pl({typed:t,config:n}),{"boolean, boolean":(e,t)=>e<=t,"BigNumber, BigNumber":function(e,t){return e.lte(t)||yi(e,t,n.relTol,n.absTol)},"bigint, bigint":(e,t)=>e<=t,"Fraction, Fraction":(e,t)=>1!==e.compare(t),"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},f,l({SS:u,DS:s,Ss:c}))})),pl=he(ll,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(ll,{"number, number":function(e,t){return e<=t||_e(e,t,n.relTol,n.absTol)}})})),ml="larger",hl=he(ml,["typed","config","bignumber","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,config:n,bignumber:r,matrix:i,DenseMatrix:o,concat:a,SparseMatrix:s}=e;const u=sa({typed:t}),c=ys({typed:t,SparseMatrix:s}),l=Po({typed:t,DenseMatrix:o}),f=fa({typed:t,matrix:i,concat:a}),p=Oi({typed:t});function m(e,t){return e.gt(t)&&!yi(e,t,n.relTol,n.absTol)}return t(ml,dl({typed:t,config:n}),{"boolean, boolean":(e,t)=>e>t,"BigNumber, BigNumber":m,"bigint, bigint":(e,t)=>e>t,"Fraction, Fraction":(e,t)=>1===e.compare(t),"Fraction, BigNumber":function(e,t){return m(r(e),t)},"BigNumber, Fraction":function(e,t){return m(e,r(t))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},p,f({SS:c,DS:u,Ss:l}))})),dl=he(ml,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(ml,{"number, number":function(e,t){return e>t&&!_e(e,t,n.relTol,n.absTol)}})})),gl="largerEq",yl=he(gl,["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,config:n,matrix:r,DenseMatrix:i,concat:o,SparseMatrix:a}=e;const s=sa({typed:t}),u=ys({typed:t,SparseMatrix:a}),c=Po({typed:t,DenseMatrix:i}),l=fa({typed:t,matrix:r,concat:o}),f=Oi({typed:t});return t(gl,xl({typed:t,config:n}),{"boolean, boolean":(e,t)=>e>=t,"BigNumber, BigNumber":function(e,t){return e.gte(t)||yi(e,t,n.relTol,n.absTol)},"bigint, bigint":function(e,t){return e>=t},"Fraction, Fraction":(e,t)=>-1!==e.compare(t),"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},f,l({SS:u,DS:s,Ss:c}))})),xl=he(gl,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(gl,{"number, number":function(e,t){return e>=t||_e(e,t,n.relTol,n.absTol)}})})),bl="deepEqual",vl=he(bl,["typed","equal"],(e=>{let{typed:t,equal:n}=e;return t(bl,{"any, any":function(e,t){return r(e.valueOf(),t.valueOf())}});function r(e,t){if(Array.isArray(e)){if(Array.isArray(t)){const n=e.length;if(n!==t.length)return!1;for(let i=0;i{let{typed:t,config:n,equalScalar:r,matrix:i,DenseMatrix:o,concat:a,SparseMatrix:s}=e;const u=sa({typed:t}),c=ys({typed:t,SparseMatrix:s}),l=Po({typed:t,DenseMatrix:o}),f=fa({typed:t,matrix:i,concat:a});return t(wl,El({typed:t,equalScalar:r}),f({elop:function(e,t){return!r(e,t)},SS:c,DS:u,Ss:l}))})),El=he(wl,["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return t(wl,{"any, any":function(e,t){return null===e?null!==t:null===t?null!==e:void 0===e?void 0!==t:void 0===t?void 0!==e:!n(e,t)}})})),Al="partitionSelect",Sl=he(Al,["typed","isNumeric","isNaN","compare"],(e=>{let{typed:t,isNumeric:n,isNaN:r,compare:i}=e;const o=i,a=(e,t)=>-i(e,t);return t(Al,{"Array | Matrix, number":function(e,t){return s(e,t,o)},"Array | Matrix, number, string":function(e,t,n){if("asc"===n)return s(e,t,o);if("desc"===n)return s(e,t,a);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":s});function s(e,t,n){if(!ye(t)||t<0)throw new Error("k must be a non-negative integer");if(E(e)){if(e.size().length>1)throw new Error("Only one dimensional matrices supported");return u(e.valueOf(),t,n)}if(Array.isArray(e))return u(e,t,n)}function u(e,t,i){if(t>=e.length)throw new Error("k out of bounds");for(let t=0;t=0){const t=e[r];e[r]=e[n],e[n]=t,--r}else++n;i(e[n],s)>0&&--n,t<=n?a=n:o=n+1}return e[t]}})),Ml="sort",Cl=he(Ml,["typed","matrix","compare","compareNatural"],(e=>{let{typed:t,matrix:n,compare:r,compareNatural:i}=e;const o=r,a=(e,t)=>-r(e,t);return t(Ml,{Array:function(e){return u(e),e.sort(o)},Matrix:function(e){return c(e),n(e.toArray().sort(o),e.storage())},"Array, function":function(e,t){return u(e),e.sort(t)},"Matrix, function":function(e,t){return c(e),n(e.toArray().sort(t),e.storage())},"Array, string":function(e,t){return u(e),e.sort(s(t))},"Matrix, string":function(e,t){return c(e),n(e.toArray().sort(s(t)),e.storage())}});function s(e){if("asc"===e)return o;if("desc"===e)return a;if("natural"===e)return i;throw new Error('String "asc", "desc", or "natural" expected')}function u(e){if(1!==vr(e).length)throw new Error("One dimensional array expected")}function c(e){if(1!==e.size().length)throw new Error("One dimensional matrix expected")}})),Tl=he("max",["typed","config","numeric","larger","isNaN"],(e=>{let{typed:t,config:n,numeric:r,larger:i,isNaN:o}=e;return t("max",{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(e,t){return ui(e,t.valueOf(),a)},"...":function(e){if(oi(e))throw new TypeError("Scalar values expected in function max");return s(e)}});function a(e,t){try{return i(e,t)?e:t}catch(e){throw Ju(e,"max",t)}}function s(e){let t;if(ai(e,(function(e){try{(o(e)||void 0===t||i(e,t))&&(t=e)}catch(t){throw Ju(t,"max",e)}})),void 0===t)throw new Error("Cannot calculate max of an empty array");return"string"==typeof t&&(t=r(t,xe(t,n))),t}})),Bl=he("min",["typed","config","numeric","smaller","isNaN"],(e=>{let{typed:t,config:n,numeric:r,smaller:i,isNaN:o}=e;return t("min",{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(e,t){return ui(e,t.valueOf(),a)},"...":function(e){if(oi(e))throw new TypeError("Scalar values expected in function min");return s(e)}});function a(e,t){try{return i(e,t)?e:t}catch(e){throw Ju(e,"min",t)}}function s(e){let t;if(ai(e,(function(e){try{(o(e)||void 0===t||i(e,t))&&(t=e)}catch(t){throw Ju(t,"min",e)}})),void 0===t)throw new Error("Cannot calculate min of an empty array");return"string"==typeof t&&(t=r(t,xe(t,n))),t}})),Dl=he("ImmutableDenseMatrix",["smaller","DenseMatrix"],(e=>{let{smaller:t,DenseMatrix:n}=e;function r(e,t){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!w(t))throw new Error("Invalid datatype: "+t);if(E(e)||N(e)){const r=new n(e,t);this._data=r._data,this._size=r._size,this._datatype=r._datatype,this._min=null,this._max=null}else if(e&&N(e.data)&&N(e.size))this._data=e.data,this._size=e.size,this._datatype=e.datatype,this._min=void 0!==e.min?e.min:null,this._max=void 0!==e.max?e.max:null;else{if(e)throw new TypeError("Unsupported type of data ("+oe(e)+")");this._data=[],this._size=[0],this._datatype=t,this._min=null,this._max=null}}return r.prototype=new n,r.prototype.type="ImmutableDenseMatrix",r.prototype.isImmutableDenseMatrix=!0,r.prototype.subset=function(e){switch(arguments.length){case 1:{const t=n.prototype.subset.call(this,e);return E(t)?new r({data:t._data,size:t._size,datatype:t._datatype}):t}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},r.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},r.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},r.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},r.prototype.clone=function(){return new r({data:ae(this._data),size:ae(this._size),datatype:this._datatype})},r.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.fromJSON=function(e){return new r(e)},r.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},r.prototype.min=function(){if(null===this._min){let e=null;this.forEach((function(n){(null===e||t(n,e))&&(e=n)})),this._min=null!==e?e:void 0}return this._min},r.prototype.max=function(){if(null===this._max){let e=null;this.forEach((function(n){(null===e||t(e,n))&&(e=n)})),this._max=null!==e?e:void 0}return this._max},r}),{isClass:!0}),Fl=he("Index",["ImmutableDenseMatrix","getMatrixDataType"],(e=>{let{ImmutableDenseMatrix:t,getMatrixDataType:n}=e;function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(let e=0,t=arguments.length;e{e&&t.push(n)})),t}const _l=he("FibonacciHeap",["smaller","larger"],(e=>{let{smaller:t,larger:n}=e;const r=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}function o(e,t,n){t.left.right=t.right,t.right.left=t.left,n.degree--,n.child===t&&(n.child=t.right),0===n.degree&&(n.child=null),t.left=e,t.right=e.right,e.right=t,t.right.left=t,t.parent=null,t.mark=!1}function a(e,t){const n=t.parent;n&&(t.mark?(o(e,t,n),a(n)):t.mark=!0)}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(e,n){const r={key:e,value:n,degree:0};if(this._minimum){const n=this._minimum;r.left=n,r.right=n.right,n.right=r,r.right.left=r,t(e,n.key)&&(this._minimum=r)}else r.left=r,r.right=r,this._minimum=r;return this._size++,r},i.prototype.size=function(){return this._size},i.prototype.clear=function(){this._minimum=null,this._size=0},i.prototype.isEmpty=function(){return 0===this._size},i.prototype.extractMinimum=function(){const e=this._minimum;if(null===e)return e;let i=this._minimum,o=e.degree,a=e.child;for(;o>0;){const e=a.right;a.left.right=a.right,a.right.left=a.left,a.left=i,a.right=i.right,i.right=a,a.right.left=a,a.parent=null,a=e,o--}return e.left.right=e.right,e.right.left=e.left,e===e.right?i=null:(i=e.right,i=function(e,i){const o=Math.floor(Math.log(i)*r)+1,a=new Array(o);let u,c=0,l=e;if(l)for(c++,l=l.right;l!==e;)c++,l=l.right;for(;c>0;){let e=l.degree;const t=l.right;for(;u=a[e],u;){if(n(l.key,u.key)){const e=u;u=l,l=e}s(u,l),a[e]=null,e++}a[e]=l,l=t,c--}e=null;for(let n=0;n{let{addScalar:t,equalScalar:n,FibonacciHeap:r}=e;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new r}return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(e,t){if(this._values[e])this._values[e].value=t;else{const n=this._heap.insert(e,t);this._values[e]=n}},i.prototype.get=function(e){const t=this._values[e];return t?t.value:0},i.prototype.accumulate=function(e,n){let r=this._values[e];r?r.value=t(r.value,n):(r=this._heap.insert(e,n),this._values[e]=r)},i.prototype.forEach=function(e,t,r){const i=this._heap,o=this._values,a=[];let s=i.extractMinimum();for(s&&a.push(s);s&&s.key<=t;)s.key>=e&&(n(s.value,0)||r(s.key,s.value,this)),s=i.extractMinimum(),s&&a.push(s);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{};return n=null==n?Number.POSITIVE_INFINITY:n,t=null==t?JSON.stringify:t,function r(){"object"!=typeof r.cache&&(r.cache={values:new Map,lru:zl(n||Number.POSITIVE_INFINITY)});const i=[];for(let e=0;e{let{on:t,config:n,addScalar:r,subtractScalar:i,multiplyScalar:o,divideScalar:a,pow:s,abs:u,fix:c,round:l,equal:f,isNumeric:p,format:m,number:h,Complex:d,BigNumber:g,Fraction:y}=e;const b=h;function w(e,t){if(!(this instanceof w))throw new Error("Constructor must be called with the new operator");if(null!=e&&!p(e)&&!x(e))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,void 0===t)this.units=[],this.dimensions=k.map((e=>0));else if("string"==typeof t){const e=w.parse(t);this.units=e.units,this.dimensions=e.dimensions}else{if(!v(t)||null!==t.value)throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.fixPrefix=t.fixPrefix,this.skipAutomaticSimplification=t.skipAutomaticSimplification,this.dimensions=t.dimensions.slice(0),this.units=t.units.map((e=>sr({},e)))}this.value=this._normalize(e)}let N,E,A;function S(){for(;" "===A||"\t"===A;)C()}function M(e){return e>="0"&&e<="9"}function C(){E++,A=N.charAt(E)}function T(e){E=e,A=N.charAt(E)}function B(){let e="";const t=E;if("+"===A?C():"-"===A&&(e+=A,C()),!function(e){return e>="0"&&e<="9"||"."===e}(A))return T(t),null;if("."===A){if(e+=A,C(),!M(A))return T(t),null}else{for(;M(A);)e+=A,C();"."===A&&(e+=A,C())}for(;M(A);)e+=A,C();if("E"===A||"e"===A){let t="";const n=E;if(t+=A,C(),"+"!==A&&"-"!==A||(t+=A,C()),!M(A))return T(n),e;for(e+=t;M(A);)e+=A,C()}return e}function D(){let e="";for(;M(A)||w.isValidAlpha(A);)e+=A,C();const t=e.charAt(0);return w.isValidAlpha(t)?e:null}function F(e){return A===e?(C(),e):null}Object.defineProperty(w,"name",{value:"Unit"}),w.prototype.constructor=w,w.prototype.type="Unit",w.prototype.isUnit=!0,w.parse=function(e,t){if(t=t||{},N=e,E=-1,A="","string"!=typeof N)throw new TypeError("Invalid argument in Unit.parse, string expected");const r=new w;r.units=[];let i=1,o=!1;C(),S();const a=B();let s=null;if(a){if("BigNumber"===n.number)s=new g(a);else if("Fraction"===n.number)try{s=new y(a)}catch(e){s=parseFloat(a)}else s=parseFloat(a);S(),F("*")?(i=1,o=!0):F("/")&&(i=-1,o=!0)}const u=[];let c=1;for(;;){for(S();"("===A;)u.push(i),c*=i,i=1,C(),S();let t;if(!A)break;{const e=A;if(t=D(),null===t)throw new SyntaxError('Unexpected "'+e+'" in "'+N+'" at index '+E.toString())}const n=O(t);if(null===n)throw new SyntaxError('Unit "'+t+'" not found.');let a=i*c;if(S(),F("^")){S();const t=B();if(null===t)throw new SyntaxError('In "'+e+'", "^" must be followed by a floating-point number');a*=t}r.units.push({unit:n.unit,prefix:n.prefix,power:a});for(let e=0;e1||Math.abs(this.units[0].power-1)>1e-15)},w.prototype._normalize=function(e){if(null==e||0===this.units.length)return e;let t=e;const n=w._getNumberConverter(oe(e));for(let e=0;e{if(me(P,e)){const t=P[e];return{unit:t,prefix:t.prefixes[""]}}for(const t in P)if(me(P,t)&&fr(e,t)){const n=P[t],r=e.length-t.length,i=e.substring(0,r),o=me(n.prefixes,i)?n.prefixes[i]:void 0;if(void 0!==o)return{unit:n,prefix:o}}return null}),{hasher:e=>e[0],limit:100});function _(e){return e.equalBase(R.NONE)&&null!==e.value&&!n.predictable?e.value:e}function I(e){return w._getNumberConverter(oe(e))(1)}w.isValuelessUnit=function(e){return null!==O(e)},w.prototype.hasBase=function(e){if("string"==typeof e&&(e=R[e]),!e)return!1;for(let t=0;t1e-12)return!1;return!0},w.prototype.equalBase=function(e){for(let t=0;t1e-12)return!1;return!0},w.prototype.equals=function(e){return this.equalBase(e)&&f(this.value,e.value)},w.prototype.multiply=function(e){const t=this.clone(),n=v(e)?e:new w(e);for(let e=0;e0?this.formatUnits():null,fixPrefix:this.fixPrefix}},w.fromJSON=function(e){var t;const n=new w(e.value,null!==(t=e.unit)&&void 0!==t?t:void 0);return n.fixPrefix=e.fixPrefix||!1,n},w.prototype.valueOf=w.prototype.toString,w.prototype.simplify=function(){const e=this.clone(),t=[];let n;for(const t in $)if(me($,t)&&e.hasBase(R[t])){n=t;break}if("NONE"===n)e.units=[];else{let r;if(n&&me($,n)&&(r=$[n]),r)e.units=[{unit:r.unit,prefix:r.prefix,power:1}];else{let n=!1;for(let r=0;r1e-12&&(me($,i)?t.push({unit:$[i].unit,prefix:$[i].prefix,power:e.dimensions[r]||0}):n=!0)}t.length1e-12){if(!me(L.si,r))throw new Error("Cannot express custom unit "+r+" in SI units");t.push({unit:L.si[r].unit,prefix:L.si[r].prefix,power:e.dimensions[n]||0})}}return e.units=t,e.fixPrefix=!0,e.skipAutomaticSimplification=!0,null!==this.value?(e.value=null,this.to(e)):e},w.prototype.formatUnits=function(){let e="",t="",n=0,r=0;for(let t=0;t0?(n++,e+=" "+this.units[t].prefix.name+this.units[t].unit.name,Math.abs(this.units[t].power-1)>1e-15&&(e+="^"+this.units[t].power)):this.units[t].power<0&&r++;if(r>0)for(let e=0;e0?(t+=" "+this.units[e].prefix.name+this.units[e].unit.name,Math.abs(this.units[e].power+1)>1e-15&&(t+="^"+-this.units[e].power)):(t+=" "+this.units[e].prefix.name+this.units[e].unit.name,t+="^"+this.units[e].power));e=e.substr(1),t=t.substr(1),n>1&&r>0&&(e="("+e+")"),r>1&&n>0&&(t="("+t+")");let i=e;return n>0&&r>0&&(i+=" / "),i+=t,i},w.prototype.format=function(e){const t=this.skipAutomaticSimplification||null===this.value?this.clone():this.simplify();let n=!1;void 0!==t.value&&null!==t.value&&x(t.value)&&(n=Math.abs(t.value.re)<1e-14);for(const e in t.units)me(t.units,e)&&t.units[e].unit&&("VA"===t.units[e].unit.name&&n?t.units[e].unit=P.VAR:"VAR"!==t.units[e].unit.name||n||(t.units[e].unit=P.VA));1!==t.units.length||t.fixPrefix||Math.abs(t.units[0].power-Math.round(t.units[0].power))<1e-14&&(t.units[0].prefix=t._bestPrefix());const r=t._denormalize(t.value);let i=null!==t.value?m(r,e||{}):"";const o=t.formatUnits();return t.value&&x(t.value)&&(i="("+i+")"),o.length>0&&i.length>0&&(i+=" "),i+=o,i},w.prototype._bestPrefix=function(){if(1!==this.units.length)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");const e=null!==this.value?u(this.value):0,t=u(this.units[0].unit.value);let n=this.units[0].prefix;if(0===e)return n;const r=this.units[0].power;let i=Math.log(e/Math.pow(n.value*t,r))/Math.LN10-1.2;if(i>-2.200001&&i<1.800001)return n;i=Math.abs(i);const o=this.units[0].unit.prefixes;for(const a in o)if(me(o,a)){const s=o[a];if(s.scientific){const o=Math.abs(Math.log(e/Math.pow(s.value*t,r))/Math.LN10-1.2);(o0))},P={meter:{name:"meter",base:R.LENGTH,prefixes:z.LONG,value:1,offset:0},inch:{name:"inch",base:R.LENGTH,prefixes:z.NONE,value:.0254,offset:0},foot:{name:"foot",base:R.LENGTH,prefixes:z.NONE,value:.3048,offset:0},yard:{name:"yard",base:R.LENGTH,prefixes:z.NONE,value:.9144,offset:0},mile:{name:"mile",base:R.LENGTH,prefixes:z.NONE,value:1609.344,offset:0},link:{name:"link",base:R.LENGTH,prefixes:z.NONE,value:.201168,offset:0},rod:{name:"rod",base:R.LENGTH,prefixes:z.NONE,value:5.0292,offset:0},chain:{name:"chain",base:R.LENGTH,prefixes:z.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:R.LENGTH,prefixes:z.NONE,value:1e-10,offset:0},m:{name:"m",base:R.LENGTH,prefixes:z.SHORT,value:1,offset:0},in:{name:"in",base:R.LENGTH,prefixes:z.NONE,value:.0254,offset:0},ft:{name:"ft",base:R.LENGTH,prefixes:z.NONE,value:.3048,offset:0},yd:{name:"yd",base:R.LENGTH,prefixes:z.NONE,value:.9144,offset:0},mi:{name:"mi",base:R.LENGTH,prefixes:z.NONE,value:1609.344,offset:0},li:{name:"li",base:R.LENGTH,prefixes:z.NONE,value:.201168,offset:0},rd:{name:"rd",base:R.LENGTH,prefixes:z.NONE,value:5.02921,offset:0},ch:{name:"ch",base:R.LENGTH,prefixes:z.NONE,value:20.1168,offset:0},mil:{name:"mil",base:R.LENGTH,prefixes:z.NONE,value:254e-7,offset:0},m2:{name:"m2",base:R.SURFACE,prefixes:z.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:R.SURFACE,prefixes:z.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:R.SURFACE,prefixes:z.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:R.SURFACE,prefixes:z.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:R.SURFACE,prefixes:z.NONE,value:2589988.110336,offset:0},sqrd:{name:"sqrd",base:R.SURFACE,prefixes:z.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:R.SURFACE,prefixes:z.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:R.SURFACE,prefixes:z.NONE,value:6.4516e-10,offset:0},acre:{name:"acre",base:R.SURFACE,prefixes:z.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:R.SURFACE,prefixes:z.NONE,value:1e4,offset:0},m3:{name:"m3",base:R.VOLUME,prefixes:z.CUBIC,value:1,offset:0},L:{name:"L",base:R.VOLUME,prefixes:z.SHORT,value:.001,offset:0},l:{name:"l",base:R.VOLUME,prefixes:z.SHORT,value:.001,offset:0},litre:{name:"litre",base:R.VOLUME,prefixes:z.LONG,value:.001,offset:0},cuin:{name:"cuin",base:R.VOLUME,prefixes:z.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:R.VOLUME,prefixes:z.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:R.VOLUME,prefixes:z.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:R.VOLUME,prefixes:z.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:R.VOLUME,prefixes:z.NONE,value:15e-6,offset:0},drop:{name:"drop",base:R.VOLUME,prefixes:z.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:R.VOLUME,prefixes:z.NONE,value:5e-8,offset:0},minim:{name:"minim",base:R.VOLUME,prefixes:z.NONE,value:6.1611519921875e-8,offset:0},fluiddram:{name:"fluiddram",base:R.VOLUME,prefixes:z.NONE,value:36966911953125e-19,offset:0},fluidounce:{name:"fluidounce",base:R.VOLUME,prefixes:z.NONE,value:295735295625e-16,offset:0},gill:{name:"gill",base:R.VOLUME,prefixes:z.NONE,value:.00011829411825,offset:0},cc:{name:"cc",base:R.VOLUME,prefixes:z.NONE,value:1e-6,offset:0},cup:{name:"cup",base:R.VOLUME,prefixes:z.NONE,value:.0002365882365,offset:0},pint:{name:"pint",base:R.VOLUME,prefixes:z.NONE,value:.000473176473,offset:0},quart:{name:"quart",base:R.VOLUME,prefixes:z.NONE,value:.000946352946,offset:0},gallon:{name:"gallon",base:R.VOLUME,prefixes:z.NONE,value:.003785411784,offset:0},beerbarrel:{name:"beerbarrel",base:R.VOLUME,prefixes:z.NONE,value:.117347765304,offset:0},oilbarrel:{name:"oilbarrel",base:R.VOLUME,prefixes:z.NONE,value:.158987294928,offset:0},hogshead:{name:"hogshead",base:R.VOLUME,prefixes:z.NONE,value:.238480942392,offset:0},g:{name:"g",base:R.MASS,prefixes:z.SHORT,value:.001,offset:0},gram:{name:"gram",base:R.MASS,prefixes:z.LONG,value:.001,offset:0},ton:{name:"ton",base:R.MASS,prefixes:z.SHORT,value:907.18474,offset:0},t:{name:"t",base:R.MASS,prefixes:z.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:R.MASS,prefixes:z.LONG,value:1e3,offset:0},grain:{name:"grain",base:R.MASS,prefixes:z.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:R.MASS,prefixes:z.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:R.MASS,prefixes:z.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:R.MASS,prefixes:z.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:R.MASS,prefixes:z.NONE,value:45.359237,offset:0},stick:{name:"stick",base:R.MASS,prefixes:z.NONE,value:.115,offset:0},stone:{name:"stone",base:R.MASS,prefixes:z.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:R.MASS,prefixes:z.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:R.MASS,prefixes:z.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:R.MASS,prefixes:z.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:R.MASS,prefixes:z.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:R.MASS,prefixes:z.NONE,value:45.359237,offset:0},s:{name:"s",base:R.TIME,prefixes:z.SHORT,value:1,offset:0},min:{name:"min",base:R.TIME,prefixes:z.NONE,value:60,offset:0},h:{name:"h",base:R.TIME,prefixes:z.NONE,value:3600,offset:0},second:{name:"second",base:R.TIME,prefixes:z.LONG,value:1,offset:0},sec:{name:"sec",base:R.TIME,prefixes:z.LONG,value:1,offset:0},minute:{name:"minute",base:R.TIME,prefixes:z.NONE,value:60,offset:0},hour:{name:"hour",base:R.TIME,prefixes:z.NONE,value:3600,offset:0},day:{name:"day",base:R.TIME,prefixes:z.NONE,value:86400,offset:0},week:{name:"week",base:R.TIME,prefixes:z.NONE,value:604800,offset:0},month:{name:"month",base:R.TIME,prefixes:z.NONE,value:2629800,offset:0},year:{name:"year",base:R.TIME,prefixes:z.NONE,value:31557600,offset:0},decade:{name:"decade",base:R.TIME,prefixes:z.NONE,value:315576e3,offset:0},century:{name:"century",base:R.TIME,prefixes:z.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:R.TIME,prefixes:z.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:R.FREQUENCY,prefixes:z.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:R.FREQUENCY,prefixes:z.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:R.ANGLE,prefixes:z.SHORT,value:1,offset:0},radian:{name:"radian",base:R.ANGLE,prefixes:z.LONG,value:1,offset:0},deg:{name:"deg",base:R.ANGLE,prefixes:z.SHORT,value:null,offset:0},degree:{name:"degree",base:R.ANGLE,prefixes:z.LONG,value:null,offset:0},grad:{name:"grad",base:R.ANGLE,prefixes:z.SHORT,value:null,offset:0},gradian:{name:"gradian",base:R.ANGLE,prefixes:z.LONG,value:null,offset:0},cycle:{name:"cycle",base:R.ANGLE,prefixes:z.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:R.ANGLE,prefixes:z.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:R.ANGLE,prefixes:z.NONE,value:null,offset:0},A:{name:"A",base:R.CURRENT,prefixes:z.SHORT,value:1,offset:0},ampere:{name:"ampere",base:R.CURRENT,prefixes:z.LONG,value:1,offset:0},K:{name:"K",base:R.TEMPERATURE,prefixes:z.SHORT,value:1,offset:0},degC:{name:"degC",base:R.TEMPERATURE,prefixes:z.SHORT,value:1,offset:273.15},degF:{name:"degF",base:R.TEMPERATURE,prefixes:z.SHORT,value:new y(5,9),offset:459.67},degR:{name:"degR",base:R.TEMPERATURE,prefixes:z.SHORT,value:new y(5,9),offset:0},kelvin:{name:"kelvin",base:R.TEMPERATURE,prefixes:z.LONG,value:1,offset:0},celsius:{name:"celsius",base:R.TEMPERATURE,prefixes:z.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:R.TEMPERATURE,prefixes:z.LONG,value:new y(5,9),offset:459.67},rankine:{name:"rankine",base:R.TEMPERATURE,prefixes:z.LONG,value:new y(5,9),offset:0},mol:{name:"mol",base:R.AMOUNT_OF_SUBSTANCE,prefixes:z.SHORT,value:1,offset:0},mole:{name:"mole",base:R.AMOUNT_OF_SUBSTANCE,prefixes:z.LONG,value:1,offset:0},cd:{name:"cd",base:R.LUMINOUS_INTENSITY,prefixes:z.SHORT,value:1,offset:0},candela:{name:"candela",base:R.LUMINOUS_INTENSITY,prefixes:z.LONG,value:1,offset:0},N:{name:"N",base:R.FORCE,prefixes:z.SHORT,value:1,offset:0},newton:{name:"newton",base:R.FORCE,prefixes:z.LONG,value:1,offset:0},dyn:{name:"dyn",base:R.FORCE,prefixes:z.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:R.FORCE,prefixes:z.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:R.FORCE,prefixes:z.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:R.FORCE,prefixes:z.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:R.FORCE,prefixes:z.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:R.FORCE,prefixes:z.NONE,value:9.80665,offset:0},J:{name:"J",base:R.ENERGY,prefixes:z.SHORT,value:1,offset:0},joule:{name:"joule",base:R.ENERGY,prefixes:z.LONG,value:1,offset:0},erg:{name:"erg",base:R.ENERGY,prefixes:z.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:R.ENERGY,prefixes:z.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:R.ENERGY,prefixes:z.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:R.ENERGY,prefixes:z.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:R.ENERGY,prefixes:z.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:R.POWER,prefixes:z.SHORT,value:1,offset:0},watt:{name:"watt",base:R.POWER,prefixes:z.LONG,value:1,offset:0},hp:{name:"hp",base:R.POWER,prefixes:z.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:R.POWER,prefixes:z.SHORT,value:d.I,offset:0},VA:{name:"VA",base:R.POWER,prefixes:z.SHORT,value:1,offset:0},Pa:{name:"Pa",base:R.PRESSURE,prefixes:z.SHORT,value:1,offset:0},psi:{name:"psi",base:R.PRESSURE,prefixes:z.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:R.PRESSURE,prefixes:z.NONE,value:101325,offset:0},bar:{name:"bar",base:R.PRESSURE,prefixes:z.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:R.PRESSURE,prefixes:z.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:R.PRESSURE,prefixes:z.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:R.PRESSURE,prefixes:z.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:R.PRESSURE,prefixes:z.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:R.ELECTRIC_CHARGE,prefixes:z.LONG,value:1,offset:0},C:{name:"C",base:R.ELECTRIC_CHARGE,prefixes:z.SHORT,value:1,offset:0},farad:{name:"farad",base:R.ELECTRIC_CAPACITANCE,prefixes:z.LONG,value:1,offset:0},F:{name:"F",base:R.ELECTRIC_CAPACITANCE,prefixes:z.SHORT,value:1,offset:0},volt:{name:"volt",base:R.ELECTRIC_POTENTIAL,prefixes:z.LONG,value:1,offset:0},V:{name:"V",base:R.ELECTRIC_POTENTIAL,prefixes:z.SHORT,value:1,offset:0},ohm:{name:"ohm",base:R.ELECTRIC_RESISTANCE,prefixes:z.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:R.ELECTRIC_INDUCTANCE,prefixes:z.LONG,value:1,offset:0},H:{name:"H",base:R.ELECTRIC_INDUCTANCE,prefixes:z.SHORT,value:1,offset:0},siemens:{name:"siemens",base:R.ELECTRIC_CONDUCTANCE,prefixes:z.LONG,value:1,offset:0},S:{name:"S",base:R.ELECTRIC_CONDUCTANCE,prefixes:z.SHORT,value:1,offset:0},weber:{name:"weber",base:R.MAGNETIC_FLUX,prefixes:z.LONG,value:1,offset:0},Wb:{name:"Wb",base:R.MAGNETIC_FLUX,prefixes:z.SHORT,value:1,offset:0},tesla:{name:"tesla",base:R.MAGNETIC_FLUX_DENSITY,prefixes:z.LONG,value:1,offset:0},T:{name:"T",base:R.MAGNETIC_FLUX_DENSITY,prefixes:z.SHORT,value:1,offset:0},b:{name:"b",base:R.BIT,prefixes:z.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:R.BIT,prefixes:z.BINARY_LONG,value:1,offset:0},B:{name:"B",base:R.BIT,prefixes:z.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:R.BIT,prefixes:z.BINARY_LONG,value:8,offset:0}},j={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fldr:"fluiddram",fluiddrams:"fluiddram",floz:"fluidounce",fluidounces:"fluidounce",gi:"gill",gills:"gill",cp:"cup",cups:"cup",pt:"pint",pints:"pint",qt:"quart",quarts:"quart",gal:"gallon",gallons:"gallon",bbl:"beerbarrel",beerbarrels:"beerbarrel",obl:"oilbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function U(e){if("BigNumber"===e.number){const e=Pl(g);P.rad.value=new g(1),P.deg.value=e.div(180),P.grad.value=e.div(200),P.cycle.value=e.times(2),P.arcsec.value=e.div(648e3),P.arcmin.value=e.div(10800)}else P.rad.value=1,P.deg.value=Math.PI/180,P.grad.value=Math.PI/200,P.cycle.value=2*Math.PI,P.arcsec.value=Math.PI/648e3,P.arcmin.value=Math.PI/10800;P.radian.value=P.rad.value,P.degree.value=P.deg.value,P.gradian.value=P.grad.value}U(n),t&&t("config",(function(e,t){e.number!==t.number&&U(e)}));const L={si:{NONE:{unit:q,prefix:z.NONE[""]},LENGTH:{unit:P.m,prefix:z.SHORT[""]},MASS:{unit:P.g,prefix:z.SHORT.k},TIME:{unit:P.s,prefix:z.SHORT[""]},CURRENT:{unit:P.A,prefix:z.SHORT[""]},TEMPERATURE:{unit:P.K,prefix:z.SHORT[""]},LUMINOUS_INTENSITY:{unit:P.cd,prefix:z.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:P.mol,prefix:z.SHORT[""]},ANGLE:{unit:P.rad,prefix:z.SHORT[""]},BIT:{unit:P.bits,prefix:z.SHORT[""]},FORCE:{unit:P.N,prefix:z.SHORT[""]},ENERGY:{unit:P.J,prefix:z.SHORT[""]},POWER:{unit:P.W,prefix:z.SHORT[""]},PRESSURE:{unit:P.Pa,prefix:z.SHORT[""]},ELECTRIC_CHARGE:{unit:P.C,prefix:z.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:P.F,prefix:z.SHORT[""]},ELECTRIC_POTENTIAL:{unit:P.V,prefix:z.SHORT[""]},ELECTRIC_RESISTANCE:{unit:P.ohm,prefix:z.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:P.H,prefix:z.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:P.S,prefix:z.SHORT[""]},MAGNETIC_FLUX:{unit:P.Wb,prefix:z.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:P.T,prefix:z.SHORT[""]},FREQUENCY:{unit:P.Hz,prefix:z.SHORT[""]}}};L.cgs=JSON.parse(JSON.stringify(L.si)),L.cgs.LENGTH={unit:P.m,prefix:z.SHORT.c},L.cgs.MASS={unit:P.g,prefix:z.SHORT[""]},L.cgs.FORCE={unit:P.dyn,prefix:z.SHORT[""]},L.cgs.ENERGY={unit:P.erg,prefix:z.NONE[""]},L.us=JSON.parse(JSON.stringify(L.si)),L.us.LENGTH={unit:P.ft,prefix:z.NONE[""]},L.us.MASS={unit:P.lbm,prefix:z.NONE[""]},L.us.TEMPERATURE={unit:P.degF,prefix:z.NONE[""]},L.us.FORCE={unit:P.lbf,prefix:z.NONE[""]},L.us.ENERGY={unit:P.BTU,prefix:z.BTU[""]},L.us.POWER={unit:P.hp,prefix:z.NONE[""]},L.us.PRESSURE={unit:P.psi,prefix:z.NONE[""]},L.auto=JSON.parse(JSON.stringify(L.si));let $=L.auto;w.setUnitSystem=function(e){if(!me(L,e))throw new Error("Unit system "+e+" does not exist. Choices are: "+Object.keys(L).join(", "));$=L[e]},w.getUnitSystem=function(){for(const e in L)if(me(L,e)&&L[e]===$)return e},w.typeConverters={BigNumber:function(e){return null!=e&&e.isFraction?new g(String(e.n)).div(String(e.d)).times(String(e.s)):new g(e+"")},Fraction:function(e){return new y(e)},Complex:function(e){return e},number:function(e){return null!=e&&e.isFraction?h(e):e}},w.prototype._numberConverter=function(){const e=w.typeConverters[this.valueType()];if(e)return e;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},w._getNumberConverter=function(e){if(!w.typeConverters[e])throw new TypeError('Unsupported type "'+e+'"');return w.typeConverters[e]};for(const e in P)if(me(P,e)){const t=P[e];t.dimensions=t.base.dimensions}for(const e in j)if(me(j,e)){const t=P[j[e]],n={};for(const e in t)me(t,e)&&(n[e]=t[e]);n.name=e,P[e]=n}return w.isValidAlpha=function(e){return/^[a-zA-Z]$/.test(e)},w.createUnit=function(e,t){if("object"!=typeof e)throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(t&&t.override)for(const t in e)if(me(e,t)&&w.deleteUnit(t),e[t].aliases)for(let n=0;n0&&!w.isValidAlpha(A)&&!M(A))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+e+'"')}}(e);let n,r,i,o=null,a=[],s=0;if(t&&"Unit"===t.type)o=t.clone();else if("string"==typeof t)""!==t&&(n=t);else{if("object"!=typeof t)throw new TypeError('Cannot create unit "'+e+'" from "'+t.toString()+'": expecting "string" or "Unit" or "Object"');n=t.definition,r=t.prefixes,s=t.offset,i=t.baseName,t.aliases&&(a=t.aliases.valueOf())}if(a)for(let e=0;e1e-12){n=!1;break}if(n){t=!0,u.base=R[e];break}}if(!t){i=i||e+"_STUFF";const t={dimensions:o.dimensions.slice(0)};t.key=i,R[i]=t,$[i]={unit:u,prefix:z.NONE[""]},u.base=R[i]}}else{if(i=i||e+"_STUFF",k.indexOf(i)>=0)throw new Error('Cannot create new base unit "'+e+'": a base unit with that name already exists (and cannot be overridden)');k.push(i);for(const e in R)me(R,e)&&(R[e].dimensions[k.length-1]=0);const t={dimensions:[]};for(let e=0;e{let{typed:t,Unit:n}=e;return t($l,{Unit:function(e){return e.clone()},string:function(e){return n.isValuelessUnit(e)?new n(null,e):n.parse(e,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(e,t){return new n(e,t)},"number | BigNumber | Fraction":function(e){return new n(e)},"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),Gl="sparse",Vl=he(Gl,["typed","SparseMatrix"],(e=>{let{typed:t,SparseMatrix:n}=e;return t(Gl,{"":function(){return new n([])},string:function(e){return new n([],e)},"Array | Matrix":function(e){return new n(e)},"Array | Matrix, string":function(e,t){return new n(e,t)}})})),Zl="createUnit",Wl=he(Zl,["typed","Unit"],(e=>{let{typed:t,Unit:n}=e;return t(Zl,{"Object, Object":function(e,t){return n.createUnit(e,t)},Object:function(e){return n.createUnit(e,{})},"string, Unit | string | Object, Object":function(e,t,r){const i={};return i[e]=t,n.createUnit(i,r)},"string, Unit | string | Object":function(e,t){const r={};return r[e]=t,n.createUnit(r,{})},string:function(e){const t={};return t[e]={},n.createUnit(t,{})}})})),Yl="acos",Jl=he(Yl,["typed","config","Complex"],(e=>{let{typed:t,config:n,Complex:r}=e;return t(Yl,{number:function(e){return e>=-1&&e<=1||n.predictable?Math.acos(e):new r(e,0).acos()},Complex:function(e){return e.acos()},BigNumber:function(e){return e.acos()}})})),Xl="number";function Ql(e){return Ie(e)}function Kl(e){return Math.atan(1/e)}function ef(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}function tf(e){return Math.asin(1/e)}function nf(e){const t=1/e;return Math.log(t+Math.sqrt(t*t+1))}function rf(e){return Math.acos(1/e)}function of(e){const t=1/e,n=Math.sqrt(t*t-1);return Math.log(n+t)}function af(e){return ze(e)}function sf(e){return ke(e)}function uf(e){return 1/Math.tan(e)}function cf(e){const t=Math.exp(2*e);return(t+1)/(t-1)}function lf(e){return 1/Math.sin(e)}function ff(e){return 0===e?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*be(e)}function pf(e){return 1/Math.cos(e)}function mf(e){return 2/(Math.exp(e)+Math.exp(-e))}function hf(e){return qe(e)}Ql.signature=Xl,Kl.signature=Xl,ef.signature=Xl,tf.signature=Xl,nf.signature=Xl,rf.signature=Xl,of.signature=Xl,af.signature=Xl,sf.signature=Xl,uf.signature=Xl,cf.signature=Xl,lf.signature=Xl,ff.signature=Xl,pf.signature=Xl,mf.signature=Xl,hf.signature=Xl;const df="acosh",gf=he(df,["typed","config","Complex"],(e=>{let{typed:t,config:n,Complex:r}=e;return t(df,{number:function(e){return e>=1||n.predictable?Ql(e):e<=-1?new r(Math.log(Math.sqrt(e*e-1)-e),Math.PI):new r(e,0).acosh()},Complex:function(e){return e.acosh()},BigNumber:function(e){return e.acosh()}})})),yf="acot",xf=he(yf,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t(yf,{number:Kl,Complex:function(e){return e.acot()},BigNumber:function(e){return new n(1).div(e).atan()}})})),bf="acoth",vf=he(bf,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(bf,{number:function(e){return e>=1||e<=-1||n.predictable?ef(e):new r(e,0).acoth()},Complex:function(e){return e.acoth()},BigNumber:function(e){return new i(1).div(e).atanh()}})})),wf="acsc",Nf=he(wf,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(wf,{number:function(e){return e<=-1||e>=1||n.predictable?tf(e):new r(e,0).acsc()},Complex:function(e){return e.acsc()},BigNumber:function(e){return new i(1).div(e).asin()}})})),Ef="acsch",Af=he(Ef,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t(Ef,{number:nf,Complex:function(e){return e.acsch()},BigNumber:function(e){return new n(1).div(e).asinh()}})})),Sf="asec",Mf=he(Sf,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(Sf,{number:function(e){return e<=-1||e>=1||n.predictable?rf(e):new r(e,0).asec()},Complex:function(e){return e.asec()},BigNumber:function(e){return new i(1).div(e).acos()}})})),Cf="asech",Tf=he(Cf,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(Cf,{number:function(e){if(e<=1&&e>=-1||n.predictable){const t=1/e;if(t>0||n.predictable)return of(e);const i=Math.sqrt(t*t-1);return new r(Math.log(i-t),Math.PI)}return new r(e,0).asech()},Complex:function(e){return e.asech()},BigNumber:function(e){return new i(1).div(e).acosh()}})})),Bf="asin",Df=he(Bf,["typed","config","Complex"],(e=>{let{typed:t,config:n,Complex:r}=e;return t(Bf,{number:function(e){return e>=-1&&e<=1||n.predictable?Math.asin(e):new r(e,0).asin()},Complex:function(e){return e.asin()},BigNumber:function(e){return e.asin()}})})),Ff=he("asinh",["typed"],(e=>{let{typed:t}=e;return t("asinh",{number:af,Complex:function(e){return e.asinh()},BigNumber:function(e){return e.asinh()}})})),Of=he("atan",["typed"],(e=>{let{typed:t}=e;return t("atan",{number:function(e){return Math.atan(e)},Complex:function(e){return e.atan()},BigNumber:function(e){return e.atan()}})})),_f="atan2",If=he(_f,["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,BigNumber:i,DenseMatrix:o,concat:a}=e;const s=aa({typed:t,equalScalar:r}),u=sa({typed:t}),c=Va({typed:t,equalScalar:r}),l=qo({typed:t,equalScalar:r}),f=Po({typed:t,DenseMatrix:o}),p=fa({typed:t,matrix:n,concat:a});return t(_f,{"number, number":Math.atan2,"BigNumber, BigNumber":(e,t)=>i.atan2(e,t)},p({scalar:"number | BigNumber",SS:c,DS:u,SD:s,Ss:l,sS:f}))})),zf="atanh",kf=he(zf,["typed","config","Complex"],(e=>{let{typed:t,config:n,Complex:r}=e;return t(zf,{number:function(e){return e<=1&&e>=-1||n.predictable?sf(e):new r(e,0).atanh()},Complex:function(e){return e.atanh()},BigNumber:function(e){return e.atanh()}})})),Rf=he("trigUnit",["typed"],(e=>{let{typed:t}=e;return{Unit:t.referToSelf((e=>n=>{if(!n.hasBase(n.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return t.find(e,n.valueType())(n.value)}))}})),qf=he("cos",["typed"],(e=>{let{typed:t}=e;const n=Rf({typed:t});return t("cos",{number:Math.cos,"Complex | BigNumber":e=>e.cos()},n)})),Pf="cosh",jf=he(Pf,["typed"],(e=>{let{typed:t}=e;return t(Pf,{number:Re,"Complex | BigNumber":e=>e.cosh()})})),Uf=he("cot",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t("cot",{number:uf,Complex:e=>e.cot(),BigNumber:e=>new n(1).div(e.tan())},Rf({typed:t}))})),Lf="coth",$f=he(Lf,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t(Lf,{number:cf,Complex:e=>e.coth(),BigNumber:e=>new n(1).div(e.tanh())})})),Hf=he("csc",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t("csc",{number:lf,Complex:e=>e.csc(),BigNumber:e=>new n(1).div(e.sin())},Rf({typed:t}))})),Gf="csch",Vf=he(Gf,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t(Gf,{number:ff,Complex:e=>e.csch(),BigNumber:e=>new n(1).div(e.sinh())})})),Zf=he("sec",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t("sec",{number:pf,Complex:e=>e.sec(),BigNumber:e=>new n(1).div(e.cos())},Rf({typed:t}))})),Wf="sech",Yf=he(Wf,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t(Wf,{number:mf,Complex:e=>e.sech(),BigNumber:e=>new n(1).div(e.cosh())})})),Jf=he("sin",["typed"],(e=>{let{typed:t}=e;const n=Rf({typed:t});return t("sin",{number:Math.sin,"Complex | BigNumber":e=>e.sin()},n)})),Xf="sinh",Qf=he(Xf,["typed"],(e=>{let{typed:t}=e;return t(Xf,{number:hf,"Complex | BigNumber":e=>e.sinh()})})),Kf=he("tan",["typed"],(e=>{let{typed:t}=e;const n=Rf({typed:t});return t("tan",{number:Math.tan,"Complex | BigNumber":e=>e.tan()},n)})),ep=he("tanh",["typed"],(e=>{let{typed:t}=e;return t("tanh",{number:Pe,"Complex | BigNumber":e=>e.tanh()})})),tp="setCartesian",np=he(tp,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{let{typed:t,size:n,subset:r,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(tp,{"Array | Matrix, Array | Matrix":function(e,t){let s=[];if(0!==r(n(e),new o(0))&&0!==r(n(t),new o(0))){const n=zr(Array.isArray(e)?e:e.toArray()).sort(i),r=zr(Array.isArray(t)?t:t.toArray()).sort(i);s=[];for(let e=0;e{let{typed:t,size:n,subset:r,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(rp,{"Array | Matrix, Array | Matrix":function(e,t){let s;if(0===r(n(e),new o(0)))s=[];else{if(0===r(n(t),new o(0)))return zr(e.toArray());{const n=Ur(zr(Array.isArray(e)?e:e.toArray()).sort(i)),r=Ur(zr(Array.isArray(t)?t:t.toArray()).sort(i));let o;s=[];for(let e=0;e{let{typed:t,size:n,subset:r,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(op,{"Array | Matrix":function(e){let t;if(0===r(n(e),new o(0)))t=[];else{const n=zr(Array.isArray(e)?e:e.toArray()).sort(i);t=[],t.push(n[0]);for(let e=1;e{let{typed:t,size:n,subset:r,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(sp,{"Array | Matrix, Array | Matrix":function(e,t){let s;if(0===r(n(e),new o(0))||0===r(n(t),new o(0)))s=[];else{const n=Ur(zr(Array.isArray(e)?e:e.toArray()).sort(i)),r=Ur(zr(Array.isArray(t)?t:t.toArray()).sort(i));s=[];for(let e=0;e{let{typed:t,size:n,subset:r,compareNatural:i,Index:o}=e;return t(cp,{"Array | Matrix, Array | Matrix":function(e,t){if(0===r(n(e),new o(0)))return!0;if(0===r(n(t),new o(0)))return!1;const a=Ur(zr(Array.isArray(e)?e:e.toArray()).sort(i)),s=Ur(zr(Array.isArray(t)?t:t.toArray()).sort(i));let u;for(let e=0;e{let{typed:t,size:n,subset:r,compareNatural:i,Index:o}=e;return t(fp,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(e,t){if(0===r(n(t),new o(0)))return 0;const a=zr(Array.isArray(t)?t:t.toArray());let s=0;for(let t=0;t{let{typed:t,size:n,subset:r,compareNatural:i,Index:o}=e;return t(mp,{"Array | Matrix":function(e){if(0===r(n(e),new o(0)))return[];const t=zr(Array.isArray(e)?e:e.toArray()).sort(i),s=[];let u=0;for(;u.toString(2).length<=t.length;)s.push(a(t,u.toString(2).split("").reverse())),u++;return function(e){let t=[];for(let n=e.length-1;n>0;n--)for(let r=0;re[r+1].length&&(t=e[r],e[r]=e[r+1],e[r+1]=t);return e}(s)}});function a(e,t){const n=[];for(let r=0;r{let{typed:t,compareNatural:n}=e;return t(dp,{"Array | Matrix":function(e){return Array.isArray(e)?zr(e).length:zr(e.toArray()).length},"Array | Matrix, boolean":function(e,t){if(!1===t||0===e.length)return Array.isArray(e)?zr(e).length:zr(e.toArray()).length;{const t=zr(Array.isArray(e)?e:e.toArray()).sort(n);let r=1;for(let e=1;e{let{typed:t,size:n,concat:r,subset:i,setDifference:o,Index:a}=e;return t(yp,{"Array | Matrix, Array | Matrix":function(e,t){if(0===i(n(e),new a(0)))return zr(t);if(0===i(n(t),new a(0)))return zr(e);const s=zr(e),u=zr(t);return r(o(s,u),o(u,s))}})})),bp="setUnion",vp=he(bp,["typed","size","concat","subset","setIntersect","setSymDifference","Index"],(e=>{let{typed:t,size:n,concat:r,subset:i,setIntersect:o,setSymDifference:a,Index:s}=e;return t(bp,{"Array | Matrix, Array | Matrix":function(e,t){if(0===i(n(e),new s(0)))return zr(t);if(0===i(n(t),new s(0)))return zr(e);const u=zr(e),c=zr(t);return r(a(u,c),o(u,c))}})})),wp=he("add",["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],(e=>{let{typed:t,matrix:n,addScalar:r,equalScalar:i,DenseMatrix:o,SparseMatrix:a,concat:s}=e;const u=ma({typed:t}),c=ha({typed:t,equalScalar:i}),l=da({typed:t,DenseMatrix:o}),f=fa({typed:t,matrix:n,concat:s});return t("add",{"any, any":r,"any, any, ...any":t.referToSelf((e=>(t,n,r)=>{let i=e(t,n);for(let t=0;t{let{typed:t,abs:n,addScalar:r,divideScalar:i,multiplyScalar:o,sqrt:a,smaller:s,isPositive:u}=e;return t(Np,{"... number | BigNumber":c,Array:c,Matrix:e=>c(zr(e.toArray(),!0))});function c(e){let t=0,c=0;for(let a=0;a{let{typed:t,abs:n,add:r,pow:i,conj:o,sqrt:a,multiply:s,equalScalar:u,larger:c,smaller:l,matrix:f,ctranspose:p,eigs:m}=e;return t(Ap,{number:Math.abs,Complex:function(e){return e.abs()},BigNumber:function(e){return e.abs()},boolean:function(e){return Math.abs(e)},Array:function(e){return h(f(e),2)},Matrix:function(e){return h(e,2)},"Array, number | BigNumber | string":function(e,t){return h(f(e),t)},"Matrix, number | BigNumber | string":function(e,t){return h(e,t)}});function h(e,t){const f=e.size();if(1===f.length)return function(e,t){if(t===Number.POSITIVE_INFINITY||"inf"===t)return function(e){let t=0;return e.forEach((function(e){const r=n(e);c(r,t)&&(t=r)}),!0),t}(e);if(t===Number.NEGATIVE_INFINITY||"-inf"===t)return function(e){let t;return e.forEach((function(e){const r=n(e);t&&!l(r,t)||(t=r)}),!0),t||0}(e);if("fro"===t)return h(e,2);if("number"==typeof t&&!isNaN(t)){if(!u(t,0)){let o=0;return e.forEach((function(e){o=r(i(n(e),t),o)}),!0),i(o,1/t)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}(e,t);if(2===f.length){if(f[0]&&f[1])return function(e,t){if(1===t)return function(e){const t=[];let i=0;return e.forEach((function(e,o){const a=o[1],s=r(t[a]||0,n(e));c(s,i)&&(i=s),t[a]=s}),!0),i}(e);if(t===Number.POSITIVE_INFINITY||"inf"===t)return function(e){const t=[];let i=0;return e.forEach((function(e,o){const a=o[0],s=r(t[a]||0,n(e));c(s,i)&&(i=s),t[a]=s}),!0),i}(e);if("fro"===t)return function(e){let t=0;return e.forEach((function(e,n){t=r(t,s(e,o(e)))})),n(a(t))}(e);if(2===t)return function(e){const t=e.size();if(t[0]!==t[1])throw new RangeError("Invalid matrix dimensions");const r=p(e),i=s(r,e),o=m(i).values.toArray(),u=o[o.length-1];return n(a(u))}(e);throw new Error("Unsupported parameter value "+t)}(e,t);throw new RangeError("Invalid matrix dimensions")}}})),Mp=he("dot",["typed","addScalar","multiplyScalar","conj","size"],(e=>{let{typed:t,addScalar:n,multiplyScalar:r,conj:i,size:o}=e;return t("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(e,o){const u=a(e,o),c=E(e)?e._data:e,l=E(e)?e._datatype||e.getDataType():void 0,f=E(o)?o._data:o,p=E(o)?o._datatype||o.getDataType():void 0,m=2===s(e).length,h=2===s(o).length;let d=n,g=r;if(l&&p&&l===p&&"string"==typeof l&&"mixed"!==l){const e=l;d=t.find(n,[e,e]),g=t.find(r,[e,e])}if(!m&&!h){let e=g(i(c[0]),f[0]);for(let t=1;tt?m++:e===t&&(c=l(c,f(o[p],u[m])),p++,m++)}return c}});function a(e,t){const n=s(e),r=s(t);let i,o;if(1===n.length)i=n[0];else{if(2!==n.length||1!==n[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+n.join(", ")+")");i=n[0]}if(1===r.length)o=r[0];else{if(2!==r.length||1!==r[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+r.join(", ")+")");o=r[0]}if(i!==o)throw new RangeError("Vectors must have equal length ("+i+" != "+o+")");if(0===i)throw new RangeError("Cannot calculate the dot product of empty vectors");return i}function s(e){return E(e)?e.size():o(e)}})),Cp=he("trace",["typed","matrix","add"],(e=>{let{typed:t,matrix:n,add:r}=e;return t("trace",{Array:function(e){return i(n(e))},SparseMatrix:function(e){const t=e._values,n=e._index,i=e._ptr,o=e._size,a=o[0],s=o[1];if(a===s){let e=0;if(t.length>0)for(let o=0;oo)break}}return e}throw new RangeError("Matrix must be square (size: "+pr(o)+")")},DenseMatrix:i,any:ae});function i(e){const t=e._size,n=e._data;switch(t.length){case 1:if(1===t[0])return ae(n[0]);throw new RangeError("Matrix must be square (size: "+pr(t)+")");case 2:{const e=t[0];if(e===t[1]){let t=0;for(let i=0;i{let{typed:t,Index:n}=e;return t(Tp,{"...number | string | BigNumber | Range | Array | Matrix":function(e){const t=e.map((function(e){return g(e)?e.toNumber():N(e)||E(e)?e.map((function(e){return g(e)?e.toNumber():e})):e})),r=new n;return n.apply(r,t),r}})})),Dp=new Set(["end"]),Fp=he("Node",["mathWithTransform"],(e=>{let{mathWithTransform:t}=e;return class{get type(){return"Node"}get isNode(){return!0}evaluate(e){return this.compile().evaluate(e)}compile(){const e=this._compile(t,{}),n={};return{evaluate:function(t){const r=h(t);return function(e){for(const t of[...Dp])if(e.has(t))throw new Error('Scope contains an illegal symbol, "'+t+'" is a reserved keyword')}(r),e(r,n,null)}}}_compile(e,t){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(e){throw new Error("Cannot run forEach on a Node interface")}map(e){throw new Error("Cannot run map on a Node interface")}_ifNode(e){if(!X(e))throw new TypeError("Callback function must return a Node");return e}traverse(e){e(this,null,null),function e(t,n){t.forEach((function(t,r,i){n(t,r,i),e(t,n)}))}(this,e)}transform(e){return function t(n,r,i){const o=e(n,r,i);return o!==n?o:n.map(t)}(this,null,null)}filter(e){const t=[];return this.traverse((function(n,r,i){e(n,r,i)&&t.push(n)})),t}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map((function(e){return e.cloneDeep()}))}equals(e){return!!e&&this.type===e.type&&ce(this,e)}toString(e){const t=this._getCustomString(e);return void 0!==t?t:this._toString(e)}_toString(){throw new Error("_toString not implemented for "+this.type)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(e){const t=this._getCustomString(e);return void 0!==t?t:this._toHTML(e)}_toHTML(){throw new Error("_toHTML not implemented for "+this.type)}toTex(e){const t=this._getCustomString(e);return void 0!==t?t:this._toTex(e)}_toTex(e){throw new Error("_toTex not implemented for "+this.type)}_getCustomString(e){if(e&&"object"==typeof e)switch(typeof e.handler){case"object":case"undefined":return;case"function":return e.handler(this,e);default:throw new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}}),{isClass:!0,isNode:!0});function Op(e){return Op="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Op(e)}function _p(e,t,n){return(t=function(e){var t=function(e){if("object"!=Op(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Op(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Op(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ip(e){return e&&e.isIndexError?new br(e.index+1,e.min+1,void 0!==e.max?e.max+1:void 0):e}function zp(e){let{subset:t}=e;return function(e,n){try{if(Array.isArray(e))return t(e,n);if(e&&"function"==typeof e.subset)return e.subset(n);if("string"==typeof e)return t(e,n);if("object"==typeof e){if(!n.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return i(e,n.getObjectProperty())}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw Ip(e)}}}const kp="AccessorNode",Rp=he(kp,["subset","Node"],(e=>{let{subset:t,Node:n}=e;const r=zp({subset:t});function o(e){return!(U(e)||L(e)||V(e)||Y(e)||Q(e)||ee(e)||re(e))}class a extends n{constructor(e,t){if(super(),!X(e))throw new TypeError('Node expected for parameter "object"');if(!J(t))throw new TypeError('IndexNode expected for parameter "index"');this.object=e,this.index=t}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return kp}get isAccessorNode(){return!0}_compile(e,t){const n=this.object._compile(e,t),o=this.index._compile(e,t);if(this.index.isObjectProperty()){const e=this.index.getObjectProperty();return function(t,r,o){return i(n(t,r,o),e)}}return function(e,t,i){const a=n(e,t,i),s=o(e,t,a);return r(a,s)}}forEach(e){e(this.object,"object",this),e(this.index,"index",this)}map(e){return new a(this._ifNode(e(this.object,"object",this)),this._ifNode(e(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(e){let t=this.object.toString(e);return o(this.object)&&(t="("+t+")"),t+this.index.toString(e)}_toHTML(e){let t=this.object.toHTML(e);return o(this.object)&&(t='('+t+')'),t+this.index.toHTML(e)}_toTex(e){let t=this.object.toTex(e);return o(this.object)&&(t="\\left(' + object + '\\right)"),t+this.index.toTex(e)}toJSON(){return{mathjs:kp,object:this.object,index:this.index}}static fromJSON(e){return new a(e.object,e.index)}}return _p(a,"name",kp),a}),{isClass:!0,isNode:!0}),qp="ArrayNode",Pp=he(qp,["Node"],(e=>{let{Node:t}=e;class n extends t{constructor(e){if(super(),this.items=e||[],!Array.isArray(this.items)||!this.items.every(X))throw new TypeError("Array containing Nodes expected")}get type(){return qp}get isArrayNode(){return!0}_compile(e,t){const n=kr(this.items,(function(n){return n._compile(e,t)}));if("Array"!==e.config.matrix){const t=e.matrix;return function(e,r,i){return t(kr(n,(function(t){return t(e,r,i)})))}}return function(e,t,r){return kr(n,(function(n){return n(e,t,r)}))}}forEach(e){for(let t=0;t[
'+this.items.map((function(t){return t.toHTML(e)})).join(',')+']'}_toTex(e){return function t(n,r){const i=n.some(L)&&!n.every(L),o=r||i,a=o?"&":"\\\\",s=n.map((function(n){return n.items?t(n.items,!r):n.toTex(e)})).join(a);return i||!o||o&&!r?"\\begin{bmatrix}"+s+"\\end{bmatrix}":s}(this.items,!1)}}return _p(n,"name",qp),n}),{isClass:!0,isNode:!0}),jp=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{op:"or",associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{op:"xor",associativity:"left",associativeWith:[]}},{"OperatorNode:and":{op:"and",associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{op:"|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{op:"^|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{op:"&",associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{op:"==",associativity:"left",associativeWith:[]},"OperatorNode:unequal":{op:"!=",associativity:"left",associativeWith:[]},"OperatorNode:smaller":{op:"<",associativity:"left",associativeWith:[]},"OperatorNode:larger":{op:">",associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{op:"<=",associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{op:">=",associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{op:"<<",associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{op:">>",associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{op:">>>",associativity:"left",associativeWith:[]}},{"OperatorNode:to":{op:"to",associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{op:"+",associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{op:"-",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{op:"*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{op:"/",associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{op:".*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{op:"./",associativity:"left",associativeWith:[]},"OperatorNode:mod":{op:"mod",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]}},{"OperatorNode:unaryPlus":{op:"+",associativity:"right"},"OperatorNode:unaryMinus":{op:"-",associativity:"right"},"OperatorNode:bitNot":{op:"~",associativity:"right"},"OperatorNode:not":{op:"not",associativity:"right"}},{"OperatorNode:pow":{op:"^",associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{op:".^",associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{op:"!",associativity:"left"}},{"OperatorNode:ctranspose":{op:"'",associativity:"left"}}];function Up(e,t){if(!t||"auto"!==t)return e;let n=e;for(;ee(n);)n=n.content;return n}function Lp(e,t,n,r){let i=e;"keep"!==t&&(i=e.getContent());const o=i.getIdentifier();let a=null;for(let e=0;e{let{subset:t,matrix:n,Node:r}=e;const a=zp({subset:t}),s=function(e){let{subset:t,matrix:n}=e;return function(e,r,i){try{if(Array.isArray(e))return n(e).subset(r,i).valueOf().forEach(((t,n)=>{e[n]=t})),e;if(e&&"function"==typeof e.subset)return e.subset(r,i);if("string"==typeof e)return t(e,r,i);if("object"==typeof e){if(!r.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return o(e,r.getObjectProperty(),i),e}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw Ip(e)}}}({subset:t,matrix:n});function u(e,t,n){t||(t="keep");const r=Lp(e,t,n),i=Lp(e.value,t,n);return"all"===t||null!==i&&i<=r}class c extends r{constructor(e,t,n){if(super(),this.object=e,this.index=n?t:null,this.value=n||t,!re(e)&&!U(e))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(re(e)&&"end"===e.name)throw new Error('Cannot assign to symbol "end"');if(this.index&&!J(this.index))throw new TypeError('IndexNode expected as "index"');if(!X(this.value))throw new TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return Gp}get isAssignmentNode(){return!0}_compile(e,t){const n=this.object._compile(e,t),r=this.index?this.index._compile(e,t):null,u=this.value._compile(e,t),c=this.object.name;if(this.index){if(this.index.isObjectProperty()){const e=this.index.getObjectProperty();return function(t,r,i){const a=n(t,r,i),s=u(t,r,i);return o(a,e,s),s}}if(re(this.object))return function(e,t,i){const o=n(e,t,i),a=u(e,t,i),l=r(e,t,o);return e.set(c,s(o,l,a)),a};{const n=this.object.object._compile(e,t);if(this.object.index.isObjectProperty()){const e=this.object.index.getObjectProperty();return function(t,a,c){const l=n(t,a,c),f=i(l,e),p=r(t,a,f),m=u(t,a,c);return o(l,e,s(f,p,m)),m}}{const i=this.object.index._compile(e,t);return function(e,t,o){const c=n(e,t,o),l=i(e,t,c),f=a(c,l),p=r(e,t,f),m=u(e,t,o);return s(c,l,s(f,p,m)),m}}}}if(!re(this.object))throw new TypeError("SymbolNode expected as object");return function(e,t,n){const r=u(e,t,n);return e.set(c,r),r}}forEach(e){e(this.object,"object",this),this.index&&e(this.index,"index",this),e(this.value,"value",this)}map(e){const t=this._ifNode(e(this.object,"object",this)),n=this.index?this._ifNode(e(this.index,"index",this)):null,r=this._ifNode(e(this.value,"value",this));return new c(t,n,r)}clone(){return new c(this.object,this.index,this.value)}_toString(e){const t=this.object.toString(e),n=this.index?this.index.toString(e):"";let r=this.value.toString(e);return u(this,e&&e.parenthesis,e&&e.implicit)&&(r="("+r+")"),t+n+" = "+r}toJSON(){return{mathjs:Gp,object:this.object,index:this.index,value:this.value}}static fromJSON(e){return new c(e.object,e.index,e.value)}_toHTML(e){const t=this.object.toHTML(e),n=this.index?this.index.toHTML(e):"";let r=this.value.toHTML(e);return u(this,e&&e.parenthesis,e&&e.implicit)&&(r='('+r+')'),t+n+'='+r}_toTex(e){const t=this.object.toTex(e),n=this.index?this.index.toTex(e):"";let r=this.value.toTex(e);return u(this,e&&e.parenthesis,e&&e.implicit)&&(r=`\\left(${r}\\right)`),t+n+"="+r}}return _p(c,"name",Gp),c}),{isClass:!0,isNode:!0}),Zp="BlockNode",Wp=he(Zp,["ResultSet","Node"],(e=>{let{ResultSet:t,Node:n}=e;class r extends n{constructor(e){if(super(),!Array.isArray(e))throw new Error("Array expected");this.blocks=e.map((function(e){const t=e&&e.node,n=!e||void 0===e.visible||e.visible;if(!X(t))throw new TypeError('Property "node" must be a Node');if("boolean"!=typeof n)throw new TypeError('Property "visible" must be a boolean');return{node:t,visible:n}}))}get type(){return Zp}get isBlockNode(){return!0}_compile(e,n){const r=kr(this.blocks,(function(t){return{evaluate:t.node._compile(e,n),visible:t.visible}}));return function(e,n,i){const o=[];return Rr(r,(function(t){const r=t.evaluate(e,n,i);t.visible&&o.push(r)})),new t(o)}}forEach(e){for(let t=0;t;')})).join('
')}_toTex(e){return this.blocks.map((function(t){return t.node.toTex(e)+(t.visible?"":";")})).join("\\;\\;\n")}}return _p(r,"name",Zp),r}),{isClass:!0,isNode:!0}),Yp="ConditionalNode",Jp=he(Yp,["Node"],(e=>{let{Node:t}=e;class n extends t{constructor(e,t,n){if(super(),!X(e))throw new TypeError("Parameter condition must be a Node");if(!X(t))throw new TypeError("Parameter trueExpr must be a Node");if(!X(n))throw new TypeError("Parameter falseExpr must be a Node");this.condition=e,this.trueExpr=t,this.falseExpr=n}get type(){return Yp}get isConditionalNode(){return!0}_compile(e,t){const n=this.condition._compile(e,t),r=this.trueExpr._compile(e,t),i=this.falseExpr._compile(e,t);return function(e,t,o){return function(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return!!e;if(e){if(g(e))return!e.isZero();if(x(e))return!(!e.re&&!e.im);if(v(e))return!!e.value}if(null==e)return!1;throw new TypeError('Unsupported type of condition "'+oe(e)+'"')}(n(e,t,o))?r(e,t,o):i(e,t,o)}}forEach(e){e(this.condition,"condition",this),e(this.trueExpr,"trueExpr",this),e(this.falseExpr,"falseExpr",this)}map(e){return new n(this._ifNode(e(this.condition,"condition",this)),this._ifNode(e(this.trueExpr,"trueExpr",this)),this._ifNode(e(this.falseExpr,"falseExpr",this)))}clone(){return new n(this.condition,this.trueExpr,this.falseExpr)}_toString(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=Lp(this,t,e&&e.implicit);let r=this.condition.toString(e);const i=Lp(this.condition,t,e&&e.implicit);("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=n)&&(r="("+r+")");let o=this.trueExpr.toString(e);const a=Lp(this.trueExpr,t,e&&e.implicit);("all"===t||"OperatorNode"===this.trueExpr.type||null!==a&&a<=n)&&(o="("+o+")");let s=this.falseExpr.toString(e);const u=Lp(this.falseExpr,t,e&&e.implicit);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==u&&u<=n)&&(s="("+s+")"),r+" ? "+o+" : "+s}toJSON(){return{mathjs:Yp,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(e){return new n(e.condition,e.trueExpr,e.falseExpr)}_toHTML(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=Lp(this,t,e&&e.implicit);let r=this.condition.toHTML(e);const i=Lp(this.condition,t,e&&e.implicit);("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=n)&&(r='('+r+')');let o=this.trueExpr.toHTML(e);const a=Lp(this.trueExpr,t,e&&e.implicit);("all"===t||"OperatorNode"===this.trueExpr.type||null!==a&&a<=n)&&(o='('+o+')');let s=this.falseExpr.toHTML(e);const u=Lp(this.falseExpr,t,e&&e.implicit);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==u&&u<=n)&&(s='('+s+')'),r+'?'+o+':'+s}_toTex(e){return"\\begin{cases} {"+this.trueExpr.toTex(e)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(e)+"}\\\\{"+this.falseExpr.toTex(e)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return _p(n,"name",Yp),n}),{isClass:!0,isNode:!0});var Xp=n(3144);const Qp={Alpha:"A",alpha:"\\alpha",Beta:"B",beta:"\\beta",Gamma:"\\Gamma",gamma:"\\gamma",Delta:"\\Delta",delta:"\\delta",Epsilon:"E",epsilon:"\\epsilon",varepsilon:"\\varepsilon",Zeta:"Z",zeta:"\\zeta",Eta:"H",eta:"\\eta",Theta:"\\Theta",theta:"\\theta",vartheta:"\\vartheta",Iota:"I",iota:"\\iota",Kappa:"K",kappa:"\\kappa",varkappa:"\\varkappa",Lambda:"\\Lambda",lambda:"\\lambda",Mu:"M",mu:"\\mu",Nu:"N",nu:"\\nu",Xi:"\\Xi",xi:"\\xi",Omicron:"O",omicron:"o",Pi:"\\Pi",pi:"\\pi",varpi:"\\varpi",Rho:"P",rho:"\\rho",varrho:"\\varrho",Sigma:"\\Sigma",sigma:"\\sigma",varsigma:"\\varsigma",Tau:"T",tau:"\\tau",Upsilon:"\\Upsilon",upsilon:"\\upsilon",Phi:"\\Phi",phi:"\\phi",varphi:"\\varphi",Chi:"X",chi:"\\chi",Psi:"\\Psi",psi:"\\psi",Omega:"\\Omega",omega:"\\omega",true:"\\mathrm{True}",false:"\\mathrm{False}",i:"i",inf:"\\infty",Inf:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:"\\lim",undefined:"\\mathbf{?}"},Kp={transpose:"^\\top",ctranspose:"^H",factorial:"!",pow:"^",dotPow:".^\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"\\~",not:"\\neg",multiply:"\\cdot",divide:"\\frac",dotMultiply:".\\cdot",dotDivide:".:",mod:"\\mod",add:"+",subtract:"-",to:"\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"},em={abs:{1:"\\left|${args[0]}\\right|"},add:{2:`\\left(\${args[0]}${Kp.add}\${args[1]}\\right)`},cbrt:{1:"\\sqrt[3]{${args[0]}}"},ceil:{1:"\\left\\lceil${args[0]}\\right\\rceil"},cube:{1:"\\left(${args[0]}\\right)^3"},divide:{2:"\\frac{${args[0]}}{${args[1]}}"},dotDivide:{2:`\\left(\${args[0]}${Kp.dotDivide}\${args[1]}\\right)`},dotMultiply:{2:`\\left(\${args[0]}${Kp.dotMultiply}\${args[1]}\\right)`},dotPow:{2:`\\left(\${args[0]}${Kp.dotPow}\${args[1]}\\right)`},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:`\\left(e${Kp.pow}{\${args[0]}}-1\\right)`,fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},fraction:{2:"\\frac{${args[0]}}{${args[1]}}"},gcd:"\\gcd\\left(${args}\\right)",hypot:"\\hypot\\left(${args}\\right)",log:{1:"\\ln\\left(${args[0]}\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}\\right)"},log10:{1:"\\log_{10}\\left(${args[0]}\\right)"},log1p:{1:"\\ln\\left(${args[0]}+1\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}+1\\right)"},log2:"\\log_{2}\\left(${args[0]}\\right)",mod:{2:`\\left(\${args[0]}${Kp.mod}\${args[1]}\\right)`},multiply:{2:`\\left(\${args[0]}${Kp.multiply}\${args[1]}\\right)`},norm:{1:"\\left\\|${args[0]}\\right\\|",2:void 0},nthRoot:{2:"\\sqrt[${args[1]}]{${args[0]}}"},nthRoots:{2:"\\{y : y^${args[1]} = {${args[0]}}\\}"},pow:{2:`\\left(\${args[0]}\\right)${Kp.pow}{\${args[1]}}`},round:{1:"\\left\\lfloor${args[0]}\\right\\rceil",2:void 0},sign:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},sqrt:{1:"\\sqrt{${args[0]}}"},square:{1:"\\left(${args[0]}\\right)^2"},subtract:{2:`\\left(\${args[0]}${Kp.subtract}\${args[1]}\\right)`},unaryMinus:{1:`${Kp.unaryMinus}\\left(\${args[0]}\\right)`},unaryPlus:{1:`${Kp.unaryPlus}\\left(\${args[0]}\\right)`},bitAnd:{2:`\\left(\${args[0]}${Kp.bitAnd}\${args[1]}\\right)`},bitNot:{1:Kp.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:`\\left(\${args[0]}${Kp.bitOr}\${args[1]}\\right)`},bitXor:{2:`\\left(\${args[0]}${Kp.bitXor}\${args[1]}\\right)`},leftShift:{2:`\\left(\${args[0]}${Kp.leftShift}\${args[1]}\\right)`},rightArithShift:{2:`\\left(\${args[0]}${Kp.rightArithShift}\${args[1]}\\right)`},rightLogShift:{2:`\\left(\${args[0]}${Kp.rightLogShift}\${args[1]}\\right)`},bellNumbers:{1:"\\mathrm{B}_{${args[0]}}"},catalan:{1:"\\mathrm{C}_{${args[0]}}"},stirlingS2:{2:"\\mathrm{S}\\left(${args}\\right)"},arg:{1:"\\arg\\left(${args[0]}\\right)"},conj:{1:"\\left(${args[0]}\\right)^*"},im:{1:"\\Im\\left\\lbrace${args[0]}\\right\\rbrace"},re:{1:"\\Re\\left\\lbrace${args[0]}\\right\\rbrace"},and:{2:`\\left(\${args[0]}${Kp.and}\${args[1]}\\right)`},not:{1:Kp.not+"\\left(${args[0]}\\right)"},or:{2:`\\left(\${args[0]}${Kp.or}\${args[1]}\\right)`},xor:{2:`\\left(\${args[0]}${Kp.xor}\${args[1]}\\right)`},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:`\\left(\${args[0]}\\right)${Kp.ctranspose}`},det:{1:"\\det\\left(${args[0]}\\right)"},dot:{2:"\\left(${args[0]}\\cdot${args[1]}\\right)"},expm:{1:"\\exp\\left(${args[0]}\\right)"},inv:{1:"\\left(${args[0]}\\right)^{-1}"},pinv:{1:"\\left(${args[0]}\\right)^{+}"},sqrtm:{1:`{\${args[0]}}${Kp.pow}{\\frac{1}{2}}`},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:`\\left(\${args[0]}\\right)${Kp.transpose}`},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:`\\left(\${args[0]}\\right)${Kp.factorial}`},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:`\\left(\${args[0]}${Kp.equal}\${args[1]}\\right)`},larger:{2:`\\left(\${args[0]}${Kp.larger}\${args[1]}\\right)`},largerEq:{2:`\\left(\${args[0]}${Kp.largerEq}\${args[1]}\\right)`},smaller:{2:`\\left(\${args[0]}${Kp.smaller}\${args[1]}\\right)`},smallerEq:{2:`\\left(\${args[0]}${Kp.smallerEq}\${args[1]}\\right)`},unequal:{2:`\\left(\${args[0]}${Kp.unequal}\${args[1]}\\right)`},erf:{1:"erf\\left(${args[0]}\\right)"},max:"\\max\\left(${args}\\right)",min:"\\min\\left(${args}\\right)",variance:"\\mathrm{Var}\\left(${args}\\right)",acos:{1:"\\cos^{-1}\\left(${args[0]}\\right)"},acosh:{1:"\\cosh^{-1}\\left(${args[0]}\\right)"},acot:{1:"\\cot^{-1}\\left(${args[0]}\\right)"},acoth:{1:"\\coth^{-1}\\left(${args[0]}\\right)"},acsc:{1:"\\csc^{-1}\\left(${args[0]}\\right)"},acsch:{1:"\\mathrm{csch}^{-1}\\left(${args[0]}\\right)"},asec:{1:"\\sec^{-1}\\left(${args[0]}\\right)"},asech:{1:"\\mathrm{sech}^{-1}\\left(${args[0]}\\right)"},asin:{1:"\\sin^{-1}\\left(${args[0]}\\right)"},asinh:{1:"\\sinh^{-1}\\left(${args[0]}\\right)"},atan:{1:"\\tan^{-1}\\left(${args[0]}\\right)"},atan2:{2:"\\mathrm{atan2}\\left(${args}\\right)"},atanh:{1:"\\tanh^{-1}\\left(${args[0]}\\right)"},cos:{1:"\\cos\\left(${args[0]}\\right)"},cosh:{1:"\\cosh\\left(${args[0]}\\right)"},cot:{1:"\\cot\\left(${args[0]}\\right)"},coth:{1:"\\coth\\left(${args[0]}\\right)"},csc:{1:"\\csc\\left(${args[0]}\\right)"},csch:{1:"\\mathrm{csch}\\left(${args[0]}\\right)"},sec:{1:"\\sec\\left(${args[0]}\\right)"},sech:{1:"\\mathrm{sech}\\left(${args[0]}\\right)"},sin:{1:"\\sin\\left(${args[0]}\\right)"},sinh:{1:"\\sinh\\left(${args[0]}\\right)"},tan:{1:"\\tan\\left(${args[0]}\\right)"},tanh:{1:"\\tanh\\left(${args[0]}\\right)"},to:{2:`\\left(\${args[0]}${Kp.to}\${args[1]}\\right)`},numeric:function(e,t){return e.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},bigint:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:`\\left(\\left(\${args[0]}\\right)+${Qp.i}\\cdot\\left(\${args[1]}\\right)\\right)`},matrix:{0:"\\begin{bmatrix}\\end{bmatrix}",1:"\\left(${args[0]}\\right)",2:"\\left(${args[0]}\\right)"},sparse:{0:"\\begin{bsparse}\\end{bsparse}",1:"\\left(${args[0]}\\right)"},unit:{1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"}},tm={deg:"^\\circ"};function nm(e){return Xp(e,{preserveFormatting:!0})}function rm(e,t){return(t=void 0!==t&&t)?me(tm,e)?tm[e]:"\\mathrm{"+nm(e)+"}":me(Qp,e)?Qp[e]:nm(e)}const im="ConstantNode",om=he(im,["Node"],(e=>{let{Node:t}=e;class n extends t{constructor(e){super(),this.value=e}get type(){return im}get isConstantNode(){return!0}_compile(e,t){const n=this.value;return function(){return n}}forEach(e){}map(e){return this.clone()}clone(){return new n(this.value)}_toString(e){return pr(this.value,e)}_toHTML(e){const t=this._toString(e);switch(oe(this.value)){case"number":case"bigint":case"BigNumber":case"Fraction":return''+t+"";case"string":return''+t+"";case"boolean":return''+t+"";case"null":return''+t+"";case"undefined":return''+t+"";default:return''+t+""}}toJSON(){return{mathjs:im,value:this.value}}static fromJSON(e){return new n(e.value)}_toTex(e){const t=this._toString(e),n=oe(this.value);switch(n){case"string":return"\\mathtt{"+nm(t)+"}";case"number":case"BigNumber":{if(!("BigNumber"===n?this.value.isFinite():isFinite(this.value)))return this.value.valueOf()<0?"-\\infty":"\\infty";const e=t.toLowerCase().indexOf("e");return-1!==e?t.substring(0,e)+"\\cdot10^{"+t.substring(e+1)+"}":t}case"bigint":return t.toString();case"Fraction":return this.value.toLatex();default:return t}}}return _p(n,"name",im),n}),{isClass:!0,isNode:!0}),am="FunctionAssignmentNode",sm=he(am,["typed","Node"],(e=>{let{typed:t,Node:n}=e;function r(e,t,n){const r=Lp(e,t,n),i=Lp(e.expr,t,n);return"all"===t||null!==i&&i<=r}class i extends n{constructor(e,t,n){if(super(),"string"!=typeof e)throw new TypeError('String expected for parameter "name"');if(!Array.isArray(t))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!X(n))throw new TypeError('Node expected for parameter "expr"');if(Dp.has(e))throw new Error('Illegal function name, "'+e+'" is a reserved keyword');const r=new Set;for(const e of t){const t="string"==typeof e?e:e.name;if(r.has(t))throw new Error(`Duplicate parameter name "${t}"`);r.add(t)}this.name=e,this.params=t.map((function(e){return e&&e.name||e})),this.types=t.map((function(e){return e&&e.type||"any"})),this.expr=n}get type(){return am}get isFunctionAssignmentNode(){return!0}_compile(e,n){const r=Object.create(n);Rr(this.params,(function(e){r[e]=!0}));const i=this.expr._compile(e,r),o=this.name,a=this.params,s=jr(this.types,","),u=o+"("+jr(this.params,", ")+")";return function(e,n,r){const c={};c[s]=function(){const t=Object.create(n);for(let e=0;e'+dr(this.params[e])+"");let i=this.expr.toHTML(e);return r(this,t,e&&e.implicit)&&(i='('+i+')'),''+dr(this.name)+'('+n.join(',')+')='+i}_toTex(e){const t=e&&e.parenthesis?e.parenthesis:"keep";let n=this.expr.toTex(e);return r(this,t,e&&e.implicit)&&(n=`\\left(${n}\\right)`),"\\mathrm{"+this.name+"}\\left("+this.params.map(rm).join(",")+"\\right)="+n}}return _p(i,"name",am),i}),{isClass:!0,isNode:!0}),um="IndexNode",cm=he(um,["Node","size"],(e=>{let{Node:t,size:n}=e;class r extends t{constructor(e,t){if(super(),this.dimensions=e,this.dotNotation=t||!1,!Array.isArray(e)||!e.every(X))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}get type(){return um}get isIndexNode(){return!0}_compile(e,t){const r=kr(this.dimensions,(function(r,i){if(r.filter((e=>e.isSymbolNode&&"end"===e.name)).length>0){const o=Object.create(t);o.end=!0;const a=r._compile(e,o);return function(e,t,r){if(!E(r)&&!N(r)&&!w(r))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+oe(r));const o=n(r).valueOf(),s=Object.create(t);return s.end=o[i],a(e,s,r)}}return r._compile(e,t)})),o=i(e,"index");return function(e,t,n){const i=kr(r,(function(r){return r(e,t,n)}));return o(...i)}}forEach(e){for(let t=0;t.'+dr(this.getObjectProperty())+"":'['+t.join(',')+']'}_toTex(e){const t=this.dimensions.map((function(t){return t.toTex(e)}));return this.dotNotation?"."+this.getObjectProperty():"_{"+t.join(",")+"}"}}return _p(r,"name",um),r}),{isClass:!0,isNode:!0}),lm="ObjectNode",fm=he(lm,["Node"],(e=>{let{Node:t}=e;class n extends t{constructor(e){if(super(),this.properties=e||{},e&&("object"!=typeof e||!Object.keys(e).every((function(t){return X(e[t])}))))throw new TypeError("Object containing Nodes expected")}get type(){return lm}get isObjectNode(){return!0}_compile(e,t){const n={};for(const r in this.properties)if(me(this.properties,r)){const o=mr(r),a=JSON.parse(o),s=i(this.properties,r);n[a]=s._compile(e,t)}return function(e,t,r){const i={};for(const o in n)me(n,o)&&(i[o]=n[o](e,t,r));return i}}forEach(e){for(const t in this.properties)me(this.properties,t)&&e(this.properties[t],"properties["+mr(t)+"]",this)}map(e){const t={};for(const n in this.properties)me(this.properties,n)&&(t[n]=this._ifNode(e(this.properties[n],"properties["+mr(n)+"]",this)));return new n(t)}clone(){const e={};for(const t in this.properties)me(this.properties,t)&&(e[t]=this.properties[t]);return new n(e)}_toString(e){const t=[];for(const n in this.properties)me(this.properties,n)&&t.push(mr(n)+": "+this.properties[n].toString(e));return"{"+t.join(", ")+"}"}toJSON(){return{mathjs:lm,properties:this.properties}}static fromJSON(e){return new n(e.properties)}_toHTML(e){const t=[];for(const n in this.properties)me(this.properties,n)&&t.push(''+dr(n)+':'+this.properties[n].toHTML(e));return'{'+t.join(',')+'}'}_toTex(e){const t=[];for(const n in this.properties)me(this.properties,n)&&t.push("\\mathbf{"+n+":} & "+this.properties[n].toTex(e)+"\\\\");return"\\left\\{\\begin{array}{ll}"+t.join("\n")+"\\end{array}\\right\\}"}}return _p(n,"name",lm),n}),{isClass:!0,isNode:!0});function pm(e,t){return new f(e,new l(t),new Set(Object.keys(t)))}const mm="OperatorNode",hm=he(mm,["Node"],(e=>{let{Node:t}=e;function n(e,t){let r=e;if("auto"===t)for(;ee(r);)r=r.content;return!!V(r)||!!K(r)&&n(r.args[0],t)}function r(e,t,r,i,o){const a=Lp(e,t,r),s=$p(e,t);if("all"===t||i.length>2&&"OperatorNode:add"!==e.getIdentifier()&&"OperatorNode:multiply"!==e.getIdentifier())return i.map((function(e){switch(e.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}}));let u;switch(i.length){case 0:u=[];break;case 1:{const n=Lp(i[0],t,r,e);if(o&&null!==n){let r,o;if("keep"===t?(r=i[0].getIdentifier(),o=e.getIdentifier()):(r=i[0].getContent().getIdentifier(),o=e.getContent().getIdentifier()),!1===jp[a][o].latexLeftParens){u=[!1];break}if(!1===jp[n][r].latexParens){u=[!1];break}}if(null===n){u=[!1];break}if(n<=a){u=[!0];break}u=[!1]}break;case 2:{let n;const c=Lp(i[0],t,r,e),l=Hp(e,i[0],t);let f;n=null!==c&&(c===a&&"right"===s&&!l||c=2&&"OperatorNode:multiply"===e.getIdentifier()&&e.implicit&&"all"!==t&&"hide"===r)for(let e=1;e2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){const t=i.map((function(t,n){return t=t.toString(e),o[n]&&(t="("+t+")"),t}));return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?t.join(" "):t.join(" "+this.op+" ")}return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:mm,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(e){return new o(e.op,e.fn,e.args,e.implicit,e.isPercentage)}_toHTML(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=e&&e.implicit?e.implicit:"hide",i=this.args,o=r(this,t,n,i,!1);if(1===i.length){const n=$p(this,t);let r=i[0].toHTML(e);return o[0]&&(r='('+r+')'),"right"===n?''+dr(this.op)+""+r:r+''+dr(this.op)+""}if(2===i.length){let t=i[0].toHTML(e),r=i[1].toHTML(e);return o[0]&&(t='('+t+')'),o[1]&&(r='('+r+')'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?t+''+r:t+''+dr(this.op)+""+r}{const t=i.map((function(t,n){return t=t.toHTML(e),o[n]&&(t='('+t+')'),t}));return i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?t.join(''):t.join(''+dr(this.op)+""):''+dr(this.fn)+'('+t.join(',')+')'}}_toTex(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=e&&e.implicit?e.implicit:"hide",i=this.args,o=r(this,t,n,i,!0);let a=Kp[this.fn];if(a=void 0===a?this.op:a,1===i.length){const n=$p(this,t);let r=i[0].toTex(e);return o[0]&&(r=`\\left(${r}\\right)`),"right"===n?a+r:r+a}if(2===i.length){const r=i[0];let s=r.toTex(e);o[0]&&(s=`\\left(${s}\\right)`);let u,c=i[1].toTex(e);switch(o[1]&&(c=`\\left(${c}\\right)`),u="keep"===t?r.getIdentifier():r.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return a+"{"+s+"}{"+c+"}";case"OperatorNode:pow":switch(s="{"+s+"}",c="{"+c+"}",u){case"ConditionalNode":case"OperatorNode:divide":s=`\\left(${s}\\right)`}break;case"OperatorNode:multiply":if(this.implicit&&"hide"===n)return s+"~"+c}return s+a+c}if(i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){const t=i.map((function(t,n){return t=t.toTex(e),o[n]&&(t=`\\left(${t}\\right)`),t}));return"OperatorNode:multiply"===this.getIdentifier()&&this.implicit&&"hide"===n?t.join("~"):t.join(a)}return"\\mathrm{"+this.fn+"}\\left("+i.map((function(t){return t.toTex(e)})).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return _p(o,"name",mm),o}),{isClass:!0,isNode:!0}),dm="ParenthesisNode",gm=he(dm,["Node"],(e=>{let{Node:t}=e;class n extends t{constructor(e){if(super(),!X(e))throw new TypeError('Node expected for parameter "content"');this.content=e}get type(){return dm}get isParenthesisNode(){return!0}_compile(e,t){return this.content._compile(e,t)}getContent(){return this.content.getContent()}forEach(e){e(this.content,"content",this)}map(e){const t=e(this.content,"content",this);return new n(t)}clone(){return new n(this.content)}_toString(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"("+this.content.toString(e)+")":this.content.toString(e)}toJSON(){return{mathjs:dm,content:this.content}}static fromJSON(e){return new n(e.content)}_toHTML(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?'('+this.content.toHTML(e)+')':this.content.toHTML(e)}_toTex(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?`\\left(${this.content.toTex(e)}\\right)`:this.content.toTex(e)}}return _p(n,"name",dm),n}),{isClass:!0,isNode:!0}),ym="RangeNode",xm=he(ym,["Node"],(e=>{let{Node:t}=e;function n(e,t,n){const r=Lp(e,t,n),i={},o=Lp(e.start,t,n);if(i.start=null!==o&&o<=r||"all"===t,e.step){const o=Lp(e.step,t,n);i.step=null!==o&&o<=r||"all"===t}const a=Lp(e.end,t,n);return i.end=null!==a&&a<=r||"all"===t,i}class r extends t{constructor(e,t,n){if(super(),!X(e))throw new TypeError("Node expected");if(!X(t))throw new TypeError("Node expected");if(n&&!X(n))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=e,this.end=t,this.step=n||null}get type(){return ym}get isRangeNode(){return!0}needsEnd(){return this.filter((function(e){return re(e)&&"end"===e.name})).length>0}_compile(e,t){const n=e.range,r=this.start._compile(e,t),i=this.end._compile(e,t);if(this.step){const o=this.step._compile(e,t);return function(e,t,a){return n(r(e,t,a),i(e,t,a),o(e,t,a))}}return function(e,t,o){return n(r(e,t,o),i(e,t,o))}}forEach(e){e(this.start,"start",this),e(this.end,"end",this),this.step&&e(this.step,"step",this)}map(e){return new r(this._ifNode(e(this.start,"start",this)),this._ifNode(e(this.end,"end",this)),this.step&&this._ifNode(e(this.step,"step",this)))}clone(){return new r(this.start,this.end,this.step&&this.step)}_toString(e){const t=n(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit);let r,i=this.start.toString(e);if(t.start&&(i="("+i+")"),r=i,this.step){let n=this.step.toString(e);t.step&&(n="("+n+")"),r+=":"+n}let o=this.end.toString(e);return t.end&&(o="("+o+")"),r+=":"+o,r}toJSON(){return{mathjs:ym,start:this.start,end:this.end,step:this.step}}static fromJSON(e){return new r(e.start,e.end,e.step)}_toHTML(e){const t=n(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit);let r,i=this.start.toHTML(e);if(t.start&&(i='('+i+')'),r=i,this.step){let n=this.step.toHTML(e);t.step&&(n='('+n+')'),r+=':'+n}let o=this.end.toHTML(e);return t.end&&(o='('+o+')'),r+=':'+o,r}_toTex(e){const t=n(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit);let r=this.start.toTex(e);if(t.start&&(r=`\\left(${r}\\right)`),this.step){let n=this.step.toTex(e);t.step&&(n=`\\left(${n}\\right)`),r+=":"+n}let i=this.end.toTex(e);return t.end&&(i=`\\left(${i}\\right)`),r+=":"+i,r}}return _p(r,"name",ym),r}),{isClass:!0,isNode:!0}),bm="RelationalNode",vm=he(bm,["Node"],(e=>{let{Node:t}=e;const n={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class r extends t{constructor(e,t){if(super(),!Array.isArray(e))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(t))throw new TypeError("Parameter params must be an array");if(e.length!==t.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=e,this.params=t}get type(){return bm}get isRelationalNode(){return!0}_compile(e,t){const n=this,r=this.params.map((n=>n._compile(e,t)));return function(t,o,a){let s,u=r[0](t,o,a);for(let c=0;ce(t,"params["+n+"]",this)),this)}map(e){return new r(this.conditionals.slice(),this.params.map(((t,n)=>this._ifNode(e(t,"params["+n+"]",this))),this))}clone(){return new r(this.conditionals,this.params)}_toString(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=Lp(this,t,e&&e.implicit),i=this.params.map((function(n,i){const o=Lp(n,t,e&&e.implicit);return"all"===t||null!==o&&o<=r?"("+n.toString(e)+")":n.toString(e)}));let o=i[0];for(let e=0;e('+n.toHTML(e)+')':n.toHTML(e)}));let o=i[0];for(let e=0;e'+dr(n[this.conditionals[e]])+""+i[e+1];return o}_toTex(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=Lp(this,t,e&&e.implicit),r=this.params.map((function(r,i){const o=Lp(r,t,e&&e.implicit);return"all"===t||null!==o&&o<=n?"\\left("+r.toTex(e)+"\right)":r.toTex(e)}));let i=r[0];for(let e=0;e{let{math:t,Unit:n,Node:r}=e;function o(e){return!!n&&n.isValuelessUnit(e)}class a extends r{constructor(e){if(super(),"string"!=typeof e)throw new TypeError('String expected for parameter "name"');this.name=e}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(e,t){const r=this.name;if(!0===t[r])return function(e,t,n){return i(t,r)};if(r in e)return function(t,n,o){return t.has(r)?t.get(r):i(e,r)};{const e=o(r);return function(t,i,o){return t.has(r)?t.get(r):e?new n(null,r):a.onUndefinedSymbol(r)}}}forEach(e){}map(e){return this.clone()}static onUndefinedSymbol(e){throw new Error("Undefined symbol "+e)}clone(){return new a(this.name)}_toString(e){return this.name}_toHTML(e){const t=dr(this.name);return"true"===t||"false"===t?''+t+"":"i"===t?''+t+"":"Infinity"===t?''+t+"":"NaN"===t?''+t+"":"null"===t?''+t+"":"undefined"===t?''+t+"":''+t+""}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(e){return new a(e.name)}_toTex(e){let n=!1;void 0===t[this.name]&&o(this.name)&&(n=!0);const r=rm(this.name,n);return"\\"===r[0]?r:" "+r}}return a}),{isClass:!0,isNode:!0}),Nm="FunctionNode",Em=he(Nm,["math","Node","SymbolNode"],(e=>{var t;let{math:n,Node:r,SymbolNode:o}=e;const a=e=>pr(e,{truncate:78});function u(e,t,n){let r="";const i=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi;let o,a=0;for(;null!==(o=i.exec(e));)if(r+=e.substring(a,o.index),a=o.index,"$$"===o[0])r+="$",a++;else{a+=o[0].length;const e=t[o[1]];if(!e)throw new ReferenceError("Template: Property "+o[1]+" does not exist.");if(void 0===o[2])switch(typeof e){case"string":r+=e;break;case"object":if(X(e))r+=e.toTex(n);else{if(!Array.isArray(e))throw new TypeError("Template: "+o[1]+" has to be a Node, String or array of Nodes");r+=e.map((function(e,t){if(X(e))return e.toTex(n);throw new TypeError("Template: "+o[1]+"["+t+"] is not a Node.")})).join(",")}break;default:throw new TypeError("Template: "+o[1]+" has to be a Node, String or array of Nodes")}else{if(!X(e[o[2]]&&e[o[2]]))throw new TypeError("Template: "+o[1]+"["+o[2]+"] is not a Node.");r+=e[o[2]].toTex(n)}}return r+=e.slice(a),r}class c extends r{constructor(e,t){if(super(),"string"==typeof e&&(e=new o(e)),!X(e))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(t)||!t.every(X))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=e,this.args=t||[]}get name(){return this.fn.name||""}get type(){return Nm}get isFunctionNode(){return!0}_compile(e,t){const n=this.args.map((n=>n._compile(e,t)));if(!re(this.fn)){if(U(this.fn)&&J(this.fn.index)&&this.fn.index.isObjectProperty()){const r=this.fn.object._compile(e,t),i=this.fn.index.getObjectProperty(),o=this.args;return function(t,a,u){const c=r(t,a,u),l=function(e,t){if(!s(e,t))throw new Error('No access to method "'+t+'"');return e[t]}(c,i);if(null!=l&&l.rawArgs)return l(o,e,pm(t,a));{const e=n.map((e=>e(t,a,u)));return l.apply(c,e)}}}{const r=this.fn.toString(),i=this.fn._compile(e,t),o=this.args;return function(t,s,u){const c=i(t,s,u);if("function"!=typeof c)throw new TypeError(`Expression '${r}' did not evaluate to a function; value is:\n ${a(c)}`);if(c.rawArgs)return c(o,e,pm(t,s));{const e=n.map((e=>e(t,s,u)));return c.apply(c,e)}}}}{const r=this.fn.name;if(t[r]){const t=this.args;return function(o,s,u){const c=i(s,r);if("function"!=typeof c)throw new TypeError(`Argument '${r}' was not a function; received: ${a(c)}`);if(c.rawArgs)return c(t,e,pm(o,s));{const e=n.map((e=>e(o,s,u)));return c.apply(c,e)}}}{const t=r in e?i(e,r):void 0,o="function"==typeof t&&!0===t.rawArgs,s=t=>{let n;if(t.has(r))n=t.get(r);else{if(!(r in e))return c.onUndefinedFunction(r);n=i(e,r)}if("function"==typeof n)return n;throw new TypeError(`'${r}' is not a function; its value is:\n ${a(n)}`)};if(o){const t=this.args;return function(r,i,o){const a=s(r);return!0===a.rawArgs?a(t,e,pm(r,i)):a(...n.map((e=>e(r,i,o))))}}switch(n.length){case 0:return function(e,t,n){return s(e)()};case 1:return function(e,t,r){return s(e)((0,n[0])(e,t,r))};case 2:return function(e,t,r){const i=s(e),o=n[0],a=n[1];return i(o(e,t,r),a(e,t,r))};default:return function(e,t,r){return s(e)(...n.map((n=>n(e,t,r))))}}}}}forEach(e){e(this.fn,"fn",this);for(let t=0;t'+dr(this.fn)+'('+t.join(',')+')'}toTex(e){let t;return e&&"object"==typeof e.handler&&me(e.handler,this.name)&&(t=e.handler[this.name](this,e)),void 0!==t?t:super.toTex(e)}_toTex(e){const t=this.args.map((function(t){return t.toTex(e)}));let r,i;switch(em[this.name]&&(r=em[this.name]),!n[this.name]||"function"!=typeof n[this.name].toTex&&"object"!=typeof n[this.name].toTex&&"string"!=typeof n[this.name].toTex||(r=n[this.name].toTex),typeof r){case"function":i=r(this,e);break;case"string":i=u(r,this,e);break;case"object":switch(typeof r[t.length]){case"function":i=r[t.length](this,e);break;case"string":i=u(r[t.length],this,e)}}return void 0!==i?i:u("\\mathrm{${name}}\\left(${args}\\right)",this,e)}getIdentifier(){return this.type+":"+this.name}}return t=c,_p(c,"name",Nm),_p(c,"onUndefinedFunction",(function(e){throw new Error("Undefined function "+e)})),_p(c,"fromJSON",(function(e){return new t(e.fn,e.args)})),c}),{isClass:!0,isNode:!0}),Am="parse",Sm=he(Am,["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],(e=>{let{typed:t,numeric:n,config:r,AccessorNode:i,ArrayNode:o,AssignmentNode:a,BlockNode:s,ConditionalNode:u,ConstantNode:c,FunctionAssignmentNode:l,FunctionNode:f,IndexNode:p,ObjectNode:m,OperatorNode:h,ParenthesisNode:d,RangeNode:g,RelationalNode:y,SymbolNode:x}=e;const b=t(Am,{string:function(e){return k(e,{})},"Array | Matrix":function(e){return v(e,{})},"string, Object":function(e,t){return k(e,void 0!==t.nodes?t.nodes:{})},"Array | Matrix, Object":v});function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=void 0!==t.nodes?t.nodes:{};return si(e,(function(e){if("string"!=typeof e)throw new TypeError("String expected");return k(e,n)}))}const w={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},N={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},E={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},A={true:!0,false:!1,null:null,undefined:void 0},S=["NaN","Infinity"],M={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function C(e,t){return e.expression.substr(e.index,t)}function T(e){return C(e,1)}function B(e){e.index++}function D(e){return e.expression.charAt(e.index-1)}function F(e){return e.expression.charAt(e.index+1)}function O(e){for(e.tokenType=w.NULL,e.token="",e.comment="";;){if("#"===T(e))for(;"\n"!==T(e)&&""!==T(e);)e.comment+=T(e),B(e);if(!b.isWhitespace(T(e),e.nestingLevel))break;B(e)}if(""===T(e))return void(e.tokenType=w.DELIMITER);if("\n"===T(e)&&!e.nestingLevel)return e.tokenType=w.DELIMITER,e.token=T(e),void B(e);const t=T(e),n=C(e,2),r=C(e,3);if(3===r.length&&N[r])return e.tokenType=w.DELIMITER,e.token=r,B(e),B(e),void B(e);if(2===n.length&&N[n])return e.tokenType=w.DELIMITER,e.token=n,B(e),void B(e);if(N[t])return e.tokenType=w.DELIMITER,e.token=t,void B(e);if(b.isDigitDot(t)){e.tokenType=w.NUMBER;const t=C(e,2);if("0b"===t||"0o"===t||"0x"===t){for(e.token+=T(e),B(e),e.token+=T(e),B(e);b.isHexDigit(T(e));)e.token+=T(e),B(e);if("."===T(e))for(e.token+=".",B(e);b.isHexDigit(T(e));)e.token+=T(e),B(e);else if("i"===T(e))for(e.token+="i",B(e);b.isDigit(T(e));)e.token+=T(e),B(e);return}if("."===T(e)){if(e.token+=T(e),B(e),!b.isDigit(T(e)))return void(e.tokenType=w.DELIMITER)}else{for(;b.isDigit(T(e));)e.token+=T(e),B(e);b.isDecimalMark(T(e),F(e))&&(e.token+=T(e),B(e))}for(;b.isDigit(T(e));)e.token+=T(e),B(e);if("E"===T(e)||"e"===T(e))if(b.isDigit(F(e))||"-"===F(e)||"+"===F(e)){if(e.token+=T(e),B(e),"+"!==T(e)&&"-"!==T(e)||(e.token+=T(e),B(e)),!b.isDigit(T(e)))throw ue(e,'Digit expected, got "'+T(e)+'"');for(;b.isDigit(T(e));)e.token+=T(e),B(e);if(b.isDecimalMark(T(e),F(e)))throw ue(e,'Digit expected, got "'+T(e)+'"')}else if(b.isDecimalMark(F(e),e.expression.charAt(e.index+2)))throw B(e),ue(e,'Digit expected, got "'+T(e)+'"')}else{if(!b.isAlpha(T(e),D(e),F(e))){for(e.tokenType=w.UNKNOWN;""!==T(e);)e.token+=T(e),B(e);throw ue(e,'Syntax error in part "'+e.token+'"')}for(;b.isAlpha(T(e),D(e),F(e))||b.isDigit(T(e));)e.token+=T(e),B(e);me(E,e.token)?e.tokenType=w.DELIMITER:e.tokenType=w.SYMBOL}}function _(e){do{O(e)}while("\n"===e.token)}function I(e){e.nestingLevel++}function z(e){e.nestingLevel--}function k(e,t){const n={extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:w.NULL,nestingLevel:0,conditionalLevel:null};sr(n,{expression:e,extraNodes:t}),O(n);const r=function(e){let t;const n=[];let r;for(""!==e.token&&"\n"!==e.token&&";"!==e.token&&(t=R(e),e.comment&&(t.comment=e.comment));"\n"===e.token||";"===e.token;)0===n.length&&t&&(r=";"!==e.token,n.push({node:t,visible:r})),O(e),"\n"!==e.token&&";"!==e.token&&""!==e.token&&(t=R(e),e.comment&&(t.comment=e.comment),r=";"!==e.token,n.push({node:t,visible:r}));return n.length>0?new s(n):(t||(t=new c(void 0),e.comment&&(t.comment=e.comment)),t)}(n);if(""!==n.token)throw n.tokenType===w.DELIMITER?ce(n,"Unexpected operator "+n.token):ue(n,'Unexpected part "'+n.token+'"');return r}function R(e){let t,n,r,i;const o=function(e){let t=function(e){let t=q(e);for(;"or"===e.token;)_(e),t=new h("or","or",[t,q(e)]);return t}(e);for(;"?"===e.token;){const n=e.conditionalLevel;e.conditionalLevel=e.nestingLevel,_(e);const r=t,i=R(e);if(":"!==e.token)throw ue(e,"False part of conditional expression expected");e.conditionalLevel=null,_(e);const o=R(e);t=new u(r,i,o),e.conditionalLevel=n}return t}(e);if("="===e.token){if(re(o))return t=o.name,_(e),r=R(e),new a(new x(t),r);if(U(o))return _(e),r=R(e),new a(o.object,o.index,r);if(Y(o)&&re(o.fn)&&(i=!0,n=[],t=o.name,o.args.forEach((function(e,t){re(e)?n[t]=e.name:i=!1})),i))return _(e),r=R(e),new l(t,n,r);throw ue(e,"Invalid left hand side of assignment operator =")}return o}function q(e){let t=P(e);for(;"xor"===e.token;)_(e),t=new h("xor","xor",[t,P(e)]);return t}function P(e){let t=j(e);for(;"and"===e.token;)_(e),t=new h("and","and",[t,j(e)]);return t}function j(e){let t=L(e);for(;"|"===e.token;)_(e),t=new h("|","bitOr",[t,L(e)]);return t}function L(e){let t=$(e);for(;"^|"===e.token;)_(e),t=new h("^|","bitXor",[t,$(e)]);return t}function $(e){let t=H(e);for(;"&"===e.token;)_(e),t=new h("&","bitAnd",[t,H(e)]);return t}function H(e){const t=[G(e)],n=[],r={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};for(;me(r,e.token);){const i={name:e.token,fn:r[e.token]};n.push(i),_(e),t.push(G(e))}return 1===t.length?t[0]:2===t.length?new h(n[0].name,n[0].fn,t):new y(n.map((e=>e.fn)),t)}function G(e){let t,n,r,i;t=W(e);const o={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};for(;me(o,e.token);)n=e.token,r=o[n],_(e),i=[t,W(e)],t=new h(n,r,i);return t}function W(e){let t,n,r,i;t=J(e);const o={to:"to",in:"to"};for(;me(o,e.token);)n=e.token,r=o[n],_(e),"in"===n&&"])},;".includes(e.token)?t=new h("*","multiply",[t,new x("in")],!0):(i=[t,J(e)],t=new h(n,r,i));return t}function J(e){let t;const n=[];if(t=":"===e.token?new c(1):X(e),":"===e.token&&e.conditionalLevel!==e.nestingLevel){for(n.push(t);":"===e.token&&n.length<3;)_(e),")"===e.token||"]"===e.token||","===e.token||""===e.token?n.push(new x("end")):n.push(X(e));t=3===n.length?new g(n[0],n[2],n[1]):new g(n[0],n[1])}return t}function X(e){let t,n,r,i;t=Q(e);const o={"+":"add","-":"subtract"};for(;me(o,e.token);){n=e.token,r=o[n],_(e);const a=Q(e);i=a.isPercentage?[t,new h("*","multiply",[t,a])]:[t,a],t=new h(n,r,i)}return t}function Q(e){let t,n,r,i;t=ee(e),n=t;const o={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"};for(;me(o,e.token);)if(r=e.token,i=o[r],_(e),"%"===r&&e.tokenType===w.DELIMITER&&"("!==e.token)if(""!==e.token&&o[e.token]){const a=new h("/","divide",[t,new c(100)],!1,!0);r=e.token,i=o[r],_(e),n=ee(e),t=new h(r,i,[a,n])}else t=new h("/","divide",[t,new c(100)],!1,!0);else n=ee(e),t=new h(r,i,[t,n]);return t}function ee(e){let t,n;for(t=te(e),n=t;e.tokenType===w.SYMBOL||"in"===e.token&&V(t)||"in"===e.token&&K(t)&&"unaryMinus"===t.fn&&V(t.args[0])||!(e.tokenType!==w.NUMBER||V(n)||K(n)&&"!"!==n.op)||"("===e.token;)n=te(e),t=new h("*","multiply",[t,n],!0);return t}function te(e){let t=ne(e),n=t;const r=[];for(;"/"===e.token&&Z(n);){if(r.push(sr({},e)),_(e),e.tokenType!==w.NUMBER){sr(e,r.pop());break}if(r.push(sr({},e)),_(e),e.tokenType!==w.SYMBOL&&"("!==e.token&&"in"!==e.token){r.pop(),sr(e,r.pop());break}sr(e,r.pop()),r.pop(),n=ne(e),t=new h("/","divide",[t,n])}return t}function ne(e){let t,i,a;const s={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return me(s,e.token)?(a=s[e.token],t=e.token,_(e),i=[ne(e)],new h(t,a,i)):function(e){let t,i,a,s;return t=function(e){let t,i,a,s;t=function(e){let t=[];if(e.tokenType===w.SYMBOL&&me(e.extraNodes,e.token)){const n=e.extraNodes[e.token];if(O(e),"("===e.token){if(t=[],I(e),O(e),")"!==e.token)for(t.push(R(e));","===e.token;)O(e),t.push(R(e));if(")"!==e.token)throw ue(e,"Parenthesis ) expected");z(e),O(e)}return new n(t)}return function(e){let t,i;return e.tokenType===w.SYMBOL||e.tokenType===w.DELIMITER&&e.token in E?(i=e.token,O(e),t=me(A,i)?new c(A[i]):S.includes(i)?new c(n(i,"number")):new x(i),t=ie(e,t),t):function(e){let t,i;return'"'===e.token||"'"===e.token?(i=oe(e,e.token),t=new c(i),t=ie(e,t),t):function(e){let t,i,a,s;if("["===e.token){if(I(e),O(e),"]"!==e.token){const n=ae(e);if(";"===e.token){for(a=1,i=[n];";"===e.token;)O(e),"]"!==e.token&&(i[a]=ae(e),a++);if("]"!==e.token)throw ue(e,"End of matrix ] expected");z(e),O(e),s=i[0].items.length;for(let t=1;t0},b.isDecimalMark=function(e,t){return"."===e&&"/"!==t&&"*"!==t&&"^"!==t},b.isDigitDot=function(e){return e>="0"&&e<="9"||"."===e},b.isDigit=function(e){return e>="0"&&e<="9"},b.isHexDigit=function(e){return e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"},t.addConversion({from:"string",to:"Node",convert:b}),b})),Mm="compile",Cm=he(Mm,["typed","parse"],(e=>{let{typed:t,parse:n}=e;return t(Mm,{string:function(e){return n(e).compile()},"Array | Matrix":function(e){return si(e,(function(e){return n(e).compile()}))}})})),Tm="evaluate",Bm=he(Tm,["typed","parse"],(e=>{let{typed:t,parse:n}=e;return t(Tm,{string:function(e){const t=m();return n(e).compile().evaluate(t)},"string, Map | Object":function(e,t){return n(e).compile().evaluate(t)},"Array | Matrix":function(e){const t=m();return si(e,(function(e){return n(e).compile().evaluate(t)}))},"Array | Matrix, Map | Object":function(e,t){return si(e,(function(e){return n(e).compile().evaluate(t)}))}})})),Dm=he("Parser",["evaluate","parse"],(e=>{let{evaluate:t,parse:n}=e;function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:m(),writable:!1})}return r.prototype.type="Parser",r.prototype.isParser=!0,r.prototype.evaluate=function(e){return t(e,this.scope)},r.prototype.get=function(e){if(this.scope.has(e))return this.scope.get(e)},r.prototype.getAll=function(){return function(e){if(e instanceof l)return e.wrappedObject;const t={};for(const n of e.keys())o(t,n,e.get(n));return t}(this.scope)},r.prototype.getAllAsMap=function(){return this.scope},r.prototype.set=function(e,t){if(!function(e){if(0===e.length)return!1;for(let t=0;t0&&n.isDigit(i)))return!1}return!0}(e))throw new Error(`Invalid variable name: '${e}'. Variable names must follow the specified rules.`);return this.scope.set(e,t),t},r.prototype.remove=function(e){this.scope.delete(e)},r.prototype.clear=function(){this.scope.clear()},r}),{isClass:!0}),Fm="parser",Om=he(Fm,["typed","Parser"],(e=>{let{typed:t,Parser:n}=e;return t(Fm,{"":function(){return new n}})})),_m=he("lup",["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],(e=>{let{typed:t,matrix:n,abs:r,addScalar:i,divideScalar:o,multiplyScalar:a,subtractScalar:s,larger:u,equalScalar:c,unaryMinus:l,DenseMatrix:f,SparseMatrix:p,Spa:m}=e;return t("lup",{DenseMatrix:function(e){return h(e)},SparseMatrix:function(e){return function(e){const t=e._size[0],n=e._size[1],i=Math.min(t,n),s=e._values,f=e._index,h=e._ptr,d=[],g=[],y=[],x=[t,i],b=[],v=[],w=[],N=[i,n];let E,A,S;const M=[],C=[];for(E=0;E0&&e.forEach(0,A-1,(function(t,n){p._forEachRow(t,d,g,y,(function(r,i){r>t&&e.accumulate(r,l(a(i,n)))}))}));let C=A,B=e.get(A),D=r(B);e.forEach(A+1,t-1,(function(e,t){const n=r(t);u(n,D)&&(C=e,D=n,B=t)})),A!==C&&(p._swapRows(A,C,x[1],d,g,y),p._swapRows(A,C,N[1],b,v,w),e.swap(A,C),T(A,C)),e.forEach(0,t-1,(function(e,t){e<=A?(b.push(t),v.push(e)):(t=o(t,B),c(t,0)||(d.push(t),g.push(e)))}))}return w.push(b.length),y.push(d.length),{L:new p({values:d,index:g,ptr:y,size:x}),U:new p({values:b,index:v,ptr:w,size:N}),p:M,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}(e)},Array:function(e){const t=h(n(e));return{L:t.L.valueOf(),U:t.U.valueOf(),p:t.p}}});function h(e){const t=e._size[0],n=e._size[1];let l=Math.min(t,n);const p=ae(e._data),m=[],h=[t,l],d=[],g=[l,n];let y,x,b;const v=[];for(y=0;y0)for(y=0;y{let{typed:t,matrix:n,zeros:r,identity:i,isZero:o,equal:a,sign:s,sqrt:u,conj:c,unaryMinus:l,addScalar:f,divideScalar:p,multiplyScalar:m,subtractScalar:h,complex:d}=e;return sr(t("qr",{DenseMatrix:function(e){return y(e)},SparseMatrix:function(e){return function(){throw new Error("qr not implemented for sparse matrices yet")}()},Array:function(e){const t=y(n(e));return{Q:t.Q.valueOf(),R:t.R.valueOf()}}}),{_denseQRimpl:g});function g(e){const t=e._size[0],n=e._size[1],d=i([t],"dense"),g=d._data,y=e.clone(),x=y._data;let b,v,w;const N=r([t],"");for(w=0;w0){const e="Complex"===n[0][0].type?d(0):0;for(let t=0;t=0;){const e=n[a+s],u=n[r+e];-1===u?(s--,o[t++]=e):(n[r+e]=n[i+u],++s,n[a+s]=u)}return t}function km(e){return-e-2}const Rm=he("csAmd",["add","multiply","transpose"],(e=>{let{add:t,multiply:n,transpose:r}=e;return function(e,a){if(!a||e<=0||e>3)return null;const s=a._size,u=s[0],c=s[1];let l=0,f=Math.max(16,10*Math.sqrt(c));f=Math.min(c-2,f);const p=function(e,i,o,a,s){const u=r(i);if(1===e&&a===o)return t(i,u);if(2===e){const e=u._index,t=u._ptr;let a=0;for(let n=0;ns))for(const i=t[n+1];ra)n[s+p]=0,n[i+p]=-1,f++,t[p]=km(e),n[s+e]++;else{const e=n[u+m];-1!==e&&(c[e]=p),n[l+p]=n[u+m],n[u+m]=p}}return f}(c,h,y,N,w,E,f,x,v,S,b),H=0;for(;$e?(F=T,O=r,_=y[0+T]-e):(F=m[r++],O=h[F],_=y[0+F]),D=1;D<=_;D++)M=m[O++],(I=y[x+M])<=0||(n+=I,y[x+M]=-I,m[a++]=M,-1!==y[b+M]&&(S[y[b+M]]=S[M]),-1!==S[M]?y[b+S[M]]=y[b+M]:y[v+y[N+M]]=y[b+M]);F!==T&&(h[F]=km(T),y[E+F]=0)}for(0!==e&&(d=a),y[N+T]=n,h[T]=o,y[0+T]=a-o,y[w+T]=-2,L=i(L,l,y,E,c),z=o;z=L?y[E+F]-=I:0!==y[E+F]&&(y[E+F]=y[N+F]+e)}for(z=o;z0?(U+=e,m[P++]=F,j+=F):(h[F]=km(T),y[E+F]=0)}y[w+M]=P-R+1;const e=P,i=R+y[0+M];for(r=q+1;r=0))for(j=S[M],M=y[A+j],y[A+j]=-1;-1!==M&&-1!==y[b+M];M=y[b+M],L++){for(_=y[0+M],k=y[w+M],r=h[M]+1;r<=h[M]+_-1;r++)y[E+m[r]]=L;let e=M;for(C=y[b+M];-1!==C;){let t=y[0+C]===_&&y[w+C]===k;for(r=h[C]+1;t&&r<=h[C]+_-1;r++)y[E+m[r]]!==L&&(t=0);t?(h[C]=km(M),y[x+M]+=y[x+C],y[x+C]=0,y[w+C]=-1,C=y[b+C],y[b+e]=C):(e=C,C=y[b+C])}}for(r=o,z=o;z=0;C--)y[x+C]>0||(y[b+C]=y[v+h[C]],y[v+h[C]]=C);for(F=c;F>=0;F--)y[x+F]<=0||-1!==h[F]&&(y[b+F]=y[v+h[F]],y[v+h[F]]=F);for(T=0,M=0;M<=c;M++)-1===h[M]&&(T=zm(M,T,y,v,b,g,E));return g.splice(g.length-1,1),g};function i(e,t,n,r,i){if(e<2||e+t<0){for(let e=0;e{let{transpose:t}=e;return function(e,n,r,i){if(!e||!n||!r)return null;const o=e._size,a=o[0],s=o[1];let u,c,l,f,p,m,h;const d=4*s+(i?s+a+1:0),g=[],y=s,x=2*s,b=3*s,v=4*s,w=5*s+1;for(l=0;l=1&&N[c]++,2===e.jleaf&&N[e.q]--}-1!==n[c]&&(g[0+c]=n[c])}for(c=0;c{let{add:t,multiply:n,transpose:r}=e;const i=Rm({add:t,multiply:n,transpose:r}),o=Pm({transpose:r});return function(e,t,n){const r=t._ptr,a=t._size[1];let s;const u={};if(u.q=i(e,t),e&&!u.q)return null;if(n){const n=e?function(e,t,n){const r=e._values,i=e._index,o=e._ptr,a=e._size,s=e._datatype,u=a[0],c=a[1],l=null,f=[],p=[];let m=0;for(let e=0;e=0;n--)-1!==e[n]&&(o[a+n]=o[0+e[n]],o[0+e[n]]=n);for(n=0;n=0;d--)for(y=n[d],x=n[d+1],g=y;g=0;h--)u[h]=-1,d=c[h],-1!==d&&(0==l[m+d]++&&(l[p+d]=h),l[0+h]=l[f+d],l[f+d]=h);for(t.lnz=0,t.m2=o,d=0;d=0;){e=r[f];const t=i?i[e]:e;Um(a,e)||(Lm(a,e),r[s+f]=t<0?0:$m(a[t]));let p=1;for(c=r[s+f],l=t<0?0:$m(a[t+1]);c{let{divideScalar:t,multiply:n,subtract:r}=e;return function(e,i,o,a,s,u,c){const l=e._values,f=e._index,p=e._ptr,m=e._size[1],h=i._values,d=i._index,g=i._ptr;let y,x,b,v;const w=function(e,t,n,r,i){const o=e._ptr,a=e._size,s=t._index,u=t._ptr,c=a[1];let l,f,p,m=c;for(f=u[n],p=u[n+1],l=f;l{let{abs:t,divideScalar:n,multiply:r,subtract:i,larger:o,largerEq:a,SparseMatrix:s}=e;const u=Gm({divideScalar:n,multiply:r,subtract:i});return function(e,i,c){if(!e)return null;const l=e._size[1];let f,p=100,m=100;i&&(f=i.q,p=i.lnz||p,m=i.unz||m);const h=[],d=[],g=[],y=new s({values:h,index:d,ptr:g,size:[l,l]}),x=[],b=[],v=[],w=new s({values:x,index:b,ptr:v,size:[l,l]}),N=[];let E,A;const S=[],M=[];for(E=0;E{let{typed:t,abs:n,add:r,multiply:i,transpose:o,divideScalar:a,subtract:s,larger:u,largerEq:c,SparseMatrix:l}=e;const f=jm({add:r,multiply:i,transpose:o}),p=Vm({abs:n,divideScalar:a,multiply:i,subtract:s,larger:u,largerEq:c,SparseMatrix:l});return t("slu",{"SparseMatrix, number, number":function(e,t,n){if(!ye(t)||t<0||t>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(n<0||n>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");const r=f(t,e,!1),i=p(e,r,n);return{L:i.L,U:i.U,p:i.pinv,q:r.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}})}));function Wm(e,t){let n;const r=t.length,i=[];if(e)for(n=0;n{let{typed:t,matrix:n,lup:r,slu:i,usolve:o,lsolve:a,DenseMatrix:s}=e;const u=Bc({DenseMatrix:s});return t(Ym,{"Array, Array | Matrix":function(e,t){e=n(e);const i=r(e);return l(i.L,i.U,i.p,null,t).valueOf()},"DenseMatrix, Array | Matrix":function(e,t){const n=r(e);return l(n.L,n.U,n.p,null,t)},"SparseMatrix, Array | Matrix":function(e,t){const n=r(e);return l(n.L,n.U,n.p,null,t)},"SparseMatrix, Array | Matrix, number, number":function(e,t,n,r){const o=i(e,n,r);return l(o.L,o.U,o.p,o.q,t)},"Object, Array | Matrix":function(e,t){return l(e.L,e.U,e.p,e.q,t)}});function c(e){if(E(e))return e;if(N(e))return n(e);throw new TypeError("Invalid Matrix LU decomposition")}function l(e,t,n,r,i){e=c(e),t=c(t),n&&((i=u(e,i,!0))._data=Wm(n,i._data));const s=a(e,i),l=o(t,s);return r&&(l._data=Wm(r,l._data)),l}})),Xm="polynomialRoot",Qm=he(Xm,["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],(e=>{let{typed:t,isZero:n,equalScalar:r,add:i,subtract:o,multiply:a,divide:s,sqrt:u,unaryMinus:c,cbrt:l,typeOf:f,im:p,re:m}=e;return t(Xm,{"number|Complex, ...number|Complex":(e,t)=>{const h=[e,...t];for(;h.length>0&&n(h[h.length-1]);)h.pop();if(h.length<2)throw new RangeError(`Polynomial [${e}, ${t}] must have a non-zero non-constant coefficient`);switch(h.length){case 2:return[c(s(h[0],h[1]))];case 3:{const[e,t,n]=h,i=a(2,n),l=a(t,t),f=a(4,n,e);if(r(l,f))return[s(c(t),i)];const p=u(o(l,f));return[s(o(p,t),i),s(o(c(p),t),i)]}case 4:{const[e,t,n,d]=h,g=c(a(3,d)),y=a(n,n),x=a(3,d,t),b=i(a(2,n,n,n),a(27,d,d,e)),v=a(9,d,n,t);if(r(y,x)&&r(b,v))return[s(n,g)];const w=o(y,x),N=o(b,v),E=i(a(18,d,n,t,e),a(n,n,t,t)),A=i(a(4,n,n,n,e),a(4,d,t,t,t),a(27,d,d,e,e));if(r(E,A))return[s(o(a(4,d,n,t),i(a(9,d,d,e),a(n,n,n))),a(d,w)),s(o(a(9,d,e),a(n,t)),a(2,w))];let S;return S=r(y,x)?N:s(i(N,u(o(a(N,N),a(4,w,w,w)))),2),l(S,!0).toArray().map((e=>s(i(n,e,s(w,e)),g))).map((e=>"Complex"===f(e)&&r(m(e),m(e)+p(e))?m(e):e))}default:throw new RangeError(`only implemented for cubic or lower-order polynomials, not ${h}`)}}})}));n(9463);const Km=he("Help",["evaluate"],(e=>{let{evaluate:t}=e;function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!e)throw new Error('Argument "doc" missing');this.doc=e}return n.prototype.type="Help",n.prototype.isHelp=!0,n.prototype.toString=function(){const e=this.doc||{};let n="\n";if(e.name&&(n+="Name: "+e.name+"\n\n"),e.category&&(n+="Category: "+e.category+"\n\n"),e.description&&(n+="Description:\n "+e.description+"\n\n"),e.syntax&&(n+="Syntax:\n "+e.syntax.join("\n ")+"\n\n"),e.examples){n+="Examples:\n";let r=!1;const i=t("config()"),o={config:e=>(r=!0,t("config(newConfig)",{newConfig:e}))};for(let r=0;r"mathjs"!==e)).forEach((n=>{t[n]=e[n]})),new n(t)},n.prototype.valueOf=n.prototype.toString,n}),{isClass:!0}),eh=he("Chain",["?on","math","typed"],(e=>{let{on:t,math:n,typed:r}=e;function i(e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");ie(e)?this.value=e.value:this.value=e}function o(e,t){pe(i.prototype,e,(function(){const e=t();if("function"==typeof e)return a(e)}))}function a(e){return function(){if(0===arguments.length)return new i(e(this.value));const t=[this.value];for(let e=0;ee[t]));var n,r};const s={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(n),t&&t("import",(function(e,t,n){n||o(e,t)})),i}),{isClass:!0}),th={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]},nh={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]},rh={bignumber:{name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","bigint","complex","fraction","index","matrix","string","unit"]},bigint:{name:"bigint",category:"Construction",syntax:["bigint(x)"],description:"Create a bigint, an integer with an arbitrary number of digits, from a number or string.",examples:["123123123123123123 # a large number will lose digits",'bigint("123123123123123123")','bignumber(["1", "3", "5"])'],seealso:["boolean","bignumber","number","complex","fraction","index","matrix","string","unit"]},boolean:{name:"boolean",category:"Construction",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]},complex:{name:"complex",category:"Construction",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]},createUnit:{name:"createUnit",category:"Construction",syntax:["createUnit(definitions)","createUnit(name, definition)"],description:"Create a user-defined unit and register it with the Unit type.",examples:['createUnit("foo")','createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})','createUnit("mph", "1 mile/hour")'],seealso:["unit","splitUnit"]},fraction:{name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(matrix)","fraction(num,den)","fraction({n: num, d: den})"],description:"Create a fraction from a number or from integer numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)","fraction({n: 333, d: 53})","fraction([sqrt(9), sqrt(10), sqrt(11)])"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]},index:{name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = 1","B = [1, 2, 3]","B[B>1 and B<3]"],seealso:["bignumber","boolean","complex","matrix","number","range","string","unit"]},matrix:{name:"matrix",category:"Construction",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()",'matrix("dense")',"matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])",'matrix([3, 4; 5, 6], "sparse")','matrix([3, 4; 5, 6], "sparse", "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","sparse"]},number:{name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","bigint","boolean","complex","fraction","index","matrix","string","unit"]},sparse:{name:"sparse",category:"Construction",syntax:["sparse()","sparse([a1, b1, ...; a1, b2, ...])",'sparse([a1, b1, ...; a1, b2, ...], "number")'],description:"Create a sparse matrix.",examples:["sparse()","sparse([3, 4; 5, 6])",'sparse([3, 0; 5, 0], "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","matrix"]},splitUnit:{name:"splitUnit",category:"Construction",syntax:["splitUnit(unit: Unit, parts: Unit[])"],description:"Split a unit in an array of units whose sum is equal to the original unit.",examples:['splitUnit(1 m, ["feet", "inch"])'],seealso:["unit","createUnit"]},string:{name:"string",category:"Construction",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]},unit:{name:"unit",category:"Construction",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]},e:th,E:th,false:{name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]},i:{name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]},Infinity:{name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]},LN2:{name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]},LN10:{name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]},LOG2E:{name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]},LOG10E:{name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]},NaN:{name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]},null:{name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]},pi:nh,PI:nh,phi:{name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...",examples:["phi"],seealso:[]},SQRT1_2:{name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]},SQRT2:{name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]},tau:{name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]},true:{name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]},version:{name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]},speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant. Deprecated in favor of coulombConstant",examples:["coulombConstant"]},coulombConstant:{description:"Coulomb's constant",examples:["coulombConstant"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Bohr magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Bohr radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:{name:"derivative",category:"Algebra",syntax:["derivative(expr, variable)","derivative(expr, variable, {simplify: boolean})"],description:"Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.",examples:['derivative("2x^3", "x")','derivative("2x^3", "x", {simplify: false})','derivative("2x^2 + 3x + 4", "x")','derivative("sin(2x)", "x")','f = parse("x^2 + x")','x = parse("x")',"df = derivative(f, x)","df.evaluate({x: 3})"],seealso:["simplify","parse","evaluate"]},lsolve:{name:"lsolve",category:"Algebra",syntax:["x=lsolve(L, b)"],description:"Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolveAll","lup","lusolve","usolve","matrix","sparse"]},lsolveAll:{name:"lsolveAll",category:"Algebra",syntax:["x=lsolveAll(L, b)"],description:"Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolve","lup","lusolve","usolve","matrix","sparse"]},lup:{name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2, 1], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]},lusolve:{name:"lusolve",category:"Algebra",syntax:["x=lusolve(A, b)","x=lusolve(lu, b)"],description:"Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lusolve(a, b)"],seealso:["lup","slu","lsolve","usolve","matrix","sparse"]},leafCount:{name:"leafCount",category:"Algebra",syntax:["leafCount(expr)"],description:"Computes the number of leaves in the parse tree of the given expression",examples:['leafCount("e^(i*pi)-1")','leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'],seealso:["simplify"]},polynomialRoot:{name:"polynomialRoot",category:"Algebra",syntax:["x=polynomialRoot(-6, 3)","x=polynomialRoot(4, -4, 1)","x=polynomialRoot(-8, 12, -6, 1)"],description:"Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.",examples:["a = polynomialRoot(-6, 11, -6, 1)"],seealso:["cbrt","sqrt"]},resolve:{name:"resolve",category:"Algebra",syntax:["resolve(node, scope)"],description:"Recursively substitute variables in an expression tree.",examples:['resolve(parse("1 + x"), { x: 7 })','resolve(parse("size(text)"), { text: "Hello World" })','resolve(parse("x + y"), { x: parse("3z") })','resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'],seealso:["simplify","evaluate"],mayThrow:["ReferenceError"]},simplify:{name:"simplify",category:"Algebra",syntax:["simplify(expr)","simplify(expr, rules)"],description:"Simplify an expression tree.",examples:['simplify("3 + 2 / 4")','simplify("2x + x")','f = parse("x * (x + 2 + x)")',"simplified = simplify(f)","simplified.evaluate({x: 2})"],seealso:["simplifyCore","derivative","evaluate","parse","rationalize","resolve"]},simplifyConstant:{name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConstant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]},simplifyCore:{name:"simplifyCore",category:"Algebra",syntax:["simplifyCore(node)"],description:"Perform simple one-pass simplifications on an expression tree.",examples:['simplifyCore(parse("0*x"))','simplifyCore(parse("(x+0)*2"))'],seealso:["simplify","simplifyConstant","evaluate"]},symbolicEqual:{name:"symbolicEqual",category:"Algebra",syntax:["symbolicEqual(expr1, expr2)","symbolicEqual(expr1, expr2, options)"],description:"Returns true if the difference of the expressions simplifies to 0",examples:['symbolicEqual("x*y","y*x")','symbolicEqual("abs(x^2)", "x^2")','symbolicEqual("abs(x)", "x", {context: {abs: {trivial: true}}})'],seealso:["simplify","evaluate"]},rationalize:{name:"rationalize",category:"Algebra",syntax:["rationalize(expr)","rationalize(expr, scope)","rationalize(expr, scope, detailed)"],description:"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.",examples:['rationalize("2x/y - y/(x+1)")','rationalize("2x/y - y/(x+1)", true)'],seealso:["simplify"]},slu:{name:"slu",category:"Algebra",syntax:["slu(A, order, threshold)"],description:"Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U",examples:["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"],seealso:["lusolve","lsolve","usolve","matrix","sparse","lup","qr"]},usolve:{name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolveAll","lup","lusolve","lsolve","matrix","sparse"]},usolveAll:{name:"usolveAll",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolve","lup","lusolve","lsolve","matrix","sparse"]},qr:{name:"qr",category:"Algebra",syntax:["qr(A)"],description:"Calculates the Matrix QR decomposition. Matrix `A` is decomposed in two matrices (`Q`, `R`) where `Q` is an orthogonal matrix and `R` is an upper triangular matrix.",examples:["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"],seealso:["lup","slu","matrix"]},abs:{name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]},add:{name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i","3 cm + 2 inch",'"2.3" + "4"'],seealso:["subtract"]},cbrt:{name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]},ceil:{name:"ceil",category:"Arithmetic",syntax:["ceil(x)","ceil(x, n)","ceil(unit, valuelessUnit)","ceil(unit, n, valuelessUnit)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)","ceil(3.241cm, cm)","ceil(3.241cm, 2, cm)"],seealso:["floor","fix","round"]},cube:{name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]},divide:{name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]},dotDivide:{name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]},dotMultiply:{name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]},dotPow:{name:"dotPow",category:"Operators",syntax:["x .^ y","dotPow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]},exp:{name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["expm","expm1","pow","log"]},expm:{name:"expm",category:"Arithmetic",syntax:["exp(x)"],description:"Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.",examples:["expm([[0,2],[0,0]])"],seealso:["exp"]},expm1:{name:"expm1",category:"Arithmetic",syntax:["expm1(x)"],description:"Calculate the value of subtracting 1 from the exponential value.",examples:["expm1(2)","pow(e, 2) - 1","log(expm1(2) + 1)"],seealso:["exp","pow","log"]},fix:{name:"fix",category:"Arithmetic",syntax:["fix(x)","fix(x, n)","fix(unit, valuelessUnit)","fix(unit, n, valuelessUnit)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)","fix(3.241cm, cm)","fix(3.241cm, 2, cm)"],seealso:["ceil","floor","round"]},floor:{name:"floor",category:"Arithmetic",syntax:["floor(x)","floor(x, n)","floor(unit, valuelessUnit)","floor(unit, n, valuelessUnit)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)","floor(3.241cm, cm)","floor(3.241cm, 2, cm)"],seealso:["ceil","fix","round"]},gcd:{name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]},hypot:{name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenuse of a list with values.",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]},lcm:{name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]},log:{name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log1p","log2","log10"]},log2:{name:"log2",category:"Arithmetic",syntax:["log2(x)"],description:"Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`.",examples:["log2(0.03125)","log2(16)","log2(16) / log2(2)","pow(2, 4)"],seealso:["exp","log1p","log","log10"]},log1p:{name:"log1p",category:"Arithmetic",syntax:["log1p(x)","log1p(x, base)"],description:"Calculate the logarithm of a `value+1`",examples:["log1p(2.5)","exp(log1p(1.4))","pow(10, 4)","log1p(9999, 10)","log1p(9999) / log(10)"],seealso:["exp","log","log2","log10"]},log10:{name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]},mod:{name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]},multiply:{name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]},norm:{name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i)","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)",'norm([[1, 2], [3, 4]], "inf")','norm([[1, 2], [3, 4]], "fro")']},nthRoot:{name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["nthRoots","pow","sqrt"]},nthRoots:{name:"nthRoots",category:"Arithmetic",syntax:["nthRoots(A)","nthRoots(A, root)"],description:'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.',examples:["nthRoots(1)","nthRoots(1, 3)"],seealso:["sqrt","pow","nthRoot"]},pow:{name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3","2*2*2","1 + e ^ (pi * i)","pow([[1, 2], [4, 3]], 2)","pow([[1, 2], [4, 3]], -1)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]},round:{name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)","round(unit, valuelessUnit)","round(unit, n, valuelessUnit)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)","round(3.241cm, 2, cm)","round([3.2, 3.8, -4.7])"],seealso:["ceil","floor","fix"]},sign:{name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>0, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]},sqrt:{name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","sqrtm","multiply","nthRoot","nthRoots","pow"]},sqrtm:{name:"sqrtm",category:"Arithmetic",syntax:["sqrtm(x)"],description:"Calculate the principal square root of a square matrix. The principal square root matrix `X` of another matrix `A` is such that `X * X = A`.",examples:["sqrtm([[33, 24], [48, 57]])"],seealso:["sqrt","abs","square","multiply"]},square:{name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]},subtract:{name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]},unaryMinus:{name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]},unaryPlus:{name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]},xgcd:{name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values. The result is an array [d, x, y] with 3 entries, where d is the greatest common divisor, and d = x * a + y * b.",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]},invmod:{name:"invmod",category:"Arithmetic",syntax:["invmod(a, b)"],description:"Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax ≣ 1 (mod b)",examples:["invmod(8, 12)","invmod(7, 13)","invmod(15151, 15122)"],seealso:["gcd","xgcd"]},bitAnd:{name:"bitAnd",category:"Bitwise",syntax:["x & y","bitAnd(x, y)"],description:"Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0",examples:["5 & 3","bitAnd(53, 131)","[1, 12, 31] & 42"],seealso:["bitNot","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]},bitNot:{name:"bitNot",category:"Bitwise",syntax:["~x","bitNot(x)"],description:"Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.",examples:["~1","~2","bitNot([2, -3, 4])"],seealso:["bitAnd","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]},bitOr:{name:"bitOr",category:"Bitwise",syntax:["x | y","bitOr(x, y)"],description:"Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.",examples:["5 | 3","bitOr([1, 2, 3], 4)"],seealso:["bitAnd","bitNot","bitXor","leftShift","rightArithShift","rightLogShift"]},bitXor:{name:"bitXor",category:"Bitwise",syntax:["bitXor(x, y)"],description:"Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.",examples:["bitOr(1, 2)","bitXor([2, 3, 4], 4)"],seealso:["bitAnd","bitNot","bitOr","leftShift","rightArithShift","rightLogShift"]},leftShift:{name:"leftShift",category:"Bitwise",syntax:["x << y","leftShift(x, y)"],description:"Bitwise left logical shift of a value x by y number of bits.",examples:["4 << 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]},rightArithShift:{name:"rightArithShift",category:"Bitwise",syntax:["x >> y","rightArithShift(x, y)"],description:"Bitwise right arithmetic shift of a value x by y number of bits.",examples:["8 >> 1","4 << 1","-12 >> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightLogShift"]},rightLogShift:{name:"rightLogShift",category:"Bitwise",syntax:["x >>> y","rightLogShift(x, y)"],description:"Bitwise right logical shift of a value x by y number of bits.",examples:["8 >>> 1","4 << 1","-12 >>> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightArithShift"]},bellNumbers:{name:"bellNumbers",category:"Combinatorics",syntax:["bellNumbers(n)"],description:"The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. `bellNumbers` only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["bellNumbers(3)","bellNumbers(8)"],seealso:["stirlingS2"]},catalan:{name:"catalan",category:"Combinatorics",syntax:["catalan(n)"],description:"The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["catalan(3)","catalan(8)"],seealso:["bellNumbers"]},composition:{name:"composition",category:"Combinatorics",syntax:["composition(n, k)"],description:"The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.",examples:["composition(5, 3)"],seealso:["combinations"]},stirlingS2:{name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers"]},config:{name:"config",category:"Core",syntax:["config()","config(options)"],description:"Get configuration or change configuration.",examples:["config()","1/3 + 1/4",'config({number: "Fraction"})',"1/3 + 1/4"],seealso:[]},import:{name:"import",category:"Core",syntax:["import(functions)","import(functions, options)"],description:"Import functions or constants from an object.",examples:["import({myFn: f(x)=x^2, myConstant: 32 })","myFn(2)","myConstant"],seealso:[]},typed:{name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number": f(x)=x+x, "string": f(x)=concat(x,x) })',"double(2)",'double("hello")'],seealso:[]},arg:{name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 + 3i)"],seealso:["re","im","conj","abs"]},conj:{name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]},re:{name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]},im:{name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]},evaluate:{name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate(expression, scope)","evaluate([expr1, expr2, expr3, ...])","evaluate([expr1, expr2, expr3, ...], scope)"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(16)")','evaluate("2 inch to cm")','evaluate("sin(x * pi)", { "x": 1/2 })','evaluate(["width=2", "height=4","width*height"])'],seealso:["parser","parse","compile"]},help:{name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]},parse:{name:"parse",category:"Expression",syntax:["parse(expr)","parse(expr, options)","parse([expr1, expr2, expr3, ...])","parse([expr1, expr2, expr3, ...], options)"],description:"Parse an expression. Returns a node tree, which can be evaluated by invoking node.evaluate() or transformed into a functional object via node.compile().",examples:['node1 = parse("sqrt(3^2 + 4^2)")',"node1.evaluate()","code1 = node1.compile()","code1.evaluate()","scope = {a: 3, b: 4}",'node2 = parse("a * b")',"node2.evaluate(scope)","code2 = node2.compile()","code2.evaluate(scope)"],seealso:["parser","evaluate","compile"]},parser:{name:"parser",category:"Expression",syntax:["parser()"],description:"Create a parser object that keeps a context of variables and their values, allowing the evaluation of expressions in that context.",examples:["myParser = parser()",'myParser.evaluate("sqrt(3^2 + 4^2)")','myParser.set("x", 3)','myParser.evaluate("y = x + 3")','myParser.evaluate(["y = x + 3", "y = y + 1"])','myParser.get("y")'],seealso:["evaluate","parse","compile"]},compile:{name:"compile",category:"Expression",syntax:["compile(expr) ","compile([expr1, expr2, expr3, ...])"],description:"Parse and compile an expression. Returns a an object with a function evaluate([scope]) to evaluate the compiled expression.",examples:['code1 = compile("sqrt(3^2 + 4^2)")',"code1.evaluate() ",'code2 = compile("a * b")',"code2.evaluate({a: 3, b: 4})"],seealso:["parser","parse","evaluate"]},distance:{name:"distance",category:"Geometry",syntax:["distance([x1, y1], [x2, y2])","distance([[x1, y1], [x2, y2]])"],description:"Calculates the Euclidean distance between two points.",examples:["distance([0,0], [4,4])","distance([[0,0], [4,4]])"],seealso:[]},intersect:{name:"intersect",category:"Geometry",syntax:["intersect(expr1, expr2, expr3, expr4)","intersect(expr1, expr2, expr3)"],description:"Computes the intersection point of lines and/or planes.",examples:["intersect([0, 0], [10, 10], [10, 0], [0, 10])","intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])"],seealso:[]},and:{name:"and",category:"Logical",syntax:["x and y","and(x, y)"],description:"Logical and. Test whether two values are both defined with a nonzero/nonempty value.",examples:["true and false","true and true","2 and 4"],seealso:["not","or","xor"]},not:{name:"not",category:"Logical",syntax:["not x","not(x)"],description:"Logical not. Flips the boolean value of given argument.",examples:["not true","not false","not 2","not 0"],seealso:["and","or","xor"]},or:{name:"or",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical or. Test if at least one value is defined with a nonzero/nonempty value.",examples:["true or false","false or false","0 or 4"],seealso:["not","and","xor"]},xor:{name:"xor",category:"Logical",syntax:["x xor y","xor(x, y)"],description:"Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.",examples:["true xor false","false xor false","true xor true","0 xor 4"],seealso:["not","and","or"]},mapSlices:{name:"mapSlices",category:"Matrix",syntax:["mapSlices(A, dim, callback)"],description:"Generate a matrix one dimension less than A by applying callback to each slice of A along dimension dim.",examples:["A = [[1, 2], [3, 4]]","mapSlices(A, 1, sum)","mapSlices(A, 2, prod)"],seealso:["map","forEach"]},concat:{name:"concat",category:"Matrix",syntax:["concat(A, B, C, ...)","concat(A, B, C, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},count:{name:"count",category:"Matrix",syntax:["count(x)"],description:"Count the number of elements of a matrix, array or string.",examples:["a = [1, 2; 3, 4; 5, 6]","count(a)","size(a)",'count("hello world")'],seealso:["size"]},cross:{name:"cross",category:"Matrix",syntax:["cross(A, B)"],description:"Calculate the cross product for two vectors in three dimensional space.",examples:["cross([1, 1, 0], [0, 1, 1])","cross([3, -3, 1], [4, 9, 2])","cross([2, 3, 4], [5, 6, 7])"],seealso:["multiply","dot"]},column:{name:"column",category:"Matrix",syntax:["column(x, index)"],description:"Return a column from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","column(A, 1)","column(A, 2)"],seealso:["row","matrixFromColumns"]},ctranspose:{name:"ctranspose",category:"Matrix",syntax:["x'","ctranspose(x)"],description:"Complex Conjugate and Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","ctranspose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]},det:{name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},diag:{name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},diff:{name:"diff",category:"Matrix",syntax:["diff(arr)","diff(arr, dim)"],description:["Create a new matrix or array with the difference of the passed matrix or array.","Dim parameter is optional and used to indicate the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","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"],examples:["A = [1, 2, 4, 7, 0]","diff(A)","diff(A, 1)","B = [[1, 2], [3, 4]]","diff(B)","diff(B, 1)","diff(B, 2)","diff(B, bignumber(2))","diff([[1, 2], matrix([3, 4])], 2)"],seealso:["subtract","partitionSelect"]},dot:{name:"dot",category:"Matrix",syntax:["dot(A, B)","A * B"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]},getMatrixDataType:{name:"getMatrixDataType",category:"Matrix",syntax:["getMatrixDataType(x)"],description:'Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed".',examples:["getMatrixDataType([1, 2, 3])","getMatrixDataType([[5 cm], [2 inch]])",'getMatrixDataType([1, "text"])',"getMatrixDataType([1, bignumber(4)])"],seealso:["matrix","sparse","typeOf"]},identity:{name:"identity",category:"Matrix",syntax:["identity(n)","identity(m, n)","identity([m, n])"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["identity(3)","identity(3, 5)","a = [1, 2, 3; 4, 5, 6]","identity(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},filter:{name:"filter",category:"Matrix",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]},flatten:{name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]},forEach:{name:"forEach",category:"Matrix",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["numberOfPets = {}","addPet(n) = numberOfPets[n] = (numberOfPets[n] ? numberOfPets[n]:0 ) + 1;",'forEach(["Dog","Cat","Cat"], addPet)',"numberOfPets"],seealso:["map","sort","filter"]},inv:{name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","identity","ones","range","size","squeeze","subset","trace","transpose","zeros"]},pinv:{name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the Moore–Penrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]},eigs:{name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and optionally eigenvectors of a square matrix",examples:["eigs([[5, 2.3], [2.3, 1]])","eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })"],seealso:["inv"]},kron:{name:"kron",category:"Matrix",syntax:["kron(x, y)"],description:"Calculates the Kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]},matrixFromFunction:{name:"matrixFromFunction",category:"Matrix",syntax:["matrixFromFunction(size, fn)","matrixFromFunction(size, fn, format)","matrixFromFunction(size, fn, format, datatype)","matrixFromFunction(size, format, fn)","matrixFromFunction(size, format, datatype, fn)"],description:"Create a matrix by evaluating a generating function at each index.",examples:["f(I) = I[1] - I[2]","matrixFromFunction([3,3], f)","g(I) = I[1] - I[2] == 1 ? 4 : 0",'matrixFromFunction([100, 100], "sparse", g)',"matrixFromFunction([5], random)"],seealso:["matrix","matrixFromRows","matrixFromColumns","zeros"]},matrixFromRows:{name:"matrixFromRows",category:"Matrix",syntax:["matrixFromRows(...arr)","matrixFromRows(row1, row2)","matrixFromRows(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual rows.",examples:["matrixFromRows([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromColumns","matrixFromFunction","zeros"]},matrixFromColumns:{name:"matrixFromColumns",category:"Matrix",syntax:["matrixFromColumns(...arr)","matrixFromColumns(row1, row2)","matrixFromColumns(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual columns.",examples:["matrixFromColumns([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromRows","matrixFromFunction","zeros"]},map:{name:"map",category:"Matrix",syntax:["map(x, callback)","map(x, y, ..., callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array or the matrices/arrays.",examples:["map([1, 2, 3], square)","map([1, 2], [3, 4], f(a,b) = a + b)"],seealso:["filter","forEach"]},ones:{name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","identity","inv","range","size","squeeze","subset","trace","transpose","zeros"]},partitionSelect:{name:"partitionSelect",category:"Matrix",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1, compareText)',"arr = [5, 2, 1]","partitionSelect(arr, 0) # returns 1, arr is now: [1, 2, 5]","arr","partitionSelect(arr, 1, 'desc') # returns 2, arr is now: [5, 2, 1]","arr"],seealso:["sort"]},range:{name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"range(1m, 1m, 3m)","a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","ones","size","squeeze","subset","trace","transpose","zeros"]},resize:{name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze","reshape"]},reshape:{name:"reshape",category:"Matrix",syntax:["reshape(x, sizes)"],description:"Reshape a multi dimensional array to fit the specified dimensions.",examples:["reshape([1, 2, 3, 4, 5, 6], [2, 3])","reshape([[1, 2], [3, 4]], [1, 4])","reshape([[1, 2], [3, 4]], [4])","reshape([1, 2, 3, 4], [-1, 2])"],seealso:["size","squeeze","resize"]},rotate:{name:"rotate",category:"Matrix",syntax:["rotate(w, theta)","rotate(w, theta, v)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotate([1, 0], pi / 2)",'rotate(matrix([1, 0]), unit("35deg"))','rotate([1, 0, 0], unit("90deg"), [0, 0, 1])','rotate(matrix([1, 0, 0]), unit("90deg"), matrix([0, 0, 1]))'],seealso:["matrix","rotationMatrix"]},rotationMatrix:{name:"rotationMatrix",category:"Matrix",syntax:["rotationMatrix(theta)","rotationMatrix(theta, v)","rotationMatrix(theta, v, format)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotationMatrix(pi / 2)",'rotationMatrix(unit("45deg"), [0, 0, 1])','rotationMatrix(1, matrix([0, 0, 1]), "sparse")'],seealso:["cos","sin"]},row:{name:"row",category:"Matrix",syntax:["row(x, index)"],description:"Return a row from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","row(A, 1)","row(A, 2)"],seealso:["column","matrixFromRows"]},size:{name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","count","det","diag","identity","inv","ones","range","squeeze","subset","trace","transpose","zeros"]},sort:{name:"sort",category:"Matrix",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"], "natural")',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]},squeeze:{name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","identity","inv","ones","range","size","subset","trace","transpose","zeros"]},subset:{name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation `l:u`. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]","f[[1,2], [1,3]] = [9, 10; 11, 12]","f"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","trace","transpose","zeros"]},trace:{name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","transpose","zeros"]},transpose:{name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]},zeros:{name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose"]},fft:{name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional Fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]},ifft:{name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse Fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]},sylvester:{name:"sylvester",category:"Algebra",syntax:["sylvester(A,B,C)"],description:"Solves the real-valued Sylvester equation AX+XB=C for X",examples:["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])","A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]","sylvester(A, B, C)"],seealso:["schur","lyap"]},schur:{name:"schur",category:"Algebra",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","A = [[1, 0], [-4, 3]]","schur(A)"],seealso:["lyap","sylvester"]},lyap:{name:"lyap",category:"Algebra",syntax:["lyap(A,Q)"],description:"Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P",examples:["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])","A = [[-2, 0], [1, -4]]","Q = [[3, 1], [1, 3]]","lyap(A,Q)"],seealso:["schur","sylvester"]},solveODE:{name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]},combinations:{name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["combinationsWithRep","permutations","factorial"]},combinationsWithRep:{name:"combinationsWithRep",category:"Probability",syntax:["combinationsWithRep(n, k)"],description:"Compute the number of combinations of n items taken k at a time with replacements.",examples:["combinationsWithRep(7, 5)"],seealso:["combinations","permutations","factorial"]},factorial:{name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","combinationsWithRep","permutations","gamma"]},gamma:{name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]},kldivergence:{name:"kldivergence",category:"Probability",syntax:["kldivergence(x, y)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]},lgamma:{name:"lgamma",category:"Probability",syntax:["lgamma(n)"],description:"Logarithm of the gamma function for real, positive numbers and complex numbers, using Lanczos approximation for numbers and Stirling series for complex numbers.",examples:["lgamma(4)","lgamma(1/2)","lgamma(i)","lgamma(complex(1.1, 2))"],seealso:["gamma"]},multinomial:{name:"multinomial",category:"Probability",syntax:["multinomial(A)"],description:"Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.",examples:["multinomial([1, 2, 1])"],seealso:["combinations","factorial"]},permutations:{name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","combinationsWithRep","factorial"]},pickRandom:{name:"pickRandom",category:"Probability",syntax:["pickRandom(array)","pickRandom(array, number)","pickRandom(array, weights)","pickRandom(array, number, weights)","pickRandom(array, weights, number)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])","pickRandom([1, 3, 1, 6], 2)","pickRandom([1, 3, 1, 6], [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"],seealso:["random","randomInt"]},random:{name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]},randomInt:{name:"randomInt",category:"Probability",syntax:["randomInt(max)","randomInt(min, max)","randomInt(size)","randomInt(size, max)","randomInt(size, min, max)"],description:"Return a random integer number",examples:["randomInt(10, 20)","randomInt([2, 3], 10)"],seealso:["pickRandom","random"]},compare:{name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compareNatural","compareText"]},compareNatural:{name:"compareNatural",category:"Relational",syntax:["compareNatural(x, y)"],description:"Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compareNatural(2, 3)","compareNatural(3, 2)","compareNatural(2, 2)","compareNatural(5cm, 40mm)",'compareNatural("2", "10")',"compareNatural(2 + 3i, 2 + 4i)","compareNatural([1, 2, 4], [1, 2, 3])","compareNatural([1, 5], [1, 2, 3])","compareNatural([1, 2], [1, 2])","compareNatural({a: 2}, {a: 4})"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare","compareText"]},compareText:{name:"compareText",category:"Relational",syntax:["compareText(x, y)"],description:"Compare two strings lexically. Comparison is case sensitive. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:['compareText("B", "A")','compareText("A", "B")','compareText("A", "A")','compareText("2", "10")','compare("2", "10")',"compare(2, 10)",'compareNatural("2", "10")','compareText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural"]},deepEqual:{name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["deepEqual([1,3,4], [1,3,4])","deepEqual([1,3,4], [1,3])"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]},equal:{name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual","equalText"]},equalText:{name:"equalText",category:"Relational",syntax:["equalText(x, y)"],description:"Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.",examples:['equalText("Hello", "Hello")','equalText("a", "A")','equal("2e3", "2000")','equalText("2e3", "2000")','equalText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural","compareText","equal"]},larger:{name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not. Comparing a value with NaN returns false.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]},largerEq:{name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 >= 1+1","2 > 1+1","a = 3.2","b = 6-2.8","(a >= b)"],seealso:["equal","unequal","smallerEq","smaller","compare"]},smaller:{name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not. Comparing a value with NaN returns false.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]},smallerEq:{name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 <= 1+1","2 < 1+1","a = 3.2","b = 6-2.8","(a <= b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]},unequal:{name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]},setCartesian:{name:"setCartesian",category:"Set",syntax:["setCartesian(set1, set2)"],description:"Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays and the values will be sorted in ascending order before the operation.",examples:["setCartesian([1, 2], [3, 4])"],seealso:["setUnion","setIntersect","setDifference","setPowerset"]},setDifference:{name:"setDifference",category:"Set",syntax:["setDifference(set1, set2)"],description:"Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setDifference([1, 2, 3, 4], [3, 4, 5, 6])","setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setSymDifference"]},setDistinct:{name:"setDistinct",category:"Set",syntax:["setDistinct(set)"],description:"Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setDistinct([1, 1, 1, 2, 2, 3])"],seealso:["setMultiplicity"]},setIntersect:{name:"setIntersect",category:"Set",syntax:["setIntersect(set1, set2)"],description:"Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])","setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setDifference"]},setIsSubset:{name:"setIsSubset",category:"Set",syntax:["setIsSubset(set1, set2)"],description:"Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIsSubset([1, 2], [3, 4, 5, 6])","setIsSubset([3, 4], [3, 4, 5, 6])"],seealso:["setUnion","setIntersect","setDifference"]},setMultiplicity:{name:"setMultiplicity",category:"Set",syntax:["setMultiplicity(element, set)"],description:"Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setMultiplicity(1, [1, 2, 2, 4])","setMultiplicity(2, [1, 2, 2, 4])"],seealso:["setDistinct","setSize"]},setPowerset:{name:"setPowerset",category:"Set",syntax:["setPowerset(set)"],description:"Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setPowerset([1, 2, 3])"],seealso:["setCartesian"]},setSize:{name:"setSize",category:"Set",syntax:["setSize(set)","setSize(set, unique)"],description:'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',examples:["setSize([1, 2, 2, 4])","setSize([1, 2, 2, 4], true)"],seealso:["setUnion","setIntersect","setDifference"]},setSymDifference:{name:"setSymDifference",category:"Set",syntax:["setSymDifference(set1, set2)"],description:"Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])","setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setDifference"]},setUnion:{name:"setUnion",category:"Set",syntax:["setUnion(set1, set2)"],description:"Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setUnion([1, 2, 3, 4], [3, 4, 5, 6])","setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setIntersect","setDifference"]},zpk2tf:{name:"zpk2tf",category:"Signal",syntax:["zpk2tf(z, p, k)"],description:"Compute the transfer function of a zero-pole-gain model.",examples:["zpk2tf([1, 2], [-1, -2], 1)","zpk2tf([1, 2], [-1, -2])","zpk2tf([1 - 3i, 2 + 2i], [-1, -2])"],seealso:[]},freqz:{name:"freqz",category:"Signal",syntax:["freqz(b, a)","freqz(b, a, w)"],description:"Calculates the frequency response of a filter given its numerator and denominator coefficients.",examples:["freqz([1, 2], [1, 2, 3])","freqz([1, 2], [1, 2, 3], [0, 1])","freqz([1, 2], [1, 2, 3], 512)"],seealso:[]},erf:{name:"erf",category:"Special",syntax:["erf(x)"],description:"Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x",examples:["erf(0.2)","erf(-0.5)","erf(4)"],seealso:[]},zeta:{name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemann's Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]},cumsum:{name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]},mad:{name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])"],seealso:["mean","median","std","abs"]},max:{name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values. If any NaN values are found, the function yields the last NaN in the input.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]},mean:{name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dimension)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","variance"]},median:{name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","variance","quantileSeq"]},min:{name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values. If any NaN values are found, the function yields the last NaN in the input.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]},mode:{name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(2, 1, 4, 3, 1)","mode([1, 2.7, 3.2, 4, 2.7])","mode(1, 4, 6, 1, 6)"],seealso:["max","mean","min","median","prod","std","sum","variance"]},prod:{name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","variance"]},quantileSeq:{name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:"Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probability are: Number, BigNumber. \n\nIn case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.",examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]},std:{name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, dimension)","std(A, normalization)","std(A, dimension, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","prod","sum","variance"]},sum:{name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","variance"]},variance:{name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, dimension)","variance(A, normalization)","variance(A, dimension, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]},corr:{name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]},acos:{name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]},acosh:{name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]},acot:{name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]},acoth:{name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the inverse hyperbolic tangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]},acsc:{name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]},acsch:{name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the inverse hyperbolic cosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]},asec:{name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]},asech:{name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]},asin:{name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]},asinh:{name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]},atan:{name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]},atanh:{name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]},atan2:{name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]},cos:{name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]},cosh:{name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]},cot:{name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]},coth:{name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]},csc:{name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]},csch:{name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]},sec:{name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]},sech:{name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]},sin:{name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]},sinh:{name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]},tan:{name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]},tanh:{name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]},to:{name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]},clone:{name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables, and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]},format:{name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]},bin:{name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]},oct:{name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]},hex:{name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]},isNaN:{name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]},isInteger:{name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]},isNegative:{name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]},isNumeric:{name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]},hasNumericValue:{name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]},isPositive:{name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]},isPrime:{name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]},isZero:{name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]},print:{name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $1, $2, $3", [6, 9, 4])'],seealso:["format"]},typeOf:{name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]},numeric:{name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, bigint, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "bigint")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","bigint","fraction","bignumber","string","format"]}},ih="help",oh=he(ih,["typed","mathWithTransform","Help"],(e=>{let{typed:t,mathWithTransform:n,Help:r}=e;return t(ih,{any:function(e){let t,o=e;if("string"!=typeof e)for(t in n)if(me(n,t)&&e===n[t]){o=t;break}const a=i(rh,o);if(!a){const e="function"==typeof o?o.name:o;throw new Error('No documentation found on "'+e+'"')}return new r(a)}})})),ah="chain",sh=he(ah,["typed","Chain"],(e=>{let{typed:t,Chain:n}=e;return t(ah,{"":function(){return new n},any:function(e){return new n(e)}})})),uh=he("det",["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],(e=>{let{typed:t,matrix:n,subtractScalar:r,multiply:i,divideScalar:o,isZero:a,unaryMinus:s}=e;return t("det",{any:function(e){return ae(e)},"Array | Matrix":function(e){let t;switch(t=E(e)?e.size():Array.isArray(e)?(e=n(e)).size():[],t.length){case 0:return ae(e);case 1:if(1===t[0])return ae(e.valueOf()[0]);if(0===t[0])return 1;throw new RangeError("Matrix must be square (size: "+pr(t)+")");case 2:{const n=t[0],u=t[1];if(n===u)return function(e,t){if(1===t)return ae(e[0][0]);if(2===t)return r(i(e[0][0],e[1][1]),i(e[1][0],e[0][1]));{let n=!1;const u=new Array(t).fill(0).map(((e,t)=>t));for(let s=0;s{let{typed:t,matrix:n,divideScalar:r,addScalar:i,multiply:o,unaryMinus:a,det:s,identity:u,abs:c}=e;return t("inv",{"Array | Matrix":function(e){const t=E(e)?e.size():vr(e);switch(t.length){case 1:if(1===t[0])return E(e)?n([r(1,e.valueOf()[0])]):[r(1,e[0])];throw new RangeError("Matrix must be square (size: "+pr(t)+")");case 2:{const r=t[0],i=t[1];if(r===i)return E(e)?n(l(e.valueOf(),r,i),e.storage()):l(e,r,i);throw new RangeError("Matrix must be square (size: "+pr(t)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+pr(t)+")")}},any:function(e){return r(1,e)}});function l(e,t,n){let l,f,p,m,h;if(1===t){if(m=e[0][0],0===m)throw Error("Cannot calculate inverse, determinant is zero");return[[r(1,m)]]}if(2===t){const t=s(e);if(0===t)throw Error("Cannot calculate inverse, determinant is zero");return[[r(e[1][1],t),r(a(e[0][1]),t)],[r(a(e[1][0]),t),r(e[0][0],t)]]}{const s=e.concat();for(l=0;lu&&(u=c(s[l][e]),d=l),l++;if(0===u)throw Error("Cannot calculate inverse, determinant is zero");l=d,l!==e&&(h=s[e],s[e]=s[l],s[l]=h,h=m[e],m[e]=m[l],m[l]=h);const g=s[e],y=m[e];for(l=0;l{let{typed:t,matrix:n,inv:r,deepEqual:i,equal:o,dotDivide:a,dot:s,ctranspose:u,divideScalar:c,multiply:l,add:f,Complex:p}=e;return t(lh,{"Array | Matrix":function(e){const t=E(e)?e.size():vr(e);switch(t.length){case 1:return d(e)?u(e):1===t[0]?r(e):a(u(e),s(e,e));case 2:{if(d(e))return u(e);const i=t[0],o=t[1];if(i===o)try{return r(e)}catch(e){if(!(e instanceof Error&&e.message.match(/Cannot calculate inverse, determinant is zero/)))throw e}return E(e)?n(m(e.valueOf(),i,o),e.storage()):m(e,i,o)}default:throw new RangeError("Matrix must be two dimensional (size: "+pr(t)+")")}},any:function(e){return o(e,0)?ae(e):c(1,e)}});function m(e,t,n){const{C:i,F:o}=function(e,t,n){const r=function(e,t,n){const r=ae(e);let i=0;for(let e=0;ee.filter(((e,n)=>n!h(s(r[t],r[t]))))}}(e,t,n),c=l(r(l(u(i),i)),u(i)),p=l(u(o),r(l(o,u(o))));return l(p,c)}function h(e){return o(f(e,p(1,1)),f(0,p(1,1)))}function d(e){return i(f(e,p(1,1)),f(l(e,0),p(1,1)))}}));const ph=he("eigs",["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","size","reshape","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],(e=>{let{config:t,typed:n,matrix:r,addScalar:i,subtract:o,equal:a,abs:s,atan:u,cos:c,sin:l,multiplyScalar:f,divideScalar:p,inv:m,bignumber:h,multiply:y,add:v,larger:w,column:N,flatten:E,number:A,complex:S,sqrt:M,diag:C,size:T,reshape:B,qr:D,usolve:F,usolveAll:O,im:_,re:I,smaller:z,matrixFromColumns:k,dot:R}=e;const q=function(e){let{config:t,addScalar:n,subtract:r,abs:i,atan:o,cos:a,sin:s,multiplyScalar:u,inv:c,bignumber:l,multiply:f,add:p}=e;function m(e,n,r){const i=n-e;return Math.abs(i)<=t.relTol?Math.PI/4:.5*Math.atan(2*r/(n-e))}function h(e,n,a){const s=r(n,e);return i(s)<=t.relTol?l(-1).acos().div(4):u(.5,o(f(2,a,c(s))))}function d(e,t,n,r){const i=e.length,o=Math.cos(t),a=Math.sin(t),s=Array(i).fill(0),u=Array(i).fill(0);for(let t=0;t({value:o[t],vector:e})));return{values:o,eigenvectors:s}}return function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.relTol,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;if("number"===o)return function(e,t,n){const r=e.length,i=Math.abs(t/r);let o,a;if(n){a=new Array(r);for(let e=0;e=Math.abs(i);){const t=s[0][0],r=s[0][1];o=m(e[t][t],e[r][r],e[t][r]),e=x(e,o,t,r),n&&(a=d(a,o,t,r)),s=b(e)}const u=Array(r).fill(0);for(let t=0;t=i(o);){const t=u[0][0],r=u[0][1];a=h(e[t][t],e[r][r],e[t][r]),e=y(e,a,t,r),n&&(s=g(s,a,t,r)),u=v(e)}const c=Array(r).fill(0);for(let t=0;t=5)return null;for(s=0;;){const t=d(e,a);if(v(D(B(a,[t])),r))break;if(++s>=10)return null;a=F(t)}return a}function T(e,t,n){const r="BigNumber"===n,i="Complex"===n;let o=Array(e).fill(0).map((e=>2*Math.random()-1));return r&&(o=o.map((e=>c(e)))),i&&(o=o.map((e=>x(e)))),o=B(o,t),F(o,n)}function B(e,t){const r=f(e);for(let o of t)o=p(o,r),e=n(e,i(a(N(o,e),N(o,o)),o));return e}function D(e){return u(s(N(e,e)))}function F(e,t){const n="Complex"===t,r="BigNumber"===t?c(1):n?x(1):1;return i(a(r,D(e)),e)}return function(e,s,f,p){let d=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];const w=function(e,n,r,i,s){const f="BigNumber"===i,p="Complex"===i,m=f?c(0):0,h=f?c(1):p?x(1):1,d=f?c(1):1,g=f?c(10):2,w=o(g,g);let N;s&&(N=Array(n).fill(h));let E=!1;for(;!E;){E=!0;for(let r=0;r1&&(N=l(Array(y-1).fill(m)))),y-=1,d.pop();for(let e=0;e2&&(N=l(Array(y-2).fill(m)))),y-=2,d.pop(),d.pop();for(let e=0;e+n(u(e),u(t)))),M>100){const e=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+g.join(", "));throw e.values=g,e.vectors=[],e}const C=s?i(w,function(e,t){const n=[];for(let e=0;ei(p,e))),A.push(...l.map((e=>({value:s,vector:r(e)}))))}return A}(e,s,T,w,N,f,p);return{values:N,eigenvectors:t}}return{values:N}}}({config:t,addScalar:i,subtract:o,multiply:y,multiplyScalar:f,flatten:E,divideScalar:p,sqrt:M,abs:s,bignumber:h,diag:C,size:T,reshape:B,qr:D,inv:m,usolve:F,usolveAll:O,equal:a,complex:S,larger:w,smaller:z,matrixFromColumns:k,dot:R});return n("eigs",{Array:function(e){return j(r(e))},"Array, number|BigNumber":function(e,t){return j(r(e),{precision:t})},"Array, Object":(e,t)=>j(r(e),t),Matrix:function(e){return j(e,{matricize:!0})},"Matrix, number|BigNumber":function(e,t){return j(e,{precision:t,matricize:!0})},"Matrix, Object":function(e,t){const n={matricize:!0};return sr(n,t),j(e,n)}});function j(e){var n;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=!("eigenvectors"in i)||i.eigenvectors,u=function(e,t,n){const r=e.toArray(),i=e.size();if(2!==i.length||i[0]!==i[1])throw new RangeError(`Matrix must be square (size: ${pr(i)})`);const a=i[0];if(function(e,t,n){for(let r=0;r{let{value:t,vector:n}=e;return{value:t,vector:r(n)}})))),a&&Object.defineProperty(u,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),u}function U(e,t,n){const r=e.datatype();if("number"===r||"BigNumber"===r||"Complex"===r)return r;let i=!1,o=!1,a=!1;for(let e=0;e{let{typed:t,abs:n,add:r,identity:i,inv:o,multiply:a}=e;return t(mh,{Matrix:function(e){const t=e.size();if(2!==t.length||t[0]!==t[1])throw new RangeError("Matrix must be square (size: "+pr(t)+")");const u=t[0],c=function(e){const t=e.size()[0];let r=0;for(let i=0;i1&&(y=a(y,m),x=-x),g=g*(f-e+1)/((2*f-e+1)*e),h=r(h,a(g,y)),d=r(d,a(g*x,y));let b=a(o(d),h);for(let e=0;e{let{typed:t,abs:n,add:r,multiply:i,map:o,sqrt:a,subtract:s,inv:u,size:c,max:l,identity:f}=e;const p=1e-6;function m(e){let t,o=0,a=e,m=f(c(e));do{const e=a;if(a=i(.5,r(e,u(m))),m=i(.5,r(m,u(e))),t=l(n(s(a,e))),t>p&&++o>1e3)throw new Error("computing square root of matrix: iterative method could not converge")}while(t>p);return a}return t(dh,{"Array | Matrix":function(e){const t=E(e)?e.size():vr(e);switch(t.length){case 1:if(1===t[0])return o(e,a);throw new RangeError("Matrix must be square (size: "+pr(t)+")");case 2:if(t[0]===t[1])return m(e);throw new RangeError("Matrix must be square (size: "+pr(t)+")");default:throw new RangeError("Matrix must be at most two dimensional (size: "+pr(t)+")")}}})})),yh="sylvester",xh=he(yh,["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],(e=>{let{typed:t,schur:n,matrixFromColumns:r,matrix:i,multiply:o,range:a,concat:s,transpose:u,index:c,subset:l,add:f,subtract:p,identity:m,lusolve:h,abs:d}=e;return t(yh,{"Matrix, Matrix, Matrix":g,"Array, Matrix, Matrix":function(e,t,n){return g(i(e),t,n)},"Array, Array, Matrix":function(e,t,n){return g(i(e),i(t),n)},"Array, Matrix, Array":function(e,t,n){return g(i(e),t,i(n))},"Matrix, Array, Matrix":function(e,t,n){return g(e,i(t),n)},"Matrix, Array, Array":function(e,t,n){return g(e,i(t),i(n))},"Matrix, Matrix, Array":function(e,t,n){return g(e,t,i(n))},"Array, Array, Array":function(e,t,n){return g(i(e),i(t),i(n)).toArray()}});function g(e,t,g){const y=t.size()[0],x=e.size()[0],b=n(e),v=b.T,w=b.U,N=n(o(-1,t)),E=N.T,A=N.U,S=o(o(u(w),g),A),M=a(0,x),C=[],T=(e,t)=>s(e,t,1),B=(e,t)=>s(e,t,0);for(let e=0;e1e-5){let t=B(l(S,c(M,e)),l(S,c(M,e+1)));for(let n=0;n{let{typed:t,matrix:n,identity:r,multiply:i,qr:o,norm:a,subtract:s}=e;return t(bh,{Array:function(e){const t=u(n(e));return{U:t.U.valueOf(),T:t.T.valueOf()}},Matrix:function(e){return u(e)}});function u(e){const t=e.size()[0];let n,u=e,c=r(t),l=0;do{n=u;const e=o(u),t=e.Q,r=e.R;if(u=i(r,t),c=i(c,t),l++>100)break}while(a(s(u,n))>1e-4);return{U:c,T:u}}})),wh="lyap",Nh=he(wh,["typed","matrix","sylvester","multiply","transpose"],(e=>{let{typed:t,matrix:n,sylvester:r,multiply:i,transpose:o}=e;return t(wh,{"Matrix, Matrix":function(e,t){return r(e,o(e),i(-1,t))},"Array, Matrix":function(e,t){return r(n(e),o(n(e)),i(-1,t))},"Matrix, Array":function(e,t){return r(e,o(n(e)),n(i(-1,t)))},"Array, Array":function(e,t){return r(n(e),o(n(e)),n(i(-1,t))).toArray()}})})),Eh=he("divide",["typed","matrix","multiply","equalScalar","divideScalar","inv"],(e=>{let{typed:t,matrix:n,multiply:r,equalScalar:i,divideScalar:o,inv:a}=e;const s=qo({typed:t,equalScalar:i}),u=jo({typed:t});return t("divide",se({"Array | Matrix, Array | Matrix":function(e,t){return r(e,a(t))},"DenseMatrix, any":function(e,t){return u(e,t,o,!1)},"SparseMatrix, any":function(e,t){return s(e,t,o,!1)},"Array, any":function(e,t){return u(n(e),t,o,!1).valueOf()},"any, Array | Matrix":function(e,t){return r(e,a(t))}},o.signatures))})),Ah="distance",Sh=he(Ah,["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],(e=>{let{typed:t,addScalar:n,subtractScalar:r,multiplyScalar:i,divideScalar:o,deepEqual:a,sqrt:s,abs:u}=e;return t(Ah,{"Array, Array, Array":function(e,t,n){if(2===e.length&&2===t.length&&2===n.length){if(!l(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!l(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!l(n))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(a(t,n))throw new TypeError("LinePoint1 should not be same with LinePoint2");const o=r(n[1],t[1]),s=r(t[0],n[0]),u=r(i(n[0],t[1]),i(t[0],n[1]));return d(e[0],e[1],o,s,u)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(e,t,n){if(2===Object.keys(e).length&&2===Object.keys(t).length&&2===Object.keys(n).length){if(!l(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!l(t))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!l(n))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(a(h(t),h(n)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in e&&"pointY"in e&&"lineOnePtX"in t&&"lineOnePtY"in t&&"lineTwoPtX"in n&&"lineTwoPtY"in n){const o=r(n.lineTwoPtY,t.lineOnePtY),a=r(t.lineOnePtX,n.lineTwoPtX),s=r(i(n.lineTwoPtX,t.lineOnePtY),i(t.lineOnePtX,n.lineTwoPtY));return d(e.pointX,e.pointY,o,a,s)}throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(e,t){if(2===e.length&&3===t.length){if(!l(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return d(e[0],e[1],t[0],t[1],t[2])}if(3===e.length&&6===t.length){if(!f(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!m(t))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return y(e[0],e[1],e[2],t[0],t[1],t[2],t[3],t[4],t[5])}if(e.length===t.length&&e.length>0){if(!p(e))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!p(t))throw new TypeError("All values of an array should be numbers or BigNumbers");return x(e,t)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(e,t){if(2===Object.keys(e).length&&3===Object.keys(t).length){if(!l(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(t))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"xCoeffLine"in t&&"yCoeffLine"in t&&"constant"in t)return d(e.pointX,e.pointY,t.xCoeffLine,t.yCoeffLine,t.constant);throw new TypeError("Key names do not match")}if(3===Object.keys(e).length&&6===Object.keys(t).length){if(!f(e))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!m(t))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"x0"in t&&"y0"in t&&"z0"in t&&"a"in t&&"b"in t&&"c"in t)return y(e.pointX,e.pointY,e.pointZ,t.x0,t.y0,t.z0,t.a,t.b,t.c);throw new TypeError("Key names do not match")}if(2===Object.keys(e).length&&2===Object.keys(t).length){if(!l(e))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!l(t))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in e&&"pointOneY"in e&&"pointTwoX"in t&&"pointTwoY"in t)return x([e.pointOneX,e.pointOneY],[t.pointTwoX,t.pointTwoY]);throw new TypeError("Key names do not match")}if(3===Object.keys(e).length&&3===Object.keys(t).length){if(!f(e))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!f(t))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in e&&"pointOneY"in e&&"pointOneZ"in e&&"pointTwoX"in t&&"pointTwoY"in t&&"pointTwoZ"in t)return x([e.pointOneX,e.pointOneY,e.pointOneZ],[t.pointTwoX,t.pointTwoY,t.pointTwoZ]);throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},Array:function(e){if(!function(e){if(2===e[0].length&&c(e[0][0])&&c(e[0][1])){if(e.some((e=>2!==e.length||!c(e[0])||!c(e[1]))))return!1}else{if(!(3===e[0].length&&c(e[0][0])&&c(e[0][1])&&c(e[0][2])))return!1;if(e.some((e=>3!==e.length||!c(e[0])||!c(e[1])||!c(e[2]))))return!1}return!0}(e))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return function(e){const t=[];let n=[],r=[];for(let i=0;i{let{typed:t,config:n,abs:r,add:i,addScalar:o,matrix:a,multiply:s,multiplyScalar:u,divideScalar:c,subtract:l,smaller:f,equalScalar:p,flatten:m,isZero:h,isNumeric:d}=e;return t("intersect",{"Array, Array, Array":g,"Array, Array, Array, Array":y,"Matrix, Matrix, Matrix":function(e,t,n){const r=g(e.valueOf(),t.valueOf(),n.valueOf());return null===r?null:a(r)},"Matrix, Matrix, Matrix, Matrix":function(e,t,n,r){const i=y(e.valueOf(),t.valueOf(),n.valueOf(),r.valueOf());return null===i?null:a(i)}});function g(e,t,n){if(e=x(e),t=x(t),n=x(n),!v(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!v(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!function(e){return 4===e.length&&d(e[0])&&d(e[1])&&d(e[2])&&d(e[3])}(n))throw new TypeError("Array with 4 numbers expected as third argument");return function(e,t,n,r,i,a,s,f,p,m){const h=u(e,s),d=u(r,s),g=u(t,f),y=u(i,f),x=u(n,p),b=u(a,p),v=l(l(l(m,h),g),x),w=l(l(l(o(o(d,y),b),h),g),x),N=c(v,w);return[o(e,u(N,l(r,e))),o(t,u(N,l(i,t))),o(n,u(N,l(a,n)))]}(e[0],e[1],e[2],t[0],t[1],t[2],n[0],n[1],n[2],n[3])}function y(e,t,a,m){if(e=x(e),t=x(t),a=x(a),m=x(m),2===e.length){if(!b(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!b(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!b(a))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!b(m))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return function(e,t,a,p){const m=e,d=a,g=l(m,t),y=l(d,p),x=l(u(g[0],y[1]),u(y[0],g[1]));if(h(x))return null;if(f(r(x),n.relTol))return null;const b=u(y[0],m[1]),v=u(y[1],m[0]),w=u(y[0],d[1]),N=u(y[1],d[0]),E=c(o(l(l(b,v),w),N),x);return i(s(g,E),m)}(e,t,a,m)}if(3===e.length){if(!v(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!v(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!v(a))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!v(m))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return function(e,t,n,r,i,a,s,f,m,d,g,y){const x=w(e,s,d,s,t,f,g,f,n,m,y,m),b=w(d,s,r,e,g,f,i,t,y,m,a,n),v=w(e,s,r,e,t,f,i,t,n,m,a,n),N=w(d,s,d,s,g,f,g,f,y,m,y,m),E=w(r,e,r,e,i,t,i,t,a,n,a,n),A=l(u(x,b),u(v,N)),S=l(u(E,N),u(b,b));if(h(S))return null;const M=c(A,S),C=c(o(x,u(M,b)),N),T=o(e,u(M,l(r,e))),B=o(t,u(M,l(i,t))),D=o(n,u(M,l(a,n))),F=o(s,u(C,l(d,s))),O=o(f,u(C,l(g,f))),_=o(m,u(C,l(y,m)));return p(T,F)&&p(B,O)&&p(D,_)?[T,B,D]:null}(e[0],e[1],e[2],t[0],t[1],t[2],a[0],a[1],a[2],m[0],m[1],m[2])}throw new TypeError("Arrays with two or thee dimensional points expected")}function x(e){return 1===e.length?e[0]:e.length>1&&Array.isArray(e[0])&&e.every((e=>Array.isArray(e)&&1===e.length))?m(e):e}function b(e){return 2===e.length&&d(e[0])&&d(e[1])}function v(e){return 3===e.length&&d(e[0])&&d(e[1])&&d(e[2])}function w(e,t,n,r,i,a,s,c,f,p,m,h){const d=u(l(e,t),l(n,r)),g=u(l(i,a),l(s,c)),y=u(l(f,p),l(m,h));return o(o(d,g),y)}})),Ch=he("sum",["typed","config","add","numeric"],(e=>{let{typed:t,config:n,add:r,numeric:i}=e;return t("sum",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){try{return ui(e,t,r)}catch(e){throw Ju(e,"sum")}},"...":function(e){if(oi(e))throw new TypeError("Scalar values expected in function sum");return o(e)}});function o(e){let t;return ai(e,(function(e){try{t=void 0===t?e:r(t,e)}catch(t){throw Ju(t,"sum",e)}})),void 0===t&&(t=i(0,n.number)),"string"==typeof t&&(t=i(t,xe(t,n))),t}})),Th="cumsum",Bh=he(Th,["typed","add","unaryPlus"],(e=>{let{typed:t,add:n,unaryPlus:r}=e;return t(Th,{Array:i,Matrix:function(e){return e.create(i(e.valueOf(),e.datatype()))},"Array, number | BigNumber":a,"Matrix, number | BigNumber":function(e,t){return e.create(a(e.valueOf(),t),e.datatype())},"...":function(e){if(oi(e))throw new TypeError("All values expected to be scalar in function cumsum");return i(e)}});function i(e){try{return o(e)}catch(e){throw Ju(e,Th)}}function o(e){if(0===e.length)return[];const t=[r(e[0])];for(let r=1;r=n.length)throw new br(t,n.length);try{return s(e,t)}catch(e){throw Ju(e,Th)}}function s(e,t){let n,r,i;if(t<=0){const a=e[0][0];if(Array.isArray(a)){for(i=ii(e),r=[],n=0;n{let{typed:t,add:n,divide:r}=e;return t(Dh,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(e,t){try{const i=ui(e,t,n),o=Array.isArray(e)?vr(e):e.size();return r(i,o[t])}catch(e){throw Ju(e,"mean")}},"...":function(e){if(oi(e))throw new TypeError("Scalar values expected in function mean");return i(e)}});function i(e){let t,i=0;if(ai(e,(function(e){try{t=void 0===t?e:n(t,e),i++}catch(t){throw Ju(t,"mean",e)}})),0===i)throw new Error("Cannot calculate the mean of an empty array");return r(t,i)}})),Oh="median",_h=he(Oh,["typed","add","divide","compare","partitionSelect"],(e=>{let{typed:t,add:n,divide:r,compare:i,partitionSelect:o}=e;function a(e){try{const t=(e=zr(e.valueOf())).length;if(0===t)throw new Error("Cannot calculate median of an empty array");if(t%2==0){const n=t/2-1,r=o(e,n+1);let a=e[n];for(let t=0;t0&&(a=e[t]);return u(a,r)}{const n=o(e,(t-1)/2);return s(n)}}catch(e){throw Ju(e,"median")}}const s=t({"number | BigNumber | Complex | Unit":function(e){return e}}),u=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(e,t){return r(n(e,t),2)}});return t(Oh,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("median(A, dim) is not yet supported")},"...":function(e){if(oi(e))throw new TypeError("Scalar values expected in function median");return a(e)}})})),Ih=he("mad",["typed","abs","map","median","subtract"],(e=>{let{typed:t,abs:n,map:r,median:i,subtract:o}=e;return t("mad",{"Array | Matrix":a,"...":function(e){return a(e)}});function a(e){if(0===(e=zr(e.valueOf())).length)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{const t=i(e);return i(r(e,(function(e){return n(o(e,t))})))}catch(e){throw e instanceof TypeError&&e.message.includes("median")?new TypeError(e.message.replace("median","mad")):Ju(e,"mad")}}})),zh="unbiased",kh="variance",Rh=he(kh,["typed","add","subtract","multiply","divide","mapSlices","isNaN"],(e=>{let{typed:t,add:n,subtract:r,multiply:i,divide:o,mapSlices:a,isNaN:s}=e;return t(kh,{"Array | Matrix":function(e){return u(e,zh)},"Array | Matrix, string":u,"Array | Matrix, number | BigNumber":function(e,t){return c(e,t,zh)},"Array | Matrix, number | BigNumber, string":c,"...":function(e){return u(e,zh)}});function u(e,t){let a,u=0;if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(ai(e,(function(e){try{a=void 0===a?e:n(a,e),u++}catch(t){throw Ju(t,"variance",e)}})),0===u)throw new Error("Cannot calculate variance of an empty array");const c=o(a,u);if(a=void 0,ai(e,(function(e){const t=r(e,c);a=void 0===a?i(t,t):n(a,i(t,t))})),s(a))return a;switch(t){case"uncorrected":return o(a,u);case"biased":return o(a,u+1);case"unbiased":{const e=g(a)?a.mul(0):0;return 1===u?e:o(a,u-1)}default:throw new Error('Unknown normalization "'+t+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function c(e,t,n){try{if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return a(e,t,(e=>u(e,n)))}catch(e){throw Ju(e,"variance")}}})),qh="quantileSeq",Ph=he(qh,["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger","mapSlices"],(e=>{let{typed:t,bignumber:n,add:r,subtract:i,divide:o,multiply:a,partitionSelect:s,compare:u,isInteger:c,smaller:l,smallerEq:f,larger:p,mapSlices:m}=e;return t(qh,{"Array | Matrix, number | BigNumber":(e,t)=>g(e,t,!1),"Array | Matrix, number | BigNumber, number":(e,t,n)=>h(e,t,!1,n,g),"Array | Matrix, number | BigNumber, boolean":g,"Array | Matrix, number | BigNumber, boolean, number":(e,t,n,r)=>h(e,t,n,r,g),"Array | Matrix, Array | Matrix":(e,t)=>y(e,t,!1),"Array | Matrix, Array | Matrix, number":(e,t,n)=>h(e,t,!1,n,y),"Array | Matrix, Array | Matrix, boolean":y,"Array | Matrix, Array | Matrix, boolean, number":(e,t,n,r)=>h(e,t,n,r,y)});function h(e,t,n,r,i){return m(e,r,(e=>i(e,t,n)))}function g(e,t,i){let a;const s=e.valueOf();if(l(t,0))throw new Error("N/prob must be non-negative");if(f(t,1))return d(t)?x(s,t,i):n(x(s,t,i));if(p(t,1)){if(!c(t))throw new Error("N must be a positive integer");if(p(t,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");const e=r(t,1);a=[];for(let n=0;l(n,t);n++){const t=o(n+1,e);a.push(x(s,t,i))}return d(t)?a:n(a)}}function y(e,t,n){const r=e.valueOf(),i=t.valueOf(),o=[];for(let e=0;e0&&(h=o[e])}return r(a(h,i(1,m)),a(g,m))}})),jh=he("std",["typed","map","sqrt","variance"],(e=>{let{typed:t,map:n,sqrt:r,variance:i}=e;return t("std",{"Array | Matrix":o,"Array | Matrix, string":o,"Array | Matrix, number | BigNumber":o,"Array | Matrix, number | BigNumber, string":o,"...":function(e){return o(e)}});function o(e,t){if(0===e.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{const e=i.apply(null,arguments);return A(e)?n(e,r):r(e)}catch(e){throw e instanceof TypeError&&e.message.includes(" variance")?new TypeError(e.message.replace(" variance"," std")):e}}})),Uh="corr",Lh=he(Uh,["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],(e=>{let{typed:t,matrix:n,sqrt:r,sum:i,add:o,subtract:a,multiply:s,pow:u,divide:c}=e;return t(Uh,{"Array, Array":function(e,t){return l(e,t)},"Matrix, Matrix":function(e,t){const r=l(e.toArray(),t.toArray());return Array.isArray(r)?n(r):r}});function l(e,t){const n=[];if(Array.isArray(e[0])&&Array.isArray(t[0])){if(e.length!==t.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(let r=0;ro(e,s(n,t[r]))),0),m=i(e.map((e=>u(e,2)))),h=i(t.map((e=>u(e,2)))),d=a(s(n,p),s(l,f)),g=r(s(a(s(n,m),u(l,2)),a(s(n,h),u(f,2))));return c(d,g)}}));function $h(e,t){if(t>1;return $h(e,n)*$h(n+1,t)}function Hh(e,t){if(!ye(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!ye(t)||t<0)throw new TypeError("Positive integer value expected in function combinations");if(t>e)throw new TypeError("k must be less than or equal to n");const n=e-t;let r=1,i=2;const o=t{let{typed:t}=e;return t(Gh,{"number, number":Hh,"BigNumber, BigNumber":function(e,t){const n=e.constructor;let r,i;const o=e.minus(t),a=new n(1);if(!Zh(e)||!Zh(t))throw new TypeError("Positive integer value expected in function combinations");if(t.gt(e))throw new TypeError("k must be less than n in function combinations");if(r=a,t.lt(o))for(i=a;i.lte(o);i=i.plus(a))r=r.times(t.plus(i)).dividedBy(i);else for(i=a;i.lte(t);i=i.plus(a))r=r.times(o.plus(i)).dividedBy(i);return r}})}));function Zh(e){return e.isInteger()&&e.gte(0)}const Wh="combinationsWithRep",Yh=he(Wh,["typed"],(e=>{let{typed:t}=e;return t(Wh,{"number, number":function(e,t){if(!ye(e)||e<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!ye(t)||t<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(e<1)throw new TypeError("k must be less than or equal to n + k - 1");return t171?1/0:$h(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Xh(1-e));if(e>=171.35)return 1/0;if(e>85){const t=e*e,n=t*e,r=n*e,i=r*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*t)-139/(51840*n)-571/(2488320*r)+163879/(209018880*i)+5246819/(75246796800*i*e))}--e,t=Kh[0];for(let n=1;n=1;t--)n+=td[t]/(e+t);return ed+(e+.5)*Math.log(t)-t+Math.log(n)}nd.signature="number";const rd="gamma",id=he(rd,["typed","config","multiplyScalar","pow","BigNumber","Complex"],(e=>{let{typed:t,config:n,multiplyScalar:r,pow:i,BigNumber:o,Complex:a}=e;return t(rd,{number:Xh,Complex:function e(t){if(0===t.im)return Xh(t.re);if(t.re<.5){const n=new a(1-t.re,-t.im),r=new a(Math.PI*t.re,Math.PI*t.im);return new a(Math.PI).div(r.sin()).div(e(n))}t=new a(t.re-1,t.im);let n=new a(Kh[0],0);for(let e=1;e2;)i-=2,u+=i,a=a.times(u);return new o(a.toPrecision(o.precision))}})),od="lgamma",ad=he(od,["Complex","typed"],(e=>{let{Complex:t,typed:n}=e;const r=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return n(od,{number:nd,Complex:function e(n){if(n.isNaN())return new t(NaN,NaN);if(0===n.im)return new t(nd(n.re),0);if(n.re>=7||Math.abs(n.im)>=7)return i(n);if(n.re<=.1){const i=(r=6.283185307179586,(!0^((a=n.im)>0||!(a<0)&&1/a==1/0)?-r:r)*Math.floor(.5*n.re+.25)),o=n.mul(Math.PI).sin().log(),s=e(new t(1-n.re,-n.im));return new t(1.1447298858494002,i).sub(o).sub(s)}return n.im>=0?o(n):o(n.conjugate()).conjugate();var r,a},BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function i(e){const n=e.sub(.5).mul(e.log()).sub(e).add(ed),i=new t(1,0).div(e),o=i.div(e);let a=r[0],s=r[1];const u=2*o.re,c=o.re*o.re+o.im*o.im;for(let e=2;e<8;e++){const t=s;s=-c*a+r[e],a=u*a+t}const l=i.mul(o.mul(a).add(s));return n.add(l)}function o(e){let n=0,r=0,o=e;for(e=e.add(1);e.re<=7;){o=o.mul(e);const t=o.im<0?1:0;0!==t&&0===r&&n++,r=t,e=e.add(1)}return i(e).sub(o.log()).sub(new t(0,2*n*Math.PI*1))}})),sd="factorial",ud=he(sd,["typed","gamma"],(e=>{let{typed:t,gamma:n}=e;return t(sd,{number:function(e){if(e<0)throw new Error("Value must be non-negative");return n(e+1)},BigNumber:function(e){if(e.isNegative())throw new Error("Value must be non-negative");return n(e.plus(1))},"Array | Matrix":t.referToSelf((e=>t=>si(t,e)))})})),cd="kldivergence",ld=he(cd,["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],(e=>{let{typed:t,matrix:n,divide:r,sum:i,multiply:o,map:a,dotDivide:s,log:u,isNumeric:c}=e;return t(cd,{"Array, Array":function(e,t){return l(n(e),n(t))},"Matrix, Array":function(e,t){return l(e,n(t))},"Array, Matrix":function(e,t){return l(n(e),t)},"Matrix, Matrix":function(e,t){return l(e,t)}});function l(e,t){const n=t.size().length,l=e.size().length;if(n>1)throw new Error("first object must be one dimensional");if(l>1)throw new Error("second object must be one dimensional");if(n!==l)throw new Error("Length of two vectors must be equal");if(0===i(e))throw new Error("Sum of elements in first object must be non zero");if(0===i(t))throw new Error("Sum of elements in second object must be non zero");const f=r(e,i(e)),p=r(t,i(t)),m=i(o(f,a(s(f,p),(e=>u(e)))));return c(m)?m:Number.NaN}})),fd="multinomial",pd=he(fd,["typed","add","divide","multiply","factorial","isInteger","isPositive"],(e=>{let{typed:t,add:n,divide:r,multiply:i,factorial:o,isInteger:a,isPositive:s}=e;return t(fd,{"Array | Matrix":function(e){let t=0,u=1;return ai(e,(function(e){if(!a(e)||!s(e))throw new TypeError("Positive integer value expected in function multinomial");t=n(t,e),u=i(u,o(e))})),r(o(t),u)}})})),md="permutations",hd=he(md,["typed","factorial"],(e=>{let{typed:t,factorial:n}=e;return t(md,{"number | BigNumber":n,"number, number":function(e,t){if(!ye(e)||e<0)throw new TypeError("Positive integer value expected in function permutations");if(!ye(t)||t<0)throw new TypeError("Positive integer value expected in function permutations");if(t>e)throw new TypeError("second argument k must be less than or equal to first argument n");return $h(e-t+1,e)},"BigNumber, BigNumber":function(e,t){let n,r;if(!dd(e)||!dd(t))throw new TypeError("Positive integer value expected in function permutations");if(t.gt(e))throw new TypeError("second argument k must be less than or equal to first argument n");for(n=e.mul(0).add(1),r=e.minus(t).plus(1);r.lte(e);r=r.plus(1))n=n.times(r);return n}})}));function dd(e){return e.isInteger()&&e.gte(0)}var gd=n(7391);const yd=gd(Date.now());function xd(e){let t;var n;return t=null===(n=e)?yd:gd(String(n)),function(){return t()}}const bd="pickRandom",vd=he(bd,["typed","config","?on"],(e=>{let{typed:t,config:n,on:r}=e,i=xd(n.randomSeed);return r&&r("config",(function(e,t){e.randomSeed!==t.randomSeed&&(i=xd(e.randomSeed))})),t(bd,{"Array | Matrix":function(e){return o(e,{})},"Array | Matrix, Object":function(e,t){return o(e,t)},"Array | Matrix, number":function(e,t){return o(e,{number:t})},"Array | Matrix, Array | Matrix":function(e,t){return o(e,{weights:t})},"Array | Matrix, Array | Matrix, number":function(e,t,n){return o(e,{number:n,weights:t})},"Array | Matrix, number, Array | Matrix":function(e,t,n){return o(e,{number:t,weights:n})}});function o(e,t){let{number:n,weights:r,elementWise:o=!0}=t;const a=void 0===n;a&&(n=1);const s=E(e)?e.create:E(r)?r.create:null;e=e.valueOf(),r&&(r=r.valueOf()),!0===o&&(e=zr(e),r=zr(r));let u=0;if(void 0!==r){if(r.length!==e.length)throw new Error("Weights must have the same length as possibles");for(let e=0,t=r.length;e1)for(let r=0,i=e.shift();r{let{typed:t,config:n,on:r}=e,i=xd(n.randomSeed);return r&&r("config",(function(e,t){e.randomSeed!==t.randomSeed&&(i=xd(e.randomSeed))})),t(Nd,{"":()=>a(0,1),number:e=>a(0,e),"number, number":(e,t)=>a(e,t),"Array | Matrix":e=>o(e,0,1),"Array | Matrix, number":(e,t)=>o(e,0,t),"Array | Matrix, number, number":(e,t,n)=>o(e,t,n)});function o(e,t,n){const r=wd(e.valueOf(),(()=>a(t,n)));return E(e)?e.create(r,"number"):r}function a(e,t){return e+i()*(t-e)}})),Ad="randomInt",Sd=he(Ad,["typed","config","log2","?on"],(e=>{let{typed:t,config:n,log2:r,on:i}=e,o=xd(n.randomSeed);return i&&i("config",(function(e,t){e.randomSeed!==t.randomSeed&&(o=xd(e.randomSeed))})),t(Ad,{"":()=>s(0,2),number:e=>s(0,e),"number, number":(e,t)=>s(e,t),bigint:e=>u(0n,e),"bigint, bigint":u,"Array | Matrix":e=>a(e,0,1),"Array | Matrix, number":(e,t)=>a(e,0,t),"Array | Matrix, number, number":(e,t,n)=>a(e,t,n)});function a(e,t,n){const r=wd(e.valueOf(),(()=>s(t,n)));return E(e)?e.create(r,"number"):r}function s(e,t){return Math.floor(e+o()*(t-e))}function u(e,t){const n=t-e;if(n<=2n**30n)return e+BigInt(s(0,Number(n)));const i=r(n);let a=n;for(;a>=n;){a=0n;for(let e=0;e{let{typed:t,addScalar:n,subtractScalar:r,multiplyScalar:i,divideScalar:o,pow:a,factorial:s,combinations:u,isNegative:c,isInteger:l,number:f,bignumber:p,larger:m}=e;const h=[],g=[];return t(Md,{"number | BigNumber, number | BigNumber":function(e,t){if(!l(e)||c(e)||!l(t)||c(t))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(m(t,e))throw new TypeError("k must be less than or equal to n in function stirlingS2");const r=!(d(e)&&d(t)),o=r?g:h,a=r?p:f,s=f(e),u=f(t);if(o[s]&&o[s].length>u)return o[s][u];for(let e=0;e<=s;++e){if(o[e]||(o[e]=[a(0===e?1:0)]),0===e)continue;const t=o[e],r=o[e-1];for(let o=t.length;o<=e&&o<=u;++o)t[o]=o===e?1:n(i(a(o),r[o]),r[o-1])}return o[s][u]}})})),Td="bellNumbers",Bd=he(Td,["typed","addScalar","isNegative","isInteger","stirlingS2"],(e=>{let{typed:t,addScalar:n,isNegative:r,isInteger:i,stirlingS2:o}=e;return t(Td,{"number | BigNumber":function(e){if(!i(e)||r(e))throw new TypeError("Non-negative integer value expected in function bellNumbers");let t=0;for(let r=0;r<=e;r++)t=n(t,o(e,r));return t}})})),Dd="catalan",Fd=he(Dd,["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],(e=>{let{typed:t,addScalar:n,divideScalar:r,multiplyScalar:i,combinations:o,isNegative:a,isInteger:s}=e;return t(Dd,{"number | BigNumber":function(e){if(!s(e)||a(e))throw new TypeError("Non-negative integer value expected in function catalan");return r(o(i(e,2),e),n(e,1))}})})),Od="composition",_d=he(Od,["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],(e=>{let{typed:t,addScalar:n,combinations:r,isPositive:i,isNegative:o,isInteger:a,larger:s}=e;return t(Od,{"number | BigNumber, number | BigNumber":function(e,t){if(!(a(e)&&i(e)&&a(t)&&i(t)))throw new TypeError("Positive integer value expected in function composition");if(s(t,e))throw new TypeError("k must be less than or equal to n in function composition");return r(n(e,-1),n(t,-1))}})})),Id="leafCount",zd=he(Id,["parse","typed"],(e=>{let{parse:t,typed:n}=e;function r(e){let t=0;return e.forEach((e=>{t+=r(e)})),t||1}return n(Id,{Node:function(e){return r(e)}})}));function kd(e){return V(e)||K(e)&&e.isUnary()&&V(e.args[0])}function Rd(e){return!!V(e)||!(!Y(e)&&!K(e)||!e.args.every(Rd))||!(!ee(e)||!Rd(e.content))}const qd=he("simplifyUtil",["FunctionNode","OperatorNode","SymbolNode"],(e=>{let{FunctionNode:t,OperatorNode:n,SymbolNode:r}=e;const i=!0,o=!1,a="defaultF",s={add:{trivial:i,total:i,commutative:i,associative:i},unaryPlus:{trivial:i,total:i,commutative:i,associative:i},subtract:{trivial:o,total:i,commutative:o,associative:o},multiply:{trivial:i,total:i,commutative:i,associative:i},divide:{trivial:o,total:i,commutative:o,associative:o},paren:{trivial:i,total:i,commutative:i,associative:o},defaultF:{trivial:o,total:i,commutative:o,associative:o}};function u(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s,r=a;if("string"==typeof e?r=e:K(e)?r=e.fn.toString():Y(e)?r=e.name:ee(e)&&(r="paren"),me(n,r)){const e=n[r];if(me(e,t))return e[t];if(me(s,r))return s[r][t]}if(me(n,a)){const e=n[a];return me(e,t)?e[t]:s[a][t]}if(me(s,r)){const e=s[r];if(me(e,t))return e[t]}return s[a][t]}function c(e){return u(e,"associative",arguments.length>1&&void 0!==arguments[1]?arguments[1]:s)}function l(e,t){let n;const r=[],i=function(e){for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:s)},isAssociative:c,mergeContext:function(e,t){const n={...e};for(const r in t)me(e,r)?n[r]={...t[r],...e[r]}:n[r]=t[r];return n},flatten:function e(t,n){if(!t.args||0===t.args.length)return t;t.args=l(t,n);for(let r=0;r2&&c(t,n)){let e=t.args.pop();for(;t.args.length>0;)e=r([t.args.pop(),e]);t.args=e.args}},unflattenl:function e(t,n){if(!t.args||0===t.args.length)return;const r=f(t),i=t.args.length;for(let r=0;r2&&c(t,n)){let e=t.args.shift();for(;t.args.length>0;)e=r([e,t.args.shift()]);t.args=e.args}},defaultContext:s,realContext:{divide:{total:o},log:{total:o}},positiveContext:{subtract:{total:o},abs:{trivial:i},log:{total:i}}}})),Pd=he("simplify",["typed","parse","equal","resolve","simplifyConstant","simplifyCore","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode","replacer"],(e=>{let{typed:t,parse:n,equal:r,resolve:i,simplifyConstant:o,simplifyCore:a,AccessorNode:s,ArrayNode:u,ConstantNode:c,FunctionNode:l,IndexNode:f,ObjectNode:p,OperatorNode:d,ParenthesisNode:g,SymbolNode:y,replacer:x}=e;const{hasProperty:b,isCommutative:v,isAssociative:w,mergeContext:N,flatten:E,unflattenr:A,unflattenl:S,createMakeNodeFunction:M,defaultContext:C,realContext:T,positiveContext:B}=qd({FunctionNode:l,OperatorNode:d,SymbolNode:y});t.addConversion({from:"Object",to:"Map",convert:h});const D=t("simplify",{Node:k,"Node, Map":(e,t)=>k(e,!1,t),"Node, Map, Object":(e,t,n)=>k(e,!1,t,n),"Node, Array":k,"Node, Array, Map":k,"Node, Array, Map, Object":k});function F(e){return e.transform((function(e){return ee(e)?F(e.content):e}))}t.removeConversion({from:"Object",to:"Map",convert:h}),D.defaultContext=C,D.realContext=T,D.positiveContext=B;const O={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};function _(e,t){const r={};if(e.s){const t=e.s.split("->");if(2!==t.length)throw SyntaxError("Could not parse rule: "+e.s);r.l=t[0],r.r=t[1]}else r.l=e.l,r.r=e.r;r.l=F(n(r.l)),r.r=F(n(r.r));for(const t of["imposeContext","repeat","assuming"])t in e&&(r[t]=e[t]);if(e.evaluate&&(r.evaluate=n(e.evaluate)),w(r.l,t)){const e=!v(r.l,t);let n;e&&(n=z());const i=M(r.l),o=z();r.expanded={},r.expanded.l=i([r.l,o]),E(r.expanded.l,t),A(r.expanded.l,t),r.expanded.r=i([r.r,o]),e&&(r.expandedNC1={},r.expandedNC1.l=i([n,r.l]),r.expandedNC1.r=i([n,r.r]),r.expandedNC2={},r.expandedNC2.l=i([n,r.expanded.l]),r.expandedNC2.r=i([n,r.expanded.r]))}return r}D.rules=[a,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},o,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 + n3 * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},o,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];let I=0;function z(){return new y("_p"+I++)}function k(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:m(),r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=r.consoleDebug;t=function(e,t){const n=[];for(let r=0;r ${t[n].r.toString()}`)),o){const t=a.toString({parenthesis:"all"});t!==e&&(console.log("Applying",i,"produced",t),e=t)}S(a,r.context)}u=a.toString({parenthesis:"all"})}return a}function R(e,t,n){let r=e;if(e)for(let i=0;i=2&&2===e.args.length){const r=function(e,t){const n=[];let r,i;const o=M(e);if(v(e,t))for(let t=0;t1&&(a=o(e.args.slice(0,t))),i=e.args.slice(t),r=1===i.length?i[0]:o(i),n.push(o([a,r]))}return n}(t,n);let i=[];for(let t=0;t2)throw Error("Unexpected non-binary associative function: "+e.toString());return[]}{let r=[];for(let i=0;i2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");const i=U(e.args[0],t.args[1],n);if(0===i.length)return[];const o=U(e.args[1],t.args[0],n);if(0===o.length)return[];r=[i,o]}o=function(e){if(0===e.length)return e;const t=e.reduce(j),n=[],r={};for(let e=0;e="a"&&e.name[1]<="z"?e.name.substring(0,2):e.name[0]){case"n":case"_p":o[0].placeholders[e.name]=t;break;case"c":case"cl":if(!V(t))return[];o[0].placeholders[e.name]=t;break;case"v":if(V(t))return[];o[0].placeholders[e.name]=t;break;case"vl":if(!re(t))return[];o[0].placeholders[e.name]=t;break;case"cd":if(!kd(t))return[];o[0].placeholders[e.name]=t;break;case"vd":if(kd(t))return[];o[0].placeholders[e.name]=t;break;case"ce":if(!Rd(t))return[];o[0].placeholders[e.name]=t;break;case"ve":if(Rd(t))return[];o[0].placeholders[e.name]=t;break;default:throw new Error("Invalid symbol in rule: "+e.name)}}else{if(!(e instanceof c))return[];if(!r(e.value,t.value))return[]}return o}function L(e,t){if(e instanceof c&&t instanceof c){if(!r(e.value,t.value))return!1}else if(e instanceof y&&t instanceof y){if(e.name!==t.name)return!1}else{if(!(e instanceof d&&t instanceof d||e instanceof l&&t instanceof l))return!1;if(e instanceof d){if(e.op!==t.op||e.fn!==t.fn)return!1}else if(e instanceof l&&e.name!==t.name)return!1;if(e.args.length!==t.args.length)return!1;for(let n=0;n{let{typed:t,config:n,mathWithTransform:r,matrix:i,fraction:o,bignumber:a,AccessorNode:s,ArrayNode:u,ConstantNode:c,FunctionNode:l,IndexNode:f,ObjectNode:p,OperatorNode:m,SymbolNode:h}=e;const{isCommutative:d,isAssociative:g,allChildren:y,createMakeNodeFunction:x}=qd({FunctionNode:l,OperatorNode:m,SymbolNode:h}),v=t("simplifyConstant",{Node:e=>S(D(e,{})),"Node, Object":function(e,t){return S(D(e,t))}});function w(e){return b(e)?e.valueOf():e instanceof Array?e.map(w):E(e)?i(w(e.valueOf())):e}function N(e,t,n){try{return r[e].apply(null,t)}catch(i){return t=t.map(w),C(r[e].apply(null,t),n)}}const A=t({Fraction:function(e){const t=e=>"BigNumber"===n.number&&a?a(e):Number(e),r=e.s*e.n,i=r<0n?new m("-","unaryMinus",[new c(-t(r))]):new c(t(r));return 1n===e.d?i:new m("/","divide",[i,new c(t(e.d))])},number:function(e){return e<0?T(new c(-e)):new c(e)},BigNumber:function(e){return e<0?T(new c(-e)):new c(e)},bigint:function(e){return e<0n?T(new c(-e)):new c(e)},Complex:function(e){throw new Error("Cannot convert Complex number to Node")},string:function(e){return new c(e)},Matrix:function(e){return new u(e.valueOf().map((e=>A(e))))}});function S(e){return X(e)?e:A(e)}function M(e,t){if(t&&!1!==t.exactFractions&&isFinite(e)&&o){const n=o(e),r=t&&"number"==typeof t.fractionsLimit?t.fractionsLimit:1/0;if(n.valueOf()===e&&n.n{if(!X(i)){const n=t.pop();if(X(n))return[n,i];try{return t.push(N(e,[n,i],r)),t}catch(e){t.push(n)}}t.push(S(t.pop()));const o=1===t.length?t[0]:n(t);return[n([o,S(i)])]}),[i]);return 1===o.length?o[0]:n([o[0],A(o[1])])}function D(e,t){switch(e.type){case"SymbolNode":return e;case"ConstantNode":switch(typeof e.value){case"number":case"bigint":return C(e.value,t);case"string":return e.value;default:if(!isNaN(e.value))return C(e.value,t)}return e;case"FunctionNode":if(r[e.name]&&r[e.name].rawArgs)return e;if(!["add","multiply"].includes(e.name)){const n=e.args.map((e=>D(e,t)));if(!n.some(X))try{return N(e.name,n,t)}catch(e){}if("size"===e.name&&1===n.length&&L(n[0])){const e=[];let t=n[0];for(;L(t);)e.push(t.items.length),t=t.items[0];return i(e)}return new l(e.name,n.map(S))}case"OperatorNode":{const n=e.fn.toString();let r,i;const o=x(e);if(K(e)&&e.isUnary())r=[D(e.args[0],t)],i=X(r[0])?o(r):N(n,r,t);else if(g(e,t.context))if(r=y(e,t.context),r=r.map((e=>D(e,t))),d(n,t.context)){const e=[],a=[];for(let t=0;t1?(i=B(n,e,o,t),a.unshift(i),i=B(n,a,o,t)):i=B(n,r,o,t)}else i=B(n,r,o,t);else r=e.args.map((e=>D(e,t))),i=B(n,r,o,t);return i}case"ParenthesisNode":return D(e.content,t);case"AccessorNode":return function(e,t,n){if(!J(t))return new s(S(e),S(t));if(L(e)||E(e)){const r=Array.from(t.dimensions);for(;r.length>0;)if(V(r[0])&&"string"!=typeof r[0].value){const t=C(r.shift().value,n);L(e)?e=e.items[t-1]:(e=e.valueOf()[t-1])instanceof Array&&(e=i(e))}else{if(!(r.length>1&&V(r[1])&&"string"!=typeof r[1].value))break;{const t=C(r[1].value,n),o=[],a=L(e)?e.items:e.valueOf();for(const n of a)if(L(n))o.push(n.items[t-1]);else{if(!E(e))break;o.push(n[t-1])}if(o.length!==a.length)break;e=L(e)?new u(o):i(o),r.splice(1,1)}}return r.length===t.dimensions.length?new s(S(e),t):r.length>0?(t=new f(r),new s(S(e),t)):e}if(Q(e)&&1===t.dimensions.length&&V(t.dimensions[0])){const n=t.dimensions[0].value;return n in e.properties?e.properties[n]:new c}return new s(S(e),t)}(D(e.object,t),D(e.index,t),t);case"ArrayNode":{const n=e.items.map((e=>D(e,t)));return n.some(X)?new u(n.map(S)):i(n)}case"IndexNode":return new f(e.dimensions.map((e=>v(e,t))));case"ObjectNode":{const n={};for(const r in e.properties)n[r]=v(e.properties[r],t);return new p(n)}default:throw new Error(`Unimplemented node type in simplifyConstant: ${e.type}`)}}return v})),Ud="simplifyCore",Ld=he(Ud,["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],(e=>{let{typed:t,parse:n,equal:r,isZero:i,add:o,subtract:a,multiply:s,divide:u,pow:c,AccessorNode:l,ArrayNode:f,ConstantNode:p,FunctionNode:m,IndexNode:h,ObjectNode:d,OperatorNode:g,ParenthesisNode:y,SymbolNode:x}=e;const b=new p(0),v=new p(1),w=new p(!0),N=new p(!1);function E(e){return K(e)&&["and","not","or"].includes(e.op)}const{hasProperty:A,isCommutative:S}=qd({FunctionNode:m,OperatorNode:g,SymbolNode:x});function M(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=t?t.context:void 0;if(A(e,"trivial",n)){if(Y(e)&&1===e.args.length)return M(e.args[0],t);let n=!1,r=0;if(e.forEach((e=>{++r,1===r&&(n=M(e,t))})),1===r)return n}let o=e;if(Y(o)){const e=function(e){const t="OperatorNode:"+e;for(const e of jp)if(t in e)return e[t].op;return null}(o.name);if(!e)return new m(M(o.fn),o.args.map((e=>M(e,t))));if(o.args.length>2&&A(o,"associative",n))for(;o.args.length>2;){const t=o.args.pop(),n=o.args.pop();o.args.push(new g(e,o.name,[t,n]))}o=new g(e,o.name,o.args)}if(K(o)&&o.isUnary()){const e=M(o.args[0],t);if("~"===o.op&&K(e)&&e.isUnary()&&"~"===e.op)return e.args[0];if("not"===o.op&&K(e)&&e.isUnary()&&"not"===e.op&&E(e.args[0]))return e.args[0];let n=!0;if("-"===o.op&&K(e)&&(e.isBinary()&&"subtract"===e.fn&&(o=new g("-","subtract",[e.args[1],e.args[0]]),n=!1),e.isUnary()&&"-"===e.op))return e.args[0];if(n)return new g(o.op,o.fn,[e])}if(K(o)&&o.isBinary()){const e=M(o.args[0],t);let a=M(o.args[1],t);if("+"===o.op){if(V(e)&&i(e.value))return a;if(V(a)&&i(a.value))return e;K(a)&&a.isUnary()&&"-"===a.op&&(a=a.args[0],o=new g("-","subtract",[e,a]))}if("-"===o.op)return K(a)&&a.isUnary()&&"-"===a.op?M(new g("+","add",[e,a.args[0]]),t):V(e)&&i(e.value)?M(new g("-","unaryMinus",[a])):V(a)&&i(a.value)?e:new g(o.op,o.fn,[e,a]);if("*"===o.op){if(V(e)){if(i(e.value))return b;if(r(e.value,1))return a}if(V(a)){if(i(a.value))return b;if(r(a.value,1))return e;if(S(o,n))return new g(o.op,o.fn,[a,e],o.implicit)}return new g(o.op,o.fn,[e,a],o.implicit)}if("/"===o.op)return V(e)&&i(e.value)?b:V(a)&&r(a.value,1)?e:new g(o.op,o.fn,[e,a]);if("^"===o.op&&V(a)){if(i(a.value))return v;if(r(a.value,1))return e}if("and"===o.op){if(V(e)){if(!e.value)return N;if(E(a))return a;if(V(a))return a.value?w:N}if(V(a)){if(!a.value)return N;if(E(e))return e}}if("or"===o.op){if(V(e)){if(e.value)return w;if(E(a))return a}if(V(a)){if(a.value)return w;if(E(e))return e}}return new g(o.op,o.fn,[e,a])}if(K(o))return new g(o.op,o.fn,o.args.map((e=>M(e,t))));if(L(o))return new f(o.items.map((e=>M(e,t))));if(U(o))return new l(M(o.object,t),M(o.index,t));if(J(o))return new h(o.dimensions.map((e=>M(e,t))));if(Q(o)){const e={};for(const n in o.properties)e[n]=M(o.properties[n],t);return new d(e)}return o}return t(Ud,{Node:M,"Node,Object":M})})),$d=he("resolve",["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],(e=>{let{typed:t,parse:n,ConstantNode:r,FunctionNode:i,OperatorNode:o,ParenthesisNode:a}=e;function s(e,t){let u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;if(!t)return e;if(re(e)){if(u.has(e.name)){const e=Array.from(u).join(", ");throw new ReferenceError(`recursive loop of variable definitions among {${e}}`)}const i=t.get(e.name);if(X(i)){const n=new Set(u);return n.add(e.name),s(i,t,n)}return"number"==typeof i?n(String(i)):void 0!==i?new r(i):e}if(K(e)){const n=e.args.map((function(e){return s(e,t,u)}));return new o(e.op,e.fn,n,e.implicit)}if(ee(e))return new a(s(e.content,t,u));if(Y(e)){const n=e.args.map((function(e){return s(e,t,u)}));return new i(e.name,n)}return e.map((e=>s(e,t,u)))}return t("resolve",{Node:s,"Node, Map | null | undefined":s,"Node, Object":(e,t)=>s(e,h(t)),"Array | Matrix":t.referToSelf((e=>t=>t.map((t=>e(t))))),"Array | Matrix, null | undefined":t.referToSelf((e=>t=>t.map((t=>e(t))))),"Array, Object":t.referTo("Array,Map",(e=>(t,n)=>e(t,h(n)))),"Matrix, Object":t.referTo("Matrix,Map",(e=>(t,n)=>e(t,h(n)))),"Array | Matrix, Map":t.referToSelf((e=>(t,n)=>t.map((t=>e(t,n)))))})})),Hd="symbolicEqual",Gd=he(Hd,["parse","simplify","typed","OperatorNode"],(e=>{let{parse:t,simplify:n,typed:r,OperatorNode:i}=e;function o(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new i("-","subtract",[e,t]),a=n(o,{},r);return V(a)&&!a.value}return r(Hd,{"Node, Node":o,"Node, Node, Object":o})})),Vd="derivative",Zd=he(Vd,["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],(e=>{let{typed:t,config:n,parse:r,simplify:i,equal:o,isZero:a,numeric:s,ConstantNode:u,FunctionNode:c,OperatorNode:l,ParenthesisNode:f,SymbolNode:p}=e;function m(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{simplify:!0};const r=new Map,o=t.name,a=x(e,(function e(t){const n=r.get(t);if(void 0!==n)return n;const i=y(e,t,o);return r.set(t,i),i}));return n.simplify?i(a):a}function h(e){const t=r(e);if(!t.isSymbolNode)throw new TypeError(`Invalid variable. Cannot parse ${JSON.stringify(e)} into a variable in function derivative`);return t}const d=t(Vd,{"Node, SymbolNode":m,"Node, SymbolNode, Object":m,"Node, string":(e,t)=>m(e,h(t)),"Node, string, Object":(e,t,n)=>m(e,h(t),n)});d._simplify=!0,d.toTex=function(e){return g.apply(null,e.args)};const g=t("_derivTex",{"Node, SymbolNode":function(e,t){return V(e)&&"string"===oe(e.value)?g(r(e.value).toString(),t.toString(),1):g(e.toTex(),t.toString(),1)},"Node, ConstantNode":function(e,t){if("string"===oe(t.value))return g(e,r(t.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(e,t,n){return g(e.toString(),t.name,n.value)},"string, string, number":function(e,t,n){let r;return r=1===n?"{d\\over d"+t+"}":"{d^{"+n+"}\\over d"+t+"^{"+n+"}}",r+`\\left[${e}\\right]`}}),y=t("_isConst",{"function, ConstantNode, string":function(){return!0},"function, SymbolNode, string":function(e,t,n){return t.name!==n},"function, ParenthesisNode, string":function(e,t,n){return e(t.content,n)},"function, FunctionAssignmentNode, string":function(e,t,n){return!t.params.includes(n)||e(t.expr,n)},"function, FunctionNode | OperatorNode, string":function(e,t,n){return t.args.every((t=>e(t,n)))}}),x=t("_derivative",{"ConstantNode, function":function(){return b(0)},"SymbolNode, function":function(e,t){return t(e)?b(0):b(1)},"ParenthesisNode, function":function(e,t){return new f(x(e.content,t))},"FunctionAssignmentNode, function":function(e,t){return t(e)?b(0):x(e.expr,t)},"FunctionNode, function":function(e,t){if(t(e))return b(0);const n=e.args[0];let r,i,o,a,s=!1,u=!1;switch(e.name){case"cbrt":s=!0,i=new l("*","multiply",[b(3),new l("^","pow",[n,new l("/","divide",[b(2),b(3)])])]);break;case"sqrt":case"nthRoot":if(1===e.args.length)s=!0,i=new l("*","multiply",[b(2),new c("sqrt",[n])]);else if(2===e.args.length)return r=new l("/","divide",[b(1),e.args[1]]),x(new l("^","pow",[n,r]),t);break;case"log10":r=b(10);case"log":if(r||1!==e.args.length){if(1===e.args.length&&r||2===e.args.length&&t(e.args[1]))i=new l("*","multiply",[n.clone(),new c("log",[r||e.args[1]])]),s=!0;else if(2===e.args.length)return x(new l("/","divide",[new c("log",[n]),new c("log",[e.args[1]])]),t)}else i=n.clone(),s=!0;break;case"pow":if(2===e.args.length)return x(new l("^","pow",[n,e.args[1]]),t);break;case"exp":i=new c("exp",[n.clone()]);break;case"sin":i=new c("cos",[n.clone()]);break;case"cos":i=new l("-","unaryMinus",[new c("sin",[n.clone()])]);break;case"tan":i=new l("^","pow",[new c("sec",[n.clone()]),b(2)]);break;case"sec":i=new l("*","multiply",[e,new c("tan",[n.clone()])]);break;case"csc":u=!0,i=new l("*","multiply",[e,new c("cot",[n.clone()])]);break;case"cot":u=!0,i=new l("^","pow",[new c("csc",[n.clone()]),b(2)]);break;case"asin":s=!0,i=new c("sqrt",[new l("-","subtract",[b(1),new l("^","pow",[n.clone(),b(2)])])]);break;case"acos":s=!0,u=!0,i=new c("sqrt",[new l("-","subtract",[b(1),new l("^","pow",[n.clone(),b(2)])])]);break;case"atan":s=!0,i=new l("+","add",[new l("^","pow",[n.clone(),b(2)]),b(1)]);break;case"asec":s=!0,i=new l("*","multiply",[new c("abs",[n.clone()]),new c("sqrt",[new l("-","subtract",[new l("^","pow",[n.clone(),b(2)]),b(1)])])]);break;case"acsc":s=!0,u=!0,i=new l("*","multiply",[new c("abs",[n.clone()]),new c("sqrt",[new l("-","subtract",[new l("^","pow",[n.clone(),b(2)]),b(1)])])]);break;case"acot":s=!0,u=!0,i=new l("+","add",[new l("^","pow",[n.clone(),b(2)]),b(1)]);break;case"sinh":i=new c("cosh",[n.clone()]);break;case"cosh":i=new c("sinh",[n.clone()]);break;case"tanh":i=new l("^","pow",[new c("sech",[n.clone()]),b(2)]);break;case"sech":u=!0,i=new l("*","multiply",[e,new c("tanh",[n.clone()])]);break;case"csch":u=!0,i=new l("*","multiply",[e,new c("coth",[n.clone()])]);break;case"coth":u=!0,i=new l("^","pow",[new c("csch",[n.clone()]),b(2)]);break;case"asinh":s=!0,i=new c("sqrt",[new l("+","add",[new l("^","pow",[n.clone(),b(2)]),b(1)])]);break;case"acosh":s=!0,i=new c("sqrt",[new l("-","subtract",[new l("^","pow",[n.clone(),b(2)]),b(1)])]);break;case"atanh":s=!0,i=new l("-","subtract",[b(1),new l("^","pow",[n.clone(),b(2)])]);break;case"asech":s=!0,u=!0,i=new l("*","multiply",[n.clone(),new c("sqrt",[new l("-","subtract",[b(1),new l("^","pow",[n.clone(),b(2)])])])]);break;case"acsch":s=!0,u=!0,i=new l("*","multiply",[new c("abs",[n.clone()]),new c("sqrt",[new l("+","add",[new l("^","pow",[n.clone(),b(2)]),b(1)])])]);break;case"acoth":s=!0,u=!0,i=new l("-","subtract",[b(1),new l("^","pow",[n.clone(),b(2)])]);break;case"abs":i=new l("/","divide",[new c(new p("abs"),[n.clone()]),n.clone()]);break;default:throw new Error('Cannot process function "'+e.name+'" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported')}s?(o="/",a="divide"):(o="*",a="multiply");let f=x(n,t);return u&&(f=new l("-","unaryMinus",[f])),new l(o,a,[f,i])},"OperatorNode, function":function(e,t){if(t(e))return b(0);if("+"===e.op)return new l(e.op,e.fn,e.args.map((function(e){return x(e,t)})));if("-"===e.op){if(e.isUnary())return new l(e.op,e.fn,[x(e.args[0],t)]);if(e.isBinary())return new l(e.op,e.fn,[x(e.args[0],t),x(e.args[1],t)])}if("*"===e.op){const n=e.args.filter((function(e){return t(e)}));if(n.length>0){const r=e.args.filter((function(e){return!t(e)})),i=1===r.length?r[0]:new l("*","multiply",r),o=n.concat(x(i,t));return new l("*","multiply",o)}return new l("+","add",e.args.map((function(n){return new l("*","multiply",e.args.map((function(e){return e===n?x(e,t):e.clone()})))})))}if("/"===e.op&&e.isBinary()){const n=e.args[0],r=e.args[1];return t(r)?new l("/","divide",[x(n,t),r]):t(n)?new l("*","multiply",[new l("-","unaryMinus",[n]),new l("/","divide",[x(r,t),new l("^","pow",[r.clone(),b(2)])])]):new l("/","divide",[new l("-","subtract",[new l("*","multiply",[x(n,t),r.clone()]),new l("*","multiply",[n.clone(),x(r,t)])]),new l("^","pow",[r.clone(),b(2)])])}if("^"===e.op&&e.isBinary()){const n=e.args[0],r=e.args[1];if(t(n))return V(n)&&(a(n.value)||o(n.value,1))?b(0):new l("*","multiply",[e,new l("*","multiply",[new c("log",[n.clone()]),x(r.clone(),t)])]);if(t(r)){if(V(r)){if(a(r.value))return b(0);if(o(r.value,1))return x(n,t)}const e=new l("^","pow",[n.clone(),new l("-","subtract",[r,b(1)])]);return new l("*","multiply",[r.clone(),new l("*","multiply",[x(n,t),e])])}return new l("*","multiply",[new l("^","pow",[n.clone(),r.clone()]),new l("+","add",[new l("*","multiply",[x(n,t),new l("/","divide",[r.clone(),n.clone()])]),new l("*","multiply",[x(r,t),new c("log",[n.clone()])])])])}throw new Error('Cannot process operator "'+e.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function b(e,t){return new u(s(e,t||xe(String(e),n)))}return d})),Wd="rationalize",Yd=he(Wd,["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],(e=>{let{config:t,typed:n,equal:r,isZero:i,add:o,subtract:a,multiply:s,divide:u,pow:c,parse:l,simplifyConstant:f,simplifyCore:p,simplify:m,fraction:h,bignumber:d,mathWithTransform:g,matrix:y,AccessorNode:x,ArrayNode:b,ConstantNode:v,FunctionNode:w,IndexNode:N,ObjectNode:E,OperatorNode:A,SymbolNode:S,ParenthesisNode:M}=e;function C(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=function(){const e=[p,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},f,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}],t=[{l:"(-n1)/(-n2)",r:"n1/n2"},{l:"(-n1)*(-n2)",r:"n1*n2"},{l:"n1--n2",r:"n1+n2"},{l:"n1-n2",r:"n1+(-n2)"},{l:"(n1+n2)*n3",r:"(n1*n3 + n2*n3)"},{l:"n1*(n2+n3)",r:"(n1*n2+n1*n3)"},{l:"c1*n + c2*n",r:"(c1+c2)*n"},{l:"c1*n + n",r:"(c1+1)*n"},{l:"c1*n - c2*n",r:"(c1-c2)*n"},{l:"c1*n - n",r:"(c1-1)*n"},{l:"v/c",r:"(1/c)*v"},{l:"v/-c",r:"-(1/c)*v"},{l:"-v*-c",r:"c*v"},{l:"-v*c",r:"-c*v"},{l:"v*-c",r:"-c*v"},{l:"v*c",r:"c*v"},{l:"-(-n1*n2)",r:"(n1*n2)"},{l:"-(n1*n2)",r:"(-n1*n2)"},{l:"-(-n1+n2)",r:"(n1-n2)"},{l:"-(n1+n2)",r:"(-n1-n2)"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"},{l:"-(-n1/n2)",r:"(n1/n2)"},{l:"-(n1/n2)",r:"(-n1/n2)"}],n=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],r={};return r.firstRules=e.concat(t,n),r.distrDivRules=[{l:"(n1/n2 + n3/n4)",r:"((n1*n4 + n3*n2)/(n2*n4))"},{l:"(n1/n2 + n3)",r:"((n1 + n3*n2)/n2)"},{l:"(n1 + n2/n3)",r:"((n1*n3 + n2)/n3)"}],r.sucDivRules=n,r.firstRulesAgain=e.concat(t),r.finalRules=[p,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},f,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],r}(),i=function(e,t,n,r){const i=[],o=m(e,r,t,{exactFractions:!1}),a="+-*"+((n=!!n)?"/":"");!function e(t){const n=t.type;if("FunctionNode"===n)throw new Error("There is an unsolved function call");if("OperatorNode"===n)if("^"===t.op){if("ConstantNode"!==t.args[1].type||!ye(parseFloat(t.args[1].value)))throw new Error("There is a non-integer exponent");e(t.args[0])}else{if(!a.includes(t.op))throw new Error("Operator "+t.op+" invalid in polynomial expression");for(let n=0;n=1){let t,n;e=T(e);let i,o=!0,u=!1;for(e=m(e,r.firstRules,{},a);n=o?r.distrDivRules:r.sucDivRules,o=!o,i=(e=m(e,n,{},s)).toString(),i!==t;)u=!0,t=i;u&&(e=m(e,r.firstRulesAgain,{},a)),e=m(e,r.finalRules,{},a)}const u=[],c={};return"OperatorNode"===e.type&&e.isBinary()&&"/"===e.op?(1===o&&(e.args[0]=B(e.args[0],u),e.args[1]=B(e.args[1])),n&&(c.numerator=e.args[0],c.denominator=e.args[1])):(1===o&&(e=B(e,u)),n&&(c.numerator=e,c.denominator=null)),n?(c.coefficients=u,c.variables=i.variables,c.expression=e,c):e}return n(Wd,{Node:C,"Node, boolean":(e,t)=>C(e,{},t),"Node, Object":C,"Node, Object, boolean":C});function T(e,t,n){const r=e.type,i=arguments.length>1;if("OperatorNode"===r&&e.isBinary()){let r,o=!1;if("^"===e.op&&("ParenthesisNode"!==e.args[0].type&&"OperatorNode"!==e.args[0].type||"ConstantNode"!==e.args[1].type||(r=parseFloat(e.args[1].value),o=r>=2&&ye(r))),o){if(r>2){const t=e.args[0],n=new A("^","pow",[e.args[0].cloneDeep(),new v(r-1)]);e=new A("*","multiply",[t,n])}else e=new A("*","multiply",[e.args[0],e.args[0].cloneDeep()]);i&&("content"===n?t.content=e:t.args[n]=e)}}if("ParenthesisNode"===r)T(e.content,e,"content");else if("ConstantNode"!==r&&"SymbolNode"!==r)for(let t=0;tn&&(t[e]=0),t[e]+=a.cte*("+"===a.oper?1:-1),void(n=Math.max(e,n))}a.cte=e,""===a.fire&&(t[0]+=a.cte*("+"===a.oper?1:-1))}}}(e,null,{cte:1,oper:"+",fire:""}),n=t.length-1;let i,o=!0;for(let e=n;e>=0;e--){if(0===t[e])continue;let n=new v(o?t[e]:Math.abs(t[e]));const a=t[e]<0?"-":"+";if(e>0){let i=new S(r);if(e>1){const t=new v(e);i=new A("^","pow",[i,t])}n=-1===t[e]&&o?new A("-","unaryMinus",[i]):1===Math.abs(t[e])?i:new A("*","multiply",[n,i])}i=o?n:"+"===a?new A("+","add",[i,n]):new A("-","subtract",[i,n]),o=!1}return o?new v(0):i}})),Jd="zpk2tf",Xd=he(Jd,["typed","add","multiply","Complex","number"],(e=>{let{typed:t,add:n,multiply:r,Complex:i,number:o}=e;return t(Jd,{"Array,Array,number":function(e,t,n){return a(e,t,n)},"Array,Array":function(e,t){return a(e,t,1)},"Matrix,Matrix,number":function(e,t,n){return a(e.valueOf(),t.valueOf(),n)},"Matrix,Matrix":function(e,t){return a(e.valueOf(),t.valueOf(),1)}});function a(e,t,n){e.some((e=>"BigNumber"===e.type))&&(e=e.map((e=>o(e)))),t.some((e=>"BigNumber"===e.type))&&(t=t.map((e=>o(e))));let a=[i(1,0)],u=[i(1,0)];for(let t=0;t=0&&a-i{let{typed:t,add:n,multiply:r,Complex:i,divide:o,matrix:a}=e;return t(Qd,{"Array, Array":function(e,t){return s(e,t,u(512))},"Array, Array, Array":function(e,t,n){return s(e,t,n)},"Array, Array, number":function(e,t,n){if(n<0)throw new Error("w must be a positive number");return s(e,t,u(n))},"Matrix, Matrix":function(e,t){const n=u(512),{w:r,h:i}=s(e.valueOf(),t.valueOf(),n);return{w:a(r),h:a(i)}},"Matrix, Matrix, Matrix":function(e,t,n){const{h:r}=s(e.valueOf(),t.valueOf(),n.valueOf());return{h:a(r),w:a(n)}},"Matrix, Matrix, number":function(e,t,n){if(n<0)throw new Error("w must be a positive number");const r=u(n),{h:i}=s(e.valueOf(),t.valueOf(),r);return{h:a(i),w:a(r)}}});function s(e,t,a){const s=[],u=[];for(let o=0;o{let{classes:t}=e;return function(e,n){const r=t[n&&n.mathjs];return r&&"function"==typeof r.fromJSON?r.fromJSON(n):n}})),tg=he("replacer",[],(()=>function(e,t){return"number"!=typeof t||isFinite(t)&&!isNaN(t)?"bigint"==typeof t?{mathjs:"bigint",value:String(t)}:t:{mathjs:"number",value:String(t)}})),ng=Math.PI,rg=2*Math.PI,ig=Math.E,og=he("true",[],(()=>!0)),ag=he("false",[],(()=>!1)),sg=he("null",[],(()=>null)),ug=Ag("Infinity",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(1/0):1/0})),cg=Ag("NaN",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(NaN):NaN})),lg=Ag("pi",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?Pl(n):ng})),fg=Ag("tau",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?jl(n):rg})),pg=Ag("e",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?Rl(n):ig})),mg=Ag("phi",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?ql(n):1.618033988749895})),hg=Ag("LN2",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(2).ln():Math.LN2})),dg=Ag("LN10",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(10).ln():Math.LN10})),gg=Ag("LOG2E",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(1).div(new n(2).ln()):Math.LOG2E})),yg=Ag("LOG10E",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(1).div(new n(10).ln()):Math.LOG10E})),xg=Ag("SQRT1_2",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n("0.5").sqrt():Math.SQRT1_2})),bg=Ag("SQRT2",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(2).sqrt():Math.SQRT2})),vg=Ag("i",["Complex"],(e=>{let{Complex:t}=e;return t.I})),wg=he("PI",["pi"],(e=>{let{pi:t}=e;return t})),Ng=he("E",["e"],(e=>{let{e:t}=e;return t})),Eg=he("version",[],(()=>"14.5.2"));function Ag(e,t,n){return he(e,t,n,{recreateOnConfigChange:!0})}const Sg=Ny("speedOfLight","299792458","m s^-1"),Mg=Ny("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),Cg=Ny("planckConstant","6.62607015e-34","J s"),Tg=Ny("reducedPlanckConstant","1.0545718176461565e-34","J s"),Bg=Ny("magneticConstant","1.25663706212e-6","N A^-2"),Dg=Ny("electricConstant","8.8541878128e-12","F m^-1"),Fg=Ny("vacuumImpedance","376.730313667","ohm"),Og=Ny("coulomb","8.987551792261171e9","N m^2 C^-2"),_g=Ny("coulombConstant","8.987551792261171e9","N m^2 C^-2"),Ig=Ny("elementaryCharge","1.602176634e-19","C"),zg=Ny("bohrMagneton","9.2740100783e-24","J T^-1"),kg=Ny("conductanceQuantum","7.748091729863649e-5","S"),Rg=Ny("inverseConductanceQuantum","12906.403729652257","ohm"),qg=Ny("magneticFluxQuantum","2.0678338484619295e-15","Wb"),Pg=Ny("nuclearMagneton","5.0507837461e-27","J T^-1"),jg=Ny("klitzing","25812.807459304513","ohm"),Ug=Ny("bohrRadius","5.29177210903e-11","m"),Lg=Ny("classicalElectronRadius","2.8179403262e-15","m"),$g=Ny("electronMass","9.1093837015e-31","kg"),Hg=Ny("fermiCoupling","1.1663787e-5","GeV^-2"),Gg=Ey("fineStructure",.0072973525693),Vg=Ny("hartreeEnergy","4.3597447222071e-18","J"),Zg=Ny("protonMass","1.67262192369e-27","kg"),Wg=Ny("deuteronMass","3.3435830926e-27","kg"),Yg=Ny("neutronMass","1.6749271613e-27","kg"),Jg=Ny("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),Xg=Ny("rydberg","10973731.568160","m^-1"),Qg=Ny("thomsonCrossSection","6.6524587321e-29","m^2"),Kg=Ey("weakMixingAngle",.2229),ey=Ey("efimovFactor",22.7),ty=Ny("atomicMass","1.66053906660e-27","kg"),ny=Ny("avogadro","6.02214076e23","mol^-1"),ry=Ny("boltzmann","1.380649e-23","J K^-1"),iy=Ny("faraday","96485.33212331001","C mol^-1"),oy=Ny("firstRadiation","3.7417718521927573e-16","W m^2"),ay=Ny("loschmidt","2.686780111798444e25","m^-3"),sy=Ny("gasConstant","8.31446261815324","J K^-1 mol^-1"),uy=Ny("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),cy=Ny("molarVolume","0.022413969545014137","m^3 mol^-1"),ly=Ey("sackurTetrode",-1.16487052358),fy=Ny("secondRadiation","0.014387768775039337","m K"),py=Ny("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),my=Ny("wienDisplacement","2.897771955e-3","m K"),hy=Ny("molarMass","0.99999999965e-3","kg mol^-1"),dy=Ny("molarMassC12","11.9999999958e-3","kg mol^-1"),gy=Ny("gravity","9.80665","m s^-2"),yy=Ny("planckLength","1.616255e-35","m"),xy=Ny("planckMass","2.176435e-8","kg"),by=Ny("planckTime","5.391245e-44","s"),vy=Ny("planckCharge","1.87554603778e-18","C"),wy=Ny("planckTemperature","1.416785e+32","K");function Ny(e,t,n){return he(e,["config","Unit","BigNumber"],(e=>{let{config:r,Unit:i,BigNumber:o}=e;const a=new i("BigNumber"===r.number?new o(t):parseFloat(t),n);return a.fixPrefix=!0,a}))}function Ey(e,t){return he(e,["config","BigNumber"],(e=>{let{config:n,BigNumber:r}=e;return"BigNumber"===n.number?new r(t):t}))}const Ay=he("mapSlices",["typed","isInteger"],(e=>{let{typed:t,isInteger:n}=e;const r=Do({typed:t,isInteger:n});return t("mapSlices",{"...any":function(e){const t=e[1];d(t)?e[1]=t-1:g(t)&&(e[1]=t.minus(1));try{return r.apply(null,e)}catch(e){throw Ip(e)}}})}),{isTransformFunction:!0,...Do.meta}),Sy=he("column",["typed","Index","matrix","range"],(e=>{let{typed:t,Index:n,matrix:r,range:i}=e;const o=ks({typed:t,Index:n,matrix:r,range:i});return t("column",{"...any":function(e){const t=e.length-1,n=e[t];d(n)&&(e[t]=n-1);try{return o.apply(null,e)}catch(e){throw Ip(e)}}})}),{isTransformFunction:!0});function My(e,t,n){const r=e.filter((function(e){return re(e)&&!(e.name in t)&&!n.has(e.name)}))[0];if(!r)throw new Error('No undefined variable found in inline expression "'+e+'"');const i=r.name,o=new Map,a=new f(n,o,new Set([i])),s=e.compile();return function(e){return o.set(i,e),s.evaluate(a)}}n(3921);const Cy=he("transformCallback",["typed"],(e=>{let{typed:t}=e;return function(e,r){return t.isTypedFunction(e)?n(e,r):Ty(e,e.length,r)};function n(e,r){const i=Object.fromEntries(Object.entries(e.signatures).map((e=>{let[i,o]=e;const a=i.split(",").length;return t.isTypedFunction(o)?[i,n(o,r)]:[i,Ty(o,a,r)]})));return"string"==typeof e.name?t(e.name,i):t(i)}}));function Ty(e,t,n){return t===n?e:t===n+1?function(){for(var t=arguments.length,r=new Array(t),i=0;in+1?function(){for(var t=arguments.length,r=new Array(t),i=0;ie+1))}const Dy=he("filter",["typed"],(e=>{let{typed:t}=e;function n(e,n,i){const o=$s({typed:t}),a=Cy({typed:t});if(0===e.length)return o();let s=e[0];if(1===e.length)return o(s);const u=e.length-1;let c=e[u];return s&&(s=r(s,i)),c&&(c=re(c)||W(c)?r(c,i):My(c,n,i)),o(s,a(c,u))}function r(e,t){return e.compile().evaluate(t)}return n.rawArgs=!0,n}),{isTransformFunction:!0}),Fy=he("forEach",["typed"],(e=>{let{typed:t}=e;const n=Ws({typed:t}),r=Cy({typed:t});function i(e,t,i){if(0===e.length)return n();let a=e[0];if(1===e.length)return n(a);const s=e.length-1;let u=e[s];return a&&(a=o(a,i)),u&&(u=re(u)||W(u)?o(u,i):My(u,t,i)),n(a,r(u,s))}function o(e,t){return e.compile().evaluate(t)}return i.rawArgs=!0,i}),{isTransformFunction:!0}),Oy=he("index",["Index","getMatrixDataType"],(e=>{let{Index:t,getMatrixDataType:n}=e;return function(){const e=[];for(let t=0,r=arguments.length;t0?0:2;else if(r&&!0===r.isSet)r=r.map((function(e){return e-1}));else if(N(r)||E(r))"boolean"!==n(r)&&(r=r.map((function(e){return e-1})));else if(d(r)||y(r))r--;else if(g(r))r=r.toNumber()-1;else if("string"!=typeof r)throw new TypeError("Dimension must be an Array, Matrix, number, bigint, string, or Range");e[t]=r}const r=new t;return t.apply(r,e),r}}),{isTransformFunction:!0}),_y=he("map",["typed"],(e=>{let{typed:t}=e;const n=ru({typed:t}),r=Cy({typed:t});function i(e,t,i){if(0===e.length)return n();if(1===e.length)return n(e[0]);const o=e.length-1;let a=e.slice(0,o),s=e[o];return a=a.map((e=>u(e,i))),s&&(s=re(s)||W(s)?u(s,i):My(s,t,i)),n(...a,r(s,o));function u(e,t){return e.compile().evaluate(t)}}return i.rawArgs=!0,i}),{isTransformFunction:!0});function Iy(e){if(2===e.length&&A(e[0])){const n=(e=e.slice())[1];(d(t=n)||g(t))&&(e[1]=function(e){return d(e)?e-1:g(e)?e.minus(1):e}(n))}var t;return e}const zy=he("max",["typed","config","numeric","larger","isNaN"],(e=>{let{typed:t,config:n,numeric:r,larger:i,isNaN:o}=e;const a=Tl({typed:t,config:n,numeric:r,larger:i,isNaN:o});return t("max",{"...any":function(e){e=Iy(e);try{return a.apply(null,e)}catch(e){throw Ip(e)}}})}),{isTransformFunction:!0}),ky=he("mean",["typed","add","divide"],(e=>{let{typed:t,add:n,divide:r}=e;const i=Fh({typed:t,add:n,divide:r});return t("mean",{"...any":function(e){e=Iy(e);try{return i.apply(null,e)}catch(e){throw Ip(e)}}})}),{isTransformFunction:!0}),Ry=he("min",["typed","config","numeric","smaller","isNaN"],(e=>{let{typed:t,config:n,numeric:r,smaller:i,isNaN:o}=e;const a=Bl({typed:t,config:n,numeric:r,smaller:i,isNaN:o});return t("min",{"...any":function(e){e=Iy(e);try{return a.apply(null,e)}catch(e){throw Ip(e)}}})}),{isTransformFunction:!0}),qy=he("range",["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],(e=>{let{typed:t,config:n,matrix:r,bignumber:i,smaller:o,smallerEq:a,larger:s,largerEq:u,add:c,isPositive:l}=e;const f=fu({typed:t,config:n,matrix:r,bignumber:i,smaller:o,smallerEq:a,larger:s,largerEq:u,add:c,isPositive:l});return t("range",{"...any":function(e){return"boolean"!=typeof e[e.length-1]&&e.push(!0),f.apply(null,e)}})}),{isTransformFunction:!0}),Py=he("row",["typed","Index","matrix","range"],(e=>{let{typed:t,Index:n,matrix:r,range:i}=e;const o=bu({typed:t,Index:n,matrix:r,range:i});return t("row",{"...any":function(e){const t=e.length-1,n=e[t];d(n)&&(e[t]=n-1);try{return o.apply(null,e)}catch(e){throw Ip(e)}}})}),{isTransformFunction:!0}),jy=he("subset",["typed","matrix","zeros","add"],(e=>{let{typed:t,matrix:n,zeros:r,add:i}=e;const o=Su({typed:t,matrix:n,zeros:r,add:i});return t("subset",{"...any":function(e){try{return o.apply(null,e)}catch(e){throw Ip(e)}}})}),{isTransformFunction:!0}),Uy=he("concat",["typed","matrix","isInteger"],(e=>{let{typed:t,matrix:n,isInteger:r}=e;const i=Is({typed:t,matrix:n,isInteger:r});return t("concat",{"...any":function(e){const t=e.length-1,n=e[t];d(n)?e[t]=n-1:g(n)&&(e[t]=n.minus(1));try{return i.apply(null,e)}catch(e){throw Ip(e)}}})}),{isTransformFunction:!0}),Ly="diff",$y=he(Ly,["typed","matrix","subtract","number","bignumber"],(e=>{let{typed:t,matrix:n,subtract:r,number:i,bignumber:o}=e;const a=ou({typed:t,matrix:n,subtract:r,number:i,bignumber:o});return t(Ly,{"...any":function(e){e=Iy(e);try{return a.apply(null,e)}catch(e){throw Ip(e)}}})}),{isTransformFunction:!0}),Hy=he("std",["typed","map","sqrt","variance"],(e=>{let{typed:t,map:n,sqrt:r,variance:i}=e;const o=jh({typed:t,map:n,sqrt:r,variance:i});return t("std",{"...any":function(e){e=Iy(e);try{return o.apply(null,e)}catch(e){throw Ip(e)}}})}),{isTransformFunction:!0}),Gy=he("sum",["typed","config","add","numeric"],(e=>{let{typed:t,config:n,add:r,numeric:i}=e;const o=Ch({typed:t,config:n,add:r,numeric:i});return t("sum",{"...any":function(e){e=Iy(e);try{return o.apply(null,e)}catch(e){throw Ip(e)}}})}),{isTransformFunction:!0}),Vy=he("quantileSeq",["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger","mapSlices"],(e=>{let{typed:t,bignumber:n,add:r,subtract:i,divide:o,multiply:a,partitionSelect:s,compare:u,isInteger:c,smaller:l,smallerEq:f,larger:p,mapSlices:m}=e;const h=Ph({typed:t,bignumber:n,add:r,subtract:i,divide:o,multiply:a,partitionSelect:s,compare:u,isInteger:c,smaller:l,smallerEq:f,larger:p,mapSlices:m});return t("quantileSeq",{"Array | Matrix, number | BigNumber":h,"Array | Matrix, number | BigNumber, number":(e,t,n)=>h(e,t,d(n)),"Array | Matrix, number | BigNumber, boolean":h,"Array | Matrix, number | BigNumber, boolean, number":(e,t,n,r)=>h(e,t,n,d(r)),"Array | Matrix, Array | Matrix":h,"Array | Matrix, Array | Matrix, number":(e,t,n)=>h(e,t,d(n)),"Array | Matrix, Array | Matrix, boolean":h,"Array | Matrix, Array | Matrix, boolean, number":(e,t,n,r)=>h(e,t,n,d(r))});function d(e){return Iy([[],e])[1]}}),{isTransformFunction:!0}),Zy="cumsum",Wy=he(Zy,["typed","add","unaryPlus"],(e=>{let{typed:t,add:n,unaryPlus:r}=e;const i=Bh({typed:t,add:n,unaryPlus:r});return t(Zy,{"...any":function(e){if(2===e.length&&A(e[0])){const t=e[1];d(t)?e[1]=t-1:g(t)&&(e[1]=t.minus(1))}try{return i.apply(null,e)}catch(e){throw Ip(e)}}})}),{isTransformFunction:!0}),Yy="variance",Jy=he(Yy,["typed","add","subtract","multiply","divide","mapSlices","isNaN"],(e=>{let{typed:t,add:n,subtract:r,multiply:i,divide:o,mapSlices:a,isNaN:s}=e;const u=Rh({typed:t,add:n,subtract:r,multiply:i,divide:o,mapSlices:a,isNaN:s});return t(Yy,{"...any":function(e){e=Iy(e);try{return u.apply(null,e)}catch(e){throw Ip(e)}}})}),{isTransformFunction:!0}),Xy="print",Qy=he(Xy,["typed","matrix","zeros","add"],(e=>{let{typed:t,matrix:n,zeros:r,add:i}=e;const o=ac({typed:t,matrix:n,zeros:r,add:i});return t(Xy,{"string, Object | Array":function(e,t){return o(a(e),t)},"string, Object | Array, number | Object":function(e,t,n){return o(a(e),t,n)}});function a(e){return e.replace(ic,(e=>"$"+e.slice(1).split(".").map((function(e){return!isNaN(e)&&e.length>0?parseInt(e)-1:e})).join(".")))}}),{isTransformFunction:!0}),Ky=he("and",["typed","matrix","zeros","add","equalScalar","not","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,zeros:i,not:o,concat:a}=e;const s=Vc({typed:t,matrix:n,equalScalar:r,zeros:i,not:o,concat:a});function u(e,t,n){const r=e[0].compile().evaluate(n);if(!A(r)&&!s(r,!0))return!1;const i=e[1].compile().evaluate(n);return s(r,i)}return u.rawArgs=!0,u}),{isTransformFunction:!0}),ex=he("or",["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o}=e;const a=Fs({typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o});function s(e,t,n){const r=e[0].compile().evaluate(n);if(!A(r)&&a(r,!1))return!0;const i=e[1].compile().evaluate(n);return a(r,i)}return s.rawArgs=!0,s}),{isTransformFunction:!0}),tx=he("bitAnd",["typed","matrix","zeros","add","equalScalar","not","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,zeros:i,not:o,concat:a}=e;const s=ps({typed:t,matrix:n,equalScalar:r,zeros:i,not:o,concat:a});function u(e,t,n){const r=e[0].compile().evaluate(n);if(!A(r)){if(isNaN(r))return NaN;if(0===r||!1===r)return 0}const i=e[1].compile().evaluate(n);return s(r,i)}return u.rawArgs=!0,u}),{isTransformFunction:!0}),nx=he("bitOr",["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o}=e;const a=gs({typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o});function s(e,t,n){const r=e[0].compile().evaluate(n);if(!A(r)){if(isNaN(r))return NaN;if(-1===r)return-1;if(!0===r)return 1}const i=e[1].compile().evaluate(n);return a(r,i)}return s.rawArgs=!0,s}),{isTransformFunction:!0});var rx=n(1504);const ix={relTol:1e-12,absTol:1e-15,matrix:"Matrix",number:"number",numberFallback:"number",precision:64,predictable:!1,randomSeed:null},ox=["Matrix","Array"],ax=["number","BigNumber","Fraction"];function sx(e,t){function n(r){if(r){if(void 0!==r.epsilon){console.warn('Warning: The configuration option "epsilon" is deprecated. Use "relTol" and "absTol" instead.');const e=ae(r);return e.relTol=r.epsilon,e.absTol=.001*r.epsilon,delete e.epsilon,n(e)}const i=ae(e);ux(r,"matrix",ox),ux(r,"number",ax),ue(e,r);const o=ae(e),a=ae(r);return t("config",o,i,a),o}return ae(e)}return n.MATRIX_OPTIONS=ox,n.NUMBER_OPTIONS=ax,Object.keys(ix).forEach((t=>{Object.defineProperty(n,t,{get:()=>e[t],enumerable:!0,configurable:!0})})),n}function ux(e,t,n){void 0===e[t]||n.includes(e[t])||console.warn('Warning: Unknown value "'+e[t]+'" for configuration option "'+t+'". Available options: '+n.map((e=>JSON.stringify(e))).join(", ")+".")}const cx=function e(n,r){const i=sr({},ix,r);if("function"!=typeof Object.create)throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");const o=function(e){const t=new rx;return e.on=t.on.bind(t),e.off=t.off.bind(t),e.once=t.once.bind(t),e.emit=t.emit.bind(t),e}({isNumber:d,isComplex:x,isBigNumber:g,isBigInt:y,isFraction:b,isUnit:v,isString:w,isArray:N,isMatrix:E,isCollection:A,isDenseMatrix:S,isSparseMatrix:M,isRange:C,isIndex:T,isBoolean:B,isResultSet:D,isHelp:F,isFunction:O,isDate:_,isRegExp:I,isObject:z,isMap:k,isPartitionedMap:R,isObjectWrappingMap:q,isNull:P,isUndefined:j,isAccessorNode:U,isArrayNode:L,isAssignmentNode:$,isBlockNode:H,isConditionalNode:G,isConstantNode:V,isFunctionAssignmentNode:W,isFunctionNode:Y,isIndexNode:J,isNode:X,isObjectNode:Q,isOperatorNode:K,isParenthesisNode:ee,isRangeNode:te,isRelationalNode:ne,isSymbolNode:re,isChain:ie});o.config=sx(i,o.emit),o.expression={transform:{},mathWithTransform:{config:o.config}};const a={};function s(){for(var e=arguments.length,t=new Array(e),n=0;n2&&void 0!==arguments[2]?arguments[2]:t.fn;if(u.includes("."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(u));const f=c(t)?n.expression.transform:n,p=u in n.expression.transform,m=me(f,u)?f[u]:void 0,h=function(){const r={};t.dependencies.map(ge).forEach((e=>{if(e.includes("."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(e));"math"===e?r.math=n:"mathWithTransform"===e?r.mathWithTransform=n.expression.mathWithTransform:"classes"===e?r.classes=n:r[e]=n[e]}));const o=t(r);if(o&&"function"==typeof o.transform)throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with export const path = "expression.transform"');if(void 0===m||i.override)return o;if(e.isTypedFunction(m)&&e.isTypedFunction(o))return e(m,o);if(i.silent)return m;throw new Error('Cannot import "'+u+'": already exists')},d=null!==(o=null===(s=t.meta)||void 0===s?void 0:s.formerly)&&void 0!==o?o:"",g=c(t)||function(e){return!(e.fn.includes(".")||me(l,e.fn)||e.meta&&e.meta.isClass)}(t),y=n.expression.mathWithTransform;t.meta&&!1===t.meta.lazy?(f[u]=h(),d&&(f[d]=f[u]),m&&p?(a(u),d&&a(d)):g&&(pe(y,u,(()=>f[u])),d&&pe(y,d,(()=>f[u])))):(pe(f,u,h),d&&pe(f,d,h),m&&p?(a(u),d&&a(d)):g&&(pe(y,u,(()=>f[u])),d&&pe(y,d,(()=>f[u])))),r[u]=t,n.emit("import",u,h)}function u(e){return!me(l,e)}function c(e){return void 0!==e&&void 0!==e.meta&&!0===e.meta.isTransformFunction||!1}const l={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(e,t){const n=arguments.length;if(1!==n&&2!==n)throw new ga("import",n,1,2);t||(t={});const r={};!function e(n,r,i){if(Array.isArray(r))r.forEach((t=>e(n,t)));else if(z(r)||"object"==typeof(o=r)&&"Module"===o[Symbol.toStringTag])for(const t in r)me(r,t)&&e(n,r[t],t);else if(de(r)||void 0!==i){const e=de(r)?c(r)?r.fn+".transform":r.fn:i;if(me(n,e)&&n[e]!==r&&!t.silent)throw new Error('Cannot import "'+e+'" twice');n[e]=r}else if(!t.silent)throw new TypeError("Factory, Object, or Array expected");var o}(r,e);for(const e in r)if(me(r,e)){const n=r[e];if(de(n))s(n,t);else if("function"==typeof(o=n)||"number"==typeof o||"string"==typeof o||"boolean"==typeof o||null===o||v(o)||x(o)||g(o)||b(o)||E(o)||Array.isArray(o))i(e,n,t);else if(!t.silent)throw new TypeError("Factory, Object, or Array expected")}var o}}(s,0,o,a);return o.import=u,o.on("config",(()=>{Object.values(a).forEach((e=>{e&&e.meta&&e.meta.recreateOnConfigChange&&u(e,{override:!0})}))})),o.create=e.bind(null,n),o.factory=he,o.import(Object.values(le(n))),o.ArgumentsError=ga,o.DimensionError=xr,o.IndexError=br,o}(e)})(),r.default})())); -//# sourceMappingURL=math.js.map \ No newline at end of file diff --git a/js/lib/math.js.LICENSE.txt b/js/lib/math.js.LICENSE.txt deleted file mode 100644 index 82cced006a..0000000000 --- a/js/lib/math.js.LICENSE.txt +++ /dev/null @@ -1,34 +0,0 @@ -/*! - * decimal.js v10.5.0 - * An arbitrary-precision Decimal type for JavaScript. - * https://github.com/MikeMcl/decimal.js - * Copyright (c) 2025 Michael Mclaughlin - * MIT Licence - */ - -/** - * math.js - * https://github.com/josdejong/mathjs - * - * Math.js is an extensive math library for JavaScript and Node.js, - * It features real and complex numbers, units, matrices, a large set of - * mathematical functions, and a flexible expression parser. - * - * @version 14.5.2 - * @date 2025-05-30 - * - * @license - * Copyright (C) 2013-2025 Jos de Jong - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ diff --git a/js/lib/math.js.map b/js/lib/math.js.map deleted file mode 100644 index a312d05967..0000000000 --- a/js/lib/math.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"math.js","mappings":";CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAc,KAAID,IAElBD,EAAW,KAAIC,GAChB,CATD,CASGK,MAAM,IACT,uCCTA,IAAIC,EAAa,EAAQ,MAEzBJ,EAAOD,QAAU,SAAUM,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M,MACNwZ,SAAU,aACVopC,OAAQ,CACN,oBACA,SACA,qBAEF5hB,YAAa,6HACbgiF,SAAU,CACR,kBACA,oBACA,oBACA,uBACA,uBACA,gCACA,iCAEFK,QAAS,CACP,OACA,SACA,MACA,OACA,MACA,MACA,alM2gBFoH,KmMpiBsB,CACtBzqH,KAAM,OACNwZ,SAAU,aACVopC,OAAQ,CACN,qBACA,UACA,sBAEF5hB,YAAa,mDACbgiF,SAAU,CACR,mBACA,qBACA,qBACA,wBACA,wBACA,8BAEFK,QAAS,CACP,MACA,SACA,MACA,OACA,MACA,MACA,anM6gBFqH,OoMriBwB,CACxB1qH,KAAM,SACNwZ,SAAU,aACVopC,OAAQ,CACN,uBACA,aAEF5hB,YAAa,mLACbgiF,SAAU,CACR,kBACA,yBAEFK,QAAS,CACP,MACA,OACA,MACA,OACA,MACA,MACA,WACA,gBpMkhBFzpG,IqMtiBqB,CACrB5Z,KAAM,MACNwZ,SAAU,aACVopC,OAAQ,CACN,oBACA,SACA,qBAEF5hB,YAAa,6HACbgiF,SAAU,CACR,kBACA,oBACA,oBACA,uBACA,uBACA,gCACA,iCAEFK,QAAS,CACP,MACA,OACA,SACA,OACA,MACA,MACA,arM8gBFjoF,KsMviBsB,CACtBp7B,KAAM,OACNwZ,SAAU,aACVopC,OAAQ,CACN,qBACA,UACA,4BAEF5hB,YAAa,2HACbgiF,SAAU,CACR,sBACA,8BACA,uBAEFK,QAAS,CACP,MACA,OACA,MACA,SACA,OACA,MACA,MACA,atMkhBFtqE,KuMxiBsB,CACtB/4C,KAAM,OACNwZ,SAAU,aACVopC,OAAQ,CACN,qBACA,WAEF5hB,YAAa,qCACbgiF,SAAU,CACR,gBACA,kBACA,sBAEFK,QAAS,CACP,MACA,OACA,MACA,SACA,MACA,MACA,MACA,avMohBFsH,YwMziB6B,CAC7B3qH,KAAM,cACNwZ,SAAU,aACVopC,OAAQ,CACN,iCACA,gDACA,+BAEF5hB,YAAa,uWACbgiF,SAAU,CACR,kCACA,yCACA,gCACA,yCAEFK,QAAS,CACP,OACA,SACA,MACA,MACA,OACA,MACA,MACA,axMmhBFuH,IyM1iBqB,CACrB5qH,KAAM,MACNwZ,SAAU,aACVopC,OAAQ,CACN,oBACA,SACA,oBACA,wBACA,oCAEF5hB,YAAa,iLACbgiF,SAAU,CACR,eACA,oBACA,mCACA,8BACA,2BAEFK,QAAS,CACP,MACA,OACA,MACA,SACA,OACA,MACA,azMkhBFjpE,I0M3iBqB,CACrBp6C,KAAM,MACNwZ,SAAU,aACVopC,OAAQ,CACN,oBACA,SACA,qBAEF5hB,YAAa,iCACbgiF,SAAU,CACR,kBACA,oBACA,qBAEFK,QAAS,CACP,MACA,OACA,SACA,MACA,OACA,MACA,a1MuhBFnV,S2M5iB0B,CAC1BluG,KAAM,WACNwZ,SAAU,aACVopC,OAAQ,CACN,yBACA,cACA,yBACA,6BACA,yCAEF5hB,YAAa,gIACbgiF,SAAU,CACR,oBACA,yBACA,wCACA,mCACA,gCAEFK,QAAS,CACP,MACA,OACA,MACA,SACA,MACA,OACA,MACA,Q3MmhBFwH,K4M7iBsB,CACtB7qH,KAAM,OACNwZ,SAAU,aACVopC,OAAQ,CACN,aAEF5hB,YAAa,iIACbgiF,SAAU,CACR,kCACA,wGAEFK,QAAS,CACP,MACA,OACA,MACA,SACA,MACA,OACA,MACA,Q5M6hBFpvE,K6MhjBsB,CACtBj0C,KAAM,OACNwZ,SAAU,eACVopC,OAAQ,CACN,WAEF5hB,YAAa,oDACbgiF,SAAU,CACR,YACA,kBAEFK,QAAS,CACP,MACA,OACA,S7MmiBFr3E,M8MjjBuB,CACvBhsC,KAAM,QACNwZ,SAAU,eACVopC,OAAQ,CACN,YAEF5hB,YAAa,6FACbgiF,SAAU,CACR,cAEFK,QAAS,CACP,OACA,QACA,U9MqiBF3mB,K+MljBsB,CACtB18F,KAAM,OACNwZ,SAAU,eACVopC,OAAQ,CACN,WAEF5hB,YAAa,8CACbgiF,SAAU,CACR,YACA,iBACA,WAEFK,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M,OAAOo3B,OAAOmlH,GAAmBlkI,SAAQrc,IACnCA,GAAWA,EAAQisC,MAAQjsC,EAAQisC,KAAKitG,wBAG1CuH,EAAezgJ,EAAS,CAAEmoB,UAAU,GACtC,GACA,IAKJwL,EAAK3c,OAASA,EAAO/M,KAAK,KAAMk2I,GAGhCxsH,EAAK3zB,QAAUA,GAIf2zB,EAAKk5F,OAAO7oH,OAAOo3B,OAAOmQ,GAAY40G,KAEtCxsH,EAAK4tC,eAAiBA,GACtB5tC,EAAKg0B,eAAiBA,GACtBh0B,EAAKm0B,WAAaA,GAEXn0B,CACT,CD3PA,CAAsBroB,kB50BOtB","sources":["webpack://math/webpack/universalModuleDefinition","webpack://math/./node_modules/core-js/internals/is-object.js","webpack://math/./node_modules/core-js/internals/get-iterator.js","webpack://math/./node_modules/core-js/modules/es.iterator.find.js","webpack://math/./node_modules/core-js/modules/es.promise.resolve.js","webpack://math/./node_modules/core-js/internals/make-built-in.js","webpack://math/./node_modules/core-js/internals/function-name.js","webpack://math/./node_modules/core-js/internals/html.js","webpack://math/./node_modules/core-js/internals/hidden-keys.js","webpack://math/./node_modules/core-js/modules/es.promise.constructor.js","webpack://math/./node_modules/core-js/internals/promise-statics-incorrect-iteration.js","webpack://math/./node_modules/core-js/internals/promise-native-constructor.js","webpack://math/./node_modules/core-js/internals/function-bind-native.js","webpack://math/./node_modules/core-js/internals/to-string.js","webpack://math/./node_modules/core-js/internals/an-instance.js","webpack://math/./node_modules/core-js/internals/set-to-string-tag.js","webpack://math/./node_modules/core-js/internals/math-trunc.js","webpack://math/./node_modules/core-js/internals/is-symbol.js","webpack://math/./node_modules/core-js/internals/is-regexp.js","webpack://math/./node_modules/core-js/internals/get-iterator-method.js","webpack://math/./node_modules/core-js/internals/promise-constructor-detection.js","webpack://math/./node_modules/core-js/internals/array-reduce.js","webpack://math/./node_modules/core-js/internals/regexp-get-flags.js","webpack://math/./node_modules/core-js/internals/proxy-accessor.js","webpack://math/./node_modules/core-js/internals/object-keys.js","webpack://math/./node_modules/core-js/internals/perform.js","webpack://math/./node_modules/core-js/modules/es.iterator.every.js","webpack://math/./node_modules/core-js/internals/internal-state.js","webpack://math/./node_modules/core-js/internals/to-integer-or-infinity.js","webpack://math/./node_modules/core-js/modules/esnext.iterator.map.js","webpack://math/./node_modules/core-js/modules/es.promise.reject.js","webpack://math/./node_modules/tiny-emitter/index.js","webpack://math/./node_modules/core-js/internals/object-is-prototype-of.js","webpack://math/./node_modules/core-js/modules/es.iterator.map.js","webpack://math/./node_modules/core-js/internals/get-iterator-direct.js","webpack://math/./node_modules/core-js/modules/esnext.iterator.to-array.js","webpack://math/./node_modules/core-js/modules/es.iterator.to-array.js","webpack://math/./node_modules/core-js/internals/object-keys-internal.js","webpack://math/./node_modules/javascript-natural-sort/naturalSort.js","webpack://math/./node_modules/core-js/internals/microtask.js","webpack://math/./node_modules/core-js/modules/es.promise.catch.js","webpack://math/./node_modules/core-js/internals/define-built-in-accessor.js","webpack://math/./node_modules/core-js/internals/to-string-tag-support.js","webpack://math/./node_modules/core-js/internals/classof-raw.js","webpack://math/./node_modules/core-js/internals/correct-prototype-getter.js","webpack://math/./node_modules/core-js/internals/species-constructor.js","webpack://math/./node_modules/core-js/internals/object-create.js","webpack://math/./node_modules/typed-function/lib/umd/typed-function.js","webpack://math/./node_modules/core-js/internals/get-substitution.js","webpack://math/./node_modules/core-js/modules/es.iterator.filter.js","webpack://math/./node_modules/core-js/internals/create-iter-result-object.js","webpack://math/./node_modules/core-js/modules/esnext.iterator.find.js","webpack://math/./node_modules/core-js/internals/iterate.js","webpack://math/./node_modules/core-js/modules/es.array.reduce.js","webpack://math/./node_modules/core-js/internals/to-primitive.js","webpack://math/./node_modules/core-js/internals/object-get-prototype-of.js","webpack://math/./node_modules/core-js/internals/is-forced.js","webpack://math/./node_modules/core-js/internals/validate-arguments-length.js","webpack://math/./node_modules/core-js/internals/environment-user-agent.js","webpack://math/./node_modules/core-js/internals/object-set-prototype-of.js","webpack://math/./node_modules/seedrandom/lib/xorwow.js","webpack://math/./node_modules/core-js/modules/es.json.stringify.js","webpack://math/./node_modules/core-js/internals/host-report-errors.js","webpack://math/./node_modules/escape-latex/dist/index.js","webpack://math/./node_modules/core-js/internals/inherit-if-required.js","webpack://math/./node_modules/seedrandom/lib/xor128.js","webpack://math/./node_modules/core-js/modules/esnext.iterator.every.js","webpack://math/./node_modules/core-js/modules/es.promise.js","webpack://math/./node_modules/core-js/internals/safe-get-built-in.js","webpack://math/./node_modules/core-js/internals/uid.js","webpack://math/./node_modules/core-js/internals/promise-resolve.js","webpack://math/./node_modules/core-js/internals/a-possible-prototype.js","webpack://math/./node_modules/core-js/internals/is-constructor.js","webpack://math/./node_modules/core-js/modules/es.iterator.some.js","webpack://math/./node_modules/core-js/internals/environment-webkit-version.js","webpack://math/./node_modules/core-js/internals/regexp-unsupported-dot-all.js","webpack://math/./node_modules/core-js/internals/inspect-source.js","webpack://math/./node_modules/core-js/internals/environment-ff-version.js","webpack://math/./node_modules/core-js/internals/object-get-own-property-symbols.js","webpack://math/./node_modules/core-js/internals/descriptors.js","webpack://math/./node_modules/core-js/internals/environment-is-ie-or-edge.js","webpack://math/./node_modules/core-js/modules/es.object.from-entries.js","webpack://math/./node_modules/core-js/internals/is-possible-prototype.js","webpack://math/./node_modules/core-js/modules/esnext.iterator.for-each.js","webpack://math/./node_modules/core-js/internals/document-create-element.js","webpack://math/./node_modules/core-js/internals/is-null-or-undefined.js","webpack://math/./node_modules/core-js/internals/is-array-iterator-method.js","webpack://math/./node_modules/core-js/internals/environment.js","webpack://math/./node_modules/core-js/internals/environment-is-ios-pebble.js","webpack://math/./node_modules/core-js/internals/ordinary-to-primitive.js","webpack://math/./node_modules/core-js/internals/is-array.js","webpack://math/./node_modules/core-js/modules/es.array.includes.js","webpack://math/./node_modules/core-js/internals/check-correctness-of-iteration.js","webpack://math/./node_modules/core-js/internals/array-sort.js","webpack://math/./node_modules/core-js/internals/symbol-constructor-detection.js","webpack://math/./node_modules/core-js/modules/esnext.iterator.filter.js","webpack://math/./node_modules/core-js/internals/iterator-helper-without-closing-on-early-error.js","webpack://math/./node_modules/core-js/internals/global-this.js","webpack://math/./node_modules/core-js/internals/array-method-is-strict.js","webpack://math/./node_modules/core-js/internals/delete-property-or-throw.js","webpack://math/./node_modules/core-js/internals/create-property.js","webpack://math/./node_modules/seedrandom/seedrandom.js","webpack://math/./node_modules/core-js/modules/es.regexp.constructor.js","webpack://math/./node_modules/core-js/internals/is-callable.js","webpack://math/./node_modules/core-js/internals/object-define-property.js","webpack://math/./node_modules/core-js/internals/own-keys.js","webpack://math/./node_modules/core-js/internals/to-indexed-object.js","webpack://math/./node_modules/core-js/modules/es.string.replace.js","webpack://math/./node_modules/core-js/internals/a-constructor.js","webpack://math/./node_modules/core-js/internals/to-absolute-index.js","webpack://math/./node_modules/core-js/internals/shared.js","webpack://math/./node_modules/core-js/internals/ie8-dom-define.js","webpack://math/./node_modules/core-js/internals/get-method.js","webpack://math/./node_modules/core-js/internals/new-promise-capability.js","webpack://math/./node_modules/core-js/internals/function-bind-context.js","webpack://math/./node_modules/seedrandom/lib/tychei.js","webpack://math/./node_modules/core-js/internals/shared-key.js","webpack://math/./node_modules/core-js/internals/environment-is-node.js","webpack://math/./node_modules/core-js/internals/length-of-array-like.js","webpack://math/./node_modules/core-js/internals/iterators.js","webpack://math/./node_modules/core-js/internals/define-built-ins.js","webpack://math/./node_modules/core-js/internals/call-with-safe-iteration-closing.js","webpack://math/./node_modules/core-js/internals/is-pure.js","webpack://math/./node_modules/core-js/internals/add-to-unscopables.js","webpack://math/./node_modules/core-js/modules/es.promise.all.js","webpack://math/./node_modules/core-js/internals/export.js","webpack://math/./node_modules/core-js/internals/regexp-exec-abstract.js","webpack://math/./node_modules/core-js/internals/create-non-enumerable-property.js","webpack://math/./node_modules/core-js/internals/function-uncurry-this-accessor.js","webpack://math/./node_modules/core-js/internals/object-define-properties.js","webpack://math/./node_modules/core-js/internals/try-to-string.js","webpack://math/./node_modules/seedrandom/lib/xor4096.js","webpack://math/./node_modules/core-js/internals/define-built-in.js","webpack://math/./node_modules/core-js/modules/es.array.sort.js","webpack://math/./node_modules/core-js/internals/get-json-replacer-function.js","webpack://math/./node_modules/core-js/internals/classof.js","webpack://math/./node_modules/core-js/internals/to-property-key.js","webpack://math/./node_modules/core-js/internals/create-property-descriptor.js","webpack://math/./node_modules/core-js/internals/use-symbol-as-uid.js","webpack://math/./node_modules/core-js/internals/indexed-object.js","webpack://math/./node_modules/seedrandom/lib/alea.js","webpack://math/./node_modules/core-js/internals/regexp-exec.js","webpack://math/./node_modules/core-js/internals/object-get-own-property-descriptor.js","webpack://math/./node_modules/seedrandom/index.js","webpack://math/./node_modules/core-js/modules/es.regexp.dot-all.js","webpack://math/./node_modules/core-js/internals/function-uncurry-this-clause.js","webpack://math/./node_modules/core-js/modules/es.regexp.exec.js","webpack://math/./node_modules/core-js/modules/esnext.iterator.some.js","webpack://math/./node_modules/core-js/modules/es.iterator.for-each.js","webpack://math/./node_modules/core-js/internals/shared-store.js","webpack://math/./node_modules/core-js/internals/set-species.js","webpack://math/./node_modules/core-js/internals/iterators-core.js","webpack://math/./node_modules/core-js/internals/array-slice.js","webpack://math/./node_modules/core-js/internals/copy-constructor-properties.js","webpack://math/./node_modules/core-js/modules/es.promise.race.js","webpack://math/./node_modules/core-js/internals/require-object-coercible.js","webpack://math/./node_modules/core-js/internals/get-built-in.js","webpack://math/./node_modules/core-js/internals/advance-string-index.js","webpack://math/./node_modules/core-js/internals/environment-is-webos-webkit.js","webpack://math/./node_modules/core-js/internals/regexp-flags.js","webpack://math/./node_modules/core-js/internals/to-length.js","webpack://math/./node_modules/core-js/modules/es.iterator.constructor.js","webpack://math/./node_modules/core-js/internals/string-multibyte.js","webpack://math/./node_modules/core-js/internals/well-known-symbol.js","webpack://math/./node_modules/core-js/modules/es.iterator.reduce.js","webpack://math/./node_modules/core-js/internals/queue.js","webpack://math/./node_modules/core-js/internals/regexp-sticky-helpers.js","webpack://math/./node_modules/core-js/internals/object-get-own-property-names.js","webpack://math/./node_modules/core-js/internals/an-object.js","webpack://math/./node_modules/core-js/internals/weak-map-basic-detection.js","webpack://math/./node_modules/core-js/internals/v8-prototype-define-bug.js","webpack://math/./node_modules/core-js/internals/enum-bug-keys.js","webpack://math/./node_modules/core-js/internals/function-apply.js","webpack://math/./node_modules/core-js/internals/object-property-is-enumerable.js","webpack://math/./node_modules/core-js/internals/regexp-unsupported-ncg.js","webpack://math/./node_modules/core-js/modules/esnext.iterator.reduce.js","webpack://math/./node_modules/core-js/internals/to-object.js","webpack://math/./node_modules/core-js/modules/esnext.iterator.constructor.js","webpack://math/./node_modules/core-js/internals/fails.js","webpack://math/./node_modules/seedrandom/lib/xorshift7.js","webpack://math/./node_modules/core-js/internals/task.js","webpack://math/./node_modules/core-js/internals/fix-regexp-well-known-symbol-logic.js","webpack://math/./node_modules/core-js/internals/has-own-property.js","webpack://math/./node_modules/core-js/internals/a-callable.js","webpack://math/./node_modules/core-js/internals/define-global-property.js","webpack://math/./node_modules/core-js/internals/iterator-create-proxy.js","webpack://math/./node_modules/core-js/modules/es.symbol.description.js","webpack://math/./node_modules/core-js/internals/function-uncurry-this.js","webpack://math/./node_modules/core-js/internals/environment-v8-version.js","webpack://math/./node_modules/core-js/internals/iterator-close.js","webpack://math/./node_modules/core-js/internals/environment-is-ios.js","webpack://math/./node_modules/core-js/internals/function-call.js","webpack://math/./node_modules/core-js/internals/array-includes.js","webpack://math/webpack/bootstrap","webpack://math/webpack/runtime/amd define","webpack://math/webpack/runtime/amd options","webpack://math/webpack/runtime/define property getters","webpack://math/webpack/runtime/hasOwnProperty shorthand","webpack://math/webpack/runtime/make namespace object","webpack://math/webpack/runtime/node module decorator","webpack://math/./src/utils/customs.js","webpack://math/./src/utils/map.js","webpack://math/./src/utils/is.js","webpack://math/./src/utils/object.js","webpack://math/./src/utils/factory.js","webpack://math/./src/utils/number.js","webpack://math/./src/core/function/typed.js","webpack://math/./src/type/resultset/ResultSet.js","webpack://math/./node_modules/decimal.js/decimal.mjs","webpack://math/./src/type/bignumber/BigNumber.js","webpack://math/./node_modules/complex.js/dist/complex.mjs","webpack://math/./src/type/complex/Complex.js","webpack://math/./node_modules/fraction.js/dist/fraction.mjs","webpack://math/./src/type/fraction/Fraction.js","webpack://math/./src/type/matrix/Range.js","webpack://math/./src/type/matrix/Matrix.js","webpack://math/./node_modules/@babel/runtime/helpers/esm/extends.js","webpack://math/./src/utils/bignumber/formatter.js","webpack://math/./src/utils/string.js","webpack://math/./src/error/DimensionError.js","webpack://math/./src/error/IndexError.js","webpack://math/./src/utils/array.js","webpack://math/./src/utils/optimizeCallback.js","webpack://math/./src/type/matrix/DenseMatrix.js","webpack://math/./src/function/utils/clone.js","webpack://math/./src/utils/switch.js","webpack://math/./src/utils/collection.js","webpack://math/./src/function/utils/isInteger.js","webpack://math/./src/plain/number/utils.js","webpack://math/./src/utils/bignumber/nearlyEqual.js","webpack://math/./src/function/utils/isNegative.js","webpack://math/./src/function/utils/isNumeric.js","webpack://math/./src/function/utils/hasNumericValue.js","webpack://math/./src/function/utils/isPositive.js","webpack://math/./src/function/utils/isZero.js","webpack://math/./src/function/utils/isNaN.js","webpack://math/./src/function/utils/typeOf.js","webpack://math/./src/function/relational/compareUnits.js","webpack://math/./src/function/relational/equalScalar.js","webpack://math/./src/utils/complex.js","webpack://math/./src/type/matrix/SparseMatrix.js","webpack://math/./src/type/number.js","webpack://math/./src/type/bigint.js","webpack://math/./src/type/string.js","webpack://math/./src/type/boolean.js","webpack://math/./src/type/bignumber/function/bignumber.js","webpack://math/./src/type/complex/function/complex.js","webpack://math/./src/type/fraction/function/fraction.js","webpack://math/./src/type/matrix/function/matrix.js","webpack://math/./src/function/matrix/matrixFromFunction.js","webpack://math/./src/function/matrix/matrixFromRows.js","webpack://math/./src/function/matrix/matrixFromColumns.js","webpack://math/./src/type/unit/function/splitUnit.js","webpack://math/./src/plain/number/arithmetic.js","webpack://math/./src/function/arithmetic/unaryMinus.js","webpack://math/./src/function/arithmetic/unaryPlus.js","webpack://math/./src/function/arithmetic/abs.js","webpack://math/./src/function/matrix/mapSlices.js","webpack://math/./src/function/arithmetic/addScalar.js","webpack://math/./src/function/arithmetic/subtractScalar.js","webpack://math/./src/function/arithmetic/cbrt.js","webpack://math/./src/type/matrix/utils/matAlgo11xS0s.js","webpack://math/./src/type/matrix/utils/matAlgo12xSfs.js","webpack://math/./src/type/matrix/utils/matAlgo14xDs.js","webpack://math/./src/function/arithmetic/ceil.js","webpack://math/./src/function/arithmetic/cube.js","webpack://math/./src/function/arithmetic/exp.js","webpack://math/./src/function/arithmetic/expm1.js","webpack://math/./src/function/arithmetic/fix.js","webpack://math/./src/function/arithmetic/floor.js","webpack://math/./src/type/matrix/utils/matAlgo02xDS0.js","webpack://math/./src/type/matrix/utils/matAlgo03xDSf.js","webpack://math/./src/type/matrix/utils/matAlgo05xSfSf.js","webpack://math/./src/type/matrix/utils/matAlgo13xDD.js","webpack://math/./src/type/matrix/utils/broadcast.js","webpack://math/./src/type/matrix/utils/matrixAlgorithmSuite.js","webpack://math/./src/function/arithmetic/mod.js","webpack://math/./src/type/matrix/utils/matAlgo01xDSid.js","webpack://math/./src/type/matrix/utils/matAlgo04xSidSid.js","webpack://math/./src/type/matrix/utils/matAlgo10xSids.js","webpack://math/./src/error/ArgumentsError.js","webpack://math/./src/function/arithmetic/gcd.js","webpack://math/./src/type/matrix/utils/matAlgo06xS0S0.js","webpack://math/./src/function/arithmetic/lcm.js","webpack://math/./src/utils/bigint.js","webpack://math/./src/function/arithmetic/log10.js","webpack://math/./src/function/arithmetic/log2.js","webpack://math/./src/function/arithmetic/multiplyScalar.js","webpack://math/./src/function/arithmetic/multiply.js","webpack://math/./src/function/arithmetic/nthRoot.js","webpack://math/./src/function/arithmetic/sign.js","webpack://math/./src/function/arithmetic/sqrt.js","webpack://math/./src/function/arithmetic/square.js","webpack://math/./src/function/arithmetic/subtract.js","webpack://math/./src/function/arithmetic/xgcd.js","webpack://math/./src/function/arithmetic/invmod.js","webpack://math/./src/type/matrix/utils/matAlgo09xS0Sf.js","webpack://math/./src/function/arithmetic/dotMultiply.js","webpack://math/./src/utils/bignumber/bitwise.js","webpack://math/./src/plain/number/bitwise.js","webpack://math/./src/function/bitwise/bitAnd.js","webpack://math/./src/function/bitwise/bitNot.js","webpack://math/./src/function/bitwise/bitOr.js","webpack://math/./src/type/matrix/utils/matAlgo07xSSf.js","webpack://math/./src/function/bitwise/bitXor.js","webpack://math/./src/function/complex/arg.js","webpack://math/./src/function/complex/conj.js","webpack://math/./src/function/complex/im.js","webpack://math/./src/function/complex/re.js","webpack://math/./src/plain/number/logical.js","webpack://math/./src/function/logical/not.js","webpack://math/./src/function/logical/or.js","webpack://math/./src/function/logical/xor.js","webpack://math/./src/function/matrix/concat.js","webpack://math/./src/function/matrix/column.js","webpack://math/./src/function/matrix/count.js","webpack://math/./src/function/matrix/cross.js","webpack://math/./src/function/matrix/diag.js","webpack://math/./src/function/matrix/filter.js","webpack://math/./src/function/matrix/flatten.js","webpack://math/./src/function/matrix/forEach.js","webpack://math/./src/function/matrix/getMatrixDataType.js","webpack://math/./src/function/matrix/identity.js","webpack://math/./src/function/matrix/kron.js","webpack://math/./src/function/matrix/map.js","webpack://math/./src/function/matrix/diff.js","webpack://math/./src/function/matrix/ones.js","webpack://math/./src/utils/noop.js","webpack://math/./src/function/matrix/range.js","webpack://math/./src/function/matrix/reshape.js","webpack://math/./src/function/matrix/resize.js","webpack://math/./src/function/matrix/rotate.js","webpack://math/./src/function/matrix/rotationMatrix.js","webpack://math/./src/function/matrix/row.js","webpack://math/./src/function/matrix/size.js","webpack://math/./src/function/matrix/squeeze.js","webpack://math/./src/function/matrix/subset.js","webpack://math/./src/function/matrix/transpose.js","webpack://math/./src/function/matrix/ctranspose.js","webpack://math/./src/function/matrix/zeros.js","webpack://math/./src/function/matrix/fft.js","webpack://math/./src/function/matrix/ifft.js","webpack://math/./src/function/numeric/solveODE.js","webpack://math/./src/function/special/erf.js","webpack://math/./src/function/special/zeta.js","webpack://math/./src/function/statistics/mode.js","webpack://math/./src/function/statistics/utils/improveErrorMessage.js","webpack://math/./src/function/statistics/prod.js","webpack://math/./src/function/string/format.js","webpack://math/./src/function/string/bin.js","webpack://math/./src/function/string/oct.js","webpack://math/./src/function/string/hex.js","webpack://math/./src/utils/print.js","webpack://math/./src/function/string/print.js","webpack://math/./src/function/unit/to.js","webpack://math/./src/function/utils/isPrime.js","webpack://math/./src/function/utils/numeric.js","webpack://math/./src/function/arithmetic/divideScalar.js","webpack://math/./src/function/arithmetic/pow.js","webpack://math/./src/function/arithmetic/round.js","webpack://math/./src/function/arithmetic/log.js","webpack://math/./src/function/arithmetic/log1p.js","webpack://math/./src/function/arithmetic/nthRoots.js","webpack://math/./src/function/arithmetic/dotPow.js","webpack://math/./src/function/arithmetic/dotDivide.js","webpack://math/./src/function/algebra/solver/utils/solveValidation.js","webpack://math/./src/function/algebra/solver/lsolve.js","webpack://math/./src/function/algebra/solver/usolve.js","webpack://math/./src/function/algebra/solver/lsolveAll.js","webpack://math/./src/function/algebra/solver/usolveAll.js","webpack://math/./src/type/matrix/utils/matAlgo08xS0Sid.js","webpack://math/./src/function/bitwise/useMatrixForArrayScalar.js","webpack://math/./src/function/bitwise/leftShift.js","webpack://math/./src/function/bitwise/rightArithShift.js","webpack://math/./src/function/bitwise/rightLogShift.js","webpack://math/./src/function/logical/and.js","webpack://math/./src/function/relational/compare.js","webpack://math/./src/function/relational/compareNatural.js","webpack://math/./src/function/relational/compareText.js","webpack://math/./src/function/relational/equal.js","webpack://math/./src/function/relational/equalText.js","webpack://math/./src/function/relational/smaller.js","webpack://math/./src/function/relational/smallerEq.js","webpack://math/./src/function/relational/larger.js","webpack://math/./src/function/relational/largerEq.js","webpack://math/./src/function/relational/deepEqual.js","webpack://math/./src/function/relational/unequal.js","webpack://math/./src/function/matrix/partitionSelect.js","webpack://math/./src/function/matrix/sort.js","webpack://math/./src/function/statistics/max.js","webpack://math/./src/function/statistics/min.js","webpack://math/./src/type/matrix/ImmutableDenseMatrix.js","webpack://math/./src/type/matrix/MatrixIndex.js","webpack://math/./src/type/matrix/FibonacciHeap.js","webpack://math/./src/type/matrix/Spa.js","webpack://math/./src/utils/lruQueue.js","webpack://math/./src/utils/function.js","webpack://math/./src/utils/bignumber/constants.js","webpack://math/./src/type/unit/Unit.js","webpack://math/./src/type/unit/function/unit.js","webpack://math/./src/type/matrix/function/sparse.js","webpack://math/./src/type/unit/function/createUnit.js","webpack://math/./src/function/trigonometry/acos.js","webpack://math/./src/plain/number/trigonometry.js","webpack://math/./src/function/trigonometry/acosh.js","webpack://math/./src/function/trigonometry/acot.js","webpack://math/./src/function/trigonometry/acoth.js","webpack://math/./src/function/trigonometry/acsc.js","webpack://math/./src/function/trigonometry/acsch.js","webpack://math/./src/function/trigonometry/asec.js","webpack://math/./src/function/trigonometry/asech.js","webpack://math/./src/function/trigonometry/asin.js","webpack://math/./src/function/trigonometry/asinh.js","webpack://math/./src/function/trigonometry/atan.js","webpack://math/./src/function/trigonometry/atan2.js","webpack://math/./src/function/trigonometry/atanh.js","webpack://math/./src/function/trigonometry/trigUnit.js","webpack://math/./src/function/trigonometry/cos.js","webpack://math/./src/function/trigonometry/cosh.js","webpack://math/./src/function/trigonometry/cot.js","webpack://math/./src/function/trigonometry/coth.js","webpack://math/./src/function/trigonometry/csc.js","webpack://math/./src/function/trigonometry/csch.js","webpack://math/./src/function/trigonometry/sec.js","webpack://math/./src/function/trigonometry/sech.js","webpack://math/./src/function/trigonometry/sin.js","webpack://math/./src/function/trigonometry/sinh.js","webpack://math/./src/function/trigonometry/tan.js","webpack://math/./src/function/trigonometry/tanh.js","webpack://math/./src/function/set/setCartesian.js","webpack://math/./src/function/set/setDifference.js","webpack://math/./src/function/set/setDistinct.js","webpack://math/./src/function/set/setIntersect.js","webpack://math/./src/function/set/setIsSubset.js","webpack://math/./src/function/set/setMultiplicity.js","webpack://math/./src/function/set/setPowerset.js","webpack://math/./src/function/set/setSize.js","webpack://math/./src/function/set/setSymDifference.js","webpack://math/./src/function/set/setUnion.js","webpack://math/./src/function/arithmetic/add.js","webpack://math/./src/function/arithmetic/hypot.js","webpack://math/./src/function/arithmetic/norm.js","webpack://math/./src/function/matrix/dot.js","webpack://math/./src/function/matrix/trace.js","webpack://math/./src/type/matrix/function/index.js","webpack://math/./src/expression/keywords.js","webpack://math/./src/expression/node/Node.js","webpack://math/./node_modules/@babel/runtime/helpers/esm/typeof.js","webpack://math/./node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack://math/./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","webpack://math/./node_modules/@babel/runtime/helpers/esm/toPrimitive.js","webpack://math/./src/expression/transform/utils/errorTransform.js","webpack://math/./src/expression/node/utils/access.js","webpack://math/./src/expression/node/AccessorNode.js","webpack://math/./src/expression/node/ArrayNode.js","webpack://math/./src/expression/operators.js","webpack://math/./src/expression/node/AssignmentNode.js","webpack://math/./src/expression/node/utils/assign.js","webpack://math/./src/expression/node/BlockNode.js","webpack://math/./src/expression/node/ConditionalNode.js","webpack://math/./src/utils/latex.js","webpack://math/./src/expression/node/ConstantNode.js","webpack://math/./src/expression/node/FunctionAssignmentNode.js","webpack://math/./src/expression/node/IndexNode.js","webpack://math/./src/expression/node/ObjectNode.js","webpack://math/./src/utils/scope.js","webpack://math/./src/expression/node/OperatorNode.js","webpack://math/./src/expression/node/ParenthesisNode.js","webpack://math/./src/expression/node/RangeNode.js","webpack://math/./src/expression/node/RelationalNode.js","webpack://math/./src/expression/node/SymbolNode.js","webpack://math/./src/expression/node/FunctionNode.js","webpack://math/./src/expression/parse.js","webpack://math/./src/expression/function/compile.js","webpack://math/./src/expression/function/evaluate.js","webpack://math/./src/expression/Parser.js","webpack://math/./src/expression/function/parser.js","webpack://math/./src/function/algebra/decomposition/lup.js","webpack://math/./src/function/algebra/decomposition/qr.js","webpack://math/./src/function/algebra/sparse/csTdfs.js","webpack://math/./src/function/algebra/sparse/csFlip.js","webpack://math/./src/function/algebra/sparse/csAmd.js","webpack://math/./src/function/algebra/sparse/csFkeep.js","webpack://math/./src/function/algebra/sparse/csLeaf.js","webpack://math/./src/function/algebra/sparse/csCounts.js","webpack://math/./src/function/algebra/sparse/csSqr.js","webpack://math/./src/function/algebra/sparse/csPermute.js","webpack://math/./src/function/algebra/sparse/csEtree.js","webpack://math/./src/function/algebra/sparse/csPost.js","webpack://math/./src/function/algebra/sparse/csMarked.js","webpack://math/./src/function/algebra/sparse/csMark.js","webpack://math/./src/function/algebra/sparse/csUnflip.js","webpack://math/./src/function/algebra/sparse/csDfs.js","webpack://math/./src/function/algebra/sparse/csSpsolve.js","webpack://math/./src/function/algebra/sparse/csReach.js","webpack://math/./src/function/algebra/sparse/csLu.js","webpack://math/./src/function/algebra/decomposition/slu.js","webpack://math/./src/function/algebra/sparse/csIpvec.js","webpack://math/./src/function/algebra/solver/lusolve.js","webpack://math/./src/function/algebra/polynomialRoot.js","webpack://math/./src/expression/Help.js","webpack://math/./src/type/chain/Chain.js","webpack://math/./src/expression/embeddedDocs/constants/e.js","webpack://math/./src/expression/embeddedDocs/constants/pi.js","webpack://math/./src/expression/embeddedDocs/embeddedDocs.js","webpack://math/./src/expression/embeddedDocs/construction/bignumber.js","webpack://math/./src/expression/embeddedDocs/construction/bigint.js","webpack://math/./src/expression/embeddedDocs/construction/boolean.js","webpack://math/./src/expression/embeddedDocs/construction/complex.js","webpack://math/./src/expression/embeddedDocs/construction/createUnit.js","webpack://math/./src/expression/embeddedDocs/construction/fraction.js","webpack://math/./src/expression/embeddedDocs/construction/index.js","webpack://math/./src/expression/embeddedDocs/construction/matrix.js","webpack://math/./src/expression/embeddedDocs/construction/number.js","webpack://math/./src/expression/embeddedDocs/construction/sparse.js","webpack://math/./src/expression/embeddedDocs/construction/splitUnit.js","webpack://math/./src/expression/embeddedDocs/construction/string.js","webpack://math/./src/expression/embeddedDocs/construction/unit.js","webpack://math/./src/expression/embeddedDocs/constants/false.js","webpack://math/./src/expression/embeddedDocs/constants/i.js","webpack://math/./src/expression/embeddedDocs/constants/Infinity.js","webpack://math/./src/expression/embeddedDocs/constants/LN2.js","webpack://math/./src/expression/embeddedDocs/constants/LN10.js","webpack://math/./src/expression/embeddedDocs/constants/LOG2E.js","webpack://math/./src/expression/embeddedDocs/constants/LOG10E.js","webpack://math/./src/expression/embeddedDocs/constants/NaN.js","webpack://math/./src/expression/embeddedDocs/constants/null.js","webpack://math/./src/expression/embeddedDocs/constants/phi.js","webpack://math/./src/expression/embeddedDocs/constants/SQRT1_2.js","webpack://math/./src/expression/embeddedDocs/constants/SQRT2.js","webpack://math/./src/expression/embeddedDocs/constants/tau.js","webpack://math/./src/expression/embeddedDocs/constants/true.js","webpack://math/./src/expression/embeddedDocs/constants/version.js","webpack://math/./src/expression/embeddedDocs/function/algebra/derivative.js","webpack://math/./src/expression/embeddedDocs/function/algebra/lsolve.js","webpack://math/./src/expression/embeddedDocs/function/algebra/lsolveAll.js","webpack://math/./src/expression/embeddedDocs/function/algebra/lup.js","webpack://math/./src/expression/embeddedDocs/function/algebra/lusolve.js","webpack://math/./src/expression/embeddedDocs/function/algebra/leafCount.js","webpack://math/./src/expression/embeddedDocs/function/algebra/polynomialRoot.js","webpack://math/./src/expression/embeddedDocs/function/algebra/resolve.js","webpack://math/./src/expression/embeddedDocs/function/algebra/simplify.js","webpack://math/./src/expression/embeddedDocs/function/algebra/simplifyConstant.js","webpack://math/./src/expression/embeddedDocs/function/algebra/simplifyCore.js","webpack://math/./src/expression/embeddedDocs/function/algebra/symbolicEqual.js","webpack://math/./src/expression/embeddedDocs/function/algebra/rationalize.js","webpack://math/./src/expression/embeddedDocs/function/algebra/slu.js","webpack://math/./src/expression/embeddedDocs/function/algebra/usolve.js","webpack://math/./src/expression/embeddedDocs/function/algebra/usolveAll.js","webpack://math/./src/expression/embeddedDocs/function/algebra/qr.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/abs.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/add.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/cbrt.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/ceil.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/cube.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/divide.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/dotDivide.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/dotMultiply.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/dotPow.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/exp.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/expm.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/expm1.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/fix.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/floor.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/gcd.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/hypot.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/lcm.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/log.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/log2.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/log1p.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/log10.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/mod.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/multiply.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/norm.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/nthRoot.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/nthRoots.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/pow.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/round.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/sign.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/sqrt.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/sqrtm.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/square.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/subtract.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/unaryMinus.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/unaryPlus.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/xgcd.js","webpack://math/./src/expression/embeddedDocs/function/arithmetic/invmod.js","webpack://math/./src/expression/embeddedDocs/function/bitwise/bitAnd.js","webpack://math/./src/expression/embeddedDocs/function/bitwise/bitNot.js","webpack://math/./src/expression/embeddedDocs/function/bitwise/bitOr.js","webpack://math/./src/expression/embeddedDocs/function/bitwise/bitXor.js","webpack://math/./src/expression/embeddedDocs/function/bitwise/leftShift.js","webpack://math/./src/expression/embeddedDocs/function/bitwise/rightArithShift.js","webpack://math/./src/expression/embeddedDocs/function/bitwise/rightLogShift.js","webpack://math/./src/expression/embeddedDocs/function/combinatorics/bellNumbers.js","webpack://math/./src/expression/embeddedDocs/function/combinatorics/catalan.js","webpack://math/./src/expression/embeddedDocs/function/combinatorics/composition.js","webpack://math/./src/expression/embeddedDocs/function/combinatorics/stirlingS2.js","webpack://math/./src/expression/embeddedDocs/core/config.js","webpack://math/./src/expression/embeddedDocs/core/import.js","webpack://math/./src/expression/embeddedDocs/core/typed.js","webpack://math/./src/expression/embeddedDocs/function/complex/arg.js","webpack://math/./src/expression/embeddedDocs/function/complex/conj.js","webpack://math/./src/expression/embeddedDocs/function/complex/re.js","webpack://math/./src/expression/embeddedDocs/function/complex/im.js","webpack://math/./src/expression/embeddedDocs/function/expression/evaluate.js","webpack://math/./src/expression/embeddedDocs/function/expression/help.js","webpack://math/./src/expression/embeddedDocs/function/expression/parse.js","webpack://math/./src/expression/embeddedDocs/function/expression/parser.js","webpack://math/./src/expression/embeddedDocs/function/expression/compile.js","webpack://math/./src/expression/embeddedDocs/function/geometry/distance.js","webpack://math/./src/expression/embeddedDocs/function/geometry/intersect.js","webpack://math/./src/expression/embeddedDocs/function/logical/and.js","webpack://math/./src/expression/embeddedDocs/function/logical/not.js","webpack://math/./src/expression/embeddedDocs/function/logical/or.js","webpack://math/./src/expression/embeddedDocs/function/logical/xor.js","webpack://math/./src/expression/embeddedDocs/function/matrix/mapSlices.js","webpack://math/./src/expression/embeddedDocs/function/matrix/concat.js","webpack://math/./src/expression/embeddedDocs/function/matrix/count.js","webpack://math/./src/expression/embeddedDocs/function/matrix/cross.js","webpack://math/./src/expression/embeddedDocs/function/matrix/column.js","webpack://math/./src/expression/embeddedDocs/function/matrix/ctranspose.js","webpack://math/./src/expression/embeddedDocs/function/matrix/det.js","webpack://math/./src/expression/embeddedDocs/function/matrix/diag.js","webpack://math/./src/expression/embeddedDocs/function/matrix/diff.js","webpack://math/./src/expression/embeddedDocs/function/matrix/dot.js","webpack://math/./src/expression/embeddedDocs/function/matrix/getMatrixDataType.js","webpack://math/./src/expression/embeddedDocs/function/matrix/identity.js","webpack://math/./src/expression/embeddedDocs/function/matrix/filter.js","webpack://math/./src/expression/embeddedDocs/function/matrix/flatten.js","webpack://math/./src/expression/embeddedDocs/function/matrix/forEach.js","webpack://math/./src/expression/embeddedDocs/function/matrix/inv.js","webpack://math/./src/expression/embeddedDocs/function/matrix/pinv.js","webpack://math/./src/expression/embeddedDocs/function/matrix/eigs.js","webpack://math/./src/expression/embeddedDocs/function/matrix/kron.js","webpack://math/./src/expression/embeddedDocs/function/matrix/matrixFromFunction.js","webpack://math/./src/expression/embeddedDocs/function/matrix/matrixFromRows.js","webpack://math/./src/expression/embeddedDocs/function/matrix/matrixFromColumns.js","webpack://math/./src/expression/embeddedDocs/function/matrix/map.js","webpack://math/./src/expression/embeddedDocs/function/matrix/ones.js","webpack://math/./src/expression/embeddedDocs/function/matrix/partitionSelect.js","webpack://math/./src/expression/embeddedDocs/function/matrix/range.js","webpack://math/./src/expression/embeddedDocs/function/matrix/resize.js","webpack://math/./src/expression/embeddedDocs/function/matrix/reshape.js","webpack://math/./src/expression/embeddedDocs/function/matrix/rotate.js","webpack://math/./src/expression/embeddedDocs/function/matrix/rotationMatrix.js","webpack://math/./src/expression/embeddedDocs/function/matrix/row.js","webpack://math/./src/expression/embeddedDocs/function/matrix/size.js","webpack://math/./src/expression/embeddedDocs/function/matrix/sort.js","webpack://math/./src/expression/embeddedDocs/function/matrix/squeeze.js","webpack://math/./src/expression/embeddedDocs/function/matrix/subset.js","webpack://math/./src/expression/embeddedDocs/function/matrix/trace.js","webpack://math/./src/expression/embeddedDocs/function/matrix/transpose.js","webpack://math/./src/expression/embeddedDocs/function/matrix/zeros.js","webpack://math/./src/expression/embeddedDocs/function/matrix/fft.js","webpack://math/./src/expression/embeddedDocs/function/matrix/ifft.js","webpack://math/./src/expression/embeddedDocs/function/algebra/sylvester.js","webpack://math/./src/expression/embeddedDocs/function/algebra/schur.js","webpack://math/./src/expression/embeddedDocs/function/algebra/lyap.js","webpack://math/./src/expression/embeddedDocs/function/numeric/solveODE.js","webpack://math/./src/expression/embeddedDocs/function/probability/combinations.js","webpack://math/./src/expression/embeddedDocs/function/probability/combinationsWithRep.js","webpack://math/./src/expression/embeddedDocs/function/probability/factorial.js","webpack://math/./src/expression/embeddedDocs/function/probability/gamma.js","webpack://math/./src/expression/embeddedDocs/function/probability/kldivergence.js","webpack://math/./src/expression/embeddedDocs/function/probability/lgamma.js","webpack://math/./src/expression/embeddedDocs/function/probability/multinomial.js","webpack://math/./src/expression/embeddedDocs/function/probability/permutations.js","webpack://math/./src/expression/embeddedDocs/function/probability/pickRandom.js","webpack://math/./src/expression/embeddedDocs/function/probability/random.js","webpack://math/./src/expression/embeddedDocs/function/probability/randomInt.js","webpack://math/./src/expression/embeddedDocs/function/relational/compare.js","webpack://math/./src/expression/embeddedDocs/function/relational/compareNatural.js","webpack://math/./src/expression/embeddedDocs/function/relational/compareText.js","webpack://math/./src/expression/embeddedDocs/function/relational/deepEqual.js","webpack://math/./src/expression/embeddedDocs/function/relational/equal.js","webpack://math/./src/expression/embeddedDocs/function/relational/equalText.js","webpack://math/./src/expression/embeddedDocs/function/relational/larger.js","webpack://math/./src/expression/embeddedDocs/function/relational/largerEq.js","webpack://math/./src/expression/embeddedDocs/function/relational/smaller.js","webpack://math/./src/expression/embeddedDocs/function/relational/smallerEq.js","webpack://math/./src/expression/embeddedDocs/function/relational/unequal.js","webpack://math/./src/expression/embeddedDocs/function/set/setCartesian.js","webpack://math/./src/expression/embeddedDocs/function/set/setDifference.js","webpack://math/./src/expression/embeddedDocs/function/set/setDistinct.js","webpack://math/./src/expression/embeddedDocs/function/set/setIntersect.js","webpack://math/./src/expression/embeddedDocs/function/set/setIsSubset.js","webpack://math/./src/expression/embeddedDocs/function/set/setMultiplicity.js","webpack://math/./src/expression/embeddedDocs/function/set/setPowerset.js","webpack://math/./src/expression/embeddedDocs/function/set/setSize.js","webpack://math/./src/expression/embeddedDocs/function/set/setSymDifference.js","webpack://math/./src/expression/embeddedDocs/function/set/setUnion.js","webpack://math/./src/expression/embeddedDocs/function/signal/zpk2tf.js","webpack://math/./src/expression/embeddedDocs/function/signal/freqz.js","webpack://math/./src/expression/embeddedDocs/function/special/erf.js","webpack://math/./src/expression/embeddedDocs/function/special/zeta.js","webpack://math/./src/expression/embeddedDocs/function/statistics/cumsum.js","webpack://math/./src/expression/embeddedDocs/function/statistics/mad.js","webpack://math/./src/expression/embeddedDocs/function/statistics/max.js","webpack://math/./src/expression/embeddedDocs/function/statistics/mean.js","webpack://math/./src/expression/embeddedDocs/function/statistics/median.js","webpack://math/./src/expression/embeddedDocs/function/statistics/min.js","webpack://math/./src/expression/embeddedDocs/function/statistics/mode.js","webpack://math/./src/expression/embeddedDocs/function/statistics/prod.js","webpack://math/./src/expression/embeddedDocs/function/statistics/quantileSeq.js","webpack://math/./src/expression/embeddedDocs/function/statistics/std.js","webpack://math/./src/expression/embeddedDocs/function/statistics/sum.js","webpack://math/./src/expression/embeddedDocs/function/statistics/variance.js","webpack://math/./src/expression/embeddedDocs/function/statistics/corr.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/acos.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/acosh.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/acot.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/acoth.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/acsc.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/acsch.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/asec.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/asech.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/asin.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/asinh.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/atan.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/atanh.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/atan2.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/cos.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/cosh.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/cot.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/coth.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/csc.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/csch.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/sec.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/sech.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/sin.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/sinh.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/tan.js","webpack://math/./src/expression/embeddedDocs/function/trigonometry/tanh.js","webpack://math/./src/expression/embeddedDocs/function/units/to.js","webpack://math/./src/expression/embeddedDocs/function/utils/clone.js","webpack://math/./src/expression/embeddedDocs/function/utils/format.js","webpack://math/./src/expression/embeddedDocs/function/utils/bin.js","webpack://math/./src/expression/embeddedDocs/function/utils/oct.js","webpack://math/./src/expression/embeddedDocs/function/utils/hex.js","webpack://math/./src/expression/embeddedDocs/function/utils/isNaN.js","webpack://math/./src/expression/embeddedDocs/function/utils/isInteger.js","webpack://math/./src/expression/embeddedDocs/function/utils/isNegative.js","webpack://math/./src/expression/embeddedDocs/function/utils/isNumeric.js","webpack://math/./src/expression/embeddedDocs/function/utils/hasNumericValue.js","webpack://math/./src/expression/embeddedDocs/function/utils/isPositive.js","webpack://math/./src/expression/embeddedDocs/function/utils/isPrime.js","webpack://math/./src/expression/embeddedDocs/function/utils/isZero.js","webpack://math/./src/expression/embeddedDocs/function/utils/print.js","webpack://math/./src/expression/embeddedDocs/function/utils/typeOf.js","webpack://math/./src/expression/embeddedDocs/function/utils/numeric.js","webpack://math/./src/expression/function/help.js","webpack://math/./src/type/chain/function/chain.js","webpack://math/./src/function/matrix/det.js","webpack://math/./src/function/matrix/inv.js","webpack://math/./src/function/matrix/pinv.js","webpack://math/./src/function/matrix/eigs.js","webpack://math/./src/function/matrix/eigs/realSymmetric.js","webpack://math/./src/function/matrix/eigs/complexEigs.js","webpack://math/./src/function/matrix/expm.js","webpack://math/./src/function/matrix/sqrtm.js","webpack://math/./src/function/algebra/sylvester.js","webpack://math/./src/function/algebra/decomposition/schur.js","webpack://math/./src/function/algebra/lyap.js","webpack://math/./src/function/arithmetic/divide.js","webpack://math/./src/function/geometry/distance.js","webpack://math/./src/function/geometry/intersect.js","webpack://math/./src/function/statistics/sum.js","webpack://math/./src/function/statistics/cumsum.js","webpack://math/./src/function/statistics/mean.js","webpack://math/./src/function/statistics/median.js","webpack://math/./src/function/statistics/mad.js","webpack://math/./src/function/statistics/variance.js","webpack://math/./src/function/statistics/quantileSeq.js","webpack://math/./src/function/statistics/std.js","webpack://math/./src/function/statistics/corr.js","webpack://math/./src/utils/product.js","webpack://math/./src/plain/number/combinations.js","webpack://math/./src/function/probability/combinations.js","webpack://math/./src/function/probability/combinationsWithRep.js","webpack://math/./src/plain/number/probability.js","webpack://math/./src/function/probability/gamma.js","webpack://math/./src/function/probability/lgamma.js","webpack://math/./src/function/probability/factorial.js","webpack://math/./src/function/probability/kldivergence.js","webpack://math/./src/function/probability/multinomial.js","webpack://math/./src/function/probability/permutations.js","webpack://math/./src/function/probability/util/seededRNG.js","webpack://math/./src/function/probability/pickRandom.js","webpack://math/./src/function/probability/util/randomMatrix.js","webpack://math/./src/function/probability/random.js","webpack://math/./src/function/probability/randomInt.js","webpack://math/./src/function/combinatorics/stirlingS2.js","webpack://math/./src/function/combinatorics/bellNumbers.js","webpack://math/./src/function/combinatorics/catalan.js","webpack://math/./src/function/combinatorics/composition.js","webpack://math/./src/function/algebra/leafCount.js","webpack://math/./src/function/algebra/simplify/wildcards.js","webpack://math/./src/function/algebra/simplify/util.js","webpack://math/./src/function/algebra/simplify.js","webpack://math/./src/function/algebra/simplifyConstant.js","webpack://math/./src/function/algebra/simplifyCore.js","webpack://math/./src/function/algebra/resolve.js","webpack://math/./src/function/algebra/symbolicEqual.js","webpack://math/./src/function/algebra/derivative.js","webpack://math/./src/function/algebra/rationalize.js","webpack://math/./src/function/signal/zpk2tf.js","webpack://math/./src/function/signal/freqz.js","webpack://math/./src/json/reviver.js","webpack://math/./src/json/replacer.js","webpack://math/./src/plain/number/constants.js","webpack://math/./src/constants.js","webpack://math/./src/version.js","webpack://math/./src/type/unit/physicalConstants.js","webpack://math/./src/expression/transform/mapSlices.transform.js","webpack://math/./src/expression/transform/column.transform.js","webpack://math/./src/expression/transform/utils/compileInlineExpression.js","webpack://math/./src/expression/transform/utils/transformCallback.js","webpack://math/./src/expression/transform/filter.transform.js","webpack://math/./src/expression/transform/forEach.transform.js","webpack://math/./src/expression/transform/index.transform.js","webpack://math/./src/expression/transform/map.transform.js","webpack://math/./src/expression/transform/utils/lastDimToZeroBase.js","webpack://math/./src/expression/transform/utils/dimToZeroBase.js","webpack://math/./src/expression/transform/max.transform.js","webpack://math/./src/expression/transform/mean.transform.js","webpack://math/./src/expression/transform/min.transform.js","webpack://math/./src/expression/transform/range.transform.js","webpack://math/./src/expression/transform/row.transform.js","webpack://math/./src/expression/transform/subset.transform.js","webpack://math/./src/expression/transform/concat.transform.js","webpack://math/./src/expression/transform/diff.transform.js","webpack://math/./src/expression/transform/std.transform.js","webpack://math/./src/expression/transform/sum.transform.js","webpack://math/./src/expression/transform/quantileSeq.transform.js","webpack://math/./src/expression/transform/cumsum.transform.js","webpack://math/./src/expression/transform/variance.transform.js","webpack://math/./src/expression/transform/print.transform.js","webpack://math/./src/expression/transform/and.transform.js","webpack://math/./src/expression/transform/or.transform.js","webpack://math/./src/expression/transform/bitAnd.transform.js","webpack://math/./src/expression/transform/bitOr.transform.js","webpack://math/./src/core/config.js","webpack://math/./src/core/function/config.js","webpack://math/./src/defaultInstance.js","webpack://math/./src/core/create.js","webpack://math/./src/utils/emitter.js","webpack://math/./src/core/function/import.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"math\"] = factory();\n\telse\n\t\troot[\"math\"] = factory();\n})(this, () => {\nreturn ","'use strict';\nvar isCallable = require('../internals/is-callable');\n\nmodule.exports = function (it) {\n return typeof it == 'object' ? it !== null : isCallable(it);\n};\n","'use strict';\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\nvar tryToString = require('../internals/try-to-string');\nvar getIteratorMethod = require('../internals/get-iterator-method');\n\nvar $TypeError = TypeError;\n\nmodule.exports = function (argument, usingIterator) {\n var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;\n if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));\n throw new $TypeError(tryToString(argument) + ' is not iterable');\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar iterate = require('../internals/iterate');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\nvar getIteratorDirect = require('../internals/get-iterator-direct');\nvar iteratorClose = require('../internals/iterator-close');\nvar iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');\n\nvar findWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('find', TypeError);\n\n// `Iterator.prototype.find` method\n// https://tc39.es/ecma262/#sec-iterator.prototype.find\n$({ target: 'Iterator', proto: true, real: true, forced: findWithoutClosingOnEarlyError }, {\n find: function find(predicate) {\n anObject(this);\n try {\n aCallable(predicate);\n } catch (error) {\n iteratorClose(this, 'throw', error);\n }\n\n if (findWithoutClosingOnEarlyError) return call(findWithoutClosingOnEarlyError, this, predicate);\n\n var record = getIteratorDirect(this);\n var counter = 0;\n return iterate(record, function (value, stop) {\n if (predicate(value, counter++)) return stop(value);\n }, { IS_RECORD: true, INTERRUPTED: true }).result;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar getBuiltIn = require('../internals/get-built-in');\nvar IS_PURE = require('../internals/is-pure');\nvar NativePromiseConstructor = require('../internals/promise-native-constructor');\nvar FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detection').CONSTRUCTOR;\nvar promiseResolve = require('../internals/promise-resolve');\n\nvar PromiseConstructorWrapper = getBuiltIn('Promise');\nvar CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR;\n\n// `Promise.resolve` method\n// https://tc39.es/ecma262/#sec-promise.resolve\n$({ target: 'Promise', stat: true, forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR }, {\n resolve: function resolve(x) {\n return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x);\n }\n});\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\nvar hasOwn = require('../internals/has-own-property');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar CONFIGURABLE_FUNCTION_NAME = require('../internals/function-name').CONFIGURABLE;\nvar inspectSource = require('../internals/inspect-source');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar enforceInternalState = InternalStateModule.enforce;\nvar getInternalState = InternalStateModule.get;\nvar $String = String;\n// eslint-disable-next-line es/no-object-defineproperty -- safe\nvar defineProperty = Object.defineProperty;\nvar stringSlice = uncurryThis(''.slice);\nvar replace = uncurryThis(''.replace);\nvar join = uncurryThis([].join);\n\nvar CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {\n return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;\n});\n\nvar TEMPLATE = String(String).split('String');\n\nvar makeBuiltIn = module.exports = function (value, name, options) {\n if (stringSlice($String(name), 0, 7) === 'Symbol(') {\n name = '[' + replace($String(name), /^Symbol\\(([^)]*)\\).*$/, '$1') + ']';\n }\n if (options && options.getter) name = 'get ' + name;\n if (options && options.setter) name = 'set ' + name;\n if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {\n if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true });\n else value.name = name;\n }\n if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {\n defineProperty(value, 'length', { value: options.arity });\n }\n try {\n if (options && hasOwn(options, 'constructor') && options.constructor) {\n if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false });\n // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable\n } else if (value.prototype) value.prototype = undefined;\n } catch (error) { /* empty */ }\n var state = enforceInternalState(value);\n if (!hasOwn(state, 'source')) {\n state.source = join(TEMPLATE, typeof name == 'string' ? name : '');\n } return value;\n};\n\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n// eslint-disable-next-line no-extend-native -- required\nFunction.prototype.toString = makeBuiltIn(function toString() {\n return isCallable(this) && getInternalState(this).source || inspectSource(this);\n}, 'toString');\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar hasOwn = require('../internals/has-own-property');\n\nvar FunctionPrototype = Function.prototype;\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;\n\nvar EXISTS = hasOwn(FunctionPrototype, 'name');\n// additional protection from minified / mangled / dropped function names\nvar PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';\nvar CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));\n\nmodule.exports = {\n EXISTS: EXISTS,\n PROPER: PROPER,\n CONFIGURABLE: CONFIGURABLE\n};\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\n\nmodule.exports = getBuiltIn('document', 'documentElement');\n","'use strict';\nmodule.exports = {};\n","'use strict';\nvar $ = require('../internals/export');\nvar IS_PURE = require('../internals/is-pure');\nvar IS_NODE = require('../internals/environment-is-node');\nvar globalThis = require('../internals/global-this');\nvar call = require('../internals/function-call');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar setPrototypeOf = require('../internals/object-set-prototype-of');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar setSpecies = require('../internals/set-species');\nvar aCallable = require('../internals/a-callable');\nvar isCallable = require('../internals/is-callable');\nvar isObject = require('../internals/is-object');\nvar anInstance = require('../internals/an-instance');\nvar speciesConstructor = require('../internals/species-constructor');\nvar task = require('../internals/task').set;\nvar microtask = require('../internals/microtask');\nvar hostReportErrors = require('../internals/host-report-errors');\nvar perform = require('../internals/perform');\nvar Queue = require('../internals/queue');\nvar InternalStateModule = require('../internals/internal-state');\nvar NativePromiseConstructor = require('../internals/promise-native-constructor');\nvar PromiseConstructorDetection = require('../internals/promise-constructor-detection');\nvar newPromiseCapabilityModule = require('../internals/new-promise-capability');\n\nvar PROMISE = 'Promise';\nvar FORCED_PROMISE_CONSTRUCTOR = PromiseConstructorDetection.CONSTRUCTOR;\nvar NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;\nvar NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;\nvar getInternalPromiseState = InternalStateModule.getterFor(PROMISE);\nvar setInternalState = InternalStateModule.set;\nvar NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;\nvar PromiseConstructor = NativePromiseConstructor;\nvar PromisePrototype = NativePromisePrototype;\nvar TypeError = globalThis.TypeError;\nvar document = globalThis.document;\nvar process = globalThis.process;\nvar newPromiseCapability = newPromiseCapabilityModule.f;\nvar newGenericPromiseCapability = newPromiseCapability;\n\nvar DISPATCH_EVENT = !!(document && document.createEvent && globalThis.dispatchEvent);\nvar UNHANDLED_REJECTION = 'unhandledrejection';\nvar REJECTION_HANDLED = 'rejectionhandled';\nvar PENDING = 0;\nvar FULFILLED = 1;\nvar REJECTED = 2;\nvar HANDLED = 1;\nvar UNHANDLED = 2;\n\nvar Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;\n\n// helpers\nvar isThenable = function (it) {\n var then;\n return isObject(it) && isCallable(then = it.then) ? then : false;\n};\n\nvar callReaction = function (reaction, state) {\n var value = state.value;\n var ok = state.state === FULFILLED;\n var handler = ok ? reaction.ok : reaction.fail;\n var resolve = reaction.resolve;\n var reject = reaction.reject;\n var domain = reaction.domain;\n var result, then, exited;\n try {\n if (handler) {\n if (!ok) {\n if (state.rejection === UNHANDLED) onHandleUnhandled(state);\n state.rejection = HANDLED;\n }\n if (handler === true) result = value;\n else {\n if (domain) domain.enter();\n result = handler(value); // can throw\n if (domain) {\n domain.exit();\n exited = true;\n }\n }\n if (result === reaction.promise) {\n reject(new TypeError('Promise-chain cycle'));\n } else if (then = isThenable(result)) {\n call(then, result, resolve, reject);\n } else resolve(result);\n } else reject(value);\n } catch (error) {\n if (domain && !exited) domain.exit();\n reject(error);\n }\n};\n\nvar notify = function (state, isReject) {\n if (state.notified) return;\n state.notified = true;\n microtask(function () {\n var reactions = state.reactions;\n var reaction;\n while (reaction = reactions.get()) {\n callReaction(reaction, state);\n }\n state.notified = false;\n if (isReject && !state.rejection) onUnhandled(state);\n });\n};\n\nvar dispatchEvent = function (name, promise, reason) {\n var event, handler;\n if (DISPATCH_EVENT) {\n event = document.createEvent('Event');\n event.promise = promise;\n event.reason = reason;\n event.initEvent(name, false, true);\n globalThis.dispatchEvent(event);\n } else event = { promise: promise, reason: reason };\n if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = globalThis['on' + name])) handler(event);\n else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);\n};\n\nvar onUnhandled = function (state) {\n call(task, globalThis, function () {\n var promise = state.facade;\n var value = state.value;\n var IS_UNHANDLED = isUnhandled(state);\n var result;\n if (IS_UNHANDLED) {\n result = perform(function () {\n if (IS_NODE) {\n process.emit('unhandledRejection', value, promise);\n } else dispatchEvent(UNHANDLED_REJECTION, promise, value);\n });\n // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should\n state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;\n if (result.error) throw result.value;\n }\n });\n};\n\nvar isUnhandled = function (state) {\n return state.rejection !== HANDLED && !state.parent;\n};\n\nvar onHandleUnhandled = function (state) {\n call(task, globalThis, function () {\n var promise = state.facade;\n if (IS_NODE) {\n process.emit('rejectionHandled', promise);\n } else dispatchEvent(REJECTION_HANDLED, promise, state.value);\n });\n};\n\nvar bind = function (fn, state, unwrap) {\n return function (value) {\n fn(state, value, unwrap);\n };\n};\n\nvar internalReject = function (state, value, unwrap) {\n if (state.done) return;\n state.done = true;\n if (unwrap) state = unwrap;\n state.value = value;\n state.state = REJECTED;\n notify(state, true);\n};\n\nvar internalResolve = function (state, value, unwrap) {\n if (state.done) return;\n state.done = true;\n if (unwrap) state = unwrap;\n try {\n if (state.facade === value) throw new TypeError(\"Promise can't be resolved itself\");\n var then = isThenable(value);\n if (then) {\n microtask(function () {\n var wrapper = { done: false };\n try {\n call(then, value,\n bind(internalResolve, wrapper, state),\n bind(internalReject, wrapper, state)\n );\n } catch (error) {\n internalReject(wrapper, error, state);\n }\n });\n } else {\n state.value = value;\n state.state = FULFILLED;\n notify(state, false);\n }\n } catch (error) {\n internalReject({ done: false }, error, state);\n }\n};\n\n// constructor polyfill\nif (FORCED_PROMISE_CONSTRUCTOR) {\n // 25.4.3.1 Promise(executor)\n PromiseConstructor = function Promise(executor) {\n anInstance(this, PromisePrototype);\n aCallable(executor);\n call(Internal, this);\n var state = getInternalPromiseState(this);\n try {\n executor(bind(internalResolve, state), bind(internalReject, state));\n } catch (error) {\n internalReject(state, error);\n }\n };\n\n PromisePrototype = PromiseConstructor.prototype;\n\n // eslint-disable-next-line no-unused-vars -- required for `.length`\n Internal = function Promise(executor) {\n setInternalState(this, {\n type: PROMISE,\n done: false,\n notified: false,\n parent: false,\n reactions: new Queue(),\n rejection: false,\n state: PENDING,\n value: null\n });\n };\n\n // `Promise.prototype.then` method\n // https://tc39.es/ecma262/#sec-promise.prototype.then\n Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) {\n var state = getInternalPromiseState(this);\n var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));\n state.parent = true;\n reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;\n reaction.fail = isCallable(onRejected) && onRejected;\n reaction.domain = IS_NODE ? process.domain : undefined;\n if (state.state === PENDING) state.reactions.add(reaction);\n else microtask(function () {\n callReaction(reaction, state);\n });\n return reaction.promise;\n });\n\n OwnPromiseCapability = function () {\n var promise = new Internal();\n var state = getInternalPromiseState(promise);\n this.promise = promise;\n this.resolve = bind(internalResolve, state);\n this.reject = bind(internalReject, state);\n };\n\n newPromiseCapabilityModule.f = newPromiseCapability = function (C) {\n return C === PromiseConstructor || C === PromiseWrapper\n ? new OwnPromiseCapability(C)\n : newGenericPromiseCapability(C);\n };\n\n if (!IS_PURE && isCallable(NativePromiseConstructor) && NativePromisePrototype !== Object.prototype) {\n nativeThen = NativePromisePrototype.then;\n\n if (!NATIVE_PROMISE_SUBCLASSING) {\n // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs\n defineBuiltIn(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {\n var that = this;\n return new PromiseConstructor(function (resolve, reject) {\n call(nativeThen, that, resolve, reject);\n }).then(onFulfilled, onRejected);\n // https://github.com/zloirock/core-js/issues/640\n }, { unsafe: true });\n }\n\n // make `.constructor === Promise` work for native promise-based APIs\n try {\n delete NativePromisePrototype.constructor;\n } catch (error) { /* empty */ }\n\n // make `instanceof Promise` work for native promise-based APIs\n if (setPrototypeOf) {\n setPrototypeOf(NativePromisePrototype, PromisePrototype);\n }\n }\n}\n\n// `Promise` constructor\n// https://tc39.es/ecma262/#sec-promise-executor\n$({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {\n Promise: PromiseConstructor\n});\n\nsetToStringTag(PromiseConstructor, PROMISE, false, true);\nsetSpecies(PROMISE);\n","'use strict';\nvar NativePromiseConstructor = require('../internals/promise-native-constructor');\nvar checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');\nvar FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detection').CONSTRUCTOR;\n\nmodule.exports = FORCED_PROMISE_CONSTRUCTOR || !checkCorrectnessOfIteration(function (iterable) {\n NativePromiseConstructor.all(iterable).then(undefined, function () { /* empty */ });\n});\n","'use strict';\nvar globalThis = require('../internals/global-this');\n\nmodule.exports = globalThis.Promise;\n","'use strict';\nvar fails = require('../internals/fails');\n\nmodule.exports = !fails(function () {\n // eslint-disable-next-line es/no-function-prototype-bind -- safe\n var test = (function () { /* empty */ }).bind();\n // eslint-disable-next-line no-prototype-builtins -- safe\n return typeof test != 'function' || test.hasOwnProperty('prototype');\n});\n","'use strict';\nvar classof = require('../internals/classof');\n\nvar $String = String;\n\nmodule.exports = function (argument) {\n if (classof(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');\n return $String(argument);\n};\n","'use strict';\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\n\nvar $TypeError = TypeError;\n\nmodule.exports = function (it, Prototype) {\n if (isPrototypeOf(Prototype, it)) return it;\n throw new $TypeError('Incorrect invocation');\n};\n","'use strict';\nvar defineProperty = require('../internals/object-define-property').f;\nvar hasOwn = require('../internals/has-own-property');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\n\nmodule.exports = function (target, TAG, STATIC) {\n if (target && !STATIC) target = target.prototype;\n if (target && !hasOwn(target, TO_STRING_TAG)) {\n defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG });\n }\n};\n","'use strict';\nvar ceil = Math.ceil;\nvar floor = Math.floor;\n\n// `Math.trunc` method\n// https://tc39.es/ecma262/#sec-math.trunc\n// eslint-disable-next-line es/no-math-trunc -- safe\nmodule.exports = Math.trunc || function trunc(x) {\n var n = +x;\n return (n > 0 ? floor : ceil)(n);\n};\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\nvar isCallable = require('../internals/is-callable');\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\n\nvar $Object = Object;\n\nmodule.exports = USE_SYMBOL_AS_UID ? function (it) {\n return typeof it == 'symbol';\n} : function (it) {\n var $Symbol = getBuiltIn('Symbol');\n return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));\n};\n","'use strict';\nvar isObject = require('../internals/is-object');\nvar classof = require('../internals/classof-raw');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar MATCH = wellKnownSymbol('match');\n\n// `IsRegExp` abstract operation\n// https://tc39.es/ecma262/#sec-isregexp\nmodule.exports = function (it) {\n var isRegExp;\n return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) === 'RegExp');\n};\n","'use strict';\nvar classof = require('../internals/classof');\nvar getMethod = require('../internals/get-method');\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\nvar Iterators = require('../internals/iterators');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar ITERATOR = wellKnownSymbol('iterator');\n\nmodule.exports = function (it) {\n if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR)\n || getMethod(it, '@@iterator')\n || Iterators[classof(it)];\n};\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar NativePromiseConstructor = require('../internals/promise-native-constructor');\nvar isCallable = require('../internals/is-callable');\nvar isForced = require('../internals/is-forced');\nvar inspectSource = require('../internals/inspect-source');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar ENVIRONMENT = require('../internals/environment');\nvar IS_PURE = require('../internals/is-pure');\nvar V8_VERSION = require('../internals/environment-v8-version');\n\nvar NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;\nvar SPECIES = wellKnownSymbol('species');\nvar SUBCLASSING = false;\nvar NATIVE_PROMISE_REJECTION_EVENT = isCallable(globalThis.PromiseRejectionEvent);\n\nvar FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () {\n var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor);\n var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor);\n // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables\n // https://bugs.chromium.org/p/chromium/issues/detail?id=830565\n // We can't detect it synchronously, so just check versions\n if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;\n // We need Promise#{ catch, finally } in the pure version for preventing prototype pollution\n if (IS_PURE && !(NativePromisePrototype['catch'] && NativePromisePrototype['finally'])) return true;\n // We can't use @@species feature detection in V8 since it causes\n // deoptimization and performance degradation\n // https://github.com/zloirock/core-js/issues/679\n if (!V8_VERSION || V8_VERSION < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) {\n // Detect correctness of subclassing with @@species support\n var promise = new NativePromiseConstructor(function (resolve) { resolve(1); });\n var FakePromise = function (exec) {\n exec(function () { /* empty */ }, function () { /* empty */ });\n };\n var constructor = promise.constructor = {};\n constructor[SPECIES] = FakePromise;\n SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;\n if (!SUBCLASSING) return true;\n // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test\n } return !GLOBAL_CORE_JS_PROMISE && (ENVIRONMENT === 'BROWSER' || ENVIRONMENT === 'DENO') && !NATIVE_PROMISE_REJECTION_EVENT;\n});\n\nmodule.exports = {\n CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR,\n REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT,\n SUBCLASSING: SUBCLASSING\n};\n","'use strict';\nvar aCallable = require('../internals/a-callable');\nvar toObject = require('../internals/to-object');\nvar IndexedObject = require('../internals/indexed-object');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\n\nvar $TypeError = TypeError;\n\nvar REDUCE_EMPTY = 'Reduce of empty array with no initial value';\n\n// `Array.prototype.{ reduce, reduceRight }` methods implementation\nvar createMethod = function (IS_RIGHT) {\n return function (that, callbackfn, argumentsLength, memo) {\n var O = toObject(that);\n var self = IndexedObject(O);\n var length = lengthOfArrayLike(O);\n aCallable(callbackfn);\n if (length === 0 && argumentsLength < 2) throw new $TypeError(REDUCE_EMPTY);\n var index = IS_RIGHT ? length - 1 : 0;\n var i = IS_RIGHT ? -1 : 1;\n if (argumentsLength < 2) while (true) {\n if (index in self) {\n memo = self[index];\n index += i;\n break;\n }\n index += i;\n if (IS_RIGHT ? index < 0 : length <= index) {\n throw new $TypeError(REDUCE_EMPTY);\n }\n }\n for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {\n memo = callbackfn(memo, self[index], index, O);\n }\n return memo;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.reduce` method\n // https://tc39.es/ecma262/#sec-array.prototype.reduce\n left: createMethod(false),\n // `Array.prototype.reduceRight` method\n // https://tc39.es/ecma262/#sec-array.prototype.reduceright\n right: createMethod(true)\n};\n","'use strict';\nvar call = require('../internals/function-call');\nvar hasOwn = require('../internals/has-own-property');\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\nvar regExpFlags = require('../internals/regexp-flags');\n\nvar RegExpPrototype = RegExp.prototype;\n\nmodule.exports = function (R) {\n var flags = R.flags;\n return flags === undefined && !('flags' in RegExpPrototype) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype, R)\n ? call(regExpFlags, R) : flags;\n};\n","'use strict';\nvar defineProperty = require('../internals/object-define-property').f;\n\nmodule.exports = function (Target, Source, key) {\n key in Target || defineProperty(Target, key, {\n configurable: true,\n get: function () { return Source[key]; },\n set: function (it) { Source[key] = it; }\n });\n};\n","'use strict';\nvar internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\n// `Object.keys` method\n// https://tc39.es/ecma262/#sec-object.keys\n// eslint-disable-next-line es/no-object-keys -- safe\nmodule.exports = Object.keys || function keys(O) {\n return internalObjectKeys(O, enumBugKeys);\n};\n","'use strict';\nmodule.exports = function (exec) {\n try {\n return { error: false, value: exec() };\n } catch (error) {\n return { error: true, value: error };\n }\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar iterate = require('../internals/iterate');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\nvar getIteratorDirect = require('../internals/get-iterator-direct');\nvar iteratorClose = require('../internals/iterator-close');\nvar iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');\n\nvar everyWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('every', TypeError);\n\n// `Iterator.prototype.every` method\n// https://tc39.es/ecma262/#sec-iterator.prototype.every\n$({ target: 'Iterator', proto: true, real: true, forced: everyWithoutClosingOnEarlyError }, {\n every: function every(predicate) {\n anObject(this);\n try {\n aCallable(predicate);\n } catch (error) {\n iteratorClose(this, 'throw', error);\n }\n\n if (everyWithoutClosingOnEarlyError) return call(everyWithoutClosingOnEarlyError, this, predicate);\n\n var record = getIteratorDirect(this);\n var counter = 0;\n return !iterate(record, function (value, stop) {\n if (!predicate(value, counter++)) return stop();\n }, { IS_RECORD: true, INTERRUPTED: true }).stopped;\n }\n});\n","'use strict';\nvar NATIVE_WEAK_MAP = require('../internals/weak-map-basic-detection');\nvar globalThis = require('../internals/global-this');\nvar isObject = require('../internals/is-object');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar hasOwn = require('../internals/has-own-property');\nvar shared = require('../internals/shared-store');\nvar sharedKey = require('../internals/shared-key');\nvar hiddenKeys = require('../internals/hidden-keys');\n\nvar OBJECT_ALREADY_INITIALIZED = 'Object already initialized';\nvar TypeError = globalThis.TypeError;\nvar WeakMap = globalThis.WeakMap;\nvar set, get, has;\n\nvar enforce = function (it) {\n return has(it) ? get(it) : set(it, {});\n};\n\nvar getterFor = function (TYPE) {\n return function (it) {\n var state;\n if (!isObject(it) || (state = get(it)).type !== TYPE) {\n throw new TypeError('Incompatible receiver, ' + TYPE + ' required');\n } return state;\n };\n};\n\nif (NATIVE_WEAK_MAP || shared.state) {\n var store = shared.state || (shared.state = new WeakMap());\n /* eslint-disable no-self-assign -- prototype methods protection */\n store.get = store.get;\n store.has = store.has;\n store.set = store.set;\n /* eslint-enable no-self-assign -- prototype methods protection */\n set = function (it, metadata) {\n if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);\n metadata.facade = it;\n store.set(it, metadata);\n return metadata;\n };\n get = function (it) {\n return store.get(it) || {};\n };\n has = function (it) {\n return store.has(it);\n };\n} else {\n var STATE = sharedKey('state');\n hiddenKeys[STATE] = true;\n set = function (it, metadata) {\n if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);\n metadata.facade = it;\n createNonEnumerableProperty(it, STATE, metadata);\n return metadata;\n };\n get = function (it) {\n return hasOwn(it, STATE) ? it[STATE] : {};\n };\n has = function (it) {\n return hasOwn(it, STATE);\n };\n}\n\nmodule.exports = {\n set: set,\n get: get,\n has: has,\n enforce: enforce,\n getterFor: getterFor\n};\n","'use strict';\nvar trunc = require('../internals/math-trunc');\n\n// `ToIntegerOrInfinity` abstract operation\n// https://tc39.es/ecma262/#sec-tointegerorinfinity\nmodule.exports = function (argument) {\n var number = +argument;\n // eslint-disable-next-line no-self-compare -- NaN check\n return number !== number || number === 0 ? 0 : trunc(number);\n};\n","'use strict';\n// TODO: Remove from `core-js@4`\nrequire('../modules/es.iterator.map');\n","'use strict';\nvar $ = require('../internals/export');\nvar newPromiseCapabilityModule = require('../internals/new-promise-capability');\nvar FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detection').CONSTRUCTOR;\n\n// `Promise.reject` method\n// https://tc39.es/ecma262/#sec-promise.reject\n$({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {\n reject: function reject(r) {\n var capability = newPromiseCapabilityModule.f(this);\n var capabilityReject = capability.reject;\n capabilityReject(r);\n return capability.promise;\n }\n});\n","function E () {\n // Keep this empty so it's easier to inherit from\n // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)\n}\n\nE.prototype = {\n on: function (name, callback, ctx) {\n var e = this.e || (this.e = {});\n\n (e[name] || (e[name] = [])).push({\n fn: callback,\n ctx: ctx\n });\n\n return this;\n },\n\n once: function (name, callback, ctx) {\n var self = this;\n function listener () {\n self.off(name, listener);\n callback.apply(ctx, arguments);\n };\n\n listener._ = callback\n return this.on(name, listener, ctx);\n },\n\n emit: function (name) {\n var data = [].slice.call(arguments, 1);\n var evtArr = ((this.e || (this.e = {}))[name] || []).slice();\n var i = 0;\n var len = evtArr.length;\n\n for (i; i < len; i++) {\n evtArr[i].fn.apply(evtArr[i].ctx, data);\n }\n\n return this;\n },\n\n off: function (name, callback) {\n var e = this.e || (this.e = {});\n var evts = e[name];\n var liveEvents = [];\n\n if (evts && callback) {\n for (var i = 0, len = evts.length; i < len; i++) {\n if (evts[i].fn !== callback && evts[i].fn._ !== callback)\n liveEvents.push(evts[i]);\n }\n }\n\n // Remove event from queue to prevent memory leak\n // Suggested by https://github.com/lazd\n // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910\n\n (liveEvents.length)\n ? e[name] = liveEvents\n : delete e[name];\n\n return this;\n }\n};\n\nmodule.exports = E;\nmodule.exports.TinyEmitter = E;\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nmodule.exports = uncurryThis({}.isPrototypeOf);\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\nvar getIteratorDirect = require('../internals/get-iterator-direct');\nvar createIteratorProxy = require('../internals/iterator-create-proxy');\nvar callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');\nvar iteratorClose = require('../internals/iterator-close');\nvar iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');\nvar IS_PURE = require('../internals/is-pure');\n\nvar mapWithoutClosingOnEarlyError = !IS_PURE && iteratorHelperWithoutClosingOnEarlyError('map', TypeError);\n\nvar IteratorProxy = createIteratorProxy(function () {\n var iterator = this.iterator;\n var result = anObject(call(this.next, iterator));\n var done = this.done = !!result.done;\n if (!done) return callWithSafeIterationClosing(iterator, this.mapper, [result.value, this.counter++], true);\n});\n\n// `Iterator.prototype.map` method\n// https://tc39.es/ecma262/#sec-iterator.prototype.map\n$({ target: 'Iterator', proto: true, real: true, forced: IS_PURE || mapWithoutClosingOnEarlyError }, {\n map: function map(mapper) {\n anObject(this);\n try {\n aCallable(mapper);\n } catch (error) {\n iteratorClose(this, 'throw', error);\n }\n\n if (mapWithoutClosingOnEarlyError) return call(mapWithoutClosingOnEarlyError, this, mapper);\n\n return new IteratorProxy(getIteratorDirect(this), {\n mapper: mapper\n });\n }\n});\n","'use strict';\n// `GetIteratorDirect(obj)` abstract operation\n// https://tc39.es/proposal-iterator-helpers/#sec-getiteratordirect\nmodule.exports = function (obj) {\n return {\n iterator: obj,\n next: obj.next,\n done: false\n };\n};\n","'use strict';\n// TODO: Remove from `core-js@4`\nrequire('../modules/es.iterator.to-array');\n","'use strict';\nvar $ = require('../internals/export');\nvar anObject = require('../internals/an-object');\nvar iterate = require('../internals/iterate');\nvar getIteratorDirect = require('../internals/get-iterator-direct');\n\nvar push = [].push;\n\n// `Iterator.prototype.toArray` method\n// https://tc39.es/ecma262/#sec-iterator.prototype.toarray\n$({ target: 'Iterator', proto: true, real: true }, {\n toArray: function toArray() {\n var result = [];\n iterate(getIteratorDirect(anObject(this)), push, { that: result, IS_RECORD: true });\n return result;\n }\n});\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar hasOwn = require('../internals/has-own-property');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar indexOf = require('../internals/array-includes').indexOf;\nvar hiddenKeys = require('../internals/hidden-keys');\n\nvar push = uncurryThis([].push);\n\nmodule.exports = function (object, names) {\n var O = toIndexedObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (hasOwn(O, key = names[i++])) {\n ~indexOf(result, key) || push(result, key);\n }\n return result;\n};\n","/*\r\n * Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license\r\n * Author: Jim Palmer (based on chunking idea from Dave Koelle)\r\n */\r\n/*jshint unused:false */\r\nmodule.exports = function naturalSort (a, b) {\r\n\t\"use strict\";\r\n\tvar re = /(^([+\\-]?(?:0|[1-9]\\d*)(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)?$|^0x[0-9a-f]+$|\\d+)/gi,\r\n\t\tsre = /(^[ ]*|[ ]*$)/g,\r\n\t\tdre = /(^([\\w ]+,?[\\w ]+)?[\\w ]+,?[\\w ]+\\d+:\\d+(:\\d+)?[\\w ]?|^\\d{1,4}[\\/\\-]\\d{1,4}[\\/\\-]\\d{1,4}|^\\w+, \\w+ \\d+, \\d{4})/,\r\n\t\thre = /^0x[0-9a-f]+$/i,\r\n\t\tore = /^0/,\r\n\t\ti = function(s) { return naturalSort.insensitive && ('' + s).toLowerCase() || '' + s; },\r\n\t\t// convert all to strings strip whitespace\r\n\t\tx = i(a).replace(sre, '') || '',\r\n\t\ty = i(b).replace(sre, '') || '',\r\n\t\t// chunk/tokenize\r\n\t\txN = x.replace(re, '\\0$1\\0').replace(/\\0$/,'').replace(/^\\0/,'').split('\\0'),\r\n\t\tyN = y.replace(re, '\\0$1\\0').replace(/\\0$/,'').replace(/^\\0/,'').split('\\0'),\r\n\t\t// numeric, hex or date detection\r\n\t\txD = parseInt(x.match(hre), 16) || (xN.length !== 1 && x.match(dre) && Date.parse(x)),\r\n\t\tyD = parseInt(y.match(hre), 16) || xD && y.match(dre) && Date.parse(y) || null,\r\n\t\toFxNcL, oFyNcL;\r\n\t// first try and sort Hex codes or Dates\r\n\tif (yD) {\r\n\t\tif ( xD < yD ) { return -1; }\r\n\t\telse if ( xD > yD ) { return 1; }\r\n\t}\r\n\t// natural sorting through split numeric strings and default strings\r\n\tfor(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc++) {\r\n\t\t// find floats not starting with '0', string or 0 if not defined (Clint Priest)\r\n\t\toFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0;\r\n\t\toFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0;\r\n\t\t// handle numeric vs string comparison - number < string - (Kyle Adams)\r\n\t\tif (isNaN(oFxNcL) !== isNaN(oFyNcL)) { return (isNaN(oFxNcL)) ? 1 : -1; }\r\n\t\t// rely on string comparison if different types - i.e. '02' < 2 != '02' < '2'\r\n\t\telse if (typeof oFxNcL !== typeof oFyNcL) {\r\n\t\t\toFxNcL += '';\r\n\t\t\toFyNcL += '';\r\n\t\t}\r\n\t\tif (oFxNcL < oFyNcL) { return -1; }\r\n\t\tif (oFxNcL > oFyNcL) { return 1; }\r\n\t}\r\n\treturn 0;\r\n};\r\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar safeGetBuiltIn = require('../internals/safe-get-built-in');\nvar bind = require('../internals/function-bind-context');\nvar macrotask = require('../internals/task').set;\nvar Queue = require('../internals/queue');\nvar IS_IOS = require('../internals/environment-is-ios');\nvar IS_IOS_PEBBLE = require('../internals/environment-is-ios-pebble');\nvar IS_WEBOS_WEBKIT = require('../internals/environment-is-webos-webkit');\nvar IS_NODE = require('../internals/environment-is-node');\n\nvar MutationObserver = globalThis.MutationObserver || globalThis.WebKitMutationObserver;\nvar document = globalThis.document;\nvar process = globalThis.process;\nvar Promise = globalThis.Promise;\nvar microtask = safeGetBuiltIn('queueMicrotask');\nvar notify, toggle, node, promise, then;\n\n// modern engines have queueMicrotask method\nif (!microtask) {\n var queue = new Queue();\n\n var flush = function () {\n var parent, fn;\n if (IS_NODE && (parent = process.domain)) parent.exit();\n while (fn = queue.get()) try {\n fn();\n } catch (error) {\n if (queue.head) notify();\n throw error;\n }\n if (parent) parent.enter();\n };\n\n // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339\n // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898\n if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {\n toggle = true;\n node = document.createTextNode('');\n new MutationObserver(flush).observe(node, { characterData: true });\n notify = function () {\n node.data = toggle = !toggle;\n };\n // environments with maybe non-completely correct, but existent Promise\n } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {\n // Promise.resolve without an argument throws an error in LG WebOS 2\n promise = Promise.resolve(undefined);\n // workaround of WebKit ~ iOS Safari 10.1 bug\n promise.constructor = Promise;\n then = bind(promise.then, promise);\n notify = function () {\n then(flush);\n };\n // Node.js without promises\n } else if (IS_NODE) {\n notify = function () {\n process.nextTick(flush);\n };\n // for other environments - macrotask based on:\n // - setImmediate\n // - MessageChannel\n // - window.postMessage\n // - onreadystatechange\n // - setTimeout\n } else {\n // `webpack` dev server bug on IE global methods - use bind(fn, global)\n macrotask = bind(macrotask, globalThis);\n notify = function () {\n macrotask(flush);\n };\n }\n\n microtask = function (fn) {\n if (!queue.head) notify();\n queue.add(fn);\n };\n}\n\nmodule.exports = microtask;\n","'use strict';\nvar $ = require('../internals/export');\nvar IS_PURE = require('../internals/is-pure');\nvar FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detection').CONSTRUCTOR;\nvar NativePromiseConstructor = require('../internals/promise-native-constructor');\nvar getBuiltIn = require('../internals/get-built-in');\nvar isCallable = require('../internals/is-callable');\nvar defineBuiltIn = require('../internals/define-built-in');\n\nvar NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;\n\n// `Promise.prototype.catch` method\n// https://tc39.es/ecma262/#sec-promise.prototype.catch\n$({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR, real: true }, {\n 'catch': function (onRejected) {\n return this.then(undefined, onRejected);\n }\n});\n\n// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`\nif (!IS_PURE && isCallable(NativePromiseConstructor)) {\n var method = getBuiltIn('Promise').prototype['catch'];\n if (NativePromisePrototype['catch'] !== method) {\n defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });\n }\n}\n","'use strict';\nvar makeBuiltIn = require('../internals/make-built-in');\nvar defineProperty = require('../internals/object-define-property');\n\nmodule.exports = function (target, name, descriptor) {\n if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });\n if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });\n return defineProperty.f(target, name, descriptor);\n};\n","'use strict';\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\nvar test = {};\n\ntest[TO_STRING_TAG] = 'z';\n\nmodule.exports = String(test) === '[object z]';\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nvar toString = uncurryThis({}.toString);\nvar stringSlice = uncurryThis(''.slice);\n\nmodule.exports = function (it) {\n return stringSlice(toString(it), 8, -1);\n};\n","'use strict';\nvar fails = require('../internals/fails');\n\nmodule.exports = !fails(function () {\n function F() { /* empty */ }\n F.prototype.constructor = null;\n // eslint-disable-next-line es/no-object-getprototypeof -- required for testing\n return Object.getPrototypeOf(new F()) !== F.prototype;\n});\n","'use strict';\nvar anObject = require('../internals/an-object');\nvar aConstructor = require('../internals/a-constructor');\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar SPECIES = wellKnownSymbol('species');\n\n// `SpeciesConstructor` abstract operation\n// https://tc39.es/ecma262/#sec-speciesconstructor\nmodule.exports = function (O, defaultConstructor) {\n var C = anObject(O).constructor;\n var S;\n return C === undefined || isNullOrUndefined(S = anObject(C)[SPECIES]) ? defaultConstructor : aConstructor(S);\n};\n","'use strict';\n/* global ActiveXObject -- old IE, WSH */\nvar anObject = require('../internals/an-object');\nvar definePropertiesModule = require('../internals/object-define-properties');\nvar enumBugKeys = require('../internals/enum-bug-keys');\nvar hiddenKeys = require('../internals/hidden-keys');\nvar html = require('../internals/html');\nvar documentCreateElement = require('../internals/document-create-element');\nvar sharedKey = require('../internals/shared-key');\n\nvar GT = '>';\nvar LT = '<';\nvar PROTOTYPE = 'prototype';\nvar SCRIPT = 'script';\nvar IE_PROTO = sharedKey('IE_PROTO');\n\nvar EmptyConstructor = function () { /* empty */ };\n\nvar scriptTag = function (content) {\n return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;\n};\n\n// Create object with fake `null` prototype: use ActiveX Object with cleared prototype\nvar NullProtoObjectViaActiveX = function (activeXDocument) {\n activeXDocument.write(scriptTag(''));\n activeXDocument.close();\n var temp = activeXDocument.parentWindow.Object;\n // eslint-disable-next-line no-useless-assignment -- avoid memory leak\n activeXDocument = null;\n return temp;\n};\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar NullProtoObjectViaIFrame = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = documentCreateElement('iframe');\n var JS = 'java' + SCRIPT + ':';\n var iframeDocument;\n iframe.style.display = 'none';\n html.appendChild(iframe);\n // https://github.com/zloirock/core-js/issues/475\n iframe.src = String(JS);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(scriptTag('document.F=Object'));\n iframeDocument.close();\n return iframeDocument.F;\n};\n\n// Check for document.domain and active x support\n// No need to use active x approach when document.domain is not set\n// see https://github.com/es-shims/es5-shim/issues/150\n// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346\n// avoid IE GC bug\nvar activeXDocument;\nvar NullProtoObject = function () {\n try {\n activeXDocument = new ActiveXObject('htmlfile');\n } catch (error) { /* ignore */ }\n NullProtoObject = typeof document != 'undefined'\n ? document.domain && activeXDocument\n ? NullProtoObjectViaActiveX(activeXDocument) // old IE\n : NullProtoObjectViaIFrame()\n : NullProtoObjectViaActiveX(activeXDocument); // WSH\n var length = enumBugKeys.length;\n while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];\n return NullProtoObject();\n};\n\nhiddenKeys[IE_PROTO] = true;\n\n// `Object.create` method\n// https://tc39.es/ecma262/#sec-object.create\n// eslint-disable-next-line es/no-object-create -- safe\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n EmptyConstructor[PROTOTYPE] = anObject(O);\n result = new EmptyConstructor();\n EmptyConstructor[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = NullProtoObject();\n return Properties === undefined ? result : definePropertiesModule.f(result, Properties);\n};\n","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global[\"'typed'\"] = factory());\n})(this, (function () { 'use strict';\n\n function ok() {\n return true;\n }\n function notOk() {\n return false;\n }\n function undef() {\n return undefined;\n }\n const NOT_TYPED_FUNCTION = 'Argument is not a typed-function.';\n\n /**\n * @typedef {{\n * params: Param[],\n * fn: function,\n * test: function,\n * implementation: function\n * }} Signature\n *\n * @typedef {{\n * types: Type[],\n * hasAny: boolean,\n * hasConversion: boolean,\n * restParam: boolean\n * }} Param\n *\n * @typedef {{\n * name: string,\n * typeIndex: number,\n * test: function,\n * isAny: boolean,\n * conversion?: ConversionDef,\n * conversionIndex: number,\n * }} Type\n *\n * @typedef {{\n * from: string,\n * to: string,\n * convert: function (*) : *\n * }} ConversionDef\n *\n * @typedef {{\n * name: string,\n * test: function(*) : boolean,\n * isAny?: boolean\n * }} TypeDef\n */\n\n /**\n * @returns {() => function}\n */\n function create() {\n // data type tests\n\n /**\n * Returns true if the argument is a non-null \"plain\" object\n */\n function isPlainObject(x) {\n return typeof x === 'object' && x !== null && x.constructor === Object;\n }\n const _types = [{\n name: 'number',\n test: function (x) {\n return typeof x === 'number';\n }\n }, {\n name: 'string',\n test: function (x) {\n return typeof x === 'string';\n }\n }, {\n name: 'boolean',\n test: function (x) {\n return typeof x === 'boolean';\n }\n }, {\n name: 'Function',\n test: function (x) {\n return typeof x === 'function';\n }\n }, {\n name: 'Array',\n test: Array.isArray\n }, {\n name: 'Date',\n test: function (x) {\n return x instanceof Date;\n }\n }, {\n name: 'RegExp',\n test: function (x) {\n return x instanceof RegExp;\n }\n }, {\n name: 'Object',\n test: isPlainObject\n }, {\n name: 'null',\n test: function (x) {\n return x === null;\n }\n }, {\n name: 'undefined',\n test: function (x) {\n return x === undefined;\n }\n }];\n const anyType = {\n name: 'any',\n test: ok,\n isAny: true\n };\n\n // Data structures to track the types. As these are local variables in\n // create(), each typed universe will get its own copy, but the variables\n // will only be accessible through the (closures of the) functions supplied\n // as properties of the typed object, not directly.\n // These will be initialized in clear() below\n let typeMap; // primary store of all types\n let typeList; // Array of just type names, for the sake of ordering\n\n // And similar data structures for the type conversions:\n let nConversions = 0;\n // the actual conversions are stored on a property of the destination types\n\n // This is a temporary object, will be replaced with a function at the end\n let typed = {\n createCount: 0\n };\n\n /**\n * Takes a type name and returns the corresponding official type object\n * for that type.\n *\n * @param {string} typeName\n * @returns {TypeDef} type\n */\n function findType(typeName) {\n const type = typeMap.get(typeName);\n if (type) {\n return type;\n }\n // Remainder is error handling\n let message = 'Unknown type \"' + typeName + '\"';\n const name = typeName.toLowerCase();\n let otherName;\n for (otherName of typeList) {\n if (otherName.toLowerCase() === name) {\n message += '. Did you mean \"' + otherName + '\" ?';\n break;\n }\n }\n throw new TypeError(message);\n }\n\n /**\n * Adds an array `types` of type definitions to this typed instance.\n * Each type definition should be an object with properties:\n * 'name' - a string giving the name of the type; 'test' - function\n * returning a boolean that tests membership in the type; and optionally\n * 'isAny' - true only for the 'any' type.\n *\n * The second optional argument, `before`, gives the name of a type that\n * these types should be added before. The new types are added in the\n * order specified.\n * @param {TypeDef[]} types\n * @param {string | boolean} [beforeSpec='any'] before\n */\n function addTypes(types) {\n let beforeSpec = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'any';\n const beforeIndex = beforeSpec ? findType(beforeSpec).index : typeList.length;\n const newTypes = [];\n for (let i = 0; i < types.length; ++i) {\n if (!types[i] || typeof types[i].name !== 'string' || typeof types[i].test !== 'function') {\n throw new TypeError('Object with properties {name: string, test: function} expected');\n }\n const typeName = types[i].name;\n if (typeMap.has(typeName)) {\n throw new TypeError('Duplicate type name \"' + typeName + '\"');\n }\n newTypes.push(typeName);\n typeMap.set(typeName, {\n name: typeName,\n test: types[i].test,\n isAny: types[i].isAny,\n index: beforeIndex + i,\n conversionsTo: [] // Newly added type can't have any conversions to it\n });\n }\n // update the typeList\n const affectedTypes = typeList.slice(beforeIndex);\n typeList = typeList.slice(0, beforeIndex).concat(newTypes).concat(affectedTypes);\n // Fix the indices\n for (let i = beforeIndex + newTypes.length; i < typeList.length; ++i) {\n typeMap.get(typeList[i]).index = i;\n }\n }\n\n /**\n * Removes all types and conversions from this typed instance.\n * May cause previously constructed typed-functions to throw\n * strange errors when they are called with types that do not\n * match any of their signatures.\n */\n function clear() {\n typeMap = new Map();\n typeList = [];\n nConversions = 0;\n addTypes([anyType], false);\n }\n\n // initialize the types to the default list\n clear();\n addTypes(_types);\n\n /**\n * Removes all conversions, leaving the types alone.\n */\n function clearConversions() {\n let typeName;\n for (typeName of typeList) {\n typeMap.get(typeName).conversionsTo = [];\n }\n nConversions = 0;\n }\n\n /**\n * Find the type names that match a value.\n * @param {*} value\n * @return {string[]} Array of names of types for which\n * the type test matches the value.\n */\n function findTypeNames(value) {\n const matches = typeList.filter(name => {\n const type = typeMap.get(name);\n return !type.isAny && type.test(value);\n });\n if (matches.length) {\n return matches;\n }\n return ['any'];\n }\n\n /**\n * Check if an entity is a typed function created by any instance\n * @param {any} entity\n * @returns {boolean}\n */\n function isTypedFunction(entity) {\n return entity && typeof entity === 'function' && '_typedFunctionData' in entity;\n }\n\n /**\n * Find a specific signature from a (composed) typed function, for example:\n *\n * typed.findSignature(fn, ['number', 'string'])\n * typed.findSignature(fn, 'number, string')\n * typed.findSignature(fn, 'number,string', {exact: true})\n *\n * This function findSignature will by default return the best match to\n * the given signature, possibly employing type conversions.\n *\n * The (optional) third argument is a plain object giving options\n * controlling the signature search. Currently the only implemented\n * option is `exact`: if specified as true (default is false), only\n * exact matches will be returned (i.e. signatures for which `fn` was\n * directly defined). Note that a (possibly different) type matching\n * `any`, or one or more instances of TYPE matching `...TYPE` are\n * considered exact matches in this regard, as no conversions are used.\n *\n * This function returns a \"signature\" object, as does `typed.resolve()`,\n * which is a plain object with four keys: `params` (the array of parameters\n * for this signature), `fn` (the originally supplied function for this\n * signature), `test` (a generated function that determines if an argument\n * list matches this signature, and `implementation` (the function to call\n * on a matching argument list, that performs conversions if necessary and\n * then calls the originally supplied function).\n *\n * @param {Function} fn A typed-function\n * @param {string | string[]} signature\n * Signature to be found, can be an array or a comma separated string.\n * @param {object} options Controls the signature search as documented\n * @return {{ params: Param[], fn: function, test: function, implementation: function }}\n * Returns the matching signature, or throws an error when no signature\n * is found.\n */\n function findSignature(fn, signature, options) {\n if (!isTypedFunction(fn)) {\n throw new TypeError(NOT_TYPED_FUNCTION);\n }\n\n // Canonicalize input\n const exact = options && options.exact;\n const stringSignature = Array.isArray(signature) ? signature.join(',') : signature;\n const params = parseSignature(stringSignature);\n const canonicalSignature = stringifyParams(params);\n\n // First hope we get lucky and exactly match a signature\n if (!exact || canonicalSignature in fn.signatures) {\n // OK, we can check the internal signatures\n const match = fn._typedFunctionData.signatureMap.get(canonicalSignature);\n if (match) {\n return match;\n }\n }\n\n // Oh well, we did not; so we have to go back and check the parameters\n // one by one, in order to catch things like `any` and rest params.\n // Note here we can assume there is at least one parameter, because\n // the empty signature would have matched successfully above.\n const nParams = params.length;\n let remainingSignatures;\n if (exact) {\n remainingSignatures = [];\n let name;\n for (name in fn.signatures) {\n remainingSignatures.push(fn._typedFunctionData.signatureMap.get(name));\n }\n } else {\n remainingSignatures = fn._typedFunctionData.signatures;\n }\n for (let i = 0; i < nParams; ++i) {\n const want = params[i];\n const filteredSignatures = [];\n let possibility;\n for (possibility of remainingSignatures) {\n const have = getParamAtIndex(possibility.params, i);\n if (!have || want.restParam && !have.restParam) {\n continue;\n }\n if (!have.hasAny) {\n // have to check all of the wanted types are available\n const haveTypes = paramTypeSet(have);\n if (want.types.some(wtype => !haveTypes.has(wtype.name))) {\n continue;\n }\n }\n // OK, this looks good\n filteredSignatures.push(possibility);\n }\n remainingSignatures = filteredSignatures;\n if (remainingSignatures.length === 0) break;\n }\n // Return the first remaining signature that was totally matched:\n let candidate;\n for (candidate of remainingSignatures) {\n if (candidate.params.length <= nParams) {\n return candidate;\n }\n }\n throw new TypeError('Signature not found (signature: ' + (fn.name || 'unnamed') + '(' + stringifyParams(params, ', ') + '))');\n }\n\n /**\n * Find the proper function to call for a specific signature from\n * a (composed) typed function, for example:\n *\n * typed.find(fn, ['number', 'string'])\n * typed.find(fn, 'number, string')\n * typed.find(fn, 'number,string', {exact: true})\n *\n * This function find will by default return the best match to\n * the given signature, possibly employing type conversions (and returning\n * a function that will perform those conversions as needed). The\n * (optional) third argument is a plain object giving options contolling\n * the signature search. Currently only the option `exact` is implemented,\n * which defaults to \"false\". If `exact` is specified as true, then only\n * exact matches will be returned (i.e. signatures for which `fn` was\n * directly defined). Uses of `any` and `...TYPE` are considered exact if\n * no conversions are necessary to apply the corresponding function.\n *\n * @param {Function} fn A typed-function\n * @param {string | string[]} signature\n * Signature to be found, can be an array or a comma separated string.\n * @param {object} options Controls the signature match as documented\n * @return {function}\n * Returns the function to call for the given signature, or throws an\n * error if no match is found.\n */\n function find(fn, signature, options) {\n return findSignature(fn, signature, options).implementation;\n }\n\n /**\n * Convert a given value to another data type, specified by type name.\n *\n * @param {*} value\n * @param {string} typeName\n */\n function convert(value, typeName) {\n // check conversion is needed\n const type = findType(typeName);\n if (type.test(value)) {\n return value;\n }\n const conversions = type.conversionsTo;\n if (conversions.length === 0) {\n throw new Error('There are no conversions to ' + typeName + ' defined.');\n }\n for (let i = 0; i < conversions.length; i++) {\n const fromType = findType(conversions[i].from);\n if (fromType.test(value)) {\n return conversions[i].convert(value);\n }\n }\n throw new Error('Cannot convert ' + value + ' to ' + typeName);\n }\n\n /**\n * Stringify parameters in a normalized way\n * @param {Param[]} params\n * @param {string} [','] separator\n * @return {string}\n */\n function stringifyParams(params) {\n let separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';\n return params.map(p => p.name).join(separator);\n }\n\n /**\n * Parse a parameter, like \"...number | boolean\"\n * @param {string} param\n * @return {Param} param\n */\n function parseParam(param) {\n const restParam = param.indexOf('...') === 0;\n const types = !restParam ? param : param.length > 3 ? param.slice(3) : 'any';\n const typeDefs = types.split('|').map(s => findType(s.trim()));\n let hasAny = false;\n let paramName = restParam ? '...' : '';\n const exactTypes = typeDefs.map(function (type) {\n hasAny = type.isAny || hasAny;\n paramName += type.name + '|';\n return {\n name: type.name,\n typeIndex: type.index,\n test: type.test,\n isAny: type.isAny,\n conversion: null,\n conversionIndex: -1\n };\n });\n return {\n types: exactTypes,\n name: paramName.slice(0, -1),\n // remove trailing '|' from above\n hasAny,\n hasConversion: false,\n restParam\n };\n }\n\n /**\n * Expands a parsed parameter with the types available from currently\n * defined conversions.\n * @param {Param} param\n * @return {Param} param\n */\n function expandParam(param) {\n const typeNames = param.types.map(t => t.name);\n const matchingConversions = availableConversions(typeNames);\n let hasAny = param.hasAny;\n let newName = param.name;\n const convertibleTypes = matchingConversions.map(function (conversion) {\n const type = findType(conversion.from);\n hasAny = type.isAny || hasAny;\n newName += '|' + conversion.from;\n return {\n name: conversion.from,\n typeIndex: type.index,\n test: type.test,\n isAny: type.isAny,\n conversion,\n conversionIndex: conversion.index\n };\n });\n return {\n types: param.types.concat(convertibleTypes),\n name: newName,\n hasAny,\n hasConversion: convertibleTypes.length > 0,\n restParam: param.restParam\n };\n }\n\n /**\n * Return the set of type names in a parameter.\n * Caches the result for efficiency\n *\n * @param {Param} param\n * @return {Set} typenames\n */\n function paramTypeSet(param) {\n if (!param.typeSet) {\n param.typeSet = new Set();\n param.types.forEach(type => param.typeSet.add(type.name));\n }\n return param.typeSet;\n }\n\n /**\n * Parse a signature with comma separated parameters,\n * like \"number | boolean, ...string\"\n *\n * @param {string} signature\n * @return {Param[]} params\n */\n function parseSignature(rawSignature) {\n const params = [];\n if (typeof rawSignature !== 'string') {\n throw new TypeError('Signatures must be strings');\n }\n const signature = rawSignature.trim();\n if (signature === '') {\n return params;\n }\n const rawParams = signature.split(',');\n for (let i = 0; i < rawParams.length; ++i) {\n const parsedParam = parseParam(rawParams[i].trim());\n if (parsedParam.restParam && i !== rawParams.length - 1) {\n throw new SyntaxError('Unexpected rest parameter \"' + rawParams[i] + '\": ' + 'only allowed for the last parameter');\n }\n // if invalid, short-circuit (all the types may have been filtered)\n if (parsedParam.types.length === 0) {\n return null;\n }\n params.push(parsedParam);\n }\n return params;\n }\n\n /**\n * Test whether a set of params contains a restParam\n * @param {Param[]} params\n * @return {boolean} Returns true when the last parameter is a restParam\n */\n function hasRestParam(params) {\n const param = last(params);\n return param ? param.restParam : false;\n }\n\n /**\n * Create a type test for a single parameter, which can have one or multiple\n * types.\n * @param {Param} param\n * @return {function(x: *) : boolean} Returns a test function\n */\n function compileTest(param) {\n if (!param || param.types.length === 0) {\n // nothing to do\n return ok;\n } else if (param.types.length === 1) {\n return findType(param.types[0].name).test;\n } else if (param.types.length === 2) {\n const test0 = findType(param.types[0].name).test;\n const test1 = findType(param.types[1].name).test;\n return function or(x) {\n return test0(x) || test1(x);\n };\n } else {\n // param.types.length > 2\n const tests = param.types.map(function (type) {\n return findType(type.name).test;\n });\n return function or(x) {\n for (let i = 0; i < tests.length; i++) {\n if (tests[i](x)) {\n return true;\n }\n }\n return false;\n };\n }\n }\n\n /**\n * Create a test for all parameters of a signature\n * @param {Param[]} params\n * @return {function(args: Array<*>) : boolean}\n */\n function compileTests(params) {\n let tests, test0, test1;\n if (hasRestParam(params)) {\n // variable arguments like '...number'\n tests = initial(params).map(compileTest);\n const varIndex = tests.length;\n const lastTest = compileTest(last(params));\n const testRestParam = function (args) {\n for (let i = varIndex; i < args.length; i++) {\n if (!lastTest(args[i])) {\n return false;\n }\n }\n return true;\n };\n return function testArgs(args) {\n for (let i = 0; i < tests.length; i++) {\n if (!tests[i](args[i])) {\n return false;\n }\n }\n return testRestParam(args) && args.length >= varIndex + 1;\n };\n } else {\n // no variable arguments\n if (params.length === 0) {\n return function testArgs(args) {\n return args.length === 0;\n };\n } else if (params.length === 1) {\n test0 = compileTest(params[0]);\n return function testArgs(args) {\n return test0(args[0]) && args.length === 1;\n };\n } else if (params.length === 2) {\n test0 = compileTest(params[0]);\n test1 = compileTest(params[1]);\n return function testArgs(args) {\n return test0(args[0]) && test1(args[1]) && args.length === 2;\n };\n } else {\n // arguments.length > 2\n tests = params.map(compileTest);\n return function testArgs(args) {\n for (let i = 0; i < tests.length; i++) {\n if (!tests[i](args[i])) {\n return false;\n }\n }\n return args.length === tests.length;\n };\n }\n }\n }\n\n /**\n * Find the parameter at a specific index of a Params list.\n * Handles rest parameters.\n * @param {Param[]} params\n * @param {number} index\n * @return {Param | null} Returns the matching parameter when found,\n * null otherwise.\n */\n function getParamAtIndex(params, index) {\n return index < params.length ? params[index] : hasRestParam(params) ? last(params) : null;\n }\n\n /**\n * Get all type names of a parameter\n * @param {Params[]} params\n * @param {number} index\n * @return {string[]} Returns an array with type names\n */\n function getTypeSetAtIndex(params, index) {\n const param = getParamAtIndex(params, index);\n if (!param) {\n return new Set();\n }\n return paramTypeSet(param);\n }\n\n /**\n * Test whether a type is an exact type or conversion\n * @param {Type} type\n * @return {boolean} Returns true when\n */\n function isExactType(type) {\n return type.conversion === null || type.conversion === undefined;\n }\n\n /**\n * Helper function for creating error messages: create an array with\n * all available types on a specific argument index.\n * @param {Signature[]} signatures\n * @param {number} index\n * @return {string[]} Returns an array with available types\n */\n function mergeExpectedParams(signatures, index) {\n const typeSet = new Set();\n signatures.forEach(signature => {\n const paramSet = getTypeSetAtIndex(signature.params, index);\n let name;\n for (name of paramSet) {\n typeSet.add(name);\n }\n });\n return typeSet.has('any') ? ['any'] : Array.from(typeSet);\n }\n\n /**\n * Create\n * @param {string} name The name of the function\n * @param {array.<*>} args The actual arguments passed to the function\n * @param {Signature[]} signatures A list with available signatures\n * @return {TypeError} Returns a type error with additional data\n * attached to it in the property `data`\n */\n function createError(name, args, signatures) {\n let err, expected;\n const _name = name || 'unnamed';\n\n // test for wrong type at some index\n let matchingSignatures = signatures;\n let index;\n for (index = 0; index < args.length; index++) {\n const nextMatchingDefs = [];\n matchingSignatures.forEach(signature => {\n const param = getParamAtIndex(signature.params, index);\n const test = compileTest(param);\n if ((index < signature.params.length || hasRestParam(signature.params)) && test(args[index])) {\n nextMatchingDefs.push(signature);\n }\n });\n if (nextMatchingDefs.length === 0) {\n // no matching signatures anymore, throw error \"wrong type\"\n expected = mergeExpectedParams(matchingSignatures, index);\n if (expected.length > 0) {\n const actualTypes = findTypeNames(args[index]);\n err = new TypeError('Unexpected type of argument in function ' + _name + ' (expected: ' + expected.join(' or ') + ', actual: ' + actualTypes.join(' | ') + ', index: ' + index + ')');\n err.data = {\n category: 'wrongType',\n fn: _name,\n index,\n actual: actualTypes,\n expected\n };\n return err;\n }\n } else {\n matchingSignatures = nextMatchingDefs;\n }\n }\n\n // test for too few arguments\n const lengths = matchingSignatures.map(function (signature) {\n return hasRestParam(signature.params) ? Infinity : signature.params.length;\n });\n if (args.length < Math.min.apply(null, lengths)) {\n expected = mergeExpectedParams(matchingSignatures, index);\n err = new TypeError('Too few arguments in function ' + _name + ' (expected: ' + expected.join(' or ') + ', index: ' + args.length + ')');\n err.data = {\n category: 'tooFewArgs',\n fn: _name,\n index: args.length,\n expected\n };\n return err;\n }\n\n // test for too many arguments\n const maxLength = Math.max.apply(null, lengths);\n if (args.length > maxLength) {\n err = new TypeError('Too many arguments in function ' + _name + ' (expected: ' + maxLength + ', actual: ' + args.length + ')');\n err.data = {\n category: 'tooManyArgs',\n fn: _name,\n index: args.length,\n expectedLength: maxLength\n };\n return err;\n }\n\n // Generic error\n const argTypes = [];\n for (let i = 0; i < args.length; ++i) {\n argTypes.push(findTypeNames(args[i]).join('|'));\n }\n err = new TypeError('Arguments of type \"' + argTypes.join(', ') + '\" do not match any of the defined signatures of function ' + _name + '.');\n err.data = {\n category: 'mismatch',\n actual: argTypes\n };\n return err;\n }\n\n /**\n * Find the lowest index of all exact types of a parameter (no conversions)\n * @param {Param} param\n * @return {number} Returns the index of the lowest type in typed.types\n */\n function getLowestTypeIndex(param) {\n let min = typeList.length + 1;\n for (let i = 0; i < param.types.length; i++) {\n if (isExactType(param.types[i])) {\n min = Math.min(min, param.types[i].typeIndex);\n }\n }\n return min;\n }\n\n /**\n * Find the lowest index of the conversion of all types of the parameter\n * having a conversion\n * @param {Param} param\n * @return {number} Returns the lowest index of the conversions of this type\n */\n function getLowestConversionIndex(param) {\n let min = nConversions + 1;\n for (let i = 0; i < param.types.length; i++) {\n if (!isExactType(param.types[i])) {\n min = Math.min(min, param.types[i].conversionIndex);\n }\n }\n return min;\n }\n\n /**\n * Compare two params\n * @param {Param} param1\n * @param {Param} param2\n * @return {number} returns -1 when param1 must get a lower\n * index than param2, 1 when the opposite,\n * or zero when both are equal\n */\n function compareParams(param1, param2) {\n // We compare a number of metrics on a param in turn:\n // 1) 'any' parameters are the least preferred\n if (param1.hasAny) {\n if (!param2.hasAny) {\n return 1;\n }\n } else if (param2.hasAny) {\n return -1;\n }\n\n // 2) Prefer non-rest to rest parameters\n if (param1.restParam) {\n if (!param2.restParam) {\n return 1;\n }\n } else if (param2.restParam) {\n return -1;\n }\n\n // 3) Prefer exact type match to conversions\n if (param1.hasConversion) {\n if (!param2.hasConversion) {\n return 1;\n }\n } else if (param2.hasConversion) {\n return -1;\n }\n\n // 4) Prefer lower type index:\n const typeDiff = getLowestTypeIndex(param1) - getLowestTypeIndex(param2);\n if (typeDiff < 0) {\n return -1;\n }\n if (typeDiff > 0) {\n return 1;\n }\n\n // 5) Prefer lower conversion index\n const convDiff = getLowestConversionIndex(param1) - getLowestConversionIndex(param2);\n if (convDiff < 0) {\n return -1;\n }\n if (convDiff > 0) {\n return 1;\n }\n\n // Don't have a basis for preference\n return 0;\n }\n\n /**\n * Compare two signatures\n * @param {Signature} signature1\n * @param {Signature} signature2\n * @return {number} returns a negative number when param1 must get a lower\n * index than param2, a positive number when the opposite,\n * or zero when both are equal\n */\n function compareSignatures(signature1, signature2) {\n const pars1 = signature1.params;\n const pars2 = signature2.params;\n const last1 = last(pars1);\n const last2 = last(pars2);\n const hasRest1 = hasRestParam(pars1);\n const hasRest2 = hasRestParam(pars2);\n // We compare a number of metrics on signatures in turn:\n // 1) An \"any rest param\" is least preferred\n if (hasRest1 && last1.hasAny) {\n if (!hasRest2 || !last2.hasAny) {\n return 1;\n }\n } else if (hasRest2 && last2.hasAny) {\n return -1;\n }\n\n // 2) Minimize the number of 'any' parameters\n let any1 = 0;\n let conv1 = 0;\n let par;\n for (par of pars1) {\n if (par.hasAny) ++any1;\n if (par.hasConversion) ++conv1;\n }\n let any2 = 0;\n let conv2 = 0;\n for (par of pars2) {\n if (par.hasAny) ++any2;\n if (par.hasConversion) ++conv2;\n }\n if (any1 !== any2) {\n return any1 - any2;\n }\n\n // 3) A conversion rest param is less preferred\n if (hasRest1 && last1.hasConversion) {\n if (!hasRest2 || !last2.hasConversion) {\n return 1;\n }\n } else if (hasRest2 && last2.hasConversion) {\n return -1;\n }\n\n // 4) Minimize the number of conversions\n if (conv1 !== conv2) {\n return conv1 - conv2;\n }\n\n // 5) Prefer no rest param\n if (hasRest1) {\n if (!hasRest2) {\n return 1;\n }\n } else if (hasRest2) {\n return -1;\n }\n\n // 6) Prefer shorter with rest param, longer without\n const lengthCriterion = (pars1.length - pars2.length) * (hasRest1 ? -1 : 1);\n if (lengthCriterion !== 0) {\n return lengthCriterion;\n }\n\n // Signatures are identical in each of the above metrics.\n // In particular, they are the same length.\n // We can therefore compare the parameters one by one.\n // First we count which signature has more preferred parameters.\n const comparisons = [];\n let tc = 0;\n for (let i = 0; i < pars1.length; ++i) {\n const thisComparison = compareParams(pars1[i], pars2[i]);\n comparisons.push(thisComparison);\n tc += thisComparison;\n }\n if (tc !== 0) {\n return tc;\n }\n\n // They have the same number of preferred parameters, so go by the\n // earliest parameter in which we have a preference.\n // In other words, dispatch is driven somewhat more by earlier\n // parameters than later ones.\n let c;\n for (c of comparisons) {\n if (c !== 0) {\n return c;\n }\n }\n\n // It's a tossup:\n return 0;\n }\n\n /**\n * Produce a list of all conversions from distinct types to one of\n * the given types.\n *\n * @param {string[]} typeNames\n * @return {ConversionDef[]} Returns the conversions that are available\n * resulting in any given type (if any)\n */\n function availableConversions(typeNames) {\n if (typeNames.length === 0) {\n return [];\n }\n const types = typeNames.map(findType);\n if (typeNames.length > 1) {\n types.sort((t1, t2) => t1.index - t2.index);\n }\n let matches = types[0].conversionsTo;\n if (typeNames.length === 1) {\n return matches;\n }\n matches = matches.concat([]); // shallow copy the matches\n // Since the types are now in index order, we just want the first\n // occurrence of any from type:\n const knownTypes = new Set(typeNames);\n for (let i = 1; i < types.length; ++i) {\n let newMatch;\n for (newMatch of types[i].conversionsTo) {\n if (!knownTypes.has(newMatch.from)) {\n matches.push(newMatch);\n knownTypes.add(newMatch.from);\n }\n }\n }\n return matches;\n }\n\n /**\n * Preprocess arguments before calling the original function:\n * - if needed convert the parameters\n * - in case of rest parameters, move the rest parameters into an Array\n * @param {Param[]} params\n * @param {function} fn\n * @return {function} Returns a wrapped function\n */\n function compileArgsPreprocessing(params, fn) {\n let fnConvert = fn;\n\n // TODO: can we make this wrapper function smarter/simpler?\n\n if (params.some(p => p.hasConversion)) {\n const restParam = hasRestParam(params);\n const compiledConversions = params.map(compileArgConversion);\n fnConvert = function convertArgs() {\n const args = [];\n const last = restParam ? arguments.length - 1 : arguments.length;\n for (let i = 0; i < last; i++) {\n args[i] = compiledConversions[i](arguments[i]);\n }\n if (restParam) {\n args[last] = arguments[last].map(compiledConversions[last]);\n }\n return fn.apply(this, args);\n };\n }\n let fnPreprocess = fnConvert;\n if (hasRestParam(params)) {\n const offset = params.length - 1;\n fnPreprocess = function preprocessRestParams() {\n return fnConvert.apply(this, slice(arguments, 0, offset).concat([slice(arguments, offset)]));\n };\n }\n return fnPreprocess;\n }\n\n /**\n * Compile conversion for a parameter to the right type\n * @param {Param} param\n * @return {function} Returns the wrapped function that will convert arguments\n *\n */\n function compileArgConversion(param) {\n let test0, test1, conversion0, conversion1;\n const tests = [];\n const conversions = [];\n param.types.forEach(function (type) {\n if (type.conversion) {\n tests.push(findType(type.conversion.from).test);\n conversions.push(type.conversion.convert);\n }\n });\n\n // create optimized conversion functions depending on the number of conversions\n switch (conversions.length) {\n case 0:\n return function convertArg(arg) {\n return arg;\n };\n case 1:\n test0 = tests[0];\n conversion0 = conversions[0];\n return function convertArg(arg) {\n if (test0(arg)) {\n return conversion0(arg);\n }\n return arg;\n };\n case 2:\n test0 = tests[0];\n test1 = tests[1];\n conversion0 = conversions[0];\n conversion1 = conversions[1];\n return function convertArg(arg) {\n if (test0(arg)) {\n return conversion0(arg);\n }\n if (test1(arg)) {\n return conversion1(arg);\n }\n return arg;\n };\n default:\n return function convertArg(arg) {\n for (let i = 0; i < conversions.length; i++) {\n if (tests[i](arg)) {\n return conversions[i](arg);\n }\n }\n return arg;\n };\n }\n }\n\n /**\n * Split params with union types in to separate params.\n *\n * For example:\n *\n * splitParams([['Array', 'Object'], ['string', 'RegExp'])\n * // returns:\n * // [\n * // ['Array', 'string'],\n * // ['Array', 'RegExp'],\n * // ['Object', 'string'],\n * // ['Object', 'RegExp']\n * // ]\n *\n * @param {Param[]} params\n * @return {Param[]}\n */\n function splitParams(params) {\n function _splitParams(params, index, paramsSoFar) {\n if (index < params.length) {\n const param = params[index];\n let resultingParams = [];\n if (param.restParam) {\n // split the types of a rest parameter in two:\n // one with only exact types, and one with exact types and conversions\n const exactTypes = param.types.filter(isExactType);\n if (exactTypes.length < param.types.length) {\n resultingParams.push({\n types: exactTypes,\n name: '...' + exactTypes.map(t => t.name).join('|'),\n hasAny: exactTypes.some(t => t.isAny),\n hasConversion: false,\n restParam: true\n });\n }\n resultingParams.push(param);\n } else {\n // split all the types of a regular parameter into one type per param\n resultingParams = param.types.map(function (type) {\n return {\n types: [type],\n name: type.name,\n hasAny: type.isAny,\n hasConversion: type.conversion,\n restParam: false\n };\n });\n }\n\n // recurse over the groups with types\n return flatMap(resultingParams, function (nextParam) {\n return _splitParams(params, index + 1, paramsSoFar.concat([nextParam]));\n });\n } else {\n // we've reached the end of the parameters.\n return [paramsSoFar];\n }\n }\n return _splitParams(params, 0, []);\n }\n\n /**\n * Test whether two param lists represent conflicting signatures\n * @param {Param[]} params1\n * @param {Param[]} params2\n * @return {boolean} Returns true when the signatures conflict, false otherwise.\n */\n function conflicting(params1, params2) {\n const ii = Math.max(params1.length, params2.length);\n for (let i = 0; i < ii; i++) {\n const typeSet1 = getTypeSetAtIndex(params1, i);\n const typeSet2 = getTypeSetAtIndex(params2, i);\n let overlap = false;\n let name;\n for (name of typeSet2) {\n if (typeSet1.has(name)) {\n overlap = true;\n break;\n }\n }\n if (!overlap) {\n return false;\n }\n }\n const len1 = params1.length;\n const len2 = params2.length;\n const restParam1 = hasRestParam(params1);\n const restParam2 = hasRestParam(params2);\n return restParam1 ? restParam2 ? len1 === len2 : len2 >= len1 : restParam2 ? len1 >= len2 : len1 === len2;\n }\n\n /**\n * Helper function for `resolveReferences` that returns a copy of\n * functionList wihe any prior resolutions cleared out, in case we are\n * recycling signatures from a prior typed function construction.\n *\n * @param {Array.} functionList\n * @return {Array.}\n */\n function clearResolutions(functionList) {\n return functionList.map(fn => {\n if (isReferToSelf(fn)) {\n return referToSelf(fn.referToSelf.callback);\n }\n if (isReferTo(fn)) {\n return makeReferTo(fn.referTo.references, fn.referTo.callback);\n }\n return fn;\n });\n }\n\n /**\n * Take a list of references, a list of functions functionList, and a\n * signatureMap indexing signatures into functionList, and return\n * the list of resolutions, or a false-y value if they don't all\n * resolve in a valid way (yet).\n *\n * @param {string[]} references\n * @param {Array} signatureMap\n * @return {function[] | false} resolutions\n */\n function collectResolutions(references, functionList, signatureMap) {\n const resolvedReferences = [];\n let reference;\n for (reference of references) {\n let resolution = signatureMap[reference];\n if (typeof resolution !== 'number') {\n throw new TypeError('No definition for referenced signature \"' + reference + '\"');\n }\n resolution = functionList[resolution];\n if (typeof resolution !== 'function') {\n return false;\n }\n resolvedReferences.push(resolution);\n }\n return resolvedReferences;\n }\n\n /**\n * Resolve any references in the functionList for the typed function\n * itself. The signatureMap tells which index in the functionList a\n * given signature should be mapped to (for use in resolving typed.referTo)\n * and self provides the destions of a typed.referToSelf.\n *\n * @param {Array} functionList\n * @param {Object.} signatureMap\n * @param {function} self The typed-function itself\n * @return {Array} The list of resolved functions\n */\n function resolveReferences(functionList, signatureMap, self) {\n const resolvedFunctions = clearResolutions(functionList);\n const isResolved = new Array(resolvedFunctions.length).fill(false);\n let leftUnresolved = true;\n while (leftUnresolved) {\n leftUnresolved = false;\n let nothingResolved = true;\n for (let i = 0; i < resolvedFunctions.length; ++i) {\n if (isResolved[i]) continue;\n const fn = resolvedFunctions[i];\n if (isReferToSelf(fn)) {\n resolvedFunctions[i] = fn.referToSelf.callback(self);\n // Preserve reference in case signature is reused someday:\n resolvedFunctions[i].referToSelf = fn.referToSelf;\n isResolved[i] = true;\n nothingResolved = false;\n } else if (isReferTo(fn)) {\n const resolvedReferences = collectResolutions(fn.referTo.references, resolvedFunctions, signatureMap);\n if (resolvedReferences) {\n resolvedFunctions[i] = fn.referTo.callback.apply(this, resolvedReferences);\n // Preserve reference in case signature is reused someday:\n resolvedFunctions[i].referTo = fn.referTo;\n isResolved[i] = true;\n nothingResolved = false;\n } else {\n leftUnresolved = true;\n }\n }\n }\n if (nothingResolved && leftUnresolved) {\n throw new SyntaxError('Circular reference detected in resolving typed.referTo');\n }\n }\n return resolvedFunctions;\n }\n\n /**\n * Validate whether any of the function bodies contains a self-reference\n * usage like `this(...)` or `this.signatures`. This self-referencing is\n * deprecated since typed-function v3. It has been replaced with\n * the functions typed.referTo and typed.referToSelf.\n * @param {Object.} signaturesMap\n */\n function validateDeprecatedThis(signaturesMap) {\n // TODO: remove this deprecation warning logic some day (it's introduced in v3)\n\n // match occurrences like 'this(' and 'this.signatures'\n const deprecatedThisRegex = /\\bthis(\\(|\\.signatures\\b)/;\n Object.keys(signaturesMap).forEach(signature => {\n const fn = signaturesMap[signature];\n if (deprecatedThisRegex.test(fn.toString())) {\n throw new SyntaxError('Using `this` to self-reference a function ' + 'is deprecated since typed-function@3. ' + 'Use typed.referTo and typed.referToSelf instead.');\n }\n });\n }\n\n /**\n * Create a typed function\n * @param {String} name The name for the typed function\n * @param {Object.} rawSignaturesMap\n * An object with one or\n * multiple signatures as key, and the\n * function corresponding to the\n * signature as value.\n * @return {function} Returns the created typed function.\n */\n function createTypedFunction(name, rawSignaturesMap) {\n typed.createCount++;\n if (Object.keys(rawSignaturesMap).length === 0) {\n throw new SyntaxError('No signatures provided');\n }\n if (typed.warnAgainstDeprecatedThis) {\n validateDeprecatedThis(rawSignaturesMap);\n }\n\n // Main processing loop for signatures\n const parsedParams = [];\n const originalFunctions = [];\n const signaturesMap = {};\n const preliminarySignatures = []; // may have duplicates from conversions\n let signature;\n for (signature in rawSignaturesMap) {\n // A) Protect against polluted Object prototype:\n if (!Object.prototype.hasOwnProperty.call(rawSignaturesMap, signature)) {\n continue;\n }\n // B) Parse the signature\n const params = parseSignature(signature);\n if (!params) continue;\n // C) Check for conflicts\n parsedParams.forEach(function (pp) {\n if (conflicting(pp, params)) {\n throw new TypeError('Conflicting signatures \"' + stringifyParams(pp) + '\" and \"' + stringifyParams(params) + '\".');\n }\n });\n parsedParams.push(params);\n // D) Store the provided function and add conversions\n const functionIndex = originalFunctions.length;\n originalFunctions.push(rawSignaturesMap[signature]);\n const conversionParams = params.map(expandParam);\n // E) Split the signatures and collect them up\n let sp;\n for (sp of splitParams(conversionParams)) {\n const spName = stringifyParams(sp);\n preliminarySignatures.push({\n params: sp,\n name: spName,\n fn: functionIndex\n });\n if (sp.every(p => !p.hasConversion)) {\n signaturesMap[spName] = functionIndex;\n }\n }\n }\n preliminarySignatures.sort(compareSignatures);\n\n // Note the forward reference to theTypedFn\n const resolvedFunctions = resolveReferences(originalFunctions, signaturesMap, theTypedFn);\n\n // Fill in the proper function for each signature\n let s;\n for (s in signaturesMap) {\n if (Object.prototype.hasOwnProperty.call(signaturesMap, s)) {\n signaturesMap[s] = resolvedFunctions[signaturesMap[s]];\n }\n }\n const signatures = [];\n const internalSignatureMap = new Map(); // benchmarks faster than object\n for (s of preliminarySignatures) {\n // Note it's only safe to eliminate duplicates like this\n // _after_ the signature sorting step above; otherwise we might\n // remove the wrong one.\n if (!internalSignatureMap.has(s.name)) {\n s.fn = resolvedFunctions[s.fn];\n signatures.push(s);\n internalSignatureMap.set(s.name, s);\n }\n }\n\n // we create a highly optimized checks for the first couple of signatures with max 2 arguments\n const ok0 = signatures[0] && signatures[0].params.length <= 2 && !hasRestParam(signatures[0].params);\n const ok1 = signatures[1] && signatures[1].params.length <= 2 && !hasRestParam(signatures[1].params);\n const ok2 = signatures[2] && signatures[2].params.length <= 2 && !hasRestParam(signatures[2].params);\n const ok3 = signatures[3] && signatures[3].params.length <= 2 && !hasRestParam(signatures[3].params);\n const ok4 = signatures[4] && signatures[4].params.length <= 2 && !hasRestParam(signatures[4].params);\n const ok5 = signatures[5] && signatures[5].params.length <= 2 && !hasRestParam(signatures[5].params);\n const allOk = ok0 && ok1 && ok2 && ok3 && ok4 && ok5;\n\n // compile the tests\n for (let i = 0; i < signatures.length; ++i) {\n signatures[i].test = compileTests(signatures[i].params);\n }\n const test00 = ok0 ? compileTest(signatures[0].params[0]) : notOk;\n const test10 = ok1 ? compileTest(signatures[1].params[0]) : notOk;\n const test20 = ok2 ? compileTest(signatures[2].params[0]) : notOk;\n const test30 = ok3 ? compileTest(signatures[3].params[0]) : notOk;\n const test40 = ok4 ? compileTest(signatures[4].params[0]) : notOk;\n const test50 = ok5 ? compileTest(signatures[5].params[0]) : notOk;\n const test01 = ok0 ? compileTest(signatures[0].params[1]) : notOk;\n const test11 = ok1 ? compileTest(signatures[1].params[1]) : notOk;\n const test21 = ok2 ? compileTest(signatures[2].params[1]) : notOk;\n const test31 = ok3 ? compileTest(signatures[3].params[1]) : notOk;\n const test41 = ok4 ? compileTest(signatures[4].params[1]) : notOk;\n const test51 = ok5 ? compileTest(signatures[5].params[1]) : notOk;\n\n // compile the functions\n for (let i = 0; i < signatures.length; ++i) {\n signatures[i].implementation = compileArgsPreprocessing(signatures[i].params, signatures[i].fn);\n }\n const fn0 = ok0 ? signatures[0].implementation : undef;\n const fn1 = ok1 ? signatures[1].implementation : undef;\n const fn2 = ok2 ? signatures[2].implementation : undef;\n const fn3 = ok3 ? signatures[3].implementation : undef;\n const fn4 = ok4 ? signatures[4].implementation : undef;\n const fn5 = ok5 ? signatures[5].implementation : undef;\n const len0 = ok0 ? signatures[0].params.length : -1;\n const len1 = ok1 ? signatures[1].params.length : -1;\n const len2 = ok2 ? signatures[2].params.length : -1;\n const len3 = ok3 ? signatures[3].params.length : -1;\n const len4 = ok4 ? signatures[4].params.length : -1;\n const len5 = ok5 ? signatures[5].params.length : -1;\n\n // simple and generic, but also slow\n const iStart = allOk ? 6 : 0;\n const iEnd = signatures.length;\n // de-reference ahead for execution speed:\n const tests = signatures.map(s => s.test);\n const fns = signatures.map(s => s.implementation);\n const generic = function generic() {\n\n for (let i = iStart; i < iEnd; i++) {\n if (tests[i](arguments)) {\n return fns[i].apply(this, arguments);\n }\n }\n return typed.onMismatch(name, arguments, signatures);\n };\n\n // create the typed function\n // fast, specialized version. Falls back to the slower, generic one if needed\n function theTypedFn(arg0, arg1) {\n\n if (arguments.length === len0 && test00(arg0) && test01(arg1)) {\n return fn0.apply(this, arguments);\n }\n if (arguments.length === len1 && test10(arg0) && test11(arg1)) {\n return fn1.apply(this, arguments);\n }\n if (arguments.length === len2 && test20(arg0) && test21(arg1)) {\n return fn2.apply(this, arguments);\n }\n if (arguments.length === len3 && test30(arg0) && test31(arg1)) {\n return fn3.apply(this, arguments);\n }\n if (arguments.length === len4 && test40(arg0) && test41(arg1)) {\n return fn4.apply(this, arguments);\n }\n if (arguments.length === len5 && test50(arg0) && test51(arg1)) {\n return fn5.apply(this, arguments);\n }\n return generic.apply(this, arguments);\n }\n\n // attach name the typed function\n try {\n Object.defineProperty(theTypedFn, 'name', {\n value: name\n });\n } catch (err) {\n // old browsers do not support Object.defineProperty and some don't support setting the name property\n // the function name is not essential for the functioning, it's mostly useful for debugging,\n // so it's fine to have unnamed functions.\n }\n\n // attach signatures to the function.\n // This property is close to the original collection of signatures\n // used to create the typed-function, just with unions split:\n theTypedFn.signatures = signaturesMap;\n\n // Store internal data for functions like resolve, find, etc.\n // Also serves as the flag that this is a typed-function\n theTypedFn._typedFunctionData = {\n signatures,\n signatureMap: internalSignatureMap\n };\n return theTypedFn;\n }\n\n /**\n * Action to take on mismatch\n * @param {string} name Name of function that was attempted to be called\n * @param {Array} args Actual arguments to the call\n * @param {Array} signatures Known signatures of the named typed-function\n */\n function _onMismatch(name, args, signatures) {\n throw createError(name, args, signatures);\n }\n\n /**\n * Return all but the last items of an array or function Arguments\n * @param {Array | Arguments} arr\n * @return {Array}\n */\n function initial(arr) {\n return slice(arr, 0, arr.length - 1);\n }\n\n /**\n * return the last item of an array or function Arguments\n * @param {Array | Arguments} arr\n * @return {*}\n */\n function last(arr) {\n return arr[arr.length - 1];\n }\n\n /**\n * Slice an array or function Arguments\n * @param {Array | Arguments | IArguments} arr\n * @param {number} start\n * @param {number} [end]\n * @return {Array}\n */\n function slice(arr, start, end) {\n return Array.prototype.slice.call(arr, start, end);\n }\n\n /**\n * Return the first item from an array for which test(arr[i]) returns true\n * @param {Array} arr\n * @param {function} test\n * @return {* | undefined} Returns the first matching item\n * or undefined when there is no match\n */\n function findInArray(arr, test) {\n for (let i = 0; i < arr.length; i++) {\n if (test(arr[i])) {\n return arr[i];\n }\n }\n return undefined;\n }\n\n /**\n * Flat map the result invoking a callback for every item in an array.\n * https://gist.github.com/samgiles/762ee337dff48623e729\n * @param {Array} arr\n * @param {function} callback\n * @return {Array}\n */\n function flatMap(arr, callback) {\n return Array.prototype.concat.apply([], arr.map(callback));\n }\n\n /**\n * Create a reference callback to one or multiple signatures\n *\n * Syntax:\n *\n * typed.referTo(signature1, signature2, ..., function callback(fn1, fn2, ...) {\n * // ...\n * })\n *\n * @returns {{referTo: {references: string[], callback}}}\n */\n function referTo() {\n const references = initial(arguments).map(s => stringifyParams(parseSignature(s)));\n const callback = last(arguments);\n if (typeof callback !== 'function') {\n throw new TypeError('Callback function expected as last argument');\n }\n return makeReferTo(references, callback);\n }\n function makeReferTo(references, callback) {\n return {\n referTo: {\n references,\n callback\n }\n };\n }\n\n /**\n * Create a reference callback to the typed-function itself\n *\n * @param {(self: function) => function} callback\n * @returns {{referToSelf: { callback: function }}}\n */\n function referToSelf(callback) {\n if (typeof callback !== 'function') {\n throw new TypeError('Callback function expected as first argument');\n }\n return {\n referToSelf: {\n callback\n }\n };\n }\n\n /**\n * Test whether something is a referTo object, holding a list with reference\n * signatures and a callback.\n *\n * @param {Object | function} objectOrFn\n * @returns {boolean}\n */\n function isReferTo(objectOrFn) {\n return objectOrFn && typeof objectOrFn.referTo === 'object' && Array.isArray(objectOrFn.referTo.references) && typeof objectOrFn.referTo.callback === 'function';\n }\n\n /**\n * Test whether something is a referToSelf object, holding a callback where\n * to pass `self`.\n *\n * @param {Object | function} objectOrFn\n * @returns {boolean}\n */\n function isReferToSelf(objectOrFn) {\n return objectOrFn && typeof objectOrFn.referToSelf === 'object' && typeof objectOrFn.referToSelf.callback === 'function';\n }\n\n /**\n * Check if name is (A) new, (B) a match, or (C) a mismatch; and throw\n * an error in case (C).\n *\n * @param { string | undefined } nameSoFar\n * @param { string | undefined } newName\n * @returns { string } updated name\n */\n function checkName(nameSoFar, newName) {\n if (!nameSoFar) {\n return newName;\n }\n if (newName && newName !== nameSoFar) {\n const err = new Error('Function names do not match (expected: ' + nameSoFar + ', actual: ' + newName + ')');\n err.data = {\n actual: newName,\n expected: nameSoFar\n };\n throw err;\n }\n return nameSoFar;\n }\n\n /**\n * Retrieve the implied name from an object with signature keys\n * and function values, checking whether all value names match\n *\n * @param { {string: function} } obj\n */\n function getObjectName(obj) {\n let name;\n for (const key in obj) {\n // Only pay attention to own properties, and only if their values\n // are typed functions or functions with a signature property\n if (Object.prototype.hasOwnProperty.call(obj, key) && (isTypedFunction(obj[key]) || typeof obj[key].signature === 'string')) {\n name = checkName(name, obj[key].name);\n }\n }\n return name;\n }\n\n /**\n * Copy all of the signatures from the second argument into the first,\n * which is modified by side effect, checking for conflicts\n *\n * @param {Object.} dest\n * @param {Object.} source\n */\n function mergeSignatures(dest, source) {\n let key;\n for (key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n if (key in dest) {\n if (source[key] !== dest[key]) {\n const err = new Error('Signature \"' + key + '\" is defined twice');\n err.data = {\n signature: key,\n sourceFunction: source[key],\n destFunction: dest[key]\n };\n throw err;\n }\n // else: both signatures point to the same function, that's fine\n }\n dest[key] = source[key];\n }\n }\n }\n const saveTyped = typed;\n\n /**\n * Originally the main function was a typed function itself, but then\n * it might not be able to generate error messages if the client\n * replaced the type system with different names.\n *\n * Main entry: typed([name], functions/objects with signatures...)\n *\n * Assembles and returns a new typed-function from the given items\n * that provide signatures and implementations, each of which may be\n * * a plain object mapping (string) signatures to implementing functions,\n * * a previously constructed typed function, or\n * * any other single function with a string-valued property `signature`.\n * The name of the resulting typed-function will be given by the\n * string-valued name argument if present, or if not, by the name\n * of any of the arguments that have one, as long as any that do are\n * consistent with each other. If no name is specified, the name will be\n * an empty string.\n *\n * @param {string} maybeName [optional]\n * @param {(function|object)[]} signature providers\n * @returns {typed-function}\n */\n typed = function (maybeName) {\n const named = typeof maybeName === 'string';\n const start = named ? 1 : 0;\n let name = named ? maybeName : '';\n const allSignatures = {};\n for (let i = start; i < arguments.length; ++i) {\n const item = arguments[i];\n let theseSignatures = {};\n let thisName;\n if (typeof item === 'function') {\n thisName = item.name;\n if (typeof item.signature === 'string') {\n // Case 1: Ordinary function with a string 'signature' property\n theseSignatures[item.signature] = item;\n } else if (isTypedFunction(item)) {\n // Case 2: Existing typed function\n theseSignatures = item.signatures;\n }\n } else if (isPlainObject(item)) {\n // Case 3: Plain object, assume keys = signatures, values = functions\n theseSignatures = item;\n if (!named) {\n thisName = getObjectName(item);\n }\n }\n if (Object.keys(theseSignatures).length === 0) {\n const err = new TypeError('Argument to \\'typed\\' at index ' + i + ' is not a (typed) function, ' + 'nor an object with signatures as keys and functions as values.');\n err.data = {\n index: i,\n argument: item\n };\n throw err;\n }\n if (!named) {\n name = checkName(name, thisName);\n }\n mergeSignatures(allSignatures, theseSignatures);\n }\n return createTypedFunction(name || '', allSignatures);\n };\n typed.create = create;\n typed.createCount = saveTyped.createCount;\n typed.onMismatch = _onMismatch;\n typed.throwMismatchError = _onMismatch;\n typed.createError = createError;\n typed.clear = clear;\n typed.clearConversions = clearConversions;\n typed.addTypes = addTypes;\n typed._findType = findType; // For unit testing only\n typed.referTo = referTo;\n typed.referToSelf = referToSelf;\n typed.convert = convert;\n typed.findSignature = findSignature;\n typed.find = find;\n typed.isTypedFunction = isTypedFunction;\n typed.warnAgainstDeprecatedThis = true;\n\n /**\n * add a type (convenience wrapper for typed.addTypes)\n * @param {{name: string, test: function}} type\n * @param {boolean} [beforeObjectTest=true]\n * If true, the new test will be inserted before\n * the test with name 'Object' (if any), since\n * tests for Object match Array and classes too.\n */\n typed.addType = function (type, beforeObjectTest) {\n let before = 'any';\n if (beforeObjectTest !== false && typeMap.has('Object')) {\n before = 'Object';\n }\n typed.addTypes([type], before);\n };\n\n /**\n * Verify that the ConversionDef conversion has a valid format.\n *\n * @param {conversionDef} conversion\n * @return {void}\n * @throws {TypeError|SyntaxError}\n */\n function _validateConversion(conversion) {\n if (!conversion || typeof conversion.from !== 'string' || typeof conversion.to !== 'string' || typeof conversion.convert !== 'function') {\n throw new TypeError('Object with properties {from: string, to: string, convert: function} expected');\n }\n if (conversion.to === conversion.from) {\n throw new SyntaxError('Illegal to define conversion from \"' + conversion.from + '\" to itself.');\n }\n }\n\n /**\n * Add a conversion\n *\n * @param {ConversionDef} conversion\n * @param {{override: boolean}} [options]\n * @returns {void}\n * @throws {TypeError}\n */\n typed.addConversion = function (conversion) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n override: false\n };\n _validateConversion(conversion);\n const to = findType(conversion.to);\n const existing = to.conversionsTo.find(other => other.from === conversion.from);\n if (existing) {\n if (options && options.override) {\n typed.removeConversion({\n from: existing.from,\n to: conversion.to,\n convert: existing.convert\n });\n } else {\n throw new Error('There is already a conversion from \"' + conversion.from + '\" to \"' + to.name + '\"');\n }\n }\n to.conversionsTo.push({\n from: conversion.from,\n convert: conversion.convert,\n index: nConversions++\n });\n };\n\n /**\n * Convenience wrapper to call addConversion on each conversion in a list.\n *\n * @param {ConversionDef[]} conversions\n * @param {{override: boolean}} [options]\n * @returns {void}\n * @throws {TypeError}\n */\n typed.addConversions = function (conversions, options) {\n conversions.forEach(conversion => typed.addConversion(conversion, options));\n };\n\n /**\n * Remove the specified conversion. The format is the same as for\n * addConversion, and the convert function must match or an error\n * is thrown.\n *\n * @param {{from: string, to: string, convert: function}} conversion\n * @returns {void}\n * @throws {TypeError|SyntaxError|Error}\n */\n typed.removeConversion = function (conversion) {\n _validateConversion(conversion);\n const to = findType(conversion.to);\n const existingConversion = findInArray(to.conversionsTo, c => c.from === conversion.from);\n if (!existingConversion) {\n throw new Error('Attempt to remove nonexistent conversion from ' + conversion.from + ' to ' + conversion.to);\n }\n if (existingConversion.convert !== conversion.convert) {\n throw new Error('Conversion to remove does not match existing conversion');\n }\n const index = to.conversionsTo.indexOf(existingConversion);\n to.conversionsTo.splice(index, 1);\n };\n\n /**\n * Produce the specific signature that a typed function\n * will execute on the given arguments. Here, a \"signature\" is an\n * object with properties 'params', 'test', 'fn', and 'implementation'.\n * This last property is a function that converts params as necessary\n * and then calls 'fn'. Returns null if there is no matching signature.\n * @param {typed-function} tf\n * @param {any[]} argList\n * @returns {{params: string, test: function, fn: function, implementation: function}}\n */\n typed.resolve = function (tf, argList) {\n if (!isTypedFunction(tf)) {\n throw new TypeError(NOT_TYPED_FUNCTION);\n }\n const sigs = tf._typedFunctionData.signatures;\n for (let i = 0; i < sigs.length; ++i) {\n if (sigs[i].test(argList)) {\n return sigs[i];\n }\n }\n return null;\n };\n return typed;\n }\n var typedFunction = create();\n\n return typedFunction;\n\n}));\n//# sourceMappingURL=typed-function.js.map\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar toObject = require('../internals/to-object');\n\nvar floor = Math.floor;\nvar charAt = uncurryThis(''.charAt);\nvar replace = uncurryThis(''.replace);\nvar stringSlice = uncurryThis(''.slice);\n// eslint-disable-next-line redos/no-vulnerable -- safe\nvar SUBSTITUTION_SYMBOLS = /\\$([$&'`]|\\d{1,2}|<[^>]*>)/g;\nvar SUBSTITUTION_SYMBOLS_NO_NAMED = /\\$([$&'`]|\\d{1,2})/g;\n\n// `GetSubstitution` abstract operation\n// https://tc39.es/ecma262/#sec-getsubstitution\nmodule.exports = function (matched, str, position, captures, namedCaptures, replacement) {\n var tailPos = position + matched.length;\n var m = captures.length;\n var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;\n if (namedCaptures !== undefined) {\n namedCaptures = toObject(namedCaptures);\n symbols = SUBSTITUTION_SYMBOLS;\n }\n return replace(replacement, symbols, function (match, ch) {\n var capture;\n switch (charAt(ch, 0)) {\n case '$': return '$';\n case '&': return matched;\n case '`': return stringSlice(str, 0, position);\n case \"'\": return stringSlice(str, tailPos);\n case '<':\n capture = namedCaptures[stringSlice(ch, 1, -1)];\n break;\n default: // \\d\\d?\n var n = +ch;\n if (n === 0) return match;\n if (n > m) {\n var f = floor(n / 10);\n if (f === 0) return match;\n if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1);\n return match;\n }\n capture = captures[n - 1];\n }\n return capture === undefined ? '' : capture;\n });\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\nvar getIteratorDirect = require('../internals/get-iterator-direct');\nvar createIteratorProxy = require('../internals/iterator-create-proxy');\nvar callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');\nvar IS_PURE = require('../internals/is-pure');\nvar iteratorClose = require('../internals/iterator-close');\nvar iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');\n\nvar filterWithoutClosingOnEarlyError = !IS_PURE && iteratorHelperWithoutClosingOnEarlyError('filter', TypeError);\n\nvar IteratorProxy = createIteratorProxy(function () {\n var iterator = this.iterator;\n var predicate = this.predicate;\n var next = this.next;\n var result, done, value;\n while (true) {\n result = anObject(call(next, iterator));\n done = this.done = !!result.done;\n if (done) return;\n value = result.value;\n if (callWithSafeIterationClosing(iterator, predicate, [value, this.counter++], true)) return value;\n }\n});\n\n// `Iterator.prototype.filter` method\n// https://tc39.es/ecma262/#sec-iterator.prototype.filter\n$({ target: 'Iterator', proto: true, real: true, forced: IS_PURE || filterWithoutClosingOnEarlyError }, {\n filter: function filter(predicate) {\n anObject(this);\n try {\n aCallable(predicate);\n } catch (error) {\n iteratorClose(this, 'throw', error);\n }\n\n if (filterWithoutClosingOnEarlyError) return call(filterWithoutClosingOnEarlyError, this, predicate);\n\n return new IteratorProxy(getIteratorDirect(this), {\n predicate: predicate\n });\n }\n});\n","'use strict';\n// `CreateIterResultObject` abstract operation\n// https://tc39.es/ecma262/#sec-createiterresultobject\nmodule.exports = function (value, done) {\n return { value: value, done: done };\n};\n","'use strict';\n// TODO: Remove from `core-js@4`\nrequire('../modules/es.iterator.find');\n","'use strict';\nvar bind = require('../internals/function-bind-context');\nvar call = require('../internals/function-call');\nvar anObject = require('../internals/an-object');\nvar tryToString = require('../internals/try-to-string');\nvar isArrayIteratorMethod = require('../internals/is-array-iterator-method');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\nvar getIterator = require('../internals/get-iterator');\nvar getIteratorMethod = require('../internals/get-iterator-method');\nvar iteratorClose = require('../internals/iterator-close');\n\nvar $TypeError = TypeError;\n\nvar Result = function (stopped, result) {\n this.stopped = stopped;\n this.result = result;\n};\n\nvar ResultPrototype = Result.prototype;\n\nmodule.exports = function (iterable, unboundFunction, options) {\n var that = options && options.that;\n var AS_ENTRIES = !!(options && options.AS_ENTRIES);\n var IS_RECORD = !!(options && options.IS_RECORD);\n var IS_ITERATOR = !!(options && options.IS_ITERATOR);\n var INTERRUPTED = !!(options && options.INTERRUPTED);\n var fn = bind(unboundFunction, that);\n var iterator, iterFn, index, length, result, next, step;\n\n var stop = function (condition) {\n if (iterator) iteratorClose(iterator, 'normal', condition);\n return new Result(true, condition);\n };\n\n var callFn = function (value) {\n if (AS_ENTRIES) {\n anObject(value);\n return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);\n } return INTERRUPTED ? fn(value, stop) : fn(value);\n };\n\n if (IS_RECORD) {\n iterator = iterable.iterator;\n } else if (IS_ITERATOR) {\n iterator = iterable;\n } else {\n iterFn = getIteratorMethod(iterable);\n if (!iterFn) throw new $TypeError(tryToString(iterable) + ' is not iterable');\n // optimisation for array iterators\n if (isArrayIteratorMethod(iterFn)) {\n for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {\n result = callFn(iterable[index]);\n if (result && isPrototypeOf(ResultPrototype, result)) return result;\n } return new Result(false);\n }\n iterator = getIterator(iterable, iterFn);\n }\n\n next = IS_RECORD ? iterable.next : iterator.next;\n while (!(step = call(next, iterator)).done) {\n try {\n result = callFn(step.value);\n } catch (error) {\n iteratorClose(iterator, 'throw', error);\n }\n if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;\n } return new Result(false);\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar $reduce = require('../internals/array-reduce').left;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar CHROME_VERSION = require('../internals/environment-v8-version');\nvar IS_NODE = require('../internals/environment-is-node');\n\n// Chrome 80-82 has a critical bug\n// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982\nvar CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;\nvar FORCED = CHROME_BUG || !arrayMethodIsStrict('reduce');\n\n// `Array.prototype.reduce` method\n// https://tc39.es/ecma262/#sec-array.prototype.reduce\n$({ target: 'Array', proto: true, forced: FORCED }, {\n reduce: function reduce(callbackfn /* , initialValue */) {\n var length = arguments.length;\n return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);\n }\n});\n","'use strict';\nvar call = require('../internals/function-call');\nvar isObject = require('../internals/is-object');\nvar isSymbol = require('../internals/is-symbol');\nvar getMethod = require('../internals/get-method');\nvar ordinaryToPrimitive = require('../internals/ordinary-to-primitive');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar $TypeError = TypeError;\nvar TO_PRIMITIVE = wellKnownSymbol('toPrimitive');\n\n// `ToPrimitive` abstract operation\n// https://tc39.es/ecma262/#sec-toprimitive\nmodule.exports = function (input, pref) {\n if (!isObject(input) || isSymbol(input)) return input;\n var exoticToPrim = getMethod(input, TO_PRIMITIVE);\n var result;\n if (exoticToPrim) {\n if (pref === undefined) pref = 'default';\n result = call(exoticToPrim, input, pref);\n if (!isObject(result) || isSymbol(result)) return result;\n throw new $TypeError(\"Can't convert object to primitive value\");\n }\n if (pref === undefined) pref = 'number';\n return ordinaryToPrimitive(input, pref);\n};\n","'use strict';\nvar hasOwn = require('../internals/has-own-property');\nvar isCallable = require('../internals/is-callable');\nvar toObject = require('../internals/to-object');\nvar sharedKey = require('../internals/shared-key');\nvar CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter');\n\nvar IE_PROTO = sharedKey('IE_PROTO');\nvar $Object = Object;\nvar ObjectPrototype = $Object.prototype;\n\n// `Object.getPrototypeOf` method\n// https://tc39.es/ecma262/#sec-object.getprototypeof\n// eslint-disable-next-line es/no-object-getprototypeof -- safe\nmodule.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {\n var object = toObject(O);\n if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];\n var constructor = object.constructor;\n if (isCallable(constructor) && object instanceof constructor) {\n return constructor.prototype;\n } return object instanceof $Object ? ObjectPrototype : null;\n};\n","'use strict';\nvar fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\n\nvar replacement = /#|\\.prototype\\./;\n\nvar isForced = function (feature, detection) {\n var value = data[normalize(feature)];\n return value === POLYFILL ? true\n : value === NATIVE ? false\n : isCallable(detection) ? fails(detection)\n : !!detection;\n};\n\nvar normalize = isForced.normalize = function (string) {\n return String(string).replace(replacement, '.').toLowerCase();\n};\n\nvar data = isForced.data = {};\nvar NATIVE = isForced.NATIVE = 'N';\nvar POLYFILL = isForced.POLYFILL = 'P';\n\nmodule.exports = isForced;\n","'use strict';\nvar $TypeError = TypeError;\n\nmodule.exports = function (passed, required) {\n if (passed < required) throw new $TypeError('Not enough arguments');\n return passed;\n};\n","'use strict';\nvar globalThis = require('../internals/global-this');\n\nvar navigator = globalThis.navigator;\nvar userAgent = navigator && navigator.userAgent;\n\nmodule.exports = userAgent ? String(userAgent) : '';\n","'use strict';\n/* eslint-disable no-proto -- safe */\nvar uncurryThisAccessor = require('../internals/function-uncurry-this-accessor');\nvar isObject = require('../internals/is-object');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar aPossiblePrototype = require('../internals/a-possible-prototype');\n\n// `Object.setPrototypeOf` method\n// https://tc39.es/ecma262/#sec-object.setprototypeof\n// Works with __proto__ only. Old v8 can't work with null proto objects.\n// eslint-disable-next-line es/no-object-setprototypeof -- safe\nmodule.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {\n var CORRECT_SETTER = false;\n var test = {};\n var setter;\n try {\n setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');\n setter(test, []);\n CORRECT_SETTER = test instanceof Array;\n } catch (error) { /* empty */ }\n return function setPrototypeOf(O, proto) {\n requireObjectCoercible(O);\n aPossiblePrototype(proto);\n if (!isObject(O)) return O;\n if (CORRECT_SETTER) setter(O, proto);\n else O.__proto__ = proto;\n return O;\n };\n}() : undefined);\n","// A Javascript implementaion of the \"xorwow\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var t = (me.x ^ (me.x >>> 2));\n me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v;\n return (me.d = (me.d + 362437 | 0)) +\n (me.v = (me.v ^ (me.v << 4)) ^ (t ^ (t << 1))) | 0;\n };\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n me.v = 0;\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n if (k == strseed.length) {\n me.d = me.x << 10 ^ me.x >>> 4;\n }\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n t.v = f.v;\n t.d = f.d;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorwow = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","'use strict';\nvar $ = require('../internals/export');\nvar getBuiltIn = require('../internals/get-built-in');\nvar apply = require('../internals/function-apply');\nvar call = require('../internals/function-call');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\nvar isSymbol = require('../internals/is-symbol');\nvar arraySlice = require('../internals/array-slice');\nvar getReplacerFunction = require('../internals/get-json-replacer-function');\nvar NATIVE_SYMBOL = require('../internals/symbol-constructor-detection');\n\nvar $String = String;\nvar $stringify = getBuiltIn('JSON', 'stringify');\nvar exec = uncurryThis(/./.exec);\nvar charAt = uncurryThis(''.charAt);\nvar charCodeAt = uncurryThis(''.charCodeAt);\nvar replace = uncurryThis(''.replace);\nvar numberToString = uncurryThis(1.0.toString);\n\nvar tester = /[\\uD800-\\uDFFF]/g;\nvar low = /^[\\uD800-\\uDBFF]$/;\nvar hi = /^[\\uDC00-\\uDFFF]$/;\n\nvar WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () {\n var symbol = getBuiltIn('Symbol')('stringify detection');\n // MS Edge converts symbol values to JSON as {}\n return $stringify([symbol]) !== '[null]'\n // WebKit converts symbol values to JSON as null\n || $stringify({ a: symbol }) !== '{}'\n // V8 throws on boxed symbols\n || $stringify(Object(symbol)) !== '{}';\n});\n\n// https://github.com/tc39/proposal-well-formed-stringify\nvar ILL_FORMED_UNICODE = fails(function () {\n return $stringify('\\uDF06\\uD834') !== '\"\\\\udf06\\\\ud834\"'\n || $stringify('\\uDEAD') !== '\"\\\\udead\"';\n});\n\nvar stringifyWithSymbolsFix = function (it, replacer) {\n var args = arraySlice(arguments);\n var $replacer = getReplacerFunction(replacer);\n if (!isCallable($replacer) && (it === undefined || isSymbol(it))) return; // IE8 returns string on undefined\n args[1] = function (key, value) {\n // some old implementations (like WebKit) could pass numbers as keys\n if (isCallable($replacer)) value = call($replacer, this, $String(key), value);\n if (!isSymbol(value)) return value;\n };\n return apply($stringify, null, args);\n};\n\nvar fixIllFormed = function (match, offset, string) {\n var prev = charAt(string, offset - 1);\n var next = charAt(string, offset + 1);\n if ((exec(low, match) && !exec(hi, next)) || (exec(hi, match) && !exec(low, prev))) {\n return '\\\\u' + numberToString(charCodeAt(match, 0), 16);\n } return match;\n};\n\nif ($stringify) {\n // `JSON.stringify` method\n // https://tc39.es/ecma262/#sec-json.stringify\n $({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {\n // eslint-disable-next-line no-unused-vars -- required for `.length`\n stringify: function stringify(it, replacer, space) {\n var args = arraySlice(arguments);\n var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args);\n return ILL_FORMED_UNICODE && typeof result == 'string' ? replace(result, tester, fixIllFormed) : result;\n }\n });\n}\n","'use strict';\nmodule.exports = function (a, b) {\n try {\n // eslint-disable-next-line no-console -- safe\n arguments.length === 1 ? console.error(a) : console.error(a, b);\n } catch (error) { /* empty */ }\n};\n","\"use strict\";\n\n// Map the characters to escape to their escaped values. The list is derived\n// from http://www.cespedes.org/blog/85/how-to-escape-latex-special-characters\n\nvar _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; };\n\nvar defaultEscapes = {\n \"{\": \"\\\\{\",\n \"}\": \"\\\\}\",\n \"\\\\\": \"\\\\textbackslash{}\",\n \"#\": \"\\\\#\",\n $: \"\\\\$\",\n \"%\": \"\\\\%\",\n \"&\": \"\\\\&\",\n \"^\": \"\\\\textasciicircum{}\",\n _: \"\\\\_\",\n \"~\": \"\\\\textasciitilde{}\"\n};\nvar formatEscapes = {\n \"\\u2013\": \"\\\\--\",\n \"\\u2014\": \"\\\\---\",\n \" \": \"~\",\n \"\\t\": \"\\\\qquad{}\",\n \"\\r\\n\": \"\\\\newline{}\",\n \"\\n\": \"\\\\newline{}\"\n};\n\nvar defaultEscapeMapFn = function defaultEscapeMapFn(defaultEscapes, formatEscapes) {\n return _extends({}, defaultEscapes, formatEscapes);\n};\n\n/**\n * Escape a string to be used in LaTeX documents.\n * @param {string} str the string to be escaped.\n * @param {boolean} params.preserveFormatting whether formatting escapes should\n * be performed (default: false).\n * @param {function} params.escapeMapFn the function to modify the escape maps.\n * @return {string} the escaped string, ready to be used in LaTeX.\n */\nmodule.exports = function (str) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n _ref$preserveFormatti = _ref.preserveFormatting,\n preserveFormatting = _ref$preserveFormatti === undefined ? false : _ref$preserveFormatti,\n _ref$escapeMapFn = _ref.escapeMapFn,\n escapeMapFn = _ref$escapeMapFn === undefined ? defaultEscapeMapFn : _ref$escapeMapFn;\n\n var runningStr = String(str);\n var result = \"\";\n\n var escapes = escapeMapFn(_extends({}, defaultEscapes), preserveFormatting ? _extends({}, formatEscapes) : {});\n var escapeKeys = Object.keys(escapes); // as it is reused later on\n\n // Algorithm: Go through the string character by character, if it matches\n // with one of the special characters then we'll replace it with the escaped\n // version.\n\n var _loop = function _loop() {\n var specialCharFound = false;\n escapeKeys.forEach(function (key, index) {\n if (specialCharFound) {\n return;\n }\n if (runningStr.length >= key.length && runningStr.slice(0, key.length) === key) {\n result += escapes[escapeKeys[index]];\n runningStr = runningStr.slice(key.length, runningStr.length);\n specialCharFound = true;\n }\n });\n if (!specialCharFound) {\n result += runningStr.slice(0, 1);\n runningStr = runningStr.slice(1, runningStr.length);\n }\n };\n\n while (runningStr) {\n _loop();\n }\n return result;\n};","'use strict';\nvar isCallable = require('../internals/is-callable');\nvar isObject = require('../internals/is-object');\nvar setPrototypeOf = require('../internals/object-set-prototype-of');\n\n// makes subclassing work correct for wrapped built-ins\nmodule.exports = function ($this, dummy, Wrapper) {\n var NewTarget, NewTargetPrototype;\n if (\n // it can work only with native `setPrototypeOf`\n setPrototypeOf &&\n // we haven't completely correct pre-ES6 way for getting `new.target`, so use this\n isCallable(NewTarget = dummy.constructor) &&\n NewTarget !== Wrapper &&\n isObject(NewTargetPrototype = NewTarget.prototype) &&\n NewTargetPrototype !== Wrapper.prototype\n ) setPrototypeOf($this, NewTargetPrototype);\n return $this;\n};\n","// A Javascript implementaion of the \"xor128\" prng algorithm by\n// George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n me.x = 0;\n me.y = 0;\n me.z = 0;\n me.w = 0;\n\n // Set up generator function.\n me.next = function() {\n var t = me.x ^ (me.x << 11);\n me.x = me.y;\n me.y = me.z;\n me.z = me.w;\n return me.w ^= (me.w >>> 19) ^ t ^ (t >>> 8);\n };\n\n if (seed === (seed | 0)) {\n // Integer seed.\n me.x = seed;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 64; k++) {\n me.x ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.x = f.x;\n t.y = f.y;\n t.z = f.z;\n t.w = f.w;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor128 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","'use strict';\n// TODO: Remove from `core-js@4`\nrequire('../modules/es.iterator.every');\n","'use strict';\n// TODO: Remove this module from `core-js@4` since it's split to modules listed below\nrequire('../modules/es.promise.constructor');\nrequire('../modules/es.promise.all');\nrequire('../modules/es.promise.catch');\nrequire('../modules/es.promise.race');\nrequire('../modules/es.promise.reject');\nrequire('../modules/es.promise.resolve');\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar DESCRIPTORS = require('../internals/descriptors');\n\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// Avoid NodeJS experimental warning\nmodule.exports = function (name) {\n if (!DESCRIPTORS) return globalThis[name];\n var descriptor = getOwnPropertyDescriptor(globalThis, name);\n return descriptor && descriptor.value;\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nvar id = 0;\nvar postfix = Math.random();\nvar toString = uncurryThis(1.0.toString);\n\nmodule.exports = function (key) {\n return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);\n};\n","'use strict';\nvar anObject = require('../internals/an-object');\nvar isObject = require('../internals/is-object');\nvar newPromiseCapability = require('../internals/new-promise-capability');\n\nmodule.exports = function (C, x) {\n anObject(C);\n if (isObject(x) && x.constructor === C) return x;\n var promiseCapability = newPromiseCapability.f(C);\n var resolve = promiseCapability.resolve;\n resolve(x);\n return promiseCapability.promise;\n};\n","'use strict';\nvar isPossiblePrototype = require('../internals/is-possible-prototype');\n\nvar $String = String;\nvar $TypeError = TypeError;\n\nmodule.exports = function (argument) {\n if (isPossiblePrototype(argument)) return argument;\n throw new $TypeError(\"Can't set \" + $String(argument) + ' as a prototype');\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\nvar classof = require('../internals/classof');\nvar getBuiltIn = require('../internals/get-built-in');\nvar inspectSource = require('../internals/inspect-source');\n\nvar noop = function () { /* empty */ };\nvar construct = getBuiltIn('Reflect', 'construct');\nvar constructorRegExp = /^\\s*(?:class|function)\\b/;\nvar exec = uncurryThis(constructorRegExp.exec);\nvar INCORRECT_TO_STRING = !constructorRegExp.test(noop);\n\nvar isConstructorModern = function isConstructor(argument) {\n if (!isCallable(argument)) return false;\n try {\n construct(noop, [], argument);\n return true;\n } catch (error) {\n return false;\n }\n};\n\nvar isConstructorLegacy = function isConstructor(argument) {\n if (!isCallable(argument)) return false;\n switch (classof(argument)) {\n case 'AsyncFunction':\n case 'GeneratorFunction':\n case 'AsyncGeneratorFunction': return false;\n }\n try {\n // we can't check .prototype since constructors produced by .bind haven't it\n // `Function#toString` throws on some built-it function in some legacy engines\n // (for example, `DOMQuad` and similar in FF41-)\n return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));\n } catch (error) {\n return true;\n }\n};\n\nisConstructorLegacy.sham = true;\n\n// `IsConstructor` abstract operation\n// https://tc39.es/ecma262/#sec-isconstructor\nmodule.exports = !construct || fails(function () {\n var called;\n return isConstructorModern(isConstructorModern.call)\n || !isConstructorModern(Object)\n || !isConstructorModern(function () { called = true; })\n || called;\n}) ? isConstructorLegacy : isConstructorModern;\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar iterate = require('../internals/iterate');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\nvar getIteratorDirect = require('../internals/get-iterator-direct');\nvar iteratorClose = require('../internals/iterator-close');\nvar iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');\n\nvar someWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('some', TypeError);\n\n// `Iterator.prototype.some` method\n// https://tc39.es/ecma262/#sec-iterator.prototype.some\n$({ target: 'Iterator', proto: true, real: true, forced: someWithoutClosingOnEarlyError }, {\n some: function some(predicate) {\n anObject(this);\n try {\n aCallable(predicate);\n } catch (error) {\n iteratorClose(this, 'throw', error);\n }\n\n if (someWithoutClosingOnEarlyError) return call(someWithoutClosingOnEarlyError, this, predicate);\n\n var record = getIteratorDirect(this);\n var counter = 0;\n return iterate(record, function (value, stop) {\n if (predicate(value, counter++)) return stop();\n }, { IS_RECORD: true, INTERRUPTED: true }).stopped;\n }\n});\n","'use strict';\nvar userAgent = require('../internals/environment-user-agent');\n\nvar webkit = userAgent.match(/AppleWebKit\\/(\\d+)\\./);\n\nmodule.exports = !!webkit && +webkit[1];\n","'use strict';\nvar fails = require('../internals/fails');\nvar globalThis = require('../internals/global-this');\n\n// babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError\nvar $RegExp = globalThis.RegExp;\n\nmodule.exports = fails(function () {\n var re = $RegExp('.', 's');\n return !(re.dotAll && re.test('\\n') && re.flags === 's');\n});\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar isCallable = require('../internals/is-callable');\nvar store = require('../internals/shared-store');\n\nvar functionToString = uncurryThis(Function.toString);\n\n// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper\nif (!isCallable(store.inspectSource)) {\n store.inspectSource = function (it) {\n return functionToString(it);\n };\n}\n\nmodule.exports = store.inspectSource;\n","'use strict';\nvar userAgent = require('../internals/environment-user-agent');\n\nvar firefox = userAgent.match(/firefox\\/(\\d+)/i);\n\nmodule.exports = !!firefox && +firefox[1];\n","'use strict';\n// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe\nexports.f = Object.getOwnPropertySymbols;\n","'use strict';\nvar fails = require('../internals/fails');\n\n// Detect IE8's incomplete defineProperty implementation\nmodule.exports = !fails(function () {\n // eslint-disable-next-line es/no-object-defineproperty -- required for testing\n return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;\n});\n","'use strict';\nvar UA = require('../internals/environment-user-agent');\n\nmodule.exports = /MSIE|Trident/.test(UA);\n","'use strict';\nvar $ = require('../internals/export');\nvar iterate = require('../internals/iterate');\nvar createProperty = require('../internals/create-property');\n\n// `Object.fromEntries` method\n// https://tc39.es/ecma262/#sec-object.fromentries\n$({ target: 'Object', stat: true }, {\n fromEntries: function fromEntries(iterable) {\n var obj = {};\n iterate(iterable, function (k, v) {\n createProperty(obj, k, v);\n }, { AS_ENTRIES: true });\n return obj;\n }\n});\n","'use strict';\nvar isObject = require('../internals/is-object');\n\nmodule.exports = function (argument) {\n return isObject(argument) || argument === null;\n};\n","'use strict';\n// TODO: Remove from `core-js@4`\nrequire('../modules/es.iterator.for-each');\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar isObject = require('../internals/is-object');\n\nvar document = globalThis.document;\n// typeof document.createElement is 'object' in old IE\nvar EXISTS = isObject(document) && isObject(document.createElement);\n\nmodule.exports = function (it) {\n return EXISTS ? document.createElement(it) : {};\n};\n","'use strict';\n// we can't use just `it == null` since of `document.all` special case\n// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec\nmodule.exports = function (it) {\n return it === null || it === undefined;\n};\n","'use strict';\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar Iterators = require('../internals/iterators');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar ArrayPrototype = Array.prototype;\n\n// check on default Array iterator\nmodule.exports = function (it) {\n return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);\n};\n","'use strict';\n/* global Bun, Deno -- detection */\nvar globalThis = require('../internals/global-this');\nvar userAgent = require('../internals/environment-user-agent');\nvar classof = require('../internals/classof-raw');\n\nvar userAgentStartsWith = function (string) {\n return userAgent.slice(0, string.length) === string;\n};\n\nmodule.exports = (function () {\n if (userAgentStartsWith('Bun/')) return 'BUN';\n if (userAgentStartsWith('Cloudflare-Workers')) return 'CLOUDFLARE';\n if (userAgentStartsWith('Deno/')) return 'DENO';\n if (userAgentStartsWith('Node.js/')) return 'NODE';\n if (globalThis.Bun && typeof Bun.version == 'string') return 'BUN';\n if (globalThis.Deno && typeof Deno.version == 'object') return 'DENO';\n if (classof(globalThis.process) === 'process') return 'NODE';\n if (globalThis.window && globalThis.document) return 'BROWSER';\n return 'REST';\n})();\n","'use strict';\nvar userAgent = require('../internals/environment-user-agent');\n\nmodule.exports = /ipad|iphone|ipod/i.test(userAgent) && typeof Pebble != 'undefined';\n","'use strict';\nvar call = require('../internals/function-call');\nvar isCallable = require('../internals/is-callable');\nvar isObject = require('../internals/is-object');\n\nvar $TypeError = TypeError;\n\n// `OrdinaryToPrimitive` abstract operation\n// https://tc39.es/ecma262/#sec-ordinarytoprimitive\nmodule.exports = function (input, pref) {\n var fn, val;\n if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;\n if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;\n if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;\n throw new $TypeError(\"Can't convert object to primitive value\");\n};\n","'use strict';\nvar classof = require('../internals/classof-raw');\n\n// `IsArray` abstract operation\n// https://tc39.es/ecma262/#sec-isarray\n// eslint-disable-next-line es/no-array-isarray -- safe\nmodule.exports = Array.isArray || function isArray(argument) {\n return classof(argument) === 'Array';\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar $includes = require('../internals/array-includes').includes;\nvar fails = require('../internals/fails');\nvar addToUnscopables = require('../internals/add-to-unscopables');\n\n// FF99+ bug\nvar BROKEN_ON_SPARSE = fails(function () {\n // eslint-disable-next-line es/no-array-prototype-includes -- detection\n return !Array(1).includes();\n});\n\n// `Array.prototype.includes` method\n// https://tc39.es/ecma262/#sec-array.prototype.includes\n$({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {\n includes: function includes(el /* , fromIndex = 0 */) {\n return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables('includes');\n","'use strict';\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar SAFE_CLOSING = false;\n\ntry {\n var called = 0;\n var iteratorWithReturn = {\n next: function () {\n return { done: !!called++ };\n },\n 'return': function () {\n SAFE_CLOSING = true;\n }\n };\n iteratorWithReturn[ITERATOR] = function () {\n return this;\n };\n // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing\n Array.from(iteratorWithReturn, function () { throw 2; });\n} catch (error) { /* empty */ }\n\nmodule.exports = function (exec, SKIP_CLOSING) {\n try {\n if (!SKIP_CLOSING && !SAFE_CLOSING) return false;\n } catch (error) { return false; } // workaround of old WebKit + `eval` bug\n var ITERATION_SUPPORT = false;\n try {\n var object = {};\n object[ITERATOR] = function () {\n return {\n next: function () {\n return { done: ITERATION_SUPPORT = true };\n }\n };\n };\n exec(object);\n } catch (error) { /* empty */ }\n return ITERATION_SUPPORT;\n};\n","'use strict';\nvar arraySlice = require('../internals/array-slice');\n\nvar floor = Math.floor;\n\nvar sort = function (array, comparefn) {\n var length = array.length;\n\n if (length < 8) {\n // insertion sort\n var i = 1;\n var element, j;\n\n while (i < length) {\n j = i;\n element = array[i];\n while (j && comparefn(array[j - 1], element) > 0) {\n array[j] = array[--j];\n }\n if (j !== i++) array[j] = element;\n }\n } else {\n // merge sort\n var middle = floor(length / 2);\n var left = sort(arraySlice(array, 0, middle), comparefn);\n var right = sort(arraySlice(array, middle), comparefn);\n var llength = left.length;\n var rlength = right.length;\n var lindex = 0;\n var rindex = 0;\n\n while (lindex < llength || rindex < rlength) {\n array[lindex + rindex] = (lindex < llength && rindex < rlength)\n ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]\n : lindex < llength ? left[lindex++] : right[rindex++];\n }\n }\n\n return array;\n};\n\nmodule.exports = sort;\n","'use strict';\n/* eslint-disable es/no-symbol -- required for testing */\nvar V8_VERSION = require('../internals/environment-v8-version');\nvar fails = require('../internals/fails');\nvar globalThis = require('../internals/global-this');\n\nvar $String = globalThis.String;\n\n// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing\nmodule.exports = !!Object.getOwnPropertySymbols && !fails(function () {\n var symbol = Symbol('symbol detection');\n // Chrome 38 Symbol has incorrect toString conversion\n // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances\n // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,\n // of course, fail.\n return !$String(symbol) || !(Object(symbol) instanceof Symbol) ||\n // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances\n !Symbol.sham && V8_VERSION && V8_VERSION < 41;\n});\n","'use strict';\n// TODO: Remove from `core-js@4`\nrequire('../modules/es.iterator.filter');\n","'use strict';\nvar globalThis = require('../internals/global-this');\n\n// https://github.com/tc39/ecma262/pull/3467\nmodule.exports = function (METHOD_NAME, ExpectedError) {\n var Iterator = globalThis.Iterator;\n var IteratorPrototype = Iterator && Iterator.prototype;\n var method = IteratorPrototype && IteratorPrototype[METHOD_NAME];\n\n var CLOSED = false;\n\n if (method) try {\n method.call({\n next: function () { return { done: true }; },\n 'return': function () { CLOSED = true; }\n }, -1);\n } catch (error) {\n // https://bugs.webkit.org/show_bug.cgi?id=291195\n if (!(error instanceof ExpectedError)) CLOSED = false;\n }\n\n if (!CLOSED) return method;\n};\n","'use strict';\nvar check = function (it) {\n return it && it.Math === Math && it;\n};\n\n// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nmodule.exports =\n // eslint-disable-next-line es/no-global-this -- safe\n check(typeof globalThis == 'object' && globalThis) ||\n check(typeof window == 'object' && window) ||\n // eslint-disable-next-line no-restricted-globals -- safe\n check(typeof self == 'object' && self) ||\n check(typeof global == 'object' && global) ||\n check(typeof this == 'object' && this) ||\n // eslint-disable-next-line no-new-func -- fallback\n (function () { return this; })() || Function('return this')();\n","'use strict';\nvar fails = require('../internals/fails');\n\nmodule.exports = function (METHOD_NAME, argument) {\n var method = [][METHOD_NAME];\n return !!method && fails(function () {\n // eslint-disable-next-line no-useless-call -- required for testing\n method.call(null, argument || function () { return 1; }, 1);\n });\n};\n","'use strict';\nvar tryToString = require('../internals/try-to-string');\n\nvar $TypeError = TypeError;\n\nmodule.exports = function (O, P) {\n if (!delete O[P]) throw new $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar definePropertyModule = require('../internals/object-define-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = function (object, key, value) {\n if (DESCRIPTORS) definePropertyModule.f(object, key, createPropertyDescriptor(0, value));\n else object[key] = value;\n};\n","/*\nCopyright 2019 David Bau.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n*/\n\n(function (global, pool, math) {\n//\n// The following constants are related to IEEE 754 limits.\n//\n\nvar width = 256, // each RC4 output is 0 <= x < 256\n chunks = 6, // at least six RC4 outputs for each double\n digits = 52, // there are 52 significant digits in a double\n rngname = 'random', // rngname: name for Math.random and Math.seedrandom\n startdenom = math.pow(width, chunks),\n significance = math.pow(2, digits),\n overflow = significance * 2,\n mask = width - 1,\n nodecrypto; // node.js crypto module, initialized at the bottom.\n\n//\n// seedrandom()\n// This is the seedrandom function described above.\n//\nfunction seedrandom(seed, options, callback) {\n var key = [];\n options = (options == true) ? { entropy: true } : (options || {});\n\n // Flatten the seed string or build one from local entropy if needed.\n var shortseed = mixkey(flatten(\n options.entropy ? [seed, tostring(pool)] :\n (seed == null) ? autoseed() : seed, 3), key);\n\n // Use the seed to initialize an ARC4 generator.\n var arc4 = new ARC4(key);\n\n // This function returns a random double in [0, 1) that contains\n // randomness in every bit of the mantissa of the IEEE 754 value.\n var prng = function() {\n var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48\n d = startdenom, // and denominator d = 2 ^ 48.\n x = 0; // and no 'extra last byte'.\n while (n < significance) { // Fill up all significant digits by\n n = (n + x) * width; // shifting numerator and\n d *= width; // denominator and generating a\n x = arc4.g(1); // new least-significant-byte.\n }\n while (n >= overflow) { // To avoid rounding up, before adding\n n /= 2; // last byte, shift everything\n d /= 2; // right using integer math until\n x >>>= 1; // we have exactly the desired bits.\n }\n return (n + x) / d; // Form the number within [0, 1).\n };\n\n prng.int32 = function() { return arc4.g(4) | 0; }\n prng.quick = function() { return arc4.g(4) / 0x100000000; }\n prng.double = prng;\n\n // Mix the randomness into accumulated entropy.\n mixkey(tostring(arc4.S), pool);\n\n // Calling convention: what to return as a function of prng, seed, is_math.\n return (options.pass || callback ||\n function(prng, seed, is_math_call, state) {\n if (state) {\n // Load the arc4 state from the given state if it has an S array.\n if (state.S) { copy(state, arc4); }\n // Only provide the .state method if requested via options.state.\n prng.state = function() { return copy(arc4, {}); }\n }\n\n // If called as a method of Math (Math.seedrandom()), mutate\n // Math.random because that is how seedrandom.js has worked since v1.0.\n if (is_math_call) { math[rngname] = prng; return seed; }\n\n // Otherwise, it is a newer calling convention, so return the\n // prng directly.\n else return prng;\n })(\n prng,\n shortseed,\n 'global' in options ? options.global : (this == math),\n options.state);\n}\n\n//\n// ARC4\n//\n// An ARC4 implementation. The constructor takes a key in the form of\n// an array of at most (width) integers that should be 0 <= x < (width).\n//\n// The g(count) method returns a pseudorandom integer that concatenates\n// the next (count) outputs from ARC4. Its return value is a number x\n// that is in the range 0 <= x < (width ^ count).\n//\nfunction ARC4(key) {\n var t, keylen = key.length,\n me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];\n\n // The empty key [] is treated as [0].\n if (!keylen) { key = [keylen++]; }\n\n // Set up S using the standard key scheduling algorithm.\n while (i < width) {\n s[i] = i++;\n }\n for (i = 0; i < width; i++) {\n s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];\n s[j] = t;\n }\n\n // The \"g\" method returns the next (count) outputs as one number.\n (me.g = function(count) {\n // Using instance members instead of closure state nearly doubles speed.\n var t, r = 0,\n i = me.i, j = me.j, s = me.S;\n while (count--) {\n t = s[i = mask & (i + 1)];\n r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];\n }\n me.i = i; me.j = j;\n return r;\n // For robust unpredictability, the function call below automatically\n // discards an initial batch of values. This is called RC4-drop[256].\n // See http://google.com/search?q=rsa+fluhrer+response&btnI\n })(width);\n}\n\n//\n// copy()\n// Copies internal state of ARC4 to or from a plain object.\n//\nfunction copy(f, t) {\n t.i = f.i;\n t.j = f.j;\n t.S = f.S.slice();\n return t;\n};\n\n//\n// flatten()\n// Converts an object tree to nested arrays of strings.\n//\nfunction flatten(obj, depth) {\n var result = [], typ = (typeof obj), prop;\n if (depth && typ == 'object') {\n for (prop in obj) {\n try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}\n }\n }\n return (result.length ? result : typ == 'string' ? obj : obj + '\\0');\n}\n\n//\n// mixkey()\n// Mixes a string seed into a key that is an array of integers, and\n// returns a shortened string seed that is equivalent to the result key.\n//\nfunction mixkey(seed, key) {\n var stringseed = seed + '', smear, j = 0;\n while (j < stringseed.length) {\n key[mask & j] =\n mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));\n }\n return tostring(key);\n}\n\n//\n// autoseed()\n// Returns an object for autoseeding, using window.crypto and Node crypto\n// module if available.\n//\nfunction autoseed() {\n try {\n var out;\n if (nodecrypto && (out = nodecrypto.randomBytes)) {\n // The use of 'out' to remember randomBytes makes tight minified code.\n out = out(width);\n } else {\n out = new Uint8Array(width);\n (global.crypto || global.msCrypto).getRandomValues(out);\n }\n return tostring(out);\n } catch (e) {\n var browser = global.navigator,\n plugins = browser && browser.plugins;\n return [+new Date, global, plugins, global.screen, tostring(pool)];\n }\n}\n\n//\n// tostring()\n// Converts an array of charcodes to a string\n//\nfunction tostring(a) {\n return String.fromCharCode.apply(0, a);\n}\n\n//\n// When seedrandom.js is loaded, we immediately mix a few bits\n// from the built-in RNG into the entropy pool. Because we do\n// not want to interfere with deterministic PRNG state later,\n// seedrandom will not call math.random on its own again after\n// initialization.\n//\nmixkey(math.random(), pool);\n\n//\n// Nodejs and AMD support: export the implementation as a module using\n// either convention.\n//\nif ((typeof module) == 'object' && module.exports) {\n module.exports = seedrandom;\n // When in node.js, try using crypto package for autoseeding.\n try {\n nodecrypto = require('crypto');\n } catch (ex) {}\n} else if ((typeof define) == 'function' && define.amd) {\n define(function() { return seedrandom; });\n} else {\n // When included as a plain script, set up Math.seedrandom global.\n math['seed' + rngname] = seedrandom;\n}\n\n\n// End anonymous scope, and pass initial values.\n})(\n // global: `self` in browsers (including strict mode and web workers),\n // otherwise `this` in Node and other environments\n (typeof self !== 'undefined') ? self : this,\n [], // pool: entropy pool starts empty\n Math // math: package containing random, pow, and seedrandom\n);\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar globalThis = require('../internals/global-this');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar isForced = require('../internals/is-forced');\nvar inheritIfRequired = require('../internals/inherit-if-required');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar create = require('../internals/object-create');\nvar getOwnPropertyNames = require('../internals/object-get-own-property-names').f;\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\nvar isRegExp = require('../internals/is-regexp');\nvar toString = require('../internals/to-string');\nvar getRegExpFlags = require('../internals/regexp-get-flags');\nvar stickyHelpers = require('../internals/regexp-sticky-helpers');\nvar proxyAccessor = require('../internals/proxy-accessor');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar fails = require('../internals/fails');\nvar hasOwn = require('../internals/has-own-property');\nvar enforceInternalState = require('../internals/internal-state').enforce;\nvar setSpecies = require('../internals/set-species');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar UNSUPPORTED_DOT_ALL = require('../internals/regexp-unsupported-dot-all');\nvar UNSUPPORTED_NCG = require('../internals/regexp-unsupported-ncg');\n\nvar MATCH = wellKnownSymbol('match');\nvar NativeRegExp = globalThis.RegExp;\nvar RegExpPrototype = NativeRegExp.prototype;\nvar SyntaxError = globalThis.SyntaxError;\nvar exec = uncurryThis(RegExpPrototype.exec);\nvar charAt = uncurryThis(''.charAt);\nvar replace = uncurryThis(''.replace);\nvar stringIndexOf = uncurryThis(''.indexOf);\nvar stringSlice = uncurryThis(''.slice);\n// TODO: Use only proper RegExpIdentifierName\nvar IS_NCG = /^\\?<[^\\s\\d!#%&*+<=>@^][^\\s!#%&*+<=>@^]*>/;\nvar re1 = /a/g;\nvar re2 = /a/g;\n\n// \"new\" should create a new object, old webkit bug\nvar CORRECT_NEW = new NativeRegExp(re1) !== re1;\n\nvar MISSED_STICKY = stickyHelpers.MISSED_STICKY;\nvar UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;\n\nvar BASE_FORCED = DESCRIPTORS &&\n (!CORRECT_NEW || MISSED_STICKY || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG || fails(function () {\n re2[MATCH] = false;\n // RegExp constructor can alter flags and IsRegExp works correct with @@match\n // eslint-disable-next-line sonarjs/inconsistent-function-call -- required for testing\n return NativeRegExp(re1) !== re1 || NativeRegExp(re2) === re2 || String(NativeRegExp(re1, 'i')) !== '/a/i';\n }));\n\nvar handleDotAll = function (string) {\n var length = string.length;\n var index = 0;\n var result = '';\n var brackets = false;\n var chr;\n for (; index <= length; index++) {\n chr = charAt(string, index);\n if (chr === '\\\\') {\n result += chr + charAt(string, ++index);\n continue;\n }\n if (!brackets && chr === '.') {\n result += '[\\\\s\\\\S]';\n } else {\n if (chr === '[') {\n brackets = true;\n } else if (chr === ']') {\n brackets = false;\n } result += chr;\n }\n } return result;\n};\n\nvar handleNCG = function (string) {\n var length = string.length;\n var index = 0;\n var result = '';\n var named = [];\n var names = create(null);\n var brackets = false;\n var ncg = false;\n var groupid = 0;\n var groupname = '';\n var chr;\n for (; index <= length; index++) {\n chr = charAt(string, index);\n if (chr === '\\\\') {\n chr += charAt(string, ++index);\n } else if (chr === ']') {\n brackets = false;\n } else if (!brackets) switch (true) {\n case chr === '[':\n brackets = true;\n break;\n case chr === '(':\n result += chr;\n // ignore non-capturing groups\n if (stringSlice(string, index + 1, index + 3) === '?:') {\n continue;\n }\n if (exec(IS_NCG, stringSlice(string, index + 1))) {\n index += 2;\n ncg = true;\n }\n groupid++;\n continue;\n case chr === '>' && ncg:\n if (groupname === '' || hasOwn(names, groupname)) {\n throw new SyntaxError('Invalid capture group name');\n }\n names[groupname] = true;\n named[named.length] = [groupname, groupid];\n ncg = false;\n groupname = '';\n continue;\n }\n if (ncg) groupname += chr;\n else result += chr;\n } return [result, named];\n};\n\n// `RegExp` constructor\n// https://tc39.es/ecma262/#sec-regexp-constructor\nif (isForced('RegExp', BASE_FORCED)) {\n var RegExpWrapper = function RegExp(pattern, flags) {\n var thisIsRegExp = isPrototypeOf(RegExpPrototype, this);\n var patternIsRegExp = isRegExp(pattern);\n var flagsAreUndefined = flags === undefined;\n var groups = [];\n var rawPattern = pattern;\n var rawFlags, dotAll, sticky, handled, result, state;\n\n if (!thisIsRegExp && patternIsRegExp && flagsAreUndefined && pattern.constructor === RegExpWrapper) {\n return pattern;\n }\n\n if (patternIsRegExp || isPrototypeOf(RegExpPrototype, pattern)) {\n pattern = pattern.source;\n if (flagsAreUndefined) flags = getRegExpFlags(rawPattern);\n }\n\n pattern = pattern === undefined ? '' : toString(pattern);\n flags = flags === undefined ? '' : toString(flags);\n rawPattern = pattern;\n\n if (UNSUPPORTED_DOT_ALL && 'dotAll' in re1) {\n dotAll = !!flags && stringIndexOf(flags, 's') > -1;\n if (dotAll) flags = replace(flags, /s/g, '');\n }\n\n rawFlags = flags;\n\n if (MISSED_STICKY && 'sticky' in re1) {\n sticky = !!flags && stringIndexOf(flags, 'y') > -1;\n if (sticky && UNSUPPORTED_Y) flags = replace(flags, /y/g, '');\n }\n\n if (UNSUPPORTED_NCG) {\n handled = handleNCG(pattern);\n pattern = handled[0];\n groups = handled[1];\n }\n\n result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype, RegExpWrapper);\n\n if (dotAll || sticky || groups.length) {\n state = enforceInternalState(result);\n if (dotAll) {\n state.dotAll = true;\n state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags);\n }\n if (sticky) state.sticky = true;\n if (groups.length) state.groups = groups;\n }\n\n if (pattern !== rawPattern) try {\n // fails in old engines, but we have no alternatives for unsupported regex syntax\n createNonEnumerableProperty(result, 'source', rawPattern === '' ? '(?:)' : rawPattern);\n } catch (error) { /* empty */ }\n\n return result;\n };\n\n for (var keys = getOwnPropertyNames(NativeRegExp), index = 0; keys.length > index;) {\n proxyAccessor(RegExpWrapper, NativeRegExp, keys[index++]);\n }\n\n RegExpPrototype.constructor = RegExpWrapper;\n RegExpWrapper.prototype = RegExpPrototype;\n defineBuiltIn(globalThis, 'RegExp', RegExpWrapper, { constructor: true });\n}\n\n// https://tc39.es/ecma262/#sec-get-regexp-@@species\nsetSpecies('RegExp');\n","'use strict';\n// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot\nvar documentAll = typeof document == 'object' && document.all;\n\n// `IsCallable` abstract operation\n// https://tc39.es/ecma262/#sec-iscallable\n// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing\nmodule.exports = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {\n return typeof argument == 'function' || argument === documentAll;\n} : function (argument) {\n return typeof argument == 'function';\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\nvar V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');\nvar anObject = require('../internals/an-object');\nvar toPropertyKey = require('../internals/to-property-key');\n\nvar $TypeError = TypeError;\n// eslint-disable-next-line es/no-object-defineproperty -- safe\nvar $defineProperty = Object.defineProperty;\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar ENUMERABLE = 'enumerable';\nvar CONFIGURABLE = 'configurable';\nvar WRITABLE = 'writable';\n\n// `Object.defineProperty` method\n// https://tc39.es/ecma262/#sec-object.defineproperty\nexports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPropertyKey(P);\n anObject(Attributes);\n if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {\n var current = $getOwnPropertyDescriptor(O, P);\n if (current && current[WRITABLE]) {\n O[P] = Attributes.value;\n Attributes = {\n configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],\n enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],\n writable: false\n };\n }\n } return $defineProperty(O, P, Attributes);\n} : $defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPropertyKey(P);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return $defineProperty(O, P, Attributes);\n } catch (error) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar anObject = require('../internals/an-object');\n\nvar concat = uncurryThis([].concat);\n\n// all object keys, includes non-enumerable and symbols\nmodule.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {\n var keys = getOwnPropertyNamesModule.f(anObject(it));\n var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;\n};\n","'use strict';\n// toObject with fallback for non-array-like ES3 strings\nvar IndexedObject = require('../internals/indexed-object');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nmodule.exports = function (it) {\n return IndexedObject(requireObjectCoercible(it));\n};\n","'use strict';\nvar apply = require('../internals/function-apply');\nvar call = require('../internals/function-call');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');\nvar fails = require('../internals/fails');\nvar anObject = require('../internals/an-object');\nvar isCallable = require('../internals/is-callable');\nvar isObject = require('../internals/is-object');\nvar toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\nvar toLength = require('../internals/to-length');\nvar toString = require('../internals/to-string');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar advanceStringIndex = require('../internals/advance-string-index');\nvar getMethod = require('../internals/get-method');\nvar getSubstitution = require('../internals/get-substitution');\nvar regExpExec = require('../internals/regexp-exec-abstract');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar REPLACE = wellKnownSymbol('replace');\nvar max = Math.max;\nvar min = Math.min;\nvar concat = uncurryThis([].concat);\nvar push = uncurryThis([].push);\nvar stringIndexOf = uncurryThis(''.indexOf);\nvar stringSlice = uncurryThis(''.slice);\n\nvar maybeToString = function (it) {\n return it === undefined ? it : String(it);\n};\n\n// IE <= 11 replaces $0 with the whole match, as if it was $&\n// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0\nvar REPLACE_KEEPS_$0 = (function () {\n // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing\n return 'a'.replace(/./, '$0') === '$0';\n})();\n\n// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string\nvar REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {\n if (/./[REPLACE]) {\n return /./[REPLACE]('a', '$0') === '';\n }\n return false;\n})();\n\nvar REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {\n var re = /./;\n re.exec = function () {\n var result = [];\n result.groups = { a: '7' };\n return result;\n };\n // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive\n return ''.replace(re, '$
') !== '7';\n});\n\n// @@replace logic\nfixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {\n var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';\n\n return [\n // `String.prototype.replace` method\n // https://tc39.es/ecma262/#sec-string.prototype.replace\n function replace(searchValue, replaceValue) {\n var O = requireObjectCoercible(this);\n var replacer = isObject(searchValue) ? getMethod(searchValue, REPLACE) : undefined;\n return replacer\n ? call(replacer, searchValue, O, replaceValue)\n : call(nativeReplace, toString(O), searchValue, replaceValue);\n },\n // `RegExp.prototype[@@replace]` method\n // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace\n function (string, replaceValue) {\n var rx = anObject(this);\n var S = toString(string);\n\n if (\n typeof replaceValue == 'string' &&\n stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&\n stringIndexOf(replaceValue, '$<') === -1\n ) {\n var res = maybeCallNative(nativeReplace, rx, S, replaceValue);\n if (res.done) return res.value;\n }\n\n var functionalReplace = isCallable(replaceValue);\n if (!functionalReplace) replaceValue = toString(replaceValue);\n\n var global = rx.global;\n var fullUnicode;\n if (global) {\n fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n }\n\n var results = [];\n var result;\n while (true) {\n result = regExpExec(rx, S);\n if (result === null) break;\n\n push(results, result);\n if (!global) break;\n\n var matchStr = toString(result[0]);\n if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n }\n\n var accumulatedResult = '';\n var nextSourcePosition = 0;\n for (var i = 0; i < results.length; i++) {\n result = results[i];\n\n var matched = toString(result[0]);\n var position = max(min(toIntegerOrInfinity(result.index), S.length), 0);\n var captures = [];\n var replacement;\n // NOTE: This is equivalent to\n // captures = result.slice(1).map(maybeToString)\n // but for some reason `nativeSlice.call(result, 1, result.length)` (called in\n // the slice polyfill when slicing native arrays) \"doesn't work\" in safari 9 and\n // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.\n for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j]));\n var namedCaptures = result.groups;\n if (functionalReplace) {\n var replacerArgs = concat([matched], captures, position, S);\n if (namedCaptures !== undefined) push(replacerArgs, namedCaptures);\n replacement = toString(apply(replaceValue, undefined, replacerArgs));\n } else {\n replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);\n }\n if (position >= nextSourcePosition) {\n accumulatedResult += stringSlice(S, nextSourcePosition, position) + replacement;\n nextSourcePosition = position + matched.length;\n }\n }\n\n return accumulatedResult + stringSlice(S, nextSourcePosition);\n }\n ];\n}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);\n","'use strict';\nvar isConstructor = require('../internals/is-constructor');\nvar tryToString = require('../internals/try-to-string');\n\nvar $TypeError = TypeError;\n\n// `Assert: IsConstructor(argument) is true`\nmodule.exports = function (argument) {\n if (isConstructor(argument)) return argument;\n throw new $TypeError(tryToString(argument) + ' is not a constructor');\n};\n","'use strict';\nvar toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\n\nvar max = Math.max;\nvar min = Math.min;\n\n// Helper for a popular repeating case of the spec:\n// Let integer be ? ToInteger(index).\n// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).\nmodule.exports = function (index, length) {\n var integer = toIntegerOrInfinity(index);\n return integer < 0 ? max(integer + length, 0) : min(integer, length);\n};\n","'use strict';\nvar store = require('../internals/shared-store');\n\nmodule.exports = function (key, value) {\n return store[key] || (store[key] = value || {});\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar createElement = require('../internals/document-create-element');\n\n// Thanks to IE8 for its funny defineProperty\nmodule.exports = !DESCRIPTORS && !fails(function () {\n // eslint-disable-next-line es/no-object-defineproperty -- required for testing\n return Object.defineProperty(createElement('div'), 'a', {\n get: function () { return 7; }\n }).a !== 7;\n});\n","'use strict';\nvar aCallable = require('../internals/a-callable');\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\n\n// `GetMethod` abstract operation\n// https://tc39.es/ecma262/#sec-getmethod\nmodule.exports = function (V, P) {\n var func = V[P];\n return isNullOrUndefined(func) ? undefined : aCallable(func);\n};\n","'use strict';\nvar aCallable = require('../internals/a-callable');\n\nvar $TypeError = TypeError;\n\nvar PromiseCapability = function (C) {\n var resolve, reject;\n this.promise = new C(function ($$resolve, $$reject) {\n if (resolve !== undefined || reject !== undefined) throw new $TypeError('Bad Promise constructor');\n resolve = $$resolve;\n reject = $$reject;\n });\n this.resolve = aCallable(resolve);\n this.reject = aCallable(reject);\n};\n\n// `NewPromiseCapability` abstract operation\n// https://tc39.es/ecma262/#sec-newpromisecapability\nmodule.exports.f = function (C) {\n return new PromiseCapability(C);\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this-clause');\nvar aCallable = require('../internals/a-callable');\nvar NATIVE_BIND = require('../internals/function-bind-native');\n\nvar bind = uncurryThis(uncurryThis.bind);\n\n// optional / simple context binding\nmodule.exports = function (fn, that) {\n aCallable(fn);\n return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n","// A Javascript implementaion of the \"Tyche-i\" prng algorithm by\n// Samuel Neves and Filipe Araujo.\n// See https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this, strseed = '';\n\n // Set up generator function.\n me.next = function() {\n var b = me.b, c = me.c, d = me.d, a = me.a;\n b = (b << 25) ^ (b >>> 7) ^ c;\n c = (c - d) | 0;\n d = (d << 24) ^ (d >>> 8) ^ a;\n a = (a - b) | 0;\n me.b = b = (b << 20) ^ (b >>> 12) ^ c;\n me.c = c = (c - d) | 0;\n me.d = (d << 16) ^ (c >>> 16) ^ a;\n return me.a = (a - b) | 0;\n };\n\n /* The following is non-inverted tyche, which has better internal\n * bit diffusion, but which is about 25% slower than tyche-i in JS.\n me.next = function() {\n var a = me.a, b = me.b, c = me.c, d = me.d;\n a = (me.a + me.b | 0) >>> 0;\n d = me.d ^ a; d = d << 16 ^ d >>> 16;\n c = me.c + d | 0;\n b = me.b ^ c; b = b << 12 ^ d >>> 20;\n me.a = a = a + b | 0;\n d = d ^ a; me.d = d = d << 8 ^ d >>> 24;\n me.c = c = c + d | 0;\n b = b ^ c;\n return me.b = (b << 7 ^ b >>> 25);\n }\n */\n\n me.a = 0;\n me.b = 0;\n me.c = 2654435769 | 0;\n me.d = 1367130551;\n\n if (seed === Math.floor(seed)) {\n // Integer seed.\n me.a = (seed / 0x100000000) | 0;\n me.b = seed | 0;\n } else {\n // String seed.\n strseed += seed;\n }\n\n // Mix in string seed, then discard an initial batch of 64 values.\n for (var k = 0; k < strseed.length + 20; k++) {\n me.b ^= strseed.charCodeAt(k) | 0;\n me.next();\n }\n}\n\nfunction copy(f, t) {\n t.a = f.a;\n t.b = f.b;\n t.c = f.c;\n t.d = f.d;\n return t;\n};\n\nfunction impl(seed, opts) {\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.tychei = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","'use strict';\nvar shared = require('../internals/shared');\nvar uid = require('../internals/uid');\n\nvar keys = shared('keys');\n\nmodule.exports = function (key) {\n return keys[key] || (keys[key] = uid(key));\n};\n","'use strict';\nvar ENVIRONMENT = require('../internals/environment');\n\nmodule.exports = ENVIRONMENT === 'NODE';\n","'use strict';\nvar toLength = require('../internals/to-length');\n\n// `LengthOfArrayLike` abstract operation\n// https://tc39.es/ecma262/#sec-lengthofarraylike\nmodule.exports = function (obj) {\n return toLength(obj.length);\n};\n","'use strict';\nmodule.exports = {};\n","'use strict';\nvar defineBuiltIn = require('../internals/define-built-in');\n\nmodule.exports = function (target, src, options) {\n for (var key in src) defineBuiltIn(target, key, src[key], options);\n return target;\n};\n","'use strict';\nvar anObject = require('../internals/an-object');\nvar iteratorClose = require('../internals/iterator-close');\n\n// call something on iterator step with safe closing on error\nmodule.exports = function (iterator, fn, value, ENTRIES) {\n try {\n return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);\n } catch (error) {\n iteratorClose(iterator, 'throw', error);\n }\n};\n","'use strict';\nmodule.exports = false;\n","'use strict';\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar create = require('../internals/object-create');\nvar defineProperty = require('../internals/object-define-property').f;\n\nvar UNSCOPABLES = wellKnownSymbol('unscopables');\nvar ArrayPrototype = Array.prototype;\n\n// Array.prototype[@@unscopables]\n// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables\nif (ArrayPrototype[UNSCOPABLES] === undefined) {\n defineProperty(ArrayPrototype, UNSCOPABLES, {\n configurable: true,\n value: create(null)\n });\n}\n\n// add a key to Array.prototype[@@unscopables]\nmodule.exports = function (key) {\n ArrayPrototype[UNSCOPABLES][key] = true;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar newPromiseCapabilityModule = require('../internals/new-promise-capability');\nvar perform = require('../internals/perform');\nvar iterate = require('../internals/iterate');\nvar PROMISE_STATICS_INCORRECT_ITERATION = require('../internals/promise-statics-incorrect-iteration');\n\n// `Promise.all` method\n// https://tc39.es/ecma262/#sec-promise.all\n$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {\n all: function all(iterable) {\n var C = this;\n var capability = newPromiseCapabilityModule.f(C);\n var resolve = capability.resolve;\n var reject = capability.reject;\n var result = perform(function () {\n var $promiseResolve = aCallable(C.resolve);\n var values = [];\n var counter = 0;\n var remaining = 1;\n iterate(iterable, function (promise) {\n var index = counter++;\n var alreadyCalled = false;\n remaining++;\n call($promiseResolve, C, promise).then(function (value) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[index] = value;\n --remaining || resolve(values);\n }, reject);\n });\n --remaining || resolve(values);\n });\n if (result.error) reject(result.value);\n return capability.promise;\n }\n});\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar defineGlobalProperty = require('../internals/define-global-property');\nvar copyConstructorProperties = require('../internals/copy-constructor-properties');\nvar isForced = require('../internals/is-forced');\n\n/*\n options.target - name of the target object\n options.global - target is the global object\n options.stat - export as static methods of target\n options.proto - export as prototype methods of target\n options.real - real prototype method for the `pure` version\n options.forced - export even if the native feature is available\n options.bind - bind methods to the target, required for the `pure` version\n options.wrap - wrap constructors to preventing global pollution, required for the `pure` version\n options.unsafe - use the simple assignment of property instead of delete + defineProperty\n options.sham - add a flag to not completely full polyfills\n options.enumerable - export as enumerable property\n options.dontCallGetSet - prevent calling a getter on target\n options.name - the .name of the function if it does not match the key\n*/\nmodule.exports = function (options, source) {\n var TARGET = options.target;\n var GLOBAL = options.global;\n var STATIC = options.stat;\n var FORCED, target, key, targetProperty, sourceProperty, descriptor;\n if (GLOBAL) {\n target = globalThis;\n } else if (STATIC) {\n target = globalThis[TARGET] || defineGlobalProperty(TARGET, {});\n } else {\n target = globalThis[TARGET] && globalThis[TARGET].prototype;\n }\n if (target) for (key in source) {\n sourceProperty = source[key];\n if (options.dontCallGetSet) {\n descriptor = getOwnPropertyDescriptor(target, key);\n targetProperty = descriptor && descriptor.value;\n } else targetProperty = target[key];\n FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);\n // contained in target\n if (!FORCED && targetProperty !== undefined) {\n if (typeof sourceProperty == typeof targetProperty) continue;\n copyConstructorProperties(sourceProperty, targetProperty);\n }\n // add a flag to not completely full polyfills\n if (options.sham || (targetProperty && targetProperty.sham)) {\n createNonEnumerableProperty(sourceProperty, 'sham', true);\n }\n defineBuiltIn(target, key, sourceProperty, options);\n }\n};\n","'use strict';\nvar call = require('../internals/function-call');\nvar anObject = require('../internals/an-object');\nvar isCallable = require('../internals/is-callable');\nvar classof = require('../internals/classof-raw');\nvar regexpExec = require('../internals/regexp-exec');\n\nvar $TypeError = TypeError;\n\n// `RegExpExec` abstract operation\n// https://tc39.es/ecma262/#sec-regexpexec\nmodule.exports = function (R, S) {\n var exec = R.exec;\n if (isCallable(exec)) {\n var result = call(exec, R, S);\n if (result !== null) anObject(result);\n return result;\n }\n if (classof(R) === 'RegExp') return call(regexpExec, R, S);\n throw new $TypeError('RegExp#exec called on incompatible receiver');\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar definePropertyModule = require('../internals/object-define-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = DESCRIPTORS ? function (object, key, value) {\n return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar aCallable = require('../internals/a-callable');\n\nmodule.exports = function (object, key, method) {\n try {\n // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\n return uncurryThis(aCallable(Object.getOwnPropertyDescriptor(object, key)[method]));\n } catch (error) { /* empty */ }\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');\nvar definePropertyModule = require('../internals/object-define-property');\nvar anObject = require('../internals/an-object');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar objectKeys = require('../internals/object-keys');\n\n// `Object.defineProperties` method\n// https://tc39.es/ecma262/#sec-object.defineproperties\n// eslint-disable-next-line es/no-object-defineproperties -- safe\nexports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var props = toIndexedObject(Properties);\n var keys = objectKeys(Properties);\n var length = keys.length;\n var index = 0;\n var key;\n while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);\n return O;\n};\n","'use strict';\nvar $String = String;\n\nmodule.exports = function (argument) {\n try {\n return $String(argument);\n } catch (error) {\n return 'Object';\n }\n};\n","// A Javascript implementaion of Richard Brent's Xorgens xor4096 algorithm.\n//\n// This fast non-cryptographic random number generator is designed for\n// use in Monte-Carlo algorithms. It combines a long-period xorshift\n// generator with a Weyl generator, and it passes all common batteries\n// of stasticial tests for randomness while consuming only a few nanoseconds\n// for each prng generated. For background on the generator, see Brent's\n// paper: \"Some long-period random number generators using shifts and xors.\"\n// http://arxiv.org/pdf/1004.3115v1.pdf\n//\n// Usage:\n//\n// var xor4096 = require('xor4096');\n// random = xor4096(1); // Seed with int32 or string.\n// assert.equal(random(), 0.1520436450538547); // (0, 1) range, 53 bits.\n// assert.equal(random.int32(), 1806534897); // signed int32, 32 bits.\n//\n// For nonzero numeric keys, this impelementation provides a sequence\n// identical to that by Brent's xorgens 3 implementaion in C. This\n// implementation also provides for initalizing the generator with\n// string seeds, or for saving and restoring the state of the generator.\n//\n// On Chrome, this prng benchmarks about 2.1 times slower than\n// Javascript's built-in Math.random().\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n var w = me.w,\n X = me.X, i = me.i, t, v;\n // Update Weyl generator.\n me.w = w = (w + 0x61c88647) | 0;\n // Update xor generator.\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n // Update Xor generator array state.\n v = X[i] = v ^ t;\n me.i = i;\n // Result is the combination.\n return (v + (w ^ (w >>> 16))) | 0;\n };\n\n function init(me, seed) {\n var t, v, i, j, w, X = [], limit = 128;\n if (seed === (seed | 0)) {\n // Numeric seeds initialize v, which is used to generates X.\n v = seed;\n seed = null;\n } else {\n // String seeds are mixed into v and X one character at a time.\n seed = seed + '\\0';\n v = 0;\n limit = Math.max(limit, seed.length);\n }\n // Initialize circular array and weyl value.\n for (i = 0, j = -32; j < limit; ++j) {\n // Put the unicode characters into the array, and shuffle them.\n if (seed) v ^= seed.charCodeAt((j + 32) % seed.length);\n // After 32 shuffles, take v as the starting w value.\n if (j === 0) w = v;\n v ^= v << 10;\n v ^= v >>> 15;\n v ^= v << 4;\n v ^= v >>> 13;\n if (j >= 0) {\n w = (w + 0x61c88647) | 0; // Weyl.\n t = (X[j & 127] ^= (v + w)); // Combine xor and weyl to init array.\n i = (0 == t) ? i + 1 : 0; // Count zeroes.\n }\n }\n // We have detected all zeroes; make the key nonzero.\n if (i >= 128) {\n X[(seed && seed.length || 0) & 127] = -1;\n }\n // Run the generator 512 times to further mix the state before using it.\n // Factoring this as a function slows the main generator, so it is just\n // unrolled here. The weyl generator is not advanced while warming up.\n i = 127;\n for (j = 4 * 128; j > 0; --j) {\n v = X[(i + 34) & 127];\n t = X[i = ((i + 1) & 127)];\n v ^= v << 13;\n t ^= t << 17;\n v ^= v >>> 15;\n t ^= t >>> 12;\n X[i] = v ^ t;\n }\n // Storing state as object members is faster than using closure variables.\n me.w = w;\n me.X = X;\n me.i = i;\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.i = f.i;\n t.w = f.w;\n t.X = f.X.slice();\n return t;\n};\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.X) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xor4096 = impl;\n}\n\n})(\n this, // window object or global\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n","'use strict';\nvar isCallable = require('../internals/is-callable');\nvar definePropertyModule = require('../internals/object-define-property');\nvar makeBuiltIn = require('../internals/make-built-in');\nvar defineGlobalProperty = require('../internals/define-global-property');\n\nmodule.exports = function (O, key, value, options) {\n if (!options) options = {};\n var simple = options.enumerable;\n var name = options.name !== undefined ? options.name : key;\n if (isCallable(value)) makeBuiltIn(value, name, options);\n if (options.global) {\n if (simple) O[key] = value;\n else defineGlobalProperty(key, value);\n } else {\n try {\n if (!options.unsafe) delete O[key];\n else if (O[key]) simple = true;\n } catch (error) { /* empty */ }\n if (simple) O[key] = value;\n else definePropertyModule.f(O, key, {\n value: value,\n enumerable: false,\n configurable: !options.nonConfigurable,\n writable: !options.nonWritable\n });\n } return O;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar aCallable = require('../internals/a-callable');\nvar toObject = require('../internals/to-object');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar deletePropertyOrThrow = require('../internals/delete-property-or-throw');\nvar toString = require('../internals/to-string');\nvar fails = require('../internals/fails');\nvar internalSort = require('../internals/array-sort');\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar FF = require('../internals/environment-ff-version');\nvar IE_OR_EDGE = require('../internals/environment-is-ie-or-edge');\nvar V8 = require('../internals/environment-v8-version');\nvar WEBKIT = require('../internals/environment-webkit-version');\n\nvar test = [];\nvar nativeSort = uncurryThis(test.sort);\nvar push = uncurryThis(test.push);\n\n// IE8-\nvar FAILS_ON_UNDEFINED = fails(function () {\n test.sort(undefined);\n});\n// V8 bug\nvar FAILS_ON_NULL = fails(function () {\n test.sort(null);\n});\n// Old WebKit\nvar STRICT_METHOD = arrayMethodIsStrict('sort');\n\nvar STABLE_SORT = !fails(function () {\n // feature detection can be too slow, so check engines versions\n if (V8) return V8 < 70;\n if (FF && FF > 3) return;\n if (IE_OR_EDGE) return true;\n if (WEBKIT) return WEBKIT < 603;\n\n var result = '';\n var code, chr, value, index;\n\n // generate an array with more 512 elements (Chakra and old V8 fails only in this case)\n for (code = 65; code < 76; code++) {\n chr = String.fromCharCode(code);\n\n switch (code) {\n case 66: case 69: case 70: case 72: value = 3; break;\n case 68: case 71: value = 4; break;\n default: value = 2;\n }\n\n for (index = 0; index < 47; index++) {\n test.push({ k: chr + index, v: value });\n }\n }\n\n test.sort(function (a, b) { return b.v - a.v; });\n\n for (index = 0; index < test.length; index++) {\n chr = test[index].k.charAt(0);\n if (result.charAt(result.length - 1) !== chr) result += chr;\n }\n\n return result !== 'DGBEFHACIJK';\n});\n\nvar FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;\n\nvar getSortCompare = function (comparefn) {\n return function (x, y) {\n if (y === undefined) return -1;\n if (x === undefined) return 1;\n if (comparefn !== undefined) return +comparefn(x, y) || 0;\n return toString(x) > toString(y) ? 1 : -1;\n };\n};\n\n// `Array.prototype.sort` method\n// https://tc39.es/ecma262/#sec-array.prototype.sort\n$({ target: 'Array', proto: true, forced: FORCED }, {\n sort: function sort(comparefn) {\n if (comparefn !== undefined) aCallable(comparefn);\n\n var array = toObject(this);\n\n if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);\n\n var items = [];\n var arrayLength = lengthOfArrayLike(array);\n var itemsLength, index;\n\n for (index = 0; index < arrayLength; index++) {\n if (index in array) push(items, array[index]);\n }\n\n internalSort(items, getSortCompare(comparefn));\n\n itemsLength = lengthOfArrayLike(items);\n index = 0;\n\n while (index < itemsLength) array[index] = items[index++];\n while (index < arrayLength) deletePropertyOrThrow(array, index++);\n\n return array;\n }\n});\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar isArray = require('../internals/is-array');\nvar isCallable = require('../internals/is-callable');\nvar classof = require('../internals/classof-raw');\nvar toString = require('../internals/to-string');\n\nvar push = uncurryThis([].push);\n\nmodule.exports = function (replacer) {\n if (isCallable(replacer)) return replacer;\n if (!isArray(replacer)) return;\n var rawLength = replacer.length;\n var keys = [];\n for (var i = 0; i < rawLength; i++) {\n var element = replacer[i];\n if (typeof element == 'string') push(keys, element);\n else if (typeof element == 'number' || classof(element) === 'Number' || classof(element) === 'String') push(keys, toString(element));\n }\n var keysLength = keys.length;\n var root = true;\n return function (key, value) {\n if (root) {\n root = false;\n return value;\n }\n if (isArray(this)) return value;\n for (var j = 0; j < keysLength; j++) if (keys[j] === key) return value;\n };\n};\n","'use strict';\nvar TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');\nvar isCallable = require('../internals/is-callable');\nvar classofRaw = require('../internals/classof-raw');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\nvar $Object = Object;\n\n// ES3 wrong here\nvar CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (error) { /* empty */ }\n};\n\n// getting tag from ES6+ `Object.prototype.toString`\nmodule.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {\n var O, tag, result;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag\n // builtinTag case\n : CORRECT_ARGUMENTS ? classofRaw(O)\n // ES3 arguments fallback\n : (result = classofRaw(O)) === 'Object' && isCallable(O.callee) ? 'Arguments' : result;\n};\n","'use strict';\nvar toPrimitive = require('../internals/to-primitive');\nvar isSymbol = require('../internals/is-symbol');\n\n// `ToPropertyKey` abstract operation\n// https://tc39.es/ecma262/#sec-topropertykey\nmodule.exports = function (argument) {\n var key = toPrimitive(argument, 'string');\n return isSymbol(key) ? key : key + '';\n};\n","'use strict';\nmodule.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n","'use strict';\n/* eslint-disable es/no-symbol -- required for testing */\nvar NATIVE_SYMBOL = require('../internals/symbol-constructor-detection');\n\nmodule.exports = NATIVE_SYMBOL &&\n !Symbol.sham &&\n typeof Symbol.iterator == 'symbol';\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar fails = require('../internals/fails');\nvar classof = require('../internals/classof-raw');\n\nvar $Object = Object;\nvar split = uncurryThis(''.split);\n\n// fallback for non-array-like ES3 and non-enumerable old V8 strings\nmodule.exports = fails(function () {\n // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346\n // eslint-disable-next-line no-prototype-builtins -- safe\n return !$Object('z').propertyIsEnumerable(0);\n}) ? function (it) {\n return classof(it) === 'String' ? split(it, '') : $Object(it);\n} : $Object;\n","// A port of an algorithm by Johannes Baagøe , 2010\n// http://baagoe.com/en/RandomMusings/javascript/\n// https://github.com/nquinlan/better-random-numbers-for-javascript-mirror\n// Original work is under MIT license -\n\n// Copyright (C) 2010 by Johannes Baagøe \n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n\n\n(function(global, module, define) {\n\nfunction Alea(seed) {\n var me = this, mash = Mash();\n\n me.next = function() {\n var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32\n me.s0 = me.s1;\n me.s1 = me.s2;\n return me.s2 = t - (me.c = t | 0);\n };\n\n // Apply the seeding algorithm from Baagoe.\n me.c = 1;\n me.s0 = mash(' ');\n me.s1 = mash(' ');\n me.s2 = mash(' ');\n me.s0 -= mash(seed);\n if (me.s0 < 0) { me.s0 += 1; }\n me.s1 -= mash(seed);\n if (me.s1 < 0) { me.s1 += 1; }\n me.s2 -= mash(seed);\n if (me.s2 < 0) { me.s2 += 1; }\n mash = null;\n}\n\nfunction copy(f, t) {\n t.c = f.c;\n t.s0 = f.s0;\n t.s1 = f.s1;\n t.s2 = f.s2;\n return t;\n}\n\nfunction impl(seed, opts) {\n var xg = new Alea(seed),\n state = opts && opts.state,\n prng = xg.next;\n prng.int32 = function() { return (xg.next() * 0x100000000) | 0; }\n prng.double = function() {\n return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53\n };\n prng.quick = prng;\n if (state) {\n if (typeof(state) == 'object') copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nfunction Mash() {\n var n = 0xefc8249d;\n\n var mash = function(data) {\n data = String(data);\n for (var i = 0; i < data.length; i++) {\n n += data.charCodeAt(i);\n var h = 0.02519603282416938 * n;\n n = h >>> 0;\n h -= n;\n h *= n;\n n = h >>> 0;\n h -= n;\n n += h * 0x100000000; // 2^32\n }\n return (n >>> 0) * 2.3283064365386963e-10; // 2^-32\n };\n\n return mash;\n}\n\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.alea = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n\n","'use strict';\n/* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */\n/* eslint-disable regexp/no-useless-quantifier -- testing */\nvar call = require('../internals/function-call');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar toString = require('../internals/to-string');\nvar regexpFlags = require('../internals/regexp-flags');\nvar stickyHelpers = require('../internals/regexp-sticky-helpers');\nvar shared = require('../internals/shared');\nvar create = require('../internals/object-create');\nvar getInternalState = require('../internals/internal-state').get;\nvar UNSUPPORTED_DOT_ALL = require('../internals/regexp-unsupported-dot-all');\nvar UNSUPPORTED_NCG = require('../internals/regexp-unsupported-ncg');\n\nvar nativeReplace = shared('native-string-replace', String.prototype.replace);\nvar nativeExec = RegExp.prototype.exec;\nvar patchedExec = nativeExec;\nvar charAt = uncurryThis(''.charAt);\nvar indexOf = uncurryThis(''.indexOf);\nvar replace = uncurryThis(''.replace);\nvar stringSlice = uncurryThis(''.slice);\n\nvar UPDATES_LAST_INDEX_WRONG = (function () {\n var re1 = /a/;\n var re2 = /b*/g;\n call(nativeExec, re1, 'a');\n call(nativeExec, re2, 'a');\n return re1.lastIndex !== 0 || re2.lastIndex !== 0;\n})();\n\nvar UNSUPPORTED_Y = stickyHelpers.BROKEN_CARET;\n\n// nonparticipating capturing group, copied from es5-shim's String#split patch.\nvar NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;\n\nvar PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;\n\nif (PATCH) {\n patchedExec = function exec(string) {\n var re = this;\n var state = getInternalState(re);\n var str = toString(string);\n var raw = state.raw;\n var result, reCopy, lastIndex, match, i, object, group;\n\n if (raw) {\n raw.lastIndex = re.lastIndex;\n result = call(patchedExec, raw, str);\n re.lastIndex = raw.lastIndex;\n return result;\n }\n\n var groups = state.groups;\n var sticky = UNSUPPORTED_Y && re.sticky;\n var flags = call(regexpFlags, re);\n var source = re.source;\n var charsAdded = 0;\n var strCopy = str;\n\n if (sticky) {\n flags = replace(flags, 'y', '');\n if (indexOf(flags, 'g') === -1) {\n flags += 'g';\n }\n\n strCopy = stringSlice(str, re.lastIndex);\n // Support anchored sticky behavior.\n if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt(str, re.lastIndex - 1) !== '\\n')) {\n source = '(?: ' + source + ')';\n strCopy = ' ' + strCopy;\n charsAdded++;\n }\n // ^(? + rx + ) is needed, in combination with some str slicing, to\n // simulate the 'y' flag.\n reCopy = new RegExp('^(?:' + source + ')', flags);\n }\n\n if (NPCG_INCLUDED) {\n reCopy = new RegExp('^' + source + '$(?!\\\\s)', flags);\n }\n if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;\n\n match = call(nativeExec, sticky ? reCopy : re, strCopy);\n\n if (sticky) {\n if (match) {\n match.input = stringSlice(match.input, charsAdded);\n match[0] = stringSlice(match[0], charsAdded);\n match.index = re.lastIndex;\n re.lastIndex += match[0].length;\n } else re.lastIndex = 0;\n } else if (UPDATES_LAST_INDEX_WRONG && match) {\n re.lastIndex = re.global ? match.index + match[0].length : lastIndex;\n }\n if (NPCG_INCLUDED && match && match.length > 1) {\n // Fix browsers whose `exec` methods don't consistently return `undefined`\n // for NPCG, like IE8. NOTE: This doesn't work for /(.?)?/\n call(nativeReplace, match[0], reCopy, function () {\n for (i = 1; i < arguments.length - 2; i++) {\n if (arguments[i] === undefined) match[i] = undefined;\n }\n });\n }\n\n if (match && groups) {\n match.groups = object = create(null);\n for (i = 0; i < groups.length; i++) {\n group = groups[i];\n object[group[0]] = match[group[1]];\n }\n }\n\n return match;\n };\n}\n\nmodule.exports = patchedExec;\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar call = require('../internals/function-call');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toPropertyKey = require('../internals/to-property-key');\nvar hasOwn = require('../internals/has-own-property');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\n\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor\nexports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {\n O = toIndexedObject(O);\n P = toPropertyKey(P);\n if (IE8_DOM_DEFINE) try {\n return $getOwnPropertyDescriptor(O, P);\n } catch (error) { /* empty */ }\n if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);\n};\n","// A library of seedable RNGs implemented in Javascript.\n//\n// Usage:\n//\n// var seedrandom = require('seedrandom');\n// var random = seedrandom(1); // or any seed.\n// var x = random(); // 0 <= x < 1. Every bit is random.\n// var x = random.quick(); // 0 <= x < 1. 32 bits of randomness.\n\n// alea, a 53-bit multiply-with-carry generator by Johannes Baagøe.\n// Period: ~2^116\n// Reported to pass all BigCrush tests.\nvar alea = require('./lib/alea');\n\n// xor128, a pure xor-shift generator by George Marsaglia.\n// Period: 2^128-1.\n// Reported to fail: MatrixRank and LinearComp.\nvar xor128 = require('./lib/xor128');\n\n// xorwow, George Marsaglia's 160-bit xor-shift combined plus weyl.\n// Period: 2^192-2^32\n// Reported to fail: CollisionOver, SimpPoker, and LinearComp.\nvar xorwow = require('./lib/xorwow');\n\n// xorshift7, by François Panneton and Pierre L'ecuyer, takes\n// a different approach: it adds robustness by allowing more shifts\n// than Marsaglia's original three. It is a 7-shift generator\n// with 256 bits, that passes BigCrush with no systmatic failures.\n// Period 2^256-1.\n// No systematic BigCrush failures reported.\nvar xorshift7 = require('./lib/xorshift7');\n\n// xor4096, by Richard Brent, is a 4096-bit xor-shift with a\n// very long period that also adds a Weyl generator. It also passes\n// BigCrush with no systematic failures. Its long period may\n// be useful if you have many generators and need to avoid\n// collisions.\n// Period: 2^4128-2^32.\n// No systematic BigCrush failures reported.\nvar xor4096 = require('./lib/xor4096');\n\n// Tyche-i, by Samuel Neves and Filipe Araujo, is a bit-shifting random\n// number generator derived from ChaCha, a modern stream cipher.\n// https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf\n// Period: ~2^127\n// No systematic BigCrush failures reported.\nvar tychei = require('./lib/tychei');\n\n// The original ARC4-based prng included in this library.\n// Period: ~2^1600\nvar sr = require('./seedrandom');\n\nsr.alea = alea;\nsr.xor128 = xor128;\nsr.xorwow = xorwow;\nsr.xorshift7 = xorshift7;\nsr.xor4096 = xor4096;\nsr.tychei = tychei;\n\nmodule.exports = sr;\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar UNSUPPORTED_DOT_ALL = require('../internals/regexp-unsupported-dot-all');\nvar classof = require('../internals/classof-raw');\nvar defineBuiltInAccessor = require('../internals/define-built-in-accessor');\nvar getInternalState = require('../internals/internal-state').get;\n\nvar RegExpPrototype = RegExp.prototype;\nvar $TypeError = TypeError;\n\n// `RegExp.prototype.dotAll` getter\n// https://tc39.es/ecma262/#sec-get-regexp.prototype.dotall\nif (DESCRIPTORS && UNSUPPORTED_DOT_ALL) {\n defineBuiltInAccessor(RegExpPrototype, 'dotAll', {\n configurable: true,\n get: function dotAll() {\n if (this === RegExpPrototype) return;\n // We can't use InternalStateModule.getterFor because\n // we don't add metadata for regexps created by a literal.\n if (classof(this) === 'RegExp') {\n return !!getInternalState(this).dotAll;\n }\n throw new $TypeError('Incompatible receiver, RegExp required');\n }\n });\n}\n","'use strict';\nvar classofRaw = require('../internals/classof-raw');\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nmodule.exports = function (fn) {\n // Nashorn bug:\n // https://github.com/zloirock/core-js/issues/1128\n // https://github.com/zloirock/core-js/issues/1130\n if (classofRaw(fn) === 'Function') return uncurryThis(fn);\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar exec = require('../internals/regexp-exec');\n\n// `RegExp.prototype.exec` method\n// https://tc39.es/ecma262/#sec-regexp.prototype.exec\n$({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {\n exec: exec\n});\n","'use strict';\n// TODO: Remove from `core-js@4`\nrequire('../modules/es.iterator.some');\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar iterate = require('../internals/iterate');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\nvar getIteratorDirect = require('../internals/get-iterator-direct');\nvar iteratorClose = require('../internals/iterator-close');\nvar iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');\n\nvar forEachWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('forEach', TypeError);\n\n// `Iterator.prototype.forEach` method\n// https://tc39.es/ecma262/#sec-iterator.prototype.foreach\n$({ target: 'Iterator', proto: true, real: true, forced: forEachWithoutClosingOnEarlyError }, {\n forEach: function forEach(fn) {\n anObject(this);\n try {\n aCallable(fn);\n } catch (error) {\n iteratorClose(this, 'throw', error);\n }\n\n if (forEachWithoutClosingOnEarlyError) return call(forEachWithoutClosingOnEarlyError, this, fn);\n\n var record = getIteratorDirect(this);\n var counter = 0;\n iterate(record, function (value) {\n fn(value, counter++);\n }, { IS_RECORD: true });\n }\n});\n","'use strict';\nvar IS_PURE = require('../internals/is-pure');\nvar globalThis = require('../internals/global-this');\nvar defineGlobalProperty = require('../internals/define-global-property');\n\nvar SHARED = '__core-js_shared__';\nvar store = module.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});\n\n(store.versions || (store.versions = [])).push({\n version: '3.42.0',\n mode: IS_PURE ? 'pure' : 'global',\n copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)',\n license: 'https://github.com/zloirock/core-js/blob/v3.42.0/LICENSE',\n source: 'https://github.com/zloirock/core-js'\n});\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\nvar defineBuiltInAccessor = require('../internals/define-built-in-accessor');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar DESCRIPTORS = require('../internals/descriptors');\n\nvar SPECIES = wellKnownSymbol('species');\n\nmodule.exports = function (CONSTRUCTOR_NAME) {\n var Constructor = getBuiltIn(CONSTRUCTOR_NAME);\n\n if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {\n defineBuiltInAccessor(Constructor, SPECIES, {\n configurable: true,\n get: function () { return this; }\n });\n }\n};\n","'use strict';\nvar fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\nvar isObject = require('../internals/is-object');\nvar create = require('../internals/object-create');\nvar getPrototypeOf = require('../internals/object-get-prototype-of');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar IS_PURE = require('../internals/is-pure');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar BUGGY_SAFARI_ITERATORS = false;\n\n// `%IteratorPrototype%` object\n// https://tc39.es/ecma262/#sec-%iteratorprototype%-object\nvar IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;\n\n/* eslint-disable es/no-array-prototype-keys -- safe */\nif ([].keys) {\n arrayIterator = [].keys();\n // Safari 8 has buggy iterators w/o `next`\n if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;\n else {\n PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));\n if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;\n }\n}\n\nvar NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype) || fails(function () {\n var test = {};\n // FF44- legacy iterators case\n return IteratorPrototype[ITERATOR].call(test) !== test;\n});\n\nif (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};\nelse if (IS_PURE) IteratorPrototype = create(IteratorPrototype);\n\n// `%IteratorPrototype%[@@iterator]()` method\n// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator\nif (!isCallable(IteratorPrototype[ITERATOR])) {\n defineBuiltIn(IteratorPrototype, ITERATOR, function () {\n return this;\n });\n}\n\nmodule.exports = {\n IteratorPrototype: IteratorPrototype,\n BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nmodule.exports = uncurryThis([].slice);\n","'use strict';\nvar hasOwn = require('../internals/has-own-property');\nvar ownKeys = require('../internals/own-keys');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar definePropertyModule = require('../internals/object-define-property');\n\nmodule.exports = function (target, source, exceptions) {\n var keys = ownKeys(source);\n var defineProperty = definePropertyModule.f;\n var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {\n defineProperty(target, key, getOwnPropertyDescriptor(source, key));\n }\n }\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar newPromiseCapabilityModule = require('../internals/new-promise-capability');\nvar perform = require('../internals/perform');\nvar iterate = require('../internals/iterate');\nvar PROMISE_STATICS_INCORRECT_ITERATION = require('../internals/promise-statics-incorrect-iteration');\n\n// `Promise.race` method\n// https://tc39.es/ecma262/#sec-promise.race\n$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {\n race: function race(iterable) {\n var C = this;\n var capability = newPromiseCapabilityModule.f(C);\n var reject = capability.reject;\n var result = perform(function () {\n var $promiseResolve = aCallable(C.resolve);\n iterate(iterable, function (promise) {\n call($promiseResolve, C, promise).then(capability.resolve, reject);\n });\n });\n if (result.error) reject(result.value);\n return capability.promise;\n }\n});\n","'use strict';\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\n\nvar $TypeError = TypeError;\n\n// `RequireObjectCoercible` abstract operation\n// https://tc39.es/ecma262/#sec-requireobjectcoercible\nmodule.exports = function (it) {\n if (isNullOrUndefined(it)) throw new $TypeError(\"Can't call method on \" + it);\n return it;\n};\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar isCallable = require('../internals/is-callable');\n\nvar aFunction = function (argument) {\n return isCallable(argument) ? argument : undefined;\n};\n\nmodule.exports = function (namespace, method) {\n return arguments.length < 2 ? aFunction(globalThis[namespace]) : globalThis[namespace] && globalThis[namespace][method];\n};\n","'use strict';\nvar charAt = require('../internals/string-multibyte').charAt;\n\n// `AdvanceStringIndex` abstract operation\n// https://tc39.es/ecma262/#sec-advancestringindex\nmodule.exports = function (S, index, unicode) {\n return index + (unicode ? charAt(S, index).length : 1);\n};\n","'use strict';\nvar userAgent = require('../internals/environment-user-agent');\n\nmodule.exports = /web0s(?!.*chrome)/i.test(userAgent);\n","'use strict';\nvar anObject = require('../internals/an-object');\n\n// `RegExp.prototype.flags` getter implementation\n// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags\nmodule.exports = function () {\n var that = anObject(this);\n var result = '';\n if (that.hasIndices) result += 'd';\n if (that.global) result += 'g';\n if (that.ignoreCase) result += 'i';\n if (that.multiline) result += 'm';\n if (that.dotAll) result += 's';\n if (that.unicode) result += 'u';\n if (that.unicodeSets) result += 'v';\n if (that.sticky) result += 'y';\n return result;\n};\n","'use strict';\nvar toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\n\nvar min = Math.min;\n\n// `ToLength` abstract operation\n// https://tc39.es/ecma262/#sec-tolength\nmodule.exports = function (argument) {\n var len = toIntegerOrInfinity(argument);\n return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar globalThis = require('../internals/global-this');\nvar anInstance = require('../internals/an-instance');\nvar anObject = require('../internals/an-object');\nvar isCallable = require('../internals/is-callable');\nvar getPrototypeOf = require('../internals/object-get-prototype-of');\nvar defineBuiltInAccessor = require('../internals/define-built-in-accessor');\nvar createProperty = require('../internals/create-property');\nvar fails = require('../internals/fails');\nvar hasOwn = require('../internals/has-own-property');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar IteratorPrototype = require('../internals/iterators-core').IteratorPrototype;\nvar DESCRIPTORS = require('../internals/descriptors');\nvar IS_PURE = require('../internals/is-pure');\n\nvar CONSTRUCTOR = 'constructor';\nvar ITERATOR = 'Iterator';\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\n\nvar $TypeError = TypeError;\nvar NativeIterator = globalThis[ITERATOR];\n\n// FF56- have non-standard global helper `Iterator`\nvar FORCED = IS_PURE\n || !isCallable(NativeIterator)\n || NativeIterator.prototype !== IteratorPrototype\n // FF44- non-standard `Iterator` passes previous tests\n || !fails(function () { NativeIterator({}); });\n\nvar IteratorConstructor = function Iterator() {\n anInstance(this, IteratorPrototype);\n if (getPrototypeOf(this) === IteratorPrototype) throw new $TypeError('Abstract class Iterator not directly constructable');\n};\n\nvar defineIteratorPrototypeAccessor = function (key, value) {\n if (DESCRIPTORS) {\n defineBuiltInAccessor(IteratorPrototype, key, {\n configurable: true,\n get: function () {\n return value;\n },\n set: function (replacement) {\n anObject(this);\n if (this === IteratorPrototype) throw new $TypeError(\"You can't redefine this property\");\n if (hasOwn(this, key)) this[key] = replacement;\n else createProperty(this, key, replacement);\n }\n });\n } else IteratorPrototype[key] = value;\n};\n\nif (!hasOwn(IteratorPrototype, TO_STRING_TAG)) defineIteratorPrototypeAccessor(TO_STRING_TAG, ITERATOR);\n\nif (FORCED || !hasOwn(IteratorPrototype, CONSTRUCTOR) || IteratorPrototype[CONSTRUCTOR] === Object) {\n defineIteratorPrototypeAccessor(CONSTRUCTOR, IteratorConstructor);\n}\n\nIteratorConstructor.prototype = IteratorPrototype;\n\n// `Iterator` constructor\n// https://tc39.es/ecma262/#sec-iterator\n$({ global: true, constructor: true, forced: FORCED }, {\n Iterator: IteratorConstructor\n});\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\nvar toString = require('../internals/to-string');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nvar charAt = uncurryThis(''.charAt);\nvar charCodeAt = uncurryThis(''.charCodeAt);\nvar stringSlice = uncurryThis(''.slice);\n\nvar createMethod = function (CONVERT_TO_STRING) {\n return function ($this, pos) {\n var S = toString(requireObjectCoercible($this));\n var position = toIntegerOrInfinity(pos);\n var size = S.length;\n var first, second;\n if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;\n first = charCodeAt(S, position);\n return first < 0xD800 || first > 0xDBFF || position + 1 === size\n || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF\n ? CONVERT_TO_STRING\n ? charAt(S, position)\n : first\n : CONVERT_TO_STRING\n ? stringSlice(S, position, position + 2)\n : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;\n };\n};\n\nmodule.exports = {\n // `String.prototype.codePointAt` method\n // https://tc39.es/ecma262/#sec-string.prototype.codepointat\n codeAt: createMethod(false),\n // `String.prototype.at` method\n // https://github.com/mathiasbynens/String.prototype.at\n charAt: createMethod(true)\n};\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar shared = require('../internals/shared');\nvar hasOwn = require('../internals/has-own-property');\nvar uid = require('../internals/uid');\nvar NATIVE_SYMBOL = require('../internals/symbol-constructor-detection');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\n\nvar Symbol = globalThis.Symbol;\nvar WellKnownSymbolsStore = shared('wks');\nvar createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol['for'] || Symbol : Symbol && Symbol.withoutSetter || uid;\n\nmodule.exports = function (name) {\n if (!hasOwn(WellKnownSymbolsStore, name)) {\n WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name)\n ? Symbol[name]\n : createWellKnownSymbol('Symbol.' + name);\n } return WellKnownSymbolsStore[name];\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar iterate = require('../internals/iterate');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\nvar getIteratorDirect = require('../internals/get-iterator-direct');\nvar iteratorClose = require('../internals/iterator-close');\nvar iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');\nvar apply = require('../internals/function-apply');\nvar fails = require('../internals/fails');\n\nvar $TypeError = TypeError;\n\n// https://bugs.webkit.org/show_bug.cgi?id=291651\nvar FAILS_ON_INITIAL_UNDEFINED = fails(function () {\n // eslint-disable-next-line es/no-iterator-prototype-reduce, es/no-array-prototype-keys, array-callback-return -- required for testing\n [].keys().reduce(function () { /* empty */ }, undefined);\n});\n\nvar reduceWithoutClosingOnEarlyError = !FAILS_ON_INITIAL_UNDEFINED && iteratorHelperWithoutClosingOnEarlyError('reduce', $TypeError);\n\n// `Iterator.prototype.reduce` method\n// https://tc39.es/ecma262/#sec-iterator.prototype.reduce\n$({ target: 'Iterator', proto: true, real: true, forced: FAILS_ON_INITIAL_UNDEFINED || reduceWithoutClosingOnEarlyError }, {\n reduce: function reduce(reducer /* , initialValue */) {\n anObject(this);\n try {\n aCallable(reducer);\n } catch (error) {\n iteratorClose(this, 'throw', error);\n }\n\n var noInitial = arguments.length < 2;\n var accumulator = noInitial ? undefined : arguments[1];\n if (reduceWithoutClosingOnEarlyError) {\n return apply(reduceWithoutClosingOnEarlyError, this, noInitial ? [reducer] : [reducer, accumulator]);\n }\n var record = getIteratorDirect(this);\n var counter = 0;\n iterate(record, function (value) {\n if (noInitial) {\n noInitial = false;\n accumulator = value;\n } else {\n accumulator = reducer(accumulator, value, counter);\n }\n counter++;\n }, { IS_RECORD: true });\n if (noInitial) throw new $TypeError('Reduce of empty iterator with no initial value');\n return accumulator;\n }\n});\n","'use strict';\nvar Queue = function () {\n this.head = null;\n this.tail = null;\n};\n\nQueue.prototype = {\n add: function (item) {\n var entry = { item: item, next: null };\n var tail = this.tail;\n if (tail) tail.next = entry;\n else this.head = entry;\n this.tail = entry;\n },\n get: function () {\n var entry = this.head;\n if (entry) {\n var next = this.head = entry.next;\n if (next === null) this.tail = null;\n return entry.item;\n }\n }\n};\n\nmodule.exports = Queue;\n","'use strict';\nvar fails = require('../internals/fails');\nvar globalThis = require('../internals/global-this');\n\n// babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError\nvar $RegExp = globalThis.RegExp;\n\nvar UNSUPPORTED_Y = fails(function () {\n var re = $RegExp('a', 'y');\n re.lastIndex = 2;\n return re.exec('abcd') !== null;\n});\n\n// UC Browser bug\n// https://github.com/zloirock/core-js/issues/1008\nvar MISSED_STICKY = UNSUPPORTED_Y || fails(function () {\n return !$RegExp('a', 'y').sticky;\n});\n\nvar BROKEN_CARET = UNSUPPORTED_Y || fails(function () {\n // https://bugzilla.mozilla.org/show_bug.cgi?id=773687\n var re = $RegExp('^r', 'gy');\n re.lastIndex = 2;\n return re.exec('str') !== null;\n});\n\nmodule.exports = {\n BROKEN_CARET: BROKEN_CARET,\n MISSED_STICKY: MISSED_STICKY,\n UNSUPPORTED_Y: UNSUPPORTED_Y\n};\n","'use strict';\nvar internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\nvar hiddenKeys = enumBugKeys.concat('length', 'prototype');\n\n// `Object.getOwnPropertyNames` method\n// https://tc39.es/ecma262/#sec-object.getownpropertynames\n// eslint-disable-next-line es/no-object-getownpropertynames -- safe\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return internalObjectKeys(O, hiddenKeys);\n};\n","'use strict';\nvar isObject = require('../internals/is-object');\n\nvar $String = String;\nvar $TypeError = TypeError;\n\n// `Assert: Type(argument) is Object`\nmodule.exports = function (argument) {\n if (isObject(argument)) return argument;\n throw new $TypeError($String(argument) + ' is not an object');\n};\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar isCallable = require('../internals/is-callable');\n\nvar WeakMap = globalThis.WeakMap;\n\nmodule.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\n\n// V8 ~ Chrome 36-\n// https://bugs.chromium.org/p/v8/issues/detail?id=3334\nmodule.exports = DESCRIPTORS && fails(function () {\n // eslint-disable-next-line es/no-object-defineproperty -- required for testing\n return Object.defineProperty(function () { /* empty */ }, 'prototype', {\n value: 42,\n writable: false\n }).prototype !== 42;\n});\n","'use strict';\n// IE8- don't enum bug keys\nmodule.exports = [\n 'constructor',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'toLocaleString',\n 'toString',\n 'valueOf'\n];\n","'use strict';\nvar NATIVE_BIND = require('../internals/function-bind-native');\n\nvar FunctionPrototype = Function.prototype;\nvar apply = FunctionPrototype.apply;\nvar call = FunctionPrototype.call;\n\n// eslint-disable-next-line es/no-function-prototype-bind, es/no-reflect -- safe\nmodule.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {\n return call.apply(apply, arguments);\n});\n","'use strict';\nvar $propertyIsEnumerable = {}.propertyIsEnumerable;\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// Nashorn ~ JDK8 bug\nvar NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);\n\n// `Object.prototype.propertyIsEnumerable` method implementation\n// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable\nexports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {\n var descriptor = getOwnPropertyDescriptor(this, V);\n return !!descriptor && descriptor.enumerable;\n} : $propertyIsEnumerable;\n","'use strict';\nvar fails = require('../internals/fails');\nvar globalThis = require('../internals/global-this');\n\n// babel-minify and Closure Compiler transpiles RegExp('(?b)', 'g') -> /(?b)/g and it causes SyntaxError\nvar $RegExp = globalThis.RegExp;\n\nmodule.exports = fails(function () {\n var re = $RegExp('(?b)', 'g');\n return re.exec('b').groups.a !== 'b' ||\n 'b'.replace(re, '$c') !== 'bc';\n});\n","'use strict';\n// TODO: Remove from `core-js@4`\nrequire('../modules/es.iterator.reduce');\n","'use strict';\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nvar $Object = Object;\n\n// `ToObject` abstract operation\n// https://tc39.es/ecma262/#sec-toobject\nmodule.exports = function (argument) {\n return $Object(requireObjectCoercible(argument));\n};\n","'use strict';\n// TODO: Remove from `core-js@4`\nrequire('../modules/es.iterator.constructor');\n","'use strict';\nmodule.exports = function (exec) {\n try {\n return !!exec();\n } catch (error) {\n return true;\n }\n};\n","// A Javascript implementaion of the \"xorshift7\" algorithm by\n// François Panneton and Pierre L'ecuyer:\n// \"On the Xorgshift Random Number Generators\"\n// http://saluc.engr.uconn.edu/refs/crypto/rng/panneton05onthexorshift.pdf\n\n(function(global, module, define) {\n\nfunction XorGen(seed) {\n var me = this;\n\n // Set up generator function.\n me.next = function() {\n // Update xor generator.\n var X = me.x, i = me.i, t, v, w;\n t = X[i]; t ^= (t >>> 7); v = t ^ (t << 24);\n t = X[(i + 1) & 7]; v ^= t ^ (t >>> 10);\n t = X[(i + 3) & 7]; v ^= t ^ (t >>> 3);\n t = X[(i + 4) & 7]; v ^= t ^ (t << 7);\n t = X[(i + 7) & 7]; t = t ^ (t << 13); v ^= t ^ (t << 9);\n X[i] = v;\n me.i = (i + 1) & 7;\n return v;\n };\n\n function init(me, seed) {\n var j, w, X = [];\n\n if (seed === (seed | 0)) {\n // Seed state array using a 32-bit integer.\n w = X[0] = seed;\n } else {\n // Seed state using a string.\n seed = '' + seed;\n for (j = 0; j < seed.length; ++j) {\n X[j & 7] = (X[j & 7] << 15) ^\n (seed.charCodeAt(j) + X[(j + 1) & 7] << 13);\n }\n }\n // Enforce an array length of 8, not all zeroes.\n while (X.length < 8) X.push(0);\n for (j = 0; j < 8 && X[j] === 0; ++j);\n if (j == 8) w = X[7] = -1; else w = X[j];\n\n me.x = X;\n me.i = 0;\n\n // Discard an initial 256 values.\n for (j = 256; j > 0; --j) {\n me.next();\n }\n }\n\n init(me, seed);\n}\n\nfunction copy(f, t) {\n t.x = f.x.slice();\n t.i = f.i;\n return t;\n}\n\nfunction impl(seed, opts) {\n if (seed == null) seed = +(new Date);\n var xg = new XorGen(seed),\n state = opts && opts.state,\n prng = function() { return (xg.next() >>> 0) / 0x100000000; };\n prng.double = function() {\n do {\n var top = xg.next() >>> 11,\n bot = (xg.next() >>> 0) / 0x100000000,\n result = (top + bot) / (1 << 21);\n } while (result === 0);\n return result;\n };\n prng.int32 = xg.next;\n prng.quick = prng;\n if (state) {\n if (state.x) copy(state, xg);\n prng.state = function() { return copy(xg, {}); }\n }\n return prng;\n}\n\nif (module && module.exports) {\n module.exports = impl;\n} else if (define && define.amd) {\n define(function() { return impl; });\n} else {\n this.xorshift7 = impl;\n}\n\n})(\n this,\n (typeof module) == 'object' && module, // present in node.js\n (typeof define) == 'function' && define // present with an AMD loader\n);\n\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar apply = require('../internals/function-apply');\nvar bind = require('../internals/function-bind-context');\nvar isCallable = require('../internals/is-callable');\nvar hasOwn = require('../internals/has-own-property');\nvar fails = require('../internals/fails');\nvar html = require('../internals/html');\nvar arraySlice = require('../internals/array-slice');\nvar createElement = require('../internals/document-create-element');\nvar validateArgumentsLength = require('../internals/validate-arguments-length');\nvar IS_IOS = require('../internals/environment-is-ios');\nvar IS_NODE = require('../internals/environment-is-node');\n\nvar set = globalThis.setImmediate;\nvar clear = globalThis.clearImmediate;\nvar process = globalThis.process;\nvar Dispatch = globalThis.Dispatch;\nvar Function = globalThis.Function;\nvar MessageChannel = globalThis.MessageChannel;\nvar String = globalThis.String;\nvar counter = 0;\nvar queue = {};\nvar ONREADYSTATECHANGE = 'onreadystatechange';\nvar $location, defer, channel, port;\n\nfails(function () {\n // Deno throws a ReferenceError on `location` access without `--location` flag\n $location = globalThis.location;\n});\n\nvar run = function (id) {\n if (hasOwn(queue, id)) {\n var fn = queue[id];\n delete queue[id];\n fn();\n }\n};\n\nvar runner = function (id) {\n return function () {\n run(id);\n };\n};\n\nvar eventListener = function (event) {\n run(event.data);\n};\n\nvar globalPostMessageDefer = function (id) {\n // old engines have not location.origin\n globalThis.postMessage(String(id), $location.protocol + '//' + $location.host);\n};\n\n// Node.js 0.9+ & IE10+ has setImmediate, otherwise:\nif (!set || !clear) {\n set = function setImmediate(handler) {\n validateArgumentsLength(arguments.length, 1);\n var fn = isCallable(handler) ? handler : Function(handler);\n var args = arraySlice(arguments, 1);\n queue[++counter] = function () {\n apply(fn, undefined, args);\n };\n defer(counter);\n return counter;\n };\n clear = function clearImmediate(id) {\n delete queue[id];\n };\n // Node.js 0.8-\n if (IS_NODE) {\n defer = function (id) {\n process.nextTick(runner(id));\n };\n // Sphere (JS game engine) Dispatch API\n } else if (Dispatch && Dispatch.now) {\n defer = function (id) {\n Dispatch.now(runner(id));\n };\n // Browsers with MessageChannel, includes WebWorkers\n // except iOS - https://github.com/zloirock/core-js/issues/624\n } else if (MessageChannel && !IS_IOS) {\n channel = new MessageChannel();\n port = channel.port2;\n channel.port1.onmessage = eventListener;\n defer = bind(port.postMessage, port);\n // Browsers with postMessage, skip WebWorkers\n // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'\n } else if (\n globalThis.addEventListener &&\n isCallable(globalThis.postMessage) &&\n !globalThis.importScripts &&\n $location && $location.protocol !== 'file:' &&\n !fails(globalPostMessageDefer)\n ) {\n defer = globalPostMessageDefer;\n globalThis.addEventListener('message', eventListener, false);\n // IE8-\n } else if (ONREADYSTATECHANGE in createElement('script')) {\n defer = function (id) {\n html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {\n html.removeChild(this);\n run(id);\n };\n };\n // Rest old browsers\n } else {\n defer = function (id) {\n setTimeout(runner(id), 0);\n };\n }\n}\n\nmodule.exports = {\n set: set,\n clear: clear\n};\n","'use strict';\n// TODO: Remove from `core-js@4` since it's moved to entry points\nrequire('../modules/es.regexp.exec');\nvar call = require('../internals/function-call');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar regexpExec = require('../internals/regexp-exec');\nvar fails = require('../internals/fails');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\n\nvar SPECIES = wellKnownSymbol('species');\nvar RegExpPrototype = RegExp.prototype;\n\nmodule.exports = function (KEY, exec, FORCED, SHAM) {\n var SYMBOL = wellKnownSymbol(KEY);\n\n var DELEGATES_TO_SYMBOL = !fails(function () {\n // String methods call symbol-named RegExp methods\n var O = {};\n O[SYMBOL] = function () { return 7; };\n return ''[KEY](O) !== 7;\n });\n\n var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {\n // Symbol-named RegExp methods call .exec\n var execCalled = false;\n var re = /a/;\n\n if (KEY === 'split') {\n // We can't use real regex here since it causes deoptimization\n // and serious performance degradation in V8\n // https://github.com/zloirock/core-js/issues/306\n re = {};\n // RegExp[@@split] doesn't call the regex's exec method, but first creates\n // a new one. We need to return the patched regex when creating the new one.\n re.constructor = {};\n re.constructor[SPECIES] = function () { return re; };\n re.flags = '';\n re[SYMBOL] = /./[SYMBOL];\n }\n\n re.exec = function () {\n execCalled = true;\n return null;\n };\n\n re[SYMBOL]('');\n return !execCalled;\n });\n\n if (\n !DELEGATES_TO_SYMBOL ||\n !DELEGATES_TO_EXEC ||\n FORCED\n ) {\n var nativeRegExpMethod = /./[SYMBOL];\n var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {\n var $exec = regexp.exec;\n if ($exec === regexpExec || $exec === RegExpPrototype.exec) {\n if (DELEGATES_TO_SYMBOL && !forceStringMethod) {\n // The native String method already delegates to @@method (this\n // polyfilled function), leasing to infinite recursion.\n // We avoid it by directly calling the native @@method method.\n return { done: true, value: call(nativeRegExpMethod, regexp, str, arg2) };\n }\n return { done: true, value: call(nativeMethod, str, regexp, arg2) };\n }\n return { done: false };\n });\n\n defineBuiltIn(String.prototype, KEY, methods[0]);\n defineBuiltIn(RegExpPrototype, SYMBOL, methods[1]);\n }\n\n if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar toObject = require('../internals/to-object');\n\nvar hasOwnProperty = uncurryThis({}.hasOwnProperty);\n\n// `HasOwnProperty` abstract operation\n// https://tc39.es/ecma262/#sec-hasownproperty\n// eslint-disable-next-line es/no-object-hasown -- safe\nmodule.exports = Object.hasOwn || function hasOwn(it, key) {\n return hasOwnProperty(toObject(it), key);\n};\n","'use strict';\nvar isCallable = require('../internals/is-callable');\nvar tryToString = require('../internals/try-to-string');\n\nvar $TypeError = TypeError;\n\n// `Assert: IsCallable(argument) is true`\nmodule.exports = function (argument) {\n if (isCallable(argument)) return argument;\n throw new $TypeError(tryToString(argument) + ' is not a function');\n};\n","'use strict';\nvar globalThis = require('../internals/global-this');\n\n// eslint-disable-next-line es/no-object-defineproperty -- safe\nvar defineProperty = Object.defineProperty;\n\nmodule.exports = function (key, value) {\n try {\n defineProperty(globalThis, key, { value: value, configurable: true, writable: true });\n } catch (error) {\n globalThis[key] = value;\n } return value;\n};\n","'use strict';\nvar call = require('../internals/function-call');\nvar create = require('../internals/object-create');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar defineBuiltIns = require('../internals/define-built-ins');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar InternalStateModule = require('../internals/internal-state');\nvar getMethod = require('../internals/get-method');\nvar IteratorPrototype = require('../internals/iterators-core').IteratorPrototype;\nvar createIterResultObject = require('../internals/create-iter-result-object');\nvar iteratorClose = require('../internals/iterator-close');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\nvar ITERATOR_HELPER = 'IteratorHelper';\nvar WRAP_FOR_VALID_ITERATOR = 'WrapForValidIterator';\nvar setInternalState = InternalStateModule.set;\n\nvar createIteratorProxyPrototype = function (IS_ITERATOR) {\n var getInternalState = InternalStateModule.getterFor(IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER);\n\n return defineBuiltIns(create(IteratorPrototype), {\n next: function next() {\n var state = getInternalState(this);\n // for simplification:\n // for `%WrapForValidIteratorPrototype%.next` or with `state.returnHandlerResult` our `nextHandler` returns `IterResultObject`\n // for `%IteratorHelperPrototype%.next` - just a value\n if (IS_ITERATOR) return state.nextHandler();\n if (state.done) return createIterResultObject(undefined, true);\n try {\n var result = state.nextHandler();\n return state.returnHandlerResult ? result : createIterResultObject(result, state.done);\n } catch (error) {\n state.done = true;\n throw error;\n }\n },\n 'return': function () {\n var state = getInternalState(this);\n var iterator = state.iterator;\n state.done = true;\n if (IS_ITERATOR) {\n var returnMethod = getMethod(iterator, 'return');\n return returnMethod ? call(returnMethod, iterator) : createIterResultObject(undefined, true);\n }\n if (state.inner) try {\n iteratorClose(state.inner.iterator, 'normal');\n } catch (error) {\n return iteratorClose(iterator, 'throw', error);\n }\n if (iterator) iteratorClose(iterator, 'normal');\n return createIterResultObject(undefined, true);\n }\n });\n};\n\nvar WrapForValidIteratorPrototype = createIteratorProxyPrototype(true);\nvar IteratorHelperPrototype = createIteratorProxyPrototype(false);\n\ncreateNonEnumerableProperty(IteratorHelperPrototype, TO_STRING_TAG, 'Iterator Helper');\n\nmodule.exports = function (nextHandler, IS_ITERATOR, RETURN_HANDLER_RESULT) {\n var IteratorProxy = function Iterator(record, state) {\n if (state) {\n state.iterator = record.iterator;\n state.next = record.next;\n } else state = record;\n state.type = IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER;\n state.returnHandlerResult = !!RETURN_HANDLER_RESULT;\n state.nextHandler = nextHandler;\n state.counter = 0;\n state.done = false;\n setInternalState(this, state);\n };\n\n IteratorProxy.prototype = IS_ITERATOR ? WrapForValidIteratorPrototype : IteratorHelperPrototype;\n\n return IteratorProxy;\n};\n","// `Symbol.prototype.description` getter\n// https://tc39.es/ecma262/#sec-symbol.prototype.description\n'use strict';\nvar $ = require('../internals/export');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar globalThis = require('../internals/global-this');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar hasOwn = require('../internals/has-own-property');\nvar isCallable = require('../internals/is-callable');\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\nvar toString = require('../internals/to-string');\nvar defineBuiltInAccessor = require('../internals/define-built-in-accessor');\nvar copyConstructorProperties = require('../internals/copy-constructor-properties');\n\nvar NativeSymbol = globalThis.Symbol;\nvar SymbolPrototype = NativeSymbol && NativeSymbol.prototype;\n\nif (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototype) ||\n // Safari 12 bug\n NativeSymbol().description !== undefined\n)) {\n var EmptyStringDescriptionStore = {};\n // wrap Symbol constructor for correct work with undefined description\n var SymbolWrapper = function Symbol() {\n var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString(arguments[0]);\n var result = isPrototypeOf(SymbolPrototype, this)\n // eslint-disable-next-line sonarjs/inconsistent-function-call -- ok\n ? new NativeSymbol(description)\n // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'\n : description === undefined ? NativeSymbol() : NativeSymbol(description);\n if (description === '') EmptyStringDescriptionStore[result] = true;\n return result;\n };\n\n copyConstructorProperties(SymbolWrapper, NativeSymbol);\n SymbolWrapper.prototype = SymbolPrototype;\n SymbolPrototype.constructor = SymbolWrapper;\n\n var NATIVE_SYMBOL = String(NativeSymbol('description detection')) === 'Symbol(description detection)';\n var thisSymbolValue = uncurryThis(SymbolPrototype.valueOf);\n var symbolDescriptiveString = uncurryThis(SymbolPrototype.toString);\n var regexp = /^Symbol\\((.*)\\)[^)]+$/;\n var replace = uncurryThis(''.replace);\n var stringSlice = uncurryThis(''.slice);\n\n defineBuiltInAccessor(SymbolPrototype, 'description', {\n configurable: true,\n get: function description() {\n var symbol = thisSymbolValue(this);\n if (hasOwn(EmptyStringDescriptionStore, symbol)) return '';\n var string = symbolDescriptiveString(symbol);\n var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, '$1');\n return desc === '' ? undefined : desc;\n }\n });\n\n $({ global: true, constructor: true, forced: true }, {\n Symbol: SymbolWrapper\n });\n}\n","'use strict';\nvar NATIVE_BIND = require('../internals/function-bind-native');\n\nvar FunctionPrototype = Function.prototype;\nvar call = FunctionPrototype.call;\n// eslint-disable-next-line es/no-function-prototype-bind -- safe\nvar uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);\n\nmodule.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) {\n return function () {\n return call.apply(fn, arguments);\n };\n};\n","'use strict';\nvar globalThis = require('../internals/global-this');\nvar userAgent = require('../internals/environment-user-agent');\n\nvar process = globalThis.process;\nvar Deno = globalThis.Deno;\nvar versions = process && process.versions || Deno && Deno.version;\nvar v8 = versions && versions.v8;\nvar match, version;\n\nif (v8) {\n match = v8.split('.');\n // in old Chrome, versions of V8 isn't V8 = Chrome / 10\n // but their correct versions are not interesting for us\n version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);\n}\n\n// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`\n// so check `userAgent` even if `.v8` exists, but 0\nif (!version && userAgent) {\n match = userAgent.match(/Edge\\/(\\d+)/);\n if (!match || match[1] >= 74) {\n match = userAgent.match(/Chrome\\/(\\d+)/);\n if (match) version = +match[1];\n }\n}\n\nmodule.exports = version;\n","'use strict';\nvar call = require('../internals/function-call');\nvar anObject = require('../internals/an-object');\nvar getMethod = require('../internals/get-method');\n\nmodule.exports = function (iterator, kind, value) {\n var innerResult, innerError;\n anObject(iterator);\n try {\n innerResult = getMethod(iterator, 'return');\n if (!innerResult) {\n if (kind === 'throw') throw value;\n return value;\n }\n innerResult = call(innerResult, iterator);\n } catch (error) {\n innerError = true;\n innerResult = error;\n }\n if (kind === 'throw') throw value;\n if (innerError) throw innerResult;\n anObject(innerResult);\n return value;\n};\n","'use strict';\nvar userAgent = require('../internals/environment-user-agent');\n\n// eslint-disable-next-line redos/no-vulnerable -- safe\nmodule.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);\n","'use strict';\nvar NATIVE_BIND = require('../internals/function-bind-native');\n\nvar call = Function.prototype.call;\n// eslint-disable-next-line es/no-function-prototype-bind -- safe\nmodule.exports = NATIVE_BIND ? call.bind(call) : function () {\n return call.apply(call, arguments);\n};\n","'use strict';\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\n\n// `Array.prototype.{ indexOf, includes }` methods implementation\nvar createMethod = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIndexedObject($this);\n var length = lengthOfArrayLike(O);\n if (length === 0) return !IS_INCLUDES && -1;\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare -- NaN check\n if (IS_INCLUDES && el !== el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare -- NaN check\n if (value !== value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) {\n if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.includes` method\n // https://tc39.es/ecma262/#sec-array.prototype.includes\n includes: createMethod(true),\n // `Array.prototype.indexOf` method\n // https://tc39.es/ecma262/#sec-array.prototype.indexof\n indexOf: createMethod(false)\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.amdD = function () {\n\tthrow new Error('define cannot be used indirect');\n};","__webpack_require__.amdO = {};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","import { hasOwnProperty } from './object.js'\n\n/**\n * Get a property of a plain object\n * Throws an error in case the object is not a plain object or the\n * property is not defined on the object itself\n * @param {Object} object\n * @param {string} prop\n * @return {*} Returns the property value when safe\n */\nfunction getSafeProperty (object, prop) {\n // only allow getting safe properties of a plain object\n if (isSafeProperty(object, prop)) {\n return object[prop]\n }\n\n if (typeof object[prop] === 'function' && isSafeMethod(object, prop)) {\n throw new Error('Cannot access method \"' + prop + '\" as a property')\n }\n\n throw new Error('No access to property \"' + prop + '\"')\n}\n\n/**\n * Set a property on a plain object.\n * Throws an error in case the object is not a plain object or the\n * property would override an inherited property like .constructor or .toString\n * @param {Object} object\n * @param {string} prop\n * @param {*} value\n * @return {*} Returns the value\n */\n// TODO: merge this function into access.js?\nfunction setSafeProperty (object, prop, value) {\n // only allow setting safe properties of a plain object\n if (isSafeProperty(object, prop)) {\n object[prop] = value\n return value\n }\n\n throw new Error('No access to property \"' + prop + '\"')\n}\n\n/**\n * Test whether a property is safe to use on an object or Array.\n * For example .toString and .constructor are not safe\n * @param {Object | Array} object\n * @param {string} prop\n * @return {boolean} Returns true when safe\n */\nfunction isSafeProperty (object, prop) {\n if (!isPlainObject(object) && !Array.isArray(object)) {\n return false\n }\n // SAFE: whitelisted\n // e.g length\n if (hasOwnProperty(safeNativeProperties, prop)) {\n return true\n }\n // UNSAFE: inherited from Object prototype\n // e.g constructor\n if (prop in Object.prototype) {\n // 'in' is used instead of hasOwnProperty for nodejs v0.10\n // which is inconsistent on root prototypes. It is safe\n // here because Object.prototype is a root object\n return false\n }\n // UNSAFE: inherited from Function prototype\n // e.g call, apply\n if (prop in Function.prototype) {\n // 'in' is used instead of hasOwnProperty for nodejs v0.10\n // which is inconsistent on root prototypes. It is safe\n // here because Function.prototype is a root object\n return false\n }\n return true\n}\n\n/**\n * Validate whether a method is safe.\n * Throws an error when that's not the case.\n * @param {Object} object\n * @param {string} method\n * @return {function} Returns the method when valid\n */\nfunction getSafeMethod (object, method) {\n if (!isSafeMethod(object, method)) {\n throw new Error('No access to method \"' + method + '\"')\n }\n\n return object[method]\n}\n\n/**\n * Check whether a method is safe.\n * Throws an error when that's not the case (for example for `constructor`).\n * @param {Object} object\n * @param {string} method\n * @return {boolean} Returns true when safe, false otherwise\n */\nfunction isSafeMethod (object, method) {\n if (object === null || object === undefined || typeof object[method] !== 'function') {\n return false\n }\n // UNSAFE: ghosted\n // e.g overridden toString\n // Note that IE10 doesn't support __proto__ and we can't do this check there.\n if (hasOwnProperty(object, method) &&\n (Object.getPrototypeOf && (method in Object.getPrototypeOf(object)))) {\n return false\n }\n // SAFE: whitelisted\n // e.g toString\n if (hasOwnProperty(safeNativeMethods, method)) {\n return true\n }\n // UNSAFE: inherited from Object prototype\n // e.g constructor\n if (method in Object.prototype) {\n // 'in' is used instead of hasOwnProperty for nodejs v0.10\n // which is inconsistent on root prototypes. It is safe\n // here because Object.prototype is a root object\n return false\n }\n // UNSAFE: inherited from Function prototype\n // e.g call, apply\n if (method in Function.prototype) {\n // 'in' is used instead of hasOwnProperty for nodejs v0.10\n // which is inconsistent on root prototypes. It is safe\n // here because Function.prototype is a root object\n return false\n }\n return true\n}\n\nfunction isPlainObject (object) {\n return typeof object === 'object' && object && object.constructor === Object\n}\n\nconst safeNativeProperties = {\n length: true,\n name: true\n}\n\nconst safeNativeMethods = {\n toString: true,\n valueOf: true,\n toLocaleString: true\n}\n\nexport { getSafeProperty }\nexport { setSafeProperty }\nexport { isSafeProperty }\nexport { getSafeMethod }\nexport { isSafeMethod }\nexport { isPlainObject }\n","import { getSafeProperty, isSafeProperty, setSafeProperty } from './customs.js'\nimport { isMap, isObject } from './is.js'\n\n/**\n * A map facade on a bare object.\n *\n * The small number of methods needed to implement a scope,\n * forwarding on to the SafeProperty functions. Over time, the codebase\n * will stop using this method, as all objects will be Maps, rather than\n * more security prone objects.\n */\nexport class ObjectWrappingMap {\n constructor (object) {\n this.wrappedObject = object\n\n this[Symbol.iterator] = this.entries\n }\n\n keys () {\n return Object.keys(this.wrappedObject)\n .filter(key => this.has(key))\n .values()\n }\n\n get (key) {\n return getSafeProperty(this.wrappedObject, key)\n }\n\n set (key, value) {\n setSafeProperty(this.wrappedObject, key, value)\n return this\n }\n\n has (key) {\n return isSafeProperty(this.wrappedObject, key) && key in this.wrappedObject\n }\n\n entries () {\n return mapIterator(this.keys(), key => [key, this.get(key)])\n }\n\n forEach (callback) {\n for (const key of this.keys()) {\n callback(this.get(key), key, this)\n }\n }\n\n delete (key) {\n if (isSafeProperty(this.wrappedObject, key)) {\n delete this.wrappedObject[key]\n }\n }\n\n clear () {\n for (const key of this.keys()) {\n this.delete(key)\n }\n }\n\n get size () {\n return Object.keys(this.wrappedObject).length\n }\n}\n\n/**\n * Create a map with two partitions: a and b.\n * The set with bKeys determines which keys/values are read/written to map b,\n * all other values are read/written to map a\n *\n * For example:\n *\n * const a = new Map()\n * const b = new Map()\n * const p = new PartitionedMap(a, b, new Set(['x', 'y']))\n *\n * In this case, values `x` and `y` are read/written to map `b`,\n * all other values are read/written to map `a`.\n */\nexport class PartitionedMap {\n /**\n * @param {Map} a\n * @param {Map} b\n * @param {Set} bKeys\n */\n constructor (a, b, bKeys) {\n this.a = a\n this.b = b\n this.bKeys = bKeys\n\n this[Symbol.iterator] = this.entries\n }\n\n get (key) {\n return this.bKeys.has(key)\n ? this.b.get(key)\n : this.a.get(key)\n }\n\n set (key, value) {\n if (this.bKeys.has(key)) {\n this.b.set(key, value)\n } else {\n this.a.set(key, value)\n }\n return this\n }\n\n has (key) {\n return this.b.has(key) || this.a.has(key)\n }\n\n keys () {\n return new Set([\n ...this.a.keys(),\n ...this.b.keys()\n ])[Symbol.iterator]()\n }\n\n entries () {\n return mapIterator(this.keys(), key => [key, this.get(key)])\n }\n\n forEach (callback) {\n for (const key of this.keys()) {\n callback(this.get(key), key, this)\n }\n }\n\n delete (key) {\n return this.bKeys.has(key)\n ? this.b.delete(key)\n : this.a.delete(key)\n }\n\n clear () {\n this.a.clear()\n this.b.clear()\n }\n\n get size () {\n return [...this.keys()].length\n }\n}\n\n/**\n * Create a new iterator that maps over the provided iterator, applying a mapping function to each item\n */\nfunction mapIterator (it, callback) {\n return {\n next: () => {\n const n = it.next()\n return (n.done)\n ? n\n : {\n value: callback(n.value),\n done: false\n }\n }\n }\n}\n\n/**\n * Creates an empty map, or whatever your platform's polyfill is.\n *\n * @returns an empty Map or Map like object.\n */\nexport function createEmptyMap () {\n return new Map()\n}\n\n/**\n * Creates a Map from the given object.\n *\n * @param { Map | { [key: string]: unknown } | undefined } mapOrObject\n * @returns\n */\nexport function createMap (mapOrObject) {\n if (!mapOrObject) {\n return createEmptyMap()\n }\n if (isMap(mapOrObject)) {\n return mapOrObject\n }\n if (isObject(mapOrObject)) {\n return new ObjectWrappingMap(mapOrObject)\n }\n\n throw new Error('createMap can create maps from objects or Maps')\n}\n\n/**\n * Unwraps a map into an object.\n *\n * @param {Map} map\n * @returns { [key: string]: unknown }\n */\nexport function toObject (map) {\n if (map instanceof ObjectWrappingMap) {\n return map.wrappedObject\n }\n const object = {}\n for (const key of map.keys()) {\n const value = map.get(key)\n setSafeProperty(object, key, value)\n }\n return object\n}\n\n/**\n * Copies the contents of key-value pairs from each `objects` in to `map`.\n *\n * Object is `objects` can be a `Map` or object.\n *\n * This is the `Map` analog to `Object.assign`.\n */\nexport function assign (map, ...objects) {\n for (const args of objects) {\n if (!args) {\n continue\n }\n if (isMap(args)) {\n for (const key of args.keys()) {\n map.set(key, args.get(key))\n }\n } else if (isObject(args)) {\n for (const key of Object.keys(args)) {\n map.set(key, args[key])\n }\n }\n }\n return map\n}\n","// type checks for all known types\n//\n// note that:\n//\n// - check by duck-typing on a property like `isUnit`, instead of checking instanceof.\n// instanceof cannot be used because that would not allow to pass data from\n// one instance of math.js to another since each has it's own instance of Unit.\n// - check the `isUnit` property via the constructor, so there will be no\n// matches for \"fake\" instances like plain objects with a property `isUnit`.\n// That is important for security reasons.\n// - It must not be possible to override the type checks used internally,\n// for security reasons, so these functions are not exposed in the expression\n// parser.\n\nimport { ObjectWrappingMap } from './map.js'\n\nexport function isNumber (x) {\n return typeof x === 'number'\n}\n\nexport function isBigNumber (x) {\n if (\n !x || typeof x !== 'object' ||\n typeof x.constructor !== 'function'\n ) {\n return false\n }\n\n if (\n x.isBigNumber === true &&\n typeof x.constructor.prototype === 'object' &&\n x.constructor.prototype.isBigNumber === true\n ) {\n return true\n }\n\n if (\n typeof x.constructor.isDecimal === 'function' &&\n x.constructor.isDecimal(x) === true\n ) {\n return true\n }\n\n return false\n}\n\nexport function isBigInt (x) {\n return typeof x === 'bigint'\n}\n\nexport function isComplex (x) {\n return (x && typeof x === 'object' && Object.getPrototypeOf(x).isComplex === true) || false\n}\n\nexport function isFraction (x) {\n return (x && typeof x === 'object' && Object.getPrototypeOf(x).isFraction === true) || false\n}\n\nexport function isUnit (x) {\n return (x && x.constructor.prototype.isUnit === true) || false\n}\n\nexport function isString (x) {\n return typeof x === 'string'\n}\n\nexport const isArray = Array.isArray\n\nexport function isMatrix (x) {\n return (x && x.constructor.prototype.isMatrix === true) || false\n}\n\n/**\n * Test whether a value is a collection: an Array or Matrix\n * @param {*} x\n * @returns {boolean} isCollection\n */\nexport function isCollection (x) {\n return Array.isArray(x) || isMatrix(x)\n}\n\nexport function isDenseMatrix (x) {\n return (x && x.isDenseMatrix && x.constructor.prototype.isMatrix === true) || false\n}\n\nexport function isSparseMatrix (x) {\n return (x && x.isSparseMatrix && x.constructor.prototype.isMatrix === true) || false\n}\n\nexport function isRange (x) {\n return (x && x.constructor.prototype.isRange === true) || false\n}\n\nexport function isIndex (x) {\n return (x && x.constructor.prototype.isIndex === true) || false\n}\n\nexport function isBoolean (x) {\n return typeof x === 'boolean'\n}\n\nexport function isResultSet (x) {\n return (x && x.constructor.prototype.isResultSet === true) || false\n}\n\nexport function isHelp (x) {\n return (x && x.constructor.prototype.isHelp === true) || false\n}\n\nexport function isFunction (x) {\n return typeof x === 'function'\n}\n\nexport function isDate (x) {\n return x instanceof Date\n}\n\nexport function isRegExp (x) {\n return x instanceof RegExp\n}\n\nexport function isObject (x) {\n return !!(x &&\n typeof x === 'object' &&\n x.constructor === Object &&\n !isComplex(x) &&\n !isFraction(x))\n}\n\n/**\n * Returns `true` if the passed object appears to be a Map (i.e. duck typing).\n *\n * Methods looked for are `get`, `set`, `keys` and `has`.\n *\n * @param {Map | object} object\n * @returns\n */\nexport function isMap (object) {\n // We can use the fast instanceof, or a slower duck typing check.\n // The duck typing method needs to cover enough methods to not be confused with DenseMatrix.\n if (!object) {\n return false\n }\n return object instanceof Map ||\n object instanceof ObjectWrappingMap ||\n (\n typeof object.set === 'function' &&\n typeof object.get === 'function' &&\n typeof object.keys === 'function' &&\n typeof object.has === 'function'\n )\n}\n\nexport function isPartitionedMap (object) {\n return isMap(object) && isMap(object.a) && isMap(object.b)\n}\n\nexport function isObjectWrappingMap (object) {\n return isMap(object) && isObject(object.wrappedObject)\n}\n\nexport function isNull (x) {\n return x === null\n}\n\nexport function isUndefined (x) {\n return x === undefined\n}\n\nexport function isAccessorNode (x) {\n return (x && x.isAccessorNode === true && x.constructor.prototype.isNode === true) || false\n}\n\nexport function isArrayNode (x) {\n return (x && x.isArrayNode === true && x.constructor.prototype.isNode === true) || false\n}\n\nexport function isAssignmentNode (x) {\n return (x && x.isAssignmentNode === true && x.constructor.prototype.isNode === true) || false\n}\n\nexport function isBlockNode (x) {\n return (x && x.isBlockNode === true && x.constructor.prototype.isNode === true) || false\n}\n\nexport function isConditionalNode (x) {\n return (x && x.isConditionalNode === true && x.constructor.prototype.isNode === true) || false\n}\n\nexport function isConstantNode (x) {\n return (x && x.isConstantNode === true && x.constructor.prototype.isNode === true) || false\n}\n\n/* Very specialized: returns true for those nodes which in the numerator of\n a fraction means that the division in that fraction has precedence over implicit\n multiplication, e.g. -2/3 x parses as (-2/3) x and 3/4 x parses as (3/4) x but\n 6!/8 x parses as 6! / (8x). It is located here because it is shared between\n parse.js and OperatorNode.js (for parsing and printing, respectively).\n\n This should *not* be exported from mathjs, unlike most of the tests here.\n Its name does not start with 'is' to prevent utils/snapshot.js from thinking\n it should be exported.\n*/\nexport function rule2Node (node) {\n return isConstantNode(node) ||\n (isOperatorNode(node) &&\n node.args.length === 1 &&\n isConstantNode(node.args[0]) &&\n '-+~'.includes(node.op))\n}\n\nexport function isFunctionAssignmentNode (x) {\n return (x && x.isFunctionAssignmentNode === true && x.constructor.prototype.isNode === true) || false\n}\n\nexport function isFunctionNode (x) {\n return (x && x.isFunctionNode === true && x.constructor.prototype.isNode === true) || false\n}\n\nexport function isIndexNode (x) {\n return (x && x.isIndexNode === true && x.constructor.prototype.isNode === true) || false\n}\n\nexport function isNode (x) {\n return (x && x.isNode === true && x.constructor.prototype.isNode === true) || false\n}\n\nexport function isObjectNode (x) {\n return (x && x.isObjectNode === true && x.constructor.prototype.isNode === true) || false\n}\n\nexport function isOperatorNode (x) {\n return (x && x.isOperatorNode === true && x.constructor.prototype.isNode === true) || false\n}\n\nexport function isParenthesisNode (x) {\n return (x && x.isParenthesisNode === true && x.constructor.prototype.isNode === true) || false\n}\n\nexport function isRangeNode (x) {\n return (x && x.isRangeNode === true && x.constructor.prototype.isNode === true) || false\n}\n\nexport function isRelationalNode (x) {\n return (x && x.isRelationalNode === true && x.constructor.prototype.isNode === true) || false\n}\n\nexport function isSymbolNode (x) {\n return (x && x.isSymbolNode === true && x.constructor.prototype.isNode === true) || false\n}\n\nexport function isChain (x) {\n return (x && x.constructor.prototype.isChain === true) || false\n}\n\nexport function typeOf (x) {\n const t = typeof x\n\n if (t === 'object') {\n if (x === null) return 'null'\n if (isBigNumber(x)) return 'BigNumber' // Special: weird mashup with Decimal\n if (x.constructor && x.constructor.name) return x.constructor.name\n\n return 'Object' // just in case\n }\n\n return t // can be 'string', 'number', 'boolean', 'function', 'bigint', ...\n}\n","import { isBigNumber, isObject } from './is.js'\n\n/**\n * Clone an object\n *\n * clone(x)\n *\n * Can clone any primitive type, array, and object.\n * If x has a function clone, this function will be invoked to clone the object.\n *\n * @param {*} x\n * @return {*} clone\n */\nexport function clone (x) {\n const type = typeof x\n\n // immutable primitive types\n if (type === 'number' || type === 'bigint' || type === 'string' || type === 'boolean' ||\n x === null || x === undefined) {\n return x\n }\n\n // use clone function of the object when available\n if (typeof x.clone === 'function') {\n return x.clone()\n }\n\n // array\n if (Array.isArray(x)) {\n return x.map(function (value) {\n return clone(value)\n })\n }\n\n if (x instanceof Date) return new Date(x.valueOf())\n if (isBigNumber(x)) return x // bignumbers are immutable\n\n // object\n if (isObject(x)) {\n return mapObject(x, clone)\n }\n\n if (type === 'function') {\n // we assume that the function is immutable\n return x\n }\n\n throw new TypeError(`Cannot clone: unknown type of value (value: ${x})`)\n}\n\n/**\n * Apply map to all properties of an object\n * @param {Object} object\n * @param {function} callback\n * @return {Object} Returns a copy of the object with mapped properties\n */\nexport function mapObject (object, callback) {\n const clone = {}\n\n for (const key in object) {\n if (hasOwnProperty(object, key)) {\n clone[key] = callback(object[key])\n }\n }\n\n return clone\n}\n\n/**\n * Extend object a with the properties of object b\n * @param {Object} a\n * @param {Object} b\n * @return {Object} a\n */\nexport function extend (a, b) {\n for (const prop in b) {\n if (hasOwnProperty(b, prop)) {\n a[prop] = b[prop]\n }\n }\n return a\n}\n\n/**\n * Deep extend an object a with the properties of object b\n * @param {Object} a\n * @param {Object} b\n * @returns {Object}\n */\nexport function deepExtend (a, b) {\n // TODO: add support for Arrays to deepExtend\n if (Array.isArray(b)) {\n throw new TypeError('Arrays are not supported by deepExtend')\n }\n\n for (const prop in b) {\n // We check against prop not being in Object.prototype or Function.prototype\n // to prevent polluting for example Object.__proto__.\n if (hasOwnProperty(b, prop) && !(prop in Object.prototype) && !(prop in Function.prototype)) {\n if (b[prop] && b[prop].constructor === Object) {\n if (a[prop] === undefined) {\n a[prop] = {}\n }\n if (a[prop] && a[prop].constructor === Object) {\n deepExtend(a[prop], b[prop])\n } else {\n a[prop] = b[prop]\n }\n } else if (Array.isArray(b[prop])) {\n throw new TypeError('Arrays are not supported by deepExtend')\n } else {\n a[prop] = b[prop]\n }\n }\n }\n return a\n}\n\n/**\n * Deep test equality of all fields in two pairs of arrays or objects.\n * Compares values and functions strictly (ie. 2 is not the same as '2').\n * @param {Array | Object} a\n * @param {Array | Object} b\n * @returns {boolean}\n */\nexport function deepStrictEqual (a, b) {\n let prop, i, len\n if (Array.isArray(a)) {\n if (!Array.isArray(b)) {\n return false\n }\n\n if (a.length !== b.length) {\n return false\n }\n\n for (i = 0, len = a.length; i < len; i++) {\n if (!deepStrictEqual(a[i], b[i])) {\n return false\n }\n }\n return true\n } else if (typeof a === 'function') {\n return (a === b)\n } else if (a instanceof Object) {\n if (Array.isArray(b) || !(b instanceof Object)) {\n return false\n }\n\n for (prop in a) {\n // noinspection JSUnfilteredForInLoop\n if (!(prop in b) || !deepStrictEqual(a[prop], b[prop])) {\n return false\n }\n }\n for (prop in b) {\n // noinspection JSUnfilteredForInLoop\n if (!(prop in a)) {\n return false\n }\n }\n return true\n } else {\n return (a === b)\n }\n}\n\n/**\n * Recursively flatten a nested object.\n * @param {Object} nestedObject\n * @return {Object} Returns the flattened object\n */\nexport function deepFlatten (nestedObject) {\n const flattenedObject = {}\n\n _deepFlatten(nestedObject, flattenedObject)\n\n return flattenedObject\n}\n\n// helper function used by deepFlatten\nfunction _deepFlatten (nestedObject, flattenedObject) {\n for (const prop in nestedObject) {\n if (hasOwnProperty(nestedObject, prop)) {\n const value = nestedObject[prop]\n if (typeof value === 'object' && value !== null) {\n _deepFlatten(value, flattenedObject)\n } else {\n flattenedObject[prop] = value\n }\n }\n }\n}\n\n/**\n * Test whether the current JavaScript engine supports Object.defineProperty\n * @returns {boolean} returns true if supported\n */\nexport function canDefineProperty () {\n // test needed for broken IE8 implementation\n try {\n if (Object.defineProperty) {\n Object.defineProperty({}, 'x', { get: function () { return null } })\n return true\n }\n } catch (e) {}\n\n return false\n}\n\n/**\n * Attach a lazy loading property to a constant.\n * The given function `fn` is called once when the property is first requested.\n *\n * @param {Object} object Object where to add the property\n * @param {string} prop Property name\n * @param {Function} valueResolver Function returning the property value. Called\n * without arguments.\n */\nexport function lazy (object, prop, valueResolver) {\n let _uninitialized = true\n let _value\n\n Object.defineProperty(object, prop, {\n get: function () {\n if (_uninitialized) {\n _value = valueResolver()\n _uninitialized = false\n }\n return _value\n },\n\n set: function (value) {\n _value = value\n _uninitialized = false\n },\n\n configurable: true,\n enumerable: true\n })\n}\n\n/**\n * Traverse a path into an object.\n * When a namespace is missing, it will be created\n * @param {Object} object\n * @param {string | string[]} path A dot separated string like 'name.space'\n * @return {Object} Returns the object at the end of the path\n */\nexport function traverse (object, path) {\n if (path && typeof path === 'string') {\n return traverse(object, path.split('.'))\n }\n\n let obj = object\n\n if (path) {\n for (let i = 0; i < path.length; i++) {\n const key = path[i]\n if (!(key in obj)) {\n obj[key] = {}\n }\n obj = obj[key]\n }\n }\n\n return obj\n}\n\n/**\n * A safe hasOwnProperty\n * @param {Object} object\n * @param {string} property\n */\nexport function hasOwnProperty (object, property) {\n return object && Object.hasOwnProperty.call(object, property)\n}\n\n/**\n * Test whether an object is a factory. a factory has fields:\n *\n * - factory: function (type: Object, config: Object, load: function, typed: function [, math: Object]) (required)\n * - name: string (optional)\n * - path: string A dot separated path (optional)\n * - math: boolean If true (false by default), the math namespace is passed\n * as fifth argument of the factory function\n *\n * @param {*} object\n * @returns {boolean}\n */\nexport function isLegacyFactory (object) {\n return object && typeof object.factory === 'function'\n}\n\n/**\n * Get a nested property from an object\n * @param {Object} object\n * @param {string | string[]} path\n * @returns {Object}\n */\nexport function get (object, path) {\n if (typeof path === 'string') {\n if (isPath(path)) {\n return get(object, path.split('.'))\n } else {\n return object[path]\n }\n }\n\n let child = object\n\n for (let i = 0; i < path.length; i++) {\n const key = path[i]\n child = child ? child[key] : undefined\n }\n\n return child\n}\n\n/**\n * Set a nested property in an object\n * Mutates the object itself\n * If the path doesn't exist, it will be created\n * @param {Object} object\n * @param {string | string[]} path\n * @param {*} value\n * @returns {Object}\n */\nexport function set (object, path, value) {\n if (typeof path === 'string') {\n if (isPath(path)) {\n return set(object, path.split('.'), value)\n } else {\n object[path] = value\n return object\n }\n }\n\n let child = object\n for (let i = 0; i < path.length - 1; i++) {\n const key = path[i]\n if (child[key] === undefined) {\n child[key] = {}\n }\n child = child[key]\n }\n\n if (path.length > 0) {\n const lastKey = path[path.length - 1]\n child[lastKey] = value\n }\n\n return object\n}\n\n/**\n * Create an object composed of the picked object properties\n * @param {Object} object\n * @param {string[]} properties\n * @param {function} [transform] Optional value to transform a value when picking it\n * @return {Object}\n */\nexport function pick (object, properties, transform) {\n const copy = {}\n\n for (let i = 0; i < properties.length; i++) {\n const key = properties[i]\n const value = get(object, key)\n if (value !== undefined) {\n set(copy, key, transform ? transform(value, key) : value)\n }\n }\n\n return copy\n}\n\n/**\n * Shallow version of pick, creating an object composed of the picked object properties\n * but not for nested properties\n * @param {Object} object\n * @param {string[]} properties\n * @return {Object}\n */\nexport function pickShallow (object, properties) {\n const copy = {}\n\n for (let i = 0; i < properties.length; i++) {\n const key = properties[i]\n const value = object[key]\n if (value !== undefined) {\n copy[key] = value\n }\n }\n\n return copy\n}\n\n// helper function to test whether a string contains a path like 'user.name'\nfunction isPath (str) {\n return str.includes('.')\n}\n","import { pickShallow } from './object.js'\n\n/**\n * Create a factory function, which can be used to inject dependencies.\n *\n * The created functions are memoized, a consecutive call of the factory\n * with the exact same inputs will return the same function instance.\n * The memoized cache is exposed on `factory.cache` and can be cleared\n * if needed.\n *\n * Example:\n *\n * const name = 'log'\n * const dependencies = ['config', 'typed', 'divideScalar', 'Complex']\n *\n * export const createLog = factory(name, dependencies, ({ typed, config, divideScalar, Complex }) => {\n * // ... create the function log here and return it\n * }\n *\n * @param {string} name Name of the function to be created\n * @param {string[]} dependencies The names of all required dependencies\n * @param {function} create Callback function called with an object with all dependencies\n * @param {Object} [meta]\n * Optional object with meta information that will be attached\n * to the created factory function as property `meta`. For explanation\n * of what meta properties can be specified and what they mean, see\n * docs/core/extension.md.\n * @returns {function}\n */\nexport function factory (name, dependencies, create, meta) {\n function assertAndCreate (scope) {\n // we only pass the requested dependencies to the factory function\n // to prevent functions to rely on dependencies that are not explicitly\n // requested.\n const deps = pickShallow(scope, dependencies.map(stripOptionalNotation))\n\n assertDependencies(name, dependencies, scope)\n\n return create(deps)\n }\n\n assertAndCreate.isFactory = true\n assertAndCreate.fn = name\n assertAndCreate.dependencies = dependencies.slice().sort()\n if (meta) {\n assertAndCreate.meta = meta\n }\n\n return assertAndCreate\n}\n\n/**\n * Sort all factories such that when loading in order, the dependencies are resolved.\n *\n * @param {Array} factories\n * @returns {Array} Returns a new array with the sorted factories.\n */\nexport function sortFactories (factories) {\n const factoriesByName = {}\n\n factories.forEach(factory => {\n factoriesByName[factory.fn] = factory\n })\n\n function containsDependency (factory, dependency) {\n // TODO: detect circular references\n if (isFactory(factory)) {\n if (factory.dependencies.includes(dependency.fn || dependency.name)) {\n return true\n }\n\n if (factory.dependencies.some(d => containsDependency(factoriesByName[d], dependency))) {\n return true\n }\n }\n\n return false\n }\n\n const sorted = []\n\n function addFactory (factory) {\n let index = 0\n while (index < sorted.length && !containsDependency(sorted[index], factory)) {\n index++\n }\n\n sorted.splice(index, 0, factory)\n }\n\n // sort regular factory functions\n factories\n .filter(isFactory)\n .forEach(addFactory)\n\n // sort legacy factory functions AFTER the regular factory functions\n factories\n .filter(factory => !isFactory(factory))\n .forEach(addFactory)\n\n return sorted\n}\n\n// TODO: comment or cleanup if unused in the end\nexport function create (factories, scope = {}) {\n sortFactories(factories)\n .forEach(factory => factory(scope))\n\n return scope\n}\n\n/**\n * Test whether an object is a factory. This is the case when it has\n * properties name, dependencies, and a function create.\n * @param {*} obj\n * @returns {boolean}\n */\nexport function isFactory (obj) {\n return typeof obj === 'function' &&\n typeof obj.fn === 'string' &&\n Array.isArray(obj.dependencies)\n}\n\n/**\n * Assert that all dependencies of a list with dependencies are available in the provided scope.\n *\n * Will throw an exception when there are dependencies missing.\n *\n * @param {string} name Name for the function to be created. Used to generate a useful error message\n * @param {string[]} dependencies\n * @param {Object} scope\n */\nexport function assertDependencies (name, dependencies, scope) {\n const allDefined = dependencies\n .filter(dependency => !isOptionalDependency(dependency)) // filter optionals\n .every(dependency => scope[dependency] !== undefined)\n\n if (!allDefined) {\n const missingDependencies = dependencies.filter(dependency => scope[dependency] === undefined)\n\n // TODO: create a custom error class for this, a MathjsError or something like that\n throw new Error(`Cannot create function \"${name}\", ` +\n `some dependencies are missing: ${missingDependencies.map(d => `\"${d}\"`).join(', ')}.`)\n }\n}\n\nexport function isOptionalDependency (dependency) {\n return dependency && dependency[0] === '?'\n}\n\nexport function stripOptionalNotation (dependency) {\n return dependency && dependency[0] === '?'\n ? dependency.slice(1)\n : dependency\n}\n","import { isBigNumber, isNumber, isObject } from './is.js'\n\n/**\n * @typedef {{sign: '+' | '-' | '', coefficients: number[], exponent: number}} SplitValue\n */\n\n/**\n * Check if a number is integer\n * @param {number | boolean} value\n * @return {boolean} isInteger\n */\nexport function isInteger (value) {\n if (typeof value === 'boolean') {\n return true\n }\n\n return isFinite(value)\n ? (value === Math.round(value))\n : false\n}\n\n/**\n * Ensure the number type is compatible with the provided value.\n * If not, return 'number' instead.\n *\n * For example:\n *\n * safeNumberType('2.3', { number: 'bigint', numberFallback: 'number' })\n *\n * will return 'number' and not 'bigint' because trying to create a bigint with\n * value 2.3 would throw an exception.\n *\n * @param {string} numberStr\n * @param {{\n * number: 'number' | 'BigNumber' | 'bigint' | 'Fraction'\n * numberFallback: 'number' | 'BigNumber'\n * }} config\n * @returns {'number' | 'BigNumber' | 'bigint' | 'Fraction'}\n */\nexport function safeNumberType (numberStr, config) {\n if (config.number === 'bigint') {\n try {\n BigInt(numberStr)\n } catch {\n return config.numberFallback\n }\n }\n\n return config.number\n}\n\n/**\n * Calculate the sign of a number\n * @param {number} x\n * @returns {number}\n */\nexport const sign = Math.sign || function (x) {\n if (x > 0) {\n return 1\n } else if (x < 0) {\n return -1\n } else {\n return 0\n }\n}\n\n/**\n * Calculate the base-2 logarithm of a number\n * @param {number} x\n * @returns {number}\n */\nexport const log2 = Math.log2 || function log2 (x) {\n return Math.log(x) / Math.LN2\n}\n\n/**\n * Calculate the base-10 logarithm of a number\n * @param {number} x\n * @returns {number}\n */\nexport const log10 = Math.log10 || function log10 (x) {\n return Math.log(x) / Math.LN10\n}\n\n/**\n * Calculate the natural logarithm of a number + 1\n * @param {number} x\n * @returns {number}\n */\nexport const log1p = Math.log1p || function (x) {\n return Math.log(x + 1)\n}\n\n/**\n * Calculate cubic root for a number\n *\n * Code from es6-shim.js:\n * https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L1564-L1577\n *\n * @param {number} x\n * @returns {number} Returns the cubic root of x\n */\nexport const cbrt = Math.cbrt || function cbrt (x) {\n if (x === 0) {\n return x\n }\n\n const negate = x < 0\n let result\n if (negate) {\n x = -x\n }\n\n if (isFinite(x)) {\n result = Math.exp(Math.log(x) / 3)\n // from https://en.wikipedia.org/wiki/Cube_root#Numerical_methods\n result = (x / (result * result) + (2 * result)) / 3\n } else {\n result = x\n }\n\n return negate ? -result : result\n}\n\n/**\n * Calculates exponentiation minus 1\n * @param {number} x\n * @return {number} res\n */\nexport const expm1 = Math.expm1 || function expm1 (x) {\n return (x >= 2e-4 || x <= -2e-4)\n ? Math.exp(x) - 1\n : x + x * x / 2 + x * x * x / 6\n}\n\n/**\n * Formats a number in a given base\n * @param {number} n\n * @param {number} base\n * @param {number} size\n * @returns {string}\n */\nfunction formatNumberToBase (n, base, size) {\n const prefixes = { 2: '0b', 8: '0o', 16: '0x' }\n const prefix = prefixes[base]\n let suffix = ''\n if (size) {\n if (size < 1) {\n throw new Error('size must be in greater than 0')\n }\n if (!isInteger(size)) {\n throw new Error('size must be an integer')\n }\n if (n > 2 ** (size - 1) - 1 || n < -(2 ** (size - 1))) {\n throw new Error(`Value must be in range [-2^${size - 1}, 2^${size - 1}-1]`)\n }\n if (!isInteger(n)) {\n throw new Error('Value must be an integer')\n }\n if (n < 0) {\n n = n + 2 ** size\n }\n suffix = `i${size}`\n }\n let sign = ''\n if (n < 0) {\n n = -n\n sign = '-'\n }\n return `${sign}${prefix}${n.toString(base)}${suffix}`\n}\n\n/**\n * Convert a number to a formatted string representation.\n *\n * Syntax:\n *\n * format(value)\n * format(value, options)\n * format(value, precision)\n * format(value, fn)\n *\n * Where:\n *\n * {number} value The value to be formatted\n * {Object} options An object with formatting options. Available options:\n * {string} notation\n * Number notation. Choose from:\n * 'fixed' Always use regular number notation.\n * For example '123.40' and '14000000'\n * 'exponential' Always use exponential notation.\n * For example '1.234e+2' and '1.4e+7'\n * 'engineering' Always use engineering notation.\n * For example '123.4e+0' and '14.0e+6'\n * 'auto' (default) Regular number notation for numbers\n * having an absolute value between\n * `lowerExp` and `upperExp` bounds, and\n * uses exponential notation elsewhere.\n * Lower bound is included, upper bound\n * is excluded.\n * For example '123.4' and '1.4e7'.\n * 'bin', 'oct, or\n * 'hex' Format the number using binary, octal,\n * or hexadecimal notation.\n * For example '0b1101' and '0x10fe'.\n * {number} wordSize The word size in bits to use for formatting\n * in binary, octal, or hexadecimal notation.\n * To be used only with 'bin', 'oct', or 'hex'\n * values for 'notation' option. When this option\n * is defined the value is formatted as a signed\n * twos complement integer of the given word size\n * and the size suffix is appended to the output.\n * For example\n * format(-1, {notation: 'hex', wordSize: 8}) === '0xffi8'.\n * Default value is undefined.\n * {number} precision A number between 0 and 16 to round\n * the digits of the number.\n * In case of notations 'exponential',\n * 'engineering', and 'auto',\n * `precision` defines the total\n * number of significant digits returned.\n * In case of notation 'fixed',\n * `precision` defines the number of\n * significant digits after the decimal\n * point.\n * `precision` is undefined by default,\n * not rounding any digits.\n * {number} lowerExp Exponent determining the lower boundary\n * for formatting a value with an exponent\n * when `notation='auto`.\n * Default value is `-3`.\n * {number} upperExp Exponent determining the upper boundary\n * for formatting a value with an exponent\n * when `notation='auto`.\n * Default value is `5`.\n * {Function} fn A custom formatting function. Can be used to override the\n * built-in notations. Function `fn` is called with `value` as\n * parameter and must return a string. Is useful for example to\n * format all values inside a matrix in a particular way.\n *\n * Examples:\n *\n * format(6.4) // '6.4'\n * format(1240000) // '1.24e6'\n * format(1/3) // '0.3333333333333333'\n * format(1/3, 3) // '0.333'\n * format(21385, 2) // '21000'\n * format(12.071, {notation: 'fixed'}) // '12'\n * format(2.3, {notation: 'fixed', precision: 2}) // '2.30'\n * format(52.8, {notation: 'exponential'}) // '5.28e+1'\n * format(12345678, {notation: 'engineering'}) // '12.345678e+6'\n *\n * @param {number} value\n * @param {Object | Function | number} [options]\n * @return {string} str The formatted value\n */\nexport function format (value, options) {\n if (typeof options === 'function') {\n // handle format(value, fn)\n return options(value)\n }\n\n // handle special cases\n if (value === Infinity) {\n return 'Infinity'\n } else if (value === -Infinity) {\n return '-Infinity'\n } else if (isNaN(value)) {\n return 'NaN'\n }\n\n const { notation, precision, wordSize } = normalizeFormatOptions(options)\n\n // handle the various notations\n switch (notation) {\n case 'fixed':\n return toFixed(value, precision)\n\n case 'exponential':\n return toExponential(value, precision)\n\n case 'engineering':\n return toEngineering(value, precision)\n\n case 'bin':\n return formatNumberToBase(value, 2, wordSize)\n\n case 'oct':\n return formatNumberToBase(value, 8, wordSize)\n\n case 'hex':\n return formatNumberToBase(value, 16, wordSize)\n\n case 'auto':\n // remove trailing zeros after the decimal point\n return toPrecision(value, precision, options)\n .replace(/((\\.\\d*?)(0+))($|e)/, function () {\n const digits = arguments[2]\n const e = arguments[4]\n return (digits !== '.') ? digits + e : e\n })\n\n default:\n throw new Error('Unknown notation \"' + notation + '\". ' +\n 'Choose \"auto\", \"exponential\", \"fixed\", \"bin\", \"oct\", or \"hex.')\n }\n}\n\n/**\n * Normalize format options into an object:\n * {\n * notation: string,\n * precision: number | undefined,\n * wordSize: number | undefined\n * }\n */\nexport function normalizeFormatOptions (options) {\n // default values for options\n let notation = 'auto'\n let precision\n let wordSize\n\n if (options !== undefined) {\n if (isNumber(options)) {\n precision = options\n } else if (isBigNumber(options)) {\n precision = options.toNumber()\n } else if (isObject(options)) {\n if (options.precision !== undefined) {\n precision = _toNumberOrThrow(options.precision, () => {\n throw new Error('Option \"precision\" must be a number or BigNumber')\n })\n }\n\n if (options.wordSize !== undefined) {\n wordSize = _toNumberOrThrow(options.wordSize, () => {\n throw new Error('Option \"wordSize\" must be a number or BigNumber')\n })\n }\n\n if (options.notation) {\n notation = options.notation\n }\n } else {\n throw new Error('Unsupported type of options, number, BigNumber, or object expected')\n }\n }\n\n return { notation, precision, wordSize }\n}\n\n/**\n * Split a number into sign, coefficients, and exponent\n * @param {number | string} value\n * @return {SplitValue}\n * Returns an object containing sign, coefficients, and exponent\n */\nexport function splitNumber (value) {\n // parse the input value\n const match = String(value).toLowerCase().match(/^(-?)(\\d+\\.?\\d*)(e([+-]?\\d+))?$/)\n if (!match) {\n throw new SyntaxError('Invalid number ' + value)\n }\n\n const sign = match[1]\n const digits = match[2]\n let exponent = parseFloat(match[4] || '0')\n\n const dot = digits.indexOf('.')\n exponent += (dot !== -1) ? (dot - 1) : (digits.length - 1)\n\n const coefficients = digits\n .replace('.', '') // remove the dot (must be removed before removing leading zeros)\n .replace(/^0*/, function (zeros) {\n // remove leading zeros, add their count to the exponent\n exponent -= zeros.length\n return ''\n })\n .replace(/0*$/, '') // remove trailing zeros\n .split('')\n .map(function (d) {\n return parseInt(d)\n })\n\n if (coefficients.length === 0) {\n coefficients.push(0)\n exponent++\n }\n\n return { sign, coefficients, exponent }\n}\n\n/**\n * Format a number in engineering notation. Like '1.23e+6', '2.3e+0', '3.500e-3'\n * @param {number | string} value\n * @param {number} [precision] Optional number of significant figures to return.\n */\nexport function toEngineering (value, precision) {\n if (isNaN(value) || !isFinite(value)) {\n return String(value)\n }\n\n const split = splitNumber(value)\n const rounded = roundDigits(split, precision)\n\n const e = rounded.exponent\n const c = rounded.coefficients\n\n // find nearest lower multiple of 3 for exponent\n const newExp = e % 3 === 0 ? e : (e < 0 ? (e - 3) - (e % 3) : e - (e % 3))\n\n if (isNumber(precision)) {\n // add zeroes to give correct sig figs\n while (precision > c.length || (e - newExp) + 1 > c.length) {\n c.push(0)\n }\n } else {\n // concatenate coefficients with necessary zeros\n // add zeros if necessary (for example: 1e+8 -> 100e+6)\n const missingZeros = Math.abs(e - newExp) - (c.length - 1)\n for (let i = 0; i < missingZeros; i++) {\n c.push(0)\n }\n }\n\n // find difference in exponents\n let expDiff = Math.abs(e - newExp)\n let decimalIdx = 1\n\n // push decimal index over by expDiff times\n while (expDiff > 0) {\n decimalIdx++\n expDiff--\n }\n\n // if all coefficient values are zero after the decimal point and precision is unset, don't add a decimal value.\n // otherwise concat with the rest of the coefficients\n const decimals = c.slice(decimalIdx).join('')\n const decimalVal = ((isNumber(precision) && decimals.length) || decimals.match(/[1-9]/)) ? ('.' + decimals) : ''\n\n const str = c.slice(0, decimalIdx).join('') +\n decimalVal +\n 'e' + (e >= 0 ? '+' : '') + newExp.toString()\n return rounded.sign + str\n}\n\n/**\n * Format a number with fixed notation.\n * @param {number | string} value\n * @param {number} [precision=undefined] Optional number of decimals after the\n * decimal point. null by default.\n */\nexport function toFixed (value, precision) {\n if (isNaN(value) || !isFinite(value)) {\n return String(value)\n }\n\n const splitValue = splitNumber(value)\n const rounded = (typeof precision === 'number')\n ? roundDigits(splitValue, splitValue.exponent + 1 + precision)\n : splitValue\n let c = rounded.coefficients\n let p = rounded.exponent + 1 // exponent may have changed\n\n // append zeros if needed\n const pp = p + (precision || 0)\n if (c.length < pp) {\n c = c.concat(zeros(pp - c.length))\n }\n\n // prepend zeros if needed\n if (p < 0) {\n c = zeros(-p + 1).concat(c)\n p = 1\n }\n\n // insert a dot if needed\n if (p < c.length) {\n c.splice(p, 0, (p === 0) ? '0.' : '.')\n }\n\n return rounded.sign + c.join('')\n}\n\n/**\n * Format a number in exponential notation. Like '1.23e+5', '2.3e+0', '3.500e-3'\n * @param {number | string} value\n * @param {number} [precision] Number of digits in formatted output.\n * If not provided, the maximum available digits\n * is used.\n */\nexport function toExponential (value, precision) {\n if (isNaN(value) || !isFinite(value)) {\n return String(value)\n }\n\n // round if needed, else create a clone\n const split = splitNumber(value)\n const rounded = precision ? roundDigits(split, precision) : split\n let c = rounded.coefficients\n const e = rounded.exponent\n\n // append zeros if needed\n if (c.length < precision) {\n c = c.concat(zeros(precision - c.length))\n }\n\n // format as `C.CCCe+EEE` or `C.CCCe-EEE`\n const first = c.shift()\n return rounded.sign + first + (c.length > 0 ? ('.' + c.join('')) : '') +\n 'e' + (e >= 0 ? '+' : '') + e\n}\n\n/**\n * Format a number with a certain precision\n * @param {number | string} value\n * @param {number} [precision=undefined] Optional number of digits.\n * @param {{lowerExp: number | undefined, upperExp: number | undefined}} [options]\n * By default:\n * lowerExp = -3 (incl)\n * upper = +5 (excl)\n * @return {string}\n */\nexport function toPrecision (value, precision, options) {\n if (isNaN(value) || !isFinite(value)) {\n return String(value)\n }\n\n // determine lower and upper bound for exponential notation.\n const lowerExp = _toNumberOrDefault(options?.lowerExp, -3)\n const upperExp = _toNumberOrDefault(options?.upperExp, 5)\n\n const split = splitNumber(value)\n const rounded = precision ? roundDigits(split, precision) : split\n if (rounded.exponent < lowerExp || rounded.exponent >= upperExp) {\n // exponential notation\n return toExponential(value, precision)\n } else {\n let c = rounded.coefficients\n const e = rounded.exponent\n\n // append trailing zeros\n if (c.length < precision) {\n c = c.concat(zeros(precision - c.length))\n }\n\n // append trailing zeros\n // TODO: simplify the next statement\n c = c.concat(zeros(e - c.length + 1 +\n (c.length < precision ? precision - c.length : 0)))\n\n // prepend zeros\n c = zeros(-e).concat(c)\n\n const dot = e > 0 ? e : 0\n if (dot < c.length - 1) {\n c.splice(dot + 1, 0, '.')\n }\n\n return rounded.sign + c.join('')\n }\n}\n\n/**\n * Round the number of digits of a number *\n * @param {SplitValue} split A value split with .splitNumber(value)\n * @param {number} precision A positive integer\n * @return {SplitValue}\n * Returns an object containing sign, coefficients, and exponent\n * with rounded digits\n */\nexport function roundDigits (split, precision) {\n // create a clone\n const rounded = {\n sign: split.sign,\n coefficients: split.coefficients,\n exponent: split.exponent\n }\n const c = rounded.coefficients\n\n // prepend zeros if needed\n while (precision <= 0) {\n c.unshift(0)\n rounded.exponent++\n precision++\n }\n\n if (c.length > precision) {\n const removed = c.splice(precision, c.length - precision)\n\n if (removed[0] >= 5) {\n let i = precision - 1\n c[i]++\n while (c[i] === 10) {\n c.pop()\n if (i === 0) {\n c.unshift(0)\n rounded.exponent++\n i++\n }\n i--\n c[i]++\n }\n }\n }\n\n return rounded\n}\n\n/**\n * Create an array filled with zeros.\n * @param {number} length\n * @return {Array}\n */\nfunction zeros (length) {\n const arr = []\n for (let i = 0; i < length; i++) {\n arr.push(0)\n }\n return arr\n}\n\n/**\n * Count the number of significant digits of a number.\n *\n * For example:\n * 2.34 returns 3\n * 0.0034 returns 2\n * 120.5e+30 returns 4\n *\n * @param {number} value\n * @return {number} digits Number of significant digits\n */\nexport function digits (value) {\n return value\n .toExponential()\n .replace(/e.*$/, '') // remove exponential notation\n .replace(/^0\\.?0*|\\./, '') // remove decimal point and leading zeros\n .length\n}\n\n/**\n * Compares two floating point numbers.\n * @param {number} a - First value to compare\n * @param {number} b - Second value to compare\n * @param {number} [relTol=1e-09] - The relative tolerance, indicating the maximum allowed difference relative to the larger absolute value. Must be greater than 0.\n * @param {number} [absTol=1e-12] - The minimum absolute tolerance, useful for comparisons near zero. Must be at least 0.\n * @return {boolean} whether the two numbers are nearly equal\n *\n * @throws {Error} If `relTol` is less than or equal to 0.\n * @throws {Error} If `absTol` is less than 0.\n *\n * @example\n * nearlyEqual(1.000000001, 1.0, 1e-8); // true\n * nearlyEqual(1.000000002, 1.0, 0); // false\n * nearlyEqual(1.0, 1.009, undefined, 0.01); // true\n * nearlyEqual(0.000000001, 0.0, undefined, 1e-8); // true\n */\nexport function nearlyEqual (a, b, relTol = 1e-8, absTol = 0) {\n if (relTol <= 0) {\n throw new Error('Relative tolerance must be greater than 0')\n }\n\n if (absTol < 0) {\n throw new Error('Absolute tolerance must be at least 0')\n }\n\n // NaN\n if (isNaN(a) || isNaN(b)) {\n return false\n }\n\n if (!isFinite(a) || !isFinite(b)) {\n return a === b\n }\n\n if (a === b) {\n return true\n }\n\n // abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)\n return Math.abs(a - b) <= Math.max(relTol * Math.max(Math.abs(a), Math.abs(b)), absTol)\n}\n\n/**\n * Calculate the hyperbolic arccos of a number\n * @param {number} x\n * @return {number}\n */\nexport const acosh = Math.acosh || function (x) {\n return Math.log(Math.sqrt(x * x - 1) + x)\n}\n\nexport const asinh = Math.asinh || function (x) {\n return Math.log(Math.sqrt(x * x + 1) + x)\n}\n\n/**\n * Calculate the hyperbolic arctangent of a number\n * @param {number} x\n * @return {number}\n */\nexport const atanh = Math.atanh || function (x) {\n return Math.log((1 + x) / (1 - x)) / 2\n}\n\n/**\n * Calculate the hyperbolic cosine of a number\n * @param {number} x\n * @returns {number}\n */\nexport const cosh = Math.cosh || function (x) {\n return (Math.exp(x) + Math.exp(-x)) / 2\n}\n\n/**\n * Calculate the hyperbolic sine of a number\n * @param {number} x\n * @returns {number}\n */\nexport const sinh = Math.sinh || function (x) {\n return (Math.exp(x) - Math.exp(-x)) / 2\n}\n\n/**\n * Calculate the hyperbolic tangent of a number\n * @param {number} x\n * @returns {number}\n */\nexport const tanh = Math.tanh || function (x) {\n const e = Math.exp(2 * x)\n return (e - 1) / (e + 1)\n}\n\n/**\n * Returns a value with the magnitude of x and the sign of y.\n * @param {number} x\n * @param {number} y\n * @returns {number}\n */\nexport function copysign (x, y) {\n const signx = x > 0 ? true : x < 0 ? false : 1 / x === Infinity\n const signy = y > 0 ? true : y < 0 ? false : 1 / y === Infinity\n return signx ^ signy ? -x : x\n}\n\nfunction _toNumberOrThrow (value, onError) {\n if (isNumber(value)) {\n return value\n } else if (isBigNumber(value)) {\n return value.toNumber()\n } else {\n onError()\n }\n}\n\nfunction _toNumberOrDefault (value, defaultValue) {\n if (isNumber(value)) {\n return value\n } else if (isBigNumber(value)) {\n return value.toNumber()\n } else {\n return defaultValue\n }\n}\n","/**\n * Create a typed-function which checks the types of the arguments and\n * can match them against multiple provided signatures. The typed-function\n * automatically converts inputs in order to find a matching signature.\n * Typed functions throw informative errors in case of wrong input arguments.\n *\n * See the library [typed-function](https://github.com/josdejong/typed-function)\n * for detailed documentation.\n *\n * Syntax:\n *\n * math.typed(name, signatures) : function\n * math.typed(signatures) : function\n *\n * Examples:\n *\n * // create a typed function with multiple types per argument (type union)\n * const fn2 = typed({\n * 'number | boolean': function (b) {\n * return 'b is a number or boolean'\n * },\n * 'string, number | boolean': function (a, b) {\n * return 'a is a string, b is a number or boolean'\n * }\n * })\n *\n * // create a typed function with an any type argument\n * const log = typed({\n * 'string, any': function (event, data) {\n * console.log('event: ' + event + ', data: ' + JSON.stringify(data))\n * }\n * })\n *\n * @param {string} [name] Optional name for the typed-function\n * @param {Object} signatures Object with one or multiple function signatures\n * @returns {function} The created typed-function.\n */\n\nimport typedFunction from 'typed-function'\nimport { factory } from '../../utils/factory.js'\nimport {\n isAccessorNode,\n isArray,\n isArrayNode,\n isAssignmentNode,\n isBigInt,\n isBigNumber,\n isBlockNode,\n isBoolean,\n isChain,\n isCollection,\n isComplex,\n isConditionalNode,\n isConstantNode,\n isDate,\n isDenseMatrix,\n isFraction,\n isFunction,\n isFunctionAssignmentNode,\n isFunctionNode,\n isHelp,\n isIndex,\n isIndexNode,\n isMap,\n isMatrix,\n isNode,\n isNull,\n isNumber,\n isObject,\n isObjectNode,\n isOperatorNode,\n isParenthesisNode,\n isRange,\n isRangeNode,\n isRegExp,\n isRelationalNode,\n isResultSet,\n isSparseMatrix,\n isString,\n isSymbolNode,\n isUndefined,\n isUnit\n} from '../../utils/is.js'\nimport { digits } from '../../utils/number.js'\n\n// returns a new instance of typed-function\nlet _createTyped = function () {\n // initially, return the original instance of typed-function\n // consecutively, return a new instance from typed.create.\n _createTyped = typedFunction.create\n return typedFunction\n}\n\nconst dependencies = [\n '?BigNumber',\n '?Complex',\n '?DenseMatrix',\n '?Fraction'\n]\n\n/**\n * Factory function for creating a new typed instance\n * @param {Object} dependencies Object with data types like Complex and BigNumber\n * @returns {Function}\n */\nexport const createTyped = /* #__PURE__ */ factory('typed', dependencies, function createTyped ({ BigNumber, Complex, DenseMatrix, Fraction }) {\n // TODO: typed-function must be able to silently ignore signatures with unknown data types\n\n // get a new instance of typed-function\n const typed = _createTyped()\n\n // define all types. The order of the types determines in which order function\n // arguments are type-checked (so for performance it's important to put the\n // most used types first).\n typed.clear()\n typed.addTypes([\n { name: 'number', test: isNumber },\n { name: 'Complex', test: isComplex },\n { name: 'BigNumber', test: isBigNumber },\n { name: 'bigint', test: isBigInt },\n { name: 'Fraction', test: isFraction },\n { name: 'Unit', test: isUnit },\n // The following type matches a valid variable name, i.e., an alphanumeric\n // string starting with an alphabetic character. It is used (at least)\n // in the definition of the derivative() function, as the argument telling\n // what to differentiate over must (currently) be a variable.\n // TODO: deprecate the identifier type (it's not used anymore, see https://github.com/josdejong/mathjs/issues/3253)\n {\n name: 'identifier',\n test: s => isString && /^\\p{L}[\\p{L}\\d]*$/u.test(s)\n },\n { name: 'string', test: isString },\n { name: 'Chain', test: isChain },\n { name: 'Array', test: isArray },\n { name: 'Matrix', test: isMatrix },\n { name: 'DenseMatrix', test: isDenseMatrix },\n { name: 'SparseMatrix', test: isSparseMatrix },\n { name: 'Range', test: isRange },\n { name: 'Index', test: isIndex },\n { name: 'boolean', test: isBoolean },\n { name: 'ResultSet', test: isResultSet },\n { name: 'Help', test: isHelp },\n { name: 'function', test: isFunction },\n { name: 'Date', test: isDate },\n { name: 'RegExp', test: isRegExp },\n { name: 'null', test: isNull },\n { name: 'undefined', test: isUndefined },\n\n { name: 'AccessorNode', test: isAccessorNode },\n { name: 'ArrayNode', test: isArrayNode },\n { name: 'AssignmentNode', test: isAssignmentNode },\n { name: 'BlockNode', test: isBlockNode },\n { name: 'ConditionalNode', test: isConditionalNode },\n { name: 'ConstantNode', test: isConstantNode },\n { name: 'FunctionNode', test: isFunctionNode },\n { name: 'FunctionAssignmentNode', test: isFunctionAssignmentNode },\n { name: 'IndexNode', test: isIndexNode },\n { name: 'Node', test: isNode },\n { name: 'ObjectNode', test: isObjectNode },\n { name: 'OperatorNode', test: isOperatorNode },\n { name: 'ParenthesisNode', test: isParenthesisNode },\n { name: 'RangeNode', test: isRangeNode },\n { name: 'RelationalNode', test: isRelationalNode },\n { name: 'SymbolNode', test: isSymbolNode },\n\n { name: 'Map', test: isMap },\n { name: 'Object', test: isObject } // order 'Object' last, it matches on other classes too\n ])\n\n typed.addConversions([\n {\n from: 'number',\n to: 'BigNumber',\n convert: function (x) {\n if (!BigNumber) {\n throwNoBignumber(x)\n }\n\n // note: conversion from number to BigNumber can fail if x has >15 digits\n if (digits(x) > 15) {\n throw new TypeError('Cannot implicitly convert a number with >15 significant digits to BigNumber ' +\n '(value: ' + x + '). ' +\n 'Use function bignumber(x) to convert to BigNumber.')\n }\n return new BigNumber(x)\n }\n }, {\n from: 'number',\n to: 'Complex',\n convert: function (x) {\n if (!Complex) {\n throwNoComplex(x)\n }\n\n return new Complex(x, 0)\n }\n }, {\n from: 'BigNumber',\n to: 'Complex',\n convert: function (x) {\n if (!Complex) {\n throwNoComplex(x)\n }\n\n return new Complex(x.toNumber(), 0)\n }\n }, {\n from: 'bigint',\n to: 'number',\n convert: function (x) {\n if (x > Number.MAX_SAFE_INTEGER) {\n throw new TypeError('Cannot implicitly convert bigint to number: ' +\n 'value exceeds the max safe integer value (value: ' + x + ')')\n }\n\n return Number(x)\n }\n }, {\n from: 'bigint',\n to: 'BigNumber',\n convert: function (x) {\n if (!BigNumber) {\n throwNoBignumber(x)\n }\n\n return new BigNumber(x.toString())\n }\n }, {\n from: 'bigint',\n to: 'Fraction',\n convert: function (x) {\n if (!Fraction) {\n throwNoFraction(x)\n }\n\n return new Fraction(x)\n }\n }, {\n from: 'Fraction',\n to: 'BigNumber',\n convert: function (x) {\n throw new TypeError('Cannot implicitly convert a Fraction to BigNumber or vice versa. ' +\n 'Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.')\n }\n }, {\n from: 'Fraction',\n to: 'Complex',\n convert: function (x) {\n if (!Complex) {\n throwNoComplex(x)\n }\n\n return new Complex(x.valueOf(), 0)\n }\n }, {\n from: 'number',\n to: 'Fraction',\n convert: function (x) {\n if (!Fraction) {\n throwNoFraction(x)\n }\n\n const f = new Fraction(x)\n if (f.valueOf() !== x) {\n throw new TypeError('Cannot implicitly convert a number to a Fraction when there will be a loss of precision ' +\n '(value: ' + x + '). ' +\n 'Use function fraction(x) to convert to Fraction.')\n }\n return f\n }\n }, {\n // FIXME: add conversion from Fraction to number, for example for `sqrt(fraction(1,3))`\n // from: 'Fraction',\n // to: 'number',\n // convert: function (x) {\n // return x.valueOf()\n // }\n // }, {\n from: 'string',\n to: 'number',\n convert: function (x) {\n const n = Number(x)\n if (isNaN(n)) {\n throw new Error('Cannot convert \"' + x + '\" to a number')\n }\n return n\n }\n }, {\n from: 'string',\n to: 'BigNumber',\n convert: function (x) {\n if (!BigNumber) {\n throwNoBignumber(x)\n }\n\n try {\n return new BigNumber(x)\n } catch (err) {\n throw new Error('Cannot convert \"' + x + '\" to BigNumber')\n }\n }\n }, {\n from: 'string',\n to: 'bigint',\n convert: function (x) {\n try {\n return BigInt(x)\n } catch (err) {\n throw new Error('Cannot convert \"' + x + '\" to BigInt')\n }\n }\n }, {\n from: 'string',\n to: 'Fraction',\n convert: function (x) {\n if (!Fraction) {\n throwNoFraction(x)\n }\n\n try {\n return new Fraction(x)\n } catch (err) {\n throw new Error('Cannot convert \"' + x + '\" to Fraction')\n }\n }\n }, {\n from: 'string',\n to: 'Complex',\n convert: function (x) {\n if (!Complex) {\n throwNoComplex(x)\n }\n\n try {\n return new Complex(x)\n } catch (err) {\n throw new Error('Cannot convert \"' + x + '\" to Complex')\n }\n }\n }, {\n from: 'boolean',\n to: 'number',\n convert: function (x) {\n return +x\n }\n }, {\n from: 'boolean',\n to: 'BigNumber',\n convert: function (x) {\n if (!BigNumber) {\n throwNoBignumber(x)\n }\n\n return new BigNumber(+x)\n }\n }, {\n from: 'boolean',\n to: 'bigint',\n convert: function (x) {\n return BigInt(+x)\n }\n }, {\n from: 'boolean',\n to: 'Fraction',\n convert: function (x) {\n if (!Fraction) {\n throwNoFraction(x)\n }\n\n return new Fraction(+x)\n }\n }, {\n from: 'boolean',\n to: 'string',\n convert: function (x) {\n return String(x)\n }\n }, {\n from: 'Array',\n to: 'Matrix',\n convert: function (array) {\n if (!DenseMatrix) {\n throwNoMatrix()\n }\n\n return new DenseMatrix(array)\n }\n }, {\n from: 'Matrix',\n to: 'Array',\n convert: function (matrix) {\n return matrix.valueOf()\n }\n }\n ])\n\n // Provide a suggestion on how to call a function elementwise\n // This was added primarily as guidance for the v10 -> v11 transition,\n // and could potentially be removed in the future if it no longer seems\n // to be helpful.\n typed.onMismatch = (name, args, signatures) => {\n const usualError = typed.createError(name, args, signatures)\n if (['wrongType', 'mismatch'].includes(usualError.data.category) &&\n args.length === 1 && isCollection(args[0]) &&\n // check if the function can be unary:\n signatures.some(sig => !sig.params.includes(','))) {\n const err = new TypeError(\n `Function '${name}' doesn't apply to matrices. To call it ` +\n `elementwise on a matrix 'M', try 'map(M, ${name})'.`)\n err.data = usualError.data\n throw err\n }\n throw usualError\n }\n\n // Provide a suggestion on how to call a function elementwise\n // This was added primarily as guidance for the v10 -> v11 transition,\n // and could potentially be removed in the future if it no longer seems\n // to be helpful.\n typed.onMismatch = (name, args, signatures) => {\n const usualError = typed.createError(name, args, signatures)\n if (['wrongType', 'mismatch'].includes(usualError.data.category) &&\n args.length === 1 && isCollection(args[0]) &&\n // check if the function can be unary:\n signatures.some(sig => !sig.params.includes(','))) {\n const err = new TypeError(\n `Function '${name}' doesn't apply to matrices. To call it ` +\n `elementwise on a matrix 'M', try 'map(M, ${name})'.`)\n err.data = usualError.data\n throw err\n }\n throw usualError\n }\n\n return typed\n})\n\nfunction throwNoBignumber (x) {\n throw new Error(`Cannot convert value ${x} into a BigNumber: no class 'BigNumber' provided`)\n}\n\nfunction throwNoComplex (x) {\n throw new Error(`Cannot convert value ${x} into a Complex number: no class 'Complex' provided`)\n}\n\nfunction throwNoMatrix () {\n throw new Error('Cannot convert array into a Matrix: no class \\'DenseMatrix\\' provided')\n}\n\nfunction throwNoFraction (x) {\n throw new Error(`Cannot convert value ${x} into a Fraction, no class 'Fraction' provided.`)\n}\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'ResultSet'\nconst dependencies = []\n\nexport const createResultSet = /* #__PURE__ */ factory(name, dependencies, () => {\n /**\n * A ResultSet contains a list or results\n * @class ResultSet\n * @param {Array} entries\n * @constructor ResultSet\n */\n function ResultSet (entries) {\n if (!(this instanceof ResultSet)) {\n throw new SyntaxError('Constructor must be called with the new operator')\n }\n\n this.entries = entries || []\n }\n\n /**\n * Attach type information\n */\n ResultSet.prototype.type = 'ResultSet'\n ResultSet.prototype.isResultSet = true\n\n /**\n * Returns the array with results hold by this ResultSet\n * @memberof ResultSet\n * @returns {Array} entries\n */\n ResultSet.prototype.valueOf = function () {\n return this.entries\n }\n\n /**\n * Returns the stringified results of the ResultSet\n * @memberof ResultSet\n * @returns {string} string\n */\n ResultSet.prototype.toString = function () {\n return '[' + this.entries.map(String).join(', ') + ']'\n }\n\n /**\n * Get a JSON representation of the ResultSet\n * @memberof ResultSet\n * @returns {Object} Returns a JSON object structured as:\n * `{\"mathjs\": \"ResultSet\", \"entries\": [...]}`\n */\n ResultSet.prototype.toJSON = function () {\n return {\n mathjs: 'ResultSet',\n entries: this.entries\n }\n }\n\n /**\n * Instantiate a ResultSet from a JSON object\n * @memberof ResultSet\n * @param {Object} json A JSON object structured as:\n * `{\"mathjs\": \"ResultSet\", \"entries\": [...]}`\n * @return {ResultSet}\n */\n ResultSet.fromJSON = function (json) {\n return new ResultSet(json.entries)\n }\n\n return ResultSet\n}, { isClass: true })\n","/*!\r\n * decimal.js v10.5.0\r\n * An arbitrary-precision Decimal type for JavaScript.\r\n * https://github.com/MikeMcl/decimal.js\r\n * Copyright (c) 2025 Michael Mclaughlin \r\n * MIT Licence\r\n */\r\n\r\n\r\n// ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //\r\n\r\n\r\n // The maximum exponent magnitude.\r\n // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.\r\nvar EXP_LIMIT = 9e15, // 0 to 9e15\r\n\r\n // The limit on the value of `precision`, and on the value of the first argument to\r\n // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.\r\n MAX_DIGITS = 1e9, // 0 to 1e9\r\n\r\n // Base conversion alphabet.\r\n NUMERALS = '0123456789abcdef',\r\n\r\n // The natural logarithm of 10 (1025 digits).\r\n LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',\r\n\r\n // Pi (1025 digits).\r\n PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',\r\n\r\n\r\n // The initial configuration properties of the Decimal constructor.\r\n DEFAULTS = {\r\n\r\n // These values must be integers within the stated ranges (inclusive).\r\n // Most of these values can be changed at run-time using the `Decimal.config` method.\r\n\r\n // The maximum number of significant digits of the result of a calculation or base conversion.\r\n // E.g. `Decimal.config({ precision: 20 });`\r\n precision: 20, // 1 to MAX_DIGITS\r\n\r\n // The rounding mode used when rounding to `precision`.\r\n //\r\n // ROUND_UP 0 Away from zero.\r\n // ROUND_DOWN 1 Towards zero.\r\n // ROUND_CEIL 2 Towards +Infinity.\r\n // ROUND_FLOOR 3 Towards -Infinity.\r\n // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n //\r\n // E.g.\r\n // `Decimal.rounding = 4;`\r\n // `Decimal.rounding = Decimal.ROUND_HALF_UP;`\r\n rounding: 4, // 0 to 8\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 The IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.\r\n //\r\n // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian\r\n // division (9) are commonly used for the modulus operation. The other rounding modes can also\r\n // be used, but they may not give useful results.\r\n modulo: 1, // 0 to 9\r\n\r\n // The exponent value at and beneath which `toString` returns exponential notation.\r\n // JavaScript numbers: -7\r\n toExpNeg: -7, // 0 to -EXP_LIMIT\r\n\r\n // The exponent value at and above which `toString` returns exponential notation.\r\n // JavaScript numbers: 21\r\n toExpPos: 21, // 0 to EXP_LIMIT\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // JavaScript numbers: -324 (5e-324)\r\n minE: -EXP_LIMIT, // -1 to -EXP_LIMIT\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // JavaScript numbers: 308 (1.7976931348623157e+308)\r\n maxE: EXP_LIMIT, // 1 to EXP_LIMIT\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n crypto: false // true/false\r\n },\r\n\r\n\r\n// ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //\r\n\r\n\r\n inexact, quadrant,\r\n external = true,\r\n\r\n decimalError = '[DecimalError] ',\r\n invalidArgument = decimalError + 'Invalid argument: ',\r\n precisionLimitExceeded = decimalError + 'Precision limit exceeded',\r\n cryptoUnavailable = decimalError + 'crypto unavailable',\r\n tag = '[object Decimal]',\r\n\r\n mathfloor = Math.floor,\r\n mathpow = Math.pow,\r\n\r\n isBinary = /^0b([01]+(\\.[01]*)?|\\.[01]+)(p[+-]?\\d+)?$/i,\r\n isHex = /^0x([0-9a-f]+(\\.[0-9a-f]*)?|\\.[0-9a-f]+)(p[+-]?\\d+)?$/i,\r\n isOctal = /^0o([0-7]+(\\.[0-7]*)?|\\.[0-7]+)(p[+-]?\\d+)?$/i,\r\n isDecimal = /^(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i,\r\n\r\n BASE = 1e7,\r\n LOG_BASE = 7,\r\n MAX_SAFE_INTEGER = 9007199254740991,\r\n\r\n LN10_PRECISION = LN10.length - 1,\r\n PI_PRECISION = PI.length - 1,\r\n\r\n // Decimal.prototype object\r\n P = { toStringTag: tag };\r\n\r\n\r\n// Decimal prototype methods\r\n\r\n\r\n/*\r\n * absoluteValue abs\r\n * ceil\r\n * clampedTo clamp\r\n * comparedTo cmp\r\n * cosine cos\r\n * cubeRoot cbrt\r\n * decimalPlaces dp\r\n * dividedBy div\r\n * dividedToIntegerBy divToInt\r\n * equals eq\r\n * floor\r\n * greaterThan gt\r\n * greaterThanOrEqualTo gte\r\n * hyperbolicCosine cosh\r\n * hyperbolicSine sinh\r\n * hyperbolicTangent tanh\r\n * inverseCosine acos\r\n * inverseHyperbolicCosine acosh\r\n * inverseHyperbolicSine asinh\r\n * inverseHyperbolicTangent atanh\r\n * inverseSine asin\r\n * inverseTangent atan\r\n * isFinite\r\n * isInteger isInt\r\n * isNaN\r\n * isNegative isNeg\r\n * isPositive isPos\r\n * isZero\r\n * lessThan lt\r\n * lessThanOrEqualTo lte\r\n * logarithm log\r\n * [maximum] [max]\r\n * [minimum] [min]\r\n * minus sub\r\n * modulo mod\r\n * naturalExponential exp\r\n * naturalLogarithm ln\r\n * negated neg\r\n * plus add\r\n * precision sd\r\n * round\r\n * sine sin\r\n * squareRoot sqrt\r\n * tangent tan\r\n * times mul\r\n * toBinary\r\n * toDecimalPlaces toDP\r\n * toExponential\r\n * toFixed\r\n * toFraction\r\n * toHexadecimal toHex\r\n * toNearest\r\n * toNumber\r\n * toOctal\r\n * toPower pow\r\n * toPrecision\r\n * toSignificantDigits toSD\r\n * toString\r\n * truncated trunc\r\n * valueOf toJSON\r\n */\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the absolute value of this Decimal.\r\n *\r\n */\r\nP.absoluteValue = P.abs = function () {\r\n var x = new this.constructor(this);\r\n if (x.s < 0) x.s = 1;\r\n return finalise(x);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the\r\n * direction of positive Infinity.\r\n *\r\n */\r\nP.ceil = function () {\r\n return finalise(new this.constructor(this), this.e + 1, 2);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal clamped to the range\r\n * delineated by `min` and `max`.\r\n *\r\n * min {number|string|bigint|Decimal}\r\n * max {number|string|bigint|Decimal}\r\n *\r\n */\r\nP.clampedTo = P.clamp = function (min, max) {\r\n var k,\r\n x = this,\r\n Ctor = x.constructor;\r\n min = new Ctor(min);\r\n max = new Ctor(max);\r\n if (!min.s || !max.s) return new Ctor(NaN);\r\n if (min.gt(max)) throw Error(invalidArgument + max);\r\n k = x.cmp(min);\r\n return k < 0 ? min : x.cmp(max) > 0 ? max : new Ctor(x);\r\n};\r\n\r\n\r\n/*\r\n * Return\r\n * 1 if the value of this Decimal is greater than the value of `y`,\r\n * -1 if the value of this Decimal is less than the value of `y`,\r\n * 0 if they have the same value,\r\n * NaN if the value of either Decimal is NaN.\r\n *\r\n */\r\nP.comparedTo = P.cmp = function (y) {\r\n var i, j, xdL, ydL,\r\n x = this,\r\n xd = x.d,\r\n yd = (y = new x.constructor(y)).d,\r\n xs = x.s,\r\n ys = y.s;\r\n\r\n // Either NaN or ±Infinity?\r\n if (!xd || !yd) {\r\n return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;\r\n }\r\n\r\n // Either zero?\r\n if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;\r\n\r\n // Signs differ?\r\n if (xs !== ys) return xs;\r\n\r\n // Compare exponents.\r\n if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;\r\n\r\n xdL = xd.length;\r\n ydL = yd.length;\r\n\r\n // Compare digit by digit.\r\n for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {\r\n if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;\r\n }\r\n\r\n // Compare lengths.\r\n return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-1, 1]\r\n *\r\n * cos(0) = 1\r\n * cos(-0) = 1\r\n * cos(Infinity) = NaN\r\n * cos(-Infinity) = NaN\r\n * cos(NaN) = NaN\r\n *\r\n */\r\nP.cosine = P.cos = function () {\r\n var pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.d) return new Ctor(NaN);\r\n\r\n // cos(0) = cos(-0) = 1\r\n if (!x.d[0]) return new Ctor(1);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;\r\n Ctor.rounding = 1;\r\n\r\n x = cosine(Ctor, toLessThanHalfPi(Ctor, x));\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);\r\n};\r\n\r\n\r\n/*\r\n *\r\n * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to\r\n * `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * cbrt(0) = 0\r\n * cbrt(-0) = -0\r\n * cbrt(1) = 1\r\n * cbrt(-1) = -1\r\n * cbrt(N) = N\r\n * cbrt(-I) = -I\r\n * cbrt(I) = I\r\n *\r\n * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))\r\n *\r\n */\r\nP.cubeRoot = P.cbrt = function () {\r\n var e, m, n, r, rep, s, sd, t, t3, t3plusx,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite() || x.isZero()) return new Ctor(x);\r\n external = false;\r\n\r\n // Initial estimate.\r\n s = x.s * mathpow(x.s * x, 1 / 3);\r\n\r\n // Math.cbrt underflow/overflow?\r\n // Pass x to Math.pow as integer, then adjust the exponent of the result.\r\n if (!s || Math.abs(s) == 1 / 0) {\r\n n = digitsToString(x.d);\r\n e = x.e;\r\n\r\n // Adjust n exponent so it is a multiple of 3 away from x exponent.\r\n if (s = (e - n.length + 1) % 3) n += (s == 1 || s == -2 ? '0' : '00');\r\n s = mathpow(n, 1 / 3);\r\n\r\n // Rarely, e may be one less than the result exponent value.\r\n e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));\r\n\r\n if (s == 1 / 0) {\r\n n = '5e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new Ctor(n);\r\n r.s = x.s;\r\n } else {\r\n r = new Ctor(s.toString());\r\n }\r\n\r\n sd = (e = Ctor.precision) + 3;\r\n\r\n // Halley's method.\r\n // TODO? Compare Newton's method.\r\n for (;;) {\r\n t = r;\r\n t3 = t.times(t).times(t);\r\n t3plusx = t3.plus(x);\r\n r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);\r\n\r\n // TODO? Replace with for-loop and checkRoundingDigits.\r\n if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {\r\n n = n.slice(sd - 3, sd + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999\r\n // , i.e. approaching a rounding boundary, continue the iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the exact result as the\r\n // nines may infinitely repeat.\r\n if (!rep) {\r\n finalise(t, e + 1, 0);\r\n\r\n if (t.times(t).times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n sd += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.\r\n // If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n finalise(r, e + 1, 1);\r\n m = !r.times(r).times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n\r\n external = true;\r\n\r\n return finalise(r, e, Ctor.rounding, m);\r\n};\r\n\r\n\r\n/*\r\n * Return the number of decimal places of the value of this Decimal.\r\n *\r\n */\r\nP.decimalPlaces = P.dp = function () {\r\n var w,\r\n d = this.d,\r\n n = NaN;\r\n\r\n if (d) {\r\n w = d.length - 1;\r\n n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last word.\r\n w = d[w];\r\n if (w) for (; w % 10 == 0; w /= 10) n--;\r\n if (n < 0) n = 0;\r\n }\r\n\r\n return n;\r\n};\r\n\r\n\r\n/*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to\r\n * `precision` significant digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.dividedBy = P.div = function (y) {\r\n return divide(this, new this.constructor(y));\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the integer part of dividing the value of this Decimal\r\n * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.dividedToIntegerBy = P.divToInt = function (y) {\r\n var x = this,\r\n Ctor = x.constructor;\r\n return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.\r\n *\r\n */\r\nP.equals = P.eq = function (y) {\r\n return this.cmp(y) === 0;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the\r\n * direction of negative Infinity.\r\n *\r\n */\r\nP.floor = function () {\r\n return finalise(new this.constructor(this), this.e + 1, 3);\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is greater than the value of `y`, otherwise return\r\n * false.\r\n *\r\n */\r\nP.greaterThan = P.gt = function (y) {\r\n return this.cmp(y) > 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is greater than or equal to the value of `y`,\r\n * otherwise return false.\r\n *\r\n */\r\nP.greaterThanOrEqualTo = P.gte = function (y) {\r\n var k = this.cmp(y);\r\n return k == 1 || k === 0;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this\r\n * Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [1, Infinity]\r\n *\r\n * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...\r\n *\r\n * cosh(0) = 1\r\n * cosh(-0) = 1\r\n * cosh(Infinity) = Infinity\r\n * cosh(-Infinity) = Infinity\r\n * cosh(NaN) = NaN\r\n *\r\n * x time taken (ms) result\r\n * 1000 9 9.8503555700852349694e+433\r\n * 10000 25 4.4034091128314607936e+4342\r\n * 100000 171 1.4033316802130615897e+43429\r\n * 1000000 3817 1.5166076984010437725e+434294\r\n * 10000000 abandoned after 2 minute wait\r\n *\r\n * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))\r\n *\r\n */\r\nP.hyperbolicCosine = P.cosh = function () {\r\n var k, n, pr, rm, len,\r\n x = this,\r\n Ctor = x.constructor,\r\n one = new Ctor(1);\r\n\r\n if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);\r\n if (x.isZero()) return one;\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;\r\n Ctor.rounding = 1;\r\n len = x.d.length;\r\n\r\n // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1\r\n // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))\r\n\r\n // Estimate the optimum number of times to use the argument reduction.\r\n // TODO? Estimation reused from cosine() and may not be optimal here.\r\n if (len < 32) {\r\n k = Math.ceil(len / 3);\r\n n = (1 / tinyPow(4, k)).toString();\r\n } else {\r\n k = 16;\r\n n = '2.3283064365386962890625e-10';\r\n }\r\n\r\n x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);\r\n\r\n // Reverse argument reduction\r\n var cosh2_x,\r\n i = k,\r\n d8 = new Ctor(8);\r\n for (; i--;) {\r\n cosh2_x = x.times(x);\r\n x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));\r\n }\r\n\r\n return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this\r\n * Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-Infinity, Infinity]\r\n *\r\n * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...\r\n *\r\n * sinh(0) = 0\r\n * sinh(-0) = -0\r\n * sinh(Infinity) = Infinity\r\n * sinh(-Infinity) = -Infinity\r\n * sinh(NaN) = NaN\r\n *\r\n * x time taken (ms)\r\n * 10 2 ms\r\n * 100 5 ms\r\n * 1000 14 ms\r\n * 10000 82 ms\r\n * 100000 886 ms 1.4033316802130615897e+43429\r\n * 200000 2613 ms\r\n * 300000 5407 ms\r\n * 400000 8824 ms\r\n * 500000 13026 ms 8.7080643612718084129e+217146\r\n * 1000000 48543 ms\r\n *\r\n * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))\r\n *\r\n */\r\nP.hyperbolicSine = P.sinh = function () {\r\n var k, pr, rm, len,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite() || x.isZero()) return new Ctor(x);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;\r\n Ctor.rounding = 1;\r\n len = x.d.length;\r\n\r\n if (len < 3) {\r\n x = taylorSeries(Ctor, 2, x, x, true);\r\n } else {\r\n\r\n // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))\r\n // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))\r\n // 3 multiplications and 1 addition\r\n\r\n // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))\r\n // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))\r\n // 4 multiplications and 2 additions\r\n\r\n // Estimate the optimum number of times to use the argument reduction.\r\n k = 1.4 * Math.sqrt(len);\r\n k = k > 16 ? 16 : k | 0;\r\n\r\n x = x.times(1 / tinyPow(5, k));\r\n x = taylorSeries(Ctor, 2, x, x, true);\r\n\r\n // Reverse argument reduction\r\n var sinh2_x,\r\n d5 = new Ctor(5),\r\n d16 = new Ctor(16),\r\n d20 = new Ctor(20);\r\n for (; k--;) {\r\n sinh2_x = x.times(x);\r\n x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));\r\n }\r\n }\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return finalise(x, pr, rm, true);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this\r\n * Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-1, 1]\r\n *\r\n * tanh(x) = sinh(x) / cosh(x)\r\n *\r\n * tanh(0) = 0\r\n * tanh(-0) = -0\r\n * tanh(Infinity) = 1\r\n * tanh(-Infinity) = -1\r\n * tanh(NaN) = NaN\r\n *\r\n */\r\nP.hyperbolicTangent = P.tanh = function () {\r\n var pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite()) return new Ctor(x.s);\r\n if (x.isZero()) return new Ctor(x);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + 7;\r\n Ctor.rounding = 1;\r\n\r\n return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of\r\n * this Decimal.\r\n *\r\n * Domain: [-1, 1]\r\n * Range: [0, pi]\r\n *\r\n * acos(x) = pi/2 - asin(x)\r\n *\r\n * acos(0) = pi/2\r\n * acos(-0) = pi/2\r\n * acos(1) = 0\r\n * acos(-1) = pi\r\n * acos(1/2) = pi/3\r\n * acos(-1/2) = 2*pi/3\r\n * acos(|x| > 1) = NaN\r\n * acos(NaN) = NaN\r\n *\r\n */\r\nP.inverseCosine = P.acos = function () {\r\n var x = this,\r\n Ctor = x.constructor,\r\n k = x.abs().cmp(1),\r\n pr = Ctor.precision,\r\n rm = Ctor.rounding;\r\n\r\n if (k !== -1) {\r\n return k === 0\r\n // |x| is 1\r\n ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)\r\n // |x| > 1 or x is NaN\r\n : new Ctor(NaN);\r\n }\r\n\r\n if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);\r\n\r\n // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3\r\n\r\n Ctor.precision = pr + 6;\r\n Ctor.rounding = 1;\r\n\r\n // See https://github.com/MikeMcl/decimal.js/pull/217\r\n x = new Ctor(1).minus(x).div(x.plus(1)).sqrt().atan();\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return x.times(2);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the\r\n * value of this Decimal.\r\n *\r\n * Domain: [1, Infinity]\r\n * Range: [0, Infinity]\r\n *\r\n * acosh(x) = ln(x + sqrt(x^2 - 1))\r\n *\r\n * acosh(x < 1) = NaN\r\n * acosh(NaN) = NaN\r\n * acosh(Infinity) = Infinity\r\n * acosh(-Infinity) = NaN\r\n * acosh(0) = NaN\r\n * acosh(-0) = NaN\r\n * acosh(1) = 0\r\n * acosh(-1) = NaN\r\n *\r\n */\r\nP.inverseHyperbolicCosine = P.acosh = function () {\r\n var pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);\r\n if (!x.isFinite()) return new Ctor(x);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;\r\n Ctor.rounding = 1;\r\n external = false;\r\n\r\n x = x.times(x).minus(1).sqrt().plus(x);\r\n\r\n external = true;\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return x.ln();\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value\r\n * of this Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-Infinity, Infinity]\r\n *\r\n * asinh(x) = ln(x + sqrt(x^2 + 1))\r\n *\r\n * asinh(NaN) = NaN\r\n * asinh(Infinity) = Infinity\r\n * asinh(-Infinity) = -Infinity\r\n * asinh(0) = 0\r\n * asinh(-0) = -0\r\n *\r\n */\r\nP.inverseHyperbolicSine = P.asinh = function () {\r\n var pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite() || x.isZero()) return new Ctor(x);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;\r\n Ctor.rounding = 1;\r\n external = false;\r\n\r\n x = x.times(x).plus(1).sqrt().plus(x);\r\n\r\n external = true;\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return x.ln();\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the\r\n * value of this Decimal.\r\n *\r\n * Domain: [-1, 1]\r\n * Range: [-Infinity, Infinity]\r\n *\r\n * atanh(x) = 0.5 * ln((1 + x) / (1 - x))\r\n *\r\n * atanh(|x| > 1) = NaN\r\n * atanh(NaN) = NaN\r\n * atanh(Infinity) = NaN\r\n * atanh(-Infinity) = NaN\r\n * atanh(0) = 0\r\n * atanh(-0) = -0\r\n * atanh(1) = Infinity\r\n * atanh(-1) = -Infinity\r\n *\r\n */\r\nP.inverseHyperbolicTangent = P.atanh = function () {\r\n var pr, rm, wpr, xsd,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite()) return new Ctor(NaN);\r\n if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n xsd = x.sd();\r\n\r\n if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);\r\n\r\n Ctor.precision = wpr = xsd - x.e;\r\n\r\n x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);\r\n\r\n Ctor.precision = pr + 4;\r\n Ctor.rounding = 1;\r\n\r\n x = x.ln();\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return x.times(0.5);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this\r\n * Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-pi/2, pi/2]\r\n *\r\n * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))\r\n *\r\n * asin(0) = 0\r\n * asin(-0) = -0\r\n * asin(1/2) = pi/6\r\n * asin(-1/2) = -pi/6\r\n * asin(1) = pi/2\r\n * asin(-1) = -pi/2\r\n * asin(|x| > 1) = NaN\r\n * asin(NaN) = NaN\r\n *\r\n * TODO? Compare performance of Taylor series.\r\n *\r\n */\r\nP.inverseSine = P.asin = function () {\r\n var halfPi, k,\r\n pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (x.isZero()) return new Ctor(x);\r\n\r\n k = x.abs().cmp(1);\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n\r\n if (k !== -1) {\r\n\r\n // |x| is 1\r\n if (k === 0) {\r\n halfPi = getPi(Ctor, pr + 4, rm).times(0.5);\r\n halfPi.s = x.s;\r\n return halfPi;\r\n }\r\n\r\n // |x| > 1 or x is NaN\r\n return new Ctor(NaN);\r\n }\r\n\r\n // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6\r\n\r\n Ctor.precision = pr + 6;\r\n Ctor.rounding = 1;\r\n\r\n x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return x.times(2);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value\r\n * of this Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-pi/2, pi/2]\r\n *\r\n * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...\r\n *\r\n * atan(0) = 0\r\n * atan(-0) = -0\r\n * atan(1) = pi/4\r\n * atan(-1) = -pi/4\r\n * atan(Infinity) = pi/2\r\n * atan(-Infinity) = -pi/2\r\n * atan(NaN) = NaN\r\n *\r\n */\r\nP.inverseTangent = P.atan = function () {\r\n var i, j, k, n, px, t, r, wpr, x2,\r\n x = this,\r\n Ctor = x.constructor,\r\n pr = Ctor.precision,\r\n rm = Ctor.rounding;\r\n\r\n if (!x.isFinite()) {\r\n if (!x.s) return new Ctor(NaN);\r\n if (pr + 4 <= PI_PRECISION) {\r\n r = getPi(Ctor, pr + 4, rm).times(0.5);\r\n r.s = x.s;\r\n return r;\r\n }\r\n } else if (x.isZero()) {\r\n return new Ctor(x);\r\n } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {\r\n r = getPi(Ctor, pr + 4, rm).times(0.25);\r\n r.s = x.s;\r\n return r;\r\n }\r\n\r\n Ctor.precision = wpr = pr + 10;\r\n Ctor.rounding = 1;\r\n\r\n // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);\r\n\r\n // Argument reduction\r\n // Ensure |x| < 0.42\r\n // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))\r\n\r\n k = Math.min(28, wpr / LOG_BASE + 2 | 0);\r\n\r\n for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1));\r\n\r\n external = false;\r\n\r\n j = Math.ceil(wpr / LOG_BASE);\r\n n = 1;\r\n x2 = x.times(x);\r\n r = new Ctor(x);\r\n px = x;\r\n\r\n // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...\r\n for (; i !== -1;) {\r\n px = px.times(x2);\r\n t = r.minus(px.div(n += 2));\r\n\r\n px = px.times(x2);\r\n r = t.plus(px.div(n += 2));\r\n\r\n if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;);\r\n }\r\n\r\n if (k) r = r.times(2 << (k - 1));\r\n\r\n external = true;\r\n\r\n return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is a finite number, otherwise return false.\r\n *\r\n */\r\nP.isFinite = function () {\r\n return !!this.d;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is an integer, otherwise return false.\r\n *\r\n */\r\nP.isInteger = P.isInt = function () {\r\n return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is NaN, otherwise return false.\r\n *\r\n */\r\nP.isNaN = function () {\r\n return !this.s;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is negative, otherwise return false.\r\n *\r\n */\r\nP.isNegative = P.isNeg = function () {\r\n return this.s < 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is positive, otherwise return false.\r\n *\r\n */\r\nP.isPositive = P.isPos = function () {\r\n return this.s > 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is 0 or -0, otherwise return false.\r\n *\r\n */\r\nP.isZero = function () {\r\n return !!this.d && this.d[0] === 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is less than `y`, otherwise return false.\r\n *\r\n */\r\nP.lessThan = P.lt = function (y) {\r\n return this.cmp(y) < 0;\r\n};\r\n\r\n\r\n/*\r\n * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.\r\n *\r\n */\r\nP.lessThanOrEqualTo = P.lte = function (y) {\r\n return this.cmp(y) < 1;\r\n};\r\n\r\n\r\n/*\r\n * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * If no base is specified, return log[10](arg).\r\n *\r\n * log[base](arg) = ln(arg) / ln(base)\r\n *\r\n * The result will always be correctly rounded if the base of the log is 10, and 'almost always'\r\n * otherwise:\r\n *\r\n * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen\r\n * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error\r\n * between the result and the correctly rounded result will be one ulp (unit in the last place).\r\n *\r\n * log[-b](a) = NaN\r\n * log[0](a) = NaN\r\n * log[1](a) = NaN\r\n * log[NaN](a) = NaN\r\n * log[Infinity](a) = NaN\r\n * log[b](0) = -Infinity\r\n * log[b](-0) = -Infinity\r\n * log[b](-a) = NaN\r\n * log[b](1) = 0\r\n * log[b](Infinity) = Infinity\r\n * log[b](NaN) = NaN\r\n *\r\n * [base] {number|string|bigint|Decimal} The base of the logarithm.\r\n *\r\n */\r\nP.logarithm = P.log = function (base) {\r\n var isBase10, d, denominator, k, inf, num, sd, r,\r\n arg = this,\r\n Ctor = arg.constructor,\r\n pr = Ctor.precision,\r\n rm = Ctor.rounding,\r\n guard = 5;\r\n\r\n // Default base is 10.\r\n if (base == null) {\r\n base = new Ctor(10);\r\n isBase10 = true;\r\n } else {\r\n base = new Ctor(base);\r\n d = base.d;\r\n\r\n // Return NaN if base is negative, or non-finite, or is 0 or 1.\r\n if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);\r\n\r\n isBase10 = base.eq(10);\r\n }\r\n\r\n d = arg.d;\r\n\r\n // Is arg negative, non-finite, 0 or 1?\r\n if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {\r\n return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);\r\n }\r\n\r\n // The result will have a non-terminating decimal expansion if base is 10 and arg is not an\r\n // integer power of 10.\r\n if (isBase10) {\r\n if (d.length > 1) {\r\n inf = true;\r\n } else {\r\n for (k = d[0]; k % 10 === 0;) k /= 10;\r\n inf = k !== 1;\r\n }\r\n }\r\n\r\n external = false;\r\n sd = pr + guard;\r\n num = naturalLogarithm(arg, sd);\r\n denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);\r\n\r\n // The result will have 5 rounding digits.\r\n r = divide(num, denominator, sd, 1);\r\n\r\n // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,\r\n // calculate 10 further digits.\r\n //\r\n // If the result is known to have an infinite decimal expansion, repeat this until it is clear\r\n // that the result is above or below the boundary. Otherwise, if after calculating the 10\r\n // further digits, the last 14 are nines, round up and assume the result is exact.\r\n // Also assume the result is exact if the last 14 are zero.\r\n //\r\n // Example of a result that will be incorrectly rounded:\r\n // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...\r\n // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it\r\n // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so\r\n // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal\r\n // place is still 2.6.\r\n if (checkRoundingDigits(r.d, k = pr, rm)) {\r\n\r\n do {\r\n sd += 10;\r\n num = naturalLogarithm(arg, sd);\r\n denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);\r\n r = divide(num, denominator, sd, 1);\r\n\r\n if (!inf) {\r\n\r\n // Check for 14 nines from the 2nd rounding digit, as the first may be 4.\r\n if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {\r\n r = finalise(r, pr + 1, 0);\r\n }\r\n\r\n break;\r\n }\r\n } while (checkRoundingDigits(r.d, k += 10, rm));\r\n }\r\n\r\n external = true;\r\n\r\n return finalise(r, pr, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.\r\n *\r\n * arguments {number|string|bigint|Decimal}\r\n *\r\nP.max = function () {\r\n Array.prototype.push.call(arguments, this);\r\n return maxOrMin(this.constructor, arguments, -1);\r\n};\r\n */\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.\r\n *\r\n * arguments {number|string|bigint|Decimal}\r\n *\r\nP.min = function () {\r\n Array.prototype.push.call(arguments, this);\r\n return maxOrMin(this.constructor, arguments, 1);\r\n};\r\n */\r\n\r\n\r\n/*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.minus = P.sub = function (y) {\r\n var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n y = new Ctor(y);\r\n\r\n // If either is not finite...\r\n if (!x.d || !y.d) {\r\n\r\n // Return NaN if either is NaN.\r\n if (!x.s || !y.s) y = new Ctor(NaN);\r\n\r\n // Return y negated if x is finite and y is ±Infinity.\r\n else if (x.d) y.s = -y.s;\r\n\r\n // Return x if y is finite and x is ±Infinity.\r\n // Return x if both are ±Infinity with different signs.\r\n // Return NaN if both are ±Infinity with the same sign.\r\n else y = new Ctor(y.d || x.s !== y.s ? x : NaN);\r\n\r\n return y;\r\n }\r\n\r\n // If signs differ...\r\n if (x.s != y.s) {\r\n y.s = -y.s;\r\n return x.plus(y);\r\n }\r\n\r\n xd = x.d;\r\n yd = y.d;\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n\r\n // If either is zero...\r\n if (!xd[0] || !yd[0]) {\r\n\r\n // Return y negated if x is zero and y is non-zero.\r\n if (yd[0]) y.s = -y.s;\r\n\r\n // Return x if y is zero and x is non-zero.\r\n else if (xd[0]) y = new Ctor(x);\r\n\r\n // Return zero if both are zero.\r\n // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.\r\n else return new Ctor(rm === 3 ? -0 : 0);\r\n\r\n return external ? finalise(y, pr, rm) : y;\r\n }\r\n\r\n // x and y are finite, non-zero numbers with the same sign.\r\n\r\n // Calculate base 1e7 exponents.\r\n e = mathfloor(y.e / LOG_BASE);\r\n xe = mathfloor(x.e / LOG_BASE);\r\n\r\n xd = xd.slice();\r\n k = xe - e;\r\n\r\n // If base 1e7 exponents differ...\r\n if (k) {\r\n xLTy = k < 0;\r\n\r\n if (xLTy) {\r\n d = xd;\r\n k = -k;\r\n len = yd.length;\r\n } else {\r\n d = yd;\r\n e = xe;\r\n len = xd.length;\r\n }\r\n\r\n // Numbers with massively different exponents would result in a very high number of\r\n // zeros needing to be prepended, but this can be avoided while still ensuring correct\r\n // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.\r\n i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;\r\n\r\n if (k > i) {\r\n k = i;\r\n d.length = 1;\r\n }\r\n\r\n // Prepend zeros to equalise exponents.\r\n d.reverse();\r\n for (i = k; i--;) d.push(0);\r\n d.reverse();\r\n\r\n // Base 1e7 exponents equal.\r\n } else {\r\n\r\n // Check digits to determine which is the bigger number.\r\n\r\n i = xd.length;\r\n len = yd.length;\r\n xLTy = i < len;\r\n if (xLTy) len = i;\r\n\r\n for (i = 0; i < len; i++) {\r\n if (xd[i] != yd[i]) {\r\n xLTy = xd[i] < yd[i];\r\n break;\r\n }\r\n }\r\n\r\n k = 0;\r\n }\r\n\r\n if (xLTy) {\r\n d = xd;\r\n xd = yd;\r\n yd = d;\r\n y.s = -y.s;\r\n }\r\n\r\n len = xd.length;\r\n\r\n // Append zeros to `xd` if shorter.\r\n // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.\r\n for (i = yd.length - len; i > 0; --i) xd[len++] = 0;\r\n\r\n // Subtract yd from xd.\r\n for (i = yd.length; i > k;) {\r\n\r\n if (xd[--i] < yd[i]) {\r\n for (j = i; j && xd[--j] === 0;) xd[j] = BASE - 1;\r\n --xd[j];\r\n xd[i] += BASE;\r\n }\r\n\r\n xd[i] -= yd[i];\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (; xd[--len] === 0;) xd.pop();\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xd[0] === 0; xd.shift()) --e;\r\n\r\n // Zero?\r\n if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);\r\n\r\n y.d = xd;\r\n y.e = getBase10Exponent(xd, e);\r\n\r\n return external ? finalise(y, pr, rm) : y;\r\n};\r\n\r\n\r\n/*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to\r\n * `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * The result depends on the modulo mode.\r\n *\r\n */\r\nP.modulo = P.mod = function (y) {\r\n var q,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n y = new Ctor(y);\r\n\r\n // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.\r\n if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);\r\n\r\n // Return x if y is ±Infinity or x is ±0.\r\n if (!y.d || x.d && !x.d[0]) {\r\n return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);\r\n }\r\n\r\n // Prevent rounding of intermediate calculations.\r\n external = false;\r\n\r\n if (Ctor.modulo == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // result = x - q * y where 0 <= result < abs(y)\r\n q = divide(x, y.abs(), 0, 3, 1);\r\n q.s *= y.s;\r\n } else {\r\n q = divide(x, y, 0, Ctor.modulo, 1);\r\n }\r\n\r\n q = q.times(y);\r\n\r\n external = true;\r\n\r\n return x.minus(q);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural exponential of the value of this Decimal,\r\n * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.naturalExponential = P.exp = function () {\r\n return naturalExponential(this);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,\r\n * rounded to `precision` significant digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.naturalLogarithm = P.ln = function () {\r\n return naturalLogarithm(this);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by\r\n * -1.\r\n *\r\n */\r\nP.negated = P.neg = function () {\r\n var x = new this.constructor(this);\r\n x.s = -x.s;\r\n return finalise(x);\r\n};\r\n\r\n\r\n/*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.plus = P.add = function (y) {\r\n var carry, d, e, i, k, len, pr, rm, xd, yd,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n y = new Ctor(y);\r\n\r\n // If either is not finite...\r\n if (!x.d || !y.d) {\r\n\r\n // Return NaN if either is NaN.\r\n if (!x.s || !y.s) y = new Ctor(NaN);\r\n\r\n // Return x if y is finite and x is ±Infinity.\r\n // Return x if both are ±Infinity with the same sign.\r\n // Return NaN if both are ±Infinity with different signs.\r\n // Return y if x is finite and y is ±Infinity.\r\n else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);\r\n\r\n return y;\r\n }\r\n\r\n // If signs differ...\r\n if (x.s != y.s) {\r\n y.s = -y.s;\r\n return x.minus(y);\r\n }\r\n\r\n xd = x.d;\r\n yd = y.d;\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n\r\n // If either is zero...\r\n if (!xd[0] || !yd[0]) {\r\n\r\n // Return x if y is zero.\r\n // Return y if y is non-zero.\r\n if (!yd[0]) y = new Ctor(x);\r\n\r\n return external ? finalise(y, pr, rm) : y;\r\n }\r\n\r\n // x and y are finite, non-zero numbers with the same sign.\r\n\r\n // Calculate base 1e7 exponents.\r\n k = mathfloor(x.e / LOG_BASE);\r\n e = mathfloor(y.e / LOG_BASE);\r\n\r\n xd = xd.slice();\r\n i = k - e;\r\n\r\n // If base 1e7 exponents differ...\r\n if (i) {\r\n\r\n if (i < 0) {\r\n d = xd;\r\n i = -i;\r\n len = yd.length;\r\n } else {\r\n d = yd;\r\n e = k;\r\n len = xd.length;\r\n }\r\n\r\n // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.\r\n k = Math.ceil(pr / LOG_BASE);\r\n len = k > len ? k + 1 : len + 1;\r\n\r\n if (i > len) {\r\n i = len;\r\n d.length = 1;\r\n }\r\n\r\n // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.\r\n d.reverse();\r\n for (; i--;) d.push(0);\r\n d.reverse();\r\n }\r\n\r\n len = xd.length;\r\n i = yd.length;\r\n\r\n // If yd is longer than xd, swap xd and yd so xd points to the longer array.\r\n if (len - i < 0) {\r\n i = len;\r\n d = yd;\r\n yd = xd;\r\n xd = d;\r\n }\r\n\r\n // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.\r\n for (carry = 0; i;) {\r\n carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;\r\n xd[i] %= BASE;\r\n }\r\n\r\n if (carry) {\r\n xd.unshift(carry);\r\n ++e;\r\n }\r\n\r\n // Remove trailing zeros.\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n for (len = xd.length; xd[--len] == 0;) xd.pop();\r\n\r\n y.d = xd;\r\n y.e = getBase10Exponent(xd, e);\r\n\r\n return external ? finalise(y, pr, rm) : y;\r\n};\r\n\r\n\r\n/*\r\n * Return the number of significant digits of the value of this Decimal.\r\n *\r\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\r\n *\r\n */\r\nP.precision = P.sd = function (z) {\r\n var k,\r\n x = this;\r\n\r\n if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);\r\n\r\n if (x.d) {\r\n k = getPrecision(x.d);\r\n if (z && x.e + 1 > k) k = x.e + 1;\r\n } else {\r\n k = NaN;\r\n }\r\n\r\n return k;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using\r\n * rounding mode `rounding`.\r\n *\r\n */\r\nP.round = function () {\r\n var x = this,\r\n Ctor = x.constructor;\r\n\r\n return finalise(new Ctor(x), x.e + 1, Ctor.rounding);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the sine of the value in radians of this Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-1, 1]\r\n *\r\n * sin(x) = x - x^3/3! + x^5/5! - ...\r\n *\r\n * sin(0) = 0\r\n * sin(-0) = -0\r\n * sin(Infinity) = NaN\r\n * sin(-Infinity) = NaN\r\n * sin(NaN) = NaN\r\n *\r\n */\r\nP.sine = P.sin = function () {\r\n var pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite()) return new Ctor(NaN);\r\n if (x.isZero()) return new Ctor(x);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;\r\n Ctor.rounding = 1;\r\n\r\n x = sine(Ctor, toLessThanHalfPi(Ctor, x));\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n */\r\nP.squareRoot = P.sqrt = function () {\r\n var m, n, sd, r, rep, t,\r\n x = this,\r\n d = x.d,\r\n e = x.e,\r\n s = x.s,\r\n Ctor = x.constructor;\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !d || !d[0]) {\r\n return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);\r\n }\r\n\r\n external = false;\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+x);\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = digitsToString(d);\r\n\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(n);\r\n e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '5e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new Ctor(n);\r\n } else {\r\n r = new Ctor(s.toString());\r\n }\r\n\r\n sd = (e = Ctor.precision) + 3;\r\n\r\n // Newton-Raphson iteration.\r\n for (;;) {\r\n t = r;\r\n r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);\r\n\r\n // TODO? Replace with for-loop and checkRoundingDigits.\r\n if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {\r\n n = n.slice(sd - 3, sd + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or\r\n // 4999, i.e. approaching a rounding boundary, continue the iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the exact result as the\r\n // nines may infinitely repeat.\r\n if (!rep) {\r\n finalise(t, e + 1, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n sd += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.\r\n // If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n finalise(r, e + 1, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n\r\n external = true;\r\n\r\n return finalise(r, e, Ctor.rounding, m);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-Infinity, Infinity]\r\n *\r\n * tan(0) = 0\r\n * tan(-0) = -0\r\n * tan(Infinity) = NaN\r\n * tan(-Infinity) = NaN\r\n * tan(NaN) = NaN\r\n *\r\n */\r\nP.tangent = P.tan = function () {\r\n var pr, rm,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (!x.isFinite()) return new Ctor(NaN);\r\n if (x.isZero()) return new Ctor(x);\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n Ctor.precision = pr + 10;\r\n Ctor.rounding = 1;\r\n\r\n x = x.sin();\r\n x.s = 1;\r\n x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);\r\n\r\n Ctor.precision = pr;\r\n Ctor.rounding = rm;\r\n\r\n return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);\r\n};\r\n\r\n\r\n/*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n */\r\nP.times = P.mul = function (y) {\r\n var carry, e, i, k, r, rL, t, xdL, ydL,\r\n x = this,\r\n Ctor = x.constructor,\r\n xd = x.d,\r\n yd = (y = new Ctor(y)).d;\r\n\r\n y.s *= x.s;\r\n\r\n // If either is NaN, ±Infinity or ±0...\r\n if (!xd || !xd[0] || !yd || !yd[0]) {\r\n\r\n return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd\r\n\r\n // Return NaN if either is NaN.\r\n // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.\r\n ? NaN\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n // Return ±0 if either is ±0.\r\n : !xd || !yd ? y.s / 0 : y.s * 0);\r\n }\r\n\r\n e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);\r\n xdL = xd.length;\r\n ydL = yd.length;\r\n\r\n // Ensure xd points to the longer array.\r\n if (xdL < ydL) {\r\n r = xd;\r\n xd = yd;\r\n yd = r;\r\n rL = xdL;\r\n xdL = ydL;\r\n ydL = rL;\r\n }\r\n\r\n // Initialise the result array with zeros.\r\n r = [];\r\n rL = xdL + ydL;\r\n for (i = rL; i--;) r.push(0);\r\n\r\n // Multiply!\r\n for (i = ydL; --i >= 0;) {\r\n carry = 0;\r\n for (k = xdL + i; k > i;) {\r\n t = r[k] + yd[i] * xd[k - i - 1] + carry;\r\n r[k--] = t % BASE | 0;\r\n carry = t / BASE | 0;\r\n }\r\n\r\n r[k] = (r[k] + carry) % BASE | 0;\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (; !r[--rL];) r.pop();\r\n\r\n if (carry) ++e;\r\n else r.shift();\r\n\r\n y.d = r;\r\n y.e = getBase10Exponent(r, e);\r\n\r\n return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal in base 2, round to `sd` significant\r\n * digits using rounding mode `rm`.\r\n *\r\n * If the optional `sd` argument is present then return binary exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toBinary = function (sd, rm) {\r\n return toStringBinary(this, 2, sd, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`\r\n * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.\r\n *\r\n * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toDecimalPlaces = P.toDP = function (dp, rm) {\r\n var x = this,\r\n Ctor = x.constructor;\r\n\r\n x = new Ctor(x);\r\n if (dp === void 0) return x;\r\n\r\n checkInt32(dp, 0, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n\r\n return finalise(x, dp + x.e + 1, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal in exponential notation rounded to\r\n * `dp` fixed decimal places using rounding mode `rounding`.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toExponential = function (dp, rm) {\r\n var str,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (dp === void 0) {\r\n str = finiteToString(x, true);\r\n } else {\r\n checkInt32(dp, 0, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n\r\n x = finalise(new Ctor(x), dp + 1, rm);\r\n str = finiteToString(x, true, dp + 1);\r\n }\r\n\r\n return x.isNeg() && !x.isZero() ? '-' + str : str;\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal in normal (fixed-point) notation to\r\n * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is\r\n * omitted.\r\n *\r\n * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.\r\n * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.\r\n * (-0).toFixed(3) is '0.000'.\r\n * (-0.5).toFixed(0) is '-0'.\r\n *\r\n */\r\nP.toFixed = function (dp, rm) {\r\n var str, y,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (dp === void 0) {\r\n str = finiteToString(x);\r\n } else {\r\n checkInt32(dp, 0, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n\r\n y = finalise(new Ctor(x), dp + x.e + 1, rm);\r\n str = finiteToString(y, false, dp + y.e + 1);\r\n }\r\n\r\n // To determine whether to add the minus sign look at the value before it was rounded,\r\n // i.e. look at `x` rather than `y`.\r\n return x.isNeg() && !x.isZero() ? '-' + str : str;\r\n};\r\n\r\n\r\n/*\r\n * Return an array representing the value of this Decimal as a simple fraction with an integer\r\n * numerator and an integer denominator.\r\n *\r\n * The denominator will be a positive non-zero value less than or equal to the specified maximum\r\n * denominator. If a maximum denominator is not specified, the denominator will be the lowest\r\n * value necessary to represent the number exactly.\r\n *\r\n * [maxD] {number|string|bigint|Decimal} Maximum denominator. Integer >= 1 and < Infinity.\r\n *\r\n */\r\nP.toFraction = function (maxD) {\r\n var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r,\r\n x = this,\r\n xd = x.d,\r\n Ctor = x.constructor;\r\n\r\n if (!xd) return new Ctor(x);\r\n\r\n n1 = d0 = new Ctor(1);\r\n d1 = n0 = new Ctor(0);\r\n\r\n d = new Ctor(d1);\r\n e = d.e = getPrecision(xd) - x.e - 1;\r\n k = e % LOG_BASE;\r\n d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);\r\n\r\n if (maxD == null) {\r\n\r\n // d is 10**e, the minimum max-denominator needed.\r\n maxD = e > 0 ? d : n1;\r\n } else {\r\n n = new Ctor(maxD);\r\n if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);\r\n maxD = n.gt(d) ? (e > 0 ? d : n1) : n;\r\n }\r\n\r\n external = false;\r\n n = new Ctor(digitsToString(xd));\r\n pr = Ctor.precision;\r\n Ctor.precision = e = xd.length * LOG_BASE * 2;\r\n\r\n for (;;) {\r\n q = divide(n, d, 0, 1, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.cmp(maxD) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n d2 = n1;\r\n n1 = n0.plus(q.times(d2));\r\n n0 = d2;\r\n d2 = d;\r\n d = n.minus(q.times(d2));\r\n n = d2;\r\n }\r\n\r\n d2 = divide(maxD.minus(d0), d1, 0, 1, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1?\r\n r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1\r\n ? [n1, d1] : [n0, d0];\r\n\r\n Ctor.precision = pr;\r\n external = true;\r\n\r\n return r;\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal in base 16, round to `sd` significant\r\n * digits using rounding mode `rm`.\r\n *\r\n * If the optional `sd` argument is present then return binary exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toHexadecimal = P.toHex = function (sd, rm) {\r\n return toStringBinary(this, 16, sd, rm);\r\n};\r\n\r\n\r\n/*\r\n * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding\r\n * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.\r\n *\r\n * The return value will always have the same sign as this Decimal, unless either this Decimal\r\n * or `y` is NaN, in which case the return value will be also be NaN.\r\n *\r\n * The return value is not affected by the value of `precision`.\r\n *\r\n * y {number|string|bigint|Decimal} The magnitude to round to a multiple of.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toNearest() rounding mode not an integer: {rm}'\r\n * 'toNearest() rounding mode out of range: {rm}'\r\n *\r\n */\r\nP.toNearest = function (y, rm) {\r\n var x = this,\r\n Ctor = x.constructor;\r\n\r\n x = new Ctor(x);\r\n\r\n if (y == null) {\r\n\r\n // If x is not finite, return x.\r\n if (!x.d) return x;\r\n\r\n y = new Ctor(1);\r\n rm = Ctor.rounding;\r\n } else {\r\n y = new Ctor(y);\r\n if (rm === void 0) {\r\n rm = Ctor.rounding;\r\n } else {\r\n checkInt32(rm, 0, 8);\r\n }\r\n\r\n // If x is not finite, return x if y is not NaN, else NaN.\r\n if (!x.d) return y.s ? x : y;\r\n\r\n // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.\r\n if (!y.d) {\r\n if (y.s) y.s = x.s;\r\n return y;\r\n }\r\n }\r\n\r\n // If y is not zero, calculate the nearest multiple of y to x.\r\n if (y.d[0]) {\r\n external = false;\r\n x = divide(x, y, 0, rm, 1).times(y);\r\n external = true;\r\n finalise(x);\r\n\r\n // If y is zero, return zero with the sign of x.\r\n } else {\r\n y.s = x.s;\r\n x = y;\r\n }\r\n\r\n return x;\r\n};\r\n\r\n\r\n/*\r\n * Return the value of this Decimal converted to a number primitive.\r\n * Zero keeps its sign.\r\n *\r\n */\r\nP.toNumber = function () {\r\n return +this;\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal in base 8, round to `sd` significant\r\n * digits using rounding mode `rm`.\r\n *\r\n * If the optional `sd` argument is present then return binary exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toOctal = function (sd, rm) {\r\n return toStringBinary(this, 8, sd, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded\r\n * to `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * ECMAScript compliant.\r\n *\r\n * pow(x, NaN) = NaN\r\n * pow(x, ±0) = 1\r\n\r\n * pow(NaN, non-zero) = NaN\r\n * pow(abs(x) > 1, +Infinity) = +Infinity\r\n * pow(abs(x) > 1, -Infinity) = +0\r\n * pow(abs(x) == 1, ±Infinity) = NaN\r\n * pow(abs(x) < 1, +Infinity) = +0\r\n * pow(abs(x) < 1, -Infinity) = +Infinity\r\n * pow(+Infinity, y > 0) = +Infinity\r\n * pow(+Infinity, y < 0) = +0\r\n * pow(-Infinity, odd integer > 0) = -Infinity\r\n * pow(-Infinity, even integer > 0) = +Infinity\r\n * pow(-Infinity, odd integer < 0) = -0\r\n * pow(-Infinity, even integer < 0) = +0\r\n * pow(+0, y > 0) = +0\r\n * pow(+0, y < 0) = +Infinity\r\n * pow(-0, odd integer > 0) = -0\r\n * pow(-0, even integer > 0) = +0\r\n * pow(-0, odd integer < 0) = -Infinity\r\n * pow(-0, even integer < 0) = +Infinity\r\n * pow(finite x < 0, finite non-integer) = NaN\r\n *\r\n * For non-integer or very large exponents pow(x, y) is calculated using\r\n *\r\n * x^y = exp(y*ln(x))\r\n *\r\n * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the\r\n * probability of an incorrectly rounded result\r\n * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14\r\n * i.e. 1 in 250,000,000,000,000\r\n *\r\n * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).\r\n *\r\n * y {number|string|bigint|Decimal} The power to which to raise this Decimal.\r\n *\r\n */\r\nP.toPower = P.pow = function (y) {\r\n var e, k, pr, r, rm, s,\r\n x = this,\r\n Ctor = x.constructor,\r\n yn = +(y = new Ctor(y));\r\n\r\n // Either ±Infinity, NaN or ±0?\r\n if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));\r\n\r\n x = new Ctor(x);\r\n\r\n if (x.eq(1)) return x;\r\n\r\n pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n\r\n if (y.eq(1)) return finalise(x, pr, rm);\r\n\r\n // y exponent\r\n e = mathfloor(y.e / LOG_BASE);\r\n\r\n // If y is a small integer use the 'exponentiation by squaring' algorithm.\r\n if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {\r\n r = intPow(Ctor, x, k, pr);\r\n return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);\r\n }\r\n\r\n s = x.s;\r\n\r\n // if x is negative\r\n if (s < 0) {\r\n\r\n // if y is not an integer\r\n if (e < y.d.length - 1) return new Ctor(NaN);\r\n\r\n // Result is positive if x is negative and the last digit of integer y is even.\r\n if ((y.d[e] & 1) == 0) s = 1;\r\n\r\n // if x.eq(-1)\r\n if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {\r\n x.s = s;\r\n return x;\r\n }\r\n }\r\n\r\n // Estimate result exponent.\r\n // x^y = 10^e, where e = y * log10(x)\r\n // log10(x) = log10(x_significand) + x_exponent\r\n // log10(x_significand) = ln(x_significand) / ln(10)\r\n k = mathpow(+x, yn);\r\n e = k == 0 || !isFinite(k)\r\n ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1))\r\n : new Ctor(k + '').e;\r\n\r\n // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.\r\n\r\n // Overflow/underflow?\r\n if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);\r\n\r\n external = false;\r\n Ctor.rounding = x.s = 1;\r\n\r\n // Estimate the extra guard digits needed to ensure five correct rounding digits from\r\n // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):\r\n // new Decimal(2.32456).pow('2087987436534566.46411')\r\n // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815\r\n k = Math.min(12, (e + '').length);\r\n\r\n // r = x^y = exp(y*ln(x))\r\n r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);\r\n\r\n // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)\r\n if (r.d) {\r\n\r\n // Truncate to the required precision plus five rounding digits.\r\n r = finalise(r, pr + 5, 1);\r\n\r\n // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate\r\n // the result.\r\n if (checkRoundingDigits(r.d, pr, rm)) {\r\n e = pr + 10;\r\n\r\n // Truncate to the increased precision plus five rounding digits.\r\n r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);\r\n\r\n // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).\r\n if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {\r\n r = finalise(r, pr + 1, 0);\r\n }\r\n }\r\n }\r\n\r\n r.s = s;\r\n external = true;\r\n Ctor.rounding = rm;\r\n\r\n return finalise(r, pr, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal rounded to `sd` significant digits\r\n * using rounding mode `rounding`.\r\n *\r\n * Return exponential notation if `sd` is less than the number of digits necessary to represent\r\n * the integer part of the value in normal notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n */\r\nP.toPrecision = function (sd, rm) {\r\n var str,\r\n x = this,\r\n Ctor = x.constructor;\r\n\r\n if (sd === void 0) {\r\n str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);\r\n } else {\r\n checkInt32(sd, 1, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n\r\n x = finalise(new Ctor(x), sd, rm);\r\n str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);\r\n }\r\n\r\n return x.isNeg() && !x.isZero() ? '-' + str : str;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`\r\n * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if\r\n * omitted.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * 'toSD() digits out of range: {sd}'\r\n * 'toSD() digits not an integer: {sd}'\r\n * 'toSD() rounding mode not an integer: {rm}'\r\n * 'toSD() rounding mode out of range: {rm}'\r\n *\r\n */\r\nP.toSignificantDigits = P.toSD = function (sd, rm) {\r\n var x = this,\r\n Ctor = x.constructor;\r\n\r\n if (sd === void 0) {\r\n sd = Ctor.precision;\r\n rm = Ctor.rounding;\r\n } else {\r\n checkInt32(sd, 1, MAX_DIGITS);\r\n\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n }\r\n\r\n return finalise(new Ctor(x), sd, rm);\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal.\r\n *\r\n * Return exponential notation if this Decimal has a positive exponent equal to or greater than\r\n * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.\r\n *\r\n */\r\nP.toString = function () {\r\n var x = this,\r\n Ctor = x.constructor,\r\n str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);\r\n\r\n return x.isNeg() && !x.isZero() ? '-' + str : str;\r\n};\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.\r\n *\r\n */\r\nP.truncated = P.trunc = function () {\r\n return finalise(new this.constructor(this), this.e + 1, 1);\r\n};\r\n\r\n\r\n/*\r\n * Return a string representing the value of this Decimal.\r\n * Unlike `toString`, negative zero will include the minus sign.\r\n *\r\n */\r\nP.valueOf = P.toJSON = function () {\r\n var x = this,\r\n Ctor = x.constructor,\r\n str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);\r\n\r\n return x.isNeg() ? '-' + str : str;\r\n};\r\n\r\n\r\n// Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.\r\n\r\n\r\n/*\r\n * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,\r\n * finiteToString, naturalExponential, naturalLogarithm\r\n * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,\r\n * P.toPrecision, P.toSignificantDigits, toStringBinary, random\r\n * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm\r\n * convertBase toStringBinary, parseOther\r\n * cos P.cos\r\n * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,\r\n * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,\r\n * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,\r\n * taylorSeries, atan2, parseOther\r\n * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,\r\n * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,\r\n * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,\r\n * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,\r\n * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,\r\n * P.truncated, divide, getLn10, getPi, naturalExponential,\r\n * naturalLogarithm, ceil, floor, round, trunc\r\n * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,\r\n * toStringBinary\r\n * getBase10Exponent P.minus, P.plus, P.times, parseOther\r\n * getLn10 P.logarithm, naturalLogarithm\r\n * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2\r\n * getPrecision P.precision, P.toFraction\r\n * getZeroString digitsToString, finiteToString\r\n * intPow P.toPower, parseOther\r\n * isOdd toLessThanHalfPi\r\n * maxOrMin max, min\r\n * naturalExponential P.naturalExponential, P.toPower\r\n * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,\r\n * P.toPower, naturalExponential\r\n * nonFiniteToString finiteToString, toStringBinary\r\n * parseDecimal Decimal\r\n * parseOther Decimal\r\n * sin P.sin\r\n * taylorSeries P.cosh, P.sinh, cos, sin\r\n * toLessThanHalfPi P.cos, P.sin\r\n * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal\r\n * truncate intPow\r\n *\r\n * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,\r\n * naturalLogarithm, config, parseOther, random, Decimal\r\n */\r\n\r\n\r\nfunction digitsToString(d) {\r\n var i, k, ws,\r\n indexOfLastWord = d.length - 1,\r\n str = '',\r\n w = d[0];\r\n\r\n if (indexOfLastWord > 0) {\r\n str += w;\r\n for (i = 1; i < indexOfLastWord; i++) {\r\n ws = d[i] + '';\r\n k = LOG_BASE - ws.length;\r\n if (k) str += getZeroString(k);\r\n str += ws;\r\n }\r\n\r\n w = d[i];\r\n ws = w + '';\r\n k = LOG_BASE - ws.length;\r\n if (k) str += getZeroString(k);\r\n } else if (w === 0) {\r\n return '0';\r\n }\r\n\r\n // Remove trailing zeros of last w.\r\n for (; w % 10 === 0;) w /= 10;\r\n\r\n return str + w;\r\n}\r\n\r\n\r\nfunction checkInt32(i, min, max) {\r\n if (i !== ~~i || i < min || i > max) {\r\n throw Error(invalidArgument + i);\r\n }\r\n}\r\n\r\n\r\n/*\r\n * Check 5 rounding digits if `repeating` is null, 4 otherwise.\r\n * `repeating == null` if caller is `log` or `pow`,\r\n * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.\r\n */\r\nfunction checkRoundingDigits(d, i, rm, repeating) {\r\n var di, k, r, rd;\r\n\r\n // Get the length of the first word of the array d.\r\n for (k = d[0]; k >= 10; k /= 10) --i;\r\n\r\n // Is the rounding digit in the first word of d?\r\n if (--i < 0) {\r\n i += LOG_BASE;\r\n di = 0;\r\n } else {\r\n di = Math.ceil((i + 1) / LOG_BASE);\r\n i %= LOG_BASE;\r\n }\r\n\r\n // i is the index (0 - 6) of the rounding digit.\r\n // E.g. if within the word 3487563 the first rounding digit is 5,\r\n // then i = 4, k = 1000, rd = 3487563 % 1000 = 563\r\n k = mathpow(10, LOG_BASE - i);\r\n rd = d[di] % k | 0;\r\n\r\n if (repeating == null) {\r\n if (i < 3) {\r\n if (i == 0) rd = rd / 100 | 0;\r\n else if (i == 1) rd = rd / 10 | 0;\r\n r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;\r\n } else {\r\n r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) &&\r\n (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 ||\r\n (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0;\r\n }\r\n } else {\r\n if (i < 4) {\r\n if (i == 0) rd = rd / 1000 | 0;\r\n else if (i == 1) rd = rd / 100 | 0;\r\n else if (i == 2) rd = rd / 10 | 0;\r\n r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;\r\n } else {\r\n r = ((repeating || rm < 4) && rd + 1 == k ||\r\n (!repeating && rm > 3) && rd + 1 == k / 2) &&\r\n (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1;\r\n }\r\n }\r\n\r\n return r;\r\n}\r\n\r\n\r\n// Convert string of `baseIn` to an array of numbers of `baseOut`.\r\n// Eg. convertBase('255', 10, 16) returns [15, 15].\r\n// Eg. convertBase('ff', 16, 10) returns [2, 5, 5].\r\nfunction convertBase(str, baseIn, baseOut) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n strL = str.length;\r\n\r\n for (; i < strL;) {\r\n for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;\r\n arr[0] += NUMERALS.indexOf(str.charAt(i++));\r\n for (j = 0; j < arr.length; j++) {\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] === void 0) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n}\r\n\r\n\r\n/*\r\n * cos(x) = 1 - x^2/2! + x^4/4! - ...\r\n * |x| < pi/2\r\n *\r\n */\r\nfunction cosine(Ctor, x) {\r\n var k, len, y;\r\n\r\n if (x.isZero()) return x;\r\n\r\n // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1\r\n // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1\r\n\r\n // Estimate the optimum number of times to use the argument reduction.\r\n len = x.d.length;\r\n if (len < 32) {\r\n k = Math.ceil(len / 3);\r\n y = (1 / tinyPow(4, k)).toString();\r\n } else {\r\n k = 16;\r\n y = '2.3283064365386962890625e-10';\r\n }\r\n\r\n Ctor.precision += k;\r\n\r\n x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));\r\n\r\n // Reverse argument reduction\r\n for (var i = k; i--;) {\r\n var cos2x = x.times(x);\r\n x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);\r\n }\r\n\r\n Ctor.precision -= k;\r\n\r\n return x;\r\n}\r\n\r\n\r\n/*\r\n * Perform division in the specified base.\r\n */\r\nvar divide = (function () {\r\n\r\n // Assumes non-zero x and k, and hence non-zero result.\r\n function multiplyInteger(x, k, base) {\r\n var temp,\r\n carry = 0,\r\n i = x.length;\r\n\r\n for (x = x.slice(); i--;) {\r\n temp = x[i] * k + carry;\r\n x[i] = temp % base | 0;\r\n carry = temp / base | 0;\r\n }\r\n\r\n if (carry) x.unshift(carry);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, r;\r\n\r\n if (aL != bL) {\r\n r = aL > bL ? 1 : -1;\r\n } else {\r\n for (i = r = 0; i < aL; i++) {\r\n if (a[i] != b[i]) {\r\n r = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return r;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1;) a.shift();\r\n }\r\n\r\n return function (x, y, pr, rm, dp, base) {\r\n var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0,\r\n yL, yz,\r\n Ctor = x.constructor,\r\n sign = x.s == y.s ? 1 : -1,\r\n xd = x.d,\r\n yd = y.d;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xd || !xd[0] || !yd || !yd[0]) {\r\n\r\n return new Ctor(// Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :\r\n\r\n // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.\r\n xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);\r\n }\r\n\r\n if (base) {\r\n logBase = 1;\r\n e = x.e - y.e;\r\n } else {\r\n base = BASE;\r\n logBase = LOG_BASE;\r\n e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);\r\n }\r\n\r\n yL = yd.length;\r\n xL = xd.length;\r\n q = new Ctor(sign);\r\n qd = q.d = [];\r\n\r\n // Result exponent may be one less than e.\r\n // The digit array of a Decimal from toStringBinary may have trailing zeros.\r\n for (i = 0; yd[i] == (xd[i] || 0); i++);\r\n\r\n if (yd[i] > (xd[i] || 0)) e--;\r\n\r\n if (pr == null) {\r\n sd = pr = Ctor.precision;\r\n rm = Ctor.rounding;\r\n } else if (dp) {\r\n sd = pr + (x.e - y.e) + 1;\r\n } else {\r\n sd = pr;\r\n }\r\n\r\n if (sd < 0) {\r\n qd.push(1);\r\n more = true;\r\n } else {\r\n\r\n // Convert precision in number of base 10 digits to base 1e7 digits.\r\n sd = sd / logBase + 2 | 0;\r\n i = 0;\r\n\r\n // divisor < 1e7\r\n if (yL == 1) {\r\n k = 0;\r\n yd = yd[0];\r\n sd++;\r\n\r\n // k is the carry.\r\n for (; (i < xL || k) && sd--; i++) {\r\n t = k * base + (xd[i] || 0);\r\n qd[i] = t / yd | 0;\r\n k = t % yd | 0;\r\n }\r\n\r\n more = k || i < xL;\r\n\r\n // divisor >= 1e7\r\n } else {\r\n\r\n // Normalise xd and yd so highest order digit of yd is >= base/2\r\n k = base / (yd[0] + 1) | 0;\r\n\r\n if (k > 1) {\r\n yd = multiplyInteger(yd, k, base);\r\n xd = multiplyInteger(xd, k, base);\r\n yL = yd.length;\r\n xL = xd.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xd.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL;) rem[remL++] = 0;\r\n\r\n yz = yd.slice();\r\n yz.unshift(0);\r\n yd0 = yd[0];\r\n\r\n if (yd[1] >= base / 2) ++yd0;\r\n\r\n do {\r\n k = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yd, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, k.\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // k will be how many times the divisor goes into the current remainder.\r\n k = rem0 / yd0 | 0;\r\n\r\n // Algorithm:\r\n // 1. product = divisor * trial digit (k)\r\n // 2. if product > remainder: product -= divisor, k--\r\n // 3. remainder -= product\r\n // 4. if product was < remainder at 2:\r\n // 5. compare new remainder and divisor\r\n // 6. If remainder > divisor: remainder -= divisor, k++\r\n\r\n if (k > 1) {\r\n if (k >= base) k = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiplyInteger(yd, k, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n cmp = compare(prod, rem, prodL, remL);\r\n\r\n // product > remainder.\r\n if (cmp == 1) {\r\n k--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yd, prodL, base);\r\n }\r\n } else {\r\n\r\n // cmp is -1.\r\n // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1\r\n // to avoid it. If k is 1 there is a need to compare yd and rem again below.\r\n if (k == 0) cmp = k = 1;\r\n prod = yd.slice();\r\n }\r\n\r\n prodL = prod.length;\r\n if (prodL < remL) prod.unshift(0);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n\r\n // If product was < previous remainder.\r\n if (cmp == -1) {\r\n remL = rem.length;\r\n\r\n // Compare divisor and new remainder.\r\n cmp = compare(yd, rem, yL, remL);\r\n\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n if (cmp < 1) {\r\n k++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yd, remL, base);\r\n }\r\n }\r\n\r\n remL = rem.length;\r\n } else if (cmp === 0) {\r\n k++;\r\n rem = [0];\r\n } // if cmp === 1, k will be 0\r\n\r\n // Add the next digit, k, to the result array.\r\n qd[i++] = k;\r\n\r\n // Update the remainder.\r\n if (cmp && rem[0]) {\r\n rem[remL++] = xd[xi] || 0;\r\n } else {\r\n rem = [xd[xi]];\r\n remL = 1;\r\n }\r\n\r\n } while ((xi++ < xL || rem[0] !== void 0) && sd--);\r\n\r\n more = rem[0] !== void 0;\r\n }\r\n\r\n // Leading zero?\r\n if (!qd[0]) qd.shift();\r\n }\r\n\r\n // logBase is 1 when divide is being used for base conversion.\r\n if (logBase == 1) {\r\n q.e = e;\r\n inexact = more;\r\n } else {\r\n\r\n // To calculate q.e, first get the number of digits of qd[0].\r\n for (i = 1, k = qd[0]; k >= 10; k /= 10) i++;\r\n q.e = i + e * logBase - 1;\r\n\r\n finalise(q, dp ? pr + q.e + 1 : pr, rm, more);\r\n }\r\n\r\n return q;\r\n };\r\n})();\r\n\r\n\r\n/*\r\n * Round `x` to `sd` significant digits using rounding mode `rm`.\r\n * Check for over/under-flow.\r\n */\r\n function finalise(x, sd, rm, isTruncated) {\r\n var digits, i, j, k, rd, roundUp, w, xd, xdi,\r\n Ctor = x.constructor;\r\n\r\n // Don't round if sd is null or undefined.\r\n out: if (sd != null) {\r\n xd = x.d;\r\n\r\n // Infinity/NaN.\r\n if (!xd) return x;\r\n\r\n // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // w: the word of xd containing rd, a base 1e7 number.\r\n // xdi: the index of w within xd.\r\n // digits: the number of digits of w.\r\n // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if\r\n // they had leading zeros)\r\n // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).\r\n\r\n // Get the length of the first word of the digits array xd.\r\n for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++;\r\n i = sd - digits;\r\n\r\n // Is the rounding digit in the first word of xd?\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n w = xd[xdi = 0];\r\n\r\n // Get the rounding digit at index j of w.\r\n rd = w / mathpow(10, digits - j - 1) % 10 | 0;\r\n } else {\r\n xdi = Math.ceil((i + 1) / LOG_BASE);\r\n k = xd.length;\r\n if (xdi >= k) {\r\n if (isTruncated) {\r\n\r\n // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.\r\n for (; k++ <= xdi;) xd.push(0);\r\n w = rd = 0;\r\n digits = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n w = k = xd[xdi];\r\n\r\n // Get the number of digits of w.\r\n for (digits = 1; k >= 10; k /= 10) digits++;\r\n\r\n // Get the index of rd within w.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within w, adjusted for leading zeros.\r\n // The number of leading zeros of w is given by LOG_BASE - digits.\r\n j = i - LOG_BASE + digits;\r\n\r\n // Get the rounding digit at index j of w.\r\n rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;\r\n }\r\n }\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n isTruncated = isTruncated || sd < 0 ||\r\n xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));\r\n\r\n // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right\r\n // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression\r\n // will give 714.\r\n\r\n roundUp = rm < 4\r\n ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xd[0]) {\r\n xd.length = 0;\r\n if (roundUp) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xd[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xd.length = xdi;\r\n k = 1;\r\n xdi--;\r\n } else {\r\n xd.length = xdi + 1;\r\n k = mathpow(10, LOG_BASE - i);\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of w.\r\n xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;\r\n }\r\n\r\n if (roundUp) {\r\n for (;;) {\r\n\r\n // Is the digit to be rounded up in the first word of xd?\r\n if (xdi == 0) {\r\n\r\n // i will be the length of xd[0] before k is added.\r\n for (i = 1, j = xd[0]; j >= 10; j /= 10) i++;\r\n j = xd[0] += k;\r\n for (k = 1; j >= 10; j /= 10) k++;\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xd[0] == BASE) xd[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xd[xdi] += k;\r\n if (xd[xdi] != BASE) break;\r\n xd[xdi--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xd.length; xd[--i] === 0;) xd.pop();\r\n }\r\n\r\n if (external) {\r\n\r\n // Overflow?\r\n if (x.e > Ctor.maxE) {\r\n\r\n // Infinity.\r\n x.d = null;\r\n x.e = NaN;\r\n\r\n // Underflow?\r\n } else if (x.e < Ctor.minE) {\r\n\r\n // Zero.\r\n x.e = 0;\r\n x.d = [0];\r\n // Ctor.underflow = true;\r\n } // else Ctor.underflow = false;\r\n }\r\n\r\n return x;\r\n}\r\n\r\n\r\nfunction finiteToString(x, isExp, sd) {\r\n if (!x.isFinite()) return nonFiniteToString(x);\r\n var k,\r\n e = x.e,\r\n str = digitsToString(x.d),\r\n len = str.length;\r\n\r\n if (isExp) {\r\n if (sd && (k = sd - len) > 0) {\r\n str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);\r\n } else if (len > 1) {\r\n str = str.charAt(0) + '.' + str.slice(1);\r\n }\r\n\r\n str = str + (x.e < 0 ? 'e' : 'e+') + x.e;\r\n } else if (e < 0) {\r\n str = '0.' + getZeroString(-e - 1) + str;\r\n if (sd && (k = sd - len) > 0) str += getZeroString(k);\r\n } else if (e >= len) {\r\n str += getZeroString(e + 1 - len);\r\n if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);\r\n } else {\r\n if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);\r\n if (sd && (k = sd - len) > 0) {\r\n if (e + 1 === len) str += '.';\r\n str += getZeroString(k);\r\n }\r\n }\r\n\r\n return str;\r\n}\r\n\r\n\r\n// Calculate the base 10 exponent from the base 1e7 exponent.\r\nfunction getBase10Exponent(digits, e) {\r\n var w = digits[0];\r\n\r\n // Add the number of digits of the first word of the digits array.\r\n for ( e *= LOG_BASE; w >= 10; w /= 10) e++;\r\n return e;\r\n}\r\n\r\n\r\nfunction getLn10(Ctor, sd, pr) {\r\n if (sd > LN10_PRECISION) {\r\n\r\n // Reset global state in case the exception is caught.\r\n external = true;\r\n if (pr) Ctor.precision = pr;\r\n throw Error(precisionLimitExceeded);\r\n }\r\n return finalise(new Ctor(LN10), sd, 1, true);\r\n}\r\n\r\n\r\nfunction getPi(Ctor, sd, rm) {\r\n if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);\r\n return finalise(new Ctor(PI), sd, rm, true);\r\n}\r\n\r\n\r\nfunction getPrecision(digits) {\r\n var w = digits.length - 1,\r\n len = w * LOG_BASE + 1;\r\n\r\n w = digits[w];\r\n\r\n // If non-zero...\r\n if (w) {\r\n\r\n // Subtract the number of trailing zeros of the last word.\r\n for (; w % 10 == 0; w /= 10) len--;\r\n\r\n // Add the number of digits of the first word.\r\n for (w = digits[0]; w >= 10; w /= 10) len++;\r\n }\r\n\r\n return len;\r\n}\r\n\r\n\r\nfunction getZeroString(k) {\r\n var zs = '';\r\n for (; k--;) zs += '0';\r\n return zs;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an\r\n * integer of type number.\r\n *\r\n * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.\r\n *\r\n */\r\nfunction intPow(Ctor, x, n, pr) {\r\n var isTruncated,\r\n r = new Ctor(1),\r\n\r\n // Max n of 9007199254740991 takes 53 loop iterations.\r\n // Maximum digits array length; leaves [28, 34] guard digits.\r\n k = Math.ceil(pr / LOG_BASE + 4);\r\n\r\n external = false;\r\n\r\n for (;;) {\r\n if (n % 2) {\r\n r = r.times(x);\r\n if (truncate(r.d, k)) isTruncated = true;\r\n }\r\n\r\n n = mathfloor(n / 2);\r\n if (n === 0) {\r\n\r\n // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.\r\n n = r.d.length - 1;\r\n if (isTruncated && r.d[n] === 0) ++r.d[n];\r\n break;\r\n }\r\n\r\n x = x.times(x);\r\n truncate(x.d, k);\r\n }\r\n\r\n external = true;\r\n\r\n return r;\r\n}\r\n\r\n\r\nfunction isOdd(n) {\r\n return n.d[n.d.length - 1] & 1;\r\n}\r\n\r\n\r\n/*\r\n * Handle `max` (`n` is -1) and `min` (`n` is 1).\r\n */\r\nfunction maxOrMin(Ctor, args, n) {\r\n var k, y,\r\n x = new Ctor(args[0]),\r\n i = 0;\r\n\r\n for (; ++i < args.length;) {\r\n y = new Ctor(args[i]);\r\n\r\n // NaN?\r\n if (!y.s) {\r\n x = y;\r\n break;\r\n }\r\n\r\n k = x.cmp(y);\r\n\r\n if (k === n || k === 0 && x.s === n) {\r\n x = y;\r\n }\r\n }\r\n\r\n return x;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant\r\n * digits.\r\n *\r\n * Taylor/Maclaurin series.\r\n *\r\n * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...\r\n *\r\n * Argument reduction:\r\n * Repeat x = x / 32, k += 5, until |x| < 0.1\r\n * exp(x) = exp(x / 2^k)^(2^k)\r\n *\r\n * Previously, the argument was initially reduced by\r\n * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)\r\n * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was\r\n * found to be slower than just dividing repeatedly by 32 as above.\r\n *\r\n * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000\r\n * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000\r\n * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)\r\n *\r\n * exp(Infinity) = Infinity\r\n * exp(-Infinity) = 0\r\n * exp(NaN) = NaN\r\n * exp(±0) = 1\r\n *\r\n * exp(x) is non-terminating for any finite, non-zero x.\r\n *\r\n * The result will always be correctly rounded.\r\n *\r\n */\r\nfunction naturalExponential(x, sd) {\r\n var denominator, guard, j, pow, sum, t, wpr,\r\n rep = 0,\r\n i = 0,\r\n k = 0,\r\n Ctor = x.constructor,\r\n rm = Ctor.rounding,\r\n pr = Ctor.precision;\r\n\r\n // 0/NaN/Infinity?\r\n if (!x.d || !x.d[0] || x.e > 17) {\r\n\r\n return new Ctor(x.d\r\n ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0\r\n : x.s ? x.s < 0 ? 0 : x : 0 / 0);\r\n }\r\n\r\n if (sd == null) {\r\n external = false;\r\n wpr = pr;\r\n } else {\r\n wpr = sd;\r\n }\r\n\r\n t = new Ctor(0.03125);\r\n\r\n // while abs(x) >= 0.1\r\n while (x.e > -2) {\r\n\r\n // x = x / 2^5\r\n x = x.times(t);\r\n k += 5;\r\n }\r\n\r\n // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision\r\n // necessary to ensure the first 4 rounding digits are correct.\r\n guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;\r\n wpr += guard;\r\n denominator = pow = sum = new Ctor(1);\r\n Ctor.precision = wpr;\r\n\r\n for (;;) {\r\n pow = finalise(pow.times(x), wpr, 1);\r\n denominator = denominator.times(++i);\r\n t = sum.plus(divide(pow, denominator, wpr, 1));\r\n\r\n if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {\r\n j = k;\r\n while (j--) sum = finalise(sum.times(sum), wpr, 1);\r\n\r\n // Check to see if the first 4 rounding digits are [49]999.\r\n // If so, repeat the summation with a higher precision, otherwise\r\n // e.g. with precision: 18, rounding: 1\r\n // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)\r\n // `wpr - guard` is the index of first rounding digit.\r\n if (sd == null) {\r\n\r\n if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {\r\n Ctor.precision = wpr += 10;\r\n denominator = pow = t = new Ctor(1);\r\n i = 0;\r\n rep++;\r\n } else {\r\n return finalise(sum, Ctor.precision = pr, rm, external = true);\r\n }\r\n } else {\r\n Ctor.precision = pr;\r\n return sum;\r\n }\r\n }\r\n\r\n sum = t;\r\n }\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant\r\n * digits.\r\n *\r\n * ln(-n) = NaN\r\n * ln(0) = -Infinity\r\n * ln(-0) = -Infinity\r\n * ln(1) = 0\r\n * ln(Infinity) = Infinity\r\n * ln(-Infinity) = NaN\r\n * ln(NaN) = NaN\r\n *\r\n * ln(n) (n != 1) is non-terminating.\r\n *\r\n */\r\nfunction naturalLogarithm(y, sd) {\r\n var c, c0, denominator, e, numerator, rep, sum, t, wpr, x1, x2,\r\n n = 1,\r\n guard = 10,\r\n x = y,\r\n xd = x.d,\r\n Ctor = x.constructor,\r\n rm = Ctor.rounding,\r\n pr = Ctor.precision;\r\n\r\n // Is x negative or Infinity, NaN, 0 or 1?\r\n if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {\r\n return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);\r\n }\r\n\r\n if (sd == null) {\r\n external = false;\r\n wpr = pr;\r\n } else {\r\n wpr = sd;\r\n }\r\n\r\n Ctor.precision = wpr += guard;\r\n c = digitsToString(xd);\r\n c0 = c.charAt(0);\r\n\r\n if (Math.abs(e = x.e) < 1.5e15) {\r\n\r\n // Argument reduction.\r\n // The series converges faster the closer the argument is to 1, so using\r\n // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b\r\n // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,\r\n // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can\r\n // later be divided by this number, then separate out the power of 10 using\r\n // ln(a*10^b) = ln(a) + b*ln(10).\r\n\r\n // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).\r\n //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {\r\n // max n is 6 (gives 0.7 - 1.3)\r\n while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {\r\n x = x.times(y);\r\n c = digitsToString(x.d);\r\n c0 = c.charAt(0);\r\n n++;\r\n }\r\n\r\n e = x.e;\r\n\r\n if (c0 > 1) {\r\n x = new Ctor('0.' + c);\r\n e++;\r\n } else {\r\n x = new Ctor(c0 + '.' + c.slice(1));\r\n }\r\n } else {\r\n\r\n // The argument reduction method above may result in overflow if the argument y is a massive\r\n // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this\r\n // function using ln(x*10^e) = ln(x) + e*ln(10).\r\n t = getLn10(Ctor, wpr + 2, pr).times(e + '');\r\n x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);\r\n Ctor.precision = pr;\r\n\r\n return sd == null ? finalise(x, pr, rm, external = true) : x;\r\n }\r\n\r\n // x1 is x reduced to a value near 1.\r\n x1 = x;\r\n\r\n // Taylor series.\r\n // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)\r\n // where x = (y - 1)/(y + 1) (|x| < 1)\r\n sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);\r\n x2 = finalise(x.times(x), wpr, 1);\r\n denominator = 3;\r\n\r\n for (;;) {\r\n numerator = finalise(numerator.times(x2), wpr, 1);\r\n t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));\r\n\r\n if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {\r\n sum = sum.times(2);\r\n\r\n // Reverse the argument reduction. Check that e is not 0 because, besides preventing an\r\n // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.\r\n if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));\r\n sum = divide(sum, new Ctor(n), wpr, 1);\r\n\r\n // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has\r\n // been repeated previously) and the first 4 rounding digits 9999?\r\n // If so, restart the summation with a higher precision, otherwise\r\n // e.g. with precision: 12, rounding: 1\r\n // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.\r\n // `wpr - guard` is the index of first rounding digit.\r\n if (sd == null) {\r\n if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {\r\n Ctor.precision = wpr += guard;\r\n t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);\r\n x2 = finalise(x.times(x), wpr, 1);\r\n denominator = rep = 1;\r\n } else {\r\n return finalise(sum, Ctor.precision = pr, rm, external = true);\r\n }\r\n } else {\r\n Ctor.precision = pr;\r\n return sum;\r\n }\r\n }\r\n\r\n sum = t;\r\n denominator += 2;\r\n }\r\n}\r\n\r\n\r\n// ±Infinity, NaN.\r\nfunction nonFiniteToString(x) {\r\n // Unsigned.\r\n return String(x.s * x.s / 0);\r\n}\r\n\r\n\r\n/*\r\n * Parse the value of a new Decimal `x` from string `str`.\r\n */\r\nfunction parseDecimal(x, str) {\r\n var e, i, len;\r\n\r\n // TODO BigInt str: no need to check for decimal point, exponential form or leading zeros.\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(len - 1) === 48; --len);\r\n str = str.slice(i, len);\r\n\r\n if (str) {\r\n len -= i;\r\n x.e = e = e - i - 1;\r\n x.d = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first word of the digits array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE;\r\n\r\n if (i < len) {\r\n if (i) x.d.push(+str.slice(0, i));\r\n for (len -= LOG_BASE; i < len;) x.d.push(+str.slice(i, i += LOG_BASE));\r\n str = str.slice(i);\r\n i = LOG_BASE - str.length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--;) str += '0';\r\n x.d.push(+str);\r\n\r\n if (external) {\r\n\r\n // Overflow?\r\n if (x.e > x.constructor.maxE) {\r\n\r\n // Infinity.\r\n x.d = null;\r\n x.e = NaN;\r\n\r\n // Underflow?\r\n } else if (x.e < x.constructor.minE) {\r\n\r\n // Zero.\r\n x.e = 0;\r\n x.d = [0];\r\n // x.constructor.underflow = true;\r\n } // else x.constructor.underflow = false;\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.e = 0;\r\n x.d = [0];\r\n }\r\n\r\n return x;\r\n}\r\n\r\n\r\n/*\r\n * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.\r\n */\r\nfunction parseOther(x, str) {\r\n var base, Ctor, divisor, i, isFloat, len, p, xd, xe;\r\n\r\n if (str.indexOf('_') > -1) {\r\n str = str.replace(/(\\d)_(?=\\d)/g, '$1');\r\n if (isDecimal.test(str)) return parseDecimal(x, str);\r\n } else if (str === 'Infinity' || str === 'NaN') {\r\n if (!+str) x.s = NaN;\r\n x.e = NaN;\r\n x.d = null;\r\n return x;\r\n }\r\n\r\n if (isHex.test(str)) {\r\n base = 16;\r\n str = str.toLowerCase();\r\n } else if (isBinary.test(str)) {\r\n base = 2;\r\n } else if (isOctal.test(str)) {\r\n base = 8;\r\n } else {\r\n throw Error(invalidArgument + str);\r\n }\r\n\r\n // Is there a binary exponent part?\r\n i = str.search(/p/i);\r\n\r\n if (i > 0) {\r\n p = +str.slice(i + 1);\r\n str = str.substring(2, i);\r\n } else {\r\n str = str.slice(2);\r\n }\r\n\r\n // Convert `str` as an integer then divide the result by `base` raised to a power such that the\r\n // fraction part will be restored.\r\n i = str.indexOf('.');\r\n isFloat = i >= 0;\r\n Ctor = x.constructor;\r\n\r\n if (isFloat) {\r\n str = str.replace('.', '');\r\n len = str.length;\r\n i = len - i;\r\n\r\n // log[10](16) = 1.2041... , log[10](88) = 1.9444....\r\n divisor = intPow(Ctor, new Ctor(base), i, i * 2);\r\n }\r\n\r\n xd = convertBase(str, base, BASE);\r\n xe = xd.length - 1;\r\n\r\n // Remove trailing zeros.\r\n for (i = xe; xd[i] === 0; --i) xd.pop();\r\n if (i < 0) return new Ctor(x.s * 0);\r\n x.e = getBase10Exponent(xd, xe);\r\n x.d = xd;\r\n external = false;\r\n\r\n // At what precision to perform the division to ensure exact conversion?\r\n // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)\r\n // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412\r\n // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.\r\n // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount\r\n // Therefore using 4 * the number of digits of str will always be enough.\r\n if (isFloat) x = divide(x, divisor, len * 4);\r\n\r\n // Multiply by the binary exponent part if present.\r\n if (p) x = x.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal.pow(2, p));\r\n external = true;\r\n\r\n return x;\r\n}\r\n\r\n\r\n/*\r\n * sin(x) = x - x^3/3! + x^5/5! - ...\r\n * |x| < pi/2\r\n *\r\n */\r\nfunction sine(Ctor, x) {\r\n var k,\r\n len = x.d.length;\r\n\r\n if (len < 3) {\r\n return x.isZero() ? x : taylorSeries(Ctor, 2, x, x);\r\n }\r\n\r\n // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)\r\n // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)\r\n // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))\r\n\r\n // Estimate the optimum number of times to use the argument reduction.\r\n k = 1.4 * Math.sqrt(len);\r\n k = k > 16 ? 16 : k | 0;\r\n\r\n x = x.times(1 / tinyPow(5, k));\r\n x = taylorSeries(Ctor, 2, x, x);\r\n\r\n // Reverse argument reduction\r\n var sin2_x,\r\n d5 = new Ctor(5),\r\n d16 = new Ctor(16),\r\n d20 = new Ctor(20);\r\n for (; k--;) {\r\n sin2_x = x.times(x);\r\n x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));\r\n }\r\n\r\n return x;\r\n}\r\n\r\n\r\n// Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.\r\nfunction taylorSeries(Ctor, n, x, y, isHyperbolic) {\r\n var j, t, u, x2,\r\n i = 1,\r\n pr = Ctor.precision,\r\n k = Math.ceil(pr / LOG_BASE);\r\n\r\n external = false;\r\n x2 = x.times(x);\r\n u = new Ctor(y);\r\n\r\n for (;;) {\r\n t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);\r\n u = isHyperbolic ? y.plus(t) : y.minus(t);\r\n y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);\r\n t = u.plus(y);\r\n\r\n if (t.d[k] !== void 0) {\r\n for (j = k; t.d[j] === u.d[j] && j--;);\r\n if (j == -1) break;\r\n }\r\n\r\n j = u;\r\n u = y;\r\n y = t;\r\n t = j;\r\n i++;\r\n }\r\n\r\n external = true;\r\n t.d.length = k + 1;\r\n\r\n return t;\r\n}\r\n\r\n\r\n// Exponent e must be positive and non-zero.\r\nfunction tinyPow(b, e) {\r\n var n = b;\r\n while (--e) n *= b;\r\n return n;\r\n}\r\n\r\n\r\n// Return the absolute value of `x` reduced to less than or equal to half pi.\r\nfunction toLessThanHalfPi(Ctor, x) {\r\n var t,\r\n isNeg = x.s < 0,\r\n pi = getPi(Ctor, Ctor.precision, 1),\r\n halfPi = pi.times(0.5);\r\n\r\n x = x.abs();\r\n\r\n if (x.lte(halfPi)) {\r\n quadrant = isNeg ? 4 : 1;\r\n return x;\r\n }\r\n\r\n t = x.divToInt(pi);\r\n\r\n if (t.isZero()) {\r\n quadrant = isNeg ? 3 : 2;\r\n } else {\r\n x = x.minus(t.times(pi));\r\n\r\n // 0 <= x < pi\r\n if (x.lte(halfPi)) {\r\n quadrant = isOdd(t) ? (isNeg ? 2 : 3) : (isNeg ? 4 : 1);\r\n return x;\r\n }\r\n\r\n quadrant = isOdd(t) ? (isNeg ? 1 : 4) : (isNeg ? 3 : 2);\r\n }\r\n\r\n return x.minus(pi).abs();\r\n}\r\n\r\n\r\n/*\r\n * Return the value of Decimal `x` as a string in base `baseOut`.\r\n *\r\n * If the optional `sd` argument is present include a binary exponent suffix.\r\n */\r\nfunction toStringBinary(x, baseOut, sd, rm) {\r\n var base, e, i, k, len, roundUp, str, xd, y,\r\n Ctor = x.constructor,\r\n isExp = sd !== void 0;\r\n\r\n if (isExp) {\r\n checkInt32(sd, 1, MAX_DIGITS);\r\n if (rm === void 0) rm = Ctor.rounding;\r\n else checkInt32(rm, 0, 8);\r\n } else {\r\n sd = Ctor.precision;\r\n rm = Ctor.rounding;\r\n }\r\n\r\n if (!x.isFinite()) {\r\n str = nonFiniteToString(x);\r\n } else {\r\n str = finiteToString(x);\r\n i = str.indexOf('.');\r\n\r\n // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:\r\n // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))\r\n // minBinaryExponent = floor(decimalExponent * log[2](10))\r\n // log[2](10) = 3.321928094887362347870319429489390175864\r\n\r\n if (isExp) {\r\n base = 2;\r\n if (baseOut == 16) {\r\n sd = sd * 4 - 3;\r\n } else if (baseOut == 8) {\r\n sd = sd * 3 - 2;\r\n }\r\n } else {\r\n base = baseOut;\r\n }\r\n\r\n // Convert the number as an integer then divide the result by its base raised to a power such\r\n // that the fraction part will be restored.\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n str = str.replace('.', '');\r\n y = new Ctor(1);\r\n y.e = str.length - i;\r\n y.d = convertBase(finiteToString(y), 10, base);\r\n y.e = y.d.length;\r\n }\r\n\r\n xd = convertBase(str, 10, base);\r\n e = len = xd.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xd[--len] == 0;) xd.pop();\r\n\r\n if (!xd[0]) {\r\n str = isExp ? '0p+0' : '0';\r\n } else {\r\n if (i < 0) {\r\n e--;\r\n } else {\r\n x = new Ctor(x);\r\n x.d = xd;\r\n x.e = e;\r\n x = divide(x, y, sd, rm, 0, base);\r\n xd = x.d;\r\n e = x.e;\r\n roundUp = inexact;\r\n }\r\n\r\n // The rounding digit, i.e. the digit after the digit that may be rounded up.\r\n i = xd[sd];\r\n k = base / 2;\r\n roundUp = roundUp || xd[sd + 1] !== void 0;\r\n\r\n roundUp = rm < 4\r\n ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2))\r\n : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 ||\r\n rm === (x.s < 0 ? 8 : 7));\r\n\r\n xd.length = sd;\r\n\r\n if (roundUp) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (; ++xd[--sd] > base - 1;) {\r\n xd[sd] = 0;\r\n if (!sd) {\r\n ++e;\r\n xd.unshift(1);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (len = xd.length; !xd[len - 1]; --len);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i < len; i++) str += NUMERALS.charAt(xd[i]);\r\n\r\n // Add binary exponent suffix?\r\n if (isExp) {\r\n if (len > 1) {\r\n if (baseOut == 16 || baseOut == 8) {\r\n i = baseOut == 16 ? 4 : 3;\r\n for (--len; len % i; len++) str += '0';\r\n xd = convertBase(str, base, baseOut);\r\n for (len = xd.length; !xd[len - 1]; --len);\r\n\r\n // xd[0] will always be be 1\r\n for (i = 1, str = '1.'; i < len; i++) str += NUMERALS.charAt(xd[i]);\r\n } else {\r\n str = str.charAt(0) + '.' + str.slice(1);\r\n }\r\n }\r\n\r\n str = str + (e < 0 ? 'p' : 'p+') + e;\r\n } else if (e < 0) {\r\n for (; ++e;) str = '0' + str;\r\n str = '0.' + str;\r\n } else {\r\n if (++e > len) for (e -= len; e-- ;) str += '0';\r\n else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);\r\n }\r\n }\r\n\r\n str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;\r\n }\r\n\r\n return x.s < 0 ? '-' + str : str;\r\n}\r\n\r\n\r\n// Does not strip trailing zeros.\r\nfunction truncate(arr, len) {\r\n if (arr.length > len) {\r\n arr.length = len;\r\n return true;\r\n }\r\n}\r\n\r\n\r\n// Decimal methods\r\n\r\n\r\n/*\r\n * abs\r\n * acos\r\n * acosh\r\n * add\r\n * asin\r\n * asinh\r\n * atan\r\n * atanh\r\n * atan2\r\n * cbrt\r\n * ceil\r\n * clamp\r\n * clone\r\n * config\r\n * cos\r\n * cosh\r\n * div\r\n * exp\r\n * floor\r\n * hypot\r\n * ln\r\n * log\r\n * log2\r\n * log10\r\n * max\r\n * min\r\n * mod\r\n * mul\r\n * pow\r\n * random\r\n * round\r\n * set\r\n * sign\r\n * sin\r\n * sinh\r\n * sqrt\r\n * sub\r\n * sum\r\n * tan\r\n * tanh\r\n * trunc\r\n */\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the absolute value of `x`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction abs(x) {\r\n return new this(x).abs();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arccosine in radians of `x`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction acos(x) {\r\n return new this(x).acos();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to\r\n * `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} A value in radians.\r\n *\r\n */\r\nfunction acosh(x) {\r\n return new this(x).acosh();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n * y {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction add(x, y) {\r\n return new this(x).plus(y);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction asin(x) {\r\n return new this(x).asin();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to\r\n * `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} A value in radians.\r\n *\r\n */\r\nfunction asinh(x) {\r\n return new this(x).asinh();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction atan(x) {\r\n return new this(x).atan();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to\r\n * `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} A value in radians.\r\n *\r\n */\r\nfunction atanh(x) {\r\n return new this(x).atanh();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi\r\n * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * Domain: [-Infinity, Infinity]\r\n * Range: [-pi, pi]\r\n *\r\n * y {number|string|bigint|Decimal} The y-coordinate.\r\n * x {number|string|bigint|Decimal} The x-coordinate.\r\n *\r\n * atan2(±0, -0) = ±pi\r\n * atan2(±0, +0) = ±0\r\n * atan2(±0, -x) = ±pi for x > 0\r\n * atan2(±0, x) = ±0 for x > 0\r\n * atan2(-y, ±0) = -pi/2 for y > 0\r\n * atan2(y, ±0) = pi/2 for y > 0\r\n * atan2(±y, -Infinity) = ±pi for finite y > 0\r\n * atan2(±y, +Infinity) = ±0 for finite y > 0\r\n * atan2(±Infinity, x) = ±pi/2 for finite x\r\n * atan2(±Infinity, -Infinity) = ±3*pi/4\r\n * atan2(±Infinity, +Infinity) = ±pi/4\r\n * atan2(NaN, x) = NaN\r\n * atan2(y, NaN) = NaN\r\n *\r\n */\r\nfunction atan2(y, x) {\r\n y = new this(y);\r\n x = new this(x);\r\n var r,\r\n pr = this.precision,\r\n rm = this.rounding,\r\n wpr = pr + 4;\r\n\r\n // Either NaN\r\n if (!y.s || !x.s) {\r\n r = new this(NaN);\r\n\r\n // Both ±Infinity\r\n } else if (!y.d && !x.d) {\r\n r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);\r\n r.s = y.s;\r\n\r\n // x is ±Infinity or y is ±0\r\n } else if (!x.d || y.isZero()) {\r\n r = x.s < 0 ? getPi(this, pr, rm) : new this(0);\r\n r.s = y.s;\r\n\r\n // y is ±Infinity or x is ±0\r\n } else if (!y.d || x.isZero()) {\r\n r = getPi(this, wpr, 1).times(0.5);\r\n r.s = y.s;\r\n\r\n // Both non-zero and finite\r\n } else if (x.s < 0) {\r\n this.precision = wpr;\r\n this.rounding = 1;\r\n r = this.atan(divide(y, x, wpr, 1));\r\n x = getPi(this, wpr, 1);\r\n this.precision = pr;\r\n this.rounding = rm;\r\n r = y.s < 0 ? r.minus(x) : r.plus(x);\r\n } else {\r\n r = this.atan(divide(y, x, wpr, 1));\r\n }\r\n\r\n return r;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction cbrt(x) {\r\n return new this(x).cbrt();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction ceil(x) {\r\n return finalise(x = new this(x), x.e + 1, 2);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` clamped to the range delineated by `min` and `max`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n * min {number|string|bigint|Decimal}\r\n * max {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction clamp(x, min, max) {\r\n return new this(x).clamp(min, max);\r\n}\r\n\r\n\r\n/*\r\n * Configure global settings for a Decimal constructor.\r\n *\r\n * `obj` is an object with one or more of the following properties,\r\n *\r\n * precision {number}\r\n * rounding {number}\r\n * toExpNeg {number}\r\n * toExpPos {number}\r\n * maxE {number}\r\n * minE {number}\r\n * modulo {number}\r\n * crypto {boolean|number}\r\n * defaults {true}\r\n *\r\n * E.g. Decimal.config({ precision: 20, rounding: 4 })\r\n *\r\n */\r\nfunction config(obj) {\r\n if (!obj || typeof obj !== 'object') throw Error(decimalError + 'Object expected');\r\n var i, p, v,\r\n useDefaults = obj.defaults === true,\r\n ps = [\r\n 'precision', 1, MAX_DIGITS,\r\n 'rounding', 0, 8,\r\n 'toExpNeg', -EXP_LIMIT, 0,\r\n 'toExpPos', 0, EXP_LIMIT,\r\n 'maxE', 0, EXP_LIMIT,\r\n 'minE', -EXP_LIMIT, 0,\r\n 'modulo', 0, 9\r\n ];\r\n\r\n for (i = 0; i < ps.length; i += 3) {\r\n if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];\r\n if ((v = obj[p]) !== void 0) {\r\n if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;\r\n else throw Error(invalidArgument + p + ': ' + v);\r\n }\r\n }\r\n\r\n if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];\r\n if ((v = obj[p]) !== void 0) {\r\n if (v === true || v === false || v === 0 || v === 1) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n this[p] = true;\r\n } else {\r\n throw Error(cryptoUnavailable);\r\n }\r\n } else {\r\n this[p] = false;\r\n }\r\n } else {\r\n throw Error(invalidArgument + p + ': ' + v);\r\n }\r\n }\r\n\r\n return this;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} A value in radians.\r\n *\r\n */\r\nfunction cos(x) {\r\n return new this(x).cos();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} A value in radians.\r\n *\r\n */\r\nfunction cosh(x) {\r\n return new this(x).cosh();\r\n}\r\n\r\n\r\n/*\r\n * Create and return a Decimal constructor with the same configuration properties as this Decimal\r\n * constructor.\r\n *\r\n */\r\nfunction clone(obj) {\r\n var i, p, ps;\r\n\r\n /*\r\n * The Decimal constructor and exported function.\r\n * Return a new Decimal instance.\r\n *\r\n * v {number|string|bigint|Decimal} A numeric value.\r\n *\r\n */\r\n function Decimal(v) {\r\n var e, i, t,\r\n x = this;\r\n\r\n // Decimal called without new.\r\n if (!(x instanceof Decimal)) return new Decimal(v);\r\n\r\n // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor\r\n // which points to Object.\r\n x.constructor = Decimal;\r\n\r\n if (isDecimalInstance(v)) {\r\n x.s = v.s;\r\n\r\n if (external) {\r\n if (!v.d || v.e > Decimal.maxE) {\r\n\r\n // Infinity.\r\n x.e = NaN;\r\n x.d = null;\r\n } else if (v.e < Decimal.minE) {\r\n\r\n // Zero.\r\n x.e = 0;\r\n x.d = [0];\r\n } else {\r\n x.e = v.e;\r\n x.d = v.d.slice();\r\n }\r\n } else {\r\n x.e = v.e;\r\n x.d = v.d ? v.d.slice() : v.d;\r\n }\r\n\r\n return;\r\n }\r\n\r\n t = typeof v;\r\n\r\n if (t === 'number') {\r\n if (v === 0) {\r\n x.s = 1 / v < 0 ? -1 : 1;\r\n x.e = 0;\r\n x.d = [0];\r\n return;\r\n }\r\n\r\n if (v < 0) {\r\n v = -v;\r\n x.s = -1;\r\n } else {\r\n x.s = 1;\r\n }\r\n\r\n // Fast path for small integers.\r\n if (v === ~~v && v < 1e7) {\r\n for (e = 0, i = v; i >= 10; i /= 10) e++;\r\n\r\n if (external) {\r\n if (e > Decimal.maxE) {\r\n x.e = NaN;\r\n x.d = null;\r\n } else if (e < Decimal.minE) {\r\n x.e = 0;\r\n x.d = [0];\r\n } else {\r\n x.e = e;\r\n x.d = [v];\r\n }\r\n } else {\r\n x.e = e;\r\n x.d = [v];\r\n }\r\n\r\n return;\r\n }\r\n\r\n // Infinity or NaN?\r\n if (v * 0 !== 0) {\r\n if (!v) x.s = NaN;\r\n x.e = NaN;\r\n x.d = null;\r\n return;\r\n }\r\n\r\n return parseDecimal(x, v.toString());\r\n }\r\n\r\n if (t === 'string') {\r\n if ((i = v.charCodeAt(0)) === 45) { // minus sign\r\n v = v.slice(1);\r\n x.s = -1;\r\n } else {\r\n if (i === 43) v = v.slice(1); // plus sign\r\n x.s = 1;\r\n }\r\n\r\n return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);\r\n }\r\n\r\n if (t === 'bigint') {\r\n if (v < 0) {\r\n v = -v;\r\n x.s = -1;\r\n } else {\r\n x.s = 1;\r\n }\r\n\r\n return parseDecimal(x, v.toString());\r\n }\r\n\r\n throw Error(invalidArgument + v);\r\n }\r\n\r\n Decimal.prototype = P;\r\n\r\n Decimal.ROUND_UP = 0;\r\n Decimal.ROUND_DOWN = 1;\r\n Decimal.ROUND_CEIL = 2;\r\n Decimal.ROUND_FLOOR = 3;\r\n Decimal.ROUND_HALF_UP = 4;\r\n Decimal.ROUND_HALF_DOWN = 5;\r\n Decimal.ROUND_HALF_EVEN = 6;\r\n Decimal.ROUND_HALF_CEIL = 7;\r\n Decimal.ROUND_HALF_FLOOR = 8;\r\n Decimal.EUCLID = 9;\r\n\r\n Decimal.config = Decimal.set = config;\r\n Decimal.clone = clone;\r\n Decimal.isDecimal = isDecimalInstance;\r\n\r\n Decimal.abs = abs;\r\n Decimal.acos = acos;\r\n Decimal.acosh = acosh; // ES6\r\n Decimal.add = add;\r\n Decimal.asin = asin;\r\n Decimal.asinh = asinh; // ES6\r\n Decimal.atan = atan;\r\n Decimal.atanh = atanh; // ES6\r\n Decimal.atan2 = atan2;\r\n Decimal.cbrt = cbrt; // ES6\r\n Decimal.ceil = ceil;\r\n Decimal.clamp = clamp;\r\n Decimal.cos = cos;\r\n Decimal.cosh = cosh; // ES6\r\n Decimal.div = div;\r\n Decimal.exp = exp;\r\n Decimal.floor = floor;\r\n Decimal.hypot = hypot; // ES6\r\n Decimal.ln = ln;\r\n Decimal.log = log;\r\n Decimal.log10 = log10; // ES6\r\n Decimal.log2 = log2; // ES6\r\n Decimal.max = max;\r\n Decimal.min = min;\r\n Decimal.mod = mod;\r\n Decimal.mul = mul;\r\n Decimal.pow = pow;\r\n Decimal.random = random;\r\n Decimal.round = round;\r\n Decimal.sign = sign; // ES6\r\n Decimal.sin = sin;\r\n Decimal.sinh = sinh; // ES6\r\n Decimal.sqrt = sqrt;\r\n Decimal.sub = sub;\r\n Decimal.sum = sum;\r\n Decimal.tan = tan;\r\n Decimal.tanh = tanh; // ES6\r\n Decimal.trunc = trunc; // ES6\r\n\r\n if (obj === void 0) obj = {};\r\n if (obj) {\r\n if (obj.defaults !== true) {\r\n ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];\r\n for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];\r\n }\r\n }\r\n\r\n Decimal.config(obj);\r\n\r\n return Decimal;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n * y {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction div(x, y) {\r\n return new this(x).div(y);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} The power to which to raise the base of the natural log.\r\n *\r\n */\r\nfunction exp(x) {\r\n return new this(x).exp();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction floor(x) {\r\n return finalise(x = new this(x), x.e + 1, 3);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,\r\n * rounded to `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)\r\n *\r\n * arguments {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction hypot() {\r\n var i, n,\r\n t = new this(0);\r\n\r\n external = false;\r\n\r\n for (i = 0; i < arguments.length;) {\r\n n = new this(arguments[i++]);\r\n if (!n.d) {\r\n if (n.s) {\r\n external = true;\r\n return new this(1 / 0);\r\n }\r\n t = n;\r\n } else if (t.d) {\r\n t = t.plus(n.times(n));\r\n }\r\n }\r\n\r\n external = true;\r\n\r\n return t.sqrt();\r\n}\r\n\r\n\r\n/*\r\n * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),\r\n * otherwise return false.\r\n *\r\n */\r\nfunction isDecimalInstance(obj) {\r\n return obj instanceof Decimal || obj && obj.toStringTag === tag || false;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction ln(x) {\r\n return new this(x).ln();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base\r\n * is specified, rounded to `precision` significant digits using rounding mode `rounding`.\r\n *\r\n * log[y](x)\r\n *\r\n * x {number|string|bigint|Decimal} The argument of the logarithm.\r\n * y {number|string|bigint|Decimal} The base of the logarithm.\r\n *\r\n */\r\nfunction log(x, y) {\r\n return new this(x).log(y);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction log2(x) {\r\n return new this(x).log(2);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction log10(x) {\r\n return new this(x).log(10);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction max() {\r\n return maxOrMin(this, arguments, -1);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction min() {\r\n return maxOrMin(this, arguments, 1);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits\r\n * using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n * y {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction mod(x, y) {\r\n return new this(x).mod(y);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n * y {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction mul(x, y) {\r\n return new this(x).mul(y);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} The base.\r\n * y {number|string|bigint|Decimal} The exponent.\r\n *\r\n */\r\nfunction pow(x, y) {\r\n return new this(x).pow(y);\r\n}\r\n\r\n\r\n/*\r\n * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with\r\n * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros\r\n * are produced).\r\n *\r\n * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.\r\n *\r\n */\r\nfunction random(sd) {\r\n var d, e, k, n,\r\n i = 0,\r\n r = new this(1),\r\n rd = [];\r\n\r\n if (sd === void 0) sd = this.precision;\r\n else checkInt32(sd, 1, MAX_DIGITS);\r\n\r\n k = Math.ceil(sd / LOG_BASE);\r\n\r\n if (!this.crypto) {\r\n for (; i < k;) rd[i++] = Math.random() * 1e7 | 0;\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n } else if (crypto.getRandomValues) {\r\n d = crypto.getRandomValues(new Uint32Array(k));\r\n\r\n for (; i < k;) {\r\n n = d[i];\r\n\r\n // 0 <= n < 4294967296\r\n // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).\r\n if (n >= 4.29e9) {\r\n d[i] = crypto.getRandomValues(new Uint32Array(1))[0];\r\n } else {\r\n\r\n // 0 <= n <= 4289999999\r\n // 0 <= (n % 1e7) <= 9999999\r\n rd[i++] = n % 1e7;\r\n }\r\n }\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n d = crypto.randomBytes(k *= 4);\r\n\r\n for (; i < k;) {\r\n\r\n // 0 <= n < 2147483648\r\n n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);\r\n\r\n // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).\r\n if (n >= 2.14e9) {\r\n crypto.randomBytes(4).copy(d, i);\r\n } else {\r\n\r\n // 0 <= n <= 2139999999\r\n // 0 <= (n % 1e7) <= 9999999\r\n rd.push(n % 1e7);\r\n i += 4;\r\n }\r\n }\r\n\r\n i = k / 4;\r\n } else {\r\n throw Error(cryptoUnavailable);\r\n }\r\n\r\n k = rd[--i];\r\n sd %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to sd.\r\n if (k && sd) {\r\n n = mathpow(10, LOG_BASE - sd);\r\n rd[i] = (k / n | 0) * n;\r\n }\r\n\r\n // Remove trailing words which are zero.\r\n for (; rd[i] === 0; i--) rd.pop();\r\n\r\n // Zero?\r\n if (i < 0) {\r\n e = 0;\r\n rd = [0];\r\n } else {\r\n e = -1;\r\n\r\n // Remove leading words which are zero and adjust exponent accordingly.\r\n for (; rd[0] === 0; e -= LOG_BASE) rd.shift();\r\n\r\n // Count the digits of the first word of rd to determine leading zeros.\r\n for (k = 1, n = rd[0]; n >= 10; n /= 10) k++;\r\n\r\n // Adjust the exponent for leading zeros of the first word of rd.\r\n if (k < LOG_BASE) e -= LOG_BASE - k;\r\n }\r\n\r\n r.e = e;\r\n r.d = rd;\r\n\r\n return r;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.\r\n *\r\n * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction round(x) {\r\n return finalise(x = new this(x), x.e + 1, this.rounding);\r\n}\r\n\r\n\r\n/*\r\n * Return\r\n * 1 if x > 0,\r\n * -1 if x < 0,\r\n * 0 if x is 0,\r\n * -0 if x is -0,\r\n * NaN otherwise\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction sign(x) {\r\n x = new this(x);\r\n return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN;\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits\r\n * using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} A value in radians.\r\n *\r\n */\r\nfunction sin(x) {\r\n return new this(x).sin();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} A value in radians.\r\n *\r\n */\r\nfunction sinh(x) {\r\n return new this(x).sinh();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction sqrt(x) {\r\n return new this(x).sqrt();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits\r\n * using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n * y {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction sub(x, y) {\r\n return new this(x).sub(y);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the sum of the arguments, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * Only the result is rounded, not the intermediate calculations.\r\n *\r\n * arguments {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction sum() {\r\n var i = 0,\r\n args = arguments,\r\n x = new this(args[i]);\r\n\r\n external = false;\r\n for (; x.s && ++i < args.length;) x = x.plus(args[i]);\r\n external = true;\r\n\r\n return finalise(x, this.precision, this.rounding);\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant\r\n * digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} A value in radians.\r\n *\r\n */\r\nfunction tan(x) {\r\n return new this(x).tan();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`\r\n * significant digits using rounding mode `rounding`.\r\n *\r\n * x {number|string|bigint|Decimal} A value in radians.\r\n *\r\n */\r\nfunction tanh(x) {\r\n return new this(x).tanh();\r\n}\r\n\r\n\r\n/*\r\n * Return a new Decimal whose value is `x` truncated to an integer.\r\n *\r\n * x {number|string|bigint|Decimal}\r\n *\r\n */\r\nfunction trunc(x) {\r\n return finalise(x = new this(x), x.e + 1, 1);\r\n}\r\n\r\n\r\nP[Symbol.for('nodejs.util.inspect.custom')] = P.toString;\r\nP[Symbol.toStringTag] = 'Decimal';\r\n\r\n// Create and configure initial Decimal constructor.\r\nexport var Decimal = P.constructor = clone(DEFAULTS);\r\n\r\n// Create the internal constants from their string values.\r\nLN10 = new Decimal(LN10);\r\nPI = new Decimal(PI);\r\n\r\nexport default Decimal;\r\n","import Decimal from 'decimal.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'BigNumber'\nconst dependencies = ['?on', 'config']\n\nexport const createBigNumberClass = /* #__PURE__ */ factory(name, dependencies, ({ on, config }) => {\n const BigNumber = Decimal.clone({ precision: config.precision, modulo: Decimal.EUCLID })\n BigNumber.prototype = Object.create(BigNumber.prototype)\n\n /**\n * Attach type information\n */\n BigNumber.prototype.type = 'BigNumber'\n BigNumber.prototype.isBigNumber = true\n\n /**\n * Get a JSON representation of a BigNumber containing\n * type information\n * @returns {Object} Returns a JSON object structured as:\n * `{\"mathjs\": \"BigNumber\", \"value\": \"0.2\"}`\n */\n BigNumber.prototype.toJSON = function () {\n return {\n mathjs: 'BigNumber',\n value: this.toString()\n }\n }\n\n /**\n * Instantiate a BigNumber from a JSON object\n * @param {Object} json a JSON object structured as:\n * `{\"mathjs\": \"BigNumber\", \"value\": \"0.2\"}`\n * @return {BigNumber}\n */\n BigNumber.fromJSON = function (json) {\n return new BigNumber(json.value)\n }\n\n if (on) {\n // listen for changed in the configuration, automatically apply changed precision\n on('config', function (curr, prev) {\n if (curr.precision !== prev.precision) {\n BigNumber.config({ precision: curr.precision })\n }\n })\n }\n\n return BigNumber\n}, { isClass: true })\n","'use strict';\n\n/**\n *\n * This class allows the manipulation of complex numbers.\n * You can pass a complex number in different formats. Either as object, double, string or two integer parameters.\n *\n * Object form\n * { re: , im: }\n * { arg: , abs: }\n * { phi: , r: }\n *\n * Array / Vector form\n * [ real, imaginary ]\n *\n * Double form\n * 99.3 - Single double value\n *\n * String form\n * '23.1337' - Simple real number\n * '15+3i' - a simple complex number\n * '3-i' - a simple complex number\n *\n * Example:\n *\n * const c = new Complex('99.3+8i');\n * c.mul({r: 3, i: 9}).div(4.9).sub(3, 2);\n *\n */\n\n\nconst cosh = Math.cosh || function (x) {\n return Math.abs(x) < 1e-9 ? 1 - x : (Math.exp(x) + Math.exp(-x)) * 0.5;\n};\n\nconst sinh = Math.sinh || function (x) {\n return Math.abs(x) < 1e-9 ? x : (Math.exp(x) - Math.exp(-x)) * 0.5;\n};\n\n/**\n * Calculates cos(x) - 1 using Taylor series if x is small (-¼π ≤ x ≤ ¼π).\n *\n * @param {number} x\n * @returns {number} cos(x) - 1\n */\nconst cosm1 = function (x) {\n\n const b = Math.PI / 4;\n if (-b > x || x > b) {\n return Math.cos(x) - 1.0;\n }\n\n /* Calculate horner form of polynomial of taylor series in Q\n let fac = 1, alt = 1, pol = {};\n for (let i = 0; i <= 16; i++) {\n fac*= i || 1;\n if (i % 2 == 0) {\n pol[i] = new Fraction(1, alt * fac);\n alt = -alt;\n }\n }\n console.log(new Polynomial(pol).toHorner()); // (((((((1/20922789888000x^2-1/87178291200)x^2+1/479001600)x^2-1/3628800)x^2+1/40320)x^2-1/720)x^2+1/24)x^2-1/2)x^2+1\n */\n\n const xx = x * x;\n return xx * (\n xx * (\n xx * (\n xx * (\n xx * (\n xx * (\n xx * (\n xx / 20922789888000\n - 1 / 87178291200)\n + 1 / 479001600)\n - 1 / 3628800)\n + 1 / 40320)\n - 1 / 720)\n + 1 / 24)\n - 1 / 2);\n};\n\nconst hypot = function (x, y) {\n\n x = Math.abs(x);\n y = Math.abs(y);\n\n // Ensure `x` is the larger value\n if (x < y) [x, y] = [y, x];\n\n // If both are below the threshold, use straightforward Pythagoras\n if (x < 1e8) return Math.sqrt(x * x + y * y);\n\n // For larger values, scale to avoid overflow\n y /= x;\n return x * Math.sqrt(1 + y * y);\n};\n\nconst parser_exit = function () {\n throw SyntaxError('Invalid Param');\n};\n\n/**\n * Calculates log(sqrt(a^2+b^2)) in a way to avoid overflows\n *\n * @param {number} a\n * @param {number} b\n * @returns {number}\n */\nfunction logHypot(a, b) {\n\n const _a = Math.abs(a);\n const _b = Math.abs(b);\n\n if (a === 0) {\n return Math.log(_b);\n }\n\n if (b === 0) {\n return Math.log(_a);\n }\n\n if (_a < 3000 && _b < 3000) {\n return Math.log(a * a + b * b) * 0.5;\n }\n\n /* I got 4 ideas to compute this property without overflow:\n *\n * Testing 1000000 times with random samples for a,b ∈ [1, 1000000000] against a big decimal library to get an error estimate\n *\n * 1. Only eliminate the square root: (OVERALL ERROR: 3.9122483030951116e-11)\n\n Math.log(a * a + b * b) / 2\n\n *\n *\n * 2. Try to use the non-overflowing pythagoras: (OVERALL ERROR: 8.889760039210159e-10)\n\n const fn = function(a, b) {\n a = Math.abs(a);\n b = Math.abs(b);\n let t = Math.min(a, b);\n a = Math.max(a, b);\n t = t / a;\n\n return Math.log(a) + Math.log(1 + t * t) / 2;\n };\n\n * 3. Abuse the identity cos(atan(y/x) = x / sqrt(x^2+y^2): (OVERALL ERROR: 3.4780178737037204e-10)\n\n Math.log(a / Math.cos(Math.atan2(b, a)))\n\n * 4. Use 3. and apply log rules: (OVERALL ERROR: 1.2014087502620896e-9)\n\n Math.log(a) - Math.log(Math.cos(Math.atan2(b, a)))\n\n */\n\n a = a * 0.5;\n b = b * 0.5;\n\n return 0.5 * Math.log(a * a + b * b) + Math.LN2;\n}\n\nconst P = { 're': 0, 'im': 0 };\nconst parse = function (a, b) {\n\n const z = P;\n\n if (a === undefined || a === null) {\n z['re'] =\n z['im'] = 0;\n } else if (b !== undefined) {\n z['re'] = a;\n z['im'] = b;\n } else\n switch (typeof a) {\n\n case 'object':\n\n if ('im' in a && 're' in a) {\n z['re'] = a['re'];\n z['im'] = a['im'];\n } else if ('abs' in a && 'arg' in a) {\n if (!isFinite(a['abs']) && isFinite(a['arg'])) {\n return Complex['INFINITY'];\n }\n z['re'] = a['abs'] * Math.cos(a['arg']);\n z['im'] = a['abs'] * Math.sin(a['arg']);\n } else if ('r' in a && 'phi' in a) {\n if (!isFinite(a['r']) && isFinite(a['phi'])) {\n return Complex['INFINITY'];\n }\n z['re'] = a['r'] * Math.cos(a['phi']);\n z['im'] = a['r'] * Math.sin(a['phi']);\n } else if (a.length === 2) { // Quick array check\n z['re'] = a[0];\n z['im'] = a[1];\n } else {\n parser_exit();\n }\n break;\n\n case 'string':\n\n z['im'] = /* void */\n z['re'] = 0;\n\n const tokens = a.replace(/_/g, '')\n .match(/\\d+\\.?\\d*e[+-]?\\d+|\\d+\\.?\\d*|\\.\\d+|./g);\n let plus = 1;\n let minus = 0;\n\n if (tokens === null) {\n parser_exit();\n }\n\n for (let i = 0; i < tokens.length; i++) {\n\n const c = tokens[i];\n\n if (c === ' ' || c === '\\t' || c === '\\n') {\n /* void */\n } else if (c === '+') {\n plus++;\n } else if (c === '-') {\n minus++;\n } else if (c === 'i' || c === 'I') {\n\n if (plus + minus === 0) {\n parser_exit();\n }\n\n if (tokens[i + 1] !== ' ' && !isNaN(tokens[i + 1])) {\n z['im'] += parseFloat((minus % 2 ? '-' : '') + tokens[i + 1]);\n i++;\n } else {\n z['im'] += parseFloat((minus % 2 ? '-' : '') + '1');\n }\n plus = minus = 0;\n\n } else {\n\n if (plus + minus === 0 || isNaN(c)) {\n parser_exit();\n }\n\n if (tokens[i + 1] === 'i' || tokens[i + 1] === 'I') {\n z['im'] += parseFloat((minus % 2 ? '-' : '') + c);\n i++;\n } else {\n z['re'] += parseFloat((minus % 2 ? '-' : '') + c);\n }\n plus = minus = 0;\n }\n }\n\n // Still something on the stack\n if (plus + minus > 0) {\n parser_exit();\n }\n break;\n\n case 'number':\n z['im'] = 0;\n z['re'] = a;\n break;\n\n default:\n parser_exit();\n }\n\n if (isNaN(z['re']) || isNaN(z['im'])) {\n // If a calculation is NaN, we treat it as NaN and don't throw\n //parser_exit();\n }\n\n return z;\n};\n\n/**\n * @constructor\n * @returns {Complex}\n */\nfunction Complex(a, b) {\n\n if (!(this instanceof Complex)) {\n return new Complex(a, b);\n }\n\n const z = parse(a, b);\n\n this['re'] = z['re'];\n this['im'] = z['im'];\n}\n\nComplex.prototype = {\n\n 're': 0,\n 'im': 0,\n\n /**\n * Calculates the sign of a complex number, which is a normalized complex\n *\n * @returns {Complex}\n */\n 'sign': function () {\n\n const abs = hypot(this['re'], this['im']);\n\n return new Complex(\n this['re'] / abs,\n this['im'] / abs);\n },\n\n /**\n * Adds two complex numbers\n *\n * @returns {Complex}\n */\n 'add': function (a, b) {\n\n const z = parse(a, b);\n\n const tInfin = this['isInfinite']();\n const zInfin = !(isFinite(z['re']) && isFinite(z['im']));\n\n if (tInfin || zInfin) {\n\n if (tInfin && zInfin) {\n // Infinity + Infinity = NaN\n return Complex['NAN'];\n }\n // Infinity + z = Infinity { where z != Infinity }\n return Complex['INFINITY'];\n }\n\n return new Complex(\n this['re'] + z['re'],\n this['im'] + z['im']);\n },\n\n /**\n * Subtracts two complex numbers\n *\n * @returns {Complex}\n */\n 'sub': function (a, b) {\n\n const z = parse(a, b);\n\n const tInfin = this['isInfinite']();\n const zInfin = !(isFinite(z['re']) && isFinite(z['im']));\n\n if (tInfin || zInfin) {\n\n if (tInfin && zInfin) {\n // Infinity - Infinity = NaN\n return Complex['NAN'];\n }\n // Infinity - z = Infinity { where z != Infinity }\n return Complex['INFINITY'];\n }\n\n return new Complex(\n this['re'] - z['re'],\n this['im'] - z['im']);\n },\n\n /**\n * Multiplies two complex numbers\n *\n * @returns {Complex}\n */\n 'mul': function (a, b) {\n\n const z = parse(a, b);\n\n const tInfin = this['isInfinite']();\n const zInfin = !(isFinite(z['re']) && isFinite(z['im']));\n const tIsZero = this['re'] === 0 && this['im'] === 0;\n const zIsZero = z['re'] === 0 && z['im'] === 0;\n\n // Infinity * 0 = NaN\n if (tInfin && zIsZero || zInfin && tIsZero) {\n return Complex['NAN'];\n }\n\n // Infinity * z = Infinity { where z != 0 }\n if (tInfin || zInfin) {\n return Complex['INFINITY'];\n }\n\n // Shortcut for real values\n if (z['im'] === 0 && this['im'] === 0) {\n return new Complex(this['re'] * z['re'], 0);\n }\n\n return new Complex(\n this['re'] * z['re'] - this['im'] * z['im'],\n this['re'] * z['im'] + this['im'] * z['re']);\n },\n\n /**\n * Divides two complex numbers\n *\n * @returns {Complex}\n */\n 'div': function (a, b) {\n\n const z = parse(a, b);\n\n const tInfin = this['isInfinite']();\n const zInfin = !(isFinite(z['re']) && isFinite(z['im']));\n const tIsZero = this['re'] === 0 && this['im'] === 0;\n const zIsZero = z['re'] === 0 && z['im'] === 0;\n\n // 0 / 0 = NaN and Infinity / Infinity = NaN\n if (tIsZero && zIsZero || tInfin && zInfin) {\n return Complex['NAN'];\n }\n\n // Infinity / 0 = Infinity\n if (zIsZero || tInfin) {\n return Complex['INFINITY'];\n }\n\n // 0 / Infinity = 0\n if (tIsZero || zInfin) {\n return Complex['ZERO'];\n }\n\n if (0 === z['im']) {\n // Divisor is real\n return new Complex(this['re'] / z['re'], this['im'] / z['re']);\n }\n\n if (Math.abs(z['re']) < Math.abs(z['im'])) {\n\n const x = z['re'] / z['im'];\n const t = z['re'] * x + z['im'];\n\n return new Complex(\n (this['re'] * x + this['im']) / t,\n (this['im'] * x - this['re']) / t);\n\n } else {\n\n const x = z['im'] / z['re'];\n const t = z['im'] * x + z['re'];\n\n return new Complex(\n (this['re'] + this['im'] * x) / t,\n (this['im'] - this['re'] * x) / t);\n }\n },\n\n /**\n * Calculate the power of two complex numbers\n *\n * @returns {Complex}\n */\n 'pow': function (a, b) {\n\n const z = parse(a, b);\n\n const tIsZero = this['re'] === 0 && this['im'] === 0;\n const zIsZero = z['re'] === 0 && z['im'] === 0;\n\n if (zIsZero) {\n return Complex['ONE'];\n }\n\n // If the exponent is real\n if (z['im'] === 0) {\n\n if (this['im'] === 0 && this['re'] > 0) {\n\n return new Complex(Math.pow(this['re'], z['re']), 0);\n\n } else if (this['re'] === 0) { // If base is fully imaginary\n\n switch ((z['re'] % 4 + 4) % 4) {\n case 0:\n return new Complex(Math.pow(this['im'], z['re']), 0);\n case 1:\n return new Complex(0, Math.pow(this['im'], z['re']));\n case 2:\n return new Complex(-Math.pow(this['im'], z['re']), 0);\n case 3:\n return new Complex(0, -Math.pow(this['im'], z['re']));\n }\n }\n }\n\n /* I couldn't find a good formula, so here is a derivation and optimization\n *\n * z_1^z_2 = (a + bi)^(c + di)\n * = exp((c + di) * log(a + bi)\n * = pow(a^2 + b^2, (c + di) / 2) * exp(i(c + di)atan2(b, a))\n * =>...\n * Re = (pow(a^2 + b^2, c / 2) * exp(-d * atan2(b, a))) * cos(d * log(a^2 + b^2) / 2 + c * atan2(b, a))\n * Im = (pow(a^2 + b^2, c / 2) * exp(-d * atan2(b, a))) * sin(d * log(a^2 + b^2) / 2 + c * atan2(b, a))\n *\n * =>...\n * Re = exp(c * log(sqrt(a^2 + b^2)) - d * atan2(b, a)) * cos(d * log(sqrt(a^2 + b^2)) + c * atan2(b, a))\n * Im = exp(c * log(sqrt(a^2 + b^2)) - d * atan2(b, a)) * sin(d * log(sqrt(a^2 + b^2)) + c * atan2(b, a))\n *\n * =>\n * Re = exp(c * logsq2 - d * arg(z_1)) * cos(d * logsq2 + c * arg(z_1))\n * Im = exp(c * logsq2 - d * arg(z_1)) * sin(d * logsq2 + c * arg(z_1))\n *\n */\n\n if (tIsZero && z['re'] > 0) { // Same behavior as Wolframalpha, Zero if real part is zero\n return Complex['ZERO'];\n }\n\n const arg = Math.atan2(this['im'], this['re']);\n const loh = logHypot(this['re'], this['im']);\n\n let re = Math.exp(z['re'] * loh - z['im'] * arg);\n let im = z['im'] * loh + z['re'] * arg;\n return new Complex(\n re * Math.cos(im),\n re * Math.sin(im));\n },\n\n /**\n * Calculate the complex square root\n *\n * @returns {Complex}\n */\n 'sqrt': function () {\n\n const a = this['re'];\n const b = this['im'];\n\n if (b === 0) {\n // Real number case\n if (a >= 0) {\n return new Complex(Math.sqrt(a), 0);\n } else {\n return new Complex(0, Math.sqrt(-a));\n }\n }\n\n const r = hypot(a, b);\n\n let re = Math.sqrt(0.5 * (r + Math.abs(a))); // sqrt(2x) / 2 = sqrt(x / 2)\n let im = Math.abs(b) / (2 * re);\n\n if (a >= 0) {\n return new Complex(re, b < 0 ? -im : im);\n } else {\n return new Complex(im, b < 0 ? -re : re);\n }\n },\n\n /**\n * Calculate the complex exponent\n *\n * @returns {Complex}\n */\n 'exp': function () {\n\n const er = Math.exp(this['re']);\n\n if (this['im'] === 0) {\n return new Complex(er, 0);\n }\n return new Complex(\n er * Math.cos(this['im']),\n er * Math.sin(this['im']));\n },\n\n /**\n * Calculate the complex exponent and subtracts one.\n *\n * This may be more accurate than `Complex(x).exp().sub(1)` if\n * `x` is small.\n *\n * @returns {Complex}\n */\n 'expm1': function () {\n\n /**\n * exp(a + i*b) - 1\n = exp(a) * (cos(b) + j*sin(b)) - 1\n = expm1(a)*cos(b) + cosm1(b) + j*exp(a)*sin(b)\n */\n\n const a = this['re'];\n const b = this['im'];\n\n return new Complex(\n Math.expm1(a) * Math.cos(b) + cosm1(b),\n Math.exp(a) * Math.sin(b));\n },\n\n /**\n * Calculate the natural log\n *\n * @returns {Complex}\n */\n 'log': function () {\n\n const a = this['re'];\n const b = this['im'];\n\n if (b === 0 && a > 0) {\n return new Complex(Math.log(a), 0);\n }\n\n return new Complex(\n logHypot(a, b),\n Math.atan2(b, a));\n },\n\n /**\n * Calculate the magnitude of the complex number\n *\n * @returns {number}\n */\n 'abs': function () {\n\n return hypot(this['re'], this['im']);\n },\n\n /**\n * Calculate the angle of the complex number\n *\n * @returns {number}\n */\n 'arg': function () {\n\n return Math.atan2(this['im'], this['re']);\n },\n\n /**\n * Calculate the sine of the complex number\n *\n * @returns {Complex}\n */\n 'sin': function () {\n\n // sin(z) = ( e^iz - e^-iz ) / 2i \n // = sin(a)cosh(b) + i cos(a)sinh(b)\n\n const a = this['re'];\n const b = this['im'];\n\n return new Complex(\n Math.sin(a) * cosh(b),\n Math.cos(a) * sinh(b));\n },\n\n /**\n * Calculate the cosine\n *\n * @returns {Complex}\n */\n 'cos': function () {\n\n // cos(z) = ( e^iz + e^-iz ) / 2 \n // = cos(a)cosh(b) - i sin(a)sinh(b)\n\n const a = this['re'];\n const b = this['im'];\n\n return new Complex(\n Math.cos(a) * cosh(b),\n -Math.sin(a) * sinh(b));\n },\n\n /**\n * Calculate the tangent\n *\n * @returns {Complex}\n */\n 'tan': function () {\n\n // tan(z) = sin(z) / cos(z) \n // = ( e^iz - e^-iz ) / ( i( e^iz + e^-iz ) )\n // = ( e^2iz - 1 ) / i( e^2iz + 1 )\n // = ( sin(2a) + i sinh(2b) ) / ( cos(2a) + cosh(2b) )\n\n const a = 2 * this['re'];\n const b = 2 * this['im'];\n const d = Math.cos(a) + cosh(b);\n\n return new Complex(\n Math.sin(a) / d,\n sinh(b) / d);\n },\n\n /**\n * Calculate the cotangent\n *\n * @returns {Complex}\n */\n 'cot': function () {\n\n // cot(c) = i(e^(ci) + e^(-ci)) / (e^(ci) - e^(-ci))\n\n const a = 2 * this['re'];\n const b = 2 * this['im'];\n const d = Math.cos(a) - cosh(b);\n\n return new Complex(\n -Math.sin(a) / d,\n sinh(b) / d);\n },\n\n /**\n * Calculate the secant\n *\n * @returns {Complex}\n */\n 'sec': function () {\n\n // sec(c) = 2 / (e^(ci) + e^(-ci))\n\n const a = this['re'];\n const b = this['im'];\n const d = 0.5 * cosh(2 * b) + 0.5 * Math.cos(2 * a);\n\n return new Complex(\n Math.cos(a) * cosh(b) / d,\n Math.sin(a) * sinh(b) / d);\n },\n\n /**\n * Calculate the cosecans\n *\n * @returns {Complex}\n */\n 'csc': function () {\n\n // csc(c) = 2i / (e^(ci) - e^(-ci))\n\n const a = this['re'];\n const b = this['im'];\n const d = 0.5 * cosh(2 * b) - 0.5 * Math.cos(2 * a);\n\n return new Complex(\n Math.sin(a) * cosh(b) / d,\n -Math.cos(a) * sinh(b) / d);\n },\n\n /**\n * Calculate the complex arcus sinus\n *\n * @returns {Complex}\n */\n 'asin': function () {\n\n // asin(c) = -i * log(ci + sqrt(1 - c^2))\n\n const a = this['re'];\n const b = this['im'];\n\n const t1 = new Complex(\n b * b - a * a + 1,\n -2 * a * b)['sqrt']();\n\n const t2 = new Complex(\n t1['re'] - b,\n t1['im'] + a)['log']();\n\n return new Complex(t2['im'], -t2['re']);\n },\n\n /**\n * Calculate the complex arcus cosinus\n *\n * @returns {Complex}\n */\n 'acos': function () {\n\n // acos(c) = i * log(c - i * sqrt(1 - c^2))\n\n const a = this['re'];\n const b = this['im'];\n\n const t1 = new Complex(\n b * b - a * a + 1,\n -2 * a * b)['sqrt']();\n\n const t2 = new Complex(\n t1['re'] - b,\n t1['im'] + a)['log']();\n\n return new Complex(Math.PI / 2 - t2['im'], t2['re']);\n },\n\n /**\n * Calculate the complex arcus tangent\n *\n * @returns {Complex}\n */\n 'atan': function () {\n\n // atan(c) = i / 2 log((i + x) / (i - x))\n\n const a = this['re'];\n const b = this['im'];\n\n if (a === 0) {\n\n if (b === 1) {\n return new Complex(0, Infinity);\n }\n\n if (b === -1) {\n return new Complex(0, -Infinity);\n }\n }\n\n const d = a * a + (1.0 - b) * (1.0 - b);\n\n const t1 = new Complex(\n (1 - b * b - a * a) / d,\n -2 * a / d).log();\n\n return new Complex(-0.5 * t1['im'], 0.5 * t1['re']);\n },\n\n /**\n * Calculate the complex arcus cotangent\n *\n * @returns {Complex}\n */\n 'acot': function () {\n\n // acot(c) = i / 2 log((c - i) / (c + i))\n\n const a = this['re'];\n const b = this['im'];\n\n if (b === 0) {\n return new Complex(Math.atan2(1, a), 0);\n }\n\n const d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a / d,\n -b / d).atan()\n : new Complex(\n (a !== 0) ? a / 0 : 0,\n (b !== 0) ? -b / 0 : 0).atan();\n },\n\n /**\n * Calculate the complex arcus secant\n *\n * @returns {Complex}\n */\n 'asec': function () {\n\n // asec(c) = -i * log(1 / c + sqrt(1 - i / c^2))\n\n const a = this['re'];\n const b = this['im'];\n\n if (a === 0 && b === 0) {\n return new Complex(0, Infinity);\n }\n\n const d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a / d,\n -b / d).acos()\n : new Complex(\n (a !== 0) ? a / 0 : 0,\n (b !== 0) ? -b / 0 : 0).acos();\n },\n\n /**\n * Calculate the complex arcus cosecans\n *\n * @returns {Complex}\n */\n 'acsc': function () {\n\n // acsc(c) = -i * log(i / c + sqrt(1 - 1 / c^2))\n\n const a = this['re'];\n const b = this['im'];\n\n if (a === 0 && b === 0) {\n return new Complex(Math.PI / 2, Infinity);\n }\n\n const d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a / d,\n -b / d).asin()\n : new Complex(\n (a !== 0) ? a / 0 : 0,\n (b !== 0) ? -b / 0 : 0).asin();\n },\n\n /**\n * Calculate the complex sinh\n *\n * @returns {Complex}\n */\n 'sinh': function () {\n\n // sinh(c) = (e^c - e^-c) / 2\n\n const a = this['re'];\n const b = this['im'];\n\n return new Complex(\n sinh(a) * Math.cos(b),\n cosh(a) * Math.sin(b));\n },\n\n /**\n * Calculate the complex cosh\n *\n * @returns {Complex}\n */\n 'cosh': function () {\n\n // cosh(c) = (e^c + e^-c) / 2\n\n const a = this['re'];\n const b = this['im'];\n\n return new Complex(\n cosh(a) * Math.cos(b),\n sinh(a) * Math.sin(b));\n },\n\n /**\n * Calculate the complex tanh\n *\n * @returns {Complex}\n */\n 'tanh': function () {\n\n // tanh(c) = (e^c - e^-c) / (e^c + e^-c)\n\n const a = 2 * this['re'];\n const b = 2 * this['im'];\n const d = cosh(a) + Math.cos(b);\n\n return new Complex(\n sinh(a) / d,\n Math.sin(b) / d);\n },\n\n /**\n * Calculate the complex coth\n *\n * @returns {Complex}\n */\n 'coth': function () {\n\n // coth(c) = (e^c + e^-c) / (e^c - e^-c)\n\n const a = 2 * this['re'];\n const b = 2 * this['im'];\n const d = cosh(a) - Math.cos(b);\n\n return new Complex(\n sinh(a) / d,\n -Math.sin(b) / d);\n },\n\n /**\n * Calculate the complex coth\n *\n * @returns {Complex}\n */\n 'csch': function () {\n\n // csch(c) = 2 / (e^c - e^-c)\n\n const a = this['re'];\n const b = this['im'];\n const d = Math.cos(2 * b) - cosh(2 * a);\n\n return new Complex(\n -2 * sinh(a) * Math.cos(b) / d,\n 2 * cosh(a) * Math.sin(b) / d);\n },\n\n /**\n * Calculate the complex sech\n *\n * @returns {Complex}\n */\n 'sech': function () {\n\n // sech(c) = 2 / (e^c + e^-c)\n\n const a = this['re'];\n const b = this['im'];\n const d = Math.cos(2 * b) + cosh(2 * a);\n\n return new Complex(\n 2 * cosh(a) * Math.cos(b) / d,\n -2 * sinh(a) * Math.sin(b) / d);\n },\n\n /**\n * Calculate the complex asinh\n *\n * @returns {Complex}\n */\n 'asinh': function () {\n\n // asinh(c) = log(c + sqrt(c^2 + 1))\n\n let tmp = this['im'];\n this['im'] = -this['re'];\n this['re'] = tmp;\n const res = this['asin']();\n\n this['re'] = -this['im'];\n this['im'] = tmp;\n tmp = res['re'];\n\n res['re'] = -res['im'];\n res['im'] = tmp;\n return res;\n },\n\n /**\n * Calculate the complex acosh\n *\n * @returns {Complex}\n */\n 'acosh': function () {\n\n // acosh(c) = log(c + sqrt(c^2 - 1))\n\n const res = this['acos']();\n if (res['im'] <= 0) {\n const tmp = res['re'];\n res['re'] = -res['im'];\n res['im'] = tmp;\n } else {\n const tmp = res['im'];\n res['im'] = -res['re'];\n res['re'] = tmp;\n }\n return res;\n },\n\n /**\n * Calculate the complex atanh\n *\n * @returns {Complex}\n */\n 'atanh': function () {\n\n // atanh(c) = log((1+c) / (1-c)) / 2\n\n const a = this['re'];\n const b = this['im'];\n\n const noIM = a > 1 && b === 0;\n const oneMinus = 1 - a;\n const onePlus = 1 + a;\n const d = oneMinus * oneMinus + b * b;\n\n const x = (d !== 0)\n ? new Complex(\n (onePlus * oneMinus - b * b) / d,\n (b * oneMinus + onePlus * b) / d)\n : new Complex(\n (a !== -1) ? (a / 0) : 0,\n (b !== 0) ? (b / 0) : 0);\n\n const temp = x['re'];\n x['re'] = logHypot(x['re'], x['im']) / 2;\n x['im'] = Math.atan2(x['im'], temp) / 2;\n if (noIM) {\n x['im'] = -x['im'];\n }\n return x;\n },\n\n /**\n * Calculate the complex acoth\n *\n * @returns {Complex}\n */\n 'acoth': function () {\n\n // acoth(c) = log((c+1) / (c-1)) / 2\n\n const a = this['re'];\n const b = this['im'];\n\n if (a === 0 && b === 0) {\n return new Complex(0, Math.PI / 2);\n }\n\n const d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a / d,\n -b / d).atanh()\n : new Complex(\n (a !== 0) ? a / 0 : 0,\n (b !== 0) ? -b / 0 : 0).atanh();\n },\n\n /**\n * Calculate the complex acsch\n *\n * @returns {Complex}\n */\n 'acsch': function () {\n\n // acsch(c) = log((1+sqrt(1+c^2))/c)\n\n const a = this['re'];\n const b = this['im'];\n\n if (b === 0) {\n\n return new Complex(\n (a !== 0)\n ? Math.log(a + Math.sqrt(a * a + 1))\n : Infinity, 0);\n }\n\n const d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a / d,\n -b / d).asinh()\n : new Complex(\n (a !== 0) ? a / 0 : 0,\n (b !== 0) ? -b / 0 : 0).asinh();\n },\n\n /**\n * Calculate the complex asech\n *\n * @returns {Complex}\n */\n 'asech': function () {\n\n // asech(c) = log((1+sqrt(1-c^2))/c)\n\n const a = this['re'];\n const b = this['im'];\n\n if (this['isZero']()) {\n return Complex['INFINITY'];\n }\n\n const d = a * a + b * b;\n return (d !== 0)\n ? new Complex(\n a / d,\n -b / d).acosh()\n : new Complex(\n (a !== 0) ? a / 0 : 0,\n (b !== 0) ? -b / 0 : 0).acosh();\n },\n\n /**\n * Calculate the complex inverse 1/z\n *\n * @returns {Complex}\n */\n 'inverse': function () {\n\n // 1 / 0 = Infinity and 1 / Infinity = 0\n if (this['isZero']()) {\n return Complex['INFINITY'];\n }\n\n if (this['isInfinite']()) {\n return Complex['ZERO'];\n }\n\n const a = this['re'];\n const b = this['im'];\n\n const d = a * a + b * b;\n\n return new Complex(a / d, -b / d);\n },\n\n /**\n * Returns the complex conjugate\n *\n * @returns {Complex}\n */\n 'conjugate': function () {\n\n return new Complex(this['re'], -this['im']);\n },\n\n /**\n * Gets the negated complex number\n *\n * @returns {Complex}\n */\n 'neg': function () {\n\n return new Complex(-this['re'], -this['im']);\n },\n\n /**\n * Ceils the actual complex number\n *\n * @returns {Complex}\n */\n 'ceil': function (places) {\n\n places = Math.pow(10, places || 0);\n\n return new Complex(\n Math.ceil(this['re'] * places) / places,\n Math.ceil(this['im'] * places) / places);\n },\n\n /**\n * Floors the actual complex number\n *\n * @returns {Complex}\n */\n 'floor': function (places) {\n\n places = Math.pow(10, places || 0);\n\n return new Complex(\n Math.floor(this['re'] * places) / places,\n Math.floor(this['im'] * places) / places);\n },\n\n /**\n * Ceils the actual complex number\n *\n * @returns {Complex}\n */\n 'round': function (places) {\n\n places = Math.pow(10, places || 0);\n\n return new Complex(\n Math.round(this['re'] * places) / places,\n Math.round(this['im'] * places) / places);\n },\n\n /**\n * Compares two complex numbers\n *\n * **Note:** new Complex(Infinity).equals(Infinity) === false\n *\n * @returns {boolean}\n */\n 'equals': function (a, b) {\n\n const z = parse(a, b);\n\n return Math.abs(z['re'] - this['re']) <= Complex['EPSILON'] &&\n Math.abs(z['im'] - this['im']) <= Complex['EPSILON'];\n },\n\n /**\n * Clones the actual object\n *\n * @returns {Complex}\n */\n 'clone': function () {\n\n return new Complex(this['re'], this['im']);\n },\n\n /**\n * Gets a string of the actual complex number\n *\n * @returns {string}\n */\n 'toString': function () {\n\n let a = this['re'];\n let b = this['im'];\n let ret = \"\";\n\n if (this['isNaN']()) {\n return 'NaN';\n }\n\n if (this['isInfinite']()) {\n return 'Infinity';\n }\n\n if (Math.abs(a) < Complex['EPSILON']) {\n a = 0;\n }\n\n if (Math.abs(b) < Complex['EPSILON']) {\n b = 0;\n }\n\n // If is real number\n if (b === 0) {\n return ret + a;\n }\n\n if (a !== 0) {\n ret += a;\n ret += \" \";\n if (b < 0) {\n b = -b;\n ret += \"-\";\n } else {\n ret += \"+\";\n }\n ret += \" \";\n } else if (b < 0) {\n b = -b;\n ret += \"-\";\n }\n\n if (1 !== b) { // b is the absolute imaginary part\n ret += b;\n }\n return ret + \"i\";\n },\n\n /**\n * Returns the actual number as a vector\n *\n * @returns {Array}\n */\n 'toVector': function () {\n\n return [this['re'], this['im']];\n },\n\n /**\n * Returns the actual real value of the current object\n *\n * @returns {number|null}\n */\n 'valueOf': function () {\n\n if (this['im'] === 0) {\n return this['re'];\n }\n return null;\n },\n\n /**\n * Determines whether a complex number is not on the Riemann sphere.\n *\n * @returns {boolean}\n */\n 'isNaN': function () {\n return isNaN(this['re']) || isNaN(this['im']);\n },\n\n /**\n * Determines whether or not a complex number is at the zero pole of the\n * Riemann sphere.\n *\n * @returns {boolean}\n */\n 'isZero': function () {\n return this['im'] === 0 && this['re'] === 0;\n },\n\n /**\n * Determines whether a complex number is not at the infinity pole of the\n * Riemann sphere.\n *\n * @returns {boolean}\n */\n 'isFinite': function () {\n return isFinite(this['re']) && isFinite(this['im']);\n },\n\n /**\n * Determines whether or not a complex number is at the infinity pole of the\n * Riemann sphere.\n *\n * @returns {boolean}\n */\n 'isInfinite': function () {\n return !this['isFinite']();\n }\n};\n\nComplex['ZERO'] = new Complex(0, 0);\nComplex['ONE'] = new Complex(1, 0);\nComplex['I'] = new Complex(0, 1);\nComplex['PI'] = new Complex(Math.PI, 0);\nComplex['E'] = new Complex(Math.E, 0);\nComplex['INFINITY'] = new Complex(Infinity, Infinity);\nComplex['NAN'] = new Complex(NaN, NaN);\nComplex['EPSILON'] = 1e-15;\nexport {\n Complex as default, Complex\n};\n","import Complex from 'complex.js'\nimport { format } from '../../utils/number.js'\nimport { isNumber, isUnit } from '../../utils/is.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'Complex'\nconst dependencies = []\n\nexport const createComplexClass = /* #__PURE__ */ factory(name, dependencies, () => {\n /**\n * Attach type information\n */\n Object.defineProperty(Complex, 'name', { value: 'Complex' })\n Complex.prototype.constructor = Complex\n Complex.prototype.type = 'Complex'\n Complex.prototype.isComplex = true\n\n /**\n * Get a JSON representation of the complex number\n * @returns {Object} Returns a JSON object structured as:\n * `{\"mathjs\": \"Complex\", \"re\": 2, \"im\": 3}`\n */\n Complex.prototype.toJSON = function () {\n return {\n mathjs: 'Complex',\n re: this.re,\n im: this.im\n }\n }\n\n /*\n * Return the value of the complex number in polar notation\n * The angle phi will be set in the interval of [-pi, pi].\n * @return {{r: number, phi: number}} Returns and object with properties r and phi.\n */\n Complex.prototype.toPolar = function () {\n return {\n r: this.abs(),\n phi: this.arg()\n }\n }\n\n /**\n * Get a string representation of the complex number,\n * with optional formatting options.\n * @param {Object | number | Function} [options] Formatting options. See\n * lib/utils/number:format for a\n * description of the available\n * options.\n * @return {string} str\n */\n Complex.prototype.format = function (options) {\n let str = ''\n let im = this.im\n let re = this.re\n const strRe = format(this.re, options)\n const strIm = format(this.im, options)\n\n // round either re or im when smaller than the configured precision\n const precision = isNumber(options) ? options : options ? options.precision : null\n if (precision !== null) {\n const epsilon = Math.pow(10, -precision)\n if (Math.abs(re / im) < epsilon) {\n re = 0\n }\n if (Math.abs(im / re) < epsilon) {\n im = 0\n }\n }\n\n if (im === 0) {\n // real value\n str = strRe\n } else if (re === 0) {\n // purely complex value\n if (im === 1) {\n str = 'i'\n } else if (im === -1) {\n str = '-i'\n } else {\n str = strIm + 'i'\n }\n } else {\n // complex value\n if (im < 0) {\n if (im === -1) {\n str = strRe + ' - i'\n } else {\n str = strRe + ' - ' + strIm.substring(1) + 'i'\n }\n } else {\n if (im === 1) {\n str = strRe + ' + i'\n } else {\n str = strRe + ' + ' + strIm + 'i'\n }\n }\n }\n return str\n }\n\n /**\n * Create a complex number from polar coordinates\n *\n * Usage:\n *\n * Complex.fromPolar(r: number, phi: number) : Complex\n * Complex.fromPolar({r: number, phi: number}) : Complex\n *\n * @param {*} args...\n * @return {Complex}\n */\n Complex.fromPolar = function (args) {\n switch (arguments.length) {\n case 1:\n {\n const arg = arguments[0]\n if (typeof arg === 'object') {\n return Complex(arg)\n } else {\n throw new TypeError('Input has to be an object with r and phi keys.')\n }\n }\n case 2:\n {\n const r = arguments[0]\n let phi = arguments[1]\n if (isNumber(r)) {\n if (isUnit(phi) && phi.hasBase('ANGLE')) {\n // convert unit to a number in radians\n phi = phi.toNumber('rad')\n }\n\n if (isNumber(phi)) {\n return new Complex({ r, phi })\n }\n\n throw new TypeError('Phi is not a number nor an angle unit.')\n } else {\n throw new TypeError('Radius r is not a number.')\n }\n }\n\n default:\n throw new SyntaxError('Wrong number of arguments in function fromPolar')\n }\n }\n\n Complex.prototype.valueOf = Complex.prototype.toString\n\n /**\n * Create a Complex number from a JSON object\n * @param {Object} json A JSON Object structured as\n * {\"mathjs\": \"Complex\", \"re\": 2, \"im\": 3}\n * All properties are optional, default values\n * for `re` and `im` are 0.\n * @return {Complex} Returns a new Complex number\n */\n Complex.fromJSON = function (json) {\n return new Complex(json)\n }\n\n /**\n * Compare two complex numbers, `a` and `b`:\n *\n * - Returns 1 when the real part of `a` is larger than the real part of `b`\n * - Returns -1 when the real part of `a` is smaller than the real part of `b`\n * - Returns 1 when the real parts are equal\n * and the imaginary part of `a` is larger than the imaginary part of `b`\n * - Returns -1 when the real parts are equal\n * and the imaginary part of `a` is smaller than the imaginary part of `b`\n * - Returns 0 when both real and imaginary parts are equal.\n *\n * @params {Complex} a\n * @params {Complex} b\n * @returns {number} Returns the comparison result: -1, 0, or 1\n */\n Complex.compare = function (a, b) {\n if (a.re > b.re) { return 1 }\n if (a.re < b.re) { return -1 }\n\n if (a.im > b.im) { return 1 }\n if (a.im < b.im) { return -1 }\n\n return 0\n }\n\n return Complex\n}, { isClass: true })\n","'use strict';\n\n/**\n *\n * This class offers the possibility to calculate fractions.\n * You can pass a fraction in different formats. Either as array, as double, as string or as an integer.\n *\n * Array/Object form\n * [ 0 => , 1 => ]\n * { n => , d => }\n *\n * Integer form\n * - Single integer value as BigInt or Number\n *\n * Double form\n * - Single double value as Number\n *\n * String form\n * 123.456 - a simple double\n * 123/456 - a string fraction\n * 123.'456' - a double with repeating decimal places\n * 123.(456) - synonym\n * 123.45'6' - a double with repeating last place\n * 123.45(6) - synonym\n *\n * Example:\n * let f = new Fraction(\"9.4'31'\");\n * f.mul([-4, 3]).div(4.9);\n *\n */\n\n// Set Identity function to downgrade BigInt to Number if needed\nif (typeof BigInt === 'undefined') BigInt = function (n) { if (isNaN(n)) throw new Error(\"\"); return n; };\n\nconst C_ZERO = BigInt(0);\nconst C_ONE = BigInt(1);\nconst C_TWO = BigInt(2);\nconst C_FIVE = BigInt(5);\nconst C_TEN = BigInt(10);\n\n// Maximum search depth for cyclic rational numbers. 2000 should be more than enough.\n// Example: 1/7 = 0.(142857) has 6 repeating decimal places.\n// If MAX_CYCLE_LEN gets reduced, long cycles will not be detected and toString() only gets the first 10 digits\nconst MAX_CYCLE_LEN = 2000;\n\n// Parsed data to avoid calling \"new\" all the time\nconst P = {\n \"s\": C_ONE,\n \"n\": C_ZERO,\n \"d\": C_ONE\n};\n\nfunction assign(n, s) {\n\n try {\n n = BigInt(n);\n } catch (e) {\n throw InvalidParameter();\n }\n return n * s;\n}\n\nfunction trunc(x) {\n return typeof x === 'bigint' ? x : Math.floor(x);\n}\n\n// Creates a new Fraction internally without the need of the bulky constructor\nfunction newFraction(n, d) {\n\n if (d === C_ZERO) {\n throw DivisionByZero();\n }\n\n const f = Object.create(Fraction.prototype);\n f[\"s\"] = n < C_ZERO ? -C_ONE : C_ONE;\n\n n = n < C_ZERO ? -n : n;\n\n const a = gcd(n, d);\n\n f[\"n\"] = n / a;\n f[\"d\"] = d / a;\n return f;\n}\n\nfunction factorize(num) {\n\n const factors = {};\n\n let n = num;\n let i = C_TWO;\n let s = C_FIVE - C_ONE;\n\n while (s <= n) {\n\n while (n % i === C_ZERO) {\n n /= i;\n factors[i] = (factors[i] || C_ZERO) + C_ONE;\n }\n s += C_ONE + C_TWO * i++;\n }\n\n if (n !== num) {\n if (n > 1)\n factors[n] = (factors[n] || C_ZERO) + C_ONE;\n } else {\n factors[num] = (factors[num] || C_ZERO) + C_ONE;\n }\n return factors;\n}\n\nconst parse = function (p1, p2) {\n\n let n = C_ZERO, d = C_ONE, s = C_ONE;\n\n if (p1 === undefined || p1 === null) { // No argument\n /* void */\n } else if (p2 !== undefined) { // Two arguments\n\n if (typeof p1 === \"bigint\") {\n n = p1;\n } else if (isNaN(p1)) {\n throw InvalidParameter();\n } else if (p1 % 1 !== 0) {\n throw NonIntegerParameter();\n } else {\n n = BigInt(p1);\n }\n\n if (typeof p2 === \"bigint\") {\n d = p2;\n } else if (isNaN(p2)) {\n throw InvalidParameter();\n } else if (p2 % 1 !== 0) {\n throw NonIntegerParameter();\n } else {\n d = BigInt(p2);\n }\n\n s = n * d;\n\n } else if (typeof p1 === \"object\") {\n if (\"d\" in p1 && \"n\" in p1) {\n n = BigInt(p1[\"n\"]);\n d = BigInt(p1[\"d\"]);\n if (\"s\" in p1)\n n *= BigInt(p1[\"s\"]);\n } else if (0 in p1) {\n n = BigInt(p1[0]);\n if (1 in p1)\n d = BigInt(p1[1]);\n } else if (typeof p1 === \"bigint\") {\n n = p1;\n } else {\n throw InvalidParameter();\n }\n s = n * d;\n } else if (typeof p1 === \"number\") {\n\n if (isNaN(p1)) {\n throw InvalidParameter();\n }\n\n if (p1 < 0) {\n s = -C_ONE;\n p1 = -p1;\n }\n\n if (p1 % 1 === 0) {\n n = BigInt(p1);\n } else {\n\n let z = 1;\n\n let A = 0, B = 1;\n let C = 1, D = 1;\n\n let N = 10000000;\n\n if (p1 >= 1) {\n z = 10 ** Math.floor(1 + Math.log10(p1));\n p1 /= z;\n }\n\n // Using Farey Sequences\n\n while (B <= N && D <= N) {\n let M = (A + C) / (B + D);\n\n if (p1 === M) {\n if (B + D <= N) {\n n = A + C;\n d = B + D;\n } else if (D > B) {\n n = C;\n d = D;\n } else {\n n = A;\n d = B;\n }\n break;\n\n } else {\n\n if (p1 > M) {\n A += C;\n B += D;\n } else {\n C += A;\n D += B;\n }\n\n if (B > N) {\n n = C;\n d = D;\n } else {\n n = A;\n d = B;\n }\n }\n }\n n = BigInt(n) * BigInt(z);\n d = BigInt(d);\n }\n\n } else if (typeof p1 === \"string\") {\n\n let ndx = 0;\n\n let v = C_ZERO, w = C_ZERO, x = C_ZERO, y = C_ONE, z = C_ONE;\n\n let match = p1.replace(/_/g, '').match(/\\d+|./g);\n\n if (match === null)\n throw InvalidParameter();\n\n if (match[ndx] === '-') {// Check for minus sign at the beginning\n s = -C_ONE;\n ndx++;\n } else if (match[ndx] === '+') {// Check for plus sign at the beginning\n ndx++;\n }\n\n if (match.length === ndx + 1) { // Check if it's just a simple number \"1234\"\n w = assign(match[ndx++], s);\n } else if (match[ndx + 1] === '.' || match[ndx] === '.') { // Check if it's a decimal number\n\n if (match[ndx] !== '.') { // Handle 0.5 and .5\n v = assign(match[ndx++], s);\n }\n ndx++;\n\n // Check for decimal places\n if (ndx + 1 === match.length || match[ndx + 1] === '(' && match[ndx + 3] === ')' || match[ndx + 1] === \"'\" && match[ndx + 3] === \"'\") {\n w = assign(match[ndx], s);\n y = C_TEN ** BigInt(match[ndx].length);\n ndx++;\n }\n\n // Check for repeating places\n if (match[ndx] === '(' && match[ndx + 2] === ')' || match[ndx] === \"'\" && match[ndx + 2] === \"'\") {\n x = assign(match[ndx + 1], s);\n z = C_TEN ** BigInt(match[ndx + 1].length) - C_ONE;\n ndx += 3;\n }\n\n } else if (match[ndx + 1] === '/' || match[ndx + 1] === ':') { // Check for a simple fraction \"123/456\" or \"123:456\"\n w = assign(match[ndx], s);\n y = assign(match[ndx + 2], C_ONE);\n ndx += 3;\n } else if (match[ndx + 3] === '/' && match[ndx + 1] === ' ') { // Check for a complex fraction \"123 1/2\"\n v = assign(match[ndx], s);\n w = assign(match[ndx + 2], s);\n y = assign(match[ndx + 4], C_ONE);\n ndx += 5;\n }\n\n if (match.length <= ndx) { // Check for more tokens on the stack\n d = y * z;\n s = /* void */\n n = x + d * v + z * w;\n } else {\n throw InvalidParameter();\n }\n\n } else if (typeof p1 === \"bigint\") {\n n = p1;\n s = p1;\n d = C_ONE;\n } else {\n throw InvalidParameter();\n }\n\n if (d === C_ZERO) {\n throw DivisionByZero();\n }\n\n P[\"s\"] = s < C_ZERO ? -C_ONE : C_ONE;\n P[\"n\"] = n < C_ZERO ? -n : n;\n P[\"d\"] = d < C_ZERO ? -d : d;\n};\n\nfunction modpow(b, e, m) {\n\n let r = C_ONE;\n for (; e > C_ZERO; b = (b * b) % m, e >>= C_ONE) {\n\n if (e & C_ONE) {\n r = (r * b) % m;\n }\n }\n return r;\n}\n\nfunction cycleLen(n, d) {\n\n for (; d % C_TWO === C_ZERO;\n d /= C_TWO) {\n }\n\n for (; d % C_FIVE === C_ZERO;\n d /= C_FIVE) {\n }\n\n if (d === C_ONE) // Catch non-cyclic numbers\n return C_ZERO;\n\n // If we would like to compute really large numbers quicker, we could make use of Fermat's little theorem:\n // 10^(d-1) % d == 1\n // However, we don't need such large numbers and MAX_CYCLE_LEN should be the capstone,\n // as we want to translate the numbers to strings.\n\n let rem = C_TEN % d;\n let t = 1;\n\n for (; rem !== C_ONE; t++) {\n rem = rem * C_TEN % d;\n\n if (t > MAX_CYCLE_LEN)\n return C_ZERO; // Returning 0 here means that we don't print it as a cyclic number. It's likely that the answer is `d-1`\n }\n return BigInt(t);\n}\n\nfunction cycleStart(n, d, len) {\n\n let rem1 = C_ONE;\n let rem2 = modpow(C_TEN, len, d);\n\n for (let t = 0; t < 300; t++) { // s < ~log10(Number.MAX_VALUE)\n // Solve 10^s == 10^(s+t) (mod d)\n\n if (rem1 === rem2)\n return BigInt(t);\n\n rem1 = rem1 * C_TEN % d;\n rem2 = rem2 * C_TEN % d;\n }\n return 0;\n}\n\nfunction gcd(a, b) {\n\n if (!a)\n return b;\n if (!b)\n return a;\n\n while (1) {\n a %= b;\n if (!a)\n return b;\n b %= a;\n if (!b)\n return a;\n }\n}\n\n/**\n * Module constructor\n *\n * @constructor\n * @param {number|Fraction=} a\n * @param {number=} b\n */\nfunction Fraction(a, b) {\n\n parse(a, b);\n\n if (this instanceof Fraction) {\n a = gcd(P[\"d\"], P[\"n\"]); // Abuse a\n this[\"s\"] = P[\"s\"];\n this[\"n\"] = P[\"n\"] / a;\n this[\"d\"] = P[\"d\"] / a;\n } else {\n return newFraction(P['s'] * P['n'], P['d']);\n }\n}\n\nvar DivisionByZero = function () { return new Error(\"Division by Zero\"); };\nvar InvalidParameter = function () { return new Error(\"Invalid argument\"); };\nvar NonIntegerParameter = function () { return new Error(\"Parameters must be integer\"); };\n\nFraction.prototype = {\n\n \"s\": C_ONE,\n \"n\": C_ZERO,\n \"d\": C_ONE,\n\n /**\n * Calculates the absolute value\n *\n * Ex: new Fraction(-4).abs() => 4\n **/\n \"abs\": function () {\n\n return newFraction(this[\"n\"], this[\"d\"]);\n },\n\n /**\n * Inverts the sign of the current fraction\n *\n * Ex: new Fraction(-4).neg() => 4\n **/\n \"neg\": function () {\n\n return newFraction(-this[\"s\"] * this[\"n\"], this[\"d\"]);\n },\n\n /**\n * Adds two rational numbers\n *\n * Ex: new Fraction({n: 2, d: 3}).add(\"14.9\") => 467 / 30\n **/\n \"add\": function (a, b) {\n\n parse(a, b);\n return newFraction(\n this[\"s\"] * this[\"n\"] * P[\"d\"] + P[\"s\"] * this[\"d\"] * P[\"n\"],\n this[\"d\"] * P[\"d\"]\n );\n },\n\n /**\n * Subtracts two rational numbers\n *\n * Ex: new Fraction({n: 2, d: 3}).add(\"14.9\") => -427 / 30\n **/\n \"sub\": function (a, b) {\n\n parse(a, b);\n return newFraction(\n this[\"s\"] * this[\"n\"] * P[\"d\"] - P[\"s\"] * this[\"d\"] * P[\"n\"],\n this[\"d\"] * P[\"d\"]\n );\n },\n\n /**\n * Multiplies two rational numbers\n *\n * Ex: new Fraction(\"-17.(345)\").mul(3) => 5776 / 111\n **/\n \"mul\": function (a, b) {\n\n parse(a, b);\n return newFraction(\n this[\"s\"] * P[\"s\"] * this[\"n\"] * P[\"n\"],\n this[\"d\"] * P[\"d\"]\n );\n },\n\n /**\n * Divides two rational numbers\n *\n * Ex: new Fraction(\"-17.(345)\").inverse().div(3)\n **/\n \"div\": function (a, b) {\n\n parse(a, b);\n return newFraction(\n this[\"s\"] * P[\"s\"] * this[\"n\"] * P[\"d\"],\n this[\"d\"] * P[\"n\"]\n );\n },\n\n /**\n * Clones the actual object\n *\n * Ex: new Fraction(\"-17.(345)\").clone()\n **/\n \"clone\": function () {\n return newFraction(this['s'] * this['n'], this['d']);\n },\n\n /**\n * Calculates the modulo of two rational numbers - a more precise fmod\n *\n * Ex: new Fraction('4.(3)').mod([7, 8]) => (13/3) % (7/8) = (5/6)\n * Ex: new Fraction(20, 10).mod().equals(0) ? \"is Integer\"\n **/\n \"mod\": function (a, b) {\n\n if (a === undefined) {\n return newFraction(this[\"s\"] * this[\"n\"] % this[\"d\"], C_ONE);\n }\n\n parse(a, b);\n if (C_ZERO === P[\"n\"] * this[\"d\"]) {\n throw DivisionByZero();\n }\n\n /**\n * I derived the rational modulo similar to the modulo for integers\n *\n * https://raw.org/book/analysis/rational-numbers/\n *\n * n1/d1 = (n2/d2) * q + r, where 0 ≤ r < n2/d2\n * => d2 * n1 = n2 * d1 * q + d1 * d2 * r\n * => r = (d2 * n1 - n2 * d1 * q) / (d1 * d2)\n * = (d2 * n1 - n2 * d1 * floor((d2 * n1) / (n2 * d1))) / (d1 * d2)\n * = ((d2 * n1) % (n2 * d1)) / (d1 * d2)\n */\n return newFraction(\n this[\"s\"] * (P[\"d\"] * this[\"n\"]) % (P[\"n\"] * this[\"d\"]),\n P[\"d\"] * this[\"d\"]);\n },\n\n /**\n * Calculates the fractional gcd of two rational numbers\n *\n * Ex: new Fraction(5,8).gcd(3,7) => 1/56\n */\n \"gcd\": function (a, b) {\n\n parse(a, b);\n\n // https://raw.org/book/analysis/rational-numbers/\n // gcd(a / b, c / d) = gcd(a, c) / lcm(b, d)\n\n return newFraction(gcd(P[\"n\"], this[\"n\"]) * gcd(P[\"d\"], this[\"d\"]), P[\"d\"] * this[\"d\"]);\n },\n\n /**\n * Calculates the fractional lcm of two rational numbers\n *\n * Ex: new Fraction(5,8).lcm(3,7) => 15\n */\n \"lcm\": function (a, b) {\n\n parse(a, b);\n\n // https://raw.org/book/analysis/rational-numbers/\n // lcm(a / b, c / d) = lcm(a, c) / gcd(b, d)\n\n if (P[\"n\"] === C_ZERO && this[\"n\"] === C_ZERO) {\n return newFraction(C_ZERO, C_ONE);\n }\n return newFraction(P[\"n\"] * this[\"n\"], gcd(P[\"n\"], this[\"n\"]) * gcd(P[\"d\"], this[\"d\"]));\n },\n\n /**\n * Gets the inverse of the fraction, means numerator and denominator are exchanged\n *\n * Ex: new Fraction([-3, 4]).inverse() => -4 / 3\n **/\n \"inverse\": function () {\n return newFraction(this[\"s\"] * this[\"d\"], this[\"n\"]);\n },\n\n /**\n * Calculates the fraction to some integer exponent\n *\n * Ex: new Fraction(-1,2).pow(-3) => -8\n */\n \"pow\": function (a, b) {\n\n parse(a, b);\n\n // Trivial case when exp is an integer\n\n if (P['d'] === C_ONE) {\n\n if (P['s'] < C_ZERO) {\n return newFraction((this['s'] * this[\"d\"]) ** P['n'], this[\"n\"] ** P['n']);\n } else {\n return newFraction((this['s'] * this[\"n\"]) ** P['n'], this[\"d\"] ** P['n']);\n }\n }\n\n // Negative roots become complex\n // (-a/b)^(c/d) = x\n // ⇔ (-1)^(c/d) * (a/b)^(c/d) = x\n // ⇔ (cos(pi) + i*sin(pi))^(c/d) * (a/b)^(c/d) = x\n // ⇔ (cos(c*pi/d) + i*sin(c*pi/d)) * (a/b)^(c/d) = x # DeMoivre's formula\n // From which follows that only for c=0 the root is non-complex\n if (this['s'] < C_ZERO) return null;\n\n // Now prime factor n and d\n let N = factorize(this['n']);\n let D = factorize(this['d']);\n\n // Exponentiate and take root for n and d individually\n let n = C_ONE;\n let d = C_ONE;\n for (let k in N) {\n if (k === '1') continue;\n if (k === '0') {\n n = C_ZERO;\n break;\n }\n N[k] *= P['n'];\n\n if (N[k] % P['d'] === C_ZERO) {\n N[k] /= P['d'];\n } else return null;\n n *= BigInt(k) ** N[k];\n }\n\n for (let k in D) {\n if (k === '1') continue;\n D[k] *= P['n'];\n\n if (D[k] % P['d'] === C_ZERO) {\n D[k] /= P['d'];\n } else return null;\n d *= BigInt(k) ** D[k];\n }\n\n if (P['s'] < C_ZERO) {\n return newFraction(d, n);\n }\n return newFraction(n, d);\n },\n\n /**\n * Calculates the logarithm of a fraction to a given rational base\n *\n * Ex: new Fraction(27, 8).log(9, 4) => 3/2\n */\n \"log\": function (a, b) {\n\n parse(a, b);\n\n if (this['s'] <= C_ZERO || P['s'] <= C_ZERO) return null;\n\n const allPrimes = {};\n\n const baseFactors = factorize(P['n']);\n const T1 = factorize(P['d']);\n\n const numberFactors = factorize(this['n']);\n const T2 = factorize(this['d']);\n\n for (const prime in T1) {\n baseFactors[prime] = (baseFactors[prime] || C_ZERO) - T1[prime];\n }\n for (const prime in T2) {\n numberFactors[prime] = (numberFactors[prime] || C_ZERO) - T2[prime];\n }\n\n for (const prime in baseFactors) {\n if (prime === '1') continue;\n allPrimes[prime] = true;\n }\n for (const prime in numberFactors) {\n if (prime === '1') continue;\n allPrimes[prime] = true;\n }\n\n let retN = null;\n let retD = null;\n\n // Iterate over all unique primes to determine if a consistent ratio exists\n for (const prime in allPrimes) {\n\n const baseExponent = baseFactors[prime] || C_ZERO;\n const numberExponent = numberFactors[prime] || C_ZERO;\n\n if (baseExponent === C_ZERO) {\n if (numberExponent !== C_ZERO) {\n return null; // Logarithm cannot be expressed as a rational number\n }\n continue; // Skip this prime since both exponents are zero\n }\n\n // Calculate the ratio of exponents for this prime\n let curN = numberExponent;\n let curD = baseExponent;\n\n // Simplify the current ratio\n const gcdValue = gcd(curN, curD);\n curN /= gcdValue;\n curD /= gcdValue;\n\n // Check if this is the first ratio; otherwise, ensure ratios are consistent\n if (retN === null && retD === null) {\n retN = curN;\n retD = curD;\n } else if (curN * retD !== retN * curD) {\n return null; // Ratios do not match, logarithm cannot be rational\n }\n }\n\n return retN !== null && retD !== null\n ? newFraction(retN, retD)\n : null;\n },\n\n /**\n * Check if two rational numbers are the same\n *\n * Ex: new Fraction(19.6).equals([98, 5]);\n **/\n \"equals\": function (a, b) {\n\n parse(a, b);\n return this[\"s\"] * this[\"n\"] * P[\"d\"] === P[\"s\"] * P[\"n\"] * this[\"d\"];\n },\n\n /**\n * Check if this rational number is less than another\n *\n * Ex: new Fraction(19.6).lt([98, 5]);\n **/\n \"lt\": function (a, b) {\n\n parse(a, b);\n return this[\"s\"] * this[\"n\"] * P[\"d\"] < P[\"s\"] * P[\"n\"] * this[\"d\"];\n },\n\n /**\n * Check if this rational number is less than or equal another\n *\n * Ex: new Fraction(19.6).lt([98, 5]);\n **/\n \"lte\": function (a, b) {\n\n parse(a, b);\n return this[\"s\"] * this[\"n\"] * P[\"d\"] <= P[\"s\"] * P[\"n\"] * this[\"d\"];\n },\n\n /**\n * Check if this rational number is greater than another\n *\n * Ex: new Fraction(19.6).lt([98, 5]);\n **/\n \"gt\": function (a, b) {\n\n parse(a, b);\n return this[\"s\"] * this[\"n\"] * P[\"d\"] > P[\"s\"] * P[\"n\"] * this[\"d\"];\n },\n\n /**\n * Check if this rational number is greater than or equal another\n *\n * Ex: new Fraction(19.6).lt([98, 5]);\n **/\n \"gte\": function (a, b) {\n\n parse(a, b);\n return this[\"s\"] * this[\"n\"] * P[\"d\"] >= P[\"s\"] * P[\"n\"] * this[\"d\"];\n },\n\n /**\n * Compare two rational numbers\n * < 0 iff this < that\n * > 0 iff this > that\n * = 0 iff this = that\n *\n * Ex: new Fraction(19.6).compare([98, 5]);\n **/\n \"compare\": function (a, b) {\n\n parse(a, b);\n let t = this[\"s\"] * this[\"n\"] * P[\"d\"] - P[\"s\"] * P[\"n\"] * this[\"d\"];\n\n return (C_ZERO < t) - (t < C_ZERO);\n },\n\n /**\n * Calculates the ceil of a rational number\n *\n * Ex: new Fraction('4.(3)').ceil() => (5 / 1)\n **/\n \"ceil\": function (places) {\n\n places = C_TEN ** BigInt(places || 0);\n\n return newFraction(trunc(this[\"s\"] * places * this[\"n\"] / this[\"d\"]) +\n (places * this[\"n\"] % this[\"d\"] > C_ZERO && this[\"s\"] >= C_ZERO ? C_ONE : C_ZERO),\n places);\n },\n\n /**\n * Calculates the floor of a rational number\n *\n * Ex: new Fraction('4.(3)').floor() => (4 / 1)\n **/\n \"floor\": function (places) {\n\n places = C_TEN ** BigInt(places || 0);\n\n return newFraction(trunc(this[\"s\"] * places * this[\"n\"] / this[\"d\"]) -\n (places * this[\"n\"] % this[\"d\"] > C_ZERO && this[\"s\"] < C_ZERO ? C_ONE : C_ZERO),\n places);\n },\n\n /**\n * Rounds a rational numbers\n *\n * Ex: new Fraction('4.(3)').round() => (4 / 1)\n **/\n \"round\": function (places) {\n\n places = C_TEN ** BigInt(places || 0);\n\n /* Derivation:\n\n s >= 0:\n round(n / d) = trunc(n / d) + (n % d) / d >= 0.5 ? 1 : 0\n = trunc(n / d) + 2(n % d) >= d ? 1 : 0\n s < 0:\n round(n / d) =-trunc(n / d) - (n % d) / d > 0.5 ? 1 : 0\n =-trunc(n / d) - 2(n % d) > d ? 1 : 0\n\n =>:\n\n round(s * n / d) = s * trunc(n / d) + s * (C + 2(n % d) > d ? 1 : 0)\n where C = s >= 0 ? 1 : 0, to fix the >= for the positve case.\n */\n\n return newFraction(trunc(this[\"s\"] * places * this[\"n\"] / this[\"d\"]) +\n this[\"s\"] * ((this[\"s\"] >= C_ZERO ? C_ONE : C_ZERO) + C_TWO * (places * this[\"n\"] % this[\"d\"]) > this[\"d\"] ? C_ONE : C_ZERO),\n places);\n },\n\n /**\n * Rounds a rational number to a multiple of another rational number\n *\n * Ex: new Fraction('0.9').roundTo(\"1/8\") => 7 / 8\n **/\n \"roundTo\": function (a, b) {\n\n /*\n k * x/y ≤ a/b < (k+1) * x/y\n ⇔ k ≤ a/b / (x/y) < (k+1)\n ⇔ k = floor(a/b * y/x)\n ⇔ k = floor((a * y) / (b * x))\n */\n\n parse(a, b);\n\n const n = this['n'] * P['d'];\n const d = this['d'] * P['n'];\n const r = n % d;\n\n // round(n / d) = trunc(n / d) + 2(n % d) >= d ? 1 : 0\n let k = trunc(n / d);\n if (r + r >= d) {\n k++;\n }\n return newFraction(this['s'] * k * P['n'], P['d']);\n },\n\n /**\n * Check if two rational numbers are divisible\n *\n * Ex: new Fraction(19.6).divisible(1.5);\n */\n \"divisible\": function (a, b) {\n\n parse(a, b);\n return !(!(P[\"n\"] * this[\"d\"]) || ((this[\"n\"] * P[\"d\"]) % (P[\"n\"] * this[\"d\"])));\n },\n\n /**\n * Returns a decimal representation of the fraction\n *\n * Ex: new Fraction(\"100.'91823'\").valueOf() => 100.91823918239183\n **/\n 'valueOf': function () {\n // Best we can do so far\n return Number(this[\"s\"] * this[\"n\"]) / Number(this[\"d\"]);\n },\n\n /**\n * Creates a string representation of a fraction with all digits\n *\n * Ex: new Fraction(\"100.'91823'\").toString() => \"100.(91823)\"\n **/\n 'toString': function (dec) {\n\n let N = this[\"n\"];\n let D = this[\"d\"];\n\n dec = dec || 15; // 15 = decimal places when no repetition\n\n let cycLen = cycleLen(N, D); // Cycle length\n let cycOff = cycleStart(N, D, cycLen); // Cycle start\n\n let str = this['s'] < C_ZERO ? \"-\" : \"\";\n\n // Append integer part\n str += trunc(N / D);\n\n N %= D;\n N *= C_TEN;\n\n if (N)\n str += \".\";\n\n if (cycLen) {\n\n for (let i = cycOff; i--;) {\n str += trunc(N / D);\n N %= D;\n N *= C_TEN;\n }\n str += \"(\";\n for (let i = cycLen; i--;) {\n str += trunc(N / D);\n N %= D;\n N *= C_TEN;\n }\n str += \")\";\n } else {\n for (let i = dec; N && i--;) {\n str += trunc(N / D);\n N %= D;\n N *= C_TEN;\n }\n }\n return str;\n },\n\n /**\n * Returns a string-fraction representation of a Fraction object\n *\n * Ex: new Fraction(\"1.'3'\").toFraction() => \"4 1/3\"\n **/\n 'toFraction': function (showMixed) {\n\n let n = this[\"n\"];\n let d = this[\"d\"];\n let str = this['s'] < C_ZERO ? \"-\" : \"\";\n\n if (d === C_ONE) {\n str += n;\n } else {\n let whole = trunc(n / d);\n if (showMixed && whole > C_ZERO) {\n str += whole;\n str += \" \";\n n %= d;\n }\n\n str += n;\n str += '/';\n str += d;\n }\n return str;\n },\n\n /**\n * Returns a latex representation of a Fraction object\n *\n * Ex: new Fraction(\"1.'3'\").toLatex() => \"\\frac{4}{3}\"\n **/\n 'toLatex': function (showMixed) {\n\n let n = this[\"n\"];\n let d = this[\"d\"];\n let str = this['s'] < C_ZERO ? \"-\" : \"\";\n\n if (d === C_ONE) {\n str += n;\n } else {\n let whole = trunc(n / d);\n if (showMixed && whole > C_ZERO) {\n str += whole;\n n %= d;\n }\n\n str += \"\\\\frac{\";\n str += n;\n str += '}{';\n str += d;\n str += '}';\n }\n return str;\n },\n\n /**\n * Returns an array of continued fraction elements\n *\n * Ex: new Fraction(\"7/8\").toContinued() => [0,1,7]\n */\n 'toContinued': function () {\n\n let a = this['n'];\n let b = this['d'];\n let res = [];\n\n do {\n res.push(trunc(a / b));\n let t = a % b;\n a = b;\n b = t;\n } while (a !== C_ONE);\n\n return res;\n },\n\n \"simplify\": function (eps) {\n\n const ieps = BigInt(1 / (eps || 0.001) | 0);\n\n const thisABS = this['abs']();\n const cont = thisABS['toContinued']();\n\n for (let i = 1; i < cont.length; i++) {\n\n let s = newFraction(cont[i - 1], C_ONE);\n for (let k = i - 2; k >= 0; k--) {\n s = s['inverse']()['add'](cont[k]);\n }\n\n let t = s['sub'](thisABS);\n if (t['n'] * ieps < t['d']) { // More robust than Math.abs(t.valueOf()) < eps\n return s['mul'](this['s']);\n }\n }\n return this;\n }\n};\nexport {\n Fraction as default, Fraction\n};\n","import Fraction from 'fraction.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'Fraction'\nconst dependencies = []\n\nexport const createFractionClass = /* #__PURE__ */ factory(name, dependencies, () => {\n /**\n * Attach type information\n */\n Object.defineProperty(Fraction, 'name', { value: 'Fraction' })\n Fraction.prototype.constructor = Fraction\n Fraction.prototype.type = 'Fraction'\n Fraction.prototype.isFraction = true\n\n /**\n * Get a JSON representation of a Fraction containing type information\n * @returns {Object} Returns a JSON object structured as:\n * `{\"mathjs\": \"Fraction\", \"n\": \"3\", \"d\": \"8\"}`\n */\n Fraction.prototype.toJSON = function () {\n return {\n mathjs: 'Fraction',\n n: String(this.s * this.n),\n d: String(this.d)\n }\n }\n\n /**\n * Instantiate a Fraction from a JSON object\n * @param {Object} json a JSON object structured as:\n * `{\"mathjs\": \"Fraction\", \"n\": \"3\", \"d\": \"8\"}`\n * @return {BigNumber}\n */\n Fraction.fromJSON = function (json) {\n return new Fraction(json)\n }\n\n return Fraction\n}, { isClass: true })\n","import { isBigInt, isBigNumber } from '../../utils/is.js'\nimport { format, sign } from '../../utils/number.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'Range'\nconst dependencies = []\n\nexport const createRangeClass = /* #__PURE__ */ factory(name, dependencies, () => {\n /**\n * Create a range of numbers. A range has a start, step, and end,\n * and contains functions to iterate over the range.\n *\n * A range can be constructed as:\n *\n * const range = new Range(start, end)\n * const range = new Range(start, end, step)\n *\n * Note that the endpoints and step may be specified with other numeric\n * types such as bigint or BigNumber, but they will be demoted to the\n * built-in `number` type and the Range will only contain numbers. The\n * rationale for this demotion is that Range objects are primarily used\n * for indexing Matrix objects, and Matrix objects may only be indexed\n * with `number`s.\n *\n * To get the result of the range:\n * range.forEach(function (x) {\n * console.log(x)\n * })\n * range.map(function (x) {\n * return math.sin(x)\n * })\n * range.toArray()\n *\n * Example usage:\n *\n * const c = new Range(2, 6) // 2:1:5\n * c.toArray() // [2, 3, 4, 5]\n * const d = new Range(2, -3, -1) // 2:-1:-2\n * d.toArray() // [2, 1, 0, -1, -2]\n *\n * @class Range\n * @constructor Range\n * @param {number} start included lower bound\n * @param {number} end excluded upper bound\n * @param {number} [step] step size, default value is 1\n */\n function Range (start, end, step) {\n if (!(this instanceof Range)) {\n throw new SyntaxError('Constructor must be called with the new operator')\n }\n\n const hasStart = start !== null && start !== undefined\n const hasEnd = end !== null && end !== undefined\n const hasStep = step !== null && step !== undefined\n\n if (hasStart) {\n if (isBigNumber(start)) {\n start = start.toNumber()\n } else if (typeof start !== 'number' && !isBigInt(start)) {\n throw new TypeError('Parameter start must be a number or bigint')\n }\n }\n if (hasEnd) {\n if (isBigNumber(end)) {\n end = end.toNumber()\n } else if (typeof end !== 'number' && !isBigInt(end)) {\n throw new TypeError('Parameter end must be a number or bigint')\n }\n }\n if (hasStep) {\n if (isBigNumber(step)) {\n step = step.toNumber()\n } else if (typeof step !== 'number' && !isBigInt(step)) {\n throw new TypeError('Parameter step must be a number or bigint')\n }\n }\n\n this.start = hasStart ? parseFloat(start) : 0\n this.end = hasEnd ? parseFloat(end) : 0\n this.step = hasStep ? parseFloat(step) : 1\n }\n\n /**\n * Attach type information\n */\n Range.prototype.type = 'Range'\n Range.prototype.isRange = true\n\n /**\n * Parse a string into a range,\n * The string contains the start, optional step, and end, separated by a colon.\n * If the string does not contain a valid range, null is returned.\n * For example str='0:2:11'.\n * @memberof Range\n * @param {string} str\n * @return {Range | null} range\n */\n Range.parse = function (str) {\n if (typeof str !== 'string') {\n return null\n }\n\n const args = str.split(':')\n const nums = args.map(function (arg) {\n return parseFloat(arg)\n })\n\n const invalid = nums.some(function (num) {\n return isNaN(num)\n })\n if (invalid) {\n return null\n }\n\n switch (nums.length) {\n case 2:\n return new Range(nums[0], nums[1])\n case 3:\n return new Range(nums[0], nums[2], nums[1])\n default:\n return null\n }\n }\n\n /**\n * Create a clone of the range\n * @return {Range} clone\n */\n Range.prototype.clone = function () {\n return new Range(this.start, this.end, this.step)\n }\n\n /**\n * Retrieve the size of the range.\n * Returns an array containing one number, the number of elements in the range.\n * @memberof Range\n * @returns {number[]} size\n */\n Range.prototype.size = function () {\n let len = 0\n const start = this.start\n const step = this.step\n const end = this.end\n const diff = end - start\n\n if (sign(step) === sign(diff)) {\n len = Math.ceil((diff) / step)\n } else if (diff === 0) {\n len = 0\n }\n\n if (isNaN(len)) {\n len = 0\n }\n return [len]\n }\n\n /**\n * Calculate the minimum value in the range\n * @memberof Range\n * @return {number | undefined} min\n */\n Range.prototype.min = function () {\n const size = this.size()[0]\n\n if (size > 0) {\n if (this.step > 0) {\n // positive step\n return this.start\n } else {\n // negative step\n return this.start + (size - 1) * this.step\n }\n } else {\n return undefined\n }\n }\n\n /**\n * Calculate the maximum value in the range\n * @memberof Range\n * @return {number | undefined} max\n */\n Range.prototype.max = function () {\n const size = this.size()[0]\n\n if (size > 0) {\n if (this.step > 0) {\n // positive step\n return this.start + (size - 1) * this.step\n } else {\n // negative step\n return this.start\n }\n } else {\n return undefined\n }\n }\n\n /**\n * Execute a callback function for each value in the range.\n * @memberof Range\n * @param {function} callback The callback method is invoked with three\n * parameters: the value of the element, the index\n * of the element, and the Range being traversed.\n */\n Range.prototype.forEach = function (callback) {\n let x = this.start\n const step = this.step\n const end = this.end\n let i = 0\n\n if (step > 0) {\n while (x < end) {\n callback(x, [i], this)\n x += step\n i++\n }\n } else if (step < 0) {\n while (x > end) {\n callback(x, [i], this)\n x += step\n i++\n }\n }\n }\n\n /**\n * Execute a callback function for each value in the Range, and return the\n * results as an array\n * @memberof Range\n * @param {function} callback The callback method is invoked with three\n * parameters: the value of the element, the index\n * of the element, and the Matrix being traversed.\n * @returns {Array} array\n */\n Range.prototype.map = function (callback) {\n const array = []\n this.forEach(function (value, index, obj) {\n array[index[0]] = callback(value, index, obj)\n })\n return array\n }\n\n /**\n * Create an Array with a copy of the Ranges data\n * @memberof Range\n * @returns {Array} array\n */\n Range.prototype.toArray = function () {\n const array = []\n this.forEach(function (value, index) {\n array[index[0]] = value\n })\n return array\n }\n\n /**\n * Get the primitive value of the Range, a one dimensional array\n * @memberof Range\n * @returns {Array} array\n */\n Range.prototype.valueOf = function () {\n // TODO: implement a caching mechanism for range.valueOf()\n return this.toArray()\n }\n\n /**\n * Get a string representation of the range, with optional formatting options.\n * Output is formatted as 'start:step:end', for example '2:6' or '0:0.2:11'\n * @memberof Range\n * @param {Object | number | function} [options] Formatting options. See\n * lib/utils/number:format for a\n * description of the available\n * options.\n * @returns {string} str\n */\n Range.prototype.format = function (options) {\n let str = format(this.start, options)\n\n if (this.step !== 1) {\n str += ':' + format(this.step, options)\n }\n str += ':' + format(this.end, options)\n return str\n }\n\n /**\n * Get a string representation of the range.\n * @memberof Range\n * @returns {string}\n */\n Range.prototype.toString = function () {\n return this.format()\n }\n\n /**\n * Get a JSON representation of the range\n * @memberof Range\n * @returns {Object} Returns a JSON object structured as:\n * `{\"mathjs\": \"Range\", \"start\": 2, \"end\": 4, \"step\": 1}`\n */\n Range.prototype.toJSON = function () {\n return {\n mathjs: 'Range',\n start: this.start,\n end: this.end,\n step: this.step\n }\n }\n\n /**\n * Instantiate a Range from a JSON object\n * @memberof Range\n * @param {Object} json A JSON object structured as:\n * `{\"mathjs\": \"Range\", \"start\": 2, \"end\": 4, \"step\": 1}`\n * @return {Range}\n */\n Range.fromJSON = function (json) {\n return new Range(json.start, json.end, json.step)\n }\n\n return Range\n}, { isClass: true })\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'Matrix'\nconst dependencies = []\n\nexport const createMatrixClass = /* #__PURE__ */ factory(name, dependencies, () => {\n /**\n * @constructor Matrix\n *\n * A Matrix is a wrapper around an Array. A matrix can hold a multi dimensional\n * array. A matrix can be constructed as:\n *\n * let matrix = math.matrix(data)\n *\n * Matrix contains the functions to resize, get and set values, get the size,\n * clone the matrix and to convert the matrix to a vector, array, or scalar.\n * Furthermore, one can iterate over the matrix using map and forEach.\n * The internal Array of the Matrix can be accessed using the function valueOf.\n *\n * Example usage:\n *\n * let matrix = math.matrix([[1, 2], [3, 4]])\n * matix.size() // [2, 2]\n * matrix.resize([3, 2], 5)\n * matrix.valueOf() // [[1, 2], [3, 4], [5, 5]]\n * matrix.subset([1,2]) // 3 (indexes are zero-based)\n *\n */\n function Matrix () {\n if (!(this instanceof Matrix)) {\n throw new SyntaxError('Constructor must be called with the new operator')\n }\n }\n\n /**\n * Attach type information\n */\n Matrix.prototype.type = 'Matrix'\n Matrix.prototype.isMatrix = true\n\n /**\n * Get the storage format used by the matrix.\n *\n * Usage:\n * const format = matrix.storage() // retrieve storage format\n *\n * @return {string} The storage format.\n */\n Matrix.prototype.storage = function () {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke storage on a Matrix interface')\n }\n\n /**\n * Get the datatype of the data stored in the matrix.\n *\n * Usage:\n * const format = matrix.datatype() // retrieve matrix datatype\n *\n * @return {string} The datatype.\n */\n Matrix.prototype.datatype = function () {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke datatype on a Matrix interface')\n }\n\n /**\n * Create a new Matrix With the type of the current matrix instance\n * @param {Array | Object} data\n * @param {string} [datatype]\n */\n Matrix.prototype.create = function (data, datatype) {\n throw new Error('Cannot invoke create on a Matrix interface')\n }\n\n /**\n * Get a subset of the matrix, or replace a subset of the matrix.\n *\n * Usage:\n * const subset = matrix.subset(index) // retrieve subset\n * const value = matrix.subset(index, replacement) // replace subset\n *\n * @param {Index} index\n * @param {Array | Matrix | *} [replacement]\n * @param {*} [defaultValue=0] Default value, filled in on new entries when\n * the matrix is resized. If not provided,\n * new matrix elements will be filled with zeros.\n */\n Matrix.prototype.subset = function (index, replacement, defaultValue) {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke subset on a Matrix interface')\n }\n\n /**\n * Get a single element from the matrix.\n * @param {number[]} index Zero-based index\n * @return {*} value\n */\n Matrix.prototype.get = function (index) {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke get on a Matrix interface')\n }\n\n /**\n * Replace a single element in the matrix.\n * @param {number[]} index Zero-based index\n * @param {*} value\n * @param {*} [defaultValue] Default value, filled in on new entries when\n * the matrix is resized. If not provided,\n * new matrix elements will be left undefined.\n * @return {Matrix} self\n */\n Matrix.prototype.set = function (index, value, defaultValue) {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke set on a Matrix interface')\n }\n\n /**\n * Resize the matrix to the given size. Returns a copy of the matrix when\n * `copy=true`, otherwise return the matrix itself (resize in place).\n *\n * @param {number[]} size The new size the matrix should have.\n * @param {*} [defaultValue=0] Default value, filled in on new entries.\n * If not provided, the matrix elements will\n * be filled with zeros.\n * @param {boolean} [copy] Return a resized copy of the matrix\n *\n * @return {Matrix} The resized matrix\n */\n Matrix.prototype.resize = function (size, defaultValue) {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke resize on a Matrix interface')\n }\n\n /**\n * Reshape the matrix to the given size. Returns a copy of the matrix when\n * `copy=true`, otherwise return the matrix itself (reshape in place).\n *\n * @param {number[]} size The new size the matrix should have.\n * @param {boolean} [copy] Return a reshaped copy of the matrix\n *\n * @return {Matrix} The reshaped matrix\n */\n Matrix.prototype.reshape = function (size, defaultValue) {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke reshape on a Matrix interface')\n }\n\n /**\n * Create a clone of the matrix\n * @return {Matrix} clone\n */\n Matrix.prototype.clone = function () {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke clone on a Matrix interface')\n }\n\n /**\n * Retrieve the size of the matrix.\n * @returns {number[]} size\n */\n Matrix.prototype.size = function () {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke size on a Matrix interface')\n }\n\n /**\n * Create a new matrix with the results of the callback function executed on\n * each entry of the matrix.\n * @param {Function} callback The callback function is invoked with three\n * parameters: the value of the element, the index\n * of the element, and the Matrix being traversed.\n * @param {boolean} [skipZeros] Invoke callback function for non-zero values only.\n *\n * @return {Matrix} matrix\n */\n Matrix.prototype.map = function (callback, skipZeros) {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke map on a Matrix interface')\n }\n\n /**\n * Execute a callback function on each entry of the matrix.\n * @param {Function} callback The callback function is invoked with three\n * parameters: the value of the element, the index\n * of the element, and the Matrix being traversed.\n */\n Matrix.prototype.forEach = function (callback) {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke forEach on a Matrix interface')\n }\n\n /**\n * Iterate over the matrix elements\n * @return {Iterable<{ value, index: number[] }>}\n */\n Matrix.prototype[Symbol.iterator] = function () {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot iterate a Matrix interface')\n }\n\n /**\n * Create an Array with a copy of the data of the Matrix\n * @returns {Array} array\n */\n Matrix.prototype.toArray = function () {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke toArray on a Matrix interface')\n }\n\n /**\n * Get the primitive value of the Matrix: a multidimensional array\n * @returns {Array} array\n */\n Matrix.prototype.valueOf = function () {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke valueOf on a Matrix interface')\n }\n\n /**\n * Get a string representation of the matrix, with optional formatting options.\n * @param {Object | number | Function} [options] Formatting options. See\n * lib/utils/number:format for a\n * description of the available\n * options.\n * @returns {string} str\n */\n Matrix.prototype.format = function (options) {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke format on a Matrix interface')\n }\n\n /**\n * Get a string representation of the matrix\n * @returns {string} str\n */\n Matrix.prototype.toString = function () {\n // must be implemented by each of the Matrix implementations\n throw new Error('Cannot invoke toString on a Matrix interface')\n }\n\n return Matrix\n}, { isClass: true })\n","function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };","import { isBigNumber, isNumber } from '../is.js'\nimport { isInteger, normalizeFormatOptions } from '../number.js'\n\n/**\n * Formats a BigNumber in a given base\n * @param {BigNumber} n\n * @param {number} base\n * @param {number} size\n * @returns {string}\n */\nfunction formatBigNumberToBase (n, base, size) {\n const BigNumberCtor = n.constructor\n const big2 = new BigNumberCtor(2)\n let suffix = ''\n if (size) {\n if (size < 1) {\n throw new Error('size must be in greater than 0')\n }\n if (!isInteger(size)) {\n throw new Error('size must be an integer')\n }\n if (n.greaterThan(big2.pow(size - 1).sub(1)) || n.lessThan(big2.pow(size - 1).mul(-1))) {\n throw new Error(`Value must be in range [-2^${size - 1}, 2^${size - 1}-1]`)\n }\n if (!n.isInteger()) {\n throw new Error('Value must be an integer')\n }\n if (n.lessThan(0)) {\n n = n.add(big2.pow(size))\n }\n suffix = `i${size}`\n }\n switch (base) {\n case 2: return `${n.toBinary()}${suffix}`\n case 8: return `${n.toOctal()}${suffix}`\n case 16: return `${n.toHexadecimal()}${suffix}`\n default: throw new Error(`Base ${base} not supported `)\n }\n}\n\n/**\n * Convert a BigNumber to a formatted string representation.\n *\n * Syntax:\n *\n * format(value)\n * format(value, options)\n * format(value, precision)\n * format(value, fn)\n *\n * Where:\n *\n * {number} value The value to be formatted\n * {Object} options An object with formatting options. Available options:\n * {string} notation\n * Number notation. Choose from:\n * 'fixed' Always use regular number notation.\n * For example '123.40' and '14000000'\n * 'exponential' Always use exponential notation.\n * For example '1.234e+2' and '1.4e+7'\n * 'auto' (default) Regular number notation for numbers\n * having an absolute value between\n * `lower` and `upper` bounds, and uses\n * exponential notation elsewhere.\n * Lower bound is included, upper bound\n * is excluded.\n * For example '123.4' and '1.4e7'.\n * 'bin', 'oct, or\n * 'hex' Format the number using binary, octal,\n * or hexadecimal notation.\n * For example '0b1101' and '0x10fe'.\n * {number} wordSize The word size in bits to use for formatting\n * in binary, octal, or hexadecimal notation.\n * To be used only with 'bin', 'oct', or 'hex'\n * values for 'notation' option. When this option\n * is defined the value is formatted as a signed\n * twos complement integer of the given word size\n * and the size suffix is appended to the output.\n * For example\n * format(-1, {notation: 'hex', wordSize: 8}) === '0xffi8'.\n * Default value is undefined.\n * {number} precision A number between 0 and 16 to round\n * the digits of the number.\n * In case of notations 'exponential',\n * 'engineering', and 'auto',\n * `precision` defines the total\n * number of significant digits returned.\n * In case of notation 'fixed',\n * `precision` defines the number of\n * significant digits after the decimal\n * point.\n * `precision` is undefined by default.\n * {number} lowerExp Exponent determining the lower boundary\n * for formatting a value with an exponent\n * when `notation='auto`.\n * Default value is `-3`.\n * {number} upperExp Exponent determining the upper boundary\n * for formatting a value with an exponent\n * when `notation='auto`.\n * Default value is `5`.\n * {Function} fn A custom formatting function. Can be used to override the\n * built-in notations. Function `fn` is called with `value` as\n * parameter and must return a string. Is useful for example to\n * format all values inside a matrix in a particular way.\n *\n * Examples:\n *\n * format(6.4) // '6.4'\n * format(1240000) // '1.24e6'\n * format(1/3) // '0.3333333333333333'\n * format(1/3, 3) // '0.333'\n * format(21385, 2) // '21000'\n * format(12e8, {notation: 'fixed'}) // returns '1200000000'\n * format(2.3, {notation: 'fixed', precision: 4}) // returns '2.3000'\n * format(52.8, {notation: 'exponential'}) // returns '5.28e+1'\n * format(12400, {notation: 'engineering'}) // returns '12.400e+3'\n *\n * @param {BigNumber} value\n * @param {Object | Function | number | BigNumber} [options]\n * @return {string} str The formatted value\n */\nexport function format (value, options) {\n if (typeof options === 'function') {\n // handle format(value, fn)\n return options(value)\n }\n\n // handle special cases\n if (!value.isFinite()) {\n return value.isNaN() ? 'NaN' : (value.gt(0) ? 'Infinity' : '-Infinity')\n }\n\n const { notation, precision, wordSize } = normalizeFormatOptions(options)\n\n // handle the various notations\n switch (notation) {\n case 'fixed':\n return toFixed(value, precision)\n\n case 'exponential':\n return toExponential(value, precision)\n\n case 'engineering':\n return toEngineering(value, precision)\n\n case 'bin':\n return formatBigNumberToBase(value, 2, wordSize)\n\n case 'oct':\n return formatBigNumberToBase(value, 8, wordSize)\n\n case 'hex':\n return formatBigNumberToBase(value, 16, wordSize)\n\n case 'auto':\n {\n // determine lower and upper bound for exponential notation.\n // TODO: implement support for upper and lower to be BigNumbers themselves\n const lowerExp = _toNumberOrDefault(options?.lowerExp, -3)\n const upperExp = _toNumberOrDefault(options?.upperExp, 5)\n\n // handle special case zero\n if (value.isZero()) return '0'\n\n // determine whether or not to output exponential notation\n let str\n const rounded = value.toSignificantDigits(precision)\n const exp = rounded.e\n if (exp >= lowerExp && exp < upperExp) {\n // normal number notation\n str = rounded.toFixed()\n } else {\n // exponential notation\n str = toExponential(value, precision)\n }\n\n // remove trailing zeros after the decimal point\n return str.replace(/((\\.\\d*?)(0+))($|e)/, function () {\n const digits = arguments[2]\n const e = arguments[4]\n return (digits !== '.') ? digits + e : e\n })\n }\n default:\n throw new Error('Unknown notation \"' + notation + '\". ' +\n 'Choose \"auto\", \"exponential\", \"fixed\", \"bin\", \"oct\", or \"hex.')\n }\n}\n\n/**\n * Format a BigNumber in engineering notation. Like '1.23e+6', '2.3e+0', '3.500e-3'\n * @param {BigNumber} value\n * @param {number} [precision] Optional number of significant figures to return.\n */\nexport function toEngineering (value, precision) {\n // find nearest lower multiple of 3 for exponent\n const e = value.e\n const newExp = e % 3 === 0 ? e : (e < 0 ? (e - 3) - (e % 3) : e - (e % 3))\n\n // find difference in exponents, and calculate the value without exponent\n const valueWithoutExp = value.mul(Math.pow(10, -newExp))\n\n let valueStr = valueWithoutExp.toPrecision(precision)\n if (valueStr.includes('e')) {\n const BigNumber = value.constructor\n valueStr = new BigNumber(valueStr).toFixed()\n }\n\n return valueStr + 'e' + (e >= 0 ? '+' : '') + newExp.toString()\n}\n\n/**\n * Format a number in exponential notation. Like '1.23e+5', '2.3e+0', '3.500e-3'\n * @param {BigNumber} value\n * @param {number} [precision] Number of digits in formatted output.\n * If not provided, the maximum available digits\n * is used.\n * @returns {string} str\n */\nexport function toExponential (value, precision) {\n if (precision !== undefined) {\n return value.toExponential(precision - 1) // Note the offset of one\n } else {\n return value.toExponential()\n }\n}\n\n/**\n * Format a number with fixed notation.\n * @param {BigNumber} value\n * @param {number} [precision=undefined] Optional number of decimals after the\n * decimal point. Undefined by default.\n */\nexport function toFixed (value, precision) {\n return value.toFixed(precision)\n}\n\nfunction _toNumberOrDefault (value, defaultValue) {\n if (isNumber(value)) {\n return value\n } else if (isBigNumber(value)) {\n return value.toNumber()\n } else {\n return defaultValue\n }\n}\n","import { isBigNumber, isString, typeOf } from './is.js'\nimport { format as formatNumber } from './number.js'\nimport { format as formatBigNumber } from './bignumber/formatter.js'\n\n/**\n * Check if a text ends with a certain string.\n * @param {string} text\n * @param {string} search\n */\nexport function endsWith (text, search) {\n const start = text.length - search.length\n const end = text.length\n return (text.substring(start, end) === search)\n}\n\n/**\n * Format a value of any type into a string.\n *\n * Usage:\n * math.format(value)\n * math.format(value, precision)\n * math.format(value, options)\n *\n * When value is a function:\n *\n * - When the function has a property `syntax`, it returns this\n * syntax description.\n * - In other cases, a string `'function'` is returned.\n *\n * When `value` is an Object:\n *\n * - When the object contains a property `format` being a function, this\n * function is invoked as `value.format(options)` and the result is returned.\n * - When the object has its own `toString` method, this method is invoked\n * and the result is returned.\n * - In other cases the function will loop over all object properties and\n * return JSON object notation like '{\"a\": 2, \"b\": 3}'.\n *\n * Example usage:\n * math.format(2/7) // '0.2857142857142857'\n * math.format(math.pi, 3) // '3.14'\n * math.format(new Complex(2, 3)) // '2 + 3i'\n * math.format('hello') // '\"hello\"'\n *\n * @param {*} value Value to be stringified\n * @param {Object | number | Function} [options]\n * Formatting options. See src/utils/number.js:format for a\n * description of the available options controlling number output.\n * This generic \"format\" also supports the option property `truncate: NN`\n * giving the maximum number NN of characters to return (if there would\n * have been more, they are deleted and replaced by an ellipsis).\n * @return {string} str\n */\nexport function format (value, options) {\n const result = _format(value, options)\n if (options && typeof options === 'object' && 'truncate' in options &&\n result.length > options.truncate) {\n return result.substring(0, options.truncate - 3) + '...'\n }\n return result\n}\n\nfunction _format (value, options) {\n if (typeof value === 'number') {\n return formatNumber(value, options)\n }\n\n if (isBigNumber(value)) {\n return formatBigNumber(value, options)\n }\n\n // note: we use unsafe duck-typing here to check for Fractions, this is\n // ok here since we're only invoking toString or concatenating its values\n if (looksLikeFraction(value)) {\n if (!options || options.fraction !== 'decimal') {\n // output as ratio, like '1/3'\n return `${value.s * value.n}/${value.d}`\n } else {\n // output as decimal, like '0.(3)'\n return value.toString()\n }\n }\n\n if (Array.isArray(value)) {\n return formatArray(value, options)\n }\n\n if (isString(value)) {\n return stringify(value)\n }\n\n if (typeof value === 'function') {\n return value.syntax ? String(value.syntax) : 'function'\n }\n\n if (value && typeof value === 'object') {\n if (typeof value.format === 'function') {\n return value.format(options)\n } else if (value && value.toString(options) !== {}.toString()) {\n // this object has a non-native toString method, use that one\n return value.toString(options)\n } else {\n const entries = Object.keys(value).map(key => {\n return stringify(key) + ': ' + format(value[key], options)\n })\n\n return '{' + entries.join(', ') + '}'\n }\n }\n\n return String(value)\n}\n\n/**\n * Stringify a value into a string enclosed in double quotes.\n * Unescaped double quotes and backslashes inside the value are escaped.\n * @param {*} value\n * @return {string}\n */\nexport function stringify (value) {\n const text = String(value)\n let escaped = ''\n let i = 0\n while (i < text.length) {\n const c = text.charAt(i)\n escaped += (c in controlCharacters) ? controlCharacters[c] : c\n i++\n }\n\n return '\"' + escaped + '\"'\n}\n\nconst controlCharacters = {\n '\"': '\\\\\"',\n '\\\\': '\\\\\\\\',\n '\\b': '\\\\b',\n '\\f': '\\\\f',\n '\\n': '\\\\n',\n '\\r': '\\\\r',\n '\\t': '\\\\t'\n}\n\n/**\n * Escape special HTML characters\n * @param {*} value\n * @return {string}\n */\nexport function escape (value) {\n let text = String(value)\n text = text.replace(/&/g, '&')\n .replace(/\"/g, '"')\n .replace(/'/g, ''')\n .replace(//g, '>')\n\n return text\n}\n\n/**\n * Recursively format an n-dimensional matrix\n * Example output: \"[[1, 2], [3, 4]]\"\n * @param {Array} array\n * @param {Object | number | Function} [options] Formatting options. See\n * lib/utils/number:format for a\n * description of the available\n * options.\n * @returns {string} str\n */\nfunction formatArray (array, options) {\n if (Array.isArray(array)) {\n let str = '['\n const len = array.length\n for (let i = 0; i < len; i++) {\n if (i !== 0) {\n str += ', '\n }\n str += formatArray(array[i], options)\n }\n str += ']'\n return str\n } else {\n return format(array, options)\n }\n}\n\n/**\n * Check whether a value looks like a Fraction (unsafe duck-type check)\n * @param {*} value\n * @return {boolean}\n */\nfunction looksLikeFraction (value) {\n return (value &&\n typeof value === 'object' &&\n typeof value.s === 'bigint' &&\n typeof value.n === 'bigint' &&\n typeof value.d === 'bigint') || false\n}\n\n/**\n * Compare two strings\n * @param {string} x\n * @param {string} y\n * @returns {number}\n */\nexport function compareText (x, y) {\n // we don't want to convert numbers to string, only accept string input\n if (!isString(x)) {\n throw new TypeError('Unexpected type of argument in function compareText ' +\n '(expected: string or Array or Matrix, actual: ' + typeOf(x) + ', index: 0)')\n }\n if (!isString(y)) {\n throw new TypeError('Unexpected type of argument in function compareText ' +\n '(expected: string or Array or Matrix, actual: ' + typeOf(y) + ', index: 1)')\n }\n\n return (x === y)\n ? 0\n : (x > y ? 1 : -1)\n}\n","/**\n * Create a range error with the message:\n * 'Dimension mismatch ( != )'\n * @param {number | number[]} actual The actual size\n * @param {number | number[]} expected The expected size\n * @param {string} [relation='!='] Optional relation between actual\n * and expected size: '!=', '<', etc.\n * @extends RangeError\n */\nexport function DimensionError (actual, expected, relation) {\n if (!(this instanceof DimensionError)) {\n throw new SyntaxError('Constructor must be called with the new operator')\n }\n\n this.actual = actual\n this.expected = expected\n this.relation = relation\n\n this.message = 'Dimension mismatch (' +\n (Array.isArray(actual) ? ('[' + actual.join(', ') + ']') : actual) +\n ' ' + (this.relation || '!=') + ' ' +\n (Array.isArray(expected) ? ('[' + expected.join(', ') + ']') : expected) +\n ')'\n\n this.stack = (new Error()).stack\n}\n\nDimensionError.prototype = new RangeError()\nDimensionError.prototype.constructor = RangeError\nDimensionError.prototype.name = 'DimensionError'\nDimensionError.prototype.isDimensionError = true\n","/**\n * Create a range error with the message:\n * 'Index out of range (index < min)'\n * 'Index out of range (index < max)'\n *\n * @param {number} index The actual index\n * @param {number} [min=0] Minimum index (included)\n * @param {number} [max] Maximum index (excluded)\n * @extends RangeError\n */\nexport function IndexError (index, min, max) {\n if (!(this instanceof IndexError)) {\n throw new SyntaxError('Constructor must be called with the new operator')\n }\n\n this.index = index\n if (arguments.length < 3) {\n this.min = 0\n this.max = min\n } else {\n this.min = min\n this.max = max\n }\n\n if (this.min !== undefined && this.index < this.min) {\n this.message = 'Index out of range (' + this.index + ' < ' + this.min + ')'\n } else if (this.max !== undefined && this.index >= this.max) {\n this.message = 'Index out of range (' + this.index + ' > ' + (this.max - 1) + ')'\n } else {\n this.message = 'Index out of range (' + this.index + ')'\n }\n\n this.stack = (new Error()).stack\n}\n\nIndexError.prototype = new RangeError()\nIndexError.prototype.constructor = RangeError\nIndexError.prototype.name = 'IndexError'\nIndexError.prototype.isIndexError = true\n","import { isInteger } from './number.js'\nimport { isNumber, isBigNumber, isArray, isString } from './is.js'\nimport { format } from './string.js'\nimport { DimensionError } from '../error/DimensionError.js'\nimport { IndexError } from '../error/IndexError.js'\nimport { deepStrictEqual } from './object.js'\n\n/**\n * Calculate the size of a multi dimensional array.\n * This function checks the size of the first entry, it does not validate\n * whether all dimensions match. (use function `validate` for that)\n * @param {Array} x\n * @return {number[]} size\n */\nexport function arraySize (x) {\n const s = []\n\n while (Array.isArray(x)) {\n s.push(x.length)\n x = x[0]\n }\n\n return s\n}\n\n/**\n * Recursively validate whether each element in a multi dimensional array\n * has a size corresponding to the provided size array.\n * @param {Array} array Array to be validated\n * @param {number[]} size Array with the size of each dimension\n * @param {number} dim Current dimension\n * @throws DimensionError\n * @private\n */\nfunction _validate (array, size, dim) {\n let i\n const len = array.length\n\n if (len !== size[dim]) {\n throw new DimensionError(len, size[dim])\n }\n\n if (dim < size.length - 1) {\n // recursively validate each child array\n const dimNext = dim + 1\n for (i = 0; i < len; i++) {\n const child = array[i]\n if (!Array.isArray(child)) {\n throw new DimensionError(size.length - 1, size.length, '<')\n }\n _validate(array[i], size, dimNext)\n }\n } else {\n // last dimension. none of the children may be an array\n for (i = 0; i < len; i++) {\n if (Array.isArray(array[i])) {\n throw new DimensionError(size.length + 1, size.length, '>')\n }\n }\n }\n}\n\n/**\n * Validate whether each element in a multi dimensional array has\n * a size corresponding to the provided size array.\n * @param {Array} array Array to be validated\n * @param {number[]} size Array with the size of each dimension\n * @throws DimensionError\n */\nexport function validate (array, size) {\n const isScalar = (size.length === 0)\n if (isScalar) {\n // scalar\n if (Array.isArray(array)) {\n throw new DimensionError(array.length, 0)\n }\n } else {\n // array\n _validate(array, size, 0)\n }\n}\n\n/**\n * Validate whether the source of the index matches the size of the Array\n * @param {Array | Matrix} value Array to be validated\n * @param {Index} index Index with the source information to validate\n * @throws DimensionError\n */\nexport function validateIndexSourceSize (value, index) {\n const valueSize = value.isMatrix ? value._size : arraySize(value)\n const sourceSize = index._sourceSize\n // checks if the source size is not null and matches the valueSize\n sourceSize.forEach((sourceDim, i) => {\n if (sourceDim !== null && sourceDim !== valueSize[i]) { throw new DimensionError(sourceDim, valueSize[i]) }\n })\n}\n\n/**\n * Test whether index is an integer number with index >= 0 and index < length\n * when length is provided\n * @param {number} index Zero-based index\n * @param {number} [length] Length of the array\n */\nexport function validateIndex (index, length) {\n if (index !== undefined) {\n if (!isNumber(index) || !isInteger(index)) {\n throw new TypeError('Index must be an integer (value: ' + index + ')')\n }\n if (index < 0 || (typeof length === 'number' && index >= length)) {\n throw new IndexError(index, length)\n }\n }\n}\n\n/**\n * Test if an index has empty values\n * @param {Index} index Zero-based index\n */\nexport function isEmptyIndex (index) {\n for (let i = 0; i < index._dimensions.length; ++i) {\n const dimension = index._dimensions[i]\n if (dimension._data && isArray(dimension._data)) {\n if (dimension._size[0] === 0) {\n return true\n }\n } else if (dimension.isRange) {\n if (dimension.start === dimension.end) {\n return true\n }\n } else if (isString(dimension)) {\n if (dimension.length === 0) {\n return true\n }\n }\n }\n return false\n}\n\n/**\n * Resize a multi dimensional array. The resized array is returned.\n * @param {Array | number} array Array to be resized\n * @param {number[]} size Array with the size of each dimension\n * @param {*} [defaultValue=0] Value to be filled in new entries,\n * zero by default. Specify for example `null`,\n * to clearly see entries that are not explicitly\n * set.\n * @return {Array} array The resized array\n */\nexport function resize (array, size, defaultValue) {\n // check the type of the arguments\n if (!Array.isArray(size)) {\n throw new TypeError('Array expected')\n }\n if (size.length === 0) {\n throw new Error('Resizing to scalar is not supported')\n }\n\n // check whether size contains positive integers\n size.forEach(function (value) {\n if (!isNumber(value) || !isInteger(value) || value < 0) {\n throw new TypeError('Invalid size, must contain positive integers ' +\n '(size: ' + format(size) + ')')\n }\n })\n\n // convert number to an array\n if (isNumber(array) || isBigNumber(array)) {\n array = [array]\n }\n\n // recursively resize the array\n const _defaultValue = (defaultValue !== undefined) ? defaultValue : 0\n _resize(array, size, 0, _defaultValue)\n\n return array\n}\n\n/**\n * Recursively resize a multi dimensional array\n * @param {Array} array Array to be resized\n * @param {number[]} size Array with the size of each dimension\n * @param {number} dim Current dimension\n * @param {*} [defaultValue] Value to be filled in new entries,\n * undefined by default.\n * @private\n */\nfunction _resize (array, size, dim, defaultValue) {\n let i\n let elem\n const oldLen = array.length\n const newLen = size[dim]\n const minLen = Math.min(oldLen, newLen)\n\n // apply new length\n array.length = newLen\n\n if (dim < size.length - 1) {\n // non-last dimension\n const dimNext = dim + 1\n\n // resize existing child arrays\n for (i = 0; i < minLen; i++) {\n // resize child array\n elem = array[i]\n if (!Array.isArray(elem)) {\n elem = [elem] // add a dimension\n array[i] = elem\n }\n _resize(elem, size, dimNext, defaultValue)\n }\n\n // create new child arrays\n for (i = minLen; i < newLen; i++) {\n // get child array\n elem = []\n array[i] = elem\n\n // resize new child array\n _resize(elem, size, dimNext, defaultValue)\n }\n } else {\n // last dimension\n\n // remove dimensions of existing values\n for (i = 0; i < minLen; i++) {\n while (Array.isArray(array[i])) {\n array[i] = array[i][0]\n }\n }\n\n // fill new elements with the default value\n for (i = minLen; i < newLen; i++) {\n array[i] = defaultValue\n }\n }\n}\n\n/**\n * Re-shape a multi dimensional array to fit the specified dimensions\n * @param {Array} array Array to be reshaped\n * @param {number[]} sizes List of sizes for each dimension\n * @returns {Array} Array whose data has been formatted to fit the\n * specified dimensions\n *\n * @throws {DimensionError} If the product of the new dimension sizes does\n * not equal that of the old ones\n */\nexport function reshape (array, sizes) {\n const flatArray = flatten(array, true) // since it has rectangular\n const currentLength = flatArray.length\n\n if (!Array.isArray(array) || !Array.isArray(sizes)) {\n throw new TypeError('Array expected')\n }\n\n if (sizes.length === 0) {\n throw new DimensionError(0, currentLength, '!=')\n }\n\n sizes = processSizesWildcard(sizes, currentLength)\n const newLength = product(sizes)\n if (currentLength !== newLength) {\n throw new DimensionError(\n newLength,\n currentLength,\n '!='\n )\n }\n\n try {\n return _reshape(flatArray, sizes)\n } catch (e) {\n if (e instanceof DimensionError) {\n throw new DimensionError(\n newLength,\n currentLength,\n '!='\n )\n }\n throw e\n }\n}\n\n/**\n * Replaces the wildcard -1 in the sizes array.\n * @param {number[]} sizes List of sizes for each dimension. At most one wildcard.\n * @param {number} currentLength Number of elements in the array.\n * @throws {Error} If more than one wildcard or unable to replace it.\n * @returns {number[]} The sizes array with wildcard replaced.\n */\nexport function processSizesWildcard (sizes, currentLength) {\n const newLength = product(sizes)\n const processedSizes = sizes.slice()\n const WILDCARD = -1\n const wildCardIndex = sizes.indexOf(WILDCARD)\n\n const isMoreThanOneWildcard = sizes.indexOf(WILDCARD, wildCardIndex + 1) >= 0\n if (isMoreThanOneWildcard) {\n throw new Error('More than one wildcard in sizes')\n }\n\n const hasWildcard = wildCardIndex >= 0\n const canReplaceWildcard = currentLength % newLength === 0\n\n if (hasWildcard) {\n if (canReplaceWildcard) {\n processedSizes[wildCardIndex] = -currentLength / newLength\n } else {\n throw new Error('Could not replace wildcard, since ' + currentLength + ' is no multiple of ' + (-newLength))\n }\n }\n return processedSizes\n}\n\n/**\n * Computes the product of all array elements.\n * @param {number[]} array Array of factors\n * @returns {number} Product of all elements\n */\nfunction product (array) {\n return array.reduce((prev, curr) => prev * curr, 1)\n}\n\n/**\n * Iteratively re-shape a multi dimensional array to fit the specified dimensions\n * @param {Array} array Array to be reshaped\n * @param {number[]} sizes List of sizes for each dimension\n * @returns {Array} Array whose data has been formatted to fit the\n * specified dimensions\n */\n\nfunction _reshape (array, sizes) {\n // testing if there are enough elements for the requested shape\n let tmpArray = array\n let tmpArray2\n // for each dimension starting by the last one and ignoring the first one\n for (let sizeIndex = sizes.length - 1; sizeIndex > 0; sizeIndex--) {\n const size = sizes[sizeIndex]\n tmpArray2 = []\n\n // aggregate the elements of the current tmpArray in elements of the requested size\n const length = tmpArray.length / size\n for (let i = 0; i < length; i++) {\n tmpArray2.push(tmpArray.slice(i * size, (i + 1) * size))\n }\n // set it as the new tmpArray for the next loop turn or for return\n tmpArray = tmpArray2\n }\n\n return tmpArray\n}\n\n/**\n * Squeeze a multi dimensional array\n * @param {Array} array\n * @param {Array} [size]\n * @returns {Array} returns the array itself\n */\nexport function squeeze (array, size) {\n const s = size || arraySize(array)\n\n // squeeze outer dimensions\n while (Array.isArray(array) && array.length === 1) {\n array = array[0]\n s.shift()\n }\n\n // find the first dimension to be squeezed\n let dims = s.length\n while (s[dims - 1] === 1) {\n dims--\n }\n\n // squeeze inner dimensions\n if (dims < s.length) {\n array = _squeeze(array, dims, 0)\n s.length = dims\n }\n\n return array\n}\n\n/**\n * Recursively squeeze a multi dimensional array\n * @param {Array} array\n * @param {number} dims Required number of dimensions\n * @param {number} dim Current dimension\n * @returns {Array | *} Returns the squeezed array\n * @private\n */\nfunction _squeeze (array, dims, dim) {\n let i, ii\n\n if (dim < dims) {\n const next = dim + 1\n for (i = 0, ii = array.length; i < ii; i++) {\n array[i] = _squeeze(array[i], dims, next)\n }\n } else {\n while (Array.isArray(array)) {\n array = array[0]\n }\n }\n\n return array\n}\n\n/**\n * Unsqueeze a multi dimensional array: add dimensions when missing\n *\n * Parameter `size` will be mutated to match the new, unsqueezed matrix size.\n *\n * @param {Array} array\n * @param {number} dims Desired number of dimensions of the array\n * @param {number} [outer] Number of outer dimensions to be added\n * @param {Array} [size] Current size of array.\n * @returns {Array} returns the array itself\n * @private\n */\nexport function unsqueeze (array, dims, outer, size) {\n const s = size || arraySize(array)\n\n // unsqueeze outer dimensions\n if (outer) {\n for (let i = 0; i < outer; i++) {\n array = [array]\n s.unshift(1)\n }\n }\n\n // unsqueeze inner dimensions\n array = _unsqueeze(array, dims, 0)\n while (s.length < dims) {\n s.push(1)\n }\n\n return array\n}\n\n/**\n * Recursively unsqueeze a multi dimensional array\n * @param {Array} array\n * @param {number} dims Required number of dimensions\n * @param {number} dim Current dimension\n * @returns {Array | *} Returns the unsqueezed array\n * @private\n */\nfunction _unsqueeze (array, dims, dim) {\n let i, ii\n\n if (Array.isArray(array)) {\n const next = dim + 1\n for (i = 0, ii = array.length; i < ii; i++) {\n array[i] = _unsqueeze(array[i], dims, next)\n }\n } else {\n for (let d = dim; d < dims; d++) {\n array = [array]\n }\n }\n\n return array\n}\n/**\n * Flatten a multi dimensional array, put all elements in a one dimensional\n * array\n * @param {Array} array A multi dimensional array\n * @param {boolean} isRectangular Optional. If the array is rectangular (not jagged)\n * @return {Array} The flattened array (1 dimensional)\n */\nexport function flatten (array, isRectangular = false) {\n if (!Array.isArray(array)) {\n // if not an array, return as is\n return array\n }\n if (typeof isRectangular !== 'boolean') {\n throw new TypeError('Boolean expected for second argument of flatten')\n }\n const flat = []\n\n if (isRectangular) {\n _flattenRectangular(array)\n } else {\n _flatten(array)\n }\n\n return flat\n\n function _flatten (array) {\n for (let i = 0; i < array.length; i++) {\n const item = array[i]\n if (Array.isArray(item)) {\n _flatten(item)\n } else {\n flat.push(item)\n }\n }\n }\n\n function _flattenRectangular (array) {\n if (Array.isArray(array[0])) {\n for (let i = 0; i < array.length; i++) {\n _flattenRectangular(array[i])\n }\n } else {\n for (let i = 0; i < array.length; i++) {\n flat.push(array[i])\n }\n }\n }\n}\n\n/**\n * A safe map\n * @param {Array} array\n * @param {function} callback\n */\nexport function map (array, callback) {\n return Array.prototype.map.call(array, callback)\n}\n\n/**\n * A safe forEach\n * @param {Array} array\n * @param {function} callback\n */\nexport function forEach (array, callback) {\n Array.prototype.forEach.call(array, callback)\n}\n\n/**\n * A safe filter\n * @param {Array} array\n * @param {function} callback\n */\nexport function filter (array, callback) {\n if (arraySize(array).length !== 1) {\n throw new Error('Only one dimensional matrices supported')\n }\n\n return Array.prototype.filter.call(array, callback)\n}\n\n/**\n * Filter values in an array given a regular expression\n * @param {Array} array\n * @param {RegExp} regexp\n * @return {Array} Returns the filtered array\n * @private\n */\nexport function filterRegExp (array, regexp) {\n if (arraySize(array).length !== 1) {\n throw new Error('Only one dimensional matrices supported')\n }\n\n return Array.prototype.filter.call(array, (entry) => regexp.test(entry))\n}\n\n/**\n * A safe join\n * @param {Array} array\n * @param {string} separator\n */\nexport function join (array, separator) {\n return Array.prototype.join.call(array, separator)\n}\n\n/**\n * Assign a numeric identifier to every element of a sorted array\n * @param {Array} a An array\n * @return {Array} An array of objects containing the original value and its identifier\n */\nexport function identify (a) {\n if (!Array.isArray(a)) {\n throw new TypeError('Array input expected')\n }\n\n if (a.length === 0) {\n return a\n }\n\n const b = []\n let count = 0\n b[0] = { value: a[0], identifier: 0 }\n for (let i = 1; i < a.length; i++) {\n if (a[i] === a[i - 1]) {\n count++\n } else {\n count = 0\n }\n b.push({ value: a[i], identifier: count })\n }\n return b\n}\n\n/**\n * Remove the numeric identifier from the elements\n * @param {array} a An array\n * @return {array} An array of values without identifiers\n */\nexport function generalize (a) {\n if (!Array.isArray(a)) {\n throw new TypeError('Array input expected')\n }\n\n if (a.length === 0) {\n return a\n }\n\n const b = []\n for (let i = 0; i < a.length; i++) {\n b.push(a[i].value)\n }\n return b\n}\n\n/**\n * Check the datatype of a given object\n * This is a low level implementation that should only be used by\n * parent Matrix classes such as SparseMatrix or DenseMatrix\n * This method does not validate Array Matrix shape\n * @param {Array} array\n * @param {function} typeOf Callback function to use to determine the type of a value\n * @return {string}\n */\nexport function getArrayDataType (array, typeOf) {\n let type // to hold type info\n let length = 0 // to hold length value to ensure it has consistent sizes\n\n for (let i = 0; i < array.length; i++) {\n const item = array[i]\n const isArray = Array.isArray(item)\n\n // Saving the target matrix row size\n if (i === 0 && isArray) {\n length = item.length\n }\n\n // If the current item is an array but the length does not equal the targetVectorSize\n if (isArray && item.length !== length) {\n return undefined\n }\n\n const itemType = isArray\n ? getArrayDataType(item, typeOf) // recurse into a nested array\n : typeOf(item)\n\n if (type === undefined) {\n type = itemType // first item\n } else if (type !== itemType) {\n return 'mixed'\n } else {\n // we're good, everything has the same type so far\n }\n }\n\n return type\n}\n\n/**\n * Return the last item from an array\n * @param {Array} array\n * @returns {*}\n */\nexport function last (array) {\n return array[array.length - 1]\n}\n\n/**\n * Get all but the last element of array.\n * @param {Array} array\n * @returns {Array}\n */\nexport function initial (array) {\n return array.slice(0, array.length - 1)\n}\n\n/**\n * Recursively concatenate two matrices.\n * The contents of the matrices are not cloned.\n * @param {Array} a Multi dimensional array\n * @param {Array} b Multi dimensional array\n * @param {number} concatDim The dimension on which to concatenate (zero-based)\n * @param {number} dim The current dim (zero-based)\n * @return {Array} c The concatenated matrix\n * @private\n */\nfunction concatRecursive (a, b, concatDim, dim) {\n if (dim < concatDim) {\n // recurse into next dimension\n if (a.length !== b.length) {\n throw new DimensionError(a.length, b.length)\n }\n\n const c = []\n for (let i = 0; i < a.length; i++) {\n c[i] = concatRecursive(a[i], b[i], concatDim, dim + 1)\n }\n return c\n } else {\n // concatenate this dimension\n return a.concat(b)\n }\n}\n\n/**\n * Concatenates many arrays in the specified direction\n * @param {...Array} arrays All the arrays to concatenate\n * @param {number} concatDim The dimension on which to concatenate (zero-based)\n * @returns {Array}\n */\nexport function concat () {\n const arrays = Array.prototype.slice.call(arguments, 0, -1)\n const concatDim = Array.prototype.slice.call(arguments, -1)\n\n if (arrays.length === 1) {\n return arrays[0]\n }\n if (arrays.length > 1) {\n return arrays.slice(1).reduce(function (A, B) { return concatRecursive(A, B, concatDim, 0) }, arrays[0])\n } else {\n throw new Error('Wrong number of arguments in function concat')\n }\n}\n\n/**\n * Receives two or more sizes and gets the broadcasted size for both.\n * @param {...number[]} sizes Sizes to broadcast together\n * @returns {number[]} The broadcasted size\n */\nexport function broadcastSizes (...sizes) {\n const dimensions = sizes.map((s) => s.length)\n const N = Math.max(...dimensions)\n const sizeMax = new Array(N).fill(null)\n // check for every size\n for (let i = 0; i < sizes.length; i++) {\n const size = sizes[i]\n const dim = dimensions[i]\n for (let j = 0; j < dim; j++) {\n const n = N - dim + j\n if (size[j] > sizeMax[n]) {\n sizeMax[n] = size[j]\n }\n }\n }\n for (let i = 0; i < sizes.length; i++) {\n checkBroadcastingRules(sizes[i], sizeMax)\n }\n return sizeMax\n}\n\n/**\n * Checks if it's possible to broadcast a size to another size\n * @param {number[]} size The size of the array to check\n * @param {number[]} toSize The size of the array to validate if it can be broadcasted to\n */\nexport function checkBroadcastingRules (size, toSize) {\n const N = toSize.length\n const dim = size.length\n for (let j = 0; j < dim; j++) {\n const n = N - dim + j\n if ((size[j] < toSize[n] && size[j] > 1) || (size[j] > toSize[n])) {\n throw new Error(\n `shape mismatch: mismatch is found in arg with shape (${size}) not possible to broadcast dimension ${dim} with size ${size[j]} to size ${toSize[n]}`\n )\n }\n }\n}\n\n/**\n * Broadcasts a single array to a certain size\n * @param {Array} array Array to be broadcasted\n * @param {number[]} toSize Size to broadcast the array\n * @returns {Array} The broadcasted array\n */\nexport function broadcastTo (array, toSize) {\n let Asize = arraySize(array)\n if (deepStrictEqual(Asize, toSize)) {\n return array\n }\n checkBroadcastingRules(Asize, toSize)\n const broadcastedSize = broadcastSizes(Asize, toSize)\n const N = broadcastedSize.length\n const paddedSize = [...Array(N - Asize.length).fill(1), ...Asize]\n\n let A = clone(array)\n // reshape A if needed to make it ready for concat\n if (Asize.length < N) {\n A = reshape(A, paddedSize)\n Asize = arraySize(A)\n }\n\n // stretches the array on each dimension to make it the same size as index\n for (let dim = 0; dim < N; dim++) {\n if (Asize[dim] < broadcastedSize[dim]) {\n A = stretch(A, broadcastedSize[dim], dim)\n Asize = arraySize(A)\n }\n }\n return A\n}\n\n/**\n * Broadcasts arrays and returns the broadcasted arrays in an array\n * @param {...Array | any} arrays\n * @returns {Array[]} The broadcasted arrays\n */\nexport function broadcastArrays (...arrays) {\n if (arrays.length === 0) {\n throw new Error('Insufficient number of arguments in function broadcastArrays')\n }\n if (arrays.length === 1) {\n return arrays[0]\n }\n const sizes = arrays.map(function (array) { return arraySize(array) })\n const broadcastedSize = broadcastSizes(...sizes)\n const broadcastedArrays = []\n arrays.forEach(function (array) { broadcastedArrays.push(broadcastTo(array, broadcastedSize)) })\n return broadcastedArrays\n}\n\n/**\n * Stretches a matrix up to a certain size in a certain dimension\n * @param {Array} arrayToStretch\n * @param {number[]} sizeToStretch\n * @param {number} dimToStretch\n * @returns {Array} The stretched array\n */\nexport function stretch (arrayToStretch, sizeToStretch, dimToStretch) {\n return concat(...Array(sizeToStretch).fill(arrayToStretch), dimToStretch)\n}\n\n/**\n* Retrieves a single element from an array given an index.\n*\n* @param {Array} array - The array from which to retrieve the value.\n* @param {Array} index - An array of indices specifying the position of the desired element in each dimension.\n* @returns {*} - The value at the specified position in the array.\n*\n* @example\n* const arr = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]];\n* const index = [1, 0, 1];\n* console.log(get(arr, index)); // 6\n*/\nexport function get (array, index) {\n if (!Array.isArray(array)) { throw new Error('Array expected') }\n const size = arraySize(array)\n if (index.length !== size.length) { throw new DimensionError(index.length, size.length) }\n for (let x = 0; x < index.length; x++) { validateIndex(index[x], size[x]) }\n return index.reduce((acc, curr) => acc[curr], array)\n}\n\n/**\n * Recursively maps over each element of nested array using a provided callback function.\n *\n * @param {Array} array - The array to be mapped.\n * @param {Function} callback - The function to execute on each element, taking three arguments:\n * - `value` (any): The current element being processed in the array.\n * - `index` (Array): The index of the current element being processed in the array.\n * - `array` (Array): The array `deepMap` was called upon.\n * @param {boolean} [skipIndex=false] - If true, the callback function is called with only the value.\n * @returns {Array} A new array with each element being the result of the callback function.\n */\nexport function deepMap (array, callback, skipIndex = false) {\n if (array.length === 0) {\n return []\n }\n\n if (skipIndex) {\n return recursiveMap(array)\n }\n const index = []\n\n return recursiveMapWithIndex(array, 0)\n\n function recursiveMapWithIndex (value, depth) {\n if (Array.isArray(value)) {\n const N = value.length\n const result = Array(N)\n for (let i = 0; i < N; i++) {\n index[depth] = i\n result[i] = recursiveMapWithIndex(value[i], depth + 1)\n }\n return result\n } else {\n return callback(value, index.slice(0, depth), array)\n }\n }\n function recursiveMap (value) {\n if (Array.isArray(value)) {\n const N = value.length\n const result = Array(N)\n for (let i = 0; i < N; i++) {\n result[i] = recursiveMap(value[i])\n }\n return result\n } else {\n return callback(value)\n }\n }\n}\n\n/**\n * Recursively iterates over each element in a multi-dimensional array and applies a callback function.\n *\n * @param {Array} array - The multi-dimensional array to iterate over.\n * @param {Function} callback - The function to execute for each element. It receives three arguments:\n * - {any} value: The current element being processed in the array.\n * - {Array} index: The index of the current element in each dimension.\n * - {Array} array: The original array being processed.\n * @param {boolean} [skipIndex=false] - If true, the callback function is called with only the value.\n */\nexport function deepForEach (array, callback, skipIndex = false) {\n if (array.length === 0) {\n return\n }\n\n if (skipIndex) {\n recursiveForEach(array)\n return\n }\n const index = []\n recursiveForEachWithIndex(array, 0)\n\n function recursiveForEachWithIndex (value, depth) {\n if (Array.isArray(value)) {\n const N = value.length\n for (let i = 0; i < N; i++) {\n index[depth] = i\n recursiveForEachWithIndex(value[i], depth + 1)\n }\n } else {\n callback(value, index.slice(0, depth), array)\n }\n }\n function recursiveForEach (value) {\n if (Array.isArray(value)) {\n const N = value.length\n for (let i = 0; i < N; i++) {\n recursiveForEach(value[i])\n }\n } else {\n callback(value)\n }\n }\n}\n\n/**\n * Deep clones a multidimensional array\n * @param {Array} array\n * @returns {Array} cloned array\n */\nexport function clone (array) {\n return Object.assign([], array)\n}\n","import typed from 'typed-function'\nimport { get, arraySize } from './array.js'\nimport { typeOf as _typeOf } from './is.js'\n\n/**\n * Simplifies a callback function by reducing its complexity and potentially improving its performance.\n *\n * @param {Function} callback The original callback function to simplify.\n * @param {Array|Matrix} array The array that will be used with the callback function.\n * @param {string} name The name of the function that is using the callback.\n * @param {boolean} [isUnary=false] If true, the callback function is unary and will be optimized as such.\n * @returns {Function} Returns a simplified version of the callback function.\n */\nexport function optimizeCallback (callback, array, name, isUnary = false) {\n if (typed.isTypedFunction(callback)) {\n let numberOfArguments\n if (isUnary) {\n numberOfArguments = 1\n } else {\n const firstIndex = (array.isMatrix ? array.size() : arraySize(array)).map(() => 0)\n const firstValue = array.isMatrix ? array.get(firstIndex) : get(array, firstIndex)\n numberOfArguments = _findNumberOfArgumentsTyped(callback, firstValue, firstIndex, array)\n }\n let fastCallback\n if (array.isMatrix && (array.dataType !== 'mixed' && array.dataType !== undefined)) {\n const singleSignature = _findSingleSignatureWithArity(callback, numberOfArguments)\n fastCallback = (singleSignature !== undefined) ? singleSignature : callback\n } else {\n fastCallback = callback\n }\n if (numberOfArguments >= 1 && numberOfArguments <= 3) {\n return {\n isUnary: numberOfArguments === 1,\n fn: (...args) => _tryFunctionWithArgs(fastCallback, args.slice(0, numberOfArguments), name, callback.name)\n }\n }\n return { isUnary: false, fn: (...args) => _tryFunctionWithArgs(fastCallback, args, name, callback.name) }\n }\n if (isUnary === undefined) {\n return { isUnary: _findIfCallbackIsUnary(callback), fn: callback }\n } else {\n return { isUnary, fn: callback }\n }\n}\n\nfunction _findSingleSignatureWithArity (callback, arity) {\n const matchingFunctions = []\n Object.entries(callback.signatures).forEach(([signature, func]) => {\n if (signature.split(',').length === arity) {\n matchingFunctions.push(func)\n }\n })\n if (matchingFunctions.length === 1) {\n return matchingFunctions[0]\n }\n}\n\n/**\n * Determines if a given callback function is unary (i.e., takes exactly one argument).\n *\n * This function checks the following conditions to determine if the callback is unary:\n * 1. The callback function should have exactly one parameter.\n * 2. The callback function should not use the `arguments` object.\n * 3. The callback function should not use rest parameters (`...`).\n * If in doubt, this function shall return `false` to be safe\n *\n * @param {Function} callback - The callback function to be checked.\n * @returns {boolean} - Returns `true` if the callback is unary, otherwise `false`.\n */\nfunction _findIfCallbackIsUnary (callback) {\n if (callback.length !== 1) return false\n\n const callbackStr = callback.toString()\n // Check if the callback function uses `arguments`\n if (/arguments/.test(callbackStr)) return false\n\n // Extract the parameters of the callback function\n const paramsStr = callbackStr.match(/\\(.*?\\)/)\n // Check if the callback function uses rest parameters\n if (/\\.\\.\\./.test(paramsStr)) return false\n return true\n}\n\nfunction _findNumberOfArgumentsTyped (callback, value, index, array) {\n const testArgs = [value, index, array]\n for (let i = 3; i > 0; i--) {\n const args = testArgs.slice(0, i)\n if (typed.resolve(callback, args) !== null) {\n return i\n }\n }\n}\n\n/**\n * @param {function} func The selected function taken from one of the signatures of the callback function\n * @param {Array} args List with arguments to apply to the selected signature\n * @param {string} mappingFnName the name of the function that is using the callback\n * @param {string} callbackName the name of the callback function\n * @returns {*} Returns the return value of the invoked signature\n * @throws {TypeError} Throws an error when no matching signature was found\n */\nfunction _tryFunctionWithArgs (func, args, mappingFnName, callbackName) {\n try {\n return func(...args)\n } catch (err) {\n _createCallbackError(err, args, mappingFnName, callbackName)\n }\n}\n\n/**\n * Creates and throws a detailed TypeError when a callback function fails.\n *\n * @param {Error} err The original error thrown by the callback function.\n * @param {Array} args The arguments that were passed to the callback function.\n * @param {string} mappingFnName The name of the function that is using the callback.\n * @param {string} callbackName The name of the callback function.\n * @throws {TypeError} Throws a detailed TypeError with enriched error message.\n */\nfunction _createCallbackError (err, args, mappingFnName, callbackName) {\n // Enrich the error message so the user understands that it took place inside the callback function\n if (err instanceof TypeError && err.data?.category === 'wrongType') {\n const argsDesc = []\n argsDesc.push(`value: ${_typeOf(args[0])}`)\n if (args.length >= 2) { argsDesc.push(`index: ${_typeOf(args[1])}`) }\n if (args.length >= 3) { argsDesc.push(`array: ${_typeOf(args[2])}`) }\n\n throw new TypeError(`Function ${mappingFnName} cannot apply callback arguments ` +\n `${callbackName}(${argsDesc.join(', ')}) at index ${JSON.stringify(args[1])}`)\n } else {\n throw new TypeError(`Function ${mappingFnName} cannot apply callback arguments ` +\n `to function ${callbackName}: ${err.message}`)\n }\n}\n","// deno-lint-ignore-file no-this-alias\nimport { isArray, isBigNumber, isCollection, isIndex, isMatrix, isNumber, isString, typeOf } from '../../utils/is.js'\nimport { arraySize, getArrayDataType, processSizesWildcard, reshape, resize, unsqueeze, validate, validateIndex, broadcastTo, get } from '../../utils/array.js'\nimport { format } from '../../utils/string.js'\nimport { isInteger } from '../../utils/number.js'\nimport { clone, deepStrictEqual } from '../../utils/object.js'\nimport { DimensionError } from '../../error/DimensionError.js'\nimport { factory } from '../../utils/factory.js'\nimport { optimizeCallback } from '../../utils/optimizeCallback.js'\n\nconst name = 'DenseMatrix'\nconst dependencies = [\n 'Matrix'\n]\n\nexport const createDenseMatrixClass = /* #__PURE__ */ factory(name, dependencies, ({ Matrix }) => {\n /**\n * Dense Matrix implementation. A regular, dense matrix, supporting multi-dimensional matrices. This is the default matrix type.\n * @class DenseMatrix\n * @enum {{ value, index: number[] }}\n */\n function DenseMatrix (data, datatype) {\n if (!(this instanceof DenseMatrix)) { throw new SyntaxError('Constructor must be called with the new operator') }\n if (datatype && !isString(datatype)) { throw new Error('Invalid datatype: ' + datatype) }\n\n if (isMatrix(data)) {\n // check data is a DenseMatrix\n if (data.type === 'DenseMatrix') {\n // clone data & size\n this._data = clone(data._data)\n this._size = clone(data._size)\n this._datatype = datatype || data._datatype\n } else {\n // build data from existing matrix\n this._data = data.toArray()\n this._size = data.size()\n this._datatype = datatype || data._datatype\n }\n } else if (data && isArray(data.data) && isArray(data.size)) {\n // initialize fields from JSON representation\n this._data = data.data\n this._size = data.size\n // verify the dimensions of the array\n validate(this._data, this._size)\n this._datatype = datatype || data.datatype\n } else if (isArray(data)) {\n // replace nested Matrices with Arrays\n this._data = preprocess(data)\n // get the dimensions of the array\n this._size = arraySize(this._data)\n // verify the dimensions of the array, TODO: compute size while processing array\n validate(this._data, this._size)\n // data type unknown\n this._datatype = datatype\n } else if (data) {\n // unsupported type\n throw new TypeError('Unsupported type of data (' + typeOf(data) + ')')\n } else {\n // nothing provided\n this._data = []\n this._size = [0]\n this._datatype = datatype\n }\n }\n\n DenseMatrix.prototype = new Matrix()\n\n /**\n * Create a new DenseMatrix\n */\n DenseMatrix.prototype.createDenseMatrix = function (data, datatype) {\n return new DenseMatrix(data, datatype)\n }\n\n /**\n * Attach type information\n */\n Object.defineProperty(DenseMatrix, 'name', { value: 'DenseMatrix' })\n DenseMatrix.prototype.constructor = DenseMatrix\n DenseMatrix.prototype.type = 'DenseMatrix'\n DenseMatrix.prototype.isDenseMatrix = true\n\n /**\n * Get the matrix type\n *\n * Usage:\n * const matrixType = matrix.getDataType() // retrieves the matrix type\n *\n * @memberOf DenseMatrix\n * @return {string} type information; if multiple types are found from the Matrix, it will return \"mixed\"\n */\n DenseMatrix.prototype.getDataType = function () {\n return getArrayDataType(this._data, typeOf)\n }\n\n /**\n * Get the storage format used by the matrix.\n *\n * Usage:\n * const format = matrix.storage() // retrieve storage format\n *\n * @memberof DenseMatrix\n * @return {string} The storage format.\n */\n DenseMatrix.prototype.storage = function () {\n return 'dense'\n }\n\n /**\n * Get the datatype of the data stored in the matrix.\n *\n * Usage:\n * const format = matrix.datatype() // retrieve matrix datatype\n *\n * @memberof DenseMatrix\n * @return {string} The datatype.\n */\n DenseMatrix.prototype.datatype = function () {\n return this._datatype\n }\n\n /**\n * Create a new DenseMatrix\n * @memberof DenseMatrix\n * @param {Array} data\n * @param {string} [datatype]\n */\n DenseMatrix.prototype.create = function (data, datatype) {\n return new DenseMatrix(data, datatype)\n }\n\n /**\n * Get a subset of the matrix, or replace a subset of the matrix.\n *\n * Usage:\n * const subset = matrix.subset(index) // retrieve subset\n * const value = matrix.subset(index, replacement) // replace subset\n *\n * @memberof DenseMatrix\n * @param {Index} index\n * @param {Array | Matrix | *} [replacement]\n * @param {*} [defaultValue=0] Default value, filled in on new entries when\n * the matrix is resized. If not provided,\n * new matrix elements will be filled with zeros.\n */\n DenseMatrix.prototype.subset = function (index, replacement, defaultValue) {\n switch (arguments.length) {\n case 1:\n return _get(this, index)\n\n // intentional fall through\n case 2:\n case 3:\n return _set(this, index, replacement, defaultValue)\n\n default:\n throw new SyntaxError('Wrong number of arguments')\n }\n }\n\n /**\n * Get a single element from the matrix.\n * @memberof DenseMatrix\n * @param {number[]} index Zero-based index\n * @return {*} value\n */\n DenseMatrix.prototype.get = function (index) {\n return get(this._data, index)\n }\n\n /**\n * Replace a single element in the matrix.\n * @memberof DenseMatrix\n * @param {number[]} index Zero-based index\n * @param {*} value\n * @param {*} [defaultValue] Default value, filled in on new entries when\n * the matrix is resized. If not provided,\n * new matrix elements will be left undefined.\n * @return {DenseMatrix} self\n */\n DenseMatrix.prototype.set = function (index, value, defaultValue) {\n if (!isArray(index)) { throw new TypeError('Array expected') }\n if (index.length < this._size.length) { throw new DimensionError(index.length, this._size.length, '<') }\n\n let i, ii, indexI\n\n // enlarge matrix when needed\n const size = index.map(function (i) {\n return i + 1\n })\n _fit(this, size, defaultValue)\n\n // traverse over the dimensions\n let data = this._data\n for (i = 0, ii = index.length - 1; i < ii; i++) {\n indexI = index[i]\n validateIndex(indexI, data.length)\n data = data[indexI]\n }\n\n // set new value\n indexI = index[index.length - 1]\n validateIndex(indexI, data.length)\n data[indexI] = value\n\n return this\n }\n\n /**\n * Get a submatrix of this matrix\n * @memberof DenseMatrix\n * @param {DenseMatrix} matrix\n * @param {Index} index Zero-based index\n * @private\n */\n function _get (matrix, index) {\n if (!isIndex(index)) {\n throw new TypeError('Invalid index')\n }\n\n const isScalar = index.isScalar()\n if (isScalar) {\n // return a scalar\n return matrix.get(index.min())\n } else {\n // validate dimensions\n const size = index.size()\n if (size.length !== matrix._size.length) {\n throw new DimensionError(size.length, matrix._size.length)\n }\n\n // validate if any of the ranges in the index is out of range\n const min = index.min()\n const max = index.max()\n for (let i = 0, ii = matrix._size.length; i < ii; i++) {\n validateIndex(min[i], matrix._size[i])\n validateIndex(max[i], matrix._size[i])\n }\n\n // retrieve submatrix\n const returnMatrix = new DenseMatrix([])\n const submatrix = _getSubmatrix(matrix._data, index)\n returnMatrix._size = submatrix.size\n returnMatrix._datatype = matrix._datatype\n returnMatrix._data = submatrix.data\n return returnMatrix\n }\n }\n\n /**\n * Get a submatrix of a multi dimensional matrix.\n * Index is not checked for correct number or length of dimensions.\n * @memberof DenseMatrix\n * @param {Array} data\n * @param {Index} index\n * @return {Array} submatrix\n * @private\n */\n function _getSubmatrix (data, index) {\n const maxDepth = index.size().length - 1\n const size = Array(maxDepth)\n return { data: getSubmatrixRecursive(data), size }\n\n function getSubmatrixRecursive (data, depth = 0) {\n const ranges = index.dimension(depth)\n size[depth] = ranges.size()[0]\n if (depth < maxDepth) {\n return ranges.map(rangeIndex => {\n validateIndex(rangeIndex, data.length)\n return getSubmatrixRecursive(data[rangeIndex], depth + 1)\n }).valueOf()\n } else {\n return ranges.map(rangeIndex => {\n validateIndex(rangeIndex, data.length)\n return data[rangeIndex]\n }).valueOf()\n }\n }\n }\n\n /**\n * Replace a submatrix in this matrix\n * Indexes are zero-based.\n * @memberof DenseMatrix\n * @param {DenseMatrix} matrix\n * @param {Index} index\n * @param {DenseMatrix | Array | *} submatrix\n * @param {*} defaultValue Default value, filled in on new entries when\n * the matrix is resized.\n * @return {DenseMatrix} matrix\n * @private\n */\n function _set (matrix, index, submatrix, defaultValue) {\n if (!index || index.isIndex !== true) {\n throw new TypeError('Invalid index')\n }\n\n // get index size and check whether the index contains a single value\n const iSize = index.size()\n const isScalar = index.isScalar()\n\n // calculate the size of the submatrix, and convert it into an Array if needed\n let sSize\n if (isMatrix(submatrix)) {\n sSize = submatrix.size()\n submatrix = submatrix.valueOf()\n } else {\n sSize = arraySize(submatrix)\n }\n\n if (isScalar) {\n // set a scalar\n\n // check whether submatrix is a scalar\n if (sSize.length !== 0) {\n throw new TypeError('Scalar expected')\n }\n matrix.set(index.min(), submatrix, defaultValue)\n } else {\n // set a submatrix\n\n // broadcast submatrix\n if (!deepStrictEqual(sSize, iSize)) {\n try {\n if (sSize.length === 0) {\n submatrix = broadcastTo([submatrix], iSize)\n } else {\n submatrix = broadcastTo(submatrix, iSize)\n }\n sSize = arraySize(submatrix)\n } catch {\n }\n }\n\n // validate dimensions\n if (iSize.length < matrix._size.length) {\n throw new DimensionError(iSize.length, matrix._size.length, '<')\n }\n\n if (sSize.length < iSize.length) {\n // calculate number of missing outer dimensions\n let i = 0\n let outer = 0\n while (iSize[i] === 1 && sSize[i] === 1) {\n i++\n }\n while (iSize[i] === 1) {\n outer++\n i++\n }\n\n // unsqueeze both outer and inner dimensions\n submatrix = unsqueeze(submatrix, iSize.length, outer, sSize)\n }\n\n // check whether the size of the submatrix matches the index size\n if (!deepStrictEqual(iSize, sSize)) {\n throw new DimensionError(iSize, sSize, '>')\n }\n\n // enlarge matrix when needed\n const size = index.max().map(function (i) {\n return i + 1\n })\n _fit(matrix, size, defaultValue)\n\n // insert the sub matrix\n _setSubmatrix(matrix._data, index, submatrix)\n }\n\n return matrix\n }\n\n /**\n * Replace a submatrix of a multi dimensional matrix.\n * @memberof DenseMatrix\n * @param {Array} data\n * @param {Index} index\n * @param {Array} submatrix\n * @private\n */\n function _setSubmatrix (data, index, submatrix) {\n const maxDepth = index.size().length - 1\n\n setSubmatrixRecursive(data, submatrix)\n\n function setSubmatrixRecursive (data, submatrix, depth = 0) {\n const range = index.dimension(depth)\n if (depth < maxDepth) {\n range.forEach((rangeIndex, i) => {\n validateIndex(rangeIndex, data.length)\n setSubmatrixRecursive(data[rangeIndex], submatrix[i[0]], depth + 1)\n })\n } else {\n range.forEach((rangeIndex, i) => {\n validateIndex(rangeIndex, data.length)\n data[rangeIndex] = submatrix[i[0]]\n })\n }\n }\n }\n\n /**\n * Resize the matrix to the given size. Returns a copy of the matrix when\n * `copy=true`, otherwise return the matrix itself (resize in place).\n *\n * @memberof DenseMatrix\n * @param {number[] || Matrix} size The new size the matrix should have.\n * @param {*} [defaultValue=0] Default value, filled in on new entries.\n * If not provided, the matrix elements will\n * be filled with zeros.\n * @param {boolean} [copy] Return a resized copy of the matrix\n *\n * @return {Matrix} The resized matrix\n */\n DenseMatrix.prototype.resize = function (size, defaultValue, copy) {\n // validate arguments\n if (!isCollection(size)) {\n throw new TypeError('Array or Matrix expected')\n }\n\n // SparseMatrix input is always 2d, flatten this into 1d if it's indeed a vector\n const sizeArray = size.valueOf().map(value => {\n return Array.isArray(value) && value.length === 1\n ? value[0]\n : value\n })\n\n // matrix to resize\n const m = copy ? this.clone() : this\n // resize matrix\n return _resize(m, sizeArray, defaultValue)\n }\n\n function _resize (matrix, size, defaultValue) {\n // check size\n if (size.length === 0) {\n // first value in matrix\n let v = matrix._data\n // go deep\n while (isArray(v)) {\n v = v[0]\n }\n return v\n }\n // resize matrix\n matrix._size = size.slice(0) // copy the array\n matrix._data = resize(matrix._data, matrix._size, defaultValue)\n // return matrix\n return matrix\n }\n\n /**\n * Reshape the matrix to the given size. Returns a copy of the matrix when\n * `copy=true`, otherwise return the matrix itself (reshape in place).\n *\n * NOTE: This might be better suited to copy by default, instead of modifying\n * in place. For now, it operates in place to remain consistent with\n * resize().\n *\n * @memberof DenseMatrix\n * @param {number[]} size The new size the matrix should have.\n * @param {boolean} [copy] Return a reshaped copy of the matrix\n *\n * @return {Matrix} The reshaped matrix\n */\n DenseMatrix.prototype.reshape = function (size, copy) {\n const m = copy ? this.clone() : this\n\n m._data = reshape(m._data, size)\n const currentLength = m._size.reduce((length, size) => length * size)\n m._size = processSizesWildcard(size, currentLength)\n return m\n }\n\n /**\n * Enlarge the matrix when it is smaller than given size.\n * If the matrix is larger or equal sized, nothing is done.\n * @memberof DenseMatrix\n * @param {DenseMatrix} matrix The matrix to be resized\n * @param {number[]} size\n * @param {*} defaultValue Default value, filled in on new entries.\n * @private\n */\n function _fit (matrix, size, defaultValue) {\n const // copy the array\n newSize = matrix._size.slice(0)\n\n let changed = false\n\n // add dimensions when needed\n while (newSize.length < size.length) {\n newSize.push(0)\n changed = true\n }\n\n // enlarge size when needed\n for (let i = 0, ii = size.length; i < ii; i++) {\n if (size[i] > newSize[i]) {\n newSize[i] = size[i]\n changed = true\n }\n }\n\n if (changed) {\n // resize only when size is changed\n _resize(matrix, newSize, defaultValue)\n }\n }\n\n /**\n * Create a clone of the matrix\n * @memberof DenseMatrix\n * @return {DenseMatrix} clone\n */\n DenseMatrix.prototype.clone = function () {\n const m = new DenseMatrix({\n data: clone(this._data),\n size: clone(this._size),\n datatype: this._datatype\n })\n return m\n }\n\n /**\n * Retrieve the size of the matrix.\n * @memberof DenseMatrix\n * @returns {number[]} size\n */\n DenseMatrix.prototype.size = function () {\n return this._size.slice(0) // return a clone of _size\n }\n\n /**\n * Create a new matrix with the results of the callback function executed on\n * each entry of the matrix.\n * @memberof DenseMatrix\n * @param {Function} callback The callback function is invoked with three\n * parameters: the value of the element, the index\n * of the element, and the Matrix being traversed.\n * @param {boolean} skipZeros If true, the callback function is invoked only for non-zero entries\n * @param {boolean} isUnary If true, the callback function is invoked with one parameter\n *\n * @return {DenseMatrix} matrix\n */\n DenseMatrix.prototype.map = function (callback, skipZeros = false, isUnary = false) {\n const me = this\n const maxDepth = me._size.length - 1\n\n if (maxDepth < 0) return me.clone()\n\n const fastCallback = optimizeCallback(callback, me, 'map', isUnary)\n const fastCallbackFn = fastCallback.fn\n\n const result = me.create(undefined, me._datatype)\n result._size = me._size\n if (isUnary || fastCallback.isUnary) {\n result._data = iterateUnary(me._data)\n return result\n }\n if (maxDepth === 0) {\n const inputData = me.valueOf()\n const data = Array(inputData.length)\n for (let i = 0; i < inputData.length; i++) {\n data[i] = fastCallbackFn(inputData[i], [i], me)\n }\n result._data = data\n return result\n }\n\n const index = []\n result._data = iterate(me._data)\n return result\n\n function iterate (data, depth = 0) {\n const result = Array(data.length)\n if (depth < maxDepth) {\n for (let i = 0; i < data.length; i++) {\n index[depth] = i\n result[i] = iterate(data[i], depth + 1)\n }\n } else {\n for (let i = 0; i < data.length; i++) {\n index[depth] = i\n result[i] = fastCallbackFn(data[i], index.slice(), me)\n }\n }\n return result\n }\n\n function iterateUnary (data, depth = 0) {\n const result = Array(data.length)\n if (depth < maxDepth) {\n for (let i = 0; i < data.length; i++) {\n result[i] = iterateUnary(data[i], depth + 1)\n }\n } else {\n for (let i = 0; i < data.length; i++) {\n result[i] = fastCallbackFn(data[i])\n }\n }\n return result\n }\n }\n\n /**\n * Execute a callback function on each entry of the matrix.\n * @memberof DenseMatrix\n * @param {Function} callback The callback function is invoked with three\n * parameters: the value of the element, the index\n * of the element, and the Matrix being traversed.\n * @param {boolean} skipZeros If true, the callback function is invoked only for non-zero entries\n * @param {boolean} isUnary If true, the callback function is invoked with one parameter\n */\n DenseMatrix.prototype.forEach = function (callback, skipZeros = false, isUnary = false) {\n const me = this\n const maxDepth = me._size.length - 1\n\n if (maxDepth < 0) return\n\n const fastCallback = optimizeCallback(callback, me, 'map', isUnary)\n const fastCallbackFn = fastCallback.fn\n if (isUnary || fastCallback.isUnary) {\n iterateUnary(me._data)\n return\n }\n if (maxDepth === 0) {\n for (let i = 0; i < me._data.length; i++) {\n fastCallbackFn(me._data[i], [i], me)\n }\n return\n }\n const index = []\n iterate(me._data)\n\n function iterate (data, depth = 0) {\n if (depth < maxDepth) {\n for (let i = 0; i < data.length; i++) {\n index[depth] = i\n iterate(data[i], depth + 1)\n }\n } else {\n for (let i = 0; i < data.length; i++) {\n index[depth] = i\n fastCallbackFn(data[i], index.slice(), me)\n }\n }\n }\n\n function iterateUnary (data, depth = 0) {\n if (depth < maxDepth) {\n for (let i = 0; i < data.length; i++) {\n iterateUnary(data[i], depth + 1)\n }\n } else {\n for (let i = 0; i < data.length; i++) {\n fastCallbackFn(data[i])\n }\n }\n }\n }\n\n /**\n * Iterate over the matrix elements\n * @return {Iterable<{ value, index: number[] }>}\n */\n DenseMatrix.prototype[Symbol.iterator] = function * () {\n const maxDepth = this._size.length - 1\n\n if (maxDepth < 0) {\n return\n }\n\n if (maxDepth === 0) {\n for (let i = 0; i < this._data.length; i++) {\n yield ({ value: this._data[i], index: [i] })\n }\n return\n }\n\n const index = []\n const recurse = function * (value, depth) {\n if (depth < maxDepth) {\n for (let i = 0; i < value.length; i++) {\n index[depth] = i\n yield * recurse(value[i], depth + 1)\n }\n } else {\n for (let i = 0; i < value.length; i++) {\n index[depth] = i\n yield ({ value: value[i], index: index.slice() })\n }\n }\n }\n yield * recurse(this._data, 0)\n }\n\n /**\n * Returns an array containing the rows of a 2D matrix\n * @returns {Array}\n */\n DenseMatrix.prototype.rows = function () {\n const result = []\n\n const s = this.size()\n if (s.length !== 2) {\n throw new TypeError('Rows can only be returned for a 2D matrix.')\n }\n\n const data = this._data\n for (const row of data) {\n result.push(new DenseMatrix([row], this._datatype))\n }\n\n return result\n }\n\n /**\n * Returns an array containing the columns of a 2D matrix\n * @returns {Array}\n */\n DenseMatrix.prototype.columns = function () {\n const result = []\n\n const s = this.size()\n if (s.length !== 2) {\n throw new TypeError('Rows can only be returned for a 2D matrix.')\n }\n\n const data = this._data\n for (let i = 0; i < s[1]; i++) {\n const col = data.map(row => [row[i]])\n result.push(new DenseMatrix(col, this._datatype))\n }\n\n return result\n }\n\n /**\n * Create an Array with a copy of the data of the DenseMatrix\n * @memberof DenseMatrix\n * @returns {Array} array\n */\n DenseMatrix.prototype.toArray = function () {\n return clone(this._data)\n }\n\n /**\n * Get the primitive value of the DenseMatrix: a multidimensional array\n * @memberof DenseMatrix\n * @returns {Array} array\n */\n DenseMatrix.prototype.valueOf = function () {\n return this._data\n }\n\n /**\n * Get a string representation of the matrix, with optional formatting options.\n * @memberof DenseMatrix\n * @param {Object | number | Function} [options] Formatting options. See\n * lib/utils/number:format for a\n * description of the available\n * options.\n * @returns {string} str\n */\n DenseMatrix.prototype.format = function (options) {\n return format(this._data, options)\n }\n\n /**\n * Get a string representation of the matrix\n * @memberof DenseMatrix\n * @returns {string} str\n */\n DenseMatrix.prototype.toString = function () {\n return format(this._data)\n }\n\n /**\n * Get a JSON representation of the matrix\n * @memberof DenseMatrix\n * @returns {Object}\n */\n DenseMatrix.prototype.toJSON = function () {\n return {\n mathjs: 'DenseMatrix',\n data: this._data,\n size: this._size,\n datatype: this._datatype\n }\n }\n\n /**\n * Get the kth Matrix diagonal.\n *\n * @memberof DenseMatrix\n * @param {number | BigNumber} [k=0] The kth diagonal where the vector will retrieved.\n *\n * @returns {Matrix} The matrix with the diagonal values.\n */\n DenseMatrix.prototype.diagonal = function (k) {\n // validate k if any\n if (k) {\n // convert BigNumber to a number\n if (isBigNumber(k)) { k = k.toNumber() }\n // is must be an integer\n if (!isNumber(k) || !isInteger(k)) {\n throw new TypeError('The parameter k must be an integer number')\n }\n } else {\n // default value\n k = 0\n }\n\n const kSuper = k > 0 ? k : 0\n const kSub = k < 0 ? -k : 0\n\n // rows & columns\n const rows = this._size[0]\n const columns = this._size[1]\n\n // number diagonal values\n const n = Math.min(rows - kSub, columns - kSuper)\n\n // x is a matrix get diagonal from matrix\n const data = []\n\n // loop rows\n for (let i = 0; i < n; i++) {\n data[i] = this._data[i + kSub][i + kSuper]\n }\n\n // create DenseMatrix\n return new DenseMatrix({\n data,\n size: [n],\n datatype: this._datatype\n })\n }\n\n /**\n * Create a diagonal matrix.\n *\n * @memberof DenseMatrix\n * @param {Array} size The matrix size.\n * @param {number | Matrix | Array } value The values for the diagonal.\n * @param {number | BigNumber} [k=0] The kth diagonal where the vector will be filled in.\n * @param {number} [defaultValue] The default value for non-diagonal\n * @param {string} [datatype] The datatype for the diagonal\n *\n * @returns {DenseMatrix}\n */\n DenseMatrix.diagonal = function (size, value, k, defaultValue) {\n if (!isArray(size)) { throw new TypeError('Array expected, size parameter') }\n if (size.length !== 2) { throw new Error('Only two dimensions matrix are supported') }\n\n // map size & validate\n size = size.map(function (s) {\n // check it is a big number\n if (isBigNumber(s)) {\n // convert it\n s = s.toNumber()\n }\n // validate arguments\n if (!isNumber(s) || !isInteger(s) || s < 1) {\n throw new Error('Size values must be positive integers')\n }\n return s\n })\n\n // validate k if any\n if (k) {\n // convert BigNumber to a number\n if (isBigNumber(k)) { k = k.toNumber() }\n // is must be an integer\n if (!isNumber(k) || !isInteger(k)) {\n throw new TypeError('The parameter k must be an integer number')\n }\n } else {\n // default value\n k = 0\n }\n\n const kSuper = k > 0 ? k : 0\n const kSub = k < 0 ? -k : 0\n\n // rows and columns\n const rows = size[0]\n const columns = size[1]\n\n // number of non-zero items\n const n = Math.min(rows - kSub, columns - kSuper)\n\n // value extraction function\n let _value\n\n // check value\n if (isArray(value)) {\n // validate array\n if (value.length !== n) {\n // number of values in array must be n\n throw new Error('Invalid value array length')\n }\n // define function\n _value = function (i) {\n // return value @ i\n return value[i]\n }\n } else if (isMatrix(value)) {\n // matrix size\n const ms = value.size()\n // validate matrix\n if (ms.length !== 1 || ms[0] !== n) {\n // number of values in array must be n\n throw new Error('Invalid matrix length')\n }\n // define function\n _value = function (i) {\n // return value @ i\n return value.get([i])\n }\n } else {\n // define function\n _value = function () {\n // return value\n return value\n }\n }\n\n // discover default value if needed\n if (!defaultValue) {\n // check first value in array\n defaultValue = isBigNumber(_value(0))\n ? _value(0).mul(0) // trick to create a BigNumber with value zero\n : 0\n }\n\n // empty array\n let data = []\n\n // check we need to resize array\n if (size.length > 0) {\n // resize array\n data = resize(data, size, defaultValue)\n // fill diagonal\n for (let d = 0; d < n; d++) {\n data[d + kSub][d + kSuper] = _value(d)\n }\n }\n\n // create DenseMatrix\n return new DenseMatrix({\n data,\n size: [rows, columns]\n })\n }\n\n /**\n * Generate a matrix from a JSON object\n * @memberof DenseMatrix\n * @param {Object} json An object structured like\n * `{\"mathjs\": \"DenseMatrix\", data: [], size: []}`,\n * where mathjs is optional\n * @returns {DenseMatrix}\n */\n DenseMatrix.fromJSON = function (json) {\n return new DenseMatrix(json)\n }\n\n /**\n * Swap rows i and j in Matrix.\n *\n * @memberof DenseMatrix\n * @param {number} i Matrix row index 1\n * @param {number} j Matrix row index 2\n *\n * @return {Matrix} The matrix reference\n */\n DenseMatrix.prototype.swapRows = function (i, j) {\n // check index\n if (!isNumber(i) || !isInteger(i) || !isNumber(j) || !isInteger(j)) {\n throw new Error('Row index must be positive integers')\n }\n // check dimensions\n if (this._size.length !== 2) {\n throw new Error('Only two dimensional matrix is supported')\n }\n // validate index\n validateIndex(i, this._size[0])\n validateIndex(j, this._size[0])\n\n // swap rows\n DenseMatrix._swapRows(i, j, this._data)\n // return current instance\n return this\n }\n\n /**\n * Swap rows i and j in Dense Matrix data structure.\n *\n * @param {number} i Matrix row index 1\n * @param {number} j Matrix row index 2\n * @param {Array} data Matrix data\n */\n DenseMatrix._swapRows = function (i, j, data) {\n // swap values i <-> j\n const vi = data[i]\n data[i] = data[j]\n data[j] = vi\n }\n\n /**\n * Preprocess data, which can be an Array or DenseMatrix with nested Arrays and\n * Matrices. Clones all (nested) Arrays, and replaces all nested Matrices with Arrays\n * @memberof DenseMatrix\n * @param {Array | Matrix} data\n * @return {Array} data\n */\n function preprocess (data) {\n if (isMatrix(data)) {\n return preprocess(data.valueOf())\n }\n\n if (isArray(data)) {\n return data.map(preprocess)\n }\n\n return data\n }\n\n return DenseMatrix\n}, { isClass: true })\n","import { clone as objectClone } from '../../utils/object.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'clone'\nconst dependencies = ['typed']\n\nexport const createClone = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Clone an object. Will make a deep copy of the data.\n *\n * Syntax:\n *\n * math.clone(x)\n *\n * Examples:\n *\n * math.clone(3.5) // returns number 3.5\n * math.clone(math.complex('2-4i')) // returns Complex 2 - 4i\n * math.clone(math.unit(45, 'deg')) // returns Unit 45 deg\n * math.clone([[1, 2], [3, 4]]) // returns Array [[1, 2], [3, 4]]\n * math.clone(\"hello world\") // returns string \"hello world\"\n *\n * @param {*} x Object to be cloned\n * @return {*} A clone of object x\n */\n return typed(name, {\n any: objectClone\n })\n})\n","/**\n * Transpose a matrix\n * @param {Array} mat\n * @returns {Array} ret\n * @private\n */\nexport function _switch (mat) {\n const I = mat.length\n const J = mat[0].length\n let i, j\n const ret = []\n for (j = 0; j < J; j++) {\n const tmp = []\n for (i = 0; i < I; i++) {\n tmp.push(mat[i][j])\n }\n ret.push(tmp)\n }\n return ret\n}\n","import { isCollection, isMatrix } from './is.js'\nimport { IndexError } from '../error/IndexError.js'\nimport { arraySize, deepMap as arrayDeepMap, deepForEach as arrayDeepForEach } from './array.js'\nimport { _switch } from './switch.js'\n\n/**\n * Test whether an array contains collections\n * @param {Array} array\n * @returns {boolean} Returns true when the array contains one or multiple\n * collections (Arrays or Matrices). Returns false otherwise.\n */\nexport function containsCollections (array) {\n for (let i = 0; i < array.length; i++) {\n if (isCollection(array[i])) {\n return true\n }\n }\n return false\n}\n\n/**\n * Recursively loop over all elements in a given multi dimensional array\n * and invoke the callback on each of the elements.\n * @param {Array | Matrix} array\n * @param {Function} callback The callback method is invoked with one\n * parameter: the current element in the array\n */\nexport function deepForEach (array, callback) {\n if (isMatrix(array)) {\n array.forEach(x => callback(x), false, true)\n } else {\n arrayDeepForEach(array, callback, true)\n }\n}\n\n/**\n * Execute the callback function element wise for each element in array and any\n * nested array\n * Returns an array with the results\n * @param {Array | Matrix} array\n * @param {Function} callback The callback is called with two parameters:\n * value1 and value2, which contain the current\n * element of both arrays.\n * @param {boolean} [skipZeros] Invoke callback function for non-zero values only.\n *\n * @return {Array | Matrix} res\n */\nexport function deepMap (array, callback, skipZeros) {\n if (!skipZeros) {\n if (isMatrix(array)) {\n return array.map(x => callback(x), false, true)\n } else {\n return arrayDeepMap(array, callback, true)\n }\n }\n const skipZerosCallback = (x) => x === 0 ? x : callback(x)\n if (isMatrix(array)) {\n return array.map(x => skipZerosCallback(x), false, true)\n } else {\n return arrayDeepMap(array, skipZerosCallback, true)\n }\n}\n\n/**\n * Reduce a given matrix or array to a new matrix or\n * array with one less dimension, applying the given\n * callback in the selected dimension.\n * @param {Array | Matrix} mat\n * @param {number} dim\n * @param {Function} callback\n * @return {Array | Matrix} res\n */\nexport function reduce (mat, dim, callback) {\n const size = Array.isArray(mat) ? arraySize(mat) : mat.size()\n if (dim < 0 || (dim >= size.length)) {\n // TODO: would be more clear when throwing a DimensionError here\n throw new IndexError(dim, size.length)\n }\n\n if (isMatrix(mat)) {\n return mat.create(_reduce(mat.valueOf(), dim, callback), mat.datatype())\n } else {\n return _reduce(mat, dim, callback)\n }\n}\n\n/**\n * Recursively reduce a matrix\n * @param {Array} mat\n * @param {number} dim\n * @param {Function} callback\n * @returns {Array} ret\n * @private\n */\nfunction _reduce (mat, dim, callback) {\n let i, ret, val, tran\n\n if (dim <= 0) {\n if (!Array.isArray(mat[0])) {\n val = mat[0]\n for (i = 1; i < mat.length; i++) {\n val = callback(val, mat[i])\n }\n return val\n } else {\n tran = _switch(mat)\n ret = []\n for (i = 0; i < tran.length; i++) {\n ret[i] = _reduce(tran[i], dim - 1, callback)\n }\n return ret\n }\n } else {\n ret = []\n for (i = 0; i < mat.length; i++) {\n ret[i] = _reduce(mat[i], dim - 1, callback)\n }\n return ret\n }\n}\n\n// TODO: document function scatter\nexport function scatter (a, j, w, x, u, mark, cindex, f, inverse, update, value) {\n // a arrays\n const avalues = a._values\n const aindex = a._index\n const aptr = a._ptr\n\n // vars\n let k, k0, k1, i\n\n // check we need to process values (pattern matrix)\n if (x) {\n // values in j\n for (k0 = aptr[j], k1 = aptr[j + 1], k = k0; k < k1; k++) {\n // row\n i = aindex[k]\n // check value exists in current j\n if (w[i] !== mark) {\n // i is new entry in j\n w[i] = mark\n // add i to pattern of C\n cindex.push(i)\n // x(i) = A, check we need to call function this time\n if (update) {\n // copy value to workspace calling callback function\n x[i] = inverse ? f(avalues[k], value) : f(value, avalues[k])\n // function was called on current row\n u[i] = mark\n } else {\n // copy value to workspace\n x[i] = avalues[k]\n }\n } else {\n // i exists in C already\n x[i] = inverse ? f(avalues[k], x[i]) : f(x[i], avalues[k])\n // function was called on current row\n u[i] = mark\n }\n }\n } else {\n // values in j\n for (k0 = aptr[j], k1 = aptr[j + 1], k = k0; k < k1; k++) {\n // row\n i = aindex[k]\n // check value exists in current j\n if (w[i] !== mark) {\n // i is new entry in j\n w[i] = mark\n // add i to pattern of C\n cindex.push(i)\n } else {\n // indicate function was called on current row\n u[i] = mark\n }\n }\n }\n}\n","import { deepMap } from '../../utils/collection.js'\nimport { isInteger as isIntegerNumber } from '../../utils/number.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'isInteger'\nconst dependencies = ['typed']\n\nexport const createIsInteger = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Test whether a value is an integer number.\n * The function supports `number`, `BigNumber`, and `Fraction`.\n *\n * The function is evaluated element-wise in case of Array or Matrix input.\n *\n * Syntax:\n *\n * math.isInteger(x)\n *\n * Examples:\n *\n * math.isInteger(2) // returns true\n * math.isInteger(0) // returns true\n * math.isInteger(0.5) // returns false\n * math.isInteger(math.bignumber(500)) // returns true\n * math.isInteger(math.fraction(4)) // returns true\n * math.isInteger('3') // returns true\n * math.isInteger([3, 0.5, -2]) // returns [true, false, true]\n * math.isInteger(math.complex('2-4i')) // throws TypeError\n *\n * See also:\n *\n * isNumeric, isPositive, isNegative, isZero\n *\n * @param {number | BigNumber | bigint | Fraction | Array | Matrix} x Value to be tested\n * @return {boolean} Returns true when `x` contains a numeric, integer value.\n * Throws an error in case of an unknown data type.\n */\n return typed(name, {\n number: isIntegerNumber, // TODO: what to do with isInteger(add(0.1, 0.2)) ?\n\n BigNumber: function (x) {\n return x.isInt()\n },\n\n bigint: function (x) {\n return true\n },\n\n Fraction: function (x) {\n return x.d === 1n\n },\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","import { isInteger } from '../../utils/number.js'\n\nconst n1 = 'number'\n\nexport function isIntegerNumber (x) {\n return isInteger(x)\n}\nisIntegerNumber.signature = n1\n\nexport function isNegativeNumber (x) {\n return x < 0\n}\nisNegativeNumber.signature = n1\n\nexport function isPositiveNumber (x) {\n return x > 0\n}\nisPositiveNumber.signature = n1\n\nexport function isZeroNumber (x) {\n return x === 0\n}\nisZeroNumber.signature = n1\n\nexport function isNaNNumber (x) {\n return Number.isNaN(x)\n}\nisNaNNumber.signature = n1\n","/**\n * Compares two BigNumbers.\n * @param {BigNumber} a - First value to compare\n * @param {BigNumber} b - Second value to compare\n * @param {number} [relTol=1e-09] - The relative tolerance, indicating the maximum allowed difference relative to the larger absolute value. Must be greater than 0.\n * @param {number} [absTol=0] - The minimum absolute tolerance, useful for comparisons near zero. Must be at least 0.\n * @returns {boolean} whether the two numbers are nearly equal\n * @throws {Error} If `relTol` is less than or equal to 0.\n * @throws {Error} If `absTol` is less than 0.\n *\n * @example\n * nearlyEqual(1.000000001, 1.0, 1e-9); // true\n * nearlyEqual(1.000000002, 1.0, 0); // false\n * nearlyEqual(1.0, 1.009, undefined, 0.02); // true\n * nearlyEqual(0.000000001, 0.0, undefined, 1e-8); // true\n */\nexport function nearlyEqual (a, b, relTol = 1e-9, absTol = 0) {\n if (relTol <= 0) {\n throw new Error('Relative tolerance must be greater than 0')\n }\n\n if (absTol < 0) {\n throw new Error('Absolute tolerance must be at least 0')\n }\n // NaN\n if (a.isNaN() || b.isNaN()) {\n return false\n }\n\n if (!a.isFinite() || !b.isFinite()) {\n return a.eq(b)\n }\n // use \"==\" operator, handles infinities\n if (a.eq(b)) {\n return true\n }\n // abs(a-b) <= max(relTol * max(abs(a), abs(b)), absTol)\n return a.minus(b).abs().lte(a.constructor.max(a.constructor.max(a.abs(), b.abs()).mul(relTol), absTol))\n}\n","import { deepMap } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\nimport { isNegativeNumber } from '../../plain/number/index.js'\nimport { nearlyEqual as bigNearlyEqual } from '../../utils/bignumber/nearlyEqual.js'\nimport { nearlyEqual } from '../../utils/number.js'\n\nconst name = 'isNegative'\nconst dependencies = ['typed', 'config']\n\nexport const createIsNegative = /* #__PURE__ */ factory(name, dependencies, ({ typed, config }) => {\n /**\n * Test whether a value is negative: smaller than zero.\n * The function supports types `number`, `BigNumber`, `Fraction`, and `Unit`.\n *\n * The function is evaluated element-wise in case of Array or Matrix input.\n *\n * Syntax:\n *\n * math.isNegative(x)\n *\n * Examples:\n *\n * math.isNegative(3) // returns false\n * math.isNegative(-2) // returns true\n * math.isNegative(0) // returns false\n * math.isNegative(-0) // returns false\n * math.isNegative(math.bignumber(2)) // returns false\n * math.isNegative(math.fraction(-2, 5)) // returns true\n * math.isNegative('-2') // returns true\n * math.isNegative([2, 0, -3]) // returns [false, false, true]\n *\n * See also:\n *\n * isNumeric, isPositive, isZero, isInteger\n *\n * @param {number | BigNumber | bigint | Fraction | Unit | Array | Matrix} x Value to be tested\n * @return {boolean} Returns true when `x` is larger than zero.\n * Throws an error in case of an unknown data type.\n */\n return typed(name, {\n number: x => nearlyEqual(x, 0, config.relTol, config.absTol) ? false : isNegativeNumber(x),\n\n BigNumber: x => bigNearlyEqual(x, new x.constructor(0), config.relTol, config.absTol)\n ? false\n : x.isNeg() && !x.isZero() && !x.isNaN(),\n\n bigint: x => x < 0n,\n\n Fraction: x => x.s < 0n, // It's enough to decide on the sign\n\n Unit: typed.referToSelf(self =>\n x => typed.find(self, x.valueType())(x.value)),\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","import { deepMap } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'isNumeric'\nconst dependencies = ['typed']\n\nexport const createIsNumeric = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Test whether a value is an numeric value.\n *\n * The function is evaluated element-wise in case of Array or Matrix input.\n *\n * Syntax:\n *\n * math.isNumeric(x)\n *\n * Examples:\n *\n * math.isNumeric(2) // returns true\n * math.isNumeric('2') // returns false\n * math.hasNumericValue('2') // returns true\n * math.isNumeric(0) // returns true\n * math.isNumeric(math.bignumber('42')) // returns true\n * math.isNumeric(math.bigint('42')) // returns true\n * math.isNumeric(math.fraction(4)) // returns true\n * math.isNumeric(math.complex('2-4i')) // returns false\n * math.isNumeric([2.3, 'foo', false]) // returns [true, false, true]\n *\n * See also:\n *\n * isZero, isPositive, isNegative, isInteger, hasNumericValue\n *\n * @param {*} x Value to be tested\n * @return {boolean} Returns true when `x` is a `number`, `BigNumber`,\n * `Fraction`, or `boolean`. Returns false for other types.\n * Throws an error in case of unknown types.\n */\n return typed(name, {\n 'number | BigNumber | bigint | Fraction | boolean': () => true,\n 'Complex | Unit | string | null | undefined | Node': () => false,\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'hasNumericValue'\nconst dependencies = ['typed', 'isNumeric']\n\nexport const createHasNumericValue = /* #__PURE__ */ factory(name, dependencies, ({ typed, isNumeric }) => {\n /**\n * Test whether a value is an numeric value.\n *\n * In case of a string, true is returned if the string contains a numeric value.\n *\n * Syntax:\n *\n * math.hasNumericValue(x)\n *\n * Examples:\n *\n * math.hasNumericValue(2) // returns true\n * math.hasNumericValue('2') // returns true\n * math.isNumeric('2') // returns false\n * math.hasNumericValue(0) // returns true\n * math.hasNumericValue(math.bignumber('500')) // returns true\n * math.hasNumericValue(math.bigint('42')) // returns true\n * math.hasNumericValue(42n) // returns true\n * math.hasNumericValue(math.fraction(4)) // returns true\n * math.hasNumericValue(math.complex('2-4i')) // returns false\n * math.hasNumericValue(false) // returns true\n * math.hasNumericValue([2.3, 'foo', false]) // returns [true, false, true]\n *\n * See also:\n *\n * isZero, isPositive, isNegative, isInteger, isNumeric\n *\n * @param {*} x Value to be tested\n * @return {boolean} Returns true when `x` is a `number`, `BigNumber`,\n * `Fraction`, `Boolean`, or a `String` containing number. Returns false for other types.\n * Throws an error in case of unknown types.\n */\n return typed(name, {\n boolean: () => true,\n string: function (x) {\n return x.trim().length > 0 && !isNaN(Number(x))\n },\n any: function (x) {\n return isNumeric(x)\n }\n })\n})\n","import { deepMap } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\nimport { isPositiveNumber } from '../../plain/number/index.js'\nimport { nearlyEqual as bigNearlyEqual } from '../../utils/bignumber/nearlyEqual.js'\nimport { nearlyEqual } from '../../utils/number.js'\n\nconst name = 'isPositive'\nconst dependencies = ['typed', 'config']\n\nexport const createIsPositive = /* #__PURE__ */ factory(name, dependencies, ({ typed, config }) => {\n /**\n * Test whether a value is positive: larger than zero.\n * The function supports types `number`, `BigNumber`, `Fraction`, and `Unit`.\n *\n * The function is evaluated element-wise in case of Array or Matrix input.\n *\n * Syntax:\n *\n * math.isPositive(x)\n *\n * Examples:\n *\n * math.isPositive(3) // returns true\n * math.isPositive(-2) // returns false\n * math.isPositive(0) // returns false\n * math.isPositive(-0) // returns false\n * math.isPositive(0.5) // returns true\n * math.isPositive(math.bignumber(2)) // returns true\n * math.isPositive(math.fraction(-2, 5)) // returns false\n * math.isPositive(math.fraction(1, 3)) // returns true\n * math.isPositive('2') // returns true\n * math.isPositive([2, 0, -3]) // returns [true, false, false]\n *\n * See also:\n *\n * isNumeric, isZero, isNegative, isInteger\n *\n * @param {number | BigNumber | bigint | Fraction | Unit | Array | Matrix} x Value to be tested\n * @return {boolean} Returns true when `x` is larger than zero.\n * Throws an error in case of an unknown data type.\n */\n return typed(name, {\n number: x => nearlyEqual(x, 0, config.relTol, config.absTol) ? false : isPositiveNumber(x),\n\n BigNumber: x =>\n bigNearlyEqual(x, new x.constructor(0), config.relTol, config.absTol)\n ? false\n : !x.isNeg() && !x.isZero() && !x.isNaN(),\n\n bigint: x => x > 0n,\n\n Fraction: x => x.s > 0n && x.n > 0n,\n\n Unit: typed.referToSelf(self =>\n x => typed.find(self, x.valueType())(x.value)),\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","import { deepMap } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'isZero'\nconst dependencies = ['typed', 'equalScalar']\n\nexport const createIsZero = /* #__PURE__ */ factory(name, dependencies, ({ typed, equalScalar }) => {\n /**\n * Test whether a value is zero.\n * The function can check for zero for types `number`, `BigNumber`, `Fraction`,\n * `Complex`, and `Unit`.\n *\n * The function is evaluated element-wise in case of Array or Matrix input.\n *\n * Syntax:\n *\n * math.isZero(x)\n *\n * Examples:\n *\n * math.isZero(0) // returns true\n * math.isZero(2) // returns false\n * math.isZero(0.5) // returns false\n * math.isZero(math.bignumber(0)) // returns true\n * math.isZero(math.fraction(0)) // returns true\n * math.isZero(math.fraction(1,3)) // returns false\n * math.isZero(math.complex('2 - 4i')) // returns false\n * math.isZero(math.complex('0i')) // returns true\n * math.isZero('0') // returns true\n * math.isZero('2') // returns false\n * math.isZero([2, 0, -3]) // returns [false, true, false]\n *\n * See also:\n *\n * isNumeric, isPositive, isNegative, isInteger\n *\n * @param {number | BigNumber | bigint | Complex | Fraction | Unit | Array | Matrix} x Value to be tested\n * @return {boolean} Returns true when `x` is zero.\n * Throws an error in case of an unknown data type.\n */\n return typed(name, {\n 'number | BigNumber | Complex | Fraction': x => equalScalar(x, 0),\n\n bigint: x => x === 0n,\n\n Unit: typed.referToSelf(self =>\n x => typed.find(self, x.valueType())(x.value)),\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","import { deepMap } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\nimport { isNaNNumber } from '../../plain/number/index.js'\n\nconst name = 'isNaN'\nconst dependencies = ['typed']\n\nexport const createIsNaN = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Test whether a value is NaN (not a number).\n * The function supports types `number`, `BigNumber`, `Fraction`, `Unit` and `Complex`.\n *\n * The function is evaluated element-wise in case of Array or Matrix input.\n *\n * Syntax:\n *\n * math.isNaN(x)\n *\n * Examples:\n *\n * math.isNaN(3) // returns false\n * math.isNaN(NaN) // returns true\n * math.isNaN(0) // returns false\n * math.isNaN(math.bignumber(NaN)) // returns true\n * math.isNaN(math.bignumber(0)) // returns false\n * math.isNaN(math.fraction(-2, 5)) // returns false\n * math.isNaN('-2') // returns false\n * math.isNaN([2, 0, -3, NaN]) // returns [false, false, false, true]\n *\n * See also:\n *\n * isNumeric, isNegative, isPositive, isZero, isInteger\n *\n * @param {number | BigNumber | bigint | Fraction | Unit | Array | Matrix} x Value to be tested\n * @return {boolean} Returns true when `x` is NaN.\n * Throws an error in case of an unknown data type.\n */\n return typed(name, {\n number: isNaNNumber,\n\n BigNumber: function (x) {\n return x.isNaN()\n },\n\n bigint: function (x) {\n return false\n },\n\n Fraction: function (x) {\n return false\n },\n\n Complex: function (x) {\n return x.isNaN()\n },\n\n Unit: function (x) {\n return Number.isNaN(x.value)\n },\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { typeOf as _typeOf } from '../../utils/is.js'\n\nconst name = 'typeOf'\nconst dependencies = ['typed']\n\nexport const createTypeOf = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Determine the type of an entity.\n *\n * Syntax:\n *\n * math.typeOf(x)\n *\n * Examples:\n *\n * // This list is intended to include all relevant types, for testing\n * // purposes:\n * math.typeOf(3.5) // returns 'number'\n * math.typeOf(42n) // returns 'bigint'\n * math.typeOf(math.complex('2-4i')) // returns 'Complex'\n * math.typeOf(math.unit('45 deg')) // returns 'Unit'\n * math.typeOf('hello world') // returns 'string'\n * math.typeOf(null) // returns 'null'\n * math.typeOf(true) // returns 'boolean'\n * math.typeOf([1, 2, 3]) // returns 'Array'\n * math.typeOf(new Date()) // returns 'Date'\n * math.typeOf(function () {}) // returns 'function'\n * math.typeOf({a: 2, b: 3}) // returns 'Object'\n * math.typeOf(/a regexp/) // returns 'RegExp'\n * math.typeOf(undefined) // returns 'undefined'\n * math.typeOf(math.bignumber('23e99')) // returns 'BigNumber'\n * math.typeOf(math.chain(2)) // returns 'Chain'\n * math.typeOf(math.fraction(1, 3)) // returns 'Fraction'\n * math.typeOf(math.help('sqrt')) // returns 'Help'\n * math.typeOf(math.index(1, 3)) // returns 'Index'\n * math.typeOf(math.matrix([[1],[3]])) // returns 'DenseMatrix'\n * math.typeOf(math.matrix([],'sparse')) // returns 'SparseMatrix'\n * math.typeOf(new math.Range(0, 10)) // returns 'Range'\n * math.typeOf(math.evaluate('a=2\\na')) // returns 'ResultSet'\n * math.typeOf(math.parse('A[2]')) // returns 'AccessorNode'\n * math.typeOf(math.parse('[1,2,3]')) // returns 'ArrayNode'\n * math.typeOf(math.parse('x=2')) // returns 'AssignmentNode'\n * math.typeOf(math.parse('a=2; b=3')) // returns 'BlockNode'\n * math.typeOf(math.parse('x<0?-1:1')) // returns 'ConditionalNode'\n * math.typeOf(math.parse('2.3')) // returns 'ConstantNode'\n * math.typeOf(math.parse('f(x)=x^2')) // returns 'FunctionAssignmentNode'\n * math.typeOf(math.parse('sqrt(4)')) // returns 'FunctionNode'\n * math.typeOf(math.parse('A[2]').index) // returns 'IndexNode'\n * math.typeOf(math.parse('{a:2}')) // returns 'ObjectNode'\n * math.typeOf(math.parse('(2+3)')) // returns 'ParenthesisNode'\n * math.typeOf(math.parse('1:10')) // returns 'RangeNode'\n * math.typeOf(math.parse('a ({\n 'Unit, Unit': typed.referToSelf(self => (x, y) => {\n if (!x.equalBase(y)) {\n throw new Error('Cannot compare units with different base')\n }\n return typed.find(self, [x.valueType(), y.valueType()])(x.value, y.value)\n })\n })\n)\n","import { nearlyEqual as bigNearlyEqual } from '../../utils/bignumber/nearlyEqual.js'\nimport { nearlyEqual } from '../../utils/number.js'\nimport { factory } from '../../utils/factory.js'\nimport { complexEquals } from '../../utils/complex.js'\nimport { createCompareUnits } from './compareUnits.js'\n\nconst name = 'equalScalar'\nconst dependencies = ['typed', 'config']\n\nexport const createEqualScalar = /* #__PURE__ */ factory(name, dependencies, ({ typed, config }) => {\n const compareUnits = createCompareUnits({ typed })\n\n /**\n * Test whether two scalar values are nearly equal.\n *\n * @param {number | BigNumber | bigint | Fraction | boolean | Complex | Unit} x First value to compare\n * @param {number | BigNumber | bigint | Fraction | boolean | Complex} y Second value to compare\n * @return {boolean} Returns true when the compared values are equal, else returns false\n * @private\n */\n return typed(name, {\n\n 'boolean, boolean': function (x, y) {\n return x === y\n },\n\n 'number, number': function (x, y) {\n return nearlyEqual(x, y, config.relTol, config.absTol)\n },\n\n 'BigNumber, BigNumber': function (x, y) {\n return x.eq(y) || bigNearlyEqual(x, y, config.relTol, config.absTol)\n },\n\n 'bigint, bigint': function (x, y) {\n return x === y\n },\n\n 'Fraction, Fraction': function (x, y) {\n return x.equals(y)\n },\n\n 'Complex, Complex': function (x, y) {\n return complexEquals(x, y, config.relTol, config.absTol)\n }\n }, compareUnits)\n})\n\nexport const createEqualScalarNumber = factory(name, ['typed', 'config'], ({ typed, config }) => {\n return typed(name, {\n 'number, number': function (x, y) {\n return nearlyEqual(x, y, config.relTol, config.absTol)\n }\n })\n})\n","import { nearlyEqual } from './number.js'\n\n/**\n * Test whether two complex values are equal provided a given relTol and absTol.\n * Does not use or change the global Complex.EPSILON setting\n * @param {Complex} x - The first complex number for comparison.\n * @param {Complex} y - The second complex number for comparison.\n * @param {number} relTol - The relative tolerance for comparison.\n * @param {number} absTol - The absolute tolerance for comparison.\n * @returns {boolean} - Returns true if the two complex numbers are equal within the given tolerances, otherwise returns false.\n */\nexport function complexEquals (x, y, relTol, absTol) {\n return nearlyEqual(x.re, y.re, relTol, absTol) && nearlyEqual(x.im, y.im, relTol, absTol)\n}\n","import { isArray, isBigNumber, isCollection, isIndex, isMatrix, isNumber, isString, typeOf } from '../../utils/is.js'\nimport { isInteger } from '../../utils/number.js'\nimport { format } from '../../utils/string.js'\nimport { clone, deepStrictEqual } from '../../utils/object.js'\nimport { arraySize, getArrayDataType, processSizesWildcard, unsqueeze, validateIndex } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\nimport { DimensionError } from '../../error/DimensionError.js'\nimport { optimizeCallback } from '../../utils/optimizeCallback.js'\n\nconst name = 'SparseMatrix'\nconst dependencies = [\n 'typed',\n 'equalScalar',\n 'Matrix'\n]\n\nexport const createSparseMatrixClass = /* #__PURE__ */ factory(name, dependencies, ({ typed, equalScalar, Matrix }) => {\n /**\n * Sparse Matrix implementation. This type implements\n * a [Compressed Column Storage](https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_column_(CSC_or_CCS))\n * format for two-dimensional sparse matrices.\n * @class SparseMatrix\n */\n function SparseMatrix (data, datatype) {\n if (!(this instanceof SparseMatrix)) { throw new SyntaxError('Constructor must be called with the new operator') }\n if (datatype && !isString(datatype)) { throw new Error('Invalid datatype: ' + datatype) }\n\n if (isMatrix(data)) {\n // create from matrix\n _createFromMatrix(this, data, datatype)\n } else if (data && isArray(data.index) && isArray(data.ptr) && isArray(data.size)) {\n // initialize fields\n this._values = data.values\n this._index = data.index\n this._ptr = data.ptr\n this._size = data.size\n this._datatype = datatype || data.datatype\n } else if (isArray(data)) {\n // create from array\n _createFromArray(this, data, datatype)\n } else if (data) {\n // unsupported type\n throw new TypeError('Unsupported type of data (' + typeOf(data) + ')')\n } else {\n // nothing provided\n this._values = []\n this._index = []\n this._ptr = [0]\n this._size = [0, 0]\n this._datatype = datatype\n }\n }\n\n function _createFromMatrix (matrix, source, datatype) {\n // check matrix type\n if (source.type === 'SparseMatrix') {\n // clone arrays\n matrix._values = source._values ? clone(source._values) : undefined\n matrix._index = clone(source._index)\n matrix._ptr = clone(source._ptr)\n matrix._size = clone(source._size)\n matrix._datatype = datatype || source._datatype\n } else {\n // build from matrix data\n _createFromArray(matrix, source.valueOf(), datatype || source._datatype)\n }\n }\n\n function _createFromArray (matrix, data, datatype) {\n // initialize fields\n matrix._values = []\n matrix._index = []\n matrix._ptr = []\n matrix._datatype = datatype\n // discover rows & columns, do not use math.size() to avoid looping array twice\n const rows = data.length\n let columns = 0\n\n // equal signature to use\n let eq = equalScalar\n // zero value\n let zero = 0\n\n if (isString(datatype)) {\n // find signature that matches (datatype, datatype)\n eq = typed.find(equalScalar, [datatype, datatype]) || equalScalar\n // convert 0 to the same datatype\n zero = typed.convert(0, datatype)\n }\n\n // check we have rows (empty array)\n if (rows > 0) {\n // column index\n let j = 0\n do {\n // store pointer to values index\n matrix._ptr.push(matrix._index.length)\n // loop rows\n for (let i = 0; i < rows; i++) {\n // current row\n const row = data[i]\n // check row is an array\n if (isArray(row)) {\n // update columns if needed (only on first column)\n if (j === 0 && columns < row.length) { columns = row.length }\n // check row has column\n if (j < row.length) {\n // value\n const v = row[j]\n // check value != 0\n if (!eq(v, zero)) {\n // store value\n matrix._values.push(v)\n // index\n matrix._index.push(i)\n }\n }\n } else {\n // update columns if needed (only on first column)\n if (j === 0 && columns < 1) { columns = 1 }\n // check value != 0 (row is a scalar)\n if (!eq(row, zero)) {\n // store value\n matrix._values.push(row)\n // index\n matrix._index.push(i)\n }\n }\n }\n // increment index\n j++\n }\n while (j < columns)\n }\n // store number of values in ptr\n matrix._ptr.push(matrix._index.length)\n // size\n matrix._size = [rows, columns]\n }\n\n SparseMatrix.prototype = new Matrix()\n\n /**\n * Create a new SparseMatrix\n */\n SparseMatrix.prototype.createSparseMatrix = function (data, datatype) {\n return new SparseMatrix(data, datatype)\n }\n\n /**\n * Attach type information\n */\n Object.defineProperty(SparseMatrix, 'name', { value: 'SparseMatrix' })\n SparseMatrix.prototype.constructor = SparseMatrix\n SparseMatrix.prototype.type = 'SparseMatrix'\n SparseMatrix.prototype.isSparseMatrix = true\n\n /**\n * Get the matrix type\n *\n * Usage:\n * const matrixType = matrix.getDataType() // retrieves the matrix type\n *\n * @memberOf SparseMatrix\n * @return {string} type information; if multiple types are found from the Matrix, it will return \"mixed\"\n */\n SparseMatrix.prototype.getDataType = function () {\n return getArrayDataType(this._values, typeOf)\n }\n\n /**\n * Get the storage format used by the matrix.\n *\n * Usage:\n * const format = matrix.storage() // retrieve storage format\n *\n * @memberof SparseMatrix\n * @return {string} The storage format.\n */\n SparseMatrix.prototype.storage = function () {\n return 'sparse'\n }\n\n /**\n * Get the datatype of the data stored in the matrix.\n *\n * Usage:\n * const format = matrix.datatype() // retrieve matrix datatype\n *\n * @memberof SparseMatrix\n * @return {string} The datatype.\n */\n SparseMatrix.prototype.datatype = function () {\n return this._datatype\n }\n\n /**\n * Create a new SparseMatrix\n * @memberof SparseMatrix\n * @param {Array} data\n * @param {string} [datatype]\n */\n SparseMatrix.prototype.create = function (data, datatype) {\n return new SparseMatrix(data, datatype)\n }\n\n /**\n * Get the matrix density.\n *\n * Usage:\n * const density = matrix.density() // retrieve matrix density\n *\n * @memberof SparseMatrix\n * @return {number} The matrix density.\n */\n SparseMatrix.prototype.density = function () {\n // rows & columns\n const rows = this._size[0]\n const columns = this._size[1]\n // calculate density\n return rows !== 0 && columns !== 0 ? (this._index.length / (rows * columns)) : 0\n }\n\n /**\n * Get a subset of the matrix, or replace a subset of the matrix.\n *\n * Usage:\n * const subset = matrix.subset(index) // retrieve subset\n * const value = matrix.subset(index, replacement) // replace subset\n *\n * @memberof SparseMatrix\n * @param {Index} index\n * @param {Array | Matrix | *} [replacement]\n * @param {*} [defaultValue=0] Default value, filled in on new entries when\n * the matrix is resized. If not provided,\n * new matrix elements will be filled with zeros.\n */\n SparseMatrix.prototype.subset = function (index, replacement, defaultValue) { // check it is a pattern matrix\n if (!this._values) { throw new Error('Cannot invoke subset on a Pattern only matrix') }\n\n // check arguments\n switch (arguments.length) {\n case 1:\n return _getsubset(this, index)\n\n // intentional fall through\n case 2:\n case 3:\n return _setsubset(this, index, replacement, defaultValue)\n\n default:\n throw new SyntaxError('Wrong number of arguments')\n }\n }\n\n function _getsubset (matrix, idx) {\n // check idx\n if (!isIndex(idx)) {\n throw new TypeError('Invalid index')\n }\n\n const isScalar = idx.isScalar()\n if (isScalar) {\n // return a scalar\n return matrix.get(idx.min())\n }\n // validate dimensions\n const size = idx.size()\n if (size.length !== matrix._size.length) {\n throw new DimensionError(size.length, matrix._size.length)\n }\n\n // vars\n let i, ii, k, kk\n\n // validate if any of the ranges in the index is out of range\n const min = idx.min()\n const max = idx.max()\n for (i = 0, ii = matrix._size.length; i < ii; i++) {\n validateIndex(min[i], matrix._size[i])\n validateIndex(max[i], matrix._size[i])\n }\n\n // matrix arrays\n const mvalues = matrix._values\n const mindex = matrix._index\n const mptr = matrix._ptr\n\n // rows & columns dimensions for result matrix\n const rows = idx.dimension(0)\n const columns = idx.dimension(1)\n\n // workspace & permutation vector\n const w = []\n const pv = []\n\n // loop rows in resulting matrix\n rows.forEach(function (i, r) {\n // update permutation vector\n pv[i] = r[0]\n // mark i in workspace\n w[i] = true\n })\n\n // result matrix arrays\n const values = mvalues ? [] : undefined\n const index = []\n const ptr = []\n\n // loop columns in result matrix\n columns.forEach(function (j) {\n // update ptr\n ptr.push(index.length)\n // loop values in column j\n for (k = mptr[j], kk = mptr[j + 1]; k < kk; k++) {\n // row\n i = mindex[k]\n // check row is in result matrix\n if (w[i] === true) {\n // push index\n index.push(pv[i])\n // check we need to process values\n if (values) { values.push(mvalues[k]) }\n }\n }\n })\n // update ptr\n ptr.push(index.length)\n\n // return matrix\n return new SparseMatrix({\n values,\n index,\n ptr,\n size,\n datatype: matrix._datatype\n })\n }\n\n function _setsubset (matrix, index, submatrix, defaultValue) {\n // check index\n if (!index || index.isIndex !== true) {\n throw new TypeError('Invalid index')\n }\n\n // get index size and check whether the index contains a single value\n const iSize = index.size()\n const isScalar = index.isScalar()\n\n // calculate the size of the submatrix, and convert it into an Array if needed\n let sSize\n if (isMatrix(submatrix)) {\n // submatrix size\n sSize = submatrix.size()\n // use array representation\n submatrix = submatrix.toArray()\n } else {\n // get submatrix size (array, scalar)\n sSize = arraySize(submatrix)\n }\n\n // check index is a scalar\n if (isScalar) {\n // verify submatrix is a scalar\n if (sSize.length !== 0) {\n throw new TypeError('Scalar expected')\n }\n // set value\n matrix.set(index.min(), submatrix, defaultValue)\n } else {\n // validate dimensions, index size must be one or two dimensions\n if (iSize.length !== 1 && iSize.length !== 2) {\n throw new DimensionError(iSize.length, matrix._size.length, '<')\n }\n\n // check submatrix and index have the same dimensions\n if (sSize.length < iSize.length) {\n // calculate number of missing outer dimensions\n let i = 0\n let outer = 0\n while (iSize[i] === 1 && sSize[i] === 1) {\n i++\n }\n while (iSize[i] === 1) {\n outer++\n i++\n }\n // unsqueeze both outer and inner dimensions\n submatrix = unsqueeze(submatrix, iSize.length, outer, sSize)\n }\n\n // check whether the size of the submatrix matches the index size\n if (!deepStrictEqual(iSize, sSize)) {\n throw new DimensionError(iSize, sSize, '>')\n }\n\n // insert the sub matrix\n if (iSize.length === 1) {\n // if the replacement index only has 1 dimension, go trough each one and set its value\n const range = index.dimension(0)\n range.forEach(function (dataIndex, subIndex) {\n validateIndex(dataIndex)\n matrix.set([dataIndex, 0], submatrix[subIndex[0]], defaultValue)\n })\n } else {\n // if the replacement index has 2 dimensions, go through each one and set the value in the correct index\n const firstDimensionRange = index.dimension(0)\n const secondDimensionRange = index.dimension(1)\n firstDimensionRange.forEach(function (firstDataIndex, firstSubIndex) {\n validateIndex(firstDataIndex)\n secondDimensionRange.forEach(function (secondDataIndex, secondSubIndex) {\n validateIndex(secondDataIndex)\n matrix.set([firstDataIndex, secondDataIndex], submatrix[firstSubIndex[0]][secondSubIndex[0]], defaultValue)\n })\n })\n }\n }\n return matrix\n }\n\n /**\n * Get a single element from the matrix.\n * @memberof SparseMatrix\n * @param {number[]} index Zero-based index\n * @return {*} value\n */\n SparseMatrix.prototype.get = function (index) {\n if (!isArray(index)) { throw new TypeError('Array expected') }\n if (index.length !== this._size.length) { throw new DimensionError(index.length, this._size.length) }\n\n // check it is a pattern matrix\n if (!this._values) { throw new Error('Cannot invoke get on a Pattern only matrix') }\n\n // row and column\n const i = index[0]\n const j = index[1]\n\n // check i, j are valid\n validateIndex(i, this._size[0])\n validateIndex(j, this._size[1])\n\n // find value index\n const k = _getValueIndex(i, this._ptr[j], this._ptr[j + 1], this._index)\n // check k is prior to next column k and it is in the correct row\n if (k < this._ptr[j + 1] && this._index[k] === i) { return this._values[k] }\n\n return 0\n }\n\n /**\n * Replace a single element in the matrix.\n * @memberof SparseMatrix\n * @param {number[]} index Zero-based index\n * @param {*} v\n * @param {*} [defaultValue] Default value, filled in on new entries when\n * the matrix is resized. If not provided,\n * new matrix elements will be set to zero.\n * @return {SparseMatrix} self\n */\n SparseMatrix.prototype.set = function (index, v, defaultValue) {\n if (!isArray(index)) { throw new TypeError('Array expected') }\n if (index.length !== this._size.length) { throw new DimensionError(index.length, this._size.length) }\n\n // check it is a pattern matrix\n if (!this._values) { throw new Error('Cannot invoke set on a Pattern only matrix') }\n\n // row and column\n const i = index[0]\n const j = index[1]\n\n // rows & columns\n let rows = this._size[0]\n let columns = this._size[1]\n\n // equal signature to use\n let eq = equalScalar\n // zero value\n let zero = 0\n\n if (isString(this._datatype)) {\n // find signature that matches (datatype, datatype)\n eq = typed.find(equalScalar, [this._datatype, this._datatype]) || equalScalar\n // convert 0 to the same datatype\n zero = typed.convert(0, this._datatype)\n }\n\n // check we need to resize matrix\n if (i > rows - 1 || j > columns - 1) {\n // resize matrix\n _resize(this, Math.max(i + 1, rows), Math.max(j + 1, columns), defaultValue)\n // update rows & columns\n rows = this._size[0]\n columns = this._size[1]\n }\n\n // check i, j are valid\n validateIndex(i, rows)\n validateIndex(j, columns)\n\n // find value index\n const k = _getValueIndex(i, this._ptr[j], this._ptr[j + 1], this._index)\n // check k is prior to next column k and it is in the correct row\n if (k < this._ptr[j + 1] && this._index[k] === i) {\n // check value != 0\n if (!eq(v, zero)) {\n // update value\n this._values[k] = v\n } else {\n // remove value from matrix\n _remove(k, j, this._values, this._index, this._ptr)\n }\n } else {\n if (!eq(v, zero)) {\n // insert value @ (i, j)\n _insert(k, i, j, v, this._values, this._index, this._ptr)\n }\n }\n\n return this\n }\n\n function _getValueIndex (i, top, bottom, index) {\n // check row is on the bottom side\n if (bottom - top === 0) { return bottom }\n // loop rows [top, bottom[\n for (let r = top; r < bottom; r++) {\n // check we found value index\n if (index[r] === i) { return r }\n }\n // we did not find row\n return top\n }\n\n function _remove (k, j, values, index, ptr) {\n // remove value @ k\n values.splice(k, 1)\n index.splice(k, 1)\n // update pointers\n for (let x = j + 1; x < ptr.length; x++) { ptr[x]-- }\n }\n\n function _insert (k, i, j, v, values, index, ptr) {\n // insert value\n values.splice(k, 0, v)\n // update row for k\n index.splice(k, 0, i)\n // update column pointers\n for (let x = j + 1; x < ptr.length; x++) { ptr[x]++ }\n }\n\n /**\n * Resize the matrix to the given size. Returns a copy of the matrix when\n * `copy=true`, otherwise return the matrix itself (resize in place).\n *\n * @memberof SparseMatrix\n * @param {number[] | Matrix} size The new size the matrix should have.\n * Since sparse matrices are always two-dimensional,\n * size must be two numbers in either an array or a matrix\n * @param {*} [defaultValue=0] Default value, filled in on new entries.\n * If not provided, the matrix elements will\n * be filled with zeros.\n * @param {boolean} [copy] Return a resized copy of the matrix\n *\n * @return {Matrix} The resized matrix\n */\n SparseMatrix.prototype.resize = function (size, defaultValue, copy) {\n // validate arguments\n if (!isCollection(size)) {\n throw new TypeError('Array or Matrix expected')\n }\n\n // SparseMatrix input is always 2d, flatten this into 1d if it's indeed a vector\n const sizeArray = size.valueOf().map(value => {\n return Array.isArray(value) && value.length === 1\n ? value[0]\n : value\n })\n\n if (sizeArray.length !== 2) { throw new Error('Only two dimensions matrix are supported') }\n\n // check sizes\n sizeArray.forEach(function (value) {\n if (!isNumber(value) || !isInteger(value) || value < 0) {\n throw new TypeError('Invalid size, must contain positive integers ' +\n '(size: ' + format(sizeArray) + ')')\n }\n })\n\n // matrix to resize\n const m = copy ? this.clone() : this\n // resize matrix\n return _resize(m, sizeArray[0], sizeArray[1], defaultValue)\n }\n\n function _resize (matrix, rows, columns, defaultValue) {\n // value to insert at the time of growing matrix\n let value = defaultValue || 0\n\n // equal signature to use\n let eq = equalScalar\n // zero value\n let zero = 0\n\n if (isString(matrix._datatype)) {\n // find signature that matches (datatype, datatype)\n eq = typed.find(equalScalar, [matrix._datatype, matrix._datatype]) || equalScalar\n // convert 0 to the same datatype\n zero = typed.convert(0, matrix._datatype)\n // convert value to the same datatype\n value = typed.convert(value, matrix._datatype)\n }\n\n // should we insert the value?\n const ins = !eq(value, zero)\n\n // old columns and rows\n const r = matrix._size[0]\n let c = matrix._size[1]\n\n let i, j, k\n\n // check we need to increase columns\n if (columns > c) {\n // loop new columns\n for (j = c; j < columns; j++) {\n // update matrix._ptr for current column\n matrix._ptr[j] = matrix._values.length\n // check we need to insert matrix._values\n if (ins) {\n // loop rows\n for (i = 0; i < r; i++) {\n // add new matrix._values\n matrix._values.push(value)\n // update matrix._index\n matrix._index.push(i)\n }\n }\n }\n // store number of matrix._values in matrix._ptr\n matrix._ptr[columns] = matrix._values.length\n } else if (columns < c) {\n // truncate matrix._ptr\n matrix._ptr.splice(columns + 1, c - columns)\n // truncate matrix._values and matrix._index\n matrix._values.splice(matrix._ptr[columns], matrix._values.length)\n matrix._index.splice(matrix._ptr[columns], matrix._index.length)\n }\n // update columns\n c = columns\n\n // check we need to increase rows\n if (rows > r) {\n // check we have to insert values\n if (ins) {\n // inserts\n let n = 0\n // loop columns\n for (j = 0; j < c; j++) {\n // update matrix._ptr for current column\n matrix._ptr[j] = matrix._ptr[j] + n\n // where to insert matrix._values\n k = matrix._ptr[j + 1] + n\n // pointer\n let p = 0\n // loop new rows, initialize pointer\n for (i = r; i < rows; i++, p++) {\n // add value\n matrix._values.splice(k + p, 0, value)\n // update matrix._index\n matrix._index.splice(k + p, 0, i)\n // increment inserts\n n++\n }\n }\n // store number of matrix._values in matrix._ptr\n matrix._ptr[c] = matrix._values.length\n }\n } else if (rows < r) {\n // deletes\n let d = 0\n // loop columns\n for (j = 0; j < c; j++) {\n // update matrix._ptr for current column\n matrix._ptr[j] = matrix._ptr[j] - d\n // where matrix._values start for next column\n const k0 = matrix._ptr[j]\n const k1 = matrix._ptr[j + 1] - d\n // loop matrix._index\n for (k = k0; k < k1; k++) {\n // row\n i = matrix._index[k]\n // check we need to delete value and matrix._index\n if (i > rows - 1) {\n // remove value\n matrix._values.splice(k, 1)\n // remove item from matrix._index\n matrix._index.splice(k, 1)\n // increase deletes\n d++\n }\n }\n }\n // update matrix._ptr for current column\n matrix._ptr[j] = matrix._values.length\n }\n // update matrix._size\n matrix._size[0] = rows\n matrix._size[1] = columns\n // return matrix\n return matrix\n }\n\n /**\n * Reshape the matrix to the given size. Returns a copy of the matrix when\n * `copy=true`, otherwise return the matrix itself (reshape in place).\n *\n * NOTE: This might be better suited to copy by default, instead of modifying\n * in place. For now, it operates in place to remain consistent with\n * resize().\n *\n * @memberof SparseMatrix\n * @param {number[]} sizes The new size the matrix should have.\n * Since sparse matrices are always two-dimensional,\n * size must be two numbers in either an array or a matrix\n * @param {boolean} [copy] Return a reshaped copy of the matrix\n *\n * @return {Matrix} The reshaped matrix\n */\n SparseMatrix.prototype.reshape = function (sizes, copy) {\n // validate arguments\n if (!isArray(sizes)) { throw new TypeError('Array expected') }\n if (sizes.length !== 2) { throw new Error('Sparse matrices can only be reshaped in two dimensions') }\n\n // check sizes\n sizes.forEach(function (value) {\n if (!isNumber(value) || !isInteger(value) || value <= -2 || value === 0) {\n throw new TypeError('Invalid size, must contain positive integers or -1 ' +\n '(size: ' + format(sizes) + ')')\n }\n })\n\n const currentLength = this._size[0] * this._size[1]\n sizes = processSizesWildcard(sizes, currentLength)\n const newLength = sizes[0] * sizes[1]\n\n // m * n must not change\n if (currentLength !== newLength) {\n throw new Error('Reshaping sparse matrix will result in the wrong number of elements')\n }\n\n // matrix to reshape\n const m = copy ? this.clone() : this\n\n // return unchanged if the same shape\n if (this._size[0] === sizes[0] && this._size[1] === sizes[1]) {\n return m\n }\n\n // Convert to COO format (generate a column index)\n const colIndex = []\n for (let i = 0; i < m._ptr.length; i++) {\n for (let j = 0; j < m._ptr[i + 1] - m._ptr[i]; j++) {\n colIndex.push(i)\n }\n }\n\n // Clone the values array\n const values = m._values.slice()\n\n // Clone the row index array\n const rowIndex = m._index.slice()\n\n // Transform the (row, column) indices\n for (let i = 0; i < m._index.length; i++) {\n const r1 = rowIndex[i]\n const c1 = colIndex[i]\n const flat = r1 * m._size[1] + c1\n colIndex[i] = flat % sizes[1]\n rowIndex[i] = Math.floor(flat / sizes[1])\n }\n\n // Now reshaping is supposed to preserve the row-major order, BUT these sparse matrices are stored\n // in column-major order, so we have to reorder the value array now. One option is to use a multisort,\n // sorting several arrays based on some other array.\n\n // OR, we could easily just:\n\n // 1. Remove all values from the matrix\n m._values.length = 0\n m._index.length = 0\n m._ptr.length = sizes[1] + 1\n m._size = sizes.slice()\n for (let i = 0; i < m._ptr.length; i++) {\n m._ptr[i] = 0\n }\n\n // 2. Re-insert all elements in the proper order (simplified code from SparseMatrix.prototype.set)\n // This step is probably the most time-consuming\n for (let h = 0; h < values.length; h++) {\n const i = rowIndex[h]\n const j = colIndex[h]\n const v = values[h]\n const k = _getValueIndex(i, m._ptr[j], m._ptr[j + 1], m._index)\n _insert(k, i, j, v, m._values, m._index, m._ptr)\n }\n\n // The value indices are inserted out of order, but apparently that's... still OK?\n\n return m\n }\n\n /**\n * Create a clone of the matrix\n * @memberof SparseMatrix\n * @return {SparseMatrix} clone\n */\n SparseMatrix.prototype.clone = function () {\n const m = new SparseMatrix({\n values: this._values ? clone(this._values) : undefined,\n index: clone(this._index),\n ptr: clone(this._ptr),\n size: clone(this._size),\n datatype: this._datatype\n })\n return m\n }\n\n /**\n * Retrieve the size of the matrix.\n * @memberof SparseMatrix\n * @returns {number[]} size\n */\n SparseMatrix.prototype.size = function () {\n return this._size.slice(0) // copy the Array\n }\n\n /**\n * Create a new matrix with the results of the callback function executed on\n * each entry of the matrix.\n * @memberof SparseMatrix\n * @param {Function} callback The callback function is invoked with three\n * parameters: the value of the element, the index\n * of the element, and the Matrix being traversed.\n * @param {boolean} [skipZeros] Invoke callback function for non-zero values only.\n *\n * @return {SparseMatrix} matrix\n */\n SparseMatrix.prototype.map = function (callback, skipZeros) {\n // check it is a pattern matrix\n if (!this._values) { throw new Error('Cannot invoke map on a Pattern only matrix') }\n // matrix instance\n const me = this\n // rows and columns\n const rows = this._size[0]\n const columns = this._size[1]\n const fastCallback = optimizeCallback(callback, me, 'map')\n // invoke callback\n const invoke = function (v, i, j) {\n // invoke callback\n return fastCallback.fn(v, [i, j], me)\n }\n // invoke _map\n return _map(this, 0, rows - 1, 0, columns - 1, invoke, skipZeros)\n }\n\n /**\n * Create a new matrix with the results of the callback function executed on the interval\n * [minRow..maxRow, minColumn..maxColumn].\n */\n function _map (matrix, minRow, maxRow, minColumn, maxColumn, callback, skipZeros) {\n // result arrays\n const values = []\n const index = []\n const ptr = []\n\n // equal signature to use\n let eq = equalScalar\n // zero value\n let zero = 0\n\n if (isString(matrix._datatype)) {\n // find signature that matches (datatype, datatype)\n eq = typed.find(equalScalar, [matrix._datatype, matrix._datatype]) || equalScalar\n // convert 0 to the same datatype\n zero = typed.convert(0, matrix._datatype)\n }\n\n // invoke callback\n const invoke = function (v, x, y) {\n // invoke callback\n const value = callback(v, x, y)\n // check value != 0\n if (!eq(value, zero)) {\n // store value\n values.push(value)\n // index\n index.push(x)\n }\n }\n // loop columns\n for (let j = minColumn; j <= maxColumn; j++) {\n // store pointer to values index\n ptr.push(values.length)\n // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1]\n const k0 = matrix._ptr[j]\n const k1 = matrix._ptr[j + 1]\n\n if (skipZeros) {\n // loop k within [k0, k1[\n for (let k = k0; k < k1; k++) {\n // row index\n const i = matrix._index[k]\n // check i is in range\n if (i >= minRow && i <= maxRow) {\n // value @ k\n invoke(matrix._values[k], i - minRow, j - minColumn)\n }\n }\n } else {\n // create a cache holding all defined values\n const values = {}\n for (let k = k0; k < k1; k++) {\n const i = matrix._index[k]\n values[i] = matrix._values[k]\n }\n\n // loop over all rows (indexes can be unordered so we can't use that),\n // and either read the value or zero\n for (let i = minRow; i <= maxRow; i++) {\n const value = (i in values) ? values[i] : 0\n invoke(value, i - minRow, j - minColumn)\n }\n }\n }\n\n // store number of values in ptr\n ptr.push(values.length)\n // return sparse matrix\n return new SparseMatrix({\n values,\n index,\n ptr,\n size: [maxRow - minRow + 1, maxColumn - minColumn + 1]\n })\n }\n\n /**\n * Execute a callback function on each entry of the matrix.\n * @memberof SparseMatrix\n * @param {Function} callback The callback function is invoked with three\n * parameters: the value of the element, the index\n * of the element, and the Matrix being traversed.\n * @param {boolean} [skipZeros] Invoke callback function for non-zero values only.\n * If false, the indices are guaranteed to be in order,\n * if true, the indices can be unordered.\n */\n SparseMatrix.prototype.forEach = function (callback, skipZeros) {\n // check it is a pattern matrix\n if (!this._values) { throw new Error('Cannot invoke forEach on a Pattern only matrix') }\n // matrix instance\n const me = this\n // rows and columns\n const rows = this._size[0]\n const columns = this._size[1]\n const fastCallback = optimizeCallback(callback, me, 'forEach')\n // loop columns\n for (let j = 0; j < columns; j++) {\n // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1]\n const k0 = this._ptr[j]\n const k1 = this._ptr[j + 1]\n\n if (skipZeros) {\n // loop k within [k0, k1[\n for (let k = k0; k < k1; k++) {\n // row index\n const i = this._index[k]\n\n // value @ k\n // TODO apply a non indexed version of algorithm in case fastCallback is not optimized\n fastCallback.fn(this._values[k], [i, j], me)\n }\n } else {\n // create a cache holding all defined values\n const values = {}\n for (let k = k0; k < k1; k++) {\n const i = this._index[k]\n values[i] = this._values[k]\n }\n\n // loop over all rows (indexes can be unordered so we can't use that),\n // and either read the value or zero\n for (let i = 0; i < rows; i++) {\n const value = (i in values) ? values[i] : 0\n fastCallback.fn(value, [i, j], me)\n }\n }\n }\n }\n\n /**\n * Iterate over the matrix elements, skipping zeros\n * @return {Iterable<{ value, index: number[] }>}\n */\n SparseMatrix.prototype[Symbol.iterator] = function * () {\n if (!this._values) { throw new Error('Cannot iterate a Pattern only matrix') }\n\n const columns = this._size[1]\n\n for (let j = 0; j < columns; j++) {\n const k0 = this._ptr[j]\n const k1 = this._ptr[j + 1]\n\n for (let k = k0; k < k1; k++) {\n // row index\n const i = this._index[k]\n\n yield ({ value: this._values[k], index: [i, j] })\n }\n }\n }\n\n /**\n * Create an Array with a copy of the data of the SparseMatrix\n * @memberof SparseMatrix\n * @returns {Array} array\n */\n SparseMatrix.prototype.toArray = function () {\n return _toArray(this._values, this._index, this._ptr, this._size, true)\n }\n\n /**\n * Get the primitive value of the SparseMatrix: a two dimensions array\n * @memberof SparseMatrix\n * @returns {Array} array\n */\n SparseMatrix.prototype.valueOf = function () {\n return _toArray(this._values, this._index, this._ptr, this._size, false)\n }\n\n function _toArray (values, index, ptr, size, copy) {\n // rows and columns\n const rows = size[0]\n const columns = size[1]\n // result\n const a = []\n // vars\n let i, j\n // initialize array\n for (i = 0; i < rows; i++) {\n a[i] = []\n for (j = 0; j < columns; j++) { a[i][j] = 0 }\n }\n\n // loop columns\n for (j = 0; j < columns; j++) {\n // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1]\n const k0 = ptr[j]\n const k1 = ptr[j + 1]\n // loop k within [k0, k1[\n for (let k = k0; k < k1; k++) {\n // row index\n i = index[k]\n // set value (use one for pattern matrix)\n a[i][j] = values ? (copy ? clone(values[k]) : values[k]) : 1\n }\n }\n return a\n }\n\n /**\n * Get a string representation of the matrix, with optional formatting options.\n * @memberof SparseMatrix\n * @param {Object | number | Function} [options] Formatting options. See\n * lib/utils/number:format for a\n * description of the available\n * options.\n * @returns {string} str\n */\n SparseMatrix.prototype.format = function (options) {\n // rows and columns\n const rows = this._size[0]\n const columns = this._size[1]\n // density\n const density = this.density()\n // rows & columns\n let str = 'Sparse Matrix [' + format(rows, options) + ' x ' + format(columns, options) + '] density: ' + format(density, options) + '\\n'\n // loop columns\n for (let j = 0; j < columns; j++) {\n // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1]\n const k0 = this._ptr[j]\n const k1 = this._ptr[j + 1]\n // loop k within [k0, k1[\n for (let k = k0; k < k1; k++) {\n // row index\n const i = this._index[k]\n // append value\n str += '\\n (' + format(i, options) + ', ' + format(j, options) + ') ==> ' + (this._values ? format(this._values[k], options) : 'X')\n }\n }\n return str\n }\n\n /**\n * Get a string representation of the matrix\n * @memberof SparseMatrix\n * @returns {string} str\n */\n SparseMatrix.prototype.toString = function () {\n return format(this.toArray())\n }\n\n /**\n * Get a JSON representation of the matrix\n * @memberof SparseMatrix\n * @returns {Object}\n */\n SparseMatrix.prototype.toJSON = function () {\n return {\n mathjs: 'SparseMatrix',\n values: this._values,\n index: this._index,\n ptr: this._ptr,\n size: this._size,\n datatype: this._datatype\n }\n }\n\n /**\n * Get the kth Matrix diagonal.\n *\n * @memberof SparseMatrix\n * @param {number | BigNumber} [k=0] The kth diagonal where the vector will retrieved.\n *\n * @returns {Matrix} The matrix vector with the diagonal values.\n */\n SparseMatrix.prototype.diagonal = function (k) {\n // validate k if any\n if (k) {\n // convert BigNumber to a number\n if (isBigNumber(k)) { k = k.toNumber() }\n // is must be an integer\n if (!isNumber(k) || !isInteger(k)) {\n throw new TypeError('The parameter k must be an integer number')\n }\n } else {\n // default value\n k = 0\n }\n\n const kSuper = k > 0 ? k : 0\n const kSub = k < 0 ? -k : 0\n\n // rows & columns\n const rows = this._size[0]\n const columns = this._size[1]\n\n // number diagonal values\n const n = Math.min(rows - kSub, columns - kSuper)\n\n // diagonal arrays\n const values = []\n const index = []\n const ptr = []\n // initial ptr value\n ptr[0] = 0\n // loop columns\n for (let j = kSuper; j < columns && values.length < n; j++) {\n // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1]\n const k0 = this._ptr[j]\n const k1 = this._ptr[j + 1]\n // loop x within [k0, k1[\n for (let x = k0; x < k1; x++) {\n // row index\n const i = this._index[x]\n // check row\n if (i === j - kSuper + kSub) {\n // value on this column\n values.push(this._values[x])\n // store row\n index[values.length - 1] = i - kSub\n // exit loop\n break\n }\n }\n }\n // close ptr\n ptr.push(values.length)\n // return matrix\n return new SparseMatrix({\n values,\n index,\n ptr,\n size: [n, 1]\n })\n }\n\n /**\n * Generate a matrix from a JSON object\n * @memberof SparseMatrix\n * @param {Object} json An object structured like\n * `{\"mathjs\": \"SparseMatrix\", \"values\": [], \"index\": [], \"ptr\": [], \"size\": []}`,\n * where mathjs is optional\n * @returns {SparseMatrix}\n */\n SparseMatrix.fromJSON = function (json) {\n return new SparseMatrix(json)\n }\n\n /**\n * Create a diagonal matrix.\n *\n * @memberof SparseMatrix\n * @param {Array} size The matrix size.\n * @param {number | Array | Matrix } value The values for the diagonal.\n * @param {number | BigNumber} [k=0] The kth diagonal where the vector will be filled in.\n * @param {number} [defaultValue] The default value for non-diagonal\n * @param {string} [datatype] The Matrix datatype, values must be of this datatype.\n *\n * @returns {SparseMatrix}\n */\n SparseMatrix.diagonal = function (size, value, k, defaultValue, datatype) {\n if (!isArray(size)) { throw new TypeError('Array expected, size parameter') }\n if (size.length !== 2) { throw new Error('Only two dimensions matrix are supported') }\n\n // map size & validate\n size = size.map(function (s) {\n // check it is a big number\n if (isBigNumber(s)) {\n // convert it\n s = s.toNumber()\n }\n // validate arguments\n if (!isNumber(s) || !isInteger(s) || s < 1) {\n throw new Error('Size values must be positive integers')\n }\n return s\n })\n\n // validate k if any\n if (k) {\n // convert BigNumber to a number\n if (isBigNumber(k)) { k = k.toNumber() }\n // is must be an integer\n if (!isNumber(k) || !isInteger(k)) {\n throw new TypeError('The parameter k must be an integer number')\n }\n } else {\n // default value\n k = 0\n }\n\n // equal signature to use\n let eq = equalScalar\n // zero value\n let zero = 0\n\n if (isString(datatype)) {\n // find signature that matches (datatype, datatype)\n eq = typed.find(equalScalar, [datatype, datatype]) || equalScalar\n // convert 0 to the same datatype\n zero = typed.convert(0, datatype)\n }\n\n const kSuper = k > 0 ? k : 0\n const kSub = k < 0 ? -k : 0\n\n // rows and columns\n const rows = size[0]\n const columns = size[1]\n\n // number of non-zero items\n const n = Math.min(rows - kSub, columns - kSuper)\n\n // value extraction function\n let _value\n\n // check value\n if (isArray(value)) {\n // validate array\n if (value.length !== n) {\n // number of values in array must be n\n throw new Error('Invalid value array length')\n }\n // define function\n _value = function (i) {\n // return value @ i\n return value[i]\n }\n } else if (isMatrix(value)) {\n // matrix size\n const ms = value.size()\n // validate matrix\n if (ms.length !== 1 || ms[0] !== n) {\n // number of values in array must be n\n throw new Error('Invalid matrix length')\n }\n // define function\n _value = function (i) {\n // return value @ i\n return value.get([i])\n }\n } else {\n // define function\n _value = function () {\n // return value\n return value\n }\n }\n\n // create arrays\n const values = []\n const index = []\n const ptr = []\n\n // loop items\n for (let j = 0; j < columns; j++) {\n // number of rows with value\n ptr.push(values.length)\n // diagonal index\n const i = j - kSuper\n // check we need to set diagonal value\n if (i >= 0 && i < n) {\n // get value @ i\n const v = _value(i)\n // check for zero\n if (!eq(v, zero)) {\n // column\n index.push(i + kSub)\n // add value\n values.push(v)\n }\n }\n }\n // last value should be number of values\n ptr.push(values.length)\n // create SparseMatrix\n return new SparseMatrix({\n values,\n index,\n ptr,\n size: [rows, columns]\n })\n }\n\n /**\n * Swap rows i and j in Matrix.\n *\n * @memberof SparseMatrix\n * @param {number} i Matrix row index 1\n * @param {number} j Matrix row index 2\n *\n * @return {Matrix} The matrix reference\n */\n SparseMatrix.prototype.swapRows = function (i, j) {\n // check index\n if (!isNumber(i) || !isInteger(i) || !isNumber(j) || !isInteger(j)) {\n throw new Error('Row index must be positive integers')\n }\n // check dimensions\n if (this._size.length !== 2) {\n throw new Error('Only two dimensional matrix is supported')\n }\n // validate index\n validateIndex(i, this._size[0])\n validateIndex(j, this._size[0])\n\n // swap rows\n SparseMatrix._swapRows(i, j, this._size[1], this._values, this._index, this._ptr)\n // return current instance\n return this\n }\n\n /**\n * Loop rows with data in column j.\n *\n * @param {number} j Column\n * @param {Array} values Matrix values\n * @param {Array} index Matrix row indeces\n * @param {Array} ptr Matrix column pointers\n * @param {Function} callback Callback function invoked for every row in column j\n */\n SparseMatrix._forEachRow = function (j, values, index, ptr, callback) {\n // indeces for column j\n const k0 = ptr[j]\n const k1 = ptr[j + 1]\n\n // loop\n for (let k = k0; k < k1; k++) {\n // invoke callback\n callback(index[k], values[k])\n }\n }\n\n /**\n * Swap rows x and y in Sparse Matrix data structures.\n *\n * @param {number} x Matrix row index 1\n * @param {number} y Matrix row index 2\n * @param {number} columns Number of columns in matrix\n * @param {Array} values Matrix values\n * @param {Array} index Matrix row indeces\n * @param {Array} ptr Matrix column pointers\n */\n SparseMatrix._swapRows = function (x, y, columns, values, index, ptr) {\n // loop columns\n for (let j = 0; j < columns; j++) {\n // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1]\n const k0 = ptr[j]\n const k1 = ptr[j + 1]\n // find value index @ x\n const kx = _getValueIndex(x, k0, k1, index)\n // find value index @ x\n const ky = _getValueIndex(y, k0, k1, index)\n // check both rows exist in matrix\n if (kx < k1 && ky < k1 && index[kx] === x && index[ky] === y) {\n // swap values (check for pattern matrix)\n if (values) {\n const v = values[kx]\n values[kx] = values[ky]\n values[ky] = v\n }\n // next column\n continue\n }\n // check x row exist & no y row\n if (kx < k1 && index[kx] === x && (ky >= k1 || index[ky] !== y)) {\n // value @ x (check for pattern matrix)\n const vx = values ? values[kx] : undefined\n // insert value @ y\n index.splice(ky, 0, y)\n if (values) { values.splice(ky, 0, vx) }\n // remove value @ x (adjust array index if needed)\n index.splice(ky <= kx ? kx + 1 : kx, 1)\n if (values) { values.splice(ky <= kx ? kx + 1 : kx, 1) }\n // next column\n continue\n }\n // check y row exist & no x row\n if (ky < k1 && index[ky] === y && (kx >= k1 || index[kx] !== x)) {\n // value @ y (check for pattern matrix)\n const vy = values ? values[ky] : undefined\n // insert value @ x\n index.splice(kx, 0, x)\n if (values) { values.splice(kx, 0, vy) }\n // remove value @ y (adjust array index if needed)\n index.splice(kx <= ky ? ky + 1 : ky, 1)\n if (values) { values.splice(kx <= ky ? ky + 1 : ky, 1) }\n }\n }\n }\n\n return SparseMatrix\n}, { isClass: true })\n","import { factory } from '../utils/factory.js'\nimport { deepMap } from '../utils/collection.js'\n\nconst name = 'number'\nconst dependencies = ['typed']\n\n/**\n * Separates the radix, integer part, and fractional part of a non decimal number string\n * @param {string} input string to parse\n * @returns {object} the parts of the string or null if not a valid input\n */\nfunction getNonDecimalNumberParts (input) {\n const nonDecimalWithRadixMatch = input.match(/(0[box])([0-9a-fA-F]*)\\.([0-9a-fA-F]*)/)\n if (nonDecimalWithRadixMatch) {\n const radix = ({ '0b': 2, '0o': 8, '0x': 16 })[nonDecimalWithRadixMatch[1]]\n const integerPart = nonDecimalWithRadixMatch[2]\n const fractionalPart = nonDecimalWithRadixMatch[3]\n return { input, radix, integerPart, fractionalPart }\n } else {\n return null\n }\n}\n\n/**\n * Makes a number from a radix, and integer part, and a fractional part\n * @param {parts} [x] parts of the number string (from getNonDecimalNumberParts)\n * @returns {number} the number\n */\nfunction makeNumberFromNonDecimalParts (parts) {\n const n = parseInt(parts.integerPart, parts.radix)\n let f = 0\n for (let i = 0; i < parts.fractionalPart.length; i++) {\n const digitValue = parseInt(parts.fractionalPart[i], parts.radix)\n f += digitValue / Math.pow(parts.radix, i + 1)\n }\n const result = n + f\n if (isNaN(result)) {\n throw new SyntaxError('String \"' + parts.input + '\" is not a valid number')\n }\n return result\n}\n\nexport const createNumber = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Create a number or convert a string, boolean, or unit to a number.\n * When value is a matrix, all elements will be converted to number.\n *\n * Syntax:\n *\n * math.number(value)\n * math.number(unit, valuelessUnit)\n *\n * Examples:\n *\n * math.number(2) // returns number 2\n * math.number('7.2') // returns number 7.2\n * math.number(true) // returns number 1\n * math.number([true, false, true, true]) // returns [1, 0, 1, 1]\n * math.number(math.unit('52cm'), 'm') // returns 0.52\n *\n * See also:\n *\n * bignumber, bigint, boolean, numeric, complex, index, matrix, string, unit\n *\n * @param {string | number | BigNumber | Fraction | boolean | Array | Matrix | Unit | null} [value] Value to be converted\n * @param {Unit | string} [valuelessUnit] A valueless unit, used to convert a unit to a number\n * @return {number | Array | Matrix} The created number\n */\n const number = typed('number', {\n '': function () {\n return 0\n },\n\n number: function (x) {\n return x\n },\n\n string: function (x) {\n if (x === 'NaN') return NaN\n const nonDecimalNumberParts = getNonDecimalNumberParts(x)\n if (nonDecimalNumberParts) {\n return makeNumberFromNonDecimalParts(nonDecimalNumberParts)\n }\n let size = 0\n const wordSizeSuffixMatch = x.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/)\n if (wordSizeSuffixMatch) {\n // x includes a size suffix like 0xffffi32, so we extract\n // the suffix and remove it from x\n size = Number(wordSizeSuffixMatch[2])\n x = wordSizeSuffixMatch[1]\n }\n let num = Number(x)\n if (isNaN(num)) {\n throw new SyntaxError('String \"' + x + '\" is not a valid number')\n }\n if (wordSizeSuffixMatch) {\n // x is a signed bin, oct, or hex literal\n // num is the value of string x if x is interpreted as unsigned\n if (num > 2 ** size - 1) {\n // literal is too large for size suffix\n throw new SyntaxError(`String \"${x}\" is out of range`)\n }\n // check if the bit at index size - 1 is set and if so do the twos complement\n if (num >= 2 ** (size - 1)) {\n num = num - 2 ** size\n }\n }\n return num\n },\n\n BigNumber: function (x) {\n return x.toNumber()\n },\n\n bigint: function (x) {\n return Number(x)\n },\n\n Fraction: function (x) {\n return x.valueOf()\n },\n\n Unit: typed.referToSelf(self => (x) => {\n const clone = x.clone()\n clone.value = self(x.value)\n return clone\n }),\n\n null: function (x) {\n return 0\n },\n\n 'Unit, string | Unit': function (unit, valuelessUnit) {\n return unit.toNumber(valuelessUnit)\n },\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n\n // reviver function to parse a JSON object like:\n //\n // {\"mathjs\":\"number\",\"value\":\"2.3\"}\n //\n // into a number 2.3\n number.fromJSON = function (json) {\n return parseFloat(json.value)\n }\n\n return number\n})\n","import { factory } from '../utils/factory.js'\nimport { deepMap } from '../utils/collection.js'\n\nconst name = 'bigint'\nconst dependencies = ['typed']\n\nexport const createBigint = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Create a bigint or convert a string, boolean, or unit to a bigint.\n * When value is a matrix, all elements will be converted to bigint.\n *\n * Syntax:\n *\n * math.bigint(value)\n *\n * Examples:\n *\n * math.bigint(2) // returns 2n\n * math.bigint('123') // returns 123n\n * math.bigint(true) // returns 1n\n * math.bigint([true, false, true, true]) // returns [1n, 0n, 1n, 1n]\n *\n * See also:\n *\n * number, bignumber, boolean, complex, index, matrix, string, unit\n *\n * @param {string | number | BigNumber | bigint | Fraction | boolean | Array | Matrix | null} [value] Value to be converted\n * @return {bigint | Array | Matrix} The created bigint\n */\n const bigint = typed('bigint', {\n '': function () {\n return 0n\n },\n\n bigint: function (x) {\n return x\n },\n\n number: function (x) {\n return BigInt(x.toFixed())\n },\n\n BigNumber: function (x) {\n return BigInt(x.round().toString())\n },\n\n Fraction: function (x) {\n return BigInt(x.valueOf().toFixed())\n },\n\n 'string | boolean': function (x) {\n return BigInt(x)\n },\n\n null: function (x) {\n return 0n\n },\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n\n // reviver function to parse a JSON object like:\n //\n // {\"mathjs\":\"bigint\",\"value\":\"123\"}\n //\n // into a bigint 123n\n bigint.fromJSON = function (json) {\n return BigInt(json.value)\n }\n\n return bigint\n})\n","import { factory } from '../utils/factory.js'\nimport { deepMap } from '../utils/collection.js'\nimport { format } from '../utils/number.js'\n\nconst name = 'string'\nconst dependencies = ['typed']\n\nexport const createString = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Create a string or convert any object into a string.\n * Elements of Arrays and Matrices are processed element wise.\n *\n * Syntax:\n *\n * math.string(value)\n *\n * Examples:\n *\n * math.string(4.2) // returns string '4.2'\n * math.string(math.complex(3, 2) // returns string '3 + 2i'\n *\n * const u = math.unit(5, 'km')\n * math.string(u.to('m')) // returns string '5000 m'\n *\n * math.string([true, false]) // returns ['true', 'false']\n *\n * See also:\n *\n * bignumber, boolean, complex, index, matrix, number, unit\n *\n * @param {* | Array | Matrix | null} [value] A value to convert to a string\n * @return {string | Array | Matrix} The created string\n */\n return typed(name, {\n '': function () {\n return ''\n },\n\n number: format,\n\n null: function (x) {\n return 'null'\n },\n\n boolean: function (x) {\n return x + ''\n },\n\n string: function (x) {\n return x\n },\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self)),\n\n any: function (x) {\n return String(x)\n }\n })\n})\n","import { factory } from '../utils/factory.js'\nimport { deepMap } from '../utils/collection.js'\n\nconst name = 'boolean'\nconst dependencies = ['typed']\n\nexport const createBoolean = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Create a boolean or convert a string or number to a boolean.\n * In case of a number, `true` is returned for non-zero numbers, and `false` in\n * case of zero.\n * Strings can be `'true'` or `'false'`, or can contain a number.\n * When value is a matrix, all elements will be converted to boolean.\n *\n * Syntax:\n *\n * math.boolean(x)\n *\n * Examples:\n *\n * math.boolean(0) // returns false\n * math.boolean(1) // returns true\n * math.boolean(-3) // returns true\n * math.boolean('true') // returns true\n * math.boolean('false') // returns false\n * math.boolean([1, 0, 1, 1]) // returns [true, false, true, true]\n *\n * See also:\n *\n * bignumber, complex, index, matrix, string, unit\n *\n * @param {string | number | boolean | Array | Matrix | null} value A value of any type\n * @return {boolean | Array | Matrix} The boolean value\n */\n return typed(name, {\n '': function () {\n return false\n },\n\n boolean: function (x) {\n return x\n },\n\n number: function (x) {\n return !!x\n },\n\n null: function (x) {\n return false\n },\n\n BigNumber: function (x) {\n return !x.isZero()\n },\n\n string: function (x) {\n // try case insensitive\n const lcase = x.toLowerCase()\n if (lcase === 'true') {\n return true\n } else if (lcase === 'false') {\n return false\n }\n\n // test whether value is a valid number\n const num = Number(x)\n if (x !== '' && !isNaN(num)) {\n return !!num\n }\n\n throw new Error('Cannot convert \"' + x + '\" to a boolean')\n },\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","import { factory } from '../../../utils/factory.js'\nimport { deepMap } from '../../../utils/collection.js'\n\nconst name = 'bignumber'\nconst dependencies = ['typed', 'BigNumber']\n\nexport const createBignumber = /* #__PURE__ */ factory(name, dependencies, ({ typed, BigNumber }) => {\n /**\n * Create a BigNumber, which can store numbers with arbitrary precision.\n * When a matrix is provided, all elements will be converted to BigNumber.\n *\n * Syntax:\n *\n * math.bignumber(x)\n *\n * Examples:\n *\n * 0.1 + 0.2 // returns number 0.30000000000000004\n * math.bignumber(0.1) + math.bignumber(0.2) // returns BigNumber 0.3\n *\n *\n * 7.2e500 // returns number Infinity\n * math.bignumber('7.2e500') // returns BigNumber 7.2e500\n *\n * See also:\n *\n * number, bigint, boolean, complex, index, matrix, string, unit\n *\n * @param {number | string | Fraction | BigNumber | bigint | Array | Matrix | boolean | null} [value] Value for the big number,\n * 0 by default.\n * @returns {BigNumber} The created bignumber\n */\n return typed('bignumber', {\n '': function () {\n return new BigNumber(0)\n },\n\n number: function (x) {\n // convert to string to prevent errors in case of >15 digits\n return new BigNumber(x + '')\n },\n\n string: function (x) {\n const wordSizeSuffixMatch = x.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/)\n if (wordSizeSuffixMatch) {\n // x has a word size suffix\n const size = wordSizeSuffixMatch[2]\n const n = BigNumber(wordSizeSuffixMatch[1])\n const twoPowSize = new BigNumber(2).pow(Number(size))\n if (n.gt(twoPowSize.sub(1))) {\n throw new SyntaxError(`String \"${x}\" is out of range`)\n }\n const twoPowSizeSubOne = new BigNumber(2).pow(Number(size) - 1)\n if (n.gte(twoPowSizeSubOne)) {\n return n.sub(twoPowSize)\n } else {\n return n\n }\n }\n return new BigNumber(x)\n },\n\n BigNumber: function (x) {\n // we assume a BigNumber is immutable\n return x\n },\n\n bigint: function (x) {\n return new BigNumber(x.toString())\n },\n\n Unit: typed.referToSelf(self => (x) => {\n const clone = x.clone()\n clone.value = self(x.value)\n return clone\n }),\n\n Fraction: function (x) {\n return new BigNumber(String(x.n)).div(String(x.d)).times(String(x.s))\n },\n\n null: function (_x) {\n return new BigNumber(0)\n },\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","import { factory } from '../../../utils/factory.js'\nimport { deepMap } from '../../../utils/collection.js'\n\nconst name = 'complex'\nconst dependencies = ['typed', 'Complex']\n\nexport const createComplex = /* #__PURE__ */ factory(name, dependencies, ({ typed, Complex }) => {\n /**\n * Create a complex value or convert a value to a complex value.\n *\n * Syntax:\n *\n * math.complex() // creates a complex value with zero\n * // as real and imaginary part.\n * math.complex(re : number, im : string) // creates a complex value with provided\n * // values for real and imaginary part.\n * math.complex(re : number) // creates a complex value with provided\n * // real value and zero imaginary part.\n * math.complex(complex : Complex) // clones the provided complex value.\n * math.complex(arg : string) // parses a string into a complex value.\n * math.complex(array : Array) // converts the elements of the array\n * // or matrix element wise into a\n * // complex value.\n * math.complex({re: number, im: number}) // creates a complex value with provided\n * // values for real an imaginary part.\n * math.complex({r: number, phi: number}) // creates a complex value with provided\n * // polar coordinates\n *\n * Examples:\n *\n * const a = math.complex(3, -4) // a = Complex 3 - 4i\n * a.re = 5 // a = Complex 5 - 4i\n * const i = a.im // Number -4\n * const b = math.complex('2 + 6i') // Complex 2 + 6i\n * const c = math.complex() // Complex 0 + 0i\n * const d = math.add(a, b) // Complex 5 + 2i\n *\n * See also:\n *\n * bignumber, boolean, index, matrix, number, string, unit\n *\n * @param {* | Array | Matrix} [args]\n * Arguments specifying the real and imaginary part of the complex number\n * @return {Complex | Array | Matrix} Returns a complex value\n */\n return typed('complex', {\n '': function () {\n return Complex.ZERO\n },\n\n number: function (x) {\n return new Complex(x, 0)\n },\n\n 'number, number': function (re, im) {\n return new Complex(re, im)\n },\n\n // TODO: this signature should be redundant\n 'BigNumber, BigNumber': function (re, im) {\n return new Complex(re.toNumber(), im.toNumber())\n },\n\n Fraction: function (x) {\n return new Complex(x.valueOf(), 0)\n },\n\n Complex: function (x) {\n return x.clone()\n },\n\n string: function (x) {\n return Complex(x) // for example '2 + 3i'\n },\n\n null: function (x) {\n return Complex(0)\n },\n\n Object: function (x) {\n if ('re' in x && 'im' in x) {\n return new Complex(x.re, x.im)\n }\n\n if (('r' in x && 'phi' in x) || ('abs' in x && 'arg' in x)) {\n return new Complex(x)\n }\n\n throw new Error('Expected object with properties (re and im) or (r and phi) or (abs and arg)')\n },\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","import { factory } from '../../../utils/factory.js'\nimport { deepMap } from '../../../utils/collection.js'\n\nconst name = 'fraction'\nconst dependencies = ['typed', 'Fraction']\n\nexport const createFraction = /* #__PURE__ */ factory(name, dependencies, ({ typed, Fraction }) => {\n /**\n * Create a fraction or convert a value to a fraction.\n *\n * With one numeric argument, produces the closest rational approximation to the\n * input.\n * With two arguments, the first is the numerator and the second is the denominator,\n * and creates the corresponding fraction. Both numerator and denominator must be\n * integers.\n * With one object argument, looks for the integer numerator as the value of property\n * 'n' and the integer denominator as the value of property 'd'.\n * With a matrix argument, creates a matrix of the same shape with entries\n * converted into fractions.\n *\n * Syntax:\n * math.fraction(value)\n * math.fraction(numerator, denominator)\n * math.fraction({n: numerator, d: denominator})\n * math.fraction(matrix: Array | Matrix)\n *\n * Examples:\n *\n * math.fraction(6.283) // returns Fraction 6283/1000\n * math.fraction(1, 3) // returns Fraction 1/3\n * math.fraction('2/3') // returns Fraction 2/3\n * math.fraction({n: 2, d: 3}) // returns Fraction 2/3\n * math.fraction([0.2, 0.25, 1.25]) // returns Array [1/5, 1/4, 5/4]\n * math.fraction(4, 5.1) // throws Error: Parameters must be integer\n *\n * See also:\n *\n * bignumber, number, string, unit\n *\n * @param {number | string | Fraction | BigNumber | bigint | Unit | Array | Matrix} [args]\n * Arguments specifying the value, or numerator and denominator of\n * the fraction\n * @return {Fraction | Array | Matrix} Returns a fraction\n */\n return typed('fraction', {\n number: function (x) {\n if (!isFinite(x) || isNaN(x)) {\n throw new Error(x + ' cannot be represented as a fraction')\n }\n\n return new Fraction(x)\n },\n\n string: function (x) {\n return new Fraction(x)\n },\n\n 'number, number': function (numerator, denominator) {\n return new Fraction(numerator, denominator)\n },\n\n 'bigint, bigint': function (numerator, denominator) {\n return new Fraction(numerator, denominator)\n },\n\n null: function (x) {\n return new Fraction(0)\n },\n\n BigNumber: function (x) {\n return new Fraction(x.toString())\n },\n\n bigint: function (x) {\n return new Fraction(x.toString())\n },\n\n Fraction: function (x) {\n return x // fractions are immutable\n },\n\n Unit: typed.referToSelf(self => (x) => {\n const clone = x.clone()\n clone.value = self(x.value)\n return clone\n }),\n\n Object: function (x) {\n return new Fraction(x)\n },\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","import { factory } from '../../../utils/factory.js'\n\nconst name = 'matrix'\nconst dependencies = ['typed', 'Matrix', 'DenseMatrix', 'SparseMatrix']\n\nexport const createMatrix = /* #__PURE__ */ factory(name, dependencies, ({ typed, Matrix, DenseMatrix, SparseMatrix }) => {\n /**\n * Create a Matrix. The function creates a new `math.Matrix` object from\n * an `Array`. A Matrix has utility functions to manipulate the data in the\n * matrix, like getting the size and getting or setting values in the matrix.\n * Supported storage formats are 'dense' and 'sparse'.\n *\n * Syntax:\n *\n * math.matrix() // creates an empty matrix using default storage format (dense).\n * math.matrix(data) // creates a matrix with initial data using default storage format (dense).\n * math.matrix('dense') // creates an empty matrix using the given storage format.\n * math.matrix(data, 'dense') // creates a matrix with initial data using the given storage format.\n * math.matrix(data, 'sparse') // creates a sparse matrix with initial data.\n * math.matrix(data, 'sparse', 'number') // creates a sparse matrix with initial data, number data type.\n *\n * Examples:\n *\n * let m = math.matrix([[1, 2], [3, 4]])\n * m.size() // Array [2, 2]\n * m.resize([3, 2], 5)\n * m.valueOf() // Array [[1, 2], [3, 4], [5, 5]]\n * m.get([1, 0]) // number 3\n *\n * See also:\n *\n * bignumber, boolean, complex, index, number, string, unit, sparse\n *\n * @param {Array | Matrix} [data] A multi dimensional array\n * @param {string} [format] The Matrix storage format, either `'dense'` or `'sparse'`\n * @param {string} [datatype] Type of the values\n *\n * @return {Matrix} The created matrix\n */\n return typed(name, {\n '': function () {\n return _create([])\n },\n\n string: function (format) {\n return _create([], format)\n },\n\n 'string, string': function (format, datatype) {\n return _create([], format, datatype)\n },\n\n Array: function (data) {\n return _create(data)\n },\n\n Matrix: function (data) {\n return _create(data, data.storage())\n },\n\n 'Array | Matrix, string': _create,\n\n 'Array | Matrix, string, string': _create\n })\n\n /**\n * Create a new Matrix with given storage format\n * @param {Array} data\n * @param {string} [format]\n * @param {string} [datatype]\n * @returns {Matrix} Returns a new Matrix\n * @private\n */\n function _create (data, format, datatype) {\n // get storage format constructor\n if (format === 'dense' || format === 'default' || format === undefined) {\n return new DenseMatrix(data, datatype)\n }\n\n if (format === 'sparse') {\n return new SparseMatrix(data, datatype)\n }\n\n throw new TypeError('Unknown matrix type ' + JSON.stringify(format) + '.')\n }\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'matrixFromFunction'\nconst dependencies = ['typed', 'matrix', 'isZero']\n\nexport const createMatrixFromFunction = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, isZero }) => {\n /**\n * Create a matrix by evaluating a generating function at each index.\n * The simplest overload returns a multi-dimensional array as long as `size`\n * is an array.\n * Passing `size` as a Matrix or specifying a `format` will result in\n * returning a Matrix.\n *\n * Syntax:\n *\n * math.matrixFromFunction(size, fn)\n * math.matrixFromFunction(size, fn, format)\n * math.matrixFromFunction(size, fn, format, datatype)\n * math.matrixFromFunction(size, format, fn)\n * math.matrixFromFunction(size, format, datatype, fn)\n *\n * Where:\n *\n * - `size: (number[] | Matrix)`\n * A vector giving the extent of the array to be created in each\n * dimension. If size has one entry, a vector is created; if it\n * has two, a rectangular array/Matrix is created; if three, a\n * three-dimensional array/Matrix is created; and so on.\n * - `fn: (index: number[]) => MathType`\n * The callback function that will generate the entries of the\n * matrix. It is called in turn with the index of each entry of\n * the matrix. The index is always an ordinary array of numbers\n * with the same length as _size_. So for vectors, you will get\n * indices like `[0]` or `[1]`, whereas for matrices, you will\n * get indices like `[2, 0]` or `[1,3]`. The return value may\n * be any type that can go in an array or Matrix entry, although\n * if you supply the _datatype_ argument, you must yourself ensure\n * the type of the return value matches. Note that currently,\n * your callback _fn_ will receive 0-based indices for the matrix\n * entries, regardless of whether matrixFromFunction is invoked\n * directly from JavaScript or via the mathjs expression language.\n * - `format: 'dense'|'sparse'`\n * Specifies the storage format for the resulting Matrix. Note that\n * if this argument is given, the return value will always be a\n * Matrix (rather than possibly an Array).\n * - `datatype: string`\n * Specifies the data type of entries of the new matrix. If given,\n * it should be the name of a data type that mathjs supports, as\n * returned by the math.typeOf function. It is up to the caller\n * to make certain that all values returned by _fn_ are consistent\n * with this datatype if specified.\n *\n * Examples:\n *\n * math.matrixFromFunction([3,3], i => i[0] - i[1]) // an antisymmetric matrix\n * math.matrixFromFunction([100, 100], 'sparse', i => i[0] - i[1] === 1 ? 4 : 0) // a sparse subdiagonal matrix\n * math.matrixFromFunction([5], i => math.random()) // a random vector\n *\n * See also:\n *\n * matrix, typeOf, zeros\n *\n * @param {Array | Matrix} size The size of the matrix to be created\n * @param {function} fn Callback function invoked for every entry in the matrix\n * @param {string} [format] The Matrix storage format, either `'dense'` or `'sparse'`\n * @param {string} [datatype] Type of the values\n * @return {Array | Matrix} Returns the created matrix\n */\n return typed(name, {\n 'Array | Matrix, function, string, string': function (size, fn, format, datatype) {\n return _create(size, fn, format, datatype)\n },\n 'Array | Matrix, function, string': function (size, fn, format) {\n return _create(size, fn, format)\n },\n 'Matrix, function': function (size, fn) {\n return _create(size, fn, 'dense')\n },\n 'Array, function': function (size, fn) {\n return _create(size, fn, 'dense').toArray()\n },\n 'Array | Matrix, string, function': function (size, format, fn) {\n return _create(size, fn, format)\n },\n 'Array | Matrix, string, string, function': function (size, format, datatype, fn) {\n return _create(size, fn, format, datatype)\n }\n })\n\n function _create (size, fn, format, datatype) {\n let m\n if (datatype !== undefined) {\n m = matrix(format, datatype)\n } else {\n m = matrix(format)\n }\n\n m.resize(size)\n m.forEach(function (_, index) {\n const val = fn(index)\n if (isZero(val)) return\n m.set(index, val)\n })\n\n return m\n }\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'matrixFromRows'\nconst dependencies = ['typed', 'matrix', 'flatten', 'size']\n\nexport const createMatrixFromRows = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, flatten, size }) => {\n /**\n * Create a dense matrix from vectors as individual rows.\n * If you pass column vectors, they will be transposed (but not conjugated!)\n *\n * Syntax:\n *\n * math.matrixFromRows(...arr)\n * math.matrixFromRows(row1, row2)\n * math.matrixFromRows(row1, row2, row3)\n *\n * Examples:\n *\n * math.matrixFromRows([1, 2, 3], [[4],[5],[6]])\n * math.matrixFromRows(...vectors)\n *\n * See also:\n *\n * matrix, matrixFromColumns, matrixFromFunction, zeros\n *\n * @param {... Array | Matrix} rows Multiple rows\n * @return { number[][] | Matrix } if at least one of the arguments is an array, an array will be returned\n */\n return typed(name, {\n '...Array': function (arr) {\n return _createArray(arr)\n },\n '...Matrix': function (arr) {\n return matrix(_createArray(arr.map(m => m.toArray())))\n }\n\n // TODO implement this properly for SparseMatrix\n })\n\n function _createArray (arr) {\n if (arr.length === 0) throw new TypeError('At least one row is needed to construct a matrix.')\n const N = checkVectorTypeAndReturnLength(arr[0])\n\n const result = []\n for (const row of arr) {\n const rowLength = checkVectorTypeAndReturnLength(row)\n\n if (rowLength !== N) {\n throw new TypeError('The vectors had different length: ' + (N | 0) + ' ≠ ' + (rowLength | 0))\n }\n\n result.push(flatten(row))\n }\n\n return result\n }\n\n function checkVectorTypeAndReturnLength (vec) {\n const s = size(vec)\n\n if (s.length === 1) { // 1D vector\n return s[0]\n } else if (s.length === 2) { // 2D vector\n if (s[0] === 1) { // row vector\n return s[1]\n } else if (s[1] === 1) { // col vector\n return s[0]\n } else {\n throw new TypeError('At least one of the arguments is not a vector.')\n }\n } else {\n throw new TypeError('Only one- or two-dimensional vectors are supported.')\n }\n }\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'matrixFromColumns'\nconst dependencies = ['typed', 'matrix', 'flatten', 'size']\n\nexport const createMatrixFromColumns = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, flatten, size }) => {\n /**\n * Create a dense matrix from vectors as individual columns.\n * If you pass row vectors, they will be transposed (but not conjugated!)\n *\n * Syntax:\n *\n * math.matrixFromColumns(...arr)\n * math.matrixFromColumns(col1, col2)\n * math.matrixFromColumns(col1, col2, col3)\n *\n * Examples:\n *\n * math.matrixFromColumns([1, 2, 3], [[4],[5],[6]])\n * math.matrixFromColumns(...vectors)\n *\n * See also:\n *\n * matrix, matrixFromRows, matrixFromFunction, zeros\n *\n * @param {... Array | Matrix} cols Multiple columns\n * @return { number[][] | Matrix } if at least one of the arguments is an array, an array will be returned\n */\n return typed(name, {\n '...Array': function (arr) {\n return _createArray(arr)\n },\n '...Matrix': function (arr) {\n return matrix(_createArray(arr.map(m => m.toArray())))\n }\n\n // TODO implement this properly for SparseMatrix\n })\n\n function _createArray (arr) {\n if (arr.length === 0) throw new TypeError('At least one column is needed to construct a matrix.')\n const N = checkVectorTypeAndReturnLength(arr[0])\n\n // create an array with empty rows\n const result = []\n for (let i = 0; i < N; i++) {\n result[i] = []\n }\n\n // loop columns\n for (const col of arr) {\n const colLength = checkVectorTypeAndReturnLength(col)\n\n if (colLength !== N) {\n throw new TypeError('The vectors had different length: ' + (N | 0) + ' ≠ ' + (colLength | 0))\n }\n\n const f = flatten(col)\n\n // push a value to each row\n for (let i = 0; i < N; i++) {\n result[i].push(f[i])\n }\n }\n\n return result\n }\n\n function checkVectorTypeAndReturnLength (vec) {\n const s = size(vec)\n\n if (s.length === 1) { // 1D vector\n return s[0]\n } else if (s.length === 2) { // 2D vector\n if (s[0] === 1) { // row vector\n return s[1]\n } else if (s[1] === 1) { // col vector\n return s[0]\n } else {\n throw new TypeError('At least one of the arguments is not a vector.')\n }\n } else {\n throw new TypeError('Only one- or two-dimensional vectors are supported.')\n }\n }\n})\n","import { factory } from '../../../utils/factory.js'\n\nconst name = 'splitUnit'\nconst dependencies = ['typed']\n\nexport const createSplitUnit = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Split a unit in an array of units whose sum is equal to the original unit.\n *\n * Syntax:\n *\n * math.splitUnit(unit: Unit, parts: Array.)\n *\n * Example:\n *\n * math.splitUnit(new Unit(1, 'm'), ['feet', 'inch'])\n * // [ 3 feet, 3.3700787401575 inch ]\n *\n * See also:\n *\n * unit\n *\n * @param {Array} [parts] An array of strings or valueless units.\n * @return {Array} An array of units.\n */\n return typed(name, {\n 'Unit, Array': function (unit, parts) {\n return unit.splitUnit(parts)\n }\n })\n})\n","import { cbrt, expm1, isInteger, log10, log1p, log2, sign, toFixed } from '../../utils/number.js'\n\nconst n1 = 'number'\nconst n2 = 'number, number'\n\nexport function absNumber (a) {\n return Math.abs(a)\n}\nabsNumber.signature = n1\n\nexport function addNumber (a, b) {\n return a + b\n}\naddNumber.signature = n2\n\nexport function subtractNumber (a, b) {\n return a - b\n}\nsubtractNumber.signature = n2\n\nexport function multiplyNumber (a, b) {\n return a * b\n}\nmultiplyNumber.signature = n2\n\nexport function divideNumber (a, b) {\n return a / b\n}\ndivideNumber.signature = n2\n\nexport function unaryMinusNumber (x) {\n return -x\n}\nunaryMinusNumber.signature = n1\n\nexport function unaryPlusNumber (x) {\n return x\n}\nunaryPlusNumber.signature = n1\n\nexport function cbrtNumber (x) {\n return cbrt(x)\n}\ncbrtNumber.signature = n1\n\nexport function cubeNumber (x) {\n return x * x * x\n}\ncubeNumber.signature = n1\n\nexport function expNumber (x) {\n return Math.exp(x)\n}\nexpNumber.signature = n1\n\nexport function expm1Number (x) {\n return expm1(x)\n}\nexpm1Number.signature = n1\n\n/**\n * Calculate gcd for numbers\n * @param {number} a\n * @param {number} b\n * @returns {number} Returns the greatest common denominator of a and b\n */\nexport function gcdNumber (a, b) {\n if (!isInteger(a) || !isInteger(b)) {\n throw new Error('Parameters in function gcd must be integer numbers')\n }\n\n // https://en.wikipedia.org/wiki/Euclidean_algorithm\n let r\n while (b !== 0) {\n r = a % b\n a = b\n b = r\n }\n return (a < 0) ? -a : a\n}\ngcdNumber.signature = n2\n\n/**\n * Calculate lcm for two numbers\n * @param {number} a\n * @param {number} b\n * @returns {number} Returns the least common multiple of a and b\n */\nexport function lcmNumber (a, b) {\n if (!isInteger(a) || !isInteger(b)) {\n throw new Error('Parameters in function lcm must be integer numbers')\n }\n\n if (a === 0 || b === 0) {\n return 0\n }\n\n // https://en.wikipedia.org/wiki/Euclidean_algorithm\n // evaluate lcm here inline to reduce overhead\n let t\n const prod = a * b\n while (b !== 0) {\n t = b\n b = a % t\n a = t\n }\n return Math.abs(prod / a)\n}\nlcmNumber.signature = n2\n\n/**\n * Calculate the logarithm of a value, optionally to a given base.\n * @param {number} x\n * @param {number | null | undefined} base\n * @return {number}\n */\nexport function logNumber (x, y) {\n if (y) { return Math.log(x) / Math.log(y) }\n return Math.log(x)\n}\n\n/**\n * Calculate the 10-base logarithm of a number\n * @param {number} x\n * @return {number}\n */\nexport function log10Number (x) {\n return log10(x)\n}\nlog10Number.signature = n1\n\n/**\n * Calculate the 2-base logarithm of a number\n * @param {number} x\n * @return {number}\n */\nexport function log2Number (x) {\n return log2(x)\n}\nlog2Number.signature = n1\n\n/**\n * Calculate the natural logarithm of a `number+1`\n * @param {number} x\n * @returns {number}\n */\nexport function log1pNumber (x) {\n return log1p(x)\n}\nlog1pNumber.signature = n1\n\n/**\n * Calculate the modulus of two numbers\n * @param {number} x\n * @param {number} y\n * @returns {number} res\n * @private\n */\nexport function modNumber (x, y) {\n // We don't use JavaScript's % operator here as this doesn't work\n // correctly for x < 0 and x === 0\n // see https://en.wikipedia.org/wiki/Modulo_operation\n return (y === 0) ? x : x - y * Math.floor(x / y)\n}\nmodNumber.signature = n2\n\n/**\n * Calculate the nth root of a, solve x^root == a\n * http://rosettacode.org/wiki/Nth_root#JavaScript\n * @param {number} a\n * @param {number} [2] root\n * @private\n */\nexport function nthRootNumber (a, root = 2) {\n const inv = root < 0\n if (inv) {\n root = -root\n }\n\n if (root === 0) {\n throw new Error('Root must be non-zero')\n }\n if (a < 0 && (Math.abs(root) % 2 !== 1)) {\n throw new Error('Root must be odd when a is negative.')\n }\n\n // edge cases zero and infinity\n if (a === 0) {\n return inv ? Infinity : 0\n }\n if (!isFinite(a)) {\n return inv ? 0 : a\n }\n\n let x = Math.pow(Math.abs(a), 1 / root)\n // If a < 0, we require that root is an odd integer,\n // so (-1) ^ (1/root) = -1\n x = a < 0 ? -x : x\n return inv ? 1 / x : x\n\n // Very nice algorithm, but fails with nthRoot(-2, 3).\n // Newton's method has some well-known problems at times:\n // https://en.wikipedia.org/wiki/Newton%27s_method#Failure_analysis\n /*\n let x = 1 // Initial guess\n let xPrev = 1\n let i = 0\n const iMax = 10000\n do {\n const delta = (a / Math.pow(x, root - 1) - x) / root\n xPrev = x\n x = x + delta\n i++\n }\n while (xPrev !== x && i < iMax)\n\n if (xPrev !== x) {\n throw new Error('Function nthRoot failed to converge')\n }\n\n return inv ? 1 / x : x\n */\n}\n\nexport function signNumber (x) {\n return sign(x)\n}\nsignNumber.signature = n1\n\nexport function sqrtNumber (x) {\n return Math.sqrt(x)\n}\nsqrtNumber.signature = n1\n\nexport function squareNumber (x) {\n return x * x\n}\nsquareNumber.signature = n1\n\n/**\n * Calculate xgcd for two numbers\n * @param {number} a\n * @param {number} b\n * @return {number} result\n * @private\n */\nexport function xgcdNumber (a, b) {\n // source: https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm\n let t // used to swap two variables\n let q // quotient\n let r // remainder\n let x = 0\n let lastx = 1\n let y = 1\n let lasty = 0\n\n if (!isInteger(a) || !isInteger(b)) {\n throw new Error('Parameters in function xgcd must be integer numbers')\n }\n\n while (b) {\n q = Math.floor(a / b)\n r = a - q * b\n\n t = x\n x = lastx - q * x\n lastx = t\n\n t = y\n y = lasty - q * y\n lasty = t\n\n a = b\n b = r\n }\n\n let res\n if (a < 0) {\n res = [-a, -lastx, -lasty]\n } else {\n res = [a, a ? lastx : 0, lasty]\n }\n return res\n}\nxgcdNumber.signature = n2\n\n/**\n * Calculates the power of x to y, x^y, for two numbers.\n * @param {number} x\n * @param {number} y\n * @return {number} res\n */\nexport function powNumber (x, y) {\n // x^Infinity === 0 if -1 < x < 1\n // A real number 0 is returned instead of complex(0)\n if ((x * x < 1 && y === Infinity) ||\n (x * x > 1 && y === -Infinity)) {\n return 0\n }\n\n return Math.pow(x, y)\n}\npowNumber.signature = n2\n\n/**\n * round a number to the given number of decimals, or to zero if decimals is\n * not provided\n * @param {number} value\n * @param {number} decimals number of decimals, between 0 and 15 (0 by default)\n * @return {number} roundedValue\n */\nexport function roundNumber (value, decimals = 0) {\n if (!isInteger(decimals) || decimals < 0 || decimals > 15) {\n throw new Error('Number of decimals in function round must be an integer from 0 to 15 inclusive')\n }\n return parseFloat(toFixed(value, decimals))\n}\n\n/**\n * Calculate the norm of a number, the absolute value.\n * @param {number} x\n * @return {number}\n */\nexport function normNumber (x) {\n return Math.abs(x)\n}\nnormNumber.signature = n1\n","import { factory } from '../../utils/factory.js'\nimport { deepMap } from '../../utils/collection.js'\nimport { unaryMinusNumber } from '../../plain/number/index.js'\n\nconst name = 'unaryMinus'\nconst dependencies = ['typed']\n\nexport const createUnaryMinus = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Inverse the sign of a value, apply a unary minus operation.\n *\n * For matrices, the function is evaluated element wise. Boolean values and\n * strings will be converted to a number. For complex numbers, both real and\n * complex value are inverted.\n *\n * Syntax:\n *\n * math.unaryMinus(x)\n *\n * Examples:\n *\n * math.unaryMinus(3.5) // returns -3.5\n * math.unaryMinus(-4.2) // returns 4.2\n *\n * See also:\n *\n * add, subtract, unaryPlus\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} x Number to be inverted.\n * @return {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} Returns the value with inverted sign.\n */\n return typed(name, {\n number: unaryMinusNumber,\n\n 'Complex | BigNumber | Fraction': x => x.neg(),\n\n bigint: x => -x,\n\n Unit: typed.referToSelf(self => x => {\n const res = x.clone()\n res.value = typed.find(self, res.valueType())(x.value)\n return res\n }),\n\n // deep map collection, skip zeros since unaryMinus(0) = 0\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self, true))\n\n // TODO: add support for string\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { deepMap } from '../../utils/collection.js'\nimport { unaryPlusNumber } from '../../plain/number/index.js'\nimport { safeNumberType } from '../../utils/number.js'\n\nconst name = 'unaryPlus'\nconst dependencies = ['typed', 'config', 'numeric']\n\nexport const createUnaryPlus = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, numeric }) => {\n /**\n * Unary plus operation.\n * Boolean values and strings will be converted to a number, numeric values will be returned as is.\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.unaryPlus(x)\n *\n * Examples:\n *\n * math.unaryPlus(3.5) // returns 3.5\n * math.unaryPlus(1) // returns 1\n *\n * See also:\n *\n * unaryMinus, add, subtract\n *\n * @param {number | BigNumber | bigint | Fraction | string | Complex | Unit | Array | Matrix} x\n * Input value\n * @return {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix}\n * Returns the input value when numeric, converts to a number when input is non-numeric.\n */\n return typed(name, {\n number: unaryPlusNumber,\n\n Complex: function (x) {\n return x // complex numbers are immutable\n },\n\n BigNumber: function (x) {\n return x // bignumbers are immutable\n },\n\n bigint: function (x) {\n return x\n },\n\n Fraction: function (x) {\n return x // fractions are immutable\n },\n\n Unit: function (x) {\n return x.clone()\n },\n\n // deep map collection, skip zeros since unaryPlus(0) = 0\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self, true)),\n\n boolean: function (x) {\n return numeric(x ? 1 : 0, config.number)\n },\n\n string: function (x) {\n return numeric(x, safeNumberType(x, config))\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { deepMap } from '../../utils/collection.js'\nimport { absNumber } from '../../plain/number/index.js'\n\nconst name = 'abs'\nconst dependencies = ['typed']\n\nexport const createAbs = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Calculate the absolute value of a number. For matrices, the function is\n * evaluated element wise.\n *\n * Syntax:\n *\n * math.abs(x)\n *\n * Examples:\n *\n * math.abs(3.5) // returns number 3.5\n * math.abs(-4.2) // returns number 4.2\n *\n * math.abs([3, -5, -1, 0, 2]) // returns Array [3, 5, 1, 0, 2]\n *\n * See also:\n *\n * sign\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Array | Matrix | Unit} x\n * A number or matrix for which to get the absolute value\n * @return {number | BigNumber | bigint | Fraction | Complex | Array | Matrix | Unit}\n * Absolute value of `x`\n */\n return typed(name, {\n number: absNumber,\n\n 'Complex | BigNumber | Fraction | Unit': x => x.abs(),\n\n bigint: x => x < 0n ? -x : x,\n\n // deep map collection, skip zeros since abs(0) = 0\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self, true))\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { arraySize } from '../../utils/array.js'\nimport { isMatrix } from '../../utils/is.js'\nimport { IndexError } from '../../error/IndexError.js'\n\nconst name = 'mapSlices'\nconst dependencies = ['typed', 'isInteger']\n\nexport const createMapSlices = /* #__PURE__ */ factory(name, dependencies, ({ typed, isInteger }) => {\n /**\n * Apply a function that maps an array to a scalar\n * along a given axis of a matrix or array.\n * Returns a new matrix or array with one less dimension than the input.\n *\n * Syntax:\n *\n * math.mapSlices(A, dim, callback)\n *\n * Where:\n *\n * - `dim: number` is a zero-based dimension over which to concatenate the matrices.\n *\n * Examples:\n *\n * const A = [[1, 2], [3, 4]]\n * const sum = math.sum\n *\n * math.mapSlices(A, 0, sum) // returns [4, 6]\n * math.mapSlices(A, 1, sum) // returns [3, 7]\n *\n * See also:\n *\n * map, filter, forEach\n *\n * Note:\n *\n * `mapSlices()` is also currently available via its deprecated\n * synonym `apply()`.\n *\n * @param {Array | Matrix} array The input Matrix\n * @param {number} dim The dimension along which the callback is applied\n * @param {Function} callback The callback function that is applied. This Function\n * should take an array or 1-d matrix as an input and\n * return a number.\n * @return {Array | Matrix} res The residual matrix with the function mapped on the slices over some dimension.\n */\n return typed(name, {\n 'Array | Matrix, number | BigNumber, function': function (mat, dim, callback) {\n if (!isInteger(dim)) {\n throw new TypeError('Integer number expected for dimension')\n }\n\n const size = Array.isArray(mat) ? arraySize(mat) : mat.size()\n if (dim < 0 || (dim >= size.length)) {\n throw new IndexError(dim, size.length)\n }\n\n if (isMatrix(mat)) {\n return mat.create(_mapSlices(mat.valueOf(), dim, callback), mat.datatype())\n } else {\n return _mapSlices(mat, dim, callback)\n }\n }\n })\n}, { formerly: 'apply' })\n\n/**\n * Recursively reduce a matrix\n * @param {Array} mat\n * @param {number} dim\n * @param {Function} callback\n * @returns {Array} ret\n * @private\n */\nfunction _mapSlices (mat, dim, callback) {\n let i, ret, tran\n\n if (dim <= 0) {\n if (!Array.isArray(mat[0])) {\n return callback(mat)\n } else {\n tran = _switch(mat)\n ret = []\n for (i = 0; i < tran.length; i++) {\n ret[i] = _mapSlices(tran[i], dim - 1, callback)\n }\n return ret\n }\n } else {\n ret = []\n for (i = 0; i < mat.length; i++) {\n ret[i] = _mapSlices(mat[i], dim - 1, callback)\n }\n return ret\n }\n}\n\n/**\n * Transpose a matrix\n * @param {Array} mat\n * @returns {Array} ret\n * @private\n */\nfunction _switch (mat) {\n const I = mat.length\n const J = mat[0].length\n let i, j\n const ret = []\n for (j = 0; j < J; j++) {\n const tmp = []\n for (i = 0; i < I; i++) {\n tmp.push(mat[i][j])\n }\n ret.push(tmp)\n }\n return ret\n}\n","import { factory } from '../../utils/factory.js'\nimport { addNumber } from '../../plain/number/index.js'\n\nconst name = 'addScalar'\nconst dependencies = ['typed']\n\nexport const createAddScalar = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Add two scalar values, `x + y`.\n * This function is meant for internal use: it is used by the public function\n * `add`\n *\n * This function does not support collections (Array or Matrix).\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit} x First value to add\n * @param {number | BigNumber | bigint | Fraction | Complex} y Second value to add\n * @return {number | BigNumber | bigint | Fraction | Complex | Unit} Sum of `x` and `y`\n * @private\n */\n return typed(name, {\n\n 'number, number': addNumber,\n\n 'Complex, Complex': function (x, y) {\n return x.add(y)\n },\n\n 'BigNumber, BigNumber': function (x, y) {\n return x.plus(y)\n },\n\n 'bigint, bigint': function (x, y) {\n return x + y\n },\n\n 'Fraction, Fraction': function (x, y) {\n return x.add(y)\n },\n\n 'Unit, Unit': typed.referToSelf(self => (x, y) => {\n if (x.value === null || x.value === undefined) {\n throw new Error('Parameter x contains a unit with undefined value')\n }\n if (y.value === null || y.value === undefined) {\n throw new Error('Parameter y contains a unit with undefined value')\n }\n if (!x.equalBase(y)) throw new Error('Units do not match')\n\n const res = x.clone()\n res.value =\n typed.find(self, [res.valueType(), y.valueType()])(res.value, y.value)\n res.fixPrefix = false\n return res\n })\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { subtractNumber } from '../../plain/number/index.js'\n\nconst name = 'subtractScalar'\nconst dependencies = ['typed']\n\nexport const createSubtractScalar = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Subtract two scalar values, `x - y`.\n * This function is meant for internal use: it is used by the public function\n * `subtract`\n *\n * This function does not support collections (Array or Matrix).\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit} x First value\n * @param {number | BigNumber | bigint | Fraction | Complex} y Second value to be subtracted from `x`\n * @return {number | BigNumber | bigint | Fraction | Complex | Unit} Difference of `x` and `y`\n * @private\n */\n return typed(name, {\n\n 'number, number': subtractNumber,\n\n 'Complex, Complex': function (x, y) {\n return x.sub(y)\n },\n\n 'BigNumber, BigNumber': function (x, y) {\n return x.minus(y)\n },\n\n 'bigint, bigint': function (x, y) {\n return x - y\n },\n\n 'Fraction, Fraction': function (x, y) {\n return x.sub(y)\n },\n\n 'Unit, Unit': typed.referToSelf(self => (x, y) => {\n if (x.value === null || x.value === undefined) {\n throw new Error('Parameter x contains a unit with undefined value')\n }\n if (y.value === null || y.value === undefined) {\n throw new Error('Parameter y contains a unit with undefined value')\n }\n if (!x.equalBase(y)) throw new Error('Units do not match')\n\n const res = x.clone()\n res.value =\n typed.find(self, [res.valueType(), y.valueType()])(res.value, y.value)\n res.fixPrefix = false\n return res\n })\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { isBigNumber, isComplex, isFraction } from '../../utils/is.js'\nimport { cbrtNumber } from '../../plain/number/index.js'\n\nconst name = 'cbrt'\nconst dependencies = [\n 'config',\n 'typed',\n 'isNegative',\n 'unaryMinus',\n 'matrix',\n 'Complex',\n 'BigNumber',\n 'Fraction'\n]\n\nexport const createCbrt = /* #__PURE__ */ factory(name, dependencies, ({ config, typed, isNegative, unaryMinus, matrix, Complex, BigNumber, Fraction }) => {\n /**\n * Calculate the cubic root of a value.\n *\n * To avoid confusion with the matrix cube root, this function does not\n * apply to matrices. For a matrix, to take the cube root elementwise,\n * see the examples.\n *\n * Syntax:\n *\n * math.cbrt(x)\n * math.cbrt(x, allRoots)\n *\n * Examples:\n *\n * math.cbrt(27) // returns 3\n * math.cube(3) // returns 27\n * math.cbrt(-64) // returns -4\n * math.cbrt(math.unit('27 m^3')) // returns Unit 3 m\n * math.map([27, 64, 125], x => math.cbrt(x)) // returns [3, 4, 5]\n *\n * const x = math.complex('8i')\n * math.cbrt(x) // returns Complex 1.7320508075689 + i\n * math.cbrt(x, true) // returns Matrix [\n * // 1.7320508075689 + i\n * // -1.7320508075689 + i\n * // -2i\n * // ]\n *\n * See also:\n *\n * square, sqrt, cube\n *\n * @param {number | BigNumber | Complex | Unit} x\n * Value for which to calculate the cubic root.\n * @param {boolean} [allRoots] Optional, false by default. Only applicable\n * when `x` is a number or complex number. If true, all complex\n * roots are returned, if false (default) the principal root is\n * returned.\n * @return {number | BigNumber | Complex | Unit}\n * Returns the cubic root of `x`\n */\n return typed(name, {\n number: cbrtNumber,\n // note: signature 'number, boolean' is also supported,\n // created by typed as it knows how to convert number to Complex\n\n Complex: _cbrtComplex,\n\n 'Complex, boolean': _cbrtComplex,\n\n BigNumber: function (x) {\n return x.cbrt()\n },\n\n Unit: _cbrtUnit\n })\n\n /**\n * Calculate the cubic root for a complex number\n * @param {Complex} x\n * @param {boolean} [allRoots] If true, the function will return an array\n * with all three roots. If false or undefined,\n * the principal root is returned.\n * @returns {Complex | Array. | Matrix.} Returns the cubic root(s) of x\n * @private\n */\n function _cbrtComplex (x, allRoots) {\n // https://www.wikiwand.com/en/Cube_root#/Complex_numbers\n\n const arg3 = x.arg() / 3\n const abs = x.abs()\n\n // principal root:\n const principal = new Complex(cbrtNumber(abs), 0).mul(new Complex(0, arg3).exp())\n\n if (allRoots) {\n const all = [\n principal,\n new Complex(cbrtNumber(abs), 0).mul(new Complex(0, arg3 + Math.PI * 2 / 3).exp()),\n new Complex(cbrtNumber(abs), 0).mul(new Complex(0, arg3 - Math.PI * 2 / 3).exp())\n ]\n\n return (config.matrix === 'Array') ? all : matrix(all)\n } else {\n return principal\n }\n }\n\n /**\n * Calculate the cubic root for a Unit\n * @param {Unit} x\n * @return {Unit} Returns the cubic root of x\n * @private\n */\n function _cbrtUnit (x) {\n if (x.value && isComplex(x.value)) {\n let result = x.clone()\n result.value = 1.0\n result = result.pow(1.0 / 3) // Compute the units\n result.value = _cbrtComplex(x.value) // Compute the value\n return result\n } else {\n const negate = isNegative(x.value)\n if (negate) {\n x.value = unaryMinus(x.value)\n }\n\n // TODO: create a helper function for this\n let third\n if (isBigNumber(x.value)) {\n third = new BigNumber(1).div(3)\n } else if (isFraction(x.value)) {\n third = new Fraction(1, 3)\n } else {\n third = 1 / 3\n }\n\n const result = x.pow(third)\n\n if (negate) {\n result.value = unaryMinus(result.value)\n }\n\n return result\n }\n }\n})\n","import { factory } from '../../../utils/factory.js'\n\nconst name = 'matAlgo11xS0s'\nconst dependencies = ['typed', 'equalScalar']\n\nexport const createMatAlgo11xS0s = /* #__PURE__ */ factory(name, dependencies, ({ typed, equalScalar }) => {\n /**\n * Iterates over SparseMatrix S nonzero items and invokes the callback function f(Sij, b).\n * Callback function invoked NZ times (number of nonzero items in S).\n *\n *\n * ┌ f(Sij, b) ; S(i,j) !== 0\n * C(i,j) = ┤\n * └ 0 ; otherwise\n *\n *\n * @param {Matrix} s The SparseMatrix instance (S)\n * @param {Scalar} b The Scalar value\n * @param {Function} callback The f(Aij,b) operation to invoke\n * @param {boolean} inverse A true value indicates callback should be invoked f(b,Sij)\n *\n * @return {Matrix} SparseMatrix (C)\n *\n * https://github.com/josdejong/mathjs/pull/346#issuecomment-97626813\n */\n return function matAlgo11xS0s (s, b, callback, inverse) {\n // sparse matrix arrays\n const avalues = s._values\n const aindex = s._index\n const aptr = s._ptr\n const asize = s._size\n const adt = s._datatype\n\n // sparse matrix cannot be a Pattern matrix\n if (!avalues) { throw new Error('Cannot perform operation on Pattern Sparse Matrix and Scalar value') }\n\n // rows & columns\n const rows = asize[0]\n const columns = asize[1]\n\n // datatype\n let dt\n // equal signature to use\n let eq = equalScalar\n // zero value\n let zero = 0\n // callback signature to use\n let cf = callback\n\n // process data types\n if (typeof adt === 'string') {\n // datatype\n dt = adt\n // find signature that matches (dt, dt)\n eq = typed.find(equalScalar, [dt, dt])\n // convert 0 to the same datatype\n zero = typed.convert(0, dt)\n // convert b to the same datatype\n b = typed.convert(b, dt)\n // callback\n cf = typed.find(callback, [dt, dt])\n }\n\n // result arrays\n const cvalues = []\n const cindex = []\n const cptr = []\n\n // loop columns\n for (let j = 0; j < columns; j++) {\n // initialize ptr\n cptr[j] = cindex.length\n // values in j\n for (let k0 = aptr[j], k1 = aptr[j + 1], k = k0; k < k1; k++) {\n // row\n const i = aindex[k]\n // invoke callback\n const v = inverse ? cf(b, avalues[k]) : cf(avalues[k], b)\n // check value is zero\n if (!eq(v, zero)) {\n // push index & value\n cindex.push(i)\n cvalues.push(v)\n }\n }\n }\n // update ptr\n cptr[columns] = cindex.length\n\n // return sparse matrix\n return s.createSparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [rows, columns],\n datatype: dt\n })\n }\n})\n","import { factory } from '../../../utils/factory.js'\n\nconst name = 'matAlgo12xSfs'\nconst dependencies = ['typed', 'DenseMatrix']\n\nexport const createMatAlgo12xSfs = /* #__PURE__ */ factory(name, dependencies, ({ typed, DenseMatrix }) => {\n /**\n * Iterates over SparseMatrix S nonzero items and invokes the callback function f(Sij, b).\n * Callback function invoked MxN times.\n *\n *\n * ┌ f(Sij, b) ; S(i,j) !== 0\n * C(i,j) = ┤\n * └ f(0, b) ; otherwise\n *\n *\n * @param {Matrix} s The SparseMatrix instance (S)\n * @param {Scalar} b The Scalar value\n * @param {Function} callback The f(Aij,b) operation to invoke\n * @param {boolean} inverse A true value indicates callback should be invoked f(b,Sij)\n *\n * @return {Matrix} DenseMatrix (C)\n *\n * https://github.com/josdejong/mathjs/pull/346#issuecomment-97626813\n */\n return function matAlgo12xSfs (s, b, callback, inverse) {\n // sparse matrix arrays\n const avalues = s._values\n const aindex = s._index\n const aptr = s._ptr\n const asize = s._size\n const adt = s._datatype\n\n // sparse matrix cannot be a Pattern matrix\n if (!avalues) { throw new Error('Cannot perform operation on Pattern Sparse Matrix and Scalar value') }\n\n // rows & columns\n const rows = asize[0]\n const columns = asize[1]\n\n // datatype\n let dt\n // callback signature to use\n let cf = callback\n\n // process data types\n if (typeof adt === 'string') {\n // datatype\n dt = adt\n // convert b to the same datatype\n b = typed.convert(b, dt)\n // callback\n cf = typed.find(callback, [dt, dt])\n }\n\n // result arrays\n const cdata = []\n\n // workspaces\n const x = []\n // marks indicating we have a value in x for a given column\n const w = []\n\n // loop columns\n for (let j = 0; j < columns; j++) {\n // columns mark\n const mark = j + 1\n // values in j\n for (let k0 = aptr[j], k1 = aptr[j + 1], k = k0; k < k1; k++) {\n // row\n const r = aindex[k]\n // update workspace\n x[r] = avalues[k]\n w[r] = mark\n }\n // loop rows\n for (let i = 0; i < rows; i++) {\n // initialize C on first column\n if (j === 0) {\n // create row array\n cdata[i] = []\n }\n // check sparse matrix has a value @ i,j\n if (w[i] === mark) {\n // invoke callback, update C\n cdata[i][j] = inverse ? cf(b, x[i]) : cf(x[i], b)\n } else {\n // dense matrix value @ i, j\n cdata[i][j] = inverse ? cf(b, 0) : cf(0, b)\n }\n }\n }\n\n // return dense matrix\n return new DenseMatrix({\n data: cdata,\n size: [rows, columns],\n datatype: dt\n })\n }\n})\n","import { factory } from '../../../utils/factory.js'\nimport { clone } from '../../../utils/object.js'\n\nconst name = 'matAlgo14xDs'\nconst dependencies = ['typed']\n\nexport const createMatAlgo14xDs = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Iterates over DenseMatrix items and invokes the callback function f(Aij..z, b).\n * Callback function invoked MxN times.\n *\n * C(i,j,...z) = f(Aij..z, b)\n *\n * @param {Matrix} a The DenseMatrix instance (A)\n * @param {Scalar} b The Scalar value\n * @param {Function} callback The f(Aij..z,b) operation to invoke\n * @param {boolean} inverse A true value indicates callback should be invoked f(b,Aij..z)\n *\n * @return {Matrix} DenseMatrix (C)\n *\n * https://github.com/josdejong/mathjs/pull/346#issuecomment-97659042\n */\n return function matAlgo14xDs (a, b, callback, inverse) {\n // a arrays\n const adata = a._data\n const asize = a._size\n const adt = a._datatype\n\n // datatype\n let dt\n // callback signature to use\n let cf = callback\n\n // process data types\n if (typeof adt === 'string') {\n // datatype\n dt = adt\n // convert b to the same datatype\n b = typed.convert(b, dt)\n // callback\n cf = typed.find(callback, [dt, dt])\n }\n\n // populate cdata, iterate through dimensions\n const cdata = asize.length > 0 ? _iterate(cf, 0, asize, asize[0], adata, b, inverse) : []\n\n // c matrix\n return a.createDenseMatrix({\n data: cdata,\n size: clone(asize),\n datatype: dt\n })\n }\n\n // recursive function\n function _iterate (f, level, s, n, av, bv, inverse) {\n // initialize array for this level\n const cv = []\n // check we reach the last level\n if (level === s.length - 1) {\n // loop arrays in last level\n for (let i = 0; i < n; i++) {\n // invoke callback and store value\n cv[i] = inverse ? f(bv, av[i]) : f(av[i], bv)\n }\n } else {\n // iterate current level\n for (let j = 0; j < n; j++) {\n // iterate next level\n cv[j] = _iterate(f, level + 1, s, s[level + 1], av[j], bv, inverse)\n }\n }\n return cv\n }\n})\n","import Decimal from 'decimal.js'\nimport { factory } from '../../utils/factory.js'\nimport { deepMap } from '../../utils/collection.js'\nimport { isInteger, nearlyEqual } from '../../utils/number.js'\nimport { nearlyEqual as bigNearlyEqual } from '../../utils/bignumber/nearlyEqual.js'\nimport { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { createMatAlgo14xDs } from '../../type/matrix/utils/matAlgo14xDs.js'\n\nconst name = 'ceil'\nconst dependencies = ['typed', 'config', 'round', 'matrix', 'equalScalar', 'zeros', 'DenseMatrix']\n\nconst bigTen = new Decimal(10)\n\nexport const createCeilNumber = /* #__PURE__ */ factory(\n name, ['typed', 'config', 'round'], ({ typed, config, round }) => {\n function _ceilNumber (x) {\n // See ./floor.js _floorNumber for rationale here\n const c = Math.ceil(x)\n const r = round(x)\n if (c === r) return c\n if (\n nearlyEqual(x, r, config.relTol, config.absTol) &&\n !nearlyEqual(x, c, config.relTol, config.absTol)\n ) {\n return r\n }\n return c\n }\n\n return typed(name, {\n number: _ceilNumber,\n 'number, number': function (x, n) {\n if (!isInteger(n)) {\n throw new RangeError(\n 'number of decimals in function ceil must be an integer')\n }\n if (n < 0 || n > 15) {\n throw new RangeError(\n 'number of decimals in ceil number must be in range 0-15')\n }\n const shift = 10 ** n\n return _ceilNumber(x * shift) / shift\n }\n })\n }\n)\n\nexport const createCeil = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, round, matrix, equalScalar, zeros, DenseMatrix }) => {\n const matAlgo11xS0s = createMatAlgo11xS0s({ typed, equalScalar })\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matAlgo14xDs = createMatAlgo14xDs({ typed })\n\n const ceilNumber = createCeilNumber({ typed, config, round })\n function _bigCeil (x) {\n // see ./floor.js _floorNumber for rationale\n const bne = (a, b) => bigNearlyEqual(a, b, config.relTol, config.absTol)\n const c = x.ceil()\n const r = round(x)\n if (c.eq(r)) return c\n if (bne(x, r) && !bne(x, c)) return r\n return c\n }\n /**\n * Round a value towards plus infinity\n * If `x` is complex, both real and imaginary part are rounded towards plus infinity.\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.ceil(x)\n * math.ceil(x, n)\n * math.ceil(unit, valuelessUnit)\n * math.ceil(unit, n, valuelessUnit)\n *\n * Examples:\n *\n * math.ceil(3.2) // returns number 4\n * math.ceil(3.8) // returns number 4\n * math.ceil(-4.2) // returns number -4\n * math.ceil(-4.7) // returns number -4\n *\n * math.ceil(3.212, 2) // returns number 3.22\n * math.ceil(3.288, 2) // returns number 3.29\n * math.ceil(-4.212, 2) // returns number -4.21\n * math.ceil(-4.782, 2) // returns number -4.78\n *\n * const c = math.complex(3.24, -2.71)\n * math.ceil(c) // returns Complex 4 - 2i\n * math.ceil(c, 1) // returns Complex 3.3 - 2.7i\n *\n * const unit = math.unit('3.241 cm')\n * const cm = math.unit('cm')\n * const mm = math.unit('mm')\n * math.ceil(unit, 1, cm) // returns Unit 3.3 cm\n * math.ceil(unit, 1, mm) // returns Unit 32.5 mm\n *\n * math.ceil([3.2, 3.8, -4.7]) // returns Array [4, 4, -4]\n * math.ceil([3.21, 3.82, -4.71], 1) // returns Array [3.3, 3.9, -4.7]\n *\n * See also:\n *\n * floor, fix, round\n *\n * @param {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} x Value to be rounded\n * @param {number | BigNumber | Array} [n=0] Number of decimals\n * @param {Unit} [valuelessUnit] A valueless unit\n * @return {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} Rounded value\n */\n return typed('ceil', {\n number: ceilNumber.signatures.number,\n 'number,number': ceilNumber.signatures['number,number'],\n\n Complex: function (x) {\n return x.ceil()\n },\n\n 'Complex, number': function (x, n) {\n return x.ceil(n)\n },\n\n 'Complex, BigNumber': function (x, n) {\n return x.ceil(n.toNumber())\n },\n\n BigNumber: _bigCeil,\n\n 'BigNumber, BigNumber': function (x, n) {\n const shift = bigTen.pow(n)\n return _bigCeil(x.mul(shift)).div(shift)\n },\n\n bigint: b => b,\n 'bigint, number': (b, _dummy) => b,\n 'bigint, BigNumber': (b, _dummy) => b,\n\n Fraction: function (x) {\n return x.ceil()\n },\n\n 'Fraction, number': function (x, n) {\n return x.ceil(n)\n },\n\n 'Fraction, BigNumber': function (x, n) {\n return x.ceil(n.toNumber())\n },\n\n 'Unit, number, Unit': typed.referToSelf(self => function (x, n, unit) {\n const valueless = x.toNumeric(unit)\n return unit.multiply(self(valueless, n))\n }),\n\n 'Unit, BigNumber, Unit': typed.referToSelf(self => (x, n, unit) => self(x, n.toNumber(), unit)),\n\n 'Array | Matrix, number | BigNumber, Unit': typed.referToSelf(self => (x, n, unit) => {\n // deep map collection, skip zeros since ceil(0) = 0\n return deepMap(x, (value) => self(value, n, unit), true)\n }),\n\n 'Array | Matrix | Unit, Unit': typed.referToSelf(self => (x, unit) => self(x, 0, unit)),\n\n 'Array | Matrix': typed.referToSelf(self => (x) => {\n // deep map collection, skip zeros since ceil(0) = 0\n return deepMap(x, self, true)\n }),\n\n 'Array, number | BigNumber': typed.referToSelf(self => (x, n) => {\n // deep map collection, skip zeros since ceil(0) = 0\n return deepMap(x, i => self(i, n), true)\n }),\n\n 'SparseMatrix, number | BigNumber': typed.referToSelf(self => (x, y) => {\n return matAlgo11xS0s(x, y, self, false)\n }),\n\n 'DenseMatrix, number | BigNumber': typed.referToSelf(self => (x, y) => {\n return matAlgo14xDs(x, y, self, false)\n }),\n\n 'number | Complex | Fraction | BigNumber, Array':\n typed.referToSelf(self => (x, y) => {\n // use matrix implementation\n return matAlgo14xDs(matrix(y), x, self, true).valueOf()\n }),\n\n 'number | Complex | Fraction | BigNumber, Matrix':\n typed.referToSelf(self => (x, y) => {\n if (equalScalar(x, 0)) return zeros(y.size(), y.storage())\n if (y.storage() === 'dense') {\n return matAlgo14xDs(y, x, self, true)\n }\n return matAlgo12xSfs(y, x, self, true)\n })\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { cubeNumber } from '../../plain/number/index.js'\n\nconst name = 'cube'\nconst dependencies = ['typed']\n\nexport const createCube = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Compute the cube of a value, `x * x * x`.\n * To avoid confusion with `pow(M,3)`, this function does not apply to matrices.\n * If you wish to cube every entry of a matrix, see the examples.\n *\n * Syntax:\n *\n * math.cube(x)\n *\n * Examples:\n *\n * math.cube(2) // returns number 8\n * math.pow(2, 3) // returns number 8\n * math.cube(4) // returns number 64\n * 4 * 4 * 4 // returns number 64\n *\n * math.map([1, 2, 3, 4], math.cube) // returns Array [1, 8, 27, 64]\n *\n * See also:\n *\n * multiply, square, pow, cbrt\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit} x Number for which to calculate the cube\n * @return {number | BigNumber | bigint | Fraction | Complex | Unit} Cube of x\n */\n return typed(name, {\n number: cubeNumber,\n\n Complex: function (x) {\n return x.mul(x).mul(x) // Is faster than pow(x, 3)\n },\n\n BigNumber: function (x) {\n return x.times(x).times(x)\n },\n\n bigint: function (x) {\n return x * x * x\n },\n\n Fraction: function (x) {\n return x.pow(3) // Is faster than mul()mul()mul()\n },\n\n Unit: function (x) {\n return x.pow(3)\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { expNumber } from '../../plain/number/index.js'\n\nconst name = 'exp'\nconst dependencies = ['typed']\n\nexport const createExp = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Calculate the exponential of a value.\n * For matrices, if you want the matrix exponential of square matrix, use\n * the `expm` function; if you want to take the exponential of each element,\n * see the examples.\n *\n * Syntax:\n *\n * math.exp(x)\n *\n * Examples:\n *\n * math.exp(2) // returns number 7.3890560989306495\n * math.pow(math.e, 2) // returns number 7.3890560989306495\n * math.log(math.exp(2)) // returns number 2\n *\n * math.map([1, 2, 3], math.exp)\n * // returns Array [\n * // 2.718281828459045,\n * // 7.3890560989306495,\n * // 20.085536923187668\n * // ]\n *\n * See also:\n *\n * expm1, expm, log, pow\n *\n * @param {number | BigNumber | Complex} x A number to exponentiate\n * @return {number | BigNumber | Complex} Exponential of `x`\n */\n return typed(name, {\n number: expNumber,\n\n Complex: function (x) {\n return x.exp()\n },\n\n BigNumber: function (x) {\n return x.exp()\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { expm1Number } from '../../plain/number/index.js'\n\nconst name = 'expm1'\nconst dependencies = ['typed', 'Complex']\n\nexport const createExpm1 = /* #__PURE__ */ factory(name, dependencies, ({ typed, Complex }) => {\n /**\n * Calculate the value of subtracting 1 from the exponential value.\n * This function is more accurate than `math.exp(x)-1` when `x` is near 0\n * To avoid ambiguity with the matrix exponential `expm`, this function\n * does not operate on matrices; if you wish to apply it elementwise, see\n * the examples.\n *\n * Syntax:\n *\n * math.expm1(x)\n *\n * Examples:\n *\n * math.expm1(2) // returns number 6.38905609893065\n * math.pow(math.e, 2) - 1 // returns number 6.3890560989306495\n * math.expm1(1e-8) // returns number 1.0000000050000001e-8\n * math.exp(1e-8) - 1 // returns number 9.9999999392253e-9\n * math.log(math.expm1(2) + 1) // returns number 2\n *\n * math.map([1, 2, 3], math.expm1)\n * // returns Array [\n * // 1.718281828459045,\n * // 6.3890560989306495,\n * // 19.085536923187668\n * // ]\n *\n * See also:\n *\n * exp, expm, log, pow\n *\n * @param {number | BigNumber | Complex} x The number to exponentiate\n * @return {number | BigNumber | Complex} Exponential of `x`, minus one\n */\n return typed(name, {\n number: expm1Number,\n\n Complex: function (x) {\n const r = Math.exp(x.re)\n return new Complex(\n r * Math.cos(x.im) - 1,\n r * Math.sin(x.im)\n )\n },\n\n BigNumber: function (x) {\n return x.exp().minus(1)\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { deepMap } from '../../utils/collection.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { createMatAlgo14xDs } from '../../type/matrix/utils/matAlgo14xDs.js'\n\nconst name = 'fix'\nconst dependencies = ['typed', 'Complex', 'matrix', 'ceil', 'floor', 'equalScalar', 'zeros', 'DenseMatrix']\n\nexport const createFixNumber = /* #__PURE__ */ factory(\n name, ['typed', 'ceil', 'floor'], ({ typed, ceil, floor }) => {\n return typed(name, {\n number: function (x) {\n return (x > 0) ? floor(x) : ceil(x)\n },\n\n 'number, number': function (x, n) {\n return (x > 0) ? floor(x, n) : ceil(x, n)\n }\n })\n }\n)\n\nexport const createFix = /* #__PURE__ */ factory(name, dependencies, ({ typed, Complex, matrix, ceil, floor, equalScalar, zeros, DenseMatrix }) => {\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matAlgo14xDs = createMatAlgo14xDs({ typed })\n\n const fixNumber = createFixNumber({ typed, ceil, floor })\n /**\n * Round a value towards zero.\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.fix(x)\n * math.fix(x,n)\n * math.fix(unit, valuelessUnit)\n * math.fix(unit, n, valuelessUnit)\n *\n * Examples:\n *\n * math.fix(3.2) // returns number 3\n * math.fix(3.8) // returns number 3\n * math.fix(-4.2) // returns number -4\n * math.fix(-4.7) // returns number -4\n *\n * math.fix(3.12, 1) // returns number 3.1\n * math.fix(3.18, 1) // returns number 3.1\n * math.fix(-4.12, 1) // returns number -4.1\n * math.fix(-4.17, 1) // returns number -4.1\n *\n * const c = math.complex(3.22, -2.78)\n * math.fix(c) // returns Complex 3 - 2i\n * math.fix(c, 1) // returns Complex 3.2 -2.7i\n *\n * const unit = math.unit('3.241 cm')\n * const cm = math.unit('cm')\n * const mm = math.unit('mm')\n * math.fix(unit, 1, cm) // returns Unit 3.2 cm\n * math.fix(unit, 1, mm) // returns Unit 32.4 mm\n *\n * math.fix([3.2, 3.8, -4.7]) // returns Array [3, 3, -4]\n * math.fix([3.2, 3.8, -4.7], 1) // returns Array [3.2, 3.8, -4.7]\n *\n * See also:\n *\n * ceil, floor, round\n *\n * @param {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} x Value to be rounded\n * @param {number | BigNumber | Array} [n=0] Number of decimals\n * @param {Unit} [valuelessUnit] A valueless unit\n * @return {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} Rounded value\n */\n return typed('fix', {\n number: fixNumber.signatures.number,\n 'number, number | BigNumber': fixNumber.signatures['number,number'],\n\n Complex: function (x) {\n return new Complex(\n (x.re > 0) ? Math.floor(x.re) : Math.ceil(x.re),\n (x.im > 0) ? Math.floor(x.im) : Math.ceil(x.im)\n )\n },\n\n 'Complex, number': function (x, n) {\n return new Complex(\n (x.re > 0) ? floor(x.re, n) : ceil(x.re, n),\n (x.im > 0) ? floor(x.im, n) : ceil(x.im, n)\n )\n },\n\n 'Complex, BigNumber': function (x, bn) {\n const n = bn.toNumber()\n return new Complex(\n (x.re > 0) ? floor(x.re, n) : ceil(x.re, n),\n (x.im > 0) ? floor(x.im, n) : ceil(x.im, n)\n )\n },\n\n BigNumber: function (x) {\n return x.isNegative() ? ceil(x) : floor(x)\n },\n\n 'BigNumber, number | BigNumber': function (x, n) {\n return x.isNegative() ? ceil(x, n) : floor(x, n)\n },\n\n bigint: b => b,\n 'bigint, number': (b, _dummy) => b,\n 'bigint, BigNumber': (b, _dummy) => b,\n\n Fraction: function (x) {\n return x.s < 0n ? x.ceil() : x.floor()\n },\n\n 'Fraction, number | BigNumber': function (x, n) {\n return x.s < 0n ? ceil(x, n) : floor(x, n)\n },\n\n 'Unit, number, Unit': typed.referToSelf(self => function (x, n, unit) {\n const valueless = x.toNumeric(unit)\n return unit.multiply(self(valueless, n))\n }),\n\n 'Unit, BigNumber, Unit': typed.referToSelf(self => (x, n, unit) => self(x, n.toNumber(), unit)),\n\n 'Array | Matrix, number | BigNumber, Unit': typed.referToSelf(self => (x, n, unit) => {\n // deep map collection, skip zeros since fix(0) = 0\n return deepMap(x, (value) => self(value, n, unit), true)\n }),\n\n 'Array | Matrix | Unit, Unit': typed.referToSelf(self => (x, unit) => self(x, 0, unit)),\n\n 'Array | Matrix': typed.referToSelf(self => (x) => {\n // deep map collection, skip zeros since fix(0) = 0\n return deepMap(x, self, true)\n }),\n\n 'Array | Matrix, number | BigNumber': typed.referToSelf(self => (x, n) => {\n // deep map collection, skip zeros since fix(0) = 0\n return deepMap(x, i => self(i, n), true)\n }),\n\n 'number | Complex | Fraction | BigNumber, Array':\n typed.referToSelf(self => (x, y) => {\n // use matrix implementation\n return matAlgo14xDs(matrix(y), x, self, true).valueOf()\n }),\n\n 'number | Complex | Fraction | BigNumber, Matrix':\n typed.referToSelf(self => (x, y) => {\n if (equalScalar(x, 0)) return zeros(y.size(), y.storage())\n if (y.storage() === 'dense') {\n return matAlgo14xDs(y, x, self, true)\n }\n return matAlgo12xSfs(y, x, self, true)\n })\n })\n})\n","import Decimal from 'decimal.js'\nimport { factory } from '../../utils/factory.js'\nimport { deepMap } from '../../utils/collection.js'\nimport { isInteger, nearlyEqual } from '../../utils/number.js'\nimport { nearlyEqual as bigNearlyEqual } from '../../utils/bignumber/nearlyEqual.js'\nimport { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { createMatAlgo14xDs } from '../../type/matrix/utils/matAlgo14xDs.js'\n\nconst name = 'floor'\nconst dependencies = ['typed', 'config', 'round', 'matrix', 'equalScalar', 'zeros', 'DenseMatrix']\n\nconst bigTen = new Decimal(10)\n\nexport const createFloorNumber = /* #__PURE__ */ factory(\n name, ['typed', 'config', 'round'], ({ typed, config, round }) => {\n function _floorNumber (x) {\n // First, if the floor and the round are identical we can be\n // quite comfortable that is the best answer:\n const f = Math.floor(x)\n const r = round(x)\n if (f === r) return f\n // OK, they are different. If x is truly distinct from f but\n // appears indistinguishable from r, presume it really is just\n // the integer r with rounding/computation error, and return that\n if (\n nearlyEqual(x, r, config.relTol, config.absTol) &&\n !nearlyEqual(x, f, config.relTol, config.absTol)\n ) {\n return r\n }\n // Otherwise (x distinct from both r and f, or indistinguishable from\n // both r and f) may as well just return f, as that's the best\n // candidate we can discern:\n return f\n }\n\n return typed(name, {\n number: _floorNumber,\n 'number, number': function (x, n) {\n if (!isInteger(n)) {\n throw new RangeError(\n 'number of decimals in function floor must be an integer')\n }\n if (n < 0 || n > 15) {\n throw new RangeError(\n 'number of decimals in floor number must be in range 0 - 15')\n }\n const shift = 10 ** n\n return _floorNumber(x * shift) / shift\n }\n })\n }\n)\n\nexport const createFloor = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, round, matrix, equalScalar, zeros, DenseMatrix }) => {\n const matAlgo11xS0s = createMatAlgo11xS0s({ typed, equalScalar })\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matAlgo14xDs = createMatAlgo14xDs({ typed })\n\n const floorNumber = createFloorNumber({ typed, config, round })\n function _bigFloor (x) {\n // see _floorNumber above for rationale\n const bne = (a, b) => bigNearlyEqual(a, b, config.relTol, config.absTol)\n const f = x.floor()\n const r = round(x)\n if (f.eq(r)) return f\n if (bne(x, r) && !bne(x, f)) return r\n return f\n }\n /**\n * Round a value towards minus infinity.\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.floor(x)\n * math.floor(x, n)\n * math.floor(unit, valuelessUnit)\n * math.floor(unit, n, valuelessUnit)\n *\n * Examples:\n *\n * math.floor(3.2) // returns number 3\n * math.floor(3.8) // returns number 3\n * math.floor(-4.2) // returns number -5\n * math.floor(-4.7) // returns number -5\n *\n * math.floor(3.212, 2) // returns number 3.21\n * math.floor(3.288, 2) // returns number 3.28\n * math.floor(-4.212, 2) // returns number -4.22\n * math.floor(-4.782, 2) // returns number -4.79\n *\n * const c = math.complex(3.24, -2.71)\n * math.floor(c) // returns Complex 3 - 3i\n * math.floor(c, 1) // returns Complex 3.2 -2.8i\n *\n * const unit = math.unit('3.241 cm')\n * const cm = math.unit('cm')\n * const mm = math.unit('mm')\n * math.floor(unit, 1, cm) // returns Unit 3.2 cm\n * math.floor(unit, 1, mm) // returns Unit 32.4 mm\n *\n * math.floor([3.2, 3.8, -4.7]) // returns Array [3, 3, -5]\n * math.floor([3.21, 3.82, -4.71], 1) // returns Array [3.2, 3.8, -4.8]\n *\n * math.floor(math.tau, [2, 3]) // returns Array [6.28, 6.283]\n *\n * // Note that floor(array, array) currently not implemented.\n *\n * See also:\n *\n * ceil, fix, round\n *\n * @param {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} x Value to be rounded\n * @param {number | BigNumber | Array} [n=0] Number of decimals\n * @param {Unit} [valuelessUnit] A valueless unit\n * @return {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} Rounded value\n */\n return typed('floor', {\n number: floorNumber.signatures.number,\n 'number,number': floorNumber.signatures['number,number'],\n\n Complex: function (x) {\n return x.floor()\n },\n\n 'Complex, number': function (x, n) {\n return x.floor(n)\n },\n\n 'Complex, BigNumber': function (x, n) {\n return x.floor(n.toNumber())\n },\n\n BigNumber: _bigFloor,\n\n 'BigNumber, BigNumber': function (x, n) {\n const shift = bigTen.pow(n)\n return _bigFloor(x.mul(shift)).div(shift)\n },\n\n bigint: b => b,\n 'bigint, number': (b, _dummy) => b,\n 'bigint, BigNumber': (b, _dummy) => b,\n\n Fraction: function (x) {\n return x.floor()\n },\n\n 'Fraction, number': function (x, n) {\n return x.floor(n)\n },\n\n 'Fraction, BigNumber': function (x, n) {\n return x.floor(n.toNumber())\n },\n\n 'Unit, number, Unit': typed.referToSelf(self => function (x, n, unit) {\n const valueless = x.toNumeric(unit)\n return unit.multiply(self(valueless, n))\n }),\n\n 'Unit, BigNumber, Unit': typed.referToSelf(self => (x, n, unit) => self(x, n.toNumber(), unit)),\n\n 'Array | Matrix, number | BigNumber, Unit': typed.referToSelf(self => (x, n, unit) => {\n // deep map collection, skip zeros since floor(0) = 0\n return deepMap(x, (value) => self(value, n, unit), true)\n }),\n\n 'Array | Matrix | Unit, Unit': typed.referToSelf(self => (x, unit) => self(x, 0, unit)),\n\n 'Array | Matrix': typed.referToSelf(self => (x) => {\n // deep map collection, skip zeros since floor(0) = 0\n return deepMap(x, self, true)\n }),\n\n 'Array, number | BigNumber': typed.referToSelf(self => (x, n) => {\n // deep map collection, skip zeros since ceil(0) = 0\n return deepMap(x, i => self(i, n), true)\n }),\n\n 'SparseMatrix, number | BigNumber': typed.referToSelf(self => (x, y) => {\n return matAlgo11xS0s(x, y, self, false)\n }),\n\n 'DenseMatrix, number | BigNumber': typed.referToSelf(self => (x, y) => {\n return matAlgo14xDs(x, y, self, false)\n }),\n\n 'number | Complex | Fraction | BigNumber, Array':\n typed.referToSelf(self => (x, y) => {\n // use matrix implementation\n return matAlgo14xDs(matrix(y), x, self, true).valueOf()\n }),\n\n 'number | Complex | Fraction | BigNumber, Matrix':\n typed.referToSelf(self => (x, y) => {\n if (equalScalar(x, 0)) return zeros(y.size(), y.storage())\n if (y.storage() === 'dense') {\n return matAlgo14xDs(y, x, self, true)\n }\n return matAlgo12xSfs(y, x, self, true)\n })\n })\n})\n","import { factory } from '../../../utils/factory.js'\nimport { DimensionError } from '../../../error/DimensionError.js'\n\nconst name = 'matAlgo02xDS0'\nconst dependencies = ['typed', 'equalScalar']\n\nexport const createMatAlgo02xDS0 = /* #__PURE__ */ factory(name, dependencies, ({ typed, equalScalar }) => {\n /**\n * Iterates over SparseMatrix nonzero items and invokes the callback function f(Dij, Sij).\n * Callback function invoked NNZ times (number of nonzero items in SparseMatrix).\n *\n *\n * ┌ f(Dij, Sij) ; S(i,j) !== 0\n * C(i,j) = ┤\n * └ 0 ; otherwise\n *\n *\n * @param {Matrix} denseMatrix The DenseMatrix instance (D)\n * @param {Matrix} sparseMatrix The SparseMatrix instance (S)\n * @param {Function} callback The f(Dij,Sij) operation to invoke, where Dij = DenseMatrix(i,j) and Sij = SparseMatrix(i,j)\n * @param {boolean} inverse A true value indicates callback should be invoked f(Sij,Dij)\n *\n * @return {Matrix} SparseMatrix (C)\n *\n * see https://github.com/josdejong/mathjs/pull/346#issuecomment-97477571\n */\n return function matAlgo02xDS0 (denseMatrix, sparseMatrix, callback, inverse) {\n // dense matrix arrays\n const adata = denseMatrix._data\n const asize = denseMatrix._size\n const adt = denseMatrix._datatype || denseMatrix.getDataType()\n // sparse matrix arrays\n const bvalues = sparseMatrix._values\n const bindex = sparseMatrix._index\n const bptr = sparseMatrix._ptr\n const bsize = sparseMatrix._size\n const bdt = sparseMatrix._datatype || sparseMatrix._data === undefined ? sparseMatrix._datatype : sparseMatrix.getDataType()\n\n // validate dimensions\n if (asize.length !== bsize.length) { throw new DimensionError(asize.length, bsize.length) }\n\n // check rows & columns\n if (asize[0] !== bsize[0] || asize[1] !== bsize[1]) { throw new RangeError('Dimension mismatch. Matrix A (' + asize + ') must match Matrix B (' + bsize + ')') }\n\n // sparse matrix cannot be a Pattern matrix\n if (!bvalues) { throw new Error('Cannot perform operation on Dense Matrix and Pattern Sparse Matrix') }\n\n // rows & columns\n const rows = asize[0]\n const columns = asize[1]\n\n // datatype\n let dt\n // equal signature to use\n let eq = equalScalar\n // zero value\n let zero = 0\n // callback signature to use\n let cf = callback\n\n // process data types\n if (typeof adt === 'string' && adt === bdt && adt !== 'mixed') {\n // datatype\n dt = adt\n // find signature that matches (dt, dt)\n eq = typed.find(equalScalar, [dt, dt])\n // convert 0 to the same datatype\n zero = typed.convert(0, dt)\n // callback\n cf = typed.find(callback, [dt, dt])\n }\n\n // result (SparseMatrix)\n const cvalues = []\n const cindex = []\n const cptr = []\n\n // loop columns in b\n for (let j = 0; j < columns; j++) {\n // update cptr\n cptr[j] = cindex.length\n // values in column j\n for (let k0 = bptr[j], k1 = bptr[j + 1], k = k0; k < k1; k++) {\n // row\n const i = bindex[k]\n // update C(i,j)\n const cij = inverse ? cf(bvalues[k], adata[i][j]) : cf(adata[i][j], bvalues[k])\n // check for nonzero\n if (!eq(cij, zero)) {\n // push i & v\n cindex.push(i)\n cvalues.push(cij)\n }\n }\n }\n // update cptr\n cptr[columns] = cindex.length\n\n // return sparse matrix\n return sparseMatrix.createSparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [rows, columns],\n datatype: adt === denseMatrix._datatype && bdt === sparseMatrix._datatype ? dt : undefined\n })\n }\n})\n","import { factory } from '../../../utils/factory.js'\nimport { DimensionError } from '../../../error/DimensionError.js'\n\nconst name = 'matAlgo03xDSf'\nconst dependencies = ['typed']\n\nexport const createMatAlgo03xDSf = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Iterates over SparseMatrix items and invokes the callback function f(Dij, Sij).\n * Callback function invoked M*N times.\n *\n *\n * ┌ f(Dij, Sij) ; S(i,j) !== 0\n * C(i,j) = ┤\n * └ f(Dij, 0) ; otherwise\n *\n *\n * @param {Matrix} denseMatrix The DenseMatrix instance (D)\n * @param {Matrix} sparseMatrix The SparseMatrix instance (C)\n * @param {Function} callback The f(Dij,Sij) operation to invoke, where Dij = DenseMatrix(i,j) and Sij = SparseMatrix(i,j)\n * @param {boolean} inverse A true value indicates callback should be invoked f(Sij,Dij)\n *\n * @return {Matrix} DenseMatrix (C)\n *\n * see https://github.com/josdejong/mathjs/pull/346#issuecomment-97477571\n */\n return function matAlgo03xDSf (denseMatrix, sparseMatrix, callback, inverse) {\n // dense matrix arrays\n const adata = denseMatrix._data\n const asize = denseMatrix._size\n const adt = denseMatrix._datatype || denseMatrix.getDataType()\n // sparse matrix arrays\n const bvalues = sparseMatrix._values\n const bindex = sparseMatrix._index\n const bptr = sparseMatrix._ptr\n const bsize = sparseMatrix._size\n const bdt = sparseMatrix._datatype || sparseMatrix._data === undefined ? sparseMatrix._datatype : sparseMatrix.getDataType()\n\n // validate dimensions\n if (asize.length !== bsize.length) { throw new DimensionError(asize.length, bsize.length) }\n\n // check rows & columns\n if (asize[0] !== bsize[0] || asize[1] !== bsize[1]) { throw new RangeError('Dimension mismatch. Matrix A (' + asize + ') must match Matrix B (' + bsize + ')') }\n\n // sparse matrix cannot be a Pattern matrix\n if (!bvalues) { throw new Error('Cannot perform operation on Dense Matrix and Pattern Sparse Matrix') }\n\n // rows & columns\n const rows = asize[0]\n const columns = asize[1]\n\n // datatype\n let dt\n // zero value\n let zero = 0\n // callback signature to use\n let cf = callback\n\n // process data types\n if (typeof adt === 'string' && adt === bdt && adt !== 'mixed') {\n // datatype\n dt = adt\n // convert 0 to the same datatype\n zero = typed.convert(0, dt)\n // callback\n cf = typed.find(callback, [dt, dt])\n }\n\n // result (DenseMatrix)\n const cdata = []\n\n // initialize dense matrix\n for (let z = 0; z < rows; z++) {\n // initialize row\n cdata[z] = []\n }\n\n // workspace\n const x = []\n // marks indicating we have a value in x for a given column\n const w = []\n\n // loop columns in b\n for (let j = 0; j < columns; j++) {\n // column mark\n const mark = j + 1\n // values in column j\n for (let k0 = bptr[j], k1 = bptr[j + 1], k = k0; k < k1; k++) {\n // row\n const i = bindex[k]\n // update workspace\n x[i] = inverse ? cf(bvalues[k], adata[i][j]) : cf(adata[i][j], bvalues[k])\n w[i] = mark\n }\n // process workspace\n for (let y = 0; y < rows; y++) {\n // check we have a calculated value for current row\n if (w[y] === mark) {\n // use calculated value\n cdata[y][j] = x[y]\n } else {\n // calculate value\n cdata[y][j] = inverse ? cf(zero, adata[y][j]) : cf(adata[y][j], zero)\n }\n }\n }\n\n // return dense matrix\n return denseMatrix.createDenseMatrix({\n data: cdata,\n size: [rows, columns],\n datatype: adt === denseMatrix._datatype && bdt === sparseMatrix._datatype ? dt : undefined\n })\n }\n})\n","import { factory } from '../../../utils/factory.js'\nimport { DimensionError } from '../../../error/DimensionError.js'\n\nconst name = 'matAlgo05xSfSf'\nconst dependencies = ['typed', 'equalScalar']\n\nexport const createMatAlgo05xSfSf = /* #__PURE__ */ factory(name, dependencies, ({ typed, equalScalar }) => {\n /**\n * Iterates over SparseMatrix A and SparseMatrix B nonzero items and invokes the callback function f(Aij, Bij).\n * Callback function invoked MAX(NNZA, NNZB) times\n *\n *\n * ┌ f(Aij, Bij) ; A(i,j) !== 0 || B(i,j) !== 0\n * C(i,j) = ┤\n * └ 0 ; otherwise\n *\n *\n * @param {Matrix} a The SparseMatrix instance (A)\n * @param {Matrix} b The SparseMatrix instance (B)\n * @param {Function} callback The f(Aij,Bij) operation to invoke\n *\n * @return {Matrix} SparseMatrix (C)\n *\n * see https://github.com/josdejong/mathjs/pull/346#issuecomment-97620294\n */\n return function matAlgo05xSfSf (a, b, callback) {\n // sparse matrix arrays\n const avalues = a._values\n const aindex = a._index\n const aptr = a._ptr\n const asize = a._size\n const adt = a._datatype || a._data === undefined ? a._datatype : a.getDataType()\n // sparse matrix arrays\n const bvalues = b._values\n const bindex = b._index\n const bptr = b._ptr\n const bsize = b._size\n const bdt = b._datatype || b._data === undefined ? b._datatype : b.getDataType()\n\n // validate dimensions\n if (asize.length !== bsize.length) { throw new DimensionError(asize.length, bsize.length) }\n\n // check rows & columns\n if (asize[0] !== bsize[0] || asize[1] !== bsize[1]) { throw new RangeError('Dimension mismatch. Matrix A (' + asize + ') must match Matrix B (' + bsize + ')') }\n\n // rows & columns\n const rows = asize[0]\n const columns = asize[1]\n\n // datatype\n let dt\n // equal signature to use\n let eq = equalScalar\n // zero value\n let zero = 0\n // callback signature to use\n let cf = callback\n\n // process data types\n if (typeof adt === 'string' && adt === bdt && adt !== 'mixed') {\n // datatype\n dt = adt\n // find signature that matches (dt, dt)\n eq = typed.find(equalScalar, [dt, dt])\n // convert 0 to the same datatype\n zero = typed.convert(0, dt)\n // callback\n cf = typed.find(callback, [dt, dt])\n }\n\n // result arrays\n const cvalues = avalues && bvalues ? [] : undefined\n const cindex = []\n const cptr = []\n\n // workspaces\n const xa = cvalues ? [] : undefined\n const xb = cvalues ? [] : undefined\n // marks indicating we have a value in x for a given column\n const wa = []\n const wb = []\n\n // vars\n let i, j, k, k1\n\n // loop columns\n for (j = 0; j < columns; j++) {\n // update cptr\n cptr[j] = cindex.length\n // columns mark\n const mark = j + 1\n // loop values A(:,j)\n for (k = aptr[j], k1 = aptr[j + 1]; k < k1; k++) {\n // row\n i = aindex[k]\n // push index\n cindex.push(i)\n // update workspace\n wa[i] = mark\n // check we need to process values\n if (xa) { xa[i] = avalues[k] }\n }\n // loop values B(:,j)\n for (k = bptr[j], k1 = bptr[j + 1]; k < k1; k++) {\n // row\n i = bindex[k]\n // check row existed in A\n if (wa[i] !== mark) {\n // push index\n cindex.push(i)\n }\n // update workspace\n wb[i] = mark\n // check we need to process values\n if (xb) { xb[i] = bvalues[k] }\n }\n // check we need to process values (non pattern matrix)\n if (cvalues) {\n // initialize first index in j\n k = cptr[j]\n // loop index in j\n while (k < cindex.length) {\n // row\n i = cindex[k]\n // marks\n const wai = wa[i]\n const wbi = wb[i]\n // check Aij or Bij are nonzero\n if (wai === mark || wbi === mark) {\n // matrix values @ i,j\n const va = wai === mark ? xa[i] : zero\n const vb = wbi === mark ? xb[i] : zero\n // Cij\n const vc = cf(va, vb)\n // check for zero\n if (!eq(vc, zero)) {\n // push value\n cvalues.push(vc)\n // increment pointer\n k++\n } else {\n // remove value @ i, do not increment pointer\n cindex.splice(k, 1)\n }\n }\n }\n }\n }\n // update cptr\n cptr[columns] = cindex.length\n\n // return sparse matrix\n return a.createSparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [rows, columns],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n })\n }\n})\n","import { factory } from '../../../utils/factory.js'\nimport { DimensionError } from '../../../error/DimensionError.js'\n\nconst name = 'matAlgo13xDD'\nconst dependencies = ['typed']\n\nexport const createMatAlgo13xDD = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Iterates over DenseMatrix items and invokes the callback function f(Aij..z, Bij..z).\n * Callback function invoked MxN times.\n *\n * C(i,j,...z) = f(Aij..z, Bij..z)\n *\n * @param {Matrix} a The DenseMatrix instance (A)\n * @param {Matrix} b The DenseMatrix instance (B)\n * @param {Function} callback The f(Aij..z,Bij..z) operation to invoke\n *\n * @return {Matrix} DenseMatrix (C)\n *\n * https://github.com/josdejong/mathjs/pull/346#issuecomment-97658658\n */\n return function matAlgo13xDD (a, b, callback) {\n // a arrays\n const adata = a._data\n const asize = a._size\n const adt = a._datatype\n // b arrays\n const bdata = b._data\n const bsize = b._size\n const bdt = b._datatype\n // c arrays\n const csize = []\n\n // validate dimensions\n if (asize.length !== bsize.length) { throw new DimensionError(asize.length, bsize.length) }\n\n // validate each one of the dimension sizes\n for (let s = 0; s < asize.length; s++) {\n // must match\n if (asize[s] !== bsize[s]) { throw new RangeError('Dimension mismatch. Matrix A (' + asize + ') must match Matrix B (' + bsize + ')') }\n // update dimension in c\n csize[s] = asize[s]\n }\n\n // datatype\n let dt\n // callback signature to use\n let cf = callback\n\n // process data types\n if (typeof adt === 'string' && adt === bdt) {\n // datatype\n dt = adt\n // callback\n cf = typed.find(callback, [dt, dt])\n }\n\n // populate cdata, iterate through dimensions\n const cdata = csize.length > 0 ? _iterate(cf, 0, csize, csize[0], adata, bdata) : []\n\n // c matrix\n return a.createDenseMatrix({\n data: cdata,\n size: csize,\n datatype: dt\n })\n }\n\n // recursive function\n function _iterate (f, level, s, n, av, bv) {\n // initialize array for this level\n const cv = []\n // check we reach the last level\n if (level === s.length - 1) {\n // loop arrays in last level\n for (let i = 0; i < n; i++) {\n // invoke callback and store value\n cv[i] = f(av[i], bv[i])\n }\n } else {\n // iterate current level\n for (let j = 0; j < n; j++) {\n // iterate next level\n cv[j] = _iterate(f, level + 1, s, s[level + 1], av[j], bv[j])\n }\n }\n return cv\n }\n})\n","import { broadcastSizes, broadcastTo } from '../../../utils/array.js'\nimport { deepStrictEqual } from '../../../utils/object.js'\n\n/**\n* Broadcasts two matrices, and return both in an array\n* It checks if it's possible with broadcasting rules\n*\n* @param {Matrix} A First Matrix\n* @param {Matrix} B Second Matrix\n*\n* @return {Matrix[]} [ broadcastedA, broadcastedB ]\n*/\n\nexport function broadcast (A, B) {\n if (deepStrictEqual(A.size(), B.size())) {\n // If matrices have the same size return them\n return [A, B]\n }\n\n // calculate the broadcasted sizes\n const newSize = broadcastSizes(A.size(), B.size())\n\n // return the array with the two broadcasted matrices\n return [A, B].map(M => _broadcastTo(M, newSize))\n}\n\n/**\n * Broadcasts a matrix to the given size.\n *\n * @param {Matrix} M - The matrix to be broadcasted.\n * @param {number[]} size - The desired size of the broadcasted matrix.\n * @returns {Matrix} The broadcasted matrix.\n * @throws {Error} If the size parameter is not an array of numbers.\n */\nfunction _broadcastTo (M, size) {\n if (deepStrictEqual(M.size(), size)) {\n return M\n }\n return M.create(broadcastTo(M.valueOf(), size), M.datatype())\n}\n","import { factory } from '../../../utils/factory.js'\nimport { extend } from '../../../utils/object.js'\nimport { createMatAlgo13xDD } from './matAlgo13xDD.js'\nimport { createMatAlgo14xDs } from './matAlgo14xDs.js'\nimport { broadcast } from './broadcast.js'\n\nconst name = 'matrixAlgorithmSuite'\nconst dependencies = ['typed', 'matrix']\n\nexport const createMatrixAlgorithmSuite = /* #__PURE__ */ factory(\n name, dependencies, ({ typed, matrix }) => {\n const matAlgo13xDD = createMatAlgo13xDD({ typed })\n const matAlgo14xDs = createMatAlgo14xDs({ typed })\n\n /**\n * Return a signatures object with the usual boilerplate of\n * matrix algorithms, based on a plain options object with the\n * following properties:\n * elop: function -- the elementwise operation to use, defaults to self\n * SS: function -- the algorithm to apply for two sparse matrices\n * DS: function -- the algorithm to apply for a dense and a sparse matrix\n * SD: function -- algo for a sparse and a dense; defaults to SD flipped\n * Ss: function -- the algorithm to apply for a sparse matrix and scalar\n * sS: function -- algo for scalar and sparse; defaults to Ss flipped\n * scalar: string -- typed-function type for scalars, defaults to 'any'\n *\n * If Ss is not specified, no matrix-scalar signatures are generated.\n *\n * @param {object} options\n * @return {Object} signatures\n */\n return function matrixAlgorithmSuite (options) {\n const elop = options.elop\n const SD = options.SD || options.DS\n let matrixSignatures\n if (elop) {\n // First the dense ones\n matrixSignatures = {\n 'DenseMatrix, DenseMatrix': (x, y) => matAlgo13xDD(...broadcast(x, y), elop),\n 'Array, Array': (x, y) =>\n matAlgo13xDD(...broadcast(matrix(x), matrix(y)), elop).valueOf(),\n 'Array, DenseMatrix': (x, y) => matAlgo13xDD(...broadcast(matrix(x), y), elop),\n 'DenseMatrix, Array': (x, y) => matAlgo13xDD(...broadcast(x, matrix(y)), elop)\n }\n // Now incorporate sparse matrices\n if (options.SS) {\n matrixSignatures['SparseMatrix, SparseMatrix'] =\n (x, y) => options.SS(...broadcast(x, y), elop, false)\n }\n if (options.DS) {\n matrixSignatures['DenseMatrix, SparseMatrix'] =\n (x, y) => options.DS(...broadcast(x, y), elop, false)\n matrixSignatures['Array, SparseMatrix'] =\n (x, y) => options.DS(...broadcast(matrix(x), y), elop, false)\n }\n if (SD) {\n matrixSignatures['SparseMatrix, DenseMatrix'] =\n (x, y) => SD(...broadcast(y, x), elop, true)\n matrixSignatures['SparseMatrix, Array'] =\n (x, y) => SD(...broadcast(matrix(y), x), elop, true)\n }\n } else {\n // No elop, use this\n // First the dense ones\n matrixSignatures = {\n 'DenseMatrix, DenseMatrix': typed.referToSelf(self => (x, y) => {\n return matAlgo13xDD(...broadcast(x, y), self)\n }),\n 'Array, Array': typed.referToSelf(self => (x, y) => {\n return matAlgo13xDD(...broadcast(matrix(x), matrix(y)), self).valueOf()\n }),\n 'Array, DenseMatrix': typed.referToSelf(self => (x, y) => {\n return matAlgo13xDD(...broadcast(matrix(x), y), self)\n }),\n 'DenseMatrix, Array': typed.referToSelf(self => (x, y) => {\n return matAlgo13xDD(...broadcast(x, matrix(y)), self)\n })\n }\n // Now incorporate sparse matrices\n if (options.SS) {\n matrixSignatures['SparseMatrix, SparseMatrix'] =\n typed.referToSelf(self => (x, y) => {\n return options.SS(...broadcast(x, y), self, false)\n })\n }\n if (options.DS) {\n matrixSignatures['DenseMatrix, SparseMatrix'] =\n typed.referToSelf(self => (x, y) => {\n return options.DS(...broadcast(x, y), self, false)\n })\n matrixSignatures['Array, SparseMatrix'] =\n typed.referToSelf(self => (x, y) => {\n return options.DS(...broadcast(matrix(x), y), self, false)\n })\n }\n if (SD) {\n matrixSignatures['SparseMatrix, DenseMatrix'] =\n typed.referToSelf(self => (x, y) => {\n return SD(...broadcast(y, x), self, true)\n })\n matrixSignatures['SparseMatrix, Array'] =\n typed.referToSelf(self => (x, y) => {\n return SD(...broadcast(matrix(y), x), self, true)\n })\n }\n }\n\n // Now add the scalars\n const scalar = options.scalar || 'any'\n const Ds = options.Ds || options.Ss\n if (Ds) {\n if (elop) {\n matrixSignatures['DenseMatrix,' + scalar] =\n (x, y) => matAlgo14xDs(x, y, elop, false)\n matrixSignatures[scalar + ', DenseMatrix'] =\n (x, y) => matAlgo14xDs(y, x, elop, true)\n matrixSignatures['Array,' + scalar] =\n (x, y) => matAlgo14xDs(matrix(x), y, elop, false).valueOf()\n matrixSignatures[scalar + ', Array'] =\n (x, y) => matAlgo14xDs(matrix(y), x, elop, true).valueOf()\n } else {\n matrixSignatures['DenseMatrix,' + scalar] =\n typed.referToSelf(self => (x, y) => {\n return matAlgo14xDs(x, y, self, false)\n })\n matrixSignatures[scalar + ', DenseMatrix'] =\n typed.referToSelf(self => (x, y) => {\n return matAlgo14xDs(y, x, self, true)\n })\n matrixSignatures['Array,' + scalar] =\n typed.referToSelf(self => (x, y) => {\n return matAlgo14xDs(matrix(x), y, self, false).valueOf()\n })\n matrixSignatures[scalar + ', Array'] =\n typed.referToSelf(self => (x, y) => {\n return matAlgo14xDs(matrix(y), x, self, true).valueOf()\n })\n }\n }\n const sS = (options.sS !== undefined) ? options.sS : options.Ss\n if (elop) {\n if (options.Ss) {\n matrixSignatures['SparseMatrix,' + scalar] =\n (x, y) => options.Ss(x, y, elop, false)\n }\n if (sS) {\n matrixSignatures[scalar + ', SparseMatrix'] =\n (x, y) => sS(y, x, elop, true)\n }\n } else {\n if (options.Ss) {\n matrixSignatures['SparseMatrix,' + scalar] =\n typed.referToSelf(self => (x, y) => {\n return options.Ss(x, y, self, false)\n })\n }\n if (sS) {\n matrixSignatures[scalar + ', SparseMatrix'] =\n typed.referToSelf(self => (x, y) => {\n return sS(y, x, self, true)\n })\n }\n }\n // Also pull in the scalar signatures if the operator is a typed function\n if (elop && elop.signatures) {\n extend(matrixSignatures, elop.signatures)\n }\n return matrixSignatures\n }\n })\n","import { factory } from '../../utils/factory.js'\nimport { createFloor } from './floor.js'\nimport { createMatAlgo02xDS0 } from '../../type/matrix/utils/matAlgo02xDS0.js'\nimport { createMatAlgo03xDSf } from '../../type/matrix/utils/matAlgo03xDSf.js'\nimport { createMatAlgo05xSfSf } from '../../type/matrix/utils/matAlgo05xSfSf.js'\nimport { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\n\nconst name = 'mod'\nconst dependencies = [\n 'typed',\n 'config',\n 'round',\n 'matrix',\n 'equalScalar',\n 'zeros',\n 'DenseMatrix',\n 'concat'\n]\n\nexport const createMod = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, round, matrix, equalScalar, zeros, DenseMatrix, concat }) => {\n const floor = createFloor({ typed, config, round, matrix, equalScalar, zeros, DenseMatrix })\n const matAlgo02xDS0 = createMatAlgo02xDS0({ typed, equalScalar })\n const matAlgo03xDSf = createMatAlgo03xDSf({ typed })\n const matAlgo05xSfSf = createMatAlgo05xSfSf({ typed, equalScalar })\n const matAlgo11xS0s = createMatAlgo11xS0s({ typed, equalScalar })\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n /**\n * Calculates the modulus, the remainder of an integer division.\n *\n * For matrices, the function is evaluated element wise.\n *\n * The modulus is defined as:\n *\n * x - y * floor(x / y)\n *\n * See https://en.wikipedia.org/wiki/Modulo_operation.\n *\n * Syntax:\n *\n * math.mod(x, y)\n *\n * Examples:\n *\n * math.mod(8, 3) // returns 2\n * math.mod(11, 2) // returns 1\n *\n * function isOdd(x) {\n * return math.mod(x, 2) != 0\n * }\n *\n * isOdd(2) // returns false\n * isOdd(3) // returns true\n *\n * See also:\n *\n * divide\n *\n * @param {number | BigNumber | bigint | Fraction | Array | Matrix} x Dividend\n * @param {number | BigNumber | bigint | Fraction | Array | Matrix} y Divisor\n * @return {number | BigNumber | bigint | Fraction | Array | Matrix} Returns the remainder of `x` divided by `y`.\n */\n return typed(\n name,\n {\n 'number, number': _modNumber,\n\n 'BigNumber, BigNumber': function (x, y) {\n return y.isZero() ? x : x.sub(y.mul(floor(x.div(y))))\n },\n\n 'bigint, bigint': function (x, y) {\n if (y === 0n) {\n return x\n }\n\n if (x < 0) {\n const m = x % y\n return m === 0n ? m : m + y\n }\n\n return x % y\n },\n\n 'Fraction, Fraction': function (x, y) {\n return y.equals(0) ? x : x.sub(y.mul(floor(x.div(y))))\n }\n },\n matrixAlgorithmSuite({\n SS: matAlgo05xSfSf,\n DS: matAlgo03xDSf,\n SD: matAlgo02xDS0,\n Ss: matAlgo11xS0s,\n sS: matAlgo12xSfs\n })\n )\n\n /**\n * Calculate the modulus of two numbers\n * @param {number} x\n * @param {number} y\n * @returns {number} res\n * @private\n */\n function _modNumber (x, y) {\n // We don't use JavaScript's % operator here as this doesn't work\n // correctly for x < 0 and x === 0\n // see https://en.wikipedia.org/wiki/Modulo_operation\n\n // We use mathjs floor to handle errors associated with\n // precision float approximation\n return (y === 0) ? x : x - y * floor(x / y)\n }\n})\n","import { factory } from '../../../utils/factory.js'\nimport { DimensionError } from '../../../error/DimensionError.js'\n\nconst name = 'matAlgo01xDSid'\nconst dependencies = ['typed']\n\nexport const createMatAlgo01xDSid = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Iterates over SparseMatrix nonzero items and invokes the callback function f(Dij, Sij).\n * Callback function invoked NNZ times (number of nonzero items in SparseMatrix).\n *\n *\n * ┌ f(Dij, Sij) ; S(i,j) !== 0\n * C(i,j) = ┤\n * └ Dij ; otherwise\n *\n *\n * @param {Matrix} denseMatrix The DenseMatrix instance (D)\n * @param {Matrix} sparseMatrix The SparseMatrix instance (S)\n * @param {Function} callback The f(Dij,Sij) operation to invoke, where Dij = DenseMatrix(i,j) and Sij = SparseMatrix(i,j)\n * @param {boolean} inverse A true value indicates callback should be invoked f(Sij,Dij)\n *\n * @return {Matrix} DenseMatrix (C)\n *\n * see https://github.com/josdejong/mathjs/pull/346#issuecomment-97477571\n */\n return function algorithm1 (denseMatrix, sparseMatrix, callback, inverse) {\n // dense matrix arrays\n const adata = denseMatrix._data\n const asize = denseMatrix._size\n const adt = denseMatrix._datatype || denseMatrix.getDataType()\n // sparse matrix arrays\n const bvalues = sparseMatrix._values\n const bindex = sparseMatrix._index\n const bptr = sparseMatrix._ptr\n const bsize = sparseMatrix._size\n const bdt = sparseMatrix._datatype || sparseMatrix._data === undefined ? sparseMatrix._datatype : sparseMatrix.getDataType()\n\n // validate dimensions\n if (asize.length !== bsize.length) { throw new DimensionError(asize.length, bsize.length) }\n\n // check rows & columns\n if (asize[0] !== bsize[0] || asize[1] !== bsize[1]) { throw new RangeError('Dimension mismatch. Matrix A (' + asize + ') must match Matrix B (' + bsize + ')') }\n\n // sparse matrix cannot be a Pattern matrix\n if (!bvalues) { throw new Error('Cannot perform operation on Dense Matrix and Pattern Sparse Matrix') }\n\n // rows & columns\n const rows = asize[0]\n const columns = asize[1]\n\n // process data types\n const dt = typeof adt === 'string' && adt !== 'mixed' && adt === bdt ? adt : undefined\n // callback function\n const cf = dt ? typed.find(callback, [dt, dt]) : callback\n\n // vars\n let i, j\n\n // result (DenseMatrix)\n const cdata = []\n // initialize c\n for (i = 0; i < rows; i++) { cdata[i] = [] }\n\n // workspace\n const x = []\n // marks indicating we have a value in x for a given column\n const w = []\n\n // loop columns in b\n for (j = 0; j < columns; j++) {\n // column mark\n const mark = j + 1\n // values in column j\n for (let k0 = bptr[j], k1 = bptr[j + 1], k = k0; k < k1; k++) {\n // row\n i = bindex[k]\n // update workspace\n x[i] = inverse ? cf(bvalues[k], adata[i][j]) : cf(adata[i][j], bvalues[k])\n // mark i as updated\n w[i] = mark\n }\n // loop rows\n for (i = 0; i < rows; i++) {\n // check row is in workspace\n if (w[i] === mark) {\n // c[i][j] was already calculated\n cdata[i][j] = x[i]\n } else {\n // item does not exist in S\n cdata[i][j] = adata[i][j]\n }\n }\n }\n\n // return dense matrix\n return denseMatrix.createDenseMatrix({\n data: cdata,\n size: [rows, columns],\n datatype: adt === denseMatrix._datatype && bdt === sparseMatrix._datatype ? dt : undefined\n })\n }\n})\n","import { factory } from '../../../utils/factory.js'\nimport { DimensionError } from '../../../error/DimensionError.js'\n\nconst name = 'matAlgo04xSidSid'\nconst dependencies = ['typed', 'equalScalar']\n\nexport const createMatAlgo04xSidSid = /* #__PURE__ */ factory(name, dependencies, ({ typed, equalScalar }) => {\n /**\n * Iterates over SparseMatrix A and SparseMatrix B nonzero items and invokes the callback function f(Aij, Bij).\n * Callback function invoked MAX(NNZA, NNZB) times\n *\n *\n * ┌ f(Aij, Bij) ; A(i,j) !== 0 && B(i,j) !== 0\n * C(i,j) = ┤ A(i,j) ; A(i,j) !== 0 && B(i,j) === 0\n * └ B(i,j) ; A(i,j) === 0\n *\n *\n * @param {Matrix} a The SparseMatrix instance (A)\n * @param {Matrix} b The SparseMatrix instance (B)\n * @param {Function} callback The f(Aij,Bij) operation to invoke\n *\n * @return {Matrix} SparseMatrix (C)\n *\n * see https://github.com/josdejong/mathjs/pull/346#issuecomment-97620294\n */\n return function matAlgo04xSidSid (a, b, callback) {\n // sparse matrix arrays\n const avalues = a._values\n const aindex = a._index\n const aptr = a._ptr\n const asize = a._size\n const adt = a._datatype || a._data === undefined ? a._datatype : a.getDataType()\n // sparse matrix arrays\n const bvalues = b._values\n const bindex = b._index\n const bptr = b._ptr\n const bsize = b._size\n const bdt = b._datatype || b._data === undefined ? b._datatype : b.getDataType()\n\n // validate dimensions\n if (asize.length !== bsize.length) { throw new DimensionError(asize.length, bsize.length) }\n\n // check rows & columns\n if (asize[0] !== bsize[0] || asize[1] !== bsize[1]) { throw new RangeError('Dimension mismatch. Matrix A (' + asize + ') must match Matrix B (' + bsize + ')') }\n\n // rows & columns\n const rows = asize[0]\n const columns = asize[1]\n\n // datatype\n let dt\n // equal signature to use\n let eq = equalScalar\n // zero value\n let zero = 0\n // callback signature to use\n let cf = callback\n\n // process data types\n if (typeof adt === 'string' && adt === bdt && adt !== 'mixed') {\n // datatype\n dt = adt\n // find signature that matches (dt, dt)\n eq = typed.find(equalScalar, [dt, dt])\n // convert 0 to the same datatype\n zero = typed.convert(0, dt)\n // callback\n cf = typed.find(callback, [dt, dt])\n }\n\n // result arrays\n const cvalues = avalues && bvalues ? [] : undefined\n const cindex = []\n const cptr = []\n\n // workspace\n const xa = avalues && bvalues ? [] : undefined\n const xb = avalues && bvalues ? [] : undefined\n // marks indicating we have a value in x for a given column\n const wa = []\n const wb = []\n\n // vars\n let i, j, k, k0, k1\n\n // loop columns\n for (j = 0; j < columns; j++) {\n // update cptr\n cptr[j] = cindex.length\n // columns mark\n const mark = j + 1\n // loop A(:,j)\n for (k0 = aptr[j], k1 = aptr[j + 1], k = k0; k < k1; k++) {\n // row\n i = aindex[k]\n // update c\n cindex.push(i)\n // update workspace\n wa[i] = mark\n // check we need to process values\n if (xa) { xa[i] = avalues[k] }\n }\n // loop B(:,j)\n for (k0 = bptr[j], k1 = bptr[j + 1], k = k0; k < k1; k++) {\n // row\n i = bindex[k]\n // check row exists in A\n if (wa[i] === mark) {\n // update record in xa @ i\n if (xa) {\n // invoke callback\n const v = cf(xa[i], bvalues[k])\n // check for zero\n if (!eq(v, zero)) {\n // update workspace\n xa[i] = v\n } else {\n // remove mark (index will be removed later)\n wa[i] = null\n }\n }\n } else {\n // update c\n cindex.push(i)\n // update workspace\n wb[i] = mark\n // check we need to process values\n if (xb) { xb[i] = bvalues[k] }\n }\n }\n // check we need to process values (non pattern matrix)\n if (xa && xb) {\n // initialize first index in j\n k = cptr[j]\n // loop index in j\n while (k < cindex.length) {\n // row\n i = cindex[k]\n // check workspace has value @ i\n if (wa[i] === mark) {\n // push value (Aij != 0 || (Aij != 0 && Bij != 0))\n cvalues[k] = xa[i]\n // increment pointer\n k++\n } else if (wb[i] === mark) {\n // push value (bij != 0)\n cvalues[k] = xb[i]\n // increment pointer\n k++\n } else {\n // remove index @ k\n cindex.splice(k, 1)\n }\n }\n }\n }\n // update cptr\n cptr[columns] = cindex.length\n\n // return sparse matrix\n return a.createSparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [rows, columns],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n })\n }\n})\n","import { factory } from '../../../utils/factory.js'\n\nconst name = 'matAlgo10xSids'\nconst dependencies = ['typed', 'DenseMatrix']\n\nexport const createMatAlgo10xSids = /* #__PURE__ */ factory(name, dependencies, ({ typed, DenseMatrix }) => {\n /**\n * Iterates over SparseMatrix S nonzero items and invokes the callback function f(Sij, b).\n * Callback function invoked NZ times (number of nonzero items in S).\n *\n *\n * ┌ f(Sij, b) ; S(i,j) !== 0\n * C(i,j) = ┤\n * └ b ; otherwise\n *\n *\n * @param {Matrix} s The SparseMatrix instance (S)\n * @param {Scalar} b The Scalar value\n * @param {Function} callback The f(Aij,b) operation to invoke\n * @param {boolean} inverse A true value indicates callback should be invoked f(b,Sij)\n *\n * @return {Matrix} DenseMatrix (C)\n *\n * https://github.com/josdejong/mathjs/pull/346#issuecomment-97626813\n */\n return function matAlgo10xSids (s, b, callback, inverse) {\n // sparse matrix arrays\n const avalues = s._values\n const aindex = s._index\n const aptr = s._ptr\n const asize = s._size\n const adt = s._datatype\n\n // sparse matrix cannot be a Pattern matrix\n if (!avalues) { throw new Error('Cannot perform operation on Pattern Sparse Matrix and Scalar value') }\n\n // rows & columns\n const rows = asize[0]\n const columns = asize[1]\n\n // datatype\n let dt\n // callback signature to use\n let cf = callback\n\n // process data types\n if (typeof adt === 'string') {\n // datatype\n dt = adt\n // convert b to the same datatype\n b = typed.convert(b, dt)\n // callback\n cf = typed.find(callback, [dt, dt])\n }\n\n // result arrays\n const cdata = []\n\n // workspaces\n const x = []\n // marks indicating we have a value in x for a given column\n const w = []\n\n // loop columns\n for (let j = 0; j < columns; j++) {\n // columns mark\n const mark = j + 1\n // values in j\n for (let k0 = aptr[j], k1 = aptr[j + 1], k = k0; k < k1; k++) {\n // row\n const r = aindex[k]\n // update workspace\n x[r] = avalues[k]\n w[r] = mark\n }\n // loop rows\n for (let i = 0; i < rows; i++) {\n // initialize C on first column\n if (j === 0) {\n // create row array\n cdata[i] = []\n }\n // check sparse matrix has a value @ i,j\n if (w[i] === mark) {\n // invoke callback, update C\n cdata[i][j] = inverse ? cf(b, x[i]) : cf(x[i], b)\n } else {\n // dense matrix value @ i, j\n cdata[i][j] = b\n }\n }\n }\n\n // return dense matrix\n return new DenseMatrix({\n data: cdata,\n size: [rows, columns],\n datatype: dt\n })\n }\n})\n","/**\n * Create a syntax error with the message:\n * 'Wrong number of arguments in function ( provided, - expected)'\n * @param {string} fn Function name\n * @param {number} count Actual argument count\n * @param {number} min Minimum required argument count\n * @param {number} [max] Maximum required argument count\n * @extends Error\n */\nexport function ArgumentsError (fn, count, min, max) {\n if (!(this instanceof ArgumentsError)) {\n throw new SyntaxError('Constructor must be called with the new operator')\n }\n\n this.fn = fn\n this.count = count\n this.min = min\n this.max = max\n\n this.message = 'Wrong number of arguments in function ' + fn +\n ' (' + count + ' provided, ' +\n min + ((max !== undefined && max !== null) ? ('-' + max) : '') + ' expected)'\n\n this.stack = (new Error()).stack\n}\n\nArgumentsError.prototype = new Error()\nArgumentsError.prototype.constructor = Error\nArgumentsError.prototype.name = 'ArgumentsError'\nArgumentsError.prototype.isArgumentsError = true\n","import { isInteger } from '../../utils/number.js'\nimport { factory } from '../../utils/factory.js'\nimport { createMod } from './mod.js'\nimport { createMatAlgo01xDSid } from '../../type/matrix/utils/matAlgo01xDSid.js'\nimport { createMatAlgo04xSidSid } from '../../type/matrix/utils/matAlgo04xSidSid.js'\nimport { createMatAlgo10xSids } from '../../type/matrix/utils/matAlgo10xSids.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\nimport { ArgumentsError } from '../../error/ArgumentsError.js'\n\nconst name = 'gcd'\nconst dependencies = [\n 'typed',\n 'config',\n 'round',\n 'matrix',\n 'equalScalar',\n 'zeros',\n 'BigNumber',\n 'DenseMatrix',\n 'concat'\n]\n\nconst gcdTypes = 'number | BigNumber | Fraction | Matrix | Array'\nconst gcdManyTypesSignature = `${gcdTypes}, ${gcdTypes}, ...${gcdTypes}`\n\nfunction is1d (array) {\n return !array.some(element => Array.isArray(element))\n}\n\nexport const createGcd = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, config, round, equalScalar, zeros, BigNumber, DenseMatrix, concat }) => {\n const mod = createMod({ typed, config, round, matrix, equalScalar, zeros, DenseMatrix, concat })\n const matAlgo01xDSid = createMatAlgo01xDSid({ typed })\n const matAlgo04xSidSid = createMatAlgo04xSidSid({ typed, equalScalar })\n const matAlgo10xSids = createMatAlgo10xSids({ typed, DenseMatrix })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n /**\n * Calculate the greatest common divisor for two or more values or arrays.\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.gcd(a, b)\n * math.gcd(a, b, c, ...)\n *\n * Examples:\n *\n * math.gcd(8, 12) // returns 4\n * math.gcd(-4, 6) // returns 2\n * math.gcd(25, 15, -10) // returns 5\n *\n * math.gcd([8, -4], [12, 6]) // returns [4, 2]\n *\n * See also:\n *\n * lcm, xgcd\n *\n * @param {... number | BigNumber | Fraction | Array | Matrix} args Two or more integer numbers\n * @return {number | BigNumber | Fraction | Array | Matrix} The greatest common divisor\n */\n return typed(\n name,\n {\n 'number, number': _gcdNumber,\n 'BigNumber, BigNumber': _gcdBigNumber,\n 'Fraction, Fraction': (x, y) => x.gcd(y)\n },\n matrixAlgorithmSuite({\n SS: matAlgo04xSidSid,\n DS: matAlgo01xDSid,\n Ss: matAlgo10xSids\n }),\n {\n [gcdManyTypesSignature]: typed.referToSelf(self => (a, b, args) => {\n let res = self(a, b)\n for (let i = 0; i < args.length; i++) {\n res = self(res, args[i])\n }\n return res\n }),\n Array: typed.referToSelf(self => (array) => {\n if (array.length === 1 && Array.isArray(array[0]) && is1d(array[0])) {\n return self(...array[0])\n }\n if (is1d(array)) {\n return self(...array)\n }\n throw new ArgumentsError('gcd() supports only 1d matrices!')\n }),\n Matrix: typed.referToSelf(self => (matrix) => {\n return self(matrix.toArray())\n })\n }\n )\n\n /**\n * Calculate gcd for numbers\n * @param {number} a\n * @param {number} b\n * @returns {number} Returns the greatest common denominator of a and b\n * @private\n */\n function _gcdNumber (a, b) {\n if (!isInteger(a) || !isInteger(b)) {\n throw new Error('Parameters in function gcd must be integer numbers')\n }\n\n // https://en.wikipedia.org/wiki/Euclidean_algorithm\n let r\n while (b !== 0) {\n r = mod(a, b)\n a = b\n b = r\n }\n return (a < 0) ? -a : a\n }\n\n /**\n * Calculate gcd for BigNumbers\n * @param {BigNumber} a\n * @param {BigNumber} b\n * @returns {BigNumber} Returns greatest common denominator of a and b\n * @private\n */\n function _gcdBigNumber (a, b) {\n if (!a.isInt() || !b.isInt()) {\n throw new Error('Parameters in function gcd must be integer numbers')\n }\n\n // https://en.wikipedia.org/wiki/Euclidean_algorithm\n const zero = new BigNumber(0)\n while (!b.isZero()) {\n const r = mod(a, b)\n a = b\n b = r\n }\n return a.lt(zero) ? a.neg() : a\n }\n})\n","import { factory } from '../../../utils/factory.js'\nimport { DimensionError } from '../../../error/DimensionError.js'\nimport { scatter } from '../../../utils/collection.js'\n\nconst name = 'matAlgo06xS0S0'\nconst dependencies = ['typed', 'equalScalar']\n\nexport const createMatAlgo06xS0S0 = /* #__PURE__ */ factory(name, dependencies, ({ typed, equalScalar }) => {\n /**\n * Iterates over SparseMatrix A and SparseMatrix B nonzero items and invokes the callback function f(Aij, Bij).\n * Callback function invoked (Anz U Bnz) times, where Anz and Bnz are the nonzero elements in both matrices.\n *\n *\n * ┌ f(Aij, Bij) ; A(i,j) !== 0 && B(i,j) !== 0\n * C(i,j) = ┤\n * └ 0 ; otherwise\n *\n *\n * @param {Matrix} a The SparseMatrix instance (A)\n * @param {Matrix} b The SparseMatrix instance (B)\n * @param {Function} callback The f(Aij,Bij) operation to invoke\n *\n * @return {Matrix} SparseMatrix (C)\n *\n * see https://github.com/josdejong/mathjs/pull/346#issuecomment-97620294\n */\n return function matAlgo06xS0S0 (a, b, callback) {\n // sparse matrix arrays\n const avalues = a._values\n const asize = a._size\n const adt = a._datatype || a._data === undefined ? a._datatype : a.getDataType()\n // sparse matrix arrays\n const bvalues = b._values\n const bsize = b._size\n const bdt = b._datatype || b._data === undefined ? b._datatype : b.getDataType()\n\n // validate dimensions\n if (asize.length !== bsize.length) { throw new DimensionError(asize.length, bsize.length) }\n\n // check rows & columns\n if (asize[0] !== bsize[0] || asize[1] !== bsize[1]) { throw new RangeError('Dimension mismatch. Matrix A (' + asize + ') must match Matrix B (' + bsize + ')') }\n\n // rows & columns\n const rows = asize[0]\n const columns = asize[1]\n\n // datatype\n let dt\n // equal signature to use\n let eq = equalScalar\n // zero value\n let zero = 0\n // callback signature to use\n let cf = callback\n\n // process data types\n if (typeof adt === 'string' && adt === bdt && adt !== 'mixed') {\n // datatype\n dt = adt\n // find signature that matches (dt, dt)\n eq = typed.find(equalScalar, [dt, dt])\n // convert 0 to the same datatype\n zero = typed.convert(0, dt)\n // callback\n cf = typed.find(callback, [dt, dt])\n }\n\n // result arrays\n const cvalues = avalues && bvalues ? [] : undefined\n const cindex = []\n const cptr = []\n\n // workspaces\n const x = cvalues ? [] : undefined\n // marks indicating we have a value in x for a given column\n const w = []\n // marks indicating value in a given row has been updated\n const u = []\n\n // loop columns\n for (let j = 0; j < columns; j++) {\n // update cptr\n cptr[j] = cindex.length\n // columns mark\n const mark = j + 1\n // scatter the values of A(:,j) into workspace\n scatter(a, j, w, x, u, mark, cindex, cf)\n // scatter the values of B(:,j) into workspace\n scatter(b, j, w, x, u, mark, cindex, cf)\n // check we need to process values (non pattern matrix)\n if (x) {\n // initialize first index in j\n let k = cptr[j]\n // loop index in j\n while (k < cindex.length) {\n // row\n const i = cindex[k]\n // check function was invoked on current row (Aij !=0 && Bij != 0)\n if (u[i] === mark) {\n // value @ i\n const v = x[i]\n // check for zero value\n if (!eq(v, zero)) {\n // push value\n cvalues.push(v)\n // increment pointer\n k++\n } else {\n // remove value @ i, do not increment pointer\n cindex.splice(k, 1)\n }\n } else {\n // remove value @ i, do not increment pointer\n cindex.splice(k, 1)\n }\n }\n } else {\n // initialize first index in j\n let p = cptr[j]\n // loop index in j\n while (p < cindex.length) {\n // row\n const r = cindex[p]\n // check function was invoked on current row (Aij !=0 && Bij != 0)\n if (u[r] !== mark) {\n // remove value @ i, do not increment pointer\n cindex.splice(p, 1)\n } else {\n // increment pointer\n p++\n }\n }\n }\n }\n // update cptr\n cptr[columns] = cindex.length\n\n // return sparse matrix\n return a.createSparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [rows, columns],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n })\n }\n})\n","import { factory } from '../../utils/factory.js'\nimport { createMatAlgo02xDS0 } from '../../type/matrix/utils/matAlgo02xDS0.js'\nimport { createMatAlgo06xS0S0 } from '../../type/matrix/utils/matAlgo06xS0S0.js'\nimport { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\nimport { lcmNumber } from '../../plain/number/index.js'\n\nconst name = 'lcm'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'equalScalar',\n 'concat'\n]\n\nexport const createLcm = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, concat }) => {\n const matAlgo02xDS0 = createMatAlgo02xDS0({ typed, equalScalar })\n const matAlgo06xS0S0 = createMatAlgo06xS0S0({ typed, equalScalar })\n const matAlgo11xS0s = createMatAlgo11xS0s({ typed, equalScalar })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n const lcmTypes = 'number | BigNumber | Fraction | Matrix | Array'\n const lcmManySignature = {}\n lcmManySignature[`${lcmTypes}, ${lcmTypes}, ...${lcmTypes}`] =\n typed.referToSelf(self => (a, b, args) => {\n let res = self(a, b)\n for (let i = 0; i < args.length; i++) {\n res = self(res, args[i])\n }\n return res\n })\n\n /**\n * Calculate the least common multiple for two or more values or arrays.\n *\n * lcm is defined as:\n *\n * lcm(a, b) = abs(a * b) / gcd(a, b)\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.lcm(a, b)\n * math.lcm(a, b, c, ...)\n *\n * Examples:\n *\n * math.lcm(4, 6) // returns 12\n * math.lcm(6, 21) // returns 42\n * math.lcm(6, 21, 5) // returns 210\n *\n * math.lcm([4, 6], [6, 21]) // returns [12, 42]\n *\n * See also:\n *\n * gcd, xgcd\n *\n * @param {... number | BigNumber | Array | Matrix} args Two or more integer numbers\n * @return {number | BigNumber | Array | Matrix} The least common multiple\n */\n return typed(\n name, {\n 'number, number': lcmNumber,\n 'BigNumber, BigNumber': _lcmBigNumber,\n 'Fraction, Fraction': (x, y) => x.lcm(y)\n },\n matrixAlgorithmSuite({\n SS: matAlgo06xS0S0,\n DS: matAlgo02xDS0,\n Ss: matAlgo11xS0s\n }),\n lcmManySignature\n )\n\n /**\n * Calculate lcm for two BigNumbers\n * @param {BigNumber} a\n * @param {BigNumber} b\n * @returns {BigNumber} Returns the least common multiple of a and b\n * @private\n */\n function _lcmBigNumber (a, b) {\n if (!a.isInt() || !b.isInt()) {\n throw new Error('Parameters in function lcm must be integer numbers')\n }\n\n if (a.isZero()) {\n return a\n }\n if (b.isZero()) {\n return b\n }\n\n // https://en.wikipedia.org/wiki/Euclidean_algorithm\n // evaluate lcm here inline to reduce overhead\n const prod = a.times(b)\n while (!b.isZero()) {\n const t = b\n b = a.mod(t)\n a = t\n }\n return prod.div(a).abs()\n }\n})\n","/**\n * Build a bigint logarithm function from a number logarithm,\n * still returning a number. The idea is that 15 hexadecimal digits\n * (60 bits) saturates the mantissa of the log, and each additional hex\n * digit effectively just adds the log of 16 to the resulting value. So\n * convert the most significant 15 hex digits to a number and take its\n * log, and then add the log of 16 for each additional hex digit that\n * was in the bigint.\n * For negative numbers (complex logarithms), following the bignum\n * implementation, it just downgrades to number and uses the complex result.\n * @param {number} log16 the log of 16\n * @param {(number) -> number} numberLog the logarithm function for numbers\n * @param {ConfigurationObject} config the mathjs configuration\n * @param {(number) -> Complex} cplx the associated Complex log\n * @returns {(bigint) -> number} the corresponding logarithm for bigints\n */\nexport function promoteLogarithm (log16, numberLog, config, cplx) {\n return function (b) {\n if (b > 0 || config.predictable) {\n if (b <= 0) return NaN\n const s = b.toString(16)\n const s15 = s.substring(0, 15)\n return log16 * (s.length - s15.length) + numberLog(Number('0x' + s15))\n }\n return cplx(b.toNumber())\n }\n}\n","import { log10Number } from '../../plain/number/index.js'\nimport { promoteLogarithm } from '../../utils/bigint.js'\nimport { deepMap } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'log10'\nconst dependencies = ['typed', 'config', 'Complex']\nconst log16 = log10Number(16)\n\nexport const createLog10 = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, Complex }) => {\n /**\n * Calculate the 10-base logarithm of a value. This is the same as calculating `log(x, 10)`.\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.log10(x)\n *\n * Examples:\n *\n * math.log10(0.00001) // returns -5\n * math.log10(10000) // returns 4\n * math.log(10000) / math.log(10) // returns 4\n * math.pow(10, 4) // returns 10000\n *\n * See also:\n *\n * exp, log, log1p, log2\n *\n * @param {number | BigNumber | Complex | Array | Matrix} x\n * Value for which to calculate the logarithm.\n * @return {number | BigNumber | Complex | Array | Matrix}\n * Returns the 10-base logarithm of `x`\n */\n\n function complexLog (c) {\n return c.log().div(Math.LN10)\n }\n\n function complexLogNumber (x) {\n return complexLog(new Complex(x, 0))\n }\n return typed(name, {\n number: function (x) {\n if (x >= 0 || config.predictable) {\n return log10Number(x)\n } else {\n // negative value -> complex value computation\n return complexLogNumber(x)\n }\n },\n\n bigint: promoteLogarithm(log16, log10Number, config, complexLogNumber),\n\n Complex: complexLog,\n\n BigNumber: function (x) {\n if (!x.isNegative() || config.predictable) {\n return x.log()\n } else {\n // downgrade to number, return Complex valued result\n return complexLogNumber(x.toNumber())\n }\n },\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","import { log2Number } from '../../plain/number/index.js'\nimport { promoteLogarithm } from '../../utils/bigint.js'\nimport { deepMap } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'log2'\nconst dependencies = ['typed', 'config', 'Complex']\n\nexport const createLog2 = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, Complex }) => {\n /**\n * Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`.\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.log2(x)\n *\n * Examples:\n *\n * math.log2(0.03125) // returns -5\n * math.log2(16) // returns 4\n * math.log2(16) / math.log2(2) // returns 4\n * math.pow(2, 4) // returns 16\n *\n * See also:\n *\n * exp, log, log1p, log10\n *\n * @param {number | BigNumber | Complex | Array | Matrix} x\n * Value for which to calculate the logarithm.\n * @return {number | BigNumber | Complex | Array | Matrix}\n * Returns the 2-base logarithm of `x`\n */\n function complexLog2Number (x) {\n return _log2Complex(new Complex(x, 0))\n }\n\n return typed(name, {\n number: function (x) {\n if (x >= 0 || config.predictable) {\n return log2Number(x)\n } else {\n // negative value -> complex value computation\n return complexLog2Number(x)\n }\n },\n\n bigint: promoteLogarithm(4, log2Number, config, complexLog2Number),\n\n Complex: _log2Complex,\n\n BigNumber: function (x) {\n if (!x.isNegative() || config.predictable) {\n return x.log(2)\n } else {\n // downgrade to number, return Complex valued result\n return complexLog2Number(x.toNumber())\n }\n },\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n\n /**\n * Calculate log2 for a complex value\n * @param {Complex} x\n * @returns {Complex}\n * @private\n */\n function _log2Complex (x) {\n const newX = Math.sqrt(x.re * x.re + x.im * x.im)\n return new Complex(\n (Math.log2) ? Math.log2(newX) : Math.log(newX) / Math.LN2,\n Math.atan2(x.im, x.re) / Math.LN2\n )\n }\n})\n","import { factory } from '../../utils/factory.js'\nimport { multiplyNumber } from '../../plain/number/index.js'\n\nconst name = 'multiplyScalar'\nconst dependencies = ['typed']\n\nexport const createMultiplyScalar = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Multiply two scalar values, `x * y`.\n * This function is meant for internal use: it is used by the public function\n * `multiply`\n *\n * This function does not support collections (Array or Matrix).\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit} x First value to multiply\n * @param {number | BigNumber | bigint | Fraction | Complex} y Second value to multiply\n * @return {number | BigNumber | bigint | Fraction | Complex | Unit} Multiplication of `x` and `y`\n * @private\n */\n return typed('multiplyScalar', {\n\n 'number, number': multiplyNumber,\n\n 'Complex, Complex': function (x, y) {\n return x.mul(y)\n },\n\n 'BigNumber, BigNumber': function (x, y) {\n return x.times(y)\n },\n\n 'bigint, bigint': function (x, y) {\n return x * y\n },\n\n 'Fraction, Fraction': function (x, y) {\n return x.mul(y)\n },\n\n 'number | Fraction | BigNumber | Complex, Unit': (x, y) => y.multiply(x),\n\n 'Unit, number | Fraction | BigNumber | Complex | Unit': (x, y) => x.multiply(y)\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { isMatrix } from '../../utils/is.js'\nimport { arraySize } from '../../utils/array.js'\nimport { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js'\nimport { createMatAlgo14xDs } from '../../type/matrix/utils/matAlgo14xDs.js'\n\nconst name = 'multiply'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'addScalar',\n 'multiplyScalar',\n 'equalScalar',\n 'dot'\n]\n\nexport const createMultiply = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, addScalar, multiplyScalar, equalScalar, dot }) => {\n const matAlgo11xS0s = createMatAlgo11xS0s({ typed, equalScalar })\n const matAlgo14xDs = createMatAlgo14xDs({ typed })\n\n function _validateMatrixDimensions (size1, size2) {\n // check left operand dimensions\n switch (size1.length) {\n case 1:\n // check size2\n switch (size2.length) {\n case 1:\n // Vector x Vector\n if (size1[0] !== size2[0]) {\n // throw error\n throw new RangeError('Dimension mismatch in multiplication. Vectors must have the same length')\n }\n break\n case 2:\n // Vector x Matrix\n if (size1[0] !== size2[0]) {\n // throw error\n throw new RangeError('Dimension mismatch in multiplication. Vector length (' + size1[0] + ') must match Matrix rows (' + size2[0] + ')')\n }\n break\n default:\n throw new Error('Can only multiply a 1 or 2 dimensional matrix (Matrix B has ' + size2.length + ' dimensions)')\n }\n break\n case 2:\n // check size2\n switch (size2.length) {\n case 1:\n // Matrix x Vector\n if (size1[1] !== size2[0]) {\n // throw error\n throw new RangeError('Dimension mismatch in multiplication. Matrix columns (' + size1[1] + ') must match Vector length (' + size2[0] + ')')\n }\n break\n case 2:\n // Matrix x Matrix\n if (size1[1] !== size2[0]) {\n // throw error\n throw new RangeError('Dimension mismatch in multiplication. Matrix A columns (' + size1[1] + ') must match Matrix B rows (' + size2[0] + ')')\n }\n break\n default:\n throw new Error('Can only multiply a 1 or 2 dimensional matrix (Matrix B has ' + size2.length + ' dimensions)')\n }\n break\n default:\n throw new Error('Can only multiply a 1 or 2 dimensional matrix (Matrix A has ' + size1.length + ' dimensions)')\n }\n }\n\n /**\n * C = A * B\n *\n * @param {Matrix} a Dense Vector (N)\n * @param {Matrix} b Dense Vector (N)\n *\n * @return {number} Scalar value\n */\n function _multiplyVectorVector (a, b, n) {\n // check empty vector\n if (n === 0) { throw new Error('Cannot multiply two empty vectors') }\n return dot(a, b)\n }\n\n /**\n * C = A * B\n *\n * @param {Matrix} a Dense Vector (M)\n * @param {Matrix} b Matrix (MxN)\n *\n * @return {Matrix} Dense Vector (N)\n */\n function _multiplyVectorMatrix (a, b) {\n // process storage\n if (b.storage() !== 'dense') {\n throw new Error('Support for SparseMatrix not implemented')\n }\n return _multiplyVectorDenseMatrix(a, b)\n }\n\n /**\n * C = A * B\n *\n * @param {Matrix} a Dense Vector (M)\n * @param {Matrix} b Dense Matrix (MxN)\n *\n * @return {Matrix} Dense Vector (N)\n */\n function _multiplyVectorDenseMatrix (a, b) {\n // a dense\n const adata = a._data\n const asize = a._size\n const adt = a._datatype || a.getDataType()\n // b dense\n const bdata = b._data\n const bsize = b._size\n const bdt = b._datatype || b.getDataType()\n // rows & columns\n const alength = asize[0]\n const bcolumns = bsize[1]\n\n // datatype\n let dt\n // addScalar signature to use\n let af = addScalar\n // multiplyScalar signature to use\n let mf = multiplyScalar\n\n // process data types\n if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') {\n // datatype\n dt = adt\n // find signatures that matches (dt, dt)\n af = typed.find(addScalar, [dt, dt])\n mf = typed.find(multiplyScalar, [dt, dt])\n }\n\n // result\n const c = []\n\n // loop matrix columns\n for (let j = 0; j < bcolumns; j++) {\n // sum (do not initialize it with zero)\n let sum = mf(adata[0], bdata[0][j])\n // loop vector\n for (let i = 1; i < alength; i++) {\n // multiply & accumulate\n sum = af(sum, mf(adata[i], bdata[i][j]))\n }\n c[j] = sum\n }\n\n // return matrix\n return a.createDenseMatrix({\n data: c,\n size: [bcolumns],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n })\n }\n\n /**\n * C = A * B\n *\n * @param {Matrix} a Matrix (MxN)\n * @param {Matrix} b Dense Vector (N)\n *\n * @return {Matrix} Dense Vector (M)\n */\n const _multiplyMatrixVector = typed('_multiplyMatrixVector', {\n 'DenseMatrix, any': _multiplyDenseMatrixVector,\n 'SparseMatrix, any': _multiplySparseMatrixVector\n })\n\n /**\n * C = A * B\n *\n * @param {Matrix} a Matrix (MxN)\n * @param {Matrix} b Matrix (NxC)\n *\n * @return {Matrix} Matrix (MxC)\n */\n const _multiplyMatrixMatrix = typed('_multiplyMatrixMatrix', {\n 'DenseMatrix, DenseMatrix': _multiplyDenseMatrixDenseMatrix,\n 'DenseMatrix, SparseMatrix': _multiplyDenseMatrixSparseMatrix,\n 'SparseMatrix, DenseMatrix': _multiplySparseMatrixDenseMatrix,\n 'SparseMatrix, SparseMatrix': _multiplySparseMatrixSparseMatrix\n })\n\n /**\n * C = A * B\n *\n * @param {Matrix} a DenseMatrix (MxN)\n * @param {Matrix} b Dense Vector (N)\n *\n * @return {Matrix} Dense Vector (M)\n */\n function _multiplyDenseMatrixVector (a, b) {\n // a dense\n const adata = a._data\n const asize = a._size\n const adt = a._datatype || a.getDataType()\n // b dense\n const bdata = b._data\n const bdt = b._datatype || b.getDataType()\n // rows & columns\n const arows = asize[0]\n const acolumns = asize[1]\n\n // datatype\n let dt\n // addScalar signature to use\n let af = addScalar\n // multiplyScalar signature to use\n let mf = multiplyScalar\n\n // process data types\n if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') {\n // datatype\n dt = adt\n // find signatures that matches (dt, dt)\n af = typed.find(addScalar, [dt, dt])\n mf = typed.find(multiplyScalar, [dt, dt])\n }\n\n // result\n const c = []\n\n // loop matrix a rows\n for (let i = 0; i < arows; i++) {\n // current row\n const row = adata[i]\n // sum (do not initialize it with zero)\n let sum = mf(row[0], bdata[0])\n // loop matrix a columns\n for (let j = 1; j < acolumns; j++) {\n // multiply & accumulate\n sum = af(sum, mf(row[j], bdata[j]))\n }\n c[i] = sum\n }\n\n // return matrix\n return a.createDenseMatrix({\n data: c,\n size: [arows],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n })\n }\n\n /**\n * C = A * B\n *\n * @param {Matrix} a DenseMatrix (MxN)\n * @param {Matrix} b DenseMatrix (NxC)\n *\n * @return {Matrix} DenseMatrix (MxC)\n */\n function _multiplyDenseMatrixDenseMatrix (a, b) { // getDataType()\n // a dense\n const adata = a._data\n const asize = a._size\n const adt = a._datatype || a.getDataType()\n // b dense\n const bdata = b._data\n const bsize = b._size\n const bdt = b._datatype || b.getDataType()\n // rows & columns\n const arows = asize[0]\n const acolumns = asize[1]\n const bcolumns = bsize[1]\n\n // datatype\n let dt\n // addScalar signature to use\n let af = addScalar\n // multiplyScalar signature to use\n let mf = multiplyScalar\n\n // process data types\n if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed' && adt !== 'mixed') {\n // datatype\n dt = adt\n // find signatures that matches (dt, dt)\n af = typed.find(addScalar, [dt, dt])\n mf = typed.find(multiplyScalar, [dt, dt])\n }\n\n // result\n const c = []\n\n // loop matrix a rows\n for (let i = 0; i < arows; i++) {\n // current row\n const row = adata[i]\n // initialize row array\n c[i] = []\n // loop matrix b columns\n for (let j = 0; j < bcolumns; j++) {\n // sum (avoid initializing sum to zero)\n let sum = mf(row[0], bdata[0][j])\n // loop matrix a columns\n for (let x = 1; x < acolumns; x++) {\n // multiply & accumulate\n sum = af(sum, mf(row[x], bdata[x][j]))\n }\n c[i][j] = sum\n }\n }\n\n // return matrix\n return a.createDenseMatrix({\n data: c,\n size: [arows, bcolumns],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n })\n }\n\n /**\n * C = A * B\n *\n * @param {Matrix} a DenseMatrix (MxN)\n * @param {Matrix} b SparseMatrix (NxC)\n *\n * @return {Matrix} SparseMatrix (MxC)\n */\n function _multiplyDenseMatrixSparseMatrix (a, b) {\n // a dense\n const adata = a._data\n const asize = a._size\n const adt = a._datatype || a.getDataType()\n // b sparse\n const bvalues = b._values\n const bindex = b._index\n const bptr = b._ptr\n const bsize = b._size\n const bdt = b._datatype || b._data === undefined ? b._datatype : b.getDataType()\n // validate b matrix\n if (!bvalues) { throw new Error('Cannot multiply Dense Matrix times Pattern only Matrix') }\n // rows & columns\n const arows = asize[0]\n const bcolumns = bsize[1]\n\n // datatype\n let dt\n // addScalar signature to use\n let af = addScalar\n // multiplyScalar signature to use\n let mf = multiplyScalar\n // equalScalar signature to use\n let eq = equalScalar\n // zero value\n let zero = 0\n\n // process data types\n if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') {\n // datatype\n dt = adt\n // find signatures that matches (dt, dt)\n af = typed.find(addScalar, [dt, dt])\n mf = typed.find(multiplyScalar, [dt, dt])\n eq = typed.find(equalScalar, [dt, dt])\n // convert 0 to the same datatype\n zero = typed.convert(0, dt)\n }\n\n // result\n const cvalues = []\n const cindex = []\n const cptr = []\n // c matrix\n const c = b.createSparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [arows, bcolumns],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n })\n\n // loop b columns\n for (let jb = 0; jb < bcolumns; jb++) {\n // update ptr\n cptr[jb] = cindex.length\n // indeces in column jb\n const kb0 = bptr[jb]\n const kb1 = bptr[jb + 1]\n // do not process column jb if no data exists\n if (kb1 > kb0) {\n // last row mark processed\n let last = 0\n // loop a rows\n for (let i = 0; i < arows; i++) {\n // column mark\n const mark = i + 1\n // C[i, jb]\n let cij\n // values in b column j\n for (let kb = kb0; kb < kb1; kb++) {\n // row\n const ib = bindex[kb]\n // check value has been initialized\n if (last !== mark) {\n // first value in column jb\n cij = mf(adata[i][ib], bvalues[kb])\n // update mark\n last = mark\n } else {\n // accumulate value\n cij = af(cij, mf(adata[i][ib], bvalues[kb]))\n }\n }\n // check column has been processed and value != 0\n if (last === mark && !eq(cij, zero)) {\n // push row & value\n cindex.push(i)\n cvalues.push(cij)\n }\n }\n }\n }\n // update ptr\n cptr[bcolumns] = cindex.length\n\n // return sparse matrix\n return c\n }\n\n /**\n * C = A * B\n *\n * @param {Matrix} a SparseMatrix (MxN)\n * @param {Matrix} b Dense Vector (N)\n *\n * @return {Matrix} SparseMatrix (M, 1)\n */\n function _multiplySparseMatrixVector (a, b) {\n // a sparse\n const avalues = a._values\n const aindex = a._index\n const aptr = a._ptr\n const adt = a._datatype || a._data === undefined ? a._datatype : a.getDataType()\n // validate a matrix\n if (!avalues) { throw new Error('Cannot multiply Pattern only Matrix times Dense Matrix') }\n // b dense\n const bdata = b._data\n const bdt = b._datatype || b.getDataType()\n // rows & columns\n const arows = a._size[0]\n const brows = b._size[0]\n // result\n const cvalues = []\n const cindex = []\n const cptr = []\n\n // datatype\n let dt\n // addScalar signature to use\n let af = addScalar\n // multiplyScalar signature to use\n let mf = multiplyScalar\n // equalScalar signature to use\n let eq = equalScalar\n // zero value\n let zero = 0\n\n // process data types\n if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') {\n // datatype\n dt = adt\n // find signatures that matches (dt, dt)\n af = typed.find(addScalar, [dt, dt])\n mf = typed.find(multiplyScalar, [dt, dt])\n eq = typed.find(equalScalar, [dt, dt])\n // convert 0 to the same datatype\n zero = typed.convert(0, dt)\n }\n\n // workspace\n const x = []\n // vector with marks indicating a value x[i] exists in a given column\n const w = []\n\n // update ptr\n cptr[0] = 0\n // rows in b\n for (let ib = 0; ib < brows; ib++) {\n // b[ib]\n const vbi = bdata[ib]\n // check b[ib] != 0, avoid loops\n if (!eq(vbi, zero)) {\n // A values & index in ib column\n for (let ka0 = aptr[ib], ka1 = aptr[ib + 1], ka = ka0; ka < ka1; ka++) {\n // a row\n const ia = aindex[ka]\n // check value exists in current j\n if (!w[ia]) {\n // ia is new entry in j\n w[ia] = true\n // add i to pattern of C\n cindex.push(ia)\n // x(ia) = A\n x[ia] = mf(vbi, avalues[ka])\n } else {\n // i exists in C already\n x[ia] = af(x[ia], mf(vbi, avalues[ka]))\n }\n }\n }\n }\n // copy values from x to column jb of c\n for (let p1 = cindex.length, p = 0; p < p1; p++) {\n // row\n const ic = cindex[p]\n // copy value\n cvalues[p] = x[ic]\n }\n // update ptr\n cptr[1] = cindex.length\n\n // matrix to return\n return a.createSparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [arows, 1],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n })\n }\n\n /**\n * C = A * B\n *\n * @param {Matrix} a SparseMatrix (MxN)\n * @param {Matrix} b DenseMatrix (NxC)\n *\n * @return {Matrix} SparseMatrix (MxC)\n */\n function _multiplySparseMatrixDenseMatrix (a, b) {\n // a sparse\n const avalues = a._values\n const aindex = a._index\n const aptr = a._ptr\n const adt = a._datatype || a._data === undefined ? a._datatype : a.getDataType()\n // validate a matrix\n if (!avalues) { throw new Error('Cannot multiply Pattern only Matrix times Dense Matrix') }\n // b dense\n const bdata = b._data\n const bdt = b._datatype || b.getDataType()\n // rows & columns\n const arows = a._size[0]\n const brows = b._size[0]\n const bcolumns = b._size[1]\n\n // datatype\n let dt\n // addScalar signature to use\n let af = addScalar\n // multiplyScalar signature to use\n let mf = multiplyScalar\n // equalScalar signature to use\n let eq = equalScalar\n // zero value\n let zero = 0\n\n // process data types\n if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') {\n // datatype\n dt = adt\n // find signatures that matches (dt, dt)\n af = typed.find(addScalar, [dt, dt])\n mf = typed.find(multiplyScalar, [dt, dt])\n eq = typed.find(equalScalar, [dt, dt])\n // convert 0 to the same datatype\n zero = typed.convert(0, dt)\n }\n\n // result\n const cvalues = []\n const cindex = []\n const cptr = []\n // c matrix\n const c = a.createSparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [arows, bcolumns],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n })\n\n // workspace\n const x = []\n // vector with marks indicating a value x[i] exists in a given column\n const w = []\n\n // loop b columns\n for (let jb = 0; jb < bcolumns; jb++) {\n // update ptr\n cptr[jb] = cindex.length\n // mark in workspace for current column\n const mark = jb + 1\n // rows in jb\n for (let ib = 0; ib < brows; ib++) {\n // b[ib, jb]\n const vbij = bdata[ib][jb]\n // check b[ib, jb] != 0, avoid loops\n if (!eq(vbij, zero)) {\n // A values & index in ib column\n for (let ka0 = aptr[ib], ka1 = aptr[ib + 1], ka = ka0; ka < ka1; ka++) {\n // a row\n const ia = aindex[ka]\n // check value exists in current j\n if (w[ia] !== mark) {\n // ia is new entry in j\n w[ia] = mark\n // add i to pattern of C\n cindex.push(ia)\n // x(ia) = A\n x[ia] = mf(vbij, avalues[ka])\n } else {\n // i exists in C already\n x[ia] = af(x[ia], mf(vbij, avalues[ka]))\n }\n }\n }\n }\n // copy values from x to column jb of c\n for (let p0 = cptr[jb], p1 = cindex.length, p = p0; p < p1; p++) {\n // row\n const ic = cindex[p]\n // copy value\n cvalues[p] = x[ic]\n }\n }\n // update ptr\n cptr[bcolumns] = cindex.length\n\n // return sparse matrix\n return c\n }\n\n /**\n * C = A * B\n *\n * @param {Matrix} a SparseMatrix (MxN)\n * @param {Matrix} b SparseMatrix (NxC)\n *\n * @return {Matrix} SparseMatrix (MxC)\n */\n function _multiplySparseMatrixSparseMatrix (a, b) {\n // a sparse\n const avalues = a._values\n const aindex = a._index\n const aptr = a._ptr\n const adt = a._datatype || a._data === undefined ? a._datatype : a.getDataType()\n // b sparse\n const bvalues = b._values\n const bindex = b._index\n const bptr = b._ptr\n const bdt = b._datatype || b._data === undefined ? b._datatype : b.getDataType()\n\n // rows & columns\n const arows = a._size[0]\n const bcolumns = b._size[1]\n // flag indicating both matrices (a & b) contain data\n const values = avalues && bvalues\n\n // datatype\n let dt\n // addScalar signature to use\n let af = addScalar\n // multiplyScalar signature to use\n let mf = multiplyScalar\n\n // process data types\n if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') {\n // datatype\n dt = adt\n // find signatures that matches (dt, dt)\n af = typed.find(addScalar, [dt, dt])\n mf = typed.find(multiplyScalar, [dt, dt])\n }\n\n // result\n const cvalues = values ? [] : undefined\n const cindex = []\n const cptr = []\n // c matrix\n const c = a.createSparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [arows, bcolumns],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n })\n\n // workspace\n const x = values ? [] : undefined\n // vector with marks indicating a value x[i] exists in a given column\n const w = []\n // variables\n let ka, ka0, ka1, kb, kb0, kb1, ia, ib\n // loop b columns\n for (let jb = 0; jb < bcolumns; jb++) {\n // update ptr\n cptr[jb] = cindex.length\n // mark in workspace for current column\n const mark = jb + 1\n // B values & index in j\n for (kb0 = bptr[jb], kb1 = bptr[jb + 1], kb = kb0; kb < kb1; kb++) {\n // b row\n ib = bindex[kb]\n // check we need to process values\n if (values) {\n // loop values in a[:,ib]\n for (ka0 = aptr[ib], ka1 = aptr[ib + 1], ka = ka0; ka < ka1; ka++) {\n // row\n ia = aindex[ka]\n // check value exists in current j\n if (w[ia] !== mark) {\n // ia is new entry in j\n w[ia] = mark\n // add i to pattern of C\n cindex.push(ia)\n // x(ia) = A\n x[ia] = mf(bvalues[kb], avalues[ka])\n } else {\n // i exists in C already\n x[ia] = af(x[ia], mf(bvalues[kb], avalues[ka]))\n }\n }\n } else {\n // loop values in a[:,ib]\n for (ka0 = aptr[ib], ka1 = aptr[ib + 1], ka = ka0; ka < ka1; ka++) {\n // row\n ia = aindex[ka]\n // check value exists in current j\n if (w[ia] !== mark) {\n // ia is new entry in j\n w[ia] = mark\n // add i to pattern of C\n cindex.push(ia)\n }\n }\n }\n }\n // check we need to process matrix values (pattern matrix)\n if (values) {\n // copy values from x to column jb of c\n for (let p0 = cptr[jb], p1 = cindex.length, p = p0; p < p1; p++) {\n // row\n const ic = cindex[p]\n // copy value\n cvalues[p] = x[ic]\n }\n }\n }\n // update ptr\n cptr[bcolumns] = cindex.length\n\n // return sparse matrix\n return c\n }\n\n /**\n * Multiply two or more values, `x * y`.\n * For matrices, the matrix product is calculated.\n *\n * Syntax:\n *\n * math.multiply(x, y)\n * math.multiply(x, y, z, ...)\n *\n * Examples:\n *\n * math.multiply(4, 5.2) // returns number 20.8\n * math.multiply(2, 3, 4) // returns number 24\n *\n * const a = math.complex(2, 3)\n * const b = math.complex(4, 1)\n * math.multiply(a, b) // returns Complex 5 + 14i\n *\n * const c = [[1, 2], [4, 3]]\n * const d = [[1, 2, 3], [3, -4, 7]]\n * math.multiply(c, d) // returns Array [[7, -6, 17], [13, -4, 33]]\n *\n * const e = math.unit('2.1 km')\n * math.multiply(3, e) // returns Unit 6.3 km\n *\n * See also:\n *\n * divide, prod, cross, dot\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} x First value to multiply\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} y Second value to multiply\n * @return {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} Multiplication of `x` and `y`\n */\n return typed(name, multiplyScalar, {\n // we extend the signatures of multiplyScalar with signatures dealing with matrices\n\n 'Array, Array': typed.referTo('Matrix, Matrix', selfMM => (x, y) => {\n // check dimensions\n _validateMatrixDimensions(arraySize(x), arraySize(y))\n\n // use dense matrix implementation\n const m = selfMM(matrix(x), matrix(y))\n // return array or scalar\n return isMatrix(m) ? m.valueOf() : m\n }),\n\n 'Matrix, Matrix': function (x, y) {\n // dimensions\n const xsize = x.size()\n const ysize = y.size()\n\n // check dimensions\n _validateMatrixDimensions(xsize, ysize)\n\n // process dimensions\n if (xsize.length === 1) {\n // process y dimensions\n if (ysize.length === 1) {\n // Vector * Vector\n return _multiplyVectorVector(x, y, xsize[0])\n }\n // Vector * Matrix\n return _multiplyVectorMatrix(x, y)\n }\n // process y dimensions\n if (ysize.length === 1) {\n // Matrix * Vector\n return _multiplyMatrixVector(x, y)\n }\n // Matrix * Matrix\n return _multiplyMatrixMatrix(x, y)\n },\n\n 'Matrix, Array': typed.referTo('Matrix,Matrix', selfMM =>\n (x, y) => selfMM(x, matrix(y))),\n\n 'Array, Matrix': typed.referToSelf(self => (x, y) => {\n // use Matrix * Matrix implementation\n return self(matrix(x, y.storage()), y)\n }),\n\n 'SparseMatrix, any': function (x, y) {\n return matAlgo11xS0s(x, y, multiplyScalar, false)\n },\n\n 'DenseMatrix, any': function (x, y) {\n return matAlgo14xDs(x, y, multiplyScalar, false)\n },\n\n 'any, SparseMatrix': function (x, y) {\n return matAlgo11xS0s(y, x, multiplyScalar, true)\n },\n\n 'any, DenseMatrix': function (x, y) {\n return matAlgo14xDs(y, x, multiplyScalar, true)\n },\n\n 'Array, any': function (x, y) {\n // use matrix implementation\n return matAlgo14xDs(matrix(x), y, multiplyScalar, false).valueOf()\n },\n\n 'any, Array': function (x, y) {\n // use matrix implementation\n return matAlgo14xDs(matrix(y), x, multiplyScalar, true).valueOf()\n },\n\n 'any, any': multiplyScalar,\n\n 'any, any, ...any': typed.referToSelf(self => (x, y, rest) => {\n let result = self(x, y)\n\n for (let i = 0; i < rest.length; i++) {\n result = self(result, rest[i])\n }\n\n return result\n })\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { createMatAlgo01xDSid } from '../../type/matrix/utils/matAlgo01xDSid.js'\nimport { createMatAlgo02xDS0 } from '../../type/matrix/utils/matAlgo02xDS0.js'\nimport { createMatAlgo06xS0S0 } from '../../type/matrix/utils/matAlgo06xS0S0.js'\nimport { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\nimport { nthRootNumber } from '../../plain/number/index.js'\n\nconst name = 'nthRoot'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'equalScalar',\n 'BigNumber',\n 'concat'\n]\n\nexport const createNthRoot = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, BigNumber, concat }) => {\n const matAlgo01xDSid = createMatAlgo01xDSid({ typed })\n const matAlgo02xDS0 = createMatAlgo02xDS0({ typed, equalScalar })\n const matAlgo06xS0S0 = createMatAlgo06xS0S0({ typed, equalScalar })\n const matAlgo11xS0s = createMatAlgo11xS0s({ typed, equalScalar })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n /**\n * Calculate the nth root of a value.\n * The principal nth root of a positive real number A, is the positive real\n * solution of the equation\n *\n * x^root = A\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.nthRoot(a)\n * math.nthRoot(a, root)\n *\n * Examples:\n *\n * math.nthRoot(9, 2) // returns 3 (since 3^2 == 9)\n * math.sqrt(9) // returns 3 (since 3^2 == 9)\n * math.nthRoot(64, 3) // returns 4 (since 4^3 == 64)\n *\n * See also:\n *\n * sqrt, pow\n *\n * @param {number | BigNumber | Array | Matrix | Complex} a\n * Value for which to calculate the nth root\n * @param {number | BigNumber} [root=2] The root.\n * @return {number | Complex | Array | Matrix} Returns the nth root of `a`\n */\n function complexErr () {\n throw new Error(\n 'Complex number not supported in function nthRoot. Use nthRoots instead.')\n }\n\n return typed(\n name,\n {\n number: nthRootNumber,\n 'number, number': nthRootNumber,\n\n BigNumber: x => _bigNthRoot(x, new BigNumber(2)),\n 'BigNumber, BigNumber': _bigNthRoot,\n\n Complex: complexErr,\n 'Complex, number': complexErr,\n\n Array: typed.referTo('DenseMatrix,number', selfDn =>\n x => selfDn(matrix(x), 2).valueOf()),\n DenseMatrix: typed.referTo('DenseMatrix,number', selfDn =>\n x => selfDn(x, 2)),\n SparseMatrix: typed.referTo('SparseMatrix,number', selfSn =>\n x => selfSn(x, 2)),\n\n 'SparseMatrix, SparseMatrix': typed.referToSelf(self => (x, y) => {\n // density must be one (no zeros in matrix)\n if (y.density() === 1) {\n // sparse + sparse\n return matAlgo06xS0S0(x, y, self)\n } else {\n // throw exception\n throw new Error('Root must be non-zero')\n }\n }),\n\n 'DenseMatrix, SparseMatrix': typed.referToSelf(self => (x, y) => {\n // density must be one (no zeros in matrix)\n if (y.density() === 1) {\n // dense + sparse\n return matAlgo01xDSid(x, y, self, false)\n } else {\n // throw exception\n throw new Error('Root must be non-zero')\n }\n }),\n\n 'Array, SparseMatrix': typed.referTo('DenseMatrix,SparseMatrix', selfDS =>\n (x, y) => selfDS(matrix(x), y)),\n\n 'number | BigNumber, SparseMatrix': typed.referToSelf(self => (x, y) => {\n // density must be one (no zeros in matrix)\n if (y.density() === 1) {\n // sparse - scalar\n return matAlgo11xS0s(y, x, self, true)\n } else {\n // throw exception\n throw new Error('Root must be non-zero')\n }\n })\n },\n matrixAlgorithmSuite({\n scalar: 'number | BigNumber',\n SD: matAlgo02xDS0,\n Ss: matAlgo11xS0s,\n sS: false\n })\n )\n\n /**\n * Calculate the nth root of a for BigNumbers, solve x^root == a\n * https://rosettacode.org/wiki/Nth_root#JavaScript\n * @param {BigNumber} a\n * @param {BigNumber} root\n * @private\n */\n function _bigNthRoot (a, root) {\n const precision = BigNumber.precision\n const Big = BigNumber.clone({ precision: precision + 2 })\n const zero = new BigNumber(0)\n\n const one = new Big(1)\n const inv = root.isNegative()\n if (inv) {\n root = root.neg()\n }\n\n if (root.isZero()) {\n throw new Error('Root must be non-zero')\n }\n if (a.isNegative() && !root.abs().mod(2).equals(1)) {\n throw new Error('Root must be odd when a is negative.')\n }\n\n // edge cases zero and infinity\n if (a.isZero()) {\n return inv ? new Big(Infinity) : 0\n }\n if (!a.isFinite()) {\n return inv ? zero : a\n }\n\n let x = a.abs().pow(one.div(root))\n // If a < 0, we require that root is an odd integer,\n // so (-1) ^ (1/root) = -1\n x = a.isNeg() ? x.neg() : x\n return new BigNumber((inv ? one.div(x) : x).toPrecision(precision))\n }\n})\n\nexport const createNthRootNumber = /* #__PURE__ */ factory(name, ['typed'], ({ typed }) => {\n return typed(name, {\n number: nthRootNumber,\n 'number, number': nthRootNumber\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { deepMap } from '../../utils/collection.js'\nimport { signNumber } from '../../plain/number/index.js'\n\nconst name = 'sign'\nconst dependencies = ['typed', 'BigNumber', 'Fraction', 'complex']\n\nexport const createSign = /* #__PURE__ */ factory(name, dependencies, ({ typed, BigNumber, complex, Fraction }) => {\n /**\n * Compute the sign of a value. The sign of a value x is:\n *\n * - 1 when x > 0\n * - -1 when x < 0\n * - 0 when x == 0\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.sign(x)\n *\n * Examples:\n *\n * math.sign(3.5) // returns 1\n * math.sign(-4.2) // returns -1\n * math.sign(0) // returns 0\n *\n * math.sign([3, 5, -2, 0, 2]) // returns [1, 1, -1, 0, 1]\n *\n * See also:\n *\n * abs\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Array | Matrix | Unit} x\n * The number for which to determine the sign\n * @return {number | BigNumber | bigint | Fraction | Complex | Array | Matrix | Unit}\n * The sign of `x`\n */\n return typed(name, {\n number: signNumber,\n\n Complex: function (x) {\n return x.im === 0 ? complex(signNumber(x.re)) : x.sign()\n },\n\n BigNumber: function (x) {\n return new BigNumber(x.cmp(0))\n },\n\n bigint: function (x) {\n return x > 0n ? 1n : x < 0n ? -1n : 0n\n },\n\n Fraction: function (x) {\n return new Fraction(x.s)\n },\n\n // deep map collection, skip zeros since sign(0) = 0\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self, true)),\n\n Unit: typed.referToSelf(self => x => {\n if (!x._isDerived() && x.units[0].unit.offset !== 0) {\n throw new TypeError('sign is ambiguous for units with offset')\n }\n return typed.find(self, x.valueType())(x.value)\n })\n })\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'sqrt'\nconst dependencies = ['config', 'typed', 'Complex']\n\nexport const createSqrt = /* #__PURE__ */ factory(name, dependencies, ({ config, typed, Complex }) => {\n /**\n * Calculate the square root of a value.\n *\n * For matrices, if you want the matrix square root of a square matrix,\n * use the `sqrtm` function. If you wish to apply `sqrt` elementwise to\n * a matrix M, use `math.map(M, math.sqrt)`.\n *\n * Syntax:\n *\n * math.sqrt(x)\n *\n * Examples:\n *\n * math.sqrt(25) // returns 5\n * math.square(5) // returns 25\n * math.sqrt(-4) // returns Complex 2i\n *\n * See also:\n *\n * square, multiply, cube, cbrt, sqrtm\n *\n * @param {number | BigNumber | Complex | Unit} x\n * Value for which to calculate the square root.\n * @return {number | BigNumber | Complex | Unit}\n * Returns the square root of `x`\n */\n return typed('sqrt', {\n number: _sqrtNumber,\n\n Complex: function (x) {\n return x.sqrt()\n },\n\n BigNumber: function (x) {\n if (!x.isNegative() || config.predictable) {\n return x.sqrt()\n } else {\n // negative value -> downgrade to number to do complex value computation\n return _sqrtNumber(x.toNumber())\n }\n },\n\n Unit: function (x) {\n // Someday will work for complex units when they are implemented\n return x.pow(0.5)\n }\n\n })\n\n /**\n * Calculate sqrt for a number\n * @param {number} x\n * @returns {number | Complex} Returns the square root of x\n * @private\n */\n function _sqrtNumber (x) {\n if (isNaN(x)) {\n return NaN\n } else if (x >= 0 || config.predictable) {\n return Math.sqrt(x)\n } else {\n return new Complex(x, 0).sqrt()\n }\n }\n})\n","import { factory } from '../../utils/factory.js'\nimport { squareNumber } from '../../plain/number/index.js'\n\nconst name = 'square'\nconst dependencies = ['typed']\n\nexport const createSquare = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Compute the square of a value, `x * x`.\n * To avoid confusion with multiplying a square matrix by itself,\n * this function does not apply to matrices. If you wish to square\n * every element of a matrix, see the examples.\n *\n * Syntax:\n *\n * math.square(x)\n *\n * Examples:\n *\n * math.square(2) // returns number 4\n * math.square(3) // returns number 9\n * math.pow(3, 2) // returns number 9\n * math.multiply(3, 3) // returns number 9\n *\n * math.map([1, 2, 3, 4], math.square) // returns Array [1, 4, 9, 16]\n *\n * See also:\n *\n * multiply, cube, sqrt, pow\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit} x\n * Number for which to calculate the square\n * @return {number | BigNumber | bigint | Fraction | Complex | Unit}\n * Squared value\n */\n return typed(name, {\n number: squareNumber,\n\n Complex: function (x) {\n return x.mul(x)\n },\n\n BigNumber: function (x) {\n return x.times(x)\n },\n\n bigint: function (x) {\n return x * x\n },\n\n Fraction: function (x) {\n return x.mul(x)\n },\n\n Unit: function (x) {\n return x.pow(2)\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { createMatAlgo01xDSid } from '../../type/matrix/utils/matAlgo01xDSid.js'\nimport { createMatAlgo03xDSf } from '../../type/matrix/utils/matAlgo03xDSf.js'\nimport { createMatAlgo05xSfSf } from '../../type/matrix/utils/matAlgo05xSfSf.js'\nimport { createMatAlgo10xSids } from '../../type/matrix/utils/matAlgo10xSids.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\n\nconst name = 'subtract'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'equalScalar',\n 'subtractScalar',\n 'unaryMinus',\n 'DenseMatrix',\n 'concat'\n]\n\nexport const createSubtract = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, subtractScalar, unaryMinus, DenseMatrix, concat }) => {\n // TODO: split function subtract in two: subtract and subtractScalar\n\n const matAlgo01xDSid = createMatAlgo01xDSid({ typed })\n const matAlgo03xDSf = createMatAlgo03xDSf({ typed })\n const matAlgo05xSfSf = createMatAlgo05xSfSf({ typed, equalScalar })\n const matAlgo10xSids = createMatAlgo10xSids({ typed, DenseMatrix })\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n /**\n * Subtract two values, `x - y`.\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.subtract(x, y)\n *\n * Examples:\n *\n * math.subtract(5.3, 2) // returns number 3.3\n *\n * const a = math.complex(2, 3)\n * const b = math.complex(4, 1)\n * math.subtract(a, b) // returns Complex -2 + 2i\n *\n * math.subtract([5, 7, 4], 4) // returns Array [1, 3, 0]\n *\n * const c = math.unit('2.1 km')\n * const d = math.unit('500m')\n * math.subtract(c, d) // returns Unit 1.6 km\n *\n * See also:\n *\n * add\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} x Initial value\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} y Value to subtract from `x`\n * @return {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} Subtraction of `x` and `y`\n */\n return typed(\n name,\n {\n 'any, any': subtractScalar\n },\n matrixAlgorithmSuite({\n elop: subtractScalar,\n SS: matAlgo05xSfSf,\n DS: matAlgo01xDSid,\n SD: matAlgo03xDSf,\n Ss: matAlgo12xSfs,\n sS: matAlgo10xSids\n })\n )\n})\n","import { factory } from '../../utils/factory.js'\nimport { xgcdNumber } from '../../plain/number/index.js'\n\nconst name = 'xgcd'\nconst dependencies = ['typed', 'config', 'matrix', 'BigNumber']\n\nexport const createXgcd = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, matrix, BigNumber }) => {\n /**\n * Calculate the extended greatest common divisor for two values.\n * See https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm.\n *\n * Syntax:\n *\n * math.xgcd(a, b)\n *\n * Examples:\n *\n * math.xgcd(8, 12) // returns [4, -1, 1]\n * math.gcd(8, 12) // returns 4\n * math.xgcd(36163, 21199) // returns [1247, -7, 12]\n *\n * See also:\n *\n * gcd, lcm\n *\n * @param {number | BigNumber} a An integer number\n * @param {number | BigNumber} b An integer number\n * @return {Array} Returns an array containing 3 integers `[div, m, n]`\n * where `div = gcd(a, b)` and `a*m + b*n = div`\n */\n return typed(name, {\n 'number, number': function (a, b) {\n const res = xgcdNumber(a, b)\n\n return (config.matrix === 'Array')\n ? res\n : matrix(res)\n },\n 'BigNumber, BigNumber': _xgcdBigNumber\n // TODO: implement support for Fraction\n })\n\n /**\n * Calculate xgcd for two BigNumbers\n * @param {BigNumber} a\n * @param {BigNumber} b\n * @return {BigNumber[]} result\n * @private\n */\n function _xgcdBigNumber (a, b) {\n // source: https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm\n let // used to swap two variables\n t\n\n let // quotient\n q\n\n let // remainder\n r\n\n const zero = new BigNumber(0)\n const one = new BigNumber(1)\n let x = zero\n let lastx = one\n let y = one\n let lasty = zero\n\n if (!a.isInt() || !b.isInt()) {\n throw new Error('Parameters in function xgcd must be integer numbers')\n }\n\n while (!b.isZero()) {\n q = a.div(b).floor()\n r = a.mod(b)\n\n t = x\n x = lastx.minus(q.times(x))\n lastx = t\n\n t = y\n y = lasty.minus(q.times(y))\n lasty = t\n\n a = b\n b = r\n }\n\n let res\n if (a.lt(zero)) {\n res = [a.neg(), lastx.neg(), lasty.neg()]\n } else {\n res = [a, !a.isZero() ? lastx : 0, lasty]\n }\n return (config.matrix === 'Array') ? res : matrix(res)\n }\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'invmod'\nconst dependencies = ['typed', 'config', 'BigNumber', 'xgcd', 'equal', 'smaller', 'mod', 'add', 'isInteger']\n\nexport const createInvmod = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, BigNumber, xgcd, equal, smaller, mod, add, isInteger }) => {\n /**\n * Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation `ax ≣ 1 (mod b)`\n * See https://en.wikipedia.org/wiki/Modular_multiplicative_inverse.\n *\n * Syntax:\n *\n * math.invmod(a, b)\n *\n * Examples:\n *\n * math.invmod(8, 12) // returns NaN\n * math.invmod(7, 13) // returns 2\n * math.invmod(15151, 15122) // returns 10429\n *\n * See also:\n *\n * gcd, xgcd\n *\n * @param {number | BigNumber} a An integer number\n * @param {number | BigNumber} b An integer number\n * @return {number | BigNumber } Returns an integer number\n * where `invmod(a,b)*a ≣ 1 (mod b)`\n */\n return typed(name, {\n 'number, number': invmod,\n 'BigNumber, BigNumber': invmod\n })\n\n function invmod (a, b) {\n if (!isInteger(a) || !isInteger(b)) throw new Error('Parameters in function invmod must be integer numbers')\n a = mod(a, b)\n if (equal(b, 0)) throw new Error('Divisor must be non zero')\n let res = xgcd(a, b)\n res = res.valueOf()\n let [gcd, inv] = res\n if (!equal(gcd, BigNumber(1))) return NaN\n inv = mod(inv, b)\n if (smaller(inv, BigNumber(0))) inv = add(inv, b)\n return inv\n }\n})\n","import { factory } from '../../../utils/factory.js'\nimport { DimensionError } from '../../../error/DimensionError.js'\n\nconst name = 'matAlgo09xS0Sf'\nconst dependencies = ['typed', 'equalScalar']\n\nexport const createMatAlgo09xS0Sf = /* #__PURE__ */ factory(name, dependencies, ({ typed, equalScalar }) => {\n /**\n * Iterates over SparseMatrix A and invokes the callback function f(Aij, Bij).\n * Callback function invoked NZA times, number of nonzero elements in A.\n *\n *\n * ┌ f(Aij, Bij) ; A(i,j) !== 0\n * C(i,j) = ┤\n * └ 0 ; otherwise\n *\n *\n * @param {Matrix} a The SparseMatrix instance (A)\n * @param {Matrix} b The SparseMatrix instance (B)\n * @param {Function} callback The f(Aij,Bij) operation to invoke\n *\n * @return {Matrix} SparseMatrix (C)\n *\n * see https://github.com/josdejong/mathjs/pull/346#issuecomment-97620294\n */\n return function matAlgo09xS0Sf (a, b, callback) {\n // sparse matrix arrays\n const avalues = a._values\n const aindex = a._index\n const aptr = a._ptr\n const asize = a._size\n const adt = a._datatype || a._data === undefined ? a._datatype : a.getDataType()\n // sparse matrix arrays\n const bvalues = b._values\n const bindex = b._index\n const bptr = b._ptr\n const bsize = b._size\n const bdt = b._datatype || b._data === undefined ? b._datatype : b.getDataType()\n\n // validate dimensions\n if (asize.length !== bsize.length) { throw new DimensionError(asize.length, bsize.length) }\n\n // check rows & columns\n if (asize[0] !== bsize[0] || asize[1] !== bsize[1]) { throw new RangeError('Dimension mismatch. Matrix A (' + asize + ') must match Matrix B (' + bsize + ')') }\n\n // rows & columns\n const rows = asize[0]\n const columns = asize[1]\n\n // datatype\n let dt\n // equal signature to use\n let eq = equalScalar\n // zero value\n let zero = 0\n // callback signature to use\n let cf = callback\n\n // process data types\n if (typeof adt === 'string' && adt === bdt && adt !== 'mixed') {\n // datatype\n dt = adt\n // find signature that matches (dt, dt)\n eq = typed.find(equalScalar, [dt, dt])\n // convert 0 to the same datatype\n zero = typed.convert(0, dt)\n // callback\n cf = typed.find(callback, [dt, dt])\n }\n\n // result arrays\n const cvalues = avalues && bvalues ? [] : undefined\n const cindex = []\n const cptr = []\n\n // workspaces\n const x = cvalues ? [] : undefined\n // marks indicating we have a value in x for a given column\n const w = []\n\n // vars\n let i, j, k, k0, k1\n\n // loop columns\n for (j = 0; j < columns; j++) {\n // update cptr\n cptr[j] = cindex.length\n // column mark\n const mark = j + 1\n // check we need to process values\n if (x) {\n // loop B(:,j)\n for (k0 = bptr[j], k1 = bptr[j + 1], k = k0; k < k1; k++) {\n // row\n i = bindex[k]\n // update workspace\n w[i] = mark\n x[i] = bvalues[k]\n }\n }\n // loop A(:,j)\n for (k0 = aptr[j], k1 = aptr[j + 1], k = k0; k < k1; k++) {\n // row\n i = aindex[k]\n // check we need to process values\n if (x) {\n // b value @ i,j\n const vb = w[i] === mark ? x[i] : zero\n // invoke f\n const vc = cf(avalues[k], vb)\n // check zero value\n if (!eq(vc, zero)) {\n // push index\n cindex.push(i)\n // push value\n cvalues.push(vc)\n }\n } else {\n // push index\n cindex.push(i)\n }\n }\n }\n // update cptr\n cptr[columns] = cindex.length\n\n // return sparse matrix\n return a.createSparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [rows, columns],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n })\n }\n})\n","import { factory } from '../../utils/factory.js'\nimport { createMatAlgo02xDS0 } from '../../type/matrix/utils/matAlgo02xDS0.js'\nimport { createMatAlgo09xS0Sf } from '../../type/matrix/utils/matAlgo09xS0Sf.js'\nimport { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\n\nconst name = 'dotMultiply'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'equalScalar',\n 'multiplyScalar',\n 'concat'\n]\n\nexport const createDotMultiply = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, multiplyScalar, concat }) => {\n const matAlgo02xDS0 = createMatAlgo02xDS0({ typed, equalScalar })\n const matAlgo09xS0Sf = createMatAlgo09xS0Sf({ typed, equalScalar })\n const matAlgo11xS0s = createMatAlgo11xS0s({ typed, equalScalar })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n /**\n * Multiply two matrices element wise. The function accepts both matrices and\n * scalar values.\n *\n * Syntax:\n *\n * math.dotMultiply(x, y)\n *\n * Examples:\n *\n * math.dotMultiply(2, 4) // returns 8\n *\n * a = [[9, 5], [6, 1]]\n * b = [[3, 2], [5, 2]]\n *\n * math.dotMultiply(a, b) // returns [[27, 10], [30, 2]]\n * math.multiply(a, b) // returns [[52, 28], [23, 14]]\n *\n * See also:\n *\n * multiply, divide, dotDivide\n *\n * @param {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} x Left hand value\n * @param {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} y Right hand value\n * @return {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} Multiplication of `x` and `y`\n */\n return typed(name, matrixAlgorithmSuite({\n elop: multiplyScalar,\n SS: matAlgo09xS0Sf,\n DS: matAlgo02xDS0,\n Ss: matAlgo11xS0s\n }))\n})\n","/**\n * Bitwise and for Bignumbers\n *\n * Special Cases:\n * N & n = N\n * n & 0 = 0\n * n & -1 = n\n * n & n = n\n * I & I = I\n * -I & -I = -I\n * I & -I = 0\n * I & n = n\n * I & -n = I\n * -I & n = 0\n * -I & -n = -I\n *\n * @param {BigNumber} x\n * @param {BigNumber} y\n * @return {BigNumber} Result of `x` & `y`, is fully precise\n * @private\n */\nexport function bitAndBigNumber (x, y) {\n if ((x.isFinite() && !x.isInteger()) || (y.isFinite() && !y.isInteger())) {\n throw new Error('Integers expected in function bitAnd')\n }\n\n const BigNumber = x.constructor\n if (x.isNaN() || y.isNaN()) {\n return new BigNumber(NaN)\n }\n\n if (x.isZero() || y.eq(-1) || x.eq(y)) {\n return x\n }\n if (y.isZero() || x.eq(-1)) {\n return y\n }\n\n if (!x.isFinite() || !y.isFinite()) {\n if (!x.isFinite() && !y.isFinite()) {\n if (x.isNegative() === y.isNegative()) {\n return x\n }\n return new BigNumber(0)\n }\n if (!x.isFinite()) {\n if (y.isNegative()) {\n return x\n }\n if (x.isNegative()) {\n return new BigNumber(0)\n }\n return y\n }\n if (!y.isFinite()) {\n if (x.isNegative()) {\n return y\n }\n if (y.isNegative()) {\n return new BigNumber(0)\n }\n return x\n }\n }\n return bitwise(x, y, function (a, b) { return a & b })\n}\n\n/**\n * Bitwise not\n * @param {BigNumber} x\n * @return {BigNumber} Result of ~`x`, fully precise\n *\n */\nexport function bitNotBigNumber (x) {\n if (x.isFinite() && !x.isInteger()) {\n throw new Error('Integer expected in function bitNot')\n }\n\n const BigNumber = x.constructor\n const prevPrec = BigNumber.precision\n BigNumber.config({ precision: 1E9 })\n\n const result = x.plus(new BigNumber(1))\n result.s = -result.s || null\n\n BigNumber.config({ precision: prevPrec })\n return result\n}\n\n/**\n * Bitwise OR for BigNumbers\n *\n * Special Cases:\n * N | n = N\n * n | 0 = n\n * n | -1 = -1\n * n | n = n\n * I | I = I\n * -I | -I = -I\n * I | -n = -1\n * I | -I = -1\n * I | n = I\n * -I | n = -I\n * -I | -n = -n\n *\n * @param {BigNumber} x\n * @param {BigNumber} y\n * @return {BigNumber} Result of `x` | `y`, fully precise\n */\nexport function bitOrBigNumber (x, y) {\n if ((x.isFinite() && !x.isInteger()) || (y.isFinite() && !y.isInteger())) {\n throw new Error('Integers expected in function bitOr')\n }\n\n const BigNumber = x.constructor\n if (x.isNaN() || y.isNaN()) {\n return new BigNumber(NaN)\n }\n\n const negOne = new BigNumber(-1)\n if (x.isZero() || y.eq(negOne) || x.eq(y)) {\n return y\n }\n if (y.isZero() || x.eq(negOne)) {\n return x\n }\n\n if (!x.isFinite() || !y.isFinite()) {\n if ((!x.isFinite() && !x.isNegative() && y.isNegative()) ||\n (x.isNegative() && !y.isNegative() && !y.isFinite())) {\n return negOne\n }\n if (x.isNegative() && y.isNegative()) {\n return x.isFinite() ? x : y\n }\n return x.isFinite() ? y : x\n }\n\n return bitwise(x, y, function (a, b) { return a | b })\n}\n\n/**\n * Applies bitwise function to numbers\n * @param {BigNumber} x\n * @param {BigNumber} y\n * @param {function (a, b)} func\n * @return {BigNumber}\n */\nexport function bitwise (x, y, func) {\n const BigNumber = x.constructor\n\n let xBits, yBits\n const xSign = +(x.s < 0)\n const ySign = +(y.s < 0)\n if (xSign) {\n xBits = decCoefficientToBinaryString(bitNotBigNumber(x))\n for (let i = 0; i < xBits.length; ++i) {\n xBits[i] ^= 1\n }\n } else {\n xBits = decCoefficientToBinaryString(x)\n }\n if (ySign) {\n yBits = decCoefficientToBinaryString(bitNotBigNumber(y))\n for (let i = 0; i < yBits.length; ++i) {\n yBits[i] ^= 1\n }\n } else {\n yBits = decCoefficientToBinaryString(y)\n }\n\n let minBits, maxBits, minSign\n if (xBits.length <= yBits.length) {\n minBits = xBits\n maxBits = yBits\n minSign = xSign\n } else {\n minBits = yBits\n maxBits = xBits\n minSign = ySign\n }\n\n let shortLen = minBits.length\n let longLen = maxBits.length\n const expFuncVal = func(xSign, ySign) ^ 1\n let outVal = new BigNumber(expFuncVal ^ 1)\n let twoPower = new BigNumber(1)\n const two = new BigNumber(2)\n\n const prevPrec = BigNumber.precision\n BigNumber.config({ precision: 1E9 })\n\n while (shortLen > 0) {\n if (func(minBits[--shortLen], maxBits[--longLen]) === expFuncVal) {\n outVal = outVal.plus(twoPower)\n }\n twoPower = twoPower.times(two)\n }\n while (longLen > 0) {\n if (func(minSign, maxBits[--longLen]) === expFuncVal) {\n outVal = outVal.plus(twoPower)\n }\n twoPower = twoPower.times(two)\n }\n\n BigNumber.config({ precision: prevPrec })\n\n if (expFuncVal === 0) {\n outVal.s = -outVal.s\n }\n return outVal\n}\n\n/* Extracted from decimal.js, and edited to specialize. */\nfunction decCoefficientToBinaryString (x) {\n // Convert to string\n const a = x.d // array with digits\n let r = a[0] + ''\n\n for (let i = 1; i < a.length; ++i) {\n let s = a[i] + ''\n for (let z = 7 - s.length; z--;) {\n s = '0' + s\n }\n\n r += s\n }\n\n let j = r.length\n while (r.charAt(j) === '0') {\n j--\n }\n\n let xe = x.e\n let str = r.slice(0, j + 1 || 1)\n const strL = str.length\n if (xe > 0) {\n if (++xe > strL) {\n // Append zeros.\n xe -= strL\n while (xe--) {\n str += '0'\n }\n } else if (xe < strL) {\n str = str.slice(0, xe) + '.' + str.slice(xe)\n }\n }\n\n // Convert from base 10 (decimal) to base 2\n const arr = [0]\n for (let i = 0; i < str.length;) {\n let arrL = arr.length\n while (arrL--) {\n arr[arrL] *= 10\n }\n\n arr[0] += parseInt(str.charAt(i++)) // convert to int\n for (let j = 0; j < arr.length; ++j) {\n if (arr[j] > 1) {\n if (arr[j + 1] === null || arr[j + 1] === undefined) {\n arr[j + 1] = 0\n }\n\n arr[j + 1] += arr[j] >> 1\n arr[j] &= 1\n }\n }\n }\n\n return arr.reverse()\n}\n\n/**\n * Bitwise XOR for BigNumbers\n *\n * Special Cases:\n * N ^ n = N\n * n ^ 0 = n\n * n ^ n = 0\n * n ^ -1 = ~n\n * I ^ n = I\n * I ^ -n = -I\n * I ^ -I = -1\n * -I ^ n = -I\n * -I ^ -n = I\n *\n * @param {BigNumber} x\n * @param {BigNumber} y\n * @return {BigNumber} Result of `x` ^ `y`, fully precise\n *\n */\nexport function bitXor (x, y) {\n if ((x.isFinite() && !x.isInteger()) || (y.isFinite() && !y.isInteger())) {\n throw new Error('Integers expected in function bitXor')\n }\n\n const BigNumber = x.constructor\n if (x.isNaN() || y.isNaN()) {\n return new BigNumber(NaN)\n }\n if (x.isZero()) {\n return y\n }\n if (y.isZero()) {\n return x\n }\n\n if (x.eq(y)) {\n return new BigNumber(0)\n }\n\n const negOne = new BigNumber(-1)\n if (x.eq(negOne)) {\n return bitNotBigNumber(y)\n }\n if (y.eq(negOne)) {\n return bitNotBigNumber(x)\n }\n\n if (!x.isFinite() || !y.isFinite()) {\n if (!x.isFinite() && !y.isFinite()) {\n return negOne\n }\n return new BigNumber(x.isNegative() === y.isNegative()\n ? Infinity\n : -Infinity)\n }\n return bitwise(x, y, function (a, b) { return a ^ b })\n}\n\n/**\n * Bitwise left shift\n *\n * Special Cases:\n * n << -n = N\n * n << N = N\n * N << n = N\n * n << 0 = n\n * 0 << n = 0\n * I << I = N\n * I << n = I\n * n << I = I\n *\n * @param {BigNumber} x\n * @param {BigNumber} y\n * @return {BigNumber} Result of `x` << `y`\n *\n */\nexport function leftShiftBigNumber (x, y) {\n if ((x.isFinite() && !x.isInteger()) || (y.isFinite() && !y.isInteger())) {\n throw new Error('Integers expected in function leftShift')\n }\n\n const BigNumber = x.constructor\n if (x.isNaN() || y.isNaN() || (y.isNegative() && !y.isZero())) {\n return new BigNumber(NaN)\n }\n if (x.isZero() || y.isZero()) {\n return x\n }\n if (!x.isFinite() && !y.isFinite()) {\n return new BigNumber(NaN)\n }\n\n // Math.pow(2, y) is fully precise for y < 55, and fast\n if (y.lt(55)) {\n return x.times(Math.pow(2, y.toNumber()) + '')\n }\n return x.times(new BigNumber(2).pow(y))\n}\n\n/*\n * Special Cases:\n * n >> -n = N\n * n >> N = N\n * N >> n = N\n * I >> I = N\n * n >> 0 = n\n * I >> n = I\n * -I >> n = -I\n * -I >> I = -I\n * n >> I = I\n * -n >> I = -1\n * 0 >> n = 0\n *\n * @param {BigNumber} value\n * @param {BigNumber} value\n * @return {BigNumber} Result of `x` >> `y`\n *\n */\nexport function rightArithShiftBigNumber (x, y) {\n if ((x.isFinite() && !x.isInteger()) || (y.isFinite() && !y.isInteger())) {\n throw new Error('Integers expected in function rightArithShift')\n }\n\n const BigNumber = x.constructor\n if (x.isNaN() || y.isNaN() || (y.isNegative() && !y.isZero())) {\n return new BigNumber(NaN)\n }\n if (x.isZero() || y.isZero()) {\n return x\n }\n if (!y.isFinite()) {\n if (x.isNegative()) {\n return new BigNumber(-1)\n }\n if (!x.isFinite()) {\n return new BigNumber(NaN)\n }\n return new BigNumber(0)\n }\n\n // Math.pow(2, y) is fully precise for y < 55, and fast\n if (y.lt(55)) {\n return x.div(Math.pow(2, y.toNumber()) + '').floor()\n }\n return x.div(new BigNumber(2).pow(y)).floor()\n}\n","import { isInteger } from '../../utils/number.js'\n\nconst n1 = 'number'\nconst n2 = 'number, number'\n\nexport function bitAndNumber (x, y) {\n if (!isInteger(x) || !isInteger(y)) {\n throw new Error('Integers expected in function bitAnd')\n }\n\n return x & y\n}\nbitAndNumber.signature = n2\n\nexport function bitNotNumber (x) {\n if (!isInteger(x)) {\n throw new Error('Integer expected in function bitNot')\n }\n\n return ~x\n}\nbitNotNumber.signature = n1\n\nexport function bitOrNumber (x, y) {\n if (!isInteger(x) || !isInteger(y)) {\n throw new Error('Integers expected in function bitOr')\n }\n\n return x | y\n}\nbitOrNumber.signature = n2\n\nexport function bitXorNumber (x, y) {\n if (!isInteger(x) || !isInteger(y)) {\n throw new Error('Integers expected in function bitXor')\n }\n\n return x ^ y\n}\nbitXorNumber.signature = n2\n\nexport function leftShiftNumber (x, y) {\n if (!isInteger(x) || !isInteger(y)) {\n throw new Error('Integers expected in function leftShift')\n }\n\n return x << y\n}\nleftShiftNumber.signature = n2\n\nexport function rightArithShiftNumber (x, y) {\n if (!isInteger(x) || !isInteger(y)) {\n throw new Error('Integers expected in function rightArithShift')\n }\n\n return x >> y\n}\nrightArithShiftNumber.signature = n2\n\nexport function rightLogShiftNumber (x, y) {\n if (!isInteger(x) || !isInteger(y)) {\n throw new Error('Integers expected in function rightLogShift')\n }\n\n return x >>> y\n}\nrightLogShiftNumber.signature = n2\n","import { bitAndBigNumber } from '../../utils/bignumber/bitwise.js'\nimport { createMatAlgo02xDS0 } from '../../type/matrix/utils/matAlgo02xDS0.js'\nimport { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js'\nimport { createMatAlgo06xS0S0 } from '../../type/matrix/utils/matAlgo06xS0S0.js'\nimport { factory } from '../../utils/factory.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\nimport { bitAndNumber } from '../../plain/number/index.js'\n\nconst name = 'bitAnd'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'equalScalar',\n 'concat'\n]\n\nexport const createBitAnd = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, concat }) => {\n const matAlgo02xDS0 = createMatAlgo02xDS0({ typed, equalScalar })\n const matAlgo06xS0S0 = createMatAlgo06xS0S0({ typed, equalScalar })\n const matAlgo11xS0s = createMatAlgo11xS0s({ typed, equalScalar })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n /**\n * Bitwise AND two values, `x & y`.\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.bitAnd(x, y)\n *\n * Examples:\n *\n * math.bitAnd(53, 131) // returns number 1\n *\n * math.bitAnd([1, 12, 31], 42) // returns Array [0, 8, 10]\n *\n * See also:\n *\n * bitNot, bitOr, bitXor, leftShift, rightArithShift, rightLogShift\n *\n * @param {number | BigNumber | bigint | Array | Matrix} x First value to and\n * @param {number | BigNumber | bigint | Array | Matrix} y Second value to and\n * @return {number | BigNumber | bigint | Array | Matrix} AND of `x` and `y`\n */\n return typed(\n name,\n {\n 'number, number': bitAndNumber,\n 'BigNumber, BigNumber': bitAndBigNumber,\n 'bigint, bigint': (x, y) => x & y\n },\n matrixAlgorithmSuite({\n SS: matAlgo06xS0S0,\n DS: matAlgo02xDS0,\n Ss: matAlgo11xS0s\n })\n )\n})\n","import { bitNotBigNumber } from '../../utils/bignumber/bitwise.js'\nimport { deepMap } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\nimport { bitNotNumber } from '../../plain/number/index.js'\n\nconst name = 'bitNot'\nconst dependencies = ['typed']\n\nexport const createBitNot = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Bitwise NOT value, `~x`.\n * For matrices, the function is evaluated element wise.\n * For units, the function is evaluated on the best prefix base.\n *\n * Syntax:\n *\n * math.bitNot(x)\n *\n * Examples:\n *\n * math.bitNot(1) // returns number -2\n *\n * math.bitNot([2, -3, 4]) // returns Array [-3, 2, -5]\n *\n * See also:\n *\n * bitAnd, bitOr, bitXor, leftShift, rightArithShift, rightLogShift\n *\n * @param {number | BigNumber | bigint | Array | Matrix} x Value to not\n * @return {number | BigNumber | bigint | Array | Matrix} NOT of `x`\n */\n return typed(name, {\n number: bitNotNumber,\n BigNumber: bitNotBigNumber,\n bigint: x => ~x,\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","import { bitOrBigNumber } from '../../utils/bignumber/bitwise.js'\nimport { factory } from '../../utils/factory.js'\nimport { createMatAlgo10xSids } from '../../type/matrix/utils/matAlgo10xSids.js'\nimport { createMatAlgo04xSidSid } from '../../type/matrix/utils/matAlgo04xSidSid.js'\nimport { createMatAlgo01xDSid } from '../../type/matrix/utils/matAlgo01xDSid.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\nimport { bitOrNumber } from '../../plain/number/index.js'\n\nconst name = 'bitOr'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'equalScalar',\n 'DenseMatrix',\n 'concat'\n]\n\nexport const createBitOr = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, DenseMatrix, concat }) => {\n const matAlgo01xDSid = createMatAlgo01xDSid({ typed })\n const matAlgo04xSidSid = createMatAlgo04xSidSid({ typed, equalScalar })\n const matAlgo10xSids = createMatAlgo10xSids({ typed, DenseMatrix })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n /**\n * Bitwise OR two values, `x | y`.\n * For matrices, the function is evaluated element wise.\n * For units, the function is evaluated on the lowest print base.\n *\n * Syntax:\n *\n * math.bitOr(x, y)\n *\n * Examples:\n *\n * math.bitOr(1, 2) // returns number 3\n *\n * math.bitOr([1, 2, 3], 4) // returns Array [5, 6, 7]\n *\n * See also:\n *\n * bitAnd, bitNot, bitXor, leftShift, rightArithShift, rightLogShift\n *\n * @param {number | BigNumber | bigint | Array | Matrix} x First value to or\n * @param {number | BigNumber | bigint | Array | Matrix} y Second value to or\n * @return {number | BigNumber | bigint | Array | Matrix} OR of `x` and `y`\n */\n return typed(\n name,\n {\n 'number, number': bitOrNumber,\n 'BigNumber, BigNumber': bitOrBigNumber,\n 'bigint, bigint': (x, y) => x | y\n },\n matrixAlgorithmSuite({\n SS: matAlgo04xSidSid,\n DS: matAlgo01xDSid,\n Ss: matAlgo10xSids\n })\n )\n})\n","import { factory } from '../../../utils/factory.js'\nimport { DimensionError } from '../../../error/DimensionError.js'\n\nconst name = 'matAlgo07xSSf'\nconst dependencies = ['typed', 'SparseMatrix']\n\nexport const createMatAlgo07xSSf = /* #__PURE__ */ factory(name, dependencies, ({ typed, SparseMatrix }) => {\n /**\n * Iterates over SparseMatrix A and SparseMatrix B items (zero and nonzero) and invokes the callback function f(Aij, Bij).\n * Callback function invoked MxN times.\n *\n * C(i,j) = f(Aij, Bij)\n *\n * @param {Matrix} a The SparseMatrix instance (A)\n * @param {Matrix} b The SparseMatrix instance (B)\n * @param {Function} callback The f(Aij,Bij) operation to invoke\n *\n * @return {Matrix} SparseMatrix (C)\n *\n * see https://github.com/josdejong/mathjs/pull/346#issuecomment-97620294\n */\n return function matAlgo07xSSf (a, b, callback) {\n // sparse matrix arrays\n const asize = a._size\n const adt = a._datatype || a._data === undefined ? a._datatype : a.getDataType()\n const bsize = b._size\n const bdt = b._datatype || b._data === undefined ? b._datatype : b.getDataType()\n\n // validate dimensions\n if (asize.length !== bsize.length) { throw new DimensionError(asize.length, bsize.length) }\n if (asize[0] !== bsize[0] || asize[1] !== bsize[1]) { throw new RangeError('Dimension mismatch. Matrix A (' + asize + ') must match Matrix B (' + bsize + ')') }\n\n // rows & columns\n const rows = asize[0]\n const columns = asize[1]\n\n // datatype\n let dt\n let zero = 0\n let cf = callback\n\n // process data types\n if (typeof adt === 'string' && adt === bdt && adt !== 'mixed') {\n dt = adt\n zero = typed.convert(0, dt)\n cf = typed.find(callback, [dt, dt])\n }\n\n // result arrays for sparse format\n const cvalues = []\n const cindex = []\n const cptr = new Array(columns + 1).fill(0) // Start with column pointer array\n\n // workspaces\n const xa = []\n const xb = []\n const wa = []\n const wb = []\n\n // loop columns\n for (let j = 0; j < columns; j++) {\n const mark = j + 1\n let nonZeroCount = 0\n\n _scatter(a, j, wa, xa, mark)\n _scatter(b, j, wb, xb, mark)\n\n // loop rows\n for (let i = 0; i < rows; i++) {\n const va = wa[i] === mark ? xa[i] : zero\n const vb = wb[i] === mark ? xb[i] : zero\n\n // invoke callback\n const cij = cf(va, vb)\n // Store all non zero and true values\n if (cij !== 0 && cij !== false) {\n cindex.push(i) // row index\n cvalues.push(cij) // computed value\n nonZeroCount++\n }\n }\n\n // Update column pointer with cumulative count of non-zero values\n cptr[j + 1] = cptr[j] + nonZeroCount\n }\n\n // Return the result as a sparse matrix\n return new SparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [rows, columns],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n })\n }\n\n function _scatter (m, j, w, x, mark) {\n // a arrays\n const values = m._values\n const index = m._index\n const ptr = m._ptr\n // loop values in column j\n for (let k = ptr[j], k1 = ptr[j + 1]; k < k1; k++) {\n // row\n const i = index[k]\n // update workspace\n w[i] = mark\n x[i] = values[k]\n }\n }\n})\n","import { bitXor as bigBitXor } from '../../utils/bignumber/bitwise.js'\nimport { createMatAlgo03xDSf } from '../../type/matrix/utils/matAlgo03xDSf.js'\nimport { createMatAlgo07xSSf } from '../../type/matrix/utils/matAlgo07xSSf.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { factory } from '../../utils/factory.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\nimport { bitXorNumber } from '../../plain/number/index.js'\n\nconst name = 'bitXor'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'DenseMatrix',\n 'concat',\n 'SparseMatrix'\n]\n\nexport const createBitXor = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, DenseMatrix, concat, SparseMatrix }) => {\n const matAlgo03xDSf = createMatAlgo03xDSf({ typed })\n const matAlgo07xSSf = createMatAlgo07xSSf({ typed, SparseMatrix })\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n /**\n * Bitwise XOR two values, `x ^ y`.\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.bitXor(x, y)\n *\n * Examples:\n *\n * math.bitXor(1, 2) // returns number 3\n *\n * math.bitXor([2, 3, 4], 4) // returns Array [6, 7, 0]\n *\n * See also:\n *\n * bitAnd, bitNot, bitOr, leftShift, rightArithShift, rightLogShift\n *\n * @param {number | BigNumber | bigint | Array | Matrix} x First value to xor\n * @param {number | BigNumber | bigint | Array | Matrix} y Second value to xor\n * @return {number | BigNumber | bigint | Array | Matrix} XOR of `x` and `y`\n */\n return typed(\n name,\n {\n 'number, number': bitXorNumber,\n 'BigNumber, BigNumber': bigBitXor,\n 'bigint, bigint': (x, y) => x ^ y\n },\n matrixAlgorithmSuite({\n SS: matAlgo07xSSf,\n DS: matAlgo03xDSf,\n Ss: matAlgo12xSfs\n })\n )\n})\n","import { factory } from '../../utils/factory.js'\nimport { deepMap } from '../../utils/collection.js'\n\nconst name = 'arg'\nconst dependencies = ['typed']\n\nexport const createArg = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Compute the argument of a complex value.\n * For a complex number `a + bi`, the argument is computed as `atan2(b, a)`.\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.arg(x)\n *\n * Examples:\n *\n * const a = math.complex(2, 2)\n * math.arg(a) / math.pi // returns number 0.25\n *\n * const b = math.complex('2 + 3i')\n * math.arg(b) // returns number 0.982793723247329\n * math.atan2(3, 2) // returns number 0.982793723247329\n *\n * See also:\n *\n * re, im, conj, abs\n *\n * @param {number | BigNumber | Complex | Array | Matrix} x\n * A complex number or array with complex numbers\n * @return {number | BigNumber | Array | Matrix} The argument of x\n */\n return typed(name, {\n number: function (x) {\n return Math.atan2(0, x)\n },\n\n BigNumber: function (x) {\n return x.constructor.atan2(0, x)\n },\n\n Complex: function (x) {\n return x.arg()\n },\n\n // TODO: implement BigNumber support for function arg\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { deepMap } from '../../utils/collection.js'\n\nconst name = 'conj'\nconst dependencies = ['typed']\n\nexport const createConj = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Compute the complex conjugate of a complex value.\n * If `x = a+bi`, the complex conjugate of `x` is `a - bi`.\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.conj(x)\n *\n * Examples:\n *\n * math.conj(math.complex('2 + 3i')) // returns Complex 2 - 3i\n * math.conj(math.complex('2 - 3i')) // returns Complex 2 + 3i\n * math.conj(math.complex('-5.2i')) // returns Complex 5.2i\n *\n * See also:\n *\n * re, im, arg, abs\n *\n * @param {number | BigNumber | Complex | Array | Matrix | Unit} x\n * A complex number or array with complex numbers\n * @return {number | BigNumber | Complex | Array | Matrix | Unit}\n * The complex conjugate of x\n */\n return typed(name, {\n 'number | BigNumber | Fraction': x => x,\n Complex: x => x.conjugate(),\n Unit: typed.referToSelf(self => x => new x.constructor(self(x.toNumeric()), x.formatUnits())),\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { deepMap } from '../../utils/collection.js'\n\nconst name = 'im'\nconst dependencies = ['typed']\n\nexport const createIm = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Get the imaginary part of a complex number.\n * For a complex number `a + bi`, the function returns `b`.\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.im(x)\n *\n * Examples:\n *\n * const a = math.complex(2, 3)\n * math.re(a) // returns number 2\n * math.im(a) // returns number 3\n *\n * math.re(math.complex('-5.2i')) // returns number -5.2\n * math.re(math.complex(2.4)) // returns number 0\n *\n * See also:\n *\n * re, conj, abs, arg\n *\n * @param {number | BigNumber | Complex | Array | Matrix} x\n * A complex number or array with complex numbers\n * @return {number | BigNumber | Array | Matrix} The imaginary part of x\n */\n return typed(name, {\n number: () => 0,\n 'BigNumber | Fraction': x => x.mul(0),\n Complex: x => x.im,\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { deepMap } from '../../utils/collection.js'\n\nconst name = 're'\nconst dependencies = ['typed']\n\nexport const createRe = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Get the real part of a complex number.\n * For a complex number `a + bi`, the function returns `a`.\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.re(x)\n *\n * Examples:\n *\n * const a = math.complex(2, 3)\n * math.re(a) // returns number 2\n * math.im(a) // returns number 3\n *\n * math.re(math.complex('-5.2i')) // returns number 0\n * math.re(math.complex(2.4)) // returns number 2.4\n *\n * See also:\n *\n * im, conj, abs, arg\n *\n * @param {number | BigNumber | Complex | Array | Matrix} x\n * A complex number or array with complex numbers\n * @return {number | BigNumber | Array | Matrix} The real part of x\n */\n return typed(name, {\n 'number | BigNumber | Fraction': x => x,\n Complex: x => x.re,\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","const n1 = 'number'\nconst n2 = 'number, number'\n\nexport function notNumber (x) {\n return !x\n}\nnotNumber.signature = n1\n\nexport function orNumber (x, y) {\n return !!(x || y)\n}\norNumber.signature = n2\n\nexport function xorNumber (x, y) {\n return !!x !== !!y\n}\nxorNumber.signature = n2\n\nexport function andNumber (x, y) {\n return !!(x && y)\n}\nandNumber.signature = n2\n","import { deepMap } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\nimport { notNumber } from '../../plain/number/index.js'\n\nconst name = 'not'\nconst dependencies = ['typed']\n\nexport const createNot = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Logical `not`. Flips boolean value of a given parameter.\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.not(x)\n *\n * Examples:\n *\n * math.not(2) // returns false\n * math.not(0) // returns true\n * math.not(true) // returns false\n *\n * a = [2, -7, 0]\n * math.not(a) // returns [false, false, true]\n *\n * See also:\n *\n * and, or, xor\n *\n * @param {number | BigNumber | bigint | Complex | Unit | Array | Matrix} x First value to check\n * @return {boolean | Array | Matrix}\n * Returns true when input is a zero or empty value.\n */\n return typed(name, {\n 'null | undefined': () => true,\n\n number: notNumber,\n\n Complex: function (x) {\n return x.re === 0 && x.im === 0\n },\n\n BigNumber: function (x) {\n return x.isZero() || x.isNaN()\n },\n\n bigint: x => !x,\n\n Unit: typed.referToSelf(self => x => typed.find(self, x.valueType())(x.value)),\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","import { createMatAlgo03xDSf } from '../../type/matrix/utils/matAlgo03xDSf.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { createMatAlgo05xSfSf } from '../../type/matrix/utils/matAlgo05xSfSf.js'\nimport { factory } from '../../utils/factory.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\nimport { orNumber } from '../../plain/number/index.js'\n\nconst name = 'or'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'equalScalar',\n 'DenseMatrix',\n 'concat'\n]\n\nexport const createOr = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, DenseMatrix, concat }) => {\n const matAlgo03xDSf = createMatAlgo03xDSf({ typed })\n const matAlgo05xSfSf = createMatAlgo05xSfSf({ typed, equalScalar })\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n /**\n * Logical `or`. Test if at least one value is defined with a nonzero/nonempty value.\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.or(x, y)\n *\n * Examples:\n *\n * math.or(2, 4) // returns true\n *\n * a = [2, 5, 0]\n * b = [0, 22, 0]\n * c = 0\n *\n * math.or(a, b) // returns [true, true, false]\n * math.or(b, c) // returns [false, true, false]\n *\n * See also:\n *\n * and, not, xor\n *\n * @param {number | BigNumber | bigint | Complex | Unit | Array | Matrix} x First value to check\n * @param {number | BigNumber | bigint | Complex | Unit | Array | Matrix} y Second value to check\n * @return {boolean | Array | Matrix}\n * Returns true when one of the inputs is defined with a nonzero/nonempty value.\n */\n return typed(\n name,\n {\n 'number, number': orNumber,\n\n 'Complex, Complex': function (x, y) {\n return (x.re !== 0 || x.im !== 0) || (y.re !== 0 || y.im !== 0)\n },\n\n 'BigNumber, BigNumber': function (x, y) {\n return (!x.isZero() && !x.isNaN()) || (!y.isZero() && !y.isNaN())\n },\n\n 'bigint, bigint': orNumber,\n\n 'Unit, Unit': typed.referToSelf(self =>\n (x, y) => self(x.value || 0, y.value || 0))\n },\n matrixAlgorithmSuite({\n SS: matAlgo05xSfSf,\n DS: matAlgo03xDSf,\n Ss: matAlgo12xSfs\n })\n )\n})\n","import { createMatAlgo03xDSf } from '../../type/matrix/utils/matAlgo03xDSf.js'\nimport { createMatAlgo07xSSf } from '../../type/matrix/utils/matAlgo07xSSf.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { factory } from '../../utils/factory.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\nimport { xorNumber } from '../../plain/number/index.js'\n\nconst name = 'xor'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'DenseMatrix',\n 'concat',\n 'SparseMatrix'\n]\n\nexport const createXor = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, DenseMatrix, concat, SparseMatrix }) => {\n const matAlgo03xDSf = createMatAlgo03xDSf({ typed })\n const matAlgo07xSSf = createMatAlgo07xSSf({ typed, SparseMatrix })\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n /**\n * Logical `xor`. Test whether one and only one value is defined with a nonzero/nonempty value.\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.xor(x, y)\n *\n * Examples:\n *\n * math.xor(2, 4) // returns false\n *\n * a = [2, 0, 0]\n * b = [2, 7, 0]\n * c = 0\n *\n * math.xor(a, b) // returns [false, true, false]\n * math.xor(a, c) // returns [true, false, false]\n *\n * See also:\n *\n * and, not, or\n *\n * @param {number | BigNumber | bigint | Complex | Unit | Array | Matrix} x First value to check\n * @param {number | BigNumber | bigint | Complex | Unit | Array | Matrix} y Second value to check\n * @return {boolean | Array | Matrix}\n * Returns true when one and only one input is defined with a nonzero/nonempty value.\n */\n return typed(\n name,\n {\n 'number, number': xorNumber,\n\n 'Complex, Complex': function (x, y) {\n return ((x.re !== 0 || x.im !== 0) !== (y.re !== 0 || y.im !== 0))\n },\n\n 'bigint, bigint': xorNumber,\n\n 'BigNumber, BigNumber': function (x, y) {\n return ((!x.isZero() && !x.isNaN()) !== (!y.isZero() && !y.isNaN()))\n },\n\n 'Unit, Unit': typed.referToSelf(self =>\n (x, y) => self(x.value || 0, y.value || 0))\n },\n matrixAlgorithmSuite({\n SS: matAlgo07xSSf,\n DS: matAlgo03xDSf,\n Ss: matAlgo12xSfs\n })\n )\n})\n","import { isBigNumber, isMatrix, isNumber } from '../../utils/is.js'\nimport { clone } from '../../utils/object.js'\nimport { arraySize, concat as _concat } from '../../utils/array.js'\nimport { IndexError } from '../../error/IndexError.js'\nimport { DimensionError } from '../../error/DimensionError.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'concat'\nconst dependencies = ['typed', 'matrix', 'isInteger']\n\nexport const createConcat = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, isInteger }) => {\n /**\n * Concatenate two or more matrices.\n *\n * Syntax:\n *\n * math.concat(A, B, C, ...)\n * math.concat(A, B, C, ..., dim)\n *\n * Where:\n *\n * - `dim: number` is a zero-based dimension over which to concatenate the matrices.\n * By default the last dimension of the matrices.\n *\n * Examples:\n *\n * const A = [[1, 2], [5, 6]]\n * const B = [[3, 4], [7, 8]]\n *\n * math.concat(A, B) // returns [[1, 2, 3, 4], [5, 6, 7, 8]]\n * math.concat(A, B, 0) // returns [[1, 2], [5, 6], [3, 4], [7, 8]]\n * math.concat('hello', ' ', 'world') // returns 'hello world'\n *\n * See also:\n *\n * size, squeeze, subset, transpose\n *\n * @param {... Array | Matrix} args Two or more matrices\n * @return {Array | Matrix} Concatenated matrix\n */\n return typed(name, {\n // TODO: change signature to '...Array | Matrix, dim?' when supported\n '...Array | Matrix | number | BigNumber': function (args) {\n let i\n const len = args.length\n let dim = -1 // zero-based dimension\n let prevDim\n let asMatrix = false\n const matrices = [] // contains multi dimensional arrays\n\n for (i = 0; i < len; i++) {\n const arg = args[i]\n\n // test whether we need to return a Matrix (if not we return an Array)\n if (isMatrix(arg)) {\n asMatrix = true\n }\n\n if (isNumber(arg) || isBigNumber(arg)) {\n if (i !== len - 1) {\n throw new Error('Dimension must be specified as last argument')\n }\n\n // last argument contains the dimension on which to concatenate\n prevDim = dim\n dim = arg.valueOf() // change BigNumber to number\n\n if (!isInteger(dim)) {\n throw new TypeError('Integer number expected for dimension')\n }\n\n if (dim < 0 || (i > 0 && dim > prevDim)) {\n // TODO: would be more clear when throwing a DimensionError here\n throw new IndexError(dim, prevDim + 1)\n }\n } else {\n // this is a matrix or array\n const m = clone(arg).valueOf()\n const size = arraySize(m)\n matrices[i] = m\n prevDim = dim\n dim = size.length - 1\n\n // verify whether each of the matrices has the same number of dimensions\n if (i > 0 && dim !== prevDim) {\n throw new DimensionError(prevDim + 1, dim + 1)\n }\n }\n }\n\n if (matrices.length === 0) {\n throw new SyntaxError('At least one matrix expected')\n }\n\n let res = matrices.shift()\n while (matrices.length) {\n res = _concat(res, matrices.shift(), dim)\n }\n\n return asMatrix ? matrix(res) : res\n },\n\n '...string': function (args) {\n return args.join('')\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { isMatrix } from '../../utils/is.js'\nimport { clone } from '../../utils/object.js'\nimport { validateIndex } from '../../utils/array.js'\n\nconst name = 'column'\nconst dependencies = ['typed', 'Index', 'matrix', 'range']\n\nexport const createColumn = /* #__PURE__ */ factory(name, dependencies, ({ typed, Index, matrix, range }) => {\n /**\n * Return a column from a Matrix.\n *\n * Syntax:\n *\n * math.column(value, index)\n *\n * Example:\n *\n * // get a column\n * const d = [[1, 2], [3, 4]]\n * math.column(d, 1) // returns [[2], [4]]\n *\n * See also:\n *\n * row\n *\n * @param {Array | Matrix } value An array or matrix\n * @param {number} column The index of the column\n * @return {Array | Matrix} The retrieved column\n */\n return typed(name, {\n 'Matrix, number': _column,\n\n 'Array, number': function (value, column) {\n return _column(matrix(clone(value)), column).valueOf()\n }\n })\n\n /**\n * Retrieve a column of a matrix\n * @param {Matrix } value A matrix\n * @param {number} column The index of the column\n * @return {Matrix} The retrieved column\n */\n function _column (value, column) {\n // check dimensions\n if (value.size().length !== 2) {\n throw new Error('Only two dimensional matrix is supported')\n }\n\n validateIndex(column, value.size()[1])\n\n const rowRange = range(0, value.size()[0])\n const index = new Index(rowRange, column)\n const result = value.subset(index)\n return isMatrix(result)\n ? result\n : matrix([[result]])\n }\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'count'\nconst dependencies = ['typed', 'size', 'prod']\n\nexport const createCount = /* #__PURE__ */ factory(name, dependencies, ({ typed, size, prod }) => {\n /**\n * Count the number of elements of a matrix, array or string.\n *\n * Syntax:\n *\n * math.count(x)\n *\n * Examples:\n *\n * math.count('hello world') // returns 11\n * const A = [[1, 2, 3], [4, 5, 6]]\n * math.count(A) // returns 6\n * math.count(math.range(1,6)) // returns 5\n *\n * See also:\n *\n * size\n *\n * @param {string | Array | Matrix} x A matrix or string\n * @return {number} An integer with the elements in `x`.\n */\n return typed(name, {\n string: function (x) {\n return x.length\n },\n\n 'Matrix | Array': function (x) {\n return prod(size(x))\n }\n })\n})\n","import { arraySize, squeeze } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'cross'\nconst dependencies = ['typed', 'matrix', 'subtract', 'multiply']\n\nexport const createCross = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, subtract, multiply }) => {\n /**\n * Calculate the cross product for two vectors in three dimensional space.\n * The cross product of `A = [a1, a2, a3]` and `B = [b1, b2, b3]` is defined\n * as:\n *\n * cross(A, B) = [\n * a2 * b3 - a3 * b2,\n * a3 * b1 - a1 * b3,\n * a1 * b2 - a2 * b1\n * ]\n *\n * If one of the input vectors has a dimension greater than 1, the output\n * vector will be a 1x3 (2-dimensional) matrix.\n *\n * Syntax:\n *\n * math.cross(x, y)\n *\n * Examples:\n *\n * math.cross([1, 1, 0], [0, 1, 1]) // Returns [1, -1, 1]\n * math.cross([3, -3, 1], [4, 9, 2]) // Returns [-15, -2, 39]\n * math.cross([2, 3, 4], [5, 6, 7]) // Returns [-3, 6, -3]\n * math.cross([[1, 2, 3]], [[4], [5], [6]]) // Returns [[-3, 6, -3]]\n *\n * See also:\n *\n * dot, multiply\n *\n * @param {Array | Matrix} x First vector\n * @param {Array | Matrix} y Second vector\n * @return {Array | Matrix} Returns the cross product of `x` and `y`\n */\n return typed(name, {\n 'Matrix, Matrix': function (x, y) {\n return matrix(_cross(x.toArray(), y.toArray()))\n },\n\n 'Matrix, Array': function (x, y) {\n return matrix(_cross(x.toArray(), y))\n },\n\n 'Array, Matrix': function (x, y) {\n return matrix(_cross(x, y.toArray()))\n },\n\n 'Array, Array': _cross\n })\n\n /**\n * Calculate the cross product for two arrays\n * @param {Array} x First vector\n * @param {Array} y Second vector\n * @returns {Array} Returns the cross product of x and y\n * @private\n */\n function _cross (x, y) {\n const highestDimension = Math.max(arraySize(x).length, arraySize(y).length)\n\n x = squeeze(x)\n y = squeeze(y)\n\n const xSize = arraySize(x)\n const ySize = arraySize(y)\n\n if (xSize.length !== 1 || ySize.length !== 1 || xSize[0] !== 3 || ySize[0] !== 3) {\n throw new RangeError('Vectors with length 3 expected ' +\n '(Size A = [' + xSize.join(', ') + '], B = [' + ySize.join(', ') + '])')\n }\n\n const product = [\n subtract(multiply(x[1], y[2]), multiply(x[2], y[1])),\n subtract(multiply(x[2], y[0]), multiply(x[0], y[2])),\n subtract(multiply(x[0], y[1]), multiply(x[1], y[0]))\n ]\n\n if (highestDimension > 1) {\n return [product]\n } else {\n return product\n }\n }\n})\n","import { isMatrix } from '../../utils/is.js'\nimport { arraySize } from '../../utils/array.js'\nimport { isInteger } from '../../utils/number.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'diag'\nconst dependencies = ['typed', 'matrix', 'DenseMatrix', 'SparseMatrix']\n\nexport const createDiag = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, DenseMatrix, SparseMatrix }) => {\n /**\n * Create a diagonal matrix or retrieve the diagonal of a matrix\n *\n * When `x` is a vector, a matrix with vector `x` on the diagonal will be returned.\n * When `x` is a two dimensional matrix, the matrixes `k`th diagonal will be returned as vector.\n * When k is positive, the values are placed on the super diagonal.\n * When k is negative, the values are placed on the sub diagonal.\n *\n * Syntax:\n *\n * math.diag(X)\n * math.diag(X, format)\n * math.diag(X, k)\n * math.diag(X, k, format)\n *\n * Examples:\n *\n * // create a diagonal matrix\n * math.diag([1, 2, 3]) // returns [[1, 0, 0], [0, 2, 0], [0, 0, 3]]\n * math.diag([1, 2, 3], 1) // returns [[0, 1, 0, 0], [0, 0, 2, 0], [0, 0, 0, 3]]\n * math.diag([1, 2, 3], -1) // returns [[0, 0, 0], [1, 0, 0], [0, 2, 0], [0, 0, 3]]\n *\n * // retrieve the diagonal from a matrix\n * const a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\n * math.diag(a) // returns [1, 5, 9]\n *\n * See also:\n *\n * ones, zeros, identity\n *\n * @param {Matrix | Array} x A two dimensional matrix or a vector\n * @param {number | BigNumber} [k=0] The diagonal where the vector will be filled\n * in or retrieved.\n * @param {string} [format='dense'] The matrix storage format.\n *\n * @returns {Matrix | Array} Diagonal matrix from input vector, or diagonal from input matrix.\n */\n return typed(name, {\n // FIXME: simplify this huge amount of signatures as soon as typed-function supports optional arguments\n\n Array: function (x) {\n return _diag(x, 0, arraySize(x), null)\n },\n\n 'Array, number': function (x, k) {\n return _diag(x, k, arraySize(x), null)\n },\n\n 'Array, BigNumber': function (x, k) {\n return _diag(x, k.toNumber(), arraySize(x), null)\n },\n\n 'Array, string': function (x, format) {\n return _diag(x, 0, arraySize(x), format)\n },\n\n 'Array, number, string': function (x, k, format) {\n return _diag(x, k, arraySize(x), format)\n },\n\n 'Array, BigNumber, string': function (x, k, format) {\n return _diag(x, k.toNumber(), arraySize(x), format)\n },\n\n Matrix: function (x) {\n return _diag(x, 0, x.size(), x.storage())\n },\n\n 'Matrix, number': function (x, k) {\n return _diag(x, k, x.size(), x.storage())\n },\n\n 'Matrix, BigNumber': function (x, k) {\n return _diag(x, k.toNumber(), x.size(), x.storage())\n },\n\n 'Matrix, string': function (x, format) {\n return _diag(x, 0, x.size(), format)\n },\n\n 'Matrix, number, string': function (x, k, format) {\n return _diag(x, k, x.size(), format)\n },\n\n 'Matrix, BigNumber, string': function (x, k, format) {\n return _diag(x, k.toNumber(), x.size(), format)\n }\n })\n\n /**\n * Creeate diagonal matrix from a vector or vice versa\n * @param {Array | Matrix} x\n * @param {number} k\n * @param {string} format Storage format for matrix. If null,\n * an Array is returned\n * @returns {Array | Matrix}\n * @private\n */\n function _diag (x, k, size, format) {\n if (!isInteger(k)) {\n throw new TypeError('Second parameter in function diag must be an integer')\n }\n\n const kSuper = k > 0 ? k : 0\n const kSub = k < 0 ? -k : 0\n\n // check dimensions\n switch (size.length) {\n case 1:\n return _createDiagonalMatrix(x, k, format, size[0], kSub, kSuper)\n case 2:\n return _getDiagonal(x, k, format, size, kSub, kSuper)\n }\n throw new RangeError('Matrix for function diag must be 2 dimensional')\n }\n\n function _createDiagonalMatrix (x, k, format, l, kSub, kSuper) {\n // matrix size\n const ms = [l + kSub, l + kSuper]\n\n if (format && format !== 'sparse' && format !== 'dense') {\n throw new TypeError(`Unknown matrix type ${format}\"`)\n }\n\n // create diagonal matrix\n const m = format === 'sparse'\n ? SparseMatrix.diagonal(ms, x, k)\n : DenseMatrix.diagonal(ms, x, k)\n // check we need to return a matrix\n return format !== null ? m : m.valueOf()\n }\n\n function _getDiagonal (x, k, format, s, kSub, kSuper) {\n // check x is a Matrix\n if (isMatrix(x)) {\n // get diagonal matrix\n const dm = x.diagonal(k)\n // check we need to return a matrix\n if (format !== null) {\n // check we need to change matrix format\n if (format !== dm.storage()) { return matrix(dm, format) }\n return dm\n }\n return dm.valueOf()\n }\n // vector size\n const n = Math.min(s[0] - kSub, s[1] - kSuper)\n // diagonal values\n const vector = []\n // loop diagonal\n for (let i = 0; i < n; i++) {\n vector[i] = x[i + kSub][i + kSuper]\n }\n // check we need to return a matrix\n return format !== null ? matrix(vector) : vector\n }\n})\n","import { optimizeCallback } from '../../utils/optimizeCallback.js'\nimport { filter, filterRegExp } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'filter'\nconst dependencies = ['typed']\n\nexport const createFilter = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Filter the items in an array or one dimensional matrix.\n *\n * The callback is invoked with three arguments: the current value,\n * the current index, and the matrix operated upon.\n * Note that because the matrix/array might be\n * multidimensional, the \"index\" argument is always an array of numbers giving\n * the index in each dimension. This is true even for vectors: the \"index\"\n * argument is an array of length 1, rather than simply a number.\n *\n * Syntax:\n *\n * math.filter(x, test)\n *\n * Examples:\n *\n * function isPositive (x) {\n * return x > 0\n * }\n * math.filter([6, -2, -1, 4, 3], isPositive) // returns [6, 4, 3]\n *\n * math.filter([\"23\", \"foo\", \"100\", \"55\", \"bar\"], /[0-9]+/) // returns [\"23\", \"100\", \"55\"]\n *\n * See also:\n *\n * forEach, map, sort\n *\n * @param {Matrix | Array} x A one dimensional matrix or array to filter\n * @param {Function | RegExp} test\n * A function or regular expression to test items.\n * All entries for which `test` returns true are returned.\n * When `test` is a function, it is invoked with three parameters:\n * the value of the element, the index of the element, and the\n * matrix/array being traversed. The function must return a boolean.\n * @return {Matrix | Array} Returns the filtered matrix.\n */\n return typed('filter', {\n 'Array, function': _filterCallback,\n\n 'Matrix, function': function (x, test) {\n return x.create(_filterCallback(x.valueOf(), test), x.datatype())\n },\n\n 'Array, RegExp': filterRegExp,\n\n 'Matrix, RegExp': function (x, test) {\n return x.create(filterRegExp(x.valueOf(), test), x.datatype())\n }\n })\n})\n\n/**\n * Filter values in a callback given a callback function\n * @param {Array} x\n * @param {Function} callback\n * @return {Array} Returns the filtered array\n * @private\n */\nfunction _filterCallback (x, callback) {\n const fastCallback = optimizeCallback(callback, x, 'filter')\n if (fastCallback.isUnary) {\n return filter(x, fastCallback.fn)\n }\n return filter(x, function (value, index, array) {\n // invoke the callback function with the right number of arguments\n return fastCallback.fn(value, [index], array)\n })\n}\n","import { flatten as flattenArray } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'flatten'\nconst dependencies = ['typed']\n\nexport const createFlatten = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Flatten a multidimensional matrix into a single dimensional matrix.\n * A new matrix is returned, the original matrix is left untouched.\n *\n * Syntax:\n *\n * math.flatten(x)\n *\n * Examples:\n *\n * math.flatten([[1,2], [3,4]]) // returns [1, 2, 3, 4]\n *\n * See also:\n *\n * concat, resize, size, squeeze\n *\n * @param {Matrix | Array} x Matrix to be flattened\n * @return {Matrix | Array} Returns the flattened matrix\n */\n return typed(name, {\n Array: function (x) {\n return flattenArray(x)\n },\n\n Matrix: function (x) {\n // Return the same matrix type as x (Dense or Sparse Matrix)\n // Return the same data type as x\n return x.create(flattenArray(x.valueOf(), true), x.datatype())\n }\n })\n})\n","import { optimizeCallback } from '../../utils/optimizeCallback.js'\nimport { factory } from '../../utils/factory.js'\nimport { deepForEach } from '../../utils/array.js'\n\nconst name = 'forEach'\nconst dependencies = ['typed']\n\nexport const createForEach = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Iterate over all elements of a matrix/array, and executes the given callback function.\n *\n * The callback is invoked with three arguments: the current value,\n * the current index, and the matrix operated upon.\n * Note that because the matrix/array might be\n * multidimensional, the \"index\" argument is always an array of numbers giving\n * the index in each dimension. This is true even for vectors: the \"index\"\n * argument is an array of length 1, rather than simply a number.\n *\n * Syntax:\n *\n * math.forEach(x, callback)\n *\n * Examples:\n *\n * math.forEach([1, 2, 3], function(value) {\n * console.log(value)\n * })\n * // outputs 1, 2, 3\n *\n * See also:\n *\n * filter, map, sort\n *\n * @param {Matrix | Array} x The matrix to iterate on.\n * @param {Function} callback The callback function is invoked with three\n * parameters: the value of the element, the index\n * of the element, and the Matrix/array being traversed.\n */\n return typed(name, {\n 'Array, function': _forEach,\n\n 'Matrix, function': function (x, callback) {\n x.forEach(callback)\n }\n })\n})\n\n/**\n * forEach for a multidimensional array\n * @param {Array} array\n * @param {Function} callback\n * @private\n */\nfunction _forEach (array, callback) {\n const fastCallback = optimizeCallback(callback, array, name)\n deepForEach(array, fastCallback.fn, fastCallback.isUnary)\n}\n","import { factory } from '../../utils/factory.js'\nimport { getArrayDataType } from '../../utils/array.js'\nimport { typeOf } from '../../utils/is.js'\n\nconst name = 'getMatrixDataType'\nconst dependencies = ['typed']\n\nexport const createGetMatrixDataType = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Find the data type of all elements in a matrix or array,\n * for example 'number' if all items are a number and 'Complex' if all values\n * are complex numbers.\n * If a matrix contains more than one data type, it will return 'mixed'.\n *\n * Syntax:\n *\n * math.getMatrixDataType(x)\n *\n * Examples:\n *\n * const x = [ [1, 2, 3], [4, 5, 6] ]\n * const mixedX = [ [1, true], [2, 3] ]\n * const fractionX = [ [math.fraction(1, 3)], [math.fraction(1, 3)] ]\n * const unitX = [ [math.unit('5cm')], [math.unit('5cm')] ]\n * const bigNumberX = [ [math.bignumber(1)], [math.bignumber(0)] ]\n * const sparse = math.sparse(x)\n * const dense = math.matrix(x)\n * math.getMatrixDataType(x) // returns 'number'\n * math.getMatrixDataType(sparse) // returns 'number'\n * math.getMatrixDataType(dense) // returns 'number'\n * math.getMatrixDataType(mixedX) // returns 'mixed'\n * math.getMatrixDataType(fractionX) // returns 'Fraction'\n * math.getMatrixDataType(unitX) // returns 'Unit'\n * math.getMatrixDataType(bigNumberX) // return 'BigNumber'\n *\n * See also:\n * SparseMatrix, DenseMatrix\n *\n * @param {...Matrix | Array} x The Matrix with values.\n *\n * @return {string} A string representation of the matrix type\n */\n return typed(name, {\n Array: function (x) {\n return getArrayDataType(x, typeOf)\n },\n Matrix: function (x) {\n return x.getDataType()\n }\n })\n})\n","import { isBigNumber } from '../../utils/is.js'\nimport { resize } from '../../utils/array.js'\nimport { isInteger } from '../../utils/number.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'identity'\nconst dependencies = [\n 'typed',\n 'config',\n 'matrix',\n 'BigNumber',\n 'DenseMatrix',\n 'SparseMatrix'\n]\n\nexport const createIdentity = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, matrix, BigNumber, DenseMatrix, SparseMatrix }) => {\n /**\n * Create a 2-dimensional identity matrix with size m x n or n x n.\n * The matrix has ones on the diagonal and zeros elsewhere.\n *\n * Syntax:\n *\n * math.identity(n)\n * math.identity(n, format)\n * math.identity(m, n)\n * math.identity(m, n, format)\n * math.identity([m, n])\n * math.identity([m, n], format)\n *\n * Examples:\n *\n * math.identity(3) // returns [[1, 0, 0], [0, 1, 0], [0, 0, 1]]\n * math.identity(3, 2) // returns [[1, 0], [0, 1], [0, 0]]\n *\n * const A = [[1, 2, 3], [4, 5, 6]]\n * math.identity(math.size(A)) // returns [[1, 0, 0], [0, 1, 0]]\n *\n * See also:\n *\n * diag, ones, zeros, size, range\n *\n * @param {...number | Matrix | Array} size The size for the matrix\n * @param {string} [format] The Matrix storage format\n *\n * @return {Matrix | Array | number} A matrix with ones on the diagonal.\n */\n return typed(name, {\n '': function () {\n return (config.matrix === 'Matrix') ? matrix([]) : []\n },\n\n string: function (format) {\n return matrix(format)\n },\n\n 'number | BigNumber': function (rows) {\n return _identity(rows, rows, config.matrix === 'Matrix' ? 'dense' : undefined)\n },\n\n 'number | BigNumber, string': function (rows, format) {\n return _identity(rows, rows, format)\n },\n\n 'number | BigNumber, number | BigNumber': function (rows, cols) {\n return _identity(rows, cols, config.matrix === 'Matrix' ? 'dense' : undefined)\n },\n\n 'number | BigNumber, number | BigNumber, string': function (rows, cols, format) {\n return _identity(rows, cols, format)\n },\n\n Array: function (size) {\n return _identityVector(size)\n },\n\n 'Array, string': function (size, format) {\n return _identityVector(size, format)\n },\n\n Matrix: function (size) {\n return _identityVector(size.valueOf(), size.storage())\n },\n\n 'Matrix, string': function (size, format) {\n return _identityVector(size.valueOf(), format)\n }\n })\n\n function _identityVector (size, format) {\n switch (size.length) {\n case 0: return format ? matrix(format) : []\n case 1: return _identity(size[0], size[0], format)\n case 2: return _identity(size[0], size[1], format)\n default: throw new Error('Vector containing two values expected')\n }\n }\n\n /**\n * Create an identity matrix\n * @param {number | BigNumber} rows\n * @param {number | BigNumber} cols\n * @param {string} [format]\n * @returns {Matrix}\n * @private\n */\n function _identity (rows, cols, format) {\n // BigNumber constructor with the right precision\n const Big = (isBigNumber(rows) || isBigNumber(cols))\n ? BigNumber\n : null\n\n if (isBigNumber(rows)) rows = rows.toNumber()\n if (isBigNumber(cols)) cols = cols.toNumber()\n\n if (!isInteger(rows) || rows < 1) {\n throw new Error('Parameters in function identity must be positive integers')\n }\n if (!isInteger(cols) || cols < 1) {\n throw new Error('Parameters in function identity must be positive integers')\n }\n\n const one = Big ? new BigNumber(1) : 1\n const defaultValue = Big ? new Big(0) : 0\n const size = [rows, cols]\n\n // check we need to return a matrix\n if (format) {\n // create diagonal matrix (use optimized implementation for storage format)\n if (format === 'sparse') {\n return SparseMatrix.diagonal(size, one, 0, defaultValue)\n }\n if (format === 'dense') {\n return DenseMatrix.diagonal(size, one, 0, defaultValue)\n }\n throw new TypeError(`Unknown matrix type \"${format}\"`)\n }\n\n // create and resize array\n const res = resize([], size, defaultValue)\n // fill in ones on the diagonal\n const minimum = rows < cols ? rows : cols\n // fill diagonal\n for (let d = 0; d < minimum; d++) {\n res[d][d] = one\n }\n return res\n }\n})\n","import { arraySize as size } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'kron'\nconst dependencies = ['typed', 'matrix', 'multiplyScalar']\n\nexport const createKron = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, multiplyScalar }) => {\n /**\n * Calculates the Kronecker product of 2 matrices or vectors.\n *\n * NOTE: If a one dimensional vector / matrix is given, it will be\n * wrapped so its two dimensions.\n * See the examples.\n *\n * Syntax:\n *\n * math.kron(x, y)\n *\n * Examples:\n *\n * math.kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])\n * // returns [ [ 1, 2, 0, 0 ], [ 3, 4, 0, 0 ], [ 0, 0, 1, 2 ], [ 0, 0, 3, 4 ] ]\n *\n * math.kron([1,1], [2,3,4])\n * // returns [ [ 2, 3, 4, 2, 3, 4 ] ]\n *\n * See also:\n *\n * multiply, dot, cross\n *\n * @param {Array | Matrix} x First vector\n * @param {Array | Matrix} y Second vector\n * @return {Array | Matrix} Returns the Kronecker product of `x` and `y`\n */\n return typed(name, {\n 'Matrix, Matrix': function (x, y) {\n return matrix(_kron(x.toArray(), y.toArray()))\n },\n\n 'Matrix, Array': function (x, y) {\n return matrix(_kron(x.toArray(), y))\n },\n\n 'Array, Matrix': function (x, y) {\n return matrix(_kron(x, y.toArray()))\n },\n\n 'Array, Array': _kron\n })\n\n /**\n * Calculate the Kronecker product of two matrices / vectors\n * @param {Array} a First vector\n * @param {Array} b Second vector\n * @returns {Array} Returns the Kronecker product of x and y\n * @private\n */\n function _kron (a, b) {\n // Deal with the dimensions of the matricies.\n if (size(a).length === 1) {\n // Wrap it in a 2D Matrix\n a = [a]\n }\n if (size(b).length === 1) {\n // Wrap it in a 2D Matrix\n b = [b]\n }\n if (size(a).length > 2 || size(b).length > 2) {\n throw new RangeError('Vectors with dimensions greater then 2 are not supported expected ' +\n '(Size x = ' + JSON.stringify(a.length) + ', y = ' + JSON.stringify(b.length) + ')')\n }\n const t = []\n let r = []\n\n return a.map(function (a) {\n return b.map(function (b) {\n r = []\n t.push(r)\n return a.map(function (y) {\n return b.map(function (x) {\n return r.push(multiplyScalar(y, x))\n })\n })\n })\n }) && t\n }\n})\n","import { optimizeCallback } from '../../utils/optimizeCallback.js'\nimport { arraySize, broadcastSizes, broadcastTo, get, deepMap } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'map'\nconst dependencies = ['typed']\n\nexport const createMap = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Create a new matrix or array with the results of a callback function executed on\n * each entry of a given matrix/array.\n *\n * For each entry of the input,\n *\n * the callback is invoked with 2N + 1 arguments:\n * the N values of the entry, the index at which that entry occurs, and the N full\n * broadcasted matrix/array being traversed where N is the number of matrices being traversed.\n * Note that because the matrix/array might be\n * multidimensional, the \"index\" argument is always an array of numbers giving\n * the index in each dimension. This is true even for vectors: the \"index\"\n * argument is an array of length 1, rather than simply a number.\n *\n * Syntax:\n *\n * math.map(x, callback)\n * math.map(x, y, ..., callback)\n *\n * Examples:\n *\n * math.map([1, 2, 3], function(value) {\n * return value * value\n * }) // returns [1, 4, 9]\n * math.map([1, 2], [3, 4], function(a, b) {\n * return a + b\n * }) // returns [4, 6]\n *\n * // The callback is normally called with three arguments:\n * // callback(value, index, Array)\n * // If you want to call with only one argument, use:\n * math.map([1, 2, 3], x => math.format(x)) // returns ['1', '2', '3']\n * // It can also be called with 2N + 1 arguments: for N arrays\n * // callback(value1, value2, index, BroadcastedArray1, BroadcastedArray2)\n *\n * See also:\n *\n * filter, forEach, sort\n *\n * @param {Matrix | Array} x The input to iterate on.\n * @param {Function} callback\n * The function to call (as described above) on each entry of the input\n * @return {Matrix | array}\n * Transformed map of x; always has the same type and shape as x\n */\n return typed(name, {\n 'Array, function': _mapArray,\n\n 'Matrix, function': function (x, callback) {\n return x.map(callback)\n },\n\n 'Array|Matrix, Array|Matrix, ...Array|Matrix|function': (A, B, rest) =>\n _mapMultiple([A, B, ...rest.slice(0, rest.length - 1)], rest[rest.length - 1])\n })\n\n /**\n * Maps over multiple arrays or matrices.\n *\n * @param {Array} Arrays - An array of arrays or matrices to map over.\n * @param {function} multiCallback - The callback function to apply to each element.\n * @throws {Error} If the last argument is not a callback function.\n * @returns {Array|Matrix} A new array or matrix with each element being the result of the callback function.\n *\n * @example\n * _mapMultiple([[1, 2, 3], [4, 5, 6]], (a, b) => a + b); // Returns [5, 7, 9]\n */\n function _mapMultiple (Arrays, multiCallback) {\n if (typeof multiCallback !== 'function') {\n throw new Error('Last argument must be a callback function')\n }\n\n const firstArrayIsMatrix = Arrays[0].isMatrix\n\n const newSize = broadcastSizes(...Arrays.map(M => M.isMatrix ? M.size() : arraySize(M)))\n\n const _get = firstArrayIsMatrix\n ? (matrix, idx) => matrix.get(idx)\n : get\n\n const broadcastedArrays = firstArrayIsMatrix\n ? Arrays.map(M => M.isMatrix\n ? M.create(broadcastTo(M.toArray(), newSize), M.datatype())\n : Arrays[0].create(broadcastTo(M.valueOf(), newSize)))\n : Arrays.map(M => M.isMatrix\n ? broadcastTo(M.toArray(), newSize)\n : broadcastTo(M, newSize))\n\n let callback\n\n if (typed.isTypedFunction(multiCallback)) {\n const firstIndex = newSize.map(() => 0)\n const firstValues = broadcastedArrays.map(array => _get(array, firstIndex))\n const callbackCase = _getTypedCallbackCase(multiCallback, firstValues, firstIndex, broadcastedArrays)\n callback = _getLimitedCallback(callbackCase)\n } else {\n const numberOfArrays = Arrays.length\n const callbackCase = _getCallbackCase(multiCallback, numberOfArrays)\n callback = _getLimitedCallback(callbackCase)\n }\n\n const broadcastedArraysCallback = (x, idx) =>\n callback(\n [x, ...broadcastedArrays.slice(1).map(Array => _get(Array, idx))],\n idx)\n\n if (firstArrayIsMatrix) {\n return broadcastedArrays[0].map(broadcastedArraysCallback)\n } else {\n return _mapArray(broadcastedArrays[0], broadcastedArraysCallback)\n }\n\n function _getLimitedCallback (callbackCase) {\n switch (callbackCase) {\n case 0:\n return x => multiCallback(...x)\n case 1:\n return (x, idx) => multiCallback(...x, idx)\n case 2:\n return (x, idx) => multiCallback(...x, idx, ...broadcastedArrays)\n }\n }\n\n function _getCallbackCase (callback, numberOfArrays) {\n if (callback.length > numberOfArrays + 1) { return 2 }\n if (callback.length === numberOfArrays + 1) { return 1 }\n return 0\n }\n\n function _getTypedCallbackCase (callback, values, idx, arrays) {\n if (typed.resolve(callback, [...values, idx, ...arrays]) !== null) { return 2 }\n if (typed.resolve(callback, [...values, idx]) !== null) { return 1 }\n if (typed.resolve(callback, values) !== null) { return 0 }\n // this should never happen\n return 0\n }\n }\n /**\n * Map for a multi dimensional array\n * @param {Array} array\n * @param {Function} callback\n * @return {Array}\n * @private\n */\n function _mapArray (array, callback) {\n const fastCallback = optimizeCallback(callback, array, name)\n return deepMap(array, fastCallback.fn, fastCallback.isUnary)\n }\n})\n","import { factory } from '../../utils/factory.js'\nimport { isInteger } from '../../utils/number.js'\nimport { isMatrix } from '../../utils/is.js'\n\nconst name = 'diff'\nconst dependencies = ['typed', 'matrix', 'subtract', 'number']\n\nexport const createDiff = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, subtract, number }) => {\n /**\n * Create a new matrix or array of the difference between elements of the given array\n * The optional dim parameter lets you specify the dimension to evaluate the difference of\n * If no dimension parameter is passed it is assumed as dimension 0\n *\n * Dimension is zero-based in javascript and one-based in the parser and can be a number or bignumber\n * Arrays must be 'rectangular' meaning arrays like [1, 2]\n * If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays\n *\n * Syntax:\n *\n * math.diff(arr)\n * math.diff(arr, dim)\n *\n * Examples:\n *\n * const arr = [1, 2, 4, 7, 0]\n * math.diff(arr) // returns [1, 2, 3, -7] (no dimension passed so 0 is assumed)\n * math.diff(math.matrix(arr)) // returns Matrix [1, 2, 3, -7]\n *\n * const arr = [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [9, 8, 7, 6, 4]]\n * math.diff(arr) // returns [[0, 0, 0, 0, 0], [8, 6, 4, 2, -1]]\n * math.diff(arr, 0) // returns [[0, 0, 0, 0, 0], [8, 6, 4, 2, -1]]\n * math.diff(arr, 1) // returns [[1, 1, 1, 1], [1, 1, 1, 1], [-1, -1, -1, -2]]\n * math.diff(arr, math.bignumber(1)) // returns [[1, 1, 1, 1], [1, 1, 1, 1], [-1, -1, -1, -2]]\n *\n * math.diff(arr, 2) // throws RangeError as arr is 2 dimensional not 3\n * math.diff(arr, -1) // throws RangeError as negative dimensions are not allowed\n *\n * // These will all produce the same result\n * math.diff([[1, 2], [3, 4]])\n * math.diff([math.matrix([1, 2]), math.matrix([3, 4])])\n * math.diff([[1, 2], math.matrix([3, 4])])\n * math.diff([math.matrix([1, 2]), [3, 4]])\n * // They do not produce the same result as math.diff(math.matrix([[1, 2], [3, 4]])) as this returns a matrix\n *\n * See Also:\n *\n * sum\n * subtract\n * partitionSelect\n *\n * @param {Array | Matrix} arr An array or matrix\n * @param {number | BigNumber} dim Dimension\n * @return {Array | Matrix} Difference between array elements in given dimension\n */\n return typed(name, {\n 'Array | Matrix': function (arr) { // No dimension specified => assume dimension 0\n if (isMatrix(arr)) {\n return matrix(_diff(arr.toArray()))\n } else {\n return _diff(arr)\n }\n },\n 'Array | Matrix, number': function (arr, dim) {\n if (!isInteger(dim)) throw new RangeError('Dimension must be a whole number')\n if (isMatrix(arr)) {\n return matrix(_recursive(arr.toArray(), dim))\n } else {\n return _recursive(arr, dim)\n }\n },\n 'Array, BigNumber': typed.referTo('Array,number', selfAn =>\n (arr, dim) => selfAn(arr, number(dim))),\n 'Matrix, BigNumber': typed.referTo('Matrix,number', selfMn =>\n (arr, dim) => selfMn(arr, number(dim)))\n })\n\n /**\n * Recursively find the correct dimension in the array/matrix\n * Then Apply _diff to that dimension\n *\n * @param {Array} arr The array\n * @param {number} dim Dimension\n * @return {Array} resulting array\n */\n function _recursive (arr, dim) {\n if (isMatrix(arr)) {\n arr = arr.toArray() // Makes sure arrays like [ matrix([0, 1]), matrix([1, 0]) ] are processed properly\n }\n if (!Array.isArray(arr)) {\n throw RangeError('Array/Matrix does not have that many dimensions')\n }\n if (dim > 0) {\n const result = []\n arr.forEach(element => {\n result.push(_recursive(element, dim - 1))\n })\n return result\n } else if (dim === 0) {\n return _diff(arr)\n } else {\n throw RangeError('Cannot have negative dimension')\n }\n }\n\n /**\n * Difference between elements in the array\n *\n * @param {Array} arr An array\n * @return {Array} resulting array\n */\n function _diff (arr) {\n const result = []\n const size = arr.length\n for (let i = 1; i < size; i++) {\n result.push(_ElementDiff(arr[i - 1], arr[i]))\n }\n return result\n }\n\n /**\n * Difference between 2 objects\n *\n * @param {Object} obj1 First object\n * @param {Object} obj2 Second object\n * @return {Array} resulting array\n */\n function _ElementDiff (obj1, obj2) {\n // Convert matrices to arrays\n if (isMatrix(obj1)) obj1 = obj1.toArray()\n if (isMatrix(obj2)) obj2 = obj2.toArray()\n\n const obj1IsArray = Array.isArray(obj1)\n const obj2IsArray = Array.isArray(obj2)\n if (obj1IsArray && obj2IsArray) {\n return _ArrayDiff(obj1, obj2)\n }\n if (!obj1IsArray && !obj2IsArray) {\n return subtract(obj2, obj1) // Difference is (second - first) NOT (first - second)\n }\n throw TypeError('Cannot calculate difference between 1 array and 1 non-array')\n }\n\n /**\n * Difference of elements in 2 arrays\n *\n * @param {Array} arr1 Array 1\n * @param {Array} arr2 Array 2\n * @return {Array} resulting array\n */\n function _ArrayDiff (arr1, arr2) {\n if (arr1.length !== arr2.length) {\n throw RangeError('Not all sub-arrays have the same length')\n }\n const result = []\n const size = arr1.length\n for (let i = 0; i < size; i++) {\n result.push(_ElementDiff(arr1[i], arr2[i]))\n }\n return result\n }\n})\n","import { isBigNumber } from '../../utils/is.js'\nimport { isInteger } from '../../utils/number.js'\nimport { resize } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'ones'\nconst dependencies = ['typed', 'config', 'matrix', 'BigNumber']\n\nexport const createOnes = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, matrix, BigNumber }) => {\n /**\n * Create a matrix filled with ones. The created matrix can have one or\n * multiple dimensions.\n *\n * Syntax:\n *\n * math.ones(m)\n * math.ones(m, format)\n * math.ones(m, n)\n * math.ones(m, n, format)\n * math.ones([m, n])\n * math.ones([m, n], format)\n * math.ones([m, n, p, ...])\n * math.ones([m, n, p, ...], format)\n *\n * Examples:\n *\n * math.ones() // returns []\n * math.ones(3) // returns [1, 1, 1]\n * math.ones(3, 2) // returns [[1, 1], [1, 1], [1, 1]]\n * math.ones(3, 2, 'dense') // returns Dense Matrix [[1, 1], [1, 1], [1, 1]]\n *\n * const A = [[1, 2, 3], [4, 5, 6]]\n * math.ones(math.size(A)) // returns [[1, 1, 1], [1, 1, 1]]\n *\n * See also:\n *\n * zeros, identity, size, range\n *\n * @param {...(number|BigNumber) | Array} size The size of each dimension of the matrix\n * @param {string} [format] The Matrix storage format\n *\n * @return {Array | Matrix | number} A matrix filled with ones\n */\n return typed('ones', {\n '': function () {\n return (config.matrix === 'Array')\n ? _ones([])\n : _ones([], 'default')\n },\n\n // math.ones(m, n, p, ..., format)\n // TODO: more accurate signature '...number | BigNumber, string' as soon as typed-function supports this\n '...number | BigNumber | string': function (size) {\n const last = size[size.length - 1]\n if (typeof last === 'string') {\n const format = size.pop()\n return _ones(size, format)\n } else if (config.matrix === 'Array') {\n return _ones(size)\n } else {\n return _ones(size, 'default')\n }\n },\n\n Array: _ones,\n\n Matrix: function (size) {\n const format = size.storage()\n return _ones(size.valueOf(), format)\n },\n\n 'Array | Matrix, string': function (size, format) {\n return _ones(size.valueOf(), format)\n }\n })\n\n /**\n * Create an Array or Matrix with ones\n * @param {Array} size\n * @param {string} [format='default']\n * @return {Array | Matrix}\n * @private\n */\n function _ones (size, format) {\n const hasBigNumbers = _normalize(size)\n const defaultValue = hasBigNumbers ? new BigNumber(1) : 1\n _validate(size)\n\n if (format) {\n // return a matrix\n const m = matrix(format)\n if (size.length > 0) {\n return m.resize(size, defaultValue)\n }\n return m\n } else {\n // return an Array\n const arr = []\n if (size.length > 0) {\n return resize(arr, size, defaultValue)\n }\n return arr\n }\n }\n\n // replace BigNumbers with numbers, returns true if size contained BigNumbers\n function _normalize (size) {\n let hasBigNumbers = false\n size.forEach(function (value, index, arr) {\n if (isBigNumber(value)) {\n hasBigNumbers = true\n arr[index] = value.toNumber()\n }\n })\n return hasBigNumbers\n }\n\n // validate arguments\n function _validate (size) {\n size.forEach(function (value) {\n if (typeof value !== 'number' || !isInteger(value) || value < 0) {\n throw new Error('Parameters in function ones must be positive integers')\n }\n })\n }\n})\n","export function noBignumber () {\n throw new Error('No \"bignumber\" implementation available')\n}\n\nexport function noFraction () {\n throw new Error('No \"fraction\" implementation available')\n}\n\nexport function noMatrix () {\n throw new Error('No \"matrix\" implementation available')\n}\n\nexport function noIndex () {\n throw new Error('No \"index\" implementation available')\n}\n\nexport function noSubset () {\n throw new Error('No \"matrix\" implementation available')\n}\n","import { factory } from '../../utils/factory.js'\nimport { noBignumber, noMatrix } from '../../utils/noop.js'\n\nconst name = 'range'\nconst dependencies = ['typed', 'config', '?matrix', '?bignumber', 'smaller', 'smallerEq', 'larger', 'largerEq', 'add', 'isPositive']\n\nexport const createRange = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, matrix, bignumber, smaller, smallerEq, larger, largerEq, add, isPositive }) => {\n /**\n * Create an array from a range.\n * By default, the range end is excluded. This can be customized by providing\n * an extra parameter `includeEnd`.\n *\n * Syntax:\n *\n * math.range(str [, includeEnd]) // Create a range from a string,\n * // where the string contains the\n * // start, optional step, and end,\n * // separated by a colon.\n * math.range(start, end [, includeEnd]) // Create a range with start and\n * // end and a step size of 1.\n * math.range(start, end, step [, includeEnd]) // Create a range with start, step,\n * // and end.\n *\n * Where:\n *\n * - `str: string`\n * A string 'start:end' or 'start:step:end'\n * - `start: {number | bigint | BigNumber | Fraction | Unit}`\n * Start of the range\n * - `end: number | bigint | BigNumber | Fraction | Unit`\n * End of the range, excluded by default, included when parameter includeEnd=true\n * - `step: number | bigint | BigNumber | Fraction | Unit`\n * Step size. Default value is 1.\n * - `includeEnd: boolean`\n * Option to specify whether to include the end or not. False by default.\n *\n * Note that the return type of the range is taken from the type of\n * the start/end. If only one these is a built-in `number` type, it will\n * be promoted to the type of the other endpoint. However, in the case of\n * Unit values, both endpoints must have compatible units, and the return\n * value will have compatible units as well.\n *\n * Examples:\n *\n * math.range(2, 6) // [2, 3, 4, 5]\n * math.range(2, -3, -1) // [2, 1, 0, -1, -2]\n * math.range('2:1:6') // [2, 3, 4, 5]\n * math.range(2, 6, true) // [2, 3, 4, 5, 6]\n * math.range(2, math.fraction(8,3), math.fraction(1,3)) // [fraction(2), fraction(7,3)]\n * math.range(math.unit(2, 'm'), math.unit(-3, 'm'), math.unit(-1, 'm')) // [2 m, 1 m, 0 m , -1 m, -2 m]\n *\n * See also:\n *\n * ones, zeros, size, subset\n *\n * @param {*} args Parameters describing the range's `start`, `end`, and optional `step`.\n * @return {Array | Matrix} range\n */\n return typed(name, {\n // TODO: simplify signatures when typed-function supports default values and optional arguments\n\n string: _strRange,\n 'string, boolean': _strRange,\n\n number: function (oops) {\n throw new TypeError(`Too few arguments to function range(): ${oops}`)\n },\n\n boolean: function (oops) {\n throw new TypeError(`Unexpected type of argument 1 to function range(): ${oops}, number|bigint|BigNumber|Fraction`)\n },\n\n 'number, number': function (start, end) {\n return _out(_range(start, end, 1, false))\n },\n 'number, number, number': function (start, end, step) {\n return _out(_range(start, end, step, false))\n },\n 'number, number, boolean': function (start, end, includeEnd) {\n return _out(_range(start, end, 1, includeEnd))\n },\n 'number, number, number, boolean': function (start, end, step, includeEnd) {\n return _out(_range(start, end, step, includeEnd))\n },\n\n // Handle bigints; if either limit is bigint, range should be too\n 'bigint, bigint|number': function (start, end) {\n return _out(_range(start, end, 1n, false))\n },\n 'number, bigint': function (start, end) {\n return _out(_range(BigInt(start), end, 1n, false))\n },\n 'bigint, bigint|number, bigint|number': function (start, end, step) {\n return _out(_range(start, end, BigInt(step), false))\n },\n 'number, bigint, bigint|number': function (start, end, step) {\n return _out(_range(BigInt(start), end, BigInt(step), false))\n },\n 'bigint, bigint|number, boolean': function (start, end, includeEnd) {\n return _out(_range(start, end, 1n, includeEnd))\n },\n 'number, bigint, boolean': function (start, end, includeEnd) {\n return _out(_range(BigInt(start), end, 1n, includeEnd))\n },\n 'bigint, bigint|number, bigint|number, boolean': function (start, end, step, includeEnd) {\n return _out(_range(start, end, BigInt(step), includeEnd))\n },\n 'number, bigint, bigint|number, boolean': function (start, end, step, includeEnd) {\n return _out(_range(BigInt(start), end, BigInt(step), includeEnd))\n },\n\n 'BigNumber, BigNumber': function (start, end) {\n const BigNumber = start.constructor\n\n return _out(_range(start, end, new BigNumber(1), false))\n },\n 'BigNumber, BigNumber, BigNumber': function (start, end, step) {\n return _out(_range(start, end, step, false))\n },\n 'BigNumber, BigNumber, boolean': function (start, end, includeEnd) {\n const BigNumber = start.constructor\n\n return _out(_range(start, end, new BigNumber(1), includeEnd))\n },\n 'BigNumber, BigNumber, BigNumber, boolean': function (start, end, step, includeEnd) {\n return _out(_range(start, end, step, includeEnd))\n },\n\n 'Fraction, Fraction': function (start, end) {\n return _out(_range(start, end, 1, false))\n },\n 'Fraction, Fraction, Fraction': function (start, end, step) {\n return _out(_range(start, end, step, false))\n },\n 'Fraction, Fraction, boolean': function (start, end, includeEnd) {\n return _out(_range(start, end, 1, includeEnd))\n },\n 'Fraction, Fraction, Fraction, boolean': function (start, end, step, includeEnd) {\n return _out(_range(start, end, step, includeEnd))\n },\n\n 'Unit, Unit, Unit': function (start, end, step) {\n return _out(_range(start, end, step, false))\n },\n 'Unit, Unit, Unit, boolean': function (start, end, step, includeEnd) {\n return _out(_range(start, end, step, includeEnd))\n }\n\n })\n\n function _out (arr) {\n if (config.matrix === 'Matrix') {\n return matrix ? matrix(arr) : noMatrix()\n }\n\n return arr\n }\n\n function _strRange (str, includeEnd) {\n const r = _parse(str)\n if (!r) {\n throw new SyntaxError('String \"' + str + '\" is no valid range')\n }\n\n if (config.number === 'BigNumber') {\n if (bignumber === undefined) {\n noBignumber()\n }\n\n return _out(_range(\n bignumber(r.start),\n bignumber(r.end),\n bignumber(r.step)),\n includeEnd)\n } else {\n return _out(_range(r.start, r.end, r.step, includeEnd))\n }\n }\n\n /**\n * Create a range with numbers or BigNumbers\n * @param {number | BigNumber | Unit} start\n * @param {number | BigNumber | Unit} end\n * @param {number | BigNumber | Unit} step\n * @param {boolean} includeEnd\n * @returns {Array} range\n * @private\n */\n function _range (start, end, step, includeEnd) {\n const array = []\n const ongoing = isPositive(step)\n ? includeEnd ? smallerEq : smaller\n : includeEnd ? largerEq : larger\n let x = start\n while (ongoing(x, end)) {\n array.push(x)\n x = add(x, step)\n }\n return array\n }\n\n /**\n * Parse a string into a range,\n * The string contains the start, optional step, and end, separated by a colon.\n * If the string does not contain a valid range, null is returned.\n * For example str='0:2:11'.\n * @param {string} str\n * @return {{start: number, end: number, step: number} | null} range Object containing properties start, end, step\n * @private\n */\n function _parse (str) {\n const args = str.split(':')\n\n // number\n const nums = args.map(function (arg) {\n // use Number and not parseFloat as Number returns NaN on invalid garbage in the string\n return Number(arg)\n })\n\n const invalid = nums.some(function (num) {\n return isNaN(num)\n })\n if (invalid) {\n return null\n }\n\n switch (nums.length) {\n case 2:\n return {\n start: nums[0],\n end: nums[1],\n step: 1\n }\n\n case 3:\n return {\n start: nums[0],\n end: nums[2],\n step: nums[1]\n }\n\n default:\n return null\n }\n }\n})\n","import { reshape as arrayReshape } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'reshape'\nconst dependencies = ['typed', 'isInteger', 'matrix']\n\nexport const createReshape = /* #__PURE__ */ factory(name, dependencies, ({ typed, isInteger }) => {\n /**\n * Reshape a multi dimensional array to fit the specified dimensions\n *\n * Syntax:\n *\n * math.reshape(x, sizes)\n *\n * Examples:\n *\n * math.reshape([1, 2, 3, 4, 5, 6], [2, 3])\n * // returns Array [[1, 2, 3], [4, 5, 6]]\n *\n * math.reshape([[1, 2], [3, 4]], [1, 4])\n * // returns Array [[1, 2, 3, 4]]\n *\n * math.reshape([[1, 2], [3, 4]], [4])\n * // returns Array [1, 2, 3, 4]\n *\n * const x = math.matrix([1, 2, 3, 4, 5, 6, 7, 8])\n * math.reshape(x, [2, 2, 2])\n * // returns Matrix [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]\n *\n * math.reshape([1, 2, 3, 4], [-1, 2])\n * // returns Matrix [[1, 2], [3, 4]]\n *\n * See also:\n *\n * size, squeeze, resize\n *\n * @param {Array | Matrix | *} x Matrix to be reshaped\n * @param {number[]} sizes One dimensional array with integral sizes for\n * each dimension. One -1 is allowed as wildcard,\n * which calculates this dimension automatically.\n *\n * @return {* | Array | Matrix} A reshaped clone of matrix `x`\n *\n * @throws {TypeError} If `sizes` does not contain solely integers\n * @throws {DimensionError} If the product of the new dimension sizes does\n * not equal that of the old ones\n */\n return typed(name, {\n\n 'Matrix, Array': function (x, sizes) {\n return x.reshape(sizes, true)\n },\n\n 'Array, Array': function (x, sizes) {\n sizes.forEach(function (size) {\n if (!isInteger(size)) {\n throw new TypeError('Invalid size for dimension: ' + size)\n }\n })\n return arrayReshape(x, sizes)\n }\n\n })\n})\n","import { isBigNumber, isMatrix } from '../../utils/is.js'\nimport { DimensionError } from '../../error/DimensionError.js'\nimport { ArgumentsError } from '../../error/ArgumentsError.js'\nimport { isInteger } from '../../utils/number.js'\nimport { format } from '../../utils/string.js'\nimport { clone } from '../../utils/object.js'\nimport { resize as arrayResize } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'resize'\nconst dependencies = ['config', 'matrix']\n\nexport const createResize = /* #__PURE__ */ factory(name, dependencies, ({ config, matrix }) => {\n /**\n * Resize a matrix\n *\n * Syntax:\n *\n * math.resize(x, size)\n * math.resize(x, size, defaultValue)\n *\n * Examples:\n *\n * math.resize([1, 2, 3, 4, 5], [3]) // returns Array [1, 2, 3]\n * math.resize([1, 2, 3], [5], 0) // returns Array [1, 2, 3, 0, 0]\n * math.resize(2, [2, 3], 0) // returns Matrix [[2, 0, 0], [0, 0, 0]]\n * math.resize(\"hello\", [8], \"!\") // returns string 'hello!!!'\n *\n * See also:\n *\n * size, squeeze, subset, reshape\n *\n * @param {Array | Matrix | *} x Matrix to be resized\n * @param {Array | Matrix} size One dimensional array with numbers\n * @param {number | string} [defaultValue=0] Zero by default, except in\n * case of a string, in that case\n * defaultValue = ' '\n * @return {* | Array | Matrix} A resized clone of matrix `x`\n */\n // TODO: rework resize to a typed-function\n return function resize (x, size, defaultValue) {\n if (arguments.length !== 2 && arguments.length !== 3) {\n throw new ArgumentsError('resize', arguments.length, 2, 3)\n }\n\n if (isMatrix(size)) {\n size = size.valueOf() // get Array\n }\n\n if (isBigNumber(size[0])) {\n // convert bignumbers to numbers\n size = size.map(function (value) {\n return !isBigNumber(value) ? value : value.toNumber()\n })\n }\n\n // check x is a Matrix\n if (isMatrix(x)) {\n // use optimized matrix implementation, return copy\n return x.resize(size, defaultValue, true)\n }\n\n if (typeof x === 'string') {\n // resize string\n return _resizeString(x, size, defaultValue)\n }\n\n // check result should be a matrix\n const asMatrix = Array.isArray(x) ? false : (config.matrix !== 'Array')\n\n if (size.length === 0) {\n // output a scalar\n while (Array.isArray(x)) {\n x = x[0]\n }\n\n return clone(x)\n } else {\n // output an array/matrix\n if (!Array.isArray(x)) {\n x = [x]\n }\n x = clone(x)\n\n const res = arrayResize(x, size, defaultValue)\n return asMatrix ? matrix(res) : res\n }\n }\n\n /**\n * Resize a string\n * @param {string} str\n * @param {number[]} size\n * @param {string} [defaultChar=' ']\n * @private\n */\n function _resizeString (str, size, defaultChar) {\n if (defaultChar !== undefined) {\n if (typeof defaultChar !== 'string' || defaultChar.length !== 1) {\n throw new TypeError('Single character expected as defaultValue')\n }\n } else {\n defaultChar = ' '\n }\n\n if (size.length !== 1) {\n throw new DimensionError(size.length, 1)\n }\n const len = size[0]\n if (typeof len !== 'number' || !isInteger(len)) {\n throw new TypeError('Invalid size, must contain positive integers ' +\n '(size: ' + format(size) + ')')\n }\n\n if (str.length > len) {\n return str.substring(0, len)\n } else if (str.length < len) {\n let res = str\n for (let i = 0, ii = len - str.length; i < ii; i++) {\n res += defaultChar\n }\n return res\n } else {\n return str\n }\n }\n})\n","import { factory } from '../../utils/factory.js'\nimport { arraySize } from '../../utils/array.js'\n\nconst name = 'rotate'\nconst dependencies = [\n 'typed',\n 'multiply',\n 'rotationMatrix'\n]\n\nexport const createRotate = /* #__PURE__ */ factory(name, dependencies, (\n {\n typed, multiply, rotationMatrix\n }) => {\n /**\n * Rotate a vector of size 1x2 counter-clockwise by a given angle\n * Rotate a vector of size 1x3 counter-clockwise by a given angle around the given axis\n *\n * Syntax:\n *\n * math.rotate(w, theta)\n * math.rotate(w, theta, v)\n *\n * Examples:\n *\n * math.rotate([11, 12], math.pi / 2) // returns [-12, 11]\n * math.rotate(matrix([11, 12]), math.pi / 2) // returns [-12, 11]\n *\n * math.rotate([1, 0, 0], unit('90deg'), [0, 0, 1]) // returns [0, 1, 0]\n * math.rotate(matrix([1, 0, 0]), unit('90deg'), [0, 0, 1]) // returns Matrix [0, 1, 0]\n *\n * math.rotate([1, 0], math.complex(1 + i)) // returns [cos(1 + i) - sin(1 + i), sin(1 + i) + cos(1 + i)]\n *\n * See also:\n *\n * matrix, rotationMatrix\n *\n * @param {Array | Matrix} w Vector to rotate\n * @param {number | BigNumber | Complex | Unit} theta Rotation angle\n * @param {Array | Matrix} [v] Rotation axis\n * @return {Array | Matrix} Multiplication of the rotation matrix and w\n */\n return typed(name, {\n 'Array , number | BigNumber | Complex | Unit': function (w, theta) {\n _validateSize(w, 2)\n const matrixRes = multiply(rotationMatrix(theta), w)\n return matrixRes.toArray()\n },\n\n 'Matrix , number | BigNumber | Complex | Unit': function (w, theta) {\n _validateSize(w, 2)\n return multiply(rotationMatrix(theta), w)\n },\n\n 'Array, number | BigNumber | Complex | Unit, Array | Matrix': function (w, theta, v) {\n _validateSize(w, 3)\n const matrixRes = multiply(rotationMatrix(theta, v), w)\n return matrixRes\n },\n\n 'Matrix, number | BigNumber | Complex | Unit, Array | Matrix': function (w, theta, v) {\n _validateSize(w, 3)\n return multiply(rotationMatrix(theta, v), w)\n }\n })\n\n function _validateSize (v, expectedSize) {\n const actualSize = Array.isArray(v) ? arraySize(v) : v.size()\n if (actualSize.length > 2) {\n throw new RangeError(`Vector must be of dimensions 1x${expectedSize}`)\n }\n if (actualSize.length === 2 && actualSize[1] !== 1) {\n throw new RangeError(`Vector must be of dimensions 1x${expectedSize}`)\n }\n if (actualSize[0] !== expectedSize) {\n throw new RangeError(`Vector must be of dimensions 1x${expectedSize}`)\n }\n }\n})\n","import { isBigNumber } from '../../utils/is.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'rotationMatrix'\nconst dependencies = [\n 'typed',\n 'config',\n 'multiplyScalar',\n 'addScalar',\n 'unaryMinus',\n 'norm',\n 'matrix',\n 'BigNumber',\n 'DenseMatrix',\n 'SparseMatrix',\n 'cos',\n 'sin'\n]\n\nexport const createRotationMatrix = /* #__PURE__ */ factory(name, dependencies, (\n {\n typed, config, multiplyScalar,\n addScalar, unaryMinus, norm, BigNumber,\n matrix, DenseMatrix, SparseMatrix, cos, sin\n }) => {\n /**\n * Create a 2-dimensional counter-clockwise rotation matrix (2x2) for a given angle (expressed in radians).\n * Create a 2-dimensional counter-clockwise rotation matrix (3x3) by a given angle (expressed in radians) around a given axis (1x3).\n *\n * Syntax:\n *\n * math.rotationMatrix(theta)\n * math.rotationMatrix(theta, format)\n * math.rotationMatrix(theta, [v])\n * math.rotationMatrix(theta, [v], format)\n *\n * Examples:\n *\n * math.rotationMatrix(math.pi / 2) // returns [[0, -1], [1, 0]]\n * math.rotationMatrix(math.bignumber(1)) // returns [[bignumber(cos(1)), bignumber(-sin(1))], [bignumber(sin(1)), bignumber(cos(1))]]\n * math.rotationMatrix(math.complex(1 + i)) // returns [[cos(1 + i), -sin(1 + i)], [sin(1 + i), cos(1 + i)]]\n * math.rotationMatrix(math.unit('1rad')) // returns [[cos(1), -sin(1)], [sin(1), cos(1)]]\n *\n * math.rotationMatrix(math.pi / 2, [0, 1, 0]) // returns [[0, 0, 1], [0, 1, 0], [-1, 0, 0]]\n * math.rotationMatrix(math.pi / 2, matrix([0, 1, 0])) // returns matrix([[0, 0, 1], [0, 1, 0], [-1, 0, 0]])\n *\n *\n * See also:\n *\n * matrix, cos, sin\n *\n *\n * @param {number | BigNumber | Complex | Unit} theta Rotation angle\n * @param {Array | Matrix} [v] Rotation axis\n * @param {string} [format] Result Matrix storage format\n * @return {Array | Matrix} Rotation matrix\n */\n\n return typed(name, {\n '': function () {\n return (config.matrix === 'Matrix') ? matrix([]) : []\n },\n\n string: function (format) {\n return matrix(format)\n },\n\n 'number | BigNumber | Complex | Unit': function (theta) {\n return _rotationMatrix2x2(theta, config.matrix === 'Matrix' ? 'dense' : undefined)\n },\n\n 'number | BigNumber | Complex | Unit, string': function (theta, format) {\n return _rotationMatrix2x2(theta, format)\n },\n\n 'number | BigNumber | Complex | Unit, Array': function (theta, v) {\n const matrixV = matrix(v)\n _validateVector(matrixV)\n return _rotationMatrix3x3(theta, matrixV, undefined)\n },\n\n 'number | BigNumber | Complex | Unit, Matrix': function (theta, v) {\n _validateVector(v)\n const storageType = v.storage() || (config.matrix === 'Matrix' ? 'dense' : undefined)\n return _rotationMatrix3x3(theta, v, storageType)\n },\n\n 'number | BigNumber | Complex | Unit, Array, string': function (theta, v, format) {\n const matrixV = matrix(v)\n _validateVector(matrixV)\n return _rotationMatrix3x3(theta, matrixV, format)\n },\n\n 'number | BigNumber | Complex | Unit, Matrix, string': function (theta, v, format) {\n _validateVector(v)\n return _rotationMatrix3x3(theta, v, format)\n }\n\n })\n\n /**\n * Returns 2x2 matrix of 2D rotation of angle theta\n *\n * @param {number | BigNumber | Complex | Unit} theta The rotation angle\n * @param {string} format The result Matrix storage format\n * @returns {Matrix}\n * @private\n */\n function _rotationMatrix2x2 (theta, format) {\n const Big = isBigNumber(theta)\n\n const minusOne = Big ? new BigNumber(-1) : -1\n const cosTheta = cos(theta)\n const sinTheta = sin(theta)\n const data = [[cosTheta, multiplyScalar(minusOne, sinTheta)], [sinTheta, cosTheta]]\n\n return _convertToFormat(data, format)\n }\n\n function _validateVector (v) {\n const size = v.size()\n if (size.length < 1 || size[0] !== 3) {\n throw new RangeError('Vector must be of dimensions 1x3')\n }\n }\n\n function _mul (array) {\n return array.reduce((p, curr) => multiplyScalar(p, curr))\n }\n\n function _convertToFormat (data, format) {\n if (format) {\n if (format === 'sparse') {\n return new SparseMatrix(data)\n }\n if (format === 'dense') {\n return new DenseMatrix(data)\n }\n throw new TypeError(`Unknown matrix type \"${format}\"`)\n }\n return data\n }\n\n /**\n * Returns a 3x3 matrix of rotation of angle theta around vector v\n *\n * @param {number | BigNumber | Complex | Unit} theta The rotation angle\n * @param {Matrix} v The rotation axis vector\n * @param {string} format The storage format of the resulting matrix\n * @returns {Matrix}\n * @private\n */\n function _rotationMatrix3x3 (theta, v, format) {\n const normV = norm(v)\n if (normV === 0) {\n throw new RangeError('Rotation around zero vector')\n }\n\n const Big = isBigNumber(theta) ? BigNumber : null\n\n const one = Big ? new Big(1) : 1\n const minusOne = Big ? new Big(-1) : -1\n const vx = Big ? new Big(v.get([0]) / normV) : v.get([0]) / normV\n const vy = Big ? new Big(v.get([1]) / normV) : v.get([1]) / normV\n const vz = Big ? new Big(v.get([2]) / normV) : v.get([2]) / normV\n const c = cos(theta)\n const oneMinusC = addScalar(one, unaryMinus(c))\n const s = sin(theta)\n\n const r11 = addScalar(c, _mul([vx, vx, oneMinusC]))\n const r12 = addScalar(_mul([vx, vy, oneMinusC]), _mul([minusOne, vz, s]))\n const r13 = addScalar(_mul([vx, vz, oneMinusC]), _mul([vy, s]))\n\n const r21 = addScalar(_mul([vx, vy, oneMinusC]), _mul([vz, s]))\n const r22 = addScalar(c, _mul([vy, vy, oneMinusC]))\n const r23 = addScalar(_mul([vy, vz, oneMinusC]), _mul([minusOne, vx, s]))\n\n const r31 = addScalar(_mul([vx, vz, oneMinusC]), _mul([minusOne, vy, s]))\n const r32 = addScalar(_mul([vy, vz, oneMinusC]), _mul([vx, s]))\n const r33 = addScalar(c, _mul([vz, vz, oneMinusC]))\n\n const data = [[r11, r12, r13], [r21, r22, r23], [r31, r32, r33]]\n\n return _convertToFormat(data, format)\n }\n})\n","import { factory } from '../../utils/factory.js'\nimport { isMatrix } from '../../utils/is.js'\nimport { clone } from '../../utils/object.js'\nimport { validateIndex } from '../../utils/array.js'\n\nconst name = 'row'\nconst dependencies = ['typed', 'Index', 'matrix', 'range']\n\nexport const createRow = /* #__PURE__ */ factory(name, dependencies, ({ typed, Index, matrix, range }) => {\n /**\n * Return a row from a Matrix.\n *\n * Syntax:\n *\n * math.row(value, index)\n *\n * Example:\n *\n * // get a row\n * const d = [[1, 2], [3, 4]]\n * math.row(d, 1) // returns [[3, 4]]\n *\n * See also:\n *\n * column\n *\n * @param {Array | Matrix } value An array or matrix\n * @param {number} row The index of the row\n * @return {Array | Matrix} The retrieved row\n */\n return typed(name, {\n 'Matrix, number': _row,\n\n 'Array, number': function (value, row) {\n return _row(matrix(clone(value)), row).valueOf()\n }\n })\n\n /**\n * Retrieve a row of a matrix\n * @param {Matrix } value A matrix\n * @param {number} row The index of the row\n * @return {Matrix} The retrieved row\n */\n function _row (value, row) {\n // check dimensions\n if (value.size().length !== 2) {\n throw new Error('Only two dimensional matrix is supported')\n }\n\n validateIndex(row, value.size()[0])\n\n const columnRange = range(0, value.size()[1])\n const index = new Index(row, columnRange)\n const result = value.subset(index)\n return isMatrix(result)\n ? result\n : matrix([[result]])\n }\n})\n","import { arraySize } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\nimport { noMatrix } from '../../utils/noop.js'\n\nconst name = 'size'\nconst dependencies = ['typed', 'config', '?matrix']\n\nexport const createSize = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, matrix }) => {\n /**\n * Calculate the size of a matrix or scalar.\n *\n * Syntax:\n *\n * math.size(x)\n *\n * Examples:\n *\n * math.size(2.3) // returns []\n * math.size('hello world') // returns [11]\n *\n * const A = [[1, 2, 3], [4, 5, 6]]\n * math.size(A) // returns [2, 3]\n * math.size(math.range(1,6).toArray()) // returns [5]\n *\n * See also:\n *\n * count, resize, squeeze, subset\n *\n * @param {boolean | number | Complex | Unit | string | Array | Matrix} x A matrix\n * @return {Array | Matrix} A vector with size of `x`.\n */\n return typed(name, {\n Matrix: function (x) {\n return x.create(x.size(), 'number')\n },\n\n Array: arraySize,\n\n string: function (x) {\n return (config.matrix === 'Array') ? [x.length] : matrix([x.length], 'dense', 'number')\n },\n\n 'number | Complex | BigNumber | Unit | boolean | null': function (x) {\n // scalar\n return (config.matrix === 'Array')\n ? []\n : matrix ? matrix([], 'dense', 'number') : noMatrix()\n }\n })\n})\n","import { clone } from '../../utils/object.js'\nimport { squeeze as arraySqueeze } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'squeeze'\nconst dependencies = ['typed']\n\nexport const createSqueeze = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Squeeze a matrix, remove inner and outer singleton dimensions from a matrix.\n *\n * Syntax:\n *\n * math.squeeze(x)\n *\n * Examples:\n *\n * math.squeeze([3]) // returns 3\n * math.squeeze([[3]]) // returns 3\n *\n * const A = math.zeros(3, 1) // returns [[0], [0], [0]] (size 3x1)\n * math.squeeze(A) // returns [0, 0, 0] (size 3)\n *\n * const B = math.zeros(1, 3) // returns [[0, 0, 0]] (size 1x3)\n * math.squeeze(B) // returns [0, 0, 0] (size 3)\n *\n * // only inner and outer dimensions are removed\n * const C = math.zeros(2, 1, 3) // returns [[[0, 0, 0]], [[0, 0, 0]]] (size 2x1x3)\n * math.squeeze(C) // returns [[[0, 0, 0]], [[0, 0, 0]]] (size 2x1x3)\n *\n * See also:\n *\n * subset\n *\n * @param {Matrix | Array} x Matrix to be squeezed\n * @return {Matrix | Array} Squeezed matrix\n */\n return typed(name, {\n Array: function (x) {\n return arraySqueeze(clone(x))\n },\n\n Matrix: function (x) {\n const res = arraySqueeze(x.toArray())\n // FIXME: return the same type of matrix as the input\n return Array.isArray(res) ? x.create(res, x.datatype()) : res\n },\n\n any: function (x) {\n // scalar\n return clone(x)\n }\n })\n})\n","import { isIndex } from '../../utils/is.js'\nimport { clone } from '../../utils/object.js'\nimport { isEmptyIndex, validateIndex, validateIndexSourceSize } from '../../utils/array.js'\nimport { getSafeProperty, setSafeProperty } from '../../utils/customs.js'\nimport { DimensionError } from '../../error/DimensionError.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'subset'\nconst dependencies = ['typed', 'matrix', 'zeros', 'add']\n\nexport const createSubset = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, zeros, add }) => {\n /**\n * Get or set a subset of a matrix or string.\n *\n * Syntax:\n * math.subset(value, index) // retrieve a subset\n * math.subset(value, index, replacement [, defaultValue]) // replace a subset\n *\n * Examples:\n *\n * // get a subset\n * const d = [[1, 2], [3, 4]]\n * math.subset(d, math.index(1, 0)) // returns 3\n * math.subset(d, math.index([0, 1], 1)) // returns [[2], [4]]\n * math.subset(d, math.index([false, true], 0)) // returns [[3]]\n *\n * // replace a subset\n * const e = []\n * const f = math.subset(e, math.index(0, [0, 2]), [5, 6]) // f = [[5, 0, 6]]\n * const g = math.subset(f, math.index(1, 1), 7, 0) // g = [[5, 0, 6], [0, 7, 0]]\n * math.subset(g, math.index([false, true], 1), 8) // returns [[5, 0, 6], [0, 8, 0]]\n *\n * // get submatrix using ranges\n * const M = [\n * [1,2,3],\n * [4,5,6],\n * [7,8,9]\n * ]\n * math.subset(M, math.index(math.range(0,2), math.range(0,3))) // [[1, 2, 3], [4, 5, 6]]\n *\n * See also:\n *\n * size, resize, squeeze, index\n *\n * @param {Array | Matrix | string} matrix An array, matrix, or string\n * @param {Index} index\n * For each dimension of the target, specifies an index or a list of\n * indices to fetch or set. `subset` uses the cartesian product of\n * the indices specified in each dimension.\n * @param {*} [replacement] An array, matrix, or scalar.\n * If provided, the subset is replaced with replacement.\n * If not provided, the subset is returned\n * @param {*} [defaultValue=undefined] Default value, filled in on new entries when\n * the matrix is resized. If not provided,\n * math.matrix elements will be left undefined.\n * @return {Array | Matrix | string} Either the retrieved subset or the updated matrix.\n */\n\n return typed(name, {\n // get subset\n 'Matrix, Index': function (value, index) {\n if (isEmptyIndex(index)) { return matrix() }\n validateIndexSourceSize(value, index)\n return value.subset(index)\n },\n\n 'Array, Index': typed.referTo('Matrix, Index', function (subsetRef) {\n return function (value, index) {\n const subsetResult = subsetRef(matrix(value), index)\n return index.isScalar() ? subsetResult : subsetResult.valueOf()\n }\n }),\n\n 'Object, Index': _getObjectProperty,\n\n 'string, Index': _getSubstring,\n\n // set subset\n 'Matrix, Index, any, any': function (value, index, replacement, defaultValue) {\n if (isEmptyIndex(index)) { return value }\n validateIndexSourceSize(value, index)\n return value.clone().subset(index, _broadcastReplacement(replacement, index), defaultValue)\n },\n\n 'Array, Index, any, any': typed.referTo('Matrix, Index, any, any', function (subsetRef) {\n return function (value, index, replacement, defaultValue) {\n const subsetResult = subsetRef(matrix(value), index, replacement, defaultValue)\n return subsetResult.isMatrix ? subsetResult.valueOf() : subsetResult\n }\n }),\n\n 'Array, Index, any': typed.referTo('Matrix, Index, any, any', function (subsetRef) {\n return function (value, index, replacement) {\n return subsetRef(matrix(value), index, replacement, undefined).valueOf()\n }\n }),\n\n 'Matrix, Index, any': typed.referTo('Matrix, Index, any, any', function (subsetRef) {\n return function (value, index, replacement) { return subsetRef(value, index, replacement, undefined) }\n }),\n\n 'string, Index, string': _setSubstring,\n 'string, Index, string, string': _setSubstring,\n 'Object, Index, any': _setObjectProperty\n })\n\n /**\n * Broadcasts a replacment value to be the same size as index\n * @param {number | BigNumber | Array | Matrix} replacement Replacement value to try to broadcast\n * @param {*} index Index value\n * @returns broadcasted replacement that matches the size of index\n */\n\n function _broadcastReplacement (replacement, index) {\n if (typeof replacement === 'string') {\n throw new Error('can\\'t boradcast a string')\n }\n if (index._isScalar) {\n return replacement\n }\n\n const indexSize = index.size()\n if (indexSize.every(d => d > 0)) {\n try {\n return add(replacement, zeros(indexSize))\n } catch (error) {\n return replacement\n }\n } else {\n return replacement\n }\n }\n})\n\n/**\n * Retrieve a subset of a string\n * @param {string} str string from which to get a substring\n * @param {Index} index An index or list of indices (character positions)\n * @returns {string} substring\n * @private\n */\nfunction _getSubstring (str, index) {\n if (!isIndex(index)) {\n // TODO: better error message\n throw new TypeError('Index expected')\n }\n\n if (isEmptyIndex(index)) { return '' }\n validateIndexSourceSize(Array.from(str), index)\n\n if (index.size().length !== 1) {\n throw new DimensionError(index.size().length, 1)\n }\n\n // validate whether the range is out of range\n const strLen = str.length\n validateIndex(index.min()[0], strLen)\n validateIndex(index.max()[0], strLen)\n\n const range = index.dimension(0)\n\n let substr = ''\n range.forEach(function (v) {\n substr += str.charAt(v)\n })\n\n return substr\n}\n\n/**\n * Replace a substring in a string\n * @param {string} str string to be replaced\n * @param {Index} index An index or list of indices (character positions)\n * @param {string} replacement Replacement string\n * @param {string} [defaultValue] Default value to be used when resizing\n * the string. is ' ' by default\n * @returns {string} result\n * @private\n */\nfunction _setSubstring (str, index, replacement, defaultValue) {\n if (!index || index.isIndex !== true) {\n // TODO: better error message\n throw new TypeError('Index expected')\n }\n if (isEmptyIndex(index)) { return str }\n validateIndexSourceSize(Array.from(str), index)\n if (index.size().length !== 1) {\n throw new DimensionError(index.size().length, 1)\n }\n if (defaultValue !== undefined) {\n if (typeof defaultValue !== 'string' || defaultValue.length !== 1) {\n throw new TypeError('Single character expected as defaultValue')\n }\n } else {\n defaultValue = ' '\n }\n\n const range = index.dimension(0)\n const len = range.size()[0]\n\n if (len !== replacement.length) {\n throw new DimensionError(range.size()[0], replacement.length)\n }\n\n // validate whether the range is out of range\n const strLen = str.length\n validateIndex(index.min()[0])\n validateIndex(index.max()[0])\n\n // copy the string into an array with characters\n const chars = []\n for (let i = 0; i < strLen; i++) {\n chars[i] = str.charAt(i)\n }\n\n range.forEach(function (v, i) {\n chars[v] = replacement.charAt(i[0])\n })\n\n // initialize undefined characters with a space\n if (chars.length > strLen) {\n for (let i = strLen - 1, len = chars.length; i < len; i++) {\n if (!chars[i]) {\n chars[i] = defaultValue\n }\n }\n }\n\n return chars.join('')\n}\n\n/**\n * Retrieve a property from an object\n * @param {Object} object\n * @param {Index} index\n * @return {*} Returns the value of the property\n * @private\n */\nfunction _getObjectProperty (object, index) {\n if (isEmptyIndex(index)) { return undefined }\n\n if (index.size().length !== 1) {\n throw new DimensionError(index.size(), 1)\n }\n\n const key = index.dimension(0)\n if (typeof key !== 'string') {\n throw new TypeError('String expected as index to retrieve an object property')\n }\n\n return getSafeProperty(object, key)\n}\n\n/**\n * Set a property on an object\n * @param {Object} object\n * @param {Index} index\n * @param {*} replacement\n * @return {*} Returns the updated object\n * @private\n */\nfunction _setObjectProperty (object, index, replacement) {\n if (isEmptyIndex(index)) { return object }\n if (index.size().length !== 1) {\n throw new DimensionError(index.size(), 1)\n }\n\n const key = index.dimension(0)\n if (typeof key !== 'string') {\n throw new TypeError('String expected as index to retrieve an object property')\n }\n\n // clone the object, and apply the property to the clone\n const updated = clone(object)\n setSafeProperty(updated, key, replacement)\n\n return updated\n}\n","import { clone } from '../../utils/object.js'\nimport { format } from '../../utils/string.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'transpose'\nconst dependencies = ['typed', 'matrix']\n\nexport const createTranspose = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix }) => {\n /**\n * Transpose a matrix. All values of the matrix are reflected over its\n * main diagonal. Only applicable to two dimensional matrices containing\n * a vector (i.e. having size `[1,n]` or `[n,1]`). One dimensional\n * vectors and scalars return the input unchanged.\n *\n * Syntax:\n *\n * math.transpose(x)\n *\n * Examples:\n *\n * const A = [[1, 2, 3], [4, 5, 6]]\n * math.transpose(A) // returns [[1, 4], [2, 5], [3, 6]]\n *\n * See also:\n *\n * diag, inv, subset, squeeze\n *\n * @param {Array | Matrix} x Matrix to be transposed\n * @return {Array | Matrix} The transposed matrix\n */\n return typed(name, {\n Array: x => transposeMatrix(matrix(x)).valueOf(),\n Matrix: transposeMatrix,\n any: clone // scalars\n })\n\n function transposeMatrix (x) {\n // matrix size\n const size = x.size()\n\n // result\n let c\n\n // process dimensions\n switch (size.length) {\n case 1:\n // vector\n c = x.clone()\n break\n\n case 2:\n {\n // rows and columns\n const rows = size[0]\n const columns = size[1]\n\n // check columns\n if (columns === 0) {\n // throw exception\n throw new RangeError('Cannot transpose a 2D matrix with no columns (size: ' + format(size) + ')')\n }\n\n // process storage format\n switch (x.storage()) {\n case 'dense':\n c = _denseTranspose(x, rows, columns)\n break\n case 'sparse':\n c = _sparseTranspose(x, rows, columns)\n break\n }\n }\n break\n\n default:\n // multi dimensional\n throw new RangeError('Matrix must be a vector or two dimensional (size: ' + format(size) + ')')\n }\n return c\n }\n\n function _denseTranspose (m, rows, columns) {\n // matrix array\n const data = m._data\n // transposed matrix data\n const transposed = []\n let transposedRow\n // loop columns\n for (let j = 0; j < columns; j++) {\n // initialize row\n transposedRow = transposed[j] = []\n // loop rows\n for (let i = 0; i < rows; i++) {\n // set data\n transposedRow[i] = clone(data[i][j])\n }\n }\n // return matrix\n return m.createDenseMatrix({\n data: transposed,\n size: [columns, rows],\n datatype: m._datatype\n })\n }\n\n function _sparseTranspose (m, rows, columns) {\n // matrix arrays\n const values = m._values\n const index = m._index\n const ptr = m._ptr\n // result matrices\n const cvalues = values ? [] : undefined\n const cindex = []\n const cptr = []\n // row counts\n const w = []\n for (let x = 0; x < rows; x++) { w[x] = 0 }\n // vars\n let p, l, j\n // loop values in matrix\n for (p = 0, l = index.length; p < l; p++) {\n // number of values in row\n w[index[p]]++\n }\n // cumulative sum\n let sum = 0\n // initialize cptr with the cummulative sum of row counts\n for (let i = 0; i < rows; i++) {\n // update cptr\n cptr.push(sum)\n // update sum\n sum += w[i]\n // update w\n w[i] = cptr[i]\n }\n // update cptr\n cptr.push(sum)\n // loop columns\n for (j = 0; j < columns; j++) {\n // values & index in column\n for (let k0 = ptr[j], k1 = ptr[j + 1], k = k0; k < k1; k++) {\n // C values & index\n const q = w[index[k]]++\n // C[j, i] = A[i, j]\n cindex[q] = j\n // check we need to process values (pattern matrix)\n if (values) { cvalues[q] = clone(values[k]) }\n }\n }\n // return matrix\n return m.createSparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [columns, rows],\n datatype: m._datatype\n })\n }\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'ctranspose'\nconst dependencies = ['typed', 'transpose', 'conj']\n\nexport const createCtranspose = /* #__PURE__ */ factory(name, dependencies, ({ typed, transpose, conj }) => {\n /**\n * Transpose and complex conjugate a matrix. All values of the matrix are\n * reflected over its main diagonal and then the complex conjugate is\n * taken. This is equivalent to complex conjugation for scalars and\n * vectors.\n *\n * Syntax:\n *\n * math.ctranspose(x)\n *\n * Examples:\n *\n * const A = [[1, 2, 3], [4, 5, math.complex(6,7)]]\n * math.ctranspose(A) // returns [[1, 4], [2, 5], [3, {re:6,im:-7}]]\n *\n * See also:\n *\n * transpose, diag, inv, subset, squeeze\n *\n * @param {Array | Matrix} x Matrix to be ctransposed\n * @return {Array | Matrix} The ctransposed matrix\n */\n return typed(name, {\n any: function (x) {\n return conj(transpose(x))\n }\n })\n})\n","import { isBigNumber } from '../../utils/is.js'\nimport { isInteger } from '../../utils/number.js'\nimport { resize } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'zeros'\nconst dependencies = ['typed', 'config', 'matrix', 'BigNumber']\n\nexport const createZeros = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, matrix, BigNumber }) => {\n /**\n * Create a matrix filled with zeros. The created matrix can have one or\n * multiple dimensions.\n *\n * Syntax:\n *\n * math.zeros(m)\n * math.zeros(m, format)\n * math.zeros(m, n)\n * math.zeros(m, n, format)\n * math.zeros([m, n])\n * math.zeros([m, n], format)\n *\n * Examples:\n *\n * math.zeros() // returns []\n * math.zeros(3) // returns [0, 0, 0]\n * math.zeros(3, 2) // returns [[0, 0], [0, 0], [0, 0]]\n * math.zeros(3, 'dense') // returns [0, 0, 0]\n *\n * const A = [[1, 2, 3], [4, 5, 6]]\n * math.zeros(math.size(A)) // returns [[0, 0, 0], [0, 0, 0]]\n *\n * See also:\n *\n * ones, identity, size, range\n *\n * @param {...(number|BigNumber) | Array} size The size of each dimension of the matrix\n * @param {string} [format] The Matrix storage format\n *\n * @return {Array | Matrix} A matrix filled with zeros\n */\n return typed(name, {\n '': function () {\n return (config.matrix === 'Array')\n ? _zeros([])\n : _zeros([], 'default')\n },\n\n // math.zeros(m, n, p, ..., format)\n // TODO: more accurate signature '...number | BigNumber, string' as soon as typed-function supports this\n '...number | BigNumber | string': function (size) {\n const last = size[size.length - 1]\n if (typeof last === 'string') {\n const format = size.pop()\n return _zeros(size, format)\n } else if (config.matrix === 'Array') {\n return _zeros(size)\n } else {\n return _zeros(size, 'default')\n }\n },\n\n Array: _zeros,\n\n Matrix: function (size) {\n const format = size.storage()\n return _zeros(size.valueOf(), format)\n },\n\n 'Array | Matrix, string': function (size, format) {\n return _zeros(size.valueOf(), format)\n }\n })\n\n /**\n * Create an Array or Matrix with zeros\n * @param {Array} size\n * @param {string} [format='default']\n * @return {Array | Matrix}\n * @private\n */\n function _zeros (size, format) {\n const hasBigNumbers = _normalize(size)\n const defaultValue = hasBigNumbers ? new BigNumber(0) : 0\n _validate(size)\n\n if (format) {\n // return a matrix\n const m = matrix(format)\n if (size.length > 0) {\n return m.resize(size, defaultValue)\n }\n return m\n } else {\n // return an Array\n const arr = []\n if (size.length > 0) {\n return resize(arr, size, defaultValue)\n }\n return arr\n }\n }\n\n // replace BigNumbers with numbers, returns true if size contained BigNumbers\n function _normalize (size) {\n let hasBigNumbers = false\n size.forEach(function (value, index, arr) {\n if (isBigNumber(value)) {\n hasBigNumbers = true\n arr[index] = value.toNumber()\n }\n })\n return hasBigNumbers\n }\n\n // validate arguments\n function _validate (size) {\n size.forEach(function (value) {\n if (typeof value !== 'number' || !isInteger(value) || value < 0) {\n throw new Error('Parameters in function zeros must be positive integers')\n }\n })\n }\n})\n\n// TODO: zeros contains almost the same code as ones. Reuse this?\n","import { arraySize } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'fft'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'addScalar',\n 'multiplyScalar',\n 'divideScalar',\n 'exp',\n 'tau',\n 'i',\n 'dotDivide',\n 'conj',\n 'pow',\n 'ceil',\n 'log2'\n]\n\nexport const createFft = /* #__PURE__ */ factory(name, dependencies, ({\n typed,\n matrix,\n addScalar,\n multiplyScalar,\n divideScalar,\n exp,\n tau,\n i: I,\n dotDivide,\n conj,\n pow,\n ceil,\n log2\n}) => {\n /**\n * Calculate N-dimensional Fourier transform\n *\n * Syntax:\n *\n * math.fft(arr)\n *\n * Examples:\n *\n * math.fft([[1, 0], [1, 0]]) // returns [[{re:2, im:0}, {re:2, im:0}], [{re:0, im:0}, {re:0, im:0}]]\n *\n *\n * See Also:\n *\n * ifft\n *\n * @param {Array | Matrix} arr An array or matrix\n * @return {Array | Matrix} N-dimensional Fourier transformation of the array\n */\n return typed(name, {\n Array: _ndFft,\n Matrix: function (matrix) {\n return matrix.create(_ndFft(matrix.valueOf()), matrix.datatype())\n }\n })\n\n /**\n * Perform an N-dimensional Fourier transform\n *\n * @param {Array} arr The array\n * @return {Array} resulting array\n */\n function _ndFft (arr) {\n const size = arraySize(arr)\n if (size.length === 1) return _fft(arr, size[0])\n // ndFft along dimension 1,...,N-1 then 1dFft along dimension 0\n return _1dFft(arr.map(slice => _ndFft(slice, size.slice(1))), 0)\n }\n\n /**\n * Perform an 1-dimensional Fourier transform\n *\n * @param {Array} arr The array\n * @param {number} dim dimension of the array to perform on\n * @return {Array} resulting array\n */\n function _1dFft (arr, dim) {\n const size = arraySize(arr)\n if (dim !== 0) return new Array(size[0]).fill(0).map((_, i) => _1dFft(arr[i], dim - 1))\n if (size.length === 1) return _fft(arr)\n function _transpose (arr) { // Swap first 2 dimensions\n const size = arraySize(arr)\n return new Array(size[1]).fill(0).map((_, j) => new Array(size[0]).fill(0).map((_, i) => arr[i][j]))\n }\n return _transpose(_1dFft(_transpose(arr), 1))\n }\n /**\n * Perform an 1-dimensional non-power-of-2 Fourier transform using Chirp-Z Transform\n *\n * @param {Array} arr The array\n * @return {Array} resulting array\n */\n function _czt (arr) {\n const n = arr.length\n const w = exp(divideScalar(multiplyScalar(-1, multiplyScalar(I, tau)), n))\n const chirp = []\n for (let i = 1 - n; i < n; i++) {\n chirp.push(pow(w, divideScalar(pow(i, 2), 2)))\n }\n const N2 = pow(2, ceil(log2(n + n - 1)))\n const xp = [\n ...new Array(n).fill(0).map((_, i) => multiplyScalar(arr[i], chirp[n - 1 + i])),\n ...new Array(N2 - n).fill(0)\n ]\n const ichirp = [\n ...new Array(n + n - 1).fill(0).map((_, i) => divideScalar(1, chirp[i])),\n ...new Array(N2 - (n + n - 1)).fill(0)\n ]\n const fftXp = _fft(xp)\n const fftIchirp = _fft(ichirp)\n const fftProduct = new Array(N2).fill(0).map((_, i) => multiplyScalar(fftXp[i], fftIchirp[i]))\n const ifftProduct = dotDivide(conj(_ndFft(conj(fftProduct))), N2)\n const ret = []\n for (let i = n - 1; i < n + n - 1; i++) {\n ret.push(multiplyScalar(ifftProduct[i], chirp[i]))\n }\n return ret\n }\n /**\n * Perform an 1-dimensional Fourier transform\n *\n * @param {Array} arr The array\n * @return {Array} resulting array\n */\n function _fft (arr) {\n const len = arr.length\n if (len === 1) return [arr[0]]\n if (len % 2 === 0) {\n const ret = [\n ..._fft(arr.filter((_, i) => i % 2 === 0), len / 2),\n ..._fft(arr.filter((_, i) => i % 2 === 1), len / 2)\n ]\n for (let k = 0; k < len / 2; k++) {\n const p = ret[k]\n const q = multiplyScalar(\n ret[k + len / 2],\n exp(\n multiplyScalar(multiplyScalar(tau, I), divideScalar(-k, len))\n )\n )\n ret[k] = addScalar(p, q)\n ret[k + len / 2] = addScalar(p, multiplyScalar(-1, q))\n }\n return ret\n } else {\n // use chirp-z transform for non-power-of-2 FFT\n return _czt(arr)\n }\n // throw new Error('Can only calculate FFT of power-of-two size')\n }\n})\n","import { arraySize } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\nimport { isMatrix } from '../../utils/is.js'\n\nconst name = 'ifft'\nconst dependencies = [\n 'typed',\n 'fft',\n 'dotDivide',\n 'conj'\n]\n\nexport const createIfft = /* #__PURE__ */ factory(name, dependencies, ({\n typed,\n fft,\n dotDivide,\n conj\n}) => {\n /**\n * Calculate N-dimensional inverse Fourier transform\n *\n * Syntax:\n *\n * math.ifft(arr)\n *\n * Examples:\n *\n * math.ifft([[2, 2], [0, 0]]) // returns [[{re:1, im:0}, {re:0, im:0}], [{re:1, im:0}, {re:0, im:0}]]\n *\n * See Also:\n *\n * fft\n *\n * @param {Array | Matrix} arr An array or matrix\n * @return {Array | Matrix} N-dimensional Fourier transformation of the array\n */\n return typed(name, {\n 'Array | Matrix': function (arr) {\n const size = isMatrix(arr) ? arr.size() : arraySize(arr)\n return dotDivide(conj(fft(conj(arr))), size.reduce((acc, curr) => acc * curr, 1))\n }\n })\n})\n","import { isUnit, isNumber, isBigNumber } from '../../utils/is.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'solveODE'\nconst dependencies = [\n 'typed',\n 'add',\n 'subtract',\n 'multiply',\n 'divide',\n 'max',\n 'map',\n 'abs',\n 'isPositive',\n 'isNegative',\n 'larger',\n 'smaller',\n 'matrix',\n 'bignumber',\n 'unaryMinus'\n]\n\nexport const createSolveODE = /* #__PURE__ */ factory(name, dependencies, (\n {\n typed,\n add,\n subtract,\n multiply,\n divide,\n max,\n map,\n abs,\n isPositive,\n isNegative,\n larger,\n smaller,\n matrix,\n bignumber,\n unaryMinus\n }\n) => {\n /**\n * Numerical Integration of Ordinary Differential Equations\n *\n * Two variable step methods are provided:\n * - \"RK23\": Bogacki–Shampine method\n * - \"RK45\": Dormand-Prince method RK5(4)7M (default)\n *\n * The arguments are expected as follows.\n *\n * - `func` should be the forcing function `f(t, y)`\n * - `tspan` should be a vector of two numbers or units `[tStart, tEnd]`\n * - `y0` the initial state values, should be a scalar or a flat array\n * - `options` should be an object with the following information:\n * - `method` ('RK45'): ['RK23', 'RK45']\n * - `tol` (1e-3): Numeric tolerance of the method, the solver keeps the error estimates less than this value\n * - `firstStep`: Initial step size\n * - `minStep`: minimum step size of the method\n * - `maxStep`: maximum step size of the method\n * - `minDelta` (0.2): minimum ratio of change for the step\n * - `maxDelta` (5): maximum ratio of change for the step\n * - `maxIter` (1e4): maximum number of iterations\n *\n * The returned value is an object with `{t, y}` please note that even though `t` means time, it can represent any other independant variable like `x`:\n * - `t` an array of size `[n]`\n * - `y` the states array can be in two ways\n * - **if `y0` is a scalar:** returns an array-like of size `[n]`\n * - **if `y0` is a flat array-like of size [m]:** returns an array like of size `[n, m]`\n *\n * Syntax:\n *\n * math.solveODE(func, tspan, y0)\n * math.solveODE(func, tspan, y0, options)\n *\n * Examples:\n *\n * function func(t, y) {return y}\n * const tspan = [0, 4]\n * const y0 = 1\n * math.solveODE(func, tspan, y0)\n * math.solveODE(func, tspan, [1, 2])\n * math.solveODE(func, tspan, y0, { method:\"RK23\", maxStep:0.1 })\n *\n * See also:\n *\n * derivative, simplifyCore\n *\n * @param {function} func The forcing function f(t,y)\n * @param {Array | Matrix} tspan The time span\n * @param {number | BigNumber | Unit | Array | Matrix} y0 The initial value\n * @param {Object} [options] Optional configuration options\n * @return {Object} Return an object with t and y values as arrays\n */\n\n function _rk (butcherTableau) {\n // generates an adaptive runge kutta method from it's butcher tableau\n\n return function (f, tspan, y0, options) {\n // adaptive runge kutta methods\n const wrongTSpan = !((tspan.length === 2) && (tspan.every(isNumOrBig) || tspan.every(isUnit)))\n if (wrongTSpan) {\n throw new Error('\"tspan\" must be an Array of two numeric values or two units [tStart, tEnd]')\n }\n const t0 = tspan[0] // initial time\n const tf = tspan[1] // final time\n const isForwards = larger(tf, t0)\n const firstStep = options.firstStep\n if (firstStep !== undefined && !isPositive(firstStep)) {\n throw new Error('\"firstStep\" must be positive')\n }\n const maxStep = options.maxStep\n if (maxStep !== undefined && !isPositive(maxStep)) {\n throw new Error('\"maxStep\" must be positive')\n }\n const minStep = options.minStep\n if (minStep && isNegative(minStep)) {\n throw new Error('\"minStep\" must be positive or zero')\n }\n const timeVars = [t0, tf, firstStep, minStep, maxStep].filter(x => x !== undefined)\n if (!(timeVars.every(isNumOrBig) || timeVars.every(isUnit))) {\n throw new Error('Inconsistent type of \"t\" dependant variables')\n }\n const steps = 1 // divide time in this number of steps\n const tol = options.tol ? options.tol : 1e-4 // define a tolerance (must be an option)\n const minDelta = options.minDelta ? options.minDelta : 0.2\n const maxDelta = options.maxDelta ? options.maxDelta : 5\n const maxIter = options.maxIter ? options.maxIter : 10_000 // stop inifite evaluation if something goes wrong\n const hasBigNumbers = [t0, tf, ...y0, maxStep, minStep].some(isBigNumber)\n const [a, c, b, bp] = hasBigNumbers\n ? [\n bignumber(butcherTableau.a),\n bignumber(butcherTableau.c),\n bignumber(butcherTableau.b),\n bignumber(butcherTableau.bp)\n ]\n : [butcherTableau.a, butcherTableau.c, butcherTableau.b, butcherTableau.bp]\n\n let h = firstStep\n ? isForwards ? firstStep : unaryMinus(firstStep)\n : divide(subtract(tf, t0), steps) // define the first step size\n const t = [t0] // start the time array\n const y = [y0] // start the solution array\n\n const deltaB = subtract(b, bp) // b - bp\n\n let n = 0\n let iter = 0\n const ongoing = _createOngoing(isForwards)\n const trimStep = _createTrimStep(isForwards)\n // iterate unitil it reaches either the final time or maximum iterations\n while (ongoing(t[n], tf)) {\n const k = []\n\n // trim the time step so that it doesn't overshoot\n h = trimStep(t[n], tf, h)\n\n // calculate the first value of k\n k.push(f(t[n], y[n]))\n\n // calculate the rest of the values of k\n for (let i = 1; i < c.length; ++i) {\n k.push(\n f(\n add(t[n], multiply(c[i], h)),\n add(y[n], multiply(h, a[i], k))\n )\n )\n }\n\n // estimate the error by comparing solutions of different orders\n const TE = max(\n abs(\n map(multiply(deltaB, k), (X) =>\n isUnit(X) ? X.value : X\n )\n )\n )\n\n if (TE < tol && tol / TE > 1 / 4) {\n // push solution if within tol\n t.push(add(t[n], h))\n y.push(add(y[n], multiply(h, b, k)))\n n++\n }\n\n // estimate the delta value that will affect the step size\n let delta = 0.84 * (tol / TE) ** (1 / 5)\n\n if (smaller(delta, minDelta)) {\n delta = minDelta\n } else if (larger(delta, maxDelta)) {\n delta = maxDelta\n }\n\n delta = hasBigNumbers ? bignumber(delta) : delta\n h = multiply(h, delta)\n\n if (maxStep && larger(abs(h), maxStep)) {\n h = isForwards ? maxStep : unaryMinus(maxStep)\n } else if (minStep && smaller(abs(h), minStep)) {\n h = isForwards ? minStep : unaryMinus(minStep)\n }\n iter++\n if (iter > maxIter) {\n throw new Error('Maximum number of iterations reached, try changing options')\n }\n }\n return { t, y }\n }\n }\n\n function _rk23 (f, tspan, y0, options) {\n // Bogacki–Shampine method\n\n // Define the butcher table\n const a = [\n [],\n [1 / 2],\n [0, 3 / 4],\n [2 / 9, 1 / 3, 4 / 9]\n ]\n\n const c = [null, 1 / 2, 3 / 4, 1]\n const b = [2 / 9, 1 / 3, 4 / 9, 0]\n const bp = [7 / 24, 1 / 4, 1 / 3, 1 / 8]\n\n const butcherTableau = { a, c, b, bp }\n\n // Solve an adaptive step size rk method\n return _rk(butcherTableau)(f, tspan, y0, options)\n }\n\n function _rk45 (f, tspan, y0, options) {\n // Dormand Prince method\n\n // Define the butcher tableau\n const a = [\n [],\n [1 / 5],\n [3 / 40, 9 / 40],\n [44 / 45, -56 / 15, 32 / 9],\n [19372 / 6561, -25360 / 2187, 64448 / 6561, -212 / 729],\n [9017 / 3168, -355 / 33, 46732 / 5247, 49 / 176, -5103 / 18656],\n [35 / 384, 0, 500 / 1113, 125 / 192, -2187 / 6784, 11 / 84]\n ]\n\n const c = [null, 1 / 5, 3 / 10, 4 / 5, 8 / 9, 1, 1]\n const b = [35 / 384, 0, 500 / 1113, 125 / 192, -2187 / 6784, 11 / 84, 0]\n const bp = [5179 / 57600, 0, 7571 / 16695, 393 / 640, -92097 / 339200, 187 / 2100, 1 / 40]\n\n const butcherTableau = { a, c, b, bp }\n\n // Solve an adaptive step size rk method\n return _rk(butcherTableau)(f, tspan, y0, options)\n }\n\n function _solveODE (f, tspan, y0, opt) {\n const method = opt.method ? opt.method : 'RK45'\n const methods = {\n RK23: _rk23,\n RK45: _rk45\n }\n if (method.toUpperCase() in methods) {\n const methodOptions = { ...opt } // clone the options object\n delete methodOptions.method // delete the method as it won't be needed\n return methods[method.toUpperCase()](f, tspan, y0, methodOptions)\n } else {\n // throw an error indicating there is no such method\n const methodsWithQuotes = Object.keys(methods).map(x => `\"${x}\"`)\n // generates a string of methods like: \"BDF\", \"RK23\" and \"RK45\"\n const availableMethodsString = `${methodsWithQuotes.slice(0, -1).join(', ')} and ${methodsWithQuotes.slice(-1)}`\n throw new Error(`Unavailable method \"${method}\". Available methods are ${availableMethodsString}`)\n }\n }\n\n function _createOngoing (isForwards) {\n // returns the correct function to test if it's still iterating\n return isForwards ? smaller : larger\n }\n\n function _createTrimStep (isForwards) {\n const outOfBounds = isForwards ? larger : smaller\n return function (t, tf, h) {\n const next = add(t, h)\n return outOfBounds(next, tf) ? subtract(tf, t) : h\n }\n }\n\n function isNumOrBig (x) {\n // checks if it's a number or bignumber\n return isBigNumber(x) || isNumber(x)\n }\n\n function _matrixSolveODE (f, T, y0, options) {\n // receives matrices and returns matrices\n const sol = _solveODE(f, T.toArray(), y0.toArray(), options)\n return { t: matrix(sol.t), y: matrix(sol.y) }\n }\n\n return typed('solveODE', {\n 'function, Array, Array, Object': _solveODE,\n 'function, Matrix, Matrix, Object': _matrixSolveODE,\n 'function, Array, Array': (f, T, y0) => _solveODE(f, T, y0, {}),\n 'function, Matrix, Matrix': (f, T, y0) => _matrixSolveODE(f, T, y0, {}),\n 'function, Array, number | BigNumber | Unit': (f, T, y0) => {\n const sol = _solveODE(f, T, [y0], {})\n return { t: sol.t, y: sol.y.map((Y) => Y[0]) }\n },\n 'function, Matrix, number | BigNumber | Unit': (f, T, y0) => {\n const sol = _solveODE(f, T.toArray(), [y0], {})\n return { t: matrix(sol.t), y: matrix(sol.y.map((Y) => Y[0])) }\n },\n 'function, Array, number | BigNumber | Unit, Object': (f, T, y0, options) => {\n const sol = _solveODE(f, T, [y0], options)\n return { t: sol.t, y: sol.y.map((Y) => Y[0]) }\n },\n 'function, Matrix, number | BigNumber | Unit, Object': (f, T, y0, options) => {\n const sol = _solveODE(f, T.toArray(), [y0], options)\n return { t: matrix(sol.t), y: matrix(sol.y.map((Y) => Y[0])) }\n }\n })\n})\n","/* eslint-disable no-loss-of-precision */\n\nimport { deepMap } from '../../utils/collection.js'\nimport { sign } from '../../utils/number.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'erf'\nconst dependencies = [\n 'typed'\n]\n\nexport const createErf = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Compute the erf function of a value using a rational Chebyshev\n * approximations for different intervals of x.\n *\n * This is a translation of W. J. Cody's Fortran implementation from 1987\n * ( https://www.netlib.org/specfun/erf ). See the AMS publication\n * \"Rational Chebyshev Approximations for the Error Function\" by W. J. Cody\n * for an explanation of this process.\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.erf(x)\n *\n * Examples:\n *\n * math.erf(0.2) // returns 0.22270258921047847\n * math.erf(-0.5) // returns -0.5204998778130465\n * math.erf(4) // returns 0.9999999845827421\n *\n * See also:\n * zeta\n *\n * @param {number | Array | Matrix} x A real number\n * @return {number | Array | Matrix} The erf of `x`\n */\n return typed('name', {\n number: function (x) {\n const y = Math.abs(x)\n\n if (y >= MAX_NUM) {\n return sign(x)\n }\n if (y <= THRESH) {\n return sign(x) * erf1(y)\n }\n if (y <= 4.0) {\n return sign(x) * (1 - erfc2(y))\n }\n return sign(x) * (1 - erfc3(y))\n },\n\n 'Array | Matrix': typed.referToSelf(self => n => deepMap(n, self))\n\n // TODO: For complex numbers, use the approximation for the Faddeeva function\n // from \"More Efficient Computation of the Complex Error Function\" (AMS)\n\n })\n\n /**\n * Approximates the error function erf() for x <= 0.46875 using this function:\n * n\n * erf(x) = x * sum (p_j * x^(2j)) / (q_j * x^(2j))\n * j=0\n */\n function erf1 (y) {\n const ysq = y * y\n let xnum = P[0][4] * ysq\n let xden = ysq\n let i\n\n for (i = 0; i < 3; i += 1) {\n xnum = (xnum + P[0][i]) * ysq\n xden = (xden + Q[0][i]) * ysq\n }\n return y * (xnum + P[0][3]) / (xden + Q[0][3])\n }\n\n /**\n * Approximates the complement of the error function erfc() for\n * 0.46875 <= x <= 4.0 using this function:\n * n\n * erfc(x) = e^(-x^2) * sum (p_j * x^j) / (q_j * x^j)\n * j=0\n */\n function erfc2 (y) {\n let xnum = P[1][8] * y\n let xden = y\n let i\n\n for (i = 0; i < 7; i += 1) {\n xnum = (xnum + P[1][i]) * y\n xden = (xden + Q[1][i]) * y\n }\n const result = (xnum + P[1][7]) / (xden + Q[1][7])\n const ysq = parseInt(y * 16) / 16\n const del = (y - ysq) * (y + ysq)\n return Math.exp(-ysq * ysq) * Math.exp(-del) * result\n }\n\n /**\n * Approximates the complement of the error function erfc() for x > 4.0 using\n * this function:\n *\n * erfc(x) = (e^(-x^2) / x) * [ 1/sqrt(pi) +\n * n\n * 1/(x^2) * sum (p_j * x^(-2j)) / (q_j * x^(-2j)) ]\n * j=0\n */\n function erfc3 (y) {\n let ysq = 1 / (y * y)\n let xnum = P[2][5] * ysq\n let xden = ysq\n let i\n\n for (i = 0; i < 4; i += 1) {\n xnum = (xnum + P[2][i]) * ysq\n xden = (xden + Q[2][i]) * ysq\n }\n let result = ysq * (xnum + P[2][4]) / (xden + Q[2][4])\n result = (SQRPI - result) / y\n ysq = parseInt(y * 16) / 16\n const del = (y - ysq) * (y + ysq)\n return Math.exp(-ysq * ysq) * Math.exp(-del) * result\n }\n})\n\n/**\n * Upper bound for the first approximation interval, 0 <= x <= THRESH\n * @constant\n */\nconst THRESH = 0.46875\n\n/**\n * Constant used by W. J. Cody's Fortran77 implementation to denote sqrt(pi)\n * @constant\n */\nconst SQRPI = 5.6418958354775628695e-1\n\n/**\n * Coefficients for each term of the numerator sum (p_j) for each approximation\n * interval (see W. J. Cody's paper for more details)\n * @constant\n */\nconst P = [[\n 3.16112374387056560e00, 1.13864154151050156e02,\n 3.77485237685302021e02, 3.20937758913846947e03,\n 1.85777706184603153e-1\n], [\n 5.64188496988670089e-1, 8.88314979438837594e00,\n 6.61191906371416295e01, 2.98635138197400131e02,\n 8.81952221241769090e02, 1.71204761263407058e03,\n 2.05107837782607147e03, 1.23033935479799725e03,\n 2.15311535474403846e-8\n], [\n 3.05326634961232344e-1, 3.60344899949804439e-1,\n 1.25781726111229246e-1, 1.60837851487422766e-2,\n 6.58749161529837803e-4, 1.63153871373020978e-2\n]]\n\n/**\n * Coefficients for each term of the denominator sum (q_j) for each approximation\n * interval (see W. J. Cody's paper for more details)\n * @constant\n */\nconst Q = [[\n 2.36012909523441209e01, 2.44024637934444173e02,\n 1.28261652607737228e03, 2.84423683343917062e03\n], [\n 1.57449261107098347e01, 1.17693950891312499e02,\n 5.37181101862009858e02, 1.62138957456669019e03,\n 3.29079923573345963e03, 4.36261909014324716e03,\n 3.43936767414372164e03, 1.23033935480374942e03\n], [\n 2.56852019228982242e00, 1.87295284992346047e00,\n 5.27905102951428412e-1, 6.05183413124413191e-2,\n 2.33520497626869185e-3\n]]\n\n/**\n * Maximum/minimum safe numbers to input to erf() (in ES6+, this number is\n * Number.[MAX|MIN]_SAFE_INTEGER). erf() for all numbers beyond this limit will\n * return 1\n */\nconst MAX_NUM = Math.pow(2, 53)\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'zeta'\nconst dependencies = ['typed', 'config', 'multiply', 'pow', 'divide', 'factorial', 'equal', 'smallerEq', 'isNegative', 'gamma', 'sin', 'subtract', 'add', '?Complex', '?BigNumber', 'pi']\n\nexport const createZeta = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, multiply, pow, divide, factorial, equal, smallerEq, isNegative, gamma, sin, subtract, add, Complex, BigNumber, pi }) => {\n /**\n * Compute the Riemann Zeta function of a value using an infinite series for\n * all of the complex plane using Riemann's Functional equation.\n *\n * Based off the paper by Xavier Gourdon and Pascal Sebah\n * ( http://numbers.computation.free.fr/Constants/Miscellaneous/zetaevaluations.pdf )\n *\n * Implementation and slight modification by Anik Patel\n *\n * Note: the implementation is accurate up to about 6 digits.\n *\n * Syntax:\n *\n * math.zeta(n)\n *\n * Examples:\n *\n * math.zeta(5) // returns 1.0369277551433895\n * math.zeta(-0.5) // returns -0.2078862249773449\n * math.zeta(math.i) // returns 0.0033002236853253153 - 0.4181554491413212i\n *\n * See also:\n * erf\n *\n * @param {number | Complex | BigNumber} s A Real, Complex or BigNumber parameter to the Riemann Zeta Function\n * @return {number | Complex | BigNumber} The Riemann Zeta of `s`\n */\n return typed(name, {\n number: (s) => zetaNumeric(s, value => value, () => 20),\n BigNumber: (s) => zetaNumeric(\n s,\n value => new BigNumber(value),\n () => {\n // relTol is for example 1e-12. Extract the positive exponent 12 from that\n return Math.abs(Math.log10(config.relTol))\n }\n ),\n Complex: zetaComplex\n })\n\n /**\n * @param {number | BigNumber} s\n * @param {(value: number) => number | BigNumber} createValue\n * @param {(value: number | BigNumber | Complex) => number} determineDigits\n * @returns {number | BigNumber}\n */\n function zetaNumeric (s, createValue, determineDigits) {\n if (equal(s, 0)) {\n return createValue(-0.5)\n }\n if (equal(s, 1)) {\n return createValue(NaN)\n }\n if (!isFinite(s)) {\n return isNegative(s) ? createValue(NaN) : createValue(1)\n }\n\n return zeta(s, createValue, determineDigits, s => s)\n }\n\n /**\n * @param {Complex} s\n * @returns {Complex}\n */\n function zetaComplex (s) {\n if (s.re === 0 && s.im === 0) {\n return new Complex(-0.5)\n }\n if (s.re === 1) {\n return new Complex(NaN, NaN)\n }\n if (s.re === Infinity && s.im === 0) {\n return new Complex(1)\n }\n if (s.im === Infinity || s.re === -Infinity) {\n return new Complex(NaN, NaN)\n }\n\n return zeta(s, value => value, s => Math.round(1.3 * 15 + 0.9 * Math.abs(s.im)), s => s.re)\n }\n\n /**\n * @param {number | BigNumber | Complex} s\n * @param {(value: number) => number | BigNumber | Complex} createValue\n * @param {(value: number | BigNumber | Complex) => number} determineDigits\n * @param {(value: number | BigNumber | Complex) => number} getRe\n * @returns {*|number}\n */\n function zeta (s, createValue, determineDigits, getRe) {\n const n = determineDigits(s)\n if (getRe(s) > -(n - 1) / 2) {\n return f(s, createValue(n), createValue)\n } else {\n // Function Equation for reflection to x < 1\n let c = multiply(pow(2, s), pow(createValue(pi), subtract(s, 1)))\n c = multiply(c, (sin(multiply(divide(createValue(pi), 2), s))))\n c = multiply(c, gamma(subtract(1, s)))\n return multiply(c, zeta(subtract(1, s), createValue, determineDigits, getRe))\n }\n }\n\n /**\n * Calculate a portion of the sum\n * @param {number | BigNumber} k a positive integer\n * @param {number | BigNumber} n a positive integer\n * @return {number} the portion of the sum\n **/\n function d (k, n) {\n let S = k\n for (let j = k; smallerEq(j, n); j = add(j, 1)) {\n const factor = divide(\n multiply(factorial(add(n, subtract(j, 1))), pow(4, j)),\n multiply(factorial(subtract(n, j)), factorial(multiply(2, j)))\n )\n S = add(S, factor)\n }\n\n return multiply(n, S)\n }\n\n /**\n * Calculate the positive Riemann Zeta function\n * @param {number} s a real or complex number with s.re > 1\n * @param {number} n a positive integer\n * @param {(number) => number | BigNumber | Complex} createValue\n * @return {number} Riemann Zeta of s\n **/\n function f (s, n, createValue) {\n const c = divide(1, multiply(d(createValue(0), n), subtract(1, pow(2, subtract(1, s)))))\n let S = createValue(0)\n for (let k = createValue(1); smallerEq(k, n); k = add(k, 1)) {\n S = add(S, divide(multiply((-1) ** (k - 1), d(k, n)), pow(k, s)))\n }\n return multiply(c, S)\n }\n})\n","import { flatten } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'mode'\nconst dependencies = ['typed', 'isNaN', 'isNumeric']\n\nexport const createMode = /* #__PURE__ */ factory(name, dependencies, ({ typed, isNaN: mathIsNaN, isNumeric }) => {\n /**\n * Computes the mode of a set of numbers or a list with values(numbers or characters).\n * If there are multiple modes, it returns a list of those values.\n *\n * Syntax:\n *\n * math.mode(a, b, c, ...)\n * math.mode(A)\n *\n * Examples:\n *\n * math.mode(2, 1, 4, 3, 1) // returns [1]\n * math.mode([1, 2.7, 3.2, 4, 2.7]) // returns [2.7]\n * math.mode(1, 4, 6, 1, 6) // returns [1, 6]\n * math.mode('a','a','b','c') // returns [\"a\"]\n * math.mode(1, 1.5, 'abc') // returns [1, 1.5, \"abc\"]\n *\n * See also:\n *\n * median,\n * mean\n *\n * @param {... *} args A single matrix\n * @return {*} The mode of all values\n */\n return typed(name, {\n 'Array | Matrix': _mode,\n\n '...': function (args) {\n return _mode(args)\n }\n })\n\n /**\n * Calculates the mode in an 1-dimensional array\n * @param {Array} values\n * @return {Array} mode\n * @private\n */\n function _mode (values) {\n values = flatten(values.valueOf())\n const num = values.length\n if (num === 0) {\n throw new Error('Cannot calculate mode of an empty array')\n }\n\n const count = {}\n let mode = []\n let max = 0\n for (let i = 0; i < values.length; i++) {\n const value = values[i]\n\n if (isNumeric(value) && mathIsNaN(value)) {\n throw new Error('Cannot calculate mode of an array containing NaN values')\n }\n\n if (!(value in count)) {\n count[value] = 0\n }\n\n count[value]++\n\n if (count[value] === max) {\n mode.push(value)\n } else if (count[value] > max) {\n max = count[value]\n mode = [value]\n }\n }\n return mode\n }\n})\n","import { typeOf } from '../../../utils/is.js'\n\n/**\n * Improve error messages for statistics functions. Errors are typically\n * thrown in an internally used function like larger, causing the error\n * not to mention the function (like max) which is actually used by the user.\n *\n * @param {Error} err\n * @param {String} fnName\n * @param {*} [value]\n * @return {Error}\n */\nexport function improveErrorMessage (err, fnName, value) {\n // TODO: add information with the index (also needs transform in expression parser)\n let details\n\n if (String(err).includes('Unexpected type')) {\n details = arguments.length > 2\n ? ' (type: ' + typeOf(value) + ', value: ' + JSON.stringify(value) + ')'\n : ' (type: ' + err.data.actual + ')'\n\n return new TypeError('Cannot calculate ' + fnName + ', unexpected type of argument' + details)\n }\n\n if (String(err).includes('complex numbers')) {\n details = arguments.length > 2\n ? ' (type: ' + typeOf(value) + ', value: ' + JSON.stringify(value) + ')'\n : ''\n\n return new TypeError('Cannot calculate ' + fnName + ', no ordering relation is defined for complex numbers' + details)\n }\n\n return err\n}\n","import { deepForEach } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\nimport { safeNumberType } from '../../utils/number.js'\nimport { improveErrorMessage } from './utils/improveErrorMessage.js'\n\nconst name = 'prod'\nconst dependencies = ['typed', 'config', 'multiplyScalar', 'numeric']\n\nexport const createProd = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, multiplyScalar, numeric }) => {\n /**\n * Compute the product of a matrix or a list with values.\n * In case of a multidimensional array or matrix, the sum of all\n * elements will be calculated.\n *\n * Syntax:\n *\n * math.prod(a, b, c, ...)\n * math.prod(A)\n *\n * Examples:\n *\n * math.multiply(2, 3) // returns 6\n * math.prod(2, 3) // returns 6\n * math.prod(2, 3, 4) // returns 24\n * math.prod([2, 3, 4]) // returns 24\n * math.prod([[2, 5], [4, 3]]) // returns 120\n *\n * See also:\n *\n * mean, median, min, max, sum, std, variance\n *\n * @param {... *} args A single matrix or or multiple scalar values\n * @return {*} The product of all values\n */\n return typed(name, {\n // prod([a, b, c, d, ...])\n 'Array | Matrix': _prod,\n\n // prod([a, b, c, d, ...], dim)\n 'Array | Matrix, number | BigNumber': function (array, dim) {\n // TODO: implement prod(A, dim)\n throw new Error('prod(A, dim) is not yet supported')\n // return reduce(arguments[0], arguments[1], math.prod)\n },\n\n // prod(a, b, c, d, ...)\n '...': function (args) {\n return _prod(args)\n }\n })\n\n /**\n * Recursively calculate the product of an n-dimensional array\n * @param {Array} array\n * @return {number} prod\n * @private\n */\n function _prod (array) {\n let prod\n\n deepForEach(array, function (value) {\n try {\n prod = (prod === undefined) ? value : multiplyScalar(prod, value)\n } catch (err) {\n throw improveErrorMessage(err, 'prod', value)\n }\n })\n\n // make sure returning numeric value: parse a string into a numeric value\n if (typeof prod === 'string') {\n prod = numeric(prod, safeNumberType(prod, config))\n }\n\n if (prod === undefined) {\n throw new Error('Cannot calculate prod of an empty array')\n }\n\n return prod\n }\n})\n","import { format as formatString } from '../../utils/string.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'format'\nconst dependencies = ['typed']\n\nexport const createFormat = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Format a value of any type into a string.\n *\n * Syntax:\n *\n * math.format(value)\n * math.format(value, options)\n * math.format(value, precision)\n * math.format(value, callback)\n *\n * Where:\n *\n * - `value: *`\n * The value to be formatted\n * - `options: Object`\n * An object with formatting options. Available options:\n * - `notation: string`\n * Number notation. Choose from:\n * - `'fixed'`\n * Always use regular number notation.\n * For example `'123.40'` and `'14000000'`\n * - `'exponential'`\n * Always use exponential notation.\n * For example `'1.234e+2'` and `'1.4e+7'`\n * - `'engineering'`\n * Always use engineering notation: always have exponential notation,\n * and select the exponent to be a multiple of `3`.\n * For example `'123.4e+0'` and `'14.0e+6'`\n * - `'auto'` (default)\n * Regular number notation for numbers having an absolute value between\n * `lower` and `upper` bounds, and uses exponential notation elsewhere.\n * Lower bound is included, upper bound is excluded.\n * For example `'123.4'` and `'1.4e7'`.\n * - `'bin'`, `'oct'`, or `'hex'`\n * Format the number using binary, octal, or hexadecimal notation.\n * For example `'0b1101'` and `'0x10fe'`.\n * - `wordSize: number | BigNumber`\n * The word size in bits to use for formatting in binary, octal, or\n * hexadecimal notation. To be used only with `'bin'`, `'oct'`, or `'hex'`\n * values for `notation` option. When this option is defined the value\n * is formatted as a signed twos complement integer of the given word\n * size and the size suffix is appended to the output.\n * For example `format(-1, {notation: 'hex', wordSize: 8}) === '0xffi8'`.\n * Default value is undefined.\n * - `precision: number | BigNumber`\n * Limit the number of digits of the formatted value.\n * For regular numbers, must be a number between `0` and `16`.\n * For bignumbers, the maximum depends on the configured precision,\n * see function `config()`.\n * In case of notations `'exponential'`, `'engineering'`, and `'auto'`,\n * `precision` defines the total number of significant digits returned.\n * In case of notation `'fixed'`, `precision` defines the number of\n * significant digits after the decimal point.\n * `precision` is undefined by default.\n * - `lowerExp: number`\n * Exponent determining the lower boundary for formatting a value with\n * an exponent when `notation='auto'`. Default value is `-3`.\n * - `upperExp: number`\n * Exponent determining the upper boundary for formatting a value with\n * an exponent when `notation='auto'`. Default value is `5`.\n * - `fraction: string`. Available values: `'ratio'` (default) or `'decimal'`.\n * For example `format(fraction(1, 3))` will output `'1/3'` when `'ratio'`\n * is configured, and will output `'0.(3)'` when `'decimal'` is configured.\n * - `truncate: number`. Specifies the maximum allowed length of the\n * returned string. If it had been longer, the excess characters\n * are deleted and replaced with `'...'`.\n * - `callback: function`\n * A custom formatting function, invoked for all numeric elements in `value`,\n * for example all elements of a matrix, or the real and imaginary\n * parts of a complex number. This callback can be used to override the\n * built-in numeric notation with any type of formatting. Function `callback`\n * is called with `value` as parameter and must return a string.\n *\n * When `value` is an Object:\n *\n * - When the object contains a property `format` being a function, this function\n * is invoked as `value.format(options)` and the result is returned.\n * - When the object has its own `toString` method, this method is invoked\n * and the result is returned.\n * - In other cases the function will loop over all object properties and\n * return JSON object notation like '{\"a\": 2, \"b\": 3}'.\n *\n * When value is a function:\n *\n * - When the function has a property `syntax`, it returns this\n * syntax description.\n * - In other cases, a string `'function'` is returned.\n *\n * Examples:\n *\n * math.format(6.4) // returns '6.4'\n * math.format(1240000) // returns '1.24e+6'\n * math.format(1/3) // returns '0.3333333333333333'\n * math.format(1/3, 3) // returns '0.333'\n * math.format(21385, 2) // returns '21000'\n * math.format(12e8, {notation: 'fixed'}) // returns '1200000000'\n * math.format(2.3, {notation: 'fixed', precision: 4}) // returns '2.3000'\n * math.format(52.8, {notation: 'exponential'}) // returns '5.28e+1'\n * math.format(12400, {notation: 'engineering'}) // returns '12.4e+3'\n * math.format(2000, {lowerExp: -2, upperExp: 2}) // returns '2e+3'\n *\n * function formatCurrency(value) {\n * // return currency notation with two digits:\n * return '$' + value.toFixed(2)\n *\n * // you could also use math.format inside the callback:\n * // return '$' + math.format(value, {notation: 'fixed', precision: 2})\n * }\n * math.format([2.1, 3, 0.016], formatCurrency) // returns '[$2.10, $3.00, $0.02]'\n *\n * See also:\n *\n * print\n *\n * @param {*} value Value to be stringified\n * @param {Object | Function | number} [options] Formatting options\n * @return {string} The formatted value\n */\n return typed(name, {\n any: formatString,\n 'any, Object | function | number | BigNumber': formatString\n })\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'bin'\nconst dependencies = ['typed', 'format']\n\n/**\n * Format a number as binary.\n *\n * Syntax:\n *\n * math.bin(value)\n *\n * Examples:\n *\n * //the following outputs \"0b10\"\n * math.bin(2)\n *\n * See also:\n *\n * oct\n * hex\n *\n * @param {number | BigNumber} value Value to be stringified\n * @param {number | BigNumber} wordSize Optional word size (see `format`)\n * @return {string} The formatted value\n */\nexport const createBin = factory(name, dependencies, ({ typed, format }) => {\n return typed(name, {\n 'number | BigNumber': function (n) {\n return format(n, { notation: 'bin' })\n },\n 'number | BigNumber, number | BigNumber': function (n, wordSize) {\n return format(n, { notation: 'bin', wordSize })\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'oct'\nconst dependencies = ['typed', 'format']\n\n/**\n * Format a number as octal.\n *\n * Syntax:\n *\n * math.oct(value)\n *\n * Examples:\n *\n * //the following outputs \"0o70\"\n * math.oct(56)\n *\n * See also:\n *\n * bin\n * hex\n *\n * @param {number | BigNumber} value Value to be stringified\n * @param {number | BigNumber} wordSize Optional word size (see `format`)\n * @return {string} The formatted value\n */\n\nexport const createOct = factory(name, dependencies, ({ typed, format }) => {\n return typed(name, {\n 'number | BigNumber': function (n) {\n return format(n, { notation: 'oct' })\n },\n 'number | BigNumber, number | BigNumber': function (n, wordSize) {\n return format(n, { notation: 'oct', wordSize })\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'hex'\nconst dependencies = ['typed', 'format']\n\n/**\n * Format a number as hexadecimal.\n *\n * Syntax:\n *\n * math.hex(value)\n *\n * Examples:\n *\n * math.hex(240) // returns \"0xf0\"\n *\n * See also:\n *\n * oct\n * bin\n *\n * @param {number | BigNumber} value Value to be stringified\n * @param {number | BigNumber} wordSize Optional word size (see `format`)\n * @return {string} The formatted value\n */\nexport const createHex = factory(name, dependencies, ({ typed, format }) => {\n return typed(name, {\n 'number | BigNumber': function (n) {\n return format(n, { notation: 'hex' })\n },\n 'number | BigNumber, number | BigNumber': function (n, wordSize) {\n return format(n, { notation: 'hex', wordSize })\n }\n })\n})\n","export const printTemplate = /\\$([\\w.]+)/g\n","import { format } from '../../utils/string.js'\nimport { isString } from '../../utils/is.js'\nimport { factory } from '../../utils/factory.js'\nimport { printTemplate } from '../../utils/print.js'\n\nconst name = 'print'\nconst dependencies = ['typed']\n\nexport const createPrint = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Interpolate values into a string template.\n *\n * Syntax:\n *\n * math.print(template, values)\n * math.print(template, values, precision)\n * math.print(template, values, options)\n *\n * Example usage:\n *\n * // the following outputs: 'Lucy is 5 years old'\n * math.print('Lucy is $age years old', {age: 5})\n *\n * // the following outputs: 'The value of pi is 3.141592654'\n * math.print('The value of pi is $pi', {pi: math.pi}, 10)\n *\n * // the following outputs: 'Hello Mary! The date is 2013-03-23'\n * math.print('Hello $user.name! The date is $date', {\n * user: {\n * name: 'Mary',\n * },\n * date: '2013-03-23'\n * })\n *\n * // the following outputs: 'My favorite fruits are apples and bananas !'\n * math.print('My favorite fruits are $0 and $1 !', [\n * 'apples',\n * 'bananas'\n * ])\n *\n * See also:\n *\n * format\n *\n * @param {string} template A string containing variable placeholders.\n * @param {Object | Array | Matrix} values An object or array containing variables\n * which will be filled in in the template.\n * @param {number | Object} [options] Formatting options,\n * or the number of digits to format numbers.\n * See function math.format for a description\n * of all options.\n * @return {string} Interpolated string\n */\n return typed(name, {\n // note: Matrix will be converted automatically to an Array\n 'string, Object | Array': _print,\n 'string, Object | Array, number | Object': _print\n })\n})\n\n/**\n * Interpolate values into a string template.\n * @param {string} template\n * @param {Object} values\n * @param {number | Object} [options]\n * @returns {string} Interpolated string\n * @private\n */\nfunction _print (template, values, options) {\n return template.replace(printTemplate, function (original, key) {\n const keys = key.split('.')\n let value = values[keys.shift()]\n if (value !== undefined && value.isMatrix) {\n value = value.toArray()\n }\n while (keys.length && value !== undefined) {\n const k = keys.shift()\n value = k ? value[k] : value + '.'\n }\n\n if (value !== undefined) {\n if (!isString(value)) {\n return format(value, options)\n } else {\n return value\n }\n }\n\n return original\n }\n )\n}\n","import { factory } from '../../utils/factory.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\n\nconst name = 'to'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'concat'\n]\n\nexport const createTo = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, concat }) => {\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n /**\n * Change the unit of a value.\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.to(x, unit)\n *\n * Examples:\n *\n * math.to(math.unit('2 inch'), 'cm') // returns Unit 5.08 cm\n * math.to(math.unit('2 inch'), math.unit('cm')) // returns Unit 5.08 cm\n * math.to(math.unit(16, 'bytes'), 'bits') // returns Unit 128 bits\n *\n * See also:\n *\n * unit\n *\n * @param {Unit | Array | Matrix} x The unit to be converted.\n * @param {Unit | Array | Matrix} unit New unit. Can be a string like \"cm\"\n * or a unit without value.\n * @return {Unit | Array | Matrix} value with changed, fixed unit.\n */\n return typed(\n name,\n { 'Unit, Unit | string': (x, unit) => x.to(unit) },\n matrixAlgorithmSuite({ Ds: true })\n )\n})\n","import { deepMap } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'isPrime'\nconst dependencies = ['typed']\n\nexport const createIsPrime = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Test whether a value is prime: has no divisors other than itself and one.\n * The function supports type `number`, `bignumber`.\n *\n * The function is evaluated element-wise in case of Array or Matrix input.\n *\n * Syntax:\n *\n * math.isPrime(x)\n *\n * Examples:\n *\n * math.isPrime(3) // returns true\n * math.isPrime(-2) // returns false\n * math.isPrime(0) // returns false\n * math.isPrime(-0) // returns false\n * math.isPrime(0.5) // returns false\n * math.isPrime('2') // returns true\n * math.isPrime([2, 17, 100]) // returns [true, true, false]\n *\n * See also:\n *\n * isNumeric, isZero, isNegative, isInteger\n *\n * @param {number | BigNumber | bigint | Array | Matrix} x Value to be tested\n * @return {boolean} Returns true when `x` is larger than zero.\n * Throws an error in case of an unknown data type.\n */\n return typed(name, {\n number: function (x) {\n if (x <= 3) {\n return x > 1\n }\n if (x % 2 === 0 || x % 3 === 0) {\n return false\n }\n for (let i = 5; i * i <= x; i += 6) {\n if (x % i === 0 || x % (i + 2) === 0) {\n return false\n }\n }\n return true\n },\n\n bigint: function (x) {\n if (x <= 3n) {\n return x > 1n\n }\n if (x % 2n === 0n || x % 3n === 0n) {\n return false\n }\n for (let i = 5n; i * i <= x; i += 6n) {\n if (x % i === 0n || x % (i + 2n) === 0n) {\n return false\n }\n }\n return true\n },\n\n BigNumber: function (n) {\n if (n.lte(3)) return n.gt(1)\n if (n.mod(2).eq(0) || n.mod(3).eq(0)) return false\n if (n.lt(Math.pow(2, 32))) {\n const x = n.toNumber()\n for (let i = 5; i * i <= x; i += 6) {\n if (x % i === 0 || x % (i + 2) === 0) {\n return false\n }\n }\n return true\n }\n\n function modPow (base, exponent, modulus) {\n // exponent can be huge, use non-recursive variant\n let accumulator = 1\n while (!exponent.eq(0)) {\n if (exponent.mod(2).eq(0)) {\n exponent = exponent.div(2)\n base = base.mul(base).mod(modulus)\n } else {\n exponent = exponent.sub(1)\n accumulator = base.mul(accumulator).mod(modulus)\n }\n }\n return accumulator\n }\n\n // https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test#Deterministic_variants\n const Decimal = n.constructor.clone({ precision: n.toFixed(0).length * 2 })\n n = new Decimal(n)\n let r = 0\n let d = n.sub(1)\n while (d.mod(2).eq(0)) {\n d = d.div(2)\n r += 1\n }\n let bases = null\n // https://en.wikipedia.org/wiki/Miller–Rabin_primality_test#Testing_against_small_sets_of_bases\n if (n.lt('3317044064679887385961981')) {\n bases = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41].filter(x => x < n)\n } else {\n const max = Math.min(n.toNumber() - 2, Math.floor(2 * Math.pow(n.toFixed(0).length * Math.log(10), 2)))\n bases = []\n for (let i = 2; i <= max; i += 1) {\n bases.push(max)\n }\n }\n for (let i = 0; i < bases.length; i += 1) {\n const a = bases[i]\n const adn = modPow(n.sub(n).add(a), d, n)\n if (!adn.eq(1)) {\n for (let i = 0, x = adn; !x.eq(n.sub(1)); i += 1, x = x.mul(x).mod(n)) {\n if (i === r - 1) {\n return false\n }\n }\n }\n }\n return true\n },\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","import { typeOf } from '../../utils/is.js'\nimport { factory } from '../../utils/factory.js'\nimport { noBignumber, noFraction } from '../../utils/noop.js'\n\nconst name = 'numeric'\nconst dependencies = ['number', '?bignumber', '?fraction']\n\nexport const createNumeric = /* #__PURE__ */ factory(name, dependencies, ({ number, bignumber, fraction }) => {\n const validInputTypes = {\n string: true,\n number: true,\n BigNumber: true,\n Fraction: true\n }\n\n // Load the conversion functions for each output type\n const validOutputTypes = {\n number: (x) => number(x),\n BigNumber: bignumber\n ? (x) => bignumber(x)\n : noBignumber,\n bigint: (x) => BigInt(x),\n Fraction: fraction\n ? (x) => fraction(x)\n : noFraction\n }\n\n /**\n * Convert a numeric input to a specific numeric type: number, BigNumber, bigint, or Fraction.\n *\n * Syntax:\n *\n * math.numeric(x)\n * math.numeric(value, outputType)\n *\n * Examples:\n *\n * math.numeric('4') // returns 4\n * math.numeric('4', 'number') // returns 4\n * math.numeric('4', 'bigint') // returns 4n\n * math.numeric('4', 'BigNumber') // returns BigNumber 4\n * math.numeric('4', 'Fraction') // returns Fraction 4\n * math.numeric(4, 'Fraction') // returns Fraction 4\n * math.numeric(math.fraction(2, 5), 'number') // returns 0.4\n *\n * See also:\n *\n * number, fraction, bignumber, bigint, string, format\n *\n * @param {string | number | BigNumber | bigint | Fraction } value\n * A numeric value or a string containing a numeric value\n * @param {string} outputType\n * Desired numeric output type.\n * Available values: 'number', 'BigNumber', or 'Fraction'\n * @return {number | BigNumber | bigint | Fraction}\n * Returns an instance of the numeric in the requested type\n */\n return function numeric (value, outputType = 'number', check) {\n if (check !== undefined) {\n throw new SyntaxError('numeric() takes one or two arguments')\n }\n const inputType = typeOf(value)\n\n if (!(inputType in validInputTypes)) {\n throw new TypeError('Cannot convert ' + value + ' of type \"' + inputType + '\"; valid input types are ' + Object.keys(validInputTypes).join(', '))\n }\n if (!(outputType in validOutputTypes)) {\n throw new TypeError('Cannot convert ' + value + ' to type \"' + outputType + '\"; valid output types are ' + Object.keys(validOutputTypes).join(', '))\n }\n\n if (outputType === inputType) {\n return value\n } else {\n return validOutputTypes[outputType](value)\n }\n }\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'divideScalar'\nconst dependencies = ['typed', 'numeric']\n\nexport const createDivideScalar = /* #__PURE__ */ factory(name, dependencies, ({ typed, numeric }) => {\n /**\n * Divide two scalar values, `x / y`.\n * This function is meant for internal use: it is used by the public functions\n * `divide` and `inv`.\n *\n * This function does not support collections (Array or Matrix).\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit} x Numerator\n * @param {number | BigNumber | bigint | Fraction | Complex} y Denominator\n * @return {number | BigNumber | bigint | Fraction | Complex | Unit} Quotient, `x / y`\n * @private\n */\n return typed(name, {\n 'number, number': function (x, y) {\n return x / y\n },\n\n 'Complex, Complex': function (x, y) {\n return x.div(y)\n },\n\n 'BigNumber, BigNumber': function (x, y) {\n return x.div(y)\n },\n\n 'bigint, bigint': function (x, y) {\n return x / y\n },\n\n 'Fraction, Fraction': function (x, y) {\n return x.div(y)\n },\n\n 'Unit, number | Complex | Fraction | BigNumber | Unit':\n (x, y) => x.divide(y),\n\n 'number | Fraction | Complex | BigNumber, Unit':\n (x, y) => y.divideInto(x)\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { isInteger } from '../../utils/number.js'\nimport { arraySize as size } from '../../utils/array.js'\nimport { powNumber } from '../../plain/number/index.js'\n\nconst name = 'pow'\nconst dependencies = [\n 'typed',\n 'config',\n 'identity',\n 'multiply',\n 'matrix',\n 'inv',\n 'fraction',\n 'number',\n 'Complex'\n]\n\nexport const createPow = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, identity, multiply, matrix, inv, number, fraction, Complex }) => {\n /**\n * Calculates the power of x to y, `x ^ y`.\n *\n * Matrix exponentiation is supported for square matrices `x` and integers `y`:\n * when `y` is nonnegative, `x` may be any square matrix; and when `y` is\n * negative, `x` must be invertible, and then this function returns\n * inv(x)^(-y).\n *\n * For cubic roots of negative numbers, the function returns the principal\n * root by default. In order to let the function return the real root,\n * math.js can be configured with `math.config({predictable: true})`.\n * To retrieve all cubic roots of a value, use `math.cbrt(x, true)`.\n *\n * Syntax:\n *\n * math.pow(x, y)\n *\n * Examples:\n *\n * math.pow(2, 3) // returns number 8\n *\n * const a = math.complex(2, 3)\n * math.pow(a, 2) // returns Complex -5 + 12i\n *\n * const b = [[1, 2], [4, 3]]\n * math.pow(b, 2) // returns Array [[9, 8], [16, 17]]\n *\n * const c = [[1, 2], [4, 3]]\n * math.pow(c, -1) // returns Array [[-0.6, 0.4], [0.8, -0.2]]\n *\n * See also:\n *\n * multiply, sqrt, cbrt, nthRoot\n *\n * @param {number | BigNumber | bigint | Complex | Unit | Array | Matrix} x The base\n * @param {number | BigNumber | bigint | Complex} y The exponent\n * @return {number | BigNumber | bigint | Complex | Array | Matrix} The value of `x` to the power `y`\n */\n return typed(name, {\n 'number, number': _pow,\n\n 'Complex, Complex': function (x, y) {\n return x.pow(y)\n },\n\n 'BigNumber, BigNumber': function (x, y) {\n if (y.isInteger() || x >= 0 || config.predictable) {\n return x.pow(y)\n } else {\n return new Complex(x.toNumber(), 0).pow(y.toNumber(), 0)\n }\n },\n\n 'bigint, bigint': (x, y) => x ** y,\n\n 'Fraction, Fraction': function (x, y) {\n const result = x.pow(y)\n\n if (result != null) {\n return result\n }\n\n if (config.predictable) {\n throw new Error('Result of pow is non-rational and cannot be expressed as a fraction')\n } else {\n return _pow(x.valueOf(), y.valueOf())\n }\n },\n\n 'Array, number': _powArray,\n\n 'Array, BigNumber': function (x, y) {\n return _powArray(x, y.toNumber())\n },\n\n 'Matrix, number': _powMatrix,\n\n 'Matrix, BigNumber': function (x, y) {\n return _powMatrix(x, y.toNumber())\n },\n\n 'Unit, number | BigNumber': function (x, y) {\n return x.pow(y)\n }\n\n })\n\n /**\n * Calculates the power of x to y, x^y, for two numbers.\n * @param {number} x\n * @param {number} y\n * @return {number | Complex} res\n * @private\n */\n function _pow (x, y) {\n // Alternatively could define a 'realmode' config option or something, but\n // 'predictable' will work for now\n if (config.predictable && !isInteger(y) && x < 0) {\n // Check to see if y can be represented as a fraction\n try {\n const yFrac = fraction(y)\n const yNum = number(yFrac)\n if (y === yNum || Math.abs((y - yNum) / y) < 1e-14) {\n if (yFrac.d % 2n === 1n) {\n return ((yFrac.n % 2n === 0n) ? 1 : -1) * Math.pow(-x, y)\n }\n }\n } catch (ex) {\n // fraction() throws an error if y is Infinity, etc.\n }\n\n // Unable to express y as a fraction, so continue on\n }\n\n // **for predictable mode** x^Infinity === NaN if x < -1\n // N.B. this behavour is different from `Math.pow` which gives\n // (-2)^Infinity === Infinity\n if (config.predictable &&\n ((x < -1 && y === Infinity) ||\n (x > -1 && x < 0 && y === -Infinity))) {\n return NaN\n }\n\n if (isInteger(y) || x >= 0 || config.predictable) {\n return powNumber(x, y)\n } else {\n // TODO: the following infinity checks are duplicated from powNumber. Deduplicate this somehow\n\n // x^Infinity === 0 if -1 < x < 1\n // A real number 0 is returned instead of complex(0)\n if ((x * x < 1 && y === Infinity) ||\n (x * x > 1 && y === -Infinity)) {\n return 0\n }\n\n return new Complex(x, 0).pow(y, 0)\n }\n }\n\n /**\n * Calculate the power of a 2d array\n * @param {Array} x must be a 2 dimensional, square matrix\n * @param {number} y a integer value (positive if `x` is not invertible)\n * @returns {Array}\n * @private\n */\n function _powArray (x, y) {\n if (!isInteger(y)) {\n throw new TypeError('For A^b, b must be an integer (value is ' + y + ')')\n }\n // verify that A is a 2 dimensional square matrix\n const s = size(x)\n if (s.length !== 2) {\n throw new Error('For A^b, A must be 2 dimensional (A has ' + s.length + ' dimensions)')\n }\n if (s[0] !== s[1]) {\n throw new Error('For A^b, A must be square (size is ' + s[0] + 'x' + s[1] + ')')\n }\n if (y < 0) {\n try {\n return _powArray(inv(x), -y)\n } catch (error) {\n if (error.message === 'Cannot calculate inverse, determinant is zero') {\n throw new TypeError('For A^b, when A is not invertible, b must be a positive integer (value is ' + y + ')')\n }\n throw error\n }\n }\n\n let res = identity(s[0]).valueOf()\n let px = x\n while (y >= 1) {\n if ((y & 1) === 1) {\n res = multiply(px, res)\n }\n y >>= 1\n px = multiply(px, px)\n }\n return res\n }\n\n /**\n * Calculate the power of a 2d matrix\n * @param {Matrix} x must be a 2 dimensional, square matrix\n * @param {number} y a positive, integer value\n * @returns {Matrix}\n * @private\n */\n function _powMatrix (x, y) {\n return matrix(_powArray(x.valueOf(), y))\n }\n})\n","import { factory } from '../../utils/factory.js'\nimport { deepMap } from '../../utils/collection.js'\nimport { nearlyEqual, splitNumber } from '../../utils/number.js'\nimport { nearlyEqual as bigNearlyEqual } from '../../utils/bignumber/nearlyEqual.js'\nimport { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { createMatAlgo14xDs } from '../../type/matrix/utils/matAlgo14xDs.js'\nimport { roundNumber } from '../../plain/number/index.js'\n\nconst NO_INT = 'Number of decimals in function round must be an integer'\n\nconst name = 'round'\nconst dependencies = [\n 'typed',\n 'config',\n 'matrix',\n 'equalScalar',\n 'zeros',\n 'BigNumber',\n 'DenseMatrix'\n]\n\nexport const createRound = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, matrix, equalScalar, zeros, BigNumber, DenseMatrix }) => {\n const matAlgo11xS0s = createMatAlgo11xS0s({ typed, equalScalar })\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matAlgo14xDs = createMatAlgo14xDs({ typed })\n\n function toExponent (epsilon) {\n return Math.abs(splitNumber(epsilon).exponent)\n }\n\n /**\n * Round a value towards the nearest rounded value.\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.round(x)\n * math.round(x, n)\n * math.round(unit, valuelessUnit)\n * math.round(unit, n, valuelessUnit)\n *\n * Examples:\n *\n * math.round(3.22) // returns number 3\n * math.round(3.82) // returns number 4\n * math.round(-4.2) // returns number -4\n * math.round(-4.7) // returns number -5\n * math.round(3.22, 1) // returns number 3.2\n * math.round(3.88, 1) // returns number 3.9\n * math.round(-4.21, 1) // returns number -4.2\n * math.round(-4.71, 1) // returns number -4.7\n * math.round(math.pi, 3) // returns number 3.142\n * math.round(123.45678, 2) // returns number 123.46\n *\n * const c = math.complex(3.2, -2.7)\n * math.round(c) // returns Complex 3 - 3i\n *\n * const unit = math.unit('3.241 cm')\n * const cm = math.unit('cm')\n * const mm = math.unit('mm')\n * math.round(unit, 1, cm) // returns Unit 3.2 cm\n * math.round(unit, 1, mm) // returns Unit 32.4 mm\n *\n * math.round([3.2, 3.8, -4.7]) // returns Array [3, 4, -5]\n *\n * See also:\n *\n * ceil, fix, floor\n *\n * @param {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} x Value to be rounded\n * @param {number | BigNumber | Array} [n=0] Number of decimals\n * @param {Unit} [valuelessUnit] A valueless unit\n * @return {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} Rounded value\n */\n return typed(name, {\n number: function (x) {\n // Handle round off errors by first rounding to relTol precision\n const xEpsilon = roundNumber(x, toExponent(config.relTol))\n const xSelected = nearlyEqual(x, xEpsilon, config.relTol, config.absTol) ? xEpsilon : x\n return roundNumber(xSelected)\n },\n\n 'number, number': function (x, n) {\n // Same as number: unless user specifies more decimals than relTol\n const epsilonExponent = toExponent(config.relTol)\n if (n >= epsilonExponent) { return roundNumber(x, n) }\n\n const xEpsilon = roundNumber(x, epsilonExponent)\n const xSelected = nearlyEqual(x, xEpsilon, config.relTol, config.absTol) ? xEpsilon : x\n return roundNumber(xSelected, n)\n },\n\n 'number, BigNumber': function (x, n) {\n if (!n.isInteger()) { throw new TypeError(NO_INT) }\n\n return new BigNumber(x).toDecimalPlaces(n.toNumber())\n },\n\n Complex: function (x) {\n return x.round()\n },\n\n 'Complex, number': function (x, n) {\n if (n % 1) { throw new TypeError(NO_INT) }\n\n return x.round(n)\n },\n\n 'Complex, BigNumber': function (x, n) {\n if (!n.isInteger()) { throw new TypeError(NO_INT) }\n\n const _n = n.toNumber()\n return x.round(_n)\n },\n\n BigNumber: function (x) {\n // Handle round off errors by first rounding to relTol precision\n const xEpsilon = new BigNumber(x).toDecimalPlaces(toExponent(config.relTol))\n const xSelected = bigNearlyEqual(x, xEpsilon, config.relTol, config.absTol) ? xEpsilon : x\n return xSelected.toDecimalPlaces(0)\n },\n\n 'BigNumber, BigNumber': function (x, n) {\n if (!n.isInteger()) { throw new TypeError(NO_INT) }\n\n // Same as BigNumber: unless user specifies more decimals than relTol\n const epsilonExponent = toExponent(config.relTol)\n if (n >= epsilonExponent) { return x.toDecimalPlaces(n.toNumber()) }\n\n const xEpsilon = x.toDecimalPlaces(epsilonExponent)\n const xSelected = bigNearlyEqual(x, xEpsilon, config.relTol, config.absTol) ? xEpsilon : x\n return xSelected.toDecimalPlaces(n.toNumber())\n },\n\n // bigints can't be rounded\n bigint: b => b,\n 'bigint, number': (b, _dummy) => b,\n 'bigint, BigNumber': (b, _dummy) => b,\n\n Fraction: function (x) {\n return x.round()\n },\n\n 'Fraction, number': function (x, n) {\n if (n % 1) { throw new TypeError(NO_INT) }\n return x.round(n)\n },\n\n 'Fraction, BigNumber': function (x, n) {\n if (!n.isInteger()) { throw new TypeError(NO_INT) }\n return x.round(n.toNumber())\n },\n\n 'Unit, number, Unit': typed.referToSelf(self => function (x, n, unit) {\n const valueless = x.toNumeric(unit)\n return unit.multiply(self(valueless, n))\n }),\n\n 'Unit, BigNumber, Unit': typed.referToSelf(self => (x, n, unit) => self(x, n.toNumber(), unit)),\n\n 'Array | Matrix, number | BigNumber, Unit': typed.referToSelf(self => (x, n, unit) => {\n // deep map collection, skip zeros since round(0) = 0\n return deepMap(x, (value) => self(value, n, unit), true)\n }),\n\n 'Array | Matrix | Unit, Unit': typed.referToSelf(self => (x, unit) => self(x, 0, unit)),\n\n 'Array | Matrix': typed.referToSelf(self => x => {\n // deep map collection, skip zeros since round(0) = 0\n return deepMap(x, self, true)\n }),\n\n 'SparseMatrix, number | BigNumber': typed.referToSelf(self => (x, n) => {\n return matAlgo11xS0s(x, n, self, false)\n }),\n\n 'DenseMatrix, number | BigNumber': typed.referToSelf(self => (x, n) => {\n return matAlgo14xDs(x, n, self, false)\n }),\n\n 'Array, number | BigNumber': typed.referToSelf(self => (x, n) => {\n // use matrix implementation\n return matAlgo14xDs(matrix(x), n, self, false).valueOf()\n }),\n\n 'number | Complex | BigNumber | Fraction, SparseMatrix': typed.referToSelf(self => (x, n) => {\n // check scalar is zero\n if (equalScalar(x, 0)) {\n // do not execute algorithm, result will be a zero matrix\n return zeros(n.size(), n.storage())\n }\n return matAlgo12xSfs(n, x, self, true)\n }),\n\n 'number | Complex | BigNumber | Fraction, DenseMatrix': typed.referToSelf(self => (x, n) => {\n // check scalar is zero\n if (equalScalar(x, 0)) {\n // do not execute algorithm, result will be a zero matrix\n return zeros(n.size(), n.storage())\n }\n return matAlgo14xDs(n, x, self, true)\n }),\n\n 'number | Complex | BigNumber | Fraction, Array': typed.referToSelf(self => (x, n) => {\n // use matrix implementation\n return matAlgo14xDs(matrix(n), x, self, true).valueOf()\n })\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { promoteLogarithm } from '../../utils/bigint.js'\nimport { logNumber } from '../../plain/number/index.js'\n\nconst name = 'log'\nconst dependencies = ['config', 'typed', 'typeOf', 'divideScalar', 'Complex']\nconst nlg16 = Math.log(16)\n\nexport const createLog = /* #__PURE__ */ factory(name, dependencies, ({ typed, typeOf, config, divideScalar, Complex }) => {\n /**\n * Calculate the logarithm of a value.\n *\n * To avoid confusion with the matrix logarithm, this function does not\n * apply to matrices.\n *\n * Syntax:\n *\n * math.log(x)\n * math.log(x, base)\n *\n * Examples:\n *\n * math.log(3.5) // returns 1.252762968495368\n * math.exp(math.log(2.4)) // returns 2.4\n *\n * math.pow(10, 4) // returns 10000\n * math.log(10000, 10) // returns 4\n * math.log(10000) / math.log(10) // returns 4\n *\n * math.log(1024, 2) // returns 10\n * math.pow(2, 10) // returns 1024\n *\n * See also:\n *\n * exp, log2, log10, log1p\n *\n * @param {number | BigNumber | Fraction | Complex} x\n * Value for which to calculate the logarithm.\n * @param {number | BigNumber | Fraction | Complex} [base=e]\n * Optional base for the logarithm. If not provided, the natural\n * logarithm of `x` is calculated.\n * @return {number | BigNumber | Fraction | Complex}\n * Returns the logarithm of `x`\n */\n function complexLog (c) {\n return c.log()\n }\n\n function complexLogNumber (x) {\n return complexLog(new Complex(x, 0))\n }\n\n return typed(name, {\n number: function (x) {\n if (x >= 0 || config.predictable) {\n return logNumber(x)\n } else {\n // negative value -> complex value computation\n return complexLogNumber(x)\n }\n },\n\n bigint: promoteLogarithm(nlg16, logNumber, config, complexLogNumber),\n\n Complex: complexLog,\n\n BigNumber: function (x) {\n if (!x.isNegative() || config.predictable) {\n return x.ln()\n } else {\n // downgrade to number, return Complex valued result\n return complexLogNumber(x.toNumber())\n }\n },\n\n 'any, any': typed.referToSelf(self => (x, base) => {\n // calculate logarithm for a specified base, log(x, base)\n\n if (typeOf(x) === 'Fraction' && typeOf(base) === 'Fraction') {\n const result = x.log(base)\n\n if (result !== null) {\n return result\n }\n }\n\n return divideScalar(self(x), self(base))\n })\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { deepMap } from '../../utils/collection.js'\nimport { log1p as _log1p } from '../../utils/number.js'\n\nconst name = 'log1p'\nconst dependencies = ['typed', 'config', 'divideScalar', 'log', 'Complex']\n\nexport const createLog1p = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, divideScalar, log, Complex }) => {\n /**\n * Calculate the logarithm of a `value+1`.\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.log1p(x)\n * math.log1p(x, base)\n *\n * Examples:\n *\n * math.log1p(2.5) // returns 1.252762968495368\n * math.exp(math.log1p(1.4)) // returns 2.4\n *\n * math.pow(10, 4) // returns 10000\n * math.log1p(9999, 10) // returns 4\n * math.log1p(9999) / math.log(10) // returns 4\n *\n * See also:\n *\n * exp, log, log2, log10\n *\n * @param {number | BigNumber | Complex | Array | Matrix} x\n * Value for which to calculate the logarithm of `x+1`.\n * @param {number | BigNumber | Complex} [base=e]\n * Optional base for the logarithm. If not provided, the natural\n * logarithm of `x+1` is calculated.\n * @return {number | BigNumber | Complex | Array | Matrix}\n * Returns the logarithm of `x+1`\n */\n return typed(name, {\n number: function (x) {\n if (x >= -1 || config.predictable) {\n return _log1p(x)\n } else {\n // negative value -> complex value computation\n return _log1pComplex(new Complex(x, 0))\n }\n },\n\n Complex: _log1pComplex,\n\n BigNumber: function (x) {\n const y = x.plus(1)\n if (!y.isNegative() || config.predictable) {\n return y.ln()\n } else {\n // downgrade to number, return Complex valued result\n return _log1pComplex(new Complex(x.toNumber(), 0))\n }\n },\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self)),\n\n 'any, any': typed.referToSelf(self => (x, base) => {\n // calculate logarithm for a specified base, log1p(x, base)\n return divideScalar(self(x), log(base))\n })\n })\n\n /**\n * Calculate the natural logarithm of a complex number + 1\n * @param {Complex} x\n * @returns {Complex}\n * @private\n */\n function _log1pComplex (x) {\n const xRe1p = x.re + 1\n return new Complex(\n Math.log(Math.sqrt(xRe1p * xRe1p + x.im * x.im)),\n Math.atan2(x.im, xRe1p)\n )\n }\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'nthRoots'\nconst dependencies = ['config', 'typed', 'divideScalar', 'Complex']\n\nexport const createNthRoots = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, divideScalar, Complex }) => {\n /**\n * Each function here returns a real multiple of i as a Complex value.\n * @param {number} val\n * @return {Complex} val, i*val, -val or -i*val for index 0, 1, 2, 3\n */\n // This is used to fix float artifacts for zero-valued components.\n const _calculateExactResult = [\n function realPos (val) { return new Complex(val, 0) },\n function imagPos (val) { return new Complex(0, val) },\n function realNeg (val) { return new Complex(-val, 0) },\n function imagNeg (val) { return new Complex(0, -val) }\n ]\n\n /**\n * Calculate the nth root of a Complex Number a using De Movire's Theorem.\n * @param {Complex} a\n * @param {number} root\n * @return {Array} array of n Complex Roots\n */\n function _nthComplexRoots (a, root) {\n if (root < 0) throw new Error('Root must be greater than zero')\n if (root === 0) throw new Error('Root must be non-zero')\n if (root % 1 !== 0) throw new Error('Root must be an integer')\n if (a === 0 || a.abs() === 0) return [new Complex(0, 0)]\n const aIsNumeric = typeof (a) === 'number'\n let offset\n // determine the offset (argument of a)/(pi/2)\n if (aIsNumeric || a.re === 0 || a.im === 0) {\n if (aIsNumeric) {\n offset = 2 * (+(a < 0)) // numeric value on the real axis\n } else if (a.im === 0) {\n offset = 2 * (+(a.re < 0)) // complex value on the real axis\n } else {\n offset = 2 * (+(a.im < 0)) + 1 // complex value on the imaginary axis\n }\n }\n const arg = a.arg()\n const abs = a.abs()\n const roots = []\n const r = Math.pow(abs, 1 / root)\n for (let k = 0; k < root; k++) {\n const halfPiFactor = (offset + 4 * k) / root\n /**\n * If (offset + 4*k)/root is an integral multiple of pi/2\n * then we can produce a more exact result.\n */\n if (halfPiFactor === Math.round(halfPiFactor)) {\n roots.push(_calculateExactResult[halfPiFactor % 4](r))\n continue\n }\n roots.push(new Complex({ r, phi: (arg + 2 * Math.PI * k) / root }))\n }\n return roots\n }\n\n /**\n * Calculate the nth roots of a value.\n * An nth root of a positive real number A,\n * is a positive real solution of the equation \"x^root = A\".\n * This function returns an array of complex values.\n *\n * Syntax:\n *\n * math.nthRoots(x)\n * math.nthRoots(x, root)\n *\n * Examples:\n *\n * math.nthRoots(1)\n * // returns [\n * // {re: 1, im: 0},\n * // {re: -1, im: 0}\n * // ]\n * math.nthRoots(1, 3)\n * // returns [\n * // { re: 1, im: 0 },\n * // { re: -0.4999999999999998, im: 0.8660254037844387 },\n * // { re: -0.5000000000000004, im: -0.8660254037844385 }\n * // ]\n *\n * See also:\n *\n * nthRoot, pow, sqrt\n *\n * @param {number | BigNumber | Fraction | Complex} x Number to be rounded\n * @param {number} [root=2] Optional root, default value is 2\n * @return {number | BigNumber | Fraction | Complex} Returns the nth roots\n */\n return typed(name, {\n Complex: function (x) {\n return _nthComplexRoots(x, 2)\n },\n 'Complex, number': _nthComplexRoots\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { createMatAlgo03xDSf } from '../../type/matrix/utils/matAlgo03xDSf.js'\nimport { createMatAlgo07xSSf } from '../../type/matrix/utils/matAlgo07xSSf.js'\nimport { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\n\nconst name = 'dotPow'\nconst dependencies = [\n 'typed',\n 'equalScalar',\n 'matrix',\n 'pow',\n 'DenseMatrix',\n 'concat',\n 'SparseMatrix'\n]\n\nexport const createDotPow = /* #__PURE__ */ factory(name, dependencies, ({ typed, equalScalar, matrix, pow, DenseMatrix, concat, SparseMatrix }) => {\n const matAlgo03xDSf = createMatAlgo03xDSf({ typed })\n const matAlgo07xSSf = createMatAlgo07xSSf({ typed, SparseMatrix })\n const matAlgo11xS0s = createMatAlgo11xS0s({ typed, equalScalar })\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n const powScalarSignatures = {}\n for (const signature in pow.signatures) {\n if (Object.prototype.hasOwnProperty.call(pow.signatures, signature)) {\n if (!signature.includes('Matrix') && !signature.includes('Array')) {\n powScalarSignatures[signature] = pow.signatures[signature]\n }\n }\n }\n const powScalar = typed(powScalarSignatures)\n\n /**\n * Calculates the power of x to y element wise.\n *\n * Syntax:\n *\n * math.dotPow(x, y)\n *\n * Examples:\n *\n * math.dotPow(2, 3) // returns number 8\n *\n * const a = [[1, 2], [4, 3]]\n * math.dotPow(a, 2) // returns Array [[1, 4], [16, 9]]\n * math.pow(a, 2) // returns Array [[9, 8], [16, 17]]\n *\n * See also:\n *\n * pow, sqrt, multiply\n *\n * @param {number | BigNumber | Complex | Unit | Array | Matrix} x The base\n * @param {number | BigNumber | Complex | Unit | Array | Matrix} y The exponent\n * @return {number | BigNumber | Complex | Unit | Array | Matrix} The value of `x` to the power `y`\n */\n return typed(name, matrixAlgorithmSuite({\n elop: powScalar,\n SS: matAlgo07xSSf,\n DS: matAlgo03xDSf,\n Ss: matAlgo11xS0s,\n sS: matAlgo12xSfs\n }))\n})\n","import { factory } from '../../utils/factory.js'\nimport { createMatAlgo02xDS0 } from '../../type/matrix/utils/matAlgo02xDS0.js'\nimport { createMatAlgo03xDSf } from '../../type/matrix/utils/matAlgo03xDSf.js'\nimport { createMatAlgo07xSSf } from '../../type/matrix/utils/matAlgo07xSSf.js'\nimport { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\n\nconst name = 'dotDivide'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'equalScalar',\n 'divideScalar',\n 'DenseMatrix',\n 'concat',\n 'SparseMatrix'\n]\n\nexport const createDotDivide = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, divideScalar, DenseMatrix, concat, SparseMatrix }) => {\n const matAlgo02xDS0 = createMatAlgo02xDS0({ typed, equalScalar })\n const matAlgo03xDSf = createMatAlgo03xDSf({ typed })\n const matAlgo07xSSf = createMatAlgo07xSSf({ typed, SparseMatrix })\n const matAlgo11xS0s = createMatAlgo11xS0s({ typed, equalScalar })\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n /**\n * Divide two matrices element wise. The function accepts both matrices and\n * scalar values.\n *\n * Syntax:\n *\n * math.dotDivide(x, y)\n *\n * Examples:\n *\n * math.dotDivide(2, 4) // returns 0.5\n *\n * a = [[9, 5], [6, 1]]\n * b = [[3, 2], [5, 2]]\n *\n * math.dotDivide(a, b) // returns [[3, 2.5], [1.2, 0.5]]\n * math.divide(a, b) // returns [[1.75, 0.75], [-1.75, 2.25]]\n *\n * See also:\n *\n * divide, multiply, dotMultiply\n *\n * @param {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} x Numerator\n * @param {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} y Denominator\n * @return {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} Quotient, `x ./ y`\n */\n return typed(name, matrixAlgorithmSuite({\n elop: divideScalar,\n SS: matAlgo07xSSf,\n DS: matAlgo03xDSf,\n SD: matAlgo02xDS0,\n Ss: matAlgo11xS0s,\n sS: matAlgo12xSfs\n }))\n})\n","import { isArray, isMatrix, isDenseMatrix, isSparseMatrix } from '../../../../utils/is.js'\nimport { arraySize } from '../../../../utils/array.js'\nimport { format } from '../../../../utils/string.js'\n\nexport function createSolveValidation ({ DenseMatrix }) {\n /**\n * Validates matrix and column vector b for backward/forward substitution algorithms.\n *\n * @param {Matrix} m An N x N matrix\n * @param {Array | Matrix} b A column vector\n * @param {Boolean} copy Return a copy of vector b\n *\n * @return {DenseMatrix} Dense column vector b\n */\n return function solveValidation (m, b, copy) {\n const mSize = m.size()\n\n if (mSize.length !== 2) {\n throw new RangeError('Matrix must be two dimensional (size: ' + format(mSize) + ')')\n }\n\n const rows = mSize[0]\n const columns = mSize[1]\n\n if (rows !== columns) {\n throw new RangeError('Matrix must be square (size: ' + format(mSize) + ')')\n }\n\n let data = []\n\n if (isMatrix(b)) {\n const bSize = b.size()\n const bdata = b._data\n\n // 1-dim vector\n if (bSize.length === 1) {\n if (bSize[0] !== rows) {\n throw new RangeError('Dimension mismatch. Matrix columns must match vector length.')\n }\n\n for (let i = 0; i < rows; i++) {\n data[i] = [bdata[i]]\n }\n\n return new DenseMatrix({\n data,\n size: [rows, 1],\n datatype: b._datatype\n })\n }\n\n // 2-dim column\n if (bSize.length === 2) {\n if (bSize[0] !== rows || bSize[1] !== 1) {\n throw new RangeError('Dimension mismatch. Matrix columns must match vector length.')\n }\n\n if (isDenseMatrix(b)) {\n if (copy) {\n data = []\n\n for (let i = 0; i < rows; i++) {\n data[i] = [bdata[i][0]]\n }\n\n return new DenseMatrix({\n data,\n size: [rows, 1],\n datatype: b._datatype\n })\n }\n\n return b\n }\n\n if (isSparseMatrix(b)) {\n for (let i = 0; i < rows; i++) { data[i] = [0] }\n\n const values = b._values\n const index = b._index\n const ptr = b._ptr\n\n for (let k1 = ptr[1], k = ptr[0]; k < k1; k++) {\n const i = index[k]\n data[i][0] = values[k]\n }\n\n return new DenseMatrix({\n data,\n size: [rows, 1],\n datatype: b._datatype\n })\n }\n }\n\n throw new RangeError('Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.')\n }\n\n if (isArray(b)) {\n const bsize = arraySize(b)\n\n if (bsize.length === 1) {\n if (bsize[0] !== rows) {\n throw new RangeError('Dimension mismatch. Matrix columns must match vector length.')\n }\n\n for (let i = 0; i < rows; i++) {\n data[i] = [b[i]]\n }\n\n return new DenseMatrix({\n data,\n size: [rows, 1]\n })\n }\n\n if (bsize.length === 2) {\n if (bsize[0] !== rows || bsize[1] !== 1) {\n throw new RangeError('Dimension mismatch. Matrix columns must match vector length.')\n }\n\n for (let i = 0; i < rows; i++) {\n data[i] = [b[i][0]]\n }\n\n return new DenseMatrix({\n data,\n size: [rows, 1]\n })\n }\n\n throw new RangeError('Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.')\n }\n }\n}\n","import { factory } from '../../../utils/factory.js'\nimport { createSolveValidation } from './utils/solveValidation.js'\n\nconst name = 'lsolve'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'divideScalar',\n 'multiplyScalar',\n 'subtractScalar',\n 'equalScalar',\n 'DenseMatrix'\n]\n\nexport const createLsolve = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, divideScalar, multiplyScalar, subtractScalar, equalScalar, DenseMatrix }) => {\n const solveValidation = createSolveValidation({ DenseMatrix })\n\n /**\n * Finds one solution of a linear equation system by forwards substitution. Matrix must be a lower triangular matrix. Throws an error if there's no solution.\n *\n * `L * x = b`\n *\n * Syntax:\n *\n * math.lsolve(L, b)\n *\n * Examples:\n *\n * const a = [[-2, 3], [2, 1]]\n * const b = [11, 9]\n * const x = lsolve(a, b) // [[-5.5], [20]]\n *\n * See also:\n *\n * lsolveAll, lup, slu, usolve, lusolve\n *\n * @param {Matrix, Array} L A N x N matrix or array (L)\n * @param {Matrix, Array} b A column vector with the b values\n *\n * @return {DenseMatrix | Array} A column vector with the linear system solution (x)\n */\n return typed(name, {\n\n 'SparseMatrix, Array | Matrix': function (m, b) {\n return _sparseForwardSubstitution(m, b)\n },\n\n 'DenseMatrix, Array | Matrix': function (m, b) {\n return _denseForwardSubstitution(m, b)\n },\n\n 'Array, Array | Matrix': function (a, b) {\n const m = matrix(a)\n const r = _denseForwardSubstitution(m, b)\n return r.valueOf()\n }\n })\n\n function _denseForwardSubstitution (m, b) {\n // validate matrix and vector, return copy of column vector b\n b = solveValidation(m, b, true)\n const bdata = b._data\n\n const rows = m._size[0]\n const columns = m._size[1]\n\n // result\n const x = []\n\n const mdata = m._data\n\n // loop columns\n for (let j = 0; j < columns; j++) {\n const bj = bdata[j][0] || 0\n let xj\n\n if (!equalScalar(bj, 0)) {\n // non-degenerate row, find solution\n\n const vjj = mdata[j][j]\n\n if (equalScalar(vjj, 0)) {\n throw new Error('Linear system cannot be solved since matrix is singular')\n }\n\n xj = divideScalar(bj, vjj)\n\n // loop rows\n for (let i = j + 1; i < rows; i++) {\n bdata[i] = [subtractScalar(bdata[i][0] || 0, multiplyScalar(xj, mdata[i][j]))]\n }\n } else {\n // degenerate row, we can choose any value\n xj = 0\n }\n\n x[j] = [xj]\n }\n\n return new DenseMatrix({\n data: x,\n size: [rows, 1]\n })\n }\n\n function _sparseForwardSubstitution (m, b) {\n // validate matrix and vector, return copy of column vector b\n b = solveValidation(m, b, true)\n\n const bdata = b._data\n\n const rows = m._size[0]\n const columns = m._size[1]\n\n const values = m._values\n const index = m._index\n const ptr = m._ptr\n\n // result\n const x = []\n\n // loop columns\n for (let j = 0; j < columns; j++) {\n const bj = bdata[j][0] || 0\n\n if (!equalScalar(bj, 0)) {\n // non-degenerate row, find solution\n\n let vjj = 0\n // matrix values & indices (column j)\n const jValues = []\n const jIndices = []\n\n // first and last index in the column\n const firstIndex = ptr[j]\n const lastIndex = ptr[j + 1]\n\n // values in column, find value at [j, j]\n for (let k = firstIndex; k < lastIndex; k++) {\n const i = index[k]\n\n // check row (rows are not sorted!)\n if (i === j) {\n vjj = values[k]\n } else if (i > j) {\n // store lower triangular\n jValues.push(values[k])\n jIndices.push(i)\n }\n }\n\n // at this point we must have a value in vjj\n if (equalScalar(vjj, 0)) {\n throw new Error('Linear system cannot be solved since matrix is singular')\n }\n\n const xj = divideScalar(bj, vjj)\n\n for (let k = 0, l = jIndices.length; k < l; k++) {\n const i = jIndices[k]\n bdata[i] = [subtractScalar(bdata[i][0] || 0, multiplyScalar(xj, jValues[k]))]\n }\n\n x[j] = [xj]\n } else {\n // degenerate row, we can choose any value\n x[j] = [0]\n }\n }\n\n return new DenseMatrix({\n data: x,\n size: [rows, 1]\n })\n }\n})\n","import { factory } from '../../../utils/factory.js'\nimport { createSolveValidation } from './utils/solveValidation.js'\n\nconst name = 'usolve'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'divideScalar',\n 'multiplyScalar',\n 'subtractScalar',\n 'equalScalar',\n 'DenseMatrix'\n]\n\nexport const createUsolve = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, divideScalar, multiplyScalar, subtractScalar, equalScalar, DenseMatrix }) => {\n const solveValidation = createSolveValidation({ DenseMatrix })\n\n /**\n * Finds one solution of a linear equation system by backward substitution. Matrix must be an upper triangular matrix. Throws an error if there's no solution.\n *\n * `U * x = b`\n *\n * Syntax:\n *\n * math.usolve(U, b)\n *\n * Examples:\n *\n * const a = [[-2, 3], [2, 1]]\n * const b = [11, 9]\n * const x = usolve(a, b) // [[8], [9]]\n *\n * See also:\n *\n * usolveAll, lup, slu, usolve, lusolve\n *\n * @param {Matrix, Array} U A N x N matrix or array (U)\n * @param {Matrix, Array} b A column vector with the b values\n *\n * @return {DenseMatrix | Array} A column vector with the linear system solution (x)\n */\n return typed(name, {\n\n 'SparseMatrix, Array | Matrix': function (m, b) {\n return _sparseBackwardSubstitution(m, b)\n },\n\n 'DenseMatrix, Array | Matrix': function (m, b) {\n return _denseBackwardSubstitution(m, b)\n },\n\n 'Array, Array | Matrix': function (a, b) {\n const m = matrix(a)\n const r = _denseBackwardSubstitution(m, b)\n return r.valueOf()\n }\n })\n\n function _denseBackwardSubstitution (m, b) {\n // make b into a column vector\n b = solveValidation(m, b, true)\n\n const bdata = b._data\n\n const rows = m._size[0]\n const columns = m._size[1]\n\n // result\n const x = []\n\n const mdata = m._data\n // loop columns backwards\n for (let j = columns - 1; j >= 0; j--) {\n // b[j]\n const bj = bdata[j][0] || 0\n // x[j]\n let xj\n\n if (!equalScalar(bj, 0)) {\n // value at [j, j]\n const vjj = mdata[j][j]\n\n if (equalScalar(vjj, 0)) {\n // system cannot be solved\n throw new Error('Linear system cannot be solved since matrix is singular')\n }\n\n xj = divideScalar(bj, vjj)\n\n // loop rows\n for (let i = j - 1; i >= 0; i--) {\n // update copy of b\n bdata[i] = [subtractScalar(bdata[i][0] || 0, multiplyScalar(xj, mdata[i][j]))]\n }\n } else {\n // zero value at j\n xj = 0\n }\n // update x\n x[j] = [xj]\n }\n\n return new DenseMatrix({\n data: x,\n size: [rows, 1]\n })\n }\n\n function _sparseBackwardSubstitution (m, b) {\n // make b into a column vector\n b = solveValidation(m, b, true)\n\n const bdata = b._data\n\n const rows = m._size[0]\n const columns = m._size[1]\n\n const values = m._values\n const index = m._index\n const ptr = m._ptr\n\n // result\n const x = []\n\n // loop columns backwards\n for (let j = columns - 1; j >= 0; j--) {\n const bj = bdata[j][0] || 0\n\n if (!equalScalar(bj, 0)) {\n // non-degenerate row, find solution\n\n let vjj = 0\n\n // upper triangular matrix values & index (column j)\n const jValues = []\n const jIndices = []\n\n // first & last indeces in column\n const firstIndex = ptr[j]\n const lastIndex = ptr[j + 1]\n\n // values in column, find value at [j, j], loop backwards\n for (let k = lastIndex - 1; k >= firstIndex; k--) {\n const i = index[k]\n\n // check row (rows are not sorted!)\n if (i === j) {\n vjj = values[k]\n } else if (i < j) {\n // store upper triangular\n jValues.push(values[k])\n jIndices.push(i)\n }\n }\n\n // at this point we must have a value in vjj\n if (equalScalar(vjj, 0)) {\n throw new Error('Linear system cannot be solved since matrix is singular')\n }\n\n const xj = divideScalar(bj, vjj)\n\n for (let k = 0, lastIndex = jIndices.length; k < lastIndex; k++) {\n const i = jIndices[k]\n bdata[i] = [subtractScalar(bdata[i][0], multiplyScalar(xj, jValues[k]))]\n }\n\n x[j] = [xj]\n } else {\n // degenerate row, we can choose any value\n x[j] = [0]\n }\n }\n\n return new DenseMatrix({\n data: x,\n size: [rows, 1]\n })\n }\n})\n","import { factory } from '../../../utils/factory.js'\nimport { createSolveValidation } from './utils/solveValidation.js'\n\nconst name = 'lsolveAll'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'divideScalar',\n 'multiplyScalar',\n 'subtractScalar',\n 'equalScalar',\n 'DenseMatrix'\n]\n\nexport const createLsolveAll = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, divideScalar, multiplyScalar, subtractScalar, equalScalar, DenseMatrix }) => {\n const solveValidation = createSolveValidation({ DenseMatrix })\n\n /**\n * Finds all solutions of a linear equation system by forwards substitution. Matrix must be a lower triangular matrix.\n *\n * `L * x = b`\n *\n * Syntax:\n *\n * math.lsolveAll(L, b)\n *\n * Examples:\n *\n * const a = [[-2, 3], [2, 1]]\n * const b = [11, 9]\n * const x = lsolveAll(a, b) // [ [[-5.5], [20]] ]\n *\n * See also:\n *\n * lsolve, lup, slu, usolve, lusolve\n *\n * @param {Matrix, Array} L A N x N matrix or array (L)\n * @param {Matrix, Array} b A column vector with the b values\n *\n * @return {DenseMatrix[] | Array[]} An array of affine-independent column vectors (x) that solve the linear system\n */\n return typed(name, {\n\n 'SparseMatrix, Array | Matrix': function (m, b) {\n return _sparseForwardSubstitution(m, b)\n },\n\n 'DenseMatrix, Array | Matrix': function (m, b) {\n return _denseForwardSubstitution(m, b)\n },\n\n 'Array, Array | Matrix': function (a, b) {\n const m = matrix(a)\n const R = _denseForwardSubstitution(m, b)\n return R.map(r => r.valueOf())\n }\n })\n\n function _denseForwardSubstitution (m, b_) {\n // the algorithm is derived from\n // https://www.overleaf.com/read/csvgqdxggyjv\n\n // array of right-hand sides\n const B = [solveValidation(m, b_, true)._data.map(e => e[0])]\n\n const M = m._data\n const rows = m._size[0]\n const columns = m._size[1]\n\n // loop columns\n for (let i = 0; i < columns; i++) {\n let L = B.length\n\n // loop right-hand sides\n for (let k = 0; k < L; k++) {\n const b = B[k]\n\n if (!equalScalar(M[i][i], 0)) {\n // non-singular row\n\n b[i] = divideScalar(b[i], M[i][i])\n\n for (let j = i + 1; j < columns; j++) {\n // b[j] -= b[i] * M[j,i]\n b[j] = subtractScalar(b[j], multiplyScalar(b[i], M[j][i]))\n }\n } else if (!equalScalar(b[i], 0)) {\n // singular row, nonzero RHS\n\n if (k === 0) {\n // There is no valid solution\n return []\n } else {\n // This RHS is invalid but other solutions may still exist\n B.splice(k, 1)\n k -= 1\n L -= 1\n }\n } else if (k === 0) {\n // singular row, RHS is zero\n\n const bNew = [...b]\n bNew[i] = 1\n\n for (let j = i + 1; j < columns; j++) {\n bNew[j] = subtractScalar(bNew[j], M[j][i])\n }\n\n B.push(bNew)\n }\n }\n }\n\n return B.map(x => new DenseMatrix({ data: x.map(e => [e]), size: [rows, 1] }))\n }\n\n function _sparseForwardSubstitution (m, b_) {\n // array of right-hand sides\n const B = [solveValidation(m, b_, true)._data.map(e => e[0])]\n\n const rows = m._size[0]\n const columns = m._size[1]\n\n const values = m._values\n const index = m._index\n const ptr = m._ptr\n\n // loop columns\n for (let i = 0; i < columns; i++) {\n let L = B.length\n\n // loop right-hand sides\n for (let k = 0; k < L; k++) {\n const b = B[k]\n\n // values & indices (column i)\n const iValues = []\n const iIndices = []\n\n // first & last indeces in column\n const firstIndex = ptr[i]\n const lastIndex = ptr[i + 1]\n\n // find the value at [i, i]\n let Mii = 0\n for (let j = firstIndex; j < lastIndex; j++) {\n const J = index[j]\n // check row\n if (J === i) {\n Mii = values[j]\n } else if (J > i) {\n // store lower triangular\n iValues.push(values[j])\n iIndices.push(J)\n }\n }\n\n if (!equalScalar(Mii, 0)) {\n // non-singular row\n\n b[i] = divideScalar(b[i], Mii)\n\n for (let j = 0, lastIndex = iIndices.length; j < lastIndex; j++) {\n const J = iIndices[j]\n b[J] = subtractScalar(b[J], multiplyScalar(b[i], iValues[j]))\n }\n } else if (!equalScalar(b[i], 0)) {\n // singular row, nonzero RHS\n\n if (k === 0) {\n // There is no valid solution\n return []\n } else {\n // This RHS is invalid but other solutions may still exist\n B.splice(k, 1)\n k -= 1\n L -= 1\n }\n } else if (k === 0) {\n // singular row, RHS is zero\n\n const bNew = [...b]\n bNew[i] = 1\n\n for (let j = 0, lastIndex = iIndices.length; j < lastIndex; j++) {\n const J = iIndices[j]\n bNew[J] = subtractScalar(bNew[J], iValues[j])\n }\n\n B.push(bNew)\n }\n }\n }\n\n return B.map(x => new DenseMatrix({ data: x.map(e => [e]), size: [rows, 1] }))\n }\n})\n","import { factory } from '../../../utils/factory.js'\nimport { createSolveValidation } from './utils/solveValidation.js'\n\nconst name = 'usolveAll'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'divideScalar',\n 'multiplyScalar',\n 'subtractScalar',\n 'equalScalar',\n 'DenseMatrix'\n]\n\nexport const createUsolveAll = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, divideScalar, multiplyScalar, subtractScalar, equalScalar, DenseMatrix }) => {\n const solveValidation = createSolveValidation({ DenseMatrix })\n\n /**\n * Finds all solutions of a linear equation system by backward substitution. Matrix must be an upper triangular matrix.\n *\n * `U * x = b`\n *\n * Syntax:\n *\n * math.usolveAll(U, b)\n *\n * Examples:\n *\n * const a = [[-2, 3], [2, 1]]\n * const b = [11, 9]\n * const x = usolveAll(a, b) // [ [[8], [9]] ]\n *\n * See also:\n *\n * usolve, lup, slu, usolve, lusolve\n *\n * @param {Matrix, Array} U A N x N matrix or array (U)\n * @param {Matrix, Array} b A column vector with the b values\n *\n * @return {DenseMatrix[] | Array[]} An array of affine-independent column vectors (x) that solve the linear system\n */\n return typed(name, {\n\n 'SparseMatrix, Array | Matrix': function (m, b) {\n return _sparseBackwardSubstitution(m, b)\n },\n\n 'DenseMatrix, Array | Matrix': function (m, b) {\n return _denseBackwardSubstitution(m, b)\n },\n\n 'Array, Array | Matrix': function (a, b) {\n const m = matrix(a)\n const R = _denseBackwardSubstitution(m, b)\n return R.map(r => r.valueOf())\n }\n })\n\n function _denseBackwardSubstitution (m, b_) {\n // the algorithm is derived from\n // https://www.overleaf.com/read/csvgqdxggyjv\n\n // array of right-hand sides\n const B = [solveValidation(m, b_, true)._data.map(e => e[0])]\n\n const M = m._data\n const rows = m._size[0]\n const columns = m._size[1]\n\n // loop columns backwards\n for (let i = columns - 1; i >= 0; i--) {\n let L = B.length\n\n // loop right-hand sides\n for (let k = 0; k < L; k++) {\n const b = B[k]\n\n if (!equalScalar(M[i][i], 0)) {\n // non-singular row\n\n b[i] = divideScalar(b[i], M[i][i])\n\n for (let j = i - 1; j >= 0; j--) {\n // b[j] -= b[i] * M[j,i]\n b[j] = subtractScalar(b[j], multiplyScalar(b[i], M[j][i]))\n }\n } else if (!equalScalar(b[i], 0)) {\n // singular row, nonzero RHS\n\n if (k === 0) {\n // There is no valid solution\n return []\n } else {\n // This RHS is invalid but other solutions may still exist\n B.splice(k, 1)\n k -= 1\n L -= 1\n }\n } else if (k === 0) {\n // singular row, RHS is zero\n\n const bNew = [...b]\n bNew[i] = 1\n\n for (let j = i - 1; j >= 0; j--) {\n bNew[j] = subtractScalar(bNew[j], M[j][i])\n }\n\n B.push(bNew)\n }\n }\n }\n\n return B.map(x => new DenseMatrix({ data: x.map(e => [e]), size: [rows, 1] }))\n }\n\n function _sparseBackwardSubstitution (m, b_) {\n // array of right-hand sides\n const B = [solveValidation(m, b_, true)._data.map(e => e[0])]\n\n const rows = m._size[0]\n const columns = m._size[1]\n\n const values = m._values\n const index = m._index\n const ptr = m._ptr\n\n // loop columns backwards\n for (let i = columns - 1; i >= 0; i--) {\n let L = B.length\n\n // loop right-hand sides\n for (let k = 0; k < L; k++) {\n const b = B[k]\n\n // values & indices (column i)\n const iValues = []\n const iIndices = []\n\n // first & last indeces in column\n const firstIndex = ptr[i]\n const lastIndex = ptr[i + 1]\n\n // find the value at [i, i]\n let Mii = 0\n for (let j = lastIndex - 1; j >= firstIndex; j--) {\n const J = index[j]\n // check row\n if (J === i) {\n Mii = values[j]\n } else if (J < i) {\n // store upper triangular\n iValues.push(values[j])\n iIndices.push(J)\n }\n }\n\n if (!equalScalar(Mii, 0)) {\n // non-singular row\n\n b[i] = divideScalar(b[i], Mii)\n\n // loop upper triangular\n for (let j = 0, lastIndex = iIndices.length; j < lastIndex; j++) {\n const J = iIndices[j]\n b[J] = subtractScalar(b[J], multiplyScalar(b[i], iValues[j]))\n }\n } else if (!equalScalar(b[i], 0)) {\n // singular row, nonzero RHS\n\n if (k === 0) {\n // There is no valid solution\n return []\n } else {\n // This RHS is invalid but other solutions may still exist\n B.splice(k, 1)\n k -= 1\n L -= 1\n }\n } else if (k === 0) {\n // singular row, RHS is zero\n\n const bNew = [...b]\n bNew[i] = 1\n\n // loop upper triangular\n for (let j = 0, lastIndex = iIndices.length; j < lastIndex; j++) {\n const J = iIndices[j]\n bNew[J] = subtractScalar(bNew[J], iValues[j])\n }\n\n B.push(bNew)\n }\n }\n }\n\n return B.map(x => new DenseMatrix({ data: x.map(e => [e]), size: [rows, 1] }))\n }\n})\n","import { factory } from '../../../utils/factory.js'\nimport { DimensionError } from '../../../error/DimensionError.js'\n\nconst name = 'matAlgo08xS0Sid'\nconst dependencies = ['typed', 'equalScalar']\n\nexport const createMatAlgo08xS0Sid = /* #__PURE__ */ factory(name, dependencies, ({ typed, equalScalar }) => {\n /**\n * Iterates over SparseMatrix A and SparseMatrix B nonzero items and invokes the callback function f(Aij, Bij).\n * Callback function invoked MAX(NNZA, NNZB) times\n *\n *\n * ┌ f(Aij, Bij) ; A(i,j) !== 0 && B(i,j) !== 0\n * C(i,j) = ┤ A(i,j) ; A(i,j) !== 0 && B(i,j) === 0\n * └ 0 ; otherwise\n *\n *\n * @param {Matrix} a The SparseMatrix instance (A)\n * @param {Matrix} b The SparseMatrix instance (B)\n * @param {Function} callback The f(Aij,Bij) operation to invoke\n *\n * @return {Matrix} SparseMatrix (C)\n *\n * see https://github.com/josdejong/mathjs/pull/346#issuecomment-97620294\n */\n return function matAlgo08xS0Sid (a, b, callback) {\n // sparse matrix arrays\n const avalues = a._values\n const aindex = a._index\n const aptr = a._ptr\n const asize = a._size\n const adt = a._datatype || a._data === undefined ? a._datatype : a.getDataType()\n // sparse matrix arrays\n const bvalues = b._values\n const bindex = b._index\n const bptr = b._ptr\n const bsize = b._size\n const bdt = b._datatype || b._data === undefined ? b._datatype : b.getDataType()\n\n // validate dimensions\n if (asize.length !== bsize.length) { throw new DimensionError(asize.length, bsize.length) }\n\n // check rows & columns\n if (asize[0] !== bsize[0] || asize[1] !== bsize[1]) { throw new RangeError('Dimension mismatch. Matrix A (' + asize + ') must match Matrix B (' + bsize + ')') }\n\n // sparse matrix cannot be a Pattern matrix\n if (!avalues || !bvalues) { throw new Error('Cannot perform operation on Pattern Sparse Matrices') }\n\n // rows & columns\n const rows = asize[0]\n const columns = asize[1]\n\n // datatype\n let dt\n // equal signature to use\n let eq = equalScalar\n // zero value\n let zero = 0\n // callback signature to use\n let cf = callback\n\n // process data types\n if (typeof adt === 'string' && adt === bdt && adt !== 'mixed') {\n // datatype\n dt = adt\n // find signature that matches (dt, dt)\n eq = typed.find(equalScalar, [dt, dt])\n // convert 0 to the same datatype\n zero = typed.convert(0, dt)\n // callback\n cf = typed.find(callback, [dt, dt])\n }\n\n // result arrays\n const cvalues = []\n const cindex = []\n const cptr = []\n\n // workspace\n const x = []\n // marks indicating we have a value in x for a given column\n const w = []\n\n // vars\n let k, k0, k1, i\n\n // loop columns\n for (let j = 0; j < columns; j++) {\n // update cptr\n cptr[j] = cindex.length\n // columns mark\n const mark = j + 1\n // loop values in a\n for (k0 = aptr[j], k1 = aptr[j + 1], k = k0; k < k1; k++) {\n // row\n i = aindex[k]\n // mark workspace\n w[i] = mark\n // set value\n x[i] = avalues[k]\n // add index\n cindex.push(i)\n }\n // loop values in b\n for (k0 = bptr[j], k1 = bptr[j + 1], k = k0; k < k1; k++) {\n // row\n i = bindex[k]\n // check value exists in workspace\n if (w[i] === mark) {\n // evaluate callback\n x[i] = cf(x[i], bvalues[k])\n }\n }\n // initialize first index in j\n k = cptr[j]\n // loop index in j\n while (k < cindex.length) {\n // row\n i = cindex[k]\n // value @ i\n const v = x[i]\n // check for zero value\n if (!eq(v, zero)) {\n // push value\n cvalues.push(v)\n // increment pointer\n k++\n } else {\n // remove value @ i, do not increment pointer\n cindex.splice(k, 1)\n }\n }\n }\n // update cptr\n cptr[columns] = cindex.length\n\n // return sparse matrix\n return a.createSparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [rows, columns],\n datatype: adt === a._datatype && bdt === b._datatype ? dt : undefined\n })\n }\n})\n","import { factory } from '../../utils/factory.js'\n\nexport const createUseMatrixForArrayScalar = /* #__PURE__ */ factory('useMatrixForArrayScalar', ['typed', 'matrix'], ({ typed, matrix }) => ({\n 'Array, number': typed.referTo('DenseMatrix, number',\n selfDn => (x, y) => selfDn(matrix(x), y).valueOf()),\n\n 'Array, BigNumber': typed.referTo('DenseMatrix, BigNumber',\n selfDB => (x, y) => selfDB(matrix(x), y).valueOf()),\n\n 'number, Array': typed.referTo('number, DenseMatrix',\n selfnD => (x, y) => selfnD(x, matrix(y)).valueOf()),\n\n 'BigNumber, Array': typed.referTo('BigNumber, DenseMatrix',\n selfBD => (x, y) => selfBD(x, matrix(y)).valueOf())\n}))\n","import { createMatAlgo02xDS0 } from '../../type/matrix/utils/matAlgo02xDS0.js'\nimport { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js'\nimport { createMatAlgo14xDs } from '../../type/matrix/utils/matAlgo14xDs.js'\nimport { createMatAlgo01xDSid } from '../../type/matrix/utils/matAlgo01xDSid.js'\nimport { createMatAlgo10xSids } from '../../type/matrix/utils/matAlgo10xSids.js'\nimport { createMatAlgo08xS0Sid } from '../../type/matrix/utils/matAlgo08xS0Sid.js'\nimport { factory } from '../../utils/factory.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\nimport { createUseMatrixForArrayScalar } from './useMatrixForArrayScalar.js'\nimport { leftShiftNumber } from '../../plain/number/index.js'\nimport { leftShiftBigNumber } from '../../utils/bignumber/bitwise.js'\n\nconst name = 'leftShift'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'equalScalar',\n 'zeros',\n 'DenseMatrix',\n 'concat'\n]\n\nexport const createLeftShift = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, zeros, DenseMatrix, concat }) => {\n const matAlgo01xDSid = createMatAlgo01xDSid({ typed })\n const matAlgo02xDS0 = createMatAlgo02xDS0({ typed, equalScalar })\n const matAlgo08xS0Sid = createMatAlgo08xS0Sid({ typed, equalScalar })\n const matAlgo10xSids = createMatAlgo10xSids({ typed, DenseMatrix })\n const matAlgo11xS0s = createMatAlgo11xS0s({ typed, equalScalar })\n const matAlgo14xDs = createMatAlgo14xDs({ typed })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n const useMatrixForArrayScalar = createUseMatrixForArrayScalar({ typed, matrix })\n\n /**\n * Bitwise left logical shift of a value x by y number of bits, `x << y`.\n * For matrices, the function is evaluated element wise.\n * For units, the function is evaluated on the best prefix base.\n *\n * Syntax:\n *\n * math.leftShift(x, y)\n *\n * Examples:\n *\n * math.leftShift(1, 2) // returns number 4\n *\n * math.leftShift([1, 2, 4], 4) // returns Array [16, 32, 64]\n *\n * See also:\n *\n * leftShift, bitNot, bitOr, bitXor, rightArithShift, rightLogShift\n *\n * @param {number | BigNumber | bigint | Array | Matrix} x Value to be shifted\n * @param {number | BigNumber | bigint} y Amount of shifts\n * @return {number | BigNumber | bigint | Array | Matrix} `x` shifted left `y` times\n */\n return typed(\n name,\n {\n 'number, number': leftShiftNumber,\n\n 'BigNumber, BigNumber': leftShiftBigNumber,\n\n 'bigint, bigint': (x, y) => x << y,\n\n 'SparseMatrix, number | BigNumber': typed.referToSelf(self => (x, y) => {\n // check scalar\n if (equalScalar(y, 0)) {\n return x.clone()\n }\n return matAlgo11xS0s(x, y, self, false)\n }),\n\n 'DenseMatrix, number | BigNumber': typed.referToSelf(self => (x, y) => {\n // check scalar\n if (equalScalar(y, 0)) {\n return x.clone()\n }\n return matAlgo14xDs(x, y, self, false)\n }),\n\n 'number | BigNumber, SparseMatrix': typed.referToSelf(self => (x, y) => {\n // check scalar\n if (equalScalar(x, 0)) {\n return zeros(y.size(), y.storage())\n }\n return matAlgo10xSids(y, x, self, true)\n }),\n\n 'number | BigNumber, DenseMatrix': typed.referToSelf(self => (x, y) => {\n // check scalar\n if (equalScalar(x, 0)) {\n return zeros(y.size(), y.storage())\n }\n return matAlgo14xDs(y, x, self, true)\n })\n },\n useMatrixForArrayScalar,\n matrixAlgorithmSuite({\n SS: matAlgo08xS0Sid,\n DS: matAlgo01xDSid,\n SD: matAlgo02xDS0\n })\n )\n})\n","import { rightArithShiftBigNumber } from '../../utils/bignumber/bitwise.js'\nimport { createMatAlgo02xDS0 } from '../../type/matrix/utils/matAlgo02xDS0.js'\nimport { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js'\nimport { createMatAlgo14xDs } from '../../type/matrix/utils/matAlgo14xDs.js'\nimport { createMatAlgo01xDSid } from '../../type/matrix/utils/matAlgo01xDSid.js'\nimport { createMatAlgo10xSids } from '../../type/matrix/utils/matAlgo10xSids.js'\nimport { createMatAlgo08xS0Sid } from '../../type/matrix/utils/matAlgo08xS0Sid.js'\nimport { factory } from '../../utils/factory.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\nimport { createUseMatrixForArrayScalar } from './useMatrixForArrayScalar.js'\nimport { rightArithShiftNumber } from '../../plain/number/index.js'\n\nconst name = 'rightArithShift'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'equalScalar',\n 'zeros',\n 'DenseMatrix',\n 'concat'\n]\n\nexport const createRightArithShift = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, zeros, DenseMatrix, concat }) => {\n const matAlgo01xDSid = createMatAlgo01xDSid({ typed })\n const matAlgo02xDS0 = createMatAlgo02xDS0({ typed, equalScalar })\n const matAlgo08xS0Sid = createMatAlgo08xS0Sid({ typed, equalScalar })\n const matAlgo10xSids = createMatAlgo10xSids({ typed, DenseMatrix })\n const matAlgo11xS0s = createMatAlgo11xS0s({ typed, equalScalar })\n const matAlgo14xDs = createMatAlgo14xDs({ typed })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n const useMatrixForArrayScalar = createUseMatrixForArrayScalar({ typed, matrix })\n\n /**\n * Bitwise right arithmetic shift of a value x by y number of bits, `x >> y`.\n * For matrices, the function is evaluated element wise.\n * For units, the function is evaluated on the best prefix base.\n *\n * Syntax:\n *\n * math.rightArithShift(x, y)\n *\n * Examples:\n *\n * math.rightArithShift(4, 2) // returns number 1\n *\n * math.rightArithShift([16, -32, 64], 4) // returns Array [1, -2, 4]\n *\n * See also:\n *\n * bitAnd, bitNot, bitOr, bitXor, rightArithShift, rightLogShift\n *\n * @param {number | BigNumber | bigint | Array | Matrix} x Value to be shifted\n * @param {number | BigNumber | bigint} y Amount of shifts\n * @return {number | BigNumber | bigint | Array | Matrix} `x` zero-filled shifted right `y` times\n */\n return typed(\n name,\n {\n 'number, number': rightArithShiftNumber,\n\n 'BigNumber, BigNumber': rightArithShiftBigNumber,\n\n 'bigint, bigint': (x, y) => x >> y,\n\n 'SparseMatrix, number | BigNumber': typed.referToSelf(self => (x, y) => {\n // check scalar\n if (equalScalar(y, 0)) {\n return x.clone()\n }\n return matAlgo11xS0s(x, y, self, false)\n }),\n\n 'DenseMatrix, number | BigNumber': typed.referToSelf(self => (x, y) => {\n // check scalar\n if (equalScalar(y, 0)) {\n return x.clone()\n }\n return matAlgo14xDs(x, y, self, false)\n }),\n\n 'number | BigNumber, SparseMatrix': typed.referToSelf(self => (x, y) => {\n // check scalar\n if (equalScalar(x, 0)) {\n return zeros(y.size(), y.storage())\n }\n return matAlgo10xSids(y, x, self, true)\n }),\n\n 'number | BigNumber, DenseMatrix': typed.referToSelf(self => (x, y) => {\n // check scalar\n if (equalScalar(x, 0)) {\n return zeros(y.size(), y.storage())\n }\n return matAlgo14xDs(y, x, self, true)\n })\n },\n useMatrixForArrayScalar,\n matrixAlgorithmSuite({\n SS: matAlgo08xS0Sid,\n DS: matAlgo01xDSid,\n SD: matAlgo02xDS0\n })\n )\n})\n","import { createMatAlgo02xDS0 } from '../../type/matrix/utils/matAlgo02xDS0.js'\nimport { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js'\nimport { createMatAlgo14xDs } from '../../type/matrix/utils/matAlgo14xDs.js'\nimport { createMatAlgo01xDSid } from '../../type/matrix/utils/matAlgo01xDSid.js'\nimport { createMatAlgo10xSids } from '../../type/matrix/utils/matAlgo10xSids.js'\nimport { createMatAlgo08xS0Sid } from '../../type/matrix/utils/matAlgo08xS0Sid.js'\nimport { factory } from '../../utils/factory.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\nimport { rightLogShiftNumber } from '../../plain/number/index.js'\nimport { createUseMatrixForArrayScalar } from './useMatrixForArrayScalar.js'\n\nconst name = 'rightLogShift'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'equalScalar',\n 'zeros',\n 'DenseMatrix',\n 'concat'\n]\n\nexport const createRightLogShift = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, zeros, DenseMatrix, concat }) => {\n const matAlgo01xDSid = createMatAlgo01xDSid({ typed })\n const matAlgo02xDS0 = createMatAlgo02xDS0({ typed, equalScalar })\n const matAlgo08xS0Sid = createMatAlgo08xS0Sid({ typed, equalScalar })\n const matAlgo10xSids = createMatAlgo10xSids({ typed, DenseMatrix })\n const matAlgo11xS0s = createMatAlgo11xS0s({ typed, equalScalar })\n const matAlgo14xDs = createMatAlgo14xDs({ typed })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n const useMatrixForArrayScalar = createUseMatrixForArrayScalar({ typed, matrix })\n\n /**\n * Bitwise right logical shift of value x by y number of bits, `x >>> y`.\n * For matrices, the function is evaluated element wise.\n * For units, the function is evaluated on the best prefix base.\n *\n * Syntax:\n *\n * math.rightLogShift(x, y)\n *\n * Examples:\n *\n * math.rightLogShift(4, 2) // returns number 1\n *\n * math.rightLogShift([16, 32, 64], 4) // returns Array [1, 2, 4]\n *\n * See also:\n *\n * bitAnd, bitNot, bitOr, bitXor, leftShift, rightLogShift\n *\n * @param {number | Array | Matrix} x Value to be shifted\n * @param {number} y Amount of shifts\n * @return {number | Array | Matrix} `x` zero-filled shifted right `y` times\n */\n\n return typed(\n name,\n {\n 'number, number': rightLogShiftNumber,\n\n // 'BigNumber, BigNumber': ..., // TODO: implement BigNumber support for rightLogShift\n\n 'SparseMatrix, number | BigNumber': typed.referToSelf(self => (x, y) => {\n // check scalar\n if (equalScalar(y, 0)) {\n return x.clone()\n }\n return matAlgo11xS0s(x, y, self, false)\n }),\n\n 'DenseMatrix, number | BigNumber': typed.referToSelf(self => (x, y) => {\n // check scalar\n if (equalScalar(y, 0)) {\n return x.clone()\n }\n return matAlgo14xDs(x, y, self, false)\n }),\n\n 'number | BigNumber, SparseMatrix': typed.referToSelf(self => (x, y) => {\n // check scalar\n if (equalScalar(x, 0)) {\n return zeros(y.size(), y.storage())\n }\n return matAlgo10xSids(y, x, self, true)\n }),\n\n 'number | BigNumber, DenseMatrix': typed.referToSelf(self => (x, y) => {\n // check scalar\n if (equalScalar(x, 0)) {\n return zeros(y.size(), y.storage())\n }\n return matAlgo14xDs(y, x, self, true)\n })\n },\n useMatrixForArrayScalar,\n matrixAlgorithmSuite({\n SS: matAlgo08xS0Sid,\n DS: matAlgo01xDSid,\n SD: matAlgo02xDS0\n })\n )\n})\n","import { createMatAlgo02xDS0 } from '../../type/matrix/utils/matAlgo02xDS0.js'\nimport { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js'\nimport { createMatAlgo14xDs } from '../../type/matrix/utils/matAlgo14xDs.js'\nimport { createMatAlgo06xS0S0 } from '../../type/matrix/utils/matAlgo06xS0S0.js'\nimport { factory } from '../../utils/factory.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\nimport { andNumber } from '../../plain/number/index.js'\n\nconst name = 'and'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'equalScalar',\n 'zeros',\n 'not',\n 'concat'\n]\n\nexport const createAnd = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, zeros, not, concat }) => {\n const matAlgo02xDS0 = createMatAlgo02xDS0({ typed, equalScalar })\n const matAlgo06xS0S0 = createMatAlgo06xS0S0({ typed, equalScalar })\n const matAlgo11xS0s = createMatAlgo11xS0s({ typed, equalScalar })\n const matAlgo14xDs = createMatAlgo14xDs({ typed })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n /**\n * Logical `and`. Test whether two values are both defined with a nonzero/nonempty value.\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.and(x, y)\n *\n * Examples:\n *\n * math.and(2, 4) // returns true\n *\n * a = [2, 0, 0]\n * b = [3, 7, 0]\n * c = 0\n *\n * math.and(a, b) // returns [true, false, false]\n * math.and(a, c) // returns [false, false, false]\n *\n * See also:\n *\n * not, or, xor\n *\n * @param {number | BigNumber | bigint | Complex | Unit | Array | Matrix} x First value to check\n * @param {number | BigNumber | bigint | Complex | Unit | Array | Matrix} y Second value to check\n * @return {boolean | Array | Matrix}\n * Returns true when both inputs are defined with a nonzero/nonempty value.\n */\n return typed(\n name,\n {\n 'number, number': andNumber,\n\n 'Complex, Complex': function (x, y) {\n return (x.re !== 0 || x.im !== 0) && (y.re !== 0 || y.im !== 0)\n },\n\n 'BigNumber, BigNumber': function (x, y) {\n return !x.isZero() && !y.isZero() && !x.isNaN() && !y.isNaN()\n },\n\n 'bigint, bigint': andNumber,\n\n 'Unit, Unit': typed.referToSelf(self =>\n (x, y) => self(x.value || 0, y.value || 0)),\n\n 'SparseMatrix, any': typed.referToSelf(self => (x, y) => {\n // check scalar\n if (not(y)) {\n // return zero matrix\n return zeros(x.size(), x.storage())\n }\n return matAlgo11xS0s(x, y, self, false)\n }),\n\n 'DenseMatrix, any': typed.referToSelf(self => (x, y) => {\n // check scalar\n if (not(y)) {\n // return zero matrix\n return zeros(x.size(), x.storage())\n }\n return matAlgo14xDs(x, y, self, false)\n }),\n\n 'any, SparseMatrix': typed.referToSelf(self => (x, y) => {\n // check scalar\n if (not(x)) {\n // return zero matrix\n return zeros(x.size(), x.storage())\n }\n return matAlgo11xS0s(y, x, self, true)\n }),\n\n 'any, DenseMatrix': typed.referToSelf(self => (x, y) => {\n // check scalar\n if (not(x)) {\n // return zero matrix\n return zeros(x.size(), x.storage())\n }\n return matAlgo14xDs(y, x, self, true)\n }),\n\n 'Array, any': typed.referToSelf(self => (x, y) => {\n // use matrix implementation\n return self(matrix(x), y).valueOf()\n }),\n\n 'any, Array': typed.referToSelf(self => (x, y) => {\n // use matrix implementation\n return self(x, matrix(y)).valueOf()\n })\n },\n matrixAlgorithmSuite({\n SS: matAlgo06xS0S0,\n DS: matAlgo02xDS0\n })\n )\n})\n","import { nearlyEqual as bigNearlyEqual } from '../../utils/bignumber/nearlyEqual.js'\nimport { nearlyEqual } from '../../utils/number.js'\nimport { factory } from '../../utils/factory.js'\nimport { createMatAlgo03xDSf } from '../../type/matrix/utils/matAlgo03xDSf.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { createMatAlgo05xSfSf } from '../../type/matrix/utils/matAlgo05xSfSf.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\nimport { createCompareUnits } from './compareUnits.js'\n\nconst name = 'compare'\nconst dependencies = [\n 'typed',\n 'config',\n 'matrix',\n 'equalScalar',\n 'BigNumber',\n 'Fraction',\n 'DenseMatrix',\n 'concat'\n]\n\nexport const createCompare = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, equalScalar, matrix, BigNumber, Fraction, DenseMatrix, concat }) => {\n const matAlgo03xDSf = createMatAlgo03xDSf({ typed })\n const matAlgo05xSfSf = createMatAlgo05xSfSf({ typed, equalScalar })\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n const compareUnits = createCompareUnits({ typed })\n\n /**\n * Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.\n *\n * x and y are considered equal when the relative difference between x and y\n * is smaller than the configured absTol and relTol. The function cannot be used to\n * compare values smaller than approximately 2.22e-16.\n *\n * For matrices, the function is evaluated element wise.\n * Strings are compared by their numerical value.\n *\n * Syntax:\n *\n * math.compare(x, y)\n *\n * Examples:\n *\n * math.compare(6, 1) // returns 1\n * math.compare(2, 3) // returns -1\n * math.compare(7, 7) // returns 0\n * math.compare('10', '2') // returns 1\n * math.compare('1000', '1e3') // returns 0\n *\n * const a = math.unit('5 cm')\n * const b = math.unit('40 mm')\n * math.compare(a, b) // returns 1\n *\n * math.compare(2, [1, 2, 3]) // returns [1, 0, -1]\n *\n * See also:\n *\n * equal, unequal, smaller, smallerEq, larger, largerEq, compareNatural, compareText\n *\n * @param {number | BigNumber | bigint | Fraction | Unit | string | Array | Matrix} x First value to compare\n * @param {number | BigNumber | bigint | Fraction | Unit | string | Array | Matrix} y Second value to compare\n * @return {number | BigNumber | bigint | Fraction | Array | Matrix} Returns the result of the comparison:\n * 1 when x > y, -1 when x < y, and 0 when x == y.\n */\n return typed(\n name,\n createCompareNumber({ typed, config }),\n {\n 'boolean, boolean': function (x, y) {\n return x === y ? 0 : (x > y ? 1 : -1)\n },\n\n 'BigNumber, BigNumber': function (x, y) {\n return bigNearlyEqual(x, y, config.relTol, config.absTol)\n ? new BigNumber(0)\n : new BigNumber(x.cmp(y))\n },\n\n 'bigint, bigint': function (x, y) {\n return x === y ? 0n : (x > y ? 1n : -1n)\n },\n\n 'Fraction, Fraction': function (x, y) {\n return new Fraction(x.compare(y))\n },\n\n 'Complex, Complex': function () {\n throw new TypeError('No ordering relation is defined for complex numbers')\n }\n },\n compareUnits,\n matrixAlgorithmSuite({\n SS: matAlgo05xSfSf,\n DS: matAlgo03xDSf,\n Ss: matAlgo12xSfs\n })\n )\n})\n\nexport const createCompareNumber = /* #__PURE__ */ factory(name, ['typed', 'config'], ({ typed, config }) => {\n return typed(name, {\n 'number, number': function (x, y) {\n return nearlyEqual(x, y, config.relTol, config.absTol)\n ? 0\n : (x > y ? 1 : -1)\n }\n })\n})\n","import naturalSort from 'javascript-natural-sort'\nimport { isDenseMatrix, isSparseMatrix, typeOf } from '../../utils/is.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'compareNatural'\nconst dependencies = [\n 'typed',\n 'compare'\n]\n\nexport const createCompareNatural = /* #__PURE__ */ factory(name, dependencies, ({ typed, compare }) => {\n const compareBooleans = compare.signatures['boolean,boolean']\n\n /**\n * Compare two values of any type in a deterministic, natural way.\n *\n * For numeric values, the function works the same as `math.compare`.\n * For types of values that can't be compared mathematically,\n * the function compares in a natural way.\n *\n * For numeric values, x and y are considered equal when the relative\n * difference between x and y is smaller than the configured relTol and absTol.\n * The function cannot be used to compare values smaller than\n * approximately 2.22e-16.\n *\n * For Complex numbers, first the real parts are compared. If equal,\n * the imaginary parts are compared.\n *\n * Strings are compared with a natural sorting algorithm, which\n * orders strings in a \"logic\" way following some heuristics.\n * This differs from the function `compare`, which converts the string\n * into a numeric value and compares that. The function `compareText`\n * on the other hand compares text lexically.\n *\n * Arrays and Matrices are compared value by value until there is an\n * unequal pair of values encountered. Objects are compared by sorted\n * keys until the keys or their values are unequal.\n *\n * Syntax:\n *\n * math.compareNatural(x, y)\n *\n * Examples:\n *\n * math.compareNatural(6, 1) // returns 1\n * math.compareNatural(2, 3) // returns -1\n * math.compareNatural(7, 7) // returns 0\n *\n * math.compareNatural('10', '2') // returns 1\n * math.compareText('10', '2') // returns -1\n * math.compare('10', '2') // returns 1\n *\n * math.compareNatural('Answer: 10', 'Answer: 2') // returns 1\n * math.compareText('Answer: 10', 'Answer: 2') // returns -1\n * math.compare('Answer: 10', 'Answer: 2')\n * // Error: Cannot convert \"Answer: 10\" to a number\n *\n * const a = math.unit('5 cm')\n * const b = math.unit('40 mm')\n * math.compareNatural(a, b) // returns 1\n *\n * const c = math.complex('2 + 3i')\n * const d = math.complex('2 + 4i')\n * math.compareNatural(c, d) // returns -1\n *\n * math.compareNatural([1, 2, 4], [1, 2, 3]) // returns 1\n * math.compareNatural([1, 2, 3], [1, 2]) // returns 1\n * math.compareNatural([1, 5], [1, 2, 3]) // returns 1\n * math.compareNatural([1, 2], [1, 2]) // returns 0\n *\n * math.compareNatural({a: 2}, {a: 4}) // returns -1\n *\n * See also:\n *\n * compare, compareText\n *\n * @param {*} x First value to compare\n * @param {*} y Second value to compare\n * @return {number} Returns the result of the comparison:\n * 1 when x > y, -1 when x < y, and 0 when x == y.\n */\n return typed(name, { 'any, any': _compareNatural }) // just to check # args\n\n function _compareNatural (x, y) {\n const typeX = typeOf(x)\n const typeY = typeOf(y)\n let c\n\n // numeric types\n if ((typeX === 'number' || typeX === 'BigNumber' || typeX === 'Fraction') &&\n (typeY === 'number' || typeY === 'BigNumber' || typeY === 'Fraction')) {\n c = compare(x, y)\n if (c.toString() !== '0') {\n // c can be number, BigNumber, or Fraction\n return c > 0 ? 1 : -1 // return a number\n } else {\n return naturalSort(typeX, typeY)\n }\n }\n\n // matrix types\n const matTypes = ['Array', 'DenseMatrix', 'SparseMatrix']\n if (matTypes.includes(typeX) || matTypes.includes(typeY)) {\n c = compareMatricesAndArrays(_compareNatural, x, y)\n if (c !== 0) {\n return c\n } else {\n return naturalSort(typeX, typeY)\n }\n }\n\n // in case of different types, order by name of type, i.e. 'BigNumber' < 'Complex'\n if (typeX !== typeY) {\n return naturalSort(typeX, typeY)\n }\n\n if (typeX === 'Complex') {\n return compareComplexNumbers(x, y)\n }\n\n if (typeX === 'Unit') {\n if (x.equalBase(y)) {\n return _compareNatural(x.value, y.value)\n }\n\n // compare by units\n return compareArrays(_compareNatural, x.formatUnits(), y.formatUnits())\n }\n\n if (typeX === 'boolean') {\n return compareBooleans(x, y)\n }\n\n if (typeX === 'string') {\n return naturalSort(x, y)\n }\n\n if (typeX === 'Object') {\n return compareObjects(_compareNatural, x, y)\n }\n\n if (typeX === 'null') {\n return 0\n }\n\n if (typeX === 'undefined') {\n return 0\n }\n\n // this should not occur...\n throw new TypeError('Unsupported type of value \"' + typeX + '\"')\n }\n\n /**\n * Compare mixed matrix/array types, by converting to same-shaped array.\n * This comparator is non-deterministic regarding input types.\n * @param {Array | SparseMatrix | DenseMatrix | *} x\n * @param {Array | SparseMatrix | DenseMatrix | *} y\n * @returns {number} Returns the comparison result: -1, 0, or 1\n */\n function compareMatricesAndArrays (compareNatural, x, y) {\n if (isSparseMatrix(x) && isSparseMatrix(y)) {\n return compareArrays(compareNatural, x.toJSON().values, y.toJSON().values)\n }\n if (isSparseMatrix(x)) {\n // note: convert to array is expensive\n return compareMatricesAndArrays(compareNatural, x.toArray(), y)\n }\n if (isSparseMatrix(y)) {\n // note: convert to array is expensive\n return compareMatricesAndArrays(compareNatural, x, y.toArray())\n }\n\n // convert DenseArray into Array\n if (isDenseMatrix(x)) {\n return compareMatricesAndArrays(compareNatural, x.toJSON().data, y)\n }\n if (isDenseMatrix(y)) {\n return compareMatricesAndArrays(compareNatural, x, y.toJSON().data)\n }\n\n // convert scalars to array\n if (!Array.isArray(x)) {\n return compareMatricesAndArrays(compareNatural, [x], y)\n }\n if (!Array.isArray(y)) {\n return compareMatricesAndArrays(compareNatural, x, [y])\n }\n\n return compareArrays(compareNatural, x, y)\n }\n\n /**\n * Compare two Arrays\n *\n * - First, compares value by value\n * - Next, if all corresponding values are equal,\n * look at the length: longest array will be considered largest\n *\n * @param {Array} x\n * @param {Array} y\n * @returns {number} Returns the comparison result: -1, 0, or 1\n */\n function compareArrays (compareNatural, x, y) {\n // compare each value\n for (let i = 0, ii = Math.min(x.length, y.length); i < ii; i++) {\n const v = compareNatural(x[i], y[i])\n if (v !== 0) {\n return v\n }\n }\n\n // compare the size of the arrays\n if (x.length > y.length) { return 1 }\n if (x.length < y.length) { return -1 }\n\n // both Arrays have equal size and content\n return 0\n }\n\n /**\n * Compare two objects\n *\n * - First, compare sorted property names\n * - Next, compare the property values\n *\n * @param {Object} x\n * @param {Object} y\n * @returns {number} Returns the comparison result: -1, 0, or 1\n */\n function compareObjects (compareNatural, x, y) {\n const keysX = Object.keys(x)\n const keysY = Object.keys(y)\n\n // compare keys\n keysX.sort(naturalSort)\n keysY.sort(naturalSort)\n const c = compareArrays(compareNatural, keysX, keysY)\n if (c !== 0) {\n return c\n }\n\n // compare values\n for (let i = 0; i < keysX.length; i++) {\n const v = compareNatural(x[keysX[i]], y[keysY[i]])\n if (v !== 0) {\n return v\n }\n }\n\n return 0\n }\n})\n\n/**\n * Compare two complex numbers, `x` and `y`:\n *\n * - First, compare the real values of `x` and `y`\n * - If equal, compare the imaginary values of `x` and `y`\n *\n * @params {Complex} x\n * @params {Complex} y\n * @returns {number} Returns the comparison result: -1, 0, or 1\n */\nfunction compareComplexNumbers (x, y) {\n if (x.re > y.re) { return 1 }\n if (x.re < y.re) { return -1 }\n\n if (x.im > y.im) { return 1 }\n if (x.im < y.im) { return -1 }\n\n return 0\n}\n","import { compareText as _compareText } from '../../utils/string.js'\nimport { factory } from '../../utils/factory.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\n\nconst name = 'compareText'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'concat'\n]\n\n_compareText.signature = 'any, any'\n\nexport const createCompareText = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, concat }) => {\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n /**\n * Compare two strings lexically. Comparison is case sensitive.\n * Returns 1 when x > y, -1 when x < y, and 0 when x == y.\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.compareText(x, y)\n *\n * Examples:\n *\n * math.compareText('B', 'A') // returns 1\n * math.compareText('2', '10') // returns 1\n * math.compare('2', '10') // returns -1\n * math.compareNatural('2', '10') // returns -1\n *\n * math.compareText('B', ['A', 'B', 'C']) // returns [1, 0, -1]\n *\n * See also:\n *\n * equal, equalText, compare, compareNatural\n *\n * @param {string | Array | DenseMatrix} x First string to compare\n * @param {string | Array | DenseMatrix} y Second string to compare\n * @return {number | Array | DenseMatrix} Returns the result of the comparison:\n * 1 when x > y, -1 when x < y, and 0 when x == y.\n */\n return typed(name, _compareText, matrixAlgorithmSuite({\n elop: _compareText,\n Ds: true\n }))\n})\n\nexport const createCompareTextNumber = /* #__PURE__ */ factory(\n name, ['typed'], ({ typed }) => typed(name, _compareText)\n)\n","import { factory } from '../../utils/factory.js'\nimport { createMatAlgo03xDSf } from '../../type/matrix/utils/matAlgo03xDSf.js'\nimport { createMatAlgo07xSSf } from '../../type/matrix/utils/matAlgo07xSSf.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\n\nconst name = 'equal'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'equalScalar',\n 'DenseMatrix',\n 'concat',\n 'SparseMatrix'\n]\n\nexport const createEqual = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, DenseMatrix, concat, SparseMatrix }) => {\n const matAlgo03xDSf = createMatAlgo03xDSf({ typed })\n const matAlgo07xSSf = createMatAlgo07xSSf({ typed, SparseMatrix })\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n /**\n * Test whether two values are equal.\n *\n * The function tests whether the relative difference between x and y is\n * smaller than the configured relTol and absTol. The function cannot be used to\n * compare values smaller than approximately 2.22e-16.\n *\n * For matrices, the function is evaluated element wise.\n * In case of complex numbers, x.re must equal y.re, and x.im must equal y.im.\n *\n * Values `null` and `undefined` are compared strictly, thus `null` is only\n * equal to `null` and nothing else, and `undefined` is only equal to\n * `undefined` and nothing else. Strings are compared by their numerical value.\n *\n * Syntax:\n *\n * math.equal(x, y)\n *\n * Examples:\n *\n * math.equal(2 + 2, 3) // returns false\n * math.equal(2 + 2, 4) // returns true\n *\n * const a = math.unit('50 cm')\n * const b = math.unit('5 m')\n * math.equal(a, b) // returns true\n *\n * const c = [2, 5, 1]\n * const d = [2, 7, 1]\n *\n * math.equal(c, d) // returns [true, false, true]\n * math.deepEqual(c, d) // returns false\n *\n * math.equal(\"1000\", \"1e3\") // returns true\n * math.equal(0, null) // returns false\n *\n * See also:\n *\n * unequal, smaller, smallerEq, larger, largerEq, compare, deepEqual, equalText\n *\n * @param {number | BigNumber | bigint | boolean | Complex | Unit | string | Array | Matrix} x First value to compare\n * @param {number | BigNumber | bigint | boolean | Complex | Unit | string | Array | Matrix} y Second value to compare\n * @return {boolean | Array | Matrix} Returns true when the compared values are equal, else returns false\n */\n return typed(\n name,\n createEqualNumber({ typed, equalScalar }),\n matrixAlgorithmSuite({\n elop: equalScalar,\n SS: matAlgo07xSSf,\n DS: matAlgo03xDSf,\n Ss: matAlgo12xSfs\n })\n )\n})\n\nexport const createEqualNumber = factory(name, ['typed', 'equalScalar'], ({ typed, equalScalar }) => {\n return typed(name, {\n 'any, any': function (x, y) {\n // strict equality for null and undefined?\n if (x === null) { return y === null }\n if (y === null) { return x === null }\n if (x === undefined) { return y === undefined }\n if (y === undefined) { return x === undefined }\n\n return equalScalar(x, y)\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'equalText'\nconst dependencies = [\n 'typed',\n 'compareText',\n 'isZero'\n]\n\nexport const createEqualText = /* #__PURE__ */ factory(name, dependencies, ({ typed, compareText, isZero }) => {\n /**\n * Check equality of two strings. Comparison is case sensitive.\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.equalText(x, y)\n *\n * Examples:\n *\n * math.equalText('Hello', 'Hello') // returns true\n * math.equalText('a', 'A') // returns false\n * math.equal('2e3', '2000') // returns true\n * math.equalText('2e3', '2000') // returns false\n *\n * math.equalText('B', ['A', 'B', 'C']) // returns [false, true, false]\n *\n * See also:\n *\n * equal, compareText, compare, compareNatural\n *\n * @param {string | Array | DenseMatrix} x First string to compare\n * @param {string | Array | DenseMatrix} y Second string to compare\n * @return {number | Array | DenseMatrix} Returns true if the values are equal, and false if not.\n */\n return typed(name, {\n 'any, any': function (x, y) {\n return isZero(compareText(x, y))\n }\n })\n})\n","import { nearlyEqual as bigNearlyEqual } from '../../utils/bignumber/nearlyEqual.js'\nimport { nearlyEqual } from '../../utils/number.js'\nimport { factory } from '../../utils/factory.js'\nimport { createMatAlgo03xDSf } from '../../type/matrix/utils/matAlgo03xDSf.js'\nimport { createMatAlgo07xSSf } from '../../type/matrix/utils/matAlgo07xSSf.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\nimport { createCompareUnits } from './compareUnits.js'\n\nconst name = 'smaller'\nconst dependencies = [\n 'typed',\n 'config',\n 'bignumber',\n 'matrix',\n 'DenseMatrix',\n 'concat',\n 'SparseMatrix'\n]\n\nexport const createSmaller = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, bignumber, matrix, DenseMatrix, concat, SparseMatrix }) => {\n const matAlgo03xDSf = createMatAlgo03xDSf({ typed })\n const matAlgo07xSSf = createMatAlgo07xSSf({ typed, SparseMatrix })\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n const compareUnits = createCompareUnits({ typed })\n\n /**\n * Test whether value x is smaller than y.\n *\n * The function returns true when x is smaller than y and the relative\n * difference between x and y is smaller than the configured relTol and absTol. The\n * function cannot be used to compare values smaller than approximately 2.22e-16.\n *\n * For matrices, the function is evaluated element wise.\n * Strings are compared by their numerical value.\n *\n * Syntax:\n *\n * math.smaller(x, y)\n *\n * Examples:\n *\n * math.smaller(2, 3) // returns true\n * math.smaller(5, 2 * 2) // returns false\n *\n * const a = math.unit('5 cm')\n * const b = math.unit('2 inch')\n * math.smaller(a, b) // returns true\n *\n * See also:\n *\n * equal, unequal, smallerEq, smaller, smallerEq, compare\n *\n * @param {number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix} x First value to compare\n * @param {number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix} y Second value to compare\n * @return {boolean | Array | Matrix} Returns true when the x is smaller than y, else returns false\n */\n function bignumSmaller (x, y) {\n return x.lt(y) && !bigNearlyEqual(x, y, config.relTol, config.absTol)\n }\n\n return typed(\n name,\n createSmallerNumber({ typed, config }),\n {\n 'boolean, boolean': (x, y) => x < y,\n\n 'BigNumber, BigNumber': bignumSmaller,\n\n 'bigint, bigint': (x, y) => x < y,\n\n 'Fraction, Fraction': (x, y) => (x.compare(y) === -1),\n\n 'Fraction, BigNumber': function (x, y) {\n return bignumSmaller(bignumber(x), y)\n },\n\n 'BigNumber, Fraction': function (x, y) {\n return bignumSmaller(x, bignumber(y))\n },\n\n 'Complex, Complex': function (x, y) {\n throw new TypeError('No ordering relation is defined for complex numbers')\n }\n },\n compareUnits,\n matrixAlgorithmSuite({\n SS: matAlgo07xSSf,\n DS: matAlgo03xDSf,\n Ss: matAlgo12xSfs\n })\n )\n})\n\nexport const createSmallerNumber = /* #__PURE__ */ factory(name, ['typed', 'config'], ({ typed, config }) => {\n return typed(name, {\n 'number, number': function (x, y) {\n return x < y && !nearlyEqual(x, y, config.relTol, config.absTol)\n }\n })\n})\n","import { nearlyEqual as bigNearlyEqual } from '../../utils/bignumber/nearlyEqual.js'\nimport { nearlyEqual } from '../../utils/number.js'\nimport { factory } from '../../utils/factory.js'\nimport { createMatAlgo03xDSf } from '../../type/matrix/utils/matAlgo03xDSf.js'\nimport { createMatAlgo07xSSf } from '../../type/matrix/utils/matAlgo07xSSf.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\nimport { createCompareUnits } from './compareUnits.js'\n\nconst name = 'smallerEq'\nconst dependencies = [\n 'typed',\n 'config',\n 'matrix',\n 'DenseMatrix',\n 'concat',\n 'SparseMatrix'\n]\n\nexport const createSmallerEq = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, matrix, DenseMatrix, concat, SparseMatrix }) => {\n const matAlgo03xDSf = createMatAlgo03xDSf({ typed })\n const matAlgo07xSSf = createMatAlgo07xSSf({ typed, SparseMatrix })\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n const compareUnits = createCompareUnits({ typed })\n\n /**\n * Test whether value x is smaller or equal to y.\n *\n * The function returns true when x is smaller than y or the relative\n * difference between x and y is smaller than the configured relTol and absTol. The\n * function cannot be used to compare values smaller than approximately 2.22e-16.\n *\n * For matrices, the function is evaluated element wise.\n * Strings are compared by their numerical value.\n *\n * Syntax:\n *\n * math.smallerEq(x, y)\n *\n * Examples:\n *\n * math.smaller(1 + 2, 3) // returns false\n * math.smallerEq(1 + 2, 3) // returns true\n *\n * See also:\n *\n * equal, unequal, smaller, larger, largerEq, compare\n *\n * @param {number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix} x First value to compare\n * @param {number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix} y Second value to compare\n * @return {boolean | Array | Matrix} Returns true when the x is smaller than y, else returns false\n */\n return typed(\n name,\n createSmallerEqNumber({ typed, config }),\n {\n 'boolean, boolean': (x, y) => (x <= y),\n\n 'BigNumber, BigNumber': function (x, y) {\n return x.lte(y) || bigNearlyEqual(x, y, config.relTol, config.absTol)\n },\n\n 'bigint, bigint': (x, y) => (x <= y),\n\n 'Fraction, Fraction': (x, y) => (x.compare(y) !== 1),\n\n 'Complex, Complex': function () {\n throw new TypeError('No ordering relation is defined for complex numbers')\n }\n },\n compareUnits,\n matrixAlgorithmSuite({\n SS: matAlgo07xSSf,\n DS: matAlgo03xDSf,\n Ss: matAlgo12xSfs\n })\n )\n})\n\nexport const createSmallerEqNumber = /* #__PURE__ */ factory(name, ['typed', 'config'], ({ typed, config }) => {\n return typed(name, {\n 'number, number': function (x, y) {\n return x <= y || nearlyEqual(x, y, config.relTol, config.absTol)\n }\n })\n})\n","import { nearlyEqual as bigNearlyEqual } from '../../utils/bignumber/nearlyEqual.js'\nimport { nearlyEqual } from '../../utils/number.js'\nimport { factory } from '../../utils/factory.js'\nimport { createMatAlgo03xDSf } from '../../type/matrix/utils/matAlgo03xDSf.js'\nimport { createMatAlgo07xSSf } from '../../type/matrix/utils/matAlgo07xSSf.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\nimport { createCompareUnits } from './compareUnits.js'\n\nconst name = 'larger'\nconst dependencies = [\n 'typed',\n 'config',\n 'bignumber',\n 'matrix',\n 'DenseMatrix',\n 'concat',\n 'SparseMatrix'\n]\n\nexport const createLarger = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, bignumber, matrix, DenseMatrix, concat, SparseMatrix }) => {\n const matAlgo03xDSf = createMatAlgo03xDSf({ typed })\n const matAlgo07xSSf = createMatAlgo07xSSf({ typed, SparseMatrix })\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n const compareUnits = createCompareUnits({ typed })\n\n /**\n * Test whether value x is larger than y.\n *\n * The function returns true when x is larger than y and the relative\n * difference between x and y is larger than the configured relTol and absTol. The\n * function cannot be used to compare values smaller than approximately 2.22e-16.\n *\n * For matrices, the function is evaluated element wise.\n * Strings are compared by their numerical value.\n *\n * Syntax:\n *\n * math.larger(x, y)\n *\n * Examples:\n *\n * math.larger(2, 3) // returns false\n * math.larger(5, 2 + 2) // returns true\n *\n * const a = math.unit('5 cm')\n * const b = math.unit('2 inch')\n * math.larger(a, b) // returns false\n *\n * See also:\n *\n * equal, unequal, smaller, smallerEq, largerEq, compare\n *\n * @param {number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix} x First value to compare\n * @param {number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix} y Second value to compare\n * @return {boolean | Array | Matrix} Returns true when the x is larger than y, else returns false\n */\n function bignumLarger (x, y) {\n return x.gt(y) && !bigNearlyEqual(x, y, config.relTol, config.absTol)\n }\n\n return typed(\n name,\n createLargerNumber({ typed, config }),\n {\n 'boolean, boolean': (x, y) => x > y,\n\n 'BigNumber, BigNumber': bignumLarger,\n\n 'bigint, bigint': (x, y) => x > y,\n\n 'Fraction, Fraction': (x, y) => (x.compare(y) === 1),\n\n 'Fraction, BigNumber': function (x, y) {\n return bignumLarger(bignumber(x), y)\n },\n\n 'BigNumber, Fraction': function (x, y) {\n return bignumLarger(x, bignumber(y))\n },\n\n 'Complex, Complex': function () {\n throw new TypeError('No ordering relation is defined for complex numbers')\n }\n },\n compareUnits,\n matrixAlgorithmSuite({\n SS: matAlgo07xSSf,\n DS: matAlgo03xDSf,\n Ss: matAlgo12xSfs\n })\n )\n})\n\nexport const createLargerNumber = /* #__PURE__ */ factory(name, ['typed', 'config'], ({ typed, config }) => {\n return typed(name, {\n 'number, number': function (x, y) {\n return x > y && !nearlyEqual(x, y, config.relTol, config.absTol)\n }\n })\n})\n","import { nearlyEqual as bigNearlyEqual } from '../../utils/bignumber/nearlyEqual.js'\nimport { nearlyEqual } from '../../utils/number.js'\nimport { factory } from '../../utils/factory.js'\nimport { createMatAlgo03xDSf } from '../../type/matrix/utils/matAlgo03xDSf.js'\nimport { createMatAlgo07xSSf } from '../../type/matrix/utils/matAlgo07xSSf.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\nimport { createCompareUnits } from './compareUnits.js'\n\nconst name = 'largerEq'\nconst dependencies = [\n 'typed',\n 'config',\n 'matrix',\n 'DenseMatrix',\n 'concat',\n 'SparseMatrix'\n]\n\nexport const createLargerEq = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, matrix, DenseMatrix, concat, SparseMatrix }) => {\n const matAlgo03xDSf = createMatAlgo03xDSf({ typed })\n const matAlgo07xSSf = createMatAlgo07xSSf({ typed, SparseMatrix })\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n const compareUnits = createCompareUnits({ typed })\n\n /**\n * Test whether value x is larger or equal to y.\n *\n * The function returns true when x is larger than y or the relative\n * difference between x and y is smaller than the configured relTol and absTol. The\n * function cannot be used to compare values smaller than approximately 2.22e-16.\n *\n * For matrices, the function is evaluated element wise.\n * Strings are compared by their numerical value.\n *\n * Syntax:\n *\n * math.largerEq(x, y)\n *\n * Examples:\n *\n * math.larger(2, 1 + 1) // returns false\n * math.largerEq(2, 1 + 1) // returns true\n *\n * See also:\n *\n * equal, unequal, smaller, smallerEq, larger, compare\n *\n * @param {number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix} x First value to compare\n * @param {number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix} y Second value to compare\n * @return {boolean | Array | Matrix} Returns true when the x is larger or equal to y, else returns false\n */\n return typed(\n name,\n createLargerEqNumber({ typed, config }),\n {\n 'boolean, boolean': (x, y) => x >= y,\n\n 'BigNumber, BigNumber': function (x, y) {\n return x.gte(y) || bigNearlyEqual(x, y, config.relTol, config.absTol)\n },\n\n 'bigint, bigint': function (x, y) {\n return x >= y\n },\n\n 'Fraction, Fraction': (x, y) => (x.compare(y) !== -1),\n\n 'Complex, Complex': function () {\n throw new TypeError('No ordering relation is defined for complex numbers')\n }\n },\n compareUnits,\n matrixAlgorithmSuite({\n SS: matAlgo07xSSf,\n DS: matAlgo03xDSf,\n Ss: matAlgo12xSfs\n })\n )\n})\n\nexport const createLargerEqNumber = /* #__PURE__ */ factory(name, ['typed', 'config'], ({ typed, config }) => {\n return typed(name, {\n 'number, number': function (x, y) {\n return x >= y || nearlyEqual(x, y, config.relTol, config.absTol)\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'deepEqual'\nconst dependencies = [\n 'typed',\n 'equal'\n]\n\nexport const createDeepEqual = /* #__PURE__ */ factory(name, dependencies, ({ typed, equal }) => {\n /**\n * Test element wise whether two matrices are equal.\n * The function accepts both matrices and scalar values.\n *\n * Strings are compared by their numerical value.\n *\n * Syntax:\n *\n * math.deepEqual(x, y)\n *\n * Examples:\n *\n * math.deepEqual(2, 4) // returns false\n *\n * a = [2, 5, 1]\n * b = [2, 7, 1]\n *\n * math.deepEqual(a, b) // returns false\n * math.equal(a, b) // returns [true, false, true]\n *\n * See also:\n *\n * equal, unequal\n *\n * @param {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} x First matrix to compare\n * @param {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} y Second matrix to compare\n * @return {number | BigNumber | Fraction | Complex | Unit | Array | Matrix}\n * Returns true when the input matrices have the same size and each of their elements is equal.\n */\n return typed(name, {\n 'any, any': function (x, y) {\n return _deepEqual(x.valueOf(), y.valueOf())\n }\n })\n\n /**\n * Test whether two arrays have the same size and all elements are equal\n * @param {Array | *} x\n * @param {Array | *} y\n * @return {boolean} Returns true if both arrays are deep equal\n */\n function _deepEqual (x, y) {\n if (Array.isArray(x)) {\n if (Array.isArray(y)) {\n const len = x.length\n if (len !== y.length) {\n return false\n }\n\n for (let i = 0; i < len; i++) {\n if (!_deepEqual(x[i], y[i])) {\n return false\n }\n }\n\n return true\n } else {\n return false\n }\n } else {\n if (Array.isArray(y)) {\n return false\n } else {\n return equal(x, y)\n }\n }\n }\n})\n","import { factory } from '../../utils/factory.js'\nimport { createMatAlgo03xDSf } from '../../type/matrix/utils/matAlgo03xDSf.js'\nimport { createMatAlgo07xSSf } from '../../type/matrix/utils/matAlgo07xSSf.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\n\nconst name = 'unequal'\nconst dependencies = [\n 'typed',\n 'config',\n 'equalScalar',\n 'matrix',\n 'DenseMatrix',\n 'concat',\n 'SparseMatrix'\n]\n\nexport const createUnequal = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, equalScalar, matrix, DenseMatrix, concat, SparseMatrix }) => {\n const matAlgo03xDSf = createMatAlgo03xDSf({ typed })\n const matAlgo07xSSf = createMatAlgo07xSSf({ typed, SparseMatrix })\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n /**\n * Test whether two values are unequal.\n *\n * The function tests whether the relative difference between x and y is\n * larger than the configured relTol and absTol. The function cannot be used to compare\n * values smaller than approximately 2.22e-16.\n *\n * For matrices, the function is evaluated element wise.\n * In case of complex numbers, x.re must unequal y.re, or x.im must unequal y.im.\n * Strings are compared by their numerical value.\n *\n * Values `null` and `undefined` are compared strictly, thus `null` is unequal\n * with everything except `null`, and `undefined` is unequal with everything\n * except `undefined`.\n *\n * Syntax:\n *\n * math.unequal(x, y)\n *\n * Examples:\n *\n * math.unequal(2 + 2, 3) // returns true\n * math.unequal(2 + 2, 4) // returns false\n *\n * const a = math.unit('50 cm')\n * const b = math.unit('5 m')\n * math.unequal(a, b) // returns false\n *\n * const c = [2, 5, 1]\n * const d = [2, 7, 1]\n *\n * math.unequal(c, d) // returns [false, true, false]\n * math.deepEqual(c, d) // returns false\n *\n * math.unequal(0, null) // returns true\n * See also:\n *\n * equal, deepEqual, smaller, smallerEq, larger, largerEq, compare\n *\n * @param {number | BigNumber | Fraction | boolean | Complex | Unit | string | Array | Matrix | undefined} x First value to compare\n * @param {number | BigNumber | Fraction | boolean | Complex | Unit | string | Array | Matrix | undefined} y Second value to compare\n * @return {boolean | Array | Matrix} Returns true when the compared values are unequal, else returns false\n */\n return typed(\n name,\n createUnequalNumber({ typed, equalScalar }),\n matrixAlgorithmSuite({\n elop: _unequal,\n SS: matAlgo07xSSf,\n DS: matAlgo03xDSf,\n Ss: matAlgo12xSfs\n })\n )\n\n function _unequal (x, y) {\n return !equalScalar(x, y)\n }\n})\n\nexport const createUnequalNumber = factory(name, ['typed', 'equalScalar'], ({ typed, equalScalar }) => {\n return typed(name, {\n 'any, any': function (x, y) {\n // strict equality for null and undefined?\n if (x === null) { return y !== null }\n if (y === null) { return x !== null }\n if (x === undefined) { return y !== undefined }\n if (y === undefined) { return x !== undefined }\n\n return !equalScalar(x, y)\n }\n })\n})\n","import { isMatrix } from '../../utils/is.js'\nimport { isInteger } from '../../utils/number.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'partitionSelect'\nconst dependencies = ['typed', 'isNumeric', 'isNaN', 'compare']\n\nexport const createPartitionSelect = /* #__PURE__ */ factory(name, dependencies, ({ typed, isNumeric, isNaN: mathIsNaN, compare }) => {\n const asc = compare\n const desc = (a, b) => -compare(a, b)\n\n /**\n * Partition-based selection of an array or 1D matrix.\n * Will find the kth smallest value, and mutates the input array.\n * Uses Quickselect.\n *\n * Syntax:\n *\n * math.partitionSelect(x, k)\n * math.partitionSelect(x, k, compare)\n *\n * Examples:\n *\n * math.partitionSelect([5, 10, 1], 2) // returns 10\n * math.partitionSelect(['C', 'B', 'A', 'D'], 1, math.compareText) // returns 'B'\n *\n * function sortByLength (a, b) {\n * return a.length - b.length\n * }\n * math.partitionSelect(['Langdon', 'Tom', 'Sara'], 2, sortByLength) // returns 'Langdon'\n *\n * // the input array is mutated\n * arr = [5, 2, 1]\n * math.partitionSelect(arr, 0) // returns 1, arr is now: [1, 2, 5]\n * math.partitionSelect(arr, 1, 'desc') // returns 2, arr is now: [5, 2, 1]\n *\n * See also:\n *\n * sort\n *\n * @param {Matrix | Array} x A one dimensional matrix or array to sort\n * @param {Number} k The kth smallest value to be retrieved zero-based index\n * @param {Function | 'asc' | 'desc'} [compare='asc']\n * An optional comparator function. The function is called as\n * `compare(a, b)`, and must return 1 when a > b, -1 when a < b,\n * and 0 when a == b.\n * @return {*} Returns the kth lowest value.\n */\n return typed(name, {\n 'Array | Matrix, number': function (x, k) {\n return _partitionSelect(x, k, asc)\n },\n\n 'Array | Matrix, number, string': function (x, k, compare) {\n if (compare === 'asc') {\n return _partitionSelect(x, k, asc)\n } else if (compare === 'desc') {\n return _partitionSelect(x, k, desc)\n } else {\n throw new Error('Compare string must be \"asc\" or \"desc\"')\n }\n },\n\n 'Array | Matrix, number, function': _partitionSelect\n })\n\n function _partitionSelect (x, k, compare) {\n if (!isInteger(k) || k < 0) {\n throw new Error('k must be a non-negative integer')\n }\n\n if (isMatrix(x)) {\n const size = x.size()\n if (size.length > 1) {\n throw new Error('Only one dimensional matrices supported')\n }\n return quickSelect(x.valueOf(), k, compare)\n }\n\n if (Array.isArray(x)) {\n return quickSelect(x, k, compare)\n }\n }\n\n /**\n * Quickselect algorithm.\n * Code adapted from:\n * https://blog.teamleadnet.com/2012/07/quick-select-algorithm-find-kth-element.html\n *\n * @param {Array} arr\n * @param {Number} k\n * @param {Function} compare\n * @private\n */\n function quickSelect (arr, k, compare) {\n if (k >= arr.length) {\n throw new Error('k out of bounds')\n }\n\n // check for NaN values since these can cause an infinite while loop\n for (let i = 0; i < arr.length; i++) {\n if (isNumeric(arr[i]) && mathIsNaN(arr[i])) {\n return arr[i] // return NaN\n }\n }\n\n let from = 0\n let to = arr.length - 1\n\n // if from == to we reached the kth element\n while (from < to) {\n let r = from\n let w = to\n const pivot = arr[Math.floor(Math.random() * (to - from + 1)) + from]\n\n // stop if the reader and writer meets\n while (r < w) {\n // arr[r] >= pivot\n if (compare(arr[r], pivot) >= 0) { // put the large values at the end\n const tmp = arr[w]\n arr[w] = arr[r]\n arr[r] = tmp\n --w\n } else { // the value is smaller than the pivot, skip\n ++r\n }\n }\n\n // if we stepped up (r++) we need to step one down (arr[r] > pivot)\n if (compare(arr[r], pivot) > 0) {\n --r\n }\n\n // the r pointer is on the end of the first k elements\n if (k <= r) {\n to = r\n } else {\n from = r + 1\n }\n }\n\n return arr[k]\n }\n})\n","import { arraySize as size } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'sort'\nconst dependencies = ['typed', 'matrix', 'compare', 'compareNatural']\n\nexport const createSort = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, compare, compareNatural }) => {\n const compareAsc = compare\n const compareDesc = (a, b) => -compare(a, b)\n\n /**\n * Sort the items in a matrix.\n *\n * Syntax:\n *\n * math.sort(x)\n * math.sort(x, compare)\n *\n * Examples:\n *\n * math.sort([5, 10, 1]) // returns [1, 5, 10]\n * math.sort(['C', 'B', 'A', 'D'], math.compareNatural)\n * // returns ['A', 'B', 'C', 'D']\n *\n * function sortByLength (a, b) {\n * return a.length - b.length\n * }\n * math.sort(['Langdon', 'Tom', 'Sara'], sortByLength)\n * // returns ['Tom', 'Sara', 'Langdon']\n *\n * See also:\n *\n * filter, forEach, map, compare, compareNatural\n *\n * @param {Matrix | Array} x A one dimensional matrix or array to sort\n * @param {Function | 'asc' | 'desc' | 'natural'} [compare='asc']\n * An optional _comparator function or name. The function is called as\n * `compare(a, b)`, and must return 1 when a > b, -1 when a < b,\n * and 0 when a == b.\n * @return {Matrix | Array} Returns the sorted matrix.\n */\n return typed(name, {\n Array: function (x) {\n _arrayIsVector(x)\n return x.sort(compareAsc)\n },\n\n Matrix: function (x) {\n _matrixIsVector(x)\n return matrix(x.toArray().sort(compareAsc), x.storage())\n },\n\n 'Array, function': function (x, _comparator) {\n _arrayIsVector(x)\n return x.sort(_comparator)\n },\n\n 'Matrix, function': function (x, _comparator) {\n _matrixIsVector(x)\n return matrix(x.toArray().sort(_comparator), x.storage())\n },\n\n 'Array, string': function (x, order) {\n _arrayIsVector(x)\n return x.sort(_comparator(order))\n },\n\n 'Matrix, string': function (x, order) {\n _matrixIsVector(x)\n return matrix(x.toArray().sort(_comparator(order)), x.storage())\n }\n })\n\n /**\n * Get the comparator for given order ('asc', 'desc', 'natural')\n * @param {'asc' | 'desc' | 'natural'} order\n * @return {Function} Returns a _comparator function\n */\n function _comparator (order) {\n if (order === 'asc') {\n return compareAsc\n } else if (order === 'desc') {\n return compareDesc\n } else if (order === 'natural') {\n return compareNatural\n } else {\n throw new Error('String \"asc\", \"desc\", or \"natural\" expected')\n }\n }\n\n /**\n * Validate whether an array is one dimensional\n * Throws an error when this is not the case\n * @param {Array} array\n * @private\n */\n function _arrayIsVector (array) {\n if (size(array).length !== 1) {\n throw new Error('One dimensional array expected')\n }\n }\n\n /**\n * Validate whether a matrix is one dimensional\n * Throws an error when this is not the case\n * @param {Matrix} matrix\n * @private\n */\n function _matrixIsVector (matrix) {\n if (matrix.size().length !== 1) {\n throw new Error('One dimensional matrix expected')\n }\n }\n})\n","import { deepForEach, reduce, containsCollections } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\nimport { safeNumberType } from '../../utils/number.js'\nimport { improveErrorMessage } from './utils/improveErrorMessage.js'\n\nconst name = 'max'\nconst dependencies = ['typed', 'config', 'numeric', 'larger', 'isNaN']\n\nexport const createMax = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, numeric, larger, isNaN: mathIsNaN }) => {\n /**\n * Compute the maximum value of a matrix or a list with values.\n * In case of a multidimensional array, the maximum of the flattened array\n * will be calculated. When `dim` is provided, the maximum over the selected\n * dimension will be calculated. Parameter `dim` is zero-based.\n *\n * Syntax:\n *\n * math.max(a, b, c, ...)\n * math.max(A)\n * math.max(A, dimension)\n *\n * Examples:\n *\n * math.max(2, 1, 4, 3) // returns 4\n * math.max([2, 1, 4, 3]) // returns 4\n *\n * // maximum over a specified dimension (zero-based)\n * math.max([[2, 5], [4, 3], [1, 7]], 0) // returns [4, 7]\n * math.max([[2, 5], [4, 3], [1, 7]], 1) // returns [5, 4, 7]\n *\n * math.max(2.7, 7.1, -4.5, 2.0, 4.1) // returns 7.1\n * math.min(2.7, 7.1, -4.5, 2.0, 4.1) // returns -4.5\n *\n * See also:\n *\n * mean, median, min, prod, std, sum, variance\n *\n * @param {... *} args A single matrix or or multiple scalar values\n * @return {*} The maximum value\n */\n return typed(name, {\n // max([a, b, c, d, ...])\n 'Array | Matrix': _max,\n\n // max([a, b, c, d, ...], dim)\n 'Array | Matrix, number | BigNumber': function (array, dim) {\n return reduce(array, dim.valueOf(), _largest)\n },\n\n // max(a, b, c, d, ...)\n '...': function (args) {\n if (containsCollections(args)) {\n throw new TypeError('Scalar values expected in function max')\n }\n\n return _max(args)\n }\n })\n\n /**\n * Return the largest of two values\n * @param {*} x\n * @param {*} y\n * @returns {*} Returns x when x is largest, or y when y is largest\n * @private\n */\n function _largest (x, y) {\n try {\n return larger(x, y) ? x : y\n } catch (err) {\n throw improveErrorMessage(err, 'max', y)\n }\n }\n\n /**\n * Recursively calculate the maximum value in an n-dimensional array\n * @param {Array} array\n * @return {number} max\n * @private\n */\n function _max (array) {\n let res\n\n deepForEach(array, function (value) {\n try {\n if (mathIsNaN(value)) {\n res = value\n } else if (res === undefined || larger(value, res)) {\n res = value\n }\n } catch (err) {\n throw improveErrorMessage(err, 'max', value)\n }\n })\n\n if (res === undefined) {\n throw new Error('Cannot calculate max of an empty array')\n }\n\n // make sure returning numeric value: parse a string into a numeric value\n if (typeof res === 'string') {\n res = numeric(res, safeNumberType(res, config))\n }\n\n return res\n }\n})\n","import { containsCollections, deepForEach, reduce } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\nimport { safeNumberType } from '../../utils/number.js'\nimport { improveErrorMessage } from './utils/improveErrorMessage.js'\n\nconst name = 'min'\nconst dependencies = ['typed', 'config', 'numeric', 'smaller', 'isNaN']\n\nexport const createMin = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, numeric, smaller, isNaN: mathIsNaN }) => {\n /**\n * Compute the minimum value of a matrix or a list of values.\n * In case of a multidimensional array, the minimum of the flattened array\n * will be calculated. When `dim` is provided, the minimum over the selected\n * dimension will be calculated. Parameter `dim` is zero-based.\n *\n * Syntax:\n *\n * math.min(a, b, c, ...)\n * math.min(A)\n * math.min(A, dimension)\n *\n * Examples:\n *\n * math.min(2, 1, 4, 3) // returns 1\n * math.min([2, 1, 4, 3]) // returns 1\n *\n * // minimum over a specified dimension (zero-based)\n * math.min([[2, 5], [4, 3], [1, 7]], 0) // returns [1, 3]\n * math.min([[2, 5], [4, 3], [1, 7]], 1) // returns [2, 3, 1]\n *\n * math.max(2.7, 7.1, -4.5, 2.0, 4.1) // returns 7.1\n * math.min(2.7, 7.1, -4.5, 2.0, 4.1) // returns -4.5\n *\n * See also:\n *\n * mean, median, max, prod, std, sum, variance\n *\n * @param {... *} args A single matrix or or multiple scalar values\n * @return {*} The minimum value\n */\n return typed(name, {\n // min([a, b, c, d, ...])\n 'Array | Matrix': _min,\n\n // min([a, b, c, d, ...], dim)\n 'Array | Matrix, number | BigNumber': function (array, dim) {\n return reduce(array, dim.valueOf(), _smallest)\n },\n\n // min(a, b, c, d, ...)\n '...': function (args) {\n if (containsCollections(args)) {\n throw new TypeError('Scalar values expected in function min')\n }\n\n return _min(args)\n }\n })\n\n /**\n * Return the smallest of two values\n * @param {*} x\n * @param {*} y\n * @returns {*} Returns x when x is smallest, or y when y is smallest\n * @private\n */\n function _smallest (x, y) {\n try {\n return smaller(x, y) ? x : y\n } catch (err) {\n throw improveErrorMessage(err, 'min', y)\n }\n }\n\n /**\n * Recursively calculate the minimum value in an n-dimensional array\n * @param {Array} array\n * @return {number} min\n * @private\n */\n function _min (array) {\n let min\n\n deepForEach(array, function (value) {\n try {\n if (mathIsNaN(value)) {\n min = value\n } else if (min === undefined || smaller(value, min)) {\n min = value\n }\n } catch (err) {\n throw improveErrorMessage(err, 'min', value)\n }\n })\n\n if (min === undefined) {\n throw new Error('Cannot calculate min of an empty array')\n }\n\n // make sure returning numeric value: parse a string into a numeric value\n if (typeof min === 'string') {\n min = numeric(min, safeNumberType(min, config))\n }\n\n return min\n }\n})\n","import { isArray, isMatrix, isString, typeOf } from '../../utils/is.js'\nimport { clone } from '../../utils/object.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'ImmutableDenseMatrix'\nconst dependencies = [\n 'smaller',\n 'DenseMatrix'\n]\n\nexport const createImmutableDenseMatrixClass = /* #__PURE__ */ factory(name, dependencies, ({ smaller, DenseMatrix }) => {\n function ImmutableDenseMatrix (data, datatype) {\n if (!(this instanceof ImmutableDenseMatrix)) { throw new SyntaxError('Constructor must be called with the new operator') }\n if (datatype && !isString(datatype)) { throw new Error('Invalid datatype: ' + datatype) }\n\n if (isMatrix(data) || isArray(data)) {\n // use DenseMatrix implementation\n const matrix = new DenseMatrix(data, datatype)\n // internal structures\n this._data = matrix._data\n this._size = matrix._size\n this._datatype = matrix._datatype\n this._min = null\n this._max = null\n } else if (data && isArray(data.data) && isArray(data.size)) {\n // initialize fields from JSON representation\n this._data = data.data\n this._size = data.size\n this._datatype = data.datatype\n this._min = typeof data.min !== 'undefined' ? data.min : null\n this._max = typeof data.max !== 'undefined' ? data.max : null\n } else if (data) {\n // unsupported type\n throw new TypeError('Unsupported type of data (' + typeOf(data) + ')')\n } else {\n // nothing provided\n this._data = []\n this._size = [0]\n this._datatype = datatype\n this._min = null\n this._max = null\n }\n }\n\n ImmutableDenseMatrix.prototype = new DenseMatrix()\n\n /**\n * Attach type information\n */\n ImmutableDenseMatrix.prototype.type = 'ImmutableDenseMatrix'\n ImmutableDenseMatrix.prototype.isImmutableDenseMatrix = true\n\n /**\n * Get a subset of the matrix, or replace a subset of the matrix.\n *\n * Usage:\n * const subset = matrix.subset(index) // retrieve subset\n * const value = matrix.subset(index, replacement) // replace subset\n *\n * @param {Index} index\n * @param {Array | ImmutableDenseMatrix | *} [replacement]\n * @param {*} [defaultValue=0] Default value, filled in on new entries when\n * the matrix is resized. If not provided,\n * new matrix elements will be filled with zeros.\n */\n ImmutableDenseMatrix.prototype.subset = function (index) {\n switch (arguments.length) {\n case 1:\n {\n // use base implementation\n const m = DenseMatrix.prototype.subset.call(this, index)\n // check result is a matrix\n if (isMatrix(m)) {\n // return immutable matrix\n return new ImmutableDenseMatrix({\n data: m._data,\n size: m._size,\n datatype: m._datatype\n })\n }\n return m\n }\n // intentional fall through\n case 2:\n case 3:\n throw new Error('Cannot invoke set subset on an Immutable Matrix instance')\n\n default:\n throw new SyntaxError('Wrong number of arguments')\n }\n }\n\n /**\n * Replace a single element in the matrix.\n * @param {Number[]} index Zero-based index\n * @param {*} value\n * @param {*} [defaultValue] Default value, filled in on new entries when\n * the matrix is resized. If not provided,\n * new matrix elements will be left undefined.\n * @return {ImmutableDenseMatrix} self\n */\n ImmutableDenseMatrix.prototype.set = function () {\n throw new Error('Cannot invoke set on an Immutable Matrix instance')\n }\n\n /**\n * Resize the matrix to the given size. Returns a copy of the matrix when\n * `copy=true`, otherwise return the matrix itself (resize in place).\n *\n * @param {Number[]} size The new size the matrix should have.\n * @param {*} [defaultValue=0] Default value, filled in on new entries.\n * If not provided, the matrix elements will\n * be filled with zeros.\n * @param {boolean} [copy] Return a resized copy of the matrix\n *\n * @return {Matrix} The resized matrix\n */\n ImmutableDenseMatrix.prototype.resize = function () {\n throw new Error('Cannot invoke resize on an Immutable Matrix instance')\n }\n\n /**\n * Disallows reshaping in favor of immutability.\n *\n * @throws {Error} Operation not allowed\n */\n ImmutableDenseMatrix.prototype.reshape = function () {\n throw new Error('Cannot invoke reshape on an Immutable Matrix instance')\n }\n\n /**\n * Create a clone of the matrix\n * @return {ImmutableDenseMatrix} clone\n */\n ImmutableDenseMatrix.prototype.clone = function () {\n return new ImmutableDenseMatrix({\n data: clone(this._data),\n size: clone(this._size),\n datatype: this._datatype\n })\n }\n\n /**\n * Get a JSON representation of the matrix\n * @returns {Object}\n */\n ImmutableDenseMatrix.prototype.toJSON = function () {\n return {\n mathjs: 'ImmutableDenseMatrix',\n data: this._data,\n size: this._size,\n datatype: this._datatype\n }\n }\n\n /**\n * Generate a matrix from a JSON object\n * @param {Object} json An object structured like\n * `{\"mathjs\": \"ImmutableDenseMatrix\", data: [], size: []}`,\n * where mathjs is optional\n * @returns {ImmutableDenseMatrix}\n */\n ImmutableDenseMatrix.fromJSON = function (json) {\n return new ImmutableDenseMatrix(json)\n }\n\n /**\n * Swap rows i and j in Matrix.\n *\n * @param {Number} i Matrix row index 1\n * @param {Number} j Matrix row index 2\n *\n * @return {Matrix} The matrix reference\n */\n ImmutableDenseMatrix.prototype.swapRows = function () {\n throw new Error('Cannot invoke swapRows on an Immutable Matrix instance')\n }\n\n /**\n * Calculate the minimum value in the set\n * @return {Number | undefined} min\n */\n ImmutableDenseMatrix.prototype.min = function () {\n // check min has been calculated before\n if (this._min === null) {\n // minimum\n let m = null\n // compute min\n this.forEach(function (v) {\n if (m === null || smaller(v, m)) { m = v }\n })\n this._min = m !== null ? m : undefined\n }\n return this._min\n }\n\n /**\n * Calculate the maximum value in the set\n * @return {Number | undefined} max\n */\n ImmutableDenseMatrix.prototype.max = function () {\n // check max has been calculated before\n if (this._max === null) {\n // maximum\n let m = null\n // compute max\n this.forEach(function (v) {\n if (m === null || smaller(m, v)) { m = v }\n })\n this._max = m !== null ? m : undefined\n }\n return this._max\n }\n\n return ImmutableDenseMatrix\n}, { isClass: true })\n","import { isArray, isMatrix, isRange } from '../../utils/is.js'\nimport { clone } from '../../utils/object.js'\nimport { isInteger } from '../../utils/number.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'Index'\nconst dependencies = ['ImmutableDenseMatrix', 'getMatrixDataType']\n\nexport const createIndexClass = /* #__PURE__ */ factory(name, dependencies, ({ ImmutableDenseMatrix, getMatrixDataType }) => {\n /**\n * Create an index. An Index can store ranges and sets for multiple dimensions.\n * Matrix.get, Matrix.set, and math.subset accept an Index as input.\n *\n * Usage:\n * const index = new Index(range1, range2, matrix1, array1, ...)\n *\n * Where each parameter can be any of:\n * A number\n * A string (containing a name of an object property)\n * An instance of Range\n * An Array with the Set values\n * An Array with Booleans\n * A Matrix with the Set values\n * A Matrix with Booleans\n *\n * The parameters start, end, and step must be integer numbers.\n *\n * @class Index\n * @Constructor Index\n * @param {...*} ranges\n */\n function Index (ranges) {\n if (!(this instanceof Index)) {\n throw new SyntaxError('Constructor must be called with the new operator')\n }\n\n this._dimensions = []\n this._sourceSize = []\n this._isScalar = true\n\n for (let i = 0, ii = arguments.length; i < ii; i++) {\n const arg = arguments[i]\n const argIsArray = isArray(arg)\n const argIsMatrix = isMatrix(arg)\n const argType = typeof arg\n let sourceSize = null\n if (isRange(arg)) {\n this._dimensions.push(arg)\n this._isScalar = false\n } else if (argIsArray || argIsMatrix) {\n // create matrix\n let m\n\n if (getMatrixDataType(arg) === 'boolean') {\n if (argIsArray) m = _createImmutableMatrix(_booleansArrayToNumbersForIndex(arg).valueOf())\n if (argIsMatrix) m = _createImmutableMatrix(_booleansArrayToNumbersForIndex(arg._data).valueOf())\n sourceSize = arg.valueOf().length\n } else {\n m = _createImmutableMatrix(arg.valueOf())\n }\n\n this._dimensions.push(m)\n // size\n const size = m.size()\n // scalar\n if (size.length !== 1 || size[0] !== 1 || sourceSize !== null) {\n this._isScalar = false\n }\n } else if (argType === 'number') {\n this._dimensions.push(_createImmutableMatrix([arg]))\n } else if (argType === 'bigint') {\n this._dimensions.push(_createImmutableMatrix([Number(arg)]))\n } else if (argType === 'string') {\n // object property (arguments.count should be 1)\n this._dimensions.push(arg)\n } else {\n throw new TypeError('Dimension must be an Array, Matrix, number, bigint, string, or Range')\n }\n this._sourceSize.push(sourceSize)\n // TODO: implement support for wildcard '*'\n }\n }\n\n /**\n * Attach type information\n */\n Index.prototype.type = 'Index'\n Index.prototype.isIndex = true\n\n function _createImmutableMatrix (arg) {\n // loop array elements\n for (let i = 0, l = arg.length; i < l; i++) {\n if (typeof arg[i] !== 'number' || !isInteger(arg[i])) {\n throw new TypeError('Index parameters must be positive integer numbers')\n }\n }\n // create matrix\n return new ImmutableDenseMatrix(arg)\n }\n\n /**\n * Create a clone of the index\n * @memberof Index\n * @return {Index} clone\n */\n Index.prototype.clone = function () {\n const index = new Index()\n index._dimensions = clone(this._dimensions)\n index._isScalar = this._isScalar\n index._sourceSize = this._sourceSize\n return index\n }\n\n /**\n * Create an index from an array with ranges/numbers\n * @memberof Index\n * @param {Array.} ranges\n * @return {Index} index\n * @private\n */\n Index.create = function (ranges) {\n const index = new Index()\n Index.apply(index, ranges)\n return index\n }\n\n /**\n * Retrieve the size of the index, the number of elements for each dimension.\n * @memberof Index\n * @returns {number[]} size\n */\n Index.prototype.size = function () {\n const size = []\n\n for (let i = 0, ii = this._dimensions.length; i < ii; i++) {\n const d = this._dimensions[i]\n size[i] = (typeof d === 'string') ? 1 : d.size()[0]\n }\n\n return size\n }\n\n /**\n * Get the maximum value for each of the indexes ranges.\n * @memberof Index\n * @returns {number[]} max\n */\n Index.prototype.max = function () {\n const values = []\n\n for (let i = 0, ii = this._dimensions.length; i < ii; i++) {\n const range = this._dimensions[i]\n values[i] = (typeof range === 'string') ? range : range.max()\n }\n\n return values\n }\n\n /**\n * Get the minimum value for each of the indexes ranges.\n * @memberof Index\n * @returns {number[]} min\n */\n Index.prototype.min = function () {\n const values = []\n\n for (let i = 0, ii = this._dimensions.length; i < ii; i++) {\n const range = this._dimensions[i]\n values[i] = (typeof range === 'string') ? range : range.min()\n }\n\n return values\n }\n\n /**\n * Loop over each of the ranges of the index\n * @memberof Index\n * @param {Function} callback Called for each range with a Range as first\n * argument, the dimension as second, and the\n * index object as third.\n */\n Index.prototype.forEach = function (callback) {\n for (let i = 0, ii = this._dimensions.length; i < ii; i++) {\n callback(this._dimensions[i], i, this)\n }\n }\n\n /**\n * Retrieve the dimension for the given index\n * @memberof Index\n * @param {Number} dim Number of the dimension\n * @returns {Range | null} range\n */\n Index.prototype.dimension = function (dim) {\n if (typeof dim !== 'number') {\n return null\n }\n\n return this._dimensions[dim] || null\n }\n\n /**\n * Test whether this index contains an object property\n * @returns {boolean} Returns true if the index is an object property\n */\n Index.prototype.isObjectProperty = function () {\n return this._dimensions.length === 1 && typeof this._dimensions[0] === 'string'\n }\n\n /**\n * Returns the object property name when the Index holds a single object property,\n * else returns null\n * @returns {string | null}\n */\n Index.prototype.getObjectProperty = function () {\n return this.isObjectProperty() ? this._dimensions[0] : null\n }\n\n /**\n * Test whether this index contains only a single value.\n *\n * This is the case when the index is created with only scalar values as ranges,\n * not for ranges resolving into a single value.\n * @memberof Index\n * @return {boolean} isScalar\n */\n Index.prototype.isScalar = function () {\n return this._isScalar\n }\n\n /**\n * Expand the Index into an array.\n * For example new Index([0,3], [2,7]) returns [[0,1,2], [2,3,4,5,6]]\n * @memberof Index\n * @returns {Array} array\n */\n Index.prototype.toArray = function () {\n const array = []\n for (let i = 0, ii = this._dimensions.length; i < ii; i++) {\n const dimension = this._dimensions[i]\n array.push((typeof dimension === 'string') ? dimension : dimension.toArray())\n }\n return array\n }\n\n /**\n * Get the primitive value of the Index, a two dimensional array.\n * Equivalent to Index.toArray().\n * @memberof Index\n * @returns {Array} array\n */\n Index.prototype.valueOf = Index.prototype.toArray\n\n /**\n * Get the string representation of the index, for example '[2:6]' or '[0:2:10, 4:7, [1,2,3]]'\n * @memberof Index\n * @returns {String} str\n */\n Index.prototype.toString = function () {\n const strings = []\n\n for (let i = 0, ii = this._dimensions.length; i < ii; i++) {\n const dimension = this._dimensions[i]\n if (typeof dimension === 'string') {\n strings.push(JSON.stringify(dimension))\n } else {\n strings.push(dimension.toString())\n }\n }\n\n return '[' + strings.join(', ') + ']'\n }\n\n /**\n * Get a JSON representation of the Index\n * @memberof Index\n * @returns {Object} Returns a JSON object structured as:\n * `{\"mathjs\": \"Index\", \"ranges\": [{\"mathjs\": \"Range\", start: 0, end: 10, step:1}, ...]}`\n */\n Index.prototype.toJSON = function () {\n return {\n mathjs: 'Index',\n dimensions: this._dimensions\n }\n }\n\n /**\n * Instantiate an Index from a JSON object\n * @memberof Index\n * @param {Object} json A JSON object structured as:\n * `{\"mathjs\": \"Index\", \"dimensions\": [{\"mathjs\": \"Range\", start: 0, end: 10, step:1}, ...]}`\n * @return {Index}\n */\n Index.fromJSON = function (json) {\n return Index.create(json.dimensions)\n }\n\n return Index\n}, { isClass: true })\n\n/**\n * Receives an array of booleans and returns an array of Numbers for Index\n * @param {Array} booleanArrayIndex An array of booleans\n * @return {Array} A set of numbers ready for index\n */\nfunction _booleansArrayToNumbersForIndex (booleanArrayIndex) {\n // gets an array of booleans and returns an array of numbers\n const indexOfNumbers = []\n booleanArrayIndex.forEach((bool, idx) => {\n if (bool) {\n indexOfNumbers.push(idx)\n }\n })\n return indexOfNumbers\n}\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'FibonacciHeap'\nconst dependencies = ['smaller', 'larger']\n\nexport const createFibonacciHeapClass = /* #__PURE__ */ factory(name, dependencies, ({ smaller, larger }) => {\n const oneOverLogPhi = 1.0 / Math.log((1.0 + Math.sqrt(5.0)) / 2.0)\n\n /**\n * Fibonacci Heap implementation, used interally for Matrix math.\n * @class FibonacciHeap\n * @constructor FibonacciHeap\n */\n function FibonacciHeap () {\n if (!(this instanceof FibonacciHeap)) { throw new SyntaxError('Constructor must be called with the new operator') }\n\n // initialize fields\n this._minimum = null\n this._size = 0\n }\n\n /**\n * Attach type information\n */\n FibonacciHeap.prototype.type = 'FibonacciHeap'\n FibonacciHeap.prototype.isFibonacciHeap = true\n\n /**\n * Inserts a new data element into the heap. No heap consolidation is\n * performed at this time, the new node is simply inserted into the root\n * list of this heap. Running time: O(1) actual.\n * @memberof FibonacciHeap\n */\n FibonacciHeap.prototype.insert = function (key, value) {\n // create node\n const node = {\n key,\n value,\n degree: 0\n }\n // check we have a node in the minimum\n if (this._minimum) {\n // minimum node\n const minimum = this._minimum\n // update left & right of node\n node.left = minimum\n node.right = minimum.right\n minimum.right = node\n node.right.left = node\n // update minimum node in heap if needed\n if (smaller(key, minimum.key)) {\n // node has a smaller key, use it as minimum\n this._minimum = node\n }\n } else {\n // set left & right\n node.left = node\n node.right = node\n // this is the first node\n this._minimum = node\n }\n // increment number of nodes in heap\n this._size++\n // return node\n return node\n }\n\n /**\n * Returns the number of nodes in heap. Running time: O(1) actual.\n * @memberof FibonacciHeap\n */\n FibonacciHeap.prototype.size = function () {\n return this._size\n }\n\n /**\n * Removes all elements from this heap.\n * @memberof FibonacciHeap\n */\n FibonacciHeap.prototype.clear = function () {\n this._minimum = null\n this._size = 0\n }\n\n /**\n * Returns true if the heap is empty, otherwise false.\n * @memberof FibonacciHeap\n */\n FibonacciHeap.prototype.isEmpty = function () {\n return this._size === 0\n }\n\n /**\n * Extracts the node with minimum key from heap. Amortized running\n * time: O(log n).\n * @memberof FibonacciHeap\n */\n FibonacciHeap.prototype.extractMinimum = function () {\n // node to remove\n const node = this._minimum\n // check we have a minimum\n if (node === null) { return node }\n // current minimum\n let minimum = this._minimum\n // get number of children\n let numberOfChildren = node.degree\n // pointer to the first child\n let x = node.child\n // for each child of node do...\n while (numberOfChildren > 0) {\n // store node in right side\n const tempRight = x.right\n // remove x from child list\n x.left.right = x.right\n x.right.left = x.left\n // add x to root list of heap\n x.left = minimum\n x.right = minimum.right\n minimum.right = x\n x.right.left = x\n // set Parent[x] to null\n x.parent = null\n x = tempRight\n numberOfChildren--\n }\n // remove node from root list of heap\n node.left.right = node.right\n node.right.left = node.left\n // update minimum\n if (node === node.right) {\n // empty\n minimum = null\n } else {\n // update minimum\n minimum = node.right\n // we need to update the pointer to the root with minimum key\n minimum = _findMinimumNode(minimum, this._size)\n }\n // decrement size of heap\n this._size--\n // update minimum\n this._minimum = minimum\n // return node\n return node\n }\n\n /**\n * Removes a node from the heap given the reference to the node. The trees\n * in the heap will be consolidated, if necessary. This operation may fail\n * to remove the correct element if there are nodes with key value -Infinity.\n * Running time: O(log n) amortized.\n * @memberof FibonacciHeap\n */\n FibonacciHeap.prototype.remove = function (node) {\n // decrease key value\n this._minimum = _decreaseKey(this._minimum, node, -1)\n // remove the smallest\n this.extractMinimum()\n }\n\n /**\n * Decreases the key value for a heap node, given the new value to take on.\n * The structure of the heap may be changed and will not be consolidated.\n * Running time: O(1) amortized.\n * @memberof FibonacciHeap\n */\n function _decreaseKey (minimum, node, key) {\n // set node key\n node.key = key\n // get parent node\n const parent = node.parent\n if (parent && smaller(node.key, parent.key)) {\n // remove node from parent\n _cut(minimum, node, parent)\n // remove all nodes from parent to the root parent\n _cascadingCut(minimum, parent)\n }\n // update minimum node if needed\n if (smaller(node.key, minimum.key)) { minimum = node }\n // return minimum\n return minimum\n }\n\n /**\n * The reverse of the link operation: removes node from the child list of parent.\n * This method assumes that min is non-null. Running time: O(1).\n * @memberof FibonacciHeap\n */\n function _cut (minimum, node, parent) {\n // remove node from parent children and decrement Degree[parent]\n node.left.right = node.right\n node.right.left = node.left\n parent.degree--\n // reset y.child if necessary\n if (parent.child === node) { parent.child = node.right }\n // remove child if degree is 0\n if (parent.degree === 0) { parent.child = null }\n // add node to root list of heap\n node.left = minimum\n node.right = minimum.right\n minimum.right = node\n node.right.left = node\n // set parent[node] to null\n node.parent = null\n // set mark[node] to false\n node.mark = false\n }\n\n /**\n * Performs a cascading cut operation. This cuts node from its parent and then\n * does the same for its parent, and so on up the tree.\n * Running time: O(log n); O(1) excluding the recursion.\n * @memberof FibonacciHeap\n */\n function _cascadingCut (minimum, node) {\n // store parent node\n const parent = node.parent\n // if there's a parent...\n if (!parent) { return }\n // if node is unmarked, set it marked\n if (!node.mark) {\n node.mark = true\n } else {\n // it's marked, cut it from parent\n _cut(minimum, node, parent)\n // cut its parent as well\n _cascadingCut(parent)\n }\n }\n\n /**\n * Make the first node a child of the second one. Running time: O(1) actual.\n * @memberof FibonacciHeap\n */\n const _linkNodes = function (node, parent) {\n // remove node from root list of heap\n node.left.right = node.right\n node.right.left = node.left\n // make node a Child of parent\n node.parent = parent\n if (!parent.child) {\n parent.child = node\n node.right = node\n node.left = node\n } else {\n node.left = parent.child\n node.right = parent.child.right\n parent.child.right = node\n node.right.left = node\n }\n // increase degree[parent]\n parent.degree++\n // set mark[node] false\n node.mark = false\n }\n\n function _findMinimumNode (minimum, size) {\n // to find trees of the same degree efficiently we use an array of length O(log n) in which we keep a pointer to one root of each degree\n const arraySize = Math.floor(Math.log(size) * oneOverLogPhi) + 1\n // create list with initial capacity\n const array = new Array(arraySize)\n // find the number of root nodes.\n let numRoots = 0\n let x = minimum\n if (x) {\n numRoots++\n x = x.right\n while (x !== minimum) {\n numRoots++\n x = x.right\n }\n }\n // vars\n let y\n // For each node in root list do...\n while (numRoots > 0) {\n // access this node's degree..\n let d = x.degree\n // get next node\n const next = x.right\n // check if there is a node already in array with the same degree\n while (true) {\n // get node with the same degree is any\n y = array[d]\n if (!y) { break }\n // make one node with the same degree a child of the other, do this based on the key value.\n if (larger(x.key, y.key)) {\n const temp = y\n y = x\n x = temp\n }\n // make y a child of x\n _linkNodes(y, x)\n // we have handled this degree, go to next one.\n array[d] = null\n d++\n }\n // save this node for later when we might encounter another of the same degree.\n array[d] = x\n // move forward through list.\n x = next\n numRoots--\n }\n // Set min to null (effectively losing the root list) and reconstruct the root list from the array entries in array[].\n minimum = null\n // loop nodes in array\n for (let i = 0; i < arraySize; i++) {\n // get current node\n y = array[i]\n if (!y) { continue }\n // check if we have a linked list\n if (minimum) {\n // First remove node from root list.\n y.left.right = y.right\n y.right.left = y.left\n // now add to root list, again.\n y.left = minimum\n y.right = minimum.right\n minimum.right = y\n y.right.left = y\n // check if this is a new min.\n if (smaller(y.key, minimum.key)) { minimum = y }\n } else { minimum = y }\n }\n return minimum\n }\n\n return FibonacciHeap\n}, { isClass: true })\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'Spa'\nconst dependencies = ['addScalar', 'equalScalar', 'FibonacciHeap']\n\nexport const createSpaClass = /* #__PURE__ */ factory(name, dependencies, ({ addScalar, equalScalar, FibonacciHeap }) => {\n /**\n * An ordered Sparse Accumulator is a representation for a sparse vector that includes a dense array\n * of the vector elements and an ordered list of non-zero elements.\n */\n function Spa () {\n if (!(this instanceof Spa)) { throw new SyntaxError('Constructor must be called with the new operator') }\n\n // allocate vector, TODO use typed arrays\n this._values = []\n this._heap = new FibonacciHeap()\n }\n\n /**\n * Attach type information\n */\n Spa.prototype.type = 'Spa'\n Spa.prototype.isSpa = true\n\n /**\n * Set the value for index i.\n *\n * @param {number} i The index\n * @param {number | BigNumber | Complex} The value at index i\n */\n Spa.prototype.set = function (i, v) {\n // check we have a value @ i\n if (!this._values[i]) {\n // insert in heap\n const node = this._heap.insert(i, v)\n // set the value @ i\n this._values[i] = node\n } else {\n // update the value @ i\n this._values[i].value = v\n }\n }\n\n Spa.prototype.get = function (i) {\n const node = this._values[i]\n if (node) { return node.value }\n return 0\n }\n\n Spa.prototype.accumulate = function (i, v) {\n // node @ i\n let node = this._values[i]\n if (!node) {\n // insert in heap\n node = this._heap.insert(i, v)\n // initialize value\n this._values[i] = node\n } else {\n // accumulate value\n node.value = addScalar(node.value, v)\n }\n }\n\n Spa.prototype.forEach = function (from, to, callback) {\n // references\n const heap = this._heap\n const values = this._values\n // nodes\n const nodes = []\n // node with minimum key, save it\n let node = heap.extractMinimum()\n if (node) { nodes.push(node) }\n // extract nodes from heap (ordered)\n while (node && node.key <= to) {\n // check it is in range\n if (node.key >= from) {\n // check value is not zero\n if (!equalScalar(node.value, 0)) {\n // invoke callback\n callback(node.key, node.value, this)\n }\n }\n // extract next node, save it\n node = heap.extractMinimum()\n if (node) { nodes.push(node) }\n }\n // reinsert all nodes in heap\n for (let i = 0; i < nodes.length; i++) {\n // current node\n const n = nodes[i]\n // insert node in heap\n node = heap.insert(n.key, n.value)\n // update values\n values[node.key] = node\n }\n }\n\n Spa.prototype.swap = function (i, j) {\n // node @ i and j\n let nodei = this._values[i]\n let nodej = this._values[j]\n // check we need to insert indeces\n if (!nodei && nodej) {\n // insert in heap\n nodei = this._heap.insert(i, nodej.value)\n // remove from heap\n this._heap.remove(nodej)\n // set values\n this._values[i] = nodei\n this._values[j] = undefined\n } else if (nodei && !nodej) {\n // insert in heap\n nodej = this._heap.insert(j, nodei.value)\n // remove from heap\n this._heap.remove(nodei)\n // set values\n this._values[j] = nodej\n this._values[i] = undefined\n } else if (nodei && nodej) {\n // swap values\n const v = nodei.value\n nodei.value = nodej.value\n nodej.value = v\n }\n }\n\n return Spa\n}, { isClass: true })\n","// (c) 2018, Mariusz Nowak\n// SPDX-License-Identifier: ISC\n// Derived from https://github.com/medikoo/lru-queue\nexport function lruQueue (limit) {\n let size = 0\n let base = 1\n let queue = Object.create(null)\n let map = Object.create(null)\n let index = 0\n const del = function (id) {\n const oldIndex = map[id]\n if (!oldIndex) return\n delete queue[oldIndex]\n delete map[id]\n --size\n if (base !== oldIndex) return\n if (!size) {\n index = 0\n base = 1\n return\n }\n while (!Object.prototype.hasOwnProperty.call(queue, ++base)) { /* empty */ }\n }\n limit = Math.abs(limit)\n return {\n hit: function (id) {\n const oldIndex = map[id]; const nuIndex = ++index\n queue[nuIndex] = id\n map[id] = nuIndex\n if (!oldIndex) {\n ++size\n if (size <= limit) return undefined\n id = queue[base]\n del(id)\n return id\n }\n delete queue[oldIndex]\n if (base !== oldIndex) return undefined\n while (!Object.prototype.hasOwnProperty.call(queue, ++base)) { /* empty */ }\n return undefined\n },\n delete: del,\n clear: function () {\n size = index = 0\n base = 1\n queue = Object.create(null)\n map = Object.create(null)\n }\n }\n}\n","// function utils\n\nimport { lruQueue } from './lruQueue.js'\n\n/**\n * Memoize a given function by caching the computed result.\n * The cache of a memoized function can be cleared by deleting the `cache`\n * property of the function.\n *\n * @param {function} fn The function to be memoized.\n * Must be a pure function.\n * @param {Object} [options]\n * @param {function(args: Array): string} [options.hasher]\n * A custom hash builder. Is JSON.stringify by default.\n * @param {number | undefined} [options.limit]\n * Maximum number of values that may be cached. Undefined indicates\n * unlimited (default)\n * @return {function} Returns the memoized function\n */\nexport function memoize (fn, { hasher, limit } = {}) {\n limit = limit == null ? Number.POSITIVE_INFINITY : limit\n hasher = hasher == null ? JSON.stringify : hasher\n\n return function memoize () {\n if (typeof memoize.cache !== 'object') {\n memoize.cache = {\n values: new Map(),\n lru: lruQueue(limit || Number.POSITIVE_INFINITY)\n }\n }\n const args = []\n for (let i = 0; i < arguments.length; i++) {\n args[i] = arguments[i]\n }\n const hash = hasher(args)\n\n if (memoize.cache.values.has(hash)) {\n memoize.cache.lru.hit(hash)\n return memoize.cache.values.get(hash)\n }\n\n const newVal = fn.apply(fn, args)\n memoize.cache.values.set(hash, newVal)\n memoize.cache.values.delete(memoize.cache.lru.hit(hash))\n\n return newVal\n }\n}\n\n/**\n * Memoize a given function by caching all results and the arguments,\n * and comparing against the arguments of previous results before\n * executing again.\n * This is less performant than `memoize` which calculates a hash,\n * which is very fast to compare. Use `memoizeCompare` only when it is\n * not possible to create a unique serializable hash from the function\n * arguments.\n * The isEqual function must compare two sets of arguments\n * and return true when equal (can be a deep equality check for example).\n * @param {function} fn\n * @param {function(a: *, b: *) : boolean} isEqual\n * @returns {function}\n */\nexport function memoizeCompare (fn, isEqual) {\n const memoize = function memoize () {\n const args = []\n for (let i = 0; i < arguments.length; i++) {\n args[i] = arguments[i]\n }\n\n for (let c = 0; c < memoize.cache.length; c++) {\n const cached = memoize.cache[c]\n\n if (isEqual(args, cached.args)) {\n // TODO: move this cache entry to the top so recently used entries move up?\n return cached.res\n }\n }\n\n const res = fn.apply(fn, args)\n memoize.cache.unshift({ args, res })\n\n return res\n }\n\n memoize.cache = []\n\n return memoize\n}\n","import { memoize } from '../function.js'\n\n/**\n * Calculate BigNumber e\n * @param {function} BigNumber BigNumber constructor\n * @returns {BigNumber} Returns e\n */\nexport const createBigNumberE = memoize(function (BigNumber) {\n return new BigNumber(1).exp()\n}, { hasher })\n\n/**\n * Calculate BigNumber golden ratio, phi = (1+sqrt(5))/2\n * @param {function} BigNumber BigNumber constructor\n * @returns {BigNumber} Returns phi\n */\nexport const createBigNumberPhi = memoize(function (BigNumber) {\n return new BigNumber(1).plus(new BigNumber(5).sqrt()).div(2)\n}, { hasher })\n\n/**\n * Calculate BigNumber pi.\n * @param {function} BigNumber BigNumber constructor\n * @returns {BigNumber} Returns pi\n */\nexport const createBigNumberPi = memoize(function (BigNumber) {\n return BigNumber.acos(-1)\n}, { hasher })\n\n/**\n * Calculate BigNumber tau, tau = 2 * pi\n * @param {function} BigNumber BigNumber constructor\n * @returns {BigNumber} Returns tau\n */\nexport const createBigNumberTau = memoize(function (BigNumber) {\n return createBigNumberPi(BigNumber).times(2)\n}, { hasher })\n\n/**\n * Create a hash for a BigNumber constructor function. The created has is\n * the configured precision\n * @param {Array} args Supposed to contain a single entry with\n * a BigNumber constructor\n * @return {number} precision\n * @private\n */\nfunction hasher (args) {\n return args[0].precision\n}\n","import { isComplex, isUnit, typeOf } from '../../utils/is.js'\nimport { factory } from '../../utils/factory.js'\nimport { memoize } from '../../utils/function.js'\nimport { endsWith } from '../../utils/string.js'\nimport { clone, hasOwnProperty } from '../../utils/object.js'\nimport { createBigNumberPi as createPi } from '../../utils/bignumber/constants.js'\n\nconst name = 'Unit'\nconst dependencies = [\n '?on',\n 'config',\n 'addScalar',\n 'subtractScalar',\n 'multiplyScalar',\n 'divideScalar',\n 'pow',\n 'abs',\n 'fix',\n 'round',\n 'equal',\n 'isNumeric',\n 'format',\n 'number',\n 'Complex',\n 'BigNumber',\n 'Fraction'\n]\n\nexport const createUnitClass = /* #__PURE__ */ factory(name, dependencies, ({\n on,\n config,\n addScalar,\n subtractScalar,\n multiplyScalar,\n divideScalar,\n pow,\n abs,\n fix,\n round,\n equal,\n isNumeric,\n format,\n number,\n Complex,\n BigNumber,\n Fraction\n}) => {\n const toNumber = number\n /**\n * A unit can be constructed in the following ways:\n *\n * const a = new Unit(value, valuelessUnit)\n * const b = new Unit(null, valuelessUnit)\n * const c = Unit.parse(str)\n *\n * Example usage:\n *\n * const a = new Unit(5, 'cm') // 50 mm\n * const b = Unit.parse('23 kg') // 23 kg\n * const c = math.in(a, new Unit(null, 'm') // 0.05 m\n * const d = new Unit(9.81, \"m/s^2\") // 9.81 m/s^2\n *\n * @class Unit\n * @constructor Unit\n * @param {number | BigNumber | Fraction | Complex | boolean} [value] A value like 5.2\n * @param {string | Unit} valuelessUnit A unit without value. Can have prefix, like \"cm\"\n */\n function Unit (value, valuelessUnit) {\n if (!(this instanceof Unit)) {\n throw new Error('Constructor must be called with the new operator')\n }\n\n if (!(value === null || value === undefined || isNumeric(value) || isComplex(value))) {\n throw new TypeError('First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined')\n }\n\n this.fixPrefix = false // if true, function format will not search for the\n // best prefix but leave it as initially provided.\n // fixPrefix is set true by the method Unit.to\n\n // The justification behind this is that if the constructor is explicitly called,\n // the caller wishes the units to be returned exactly as supplied.\n this.skipAutomaticSimplification = true\n\n if (valuelessUnit === undefined) {\n this.units = []\n this.dimensions = BASE_DIMENSIONS.map(x => 0)\n } else if (typeof valuelessUnit === 'string') {\n const u = Unit.parse(valuelessUnit)\n this.units = u.units\n this.dimensions = u.dimensions\n } else if (isUnit(valuelessUnit) && valuelessUnit.value === null) {\n // clone from valuelessUnit\n this.fixPrefix = valuelessUnit.fixPrefix\n this.skipAutomaticSimplification = valuelessUnit.skipAutomaticSimplification\n this.dimensions = valuelessUnit.dimensions.slice(0)\n this.units = valuelessUnit.units.map(u => Object.assign({}, u))\n } else {\n throw new TypeError('Second parameter in Unit constructor must be a string or valueless Unit')\n }\n\n this.value = this._normalize(value)\n }\n\n /**\n * Attach type information\n */\n Object.defineProperty(Unit, 'name', { value: 'Unit' })\n Unit.prototype.constructor = Unit\n Unit.prototype.type = 'Unit'\n Unit.prototype.isUnit = true\n\n // private variables and functions for the Unit parser\n let text, index, c\n\n function skipWhitespace () {\n while (c === ' ' || c === '\\t') {\n next()\n }\n }\n\n function isDigitDot (c) {\n return ((c >= '0' && c <= '9') || c === '.')\n }\n\n function isDigit (c) {\n return ((c >= '0' && c <= '9'))\n }\n\n function next () {\n index++\n c = text.charAt(index)\n }\n\n function revert (oldIndex) {\n index = oldIndex\n c = text.charAt(index)\n }\n\n function parseNumber () {\n let number = ''\n const oldIndex = index\n\n if (c === '+') {\n next()\n } else if (c === '-') {\n number += c\n next()\n }\n\n if (!isDigitDot(c)) {\n // a + or - must be followed by a digit\n revert(oldIndex)\n return null\n }\n\n // get number, can have a single dot\n if (c === '.') {\n number += c\n next()\n if (!isDigit(c)) {\n // this is no legal number, it is just a dot\n revert(oldIndex)\n return null\n }\n } else {\n while (isDigit(c)) {\n number += c\n next()\n }\n if (c === '.') {\n number += c\n next()\n }\n }\n while (isDigit(c)) {\n number += c\n next()\n }\n\n // check for exponential notation like \"2.3e-4\" or \"1.23e50\"\n if (c === 'E' || c === 'e') {\n // The grammar branches here. This could either be part of an exponent or the start of a unit that begins with the letter e, such as \"4exabytes\"\n\n let tentativeNumber = ''\n const tentativeIndex = index\n\n tentativeNumber += c\n next()\n\n if (c === '+' || c === '-') {\n tentativeNumber += c\n next()\n }\n\n // Scientific notation MUST be followed by an exponent (otherwise we assume it is not scientific notation)\n if (!isDigit(c)) {\n // The e or E must belong to something else, so return the number without the e or E.\n revert(tentativeIndex)\n return number\n }\n\n // We can now safely say that this is scientific notation.\n number = number + tentativeNumber\n while (isDigit(c)) {\n number += c\n next()\n }\n }\n\n return number\n }\n\n function parseUnit () {\n let unitName = ''\n\n // Alphanumeric characters only; matches [a-zA-Z0-9]\n while (isDigit(c) || Unit.isValidAlpha(c)) {\n unitName += c\n next()\n }\n\n // Must begin with [a-zA-Z]\n const firstC = unitName.charAt(0)\n if (Unit.isValidAlpha(firstC)) {\n return unitName\n } else {\n return null\n }\n }\n\n function parseCharacter (toFind) {\n if (c === toFind) {\n next()\n return toFind\n } else {\n return null\n }\n }\n\n /**\n * Parse a string into a unit. The value of the unit is parsed as number,\n * BigNumber, or Fraction depending on the math.js config setting `number`.\n *\n * Throws an exception if the provided string does not contain a valid unit or\n * cannot be parsed.\n * @memberof Unit\n * @param {string} str A string like \"5.2 inch\", \"4e2 cm/s^2\"\n * @return {Unit} unit\n */\n Unit.parse = function (str, options) {\n options = options || {}\n text = str\n index = -1\n c = ''\n\n if (typeof text !== 'string') {\n throw new TypeError('Invalid argument in Unit.parse, string expected')\n }\n\n const unit = new Unit()\n unit.units = []\n\n let powerMultiplierCurrent = 1\n let expectingUnit = false\n\n // A unit should follow this pattern:\n // [number] ...[ [*/] unit[^number] ]\n // unit[^number] ... [ [*/] unit[^number] ]\n\n // Rules:\n // number is any floating point number.\n // unit is any alphanumeric string beginning with an alpha. Units with names like e3 should be avoided because they look like the exponent of a floating point number!\n // The string may optionally begin with a number.\n // Each unit may optionally be followed by ^number.\n // Whitespace or a forward slash is recommended between consecutive units, although the following technically is parseable:\n // 2m^2kg/s^2\n // it is not good form. If a unit starts with e, then it could be confused as a floating point number:\n // 4erg\n\n next()\n skipWhitespace()\n\n // Optional number at the start of the string\n const valueStr = parseNumber()\n let value = null\n if (valueStr) {\n if (config.number === 'BigNumber') {\n value = new BigNumber(valueStr)\n } else if (config.number === 'Fraction') {\n try {\n // not all numbers can be turned in Fractions, for example very small numbers not\n value = new Fraction(valueStr)\n } catch (err) {\n value = parseFloat(valueStr)\n }\n } else { // number\n value = parseFloat(valueStr)\n }\n\n skipWhitespace() // Whitespace is not required here\n\n // handle multiplication or division right after the value, like '1/s'\n if (parseCharacter('*')) {\n powerMultiplierCurrent = 1\n expectingUnit = true\n } else if (parseCharacter('/')) {\n powerMultiplierCurrent = -1\n expectingUnit = true\n }\n }\n\n // Stack to keep track of powerMultipliers applied to each parentheses group\n const powerMultiplierStack = []\n\n // Running product of all elements in powerMultiplierStack\n let powerMultiplierStackProduct = 1\n\n while (true) {\n skipWhitespace()\n\n // Check for and consume opening parentheses, pushing powerMultiplierCurrent to the stack\n // A '(' will always appear directly before a unit.\n while (c === '(') {\n powerMultiplierStack.push(powerMultiplierCurrent)\n powerMultiplierStackProduct *= powerMultiplierCurrent\n powerMultiplierCurrent = 1\n next()\n skipWhitespace()\n }\n\n // Is there something here?\n let uStr\n if (c) {\n const oldC = c\n uStr = parseUnit()\n if (uStr === null) {\n throw new SyntaxError('Unexpected \"' + oldC + '\" in \"' + text + '\" at index ' + index.toString())\n }\n } else {\n // End of input.\n break\n }\n\n // Verify the unit exists and get the prefix (if any)\n const res = _findUnit(uStr)\n if (res === null) {\n // Unit not found.\n throw new SyntaxError('Unit \"' + uStr + '\" not found.')\n }\n\n let power = powerMultiplierCurrent * powerMultiplierStackProduct\n // Is there a \"^ number\"?\n skipWhitespace()\n if (parseCharacter('^')) {\n skipWhitespace()\n const p = parseNumber()\n if (p === null) {\n // No valid number found for the power!\n throw new SyntaxError('In \"' + str + '\", \"^\" must be followed by a floating-point number')\n }\n power *= p\n }\n\n // Add the unit to the list\n unit.units.push({\n unit: res.unit,\n prefix: res.prefix,\n power\n })\n for (let i = 0; i < BASE_DIMENSIONS.length; i++) {\n unit.dimensions[i] += (res.unit.dimensions[i] || 0) * power\n }\n\n // Check for and consume closing parentheses, popping from the stack.\n // A ')' will always follow a unit.\n skipWhitespace()\n while (c === ')') {\n if (powerMultiplierStack.length === 0) {\n throw new SyntaxError('Unmatched \")\" in \"' + text + '\" at index ' + index.toString())\n }\n powerMultiplierStackProduct /= powerMultiplierStack.pop()\n next()\n skipWhitespace()\n }\n\n // \"*\" and \"/\" should mean we are expecting something to come next.\n // Is there a forward slash? If so, negate powerMultiplierCurrent. The next unit or paren group is in the denominator.\n expectingUnit = false\n\n if (parseCharacter('*')) {\n // explicit multiplication\n powerMultiplierCurrent = 1\n expectingUnit = true\n } else if (parseCharacter('/')) {\n // division\n powerMultiplierCurrent = -1\n expectingUnit = true\n } else {\n // implicit multiplication\n powerMultiplierCurrent = 1\n }\n\n // Replace the unit into the auto unit system\n if (res.unit.base) {\n const baseDim = res.unit.base.key\n UNIT_SYSTEMS.auto[baseDim] = {\n unit: res.unit,\n prefix: res.prefix\n }\n }\n }\n\n // Has the string been entirely consumed?\n skipWhitespace()\n if (c) {\n throw new SyntaxError('Could not parse: \"' + str + '\"')\n }\n\n // Is there a trailing slash?\n if (expectingUnit) {\n throw new SyntaxError('Trailing characters: \"' + str + '\"')\n }\n\n // Is the parentheses stack empty?\n if (powerMultiplierStack.length !== 0) {\n throw new SyntaxError('Unmatched \"(\" in \"' + text + '\"')\n }\n\n // Are there any units at all?\n if (unit.units.length === 0 && !options.allowNoUnits) {\n throw new SyntaxError('\"' + str + '\" contains no units')\n }\n\n unit.value = (value !== undefined) ? unit._normalize(value) : null\n return unit\n }\n\n /**\n * create a copy of this unit\n * @memberof Unit\n * @return {Unit} Returns a cloned version of the unit\n */\n Unit.prototype.clone = function () {\n const unit = new Unit()\n\n unit.fixPrefix = this.fixPrefix\n unit.skipAutomaticSimplification = this.skipAutomaticSimplification\n\n unit.value = clone(this.value)\n unit.dimensions = this.dimensions.slice(0)\n unit.units = []\n for (let i = 0; i < this.units.length; i++) {\n unit.units[i] = { }\n for (const p in this.units[i]) {\n if (hasOwnProperty(this.units[i], p)) {\n unit.units[i][p] = this.units[i][p]\n }\n }\n }\n\n return unit\n }\n\n /**\n * Return the type of the value of this unit\n *\n * @memberof Unit\n * @return {string} type of the value of the unit\n */\n Unit.prototype.valueType = function () {\n return typeOf(this.value)\n }\n\n /**\n * Return whether the unit is derived (such as m/s, or cm^2, but not N)\n * @memberof Unit\n * @return {boolean} True if the unit is derived\n * @private\n */\n Unit.prototype._isDerived = function () {\n if (this.units.length === 0) {\n return false\n }\n return this.units.length > 1 || Math.abs(this.units[0].power - 1.0) > 1e-15\n }\n\n /**\n * Normalize a value, based on its currently set unit(s)\n * @memberof Unit\n * @param {number | BigNumber | Fraction | boolean} value\n * @return {number | BigNumber | Fraction | boolean} normalized value\n * @private\n */\n Unit.prototype._normalize = function (value) {\n if (value === null || value === undefined || this.units.length === 0) {\n return value\n }\n let res = value\n const convert = Unit._getNumberConverter(typeOf(value)) // convert to Fraction or BigNumber if needed\n\n for (let i = 0; i < this.units.length; i++) {\n const unitValue = convert(this.units[i].unit.value)\n const unitPrefixValue = convert(this.units[i].prefix.value)\n const unitPower = convert(this.units[i].power)\n res = multiplyScalar(res, pow(multiplyScalar(unitValue, unitPrefixValue), unitPower))\n }\n\n return res\n }\n\n /**\n * Denormalize a value, based on its currently set unit(s)\n * @memberof Unit\n * @param {number} value\n * @param {number} [prefixValue] Optional prefix value to be used (ignored if this is a derived unit)\n * @return {number} denormalized value\n * @private\n */\n Unit.prototype._denormalize = function (value, prefixValue) {\n if (value === null || value === undefined || this.units.length === 0) {\n return value\n }\n let res = value\n const convert = Unit._getNumberConverter(typeOf(value)) // convert to Fraction or BigNumber if needed\n\n for (let i = 0; i < this.units.length; i++) {\n const unitValue = convert(this.units[i].unit.value)\n const unitPrefixValue = convert(this.units[i].prefix.value)\n const unitPower = convert(this.units[i].power)\n res = divideScalar(res, pow(multiplyScalar(unitValue, unitPrefixValue), unitPower))\n }\n\n return res\n }\n\n /**\n * Find a unit from a string\n * @memberof Unit\n * @param {string} str A string like 'cm' or 'inch'\n * @returns {Object | null} result When found, an object with fields unit and\n * prefix is returned. Else, null is returned.\n * @private\n */\n const _findUnit = memoize((str) => {\n // First, match units names exactly. For example, a user could define 'mm' as 10^-4 m, which is silly, but then we would want 'mm' to match the user-defined unit.\n if (hasOwnProperty(UNITS, str)) {\n const unit = UNITS[str]\n const prefix = unit.prefixes['']\n return { unit, prefix }\n }\n\n for (const name in UNITS) {\n if (hasOwnProperty(UNITS, name)) {\n if (endsWith(str, name)) {\n const unit = UNITS[name]\n const prefixLen = (str.length - name.length)\n const prefixName = str.substring(0, prefixLen)\n const prefix = hasOwnProperty(unit.prefixes, prefixName)\n ? unit.prefixes[prefixName]\n : undefined\n if (prefix !== undefined) {\n // store unit, prefix, and value\n return { unit, prefix }\n }\n }\n }\n }\n\n return null\n }, { hasher: (args) => args[0], limit: 100 })\n\n /**\n * Test if the given expression is a unit.\n * The unit can have a prefix but cannot have a value.\n * @memberof Unit\n * @param {string} name A string to be tested whether it is a value less unit.\n * The unit can have prefix, like \"cm\"\n * @return {boolean} true if the given string is a unit\n */\n Unit.isValuelessUnit = function (name) {\n return (_findUnit(name) !== null)\n }\n\n /**\n * check if this unit has given base unit\n * If this unit is a derived unit, this will ALWAYS return false, since by definition base units are not derived.\n * @memberof Unit\n * @param {BASE_UNIT | string | undefined} base\n */\n Unit.prototype.hasBase = function (base) {\n if (typeof (base) === 'string') {\n base = BASE_UNITS[base]\n }\n\n if (!base) { return false }\n\n // All dimensions must be the same\n for (let i = 0; i < BASE_DIMENSIONS.length; i++) {\n if (Math.abs((this.dimensions[i] || 0) - (base.dimensions[i] || 0)) > 1e-12) {\n return false\n }\n }\n return true\n }\n\n /**\n * Check if this unit has a base or bases equal to another base or bases\n * For derived units, the exponent on each base also must match\n * @memberof Unit\n * @param {Unit} other\n * @return {boolean} true if equal base\n */\n Unit.prototype.equalBase = function (other) {\n // All dimensions must be the same\n for (let i = 0; i < BASE_DIMENSIONS.length; i++) {\n if (Math.abs((this.dimensions[i] || 0) - (other.dimensions[i] || 0)) > 1e-12) {\n return false\n }\n }\n return true\n }\n\n /**\n * Check if this unit equals another unit\n * @memberof Unit\n * @param {Unit} other\n * @return {boolean} true if both units are equal\n */\n Unit.prototype.equals = function (other) {\n return (this.equalBase(other) && equal(this.value, other.value))\n }\n\n /**\n * Multiply this unit with another one or with a scalar\n * @memberof Unit\n * @param {Unit} other\n * @return {Unit} product of this unit and the other unit\n */\n Unit.prototype.multiply = function (_other) {\n const res = this.clone()\n const other = isUnit(_other) ? _other : new Unit(_other)\n\n for (let i = 0; i < BASE_DIMENSIONS.length; i++) {\n // Dimensions arrays may be of different lengths. Default to 0.\n res.dimensions[i] = (this.dimensions[i] || 0) + (other.dimensions[i] || 0)\n }\n\n // Append other's units list onto res\n for (let i = 0; i < other.units.length; i++) {\n // Make a shallow copy of every unit\n const inverted = {\n ...other.units[i]\n }\n res.units.push(inverted)\n }\n\n // If at least one operand has a value, then the result should also have a value\n if (this.value !== null || other.value !== null) {\n const valThis = this.value === null ? this._normalize(one(other.value)) : this.value\n const valOther = other.value === null ? other._normalize(one(this.value)) : other.value\n\n res.value = multiplyScalar(valThis, valOther)\n } else {\n res.value = null\n }\n\n if (isUnit(_other)) {\n res.skipAutomaticSimplification = false\n }\n\n return getNumericIfUnitless(res)\n }\n\n /**\n * Divide a number by this unit\n *\n * @memberof Unit\n * @param {numeric} numerator\n * @param {unit} result of dividing numerator by this unit\n */\n Unit.prototype.divideInto = function (numerator) {\n return new Unit(numerator).divide(this)\n }\n\n /**\n * Divide this unit by another one\n * @memberof Unit\n * @param {Unit | numeric} other\n * @return {Unit} result of dividing this unit by the other unit\n */\n Unit.prototype.divide = function (_other) {\n const res = this.clone()\n const other = isUnit(_other) ? _other : new Unit(_other)\n\n for (let i = 0; i < BASE_DIMENSIONS.length; i++) {\n // Dimensions arrays may be of different lengths. Default to 0.\n res.dimensions[i] = (this.dimensions[i] || 0) - (other.dimensions[i] || 0)\n }\n\n // Invert and append other's units list onto res\n for (let i = 0; i < other.units.length; i++) {\n // Make a shallow copy of every unit\n const inverted = {\n ...other.units[i],\n power: -other.units[i].power\n }\n res.units.push(inverted)\n }\n\n // If at least one operand has a value, the result should have a value\n if (this.value !== null || other.value !== null) {\n const valThis = this.value === null ? this._normalize(one(other.value)) : this.value\n const valOther = other.value === null ? other._normalize(one(this.value)) : other.value\n res.value = divideScalar(valThis, valOther)\n } else {\n res.value = null\n }\n\n if (isUnit(_other)) {\n res.skipAutomaticSimplification = false\n }\n\n return getNumericIfUnitless(res)\n }\n\n /**\n * Calculate the power of a unit\n * @memberof Unit\n * @param {number | Fraction | BigNumber} p\n * @returns {Unit} The result: this^p\n */\n Unit.prototype.pow = function (p) {\n const res = this.clone()\n\n for (let i = 0; i < BASE_DIMENSIONS.length; i++) {\n // Dimensions arrays may be of different lengths. Default to 0.\n res.dimensions[i] = (this.dimensions[i] || 0) * p\n }\n\n // Adjust the power of each unit in the list\n for (let i = 0; i < res.units.length; i++) {\n res.units[i].power *= p\n }\n\n if (res.value !== null) {\n res.value = pow(res.value, p)\n\n // only allow numeric output, we don't want to return a Complex number\n // if (!isNumeric(res.value)) {\n // res.value = NaN\n // }\n // Update: Complex supported now\n } else {\n res.value = null\n }\n\n res.skipAutomaticSimplification = false\n\n return getNumericIfUnitless(res)\n }\n\n /**\n * Return the numeric value of this unit if it is dimensionless, has a value, and config.predictable == false; or the original unit otherwise\n * @param {Unit} unit\n * @returns {number | Fraction | BigNumber | Unit} The numeric value of the unit if conditions are met, or the original unit otherwise\n */\n function getNumericIfUnitless (unit) {\n if (unit.equalBase(BASE_UNITS.NONE) && unit.value !== null && !config.predictable) {\n return unit.value\n } else {\n return unit\n }\n }\n\n /**\n * Create a value one with the numeric type of `typeOfValue`.\n * For example, `one(new BigNumber(3))` returns `BigNumber(1)`\n * @param {number | Fraction | BigNumber} typeOfValue\n * @returns {number | Fraction | BigNumber}\n */\n function one (typeOfValue) {\n // TODO: this is a workaround to prevent the following BigNumber conversion error from throwing:\n // \"TypeError: Cannot implicitly convert a number with >15 significant digits to BigNumber\"\n // see https://github.com/josdejong/mathjs/issues/3450\n // https://github.com/josdejong/mathjs/pull/3375\n const convert = Unit._getNumberConverter(typeOf(typeOfValue))\n\n return convert(1)\n }\n\n /**\n * Calculate the absolute value of a unit\n * @memberof Unit\n * @param {number | Fraction | BigNumber} x\n * @returns {Unit} The result: |x|, absolute value of x\n */\n Unit.prototype.abs = function () {\n const ret = this.clone()\n if (ret.value !== null) {\n if (ret._isDerived() || ret.units.length === 0 || ret.units[0].unit.offset === 0) {\n ret.value = abs(ret.value)\n } else {\n // To give the correct, but unexpected, results for units with an offset.\n // For example, abs(-283.15 degC) = -263.15 degC !!!\n // We must take the offset into consideration here\n const convert = ret._numberConverter() // convert to Fraction or BigNumber if needed\n const unitValue = convert(ret.units[0].unit.value)\n const nominalOffset = convert(ret.units[0].unit.offset)\n const unitOffset = multiplyScalar(unitValue, nominalOffset)\n ret.value = subtractScalar(abs(addScalar(ret.value, unitOffset)), unitOffset)\n }\n }\n\n for (const i in ret.units) {\n if (ret.units[i].unit.name === 'VA' || ret.units[i].unit.name === 'VAR') {\n ret.units[i].unit = UNITS.W\n }\n }\n\n return ret\n }\n\n /**\n * Convert the unit to a specific unit name.\n * @memberof Unit\n * @param {string | Unit} valuelessUnit A unit without value. Can have prefix, like \"cm\"\n * @returns {Unit} Returns a clone of the unit with a fixed prefix and unit.\n */\n Unit.prototype.to = function (valuelessUnit) {\n const value = this.value === null ? this._normalize(1) : this.value\n let other\n if (typeof valuelessUnit === 'string') {\n other = Unit.parse(valuelessUnit)\n } else if (isUnit(valuelessUnit)) {\n other = valuelessUnit.clone()\n } else {\n throw new Error('String or Unit expected as parameter')\n }\n\n if (!this.equalBase(other)) {\n throw new Error(`Units do not match ('${other.toString()}' != '${this.toString()}')`)\n }\n if (other.value !== null) {\n throw new Error('Cannot convert to a unit with a value')\n }\n\n if (this.value === null || this._isDerived() ||\n this.units.length === 0 || other.units.length === 0 ||\n this.units[0].unit.offset === other.units[0].unit.offset) {\n other.value = clone(value)\n } else {\n /* Need to adjust value by difference in offset to convert */\n const convert = Unit._getNumberConverter(typeOf(value)) // convert to Fraction or BigNumber if needed\n\n const thisUnitValue = this.units[0].unit.value\n const thisNominalOffset = this.units[0].unit.offset\n const thisUnitOffset = multiplyScalar(thisUnitValue, thisNominalOffset)\n\n const otherUnitValue = other.units[0].unit.value\n const otherNominalOffset = other.units[0].unit.offset\n const otherUnitOffset = multiplyScalar(otherUnitValue, otherNominalOffset)\n\n other.value = addScalar(value, convert(subtractScalar(thisUnitOffset, otherUnitOffset)))\n }\n other.fixPrefix = true\n other.skipAutomaticSimplification = true\n return other\n }\n\n /**\n * Return the value of the unit when represented with given valueless unit\n * @memberof Unit\n * @param {string | Unit} valuelessUnit For example 'cm' or 'inch'\n * @return {number} Returns the unit value as number.\n */\n // TODO: deprecate Unit.toNumber? It's always better to use toNumeric\n Unit.prototype.toNumber = function (valuelessUnit) {\n return toNumber(this.toNumeric(valuelessUnit))\n }\n\n /**\n * Return the value of the unit in the original numeric type\n * @memberof Unit\n * @param {string | Unit} valuelessUnit For example 'cm' or 'inch'\n * @return {number | BigNumber | Fraction} Returns the unit value\n */\n Unit.prototype.toNumeric = function (valuelessUnit) {\n let other\n if (valuelessUnit) {\n // Allow getting the numeric value without converting to a different unit\n other = this.to(valuelessUnit)\n } else {\n other = this.clone()\n }\n\n if (other._isDerived() || other.units.length === 0) {\n return other._denormalize(other.value)\n } else {\n return other._denormalize(other.value, other.units[0].prefix.value)\n }\n }\n\n /**\n * Get a string representation of the unit.\n * @memberof Unit\n * @return {string}\n */\n Unit.prototype.toString = function () {\n return this.format()\n }\n\n /**\n * Get a JSON representation of the unit\n * @memberof Unit\n * @returns {Object} Returns a JSON object structured as:\n * `{\"mathjs\": \"Unit\", \"value\": 2, \"unit\": \"cm\", \"fixPrefix\": false}`\n */\n Unit.prototype.toJSON = function () {\n return {\n mathjs: 'Unit',\n value: this._denormalize(this.value),\n unit: this.units.length > 0 ? this.formatUnits() : null,\n fixPrefix: this.fixPrefix\n }\n }\n\n /**\n * Instantiate a Unit from a JSON object\n * @memberof Unit\n * @param {Object} json A JSON object structured as:\n * `{\"mathjs\": \"Unit\", \"value\": 2, \"unit\": \"cm\", \"fixPrefix\": false}`\n * @return {Unit}\n */\n Unit.fromJSON = function (json) {\n const unit = new Unit(json.value, json.unit ?? undefined)\n unit.fixPrefix = json.fixPrefix || false\n return unit\n }\n\n /**\n * Returns the string representation of the unit.\n * @memberof Unit\n * @return {string}\n */\n Unit.prototype.valueOf = Unit.prototype.toString\n\n /**\n * Simplify this Unit's unit list and return a new Unit with the simplified list.\n * The returned Unit will contain a list of the \"best\" units for formatting.\n */\n Unit.prototype.simplify = function () {\n const ret = this.clone()\n\n const proposedUnitList = []\n\n // Search for a matching base\n let matchingBase\n for (const key in currentUnitSystem) {\n if (hasOwnProperty(currentUnitSystem, key)) {\n if (ret.hasBase(BASE_UNITS[key])) {\n matchingBase = key\n break\n }\n }\n }\n\n if (matchingBase === 'NONE') {\n ret.units = []\n } else {\n let matchingUnit\n if (matchingBase) {\n // Does the unit system have a matching unit?\n if (hasOwnProperty(currentUnitSystem, matchingBase)) {\n matchingUnit = currentUnitSystem[matchingBase]\n }\n }\n if (matchingUnit) {\n ret.units = [{\n unit: matchingUnit.unit,\n prefix: matchingUnit.prefix,\n power: 1.0\n }]\n } else {\n // Multiple units or units with powers are formatted like this:\n // 5 (kg m^2) / (s^3 mol)\n // Build an representation from the base units of the current unit system\n let missingBaseDim = false\n for (let i = 0; i < BASE_DIMENSIONS.length; i++) {\n const baseDim = BASE_DIMENSIONS[i]\n if (Math.abs(ret.dimensions[i] || 0) > 1e-12) {\n if (hasOwnProperty(currentUnitSystem, baseDim)) {\n proposedUnitList.push({\n unit: currentUnitSystem[baseDim].unit,\n prefix: currentUnitSystem[baseDim].prefix,\n power: ret.dimensions[i] || 0\n })\n } else {\n missingBaseDim = true\n }\n }\n }\n\n // Is the proposed unit list \"simpler\" than the existing one?\n if (proposedUnitList.length < ret.units.length && !missingBaseDim) {\n // Replace this unit list with the proposed list\n ret.units = proposedUnitList\n }\n }\n }\n\n return ret\n }\n\n /**\n * Returns a new Unit in the SI system with the same value as this one\n */\n Unit.prototype.toSI = function () {\n const ret = this.clone()\n\n const proposedUnitList = []\n\n // Multiple units or units with powers are formatted like this:\n // 5 (kg m^2) / (s^3 mol)\n // Build an representation from the base units of the SI unit system\n for (let i = 0; i < BASE_DIMENSIONS.length; i++) {\n const baseDim = BASE_DIMENSIONS[i]\n if (Math.abs(ret.dimensions[i] || 0) > 1e-12) {\n if (hasOwnProperty(UNIT_SYSTEMS.si, baseDim)) {\n proposedUnitList.push({\n unit: UNIT_SYSTEMS.si[baseDim].unit,\n prefix: UNIT_SYSTEMS.si[baseDim].prefix,\n power: ret.dimensions[i] || 0\n })\n } else {\n throw new Error('Cannot express custom unit ' + baseDim + ' in SI units')\n }\n }\n }\n\n // Replace this unit list with the proposed list\n ret.units = proposedUnitList\n\n ret.fixPrefix = true\n ret.skipAutomaticSimplification = true\n\n if (this.value !== null) {\n ret.value = null\n return this.to(ret)\n }\n return ret\n }\n\n /**\n * Get a string representation of the units of this Unit, without the value. The unit list is formatted as-is without first being simplified.\n * @memberof Unit\n * @return {string}\n */\n Unit.prototype.formatUnits = function () {\n let strNum = ''\n let strDen = ''\n let nNum = 0\n let nDen = 0\n\n for (let i = 0; i < this.units.length; i++) {\n if (this.units[i].power > 0) {\n nNum++\n strNum += ' ' + this.units[i].prefix.name + this.units[i].unit.name\n if (Math.abs(this.units[i].power - 1.0) > 1e-15) {\n strNum += '^' + this.units[i].power\n }\n } else if (this.units[i].power < 0) {\n nDen++\n }\n }\n\n if (nDen > 0) {\n for (let i = 0; i < this.units.length; i++) {\n if (this.units[i].power < 0) {\n if (nNum > 0) {\n strDen += ' ' + this.units[i].prefix.name + this.units[i].unit.name\n if (Math.abs(this.units[i].power + 1.0) > 1e-15) {\n strDen += '^' + (-this.units[i].power)\n }\n } else {\n strDen += ' ' + this.units[i].prefix.name + this.units[i].unit.name\n strDen += '^' + (this.units[i].power)\n }\n }\n }\n }\n // Remove leading \" \"\n strNum = strNum.substr(1)\n strDen = strDen.substr(1)\n\n // Add parans for better copy/paste back into evaluate, for example, or for better pretty print formatting\n if (nNum > 1 && nDen > 0) {\n strNum = '(' + strNum + ')'\n }\n if (nDen > 1 && nNum > 0) {\n strDen = '(' + strDen + ')'\n }\n\n let str = strNum\n if (nNum > 0 && nDen > 0) {\n str += ' / '\n }\n str += strDen\n\n return str\n }\n\n /**\n * Get a string representation of the Unit, with optional formatting options.\n * @memberof Unit\n * @param {Object | number | Function} [options] Formatting options. See\n * lib/utils/number:format for a\n * description of the available\n * options.\n * @return {string}\n */\n Unit.prototype.format = function (options) {\n // Simplfy the unit list, unless it is valueless or was created directly in the\n // constructor or as the result of to or toSI\n const simp = this.skipAutomaticSimplification || this.value === null\n ? this.clone()\n : this.simplify()\n\n // Apply some custom logic for handling VA and VAR. The goal is to express the value of the unit as a real value, if possible. Otherwise, use a real-valued unit instead of a complex-valued one.\n let isImaginary = false\n if (typeof (simp.value) !== 'undefined' && simp.value !== null && isComplex(simp.value)) {\n // TODO: Make this better, for example, use relative magnitude of re and im rather than absolute\n isImaginary = Math.abs(simp.value.re) < 1e-14\n }\n\n for (const i in simp.units) {\n if (hasOwnProperty(simp.units, i)) {\n if (simp.units[i].unit) {\n if (simp.units[i].unit.name === 'VA' && isImaginary) {\n simp.units[i].unit = UNITS.VAR\n } else if (simp.units[i].unit.name === 'VAR' && !isImaginary) {\n simp.units[i].unit = UNITS.VA\n }\n }\n }\n }\n\n // Now apply the best prefix\n // Units must have only one unit and not have the fixPrefix flag set\n if (simp.units.length === 1 && !simp.fixPrefix) {\n // Units must have integer powers, otherwise the prefix will change the\n // outputted value by not-an-integer-power-of-ten\n if (Math.abs(simp.units[0].power - Math.round(simp.units[0].power)) < 1e-14) {\n // Apply the best prefix\n simp.units[0].prefix = simp._bestPrefix()\n }\n }\n\n const value = simp._denormalize(simp.value)\n let str = (simp.value !== null) ? format(value, options || {}) : ''\n const unitStr = simp.formatUnits()\n if (simp.value && isComplex(simp.value)) {\n str = '(' + str + ')' // Surround complex values with ( ) to enable better parsing\n }\n if (unitStr.length > 0 && str.length > 0) {\n str += ' '\n }\n str += unitStr\n\n return str\n }\n\n /**\n * Calculate the best prefix using current value.\n * @memberof Unit\n * @returns {Object} prefix\n * @private\n */\n Unit.prototype._bestPrefix = function () {\n if (this.units.length !== 1) {\n throw new Error('Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!')\n }\n if (Math.abs(this.units[0].power - Math.round(this.units[0].power)) >= 1e-14) {\n throw new Error('Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!')\n }\n\n // find the best prefix value (resulting in the value of which\n // the absolute value of the log10 is closest to zero,\n // though with a little offset of 1.2 for nicer values: you get a\n // sequence 1mm 100mm 500mm 0.6m 1m 10m 100m 500m 0.6km 1km ...\n\n // Note: the units value can be any numeric type, but to find the best\n // prefix it's enough to work with limited precision of a regular number\n // Update: using mathjs abs since we also allow complex numbers\n const absValue = this.value !== null ? abs(this.value) : 0\n const absUnitValue = abs(this.units[0].unit.value)\n let bestPrefix = this.units[0].prefix\n if (absValue === 0) {\n return bestPrefix\n }\n const power = this.units[0].power\n let bestDiff = Math.log(absValue / Math.pow(bestPrefix.value * absUnitValue, power)) / Math.LN10 - 1.2\n if (bestDiff > -2.200001 && bestDiff < 1.800001) return bestPrefix // Allow the original prefix\n bestDiff = Math.abs(bestDiff)\n const prefixes = this.units[0].unit.prefixes\n for (const p in prefixes) {\n if (hasOwnProperty(prefixes, p)) {\n const prefix = prefixes[p]\n if (prefix.scientific) {\n const diff = Math.abs(\n Math.log(absValue / Math.pow(prefix.value * absUnitValue, power)) / Math.LN10 - 1.2)\n\n if (diff < bestDiff ||\n (diff === bestDiff && prefix.name.length < bestPrefix.name.length)) {\n // choose the prefix with the smallest diff, or if equal, choose the one\n // with the shortest name (can happen with SHORTLONG for example)\n bestPrefix = prefix\n bestDiff = diff\n }\n }\n }\n }\n\n return bestPrefix\n }\n\n /**\n * Returns an array of units whose sum is equal to this unit\n * @memberof Unit\n * @param {Array} [parts] An array of strings or valueless units.\n *\n * Example:\n *\n * const u = new Unit(1, 'm')\n * u.splitUnit(['feet', 'inch'])\n * [ 3 feet, 3.3700787401575 inch ]\n *\n * @return {Array} An array of units.\n */\n Unit.prototype.splitUnit = function (parts) {\n let x = this.clone()\n const ret = []\n for (let i = 0; i < parts.length; i++) {\n // Convert x to the requested unit\n x = x.to(parts[i])\n if (i === parts.length - 1) break\n\n // Get the numeric value of this unit\n const xNumeric = x.toNumeric()\n\n // Check to see if xNumeric is nearly equal to an integer,\n // since fix can incorrectly round down if there is round-off error\n const xRounded = round(xNumeric)\n let xFixed\n const isNearlyEqual = equal(xRounded, xNumeric)\n if (isNearlyEqual) {\n xFixed = xRounded\n } else {\n xFixed = fix(x.toNumeric())\n }\n\n const y = new Unit(xFixed, parts[i].toString())\n ret.push(y)\n x = subtractScalar(x, y)\n }\n\n // This little bit fixes a bug where the remainder should be 0 but is a little bit off.\n // But instead of comparing x, the remainder, with zero--we will compare the sum of\n // all the parts so far with the original value. If they are nearly equal,\n // we set the remainder to 0.\n let testSum = 0\n for (let i = 0; i < ret.length; i++) {\n testSum = addScalar(testSum, ret[i].value)\n }\n if (equal(testSum, this.value)) {\n x.value = 0\n }\n\n ret.push(x)\n\n return ret\n }\n\n const PREFIXES = {\n NONE: {\n '': { name: '', value: 1, scientific: true }\n },\n SHORT: {\n '': { name: '', value: 1, scientific: true },\n\n da: { name: 'da', value: 1e1, scientific: false },\n h: { name: 'h', value: 1e2, scientific: false },\n k: { name: 'k', value: 1e3, scientific: true },\n M: { name: 'M', value: 1e6, scientific: true },\n G: { name: 'G', value: 1e9, scientific: true },\n T: { name: 'T', value: 1e12, scientific: true },\n P: { name: 'P', value: 1e15, scientific: true },\n E: { name: 'E', value: 1e18, scientific: true },\n Z: { name: 'Z', value: 1e21, scientific: true },\n Y: { name: 'Y', value: 1e24, scientific: true },\n R: { name: 'R', value: 1e27, scientific: true },\n Q: { name: 'Q', value: 1e30, scientific: true },\n\n d: { name: 'd', value: 1e-1, scientific: false },\n c: { name: 'c', value: 1e-2, scientific: false },\n m: { name: 'm', value: 1e-3, scientific: true },\n u: { name: 'u', value: 1e-6, scientific: true },\n n: { name: 'n', value: 1e-9, scientific: true },\n p: { name: 'p', value: 1e-12, scientific: true },\n f: { name: 'f', value: 1e-15, scientific: true },\n a: { name: 'a', value: 1e-18, scientific: true },\n z: { name: 'z', value: 1e-21, scientific: true },\n y: { name: 'y', value: 1e-24, scientific: true },\n r: { name: 'r', value: 1e-27, scientific: true },\n q: { name: 'q', value: 1e-30, scientific: true }\n },\n LONG: {\n '': { name: '', value: 1, scientific: true },\n\n deca: { name: 'deca', value: 1e1, scientific: false },\n hecto: { name: 'hecto', value: 1e2, scientific: false },\n kilo: { name: 'kilo', value: 1e3, scientific: true },\n mega: { name: 'mega', value: 1e6, scientific: true },\n giga: { name: 'giga', value: 1e9, scientific: true },\n tera: { name: 'tera', value: 1e12, scientific: true },\n peta: { name: 'peta', value: 1e15, scientific: true },\n exa: { name: 'exa', value: 1e18, scientific: true },\n zetta: { name: 'zetta', value: 1e21, scientific: true },\n yotta: { name: 'yotta', value: 1e24, scientific: true },\n ronna: { name: 'ronna', value: 1e27, scientific: true },\n quetta: { name: 'quetta', value: 1e30, scientific: true },\n\n deci: { name: 'deci', value: 1e-1, scientific: false },\n centi: { name: 'centi', value: 1e-2, scientific: false },\n milli: { name: 'milli', value: 1e-3, scientific: true },\n micro: { name: 'micro', value: 1e-6, scientific: true },\n nano: { name: 'nano', value: 1e-9, scientific: true },\n pico: { name: 'pico', value: 1e-12, scientific: true },\n femto: { name: 'femto', value: 1e-15, scientific: true },\n atto: { name: 'atto', value: 1e-18, scientific: true },\n zepto: { name: 'zepto', value: 1e-21, scientific: true },\n yocto: { name: 'yocto', value: 1e-24, scientific: true },\n ronto: { name: 'ronto', value: 1e-27, scientific: true },\n quecto: { name: 'quecto', value: 1e-30, scientific: true }\n },\n SQUARED: {\n '': { name: '', value: 1, scientific: true },\n\n da: { name: 'da', value: 1e2, scientific: false },\n h: { name: 'h', value: 1e4, scientific: false },\n k: { name: 'k', value: 1e6, scientific: true },\n M: { name: 'M', value: 1e12, scientific: true },\n G: { name: 'G', value: 1e18, scientific: true },\n T: { name: 'T', value: 1e24, scientific: true },\n P: { name: 'P', value: 1e30, scientific: true },\n E: { name: 'E', value: 1e36, scientific: true },\n Z: { name: 'Z', value: 1e42, scientific: true },\n Y: { name: 'Y', value: 1e48, scientific: true },\n R: { name: 'R', value: 1e54, scientific: true },\n Q: { name: 'Q', value: 1e60, scientific: true },\n\n d: { name: 'd', value: 1e-2, scientific: false },\n c: { name: 'c', value: 1e-4, scientific: false },\n m: { name: 'm', value: 1e-6, scientific: true },\n u: { name: 'u', value: 1e-12, scientific: true },\n n: { name: 'n', value: 1e-18, scientific: true },\n p: { name: 'p', value: 1e-24, scientific: true },\n f: { name: 'f', value: 1e-30, scientific: true },\n a: { name: 'a', value: 1e-36, scientific: true },\n z: { name: 'z', value: 1e-42, scientific: true },\n y: { name: 'y', value: 1e-48, scientific: true },\n r: { name: 'r', value: 1e-54, scientific: true },\n q: { name: 'q', value: 1e-60, scientific: true }\n },\n CUBIC: {\n '': { name: '', value: 1, scientific: true },\n\n da: { name: 'da', value: 1e3, scientific: false },\n h: { name: 'h', value: 1e6, scientific: false },\n k: { name: 'k', value: 1e9, scientific: true },\n M: { name: 'M', value: 1e18, scientific: true },\n G: { name: 'G', value: 1e27, scientific: true },\n T: { name: 'T', value: 1e36, scientific: true },\n P: { name: 'P', value: 1e45, scientific: true },\n E: { name: 'E', value: 1e54, scientific: true },\n Z: { name: 'Z', value: 1e63, scientific: true },\n Y: { name: 'Y', value: 1e72, scientific: true },\n R: { name: 'R', value: 1e81, scientific: true },\n Q: { name: 'Q', value: 1e90, scientific: true },\n\n d: { name: 'd', value: 1e-3, scientific: false },\n c: { name: 'c', value: 1e-6, scientific: false },\n m: { name: 'm', value: 1e-9, scientific: true },\n u: { name: 'u', value: 1e-18, scientific: true },\n n: { name: 'n', value: 1e-27, scientific: true },\n p: { name: 'p', value: 1e-36, scientific: true },\n f: { name: 'f', value: 1e-45, scientific: true },\n a: { name: 'a', value: 1e-54, scientific: true },\n z: { name: 'z', value: 1e-63, scientific: true },\n y: { name: 'y', value: 1e-72, scientific: true },\n r: { name: 'r', value: 1e-81, scientific: true },\n q: { name: 'q', value: 1e-90, scientific: true }\n },\n BINARY_SHORT_SI: {\n '': { name: '', value: 1, scientific: true },\n k: { name: 'k', value: 1e3, scientific: true },\n M: { name: 'M', value: 1e6, scientific: true },\n G: { name: 'G', value: 1e9, scientific: true },\n T: { name: 'T', value: 1e12, scientific: true },\n P: { name: 'P', value: 1e15, scientific: true },\n E: { name: 'E', value: 1e18, scientific: true },\n Z: { name: 'Z', value: 1e21, scientific: true },\n Y: { name: 'Y', value: 1e24, scientific: true }\n },\n BINARY_SHORT_IEC: {\n '': { name: '', value: 1, scientific: true },\n Ki: { name: 'Ki', value: 1024, scientific: true },\n Mi: { name: 'Mi', value: Math.pow(1024, 2), scientific: true },\n Gi: { name: 'Gi', value: Math.pow(1024, 3), scientific: true },\n Ti: { name: 'Ti', value: Math.pow(1024, 4), scientific: true },\n Pi: { name: 'Pi', value: Math.pow(1024, 5), scientific: true },\n Ei: { name: 'Ei', value: Math.pow(1024, 6), scientific: true },\n Zi: { name: 'Zi', value: Math.pow(1024, 7), scientific: true },\n Yi: { name: 'Yi', value: Math.pow(1024, 8), scientific: true }\n },\n BINARY_LONG_SI: {\n '': { name: '', value: 1, scientific: true },\n kilo: { name: 'kilo', value: 1e3, scientific: true },\n mega: { name: 'mega', value: 1e6, scientific: true },\n giga: { name: 'giga', value: 1e9, scientific: true },\n tera: { name: 'tera', value: 1e12, scientific: true },\n peta: { name: 'peta', value: 1e15, scientific: true },\n exa: { name: 'exa', value: 1e18, scientific: true },\n zetta: { name: 'zetta', value: 1e21, scientific: true },\n yotta: { name: 'yotta', value: 1e24, scientific: true }\n },\n BINARY_LONG_IEC: {\n '': { name: '', value: 1, scientific: true },\n kibi: { name: 'kibi', value: 1024, scientific: true },\n mebi: { name: 'mebi', value: Math.pow(1024, 2), scientific: true },\n gibi: { name: 'gibi', value: Math.pow(1024, 3), scientific: true },\n tebi: { name: 'tebi', value: Math.pow(1024, 4), scientific: true },\n pebi: { name: 'pebi', value: Math.pow(1024, 5), scientific: true },\n exi: { name: 'exi', value: Math.pow(1024, 6), scientific: true },\n zebi: { name: 'zebi', value: Math.pow(1024, 7), scientific: true },\n yobi: { name: 'yobi', value: Math.pow(1024, 8), scientific: true }\n },\n BTU: {\n '': { name: '', value: 1, scientific: true },\n MM: { name: 'MM', value: 1e6, scientific: true }\n }\n }\n\n PREFIXES.SHORTLONG = Object.assign({}, PREFIXES.SHORT, PREFIXES.LONG)\n PREFIXES.BINARY_SHORT = Object.assign({}, PREFIXES.BINARY_SHORT_SI, PREFIXES.BINARY_SHORT_IEC)\n PREFIXES.BINARY_LONG = Object.assign({}, PREFIXES.BINARY_LONG_SI, PREFIXES.BINARY_LONG_IEC)\n\n /* Internally, each unit is represented by a value and a dimension array. The elements of the dimensions array have the following meaning:\n * Index Dimension\n * ----- ---------\n * 0 Length\n * 1 Mass\n * 2 Time\n * 3 Current\n * 4 Temperature\n * 5 Luminous intensity\n * 6 Amount of substance\n * 7 Angle\n * 8 Bit (digital)\n * For example, the unit \"298.15 K\" is a pure temperature and would have a value of 298.15 and a dimension array of [0, 0, 0, 0, 1, 0, 0, 0, 0]. The unit \"1 cal / (gm °C)\" can be written in terms of the 9 fundamental dimensions as [length^2] / ([time^2] * [temperature]), and would a value of (after conversion to SI) 4184.0 and a dimensions array of [2, 0, -2, 0, -1, 0, 0, 0, 0].\n *\n */\n\n const BASE_DIMENSIONS = ['MASS', 'LENGTH', 'TIME', 'CURRENT', 'TEMPERATURE', 'LUMINOUS_INTENSITY', 'AMOUNT_OF_SUBSTANCE', 'ANGLE', 'BIT']\n\n const BASE_UNITS = {\n NONE: {\n dimensions: [0, 0, 0, 0, 0, 0, 0, 0, 0]\n },\n MASS: {\n dimensions: [1, 0, 0, 0, 0, 0, 0, 0, 0]\n },\n LENGTH: {\n dimensions: [0, 1, 0, 0, 0, 0, 0, 0, 0]\n },\n TIME: {\n dimensions: [0, 0, 1, 0, 0, 0, 0, 0, 0]\n },\n CURRENT: {\n dimensions: [0, 0, 0, 1, 0, 0, 0, 0, 0]\n },\n TEMPERATURE: {\n dimensions: [0, 0, 0, 0, 1, 0, 0, 0, 0]\n },\n LUMINOUS_INTENSITY: {\n dimensions: [0, 0, 0, 0, 0, 1, 0, 0, 0]\n },\n AMOUNT_OF_SUBSTANCE: {\n dimensions: [0, 0, 0, 0, 0, 0, 1, 0, 0]\n },\n\n FORCE: {\n dimensions: [1, 1, -2, 0, 0, 0, 0, 0, 0]\n },\n SURFACE: {\n dimensions: [0, 2, 0, 0, 0, 0, 0, 0, 0]\n },\n VOLUME: {\n dimensions: [0, 3, 0, 0, 0, 0, 0, 0, 0]\n },\n ENERGY: {\n dimensions: [1, 2, -2, 0, 0, 0, 0, 0, 0]\n },\n POWER: {\n dimensions: [1, 2, -3, 0, 0, 0, 0, 0, 0]\n },\n PRESSURE: {\n dimensions: [1, -1, -2, 0, 0, 0, 0, 0, 0]\n },\n\n ELECTRIC_CHARGE: {\n dimensions: [0, 0, 1, 1, 0, 0, 0, 0, 0]\n },\n ELECTRIC_CAPACITANCE: {\n dimensions: [-1, -2, 4, 2, 0, 0, 0, 0, 0]\n },\n ELECTRIC_POTENTIAL: {\n dimensions: [1, 2, -3, -1, 0, 0, 0, 0, 0]\n },\n ELECTRIC_RESISTANCE: {\n dimensions: [1, 2, -3, -2, 0, 0, 0, 0, 0]\n },\n ELECTRIC_INDUCTANCE: {\n dimensions: [1, 2, -2, -2, 0, 0, 0, 0, 0]\n },\n ELECTRIC_CONDUCTANCE: {\n dimensions: [-1, -2, 3, 2, 0, 0, 0, 0, 0]\n },\n MAGNETIC_FLUX: {\n dimensions: [1, 2, -2, -1, 0, 0, 0, 0, 0]\n },\n MAGNETIC_FLUX_DENSITY: {\n dimensions: [1, 0, -2, -1, 0, 0, 0, 0, 0]\n },\n\n FREQUENCY: {\n dimensions: [0, 0, -1, 0, 0, 0, 0, 0, 0]\n },\n ANGLE: {\n dimensions: [0, 0, 0, 0, 0, 0, 0, 1, 0]\n },\n BIT: {\n dimensions: [0, 0, 0, 0, 0, 0, 0, 0, 1]\n }\n }\n\n for (const key in BASE_UNITS) {\n if (hasOwnProperty(BASE_UNITS, key)) {\n BASE_UNITS[key].key = key\n }\n }\n\n const BASE_UNIT_NONE = {}\n\n const UNIT_NONE = { name: '', base: BASE_UNIT_NONE, value: 1, offset: 0, dimensions: BASE_DIMENSIONS.map(x => 0) }\n\n const UNITS = {\n // length\n meter: {\n name: 'meter',\n base: BASE_UNITS.LENGTH,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0\n },\n inch: {\n name: 'inch',\n base: BASE_UNITS.LENGTH,\n prefixes: PREFIXES.NONE,\n value: 0.0254,\n offset: 0\n },\n foot: {\n name: 'foot',\n base: BASE_UNITS.LENGTH,\n prefixes: PREFIXES.NONE,\n value: 0.3048,\n offset: 0\n },\n yard: {\n name: 'yard',\n base: BASE_UNITS.LENGTH,\n prefixes: PREFIXES.NONE,\n value: 0.9144,\n offset: 0\n },\n mile: {\n name: 'mile',\n base: BASE_UNITS.LENGTH,\n prefixes: PREFIXES.NONE,\n value: 1609.344,\n offset: 0\n },\n link: {\n name: 'link',\n base: BASE_UNITS.LENGTH,\n prefixes: PREFIXES.NONE,\n value: 0.201168,\n offset: 0\n },\n rod: {\n name: 'rod',\n base: BASE_UNITS.LENGTH,\n prefixes: PREFIXES.NONE,\n value: 5.0292,\n offset: 0\n },\n chain: {\n name: 'chain',\n base: BASE_UNITS.LENGTH,\n prefixes: PREFIXES.NONE,\n value: 20.1168,\n offset: 0\n },\n angstrom: {\n name: 'angstrom',\n base: BASE_UNITS.LENGTH,\n prefixes: PREFIXES.NONE,\n value: 1e-10,\n offset: 0\n },\n\n m: {\n name: 'm',\n base: BASE_UNITS.LENGTH,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n in: {\n name: 'in',\n base: BASE_UNITS.LENGTH,\n prefixes: PREFIXES.NONE,\n value: 0.0254,\n offset: 0\n },\n ft: {\n name: 'ft',\n base: BASE_UNITS.LENGTH,\n prefixes: PREFIXES.NONE,\n value: 0.3048,\n offset: 0\n },\n yd: {\n name: 'yd',\n base: BASE_UNITS.LENGTH,\n prefixes: PREFIXES.NONE,\n value: 0.9144,\n offset: 0\n },\n mi: {\n name: 'mi',\n base: BASE_UNITS.LENGTH,\n prefixes: PREFIXES.NONE,\n value: 1609.344,\n offset: 0\n },\n li: {\n name: 'li',\n base: BASE_UNITS.LENGTH,\n prefixes: PREFIXES.NONE,\n value: 0.201168,\n offset: 0\n },\n rd: {\n name: 'rd',\n base: BASE_UNITS.LENGTH,\n prefixes: PREFIXES.NONE,\n value: 5.029210,\n offset: 0\n },\n ch: {\n name: 'ch',\n base: BASE_UNITS.LENGTH,\n prefixes: PREFIXES.NONE,\n value: 20.1168,\n offset: 0\n },\n mil: {\n name: 'mil',\n base: BASE_UNITS.LENGTH,\n prefixes: PREFIXES.NONE,\n value: 0.0000254,\n offset: 0\n }, // 1/1000 inch\n\n // Surface\n m2: {\n name: 'm2',\n base: BASE_UNITS.SURFACE,\n prefixes: PREFIXES.SQUARED,\n value: 1,\n offset: 0\n },\n sqin: {\n name: 'sqin',\n base: BASE_UNITS.SURFACE,\n prefixes: PREFIXES.NONE,\n value: 0.00064516,\n offset: 0\n }, // 645.16 mm2\n sqft: {\n name: 'sqft',\n base: BASE_UNITS.SURFACE,\n prefixes: PREFIXES.NONE,\n value: 0.09290304,\n offset: 0\n }, // 0.09290304 m2\n sqyd: {\n name: 'sqyd',\n base: BASE_UNITS.SURFACE,\n prefixes: PREFIXES.NONE,\n value: 0.83612736,\n offset: 0\n }, // 0.83612736 m2\n sqmi: {\n name: 'sqmi',\n base: BASE_UNITS.SURFACE,\n prefixes: PREFIXES.NONE,\n value: 2589988.110336,\n offset: 0\n }, // 2.589988110336 km2\n sqrd: {\n name: 'sqrd',\n base: BASE_UNITS.SURFACE,\n prefixes: PREFIXES.NONE,\n value: 25.29295,\n offset: 0\n }, // 25.29295 m2\n sqch: {\n name: 'sqch',\n base: BASE_UNITS.SURFACE,\n prefixes: PREFIXES.NONE,\n value: 404.6873,\n offset: 0\n }, // 404.6873 m2\n sqmil: {\n name: 'sqmil',\n base: BASE_UNITS.SURFACE,\n prefixes: PREFIXES.NONE,\n value: 6.4516e-10,\n offset: 0\n }, // 6.4516 * 10^-10 m2\n acre: {\n name: 'acre',\n base: BASE_UNITS.SURFACE,\n prefixes: PREFIXES.NONE,\n value: 4046.86,\n offset: 0\n }, // 4046.86 m2\n hectare: {\n name: 'hectare',\n base: BASE_UNITS.SURFACE,\n prefixes: PREFIXES.NONE,\n value: 10000,\n offset: 0\n }, // 10000 m2\n\n // Volume\n m3: {\n name: 'm3',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.CUBIC,\n value: 1,\n offset: 0\n },\n L: {\n name: 'L',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.SHORT,\n value: 0.001,\n offset: 0\n }, // litre\n l: {\n name: 'l',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.SHORT,\n value: 0.001,\n offset: 0\n }, // litre\n litre: {\n name: 'litre',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.LONG,\n value: 0.001,\n offset: 0\n },\n cuin: {\n name: 'cuin',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 1.6387064e-5,\n offset: 0\n }, // 1.6387064e-5 m3\n cuft: {\n name: 'cuft',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 0.028316846592,\n offset: 0\n }, // 28.316 846 592 L\n cuyd: {\n name: 'cuyd',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 0.764554857984,\n offset: 0\n }, // 764.554 857 984 L\n teaspoon: {\n name: 'teaspoon',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 0.000005,\n offset: 0\n }, // 5 mL\n tablespoon: {\n name: 'tablespoon',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 0.000015,\n offset: 0\n }, // 15 mL\n // {name: 'cup', base: BASE_UNITS.VOLUME, prefixes: PREFIXES.NONE, value: 0.000240, offset: 0}, // 240 mL // not possible, we have already another cup\n drop: {\n name: 'drop',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 5e-8,\n offset: 0\n }, // 0.05 mL = 5e-8 m3\n gtt: {\n name: 'gtt',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 5e-8,\n offset: 0\n }, // 0.05 mL = 5e-8 m3\n\n // Liquid volume\n minim: {\n name: 'minim',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 0.000000061611519921875,\n offset: 0\n }, // 1/61440 gallons\n fluiddram: {\n name: 'fluiddram',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 0.0000036966911953125,\n offset: 0\n }, // 1/1024 gallons\n fluidounce: {\n name: 'fluidounce',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 0.0000295735295625,\n offset: 0\n }, // 1/128 gallons\n gill: {\n name: 'gill',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 0.00011829411825,\n offset: 0\n }, // 1/32 gallons\n cc: {\n name: 'cc',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 1e-6,\n offset: 0\n }, // 1e-6 L\n cup: {\n name: 'cup',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 0.0002365882365,\n offset: 0\n }, // 1/16 gallons\n pint: {\n name: 'pint',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 0.000473176473,\n offset: 0\n }, // 1/8 gallons\n quart: {\n name: 'quart',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 0.000946352946,\n offset: 0\n }, // 1/4 gallons\n gallon: {\n name: 'gallon',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 0.003785411784,\n offset: 0\n }, // 3.785411784 L\n beerbarrel: {\n name: 'beerbarrel',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 0.117347765304,\n offset: 0\n }, // 31 gallons\n oilbarrel: {\n name: 'oilbarrel',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 0.158987294928,\n offset: 0\n }, // 42 gallons\n hogshead: {\n name: 'hogshead',\n base: BASE_UNITS.VOLUME,\n prefixes: PREFIXES.NONE,\n value: 0.238480942392,\n offset: 0\n }, // 63 gallons\n\n // Mass\n g: {\n name: 'g',\n base: BASE_UNITS.MASS,\n prefixes: PREFIXES.SHORT,\n value: 0.001,\n offset: 0\n },\n gram: {\n name: 'gram',\n base: BASE_UNITS.MASS,\n prefixes: PREFIXES.LONG,\n value: 0.001,\n offset: 0\n },\n\n ton: {\n name: 'ton',\n base: BASE_UNITS.MASS,\n prefixes: PREFIXES.SHORT,\n value: 907.18474,\n offset: 0\n },\n t: {\n name: 't',\n base: BASE_UNITS.MASS,\n prefixes: PREFIXES.SHORT,\n value: 1000,\n offset: 0\n },\n tonne: {\n name: 'tonne',\n base: BASE_UNITS.MASS,\n prefixes: PREFIXES.LONG,\n value: 1000,\n offset: 0\n },\n\n grain: {\n name: 'grain',\n base: BASE_UNITS.MASS,\n prefixes: PREFIXES.NONE,\n value: 64.79891e-6,\n offset: 0\n },\n dram: {\n name: 'dram',\n base: BASE_UNITS.MASS,\n prefixes: PREFIXES.NONE,\n value: 1.7718451953125e-3,\n offset: 0\n },\n ounce: {\n name: 'ounce',\n base: BASE_UNITS.MASS,\n prefixes: PREFIXES.NONE,\n value: 28.349523125e-3,\n offset: 0\n },\n poundmass: {\n name: 'poundmass',\n base: BASE_UNITS.MASS,\n prefixes: PREFIXES.NONE,\n value: 453.59237e-3,\n offset: 0\n },\n hundredweight: {\n name: 'hundredweight',\n base: BASE_UNITS.MASS,\n prefixes: PREFIXES.NONE,\n value: 45.359237,\n offset: 0\n },\n stick: {\n name: 'stick',\n base: BASE_UNITS.MASS,\n prefixes: PREFIXES.NONE,\n value: 115e-3,\n offset: 0\n },\n stone: {\n name: 'stone',\n base: BASE_UNITS.MASS,\n prefixes: PREFIXES.NONE,\n value: 6.35029318,\n offset: 0\n },\n\n gr: {\n name: 'gr',\n base: BASE_UNITS.MASS,\n prefixes: PREFIXES.NONE,\n value: 64.79891e-6,\n offset: 0\n },\n dr: {\n name: 'dr',\n base: BASE_UNITS.MASS,\n prefixes: PREFIXES.NONE,\n value: 1.7718451953125e-3,\n offset: 0\n },\n oz: {\n name: 'oz',\n base: BASE_UNITS.MASS,\n prefixes: PREFIXES.NONE,\n value: 28.349523125e-3,\n offset: 0\n },\n lbm: {\n name: 'lbm',\n base: BASE_UNITS.MASS,\n prefixes: PREFIXES.NONE,\n value: 453.59237e-3,\n offset: 0\n },\n cwt: {\n name: 'cwt',\n base: BASE_UNITS.MASS,\n prefixes: PREFIXES.NONE,\n value: 45.359237,\n offset: 0\n },\n\n // Time\n s: {\n name: 's',\n base: BASE_UNITS.TIME,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n min: {\n name: 'min',\n base: BASE_UNITS.TIME,\n prefixes: PREFIXES.NONE,\n value: 60,\n offset: 0\n },\n h: {\n name: 'h',\n base: BASE_UNITS.TIME,\n prefixes: PREFIXES.NONE,\n value: 3600,\n offset: 0\n },\n second: {\n name: 'second',\n base: BASE_UNITS.TIME,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0\n },\n sec: {\n name: 'sec',\n base: BASE_UNITS.TIME,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0\n },\n minute: {\n name: 'minute',\n base: BASE_UNITS.TIME,\n prefixes: PREFIXES.NONE,\n value: 60,\n offset: 0\n },\n hour: {\n name: 'hour',\n base: BASE_UNITS.TIME,\n prefixes: PREFIXES.NONE,\n value: 3600,\n offset: 0\n },\n day: {\n name: 'day',\n base: BASE_UNITS.TIME,\n prefixes: PREFIXES.NONE,\n value: 86400,\n offset: 0\n },\n week: {\n name: 'week',\n base: BASE_UNITS.TIME,\n prefixes: PREFIXES.NONE,\n value: 7 * 86400,\n offset: 0\n },\n month: {\n name: 'month',\n base: BASE_UNITS.TIME,\n prefixes: PREFIXES.NONE,\n value: 2629800, // 1/12th of Julian year\n offset: 0\n },\n year: {\n name: 'year',\n base: BASE_UNITS.TIME,\n prefixes: PREFIXES.NONE,\n value: 31557600, // Julian year\n offset: 0\n },\n decade: {\n name: 'decade',\n base: BASE_UNITS.TIME,\n prefixes: PREFIXES.NONE,\n value: 315576000, // Julian decade\n offset: 0\n },\n century: {\n name: 'century',\n base: BASE_UNITS.TIME,\n prefixes: PREFIXES.NONE,\n value: 3155760000, // Julian century\n offset: 0\n },\n millennium: {\n name: 'millennium',\n base: BASE_UNITS.TIME,\n prefixes: PREFIXES.NONE,\n value: 31557600000, // Julian millennium\n offset: 0\n },\n\n // Frequency\n hertz: {\n name: 'Hertz',\n base: BASE_UNITS.FREQUENCY,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0,\n reciprocal: true\n },\n Hz: {\n name: 'Hz',\n base: BASE_UNITS.FREQUENCY,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0,\n reciprocal: true\n },\n\n // Angle\n rad: {\n name: 'rad',\n base: BASE_UNITS.ANGLE,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n radian: {\n name: 'radian',\n base: BASE_UNITS.ANGLE,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0\n },\n // deg = rad / (2*pi) * 360 = rad / 0.017453292519943295769236907684888\n deg: {\n name: 'deg',\n base: BASE_UNITS.ANGLE,\n prefixes: PREFIXES.SHORT,\n value: null, // will be filled in by calculateAngleValues()\n offset: 0\n },\n degree: {\n name: 'degree',\n base: BASE_UNITS.ANGLE,\n prefixes: PREFIXES.LONG,\n value: null, // will be filled in by calculateAngleValues()\n offset: 0\n },\n // grad = rad / (2*pi) * 400 = rad / 0.015707963267948966192313216916399\n grad: {\n name: 'grad',\n base: BASE_UNITS.ANGLE,\n prefixes: PREFIXES.SHORT,\n value: null, // will be filled in by calculateAngleValues()\n offset: 0\n },\n gradian: {\n name: 'gradian',\n base: BASE_UNITS.ANGLE,\n prefixes: PREFIXES.LONG,\n value: null, // will be filled in by calculateAngleValues()\n offset: 0\n },\n // cycle = rad / (2*pi) = rad / 6.2831853071795864769252867665793\n cycle: {\n name: 'cycle',\n base: BASE_UNITS.ANGLE,\n prefixes: PREFIXES.NONE,\n value: null, // will be filled in by calculateAngleValues()\n offset: 0\n },\n // arcsec = rad / (3600 * (360 / 2 * pi)) = rad / 0.0000048481368110953599358991410235795\n arcsec: {\n name: 'arcsec',\n base: BASE_UNITS.ANGLE,\n prefixes: PREFIXES.NONE,\n value: null, // will be filled in by calculateAngleValues()\n offset: 0\n },\n // arcmin = rad / (60 * (360 / 2 * pi)) = rad / 0.00029088820866572159615394846141477\n arcmin: {\n name: 'arcmin',\n base: BASE_UNITS.ANGLE,\n prefixes: PREFIXES.NONE,\n value: null, // will be filled in by calculateAngleValues()\n offset: 0\n },\n\n // Electric current\n A: {\n name: 'A',\n base: BASE_UNITS.CURRENT,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n ampere: {\n name: 'ampere',\n base: BASE_UNITS.CURRENT,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0\n },\n\n // Temperature\n // K(C) = °C + 273.15\n // K(F) = (°F + 459.67) * (5 / 9)\n // K(R) = °R * (5 / 9)\n K: {\n name: 'K',\n base: BASE_UNITS.TEMPERATURE,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n degC: {\n name: 'degC',\n base: BASE_UNITS.TEMPERATURE,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 273.15\n },\n degF: {\n name: 'degF',\n base: BASE_UNITS.TEMPERATURE,\n prefixes: PREFIXES.SHORT,\n value: new Fraction(5, 9),\n offset: 459.67\n },\n degR: {\n name: 'degR',\n base: BASE_UNITS.TEMPERATURE,\n prefixes: PREFIXES.SHORT,\n value: new Fraction(5, 9),\n offset: 0\n },\n kelvin: {\n name: 'kelvin',\n base: BASE_UNITS.TEMPERATURE,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0\n },\n celsius: {\n name: 'celsius',\n base: BASE_UNITS.TEMPERATURE,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 273.15\n },\n fahrenheit: {\n name: 'fahrenheit',\n base: BASE_UNITS.TEMPERATURE,\n prefixes: PREFIXES.LONG,\n value: new Fraction(5, 9),\n offset: 459.67\n },\n rankine: {\n name: 'rankine',\n base: BASE_UNITS.TEMPERATURE,\n prefixes: PREFIXES.LONG,\n value: new Fraction(5, 9),\n offset: 0\n },\n\n // amount of substance\n mol: {\n name: 'mol',\n base: BASE_UNITS.AMOUNT_OF_SUBSTANCE,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n mole: {\n name: 'mole',\n base: BASE_UNITS.AMOUNT_OF_SUBSTANCE,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0\n },\n\n // luminous intensity\n cd: {\n name: 'cd',\n base: BASE_UNITS.LUMINOUS_INTENSITY,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n candela: {\n name: 'candela',\n base: BASE_UNITS.LUMINOUS_INTENSITY,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0\n },\n // TODO: units STERADIAN\n // {name: 'sr', base: BASE_UNITS.STERADIAN, prefixes: PREFIXES.NONE, value: 1, offset: 0},\n // {name: 'steradian', base: BASE_UNITS.STERADIAN, prefixes: PREFIXES.NONE, value: 1, offset: 0},\n\n // Force\n N: {\n name: 'N',\n base: BASE_UNITS.FORCE,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n newton: {\n name: 'newton',\n base: BASE_UNITS.FORCE,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0\n },\n dyn: {\n name: 'dyn',\n base: BASE_UNITS.FORCE,\n prefixes: PREFIXES.SHORT,\n value: 0.00001,\n offset: 0\n },\n dyne: {\n name: 'dyne',\n base: BASE_UNITS.FORCE,\n prefixes: PREFIXES.LONG,\n value: 0.00001,\n offset: 0\n },\n lbf: {\n name: 'lbf',\n base: BASE_UNITS.FORCE,\n prefixes: PREFIXES.NONE,\n value: 4.4482216152605,\n offset: 0\n },\n poundforce: {\n name: 'poundforce',\n base: BASE_UNITS.FORCE,\n prefixes: PREFIXES.NONE,\n value: 4.4482216152605,\n offset: 0\n },\n kip: {\n name: 'kip',\n base: BASE_UNITS.FORCE,\n prefixes: PREFIXES.LONG,\n value: 4448.2216,\n offset: 0\n },\n kilogramforce: {\n name: 'kilogramforce',\n base: BASE_UNITS.FORCE,\n prefixes: PREFIXES.NONE,\n value: 9.80665,\n offset: 0\n },\n\n // Energy\n J: {\n name: 'J',\n base: BASE_UNITS.ENERGY,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n joule: {\n name: 'joule',\n base: BASE_UNITS.ENERGY,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0\n },\n erg: {\n name: 'erg',\n base: BASE_UNITS.ENERGY,\n prefixes: PREFIXES.SHORTLONG, // Both kiloerg and kerg are acceptable\n value: 1e-7,\n offset: 0\n },\n Wh: {\n name: 'Wh',\n base: BASE_UNITS.ENERGY,\n prefixes: PREFIXES.SHORT,\n value: 3600,\n offset: 0\n },\n BTU: {\n name: 'BTU',\n base: BASE_UNITS.ENERGY,\n prefixes: PREFIXES.BTU,\n value: 1055.05585262,\n offset: 0\n },\n eV: {\n name: 'eV',\n base: BASE_UNITS.ENERGY,\n prefixes: PREFIXES.SHORT,\n value: 1.602176565e-19,\n offset: 0\n },\n electronvolt: {\n name: 'electronvolt',\n base: BASE_UNITS.ENERGY,\n prefixes: PREFIXES.LONG,\n value: 1.602176565e-19,\n offset: 0\n },\n\n // Power\n W: {\n name: 'W',\n base: BASE_UNITS.POWER,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n watt: {\n name: 'watt',\n base: BASE_UNITS.POWER,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0\n },\n hp: {\n name: 'hp',\n base: BASE_UNITS.POWER,\n prefixes: PREFIXES.NONE,\n value: 745.6998715386,\n offset: 0\n },\n\n // Electrical power units\n VAR: {\n name: 'VAR',\n base: BASE_UNITS.POWER,\n prefixes: PREFIXES.SHORT,\n value: Complex.I,\n offset: 0\n },\n\n VA: {\n name: 'VA',\n base: BASE_UNITS.POWER,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n\n // Pressure\n Pa: {\n name: 'Pa',\n base: BASE_UNITS.PRESSURE,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n psi: {\n name: 'psi',\n base: BASE_UNITS.PRESSURE,\n prefixes: PREFIXES.NONE,\n value: 6894.75729276459,\n offset: 0\n },\n atm: {\n name: 'atm',\n base: BASE_UNITS.PRESSURE,\n prefixes: PREFIXES.NONE,\n value: 101325,\n offset: 0\n },\n bar: {\n name: 'bar',\n base: BASE_UNITS.PRESSURE,\n prefixes: PREFIXES.SHORTLONG,\n value: 100000,\n offset: 0\n },\n torr: {\n name: 'torr',\n base: BASE_UNITS.PRESSURE,\n prefixes: PREFIXES.NONE,\n value: 133.322,\n offset: 0\n },\n mmHg: {\n name: 'mmHg',\n base: BASE_UNITS.PRESSURE,\n prefixes: PREFIXES.NONE,\n value: 133.322,\n offset: 0\n },\n mmH2O: {\n name: 'mmH2O',\n base: BASE_UNITS.PRESSURE,\n prefixes: PREFIXES.NONE,\n value: 9.80665,\n offset: 0\n },\n cmH2O: {\n name: 'cmH2O',\n base: BASE_UNITS.PRESSURE,\n prefixes: PREFIXES.NONE,\n value: 98.0665,\n offset: 0\n },\n\n // Electric charge\n coulomb: {\n name: 'coulomb',\n base: BASE_UNITS.ELECTRIC_CHARGE,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0\n },\n C: {\n name: 'C',\n base: BASE_UNITS.ELECTRIC_CHARGE,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n // Electric capacitance\n farad: {\n name: 'farad',\n base: BASE_UNITS.ELECTRIC_CAPACITANCE,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0\n },\n F: {\n name: 'F',\n base: BASE_UNITS.ELECTRIC_CAPACITANCE,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n // Electric potential\n volt: {\n name: 'volt',\n base: BASE_UNITS.ELECTRIC_POTENTIAL,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0\n },\n V: {\n name: 'V',\n base: BASE_UNITS.ELECTRIC_POTENTIAL,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n // Electric resistance\n ohm: {\n name: 'ohm',\n base: BASE_UNITS.ELECTRIC_RESISTANCE,\n prefixes: PREFIXES.SHORTLONG, // Both Mohm and megaohm are acceptable\n value: 1,\n offset: 0\n },\n /*\n * Unicode breaks in browsers if charset is not specified\n Ω: {\n name: 'Ω',\n base: BASE_UNITS.ELECTRIC_RESISTANCE,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n */\n // Electric inductance\n henry: {\n name: 'henry',\n base: BASE_UNITS.ELECTRIC_INDUCTANCE,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0\n },\n H: {\n name: 'H',\n base: BASE_UNITS.ELECTRIC_INDUCTANCE,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n // Electric conductance\n siemens: {\n name: 'siemens',\n base: BASE_UNITS.ELECTRIC_CONDUCTANCE,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0\n },\n S: {\n name: 'S',\n base: BASE_UNITS.ELECTRIC_CONDUCTANCE,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n // Magnetic flux\n weber: {\n name: 'weber',\n base: BASE_UNITS.MAGNETIC_FLUX,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0\n },\n Wb: {\n name: 'Wb',\n base: BASE_UNITS.MAGNETIC_FLUX,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n // Magnetic flux density\n tesla: {\n name: 'tesla',\n base: BASE_UNITS.MAGNETIC_FLUX_DENSITY,\n prefixes: PREFIXES.LONG,\n value: 1,\n offset: 0\n },\n T: {\n name: 'T',\n base: BASE_UNITS.MAGNETIC_FLUX_DENSITY,\n prefixes: PREFIXES.SHORT,\n value: 1,\n offset: 0\n },\n\n // Binary\n b: {\n name: 'b',\n base: BASE_UNITS.BIT,\n prefixes: PREFIXES.BINARY_SHORT,\n value: 1,\n offset: 0\n },\n bits: {\n name: 'bits',\n base: BASE_UNITS.BIT,\n prefixes: PREFIXES.BINARY_LONG,\n value: 1,\n offset: 0\n },\n B: {\n name: 'B',\n base: BASE_UNITS.BIT,\n prefixes: PREFIXES.BINARY_SHORT,\n value: 8,\n offset: 0\n },\n bytes: {\n name: 'bytes',\n base: BASE_UNITS.BIT,\n prefixes: PREFIXES.BINARY_LONG,\n value: 8,\n offset: 0\n }\n }\n\n // aliases (formerly plurals)\n // note that ALIASES is only used at creation to create more entries in UNITS by copying the aliased units\n const ALIASES = {\n meters: 'meter',\n inches: 'inch',\n feet: 'foot',\n yards: 'yard',\n miles: 'mile',\n links: 'link',\n rods: 'rod',\n chains: 'chain',\n angstroms: 'angstrom',\n\n lt: 'l',\n litres: 'litre',\n liter: 'litre',\n liters: 'litre',\n teaspoons: 'teaspoon',\n tablespoons: 'tablespoon',\n minims: 'minim',\n fldr: 'fluiddram',\n fluiddrams: 'fluiddram',\n floz: 'fluidounce',\n fluidounces: 'fluidounce',\n gi: 'gill',\n gills: 'gill',\n cp: 'cup',\n cups: 'cup',\n pt: 'pint',\n pints: 'pint',\n qt: 'quart',\n quarts: 'quart',\n gal: 'gallon',\n gallons: 'gallon',\n bbl: 'beerbarrel',\n beerbarrels: 'beerbarrel',\n obl: 'oilbarrel',\n oilbarrels: 'oilbarrel',\n hogsheads: 'hogshead',\n gtts: 'gtt',\n\n grams: 'gram',\n tons: 'ton',\n tonnes: 'tonne',\n grains: 'grain',\n drams: 'dram',\n ounces: 'ounce',\n poundmasses: 'poundmass',\n hundredweights: 'hundredweight',\n sticks: 'stick',\n lb: 'lbm',\n lbs: 'lbm',\n\n kips: 'kip',\n kgf: 'kilogramforce',\n\n acres: 'acre',\n hectares: 'hectare',\n sqfeet: 'sqft',\n sqyard: 'sqyd',\n sqmile: 'sqmi',\n sqmiles: 'sqmi',\n\n mmhg: 'mmHg',\n mmh2o: 'mmH2O',\n cmh2o: 'cmH2O',\n\n seconds: 'second',\n secs: 'second',\n minutes: 'minute',\n mins: 'minute',\n hours: 'hour',\n hr: 'hour',\n hrs: 'hour',\n days: 'day',\n weeks: 'week',\n months: 'month',\n years: 'year',\n decades: 'decade',\n centuries: 'century',\n millennia: 'millennium',\n\n hertz: 'hertz',\n\n radians: 'radian',\n degrees: 'degree',\n gradians: 'gradian',\n cycles: 'cycle',\n arcsecond: 'arcsec',\n arcseconds: 'arcsec',\n arcminute: 'arcmin',\n arcminutes: 'arcmin',\n\n BTUs: 'BTU',\n watts: 'watt',\n joules: 'joule',\n\n amperes: 'ampere',\n amps: 'ampere',\n amp: 'ampere',\n coulombs: 'coulomb',\n volts: 'volt',\n ohms: 'ohm',\n farads: 'farad',\n webers: 'weber',\n teslas: 'tesla',\n electronvolts: 'electronvolt',\n moles: 'mole',\n\n bit: 'bits',\n byte: 'bytes'\n }\n\n /**\n * Calculate the values for the angle units.\n * Value is calculated as number or BigNumber depending on the configuration\n * @param {{number: 'number' | 'BigNumber'}} config\n */\n function calculateAngleValues (config) {\n if (config.number === 'BigNumber') {\n const pi = createPi(BigNumber)\n UNITS.rad.value = new BigNumber(1)\n UNITS.deg.value = pi.div(180) // 2 * pi / 360\n UNITS.grad.value = pi.div(200) // 2 * pi / 400\n UNITS.cycle.value = pi.times(2) // 2 * pi\n UNITS.arcsec.value = pi.div(648000) // 2 * pi / 360 / 3600\n UNITS.arcmin.value = pi.div(10800) // 2 * pi / 360 / 60\n } else { // number\n UNITS.rad.value = 1\n UNITS.deg.value = Math.PI / 180 // 2 * pi / 360\n UNITS.grad.value = Math.PI / 200 // 2 * pi / 400\n UNITS.cycle.value = Math.PI * 2 // 2 * pi\n UNITS.arcsec.value = Math.PI / 648000 // 2 * pi / 360 / 3600\n UNITS.arcmin.value = Math.PI / 10800 // 2 * pi / 360 / 60\n }\n\n // copy to the full names of the angles\n UNITS.radian.value = UNITS.rad.value\n UNITS.degree.value = UNITS.deg.value\n UNITS.gradian.value = UNITS.grad.value\n }\n\n // apply the angle values now\n calculateAngleValues(config)\n\n if (on) {\n // recalculate the values on change of configuration\n on('config', function (curr, prev) {\n if (curr.number !== prev.number) {\n calculateAngleValues(curr)\n }\n })\n }\n\n /**\n * A unit system is a set of dimensionally independent base units plus a set of derived units, formed by multiplication and division of the base units, that are by convention used with the unit system.\n * A user perhaps could issue a command to select a preferred unit system, or use the default (see below).\n * Auto unit system: The default unit system is updated on the fly anytime a unit is parsed. The corresponding unit in the default unit system is updated, so that answers are given in the same units the user supplies.\n */\n const UNIT_SYSTEMS = {\n si: {\n // Base units\n NONE: { unit: UNIT_NONE, prefix: PREFIXES.NONE[''] },\n LENGTH: { unit: UNITS.m, prefix: PREFIXES.SHORT[''] },\n MASS: { unit: UNITS.g, prefix: PREFIXES.SHORT.k },\n TIME: { unit: UNITS.s, prefix: PREFIXES.SHORT[''] },\n CURRENT: { unit: UNITS.A, prefix: PREFIXES.SHORT[''] },\n TEMPERATURE: { unit: UNITS.K, prefix: PREFIXES.SHORT[''] },\n LUMINOUS_INTENSITY: { unit: UNITS.cd, prefix: PREFIXES.SHORT[''] },\n AMOUNT_OF_SUBSTANCE: { unit: UNITS.mol, prefix: PREFIXES.SHORT[''] },\n ANGLE: { unit: UNITS.rad, prefix: PREFIXES.SHORT[''] },\n BIT: { unit: UNITS.bits, prefix: PREFIXES.SHORT[''] },\n\n // Derived units\n FORCE: { unit: UNITS.N, prefix: PREFIXES.SHORT[''] },\n ENERGY: { unit: UNITS.J, prefix: PREFIXES.SHORT[''] },\n POWER: { unit: UNITS.W, prefix: PREFIXES.SHORT[''] },\n PRESSURE: { unit: UNITS.Pa, prefix: PREFIXES.SHORT[''] },\n ELECTRIC_CHARGE: { unit: UNITS.C, prefix: PREFIXES.SHORT[''] },\n ELECTRIC_CAPACITANCE: { unit: UNITS.F, prefix: PREFIXES.SHORT[''] },\n ELECTRIC_POTENTIAL: { unit: UNITS.V, prefix: PREFIXES.SHORT[''] },\n ELECTRIC_RESISTANCE: { unit: UNITS.ohm, prefix: PREFIXES.SHORT[''] },\n ELECTRIC_INDUCTANCE: { unit: UNITS.H, prefix: PREFIXES.SHORT[''] },\n ELECTRIC_CONDUCTANCE: { unit: UNITS.S, prefix: PREFIXES.SHORT[''] },\n MAGNETIC_FLUX: { unit: UNITS.Wb, prefix: PREFIXES.SHORT[''] },\n MAGNETIC_FLUX_DENSITY: { unit: UNITS.T, prefix: PREFIXES.SHORT[''] },\n FREQUENCY: { unit: UNITS.Hz, prefix: PREFIXES.SHORT[''] }\n }\n }\n\n // Clone to create the other unit systems\n UNIT_SYSTEMS.cgs = JSON.parse(JSON.stringify(UNIT_SYSTEMS.si))\n UNIT_SYSTEMS.cgs.LENGTH = { unit: UNITS.m, prefix: PREFIXES.SHORT.c }\n UNIT_SYSTEMS.cgs.MASS = { unit: UNITS.g, prefix: PREFIXES.SHORT[''] }\n UNIT_SYSTEMS.cgs.FORCE = { unit: UNITS.dyn, prefix: PREFIXES.SHORT[''] }\n UNIT_SYSTEMS.cgs.ENERGY = { unit: UNITS.erg, prefix: PREFIXES.NONE[''] }\n // there are wholly 4 unique cgs systems for electricity and magnetism,\n // so let's not worry about it unless somebody complains\n\n UNIT_SYSTEMS.us = JSON.parse(JSON.stringify(UNIT_SYSTEMS.si))\n UNIT_SYSTEMS.us.LENGTH = { unit: UNITS.ft, prefix: PREFIXES.NONE[''] }\n UNIT_SYSTEMS.us.MASS = { unit: UNITS.lbm, prefix: PREFIXES.NONE[''] }\n UNIT_SYSTEMS.us.TEMPERATURE = { unit: UNITS.degF, prefix: PREFIXES.NONE[''] }\n UNIT_SYSTEMS.us.FORCE = { unit: UNITS.lbf, prefix: PREFIXES.NONE[''] }\n UNIT_SYSTEMS.us.ENERGY = { unit: UNITS.BTU, prefix: PREFIXES.BTU[''] }\n UNIT_SYSTEMS.us.POWER = { unit: UNITS.hp, prefix: PREFIXES.NONE[''] }\n UNIT_SYSTEMS.us.PRESSURE = { unit: UNITS.psi, prefix: PREFIXES.NONE[''] }\n\n // Add additional unit systems here.\n\n // Choose a unit system to seed the auto unit system.\n UNIT_SYSTEMS.auto = JSON.parse(JSON.stringify(UNIT_SYSTEMS.si))\n\n // Set the current unit system\n let currentUnitSystem = UNIT_SYSTEMS.auto\n\n /**\n * Set a unit system for formatting derived units.\n * @memberof Unit\n * @param {string} [name] The name of the unit system.\n */\n Unit.setUnitSystem = function (name) {\n if (hasOwnProperty(UNIT_SYSTEMS, name)) {\n currentUnitSystem = UNIT_SYSTEMS[name]\n } else {\n throw new Error('Unit system ' + name + ' does not exist. Choices are: ' + Object.keys(UNIT_SYSTEMS).join(', '))\n }\n }\n\n /**\n * Return the current unit system.\n * @memberof Unit\n * @return {string} The current unit system.\n */\n Unit.getUnitSystem = function () {\n for (const key in UNIT_SYSTEMS) {\n if (hasOwnProperty(UNIT_SYSTEMS, key)) {\n if (UNIT_SYSTEMS[key] === currentUnitSystem) {\n return key\n }\n }\n }\n }\n\n /**\n * Converters to convert from number to an other numeric type like BigNumber\n * or Fraction\n */\n Unit.typeConverters = {\n BigNumber: function (x) {\n if (x?.isFraction) return new BigNumber(String(x.n)).div(String(x.d)).times(String(x.s))\n return new BigNumber(x + '') // stringify to prevent constructor error\n },\n\n Fraction: function (x) {\n return new Fraction(x)\n },\n\n Complex: function (x) {\n return x\n },\n\n number: function (x) {\n if (x?.isFraction) return number(x)\n return x\n }\n }\n\n /**\n * Retrieve the right converter function corresponding with this unit's\n * value\n *\n * @memberof Unit\n * @return {Function}\n */\n Unit.prototype._numberConverter = function () {\n const convert = Unit.typeConverters[this.valueType()]\n if (convert) {\n return convert\n }\n throw new TypeError('Unsupported Unit value type \"' + this.valueType() + '\"')\n }\n\n /**\n * Retrieve the right convertor function corresponding with the type\n * of provided exampleValue.\n *\n * @param {string} type A string 'number', 'BigNumber', or 'Fraction'\n * In case of an unknown type,\n * @return {Function}\n */\n Unit._getNumberConverter = function (type) {\n if (!Unit.typeConverters[type]) {\n throw new TypeError('Unsupported type \"' + type + '\"')\n }\n\n return Unit.typeConverters[type]\n }\n\n // Add dimensions to each built-in unit\n for (const key in UNITS) {\n if (hasOwnProperty(UNITS, key)) {\n const unit = UNITS[key]\n unit.dimensions = unit.base.dimensions\n }\n }\n\n // Create aliases\n for (const name in ALIASES) {\n if (hasOwnProperty(ALIASES, name)) {\n const unit = UNITS[ALIASES[name]]\n const alias = {}\n for (const key in unit) {\n if (hasOwnProperty(unit, key)) {\n alias[key] = unit[key]\n }\n }\n alias.name = name\n UNITS[name] = alias\n }\n }\n\n /**\n * Checks if a character is a valid latin letter (upper or lower case).\n * Note that this function can be overridden, for example to allow support of other alphabets.\n * @memberof Unit\n * @param {string} c Tested character\n * @return {boolean} true if the character is a latin letter\n */\n Unit.isValidAlpha = function isValidAlpha (c) {\n return /^[a-zA-Z]$/.test(c)\n }\n\n function assertUnitNameIsValid (name) {\n for (let i = 0; i < name.length; i++) {\n c = name.charAt(i)\n\n if (i === 0 && !Unit.isValidAlpha(c)) { throw new Error('Invalid unit name (must begin with alpha character): \"' + name + '\"') }\n\n if (i > 0 && !(Unit.isValidAlpha(c) ||\n isDigit(c))) { throw new Error('Invalid unit name (only alphanumeric characters are allowed): \"' + name + '\"') }\n }\n }\n\n /**\n * Wrapper around createUnitSingle.\n * Example:\n * createUnit( {\n * foo: {\n * prefixes: 'long',\n * baseName: 'essence-of-foo'\n * },\n * bar: '40 foo',\n * baz: {\n * definition: '1 bar/hour',\n * prefixes: 'long'\n * }\n * },\n * {\n * override: true\n * })\n * @memberof Unit\n * @param {object} obj Object map. Each key becomes a unit which is defined by its value.\n * @param {object} options\n * @return {Unit} the last created unit\n */\n Unit.createUnit = function (obj, options) {\n if (typeof (obj) !== 'object') {\n throw new TypeError(\"createUnit expects first parameter to be of type 'Object'\")\n }\n\n // Remove all units and aliases we are overriding\n if (options && options.override) {\n for (const key in obj) {\n if (hasOwnProperty(obj, key)) {\n Unit.deleteUnit(key)\n }\n if (obj[key].aliases) {\n for (let i = 0; i < obj[key].aliases.length; i++) {\n Unit.deleteUnit(obj[key].aliases[i])\n }\n }\n }\n }\n\n // TODO: traverse multiple times until all units have been added\n let lastUnit\n for (const key in obj) {\n if (hasOwnProperty(obj, key)) {\n lastUnit = Unit.createUnitSingle(key, obj[key])\n }\n }\n return lastUnit\n }\n\n /**\n * Create a user-defined unit and register it with the Unit type.\n * Example:\n * createUnitSingle('knot', '0.514444444 m/s')\n *\n * @memberof Unit\n * @param {string} name The name of the new unit. Must be unique. Example: 'knot'\n * @param {string | Unit | object} definition Definition of the unit in terms\n * of existing units. For example, '0.514444444 m / s'. Can be a Unit, a string,\n * or an Object. If an Object, may have the following properties:\n * - definition {string | Unit} The definition of this unit.\n * - prefixes {string} \"none\", \"short\", \"long\", \"binary_short\", or \"binary_long\".\n * The default is \"none\".\n * - aliases {Array} Array of strings. Example: ['knots', 'kt', 'kts']\n * - offset {Numeric} An offset to apply when converting from the unit. For\n * example, the offset for celsius is 273.15 and the offset for farhenheit\n * is 459.67. Default is 0.\n * - baseName {string} If the unit's dimension does not match that of any other\n * base unit, the name of the newly create base unit. Otherwise, this property\n * has no effect.\n *\n * @return {Unit}\n */\n Unit.createUnitSingle = function (name, obj) {\n if (typeof (obj) === 'undefined' || obj === null) {\n obj = {}\n }\n\n if (typeof (name) !== 'string') {\n throw new TypeError(\"createUnitSingle expects first parameter to be of type 'string'\")\n }\n\n // Check collisions with existing units\n if (hasOwnProperty(UNITS, name)) {\n throw new Error('Cannot create unit \"' + name + '\": a unit with that name already exists')\n }\n\n // TODO: Validate name for collisions with other built-in functions (like abs or cos, for example), and for acceptable variable names. For example, '42' is probably not a valid unit. Nor is '%', since it is also an operator.\n\n assertUnitNameIsValid(name)\n\n let defUnit = null // The Unit from which the new unit will be created.\n let aliases = []\n let offset = 0\n let definition\n let prefixes\n let baseName\n if (obj && obj.type === 'Unit') {\n defUnit = obj.clone()\n } else if (typeof (obj) === 'string') {\n if (obj !== '') {\n definition = obj\n }\n } else if (typeof (obj) === 'object') {\n definition = obj.definition\n prefixes = obj.prefixes\n offset = obj.offset\n baseName = obj.baseName\n if (obj.aliases) {\n aliases = obj.aliases.valueOf() // aliases could be a Matrix, so convert to Array\n }\n } else {\n throw new TypeError('Cannot create unit \"' + name + '\" from \"' + obj.toString() + '\": expecting \"string\" or \"Unit\" or \"Object\"')\n }\n\n if (aliases) {\n for (let i = 0; i < aliases.length; i++) {\n if (hasOwnProperty(UNITS, aliases[i])) {\n throw new Error('Cannot create alias \"' + aliases[i] + '\": a unit with that name already exists')\n }\n }\n }\n\n if (definition && typeof (definition) === 'string' && !defUnit) {\n try {\n defUnit = Unit.parse(definition, { allowNoUnits: true })\n } catch (ex) {\n ex.message = 'Could not create unit \"' + name + '\" from \"' + definition + '\": ' + ex.message\n throw (ex)\n }\n } else if (definition && definition.type === 'Unit') {\n defUnit = definition.clone()\n }\n\n aliases = aliases || []\n offset = offset || 0\n if (prefixes && prefixes.toUpperCase) { prefixes = PREFIXES[prefixes.toUpperCase()] || PREFIXES.NONE } else { prefixes = PREFIXES.NONE }\n\n // If defUnit is null, it is because the user did not\n // specify a defintion. So create a new base dimension.\n let newUnit = {}\n if (!defUnit) {\n // Add a new base dimension\n baseName = baseName || name + '_STUFF' // foo --> foo_STUFF, or the essence of foo\n if (BASE_DIMENSIONS.indexOf(baseName) >= 0) {\n throw new Error('Cannot create new base unit \"' + name + '\": a base unit with that name already exists (and cannot be overridden)')\n }\n BASE_DIMENSIONS.push(baseName)\n\n // Push 0 onto existing base units\n for (const b in BASE_UNITS) {\n if (hasOwnProperty(BASE_UNITS, b)) {\n BASE_UNITS[b].dimensions[BASE_DIMENSIONS.length - 1] = 0\n }\n }\n\n // Add the new base unit\n const newBaseUnit = { dimensions: [] }\n for (let i = 0; i < BASE_DIMENSIONS.length; i++) {\n newBaseUnit.dimensions[i] = 0\n }\n newBaseUnit.dimensions[BASE_DIMENSIONS.length - 1] = 1\n newBaseUnit.key = baseName\n BASE_UNITS[baseName] = newBaseUnit\n\n newUnit = {\n name,\n value: 1,\n dimensions: BASE_UNITS[baseName].dimensions.slice(0),\n prefixes,\n offset,\n base: BASE_UNITS[baseName]\n }\n\n currentUnitSystem[baseName] = {\n unit: newUnit,\n prefix: PREFIXES.NONE['']\n }\n } else {\n newUnit = {\n name,\n value: defUnit.value,\n dimensions: defUnit.dimensions.slice(0),\n prefixes,\n offset\n }\n\n // Create a new base if no matching base exists\n let anyMatch = false\n for (const i in BASE_UNITS) {\n if (hasOwnProperty(BASE_UNITS, i)) {\n let match = true\n for (let j = 0; j < BASE_DIMENSIONS.length; j++) {\n if (Math.abs((newUnit.dimensions[j] || 0) - (BASE_UNITS[i].dimensions[j] || 0)) > 1e-12) {\n match = false\n break\n }\n }\n if (match) {\n anyMatch = true\n newUnit.base = BASE_UNITS[i]\n break\n }\n }\n }\n if (!anyMatch) {\n baseName = baseName || name + '_STUFF' // foo --> foo_STUFF, or the essence of foo\n // Add the new base unit\n const newBaseUnit = { dimensions: defUnit.dimensions.slice(0) }\n newBaseUnit.key = baseName\n BASE_UNITS[baseName] = newBaseUnit\n\n currentUnitSystem[baseName] = {\n unit: newUnit,\n prefix: PREFIXES.NONE['']\n }\n\n newUnit.base = BASE_UNITS[baseName]\n }\n }\n\n Unit.UNITS[name] = newUnit\n\n for (let i = 0; i < aliases.length; i++) {\n const aliasName = aliases[i]\n const alias = {}\n for (const key in newUnit) {\n if (hasOwnProperty(newUnit, key)) {\n alias[key] = newUnit[key]\n }\n }\n alias.name = aliasName\n Unit.UNITS[aliasName] = alias\n }\n\n // delete the memoization cache because we created a new unit\n delete _findUnit.cache\n\n return new Unit(null, name)\n }\n\n Unit.deleteUnit = function (name) {\n delete Unit.UNITS[name]\n\n // delete the memoization cache because we deleted a unit\n delete _findUnit.cache\n }\n\n // expose arrays with prefixes, dimensions, units, systems\n Unit.PREFIXES = PREFIXES\n Unit.BASE_DIMENSIONS = BASE_DIMENSIONS\n Unit.BASE_UNITS = BASE_UNITS\n Unit.UNIT_SYSTEMS = UNIT_SYSTEMS\n Unit.UNITS = UNITS\n\n return Unit\n}, { isClass: true })\n","import { factory } from '../../../utils/factory.js'\nimport { deepMap } from '../../../utils/collection.js'\n\nconst name = 'unit'\nconst dependencies = ['typed', 'Unit']\n\n// This function is named createUnitFunction to prevent a naming conflict with createUnit\nexport const createUnitFunction = /* #__PURE__ */ factory(name, dependencies, ({ typed, Unit }) => {\n /**\n * Create a unit. Depending on the passed arguments, the function\n * will create and return a new math.Unit object.\n * When a matrix is provided, all elements will be converted to units.\n *\n * Syntax:\n *\n * math.unit(unit : string)\n * math.unit(value : number, valuelessUnit : Unit)\n * math.unit(value : number, valuelessUnit : string)\n *\n * Examples:\n *\n * const kph = math.unit('km/h') // returns Unit km/h (valueless)\n * const v = math.unit(25, kph) // returns Unit 25 km/h\n * const a = math.unit(5, 'cm') // returns Unit 50 mm\n * const b = math.unit('23 kg') // returns Unit 23 kg\n * a.to('m') // returns Unit 0.05 m\n *\n * See also:\n *\n * bignumber, boolean, complex, index, matrix, number, string, createUnit\n *\n * @param {* | Array | Matrix} args A number and unit.\n * @return {Unit | Array | Matrix} The created unit\n */\n\n return typed(name, {\n Unit: function (x) {\n return x.clone()\n },\n\n string: function (x) {\n if (Unit.isValuelessUnit(x)) {\n return new Unit(null, x) // a pure unit\n }\n\n return Unit.parse(x, { allowNoUnits: true }) // a unit with value, like '5cm'\n },\n\n 'number | BigNumber | Fraction | Complex, string | Unit': function (value, unit) {\n return new Unit(value, unit)\n },\n\n 'number | BigNumber | Fraction': function (value) {\n // dimensionless\n return new Unit(value)\n },\n\n 'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))\n })\n})\n","import { factory } from '../../../utils/factory.js'\n\nconst name = 'sparse'\nconst dependencies = ['typed', 'SparseMatrix']\n\nexport const createSparse = /* #__PURE__ */ factory(name, dependencies, ({ typed, SparseMatrix }) => {\n /**\n * Create a Sparse Matrix. The function creates a new `math.Matrix` object from\n * an `Array`. A Matrix has utility functions to manipulate the data in the\n * matrix, like getting the size and getting or setting values in the matrix.\n * Note that a Sparse Matrix is always 2-dimensional, so for example if\n * you create one from a plain array of _n_ numbers, you get an _n_ by 1\n * Sparse \"column vector\".\n *\n * Syntax:\n *\n * math.sparse() // creates an empty sparse matrix.\n * math.sparse(data) // creates a sparse matrix with initial data.\n * math.sparse(data, 'number') // creates a sparse matrix with initial data, number datatype.\n *\n * Examples:\n *\n * let m = math.sparse([[1, 2], [3, 4]])\n * m.size() // Array [2, 2]\n * m.resize([3, 2], 5)\n * m.valueOf() // Array [[1, 2], [3, 4], [5, 5]]\n * m.get([1, 0]) // number 3\n * let v = math.sparse([0, 0, 1])\n * v.size() // Array [3, 1]\n * v.get([2, 0]) // number 1\n *\n * See also:\n *\n * bignumber, boolean, complex, index, number, string, unit, matrix\n *\n * @param {Array | Matrix} [data] A two dimensional array\n *\n * @return {Matrix} The created matrix\n */\n return typed(name, {\n '': function () {\n return new SparseMatrix([])\n },\n\n string: function (datatype) {\n return new SparseMatrix([], datatype)\n },\n\n 'Array | Matrix': function (data) {\n return new SparseMatrix(data)\n },\n\n 'Array | Matrix, string': function (data, datatype) {\n return new SparseMatrix(data, datatype)\n }\n })\n})\n","import { factory } from '../../../utils/factory.js'\n\nconst name = 'createUnit'\nconst dependencies = ['typed', 'Unit']\n\nexport const createCreateUnit = /* #__PURE__ */ factory(name, dependencies, ({ typed, Unit }) => {\n /**\n * Create a user-defined unit and register it with the Unit type.\n *\n * Syntax:\n *\n * math.createUnit({\n * baseUnit1: {\n * aliases: [string, ...]\n * prefixes: object\n * },\n * unit2: {\n * definition: string,\n * aliases: [string, ...]\n * prefixes: object,\n * offset: number\n * },\n * unit3: string // Shortcut\n * })\n *\n * // Another shortcut:\n * math.createUnit(string, unit : string, [object])\n *\n * Examples:\n *\n * math.createUnit('foo')\n * math.createUnit('knot', {definition: '0.514444444 m/s', aliases: ['knots', 'kt', 'kts']})\n * math.createUnit('mph', '1 mile/hour')\n * math.createUnit('km', math.unit(1000, 'm'))\n *\n * @param {string} name The name of the new unit. Must be unique. Example: 'knot'\n * @param {string, UnitDefinition, Unit} definition Definition of the unit in terms of existing units. For example, '0.514444444 m / s'.\n * @param {Object} options (optional) An object containing any of the following properties:\n * - `prefixes {string}` \"none\", \"short\", \"long\", \"binary_short\", or \"binary_long\". The default is \"none\".\n * - `aliases {Array}` Array of strings. Example: ['knots', 'kt', 'kts']\n * - `offset {Numeric}` An offset to apply when converting from the unit. For example, the offset for celsius is 273.15. Default is 0.\n *\n * See also:\n *\n * unit\n *\n * @return {Unit} The new unit\n */\n return typed(name, {\n\n // General function signature. First parameter is an object where each property is the definition of a new unit. The object keys are the unit names and the values are the definitions. The values can be objects, strings, or Units. If a property is an empty object or an empty string, a new base unit is created. The second parameter is the options.\n 'Object, Object': function (obj, options) {\n return Unit.createUnit(obj, options)\n },\n\n // Same as above but without the options.\n Object: function (obj) {\n return Unit.createUnit(obj, {})\n },\n\n // Shortcut method for creating one unit.\n 'string, Unit | string | Object, Object': function (name, def, options) {\n const obj = {}\n obj[name] = def\n return Unit.createUnit(obj, options)\n },\n\n // Same as above but without the options.\n 'string, Unit | string | Object': function (name, def) {\n const obj = {}\n obj[name] = def\n return Unit.createUnit(obj, {})\n },\n\n // Without a definition, creates a base unit.\n string: function (name) {\n const obj = {}\n obj[name] = {}\n return Unit.createUnit(obj, {})\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'acos'\nconst dependencies = ['typed', 'config', 'Complex']\n\nexport const createAcos = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, Complex }) => {\n /**\n * Calculate the inverse cosine of a value.\n *\n * To avoid confusion with the matrix arccosine, this function does not\n * apply to matrices.\n *\n * Syntax:\n *\n * math.acos(x)\n *\n * Examples:\n *\n * math.acos(0.5) // returns number 1.0471975511965979\n * math.acos(math.cos(1.5)) // returns number 1.5\n *\n * math.acos(2) // returns Complex 0 + 1.3169578969248166 i\n *\n * See also:\n *\n * cos, atan, asin\n *\n * @param {number | BigNumber | Complex} x Function input\n * @return {number | BigNumber | Complex} The arc cosine of x\n */\n return typed(name, {\n number: function (x) {\n if ((x >= -1 && x <= 1) || config.predictable) {\n return Math.acos(x)\n } else {\n return new Complex(x, 0).acos()\n }\n },\n\n Complex: function (x) {\n return x.acos()\n },\n\n BigNumber: function (x) {\n return x.acos()\n }\n })\n})\n","import { acosh, asinh, atanh, cosh, sign, sinh, tanh } from '../../utils/number.js'\n\nconst n1 = 'number'\nconst n2 = 'number, number'\n\nexport function acosNumber (x) {\n return Math.acos(x)\n}\nacosNumber.signature = n1\n\nexport function acoshNumber (x) {\n return acosh(x)\n}\nacoshNumber.signature = n1\n\nexport function acotNumber (x) {\n return Math.atan(1 / x)\n}\nacotNumber.signature = n1\n\nexport function acothNumber (x) {\n return isFinite(x)\n ? (Math.log((x + 1) / x) + Math.log(x / (x - 1))) / 2\n : 0\n}\nacothNumber.signature = n1\n\nexport function acscNumber (x) {\n return Math.asin(1 / x)\n}\nacscNumber.signature = n1\n\nexport function acschNumber (x) {\n const xInv = 1 / x\n return Math.log(xInv + Math.sqrt(xInv * xInv + 1))\n}\nacschNumber.signature = n1\n\nexport function asecNumber (x) {\n return Math.acos(1 / x)\n}\nasecNumber.signature = n1\n\nexport function asechNumber (x) {\n const xInv = 1 / x\n const ret = Math.sqrt(xInv * xInv - 1)\n return Math.log(ret + xInv)\n}\nasechNumber.signature = n1\n\nexport function asinNumber (x) {\n return Math.asin(x)\n}\nasinNumber.signature = n1\n\nexport function asinhNumber (x) {\n return asinh(x)\n}\nasinhNumber.signature = n1\n\nexport function atanNumber (x) {\n return Math.atan(x)\n}\natanNumber.signature = n1\n\nexport function atan2Number (y, x) {\n return Math.atan2(y, x)\n}\natan2Number.signature = n2\n\nexport function atanhNumber (x) {\n return atanh(x)\n}\natanhNumber.signature = n1\n\nexport function cosNumber (x) {\n return Math.cos(x)\n}\ncosNumber.signature = n1\n\nexport function coshNumber (x) {\n return cosh(x)\n}\ncoshNumber.signature = n1\n\nexport function cotNumber (x) {\n return 1 / Math.tan(x)\n}\ncotNumber.signature = n1\n\nexport function cothNumber (x) {\n const e = Math.exp(2 * x)\n return (e + 1) / (e - 1)\n}\ncothNumber.signature = n1\n\nexport function cscNumber (x) {\n return 1 / Math.sin(x)\n}\ncscNumber.signature = n1\n\nexport function cschNumber (x) {\n // consider values close to zero (+/-)\n if (x === 0) {\n return Number.POSITIVE_INFINITY\n } else {\n return Math.abs(2 / (Math.exp(x) - Math.exp(-x))) * sign(x)\n }\n}\ncschNumber.signature = n1\n\nexport function secNumber (x) {\n return 1 / Math.cos(x)\n}\nsecNumber.signature = n1\n\nexport function sechNumber (x) {\n return 2 / (Math.exp(x) + Math.exp(-x))\n}\nsechNumber.signature = n1\n\nexport function sinNumber (x) {\n return Math.sin(x)\n}\nsinNumber.signature = n1\n\nexport function sinhNumber (x) {\n return sinh(x)\n}\nsinhNumber.signature = n1\n\nexport function tanNumber (x) {\n return Math.tan(x)\n}\ntanNumber.signature = n1\n\nexport function tanhNumber (x) {\n return tanh(x)\n}\ntanhNumber.signature = n1\n","import { factory } from '../../utils/factory.js'\nimport { acoshNumber } from '../../plain/number/index.js'\n\nconst name = 'acosh'\nconst dependencies = ['typed', 'config', 'Complex']\n\nexport const createAcosh = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, Complex }) => {\n /**\n * Calculate the hyperbolic arccos of a value,\n * defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.acosh(x)\n *\n * Examples:\n *\n * math.acosh(1.5) // returns 0.9624236501192069\n *\n * See also:\n *\n * cosh, asinh, atanh\n *\n * @param {number | BigNumber | Complex} x Function input\n * @return {number | BigNumber | Complex} Hyperbolic arccosine of x\n */\n return typed(name, {\n number: function (x) {\n if (x >= 1 || config.predictable) {\n return acoshNumber(x)\n }\n if (x <= -1) {\n return new Complex(Math.log(Math.sqrt(x * x - 1) - x), Math.PI)\n }\n return new Complex(x, 0).acosh()\n },\n\n Complex: function (x) {\n return x.acosh()\n },\n\n BigNumber: function (x) {\n return x.acosh()\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { acotNumber } from '../../plain/number/index.js'\n\nconst name = 'acot'\nconst dependencies = ['typed', 'BigNumber']\n\nexport const createAcot = /* #__PURE__ */ factory(name, dependencies, ({ typed, BigNumber }) => {\n /**\n * Calculate the inverse cotangent of a value, defined as `acot(x) = atan(1/x)`.\n *\n * To avoid confusion with the matrix arccotanget, this function does not\n * apply to matrices.\n *\n * Syntax:\n *\n * math.acot(x)\n *\n * Examples:\n *\n * math.acot(0.5) // returns number 1.1071487177940904\n * math.acot(2) // returns number 0.4636476090008061\n * math.acot(math.cot(1.5)) // returns number 1.5\n *\n * See also:\n *\n * cot, atan\n *\n * @param {number | BigNumber| Complex} x Function input\n * @return {number | BigNumber| Complex} The arc cotangent of x\n */\n return typed(name, {\n number: acotNumber,\n\n Complex: function (x) {\n return x.acot()\n },\n\n BigNumber: function (x) {\n return new BigNumber(1).div(x).atan()\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { acothNumber } from '../../plain/number/index.js'\n\nconst name = 'acoth'\nconst dependencies = ['typed', 'config', 'Complex', 'BigNumber']\n\nexport const createAcoth = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, Complex, BigNumber }) => {\n /**\n * Calculate the inverse hyperbolic tangent of a value,\n * defined as `acoth(x) = atanh(1/x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.\n *\n * To avoid confusion with the matrix inverse hyperbolic tangent, this\n * function does not apply to matrices.\n *\n * Syntax:\n *\n * math.acoth(x)\n *\n * Examples:\n *\n * math.acoth(0.5) // returns 0.5493061443340548 - 1.5707963267948966i\n *\n * See also:\n *\n * acsch, asech\n *\n * @param {number | BigNumber | Complex} x Function input\n * @return {number | BigNumber | Complex} Hyperbolic arccotangent of x\n */\n return typed(name, {\n number: function (x) {\n if (x >= 1 || x <= -1 || config.predictable) {\n return acothNumber(x)\n }\n return new Complex(x, 0).acoth()\n },\n\n Complex: function (x) {\n return x.acoth()\n },\n\n BigNumber: function (x) {\n return new BigNumber(1).div(x).atanh()\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { acscNumber } from '../../plain/number/index.js'\n\nconst name = 'acsc'\nconst dependencies = ['typed', 'config', 'Complex', 'BigNumber']\n\nexport const createAcsc = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, Complex, BigNumber }) => {\n /**\n * Calculate the inverse cosecant of a value, defined as `acsc(x) = asin(1/x)`.\n *\n * To avoid confusion with the matrix arccosecant, this function does not\n * apply to matrices.\n *\n * Syntax:\n *\n * math.acsc(x)\n *\n * Examples:\n *\n * math.acsc(2) // returns 0.5235987755982989\n * math.acsc(0.5) // returns Complex 1.5707963267948966 -1.3169578969248166i\n * math.acsc(math.csc(1.5)) // returns number 1.5\n *\n * See also:\n *\n * csc, asin, asec\n *\n * @param {number | BigNumber | Complex} x Function input\n * @return {number | BigNumber | Complex} The arc cosecant of x\n */\n return typed(name, {\n number: function (x) {\n if (x <= -1 || x >= 1 || config.predictable) {\n return acscNumber(x)\n }\n return new Complex(x, 0).acsc()\n },\n\n Complex: function (x) {\n return x.acsc()\n },\n\n BigNumber: function (x) {\n return new BigNumber(1).div(x).asin()\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { acschNumber } from '../../plain/number/index.js'\n\nconst name = 'acsch'\nconst dependencies = ['typed', 'BigNumber']\n\nexport const createAcsch = /* #__PURE__ */ factory(name, dependencies, ({ typed, BigNumber }) => {\n /**\n * Calculate the inverse hyperbolic cosecant of a value,\n * defined as `acsch(x) = asinh(1/x) = ln(1/x + sqrt(1/x^2 + 1))`.\n *\n * To avoid confusion with the matrix inverse hyperbolic cosecant, this function\n * does not apply to matrices.\n *\n * Syntax:\n *\n * math.acsch(x)\n *\n * Examples:\n *\n * math.acsch(0.5) // returns 1.4436354751788103\n *\n * See also:\n *\n * asech, acoth\n *\n * @param {number | BigNumber | Complex} x Function input\n * @return {number | BigNumber | Complex} Hyperbolic arccosecant of x\n */\n return typed(name, {\n number: acschNumber,\n\n Complex: function (x) {\n return x.acsch()\n },\n\n BigNumber: function (x) {\n return new BigNumber(1).div(x).asinh()\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { asecNumber } from '../../plain/number/index.js'\n\nconst name = 'asec'\nconst dependencies = ['typed', 'config', 'Complex', 'BigNumber']\n\nexport const createAsec = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, Complex, BigNumber }) => {\n /**\n * Calculate the inverse secant of a value. Defined as `asec(x) = acos(1/x)`.\n *\n * To avoid confusion with the matrix arcsecant, this function does not\n * apply to matrices.\n *\n * Syntax:\n *\n * math.asec(x)\n *\n * Examples:\n *\n * math.asec(2) // returns 1.0471975511965979\n * math.asec(math.sec(1.5)) // returns 1.5\n *\n * math.asec(0.5) // returns Complex 0 + 1.3169578969248166i\n *\n * See also:\n *\n * acos, acot, acsc\n *\n * @param {number | BigNumber | Complex} x Function input\n * @return {number | BigNumber | Complex} The arc secant of x\n */\n return typed(name, {\n number: function (x) {\n if (x <= -1 || x >= 1 || config.predictable) {\n return asecNumber(x)\n }\n return new Complex(x, 0).asec()\n },\n\n Complex: function (x) {\n return x.asec()\n },\n\n BigNumber: function (x) {\n return new BigNumber(1).div(x).acos()\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { asechNumber } from '../../plain/number/index.js'\n\nconst name = 'asech'\nconst dependencies = ['typed', 'config', 'Complex', 'BigNumber']\n\nexport const createAsech = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, Complex, BigNumber }) => {\n /**\n * Calculate the hyperbolic arcsecant of a value,\n * defined as `asech(x) = acosh(1/x) = ln(sqrt(1/x^2 - 1) + 1/x)`.\n *\n * To avoid confusion with the matrix hyperbolic arcsecant, this function\n * does not apply to matrices.\n *\n * Syntax:\n *\n * math.asech(x)\n *\n * Examples:\n *\n * math.asech(0.5) // returns 1.3169578969248166\n *\n * See also:\n *\n * acsch, acoth\n *\n * @param {number | BigNumber | Complex} x Function input\n * @return {number | BigNumber | Complex} Hyperbolic arcsecant of x\n */\n return typed(name, {\n number: function (x) {\n if ((x <= 1 && x >= -1) || config.predictable) {\n const xInv = 1 / x\n if (xInv > 0 || config.predictable) {\n return asechNumber(x)\n }\n\n const ret = Math.sqrt(xInv * xInv - 1)\n return new Complex(Math.log(ret - xInv), Math.PI)\n }\n\n return new Complex(x, 0).asech()\n },\n\n Complex: function (x) {\n return x.asech()\n },\n\n BigNumber: function (x) {\n return new BigNumber(1).div(x).acosh()\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'asin'\nconst dependencies = ['typed', 'config', 'Complex']\n\nexport const createAsin = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, Complex }) => {\n /**\n * Calculate the inverse sine of a value.\n *\n * To avoid confusion with the matric arcsine, this function does not apply\n * to matrices.\n *\n * Syntax:\n *\n * math.asin(x)\n *\n * Examples:\n *\n * math.asin(0.5) // returns number 0.5235987755982989\n * math.asin(math.sin(1.5)) // returns number 1.5\n *\n * math.asin(2) // returns Complex 1.5707963267948966 -1.3169578969248166i\n *\n * See also:\n *\n * sin, atan, acos\n *\n * @param {number | BigNumber | Complex} x Function input\n * @return {number | BigNumber | Complex} The arc sine of x\n */\n return typed(name, {\n number: function (x) {\n if ((x >= -1 && x <= 1) || config.predictable) {\n return Math.asin(x)\n } else {\n return new Complex(x, 0).asin()\n }\n },\n\n Complex: function (x) {\n return x.asin()\n },\n\n BigNumber: function (x) {\n return x.asin()\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { asinhNumber } from '../../plain/number/index.js'\n\nconst name = 'asinh'\nconst dependencies = ['typed']\n\nexport const createAsinh = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Calculate the hyperbolic arcsine of a value,\n * defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.\n *\n * To avoid confusion with the matrix hyperbolic arcsine, this function\n * does not apply to matrices.\n *\n * Syntax:\n *\n * math.asinh(x)\n *\n * Examples:\n *\n * math.asinh(0.5) // returns 0.48121182505960347\n *\n * See also:\n *\n * acosh, atanh\n *\n * @param {number | BigNumber | Complex} x Function input\n * @return {number | BigNumber | Complex} Hyperbolic arcsine of x\n */\n return typed('asinh', {\n number: asinhNumber,\n\n Complex: function (x) {\n return x.asinh()\n },\n\n BigNumber: function (x) {\n return x.asinh()\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'atan'\nconst dependencies = ['typed']\n\nexport const createAtan = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Calculate the inverse tangent of a value.\n *\n * To avoid confusion with matrix arctangent, this function does not apply\n * to matrices.\n *\n * Syntax:\n *\n * math.atan(x)\n *\n * Examples:\n *\n * math.atan(0.5) // returns number 0.4636476090008061\n * math.atan(2) // returns number 1.1071487177940904\n * math.atan(math.tan(1.5)) // returns number 1.5\n *\n * See also:\n *\n * tan, asin, acos\n *\n * @param {number | BigNumber | Complex} x Function input\n * @return {number | BigNumber | Complex} The arc tangent of x\n */\n return typed('atan', {\n number: function (x) {\n return Math.atan(x)\n },\n\n Complex: function (x) {\n return x.atan()\n },\n\n BigNumber: function (x) {\n return x.atan()\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { createMatAlgo02xDS0 } from '../../type/matrix/utils/matAlgo02xDS0.js'\nimport { createMatAlgo03xDSf } from '../../type/matrix/utils/matAlgo03xDSf.js'\nimport { createMatAlgo09xS0Sf } from '../../type/matrix/utils/matAlgo09xS0Sf.js'\nimport { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js'\nimport { createMatAlgo12xSfs } from '../../type/matrix/utils/matAlgo12xSfs.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\n\nconst name = 'atan2'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'equalScalar',\n 'BigNumber',\n 'DenseMatrix',\n 'concat'\n]\n\nexport const createAtan2 = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, BigNumber, DenseMatrix, concat }) => {\n const matAlgo02xDS0 = createMatAlgo02xDS0({ typed, equalScalar })\n const matAlgo03xDSf = createMatAlgo03xDSf({ typed })\n const matAlgo09xS0Sf = createMatAlgo09xS0Sf({ typed, equalScalar })\n const matAlgo11xS0s = createMatAlgo11xS0s({ typed, equalScalar })\n const matAlgo12xSfs = createMatAlgo12xSfs({ typed, DenseMatrix })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n\n /**\n * Calculate the inverse tangent function with two arguments, y/x.\n * By providing two arguments, the right quadrant of the computed angle can be\n * determined.\n *\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.atan2(y, x)\n *\n * Examples:\n *\n * math.atan2(2, 2) / math.pi // returns number 0.25\n *\n * const angle = math.unit(60, 'deg')\n * const x = math.cos(angle)\n * const y = math.sin(angle)\n * math.atan2(y, x) * 180 / math.pi // returns 60\n *\n * math.atan(2) // returns number 1.1071487177940904\n *\n * See also:\n *\n * tan, atan, sin, cos\n *\n * @param {number | Array | Matrix} y Second dimension\n * @param {number | Array | Matrix} x First dimension\n * @return {number | Array | Matrix} Four-quadrant inverse tangent\n */\n return typed(\n name,\n {\n 'number, number': Math.atan2,\n\n // Complex numbers doesn't seem to have a reasonable implementation of\n // atan2(). Even Matlab removed the support, after they only calculated\n // the atan only on base of the real part of the numbers and ignored\n // the imaginary.\n\n 'BigNumber, BigNumber': (y, x) => BigNumber.atan2(y, x)\n },\n matrixAlgorithmSuite({\n scalar: 'number | BigNumber',\n SS: matAlgo09xS0Sf,\n DS: matAlgo03xDSf,\n SD: matAlgo02xDS0,\n Ss: matAlgo11xS0s,\n sS: matAlgo12xSfs\n })\n )\n})\n","import { factory } from '../../utils/factory.js'\nimport { atanhNumber } from '../../plain/number/index.js'\n\nconst name = 'atanh'\nconst dependencies = ['typed', 'config', 'Complex']\n\nexport const createAtanh = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, Complex }) => {\n /**\n * Calculate the hyperbolic arctangent of a value,\n * defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.\n *\n * To avoid confusion with the matrix hyperbolic arctangent, this function\n * does not apply to matrices.\n *\n * Syntax:\n *\n * math.atanh(x)\n *\n * Examples:\n *\n * math.atanh(0.5) // returns 0.5493061443340549\n *\n * See also:\n *\n * acosh, asinh\n *\n * @param {number | BigNumber | Complex} x Function input\n * @return {number | BigNumber | Complex} Hyperbolic arctangent of x\n */\n return typed(name, {\n number: function (x) {\n if ((x <= 1 && x >= -1) || config.predictable) {\n return atanhNumber(x)\n }\n return new Complex(x, 0).atanh()\n },\n\n Complex: function (x) {\n return x.atanh()\n },\n\n BigNumber: function (x) {\n return x.atanh()\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\n\nexport const createTrigUnit = /* #__PURE__ */ factory(\n 'trigUnit', ['typed'], ({ typed }) => ({\n Unit: typed.referToSelf(self => x => {\n if (!x.hasBase(x.constructor.BASE_UNITS.ANGLE)) {\n throw new TypeError('Unit in function cot is no angle')\n }\n return typed.find(self, x.valueType())(x.value)\n })\n })\n)\n","import { factory } from '../../utils/factory.js'\nimport { createTrigUnit } from './trigUnit.js'\n\nconst name = 'cos'\nconst dependencies = ['typed']\n\nexport const createCos = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n const trigUnit = createTrigUnit({ typed })\n\n /**\n * Calculate the cosine of a value.\n *\n * To avoid confusion with the matrix cosine, this function does not\n * apply to matrices.\n *\n * Syntax:\n *\n * math.cos(x)\n *\n * Examples:\n *\n * math.cos(2) // returns number -0.4161468365471422\n * math.cos(math.pi / 4) // returns number 0.7071067811865475\n * math.cos(math.unit(180, 'deg')) // returns number -1\n * math.cos(math.unit(60, 'deg')) // returns number 0.5\n *\n * const angle = 0.2\n * math.pow(math.sin(angle), 2) + math.pow(math.cos(angle), 2) // returns number 1\n *\n * See also:\n *\n * cos, tan\n *\n * @param {number | BigNumber | Complex | Unit} x Function input\n * @return {number | BigNumber | Complex} Cosine of x\n */\n return typed(name, {\n number: Math.cos,\n 'Complex | BigNumber': x => x.cos()\n }, trigUnit)\n})\n","import { factory } from '../../utils/factory.js'\nimport { cosh as coshNumber } from '../../utils/number.js'\n\nconst name = 'cosh'\nconst dependencies = ['typed']\n\nexport const createCosh = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Calculate the hyperbolic cosine of a value,\n * defined as `cosh(x) = 1/2 * (exp(x) + exp(-x))`.\n *\n * To avoid confusion with the matrix hyperbolic cosine, this function does\n * not apply to matrices.\n *\n * Syntax:\n *\n * math.cosh(x)\n *\n * Examples:\n *\n * math.cosh(0.5) // returns number 1.1276259652063807\n *\n * See also:\n *\n * sinh, tanh\n *\n * @param {number | BigNumber | Complex} x Function input\n * @return {number | BigNumber | Complex} Hyperbolic cosine of x\n */\n return typed(name, {\n number: coshNumber,\n 'Complex | BigNumber': x => x.cosh()\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { cotNumber } from '../../plain/number/index.js'\nimport { createTrigUnit } from './trigUnit.js'\n\nconst name = 'cot'\nconst dependencies = ['typed', 'BigNumber']\n\nexport const createCot = /* #__PURE__ */ factory(name, dependencies, ({ typed, BigNumber }) => {\n const trigUnit = createTrigUnit({ typed })\n\n /**\n * Calculate the cotangent of a value. Defined as `cot(x) = 1 / tan(x)`.\n *\n * To avoid confusion with the matrix cotangent, this function does not\n * apply to matrices.\n *\n * Syntax:\n *\n * math.cot(x)\n *\n * Examples:\n *\n * math.cot(2) // returns number -0.45765755436028577\n * 1 / math.tan(2) // returns number -0.45765755436028577\n *\n * See also:\n *\n * tan, sec, csc\n *\n * @param {number | Complex | Unit | Array | Matrix} x Function input\n * @return {number | Complex | Array | Matrix} Cotangent of x\n */\n return typed(name, {\n number: cotNumber,\n Complex: x => x.cot(),\n BigNumber: x => new BigNumber(1).div(x.tan())\n }, trigUnit)\n})\n","import { factory } from '../../utils/factory.js'\nimport { cothNumber } from '../../plain/number/index.js'\n\nconst name = 'coth'\nconst dependencies = ['typed', 'BigNumber']\n\nexport const createCoth = /* #__PURE__ */ factory(name, dependencies, ({ typed, BigNumber }) => {\n /**\n * Calculate the hyperbolic cotangent of a value,\n * defined as `coth(x) = 1 / tanh(x)`.\n *\n * To avoid confusion with the matrix hyperbolic cotangent, this function\n * does not apply to matrices.\n *\n * Syntax:\n *\n * math.coth(x)\n *\n * Examples:\n *\n * // coth(x) = 1 / tanh(x)\n * math.coth(2) // returns 1.0373147207275482\n * 1 / math.tanh(2) // returns 1.0373147207275482\n *\n * See also:\n *\n * sinh, tanh, cosh\n *\n * @param {number | BigNumber | Complex} x Function input\n * @return {number | BigNumber | Complex} Hyperbolic cotangent of x\n */\n return typed(name, {\n number: cothNumber,\n Complex: x => x.coth(),\n BigNumber: x => new BigNumber(1).div(x.tanh())\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { cscNumber } from '../../plain/number/index.js'\nimport { createTrigUnit } from './trigUnit.js'\n\nconst name = 'csc'\nconst dependencies = ['typed', 'BigNumber']\n\nexport const createCsc = /* #__PURE__ */ factory(name, dependencies, ({ typed, BigNumber }) => {\n const trigUnit = createTrigUnit({ typed })\n\n /**\n * Calculate the cosecant of a value, defined as `csc(x) = 1/sin(x)`.\n *\n * To avoid confusion with the matrix cosecant, this function does not\n * apply to matrices.\n *\n * Syntax:\n *\n * math.csc(x)\n *\n * Examples:\n *\n * math.csc(2) // returns number 1.099750170294617\n * 1 / math.sin(2) // returns number 1.099750170294617\n *\n * See also:\n *\n * sin, sec, cot\n *\n * @param {number | BigNumber | Complex | Unit} x Function input\n * @return {number | BigNumber | Complex} Cosecant of x\n */\n return typed(name, {\n number: cscNumber,\n Complex: x => x.csc(),\n BigNumber: x => new BigNumber(1).div(x.sin())\n }, trigUnit)\n})\n","import { factory } from '../../utils/factory.js'\nimport { cschNumber } from '../../plain/number/index.js'\n\nconst name = 'csch'\nconst dependencies = ['typed', 'BigNumber']\n\nexport const createCsch = /* #__PURE__ */ factory(name, dependencies, ({ typed, BigNumber }) => {\n /**\n * Calculate the hyperbolic cosecant of a value,\n * defined as `csch(x) = 1 / sinh(x)`.\n *\n * To avoid confusion with the matrix hyperbolic cosecant, this function\n * does not apply to matrices.\n *\n * Syntax:\n *\n * math.csch(x)\n *\n * Examples:\n *\n * // csch(x) = 1/ sinh(x)\n * math.csch(0.5) // returns 1.9190347513349437\n * 1 / math.sinh(0.5) // returns 1.9190347513349437\n *\n * See also:\n *\n * sinh, sech, coth\n *\n * @param {number | BigNumber | Complex} x Function input\n * @return {number | BigNumber | Complex} Hyperbolic cosecant of x\n */\n return typed(name, {\n number: cschNumber,\n Complex: x => x.csch(),\n BigNumber: x => new BigNumber(1).div(x.sinh())\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { secNumber } from '../../plain/number/index.js'\nimport { createTrigUnit } from './trigUnit.js'\n\nconst name = 'sec'\nconst dependencies = ['typed', 'BigNumber']\n\nexport const createSec = /* #__PURE__ */ factory(name, dependencies, ({ typed, BigNumber }) => {\n const trigUnit = createTrigUnit({ typed })\n\n /**\n * Calculate the secant of a value, defined as `sec(x) = 1/cos(x)`.\n *\n * To avoid confusion with the matrix secant, this function does not\n * apply to matrices.\n *\n * Syntax:\n *\n * math.sec(x)\n *\n * Examples:\n *\n * math.sec(2) // returns number -2.4029979617223822\n * 1 / math.cos(2) // returns number -2.4029979617223822\n *\n * See also:\n *\n * cos, csc, cot\n *\n * @param {number | BigNumber | Complex | Unit} x Function input\n * @return {number | BigNumber | Complex} Secant of x\n */\n return typed(name, {\n number: secNumber,\n Complex: x => x.sec(),\n BigNumber: x => new BigNumber(1).div(x.cos())\n }, trigUnit)\n})\n","import { factory } from '../../utils/factory.js'\nimport { sechNumber } from '../../plain/number/index.js'\n\nconst name = 'sech'\nconst dependencies = ['typed', 'BigNumber']\n\nexport const createSech = /* #__PURE__ */ factory(name, dependencies, ({ typed, BigNumber }) => {\n /**\n * Calculate the hyperbolic secant of a value,\n * defined as `sech(x) = 1 / cosh(x)`.\n *\n * To avoid confusion with the matrix hyperbolic secant, this function does\n * not apply to matrices.\n *\n * Syntax:\n *\n * math.sech(x)\n *\n * Examples:\n *\n * // sech(x) = 1/ cosh(x)\n * math.sech(0.5) // returns 0.886818883970074\n * 1 / math.cosh(0.5) // returns 0.886818883970074\n *\n * See also:\n *\n * cosh, csch, coth\n *\n * @param {number | BigNumber | Complex} x Function input\n * @return {number | BigNumber | Complex} Hyperbolic secant of x\n */\n return typed(name, {\n number: sechNumber,\n Complex: x => x.sech(),\n BigNumber: x => new BigNumber(1).div(x.cosh())\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { createTrigUnit } from './trigUnit.js'\n\nconst name = 'sin'\nconst dependencies = ['typed']\n\nexport const createSin = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n const trigUnit = createTrigUnit({ typed })\n\n /**\n * Calculate the sine of a value.\n *\n * To avoid confusion with the matrix sine, this function does not apply\n * to matrices.\n *\n * Syntax:\n *\n * math.sin(x)\n *\n * Examples:\n *\n * math.sin(2) // returns number 0.9092974268256813\n * math.sin(math.pi / 4) // returns number 0.7071067811865475\n * math.sin(math.unit(90, 'deg')) // returns number 1\n * math.sin(math.unit(30, 'deg')) // returns number 0.5\n *\n * const angle = 0.2\n * math.pow(math.sin(angle), 2) + math.pow(math.cos(angle), 2) // returns number 1\n *\n * See also:\n *\n * cos, tan\n *\n * @param {number | BigNumber | Complex | Unit} x Function input\n * @return {number | BigNumber | Complex} Sine of x\n */\n return typed(name, {\n number: Math.sin,\n 'Complex | BigNumber': x => x.sin()\n }, trigUnit)\n})\n","import { factory } from '../../utils/factory.js'\nimport { sinhNumber } from '../../plain/number/index.js'\n\nconst name = 'sinh'\nconst dependencies = ['typed']\n\nexport const createSinh = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Calculate the hyperbolic sine of a value,\n * defined as `sinh(x) = 1/2 * (exp(x) - exp(-x))`.\n *\n * To avoid confusion with the matrix hyperbolic sine, this function does\n * not apply to matrices.\n *\n * Syntax:\n *\n * math.sinh(x)\n *\n * Examples:\n *\n * math.sinh(0.5) // returns number 0.5210953054937474\n *\n * See also:\n *\n * cosh, tanh\n *\n * @param {number | BigNumber | Complex} x Function input\n * @return {number | BigNumber | Complex} Hyperbolic sine of x\n */\n return typed(name, {\n number: sinhNumber,\n 'Complex | BigNumber': x => x.sinh()\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { createTrigUnit } from './trigUnit.js'\n\nconst name = 'tan'\nconst dependencies = ['typed']\n\nexport const createTan = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n const trigUnit = createTrigUnit({ typed })\n\n /**\n * Calculate the tangent of a value. `tan(x)` is equal to `sin(x) / cos(x)`.\n *\n * To avoid confusion with the matrix tangent, this function does not apply\n * to matrices.\n *\n * Syntax:\n *\n * math.tan(x)\n *\n * Examples:\n *\n * math.tan(0.5) // returns number 0.5463024898437905\n * math.sin(0.5) / math.cos(0.5) // returns number 0.5463024898437905\n * math.tan(math.pi / 4) // returns number 1\n * math.tan(math.unit(45, 'deg')) // returns number 1\n *\n * See also:\n *\n * atan, sin, cos\n *\n * @param {number | BigNumber | Complex | Unit} x Function input\n * @return {number | BigNumber | Complex} Tangent of x\n */\n return typed(name, {\n number: Math.tan,\n 'Complex | BigNumber': x => x.tan()\n }, trigUnit)\n})\n","import { factory } from '../../utils/factory.js'\nimport { tanh as _tanh } from '../../utils/number.js'\n\nconst name = 'tanh'\nconst dependencies = ['typed']\n\nexport const createTanh = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Calculate the hyperbolic tangent of a value,\n * defined as `tanh(x) = (exp(2 * x) - 1) / (exp(2 * x) + 1)`.\n *\n * To avoid confusion with matrix hyperbolic tangent, this function does\n * not apply to matrices.\n *\n * Syntax:\n *\n * math.tanh(x)\n *\n * Examples:\n *\n * // tanh(x) = sinh(x) / cosh(x) = 1 / coth(x)\n * math.tanh(0.5) // returns 0.46211715726000974\n * math.sinh(0.5) / math.cosh(0.5) // returns 0.46211715726000974\n * 1 / math.coth(0.5) // returns 0.46211715726000974\n *\n * See also:\n *\n * sinh, cosh, coth\n *\n * @param {number | BigNumber | Complex} x Function input\n * @return {number | BigNumber | Complex} Hyperbolic tangent of x\n */\n return typed('tanh', {\n number: _tanh,\n 'Complex | BigNumber': x => x.tanh()\n })\n})\n","import { flatten } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'setCartesian'\nconst dependencies = ['typed', 'size', 'subset', 'compareNatural', 'Index', 'DenseMatrix']\n\nexport const createSetCartesian = /* #__PURE__ */ factory(name, dependencies, ({ typed, size, subset, compareNatural, Index, DenseMatrix }) => {\n /**\n * Create the cartesian product of two (multi)sets.\n * Multi-dimension arrays will be converted to single-dimension arrays\n * and the values will be sorted in ascending order before the operation.\n *\n * Syntax:\n *\n * math.setCartesian(set1, set2)\n *\n * Examples:\n *\n * math.setCartesian([1, 2], [3, 4]) // returns [[1, 3], [1, 4], [2, 3], [2, 4]]\n * math.setCartesian([4, 3], [2, 1]) // returns [[3, 1], [3, 2], [4, 1], [4, 2]]\n *\n * See also:\n *\n * setUnion, setIntersect, setDifference, setPowerset\n *\n * @param {Array | Matrix} a1 A (multi)set\n * @param {Array | Matrix} a2 A (multi)set\n * @return {Array | Matrix} The cartesian product of two (multi)sets\n */\n return typed(name, {\n 'Array | Matrix, Array | Matrix': function (a1, a2) {\n let result = []\n\n if (subset(size(a1), new Index(0)) !== 0 && subset(size(a2), new Index(0)) !== 0) { // if any of them is empty, return empty\n const b1 = flatten(Array.isArray(a1) ? a1 : a1.toArray()).sort(compareNatural)\n const b2 = flatten(Array.isArray(a2) ? a2 : a2.toArray()).sort(compareNatural)\n result = []\n for (let i = 0; i < b1.length; i++) {\n for (let j = 0; j < b2.length; j++) {\n result.push([b1[i], b2[j]])\n }\n }\n }\n // return an array, if both inputs were arrays\n if (Array.isArray(a1) && Array.isArray(a2)) {\n return result\n }\n // return a matrix otherwise\n return new DenseMatrix(result)\n }\n })\n})\n","import { flatten, generalize, identify } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'setDifference'\nconst dependencies = ['typed', 'size', 'subset', 'compareNatural', 'Index', 'DenseMatrix']\n\nexport const createSetDifference = /* #__PURE__ */ factory(name, dependencies, ({ typed, size, subset, compareNatural, Index, DenseMatrix }) => {\n /**\n * Create the difference of two (multi)sets: every element of set1, that is not the element of set2.\n * Multi-dimension arrays will be converted to single-dimension arrays before the operation.\n *\n * Syntax:\n *\n * math.setDifference(set1, set2)\n *\n * Examples:\n *\n * math.setDifference([1, 2, 3, 4], [3, 4, 5, 6]) // returns [1, 2]\n * math.setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]]) // returns [1, 2]\n *\n * See also:\n *\n * setUnion, setIntersect, setSymDifference\n *\n * @param {Array | Matrix} a1 A (multi)set\n * @param {Array | Matrix} a2 A (multi)set\n * @return {Array | Matrix} The difference of two (multi)sets\n */\n return typed(name, {\n 'Array | Matrix, Array | Matrix': function (a1, a2) {\n let result\n if (subset(size(a1), new Index(0)) === 0) { // empty-anything=empty\n result = []\n } else if (subset(size(a2), new Index(0)) === 0) { // anything-empty=anything\n return flatten(a1.toArray())\n } else {\n const b1 = identify(flatten(Array.isArray(a1) ? a1 : a1.toArray()).sort(compareNatural))\n const b2 = identify(flatten(Array.isArray(a2) ? a2 : a2.toArray()).sort(compareNatural))\n result = []\n let inb2\n for (let i = 0; i < b1.length; i++) {\n inb2 = false\n for (let j = 0; j < b2.length; j++) {\n if (compareNatural(b1[i].value, b2[j].value) === 0 && b1[i].identifier === b2[j].identifier) { // the identifier is always a decimal int\n inb2 = true\n break\n }\n }\n if (!inb2) {\n result.push(b1[i])\n }\n }\n }\n // return an array, if both inputs were arrays\n if (Array.isArray(a1) && Array.isArray(a2)) {\n return generalize(result)\n }\n // return a matrix otherwise\n return new DenseMatrix(generalize(result))\n }\n })\n})\n","import { flatten } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'setDistinct'\nconst dependencies = ['typed', 'size', 'subset', 'compareNatural', 'Index', 'DenseMatrix']\n\nexport const createSetDistinct = /* #__PURE__ */ factory(name, dependencies, ({ typed, size, subset, compareNatural, Index, DenseMatrix }) => {\n /**\n * Collect the distinct elements of a multiset.\n * A multi-dimension array will be converted to a single-dimension array before the operation.\n *\n * Syntax:\n *\n * math.setDistinct(set)\n *\n * Examples:\n *\n * math.setDistinct([1, 1, 1, 2, 2, 3]) // returns [1, 2, 3]\n *\n * See also:\n *\n * setMultiplicity\n *\n * @param {Array | Matrix} a A multiset\n * @return {Array | Matrix} A set containing the distinc elements of the multiset\n */\n return typed(name, {\n 'Array | Matrix': function (a) {\n let result\n if (subset(size(a), new Index(0)) === 0) { // if empty, return empty\n result = []\n } else {\n const b = flatten(Array.isArray(a) ? a : a.toArray()).sort(compareNatural)\n result = []\n result.push(b[0])\n for (let i = 1; i < b.length; i++) {\n if (compareNatural(b[i], b[i - 1]) !== 0) {\n result.push(b[i])\n }\n }\n }\n // return an array, if the input was an array\n if (Array.isArray(a)) {\n return result\n }\n // return a matrix otherwise\n return new DenseMatrix(result)\n }\n })\n})\n","import { flatten, generalize, identify } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'setIntersect'\nconst dependencies = ['typed', 'size', 'subset', 'compareNatural', 'Index', 'DenseMatrix']\n\nexport const createSetIntersect = /* #__PURE__ */ factory(name, dependencies, ({ typed, size, subset, compareNatural, Index, DenseMatrix }) => {\n /**\n * Create the intersection of two (multi)sets.\n * Multi-dimension arrays will be converted to single-dimension arrays before the operation.\n *\n * Syntax:\n *\n * math.setIntersect(set1, set2)\n *\n * Examples:\n *\n * math.setIntersect([1, 2, 3, 4], [3, 4, 5, 6]) // returns [3, 4]\n * math.setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]]) // returns [3, 4]\n *\n * See also:\n *\n * setUnion, setDifference\n *\n * @param {Array | Matrix} a1 A (multi)set\n * @param {Array | Matrix} a2 A (multi)set\n * @return {Array | Matrix} The intersection of two (multi)sets\n */\n return typed(name, {\n 'Array | Matrix, Array | Matrix': function (a1, a2) {\n let result\n if (subset(size(a1), new Index(0)) === 0 || subset(size(a2), new Index(0)) === 0) { // of any of them is empty, return empty\n result = []\n } else {\n const b1 = identify(flatten(Array.isArray(a1) ? a1 : a1.toArray()).sort(compareNatural))\n const b2 = identify(flatten(Array.isArray(a2) ? a2 : a2.toArray()).sort(compareNatural))\n result = []\n for (let i = 0; i < b1.length; i++) {\n for (let j = 0; j < b2.length; j++) {\n if (compareNatural(b1[i].value, b2[j].value) === 0 && b1[i].identifier === b2[j].identifier) { // the identifier is always a decimal int\n result.push(b1[i])\n break\n }\n }\n }\n }\n // return an array, if both inputs were arrays\n if (Array.isArray(a1) && Array.isArray(a2)) {\n return generalize(result)\n }\n // return a matrix otherwise\n return new DenseMatrix(generalize(result))\n }\n })\n})\n","import { flatten, identify } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'setIsSubset'\nconst dependencies = ['typed', 'size', 'subset', 'compareNatural', 'Index']\n\nexport const createSetIsSubset = /* #__PURE__ */ factory(name, dependencies, ({ typed, size, subset, compareNatural, Index }) => {\n /**\n * Check whether a (multi)set is a subset of another (multi)set. (Every element of set1 is the element of set2.)\n * Multi-dimension arrays will be converted to single-dimension arrays before the operation.\n *\n * Syntax:\n *\n * math.setIsSubset(set1, set2)\n *\n * Examples:\n *\n * math.setIsSubset([1, 2], [3, 4, 5, 6]) // returns false\n * math.setIsSubset([3, 4], [3, 4, 5, 6]) // returns true\n *\n * See also:\n *\n * setUnion, setIntersect, setDifference\n *\n * @param {Array | Matrix} a1 A (multi)set\n * @param {Array | Matrix} a2 A (multi)set\n * @return {boolean} Returns true when a1 is a subset of a2, returns false otherwise\n */\n return typed(name, {\n 'Array | Matrix, Array | Matrix': function (a1, a2) {\n if (subset(size(a1), new Index(0)) === 0) { // empty is a subset of anything\n return true\n } else if (subset(size(a2), new Index(0)) === 0) { // anything is not a subset of empty\n return false\n }\n const b1 = identify(flatten(Array.isArray(a1) ? a1 : a1.toArray()).sort(compareNatural))\n const b2 = identify(flatten(Array.isArray(a2) ? a2 : a2.toArray()).sort(compareNatural))\n let inb2\n for (let i = 0; i < b1.length; i++) {\n inb2 = false\n for (let j = 0; j < b2.length; j++) {\n if (compareNatural(b1[i].value, b2[j].value) === 0 && b1[i].identifier === b2[j].identifier) { // the identifier is always a decimal int\n inb2 = true\n break\n }\n }\n if (inb2 === false) {\n return false\n }\n }\n return true\n }\n })\n})\n","import { flatten } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'setMultiplicity'\nconst dependencies = ['typed', 'size', 'subset', 'compareNatural', 'Index']\n\nexport const createSetMultiplicity = /* #__PURE__ */ factory(name, dependencies, ({ typed, size, subset, compareNatural, Index }) => {\n /**\n * Count the multiplicity of an element in a multiset.\n * A multi-dimension array will be converted to a single-dimension array before the operation.\n *\n * Syntax:\n *\n * math.setMultiplicity(element, set)\n *\n * Examples:\n *\n * math.setMultiplicity(1, [1, 2, 2, 4]) // returns 1\n * math.setMultiplicity(2, [1, 2, 2, 4]) // returns 2\n *\n * See also:\n *\n * setDistinct, setSize\n *\n * @param {number | BigNumber | Fraction | Complex} e An element in the multiset\n * @param {Array | Matrix} a A multiset\n * @return {number} The number of how many times the multiset contains the element\n */\n return typed(name, {\n 'number | BigNumber | Fraction | Complex, Array | Matrix': function (e, a) {\n if (subset(size(a), new Index(0)) === 0) { // if empty, return 0\n return 0\n }\n const b = flatten(Array.isArray(a) ? a : a.toArray())\n let count = 0\n for (let i = 0; i < b.length; i++) {\n if (compareNatural(b[i], e) === 0) {\n count++\n }\n }\n return count\n }\n })\n})\n","import { flatten } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'setPowerset'\nconst dependencies = ['typed', 'size', 'subset', 'compareNatural', 'Index']\n\nexport const createSetPowerset = /* #__PURE__ */ factory(name, dependencies, ({ typed, size, subset, compareNatural, Index }) => {\n /**\n * Create the powerset of a (multi)set. (The powerset contains very possible subsets of a (multi)set.)\n * A multi-dimension array will be converted to a single-dimension array before the operation.\n *\n * Syntax:\n *\n * math.setPowerset(set)\n *\n * Examples:\n *\n * math.setPowerset([1, 2, 3]) // returns [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]\n *\n * See also:\n *\n * setCartesian\n *\n * @param {Array | Matrix} a A (multi)set\n * @return {Array} The powerset of the (multi)set\n */\n return typed(name, {\n 'Array | Matrix': function (a) {\n if (subset(size(a), new Index(0)) === 0) { // if empty, return empty\n return []\n }\n const b = flatten(Array.isArray(a) ? a : a.toArray()).sort(compareNatural)\n const result = []\n let number = 0\n while (number.toString(2).length <= b.length) {\n result.push(_subset(b, number.toString(2).split('').reverse()))\n number++\n }\n // can not return a matrix, because of the different size of the subarrays\n return _sort(result)\n }\n })\n\n // create subset\n function _subset (array, bitarray) {\n const result = []\n for (let i = 0; i < bitarray.length; i++) {\n if (bitarray[i] === '1') {\n result.push(array[i])\n }\n }\n return result\n }\n\n // sort subsests by length\n function _sort (array) {\n let temp = []\n for (let i = array.length - 1; i > 0; i--) {\n for (let j = 0; j < i; j++) {\n if (array[j].length > array[j + 1].length) {\n temp = array[j]\n array[j] = array[j + 1]\n array[j + 1] = temp\n }\n }\n }\n return array\n }\n})\n","import { flatten } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'setSize'\nconst dependencies = ['typed', 'compareNatural']\n\nexport const createSetSize = /* #__PURE__ */ factory(name, dependencies, ({ typed, compareNatural }) => {\n /**\n * Count the number of elements of a (multi)set. When a second parameter is 'true', count only the unique values.\n * A multi-dimension array will be converted to a single-dimension array before the operation.\n *\n * Syntax:\n *\n * math.setSize(set)\n * math.setSize(set, unique)\n *\n * Examples:\n *\n * math.setSize([1, 2, 2, 4]) // returns 4\n * math.setSize([1, 2, 2, 4], true) // returns 3\n *\n * See also:\n *\n * setUnion, setIntersect, setDifference\n *\n * @param {Array | Matrix} a A multiset\n * @param {boolean} [unique] If true, only the unique values are counted. False by default\n * @return {number} The number of elements of the (multi)set\n */\n return typed(name, {\n 'Array | Matrix': function (a) {\n return Array.isArray(a) ? flatten(a).length : flatten(a.toArray()).length\n },\n 'Array | Matrix, boolean': function (a, unique) {\n if (unique === false || a.length === 0) {\n return Array.isArray(a) ? flatten(a).length : flatten(a.toArray()).length\n } else {\n const b = flatten(Array.isArray(a) ? a : a.toArray()).sort(compareNatural)\n let count = 1\n for (let i = 1; i < b.length; i++) {\n if (compareNatural(b[i], b[i - 1]) !== 0) {\n count++\n }\n }\n return count\n }\n }\n })\n})\n","import { flatten } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'setSymDifference'\nconst dependencies = ['typed', 'size', 'concat', 'subset', 'setDifference', 'Index']\n\nexport const createSetSymDifference = /* #__PURE__ */ factory(name, dependencies, ({ typed, size, concat, subset, setDifference, Index }) => {\n /**\n * Create the symmetric difference of two (multi)sets.\n * Multi-dimension arrays will be converted to single-dimension arrays before the operation.\n *\n * Syntax:\n *\n * math.setSymDifference(set1, set2)\n *\n * Examples:\n *\n * math.setSymDifference([1, 2, 3, 4], [3, 4, 5, 6]) // returns [1, 2, 5, 6]\n * math.setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]]) // returns [1, 2, 5, 6]\n *\n * See also:\n *\n * setUnion, setIntersect, setDifference\n *\n * @param {Array | Matrix} a1 A (multi)set\n * @param {Array | Matrix} a2 A (multi)set\n * @return {Array | Matrix} The symmetric difference of two (multi)sets\n */\n return typed(name, {\n 'Array | Matrix, Array | Matrix': function (a1, a2) {\n if (subset(size(a1), new Index(0)) === 0) { // if any of them is empty, return the other one\n return flatten(a2)\n } else if (subset(size(a2), new Index(0)) === 0) {\n return flatten(a1)\n }\n const b1 = flatten(a1)\n const b2 = flatten(a2)\n return concat(setDifference(b1, b2), setDifference(b2, b1))\n }\n })\n})\n","import { flatten } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'setUnion'\nconst dependencies = ['typed', 'size', 'concat', 'subset', 'setIntersect', 'setSymDifference', 'Index']\n\nexport const createSetUnion = /* #__PURE__ */ factory(name, dependencies, ({ typed, size, concat, subset, setIntersect, setSymDifference, Index }) => {\n /**\n * Create the union of two (multi)sets.\n * Multi-dimension arrays will be converted to single-dimension arrays before the operation.\n *\n * Syntax:\n *\n * math.setUnion(set1, set2)\n *\n * Examples:\n *\n * math.setUnion([1, 2, 3, 4], [3, 4, 5, 6]) // returns [1, 2, 3, 4, 5, 6]\n * math.setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]]) // returns [1, 2, 3, 4, 5, 6]\n *\n * See also:\n *\n * setIntersect, setDifference\n *\n * @param {Array | Matrix} a1 A (multi)set\n * @param {Array | Matrix} a2 A (multi)set\n * @return {Array | Matrix} The union of two (multi)sets\n */\n return typed(name, {\n 'Array | Matrix, Array | Matrix': function (a1, a2) {\n if (subset(size(a1), new Index(0)) === 0) { // if any of them is empty, return the other one\n return flatten(a2)\n } else if (subset(size(a2), new Index(0)) === 0) {\n return flatten(a1)\n }\n const b1 = flatten(a1)\n const b2 = flatten(a2)\n return concat(setSymDifference(b1, b2), setIntersect(b1, b2))\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { createMatAlgo01xDSid } from '../../type/matrix/utils/matAlgo01xDSid.js'\nimport { createMatAlgo04xSidSid } from '../../type/matrix/utils/matAlgo04xSidSid.js'\nimport { createMatAlgo10xSids } from '../../type/matrix/utils/matAlgo10xSids.js'\nimport { createMatrixAlgorithmSuite } from '../../type/matrix/utils/matrixAlgorithmSuite.js'\n\nconst name = 'add'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'addScalar',\n 'equalScalar',\n 'DenseMatrix',\n 'SparseMatrix',\n 'concat'\n]\n\nexport const createAdd = /* #__PURE__ */ factory(\n name,\n dependencies,\n ({ typed, matrix, addScalar, equalScalar, DenseMatrix, SparseMatrix, concat }) => {\n const matAlgo01xDSid = createMatAlgo01xDSid({ typed })\n const matAlgo04xSidSid = createMatAlgo04xSidSid({ typed, equalScalar })\n const matAlgo10xSids = createMatAlgo10xSids({ typed, DenseMatrix })\n const matrixAlgorithmSuite = createMatrixAlgorithmSuite({ typed, matrix, concat })\n /**\n * Add two or more values, `x + y`.\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.add(x, y)\n * math.add(x, y, z, ...)\n *\n * Examples:\n *\n * math.add(2, 3) // returns number 5\n * math.add(2, 3, 4) // returns number 9\n *\n * const a = math.complex(2, 3)\n * const b = math.complex(-4, 1)\n * math.add(a, b) // returns Complex -2 + 4i\n *\n * math.add([1, 2, 3], 4) // returns Array [5, 6, 7]\n *\n * const c = math.unit('5 cm')\n * const d = math.unit('2.1 mm')\n * math.add(c, d) // returns Unit 52.1 mm\n *\n * math.add(\"2.3\", \"4\") // returns number 6.3\n *\n * See also:\n *\n * subtract, sum\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} x First value to add\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} y Second value to add\n * @return {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} Sum of `x` and `y`\n */\n return typed(\n name,\n {\n 'any, any': addScalar,\n\n 'any, any, ...any': typed.referToSelf(self => (x, y, rest) => {\n let result = self(x, y)\n\n for (let i = 0; i < rest.length; i++) {\n result = self(result, rest[i])\n }\n\n return result\n })\n },\n matrixAlgorithmSuite({\n elop: addScalar,\n DS: matAlgo01xDSid,\n SS: matAlgo04xSidSid,\n Ss: matAlgo10xSids\n })\n )\n })\n","import { factory } from '../../utils/factory.js'\nimport { flatten } from '../../utils/array.js'\nimport { isComplex } from '../../utils/is.js'\n\nconst name = 'hypot'\nconst dependencies = [\n 'typed',\n 'abs',\n 'addScalar',\n 'divideScalar',\n 'multiplyScalar',\n 'sqrt',\n 'smaller',\n 'isPositive'\n]\n\nexport const createHypot = /* #__PURE__ */ factory(name, dependencies, ({ typed, abs, addScalar, divideScalar, multiplyScalar, sqrt, smaller, isPositive }) => {\n /**\n * Calculate the hypotenuse of a list with values. The hypotenuse is defined as:\n *\n * hypot(a, b, c, ...) = sqrt(a^2 + b^2 + c^2 + ...)\n *\n * For matrix input, the hypotenuse is calculated for all values in the matrix.\n *\n * Syntax:\n *\n * math.hypot(a, b, ...)\n * math.hypot([a, b, c, ...])\n *\n * Examples:\n *\n * math.hypot(3, 4) // 5\n * math.hypot(3, 4, 5) // 7.0710678118654755\n * math.hypot([3, 4, 5]) // 7.0710678118654755\n * math.hypot(-2) // 2\n *\n * See also:\n *\n * abs, norm\n *\n * @param {... number | BigNumber | Array | Matrix} args A list with numeric values or an Array or Matrix.\n * Matrix and Array input is flattened and returns a\n * single number for the whole matrix.\n * @return {number | BigNumber} Returns the hypothenusa of the input values.\n */\n return typed(name, {\n '... number | BigNumber': _hypot,\n\n Array: _hypot,\n\n Matrix: M => _hypot(flatten(M.toArray(), true))\n })\n\n /**\n * Calculate the hypotenuse for an Array with values\n * @param {Array.} args\n * @return {number | BigNumber} Returns the result\n * @private\n */\n function _hypot (args) {\n // code based on `hypot` from es6-shim:\n // https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L1619-L1633\n let result = 0\n let largest = 0\n\n for (let i = 0; i < args.length; i++) {\n if (isComplex(args[i])) {\n throw new TypeError('Unexpected type of argument to hypot')\n }\n const value = abs(args[i])\n if (smaller(largest, value)) {\n result = multiplyScalar(result,\n multiplyScalar(divideScalar(largest, value), divideScalar(largest, value)))\n result = addScalar(result, 1)\n largest = value\n } else {\n result = addScalar(result, isPositive(value)\n ? multiplyScalar(divideScalar(value, largest), divideScalar(value, largest))\n : value)\n }\n }\n\n return multiplyScalar(largest, sqrt(result))\n }\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'norm'\nconst dependencies = [\n 'typed',\n 'abs',\n 'add',\n 'pow',\n 'conj',\n 'sqrt',\n 'multiply',\n 'equalScalar',\n 'larger',\n 'smaller',\n 'matrix',\n 'ctranspose',\n 'eigs'\n]\n\nexport const createNorm = /* #__PURE__ */ factory(\n name,\n dependencies,\n ({\n typed,\n abs,\n add,\n pow,\n conj,\n sqrt,\n multiply,\n equalScalar,\n larger,\n smaller,\n matrix,\n ctranspose,\n eigs\n }) => {\n /**\n * Calculate the norm of a number, vector or matrix.\n *\n * The second parameter p is optional. If not provided, it defaults to 2.\n *\n * Syntax:\n *\n * math.norm(x)\n * math.norm(x, p)\n *\n * Examples:\n *\n * math.abs(-3.5) // returns 3.5\n * math.norm(-3.5) // returns 3.5\n *\n * math.norm(math.complex(3, -4)) // returns 5\n *\n * math.norm([1, 2, -3], Infinity) // returns 3\n * math.norm([1, 2, -3], -Infinity) // returns 1\n *\n * math.norm([3, 4], 2) // returns 5\n *\n * math.norm([[1, 2], [3, 4]], 1) // returns 6\n * math.norm([[1, 2], [3, 4]], 'inf') // returns 7\n * math.norm([[1, 2], [3, 4]], 'fro') // returns 5.477225575051661\n *\n * See also:\n *\n * abs, hypot\n *\n * @param {number | BigNumber | Complex | Array | Matrix} x\n * Value for which to calculate the norm\n * @param {number | BigNumber | string} [p=2]\n * Vector space.\n * Supported numbers include Infinity and -Infinity.\n * Supported strings are: 'inf', '-inf', and 'fro' (The Frobenius norm)\n * @return {number | BigNumber} the p-norm\n */\n return typed(name, {\n number: Math.abs,\n\n Complex: function (x) {\n return x.abs()\n },\n\n BigNumber: function (x) {\n // norm(x) = abs(x)\n return x.abs()\n },\n\n boolean: function (x) {\n // norm(x) = abs(x)\n return Math.abs(x)\n },\n\n Array: function (x) {\n return _norm(matrix(x), 2)\n },\n\n Matrix: function (x) {\n return _norm(x, 2)\n },\n\n 'Array, number | BigNumber | string': function (x, p) {\n return _norm(matrix(x), p)\n },\n\n 'Matrix, number | BigNumber | string': function (x, p) {\n return _norm(x, p)\n }\n })\n\n /**\n * Calculate the plus infinity norm for a vector\n * @param {Matrix} x\n * @returns {number} Returns the norm\n * @private\n */\n function _vectorNormPlusInfinity (x) {\n // norm(x, Infinity) = max(abs(x))\n let pinf = 0\n // skip zeros since abs(0) === 0\n x.forEach(function (value) {\n const v = abs(value)\n if (larger(v, pinf)) {\n pinf = v\n }\n }, true)\n return pinf\n }\n\n /**\n * Calculate the minus infinity norm for a vector\n * @param {Matrix} x\n * @returns {number} Returns the norm\n * @private\n */\n function _vectorNormMinusInfinity (x) {\n // norm(x, -Infinity) = min(abs(x))\n let ninf\n // skip zeros since abs(0) === 0\n x.forEach(function (value) {\n const v = abs(value)\n if (!ninf || smaller(v, ninf)) {\n ninf = v\n }\n }, true)\n return ninf || 0\n }\n\n /**\n * Calculate the norm for a vector\n * @param {Matrix} x\n * @param {number | string} p\n * @returns {number} Returns the norm\n * @private\n */\n function _vectorNorm (x, p) {\n // check p\n if (p === Number.POSITIVE_INFINITY || p === 'inf') {\n return _vectorNormPlusInfinity(x)\n }\n if (p === Number.NEGATIVE_INFINITY || p === '-inf') {\n return _vectorNormMinusInfinity(x)\n }\n if (p === 'fro') {\n return _norm(x, 2)\n }\n if (typeof p === 'number' && !isNaN(p)) {\n // check p != 0\n if (!equalScalar(p, 0)) {\n // norm(x, p) = sum(abs(xi) ^ p) ^ 1/p\n let n = 0\n // skip zeros since abs(0) === 0\n x.forEach(function (value) {\n n = add(pow(abs(value), p), n)\n }, true)\n return pow(n, 1 / p)\n }\n return Number.POSITIVE_INFINITY\n }\n // invalid parameter value\n throw new Error('Unsupported parameter value')\n }\n\n /**\n * Calculate the Frobenius norm for a matrix\n * @param {Matrix} x\n * @returns {number} Returns the norm\n * @private\n */\n function _matrixNormFrobenius (x) {\n // norm(x) = sqrt(sum(diag(x'x)))\n let fro = 0\n x.forEach(function (value, index) {\n fro = add(fro, multiply(value, conj(value)))\n })\n return abs(sqrt(fro))\n }\n\n /**\n * Calculate the norm L1 for a matrix\n * @param {Matrix} x\n * @returns {number} Returns the norm\n * @private\n */\n function _matrixNormOne (x) {\n // norm(x) = the largest column sum\n const c = []\n // result\n let maxc = 0\n // skip zeros since abs(0) == 0\n x.forEach(function (value, index) {\n const j = index[1]\n const cj = add(c[j] || 0, abs(value))\n if (larger(cj, maxc)) {\n maxc = cj\n }\n c[j] = cj\n }, true)\n return maxc\n }\n\n /**\n * Calculate the norm L2 for a matrix\n * @param {Matrix} x\n * @returns {number} Returns the norm\n * @private\n */\n function _matrixNormTwo (x) {\n // norm(x) = sqrt( max eigenvalue of A*.A)\n const sizeX = x.size()\n if (sizeX[0] !== sizeX[1]) {\n throw new RangeError('Invalid matrix dimensions')\n }\n const tx = ctranspose(x)\n const squaredX = multiply(tx, x)\n const eigenVals = eigs(squaredX).values.toArray()\n const rho = eigenVals[eigenVals.length - 1]\n return abs(sqrt(rho))\n }\n\n /**\n * Calculate the infinity norm for a matrix\n * @param {Matrix} x\n * @returns {number} Returns the norm\n * @private\n */\n function _matrixNormInfinity (x) {\n // norm(x) = the largest row sum\n const r = []\n // result\n let maxr = 0\n // skip zeros since abs(0) == 0\n x.forEach(function (value, index) {\n const i = index[0]\n const ri = add(r[i] || 0, abs(value))\n if (larger(ri, maxr)) {\n maxr = ri\n }\n r[i] = ri\n }, true)\n return maxr\n }\n\n /**\n * Calculate the norm for a 2D Matrix (M*N)\n * @param {Matrix} x\n * @param {number | string} p\n * @returns {number} Returns the norm\n * @private\n */\n function _matrixNorm (x, p) {\n // check p\n if (p === 1) {\n return _matrixNormOne(x)\n }\n if (p === Number.POSITIVE_INFINITY || p === 'inf') {\n return _matrixNormInfinity(x)\n }\n if (p === 'fro') {\n return _matrixNormFrobenius(x)\n }\n if (p === 2) {\n return _matrixNormTwo(x)\n } // invalid parameter value\n\n throw new Error('Unsupported parameter value ' + p)\n }\n\n /**\n * Calculate the norm for an array\n * @param {Matrix} x\n * @param {number | string} p\n * @returns {number} Returns the norm\n * @private\n */\n function _norm (x, p) {\n // size\n const sizeX = x.size()\n\n // check if it is a vector\n if (sizeX.length === 1) {\n return _vectorNorm(x, p)\n }\n // MxN matrix\n if (sizeX.length === 2) {\n if (sizeX[0] && sizeX[1]) {\n return _matrixNorm(x, p)\n } else {\n throw new RangeError('Invalid matrix dimensions')\n }\n }\n }\n }\n)\n","import { factory } from '../../utils/factory.js'\nimport { isMatrix } from '../../utils/is.js'\n\nconst name = 'dot'\nconst dependencies = ['typed', 'addScalar', 'multiplyScalar', 'conj', 'size']\n\nexport const createDot = /* #__PURE__ */ factory(name, dependencies, ({ typed, addScalar, multiplyScalar, conj, size }) => {\n /**\n * Calculate the dot product of two vectors. The dot product of\n * `A = [a1, a2, ..., an]` and `B = [b1, b2, ..., bn]` is defined as:\n *\n * dot(A, B) = conj(a1) * b1 + conj(a2) * b2 + ... + conj(an) * bn\n *\n * Syntax:\n *\n * math.dot(x, y)\n *\n * Examples:\n *\n * math.dot([2, 4, 1], [2, 2, 3]) // returns number 15\n * math.multiply([2, 4, 1], [2, 2, 3]) // returns number 15\n *\n * See also:\n *\n * multiply, cross\n *\n * @param {Array | Matrix} x First vector\n * @param {Array | Matrix} y Second vector\n * @return {number} Returns the dot product of `x` and `y`\n */\n return typed(name, {\n 'Array | DenseMatrix, Array | DenseMatrix': _denseDot,\n 'SparseMatrix, SparseMatrix': _sparseDot\n })\n\n function _validateDim (x, y) {\n const xSize = _size(x)\n const ySize = _size(y)\n let xLen, yLen\n\n if (xSize.length === 1) {\n xLen = xSize[0]\n } else if (xSize.length === 2 && xSize[1] === 1) {\n xLen = xSize[0]\n } else {\n throw new RangeError('Expected a column vector, instead got a matrix of size (' + xSize.join(', ') + ')')\n }\n\n if (ySize.length === 1) {\n yLen = ySize[0]\n } else if (ySize.length === 2 && ySize[1] === 1) {\n yLen = ySize[0]\n } else {\n throw new RangeError('Expected a column vector, instead got a matrix of size (' + ySize.join(', ') + ')')\n }\n\n if (xLen !== yLen) throw new RangeError('Vectors must have equal length (' + xLen + ' != ' + yLen + ')')\n if (xLen === 0) throw new RangeError('Cannot calculate the dot product of empty vectors')\n\n return xLen\n }\n\n function _denseDot (a, b) {\n const N = _validateDim(a, b)\n\n const adata = isMatrix(a) ? a._data : a\n const adt = isMatrix(a) ? a._datatype || a.getDataType() : undefined\n\n const bdata = isMatrix(b) ? b._data : b\n const bdt = isMatrix(b) ? b._datatype || b.getDataType() : undefined\n\n // are these 2-dimensional column vectors? (as opposed to 1-dimensional vectors)\n const aIsColumn = _size(a).length === 2\n const bIsColumn = _size(b).length === 2\n\n let add = addScalar\n let mul = multiplyScalar\n\n // process data types\n if (adt && bdt && adt === bdt && typeof adt === 'string' && adt !== 'mixed') {\n const dt = adt\n // find signatures that matches (dt, dt)\n add = typed.find(addScalar, [dt, dt])\n mul = typed.find(multiplyScalar, [dt, dt])\n }\n\n // both vectors 1-dimensional\n if (!aIsColumn && !bIsColumn) {\n let c = mul(conj(adata[0]), bdata[0])\n for (let i = 1; i < N; i++) {\n c = add(c, mul(conj(adata[i]), bdata[i]))\n }\n return c\n }\n\n // a is 1-dim, b is column\n if (!aIsColumn && bIsColumn) {\n let c = mul(conj(adata[0]), bdata[0][0])\n for (let i = 1; i < N; i++) {\n c = add(c, mul(conj(adata[i]), bdata[i][0]))\n }\n return c\n }\n\n // a is column, b is 1-dim\n if (aIsColumn && !bIsColumn) {\n let c = mul(conj(adata[0][0]), bdata[0])\n for (let i = 1; i < N; i++) {\n c = add(c, mul(conj(adata[i][0]), bdata[i]))\n }\n return c\n }\n\n // both vectors are column\n if (aIsColumn && bIsColumn) {\n let c = mul(conj(adata[0][0]), bdata[0][0])\n for (let i = 1; i < N; i++) {\n c = add(c, mul(conj(adata[i][0]), bdata[i][0]))\n }\n return c\n }\n }\n\n function _sparseDot (x, y) {\n _validateDim(x, y)\n\n const xindex = x._index\n const xvalues = x._values\n\n const yindex = y._index\n const yvalues = y._values\n\n // TODO optimize add & mul using datatype\n let c = 0\n const add = addScalar\n const mul = multiplyScalar\n\n let i = 0\n let j = 0\n while (i < xindex.length && j < yindex.length) {\n const I = xindex[i]\n const J = yindex[j]\n\n if (I < J) {\n i++\n continue\n }\n if (I > J) {\n j++\n continue\n }\n if (I === J) {\n c = add(c, mul(xvalues[i], yvalues[j]))\n i++\n j++\n }\n }\n\n return c\n }\n\n // TODO remove this once #1771 is fixed\n function _size (x) {\n return isMatrix(x) ? x.size() : size(x)\n }\n})\n","import { clone } from '../../utils/object.js'\nimport { format } from '../../utils/string.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'trace'\nconst dependencies = ['typed', 'matrix', 'add']\n\nexport const createTrace = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, add }) => {\n /**\n * Calculate the trace of a matrix: the sum of the elements on the main\n * diagonal of a square matrix.\n *\n * Syntax:\n *\n * math.trace(x)\n *\n * Examples:\n *\n * math.trace([[1, 2], [3, 4]]) // returns 5\n *\n * const A = [\n * [1, 2, 3],\n * [-1, 2, 3],\n * [2, 0, 3]\n * ]\n * math.trace(A) // returns 6\n *\n * See also:\n *\n * diag\n *\n * @param {Array | Matrix} x A matrix\n *\n * @return {number} The trace of `x`\n */\n return typed('trace', {\n Array: function _arrayTrace (x) {\n // use dense matrix implementation\n return _denseTrace(matrix(x))\n },\n\n SparseMatrix: _sparseTrace,\n\n DenseMatrix: _denseTrace,\n\n any: clone\n })\n\n function _denseTrace (m) {\n // matrix size & data\n const size = m._size\n const data = m._data\n\n // process dimensions\n switch (size.length) {\n case 1:\n // vector\n if (size[0] === 1) {\n // return data[0]\n return clone(data[0])\n }\n throw new RangeError('Matrix must be square (size: ' + format(size) + ')')\n case 2:\n {\n // two dimensional\n const rows = size[0]\n const cols = size[1]\n if (rows === cols) {\n // calulate sum\n let sum = 0\n // loop diagonal\n for (let i = 0; i < rows; i++) { sum = add(sum, data[i][i]) }\n // return trace\n return sum\n } else {\n throw new RangeError('Matrix must be square (size: ' + format(size) + ')')\n }\n }\n default:\n // multi dimensional\n throw new RangeError('Matrix must be two dimensional (size: ' + format(size) + ')')\n }\n }\n\n function _sparseTrace (m) {\n // matrix arrays\n const values = m._values\n const index = m._index\n const ptr = m._ptr\n const size = m._size\n // check dimensions\n const rows = size[0]\n const columns = size[1]\n // matrix must be square\n if (rows === columns) {\n // calulate sum\n let sum = 0\n // check we have data (avoid looping columns)\n if (values.length > 0) {\n // loop columns\n for (let j = 0; j < columns; j++) {\n // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1]\n const k0 = ptr[j]\n const k1 = ptr[j + 1]\n // loop k within [k0, k1[\n for (let k = k0; k < k1; k++) {\n // row index\n const i = index[k]\n // check row\n if (i === j) {\n // accumulate value\n sum = add(sum, values[k])\n // exit loop\n break\n }\n if (i > j) {\n // exit loop, no value on the diagonal for column j\n break\n }\n }\n }\n }\n // return trace\n return sum\n }\n throw new RangeError('Matrix must be square (size: ' + format(size) + ')')\n }\n})\n","import { isBigNumber, isMatrix, isArray } from '../../../utils/is.js'\nimport { factory } from '../../../utils/factory.js'\n\nconst name = 'index'\nconst dependencies = ['typed', 'Index']\n\nexport const createIndex = /* #__PURE__ */ factory(name, dependencies, ({ typed, Index }) => {\n /**\n * Create an index. An Index can store ranges having start, step, and end\n * for multiple dimensions.\n * Matrix.get, Matrix.set, and math.subset accept an Index as input.\n *\n * Syntax:\n *\n * math.index(range1, range2, ...)\n *\n * Where each range can be any of:\n *\n * - A number\n * - A string for getting/setting an object property\n * - An instance of `Range`\n * - A one-dimensional Array or a Matrix with numbers or booleans\n *\n * Indexes must be zero-based, integer numbers.\n *\n * Examples:\n *\n * const b = [1, 2, 3, 4, 5]\n * math.subset(b, math.index([1, 2, 3])) // returns [2, 3, 4]\n * math.subset(b, math.index([false, true, true, true, false])) // returns [2, 3, 4]\n *\n * const a = math.matrix([[1, 2], [3, 4]])\n * a.subset(math.index(0, 1)) // returns 2\n * a.subset(math.index(0, [false, true])) // returns 2\n *\n * See also:\n *\n * bignumber, boolean, complex, matrix, number, string, unit\n *\n * @param {...*} ranges Zero or more ranges or numbers.\n * @return {Index} Returns the created index\n */\n return typed(name, {\n '...number | string | BigNumber | Range | Array | Matrix': function (args) {\n const ranges = args.map(function (arg) {\n if (isBigNumber(arg)) {\n return arg.toNumber() // convert BigNumber to Number\n } else if (isArray(arg) || isMatrix(arg)) {\n return arg.map(function (elem) {\n // convert BigNumber to Number\n return isBigNumber(elem) ? elem.toNumber() : elem\n })\n } else {\n return arg\n }\n })\n\n const res = new Index()\n Index.apply(res, ranges)\n return res\n }\n })\n})\n","// Reserved keywords not allowed to use in the parser\nexport const keywords = new Set([\n 'end'\n])\n","import { isNode } from '../../utils/is.js'\n\nimport { keywords } from '../keywords.js'\nimport { deepStrictEqual } from '../../utils/object.js'\nimport { factory } from '../../utils/factory.js'\nimport { createMap } from '../../utils/map.js'\n\nconst name = 'Node'\nconst dependencies = ['mathWithTransform']\n\nexport const createNode = /* #__PURE__ */ factory(name, dependencies, ({ mathWithTransform }) => {\n /**\n * Validate the symbol names of a scope.\n * Throws an error when the scope contains an illegal symbol.\n * @param {Object} scope\n */\n function _validateScope (scope) {\n for (const symbol of [...keywords]) {\n if (scope.has(symbol)) {\n throw new Error('Scope contains an illegal symbol, \"' + symbol + '\" is a reserved keyword')\n }\n }\n }\n\n class Node {\n get type () { return 'Node' }\n get isNode () { return true }\n\n /**\n * Evaluate the node\n * @param {Object} [scope] Scope to read/write variables\n * @return {*} Returns the result\n */\n evaluate (scope) {\n return this.compile().evaluate(scope)\n }\n\n /**\n * Compile the node into an optimized, evauatable JavaScript function\n * @return {{evaluate: function([Object])}} object\n * Returns an object with a function 'evaluate',\n * which can be invoked as expr.evaluate([scope: Object]),\n * where scope is an optional object with\n * variables.\n */\n compile () {\n const expr = this._compile(mathWithTransform, {})\n const args = {}\n const context = null\n\n function evaluate (scope) {\n const s = createMap(scope)\n _validateScope(s)\n return expr(s, args, context)\n }\n\n return {\n evaluate\n }\n }\n\n /**\n * Compile a node into a JavaScript function.\n * This basically pre-calculates as much as possible and only leaves open\n * calculations which depend on a dynamic scope with variables.\n * @param {Object} math Math.js namespace with functions and constants.\n * @param {Object} argNames An object with argument names as key and `true`\n * as value. Used in the SymbolNode to optimize\n * for arguments from user assigned functions\n * (see FunctionAssignmentNode) or special symbols\n * like `end` (see IndexNode).\n * @return {function} Returns a function which can be called like:\n * evalNode(scope: Object, args: Object, context: *)\n */\n _compile (math, argNames) {\n throw new Error('Method _compile must be implemented by type ' + this.type)\n }\n\n /**\n * Execute a callback for each of the child nodes of this node\n * @param {function(child: Node, path: string, parent: Node)} callback\n */\n forEach (callback) {\n // must be implemented by each of the Node implementations\n throw new Error('Cannot run forEach on a Node interface')\n }\n\n /**\n * Create a new Node whose children are the results of calling the\n * provided callback function for each child of the original node.\n * @param {function(child: Node, path: string, parent: Node): Node} callback\n * @returns {OperatorNode} Returns a transformed copy of the node\n */\n map (callback) {\n // must be implemented by each of the Node implementations\n throw new Error('Cannot run map on a Node interface')\n }\n\n /**\n * Validate whether an object is a Node, for use with map\n * @param {Node} node\n * @returns {Node} Returns the input if it's a node, else throws an Error\n * @protected\n */\n _ifNode (node) {\n if (!isNode(node)) {\n throw new TypeError('Callback function must return a Node')\n }\n return node\n }\n\n /**\n * Recursively traverse all nodes in a node tree. Executes given callback for\n * this node and each of its child nodes.\n * @param {function(node: Node, path: string, parent: Node)} callback\n * A callback called for every node in the node tree.\n */\n traverse (callback) {\n // execute callback for itself\n // eslint-disable-next-line\n callback(this, null, null)\n\n // recursively traverse over all children of a node\n function _traverse (node, callback) {\n node.forEach(function (child, path, parent) {\n callback(child, path, parent)\n _traverse(child, callback)\n })\n }\n\n _traverse(this, callback)\n }\n\n /**\n * Recursively transform a node tree via a transform function.\n *\n * For example, to replace all nodes of type SymbolNode having name 'x' with\n * a ConstantNode with value 2:\n *\n * const res = Node.transform(function (node, path, parent) {\n * if (node && node.isSymbolNode) && (node.name === 'x')) {\n * return new ConstantNode(2)\n * }\n * else {\n * return node\n * }\n * })\n *\n * @param {function(node: Node, path: string, parent: Node) : Node} callback\n * A mapping function accepting a node, and returning\n * a replacement for the node or the original node. The \"signature\"\n * of the callback must be:\n * callback(node: Node, index: string, parent: Node) : Node\n * @return {Node} Returns the original node or its replacement\n */\n transform (callback) {\n function _transform (child, path, parent) {\n const replacement = callback(child, path, parent)\n\n if (replacement !== child) {\n // stop iterating when the node is replaced\n return replacement\n }\n\n return child.map(_transform)\n }\n\n return _transform(this, null, null)\n }\n\n /**\n * Find any node in the node tree matching given filter function. For\n * example, to find all nodes of type SymbolNode having name 'x':\n *\n * const results = Node.filter(function (node) {\n * return (node && node.isSymbolNode) && (node.name === 'x')\n * })\n *\n * @param {function(node: Node, path: string, parent: Node) : Node} callback\n * A test function returning true when a node matches, and false\n * otherwise. Function signature:\n * callback(node: Node, index: string, parent: Node) : boolean\n * @return {Node[]} nodes\n * An array with nodes matching given filter criteria\n */\n filter (callback) {\n const nodes = []\n\n this.traverse(function (node, path, parent) {\n if (callback(node, path, parent)) {\n nodes.push(node)\n }\n })\n\n return nodes\n }\n\n /**\n * Create a shallow clone of this node\n * @return {Node}\n */\n clone () {\n // must be implemented by each of the Node implementations\n throw new Error('Cannot clone a Node interface')\n }\n\n /**\n * Create a deep clone of this node\n * @return {Node}\n */\n cloneDeep () {\n return this.map(function (node) {\n return node.cloneDeep()\n })\n }\n\n /**\n * Deep compare this node with another node.\n * @param {Node} other\n * @return {boolean} Returns true when both nodes are of the same type and\n * contain the same values (as do their childs)\n */\n equals (other) {\n return other\n ? this.type === other.type && deepStrictEqual(this, other)\n : false\n }\n\n /**\n * Get string representation. (wrapper function)\n *\n * This function can get an object of the following form:\n * {\n * handler: //This can be a callback function of the form\n * // \"function callback(node, options)\"or\n * // a map that maps function names (used in FunctionNodes)\n * // to callbacks\n * parenthesis: \"keep\" //the parenthesis option (This is optional)\n * }\n *\n * @param {Object} [options]\n * @return {string}\n */\n toString (options) {\n const customString = this._getCustomString(options)\n\n if (typeof customString !== 'undefined') {\n return customString\n }\n\n return this._toString(options)\n }\n\n /**\n * Internal function to generate the string output.\n * This has to be implemented by every Node\n *\n * @throws {Error}\n */\n _toString () {\n // must be implemented by each of the Node implementations\n throw new Error('_toString not implemented for ' + this.type)\n }\n\n /**\n * Get a JSON representation of the node\n * Both .toJSON() and the static .fromJSON(json) should be implemented by all\n * implementations of Node\n * @returns {Object}\n */\n toJSON () {\n throw new Error(\n 'Cannot serialize object: toJSON not implemented by ' + this.type)\n }\n\n /**\n * Get HTML representation. (wrapper function)\n *\n * This function can get an object of the following form:\n * {\n * handler: //This can be a callback function of the form\n * // \"function callback(node, options)\" or\n * // a map that maps function names (used in FunctionNodes)\n * // to callbacks\n * parenthesis: \"keep\" //the parenthesis option (This is optional)\n * }\n *\n * @param {Object} [options]\n * @return {string}\n */\n toHTML (options) {\n const customString = this._getCustomString(options)\n\n if (typeof customString !== 'undefined') {\n return customString\n }\n\n return this._toHTML(options)\n }\n\n /**\n * Internal function to generate the HTML output.\n * This has to be implemented by every Node\n *\n * @throws {Error}\n */\n _toHTML () {\n // must be implemented by each of the Node implementations\n throw new Error('_toHTML not implemented for ' + this.type)\n }\n\n /**\n * Get LaTeX representation. (wrapper function)\n *\n * This function can get an object of the following form:\n * {\n * handler: //This can be a callback function of the form\n * // \"function callback(node, options)\"or\n * // a map that maps function names (used in FunctionNodes)\n * // to callbacks\n * parenthesis: \"keep\" //the parenthesis option (This is optional)\n * }\n *\n * @param {Object} [options]\n * @return {string}\n */\n toTex (options) {\n const customString = this._getCustomString(options)\n\n if (typeof customString !== 'undefined') {\n return customString\n }\n\n return this._toTex(options)\n }\n\n /**\n * Internal function to generate the LaTeX output.\n * This has to be implemented by every Node\n *\n * @param {Object} [options]\n * @throws {Error}\n */\n _toTex (options) {\n // must be implemented by each of the Node implementations\n throw new Error('_toTex not implemented for ' + this.type)\n }\n\n /**\n * Helper used by `to...` functions.\n */\n _getCustomString (options) {\n if (options && typeof options === 'object') {\n switch (typeof options.handler) {\n case 'object':\n case 'undefined':\n return\n case 'function':\n return options.handler(this, options)\n default:\n throw new TypeError('Object or function expected as callback')\n }\n }\n }\n\n /**\n * Get identifier.\n * @return {string}\n */\n getIdentifier () {\n return this.type\n }\n\n /**\n * Get the content of the current Node.\n * @return {Node} node\n **/\n getContent () {\n return this\n }\n }\n\n return Node\n}, { isClass: true, isNode: true })\n","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}\nexport { _typeof as default };","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperty(e, r, t) {\n return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\nexport { _defineProperty as default };","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}\nexport { toPropertyKey as default };","import _typeof from \"./typeof.js\";\nfunction toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nexport { toPrimitive as default };","import { IndexError } from '../../../error/IndexError.js'\n\n/**\n * Transform zero-based indices to one-based indices in errors\n * @param {Error} err\n * @returns {Error | IndexError} Returns the transformed error\n */\nexport function errorTransform (err) {\n if (err && err.isIndexError) {\n return new IndexError(\n err.index + 1,\n err.min + 1,\n err.max !== undefined ? err.max + 1 : undefined)\n }\n\n return err\n}\n","import { errorTransform } from '../../transform/utils/errorTransform.js'\nimport { getSafeProperty } from '../../../utils/customs.js'\n\nexport function accessFactory ({ subset }) {\n /**\n * Retrieve part of an object:\n *\n * - Retrieve a property from an object\n * - Retrieve a part of a string\n * - Retrieve a matrix subset\n *\n * @param {Object | Array | Matrix | string} object\n * @param {Index} index\n * @return {Object | Array | Matrix | string} Returns the subset\n */\n return function access (object, index) {\n try {\n if (Array.isArray(object)) {\n return subset(object, index)\n } else if (object && typeof object.subset === 'function') { // Matrix\n return object.subset(index)\n } else if (typeof object === 'string') {\n // TODO: move getStringSubset into a separate util file, use that\n return subset(object, index)\n } else if (typeof object === 'object') {\n if (!index.isObjectProperty()) {\n throw new TypeError('Cannot apply a numeric index as object property')\n }\n\n return getSafeProperty(object, index.getObjectProperty())\n } else {\n throw new TypeError('Cannot apply index: unsupported type of object')\n }\n } catch (err) {\n throw errorTransform(err)\n }\n }\n}\n","import {\n isAccessorNode,\n isArrayNode,\n isConstantNode,\n isFunctionNode,\n isIndexNode,\n isNode,\n isObjectNode,\n isParenthesisNode,\n isSymbolNode\n} from '../../utils/is.js'\nimport { getSafeProperty } from '../../utils/customs.js'\nimport { factory } from '../../utils/factory.js'\nimport { accessFactory } from './utils/access.js'\n\nconst name = 'AccessorNode'\nconst dependencies = [\n 'subset',\n 'Node'\n]\n\nexport const createAccessorNode = /* #__PURE__ */ factory(name, dependencies, ({ subset, Node }) => {\n const access = accessFactory({ subset })\n\n /**\n * Are parenthesis needed?\n * @private\n */\n function needParenthesis (node) {\n // TODO: maybe make a method on the nodes which tells whether they need parenthesis?\n return !(\n isAccessorNode(node) ||\n isArrayNode(node) ||\n isConstantNode(node) ||\n isFunctionNode(node) ||\n isObjectNode(node) ||\n isParenthesisNode(node) ||\n isSymbolNode(node))\n }\n\n class AccessorNode extends Node {\n /**\n * @constructor AccessorNode\n * @extends {Node}\n * Access an object property or get a matrix subset\n *\n * @param {Node} object The object from which to retrieve\n * a property or subset.\n * @param {IndexNode} index IndexNode containing ranges\n */\n constructor (object, index) {\n super()\n if (!isNode(object)) {\n throw new TypeError('Node expected for parameter \"object\"')\n }\n if (!isIndexNode(index)) {\n throw new TypeError('IndexNode expected for parameter \"index\"')\n }\n\n this.object = object\n this.index = index\n }\n\n // readonly property name\n get name () {\n if (this.index) {\n return (this.index.isObjectProperty())\n ? this.index.getObjectProperty()\n : ''\n } else {\n return this.object.name || ''\n }\n }\n\n static name = name\n get type () { return name }\n get isAccessorNode () { return true }\n\n /**\n * Compile a node into a JavaScript function.\n * This basically pre-calculates as much as possible and only leaves open\n * calculations which depend on a dynamic scope with variables.\n * @param {Object} math Math.js namespace with functions and constants.\n * @param {Object} argNames An object with argument names as key and `true`\n * as value. Used in the SymbolNode to optimize\n * for arguments from user assigned functions\n * (see FunctionAssignmentNode) or special symbols\n * like `end` (see IndexNode).\n * @return {function} Returns a function which can be called like:\n * evalNode(scope: Object, args: Object, context: *)\n */\n _compile (math, argNames) {\n const evalObject = this.object._compile(math, argNames)\n const evalIndex = this.index._compile(math, argNames)\n\n if (this.index.isObjectProperty()) {\n const prop = this.index.getObjectProperty()\n return function evalAccessorNode (scope, args, context) {\n // get a property from an object evaluated using the scope.\n return getSafeProperty(evalObject(scope, args, context), prop)\n }\n } else {\n return function evalAccessorNode (scope, args, context) {\n const object = evalObject(scope, args, context)\n // we pass just object here instead of context:\n const index = evalIndex(scope, args, object)\n return access(object, index)\n }\n }\n }\n\n /**\n * Execute a callback for each of the child nodes of this node\n * @param {function(child: Node, path: string, parent: Node)} callback\n */\n forEach (callback) {\n callback(this.object, 'object', this)\n callback(this.index, 'index', this)\n }\n\n /**\n * Create a new AccessorNode whose children are the results of calling\n * the provided callback function for each child of the original node.\n * @param {function(child: Node, path: string, parent: Node): Node} callback\n * @returns {AccessorNode} Returns a transformed copy of the node\n */\n map (callback) {\n return new AccessorNode(\n this._ifNode(callback(this.object, 'object', this)),\n this._ifNode(callback(this.index, 'index', this))\n )\n }\n\n /**\n * Create a clone of this node, a shallow copy\n * @return {AccessorNode}\n */\n clone () {\n return new AccessorNode(this.object, this.index)\n }\n\n /**\n * Get string representation\n * @param {Object} options\n * @return {string}\n */\n _toString (options) {\n let object = this.object.toString(options)\n if (needParenthesis(this.object)) {\n object = '(' + object + ')'\n }\n\n return object + this.index.toString(options)\n }\n\n /**\n * Get HTML representation\n * @param {Object} options\n * @return {string}\n */\n _toHTML (options) {\n let object = this.object.toHTML(options)\n if (needParenthesis(this.object)) {\n object =\n '(' +\n object +\n ')'\n }\n\n return object + this.index.toHTML(options)\n }\n\n /**\n * Get LaTeX representation\n * @param {Object} options\n * @return {string}\n */\n _toTex (options) {\n let object = this.object.toTex(options)\n if (needParenthesis(this.object)) {\n object = '\\\\left(\\' + object + \\'\\\\right)'\n }\n\n return object + this.index.toTex(options)\n }\n\n /**\n * Get a JSON representation of the node\n * @returns {Object}\n */\n toJSON () {\n return {\n mathjs: name,\n object: this.object,\n index: this.index\n }\n }\n\n /**\n * Instantiate an AccessorNode from its JSON representation\n * @param {Object} json\n * An object structured like\n * `{\"mathjs\": \"AccessorNode\", object: ..., index: ...}`,\n * where mathjs is optional\n * @returns {AccessorNode}\n */\n static fromJSON (json) {\n return new AccessorNode(json.object, json.index)\n }\n }\n\n return AccessorNode\n}, { isClass: true, isNode: true })\n","import { isArrayNode, isNode } from '../../utils/is.js'\nimport { map } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'ArrayNode'\nconst dependencies = [\n 'Node'\n]\n\nexport const createArrayNode = /* #__PURE__ */ factory(name, dependencies, ({ Node }) => {\n class ArrayNode extends Node {\n /**\n * @constructor ArrayNode\n * @extends {Node}\n * Holds an 1-dimensional array with items\n * @param {Node[]} [items] 1 dimensional array with items\n */\n constructor (items) {\n super()\n this.items = items || []\n\n // validate input\n if (!Array.isArray(this.items) || !this.items.every(isNode)) {\n throw new TypeError('Array containing Nodes expected')\n }\n }\n\n static name = name\n get type () { return name }\n get isArrayNode () { return true }\n\n /**\n * Compile a node into a JavaScript function.\n * This basically pre-calculates as much as possible and only leaves open\n * calculations which depend on a dynamic scope with variables.\n * @param {Object} math Math.js namespace with functions and constants.\n * @param {Object} argNames An object with argument names as key and `true`\n * as value. Used in the SymbolNode to optimize\n * for arguments from user assigned functions\n * (see FunctionAssignmentNode) or special symbols\n * like `end` (see IndexNode).\n * @return {function} Returns a function which can be called like:\n * evalNode(scope: Object, args: Object, context: *)\n */\n _compile (math, argNames) {\n const evalItems = map(this.items, function (item) {\n return item._compile(math, argNames)\n })\n\n const asMatrix = (math.config.matrix !== 'Array')\n if (asMatrix) {\n const matrix = math.matrix\n return function evalArrayNode (scope, args, context) {\n return matrix(map(evalItems, function (evalItem) {\n return evalItem(scope, args, context)\n }))\n }\n } else {\n return function evalArrayNode (scope, args, context) {\n return map(evalItems, function (evalItem) {\n return evalItem(scope, args, context)\n })\n }\n }\n }\n\n /**\n * Execute a callback for each of the child nodes of this node\n * @param {function(child: Node, path: string, parent: Node)} callback\n */\n forEach (callback) {\n for (let i = 0; i < this.items.length; i++) {\n const node = this.items[i]\n callback(node, 'items[' + i + ']', this)\n }\n }\n\n /**\n * Create a new ArrayNode whose children are the results of calling\n * the provided callback function for each child of the original node.\n * @param {function(child: Node, path: string, parent: Node): Node} callback\n * @returns {ArrayNode} Returns a transformed copy of the node\n */\n map (callback) {\n const items = []\n for (let i = 0; i < this.items.length; i++) {\n items[i] = this._ifNode(callback(this.items[i], 'items[' + i + ']', this))\n }\n return new ArrayNode(items)\n }\n\n /**\n * Create a clone of this node, a shallow copy\n * @return {ArrayNode}\n */\n clone () {\n return new ArrayNode(this.items.slice(0))\n }\n\n /**\n * Get string representation\n * @param {Object} options\n * @return {string} str\n * @override\n */\n _toString (options) {\n const items = this.items.map(function (node) {\n return node.toString(options)\n })\n return '[' + items.join(', ') + ']'\n }\n\n /**\n * Get a JSON representation of the node\n * @returns {Object}\n */\n toJSON () {\n return {\n mathjs: name,\n items: this.items\n }\n }\n\n /**\n * Instantiate an ArrayNode from its JSON representation\n * @param {Object} json An object structured like\n * `{\"mathjs\": \"ArrayNode\", items: [...]}`,\n * where mathjs is optional\n * @returns {ArrayNode}\n */\n static fromJSON (json) {\n return new ArrayNode(json.items)\n }\n\n /**\n * Get HTML representation\n * @param {Object} options\n * @return {string} str\n * @override\n */\n _toHTML (options) {\n const items = this.items.map(function (node) {\n return node.toHTML(options)\n })\n return '[' +\n items.join(',') +\n ']'\n }\n\n /**\n * Get LaTeX representation\n * @param {Object} options\n * @return {string} str\n */\n _toTex (options) {\n function itemsToTex (items, nested) {\n const mixedItems = items.some(isArrayNode) && !items.every(isArrayNode)\n const itemsFormRow = nested || mixedItems\n const itemSep = itemsFormRow ? '&' : '\\\\\\\\'\n const itemsTex = items\n .map(function (node) {\n if (node.items) {\n return itemsToTex(node.items, !nested)\n } else {\n return node.toTex(options)\n }\n })\n .join(itemSep)\n return mixedItems || !itemsFormRow || (itemsFormRow && !nested)\n ? '\\\\begin{bmatrix}' + itemsTex + '\\\\end{bmatrix}'\n : itemsTex\n }\n return itemsToTex(this.items, false)\n }\n }\n\n return ArrayNode\n}, { isClass: true, isNode: true })\n","// list of identifiers of nodes in order of their precedence\n// also contains information about left/right associativity\n// and which other operator the operator is associative with\n// Example:\n// addition is associative with addition and subtraction, because:\n// (a+b)+c=a+(b+c)\n// (a+b)-c=a+(b-c)\n//\n// postfix operators are left associative, prefix operators\n// are right associative\n//\n// It's also possible to set the following properties:\n// latexParens: if set to false, this node doesn't need to be enclosed\n// in parentheses when using LaTeX\n// latexLeftParens: if set to false, this !OperatorNode's!\n// left argument doesn't need to be enclosed\n// in parentheses\n// latexRightParens: the same for the right argument\nimport { hasOwnProperty } from '../utils/object.js'\nimport { isConstantNode, isParenthesisNode, rule2Node } from '../utils/is.js'\n\nexport const properties = [\n { // assignment\n AssignmentNode: {},\n FunctionAssignmentNode: {}\n },\n { // conditional expression\n ConditionalNode: {\n latexLeftParens: false,\n latexRightParens: false,\n latexParens: false\n // conditionals don't need parentheses in LaTeX because\n // they are 2 dimensional\n }\n },\n { // logical or\n 'OperatorNode:or': {\n op: 'or',\n associativity: 'left',\n associativeWith: []\n }\n\n },\n { // logical xor\n 'OperatorNode:xor': {\n op: 'xor',\n associativity: 'left',\n associativeWith: []\n }\n },\n { // logical and\n 'OperatorNode:and': {\n op: 'and',\n associativity: 'left',\n associativeWith: []\n }\n },\n { // bitwise or\n 'OperatorNode:bitOr': {\n op: '|',\n associativity: 'left',\n associativeWith: []\n }\n },\n { // bitwise xor\n 'OperatorNode:bitXor': {\n op: '^|',\n associativity: 'left',\n associativeWith: []\n }\n },\n { // bitwise and\n 'OperatorNode:bitAnd': {\n op: '&',\n associativity: 'left',\n associativeWith: []\n }\n },\n { // relational operators\n 'OperatorNode:equal': {\n op: '==',\n associativity: 'left',\n associativeWith: []\n },\n 'OperatorNode:unequal': {\n op: '!=',\n associativity: 'left',\n associativeWith: []\n },\n 'OperatorNode:smaller': {\n op: '<',\n associativity: 'left',\n associativeWith: []\n },\n 'OperatorNode:larger': {\n op: '>',\n associativity: 'left',\n associativeWith: []\n },\n 'OperatorNode:smallerEq': {\n op: '<=',\n associativity: 'left',\n associativeWith: []\n },\n 'OperatorNode:largerEq': {\n op: '>=',\n associativity: 'left',\n associativeWith: []\n },\n RelationalNode: {\n associativity: 'left',\n associativeWith: []\n }\n },\n { // bitshift operators\n 'OperatorNode:leftShift': {\n op: '<<',\n associativity: 'left',\n associativeWith: []\n },\n 'OperatorNode:rightArithShift': {\n op: '>>',\n associativity: 'left',\n associativeWith: []\n },\n 'OperatorNode:rightLogShift': {\n op: '>>>',\n associativity: 'left',\n associativeWith: []\n }\n },\n { // unit conversion\n 'OperatorNode:to': {\n op: 'to',\n associativity: 'left',\n associativeWith: []\n }\n },\n { // range\n RangeNode: {}\n },\n { // addition, subtraction\n 'OperatorNode:add': {\n op: '+',\n associativity: 'left',\n associativeWith: ['OperatorNode:add', 'OperatorNode:subtract']\n },\n 'OperatorNode:subtract': {\n op: '-',\n associativity: 'left',\n associativeWith: []\n }\n },\n { // multiply, divide, modulus\n 'OperatorNode:multiply': {\n op: '*',\n associativity: 'left',\n associativeWith: [\n 'OperatorNode:multiply',\n 'OperatorNode:divide',\n 'Operator:dotMultiply',\n 'Operator:dotDivide'\n ]\n },\n 'OperatorNode:divide': {\n op: '/',\n associativity: 'left',\n associativeWith: [],\n latexLeftParens: false,\n latexRightParens: false,\n latexParens: false\n // fractions don't require parentheses because\n // they're 2 dimensional, so parens aren't needed\n // in LaTeX\n },\n 'OperatorNode:dotMultiply': {\n op: '.*',\n associativity: 'left',\n associativeWith: [\n 'OperatorNode:multiply',\n 'OperatorNode:divide',\n 'OperatorNode:dotMultiply',\n 'OperatorNode:doDivide'\n ]\n },\n 'OperatorNode:dotDivide': {\n op: './',\n associativity: 'left',\n associativeWith: []\n },\n 'OperatorNode:mod': {\n op: 'mod',\n associativity: 'left',\n associativeWith: []\n }\n },\n { // Repeat multiplication for implicit multiplication\n 'OperatorNode:multiply': {\n associativity: 'left',\n associativeWith: [\n 'OperatorNode:multiply',\n 'OperatorNode:divide',\n 'Operator:dotMultiply',\n 'Operator:dotDivide'\n ]\n }\n },\n { // unary prefix operators\n 'OperatorNode:unaryPlus': {\n op: '+',\n associativity: 'right'\n },\n 'OperatorNode:unaryMinus': {\n op: '-',\n associativity: 'right'\n },\n 'OperatorNode:bitNot': {\n op: '~',\n associativity: 'right'\n },\n 'OperatorNode:not': {\n op: 'not',\n associativity: 'right'\n }\n },\n { // exponentiation\n 'OperatorNode:pow': {\n op: '^',\n associativity: 'right',\n associativeWith: [],\n latexRightParens: false\n // the exponent doesn't need parentheses in\n // LaTeX because it's 2 dimensional\n // (it's on top)\n },\n 'OperatorNode:dotPow': {\n op: '.^',\n associativity: 'right',\n associativeWith: []\n }\n },\n { // factorial\n 'OperatorNode:factorial': {\n op: '!',\n associativity: 'left'\n }\n },\n { // matrix transpose\n 'OperatorNode:ctranspose': {\n op: \"'\",\n associativity: 'left'\n }\n }\n]\n\n/**\n * Returns the first non-parenthesis internal node, but only\n * when the 'parenthesis' option is unset or auto.\n * @param {Node} _node\n * @param {string} parenthesis\n * @return {Node}\n */\nfunction unwrapParen (_node, parenthesis) {\n if (!parenthesis || parenthesis !== 'auto') return _node\n let node = _node\n while (isParenthesisNode(node)) node = node.content\n return node\n}\n\n/**\n * Get the precedence of a Node.\n * Higher number for higher precedence, starting with 0.\n * Returns null if the precedence is undefined.\n *\n * @param {Node} _node\n * @param {string} parenthesis\n * @param {string} implicit\n * @param {Node} parent (for determining context for implicit multiplication)\n * @return {number | null}\n */\nexport function getPrecedence (_node, parenthesis, implicit, parent) {\n let node = _node\n if (parenthesis !== 'keep') {\n // ParenthesisNodes are only ignored when not in 'keep' mode\n node = _node.getContent()\n }\n const identifier = node.getIdentifier()\n let precedence = null\n for (let i = 0; i < properties.length; i++) {\n if (identifier in properties[i]) {\n precedence = i\n break\n }\n }\n // Bump up precedence of implicit multiplication, except when preceded\n // by a \"Rule 2\" fraction ( [unaryOp]constant / constant )\n if (identifier === 'OperatorNode:multiply' && node.implicit &&\n implicit !== 'show') {\n const leftArg = unwrapParen(node.args[0], parenthesis)\n if (!(isConstantNode(leftArg) && parent &&\n parent.getIdentifier() === 'OperatorNode:divide' &&\n rule2Node(unwrapParen(parent.args[0], parenthesis))) &&\n !(leftArg.getIdentifier() === 'OperatorNode:divide' &&\n rule2Node(unwrapParen(leftArg.args[0], parenthesis)) &&\n isConstantNode(unwrapParen(leftArg.args[1])))\n ) {\n precedence += 1\n }\n }\n return precedence\n}\n\n/**\n * Get the associativity of an operator (left or right).\n * Returns a string containing 'left' or 'right' or null if\n * the associativity is not defined.\n *\n * @param {Node} _node\n * @param {string} parenthesis\n * @return {string|null}\n * @throws {Error}\n */\nexport function getAssociativity (_node, parenthesis) {\n let node = _node\n if (parenthesis !== 'keep') {\n // ParenthesisNodes are only ignored when not in 'keep' mode\n node = _node.getContent()\n }\n const identifier = node.getIdentifier()\n const index = getPrecedence(node, parenthesis)\n if (index === null) {\n // node isn't in the list\n return null\n }\n const property = properties[index][identifier]\n\n if (hasOwnProperty(property, 'associativity')) {\n if (property.associativity === 'left') {\n return 'left'\n }\n if (property.associativity === 'right') {\n return 'right'\n }\n // associativity is invalid\n throw Error('\\'' + identifier + '\\' has the invalid associativity \\'' +\n property.associativity + '\\'.')\n }\n\n // associativity is undefined\n return null\n}\n\n/**\n * Check if an operator is associative with another operator.\n * Returns either true or false or null if not defined.\n *\n * @param {Node} nodeA\n * @param {Node} nodeB\n * @param {string} parenthesis\n * @return {boolean | null}\n */\nexport function isAssociativeWith (nodeA, nodeB, parenthesis) {\n // ParenthesisNodes are only ignored when not in 'keep' mode\n const a = (parenthesis !== 'keep') ? nodeA.getContent() : nodeA\n const b = (parenthesis !== 'keep') ? nodeA.getContent() : nodeB\n const identifierA = a.getIdentifier()\n const identifierB = b.getIdentifier()\n const index = getPrecedence(a, parenthesis)\n if (index === null) {\n // node isn't in the list\n return null\n }\n const property = properties[index][identifierA]\n\n if (hasOwnProperty(property, 'associativeWith') &&\n (property.associativeWith instanceof Array)) {\n for (let i = 0; i < property.associativeWith.length; i++) {\n if (property.associativeWith[i] === identifierB) {\n return true\n }\n }\n return false\n }\n\n // associativeWith is not defined\n return null\n}\n\n/**\n * Get the operator associated with a function name.\n * Returns a string with the operator symbol, or null if the\n * input is not the name of a function associated with an\n * operator.\n *\n * @param {string} Function name\n * @return {string | null} Associated operator symbol, if any\n */\nexport function getOperator (fn) {\n const identifier = 'OperatorNode:' + fn\n for (const group of properties) {\n if (identifier in group) {\n return group[identifier].op\n }\n }\n return null\n}\n","import { isAccessorNode, isIndexNode, isNode, isSymbolNode } from '../../utils/is.js'\nimport { getSafeProperty, setSafeProperty } from '../../utils/customs.js'\nimport { factory } from '../../utils/factory.js'\nimport { accessFactory } from './utils/access.js'\nimport { assignFactory } from './utils/assign.js'\nimport { getPrecedence } from '../operators.js'\n\nconst name = 'AssignmentNode'\nconst dependencies = [\n 'subset',\n '?matrix', // FIXME: should not be needed at all, should be handled by subset\n 'Node'\n]\n\nexport const createAssignmentNode = /* #__PURE__ */ factory(name, dependencies, ({ subset, matrix, Node }) => {\n const access = accessFactory({ subset })\n const assign = assignFactory({ subset, matrix })\n\n /*\n * Is parenthesis needed?\n * @param {node} node\n * @param {string} [parenthesis='keep']\n * @param {string} implicit\n * @private\n */\n function needParenthesis (node, parenthesis, implicit) {\n if (!parenthesis) {\n parenthesis = 'keep'\n }\n\n const precedence = getPrecedence(node, parenthesis, implicit)\n const exprPrecedence = getPrecedence(node.value, parenthesis, implicit)\n return (parenthesis === 'all') ||\n ((exprPrecedence !== null) && (exprPrecedence <= precedence))\n }\n\n class AssignmentNode extends Node {\n /**\n * @constructor AssignmentNode\n * @extends {Node}\n *\n * Define a symbol, like `a=3.2`, update a property like `a.b=3.2`, or\n * replace a subset of a matrix like `A[2,2]=42`.\n *\n * Syntax:\n *\n * new AssignmentNode(symbol, value)\n * new AssignmentNode(object, index, value)\n *\n * Usage:\n *\n * new AssignmentNode(new SymbolNode('a'), new ConstantNode(2)) // a=2\n * new AssignmentNode(new SymbolNode('a'),\n * new IndexNode('b'),\n * new ConstantNode(2)) // a.b=2\n * new AssignmentNode(new SymbolNode('a'),\n * new IndexNode(1, 2),\n * new ConstantNode(3)) // a[1,2]=3\n *\n * @param {SymbolNode | AccessorNode} object\n * Object on which to assign a value\n * @param {IndexNode} [index=null]\n * Index, property name or matrix index. Optional. If not provided\n * and `object` is a SymbolNode, the property is assigned to the\n * global scope.\n * @param {Node} value\n * The value to be assigned\n */\n constructor (object, index, value) {\n super()\n this.object = object\n this.index = value ? index : null\n this.value = value || index\n\n // validate input\n if (!isSymbolNode(object) && !isAccessorNode(object)) {\n throw new TypeError('SymbolNode or AccessorNode expected as \"object\"')\n }\n if (isSymbolNode(object) && object.name === 'end') {\n throw new Error('Cannot assign to symbol \"end\"')\n }\n if (this.index && !isIndexNode(this.index)) { // index is optional\n throw new TypeError('IndexNode expected as \"index\"')\n }\n if (!isNode(this.value)) {\n throw new TypeError('Node expected as \"value\"')\n }\n }\n\n // class name for typing purposes:\n static name = name\n\n // readonly property name\n get name () {\n if (this.index) {\n return (this.index.isObjectProperty())\n ? this.index.getObjectProperty()\n : ''\n } else {\n return this.object.name || ''\n }\n }\n\n get type () { return name }\n get isAssignmentNode () { return true }\n\n /**\n * Compile a node into a JavaScript function.\n * This basically pre-calculates as much as possible and only leaves open\n * calculations which depend on a dynamic scope with variables.\n * @param {Object} math Math.js namespace with functions and constants.\n * @param {Object} argNames An object with argument names as key and `true`\n * as value. Used in the SymbolNode to optimize\n * for arguments from user assigned functions\n * (see FunctionAssignmentNode) or special symbols\n * like `end` (see IndexNode).\n * @return {function} Returns a function which can be called like:\n * evalNode(scope: Object, args: Object, context: *)\n */\n _compile (math, argNames) {\n const evalObject = this.object._compile(math, argNames)\n const evalIndex = this.index ? this.index._compile(math, argNames) : null\n const evalValue = this.value._compile(math, argNames)\n const name = this.object.name\n\n if (!this.index) {\n // apply a variable to the scope, for example `a=2`\n if (!isSymbolNode(this.object)) {\n throw new TypeError('SymbolNode expected as object')\n }\n\n return function evalAssignmentNode (scope, args, context) {\n const value = evalValue(scope, args, context)\n scope.set(name, value)\n return value\n }\n } else if (this.index.isObjectProperty()) {\n // apply an object property for example `a.b=2`\n const prop = this.index.getObjectProperty()\n\n return function evalAssignmentNode (scope, args, context) {\n const object = evalObject(scope, args, context)\n const value = evalValue(scope, args, context)\n setSafeProperty(object, prop, value)\n return value\n }\n } else if (isSymbolNode(this.object)) {\n // update a matrix subset, for example `a[2]=3`\n return function evalAssignmentNode (scope, args, context) {\n const childObject = evalObject(scope, args, context)\n const value = evalValue(scope, args, context)\n // Important: we pass childObject instead of context:\n const index = evalIndex(scope, args, childObject)\n scope.set(name, assign(childObject, index, value))\n return value\n }\n } else { // isAccessorNode(node.object) === true\n // update a matrix subset, for example `a.b[2]=3`\n\n // we will not use the compile function of the AccessorNode, but\n // compile it ourselves here as we need the parent object of the\n // AccessorNode:\n // wee need to apply the updated object to parent object\n const evalParentObject = this.object.object._compile(math, argNames)\n\n if (this.object.index.isObjectProperty()) {\n const parentProp = this.object.index.getObjectProperty()\n\n return function evalAssignmentNode (scope, args, context) {\n const parent = evalParentObject(scope, args, context)\n const childObject = getSafeProperty(parent, parentProp)\n // Important: we pass childObject instead of context:\n const index = evalIndex(scope, args, childObject)\n const value = evalValue(scope, args, context)\n setSafeProperty(\n parent, parentProp, assign(childObject, index, value))\n return value\n }\n } else {\n // if some parameters use the 'end' parameter, we need to calculate\n // the size\n const evalParentIndex = this.object.index._compile(math, argNames)\n\n return function evalAssignmentNode (scope, args, context) {\n const parent = evalParentObject(scope, args, context)\n // Important: we pass parent instead of context:\n const parentIndex = evalParentIndex(scope, args, parent)\n const childObject = access(parent, parentIndex)\n // Important: we pass childObject instead of context\n const index = evalIndex(scope, args, childObject)\n const value = evalValue(scope, args, context)\n\n assign(parent, parentIndex, assign(childObject, index, value))\n\n return value\n }\n }\n }\n }\n\n /**\n * Execute a callback for each of the child nodes of this node\n * @param {function(child: Node, path: string, parent: Node)} callback\n */\n forEach (callback) {\n callback(this.object, 'object', this)\n if (this.index) {\n callback(this.index, 'index', this)\n }\n callback(this.value, 'value', this)\n }\n\n /**\n * Create a new AssignmentNode whose children are the results of calling\n * the provided callback function for each child of the original node.\n * @param {function(child: Node, path: string, parent: Node): Node} callback\n * @returns {AssignmentNode} Returns a transformed copy of the node\n */\n map (callback) {\n const object = this._ifNode(callback(this.object, 'object', this))\n const index = this.index\n ? this._ifNode(callback(this.index, 'index', this))\n : null\n const value = this._ifNode(callback(this.value, 'value', this))\n\n return new AssignmentNode(object, index, value)\n }\n\n /**\n * Create a clone of this node, a shallow copy\n * @return {AssignmentNode}\n */\n clone () {\n return new AssignmentNode(this.object, this.index, this.value)\n }\n\n /**\n * Get string representation\n * @param {Object} options\n * @return {string}\n */\n _toString (options) {\n const object = this.object.toString(options)\n const index = this.index ? this.index.toString(options) : ''\n let value = this.value.toString(options)\n if (needParenthesis(\n this, options && options.parenthesis, options && options.implicit)) {\n value = '(' + value + ')'\n }\n\n return object + index + ' = ' + value\n }\n\n /**\n * Get a JSON representation of the node\n * @returns {Object}\n */\n toJSON () {\n return {\n mathjs: name,\n object: this.object,\n index: this.index,\n value: this.value\n }\n }\n\n /**\n * Instantiate an AssignmentNode from its JSON representation\n * @param {Object} json\n * An object structured like\n * `{\"mathjs\": \"AssignmentNode\", object: ..., index: ..., value: ...}`,\n * where mathjs is optional\n * @returns {AssignmentNode}\n */\n static fromJSON (json) {\n return new AssignmentNode(json.object, json.index, json.value)\n }\n\n /**\n * Get HTML representation\n * @param {Object} options\n * @return {string}\n */\n _toHTML (options) {\n const object = this.object.toHTML(options)\n const index = this.index ? this.index.toHTML(options) : ''\n let value = this.value.toHTML(options)\n if (needParenthesis(\n this, options && options.parenthesis, options && options.implicit)) {\n value = '(' +\n value +\n ')'\n }\n\n return object + index +\n '=' +\n value\n }\n\n /**\n * Get LaTeX representation\n * @param {Object} options\n * @return {string}\n */\n _toTex (options) {\n const object = this.object.toTex(options)\n const index = this.index ? this.index.toTex(options) : ''\n let value = this.value.toTex(options)\n if (needParenthesis(\n this, options && options.parenthesis, options && options.implicit)) {\n value = `\\\\left(${value}\\\\right)`\n }\n\n return object + index + '=' + value\n }\n }\n\n return AssignmentNode\n}, { isClass: true, isNode: true })\n","import { errorTransform } from '../../transform/utils/errorTransform.js'\nimport { setSafeProperty } from '../../../utils/customs.js'\n\nexport function assignFactory ({ subset, matrix }) {\n /**\n * Replace part of an object:\n *\n * - Assign a property to an object\n * - Replace a part of a string\n * - Replace a matrix subset\n *\n * @param {Object | Array | Matrix | string} object\n * @param {Index} index\n * @param {*} value\n * @return {Object | Array | Matrix | string} Returns the original object\n * except in case of a string\n */\n // TODO: change assign to return the value instead of the object\n return function assign (object, index, value) {\n try {\n if (Array.isArray(object)) {\n const result = matrix(object).subset(index, value).valueOf()\n\n // shallow copy all (updated) items into the original array\n result.forEach((item, index) => {\n object[index] = item\n })\n\n return object\n } else if (object && typeof object.subset === 'function') { // Matrix\n return object.subset(index, value)\n } else if (typeof object === 'string') {\n // TODO: move setStringSubset into a separate util file, use that\n return subset(object, index, value)\n } else if (typeof object === 'object') {\n if (!index.isObjectProperty()) {\n throw TypeError('Cannot apply a numeric index as object property')\n }\n setSafeProperty(object, index.getObjectProperty(), value)\n return object\n } else {\n throw new TypeError('Cannot apply index: unsupported type of object')\n }\n } catch (err) {\n throw errorTransform(err)\n }\n }\n}\n","import { isNode } from '../../utils/is.js'\nimport { forEach, map } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'BlockNode'\nconst dependencies = [\n 'ResultSet',\n 'Node'\n]\n\nexport const createBlockNode = /* #__PURE__ */ factory(name, dependencies, ({ ResultSet, Node }) => {\n class BlockNode extends Node {\n /**\n * @constructor BlockNode\n * @extends {Node}\n * Holds a set with blocks\n * @param {Array.<{node: Node} | {node: Node, visible: boolean}>} blocks\n * An array with blocks, where a block is constructed as an\n * Object with properties block, which is a Node, and visible,\n * which is a boolean. The property visible is optional and\n * is true by default\n */\n constructor (blocks) {\n super()\n // validate input, copy blocks\n if (!Array.isArray(blocks)) throw new Error('Array expected')\n this.blocks = blocks.map(function (block) {\n const node = block && block.node\n const visible = block &&\n block.visible !== undefined\n ? block.visible\n : true\n\n if (!isNode(node)) throw new TypeError('Property \"node\" must be a Node')\n if (typeof visible !== 'boolean') { throw new TypeError('Property \"visible\" must be a boolean') }\n\n return { node, visible }\n })\n }\n\n static name = name\n get type () { return name }\n get isBlockNode () { return true }\n\n /**\n * Compile a node into a JavaScript function.\n * This basically pre-calculates as much as possible and only leaves open\n * calculations which depend on a dynamic scope with variables.\n * @param {Object} math Math.js namespace with functions and constants.\n * @param {Object} argNames An object with argument names as key and `true`\n * as value. Used in the SymbolNode to optimize\n * for arguments from user assigned functions\n * (see FunctionAssignmentNode) or special symbols\n * like `end` (see IndexNode).\n * @return {function} Returns a function which can be called like:\n * evalNode(scope: Object, args: Object, context: *)\n */\n _compile (math, argNames) {\n const evalBlocks = map(this.blocks, function (block) {\n return {\n evaluate: block.node._compile(math, argNames),\n visible: block.visible\n }\n })\n\n return function evalBlockNodes (scope, args, context) {\n const results = []\n\n forEach(evalBlocks, function evalBlockNode (block) {\n const result = block.evaluate(scope, args, context)\n if (block.visible) {\n results.push(result)\n }\n })\n\n return new ResultSet(results)\n }\n }\n\n /**\n * Execute a callback for each of the child blocks of this node\n * @param {function(child: Node, path: string, parent: Node)} callback\n */\n forEach (callback) {\n for (let i = 0; i < this.blocks.length; i++) {\n callback(this.blocks[i].node, 'blocks[' + i + '].node', this)\n }\n }\n\n /**\n * Create a new BlockNode whose children are the results of calling\n * the provided callback function for each child of the original node.\n * @param {function(child: Node, path: string, parent: Node): Node} callback\n * @returns {BlockNode} Returns a transformed copy of the node\n */\n map (callback) {\n const blocks = []\n for (let i = 0; i < this.blocks.length; i++) {\n const block = this.blocks[i]\n const node = this._ifNode(\n callback(block.node, 'blocks[' + i + '].node', this))\n blocks[i] = {\n node,\n visible: block.visible\n }\n }\n return new BlockNode(blocks)\n }\n\n /**\n * Create a clone of this node, a shallow copy\n * @return {BlockNode}\n */\n clone () {\n const blocks = this.blocks.map(function (block) {\n return {\n node: block.node,\n visible: block.visible\n }\n })\n\n return new BlockNode(blocks)\n }\n\n /**\n * Get string representation\n * @param {Object} options\n * @return {string} str\n * @override\n */\n _toString (options) {\n return this.blocks.map(function (param) {\n return param.node.toString(options) + (param.visible ? '' : ';')\n }).join('\\n')\n }\n\n /**\n * Get a JSON representation of the node\n * @returns {Object}\n */\n toJSON () {\n return {\n mathjs: name,\n blocks: this.blocks\n }\n }\n\n /**\n * Instantiate an BlockNode from its JSON representation\n * @param {Object} json\n * An object structured like\n * `{\"mathjs\": \"BlockNode\", blocks: [{node: ..., visible: false}, ...]}`,\n * where mathjs is optional\n * @returns {BlockNode}\n */\n static fromJSON (json) {\n return new BlockNode(json.blocks)\n }\n\n /**\n * Get HTML representation\n * @param {Object} options\n * @return {string} str\n * @override\n */\n _toHTML (options) {\n return this.blocks.map(function (param) {\n return param.node.toHTML(options) +\n (param.visible ? '' : ';')\n }).join('
')\n }\n\n /**\n * Get LaTeX representation\n * @param {Object} options\n * @return {string} str\n */\n _toTex (options) {\n return this.blocks.map(function (param) {\n return param.node.toTex(options) + (param.visible ? '' : ';')\n }).join('\\\\;\\\\;\\n')\n }\n }\n\n return BlockNode\n}, { isClass: true, isNode: true })\n","import { isBigNumber, isComplex, isNode, isUnit, typeOf } from '../../utils/is.js'\nimport { factory } from '../../utils/factory.js'\nimport { getPrecedence } from '../operators.js'\n\nconst name = 'ConditionalNode'\nconst dependencies = [\n 'Node'\n]\n\nexport const createConditionalNode = /* #__PURE__ */ factory(name, dependencies, ({ Node }) => {\n /**\n * Test whether a condition is met\n * @param {*} condition\n * @returns {boolean} true if condition is true or non-zero, else false\n */\n function testCondition (condition) {\n if (typeof condition === 'number' ||\n typeof condition === 'boolean' ||\n typeof condition === 'string') {\n return !!condition\n }\n\n if (condition) {\n if (isBigNumber(condition)) {\n return !condition.isZero()\n }\n\n if (isComplex(condition)) {\n return !!((condition.re || condition.im))\n }\n\n if (isUnit(condition)) {\n return !!condition.value\n }\n }\n\n if (condition === null || condition === undefined) {\n return false\n }\n\n throw new TypeError('Unsupported type of condition \"' + typeOf(condition) + '\"')\n }\n\n class ConditionalNode extends Node {\n /**\n * A lazy evaluating conditional operator: 'condition ? trueExpr : falseExpr'\n *\n * @param {Node} condition Condition, must result in a boolean\n * @param {Node} trueExpr Expression evaluated when condition is true\n * @param {Node} falseExpr Expression evaluated when condition is true\n *\n * @constructor ConditionalNode\n * @extends {Node}\n */\n constructor (condition, trueExpr, falseExpr) {\n super()\n if (!isNode(condition)) { throw new TypeError('Parameter condition must be a Node') }\n if (!isNode(trueExpr)) { throw new TypeError('Parameter trueExpr must be a Node') }\n if (!isNode(falseExpr)) { throw new TypeError('Parameter falseExpr must be a Node') }\n\n this.condition = condition\n this.trueExpr = trueExpr\n this.falseExpr = falseExpr\n }\n\n static name = name\n get type () { return name }\n get isConditionalNode () { return true }\n\n /**\n * Compile a node into a JavaScript function.\n * This basically pre-calculates as much as possible and only leaves open\n * calculations which depend on a dynamic scope with variables.\n * @param {Object} math Math.js namespace with functions and constants.\n * @param {Object} argNames An object with argument names as key and `true`\n * as value. Used in the SymbolNode to optimize\n * for arguments from user assigned functions\n * (see FunctionAssignmentNode) or special symbols\n * like `end` (see IndexNode).\n * @return {function} Returns a function which can be called like:\n * evalNode(scope: Object, args: Object, context: *)\n */\n _compile (math, argNames) {\n const evalCondition = this.condition._compile(math, argNames)\n const evalTrueExpr = this.trueExpr._compile(math, argNames)\n const evalFalseExpr = this.falseExpr._compile(math, argNames)\n\n return function evalConditionalNode (scope, args, context) {\n return testCondition(evalCondition(scope, args, context))\n ? evalTrueExpr(scope, args, context)\n : evalFalseExpr(scope, args, context)\n }\n }\n\n /**\n * Execute a callback for each of the child nodes of this node\n * @param {function(child: Node, path: string, parent: Node)} callback\n */\n forEach (callback) {\n callback(this.condition, 'condition', this)\n callback(this.trueExpr, 'trueExpr', this)\n callback(this.falseExpr, 'falseExpr', this)\n }\n\n /**\n * Create a new ConditionalNode whose children are the results of calling\n * the provided callback function for each child of the original node.\n * @param {function(child: Node, path: string, parent: Node): Node} callback\n * @returns {ConditionalNode} Returns a transformed copy of the node\n */\n map (callback) {\n return new ConditionalNode(\n this._ifNode(callback(this.condition, 'condition', this)),\n this._ifNode(callback(this.trueExpr, 'trueExpr', this)),\n this._ifNode(callback(this.falseExpr, 'falseExpr', this))\n )\n }\n\n /**\n * Create a clone of this node, a shallow copy\n * @return {ConditionalNode}\n */\n clone () {\n return new ConditionalNode(this.condition, this.trueExpr, this.falseExpr)\n }\n\n /**\n * Get string representation\n * @param {Object} options\n * @return {string} str\n */\n _toString (options) {\n const parenthesis =\n (options && options.parenthesis) ? options.parenthesis : 'keep'\n const precedence =\n getPrecedence(this, parenthesis, options && options.implicit)\n\n // Enclose Arguments in parentheses if they are an OperatorNode\n // or have lower or equal precedence\n // NOTE: enclosing all OperatorNodes in parentheses is a decision\n // purely based on aesthetics and readability\n let condition = this.condition.toString(options)\n const conditionPrecedence =\n getPrecedence(this.condition, parenthesis, options && options.implicit)\n if ((parenthesis === 'all') ||\n (this.condition.type === 'OperatorNode') ||\n ((conditionPrecedence !== null) &&\n (conditionPrecedence <= precedence))) {\n condition = '(' + condition + ')'\n }\n\n let trueExpr = this.trueExpr.toString(options)\n const truePrecedence =\n getPrecedence(this.trueExpr, parenthesis, options && options.implicit)\n if ((parenthesis === 'all') ||\n (this.trueExpr.type === 'OperatorNode') ||\n ((truePrecedence !== null) && (truePrecedence <= precedence))) {\n trueExpr = '(' + trueExpr + ')'\n }\n\n let falseExpr = this.falseExpr.toString(options)\n const falsePrecedence =\n getPrecedence(this.falseExpr, parenthesis, options && options.implicit)\n if ((parenthesis === 'all') ||\n (this.falseExpr.type === 'OperatorNode') ||\n ((falsePrecedence !== null) && (falsePrecedence <= precedence))) {\n falseExpr = '(' + falseExpr + ')'\n }\n return condition + ' ? ' + trueExpr + ' : ' + falseExpr\n }\n\n /**\n * Get a JSON representation of the node\n * @returns {Object}\n */\n toJSON () {\n return {\n mathjs: name,\n condition: this.condition,\n trueExpr: this.trueExpr,\n falseExpr: this.falseExpr\n }\n }\n\n /**\n * Instantiate an ConditionalNode from its JSON representation\n * @param {Object} json\n * An object structured like\n * ```\n * {\"mathjs\": \"ConditionalNode\",\n * \"condition\": ...,\n * \"trueExpr\": ...,\n * \"falseExpr\": ...}\n * ```\n * where mathjs is optional\n * @returns {ConditionalNode}\n */\n static fromJSON (json) {\n return new ConditionalNode(json.condition, json.trueExpr, json.falseExpr)\n }\n\n /**\n * Get HTML representation\n * @param {Object} options\n * @return {string} str\n */\n _toHTML (options) {\n const parenthesis =\n (options && options.parenthesis) ? options.parenthesis : 'keep'\n const precedence =\n getPrecedence(this, parenthesis, options && options.implicit)\n\n // Enclose Arguments in parentheses if they are an OperatorNode\n // or have lower or equal precedence\n // NOTE: enclosing all OperatorNodes in parentheses is a decision\n // purely based on aesthetics and readability\n let condition = this.condition.toHTML(options)\n const conditionPrecedence =\n getPrecedence(this.condition, parenthesis, options && options.implicit)\n if ((parenthesis === 'all') ||\n (this.condition.type === 'OperatorNode') ||\n ((conditionPrecedence !== null) &&\n (conditionPrecedence <= precedence))) {\n condition =\n '(' +\n condition +\n ')'\n }\n\n let trueExpr = this.trueExpr.toHTML(options)\n const truePrecedence =\n getPrecedence(this.trueExpr, parenthesis, options && options.implicit)\n if ((parenthesis === 'all') ||\n (this.trueExpr.type === 'OperatorNode') ||\n ((truePrecedence !== null) && (truePrecedence <= precedence))) {\n trueExpr =\n '(' +\n trueExpr +\n ')'\n }\n\n let falseExpr = this.falseExpr.toHTML(options)\n const falsePrecedence =\n getPrecedence(this.falseExpr, parenthesis, options && options.implicit)\n if ((parenthesis === 'all') ||\n (this.falseExpr.type === 'OperatorNode') ||\n ((falsePrecedence !== null) && (falsePrecedence <= precedence))) {\n falseExpr =\n '(' +\n falseExpr +\n ')'\n }\n return condition +\n '?' +\n trueExpr +\n ':' +\n falseExpr\n }\n\n /**\n * Get LaTeX representation\n * @param {Object} options\n * @return {string} str\n */\n _toTex (options) {\n return '\\\\begin{cases} {' +\n this.trueExpr.toTex(options) + '}, &\\\\quad{\\\\text{if }\\\\;' +\n this.condition.toTex(options) +\n '}\\\\\\\\{' + this.falseExpr.toTex(options) +\n '}, &\\\\quad{\\\\text{otherwise}}\\\\end{cases}'\n }\n }\n\n return ConditionalNode\n}, { isClass: true, isNode: true })\n","/* eslint no-template-curly-in-string: \"off\" */\n\nimport escapeLatexLib from 'escape-latex'\nimport { hasOwnProperty } from './object.js'\n\nexport const latexSymbols = {\n // GREEK LETTERS\n Alpha: 'A',\n alpha: '\\\\alpha',\n Beta: 'B',\n beta: '\\\\beta',\n Gamma: '\\\\Gamma',\n gamma: '\\\\gamma',\n Delta: '\\\\Delta',\n delta: '\\\\delta',\n Epsilon: 'E',\n epsilon: '\\\\epsilon',\n varepsilon: '\\\\varepsilon',\n Zeta: 'Z',\n zeta: '\\\\zeta',\n Eta: 'H',\n eta: '\\\\eta',\n Theta: '\\\\Theta',\n theta: '\\\\theta',\n vartheta: '\\\\vartheta',\n Iota: 'I',\n iota: '\\\\iota',\n Kappa: 'K',\n kappa: '\\\\kappa',\n varkappa: '\\\\varkappa',\n Lambda: '\\\\Lambda',\n lambda: '\\\\lambda',\n Mu: 'M',\n mu: '\\\\mu',\n Nu: 'N',\n nu: '\\\\nu',\n Xi: '\\\\Xi',\n xi: '\\\\xi',\n Omicron: 'O',\n omicron: 'o',\n Pi: '\\\\Pi',\n pi: '\\\\pi',\n varpi: '\\\\varpi',\n Rho: 'P',\n rho: '\\\\rho',\n varrho: '\\\\varrho',\n Sigma: '\\\\Sigma',\n sigma: '\\\\sigma',\n varsigma: '\\\\varsigma',\n Tau: 'T',\n tau: '\\\\tau',\n Upsilon: '\\\\Upsilon',\n upsilon: '\\\\upsilon',\n Phi: '\\\\Phi',\n phi: '\\\\phi',\n varphi: '\\\\varphi',\n Chi: 'X',\n chi: '\\\\chi',\n Psi: '\\\\Psi',\n psi: '\\\\psi',\n Omega: '\\\\Omega',\n omega: '\\\\omega',\n // logic\n true: '\\\\mathrm{True}',\n false: '\\\\mathrm{False}',\n // other\n i: 'i', // TODO use \\i ??\n inf: '\\\\infty',\n Inf: '\\\\infty',\n infinity: '\\\\infty',\n Infinity: '\\\\infty',\n oo: '\\\\infty',\n lim: '\\\\lim',\n undefined: '\\\\mathbf{?}'\n}\n\nexport const latexOperators = {\n transpose: '^\\\\top',\n ctranspose: '^H',\n factorial: '!',\n pow: '^',\n dotPow: '.^\\\\wedge', // TODO find ideal solution\n unaryPlus: '+',\n unaryMinus: '-',\n bitNot: '\\\\~', // TODO find ideal solution\n not: '\\\\neg',\n multiply: '\\\\cdot',\n divide: '\\\\frac', // TODO how to handle that properly?\n dotMultiply: '.\\\\cdot', // TODO find ideal solution\n dotDivide: '.:', // TODO find ideal solution\n mod: '\\\\mod',\n add: '+',\n subtract: '-',\n to: '\\\\rightarrow',\n leftShift: '<<',\n rightArithShift: '>>',\n rightLogShift: '>>>',\n equal: '=',\n unequal: '\\\\neq',\n smaller: '<',\n larger: '>',\n smallerEq: '\\\\leq',\n largerEq: '\\\\geq',\n bitAnd: '\\\\&',\n bitXor: '\\\\underline{|}',\n bitOr: '|',\n and: '\\\\wedge',\n xor: '\\\\veebar',\n or: '\\\\vee'\n}\n\nexport const latexFunctions = {\n // arithmetic\n abs: { 1: '\\\\left|${args[0]}\\\\right|' },\n add: { 2: `\\\\left(\\${args[0]}${latexOperators.add}\\${args[1]}\\\\right)` },\n cbrt: { 1: '\\\\sqrt[3]{${args[0]}}' },\n ceil: { 1: '\\\\left\\\\lceil${args[0]}\\\\right\\\\rceil' },\n cube: { 1: '\\\\left(${args[0]}\\\\right)^3' },\n divide: { 2: '\\\\frac{${args[0]}}{${args[1]}}' },\n dotDivide: { 2: `\\\\left(\\${args[0]}${latexOperators.dotDivide}\\${args[1]}\\\\right)` },\n dotMultiply: { 2: `\\\\left(\\${args[0]}${latexOperators.dotMultiply}\\${args[1]}\\\\right)` },\n dotPow: { 2: `\\\\left(\\${args[0]}${latexOperators.dotPow}\\${args[1]}\\\\right)` },\n exp: { 1: '\\\\exp\\\\left(${args[0]}\\\\right)' },\n expm1: `\\\\left(e${latexOperators.pow}{\\${args[0]}}-1\\\\right)`,\n fix: { 1: '\\\\mathrm{${name}}\\\\left(${args[0]}\\\\right)' },\n floor: { 1: '\\\\left\\\\lfloor${args[0]}\\\\right\\\\rfloor' },\n fraction: { 2: '\\\\frac{${args[0]}}{${args[1]}}' },\n gcd: '\\\\gcd\\\\left(${args}\\\\right)',\n hypot: '\\\\hypot\\\\left(${args}\\\\right)',\n log: {\n 1: '\\\\ln\\\\left(${args[0]}\\\\right)',\n 2: '\\\\log_{${args[1]}}\\\\left(${args[0]}\\\\right)'\n },\n log10: { 1: '\\\\log_{10}\\\\left(${args[0]}\\\\right)' },\n log1p: {\n 1: '\\\\ln\\\\left(${args[0]}+1\\\\right)',\n 2: '\\\\log_{${args[1]}}\\\\left(${args[0]}+1\\\\right)'\n },\n log2: '\\\\log_{2}\\\\left(${args[0]}\\\\right)',\n mod: { 2: `\\\\left(\\${args[0]}${latexOperators.mod}\\${args[1]}\\\\right)` },\n multiply: { 2: `\\\\left(\\${args[0]}${latexOperators.multiply}\\${args[1]}\\\\right)` },\n norm: {\n 1: '\\\\left\\\\|${args[0]}\\\\right\\\\|',\n 2: undefined // use default template\n },\n nthRoot: { 2: '\\\\sqrt[${args[1]}]{${args[0]}}' },\n nthRoots: { 2: '\\\\{y : y^${args[1]} = {${args[0]}}\\\\}' },\n pow: { 2: `\\\\left(\\${args[0]}\\\\right)${latexOperators.pow}{\\${args[1]}}` },\n round: {\n 1: '\\\\left\\\\lfloor${args[0]}\\\\right\\\\rceil',\n 2: undefined // use default template\n },\n sign: { 1: '\\\\mathrm{${name}}\\\\left(${args[0]}\\\\right)' },\n sqrt: { 1: '\\\\sqrt{${args[0]}}' },\n square: { 1: '\\\\left(${args[0]}\\\\right)^2' },\n subtract: { 2: `\\\\left(\\${args[0]}${latexOperators.subtract}\\${args[1]}\\\\right)` },\n unaryMinus: { 1: `${latexOperators.unaryMinus}\\\\left(\\${args[0]}\\\\right)` },\n unaryPlus: { 1: `${latexOperators.unaryPlus}\\\\left(\\${args[0]}\\\\right)` },\n\n // bitwise\n bitAnd: { 2: `\\\\left(\\${args[0]}${latexOperators.bitAnd}\\${args[1]}\\\\right)` },\n bitNot: { 1: latexOperators.bitNot + '\\\\left(${args[0]}\\\\right)' },\n bitOr: { 2: `\\\\left(\\${args[0]}${latexOperators.bitOr}\\${args[1]}\\\\right)` },\n bitXor: { 2: `\\\\left(\\${args[0]}${latexOperators.bitXor}\\${args[1]}\\\\right)` },\n leftShift: { 2: `\\\\left(\\${args[0]}${latexOperators.leftShift}\\${args[1]}\\\\right)` },\n rightArithShift: { 2: `\\\\left(\\${args[0]}${latexOperators.rightArithShift}\\${args[1]}\\\\right)` },\n rightLogShift: { 2: `\\\\left(\\${args[0]}${latexOperators.rightLogShift}\\${args[1]}\\\\right)` },\n\n // combinatorics\n bellNumbers: { 1: '\\\\mathrm{B}_{${args[0]}}' },\n catalan: { 1: '\\\\mathrm{C}_{${args[0]}}' },\n stirlingS2: { 2: '\\\\mathrm{S}\\\\left(${args}\\\\right)' },\n\n // complex\n arg: { 1: '\\\\arg\\\\left(${args[0]}\\\\right)' },\n conj: { 1: '\\\\left(${args[0]}\\\\right)^*' },\n im: { 1: '\\\\Im\\\\left\\\\lbrace${args[0]}\\\\right\\\\rbrace' },\n re: { 1: '\\\\Re\\\\left\\\\lbrace${args[0]}\\\\right\\\\rbrace' },\n\n // logical\n and: { 2: `\\\\left(\\${args[0]}${latexOperators.and}\\${args[1]}\\\\right)` },\n not: { 1: latexOperators.not + '\\\\left(${args[0]}\\\\right)' },\n or: { 2: `\\\\left(\\${args[0]}${latexOperators.or}\\${args[1]}\\\\right)` },\n xor: { 2: `\\\\left(\\${args[0]}${latexOperators.xor}\\${args[1]}\\\\right)` },\n\n // matrix\n cross: { 2: '\\\\left(${args[0]}\\\\right)\\\\times\\\\left(${args[1]}\\\\right)' },\n ctranspose: { 1: `\\\\left(\\${args[0]}\\\\right)${latexOperators.ctranspose}` },\n det: { 1: '\\\\det\\\\left(${args[0]}\\\\right)' },\n dot: { 2: '\\\\left(${args[0]}\\\\cdot${args[1]}\\\\right)' },\n expm: { 1: '\\\\exp\\\\left(${args[0]}\\\\right)' },\n inv: { 1: '\\\\left(${args[0]}\\\\right)^{-1}' },\n pinv: { 1: '\\\\left(${args[0]}\\\\right)^{+}' },\n sqrtm: { 1: `{\\${args[0]}}${latexOperators.pow}{\\\\frac{1}{2}}` },\n trace: { 1: '\\\\mathrm{tr}\\\\left(${args[0]}\\\\right)' },\n transpose: { 1: `\\\\left(\\${args[0]}\\\\right)${latexOperators.transpose}` },\n\n // probability\n combinations: { 2: '\\\\binom{${args[0]}}{${args[1]}}' },\n combinationsWithRep: { 2: '\\\\left(\\\\!\\\\!{\\\\binom{${args[0]}}{${args[1]}}}\\\\!\\\\!\\\\right)' },\n factorial: { 1: `\\\\left(\\${args[0]}\\\\right)${latexOperators.factorial}` },\n gamma: { 1: '\\\\Gamma\\\\left(${args[0]}\\\\right)' },\n lgamma: { 1: '\\\\ln\\\\Gamma\\\\left(${args[0]}\\\\right)' },\n\n // relational\n equal: { 2: `\\\\left(\\${args[0]}${latexOperators.equal}\\${args[1]}\\\\right)` },\n larger: { 2: `\\\\left(\\${args[0]}${latexOperators.larger}\\${args[1]}\\\\right)` },\n largerEq: { 2: `\\\\left(\\${args[0]}${latexOperators.largerEq}\\${args[1]}\\\\right)` },\n smaller: { 2: `\\\\left(\\${args[0]}${latexOperators.smaller}\\${args[1]}\\\\right)` },\n smallerEq: { 2: `\\\\left(\\${args[0]}${latexOperators.smallerEq}\\${args[1]}\\\\right)` },\n unequal: { 2: `\\\\left(\\${args[0]}${latexOperators.unequal}\\${args[1]}\\\\right)` },\n\n // special\n erf: { 1: 'erf\\\\left(${args[0]}\\\\right)' },\n\n // statistics\n max: '\\\\max\\\\left(${args}\\\\right)',\n min: '\\\\min\\\\left(${args}\\\\right)',\n variance: '\\\\mathrm{Var}\\\\left(${args}\\\\right)',\n\n // trigonometry\n acos: { 1: '\\\\cos^{-1}\\\\left(${args[0]}\\\\right)' },\n acosh: { 1: '\\\\cosh^{-1}\\\\left(${args[0]}\\\\right)' },\n acot: { 1: '\\\\cot^{-1}\\\\left(${args[0]}\\\\right)' },\n acoth: { 1: '\\\\coth^{-1}\\\\left(${args[0]}\\\\right)' },\n acsc: { 1: '\\\\csc^{-1}\\\\left(${args[0]}\\\\right)' },\n acsch: { 1: '\\\\mathrm{csch}^{-1}\\\\left(${args[0]}\\\\right)' },\n asec: { 1: '\\\\sec^{-1}\\\\left(${args[0]}\\\\right)' },\n asech: { 1: '\\\\mathrm{sech}^{-1}\\\\left(${args[0]}\\\\right)' },\n asin: { 1: '\\\\sin^{-1}\\\\left(${args[0]}\\\\right)' },\n asinh: { 1: '\\\\sinh^{-1}\\\\left(${args[0]}\\\\right)' },\n atan: { 1: '\\\\tan^{-1}\\\\left(${args[0]}\\\\right)' },\n atan2: { 2: '\\\\mathrm{atan2}\\\\left(${args}\\\\right)' },\n atanh: { 1: '\\\\tanh^{-1}\\\\left(${args[0]}\\\\right)' },\n cos: { 1: '\\\\cos\\\\left(${args[0]}\\\\right)' },\n cosh: { 1: '\\\\cosh\\\\left(${args[0]}\\\\right)' },\n cot: { 1: '\\\\cot\\\\left(${args[0]}\\\\right)' },\n coth: { 1: '\\\\coth\\\\left(${args[0]}\\\\right)' },\n csc: { 1: '\\\\csc\\\\left(${args[0]}\\\\right)' },\n csch: { 1: '\\\\mathrm{csch}\\\\left(${args[0]}\\\\right)' },\n sec: { 1: '\\\\sec\\\\left(${args[0]}\\\\right)' },\n sech: { 1: '\\\\mathrm{sech}\\\\left(${args[0]}\\\\right)' },\n sin: { 1: '\\\\sin\\\\left(${args[0]}\\\\right)' },\n sinh: { 1: '\\\\sinh\\\\left(${args[0]}\\\\right)' },\n tan: { 1: '\\\\tan\\\\left(${args[0]}\\\\right)' },\n tanh: { 1: '\\\\tanh\\\\left(${args[0]}\\\\right)' },\n\n // unit\n to: { 2: `\\\\left(\\${args[0]}${latexOperators.to}\\${args[1]}\\\\right)` },\n\n // utils\n numeric: function (node, options) {\n // Not sure if this is strictly right but should work correctly for the vast majority of use cases.\n return node.args[0].toTex()\n },\n\n // type\n number: {\n 0: '0',\n 1: '\\\\left(${args[0]}\\\\right)',\n 2: '\\\\left(\\\\left(${args[0]}\\\\right)${args[1]}\\\\right)'\n },\n string: {\n 0: '\\\\mathtt{\"\"}',\n 1: '\\\\mathrm{string}\\\\left(${args[0]}\\\\right)'\n },\n bignumber: {\n 0: '0',\n 1: '\\\\left(${args[0]}\\\\right)'\n },\n bigint: {\n 0: '0',\n 1: '\\\\left(${args[0]}\\\\right)'\n },\n complex: {\n 0: '0',\n 1: '\\\\left(${args[0]}\\\\right)',\n 2: `\\\\left(\\\\left(\\${args[0]}\\\\right)+${latexSymbols.i}\\\\cdot\\\\left(\\${args[1]}\\\\right)\\\\right)`\n },\n matrix: {\n 0: '\\\\begin{bmatrix}\\\\end{bmatrix}',\n 1: '\\\\left(${args[0]}\\\\right)',\n 2: '\\\\left(${args[0]}\\\\right)'\n },\n sparse: {\n 0: '\\\\begin{bsparse}\\\\end{bsparse}',\n 1: '\\\\left(${args[0]}\\\\right)'\n },\n unit: {\n 1: '\\\\left(${args[0]}\\\\right)',\n 2: '\\\\left(\\\\left(${args[0]}\\\\right)${args[1]}\\\\right)'\n }\n\n}\n\nexport const defaultTemplate = '\\\\mathrm{${name}}\\\\left(${args}\\\\right)'\n\nconst latexUnits = {\n deg: '^\\\\circ'\n}\n\nexport function escapeLatex (string) {\n return escapeLatexLib(string, { preserveFormatting: true })\n}\n\n// @param {string} name\n// @param {boolean} isUnit\nexport function toSymbol (name, isUnit) {\n isUnit = typeof isUnit === 'undefined' ? false : isUnit\n if (isUnit) {\n if (hasOwnProperty(latexUnits, name)) {\n return latexUnits[name]\n }\n\n return '\\\\mathrm{' + escapeLatex(name) + '}'\n }\n\n if (hasOwnProperty(latexSymbols, name)) {\n return latexSymbols[name]\n }\n\n return escapeLatex(name)\n}\n","import { format } from '../../utils/string.js'\nimport { typeOf } from '../../utils/is.js'\nimport { escapeLatex } from '../../utils/latex.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'ConstantNode'\nconst dependencies = [\n 'Node'\n]\n\nexport const createConstantNode = /* #__PURE__ */ factory(name, dependencies, ({ Node }) => {\n class ConstantNode extends Node {\n /**\n * A ConstantNode holds a constant value like a number or string.\n *\n * Usage:\n *\n * new ConstantNode(2.3)\n * new ConstantNode('hello')\n *\n * @param {*} value Value can be any type (number, BigNumber, bigint, string, ...)\n * @constructor ConstantNode\n * @extends {Node}\n */\n constructor (value) {\n super()\n this.value = value\n }\n\n static name = name\n get type () { return name }\n get isConstantNode () { return true }\n\n /**\n * Compile a node into a JavaScript function.\n * This basically pre-calculates as much as possible and only leaves open\n * calculations which depend on a dynamic scope with variables.\n * @param {Object} math Math.js namespace with functions and constants.\n * @param {Object} argNames An object with argument names as key and `true`\n * as value. Used in the SymbolNode to optimize\n * for arguments from user assigned functions\n * (see FunctionAssignmentNode) or special symbols\n * like `end` (see IndexNode).\n * @return {function} Returns a function which can be called like:\n * evalNode(scope: Object, args: Object, context: *)\n */\n _compile (math, argNames) {\n const value = this.value\n\n return function evalConstantNode () {\n return value\n }\n }\n\n /**\n * Execute a callback for each of the child nodes of this node\n * @param {function(child: Node, path: string, parent: Node)} callback\n */\n forEach (callback) {\n // nothing to do, we don't have any children\n }\n\n /**\n * Create a new ConstantNode with children produced by the given callback.\n * Trivial because there are no children.\n * @param {function(child: Node, path: string, parent: Node) : Node} callback\n * @returns {ConstantNode} Returns a clone of the node\n */\n map (callback) {\n return this.clone()\n }\n\n /**\n * Create a clone of this node, a shallow copy\n * @return {ConstantNode}\n */\n clone () {\n return new ConstantNode(this.value)\n }\n\n /**\n * Get string representation\n * @param {Object} options\n * @return {string} str\n */\n _toString (options) {\n return format(this.value, options)\n }\n\n /**\n * Get HTML representation\n * @param {Object} options\n * @return {string} str\n */\n _toHTML (options) {\n const value = this._toString(options)\n\n switch (typeOf(this.value)) {\n case 'number':\n case 'bigint':\n case 'BigNumber':\n case 'Fraction':\n return '' + value + ''\n case 'string':\n return '' + value + ''\n case 'boolean':\n return '' + value + ''\n case 'null':\n return '' + value + ''\n case 'undefined':\n return '' + value + ''\n\n default:\n return '' + value + ''\n }\n }\n\n /**\n * Get a JSON representation of the node\n * @returns {Object}\n */\n toJSON () {\n return { mathjs: name, value: this.value }\n }\n\n /**\n * Instantiate a ConstantNode from its JSON representation\n * @param {Object} json An object structured like\n * `{\"mathjs\": \"SymbolNode\", value: 2.3}`,\n * where mathjs is optional\n * @returns {ConstantNode}\n */\n static fromJSON (json) {\n return new ConstantNode(json.value)\n }\n\n /**\n * Get LaTeX representation\n * @param {Object} options\n * @return {string} str\n */\n _toTex (options) {\n const value = this._toString(options)\n const type = typeOf(this.value)\n\n switch (type) {\n case 'string':\n return '\\\\mathtt{' + escapeLatex(value) + '}'\n\n case 'number':\n case 'BigNumber': {\n const finite = type === 'BigNumber' ? this.value.isFinite() : isFinite(this.value)\n if (!finite) {\n return (this.value.valueOf() < 0)\n ? '-\\\\infty'\n : '\\\\infty'\n }\n\n const index = value.toLowerCase().indexOf('e')\n if (index !== -1) {\n return value.substring(0, index) + '\\\\cdot10^{' +\n value.substring(index + 1) + '}'\n }\n\n return value\n }\n\n case 'bigint': {\n return value.toString()\n }\n\n case 'Fraction':\n return this.value.toLatex()\n\n default:\n return value\n }\n }\n }\n\n return ConstantNode\n}, { isClass: true, isNode: true })\n","import { isNode } from '../../utils/is.js'\n\nimport { keywords } from '../keywords.js'\nimport { escape } from '../../utils/string.js'\nimport { forEach, join } from '../../utils/array.js'\nimport { toSymbol } from '../../utils/latex.js'\nimport { getPrecedence } from '../operators.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'FunctionAssignmentNode'\nconst dependencies = [\n 'typed',\n 'Node'\n]\n\nexport const createFunctionAssignmentNode = /* #__PURE__ */ factory(name, dependencies, ({ typed, Node }) => {\n /**\n * Is parenthesis needed?\n * @param {Node} node\n * @param {Object} parenthesis\n * @param {string} implicit\n * @private\n */\n function needParenthesis (node, parenthesis, implicit) {\n const precedence = getPrecedence(node, parenthesis, implicit)\n const exprPrecedence = getPrecedence(node.expr, parenthesis, implicit)\n\n return (parenthesis === 'all') ||\n ((exprPrecedence !== null) && (exprPrecedence <= precedence))\n }\n\n class FunctionAssignmentNode extends Node {\n /**\n * @constructor FunctionAssignmentNode\n * @extends {Node}\n * Function assignment\n *\n * @param {string} name Function name\n * @param {string[] | Array.<{name: string, type: string}>} params\n * Array with function parameter names, or an\n * array with objects containing the name\n * and type of the parameter\n * @param {Node} expr The function expression\n */\n constructor (name, params, expr) {\n super()\n // validate input\n if (typeof name !== 'string') { throw new TypeError('String expected for parameter \"name\"') }\n if (!Array.isArray(params)) {\n throw new TypeError(\n 'Array containing strings or objects expected for parameter \"params\"')\n }\n if (!isNode(expr)) { throw new TypeError('Node expected for parameter \"expr\"') }\n if (keywords.has(name)) { throw new Error('Illegal function name, \"' + name + '\" is a reserved keyword') }\n\n const paramNames = new Set()\n for (const param of params) {\n const name = typeof param === 'string' ? param : param.name\n if (paramNames.has(name)) {\n throw new Error(`Duplicate parameter name \"${name}\"`)\n } else {\n paramNames.add(name)\n }\n }\n\n this.name = name\n this.params = params.map(function (param) {\n return (param && param.name) || param\n })\n this.types = params.map(function (param) {\n return (param && param.type) || 'any'\n })\n this.expr = expr\n }\n\n static name = name\n get type () { return name }\n get isFunctionAssignmentNode () { return true }\n\n /**\n * Compile a node into a JavaScript function.\n * This basically pre-calculates as much as possible and only leaves open\n * calculations which depend on a dynamic scope with variables.\n * @param {Object} math Math.js namespace with functions and constants.\n * @param {Object} argNames An object with argument names as key and `true`\n * as value. Used in the SymbolNode to optimize\n * for arguments from user assigned functions\n * (see FunctionAssignmentNode) or special symbols\n * like `end` (see IndexNode).\n * @return {function} Returns a function which can be called like:\n * evalNode(scope: Object, args: Object, context: *)\n */\n _compile (math, argNames) {\n const childArgNames = Object.create(argNames)\n forEach(this.params, function (param) {\n childArgNames[param] = true\n })\n\n // compile the function expression with the child args\n const evalExpr = this.expr._compile(math, childArgNames)\n const name = this.name\n const params = this.params\n const signature = join(this.types, ',')\n const syntax = name + '(' + join(this.params, ', ') + ')'\n\n return function evalFunctionAssignmentNode (scope, args, context) {\n const signatures = {}\n signatures[signature] = function () {\n const childArgs = Object.create(args)\n\n for (let i = 0; i < params.length; i++) {\n childArgs[params[i]] = arguments[i]\n }\n\n return evalExpr(scope, childArgs, context)\n }\n const fn = typed(name, signatures)\n fn.syntax = syntax\n\n scope.set(name, fn)\n\n return fn\n }\n }\n\n /**\n * Execute a callback for each of the child nodes of this node\n * @param {function(child: Node, path: string, parent: Node)} callback\n */\n forEach (callback) {\n callback(this.expr, 'expr', this)\n }\n\n /**\n * Create a new FunctionAssignmentNode whose children are the results of\n * calling the provided callback function for each child of the original\n * node.\n * @param {function(child: Node, path: string, parent: Node): Node} callback\n * @returns {FunctionAssignmentNode} Returns a transformed copy of the node\n */\n map (callback) {\n const expr = this._ifNode(callback(this.expr, 'expr', this))\n\n return new FunctionAssignmentNode(this.name, this.params.slice(0), expr)\n }\n\n /**\n * Create a clone of this node, a shallow copy\n * @return {FunctionAssignmentNode}\n */\n clone () {\n return new FunctionAssignmentNode(\n this.name, this.params.slice(0), this.expr)\n }\n\n /**\n * get string representation\n * @param {Object} options\n * @return {string} str\n */\n _toString (options) {\n const parenthesis =\n (options && options.parenthesis) ? options.parenthesis : 'keep'\n let expr = this.expr.toString(options)\n if (needParenthesis(this, parenthesis, options && options.implicit)) {\n expr = '(' + expr + ')'\n }\n return this.name + '(' + this.params.join(', ') + ') = ' + expr\n }\n\n /**\n * Get a JSON representation of the node\n * @returns {Object}\n */\n toJSON () {\n const types = this.types\n\n return {\n mathjs: name,\n name: this.name,\n params: this.params.map(function (param, index) {\n return {\n name: param,\n type: types[index]\n }\n }),\n expr: this.expr\n }\n }\n\n /**\n * Instantiate an FunctionAssignmentNode from its JSON representation\n * @param {Object} json\n * An object structured like\n * ```\n * {\"mathjs\": \"FunctionAssignmentNode\",\n * name: ..., params: ..., expr: ...}\n * ```\n * where mathjs is optional\n * @returns {FunctionAssignmentNode}\n */\n static fromJSON (json) {\n return new FunctionAssignmentNode(json.name, json.params, json.expr)\n }\n\n /**\n * get HTML representation\n * @param {Object} options\n * @return {string} str\n */\n _toHTML (options) {\n const parenthesis = (options && options.parenthesis) ? options.parenthesis : 'keep'\n const params = []\n for (let i = 0; i < this.params.length; i++) {\n params.push('' +\n escape(this.params[i]) + '')\n }\n let expr = this.expr.toHTML(options)\n if (needParenthesis(this, parenthesis, options && options.implicit)) {\n expr = '(' +\n expr +\n ')'\n }\n return '' +\n escape(this.name) + '' +\n '(' +\n params.join(',') +\n ')' +\n '=' +\n expr\n }\n\n /**\n * get LaTeX representation\n * @param {Object} options\n * @return {string} str\n */\n _toTex (options) {\n const parenthesis =\n (options && options.parenthesis) ? options.parenthesis : 'keep'\n let expr = this.expr.toTex(options)\n if (needParenthesis(this, parenthesis, options && options.implicit)) {\n expr = `\\\\left(${expr}\\\\right)`\n }\n\n return '\\\\mathrm{' + this.name +\n '}\\\\left(' + this.params.map(toSymbol).join(',') + '\\\\right)=' + expr\n }\n }\n\n return FunctionAssignmentNode\n}, { isClass: true, isNode: true })\n","import { map } from '../../utils/array.js'\nimport { getSafeProperty } from '../../utils/customs.js'\nimport { factory } from '../../utils/factory.js'\nimport { isArray, isConstantNode, isMatrix, isNode, isString, typeOf } from '../../utils/is.js'\nimport { escape } from '../../utils/string.js'\n\nconst name = 'IndexNode'\nconst dependencies = [\n 'Node',\n 'size'\n]\n\nexport const createIndexNode = /* #__PURE__ */ factory(name, dependencies, ({ Node, size }) => {\n class IndexNode extends Node {\n /**\n * @constructor IndexNode\n * @extends Node\n *\n * Describes a subset of a matrix or an object property.\n * Cannot be used on its own, needs to be used within an AccessorNode or\n * AssignmentNode.\n *\n * @param {Node[]} dimensions\n * @param {boolean} [dotNotation=false]\n * Optional property describing whether this index was written using dot\n * notation like `a.b`, or using bracket notation like `a[\"b\"]`\n * (which is the default). This property is used for string conversion.\n */\n constructor (dimensions, dotNotation) {\n super()\n this.dimensions = dimensions\n this.dotNotation = dotNotation || false\n\n // validate input\n if (!Array.isArray(dimensions) || !dimensions.every(isNode)) {\n throw new TypeError(\n 'Array containing Nodes expected for parameter \"dimensions\"')\n }\n if (this.dotNotation && !this.isObjectProperty()) {\n throw new Error('dotNotation only applicable for object properties')\n }\n }\n\n static name = name\n get type () { return name }\n get isIndexNode () { return true }\n\n /**\n * Compile a node into a JavaScript function.\n * This basically pre-calculates as much as possible and only leaves open\n * calculations which depend on a dynamic scope with variables.\n * @param {Object} math Math.js namespace with functions and constants.\n * @param {Object} argNames An object with argument names as key and `true`\n * as value. Used in the SymbolNode to optimize\n * for arguments from user assigned functions\n * (see FunctionAssignmentNode) or special symbols\n * like `end` (see IndexNode).\n * @return {function} Returns a function which can be called like:\n * evalNode(scope: Object, args: Object, context: *)\n */\n _compile (math, argNames) {\n // TODO: implement support for bignumber (currently bignumbers are silently\n // reduced to numbers when changing the value to zero-based)\n\n // TODO: Optimization: when the range values are ConstantNodes,\n // we can beforehand resolve the zero-based value\n\n // optimization for a simple object property\n const evalDimensions = map(this.dimensions, function (dimension, i) {\n const needsEnd = dimension\n .filter(node => node.isSymbolNode && node.name === 'end')\n .length > 0\n\n if (needsEnd) {\n // SymbolNode 'end' is used inside the index,\n // like in `A[end]` or `A[end - 2]`\n const childArgNames = Object.create(argNames)\n childArgNames.end = true\n\n const _evalDimension = dimension._compile(math, childArgNames)\n\n return function evalDimension (scope, args, context) {\n if (!isMatrix(context) && !isArray(context) && !isString(context)) {\n throw new TypeError(\n 'Cannot resolve \"end\": ' +\n 'context must be a Matrix, Array, or string but is ' +\n typeOf(context))\n }\n\n const s = size(context).valueOf()\n const childArgs = Object.create(args)\n childArgs.end = s[i]\n\n return _evalDimension(scope, childArgs, context)\n }\n } else {\n // SymbolNode `end` not used\n return dimension._compile(math, argNames)\n }\n })\n\n const index = getSafeProperty(math, 'index')\n\n return function evalIndexNode (scope, args, context) {\n const dimensions = map(evalDimensions, function (evalDimension) {\n return evalDimension(scope, args, context)\n })\n\n return index(...dimensions)\n }\n }\n\n /**\n * Execute a callback for each of the child nodes of this node\n * @param {function(child: Node, path: string, parent: Node)} callback\n */\n forEach (callback) {\n for (let i = 0; i < this.dimensions.length; i++) {\n callback(this.dimensions[i], 'dimensions[' + i + ']', this)\n }\n }\n\n /**\n * Create a new IndexNode whose children are the results of calling\n * the provided callback function for each child of the original node.\n * @param {function(child: Node, path: string, parent: Node): Node} callback\n * @returns {IndexNode} Returns a transformed copy of the node\n */\n map (callback) {\n const dimensions = []\n for (let i = 0; i < this.dimensions.length; i++) {\n dimensions[i] = this._ifNode(\n callback(this.dimensions[i], 'dimensions[' + i + ']', this))\n }\n\n return new IndexNode(dimensions, this.dotNotation)\n }\n\n /**\n * Create a clone of this node, a shallow copy\n * @return {IndexNode}\n */\n clone () {\n return new IndexNode(this.dimensions.slice(0), this.dotNotation)\n }\n\n /**\n * Test whether this IndexNode contains a single property name\n * @return {boolean}\n */\n isObjectProperty () {\n return this.dimensions.length === 1 &&\n isConstantNode(this.dimensions[0]) &&\n typeof this.dimensions[0].value === 'string'\n }\n\n /**\n * Returns the property name if IndexNode contains a property.\n * If not, returns null.\n * @return {string | null}\n */\n getObjectProperty () {\n return this.isObjectProperty() ? this.dimensions[0].value : null\n }\n\n /**\n * Get string representation\n * @param {Object} options\n * @return {string} str\n */\n _toString (options) {\n // format the parameters like \"[1, 0:5]\"\n return this.dotNotation\n ? ('.' + this.getObjectProperty())\n : ('[' + this.dimensions.join(', ') + ']')\n }\n\n /**\n * Get a JSON representation of the node\n * @returns {Object}\n */\n toJSON () {\n return {\n mathjs: name,\n dimensions: this.dimensions,\n dotNotation: this.dotNotation\n }\n }\n\n /**\n * Instantiate an IndexNode from its JSON representation\n * @param {Object} json\n * An object structured like\n * `{\"mathjs\": \"IndexNode\", dimensions: [...], dotNotation: false}`,\n * where mathjs is optional\n * @returns {IndexNode}\n */\n static fromJSON (json) {\n return new IndexNode(json.dimensions, json.dotNotation)\n }\n\n /**\n * Get HTML representation\n * @param {Object} options\n * @return {string} str\n */\n _toHTML (options) {\n // format the parameters like \"[1, 0:5]\"\n const dimensions = []\n for (let i = 0; i < this.dimensions.length; i++) {\n dimensions[i] = this.dimensions[i].toHTML()\n }\n if (this.dotNotation) {\n return '.' +\n '' +\n escape(this.getObjectProperty()) + ''\n } else {\n return '[' +\n dimensions.join(',') +\n ']'\n }\n }\n\n /**\n * Get LaTeX representation\n * @param {Object} options\n * @return {string} str\n */\n _toTex (options) {\n const dimensions = this.dimensions.map(function (range) {\n return range.toTex(options)\n })\n\n return this.dotNotation\n ? ('.' + this.getObjectProperty() + '')\n : ('_{' + dimensions.join(',') + '}')\n }\n }\n\n return IndexNode\n}, { isClass: true, isNode: true })\n","import { getSafeProperty } from '../../utils/customs.js'\nimport { factory } from '../../utils/factory.js'\nimport { isNode } from '../../utils/is.js'\nimport { hasOwnProperty } from '../../utils/object.js'\nimport { escape, stringify } from '../../utils/string.js'\n\nconst name = 'ObjectNode'\nconst dependencies = [\n 'Node'\n]\n\nexport const createObjectNode = /* #__PURE__ */ factory(name, dependencies, ({ Node }) => {\n class ObjectNode extends Node {\n /**\n * @constructor ObjectNode\n * @extends {Node}\n * Holds an object with keys/values\n * @param {Object.} [properties] object with key/value pairs\n */\n constructor (properties) {\n super()\n this.properties = properties || {}\n\n // validate input\n if (properties) {\n if (!(typeof properties === 'object') ||\n !Object.keys(properties).every(function (key) {\n return isNode(properties[key])\n })) {\n throw new TypeError('Object containing Nodes expected')\n }\n }\n }\n\n static name = name\n get type () { return name }\n get isObjectNode () { return true }\n\n /**\n * Compile a node into a JavaScript function.\n * This basically pre-calculates as much as possible and only leaves open\n * calculations which depend on a dynamic scope with variables.\n * @param {Object} math Math.js namespace with functions and constants.\n * @param {Object} argNames An object with argument names as key and `true`\n * as value. Used in the SymbolNode to optimize\n * for arguments from user assigned functions\n * (see FunctionAssignmentNode) or special symbols\n * like `end` (see IndexNode).\n * @return {function} Returns a function which can be called like:\n * evalNode(scope: Object, args: Object, context: *)\n */\n _compile (math, argNames) {\n const evalEntries = {}\n\n for (const key in this.properties) {\n if (hasOwnProperty(this.properties, key)) {\n // we stringify/parse the key here to resolve unicode characters,\n // so you cannot create a key like {\"co\\\\u006Estructor\": null}\n const stringifiedKey = stringify(key)\n const parsedKey = JSON.parse(stringifiedKey)\n const prop = getSafeProperty(this.properties, key)\n\n evalEntries[parsedKey] = prop._compile(math, argNames)\n }\n }\n\n return function evalObjectNode (scope, args, context) {\n const obj = {}\n\n for (const key in evalEntries) {\n if (hasOwnProperty(evalEntries, key)) {\n obj[key] = evalEntries[key](scope, args, context)\n }\n }\n\n return obj\n }\n }\n\n /**\n * Execute a callback for each of the child nodes of this node\n * @param {function(child: Node, path: string, parent: Node)} callback\n */\n forEach (callback) {\n for (const key in this.properties) {\n if (hasOwnProperty(this.properties, key)) {\n callback(\n this.properties[key], 'properties[' + stringify(key) + ']', this)\n }\n }\n }\n\n /**\n * Create a new ObjectNode whose children are the results of calling\n * the provided callback function for each child of the original node.\n * @param {function(child: Node, path: string, parent: Node): Node} callback\n * @returns {ObjectNode} Returns a transformed copy of the node\n */\n map (callback) {\n const properties = {}\n for (const key in this.properties) {\n if (hasOwnProperty(this.properties, key)) {\n properties[key] = this._ifNode(\n callback(\n this.properties[key], 'properties[' + stringify(key) + ']', this))\n }\n }\n return new ObjectNode(properties)\n }\n\n /**\n * Create a clone of this node, a shallow copy\n * @return {ObjectNode}\n */\n clone () {\n const properties = {}\n for (const key in this.properties) {\n if (hasOwnProperty(this.properties, key)) {\n properties[key] = this.properties[key]\n }\n }\n return new ObjectNode(properties)\n }\n\n /**\n * Get string representation\n * @param {Object} options\n * @return {string} str\n * @override\n */\n _toString (options) {\n const entries = []\n for (const key in this.properties) {\n if (hasOwnProperty(this.properties, key)) {\n entries.push(\n stringify(key) + ': ' + this.properties[key].toString(options))\n }\n }\n return '{' + entries.join(', ') + '}'\n }\n\n /**\n * Get a JSON representation of the node\n * @returns {Object}\n */\n toJSON () {\n return {\n mathjs: name,\n properties: this.properties\n }\n }\n\n /**\n * Instantiate an OperatorNode from its JSON representation\n * @param {Object} json An object structured like\n * `{\"mathjs\": \"ObjectNode\", \"properties\": {...}}`,\n * where mathjs is optional\n * @returns {ObjectNode}\n */\n static fromJSON (json) {\n return new ObjectNode(json.properties)\n }\n\n /**\n * Get HTML representation\n * @param {Object} options\n * @return {string} str\n * @override\n */\n _toHTML (options) {\n const entries = []\n for (const key in this.properties) {\n if (hasOwnProperty(this.properties, key)) {\n entries.push(\n '' + escape(key) + '' +\n '' +\n ':' + this.properties[key].toHTML(options))\n }\n }\n return '{' +\n entries.join(',') +\n '}'\n }\n\n /**\n * Get LaTeX representation\n * @param {Object} options\n * @return {string} str\n */\n _toTex (options) {\n const entries = []\n for (const key in this.properties) {\n if (hasOwnProperty(this.properties, key)) {\n entries.push(\n '\\\\mathbf{' + key + ':} & ' +\n this.properties[key].toTex(options) + '\\\\\\\\')\n }\n }\n const tex = '\\\\left\\\\{\\\\begin{array}{ll}' + entries.join('\\n') +\n '\\\\end{array}\\\\right\\\\}'\n return tex\n }\n }\n\n return ObjectNode\n}, { isClass: true, isNode: true })\n","import { ObjectWrappingMap, PartitionedMap } from './map.js'\n\n/**\n * Create a new scope which can access the parent scope,\n * but does not affect it when written. This is suitable for variable definitions\n * within a block node, or function definition.\n *\n * If parent scope has a createSubScope method, it delegates to that. Otherwise,\n * creates an empty map, and copies the parent scope to it, adding in\n * the remaining `args`.\n *\n * @param {Map} parentScope\n * @param {Object} args\n * @returns {PartitionedMap}\n */\nexport function createSubScope (parentScope, args) {\n return new PartitionedMap(\n parentScope,\n new ObjectWrappingMap(args),\n new Set(Object.keys(args))\n )\n}\n","import { isNode, isConstantNode, isOperatorNode, isParenthesisNode } from '../../utils/is.js'\nimport { map } from '../../utils/array.js'\nimport { createSubScope } from '../../utils/scope.js'\nimport { escape } from '../../utils/string.js'\nimport { getSafeProperty, isSafeMethod } from '../../utils/customs.js'\nimport { getAssociativity, getPrecedence, isAssociativeWith, properties } from '../operators.js'\nimport { latexOperators } from '../../utils/latex.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'OperatorNode'\nconst dependencies = [\n 'Node'\n]\n\nexport const createOperatorNode = /* #__PURE__ */ factory(name, dependencies, ({ Node }) => {\n /**\n * Returns true if the expression starts with a constant, under\n * the current parenthesization:\n * @param {Node} expression\n * @param {string} parenthesis\n * @return {boolean}\n */\n function startsWithConstant (expr, parenthesis) {\n let curNode = expr\n if (parenthesis === 'auto') {\n while (isParenthesisNode(curNode)) curNode = curNode.content\n }\n if (isConstantNode(curNode)) return true\n if (isOperatorNode(curNode)) {\n return startsWithConstant(curNode.args[0], parenthesis)\n }\n return false\n }\n\n /**\n * Calculate which parentheses are necessary. Gets an OperatorNode\n * (which is the root of the tree) and an Array of Nodes\n * (this.args) and returns an array where 'true' means that an argument\n * has to be enclosed in parentheses whereas 'false' means the opposite.\n *\n * @param {OperatorNode} root\n * @param {string} parenthesis\n * @param {Node[]} args\n * @param {boolean} latex\n * @return {boolean[]}\n * @private\n */\n function calculateNecessaryParentheses (root, parenthesis, implicit, args, latex) {\n // precedence of the root OperatorNode\n const precedence = getPrecedence(root, parenthesis, implicit)\n const associativity = getAssociativity(root, parenthesis)\n\n if ((parenthesis === 'all') || ((args.length > 2) && (root.getIdentifier() !== 'OperatorNode:add') && (root.getIdentifier() !== 'OperatorNode:multiply'))) {\n return args.map(function (arg) {\n switch (arg.getContent().type) { // Nodes that don't need extra parentheses\n case 'ArrayNode':\n case 'ConstantNode':\n case 'SymbolNode':\n case 'ParenthesisNode':\n return false\n default:\n return true\n }\n })\n }\n\n let result\n switch (args.length) {\n case 0:\n result = []\n break\n\n case 1: // unary operators\n {\n // precedence of the operand\n const operandPrecedence = getPrecedence(args[0], parenthesis, implicit, root)\n\n // handle special cases for LaTeX, where some of the parentheses aren't needed\n if (latex && (operandPrecedence !== null)) {\n let operandIdentifier\n let rootIdentifier\n if (parenthesis === 'keep') {\n operandIdentifier = args[0].getIdentifier()\n rootIdentifier = root.getIdentifier()\n } else {\n // Ignore Parenthesis Nodes when not in 'keep' mode\n operandIdentifier = args[0].getContent().getIdentifier()\n rootIdentifier = root.getContent().getIdentifier()\n }\n if (properties[precedence][rootIdentifier].latexLeftParens === false) {\n result = [false]\n break\n }\n\n if (properties[operandPrecedence][operandIdentifier].latexParens === false) {\n result = [false]\n break\n }\n }\n\n if (operandPrecedence === null) {\n // if the operand has no defined precedence, no parens are needed\n result = [false]\n break\n }\n\n if (operandPrecedence <= precedence) {\n // if the operands precedence is lower, parens are needed\n result = [true]\n break\n }\n\n // otherwise, no parens needed\n result = [false]\n }\n break\n case 2: // binary operators\n {\n let lhsParens // left hand side needs parenthesis?\n // precedence of the left hand side\n const lhsPrecedence = getPrecedence(args[0], parenthesis, implicit, root)\n // is the root node associative with the left hand side\n const assocWithLhs = isAssociativeWith(root, args[0], parenthesis)\n\n if (lhsPrecedence === null) {\n // if the left hand side has no defined precedence, no parens are needed\n // FunctionNode for example\n lhsParens = false\n } else if ((lhsPrecedence === precedence) && (associativity === 'right') && !assocWithLhs) {\n // In case of equal precedence, if the root node is left associative\n // parens are **never** necessary for the left hand side.\n // If it is right associative however, parens are necessary\n // if the root node isn't associative with the left hand side\n lhsParens = true\n } else if (lhsPrecedence < precedence) {\n lhsParens = true\n } else {\n lhsParens = false\n }\n\n let rhsParens // right hand side needs parenthesis?\n // precedence of the right hand side\n const rhsPrecedence = getPrecedence(args[1], parenthesis, implicit, root)\n // is the root node associative with the right hand side?\n const assocWithRhs = isAssociativeWith(root, args[1], parenthesis)\n\n if (rhsPrecedence === null) {\n // if the right hand side has no defined precedence, no parens are needed\n // FunctionNode for example\n rhsParens = false\n } else if ((rhsPrecedence === precedence) && (associativity === 'left') && !assocWithRhs) {\n // In case of equal precedence, if the root node is right associative\n // parens are **never** necessary for the right hand side.\n // If it is left associative however, parens are necessary\n // if the root node isn't associative with the right hand side\n rhsParens = true\n } else if (rhsPrecedence < precedence) {\n rhsParens = true\n } else {\n rhsParens = false\n }\n\n // handle special cases for LaTeX, where some of the parentheses aren't needed\n if (latex) {\n let rootIdentifier\n let lhsIdentifier\n let rhsIdentifier\n if (parenthesis === 'keep') {\n rootIdentifier = root.getIdentifier()\n lhsIdentifier = root.args[0].getIdentifier()\n rhsIdentifier = root.args[1].getIdentifier()\n } else {\n // Ignore ParenthesisNodes when not in 'keep' mode\n rootIdentifier = root.getContent().getIdentifier()\n lhsIdentifier = root.args[0].getContent().getIdentifier()\n rhsIdentifier = root.args[1].getContent().getIdentifier()\n }\n\n if (lhsPrecedence !== null) {\n if (properties[precedence][rootIdentifier].latexLeftParens === false) {\n lhsParens = false\n }\n\n if (properties[lhsPrecedence][lhsIdentifier].latexParens === false) {\n lhsParens = false\n }\n }\n\n if (rhsPrecedence !== null) {\n if (properties[precedence][rootIdentifier].latexRightParens === false) {\n rhsParens = false\n }\n\n if (properties[rhsPrecedence][rhsIdentifier].latexParens === false) {\n rhsParens = false\n }\n }\n }\n\n result = [lhsParens, rhsParens]\n }\n break\n\n default:\n if ((root.getIdentifier() === 'OperatorNode:add') || (root.getIdentifier() === 'OperatorNode:multiply')) {\n result = args.map(function (arg) {\n const argPrecedence = getPrecedence(arg, parenthesis, implicit, root)\n const assocWithArg = isAssociativeWith(root, arg, parenthesis)\n const argAssociativity = getAssociativity(arg, parenthesis)\n if (argPrecedence === null) {\n // if the argument has no defined precedence, no parens are needed\n return false\n } else if ((precedence === argPrecedence) && (associativity === argAssociativity) && !assocWithArg) {\n return true\n } else if (argPrecedence < precedence) {\n return true\n }\n\n return false\n })\n }\n break\n }\n\n // Handles an edge case of parentheses with implicit multiplication\n // of ConstantNode.\n // In that case, parenthesize ConstantNodes that follow an unparenthesized\n // expression, even though they normally wouldn't be printed.\n if (args.length >= 2 && root.getIdentifier() === 'OperatorNode:multiply' &&\n root.implicit && parenthesis !== 'all' && implicit === 'hide') {\n for (let i = 1; i < result.length; ++i) {\n if (startsWithConstant(args[i], parenthesis) && !result[i - 1] &&\n (parenthesis !== 'keep' || !isParenthesisNode(args[i - 1]))) {\n result[i] = true\n }\n }\n }\n\n return result\n }\n\n class OperatorNode extends Node {\n /**\n * @constructor OperatorNode\n * @extends {Node}\n * An operator with two arguments, like 2+3\n *\n * @param {string} op Operator name, for example '+'\n * @param {string} fn Function name, for example 'add'\n * @param {Node[]} args Operator arguments\n * @param {boolean} [implicit] Is this an implicit multiplication?\n * @param {boolean} [isPercentage] Is this an percentage Operation?\n */\n constructor (op, fn, args, implicit, isPercentage) {\n super()\n // validate input\n if (typeof op !== 'string') {\n throw new TypeError('string expected for parameter \"op\"')\n }\n if (typeof fn !== 'string') {\n throw new TypeError('string expected for parameter \"fn\"')\n }\n if (!Array.isArray(args) || !args.every(isNode)) {\n throw new TypeError(\n 'Array containing Nodes expected for parameter \"args\"')\n }\n\n this.implicit = (implicit === true)\n this.isPercentage = (isPercentage === true)\n this.op = op\n this.fn = fn\n this.args = args || []\n }\n\n static name = name\n get type () { return name }\n get isOperatorNode () { return true }\n\n /**\n * Compile a node into a JavaScript function.\n * This basically pre-calculates as much as possible and only leaves open\n * calculations which depend on a dynamic scope with variables.\n * @param {Object} math Math.js namespace with functions and constants.\n * @param {Object} argNames An object with argument names as key and `true`\n * as value. Used in the SymbolNode to optimize\n * for arguments from user assigned functions\n * (see FunctionAssignmentNode) or special symbols\n * like `end` (see IndexNode).\n * @return {function} Returns a function which can be called like:\n * evalNode(scope: Object, args: Object, context: *)\n */\n _compile (math, argNames) {\n // validate fn\n if (typeof this.fn !== 'string' || !isSafeMethod(math, this.fn)) {\n if (!math[this.fn]) {\n throw new Error(\n 'Function ' + this.fn + ' missing in provided namespace \"math\"')\n } else {\n throw new Error('No access to function \"' + this.fn + '\"')\n }\n }\n\n const fn = getSafeProperty(math, this.fn)\n const evalArgs = map(this.args, function (arg) {\n return arg._compile(math, argNames)\n })\n\n if (typeof fn === 'function' && fn.rawArgs === true) {\n // pass unevaluated parameters (nodes) to the function\n // \"raw\" evaluation\n const rawArgs = this.args\n return function evalOperatorNode (scope, args, context) {\n return fn(rawArgs, math, createSubScope(scope, args))\n }\n } else if (evalArgs.length === 1) {\n const evalArg0 = evalArgs[0]\n return function evalOperatorNode (scope, args, context) {\n return fn(evalArg0(scope, args, context))\n }\n } else if (evalArgs.length === 2) {\n const evalArg0 = evalArgs[0]\n const evalArg1 = evalArgs[1]\n return function evalOperatorNode (scope, args, context) {\n return fn(\n evalArg0(scope, args, context),\n evalArg1(scope, args, context))\n }\n } else {\n return function evalOperatorNode (scope, args, context) {\n return fn.apply(null, map(evalArgs, function (evalArg) {\n return evalArg(scope, args, context)\n }))\n }\n }\n }\n\n /**\n * Execute a callback for each of the child nodes of this node\n * @param {function(child: Node, path: string, parent: Node)} callback\n */\n forEach (callback) {\n for (let i = 0; i < this.args.length; i++) {\n callback(this.args[i], 'args[' + i + ']', this)\n }\n }\n\n /**\n * Create a new OperatorNode whose children are the results of calling\n * the provided callback function for each child of the original node.\n * @param {function(child: Node, path: string, parent: Node): Node} callback\n * @returns {OperatorNode} Returns a transformed copy of the node\n */\n map (callback) {\n const args = []\n for (let i = 0; i < this.args.length; i++) {\n args[i] = this._ifNode(callback(this.args[i], 'args[' + i + ']', this))\n }\n return new OperatorNode(\n this.op, this.fn, args, this.implicit, this.isPercentage)\n }\n\n /**\n * Create a clone of this node, a shallow copy\n * @return {OperatorNode}\n */\n clone () {\n return new OperatorNode(\n this.op, this.fn, this.args.slice(0), this.implicit, this.isPercentage)\n }\n\n /**\n * Check whether this is an unary OperatorNode:\n * has exactly one argument, like `-a`.\n * @return {boolean}\n * Returns true when an unary operator node, false otherwise.\n */\n isUnary () {\n return this.args.length === 1\n }\n\n /**\n * Check whether this is a binary OperatorNode:\n * has exactly two arguments, like `a + b`.\n * @return {boolean}\n * Returns true when a binary operator node, false otherwise.\n */\n isBinary () {\n return this.args.length === 2\n }\n\n /**\n * Get string representation.\n * @param {Object} options\n * @return {string} str\n */\n _toString (options) {\n const parenthesis =\n (options && options.parenthesis) ? options.parenthesis : 'keep'\n const implicit = (options && options.implicit) ? options.implicit : 'hide'\n const args = this.args\n const parens =\n calculateNecessaryParentheses(this, parenthesis, implicit, args, false)\n\n if (args.length === 1) { // unary operators\n const assoc = getAssociativity(this, parenthesis)\n\n let operand = args[0].toString(options)\n if (parens[0]) {\n operand = '(' + operand + ')'\n }\n\n // for example for \"not\", we want a space between operand and argument\n const opIsNamed = /[a-zA-Z]+/.test(this.op)\n\n if (assoc === 'right') { // prefix operator\n return this.op + (opIsNamed ? ' ' : '') + operand\n } else if (assoc === 'left') { // postfix\n return operand + (opIsNamed ? ' ' : '') + this.op\n }\n\n // fall back to postfix\n return operand + this.op\n } else if (args.length === 2) {\n let lhs = args[0].toString(options) // left hand side\n let rhs = args[1].toString(options) // right hand side\n if (parens[0]) { // left hand side in parenthesis?\n lhs = '(' + lhs + ')'\n }\n if (parens[1]) { // right hand side in parenthesis?\n rhs = '(' + rhs + ')'\n }\n\n if (this.implicit &&\n (this.getIdentifier() === 'OperatorNode:multiply') &&\n (implicit === 'hide')) {\n return lhs + ' ' + rhs\n }\n\n return lhs + ' ' + this.op + ' ' + rhs\n } else if ((args.length > 2) &&\n ((this.getIdentifier() === 'OperatorNode:add') ||\n (this.getIdentifier() === 'OperatorNode:multiply'))) {\n const stringifiedArgs = args.map(function (arg, index) {\n arg = arg.toString(options)\n if (parens[index]) { // put in parenthesis?\n arg = '(' + arg + ')'\n }\n\n return arg\n })\n\n if (this.implicit &&\n (this.getIdentifier() === 'OperatorNode:multiply') &&\n (implicit === 'hide')) {\n return stringifiedArgs.join(' ')\n }\n\n return stringifiedArgs.join(' ' + this.op + ' ')\n } else {\n // fallback to formatting as a function call\n return this.fn + '(' + this.args.join(', ') + ')'\n }\n }\n\n /**\n * Get a JSON representation of the node\n * @returns {Object}\n */\n toJSON () {\n return {\n mathjs: name,\n op: this.op,\n fn: this.fn,\n args: this.args,\n implicit: this.implicit,\n isPercentage: this.isPercentage\n }\n }\n\n /**\n * Instantiate an OperatorNode from its JSON representation\n * @param {Object} json\n * An object structured like\n * ```\n * {\"mathjs\": \"OperatorNode\",\n * \"op\": \"+\", \"fn\": \"add\", \"args\": [...],\n * \"implicit\": false,\n * \"isPercentage\":false}\n * ```\n * where mathjs is optional\n * @returns {OperatorNode}\n */\n static fromJSON (json) {\n return new OperatorNode(\n json.op, json.fn, json.args, json.implicit, json.isPercentage)\n }\n\n /**\n * Get HTML representation.\n * @param {Object} options\n * @return {string} str\n */\n _toHTML (options) {\n const parenthesis =\n (options && options.parenthesis) ? options.parenthesis : 'keep'\n const implicit = (options && options.implicit) ? options.implicit : 'hide'\n const args = this.args\n const parens =\n calculateNecessaryParentheses(this, parenthesis, implicit, args, false)\n\n if (args.length === 1) { // unary operators\n const assoc = getAssociativity(this, parenthesis)\n\n let operand = args[0].toHTML(options)\n if (parens[0]) {\n operand =\n '(' +\n operand +\n ')'\n }\n\n if (assoc === 'right') { // prefix operator\n return '' + escape(this.op) + '' +\n operand\n } else { // postfix when assoc === 'left' or undefined\n return operand +\n '' + escape(this.op) + ''\n }\n } else if (args.length === 2) { // binary operatoes\n let lhs = args[0].toHTML(options) // left hand side\n let rhs = args[1].toHTML(options) // right hand side\n if (parens[0]) { // left hand side in parenthesis?\n lhs = '(' +\n lhs +\n ')'\n }\n if (parens[1]) { // right hand side in parenthesis?\n rhs = '(' +\n rhs +\n ')'\n }\n\n if (this.implicit &&\n (this.getIdentifier() === 'OperatorNode:multiply') &&\n (implicit === 'hide')) {\n return lhs +\n '' + rhs\n }\n\n return lhs +\n '' + escape(this.op) + '' +\n rhs\n } else {\n const stringifiedArgs = args.map(function (arg, index) {\n arg = arg.toHTML(options)\n if (parens[index]) { // put in parenthesis?\n arg =\n '(' +\n arg +\n ')'\n }\n\n return arg\n })\n\n if ((args.length > 2) &&\n ((this.getIdentifier() === 'OperatorNode:add') ||\n (this.getIdentifier() === 'OperatorNode:multiply'))) {\n if (this.implicit &&\n (this.getIdentifier() === 'OperatorNode:multiply') &&\n (implicit === 'hide')) {\n return stringifiedArgs.join(\n '')\n }\n\n return stringifiedArgs.join(\n '' + escape(this.op) + '')\n } else {\n // fallback to formatting as a function call\n return '' + escape(this.fn) +\n '' +\n '(' +\n stringifiedArgs.join(',') +\n ')'\n }\n }\n }\n\n /**\n * Get LaTeX representation\n * @param {Object} options\n * @return {string} str\n */\n _toTex (options) {\n const parenthesis =\n (options && options.parenthesis) ? options.parenthesis : 'keep'\n const implicit = (options && options.implicit) ? options.implicit : 'hide'\n const args = this.args\n const parens =\n calculateNecessaryParentheses(this, parenthesis, implicit, args, true)\n\n let op = latexOperators[this.fn]\n op = typeof op === 'undefined' ? this.op : op // fall back to using this.op\n\n if (args.length === 1) { // unary operators\n const assoc = getAssociativity(this, parenthesis)\n\n let operand = args[0].toTex(options)\n if (parens[0]) {\n operand = `\\\\left(${operand}\\\\right)`\n }\n\n if (assoc === 'right') { // prefix operator\n return op + operand\n } else if (assoc === 'left') { // postfix operator\n return operand + op\n }\n\n // fall back to postfix\n return operand + op\n } else if (args.length === 2) { // binary operators\n const lhs = args[0] // left hand side\n let lhsTex = lhs.toTex(options)\n if (parens[0]) {\n lhsTex = `\\\\left(${lhsTex}\\\\right)`\n }\n\n const rhs = args[1] // right hand side\n let rhsTex = rhs.toTex(options)\n if (parens[1]) {\n rhsTex = `\\\\left(${rhsTex}\\\\right)`\n }\n\n // handle some exceptions (due to the way LaTeX works)\n let lhsIdentifier\n if (parenthesis === 'keep') {\n lhsIdentifier = lhs.getIdentifier()\n } else {\n // Ignore ParenthesisNodes if in 'keep' mode\n lhsIdentifier = lhs.getContent().getIdentifier()\n }\n switch (this.getIdentifier()) {\n case 'OperatorNode:divide':\n // op contains '\\\\frac' at this point\n return op + '{' + lhsTex + '}' + '{' + rhsTex + '}'\n case 'OperatorNode:pow':\n lhsTex = '{' + lhsTex + '}'\n rhsTex = '{' + rhsTex + '}'\n switch (lhsIdentifier) {\n case 'ConditionalNode': //\n case 'OperatorNode:divide':\n lhsTex = `\\\\left(${lhsTex}\\\\right)`\n }\n break\n case 'OperatorNode:multiply':\n if (this.implicit && (implicit === 'hide')) {\n return lhsTex + '~' + rhsTex\n }\n }\n return lhsTex + op + rhsTex\n } else if ((args.length > 2) &&\n ((this.getIdentifier() === 'OperatorNode:add') ||\n (this.getIdentifier() === 'OperatorNode:multiply'))) {\n const texifiedArgs = args.map(function (arg, index) {\n arg = arg.toTex(options)\n if (parens[index]) {\n arg = `\\\\left(${arg}\\\\right)`\n }\n return arg\n })\n\n if ((this.getIdentifier() === 'OperatorNode:multiply') &&\n this.implicit && implicit === 'hide') {\n return texifiedArgs.join('~')\n }\n\n return texifiedArgs.join(op)\n } else {\n // fall back to formatting as a function call\n // as this is a fallback, it doesn't use\n // fancy function names\n return '\\\\mathrm{' + this.fn + '}\\\\left(' +\n args.map(function (arg) {\n return arg.toTex(options)\n }).join(',') + '\\\\right)'\n }\n }\n\n /**\n * Get identifier.\n * @return {string}\n */\n getIdentifier () {\n return this.type + ':' + this.fn\n }\n }\n\n return OperatorNode\n}, { isClass: true, isNode: true })\n","import { isNode } from '../../utils/is.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'ParenthesisNode'\nconst dependencies = [\n 'Node'\n]\n\nexport const createParenthesisNode = /* #__PURE__ */ factory(name, dependencies, ({ Node }) => {\n class ParenthesisNode extends Node {\n /**\n * @constructor ParenthesisNode\n * @extends {Node}\n * A parenthesis node describes manual parenthesis from the user input\n * @param {Node} content\n * @extends {Node}\n */\n constructor (content) {\n super()\n // validate input\n if (!isNode(content)) {\n throw new TypeError('Node expected for parameter \"content\"')\n }\n\n this.content = content\n }\n\n static name = name\n get type () { return name }\n get isParenthesisNode () { return true }\n\n /**\n * Compile a node into a JavaScript function.\n * This basically pre-calculates as much as possible and only leaves open\n * calculations which depend on a dynamic scope with variables.\n * @param {Object} math Math.js namespace with functions and constants.\n * @param {Object} argNames An object with argument names as key and `true`\n * as value. Used in the SymbolNode to optimize\n * for arguments from user assigned functions\n * (see FunctionAssignmentNode) or special symbols\n * like `end` (see IndexNode).\n * @return {function} Returns a function which can be called like:\n * evalNode(scope: Object, args: Object, context: *)\n */\n _compile (math, argNames) {\n return this.content._compile(math, argNames)\n }\n\n /**\n * Get the content of the current Node.\n * @return {Node} content\n * @override\n **/\n getContent () {\n return this.content.getContent()\n }\n\n /**\n * Execute a callback for each of the child nodes of this node\n * @param {function(child: Node, path: string, parent: Node)} callback\n */\n forEach (callback) {\n callback(this.content, 'content', this)\n }\n\n /**\n * Create a new ParenthesisNode whose child is the result of calling\n * the provided callback function on the child of this node.\n * @param {function(child: Node, path: string, parent: Node) : Node} callback\n * @returns {ParenthesisNode} Returns a clone of the node\n */\n map (callback) {\n const content = callback(this.content, 'content', this)\n return new ParenthesisNode(content)\n }\n\n /**\n * Create a clone of this node, a shallow copy\n * @return {ParenthesisNode}\n */\n clone () {\n return new ParenthesisNode(this.content)\n }\n\n /**\n * Get string representation\n * @param {Object} options\n * @return {string} str\n * @override\n */\n _toString (options) {\n if ((!options) ||\n (options && !options.parenthesis) ||\n (options && options.parenthesis === 'keep')) {\n return '(' + this.content.toString(options) + ')'\n }\n return this.content.toString(options)\n }\n\n /**\n * Get a JSON representation of the node\n * @returns {Object}\n */\n toJSON () {\n return { mathjs: name, content: this.content }\n }\n\n /**\n * Instantiate an ParenthesisNode from its JSON representation\n * @param {Object} json An object structured like\n * `{\"mathjs\": \"ParenthesisNode\", \"content\": ...}`,\n * where mathjs is optional\n * @returns {ParenthesisNode}\n */\n static fromJSON (json) {\n return new ParenthesisNode(json.content)\n }\n\n /**\n * Get HTML representation\n * @param {Object} options\n * @return {string} str\n * @override\n */\n _toHTML (options) {\n if ((!options) ||\n (options && !options.parenthesis) ||\n (options && options.parenthesis === 'keep')) {\n return '(' +\n this.content.toHTML(options) +\n ')'\n }\n return this.content.toHTML(options)\n }\n\n /**\n * Get LaTeX representation\n * @param {Object} options\n * @return {string} str\n * @override\n */\n _toTex (options) {\n if ((!options) ||\n (options && !options.parenthesis) ||\n (options && options.parenthesis === 'keep')) {\n return `\\\\left(${this.content.toTex(options)}\\\\right)`\n }\n return this.content.toTex(options)\n }\n }\n\n return ParenthesisNode\n}, { isClass: true, isNode: true })\n","import { isNode, isSymbolNode } from '../../utils/is.js'\nimport { factory } from '../../utils/factory.js'\nimport { getPrecedence } from '../operators.js'\n\nconst name = 'RangeNode'\nconst dependencies = [\n 'Node'\n]\n\nexport const createRangeNode = /* #__PURE__ */ factory(name, dependencies, ({ Node }) => {\n /**\n * Calculate the necessary parentheses\n * @param {Node} node\n * @param {string} parenthesis\n * @param {string} implicit\n * @return {Object} parentheses\n * @private\n */\n function calculateNecessaryParentheses (node, parenthesis, implicit) {\n const precedence = getPrecedence(node, parenthesis, implicit)\n const parens = {}\n\n const startPrecedence = getPrecedence(node.start, parenthesis, implicit)\n parens.start = ((startPrecedence !== null) && (startPrecedence <= precedence)) ||\n (parenthesis === 'all')\n\n if (node.step) {\n const stepPrecedence = getPrecedence(node.step, parenthesis, implicit)\n parens.step = ((stepPrecedence !== null) && (stepPrecedence <= precedence)) ||\n (parenthesis === 'all')\n }\n\n const endPrecedence = getPrecedence(node.end, parenthesis, implicit)\n parens.end = ((endPrecedence !== null) && (endPrecedence <= precedence)) ||\n (parenthesis === 'all')\n\n return parens\n }\n\n class RangeNode extends Node {\n /**\n * @constructor RangeNode\n * @extends {Node}\n * create a range\n * @param {Node} start included lower-bound\n * @param {Node} end included upper-bound\n * @param {Node} [step] optional step\n */\n constructor (start, end, step) {\n super()\n // validate inputs\n if (!isNode(start)) throw new TypeError('Node expected')\n if (!isNode(end)) throw new TypeError('Node expected')\n if (step && !isNode(step)) throw new TypeError('Node expected')\n if (arguments.length > 3) throw new Error('Too many arguments')\n\n this.start = start // included lower-bound\n this.end = end // included upper-bound\n this.step = step || null // optional step\n }\n\n static name = name\n get type () { return name }\n get isRangeNode () { return true }\n\n /**\n * Check whether the RangeNode needs the `end` symbol to be defined.\n * This end is the size of the Matrix in current dimension.\n * @return {boolean}\n */\n needsEnd () {\n // find all `end` symbols in this RangeNode\n const endSymbols = this.filter(function (node) {\n return isSymbolNode(node) && (node.name === 'end')\n })\n\n return endSymbols.length > 0\n }\n\n /**\n * Compile a node into a JavaScript function.\n * This basically pre-calculates as much as possible and only leaves open\n * calculations which depend on a dynamic scope with variables.\n * @param {Object} math Math.js namespace with functions and constants.\n * @param {Object} argNames An object with argument names as key and `true`\n * as value. Used in the SymbolNode to optimize\n * for arguments from user assigned functions\n * (see FunctionAssignmentNode) or special symbols\n * like `end` (see IndexNode).\n * @return {function} Returns a function which can be called like:\n * evalNode(scope: Object, args: Object, context: *)\n */\n _compile (math, argNames) {\n const range = math.range\n const evalStart = this.start._compile(math, argNames)\n const evalEnd = this.end._compile(math, argNames)\n\n if (this.step) {\n const evalStep = this.step._compile(math, argNames)\n\n return function evalRangeNode (scope, args, context) {\n return range(\n evalStart(scope, args, context),\n evalEnd(scope, args, context),\n evalStep(scope, args, context)\n )\n }\n } else {\n return function evalRangeNode (scope, args, context) {\n return range(\n evalStart(scope, args, context),\n evalEnd(scope, args, context)\n )\n }\n }\n }\n\n /**\n * Execute a callback for each of the child nodes of this node\n * @param {function(child: Node, path: string, parent: Node)} callback\n */\n forEach (callback) {\n callback(this.start, 'start', this)\n callback(this.end, 'end', this)\n if (this.step) {\n callback(this.step, 'step', this)\n }\n }\n\n /**\n * Create a new RangeNode whose children are the results of calling\n * the provided callback function for each child of the original node.\n * @param {function(child: Node, path: string, parent: Node): Node} callback\n * @returns {RangeNode} Returns a transformed copy of the node\n */\n map (callback) {\n return new RangeNode(\n this._ifNode(callback(this.start, 'start', this)),\n this._ifNode(callback(this.end, 'end', this)),\n this.step && this._ifNode(callback(this.step, 'step', this))\n )\n }\n\n /**\n * Create a clone of this node, a shallow copy\n * @return {RangeNode}\n */\n clone () {\n return new RangeNode(this.start, this.end, this.step && this.step)\n }\n\n /**\n * Get string representation\n * @param {Object} options\n * @return {string} str\n */\n _toString (options) {\n const parenthesis =\n (options && options.parenthesis) ? options.parenthesis : 'keep'\n const parens =\n calculateNecessaryParentheses(\n this, parenthesis, options && options.implicit)\n\n // format string as start:step:stop\n let str\n\n let start = this.start.toString(options)\n if (parens.start) {\n start = '(' + start + ')'\n }\n str = start\n\n if (this.step) {\n let step = this.step.toString(options)\n if (parens.step) {\n step = '(' + step + ')'\n }\n str += ':' + step\n }\n\n let end = this.end.toString(options)\n if (parens.end) {\n end = '(' + end + ')'\n }\n str += ':' + end\n\n return str\n }\n\n /**\n * Get a JSON representation of the node\n * @returns {Object}\n */\n toJSON () {\n return {\n mathjs: name,\n start: this.start,\n end: this.end,\n step: this.step\n }\n }\n\n /**\n * Instantiate an RangeNode from its JSON representation\n * @param {Object} json\n * An object structured like\n * `{\"mathjs\": \"RangeNode\", \"start\": ..., \"end\": ..., \"step\": ...}`,\n * where mathjs is optional\n * @returns {RangeNode}\n */\n static fromJSON (json) {\n return new RangeNode(json.start, json.end, json.step)\n }\n\n /**\n * Get HTML representation\n * @param {Object} options\n * @return {string} str\n */\n _toHTML (options) {\n const parenthesis =\n (options && options.parenthesis) ? options.parenthesis : 'keep'\n const parens =\n calculateNecessaryParentheses(\n this, parenthesis, options && options.implicit)\n\n // format string as start:step:stop\n let str\n\n let start = this.start.toHTML(options)\n if (parens.start) {\n start = '(' +\n start +\n ')'\n }\n str = start\n\n if (this.step) {\n let step = this.step.toHTML(options)\n if (parens.step) {\n step = '(' +\n step +\n ')'\n }\n str += ':' + step\n }\n\n let end = this.end.toHTML(options)\n if (parens.end) {\n end = '(' +\n end +\n ')'\n }\n str += ':' + end\n\n return str\n }\n\n /**\n * Get LaTeX representation\n * @params {Object} options\n * @return {string} str\n */\n _toTex (options) {\n const parenthesis =\n (options && options.parenthesis) ? options.parenthesis : 'keep'\n const parens =\n calculateNecessaryParentheses(\n this, parenthesis, options && options.implicit)\n\n let str = this.start.toTex(options)\n if (parens.start) {\n str = `\\\\left(${str}\\\\right)`\n }\n\n if (this.step) {\n let step = this.step.toTex(options)\n if (parens.step) {\n step = `\\\\left(${step}\\\\right)`\n }\n str += ':' + step\n }\n\n let end = this.end.toTex(options)\n if (parens.end) {\n end = `\\\\left(${end}\\\\right)`\n }\n str += ':' + end\n\n return str\n }\n }\n\n return RangeNode\n}, { isClass: true, isNode: true })\n","import { getPrecedence } from '../operators.js'\nimport { escape } from '../../utils/string.js'\nimport { getSafeProperty } from '../../utils/customs.js'\nimport { latexOperators } from '../../utils/latex.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'RelationalNode'\nconst dependencies = [\n 'Node'\n]\n\nexport const createRelationalNode = /* #__PURE__ */ factory(name, dependencies, ({ Node }) => {\n const operatorMap = {\n equal: '==',\n unequal: '!=',\n smaller: '<',\n larger: '>',\n smallerEq: '<=',\n largerEq: '>='\n }\n\n class RelationalNode extends Node {\n /**\n * A node representing a chained conditional expression, such as 'x > y > z'\n *\n * @param {String[]} conditionals\n * An array of conditional operators used to compare the parameters\n * @param {Node[]} params\n * The parameters that will be compared\n *\n * @constructor RelationalNode\n * @extends {Node}\n */\n constructor (conditionals, params) {\n super()\n if (!Array.isArray(conditionals)) { throw new TypeError('Parameter conditionals must be an array') }\n if (!Array.isArray(params)) { throw new TypeError('Parameter params must be an array') }\n if (conditionals.length !== params.length - 1) {\n throw new TypeError(\n 'Parameter params must contain exactly one more element ' +\n 'than parameter conditionals')\n }\n\n this.conditionals = conditionals\n this.params = params\n }\n\n static name = name\n get type () { return name }\n get isRelationalNode () { return true }\n\n /**\n * Compile a node into a JavaScript function.\n * This basically pre-calculates as much as possible and only leaves open\n * calculations which depend on a dynamic scope with variables.\n * @param {Object} math Math.js namespace with functions and constants.\n * @param {Object} argNames An object with argument names as key and `true`\n * as value. Used in the SymbolNode to optimize\n * for arguments from user assigned functions\n * (see FunctionAssignmentNode) or special symbols\n * like `end` (see IndexNode).\n * @return {function} Returns a function which can be called like:\n * evalNode(scope: Object, args: Object, context: *)\n */\n _compile (math, argNames) {\n const self = this\n\n const compiled = this.params.map(p => p._compile(math, argNames))\n\n return function evalRelationalNode (scope, args, context) {\n let evalLhs\n let evalRhs = compiled[0](scope, args, context)\n\n for (let i = 0; i < self.conditionals.length; i++) {\n evalLhs = evalRhs\n evalRhs = compiled[i + 1](scope, args, context)\n const condFn = getSafeProperty(math, self.conditionals[i])\n if (!condFn(evalLhs, evalRhs)) {\n return false\n }\n }\n return true\n }\n }\n\n /**\n * Execute a callback for each of the child nodes of this node\n * @param {function(child: Node, path: string, parent: Node)} callback\n */\n forEach (callback) {\n this.params.forEach((n, i) => callback(n, 'params[' + i + ']', this), this)\n }\n\n /**\n * Create a new RelationalNode whose children are the results of calling\n * the provided callback function for each child of the original node.\n * @param {function(child: Node, path: string, parent: Node): Node} callback\n * @returns {RelationalNode} Returns a transformed copy of the node\n */\n map (callback) {\n return new RelationalNode(\n this.conditionals.slice(),\n this.params.map(\n (n, i) => this._ifNode(callback(n, 'params[' + i + ']', this)), this))\n }\n\n /**\n * Create a clone of this node, a shallow copy\n * @return {RelationalNode}\n */\n clone () {\n return new RelationalNode(this.conditionals, this.params)\n }\n\n /**\n * Get string representation.\n * @param {Object} options\n * @return {string} str\n */\n _toString (options) {\n const parenthesis =\n (options && options.parenthesis) ? options.parenthesis : 'keep'\n const precedence =\n getPrecedence(this, parenthesis, options && options.implicit)\n\n const paramStrings = this.params.map(function (p, index) {\n const paramPrecedence =\n getPrecedence(p, parenthesis, options && options.implicit)\n return (parenthesis === 'all' ||\n (paramPrecedence !== null && paramPrecedence <= precedence))\n ? '(' + p.toString(options) + ')'\n : p.toString(options)\n })\n\n let ret = paramStrings[0]\n for (let i = 0; i < this.conditionals.length; i++) {\n ret += ' ' + operatorMap[this.conditionals[i]]\n ret += ' ' + paramStrings[i + 1]\n }\n\n return ret\n }\n\n /**\n * Get a JSON representation of the node\n * @returns {Object}\n */\n toJSON () {\n return {\n mathjs: name,\n conditionals: this.conditionals,\n params: this.params\n }\n }\n\n /**\n * Instantiate a RelationalNode from its JSON representation\n * @param {Object} json\n * An object structured like\n * `{\"mathjs\": \"RelationalNode\", \"conditionals\": ..., \"params\": ...}`,\n * where mathjs is optional\n * @returns {RelationalNode}\n */\n static fromJSON (json) {\n return new RelationalNode(json.conditionals, json.params)\n }\n\n /**\n * Get HTML representation\n * @param {Object} options\n * @return {string} str\n */\n _toHTML (options) {\n const parenthesis =\n (options && options.parenthesis) ? options.parenthesis : 'keep'\n const precedence =\n getPrecedence(this, parenthesis, options && options.implicit)\n\n const paramStrings = this.params.map(function (p, index) {\n const paramPrecedence =\n getPrecedence(p, parenthesis, options && options.implicit)\n return (parenthesis === 'all' ||\n (paramPrecedence !== null && paramPrecedence <= precedence))\n ? ('(' +\n p.toHTML(options) +\n ')')\n : p.toHTML(options)\n })\n\n let ret = paramStrings[0]\n for (let i = 0; i < this.conditionals.length; i++) {\n ret += '' +\n escape(operatorMap[this.conditionals[i]]) + '' +\n paramStrings[i + 1]\n }\n\n return ret\n }\n\n /**\n * Get LaTeX representation\n * @param {Object} options\n * @return {string} str\n */\n _toTex (options) {\n const parenthesis =\n (options && options.parenthesis) ? options.parenthesis : 'keep'\n const precedence =\n getPrecedence(this, parenthesis, options && options.implicit)\n\n const paramStrings = this.params.map(function (p, index) {\n const paramPrecedence =\n getPrecedence(p, parenthesis, options && options.implicit)\n return (parenthesis === 'all' ||\n (paramPrecedence !== null && paramPrecedence <= precedence))\n ? '\\\\left(' + p.toTex(options) + '\\right)'\n : p.toTex(options)\n })\n\n let ret = paramStrings[0]\n for (let i = 0; i < this.conditionals.length; i++) {\n ret += latexOperators[this.conditionals[i]] + paramStrings[i + 1]\n }\n\n return ret\n }\n }\n\n return RelationalNode\n}, { isClass: true, isNode: true })\n","import { escape } from '../../utils/string.js'\nimport { getSafeProperty } from '../../utils/customs.js'\nimport { factory } from '../../utils/factory.js'\nimport { toSymbol } from '../../utils/latex.js'\n\nconst name = 'SymbolNode'\nconst dependencies = [\n 'math',\n '?Unit',\n 'Node'\n]\n\nexport const createSymbolNode = /* #__PURE__ */ factory(name, dependencies, ({ math, Unit, Node }) => {\n /**\n * Check whether some name is a valueless unit like \"inch\".\n * @param {string} name\n * @return {boolean}\n */\n function isValuelessUnit (name) {\n return Unit ? Unit.isValuelessUnit(name) : false\n }\n\n class SymbolNode extends Node {\n /**\n * @constructor SymbolNode\n * @extends {Node}\n * A symbol node can hold and resolve a symbol\n * @param {string} name\n * @extends {Node}\n */\n constructor (name) {\n super()\n // validate input\n if (typeof name !== 'string') {\n throw new TypeError('String expected for parameter \"name\"')\n }\n\n this.name = name\n }\n\n get type () { return 'SymbolNode' }\n get isSymbolNode () { return true }\n\n /**\n * Compile a node into a JavaScript function.\n * This basically pre-calculates as much as possible and only leaves open\n * calculations which depend on a dynamic scope with variables.\n * @param {Object} math Math.js namespace with functions and constants.\n * @param {Object} argNames An object with argument names as key and `true`\n * as value. Used in the SymbolNode to optimize\n * for arguments from user assigned functions\n * (see FunctionAssignmentNode) or special symbols\n * like `end` (see IndexNode).\n * @return {function} Returns a function which can be called like:\n * evalNode(scope: Object, args: Object, context: *)\n */\n _compile (math, argNames) {\n const name = this.name\n\n if (argNames[name] === true) {\n // this is a FunctionAssignment argument\n // (like an x when inside the expression of a function\n // assignment `f(x) = ...`)\n return function (scope, args, context) {\n return getSafeProperty(args, name)\n }\n } else if (name in math) {\n return function (scope, args, context) {\n return scope.has(name)\n ? scope.get(name)\n : getSafeProperty(math, name)\n }\n } else {\n const isUnit = isValuelessUnit(name)\n\n return function (scope, args, context) {\n return scope.has(name)\n ? scope.get(name)\n : isUnit\n ? new Unit(null, name)\n : SymbolNode.onUndefinedSymbol(name)\n }\n }\n }\n\n /**\n * Execute a callback for each of the child nodes of this node\n * @param {function(child: Node, path: string, parent: Node)} callback\n */\n forEach (callback) {\n // nothing to do, we don't have any children\n }\n\n /**\n * Create a new SymbolNode with children produced by the given callback.\n * Trivial since a SymbolNode has no children\n * @param {function(child: Node, path: string, parent: Node) : Node} callback\n * @returns {SymbolNode} Returns a clone of the node\n */\n map (callback) {\n return this.clone()\n }\n\n /**\n * Throws an error 'Undefined symbol {name}'\n * @param {string} name\n */\n static onUndefinedSymbol (name) {\n throw new Error('Undefined symbol ' + name)\n }\n\n /**\n * Create a clone of this node, a shallow copy\n * @return {SymbolNode}\n */\n clone () {\n return new SymbolNode(this.name)\n }\n\n /**\n * Get string representation\n * @param {Object} options\n * @return {string} str\n * @override\n */\n _toString (options) {\n return this.name\n }\n\n /**\n * Get HTML representation\n * @param {Object} options\n * @return {string} str\n * @override\n */\n _toHTML (options) {\n const name = escape(this.name)\n\n if (name === 'true' || name === 'false') {\n return '' + name + ''\n } else if (name === 'i') {\n return '' +\n name + ''\n } else if (name === 'Infinity') {\n return '' +\n name + ''\n } else if (name === 'NaN') {\n return '' + name + ''\n } else if (name === 'null') {\n return '' + name + ''\n } else if (name === 'undefined') {\n return '' +\n name + ''\n }\n\n return '' + name + ''\n }\n\n /**\n * Get a JSON representation of the node\n * @returns {Object}\n */\n toJSON () {\n return {\n mathjs: 'SymbolNode',\n name: this.name\n }\n }\n\n /**\n * Instantiate a SymbolNode from its JSON representation\n * @param {Object} json An object structured like\n * `{\"mathjs\": \"SymbolNode\", name: \"x\"}`,\n * where mathjs is optional\n * @returns {SymbolNode}\n */\n static fromJSON (json) {\n return new SymbolNode(json.name)\n }\n\n /**\n * Get LaTeX representation\n * @param {Object} options\n * @return {string} str\n * @override\n */\n _toTex (options) {\n let isUnit = false\n if ((typeof math[this.name] === 'undefined') &&\n isValuelessUnit(this.name)) {\n isUnit = true\n }\n const symbol = toSymbol(this.name, isUnit)\n if (symbol[0] === '\\\\') {\n // no space needed if the symbol starts with '\\'\n return symbol\n }\n // the space prevents symbols from breaking stuff like '\\cdot'\n // if it's written right before the symbol\n return ' ' + symbol\n }\n }\n\n return SymbolNode\n}, { isClass: true, isNode: true })\n","import { isAccessorNode, isFunctionAssignmentNode, isIndexNode, isNode, isSymbolNode } from '../../utils/is.js'\nimport { escape, format } from '../../utils/string.js'\nimport { hasOwnProperty } from '../../utils/object.js'\nimport { getSafeProperty, getSafeMethod } from '../../utils/customs.js'\nimport { createSubScope } from '../../utils/scope.js'\nimport { factory } from '../../utils/factory.js'\nimport { defaultTemplate, latexFunctions } from '../../utils/latex.js'\n\nconst name = 'FunctionNode'\nconst dependencies = [\n 'math',\n 'Node',\n 'SymbolNode'\n]\n\nexport const createFunctionNode = /* #__PURE__ */ factory(name, dependencies, ({ math, Node, SymbolNode }) => {\n /* format to fixed length */\n const strin = entity => format(entity, { truncate: 78 })\n\n /*\n * Expand a LaTeX template\n *\n * @param {string} template\n * @param {Node} node\n * @param {Object} options\n * @private\n **/\n function expandTemplate (template, node, options) {\n let latex = ''\n\n // Match everything of the form ${identifier} or ${identifier[2]} or $$\n // while submatching identifier and 2 (in the second case)\n const regex = /\\$(?:\\{([a-z_][a-z_0-9]*)(?:\\[([0-9]+)\\])?\\}|\\$)/gi\n\n let inputPos = 0 // position in the input string\n let match\n while ((match = regex.exec(template)) !== null) { // go through all matches\n // add everything in front of the match to the LaTeX string\n latex += template.substring(inputPos, match.index)\n inputPos = match.index\n\n if (match[0] === '$$') { // escaped dollar sign\n latex += '$'\n inputPos++\n } else { // template parameter\n inputPos += match[0].length\n const property = node[match[1]]\n if (!property) {\n throw new ReferenceError('Template: Property ' + match[1] + ' does not exist.')\n }\n if (match[2] === undefined) { // no square brackets\n switch (typeof property) {\n case 'string':\n latex += property\n break\n case 'object':\n if (isNode(property)) {\n latex += property.toTex(options)\n } else if (Array.isArray(property)) {\n // make array of Nodes into comma separated list\n latex += property.map(function (arg, index) {\n if (isNode(arg)) {\n return arg.toTex(options)\n }\n throw new TypeError('Template: ' + match[1] + '[' + index + '] is not a Node.')\n }).join(',')\n } else {\n throw new TypeError('Template: ' + match[1] + ' has to be a Node, String or array of Nodes')\n }\n break\n default:\n throw new TypeError('Template: ' + match[1] + ' has to be a Node, String or array of Nodes')\n }\n } else { // with square brackets\n if (isNode(property[match[2]] && property[match[2]])) {\n latex += property[match[2]].toTex(options)\n } else {\n throw new TypeError('Template: ' + match[1] + '[' + match[2] + '] is not a Node.')\n }\n }\n }\n }\n latex += template.slice(inputPos) // append rest of the template\n\n return latex\n }\n\n class FunctionNode extends Node {\n /**\n * @constructor FunctionNode\n * @extends {./Node}\n * invoke a list with arguments on a node\n * @param {./Node | string} fn\n * Item resolving to a function on which to invoke\n * the arguments, typically a SymbolNode or AccessorNode\n * @param {./Node[]} args\n */\n constructor (fn, args) {\n super()\n if (typeof fn === 'string') {\n fn = new SymbolNode(fn)\n }\n\n // validate input\n if (!isNode(fn)) throw new TypeError('Node expected as parameter \"fn\"')\n if (!Array.isArray(args) || !args.every(isNode)) {\n throw new TypeError(\n 'Array containing Nodes expected for parameter \"args\"')\n }\n\n this.fn = fn\n this.args = args || []\n }\n\n // readonly property name\n get name () {\n return this.fn.name || ''\n }\n\n static name = name\n get type () { return name }\n get isFunctionNode () { return true }\n\n /**\n * Compile a node into a JavaScript function.\n * This basically pre-calculates as much as possible and only leaves open\n * calculations which depend on a dynamic scope with variables.\n * @param {Object} math Math.js namespace with functions and constants.\n * @param {Object} argNames An object with argument names as key and `true`\n * as value. Used in the SymbolNode to optimize\n * for arguments from user assigned functions\n * (see FunctionAssignmentNode) or special symbols\n * like `end` (see IndexNode).\n * @return {function} Returns a function which can be called like:\n * evalNode(scope: Object, args: Object, context: *)\n */\n _compile (math, argNames) {\n // compile arguments\n const evalArgs = this.args.map((arg) => arg._compile(math, argNames))\n\n if (isSymbolNode(this.fn)) {\n const name = this.fn.name\n if (!argNames[name]) {\n // we can statically determine whether the function\n // has the rawArgs property\n const fn = name in math ? getSafeProperty(math, name) : undefined\n const isRaw = typeof fn === 'function' && fn.rawArgs === true\n\n const resolveFn = (scope) => {\n let value\n if (scope.has(name)) {\n value = scope.get(name)\n } else if (name in math) {\n value = getSafeProperty(math, name)\n } else {\n return FunctionNode.onUndefinedFunction(name)\n }\n if (typeof value === 'function') {\n return value\n }\n throw new TypeError(\n `'${name}' is not a function; its value is:\\n ${strin(value)}`\n )\n }\n\n if (isRaw) {\n // pass unevaluated parameters (nodes) to the function\n // \"raw\" evaluation\n const rawArgs = this.args\n return function evalFunctionNode (scope, args, context) {\n const fn = resolveFn(scope)\n\n // the original function can be overwritten in the scope with a non-rawArgs function\n if (fn.rawArgs === true) {\n return fn(rawArgs, math, createSubScope(scope, args))\n } else {\n // \"regular\" evaluation\n const values = evalArgs.map((evalArg) => evalArg(scope, args, context))\n return fn(...values)\n }\n }\n } else {\n // \"regular\" evaluation\n switch (evalArgs.length) {\n case 0: return function evalFunctionNode (scope, args, context) {\n const fn = resolveFn(scope)\n return fn()\n }\n case 1: return function evalFunctionNode (scope, args, context) {\n const fn = resolveFn(scope)\n const evalArg0 = evalArgs[0]\n return fn(\n evalArg0(scope, args, context)\n )\n }\n case 2: return function evalFunctionNode (scope, args, context) {\n const fn = resolveFn(scope)\n const evalArg0 = evalArgs[0]\n const evalArg1 = evalArgs[1]\n return fn(\n evalArg0(scope, args, context),\n evalArg1(scope, args, context)\n )\n }\n default: return function evalFunctionNode (scope, args, context) {\n const fn = resolveFn(scope)\n const values = evalArgs.map((evalArg) => evalArg(scope, args, context))\n return fn(...values)\n }\n }\n }\n } else { // the function symbol is an argName\n const rawArgs = this.args\n return function evalFunctionNode (scope, args, context) {\n const fn = getSafeProperty(args, name)\n if (typeof fn !== 'function') {\n throw new TypeError(\n `Argument '${name}' was not a function; received: ${strin(fn)}`\n )\n }\n if (fn.rawArgs) {\n // \"Raw\" evaluation\n return fn(rawArgs, math, createSubScope(scope, args))\n } else {\n const values = evalArgs.map(\n (evalArg) => evalArg(scope, args, context))\n return fn.apply(fn, values)\n }\n }\n }\n } else if (\n isAccessorNode(this.fn) &&\n isIndexNode(this.fn.index) &&\n this.fn.index.isObjectProperty()\n ) {\n // execute the function with the right context:\n // the object of the AccessorNode\n\n const evalObject = this.fn.object._compile(math, argNames)\n const prop = this.fn.index.getObjectProperty()\n const rawArgs = this.args\n\n return function evalFunctionNode (scope, args, context) {\n const object = evalObject(scope, args, context)\n const fn = getSafeMethod(object, prop)\n\n if (fn?.rawArgs) {\n // \"Raw\" evaluation\n return fn(rawArgs, math, createSubScope(scope, args))\n } else {\n // \"regular\" evaluation\n const values = evalArgs.map((evalArg) => evalArg(scope, args, context))\n return fn.apply(object, values)\n }\n }\n } else {\n // node.fn.isAccessorNode && !node.fn.index.isObjectProperty()\n // we have to dynamically determine whether the function has the\n // rawArgs property\n const fnExpr = this.fn.toString()\n const evalFn = this.fn._compile(math, argNames)\n const rawArgs = this.args\n\n return function evalFunctionNode (scope, args, context) {\n const fn = evalFn(scope, args, context)\n if (typeof fn !== 'function') {\n throw new TypeError(\n `Expression '${fnExpr}' did not evaluate to a function; value is:` +\n `\\n ${strin(fn)}`\n )\n }\n if (fn.rawArgs) {\n // \"Raw\" evaluation\n return fn(rawArgs, math, createSubScope(scope, args))\n } else {\n // \"regular\" evaluation\n const values = evalArgs.map(\n (evalArg) => evalArg(scope, args, context))\n return fn.apply(fn, values)\n }\n }\n }\n }\n\n /**\n * Execute a callback for each of the child nodes of this node\n * @param {function(child: Node, path: string, parent: Node)} callback\n */\n forEach (callback) {\n callback(this.fn, 'fn', this)\n\n for (let i = 0; i < this.args.length; i++) {\n callback(this.args[i], 'args[' + i + ']', this)\n }\n }\n\n /**\n * Create a new FunctionNode whose children are the results of calling\n * the provided callback function for each child of the original node.\n * @param {function(child: Node, path: string, parent: Node): Node} callback\n * @returns {FunctionNode} Returns a transformed copy of the node\n */\n map (callback) {\n const fn = this._ifNode(callback(this.fn, 'fn', this))\n const args = []\n for (let i = 0; i < this.args.length; i++) {\n args[i] = this._ifNode(callback(this.args[i], 'args[' + i + ']', this))\n }\n return new FunctionNode(fn, args)\n }\n\n /**\n * Create a clone of this node, a shallow copy\n * @return {FunctionNode}\n */\n clone () {\n return new FunctionNode(this.fn, this.args.slice(0))\n }\n\n /**\n * Throws an error 'Undefined function {name}'\n * @param {string} name\n */\n static onUndefinedFunction = function (name) {\n throw new Error('Undefined function ' + name)\n }\n\n /**\n * Get string representation. (wrapper function)\n * This overrides parts of Node's toString function.\n * If callback is an object containing callbacks, it\n * calls the correct callback for the current node,\n * otherwise it falls back to calling Node's toString\n * function.\n *\n * @param {Object} options\n * @return {string} str\n * @override\n */\n toString (options) {\n let customString\n const name = this.fn.toString(options)\n if (options &&\n (typeof options.handler === 'object') &&\n hasOwnProperty(options.handler, name)) {\n // callback is a map of callback functions\n customString = options.handler[name](this, options)\n }\n\n if (typeof customString !== 'undefined') {\n return customString\n }\n\n // fall back to Node's toString\n return super.toString(options)\n }\n\n /**\n * Get string representation\n * @param {Object} options\n * @return {string} str\n */\n _toString (options) {\n const args = this.args.map(function (arg) {\n return arg.toString(options)\n })\n\n const fn = isFunctionAssignmentNode(this.fn)\n ? ('(' + this.fn.toString(options) + ')')\n : this.fn.toString(options)\n\n // format the arguments like \"add(2, 4.2)\"\n return fn + '(' + args.join(', ') + ')'\n }\n\n /**\n * Get a JSON representation of the node\n * @returns {Object}\n */\n toJSON () {\n return {\n mathjs: name,\n fn: this.fn,\n args: this.args\n }\n }\n\n /**\n * Instantiate an AssignmentNode from its JSON representation\n * @param {Object} json An object structured like\n * `{\"mathjs\": \"FunctionNode\", fn: ..., args: ...}`,\n * where mathjs is optional\n * @returns {FunctionNode}\n */\n static fromJSON = function (json) {\n return new FunctionNode(json.fn, json.args)\n }\n\n /**\n * Get HTML representation\n * @param {Object} options\n * @return {string} str\n */\n _toHTML (options) {\n const args = this.args.map(function (arg) {\n return arg.toHTML(options)\n })\n\n // format the arguments like \"add(2, 4.2)\"\n return '' + escape(this.fn) +\n '(' +\n args.join(',') +\n ')'\n }\n\n /**\n * Get LaTeX representation. (wrapper function)\n * This overrides parts of Node's toTex function.\n * If callback is an object containing callbacks, it\n * calls the correct callback for the current node,\n * otherwise it falls back to calling Node's toTex\n * function.\n *\n * @param {Object} options\n * @return {string}\n */\n toTex (options) {\n let customTex\n if (options &&\n (typeof options.handler === 'object') &&\n hasOwnProperty(options.handler, this.name)) {\n // callback is a map of callback functions\n customTex = options.handler[this.name](this, options)\n }\n\n if (typeof customTex !== 'undefined') {\n return customTex\n }\n\n // fall back to Node's toTex\n return super.toTex(options)\n }\n\n /**\n * Get LaTeX representation\n * @param {Object} options\n * @return {string} str\n */\n _toTex (options) {\n const args = this.args.map(function (arg) { // get LaTeX of the arguments\n return arg.toTex(options)\n })\n\n let latexConverter\n\n if (latexFunctions[this.name]) {\n latexConverter = latexFunctions[this.name]\n }\n\n // toTex property on the function itself\n if (math[this.name] &&\n ((typeof math[this.name].toTex === 'function') ||\n (typeof math[this.name].toTex === 'object') ||\n (typeof math[this.name].toTex === 'string'))\n ) {\n // .toTex is a callback function\n latexConverter = math[this.name].toTex\n }\n\n let customToTex\n switch (typeof latexConverter) {\n case 'function': // a callback function\n customToTex = latexConverter(this, options)\n break\n case 'string': // a template string\n customToTex = expandTemplate(latexConverter, this, options)\n break\n case 'object':\n // an object with different \"converters\" for different\n // numbers of arguments\n switch (typeof latexConverter[args.length]) {\n case 'function':\n customToTex = latexConverter[args.length](this, options)\n break\n case 'string':\n customToTex =\n expandTemplate(latexConverter[args.length], this, options)\n break\n }\n }\n\n if (typeof customToTex !== 'undefined') {\n return customToTex\n }\n\n return expandTemplate(defaultTemplate, this, options)\n }\n\n /**\n * Get identifier.\n * @return {string}\n */\n getIdentifier () {\n return this.type + ':' + this.name\n }\n }\n\n return FunctionNode\n}, { isClass: true, isNode: true })\n","import { factory } from '../utils/factory.js'\nimport { isAccessorNode, isConstantNode, isFunctionNode, isOperatorNode, isSymbolNode, rule2Node } from '../utils/is.js'\nimport { deepMap } from '../utils/collection.js'\nimport { safeNumberType } from '../utils/number.js'\nimport { hasOwnProperty } from '../utils/object.js'\n\nconst name = 'parse'\nconst dependencies = [\n 'typed',\n 'numeric',\n 'config',\n 'AccessorNode',\n 'ArrayNode',\n 'AssignmentNode',\n 'BlockNode',\n 'ConditionalNode',\n 'ConstantNode',\n 'FunctionAssignmentNode',\n 'FunctionNode',\n 'IndexNode',\n 'ObjectNode',\n 'OperatorNode',\n 'ParenthesisNode',\n 'RangeNode',\n 'RelationalNode',\n 'SymbolNode'\n]\n\nexport const createParse = /* #__PURE__ */ factory(name, dependencies, ({\n typed,\n numeric,\n config,\n AccessorNode,\n ArrayNode,\n AssignmentNode,\n BlockNode,\n ConditionalNode,\n ConstantNode,\n FunctionAssignmentNode,\n FunctionNode,\n IndexNode,\n ObjectNode,\n OperatorNode,\n ParenthesisNode,\n RangeNode,\n RelationalNode,\n SymbolNode\n}) => {\n /**\n * Parse an expression. Returns a node tree, which can be evaluated by\n * invoking node.evaluate() or transformed into a functional object via node.compile().\n *\n * Note the evaluating arbitrary expressions may involve security risks,\n * see [https://mathjs.org/docs/expressions/security.html](https://mathjs.org/docs/expressions/security.html) for more information.\n *\n * Syntax:\n *\n * math.parse(expr)\n * math.parse(expr, options)\n * math.parse([expr1, expr2, expr3, ...])\n * math.parse([expr1, expr2, expr3, ...], options)\n *\n * Example:\n *\n * const node1 = math.parse('sqrt(3^2 + 4^2)')\n * node1.compile().evaluate() // 5\n *\n * let scope = {a:3, b:4}\n * const node2 = math.parse('a * b') // 12\n * node2.evaluate(scope) // 12\n * const code2 = node2.compile()\n * code2.evaluate(scope) // 12\n * scope.a = 5\n * code2.evaluate(scope) // 20\n *\n * const nodes = math.parse(['a = 3', 'b = 4', 'a * b'])\n * nodes[2].compile().evaluate() // 12\n *\n * See also:\n *\n * evaluate, compile\n *\n * @param {string | string[] | Matrix} expr Expression to be parsed\n * @param {{nodes: Object}} [options] Available options:\n * - `nodes` a set of custom nodes\n * @return {Node | Node[]} node\n * @throws {Error}\n */\n const parse = typed(name, {\n string: function (expression) {\n return parseStart(expression, {})\n },\n 'Array | Matrix': function (expressions) {\n return parseMultiple(expressions, {})\n },\n 'string, Object': function (expression, options) {\n const extraNodes = options.nodes !== undefined ? options.nodes : {}\n\n return parseStart(expression, extraNodes)\n },\n 'Array | Matrix, Object': parseMultiple\n })\n\n function parseMultiple (expressions, options = {}) {\n const extraNodes = options.nodes !== undefined ? options.nodes : {}\n\n // parse an array or matrix with expressions\n return deepMap(expressions, function (elem) {\n if (typeof elem !== 'string') throw new TypeError('String expected')\n\n return parseStart(elem, extraNodes)\n })\n }\n\n // token types enumeration\n const TOKENTYPE = {\n NULL: 0,\n DELIMITER: 1,\n NUMBER: 2,\n SYMBOL: 3,\n UNKNOWN: 4\n }\n\n // map with all delimiters\n const DELIMITERS = {\n ',': true,\n '(': true,\n ')': true,\n '[': true,\n ']': true,\n '{': true,\n '}': true,\n '\"': true,\n '\\'': true,\n ';': true,\n\n '+': true,\n '-': true,\n '*': true,\n '.*': true,\n '/': true,\n './': true,\n '%': true,\n '^': true,\n '.^': true,\n '~': true,\n '!': true,\n '&': true,\n '|': true,\n '^|': true,\n '=': true,\n ':': true,\n '?': true,\n\n '==': true,\n '!=': true,\n '<': true,\n '>': true,\n '<=': true,\n '>=': true,\n\n '<<': true,\n '>>': true,\n '>>>': true\n }\n\n // map with all named delimiters\n const NAMED_DELIMITERS = {\n mod: true,\n to: true,\n in: true,\n and: true,\n xor: true,\n or: true,\n not: true\n }\n\n const CONSTANTS = {\n true: true,\n false: false,\n null: null,\n undefined\n }\n\n const NUMERIC_CONSTANTS = [\n 'NaN',\n 'Infinity'\n ]\n\n const ESCAPE_CHARACTERS = {\n '\"': '\"',\n \"'\": \"'\",\n '\\\\': '\\\\',\n '/': '/',\n b: '\\b',\n f: '\\f',\n n: '\\n',\n r: '\\r',\n t: '\\t'\n // note that \\u is handled separately in parseStringToken()\n }\n\n function initialState () {\n return {\n extraNodes: {}, // current extra nodes, must be careful not to mutate\n expression: '', // current expression\n comment: '', // last parsed comment\n index: 0, // current index in expr\n token: '', // current token\n tokenType: TOKENTYPE.NULL, // type of the token\n nestingLevel: 0, // level of nesting inside parameters, used to ignore newline characters\n conditionalLevel: null // when a conditional is being parsed, the level of the conditional is stored here\n }\n }\n\n /**\n * View upto `length` characters of the expression starting at the current character.\n *\n * @param {Object} state\n * @param {number} [length=1] Number of characters to view\n * @returns {string}\n * @private\n */\n function currentString (state, length) {\n return state.expression.substr(state.index, length)\n }\n\n /**\n * View the current character. Returns '' if end of expression is reached.\n *\n * @param {Object} state\n * @returns {string}\n * @private\n */\n function currentCharacter (state) {\n return currentString(state, 1)\n }\n\n /**\n * Get the next character from the expression.\n * The character is stored into the char c. If the end of the expression is\n * reached, the function puts an empty string in c.\n * @private\n */\n function next (state) {\n state.index++\n }\n\n /**\n * Preview the previous character from the expression.\n * @return {string} cNext\n * @private\n */\n function prevCharacter (state) {\n return state.expression.charAt(state.index - 1)\n }\n\n /**\n * Preview the next character from the expression.\n * @return {string} cNext\n * @private\n */\n function nextCharacter (state) {\n return state.expression.charAt(state.index + 1)\n }\n\n /**\n * Get next token in the current string expr.\n * The token and token type are available as token and tokenType\n * @private\n */\n function getToken (state) {\n state.tokenType = TOKENTYPE.NULL\n state.token = ''\n state.comment = ''\n\n // skip over ignored characters:\n while (true) {\n // comments:\n if (currentCharacter(state) === '#') {\n while (currentCharacter(state) !== '\\n' &&\n currentCharacter(state) !== '') {\n state.comment += currentCharacter(state)\n next(state)\n }\n }\n // whitespace: space, tab, and newline when inside parameters\n if (parse.isWhitespace(currentCharacter(state), state.nestingLevel)) {\n next(state)\n } else {\n break\n }\n }\n\n // check for end of expression\n if (currentCharacter(state) === '') {\n // token is still empty\n state.tokenType = TOKENTYPE.DELIMITER\n return\n }\n\n // check for new line character\n if (currentCharacter(state) === '\\n' && !state.nestingLevel) {\n state.tokenType = TOKENTYPE.DELIMITER\n state.token = currentCharacter(state)\n next(state)\n return\n }\n\n const c1 = currentCharacter(state)\n const c2 = currentString(state, 2)\n const c3 = currentString(state, 3)\n if (c3.length === 3 && DELIMITERS[c3]) {\n state.tokenType = TOKENTYPE.DELIMITER\n state.token = c3\n next(state)\n next(state)\n next(state)\n return\n }\n\n // check for delimiters consisting of 2 characters\n if (c2.length === 2 && DELIMITERS[c2]) {\n state.tokenType = TOKENTYPE.DELIMITER\n state.token = c2\n next(state)\n next(state)\n return\n }\n\n // check for delimiters consisting of 1 character\n if (DELIMITERS[c1]) {\n state.tokenType = TOKENTYPE.DELIMITER\n state.token = c1\n next(state)\n return\n }\n\n // check for a number\n if (parse.isDigitDot(c1)) {\n state.tokenType = TOKENTYPE.NUMBER\n\n // check for binary, octal, or hex\n const c2 = currentString(state, 2)\n if (c2 === '0b' || c2 === '0o' || c2 === '0x') {\n state.token += currentCharacter(state)\n next(state)\n state.token += currentCharacter(state)\n next(state)\n while (parse.isHexDigit(currentCharacter(state))) {\n state.token += currentCharacter(state)\n next(state)\n }\n if (currentCharacter(state) === '.') {\n // this number has a radix point\n state.token += '.'\n next(state)\n // get the digits after the radix\n while (parse.isHexDigit(currentCharacter(state))) {\n state.token += currentCharacter(state)\n next(state)\n }\n } else if (currentCharacter(state) === 'i') {\n // this number has a word size suffix\n state.token += 'i'\n next(state)\n // get the word size\n while (parse.isDigit(currentCharacter(state))) {\n state.token += currentCharacter(state)\n next(state)\n }\n }\n return\n }\n\n // get number, can have a single dot\n if (currentCharacter(state) === '.') {\n state.token += currentCharacter(state)\n next(state)\n\n if (!parse.isDigit(currentCharacter(state))) {\n // this is no number, it is just a dot (can be dot notation)\n state.tokenType = TOKENTYPE.DELIMITER\n return\n }\n } else {\n while (parse.isDigit(currentCharacter(state))) {\n state.token += currentCharacter(state)\n next(state)\n }\n if (parse.isDecimalMark(currentCharacter(state), nextCharacter(state))) {\n state.token += currentCharacter(state)\n next(state)\n }\n }\n\n while (parse.isDigit(currentCharacter(state))) {\n state.token += currentCharacter(state)\n next(state)\n }\n // check for exponential notation like \"2.3e-4\", \"1.23e50\" or \"2e+4\"\n if (currentCharacter(state) === 'E' || currentCharacter(state) === 'e') {\n if (parse.isDigit(nextCharacter(state)) || nextCharacter(state) === '-' || nextCharacter(state) === '+') {\n state.token += currentCharacter(state)\n next(state)\n\n if (currentCharacter(state) === '+' || currentCharacter(state) === '-') {\n state.token += currentCharacter(state)\n next(state)\n }\n // Scientific notation MUST be followed by an exponent\n if (!parse.isDigit(currentCharacter(state))) {\n throw createSyntaxError(state, 'Digit expected, got \"' + currentCharacter(state) + '\"')\n }\n\n while (parse.isDigit(currentCharacter(state))) {\n state.token += currentCharacter(state)\n next(state)\n }\n\n if (parse.isDecimalMark(currentCharacter(state), nextCharacter(state))) {\n throw createSyntaxError(state, 'Digit expected, got \"' + currentCharacter(state) + '\"')\n }\n } else if (parse.isDecimalMark(nextCharacter(state), state.expression.charAt(state.index + 2))) {\n next(state)\n throw createSyntaxError(state, 'Digit expected, got \"' + currentCharacter(state) + '\"')\n }\n }\n\n return\n }\n\n // check for variables, functions, named operators\n if (parse.isAlpha(currentCharacter(state), prevCharacter(state), nextCharacter(state))) {\n while (parse.isAlpha(currentCharacter(state), prevCharacter(state), nextCharacter(state)) || parse.isDigit(currentCharacter(state))) {\n state.token += currentCharacter(state)\n next(state)\n }\n\n if (hasOwnProperty(NAMED_DELIMITERS, state.token)) {\n state.tokenType = TOKENTYPE.DELIMITER\n } else {\n state.tokenType = TOKENTYPE.SYMBOL\n }\n\n return\n }\n\n // something unknown is found, wrong characters -> a syntax error\n state.tokenType = TOKENTYPE.UNKNOWN\n while (currentCharacter(state) !== '') {\n state.token += currentCharacter(state)\n next(state)\n }\n throw createSyntaxError(state, 'Syntax error in part \"' + state.token + '\"')\n }\n\n /**\n * Get next token and skip newline tokens\n */\n function getTokenSkipNewline (state) {\n do {\n getToken(state)\n }\n while (state.token === '\\n') // eslint-disable-line no-unmodified-loop-condition\n }\n\n /**\n * Open parameters.\n * New line characters will be ignored until closeParams(state) is called\n */\n function openParams (state) {\n state.nestingLevel++\n }\n\n /**\n * Close parameters.\n * New line characters will no longer be ignored\n */\n function closeParams (state) {\n state.nestingLevel--\n }\n\n /**\n * Checks whether the current character `c` is a valid alpha character:\n *\n * - A latin letter (upper or lower case) Ascii: a-z, A-Z\n * - An underscore Ascii: _\n * - A dollar sign Ascii: $\n * - A latin letter with accents Unicode: \\u00C0 - \\u02AF\n * - A greek letter Unicode: \\u0370 - \\u03FF\n * - A mathematical alphanumeric symbol Unicode: \\u{1D400} - \\u{1D7FF} excluding invalid code points\n *\n * The previous and next characters are needed to determine whether\n * this character is part of a unicode surrogate pair.\n *\n * @param {string} c Current character in the expression\n * @param {string} cPrev Previous character\n * @param {string} cNext Next character\n * @return {boolean}\n */\n parse.isAlpha = function isAlpha (c, cPrev, cNext) {\n return parse.isValidLatinOrGreek(c) ||\n parse.isValidMathSymbol(c, cNext) ||\n parse.isValidMathSymbol(cPrev, c)\n }\n\n /**\n * Test whether a character is a valid latin, greek, or letter-like character\n * @param {string} c\n * @return {boolean}\n */\n parse.isValidLatinOrGreek = function isValidLatinOrGreek (c) {\n return /^[a-zA-Z_$\\u00C0-\\u02AF\\u0370-\\u03FF\\u2100-\\u214F]$/.test(c)\n }\n\n /**\n * Test whether two given 16 bit characters form a surrogate pair of a\n * unicode math symbol.\n *\n * https://unicode-table.com/en/\n * https://www.wikiwand.com/en/Mathematical_operators_and_symbols_in_Unicode\n *\n * Note: In ES6 will be unicode aware:\n * https://stackoverflow.com/questions/280712/javascript-unicode-regexes\n * https://mathiasbynens.be/notes/es6-unicode-regex\n *\n * @param {string} high\n * @param {string} low\n * @return {boolean}\n */\n parse.isValidMathSymbol = function isValidMathSymbol (high, low) {\n return /^[\\uD835]$/.test(high) &&\n /^[\\uDC00-\\uDFFF]$/.test(low) &&\n /^[^\\uDC55\\uDC9D\\uDCA0\\uDCA1\\uDCA3\\uDCA4\\uDCA7\\uDCA8\\uDCAD\\uDCBA\\uDCBC\\uDCC4\\uDD06\\uDD0B\\uDD0C\\uDD15\\uDD1D\\uDD3A\\uDD3F\\uDD45\\uDD47-\\uDD49\\uDD51\\uDEA6\\uDEA7\\uDFCC\\uDFCD]$/.test(low)\n }\n\n /**\n * Check whether given character c is a white space character: space, tab, or enter\n * @param {string} c\n * @param {number} nestingLevel\n * @return {boolean}\n */\n parse.isWhitespace = function isWhitespace (c, nestingLevel) {\n // TODO: also take '\\r' carriage return as newline? Or does that give problems on mac?\n return c === ' ' || c === '\\t' || (c === '\\n' && nestingLevel > 0)\n }\n\n /**\n * Test whether the character c is a decimal mark (dot).\n * This is the case when it's not the start of a delimiter '.*', './', or '.^'\n * @param {string} c\n * @param {string} cNext\n * @return {boolean}\n */\n parse.isDecimalMark = function isDecimalMark (c, cNext) {\n return c === '.' && cNext !== '/' && cNext !== '*' && cNext !== '^'\n }\n\n /**\n * checks if the given char c is a digit or dot\n * @param {string} c a string with one character\n * @return {boolean}\n */\n parse.isDigitDot = function isDigitDot (c) {\n return ((c >= '0' && c <= '9') || c === '.')\n }\n\n /**\n * checks if the given char c is a digit\n * @param {string} c a string with one character\n * @return {boolean}\n */\n parse.isDigit = function isDigit (c) {\n return (c >= '0' && c <= '9')\n }\n\n /**\n * checks if the given char c is a hex digit\n * @param {string} c a string with one character\n * @return {boolean}\n */\n parse.isHexDigit = function isHexDigit (c) {\n return ((c >= '0' && c <= '9') ||\n (c >= 'a' && c <= 'f') ||\n (c >= 'A' && c <= 'F'))\n }\n\n /**\n * Start of the parse levels below, in order of precedence\n * @return {Node} node\n * @private\n */\n function parseStart (expression, extraNodes) {\n const state = initialState()\n Object.assign(state, { expression, extraNodes })\n getToken(state)\n\n const node = parseBlock(state)\n\n // check for garbage at the end of the expression\n // an expression ends with a empty character '' and tokenType DELIMITER\n if (state.token !== '') {\n if (state.tokenType === TOKENTYPE.DELIMITER) {\n // user entered a not existing operator like \"//\"\n\n // TODO: give hints for aliases, for example with \"<>\" give as hint \" did you mean !== ?\"\n throw createError(state, 'Unexpected operator ' + state.token)\n } else {\n throw createSyntaxError(state, 'Unexpected part \"' + state.token + '\"')\n }\n }\n\n return node\n }\n\n /**\n * Parse a block with expressions. Expressions can be separated by a newline\n * character '\\n', or by a semicolon ';'. In case of a semicolon, no output\n * of the preceding line is returned.\n * @return {Node} node\n * @private\n */\n function parseBlock (state) {\n let node\n const blocks = []\n let visible\n\n if (state.token !== '' && state.token !== '\\n' && state.token !== ';') {\n node = parseAssignment(state)\n if (state.comment) {\n node.comment = state.comment\n }\n }\n\n // TODO: simplify this loop\n while (state.token === '\\n' || state.token === ';') { // eslint-disable-line no-unmodified-loop-condition\n if (blocks.length === 0 && node) {\n visible = (state.token !== ';')\n blocks.push({ node, visible })\n }\n\n getToken(state)\n if (state.token !== '\\n' && state.token !== ';' && state.token !== '') {\n node = parseAssignment(state)\n if (state.comment) {\n node.comment = state.comment\n }\n\n visible = (state.token !== ';')\n blocks.push({ node, visible })\n }\n }\n\n if (blocks.length > 0) {\n return new BlockNode(blocks)\n } else {\n if (!node) {\n node = new ConstantNode(undefined)\n if (state.comment) {\n node.comment = state.comment\n }\n }\n\n return node\n }\n }\n\n /**\n * Assignment of a function or variable,\n * - can be a variable like 'a=2.3'\n * - or a updating an existing variable like 'matrix(2,3:5)=[6,7,8]'\n * - defining a function like 'f(x) = x^2'\n * @return {Node} node\n * @private\n */\n function parseAssignment (state) {\n let name, args, value, valid\n\n const node = parseConditional(state)\n\n if (state.token === '=') {\n if (isSymbolNode(node)) {\n // parse a variable assignment like 'a = 2/3'\n name = node.name\n getTokenSkipNewline(state)\n value = parseAssignment(state)\n return new AssignmentNode(new SymbolNode(name), value)\n } else if (isAccessorNode(node)) {\n // parse a matrix subset assignment like 'A[1,2] = 4'\n getTokenSkipNewline(state)\n value = parseAssignment(state)\n return new AssignmentNode(node.object, node.index, value)\n } else if (isFunctionNode(node) && isSymbolNode(node.fn)) {\n // parse function assignment like 'f(x) = x^2'\n valid = true\n args = []\n\n name = node.name\n node.args.forEach(function (arg, index) {\n if (isSymbolNode(arg)) {\n args[index] = arg.name\n } else {\n valid = false\n }\n })\n\n if (valid) {\n getTokenSkipNewline(state)\n value = parseAssignment(state)\n return new FunctionAssignmentNode(name, args, value)\n }\n }\n\n throw createSyntaxError(state, 'Invalid left hand side of assignment operator =')\n }\n\n return node\n }\n\n /**\n * conditional operation\n *\n * condition ? truePart : falsePart\n *\n * Note: conditional operator is right-associative\n *\n * @return {Node} node\n * @private\n */\n function parseConditional (state) {\n let node = parseLogicalOr(state)\n\n while (state.token === '?') { // eslint-disable-line no-unmodified-loop-condition\n // set a conditional level, the range operator will be ignored as long\n // as conditionalLevel === state.nestingLevel.\n const prev = state.conditionalLevel\n state.conditionalLevel = state.nestingLevel\n getTokenSkipNewline(state)\n\n const condition = node\n const trueExpr = parseAssignment(state)\n\n if (state.token !== ':') throw createSyntaxError(state, 'False part of conditional expression expected')\n\n state.conditionalLevel = null\n getTokenSkipNewline(state)\n\n const falseExpr = parseAssignment(state) // Note: check for conditional operator again, right associativity\n\n node = new ConditionalNode(condition, trueExpr, falseExpr)\n\n // restore the previous conditional level\n state.conditionalLevel = prev\n }\n\n return node\n }\n\n /**\n * logical or, 'x or y'\n * @return {Node} node\n * @private\n */\n function parseLogicalOr (state) {\n let node = parseLogicalXor(state)\n\n while (state.token === 'or') { // eslint-disable-line no-unmodified-loop-condition\n getTokenSkipNewline(state)\n node = new OperatorNode('or', 'or', [node, parseLogicalXor(state)])\n }\n\n return node\n }\n\n /**\n * logical exclusive or, 'x xor y'\n * @return {Node} node\n * @private\n */\n function parseLogicalXor (state) {\n let node = parseLogicalAnd(state)\n\n while (state.token === 'xor') { // eslint-disable-line no-unmodified-loop-condition\n getTokenSkipNewline(state)\n node = new OperatorNode('xor', 'xor', [node, parseLogicalAnd(state)])\n }\n\n return node\n }\n\n /**\n * logical and, 'x and y'\n * @return {Node} node\n * @private\n */\n function parseLogicalAnd (state) {\n let node = parseBitwiseOr(state)\n\n while (state.token === 'and') { // eslint-disable-line no-unmodified-loop-condition\n getTokenSkipNewline(state)\n node = new OperatorNode('and', 'and', [node, parseBitwiseOr(state)])\n }\n\n return node\n }\n\n /**\n * bitwise or, 'x | y'\n * @return {Node} node\n * @private\n */\n function parseBitwiseOr (state) {\n let node = parseBitwiseXor(state)\n\n while (state.token === '|') { // eslint-disable-line no-unmodified-loop-condition\n getTokenSkipNewline(state)\n node = new OperatorNode('|', 'bitOr', [node, parseBitwiseXor(state)])\n }\n\n return node\n }\n\n /**\n * bitwise exclusive or (xor), 'x ^| y'\n * @return {Node} node\n * @private\n */\n function parseBitwiseXor (state) {\n let node = parseBitwiseAnd(state)\n\n while (state.token === '^|') { // eslint-disable-line no-unmodified-loop-condition\n getTokenSkipNewline(state)\n node = new OperatorNode('^|', 'bitXor', [node, parseBitwiseAnd(state)])\n }\n\n return node\n }\n\n /**\n * bitwise and, 'x & y'\n * @return {Node} node\n * @private\n */\n function parseBitwiseAnd (state) {\n let node = parseRelational(state)\n\n while (state.token === '&') { // eslint-disable-line no-unmodified-loop-condition\n getTokenSkipNewline(state)\n node = new OperatorNode('&', 'bitAnd', [node, parseRelational(state)])\n }\n\n return node\n }\n\n /**\n * Parse a chained conditional, like 'a > b >= c'\n * @return {Node} node\n */\n function parseRelational (state) {\n const params = [parseShift(state)]\n const conditionals = []\n\n const operators = {\n '==': 'equal',\n '!=': 'unequal',\n '<': 'smaller',\n '>': 'larger',\n '<=': 'smallerEq',\n '>=': 'largerEq'\n }\n\n while (hasOwnProperty(operators, state.token)) { // eslint-disable-line no-unmodified-loop-condition\n const cond = { name: state.token, fn: operators[state.token] }\n conditionals.push(cond)\n getTokenSkipNewline(state)\n params.push(parseShift(state))\n }\n\n if (params.length === 1) {\n return params[0]\n } else if (params.length === 2) {\n return new OperatorNode(conditionals[0].name, conditionals[0].fn, params)\n } else {\n return new RelationalNode(conditionals.map(c => c.fn), params)\n }\n }\n\n /**\n * Bitwise left shift, bitwise right arithmetic shift, bitwise right logical shift\n * @return {Node} node\n * @private\n */\n function parseShift (state) {\n let node, name, fn, params\n\n node = parseConversion(state)\n\n const operators = {\n '<<': 'leftShift',\n '>>': 'rightArithShift',\n '>>>': 'rightLogShift'\n }\n\n while (hasOwnProperty(operators, state.token)) {\n name = state.token\n fn = operators[name]\n\n getTokenSkipNewline(state)\n params = [node, parseConversion(state)]\n node = new OperatorNode(name, fn, params)\n }\n\n return node\n }\n\n /**\n * conversion operators 'to' and 'in'\n * @return {Node} node\n * @private\n */\n function parseConversion (state) {\n let node, name, fn, params\n\n node = parseRange(state)\n\n const operators = {\n to: 'to',\n in: 'to' // alias of 'to'\n }\n\n while (hasOwnProperty(operators, state.token)) {\n name = state.token\n fn = operators[name]\n\n getTokenSkipNewline(state)\n\n if (name === 'in' && '])},;'.includes(state.token)) {\n // end of expression -> this is the unit 'in' ('inch')\n node = new OperatorNode('*', 'multiply', [node, new SymbolNode('in')], true)\n } else {\n // operator 'a to b' or 'a in b'\n params = [node, parseRange(state)]\n node = new OperatorNode(name, fn, params)\n }\n }\n\n return node\n }\n\n /**\n * parse range, \"start:end\", \"start:step:end\", \":\", \"start:\", \":end\", etc\n * @return {Node} node\n * @private\n */\n function parseRange (state) {\n let node\n const params = []\n\n if (state.token === ':') {\n // implicit start=1 (one-based)\n node = new ConstantNode(1)\n } else {\n // explicit start\n node = parseAddSubtract(state)\n }\n\n if (state.token === ':' && (state.conditionalLevel !== state.nestingLevel)) {\n // we ignore the range operator when a conditional operator is being processed on the same level\n params.push(node)\n\n // parse step and end\n while (state.token === ':' && params.length < 3) { // eslint-disable-line no-unmodified-loop-condition\n getTokenSkipNewline(state)\n\n if (state.token === ')' || state.token === ']' || state.token === ',' || state.token === '') {\n // implicit end\n params.push(new SymbolNode('end'))\n } else {\n // explicit end\n params.push(parseAddSubtract(state))\n }\n }\n\n if (params.length === 3) {\n // params = [start, step, end]\n node = new RangeNode(params[0], params[2], params[1]) // start, end, step\n } else { // length === 2\n // params = [start, end]\n node = new RangeNode(params[0], params[1]) // start, end\n }\n }\n\n return node\n }\n\n /**\n * add or subtract\n * @return {Node} node\n * @private\n */\n function parseAddSubtract (state) {\n let node, name, fn, params\n\n node = parseMultiplyDivideModulusPercentage(state)\n\n const operators = {\n '+': 'add',\n '-': 'subtract'\n }\n while (hasOwnProperty(operators, state.token)) {\n name = state.token\n fn = operators[name]\n\n getTokenSkipNewline(state)\n const rightNode = parseMultiplyDivideModulusPercentage(state)\n if (rightNode.isPercentage) {\n params = [node, new OperatorNode('*', 'multiply', [node, rightNode])]\n } else {\n params = [node, rightNode]\n }\n node = new OperatorNode(name, fn, params)\n }\n\n return node\n }\n\n /**\n * multiply, divide, modulus, percentage\n * @return {Node} node\n * @private\n */\n function parseMultiplyDivideModulusPercentage (state) {\n let node, last, name, fn\n\n node = parseImplicitMultiplication(state)\n last = node\n\n const operators = {\n '*': 'multiply',\n '.*': 'dotMultiply',\n '/': 'divide',\n './': 'dotDivide',\n '%': 'mod',\n mod: 'mod'\n }\n\n while (true) {\n if (hasOwnProperty(operators, state.token)) {\n // explicit operators\n name = state.token\n fn = operators[name]\n\n getTokenSkipNewline(state)\n\n if (name === '%' && state.tokenType === TOKENTYPE.DELIMITER && state.token !== '(') {\n // If the expression contains only %, then treat that as /100\n if (state.token !== '' && operators[state.token]) {\n const left = new OperatorNode('/', 'divide', [node, new ConstantNode(100)], false, true)\n name = state.token\n fn = operators[name]\n getTokenSkipNewline(state)\n last = parseImplicitMultiplication(state)\n\n node = new OperatorNode(name, fn, [left, last])\n } else { node = new OperatorNode('/', 'divide', [node, new ConstantNode(100)], false, true) }\n // return node\n } else {\n last = parseImplicitMultiplication(state)\n node = new OperatorNode(name, fn, [node, last])\n }\n } else {\n break\n }\n }\n\n return node\n }\n\n /**\n * implicit multiplication\n * @return {Node} node\n * @private\n */\n function parseImplicitMultiplication (state) {\n let node, last\n\n node = parseRule2(state)\n last = node\n\n while (true) {\n if ((state.tokenType === TOKENTYPE.SYMBOL) ||\n (state.token === 'in' && isConstantNode(node)) ||\n (state.token === 'in' && isOperatorNode(node) && node.fn === 'unaryMinus' && isConstantNode(node.args[0])) ||\n (state.tokenType === TOKENTYPE.NUMBER &&\n !isConstantNode(last) &&\n (!isOperatorNode(last) || last.op === '!')) ||\n (state.token === '(')) {\n // parse implicit multiplication\n //\n // symbol: implicit multiplication like '2a', '(2+3)a', 'a b'\n // number: implicit multiplication like '(2+3)2'\n // parenthesis: implicit multiplication like '2(3+4)', '(3+4)(1+2)'\n last = parseRule2(state)\n node = new OperatorNode('*', 'multiply', [node, last], true /* implicit */)\n } else {\n break\n }\n }\n\n return node\n }\n\n /**\n * Infamous \"rule 2\" as described in https://github.com/josdejong/mathjs/issues/792#issuecomment-361065370\n * And as amended in https://github.com/josdejong/mathjs/issues/2370#issuecomment-1054052164\n * Explicit division gets higher precedence than implicit multiplication\n * when the division matches this pattern:\n * [unaryPrefixOp]?[number] / [number] [symbol]\n * @return {Node} node\n * @private\n */\n function parseRule2 (state) {\n let node = parseUnary(state)\n let last = node\n const tokenStates = []\n\n while (true) {\n // Match the \"number /\" part of the pattern \"number / number symbol\"\n if (state.token === '/' && rule2Node(last)) {\n // Look ahead to see if the next token is a number\n tokenStates.push(Object.assign({}, state))\n getTokenSkipNewline(state)\n\n // Match the \"number / number\" part of the pattern\n if (state.tokenType === TOKENTYPE.NUMBER) {\n // Look ahead again\n tokenStates.push(Object.assign({}, state))\n getTokenSkipNewline(state)\n\n // Match the \"symbol\" part of the pattern, or a left parenthesis\n if (state.tokenType === TOKENTYPE.SYMBOL || state.token === '(' || state.token === 'in') {\n // We've matched the pattern \"number / number symbol\".\n // Rewind once and build the \"number / number\" node; the symbol will be consumed later\n Object.assign(state, tokenStates.pop())\n tokenStates.pop()\n last = parseUnary(state)\n node = new OperatorNode('/', 'divide', [node, last])\n } else {\n // Not a match, so rewind\n tokenStates.pop()\n Object.assign(state, tokenStates.pop())\n break\n }\n } else {\n // Not a match, so rewind\n Object.assign(state, tokenStates.pop())\n break\n }\n } else {\n break\n }\n }\n\n return node\n }\n\n /**\n * Unary plus and minus, and logical and bitwise not\n * @return {Node} node\n * @private\n */\n function parseUnary (state) {\n let name, params, fn\n const operators = {\n '-': 'unaryMinus',\n '+': 'unaryPlus',\n '~': 'bitNot',\n not: 'not'\n }\n\n if (hasOwnProperty(operators, state.token)) {\n fn = operators[state.token]\n name = state.token\n\n getTokenSkipNewline(state)\n params = [parseUnary(state)]\n\n return new OperatorNode(name, fn, params)\n }\n\n return parsePow(state)\n }\n\n /**\n * power\n * Note: power operator is right associative\n * @return {Node} node\n * @private\n */\n function parsePow (state) {\n let node, name, fn, params\n\n node = parseLeftHandOperators(state)\n\n if (state.token === '^' || state.token === '.^') {\n name = state.token\n fn = (name === '^') ? 'pow' : 'dotPow'\n\n getTokenSkipNewline(state)\n params = [node, parseUnary(state)] // Go back to unary, we can have '2^-3'\n node = new OperatorNode(name, fn, params)\n }\n\n return node\n }\n\n /**\n * Left hand operators: factorial x!, ctranspose x'\n * @return {Node} node\n * @private\n */\n function parseLeftHandOperators (state) {\n let node, name, fn, params\n\n node = parseCustomNodes(state)\n\n const operators = {\n '!': 'factorial',\n '\\'': 'ctranspose'\n }\n\n while (hasOwnProperty(operators, state.token)) {\n name = state.token\n fn = operators[name]\n\n getToken(state)\n params = [node]\n\n node = new OperatorNode(name, fn, params)\n node = parseAccessors(state, node)\n }\n\n return node\n }\n\n /**\n * Parse a custom node handler. A node handler can be used to process\n * nodes in a custom way, for example for handling a plot.\n *\n * A handler must be passed as second argument of the parse function.\n * - must extend math.Node\n * - must contain a function _compile(defs: Object) : string\n * - must contain a function find(filter: Object) : Node[]\n * - must contain a function toString() : string\n * - the constructor is called with a single argument containing all parameters\n *\n * For example:\n *\n * nodes = {\n * 'plot': PlotHandler\n * }\n *\n * The constructor of the handler is called as:\n *\n * node = new PlotHandler(params)\n *\n * The handler will be invoked when evaluating an expression like:\n *\n * node = math.parse('plot(sin(x), x)', nodes)\n *\n * @return {Node} node\n * @private\n */\n function parseCustomNodes (state) {\n let params = []\n\n if (state.tokenType === TOKENTYPE.SYMBOL && hasOwnProperty(state.extraNodes, state.token)) {\n const CustomNode = state.extraNodes[state.token]\n\n getToken(state)\n\n // parse parameters\n if (state.token === '(') {\n params = []\n\n openParams(state)\n getToken(state)\n\n if (state.token !== ')') {\n params.push(parseAssignment(state))\n\n // parse a list with parameters\n while (state.token === ',') { // eslint-disable-line no-unmodified-loop-condition\n getToken(state)\n params.push(parseAssignment(state))\n }\n }\n\n if (state.token !== ')') {\n throw createSyntaxError(state, 'Parenthesis ) expected')\n }\n closeParams(state)\n getToken(state)\n }\n\n // create a new custom node\n // noinspection JSValidateTypes\n return new CustomNode(params)\n }\n\n return parseSymbol(state)\n }\n\n /**\n * parse symbols: functions, variables, constants, units\n * @return {Node} node\n * @private\n */\n function parseSymbol (state) {\n let node, name\n\n if (state.tokenType === TOKENTYPE.SYMBOL ||\n (state.tokenType === TOKENTYPE.DELIMITER && state.token in NAMED_DELIMITERS)) {\n name = state.token\n\n getToken(state)\n\n if (hasOwnProperty(CONSTANTS, name)) { // true, false, null, ...\n node = new ConstantNode(CONSTANTS[name])\n } else if (NUMERIC_CONSTANTS.includes(name)) { // NaN, Infinity\n node = new ConstantNode(numeric(name, 'number'))\n } else {\n node = new SymbolNode(name)\n }\n\n // parse function parameters and matrix index\n node = parseAccessors(state, node)\n return node\n }\n\n return parseString(state)\n }\n\n /**\n * parse accessors:\n * - function invocation in round brackets (...), for example sqrt(2)\n * - index enclosed in square brackets [...], for example A[2,3]\n * - dot notation for properties, like foo.bar\n * @param {Object} state\n * @param {Node} node Node on which to apply the parameters. If there\n * are no parameters in the expression, the node\n * itself is returned\n * @param {string[]} [types] Filter the types of notations\n * can be ['(', '[', '.']\n * @return {Node} node\n * @private\n */\n function parseAccessors (state, node, types) {\n let params\n\n while ((state.token === '(' || state.token === '[' || state.token === '.') &&\n (!types || types.includes(state.token))) { // eslint-disable-line no-unmodified-loop-condition\n params = []\n\n if (state.token === '(') {\n if (isSymbolNode(node) || isAccessorNode(node)) {\n // function invocation like fn(2, 3) or obj.fn(2, 3)\n openParams(state)\n getToken(state)\n\n if (state.token !== ')') {\n params.push(parseAssignment(state))\n\n // parse a list with parameters\n while (state.token === ',') { // eslint-disable-line no-unmodified-loop-condition\n getToken(state)\n params.push(parseAssignment(state))\n }\n }\n\n if (state.token !== ')') {\n throw createSyntaxError(state, 'Parenthesis ) expected')\n }\n closeParams(state)\n getToken(state)\n\n node = new FunctionNode(node, params)\n } else {\n // implicit multiplication like (2+3)(4+5) or sqrt(2)(1+2)\n // don't parse it here but let it be handled by parseImplicitMultiplication\n // with correct precedence\n return node\n }\n } else if (state.token === '[') {\n // index notation like variable[2, 3]\n openParams(state)\n getToken(state)\n\n if (state.token !== ']') {\n params.push(parseAssignment(state))\n\n // parse a list with parameters\n while (state.token === ',') { // eslint-disable-line no-unmodified-loop-condition\n getToken(state)\n params.push(parseAssignment(state))\n }\n }\n\n if (state.token !== ']') {\n throw createSyntaxError(state, 'Parenthesis ] expected')\n }\n closeParams(state)\n getToken(state)\n\n node = new AccessorNode(node, new IndexNode(params))\n } else {\n // dot notation like variable.prop\n getToken(state)\n\n const isPropertyName = state.tokenType === TOKENTYPE.SYMBOL ||\n (state.tokenType === TOKENTYPE.DELIMITER && state.token in NAMED_DELIMITERS)\n if (!isPropertyName) {\n throw createSyntaxError(state, 'Property name expected after dot')\n }\n\n params.push(new ConstantNode(state.token))\n getToken(state)\n\n const dotNotation = true\n node = new AccessorNode(node, new IndexNode(params, dotNotation))\n }\n }\n\n return node\n }\n\n /**\n * Parse a single or double quoted string.\n * @return {Node} node\n * @private\n */\n function parseString (state) {\n let node, str\n\n if (state.token === '\"' || state.token === \"'\") {\n str = parseStringToken(state, state.token)\n\n // create constant\n node = new ConstantNode(str)\n\n // parse index parameters\n node = parseAccessors(state, node)\n\n return node\n }\n\n return parseMatrix(state)\n }\n\n /**\n * Parse a string surrounded by single or double quotes\n * @param {Object} state\n * @param {\"'\" | \"\\\"\"} quote\n * @return {string}\n */\n function parseStringToken (state, quote) {\n let str = ''\n\n while (currentCharacter(state) !== '' && currentCharacter(state) !== quote) {\n if (currentCharacter(state) === '\\\\') {\n next(state)\n\n const char = currentCharacter(state)\n const escapeChar = ESCAPE_CHARACTERS[char]\n if (escapeChar !== undefined) {\n // an escaped control character like \\\" or \\n\n str += escapeChar\n state.index += 1\n } else if (char === 'u') {\n // escaped unicode character\n const unicode = state.expression.slice(state.index + 1, state.index + 5)\n if (/^[0-9A-Fa-f]{4}$/.test(unicode)) { // test whether the string holds four hexadecimal values\n str += String.fromCharCode(parseInt(unicode, 16))\n state.index += 5\n } else {\n throw createSyntaxError(state, `Invalid unicode character \\\\u${unicode}`)\n }\n } else {\n throw createSyntaxError(state, `Bad escape character \\\\${char}`)\n }\n } else {\n // any regular character\n str += currentCharacter(state)\n next(state)\n }\n }\n\n getToken(state)\n if (state.token !== quote) {\n throw createSyntaxError(state, `End of string ${quote} expected`)\n }\n getToken(state)\n\n return str\n }\n\n /**\n * parse the matrix\n * @return {Node} node\n * @private\n */\n function parseMatrix (state) {\n let array, params, rows, cols\n\n if (state.token === '[') {\n // matrix [...]\n openParams(state)\n getToken(state)\n\n if (state.token !== ']') {\n // this is a non-empty matrix\n const row = parseRow(state)\n\n if (state.token === ';') {\n // 2 dimensional array\n rows = 1\n params = [row]\n\n // the rows of the matrix are separated by dot-comma's\n while (state.token === ';') { // eslint-disable-line no-unmodified-loop-condition\n getToken(state)\n\n if (state.token !== ']') {\n params[rows] = parseRow(state)\n rows++\n }\n }\n\n if (state.token !== ']') {\n throw createSyntaxError(state, 'End of matrix ] expected')\n }\n closeParams(state)\n getToken(state)\n\n // check if the number of columns matches in all rows\n cols = params[0].items.length\n for (let r = 1; r < rows; r++) {\n if (params[r].items.length !== cols) {\n throw createError(state, 'Column dimensions mismatch ' +\n '(' + params[r].items.length + ' !== ' + cols + ')')\n }\n }\n\n array = new ArrayNode(params)\n } else {\n // 1 dimensional vector\n if (state.token !== ']') {\n throw createSyntaxError(state, 'End of matrix ] expected')\n }\n closeParams(state)\n getToken(state)\n\n array = row\n }\n } else {\n // this is an empty matrix \"[ ]\"\n closeParams(state)\n getToken(state)\n array = new ArrayNode([])\n }\n\n return parseAccessors(state, array)\n }\n\n return parseObject(state)\n }\n\n /**\n * Parse a single comma-separated row from a matrix, like 'a, b, c'\n * @return {ArrayNode} node\n */\n function parseRow (state) {\n const params = [parseAssignment(state)]\n let len = 1\n\n while (state.token === ',') { // eslint-disable-line no-unmodified-loop-condition\n getToken(state)\n\n // parse expression\n if (state.token !== ']' && state.token !== ';') {\n params[len] = parseAssignment(state)\n len++\n }\n }\n\n return new ArrayNode(params)\n }\n\n /**\n * parse an object, enclosed in angle brackets{...}, for example {value: 2}\n * @return {Node} node\n * @private\n */\n function parseObject (state) {\n if (state.token === '{') {\n openParams(state)\n let key\n\n const properties = {}\n do {\n getToken(state)\n\n if (state.token !== '}') {\n // parse key\n if (state.token === '\"' || state.token === \"'\") {\n key = parseStringToken(state, state.token)\n } else if (state.tokenType === TOKENTYPE.SYMBOL || (state.tokenType === TOKENTYPE.DELIMITER && state.token in NAMED_DELIMITERS)) {\n key = state.token\n getToken(state)\n } else {\n throw createSyntaxError(state, 'Symbol or string expected as object key')\n }\n\n // parse key/value separator\n if (state.token !== ':') {\n throw createSyntaxError(state, 'Colon : expected after object key')\n }\n getToken(state)\n\n // parse key\n properties[key] = parseAssignment(state)\n }\n }\n while (state.token === ',') // eslint-disable-line no-unmodified-loop-condition\n\n if (state.token !== '}') {\n throw createSyntaxError(state, 'Comma , or bracket } expected after object value')\n }\n closeParams(state)\n getToken(state)\n\n let node = new ObjectNode(properties)\n\n // parse index parameters\n node = parseAccessors(state, node)\n\n return node\n }\n\n return parseNumber(state)\n }\n\n /**\n * parse a number\n * @return {Node} node\n * @private\n */\n function parseNumber (state) {\n let numberStr\n\n if (state.tokenType === TOKENTYPE.NUMBER) {\n // this is a number\n numberStr = state.token\n getToken(state)\n\n const numericType = safeNumberType(numberStr, config)\n const value = numeric(numberStr, numericType)\n\n return new ConstantNode(value)\n }\n\n return parseParentheses(state)\n }\n\n /**\n * parentheses\n * @return {Node} node\n * @private\n */\n function parseParentheses (state) {\n let node\n\n // check if it is a parenthesized expression\n if (state.token === '(') {\n // parentheses (...)\n openParams(state)\n getToken(state)\n\n node = parseAssignment(state) // start again\n\n if (state.token !== ')') {\n throw createSyntaxError(state, 'Parenthesis ) expected')\n }\n closeParams(state)\n getToken(state)\n\n node = new ParenthesisNode(node)\n node = parseAccessors(state, node)\n return node\n }\n\n return parseEnd(state)\n }\n\n /**\n * Evaluated when the expression is not yet ended but expected to end\n * @return {Node} res\n * @private\n */\n function parseEnd (state) {\n if (state.token === '') {\n // syntax error or unexpected end of expression\n throw createSyntaxError(state, 'Unexpected end of expression')\n } else {\n throw createSyntaxError(state, 'Value expected')\n }\n }\n\n /**\n * Shortcut for getting the current row value (one based)\n * Returns the line of the currently handled expression\n * @private\n */\n /* TODO: implement keeping track on the row number\n function row () {\n return null\n }\n */\n\n /**\n * Shortcut for getting the current col value (one based)\n * Returns the column (position) where the last state.token starts\n * @private\n */\n function col (state) {\n return state.index - state.token.length + 1\n }\n\n /**\n * Create an error\n * @param {Object} state\n * @param {string} message\n * @return {SyntaxError} instantiated error\n * @private\n */\n function createSyntaxError (state, message) {\n const c = col(state)\n const error = new SyntaxError(message + ' (char ' + c + ')')\n error.char = c\n\n return error\n }\n\n /**\n * Create an error\n * @param {Object} state\n * @param {string} message\n * @return {Error} instantiated error\n * @private\n */\n function createError (state, message) {\n const c = col(state)\n const error = new SyntaxError(message + ' (char ' + c + ')')\n error.char = c\n\n return error\n }\n\n // Now that we can parse, automatically convert strings to Nodes by parsing\n typed.addConversion({ from: 'string', to: 'Node', convert: parse })\n\n return parse\n})\n","import { deepMap } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'compile'\nconst dependencies = ['typed', 'parse']\n\nexport const createCompile = /* #__PURE__ */ factory(name, dependencies, ({ typed, parse }) => {\n /**\n * Parse and compile an expression.\n * Returns a an object with a function `evaluate([scope])` to evaluate the\n * compiled expression.\n *\n * Syntax:\n *\n * math.compile(expr) // returns one node\n * math.compile([expr1, expr2, expr3, ...]) // returns an array with nodes\n *\n * Examples:\n *\n * const code1 = math.compile('sqrt(3^2 + 4^2)')\n * code1.evaluate() // 5\n *\n * let scope = {a: 3, b: 4}\n * const code2 = math.compile('a * b') // 12\n * code2.evaluate(scope) // 12\n * scope.a = 5\n * code2.evaluate(scope) // 20\n *\n * const nodes = math.compile(['a = 3', 'b = 4', 'a * b'])\n * nodes[2].evaluate() // 12\n *\n * See also:\n *\n * parse, evaluate\n *\n * @param {string | string[] | Array | Matrix} expr\n * The expression to be compiled\n * @return {{evaluate: Function} | Array.<{evaluate: Function}>} code\n * An object with the compiled expression\n * @throws {Error}\n */\n return typed(name, {\n string: function (expr) {\n return parse(expr).compile()\n },\n\n 'Array | Matrix': function (expr) {\n return deepMap(expr, function (entry) {\n return parse(entry).compile()\n })\n }\n })\n})\n","import { deepMap } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\nimport { createEmptyMap } from '../../utils/map.js'\n\nconst name = 'evaluate'\nconst dependencies = ['typed', 'parse']\n\nexport const createEvaluate = /* #__PURE__ */ factory(name, dependencies, ({ typed, parse }) => {\n /**\n * Evaluate an expression.\n *\n * The expression parser does not use JavaScript. Its syntax is close\n * to JavaScript but more suited for mathematical expressions.\n * See [https://mathjs.org/docs/expressions/syntax.html](https://mathjs.org/docs/expressions/syntax.html) to learn\n * the syntax and get an overview of the exact differences from JavaScript.\n *\n * Note the evaluating arbitrary expressions may involve security risks,\n * see [https://mathjs.org/docs/expressions/security.html](https://mathjs.org/docs/expressions/security.html) for more information.\n *\n * Syntax:\n *\n * math.evaluate(expr)\n * math.evaluate(expr, scope)\n * math.evaluate([expr1, expr2, expr3, ...])\n * math.evaluate([expr1, expr2, expr3, ...], scope)\n *\n * Example:\n *\n * math.evaluate('(2+3)/4') // 1.25\n * math.evaluate('sqrt(3^2 + 4^2)') // 5\n * math.evaluate('sqrt(-4)') // 2i\n * math.evaluate(['a=3', 'b=4', 'a*b']) // [3, 4, 12]\n *\n * let scope = {a:3, b:4}\n * math.evaluate('a * b', scope) // 12\n *\n * See also:\n *\n * parse, compile\n *\n * @param {string | string[] | Matrix} expr The expression to be evaluated\n * @param {Object} [scope] Scope to read/write variables\n * @return {*} The result of the expression\n * @throws {Error}\n */\n return typed(name, {\n string: function (expr) {\n const scope = createEmptyMap()\n return parse(expr).compile().evaluate(scope)\n },\n\n 'string, Map | Object': function (expr, scope) {\n return parse(expr).compile().evaluate(scope)\n },\n\n 'Array | Matrix': function (expr) {\n const scope = createEmptyMap()\n return deepMap(expr, function (entry) {\n return parse(entry).compile().evaluate(scope)\n })\n },\n\n 'Array | Matrix, Map | Object': function (expr, scope) {\n return deepMap(expr, function (entry) {\n return parse(entry).compile().evaluate(scope)\n })\n }\n })\n})\n","import { factory } from '../utils/factory.js'\nimport { createEmptyMap, toObject } from '../utils/map.js'\n\nconst name = 'Parser'\nconst dependencies = ['evaluate', 'parse']\n\nexport const createParserClass = /* #__PURE__ */ factory(name, dependencies, ({ evaluate, parse }) => {\n /**\n * @constructor Parser\n * Parser contains methods to evaluate or parse expressions, and has a number\n * of convenience methods to get, set, and remove variables from memory. Parser\n * keeps a scope containing variables in memory, which is used for all\n * evaluations.\n *\n * Methods:\n * const result = parser.evaluate(expr) // evaluate an expression\n * const value = parser.get(name) // retrieve a variable from the parser\n * const values = parser.getAll() // retrieve all defined variables\n * parser.set(name, value) // set a variable in the parser\n * parser.remove(name) // clear a variable from the\n * // parsers scope\n * parser.clear() // clear the parsers scope\n *\n * Example usage:\n * const parser = new Parser()\n * // Note: there is a convenience method which can be used instead:\n * // const parser = new math.parser()\n *\n * // evaluate expressions\n * parser.evaluate('sqrt(3^2 + 4^2)') // 5\n * parser.evaluate('sqrt(-4)') // 2i\n * parser.evaluate('2 inch in cm') // 5.08 cm\n * parser.evaluate('cos(45 deg)') // 0.7071067811865476\n *\n * // define variables and functions\n * parser.evaluate('x = 7 / 2') // 3.5\n * parser.evaluate('x + 3') // 6.5\n * parser.evaluate('f(x, y) = x^y') // f(x, y)\n * parser.evaluate('f(2, 3)') // 8\n *\n * // get and set variables and functions\n * const x = parser.get('x') // 3.5\n * const f = parser.get('f') // function\n * const g = f(3, 2) // 9\n * parser.set('h', 500)\n * const i = parser.evaluate('h / 2') // 250\n * parser.set('hello', function (name) {\n * return 'hello, ' + name + '!'\n * })\n * parser.evaluate('hello(\"user\")') // \"hello, user!\"\n *\n * // clear defined functions and variables\n * parser.clear()\n *\n */\n function Parser () {\n if (!(this instanceof Parser)) {\n throw new SyntaxError(\n 'Constructor must be called with the new operator')\n }\n\n Object.defineProperty(this, 'scope', {\n value: createEmptyMap(),\n writable: false\n })\n }\n\n /**\n * Attach type information\n */\n Parser.prototype.type = 'Parser'\n Parser.prototype.isParser = true\n\n /**\n * Parse and evaluate the given expression\n * @param {string | string[]} expr A string containing an expression,\n * for example \"2+3\", or a list with expressions\n * @return {*} result The result, or undefined when the expression was empty\n * @throws {Error}\n */\n Parser.prototype.evaluate = function (expr) {\n // TODO: validate arguments\n return evaluate(expr, this.scope)\n }\n\n /**\n * Get a variable (a function or variable) by name from the parsers scope.\n * Returns undefined when not found\n * @param {string} name\n * @return {* | undefined} value\n */\n Parser.prototype.get = function (name) {\n // TODO: validate arguments\n if (this.scope.has(name)) {\n return this.scope.get(name)\n }\n }\n\n /**\n * Get a map with all defined variables\n * @return {Object} values\n */\n Parser.prototype.getAll = function () {\n return toObject(this.scope)\n }\n\n /**\n * Get a map with all defined variables\n * @return {Map} values\n */\n Parser.prototype.getAllAsMap = function () {\n return this.scope\n }\n\n function isValidVariableName (name) {\n if (name.length === 0) { return false }\n\n for (let i = 0; i < name.length; i++) {\n const cPrev = name.charAt(i - 1)\n const c = name.charAt(i)\n const cNext = name.charAt(i + 1)\n const valid = parse.isAlpha(c, cPrev, cNext) || (i > 0 && parse.isDigit(c))\n\n if (!valid) {\n return false\n }\n }\n\n return true\n }\n\n /**\n * Set a symbol (a function or variable) by name from the parsers scope.\n * @param {string} name\n * @param {* | undefined} value\n */\n Parser.prototype.set = function (name, value) {\n if (!isValidVariableName(name)) {\n throw new Error(`Invalid variable name: '${name}'. Variable names must follow the specified rules.`)\n }\n this.scope.set(name, value)\n return value\n }\n\n /**\n * Remove a variable from the parsers scope\n * @param {string} name\n */\n Parser.prototype.remove = function (name) {\n this.scope.delete(name)\n }\n\n /**\n * Clear the scope with variables and functions\n */\n Parser.prototype.clear = function () {\n this.scope.clear()\n }\n\n return Parser\n}, { isClass: true })\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'parser'\nconst dependencies = ['typed', 'Parser']\n\nexport const createParser = /* #__PURE__ */ factory(name, dependencies, ({ typed, Parser }) => {\n /**\n * Create a `math.Parser` object that keeps a context of variables and their values, allowing the evaluation of expressions in that context.\n *\n * Syntax:\n *\n * math.parser()\n *\n * Examples:\n *\n * const parser = new math.parser()\n *\n * // evaluate expressions\n * const a = parser.evaluate('sqrt(3^2 + 4^2)') // 5\n * const b = parser.evaluate('sqrt(-4)') // 2i\n * const c = parser.evaluate('2 inch in cm') // 5.08 cm\n * const d = parser.evaluate('cos(45 deg)') // 0.7071067811865476\n *\n * // define variables and functions\n * parser.evaluate('x = 7 / 2') // 3.5\n * parser.evaluate('x + 3') // 6.5\n * parser.evaluate('f(x, y) = x^y') // f(x, y)\n * parser.evaluate('f(2, 3)') // 8\n *\n * // get and set variables and functions\n * const x = parser.get('x') // 3.5\n * const f = parser.get('f') // function\n * const g = f(3, 2) // 9\n * parser.set('h', 500)\n * const i = parser.evaluate('h / 2') // 250\n * parser.set('hello', function (name) {\n * return 'hello, ' + name + '!'\n * })\n * parser.evaluate('hello(\"user\")') // \"hello, user!\"\n *\n * // clear defined functions and variables\n * parser.clear()\n *\n * See also:\n *\n * evaluate, compile, parse\n *\n * @return {Parser} Parser\n */\n return typed(name, {\n '': function () {\n return new Parser()\n }\n })\n})\n","import { clone } from '../../../utils/object.js'\nimport { factory } from '../../../utils/factory.js'\n\nconst name = 'lup'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'abs',\n 'addScalar',\n 'divideScalar',\n 'multiplyScalar',\n 'subtractScalar',\n 'larger',\n 'equalScalar',\n 'unaryMinus',\n 'DenseMatrix',\n 'SparseMatrix',\n 'Spa'\n]\n\nexport const createLup = /* #__PURE__ */ factory(name, dependencies, (\n {\n typed,\n matrix,\n abs,\n addScalar,\n divideScalar,\n multiplyScalar,\n subtractScalar,\n larger,\n equalScalar,\n unaryMinus,\n DenseMatrix,\n SparseMatrix,\n Spa\n }\n) => {\n /**\n * Calculate the Matrix LU decomposition with partial pivoting. Matrix `A` is decomposed in two matrices (`L`, `U`) and a\n * row permutation vector `p` where `A[p,:] = L * U`\n *\n * Syntax:\n *\n * math.lup(A)\n *\n * Example:\n *\n * const m = [[2, 1], [1, 4]]\n * const r = math.lup(m)\n * // r = {\n * // L: [[1, 0], [0.5, 1]],\n * // U: [[2, 1], [0, 3.5]],\n * // P: [0, 1]\n * // }\n *\n * See also:\n *\n * slu, lsolve, lusolve, usolve\n *\n * @param {Matrix | Array} A A two dimensional matrix or array for which to get the LUP decomposition.\n *\n * @return {{L: Array | Matrix, U: Array | Matrix, P: Array.}} The lower triangular matrix, the upper triangular matrix and the permutation matrix.\n */\n return typed(name, {\n\n DenseMatrix: function (m) {\n return _denseLUP(m)\n },\n\n SparseMatrix: function (m) {\n return _sparseLUP(m)\n },\n\n Array: function (a) {\n // create dense matrix from array\n const m = matrix(a)\n // lup, use matrix implementation\n const r = _denseLUP(m)\n // result\n return {\n L: r.L.valueOf(),\n U: r.U.valueOf(),\n p: r.p\n }\n }\n })\n\n function _denseLUP (m) {\n // rows & columns\n const rows = m._size[0]\n const columns = m._size[1]\n // minimum rows and columns\n let n = Math.min(rows, columns)\n // matrix array, clone original data\n const data = clone(m._data)\n // l matrix arrays\n const ldata = []\n const lsize = [rows, n]\n // u matrix arrays\n const udata = []\n const usize = [n, columns]\n // vars\n let i, j, k\n // permutation vector\n const p = []\n for (i = 0; i < rows; i++) { p[i] = i }\n // loop columns\n for (j = 0; j < columns; j++) {\n // skip first column in upper triangular matrix\n if (j > 0) {\n // loop rows\n for (i = 0; i < rows; i++) {\n // min i,j\n const min = Math.min(i, j)\n // v[i, j]\n let s = 0\n // loop up to min\n for (k = 0; k < min; k++) {\n // s = l[i, k] - data[k, j]\n s = addScalar(s, multiplyScalar(data[i][k], data[k][j]))\n }\n data[i][j] = subtractScalar(data[i][j], s)\n }\n }\n // row with larger value in cvector, row >= j\n let pi = j\n let pabsv = 0\n let vjj = 0\n // loop rows\n for (i = j; i < rows; i++) {\n // data @ i, j\n const v = data[i][j]\n // absolute value\n const absv = abs(v)\n // value is greater than pivote value\n if (larger(absv, pabsv)) {\n // store row\n pi = i\n // update max value\n pabsv = absv\n // value @ [j, j]\n vjj = v\n }\n }\n // swap rows (j <-> pi)\n if (j !== pi) {\n // swap values j <-> pi in p\n p[j] = [p[pi], p[pi] = p[j]][0]\n // swap j <-> pi in data\n DenseMatrix._swapRows(j, pi, data)\n }\n // check column is in lower triangular matrix\n if (j < rows) {\n // loop rows (lower triangular matrix)\n for (i = j + 1; i < rows; i++) {\n // value @ i, j\n const vij = data[i][j]\n if (!equalScalar(vij, 0)) {\n // update data\n data[i][j] = divideScalar(data[i][j], vjj)\n }\n }\n }\n }\n // loop columns\n for (j = 0; j < columns; j++) {\n // loop rows\n for (i = 0; i < rows; i++) {\n // initialize row in arrays\n if (j === 0) {\n // check row exists in upper triangular matrix\n if (i < columns) {\n // U\n udata[i] = []\n }\n // L\n ldata[i] = []\n }\n // check we are in the upper triangular matrix\n if (i < j) {\n // check row exists in upper triangular matrix\n if (i < columns) {\n // U\n udata[i][j] = data[i][j]\n }\n // check column exists in lower triangular matrix\n if (j < rows) {\n // L\n ldata[i][j] = 0\n }\n continue\n }\n // diagonal value\n if (i === j) {\n // check row exists in upper triangular matrix\n if (i < columns) {\n // U\n udata[i][j] = data[i][j]\n }\n // check column exists in lower triangular matrix\n if (j < rows) {\n // L\n ldata[i][j] = 1\n }\n continue\n }\n // check row exists in upper triangular matrix\n if (i < columns) {\n // U\n udata[i][j] = 0\n }\n // check column exists in lower triangular matrix\n if (j < rows) {\n // L\n ldata[i][j] = data[i][j]\n }\n }\n }\n // l matrix\n const l = new DenseMatrix({\n data: ldata,\n size: lsize\n })\n // u matrix\n const u = new DenseMatrix({\n data: udata,\n size: usize\n })\n // p vector\n const pv = []\n for (i = 0, n = p.length; i < n; i++) { pv[p[i]] = i }\n // return matrices\n return {\n L: l,\n U: u,\n p: pv,\n toString: function () {\n return 'L: ' + this.L.toString() + '\\nU: ' + this.U.toString() + '\\nP: ' + this.p\n }\n }\n }\n\n function _sparseLUP (m) {\n // rows & columns\n const rows = m._size[0]\n const columns = m._size[1]\n // minimum rows and columns\n const n = Math.min(rows, columns)\n // matrix arrays (will not be modified, thanks to permutation vector)\n const values = m._values\n const index = m._index\n const ptr = m._ptr\n // l matrix arrays\n const lvalues = []\n const lindex = []\n const lptr = []\n const lsize = [rows, n]\n // u matrix arrays\n const uvalues = []\n const uindex = []\n const uptr = []\n const usize = [n, columns]\n // vars\n let i, j, k\n // permutation vectors, (current index -> original index) and (original index -> current index)\n const pvCo = []\n const pvOc = []\n for (i = 0; i < rows; i++) {\n pvCo[i] = i\n pvOc[i] = i\n }\n // swap indices in permutation vectors (condition x < y)!\n const swapIndeces = function (x, y) {\n // find pv indeces getting data from x and y\n const kx = pvOc[x]\n const ky = pvOc[y]\n // update permutation vector current -> original\n pvCo[kx] = y\n pvCo[ky] = x\n // update permutation vector original -> current\n pvOc[x] = ky\n pvOc[y] = kx\n }\n // loop columns\n for (j = 0; j < columns; j++) {\n // sparse accumulator\n const spa = new Spa()\n // check lower triangular matrix has a value @ column j\n if (j < rows) {\n // update ptr\n lptr.push(lvalues.length)\n // first value in j column for lower triangular matrix\n lvalues.push(1)\n lindex.push(j)\n }\n // update ptr\n uptr.push(uvalues.length)\n // k0 <= k < k1 where k0 = _ptr[j] && k1 = _ptr[j+1]\n const k0 = ptr[j]\n const k1 = ptr[j + 1]\n // copy column j into sparse accumulator\n for (k = k0; k < k1; k++) {\n // row\n i = index[k]\n // copy column values into sparse accumulator (use permutation vector)\n spa.set(pvCo[i], values[k])\n }\n // skip first column in upper triangular matrix\n if (j > 0) {\n // loop rows in column j (above diagonal)\n spa.forEach(0, j - 1, function (k, vkj) {\n // loop rows in column k (L)\n SparseMatrix._forEachRow(k, lvalues, lindex, lptr, function (i, vik) {\n // check row is below k\n if (i > k) {\n // update spa value\n spa.accumulate(i, unaryMinus(multiplyScalar(vik, vkj)))\n }\n })\n })\n }\n // row with larger value in spa, row >= j\n let pi = j\n let vjj = spa.get(j)\n let pabsv = abs(vjj)\n // loop values in spa (order by row, below diagonal)\n spa.forEach(j + 1, rows - 1, function (x, v) {\n // absolute value\n const absv = abs(v)\n // value is greater than pivote value\n if (larger(absv, pabsv)) {\n // store row\n pi = x\n // update max value\n pabsv = absv\n // value @ [j, j]\n vjj = v\n }\n })\n // swap rows (j <-> pi)\n if (j !== pi) {\n // swap values j <-> pi in L\n SparseMatrix._swapRows(j, pi, lsize[1], lvalues, lindex, lptr)\n // swap values j <-> pi in U\n SparseMatrix._swapRows(j, pi, usize[1], uvalues, uindex, uptr)\n // swap values in spa\n spa.swap(j, pi)\n // update permutation vector (swap values @ j, pi)\n swapIndeces(j, pi)\n }\n // loop values in spa (order by row)\n spa.forEach(0, rows - 1, function (x, v) {\n // check we are above diagonal\n if (x <= j) {\n // update upper triangular matrix\n uvalues.push(v)\n uindex.push(x)\n } else {\n // update value\n v = divideScalar(v, vjj)\n // check value is non zero\n if (!equalScalar(v, 0)) {\n // update lower triangular matrix\n lvalues.push(v)\n lindex.push(x)\n }\n }\n })\n }\n // update ptrs\n uptr.push(uvalues.length)\n lptr.push(lvalues.length)\n\n // return matrices\n return {\n L: new SparseMatrix({\n values: lvalues,\n index: lindex,\n ptr: lptr,\n size: lsize\n }),\n U: new SparseMatrix({\n values: uvalues,\n index: uindex,\n ptr: uptr,\n size: usize\n }),\n p: pvCo,\n toString: function () {\n return 'L: ' + this.L.toString() + '\\nU: ' + this.U.toString() + '\\nP: ' + this.p\n }\n }\n }\n})\n","import { factory } from '../../../utils/factory.js'\n\nconst name = 'qr'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'zeros',\n 'identity',\n 'isZero',\n 'equal',\n 'sign',\n 'sqrt',\n 'conj',\n 'unaryMinus',\n 'addScalar',\n 'divideScalar',\n 'multiplyScalar',\n 'subtractScalar',\n 'complex'\n]\n\nexport const createQr = /* #__PURE__ */ factory(name, dependencies, (\n {\n typed,\n matrix,\n zeros,\n identity,\n isZero,\n equal,\n sign,\n sqrt,\n conj,\n unaryMinus,\n addScalar,\n divideScalar,\n multiplyScalar,\n subtractScalar,\n complex\n }\n) => {\n /**\n * Calculate the Matrix QR decomposition. Matrix `A` is decomposed in\n * two matrices (`Q`, `R`) where `Q` is an\n * orthogonal matrix and `R` is an upper triangular matrix.\n *\n * Syntax:\n *\n * math.qr(A)\n *\n * Example:\n *\n * const m = [\n * [1, -1, 4],\n * [1, 4, -2],\n * [1, 4, 2],\n * [1, -1, 0]\n * ]\n * const result = math.qr(m)\n * // r = {\n * // Q: [\n * // [0.5, -0.5, 0.5],\n * // [0.5, 0.5, -0.5],\n * // [0.5, 0.5, 0.5],\n * // [0.5, -0.5, -0.5],\n * // ],\n * // R: [\n * // [2, 3, 2],\n * // [0, 5, -2],\n * // [0, 0, 4],\n * // [0, 0, 0]\n * // ]\n * // }\n *\n * See also:\n *\n * lup, lusolve\n *\n * @param {Matrix | Array} A A two dimensional matrix or array\n * for which to get the QR decomposition.\n *\n * @return {{Q: Array | Matrix, R: Array | Matrix}} Q: the orthogonal\n * matrix and R: the upper triangular matrix\n */\n return Object.assign(typed(name, {\n\n DenseMatrix: function (m) {\n return _denseQR(m)\n },\n\n SparseMatrix: function (m) {\n return _sparseQR(m)\n },\n\n Array: function (a) {\n // create dense matrix from array\n const m = matrix(a)\n // lup, use matrix implementation\n const r = _denseQR(m)\n // result\n return {\n Q: r.Q.valueOf(),\n R: r.R.valueOf()\n }\n }\n }), { _denseQRimpl })\n\n function _denseQRimpl (m) {\n // rows & columns (m x n)\n const rows = m._size[0] // m\n const cols = m._size[1] // n\n\n const Q = identity([rows], 'dense')\n const Qdata = Q._data\n\n const R = m.clone()\n const Rdata = R._data\n\n // vars\n let i, j, k\n\n const w = zeros([rows], '')\n\n for (k = 0; k < Math.min(cols, rows); ++k) {\n /*\n * **k-th Household matrix**\n *\n * The matrix I - 2*v*transpose(v)\n * x = first column of A\n * x1 = first element of x\n * alpha = x1 / |x1| * |x|\n * e1 = tranpose([1, 0, 0, ...])\n * u = x - alpha * e1\n * v = u / |u|\n *\n * Household matrix = I - 2 * v * tranpose(v)\n *\n * * Initially Q = I and R = A.\n * * Household matrix is a reflection in a plane normal to v which\n * will zero out all but the top right element in R.\n * * Appplying reflection to both Q and R will not change product.\n * * Repeat this process on the (1,1) minor to get R as an upper\n * triangular matrix.\n * * Reflections leave the magnitude of the columns of Q unchanged\n * so Q remains othoganal.\n *\n */\n\n const pivot = Rdata[k][k]\n const sgn = unaryMinus(equal(pivot, 0) ? 1 : sign(pivot))\n const conjSgn = conj(sgn)\n\n let alphaSquared = 0\n\n for (i = k; i < rows; i++) {\n alphaSquared = addScalar(alphaSquared, multiplyScalar(Rdata[i][k], conj(Rdata[i][k])))\n }\n\n const alpha = multiplyScalar(sgn, sqrt(alphaSquared))\n\n if (!isZero(alpha)) {\n // first element in vector u\n const u1 = subtractScalar(pivot, alpha)\n\n // w = v * u1 / |u| (only elements k to (rows-1) are used)\n w[k] = 1\n\n for (i = k + 1; i < rows; i++) {\n w[i] = divideScalar(Rdata[i][k], u1)\n }\n\n // tau = - conj(u1 / alpha)\n const tau = unaryMinus(conj(divideScalar(u1, alpha)))\n\n let s\n\n /*\n * tau and w have been choosen so that\n *\n * 2 * v * tranpose(v) = tau * w * tranpose(w)\n */\n\n /*\n * -- calculate R = R - tau * w * tranpose(w) * R --\n * Only do calculation with rows k to (rows-1)\n * Additionally columns 0 to (k-1) will not be changed by this\n * multiplication so do not bother recalculating them\n */\n for (j = k; j < cols; j++) {\n s = 0.0\n\n // calculate jth element of [tranpose(w) * R]\n for (i = k; i < rows; i++) {\n s = addScalar(s, multiplyScalar(conj(w[i]), Rdata[i][j]))\n }\n\n // calculate the jth element of [tau * transpose(w) * R]\n s = multiplyScalar(s, tau)\n\n for (i = k; i < rows; i++) {\n Rdata[i][j] = multiplyScalar(\n subtractScalar(Rdata[i][j], multiplyScalar(w[i], s)),\n conjSgn\n )\n }\n }\n /*\n * -- calculate Q = Q - tau * Q * w * transpose(w) --\n * Q is a square matrix (rows x rows)\n * Only do calculation with columns k to (rows-1)\n * Additionally rows 0 to (k-1) will not be changed by this\n * multiplication so do not bother recalculating them\n */\n for (i = 0; i < rows; i++) {\n s = 0.0\n\n // calculate ith element of [Q * w]\n for (j = k; j < rows; j++) {\n s = addScalar(s, multiplyScalar(Qdata[i][j], w[j]))\n }\n\n // calculate the ith element of [tau * Q * w]\n s = multiplyScalar(s, tau)\n\n for (j = k; j < rows; ++j) {\n Qdata[i][j] = divideScalar(\n subtractScalar(Qdata[i][j], multiplyScalar(s, conj(w[j]))),\n conjSgn\n )\n }\n }\n }\n }\n\n // return matrices\n return {\n Q,\n R,\n toString: function () {\n return 'Q: ' + this.Q.toString() + '\\nR: ' + this.R.toString()\n }\n }\n }\n\n function _denseQR (m) {\n const ret = _denseQRimpl(m)\n const Rdata = ret.R._data\n if (m._data.length > 0) {\n const zero = Rdata[0][0].type === 'Complex' ? complex(0) : 0\n\n for (let i = 0; i < Rdata.length; ++i) {\n for (let j = 0; j < i && j < (Rdata[0] || []).length; ++j) {\n Rdata[i][j] = zero\n }\n }\n }\n\n return ret\n }\n\n function _sparseQR (m) {\n throw new Error('qr not implemented for sparse matrices yet')\n }\n})\n","// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.\n// SPDX-License-Identifier: LGPL-2.1+\n// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source\n\n/**\n * Depth-first search and postorder of a tree rooted at node j\n *\n * @param {Number} j The tree node\n * @param {Number} k\n * @param {Array} w The workspace array\n * @param {Number} head The index offset within the workspace for the head array\n * @param {Number} next The index offset within the workspace for the next array\n * @param {Array} post The post ordering array\n * @param {Number} stack The index offset within the workspace for the stack array\n */\nexport function csTdfs (j, k, w, head, next, post, stack) {\n // variables\n let top = 0\n // place j on the stack\n w[stack] = j\n // while (stack is not empty)\n while (top >= 0) {\n // p = top of stack\n const p = w[stack + top]\n // i = youngest child of p\n const i = w[head + p]\n if (i === -1) {\n // p has no unordered children left\n top--\n // node p is the kth postordered node\n post[k++] = p\n } else {\n // remove i from children of p\n w[head + p] = w[next + i]\n // increment top\n ++top\n // start dfs on child node i\n w[stack + top] = i\n }\n }\n return k\n}\n","// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.\n// SPDX-License-Identifier: LGPL-2.1+\n// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source\n\n/**\n * This function \"flips\" its input about the integer -1.\n *\n * @param {Number} i The value to flip\n */\nexport function csFlip (i) {\n // flip the value\n return -i - 2\n}\n","// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.\n// SPDX-License-Identifier: LGPL-2.1+\n// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source\nimport { factory } from '../../../utils/factory.js'\nimport { csFkeep } from './csFkeep.js'\nimport { csFlip } from './csFlip.js'\nimport { csTdfs } from './csTdfs.js'\n\nconst name = 'csAmd'\nconst dependencies = [\n 'add',\n 'multiply',\n 'transpose'\n]\n\nexport const createCsAmd = /* #__PURE__ */ factory(name, dependencies, ({ add, multiply, transpose }) => {\n /**\n * Approximate minimum degree ordering. The minimum degree algorithm is a widely used\n * heuristic for finding a permutation P so that P*A*P' has fewer nonzeros in its factorization\n * than A. It is a gready method that selects the sparsest pivot row and column during the course\n * of a right looking sparse Cholesky factorization.\n *\n * @param {Number} order 0: Natural, 1: Cholesky, 2: LU, 3: QR\n * @param {Matrix} m Sparse Matrix\n */\n return function csAmd (order, a) {\n // check input parameters\n if (!a || order <= 0 || order > 3) { return null }\n // a matrix arrays\n const asize = a._size\n // rows and columns\n const m = asize[0]\n const n = asize[1]\n // initialize vars\n let lemax = 0\n // dense threshold\n let dense = Math.max(16, 10 * Math.sqrt(n))\n dense = Math.min(n - 2, dense)\n // create target matrix C\n const cm = _createTargetMatrix(order, a, m, n, dense)\n // drop diagonal entries\n csFkeep(cm, _diag, null)\n // C matrix arrays\n const cindex = cm._index\n const cptr = cm._ptr\n\n // number of nonzero elements in C\n let cnz = cptr[n]\n\n // allocate result (n+1)\n const P = []\n\n // create workspace (8 * (n + 1))\n const W = []\n const len = 0 // first n + 1 entries\n const nv = n + 1 // next n + 1 entries\n const next = 2 * (n + 1) // next n + 1 entries\n const head = 3 * (n + 1) // next n + 1 entries\n const elen = 4 * (n + 1) // next n + 1 entries\n const degree = 5 * (n + 1) // next n + 1 entries\n const w = 6 * (n + 1) // next n + 1 entries\n const hhead = 7 * (n + 1) // last n + 1 entries\n\n // use P as workspace for last\n const last = P\n\n // initialize quotient graph\n let mark = _initializeQuotientGraph(n, cptr, W, len, head, last, next, hhead, nv, w, elen, degree)\n\n // initialize degree lists\n let nel = _initializeDegreeLists(n, cptr, W, degree, elen, w, dense, nv, head, last, next)\n\n // minimum degree node\n let mindeg = 0\n\n // vars\n let i, j, k, k1, k2, e, pj, ln, nvi, pk, eln, p1, p2, pn, h, d\n\n // while (selecting pivots) do\n while (nel < n) {\n // select node of minimum approximate degree. amd() is now ready to start eliminating the graph. It first\n // finds a node k of minimum degree and removes it from its degree list. The variable nel keeps track of thow\n // many nodes have been eliminated.\n for (k = -1; mindeg < n && (k = W[head + mindeg]) === -1; mindeg++);\n if (W[next + k] !== -1) { last[W[next + k]] = -1 }\n // remove k from degree list\n W[head + mindeg] = W[next + k]\n // elenk = |Ek|\n const elenk = W[elen + k]\n // # of nodes k represents\n let nvk = W[nv + k]\n // W[nv + k] nodes of A eliminated\n nel += nvk\n\n // Construct a new element. The new element Lk is constructed in place if |Ek| = 0. nv[i] is\n // negated for all nodes i in Lk to flag them as members of this set. Each node i is removed from the\n // degree lists. All elements e in Ek are absorved into element k.\n let dk = 0\n // flag k as in Lk\n W[nv + k] = -nvk\n let p = cptr[k]\n // do in place if W[elen + k] === 0\n const pk1 = (elenk === 0) ? p : cnz\n let pk2 = pk1\n for (k1 = 1; k1 <= elenk + 1; k1++) {\n if (k1 > elenk) {\n // search the nodes in k\n e = k\n // list of nodes starts at cindex[pj]\n pj = p\n // length of list of nodes in k\n ln = W[len + k] - elenk\n } else {\n // search the nodes in e\n e = cindex[p++]\n pj = cptr[e]\n // length of list of nodes in e\n ln = W[len + e]\n }\n for (k2 = 1; k2 <= ln; k2++) {\n i = cindex[pj++]\n // check node i dead, or seen\n if ((nvi = W[nv + i]) <= 0) { continue }\n // W[degree + Lk] += size of node i\n dk += nvi\n // negate W[nv + i] to denote i in Lk\n W[nv + i] = -nvi\n // place i in Lk\n cindex[pk2++] = i\n if (W[next + i] !== -1) { last[W[next + i]] = last[i] }\n // check we need to remove i from degree list\n if (last[i] !== -1) { W[next + last[i]] = W[next + i] } else { W[head + W[degree + i]] = W[next + i] }\n }\n if (e !== k) {\n // absorb e into k\n cptr[e] = csFlip(k)\n // e is now a dead element\n W[w + e] = 0\n }\n }\n // cindex[cnz...nzmax] is free\n if (elenk !== 0) { cnz = pk2 }\n // external degree of k - |Lk\\i|\n W[degree + k] = dk\n // element k is in cindex[pk1..pk2-1]\n cptr[k] = pk1\n W[len + k] = pk2 - pk1\n // k is now an element\n W[elen + k] = -2\n\n // Find set differences. The scan1 function now computes the set differences |Le \\ Lk| for all elements e. At the start of the\n // scan, no entry in the w array is greater than or equal to mark.\n\n // clear w if necessary\n mark = _wclear(mark, lemax, W, w, n)\n // scan 1: find |Le\\Lk|\n for (pk = pk1; pk < pk2; pk++) {\n i = cindex[pk]\n // check if W[elen + i] empty, skip it\n if ((eln = W[elen + i]) <= 0) { continue }\n // W[nv + i] was negated\n nvi = -W[nv + i]\n const wnvi = mark - nvi\n // scan Ei\n for (p = cptr[i], p1 = cptr[i] + eln - 1; p <= p1; p++) {\n e = cindex[p]\n if (W[w + e] >= mark) {\n // decrement |Le\\Lk|\n W[w + e] -= nvi\n } else if (W[w + e] !== 0) {\n // ensure e is a live element, 1st time e seen in scan 1\n W[w + e] = W[degree + e] + wnvi\n }\n }\n }\n\n // degree update\n // The second pass computes the approximate degree di, prunes the sets Ei and Ai, and computes a hash\n // function h(i) for all nodes in Lk.\n\n // scan2: degree update\n for (pk = pk1; pk < pk2; pk++) {\n // consider node i in Lk\n i = cindex[pk]\n p1 = cptr[i]\n p2 = p1 + W[elen + i] - 1\n pn = p1\n // scan Ei\n for (h = 0, d = 0, p = p1; p <= p2; p++) {\n e = cindex[p]\n // check e is an unabsorbed element\n if (W[w + e] !== 0) {\n // dext = |Le\\Lk|\n const dext = W[w + e] - mark\n if (dext > 0) {\n // sum up the set differences\n d += dext\n // keep e in Ei\n cindex[pn++] = e\n // compute the hash of node i\n h += e\n } else {\n // aggressive absorb. e->k\n cptr[e] = csFlip(k)\n // e is a dead element\n W[w + e] = 0\n }\n }\n }\n // W[elen + i] = |Ei|\n W[elen + i] = pn - p1 + 1\n const p3 = pn\n const p4 = p1 + W[len + i]\n // prune edges in Ai\n for (p = p2 + 1; p < p4; p++) {\n j = cindex[p]\n // check node j dead or in Lk\n const nvj = W[nv + j]\n if (nvj <= 0) { continue }\n // degree(i) += |j|\n d += nvj\n // place j in node list of i\n cindex[pn++] = j\n // compute hash for node i\n h += j\n }\n // check for mass elimination\n if (d === 0) {\n // absorb i into k\n cptr[i] = csFlip(k)\n nvi = -W[nv + i]\n // |Lk| -= |i|\n dk -= nvi\n // |k| += W[nv + i]\n nvk += nvi\n nel += nvi\n W[nv + i] = 0\n // node i is dead\n W[elen + i] = -1\n } else {\n // update degree(i)\n W[degree + i] = Math.min(W[degree + i], d)\n // move first node to end\n cindex[pn] = cindex[p3]\n // move 1st el. to end of Ei\n cindex[p3] = cindex[p1]\n // add k as 1st element in of Ei\n cindex[p1] = k\n // new len of adj. list of node i\n W[len + i] = pn - p1 + 1\n // finalize hash of i\n h = (h < 0 ? -h : h) % n\n // place i in hash bucket\n W[next + i] = W[hhead + h]\n W[hhead + h] = i\n // save hash of i in last[i]\n last[i] = h\n }\n }\n // finalize |Lk|\n W[degree + k] = dk\n lemax = Math.max(lemax, dk)\n // clear w\n mark = _wclear(mark + lemax, lemax, W, w, n)\n\n // Supernode detection. Supernode detection relies on the hash function h(i) computed for each node i.\n // If two nodes have identical adjacency lists, their hash functions wil be identical.\n for (pk = pk1; pk < pk2; pk++) {\n i = cindex[pk]\n // check i is dead, skip it\n if (W[nv + i] >= 0) { continue }\n // scan hash bucket of node i\n h = last[i]\n i = W[hhead + h]\n // hash bucket will be empty\n W[hhead + h] = -1\n for (; i !== -1 && W[next + i] !== -1; i = W[next + i], mark++) {\n ln = W[len + i]\n eln = W[elen + i]\n for (p = cptr[i] + 1; p <= cptr[i] + ln - 1; p++) { W[w + cindex[p]] = mark }\n let jlast = i\n // compare i with all j\n for (j = W[next + i]; j !== -1;) {\n let ok = W[len + j] === ln && W[elen + j] === eln\n for (p = cptr[j] + 1; ok && p <= cptr[j] + ln - 1; p++) {\n // compare i and j\n if (W[w + cindex[p]] !== mark) { ok = 0 }\n }\n // check i and j are identical\n if (ok) {\n // absorb j into i\n cptr[j] = csFlip(i)\n W[nv + i] += W[nv + j]\n W[nv + j] = 0\n // node j is dead\n W[elen + j] = -1\n // delete j from hash bucket\n j = W[next + j]\n W[next + jlast] = j\n } else {\n // j and i are different\n jlast = j\n j = W[next + j]\n }\n }\n }\n }\n\n // Finalize new element. The elimination of node k is nearly complete. All nodes i in Lk are scanned one last time.\n // Node i is removed from Lk if it is dead. The flagged status of nv[i] is cleared.\n for (p = pk1, pk = pk1; pk < pk2; pk++) {\n i = cindex[pk]\n // check i is dead, skip it\n if ((nvi = -W[nv + i]) <= 0) { continue }\n // restore W[nv + i]\n W[nv + i] = nvi\n // compute external degree(i)\n d = W[degree + i] + dk - nvi\n d = Math.min(d, n - nel - nvi)\n if (W[head + d] !== -1) { last[W[head + d]] = i }\n // put i back in degree list\n W[next + i] = W[head + d]\n last[i] = -1\n W[head + d] = i\n // find new minimum degree\n mindeg = Math.min(mindeg, d)\n W[degree + i] = d\n // place i in Lk\n cindex[p++] = i\n }\n // # nodes absorbed into k\n W[nv + k] = nvk\n // length of adj list of element k\n if ((W[len + k] = p - pk1) === 0) {\n // k is a root of the tree\n cptr[k] = -1\n // k is now a dead element\n W[w + k] = 0\n }\n if (elenk !== 0) {\n // free unused space in Lk\n cnz = p\n }\n }\n\n // Postordering. The elimination is complete, but no permutation has been computed. All that is left\n // of the graph is the assembly tree (ptr) and a set of dead nodes and elements (i is a dead node if\n // nv[i] is zero and a dead element if nv[i] > 0). It is from this information only that the final permutation\n // is computed. The tree is restored by unflipping all of ptr.\n\n // fix assembly tree\n for (i = 0; i < n; i++) { cptr[i] = csFlip(cptr[i]) }\n for (j = 0; j <= n; j++) { W[head + j] = -1 }\n // place unordered nodes in lists\n for (j = n; j >= 0; j--) {\n // skip if j is an element\n if (W[nv + j] > 0) { continue }\n // place j in list of its parent\n W[next + j] = W[head + cptr[j]]\n W[head + cptr[j]] = j\n }\n // place elements in lists\n for (e = n; e >= 0; e--) {\n // skip unless e is an element\n if (W[nv + e] <= 0) { continue }\n if (cptr[e] !== -1) {\n // place e in list of its parent\n W[next + e] = W[head + cptr[e]]\n W[head + cptr[e]] = e\n }\n }\n // postorder the assembly tree\n for (k = 0, i = 0; i <= n; i++) {\n if (cptr[i] === -1) { k = csTdfs(i, k, W, head, next, P, w) }\n }\n // remove last item in array\n P.splice(P.length - 1, 1)\n // return P\n return P\n }\n\n /**\n * Creates the matrix that will be used by the approximate minimum degree ordering algorithm. The function accepts the matrix M as input and returns a permutation\n * vector P. The amd algorithm operates on a symmetrix matrix, so one of three symmetric matrices is formed.\n *\n * Order: 0\n * A natural ordering P=null matrix is returned.\n *\n * Order: 1\n * Matrix must be square. This is appropriate for a Cholesky or LU factorization.\n * P = M + M'\n *\n * Order: 2\n * Dense columns from M' are dropped, M recreated from M'. This is appropriatefor LU factorization of unsymmetric matrices.\n * P = M' * M\n *\n * Order: 3\n * This is best used for QR factorization or LU factorization is matrix M has no dense rows. A dense row is a row with more than 10*sqr(columns) entries.\n * P = M' * M\n */\n function _createTargetMatrix (order, a, m, n, dense) {\n // compute A'\n const at = transpose(a)\n\n // check order = 1, matrix must be square\n if (order === 1 && n === m) {\n // C = A + A'\n return add(a, at)\n }\n\n // check order = 2, drop dense columns from M'\n if (order === 2) {\n // transpose arrays\n const tindex = at._index\n const tptr = at._ptr\n // new column index\n let p2 = 0\n // loop A' columns (rows)\n for (let j = 0; j < m; j++) {\n // column j of AT starts here\n let p = tptr[j]\n // new column j starts here\n tptr[j] = p2\n // skip dense col j\n if (tptr[j + 1] - p > dense) { continue }\n // map rows in column j of A\n for (const p1 = tptr[j + 1]; p < p1; p++) { tindex[p2++] = tindex[p] }\n }\n // finalize AT\n tptr[m] = p2\n // recreate A from new transpose matrix\n a = transpose(at)\n // use A' * A\n return multiply(at, a)\n }\n\n // use A' * A, square or rectangular matrix\n return multiply(at, a)\n }\n\n /**\n * Initialize quotient graph. There are four kind of nodes and elements that must be represented:\n *\n * - A live node is a node i (or a supernode) that has not been selected as a pivot nad has not been merged into another supernode.\n * - A dead node i is one that has been removed from the graph, having been absorved into r = flip(ptr[i]).\n * - A live element e is one that is in the graph, having been formed when node e was selected as the pivot.\n * - A dead element e is one that has benn absorved into a subsequent element s = flip(ptr[e]).\n */\n function _initializeQuotientGraph (n, cptr, W, len, head, last, next, hhead, nv, w, elen, degree) {\n // Initialize quotient graph\n for (let k = 0; k < n; k++) { W[len + k] = cptr[k + 1] - cptr[k] }\n W[len + n] = 0\n // initialize workspace\n for (let i = 0; i <= n; i++) {\n // degree list i is empty\n W[head + i] = -1\n last[i] = -1\n W[next + i] = -1\n // hash list i is empty\n W[hhead + i] = -1\n // node i is just one node\n W[nv + i] = 1\n // node i is alive\n W[w + i] = 1\n // Ek of node i is empty\n W[elen + i] = 0\n // degree of node i\n W[degree + i] = W[len + i]\n }\n // clear w\n const mark = _wclear(0, 0, W, w, n)\n // n is a dead element\n W[elen + n] = -2\n // n is a root of assembly tree\n cptr[n] = -1\n // n is a dead element\n W[w + n] = 0\n // return mark\n return mark\n }\n\n /**\n * Initialize degree lists. Each node is placed in its degree lists. Nodes of zero degree are eliminated immediately. Nodes with\n * degree >= dense are alsol eliminated and merged into a placeholder node n, a dead element. Thes nodes will appera last in the\n * output permutation p.\n */\n function _initializeDegreeLists (n, cptr, W, degree, elen, w, dense, nv, head, last, next) {\n // result\n let nel = 0\n // loop columns\n for (let i = 0; i < n; i++) {\n // degree @ i\n const d = W[degree + i]\n // check node i is empty\n if (d === 0) {\n // element i is dead\n W[elen + i] = -2\n nel++\n // i is a root of assembly tree\n cptr[i] = -1\n W[w + i] = 0\n } else if (d > dense) {\n // absorb i into element n\n W[nv + i] = 0\n // node i is dead\n W[elen + i] = -1\n nel++\n cptr[i] = csFlip(n)\n W[nv + n]++\n } else {\n const h = W[head + d]\n if (h !== -1) { last[h] = i }\n // put node i in degree list d\n W[next + i] = W[head + d]\n W[head + d] = i\n }\n }\n return nel\n }\n\n function _wclear (mark, lemax, W, w, n) {\n if (mark < 2 || (mark + lemax < 0)) {\n for (let k = 0; k < n; k++) {\n if (W[w + k] !== 0) { W[w + k] = 1 }\n }\n mark = 2\n }\n // at this point, W [0..n-1] < mark holds\n return mark\n }\n\n function _diag (i, j) {\n return i !== j\n }\n})\n","// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.\n// SPDX-License-Identifier: LGPL-2.1+\n// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source\n\n/**\n * Keeps entries in the matrix when the callback function returns true, removes the entry otherwise\n *\n * @param {Matrix} a The sparse matrix\n * @param {function} callback The callback function, function will be invoked with the following args:\n * - The entry row\n * - The entry column\n * - The entry value\n * - The state parameter\n * @param {any} other The state\n *\n * @return The number of nonzero elements in the matrix\n */\nexport function csFkeep (a, callback, other) {\n // a arrays\n const avalues = a._values\n const aindex = a._index\n const aptr = a._ptr\n const asize = a._size\n // columns\n const n = asize[1]\n // nonzero items\n let nz = 0\n // loop columns\n for (let j = 0; j < n; j++) {\n // get current location of col j\n let p = aptr[j]\n // record new location of col j\n aptr[j] = nz\n for (; p < aptr[j + 1]; p++) {\n // check we need to keep this item\n if (callback(aindex[p], j, avalues ? avalues[p] : 1, other)) {\n // keep A(i,j)\n aindex[nz] = aindex[p]\n // check we need to process values (pattern only)\n if (avalues) { avalues[nz] = avalues[p] }\n // increment nonzero items\n nz++\n }\n }\n }\n // finalize A\n aptr[n] = nz\n // trim arrays\n aindex.splice(nz, aindex.length - nz)\n // check we need to process values (pattern only)\n if (avalues) { avalues.splice(nz, avalues.length - nz) }\n // return number of nonzero items\n return nz\n}\n","// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.\n// SPDX-License-Identifier: LGPL-2.1+\n// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source\n\n/**\n * This function determines if j is a leaf of the ith row subtree.\n * Consider A(i,j), node j in ith row subtree and return lca(jprev,j)\n *\n * @param {Number} i The ith row subtree\n * @param {Number} j The node to test\n * @param {Array} w The workspace array\n * @param {Number} first The index offset within the workspace for the first array\n * @param {Number} maxfirst The index offset within the workspace for the maxfirst array\n * @param {Number} prevleaf The index offset within the workspace for the prevleaf array\n * @param {Number} ancestor The index offset within the workspace for the ancestor array\n *\n * @return {Object}\n */\nexport function csLeaf (i, j, w, first, maxfirst, prevleaf, ancestor) {\n let s, sparent\n\n // our result\n let jleaf = 0\n let q\n\n // check j is a leaf\n if (i <= j || w[first + j] <= w[maxfirst + i]) { return (-1) }\n // update max first[j] seen so far\n w[maxfirst + i] = w[first + j]\n // jprev = previous leaf of ith subtree\n const jprev = w[prevleaf + i]\n w[prevleaf + i] = j\n\n // check j is first or subsequent leaf\n if (jprev === -1) {\n // 1st leaf, q = root of ith subtree\n jleaf = 1\n q = i\n } else {\n // update jleaf\n jleaf = 2\n // q = least common ancester (jprev,j)\n for (q = jprev; q !== w[ancestor + q]; q = w[ancestor + q]);\n for (s = jprev; s !== q; s = sparent) {\n // path compression\n sparent = w[ancestor + s]\n w[ancestor + s] = q\n }\n }\n return { jleaf, q }\n}\n","// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.\n// SPDX-License-Identifier: LGPL-2.1+\n// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source\nimport { factory } from '../../../utils/factory.js'\nimport { csLeaf } from './csLeaf.js'\n\nconst name = 'csCounts'\nconst dependencies = [\n 'transpose'\n]\n\nexport const createCsCounts = /* #__PURE__ */ factory(name, dependencies, ({ transpose }) => {\n /**\n * Computes the column counts using the upper triangular part of A.\n * It transposes A internally, none of the input parameters are modified.\n *\n * @param {Matrix} a The sparse matrix A\n *\n * @param {Matrix} ata Count the columns of A'A instead\n *\n * @return An array of size n of the column counts or null on error\n */\n return function (a, parent, post, ata) {\n // check inputs\n if (!a || !parent || !post) { return null }\n // a matrix arrays\n const asize = a._size\n // rows and columns\n const m = asize[0]\n const n = asize[1]\n // variables\n let i, j, k, J, p, p0, p1\n\n // workspace size\n const s = 4 * n + (ata ? (n + m + 1) : 0)\n // allocate workspace\n const w = [] // (s)\n const ancestor = 0 // first n entries\n const maxfirst = n // next n entries\n const prevleaf = 2 * n // next n entries\n const first = 3 * n // next n entries\n const head = 4 * n // next n + 1 entries (used when ata is true)\n const next = 5 * n + 1 // last entries in workspace\n // clear workspace w[0..s-1]\n for (k = 0; k < s; k++) { w[k] = -1 }\n\n // allocate result\n const colcount = [] // (n)\n\n // AT = A'\n const at = transpose(a)\n // at arrays\n const tindex = at._index\n const tptr = at._ptr\n\n // find w[first + j]\n for (k = 0; k < n; k++) {\n j = post[k]\n // colcount[j]=1 if j is a leaf\n colcount[j] = (w[first + j] === -1) ? 1 : 0\n for (; j !== -1 && w[first + j] === -1; j = parent[j]) { w[first + j] = k }\n }\n\n // initialize ata if needed\n if (ata) {\n // invert post\n for (k = 0; k < n; k++) { w[post[k]] = k }\n // loop rows (columns in AT)\n for (i = 0; i < m; i++) {\n // values in column i of AT\n for (k = n, p0 = tptr[i], p1 = tptr[i + 1], p = p0; p < p1; p++) { k = Math.min(k, w[tindex[p]]) }\n // place row i in linked list k\n w[next + i] = w[head + k]\n w[head + k] = i\n }\n }\n\n // each node in its own set\n for (i = 0; i < n; i++) { w[ancestor + i] = i }\n\n for (k = 0; k < n; k++) {\n // j is the kth node in postordered etree\n j = post[k]\n // check j is not a root\n if (parent[j] !== -1) { colcount[parent[j]]-- }\n\n // J=j for LL'=A case\n for (J = (ata ? w[head + k] : j); J !== -1; J = (ata ? w[next + J] : -1)) {\n for (p = tptr[J]; p < tptr[J + 1]; p++) {\n i = tindex[p]\n const r = csLeaf(i, j, w, first, maxfirst, prevleaf, ancestor)\n // check A(i,j) is in skeleton\n if (r.jleaf >= 1) { colcount[j]++ }\n // check account for overlap in q\n if (r.jleaf === 2) { colcount[r.q]-- }\n }\n }\n if (parent[j] !== -1) { w[ancestor + j] = parent[j] }\n }\n // sum up colcount's of each child\n for (j = 0; j < n; j++) {\n if (parent[j] !== -1) { colcount[parent[j]] += colcount[j] }\n }\n return colcount\n }\n})\n","// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.\n// SPDX-License-Identifier: LGPL-2.1+\n// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source\nimport { csPermute } from './csPermute.js'\nimport { csPost } from './csPost.js'\nimport { csEtree } from './csEtree.js'\nimport { createCsAmd } from './csAmd.js'\nimport { createCsCounts } from './csCounts.js'\nimport { factory } from '../../../utils/factory.js'\n\nconst name = 'csSqr'\nconst dependencies = [\n 'add',\n 'multiply',\n 'transpose'\n]\n\nexport const createCsSqr = /* #__PURE__ */ factory(name, dependencies, ({ add, multiply, transpose }) => {\n const csAmd = createCsAmd({ add, multiply, transpose })\n const csCounts = createCsCounts({ transpose })\n\n /**\n * Symbolic ordering and analysis for QR and LU decompositions.\n *\n * @param {Number} order The ordering strategy (see csAmd for more details)\n * @param {Matrix} a The A matrix\n * @param {boolean} qr Symbolic ordering and analysis for QR decomposition (true) or\n * symbolic ordering and analysis for LU decomposition (false)\n *\n * @return {Object} The Symbolic ordering and analysis for matrix A\n */\n return function csSqr (order, a, qr) {\n // a arrays\n const aptr = a._ptr\n const asize = a._size\n // columns\n const n = asize[1]\n // vars\n let k\n // symbolic analysis result\n const s = {}\n // fill-reducing ordering\n s.q = csAmd(order, a)\n // validate results\n if (order && !s.q) { return null }\n // QR symbolic analysis\n if (qr) {\n // apply permutations if needed\n const c = order ? csPermute(a, null, s.q, 0) : a\n // etree of C'*C, where C=A(:,q)\n s.parent = csEtree(c, 1)\n // post order elimination tree\n const post = csPost(s.parent, n)\n // col counts chol(C'*C)\n s.cp = csCounts(c, s.parent, post, 1)\n // check we have everything needed to calculate number of nonzero elements\n if (c && s.parent && s.cp && _vcount(c, s)) {\n // calculate number of nonzero elements\n for (s.unz = 0, k = 0; k < n; k++) { s.unz += s.cp[k] }\n }\n } else {\n // for LU factorization only, guess nnz(L) and nnz(U)\n s.unz = 4 * (aptr[n]) + n\n s.lnz = s.unz\n }\n // return result S\n return s\n }\n\n /**\n * Compute nnz(V) = s.lnz, s.pinv, s.leftmost, s.m2 from A and s.parent\n */\n function _vcount (a, s) {\n // a arrays\n const aptr = a._ptr\n const aindex = a._index\n const asize = a._size\n // rows & columns\n const m = asize[0]\n const n = asize[1]\n // initialize s arrays\n s.pinv = [] // (m + n)\n s.leftmost = [] // (m)\n // vars\n const parent = s.parent\n const pinv = s.pinv\n const leftmost = s.leftmost\n // workspace, next: first m entries, head: next n entries, tail: next n entries, nque: next n entries\n const w = [] // (m + 3 * n)\n const next = 0\n const head = m\n const tail = m + n\n const nque = m + 2 * n\n // vars\n let i, k, p, p0, p1\n // initialize w\n for (k = 0; k < n; k++) {\n // queue k is empty\n w[head + k] = -1\n w[tail + k] = -1\n w[nque + k] = 0\n }\n // initialize row arrays\n for (i = 0; i < m; i++) { leftmost[i] = -1 }\n // loop columns backwards\n for (k = n - 1; k >= 0; k--) {\n // values & index for column k\n for (p0 = aptr[k], p1 = aptr[k + 1], p = p0; p < p1; p++) {\n // leftmost[i] = min(find(A(i,:)))\n leftmost[aindex[p]] = k\n }\n }\n // scan rows in reverse order\n for (i = m - 1; i >= 0; i--) {\n // row i is not yet ordered\n pinv[i] = -1\n k = leftmost[i]\n // check row i is empty\n if (k === -1) { continue }\n // first row in queue k\n if (w[nque + k]++ === 0) { w[tail + k] = i }\n // put i at head of queue k\n w[next + i] = w[head + k]\n w[head + k] = i\n }\n s.lnz = 0\n s.m2 = m\n // find row permutation and nnz(V)\n for (k = 0; k < n; k++) {\n // remove row i from queue k\n i = w[head + k]\n // count V(k,k) as nonzero\n s.lnz++\n // add a fictitious row\n if (i < 0) { i = s.m2++ }\n // associate row i with V(:,k)\n pinv[i] = k\n // skip if V(k+1:m,k) is empty\n if (--nque[k] <= 0) { continue }\n // nque[k] is nnz (V(k+1:m,k))\n s.lnz += w[nque + k]\n // move all rows to parent of k\n const pa = parent[k]\n if (pa !== -1) {\n if (w[nque + pa] === 0) { w[tail + pa] = w[tail + k] }\n w[next + w[tail + k]] = w[head + pa]\n w[head + pa] = w[next + i]\n w[nque + pa] += w[nque + k]\n }\n }\n for (i = 0; i < m; i++) {\n if (pinv[i] < 0) { pinv[i] = k++ }\n }\n return true\n }\n})\n","// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.\n// SPDX-License-Identifier: LGPL-2.1+\n// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source\n\n/**\n * Permutes a sparse matrix C = P * A * Q\n *\n * @param {SparseMatrix} a The Matrix A\n * @param {Array} pinv The row permutation vector\n * @param {Array} q The column permutation vector\n * @param {boolean} values Create a pattern matrix (false), values and pattern otherwise\n *\n * @return {Matrix} C = P * A * Q, null on error\n */\nexport function csPermute (a, pinv, q, values) {\n // a arrays\n const avalues = a._values\n const aindex = a._index\n const aptr = a._ptr\n const asize = a._size\n const adt = a._datatype\n // rows & columns\n const m = asize[0]\n const n = asize[1]\n // c arrays\n const cvalues = values && a._values ? [] : null\n const cindex = [] // (aptr[n])\n const cptr = [] // (n + 1)\n // initialize vars\n let nz = 0\n // loop columns\n for (let k = 0; k < n; k++) {\n // column k of C is column q[k] of A\n cptr[k] = nz\n // apply column permutation\n const j = q ? (q[k]) : k\n // loop values in column j of A\n for (let t0 = aptr[j], t1 = aptr[j + 1], t = t0; t < t1; t++) {\n // row i of A is row pinv[i] of C\n const r = pinv ? pinv[aindex[t]] : aindex[t]\n // index\n cindex[nz] = r\n // check we need to populate values\n if (cvalues) { cvalues[nz] = avalues[t] }\n // increment number of nonzero elements\n nz++\n }\n }\n // finalize the last column of C\n cptr[n] = nz\n // return C matrix\n return a.createSparseMatrix({\n values: cvalues,\n index: cindex,\n ptr: cptr,\n size: [m, n],\n datatype: adt\n })\n}\n","// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.\n// SPDX-License-Identifier: LGPL-2.1+\n// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source\n\n/**\n * Computes the elimination tree of Matrix A (using triu(A)) or the\n * elimination tree of A'A without forming A'A.\n *\n * @param {Matrix} a The A Matrix\n * @param {boolean} ata A value of true the function computes the etree of A'A\n */\nexport function csEtree (a, ata) {\n // check inputs\n if (!a) { return null }\n // a arrays\n const aindex = a._index\n const aptr = a._ptr\n const asize = a._size\n // rows & columns\n const m = asize[0]\n const n = asize[1]\n\n // allocate result\n const parent = [] // (n)\n\n // allocate workspace\n const w = [] // (n + (ata ? m : 0))\n const ancestor = 0 // first n entries in w\n const prev = n // last m entries (ata = true)\n\n let i, inext\n\n // check we are calculating A'A\n if (ata) {\n // initialize workspace\n for (i = 0; i < m; i++) { w[prev + i] = -1 }\n }\n // loop columns\n for (let k = 0; k < n; k++) {\n // node k has no parent yet\n parent[k] = -1\n // nor does k have an ancestor\n w[ancestor + k] = -1\n // values in column k\n for (let p0 = aptr[k], p1 = aptr[k + 1], p = p0; p < p1; p++) {\n // row\n const r = aindex[p]\n // node\n i = ata ? (w[prev + r]) : r\n // traverse from i to k\n for (; i !== -1 && i < k; i = inext) {\n // inext = ancestor of i\n inext = w[ancestor + i]\n // path compression\n w[ancestor + i] = k\n // check no anc., parent is k\n if (inext === -1) { parent[i] = k }\n }\n if (ata) { w[prev + r] = k }\n }\n }\n return parent\n}\n","// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.\n// SPDX-License-Identifier: LGPL-2.1+\n// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source\nimport { csTdfs } from './csTdfs.js'\n\n/**\n * Post order a tree of forest\n *\n * @param {Array} parent The tree or forest\n * @param {Number} n Number of columns\n */\nexport function csPost (parent, n) {\n // check inputs\n if (!parent) { return null }\n // vars\n let k = 0\n let j\n // allocate result\n const post = [] // (n)\n // workspace, head: first n entries, next: next n entries, stack: last n entries\n const w = [] // (3 * n)\n const head = 0\n const next = n\n const stack = 2 * n\n // initialize workspace\n for (j = 0; j < n; j++) {\n // empty linked lists\n w[head + j] = -1\n }\n // traverse nodes in reverse order\n for (j = n - 1; j >= 0; j--) {\n // check j is a root\n if (parent[j] === -1) { continue }\n // add j to list of its parent\n w[next + j] = w[head + parent[j]]\n w[head + parent[j]] = j\n }\n // loop nodes\n for (j = 0; j < n; j++) {\n // skip j if it is not a root\n if (parent[j] !== -1) { continue }\n // depth-first search\n k = csTdfs(j, k, w, head, next, post, stack)\n }\n return post\n}\n","// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.\n// SPDX-License-Identifier: LGPL-2.1+\n// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source\n\n/**\n * Checks if the node at w[j] is marked\n *\n * @param {Array} w The array\n * @param {Number} j The array index\n */\nexport function csMarked (w, j) {\n // check node is marked\n return w[j] < 0\n}\n","// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.\n// SPDX-License-Identifier: LGPL-2.1+\n// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source\n\nimport { csFlip } from './csFlip.js'\n\n/**\n * Marks the node at w[j]\n *\n * @param {Array} w The array\n * @param {Number} j The array index\n */\nexport function csMark (w, j) {\n // mark w[j]\n w[j] = csFlip(w[j])\n}\n","// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.\n// SPDX-License-Identifier: LGPL-2.1+\n// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source\nimport { csFlip } from './csFlip.js'\n\n/**\n * Flips the value if it is negative of returns the same value otherwise.\n *\n * @param {Number} i The value to flip\n */\nexport function csUnflip (i) {\n // flip the value if it is negative\n return i < 0 ? csFlip(i) : i\n}\n","// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.\n// SPDX-License-Identifier: LGPL-2.1+\n// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source\nimport { csMarked } from './csMarked.js'\nimport { csMark } from './csMark.js'\nimport { csUnflip } from './csUnflip.js'\n\n/**\n * Depth-first search computes the nonzero pattern xi of the directed graph G (Matrix) starting\n * at nodes in B (see csReach()).\n *\n * @param {Number} j The starting node for the DFS algorithm\n * @param {Matrix} g The G matrix to search, ptr array modified, then restored\n * @param {Number} top Start index in stack xi[top..n-1]\n * @param {Number} k The kth column in B\n * @param {Array} xi The nonzero pattern xi[top] .. xi[n - 1], an array of size = 2 * n\n * The first n entries is the nonzero pattern, the last n entries is the stack\n * @param {Array} pinv The inverse row permutation vector, must be null for L * x = b\n *\n * @return {Number} New value of top\n */\nexport function csDfs (j, g, top, xi, pinv) {\n // g arrays\n const index = g._index\n const ptr = g._ptr\n const size = g._size\n // columns\n const n = size[1]\n // vars\n let i, p, p2\n // initialize head\n let head = 0\n // initialize the recursion stack\n xi[0] = j\n // loop\n while (head >= 0) {\n // get j from the top of the recursion stack\n j = xi[head]\n // apply permutation vector\n const jnew = pinv ? pinv[j] : j\n // check node j is marked\n if (!csMarked(ptr, j)) {\n // mark node j as visited\n csMark(ptr, j)\n // update stack (last n entries in xi)\n xi[n + head] = jnew < 0 ? 0 : csUnflip(ptr[jnew])\n }\n // node j done if no unvisited neighbors\n let done = 1\n // examine all neighbors of j, stack (last n entries in xi)\n for (p = xi[n + head], p2 = jnew < 0 ? 0 : csUnflip(ptr[jnew + 1]); p < p2; p++) {\n // consider neighbor node i\n i = index[p]\n // check we have visited node i, skip it\n if (csMarked(ptr, i)) { continue }\n // pause depth-first search of node j, update stack (last n entries in xi)\n xi[n + head] = p\n // start dfs at node i\n xi[++head] = i\n // node j is not done\n done = 0\n // break, to start dfs(i)\n break\n }\n // check depth-first search at node j is done\n if (done) {\n // remove j from the recursion stack\n head--\n // and place in the output stack\n xi[--top] = j\n }\n }\n return top\n}\n","// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.\n// SPDX-License-Identifier: LGPL-2.1+\n// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source\nimport { csReach } from './csReach.js'\nimport { factory } from '../../../utils/factory.js'\n\nconst name = 'csSpsolve'\nconst dependencies = [\n 'divideScalar',\n 'multiply',\n 'subtract'\n]\n\nexport const createCsSpsolve = /* #__PURE__ */ factory(name, dependencies, ({ divideScalar, multiply, subtract }) => {\n /**\n * The function csSpsolve() computes the solution to G * x = bk, where bk is the\n * kth column of B. When lo is true, the function assumes G = L is lower triangular with the\n * diagonal entry as the first entry in each column. When lo is true, the function assumes G = U\n * is upper triangular with the diagonal entry as the last entry in each column.\n *\n * @param {Matrix} g The G matrix\n * @param {Matrix} b The B matrix\n * @param {Number} k The kth column in B\n * @param {Array} xi The nonzero pattern xi[top] .. xi[n - 1], an array of size = 2 * n\n * The first n entries is the nonzero pattern, the last n entries is the stack\n * @param {Array} x The soluton to the linear system G * x = b\n * @param {Array} pinv The inverse row permutation vector, must be null for L * x = b\n * @param {boolean} lo The lower (true) upper triangular (false) flag\n *\n * @return {Number} The index for the nonzero pattern\n */\n return function csSpsolve (g, b, k, xi, x, pinv, lo) {\n // g arrays\n const gvalues = g._values\n const gindex = g._index\n const gptr = g._ptr\n const gsize = g._size\n // columns\n const n = gsize[1]\n // b arrays\n const bvalues = b._values\n const bindex = b._index\n const bptr = b._ptr\n // vars\n let p, p0, p1, q\n // xi[top..n-1] = csReach(B(:,k))\n const top = csReach(g, b, k, xi, pinv)\n // clear x\n for (p = top; p < n; p++) { x[xi[p]] = 0 }\n // scatter b\n for (p0 = bptr[k], p1 = bptr[k + 1], p = p0; p < p1; p++) { x[bindex[p]] = bvalues[p] }\n // loop columns\n for (let px = top; px < n; px++) {\n // x array index for px\n const j = xi[px]\n // apply permutation vector (U x = b), j maps to column J of G\n const J = pinv ? pinv[j] : j\n // check column J is empty\n if (J < 0) { continue }\n // column value indeces in G, p0 <= p < p1\n p0 = gptr[J]\n p1 = gptr[J + 1]\n // x(j) /= G(j,j)\n x[j] = divideScalar(x[j], gvalues[lo ? p0 : (p1 - 1)])\n // first entry L(j,j)\n p = lo ? (p0 + 1) : p0\n q = lo ? (p1) : (p1 - 1)\n // loop\n for (; p < q; p++) {\n // row\n const i = gindex[p]\n // x(i) -= G(i,j) * x(j)\n x[i] = subtract(x[i], multiply(gvalues[p], x[j]))\n }\n }\n // return top of stack\n return top\n }\n})\n","// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.\n// SPDX-License-Identifier: LGPL-2.1+\n// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source\n\nimport { csMarked } from './csMarked.js'\nimport { csMark } from './csMark.js'\nimport { csDfs } from './csDfs.js'\n\n/**\n * The csReach function computes X = Reach(B), where B is the nonzero pattern of the n-by-1\n * sparse column of vector b. The function returns the set of nodes reachable from any node in B. The\n * nonzero pattern xi of the solution x to the sparse linear system Lx=b is given by X=Reach(B).\n *\n * @param {Matrix} g The G matrix\n * @param {Matrix} b The B matrix\n * @param {Number} k The kth column in B\n * @param {Array} xi The nonzero pattern xi[top] .. xi[n - 1], an array of size = 2 * n\n * The first n entries is the nonzero pattern, the last n entries is the stack\n * @param {Array} pinv The inverse row permutation vector\n *\n * @return {Number} The index for the nonzero pattern\n */\nexport function csReach (g, b, k, xi, pinv) {\n // g arrays\n const gptr = g._ptr\n const gsize = g._size\n // b arrays\n const bindex = b._index\n const bptr = b._ptr\n // columns\n const n = gsize[1]\n // vars\n let p, p0, p1\n // initialize top\n let top = n\n // loop column indeces in B\n for (p0 = bptr[k], p1 = bptr[k + 1], p = p0; p < p1; p++) {\n // node i\n const i = bindex[p]\n // check node i is marked\n if (!csMarked(gptr, i)) {\n // start a dfs at unmarked node i\n top = csDfs(i, g, top, xi, pinv)\n }\n }\n // loop columns from top -> n - 1\n for (p = top; p < n; p++) {\n // restore G\n csMark(gptr, xi[p])\n }\n return top\n}\n","// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.\n// SPDX-License-Identifier: LGPL-2.1+\n// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source\n\nimport { factory } from '../../../utils/factory.js'\nimport { createCsSpsolve } from './csSpsolve.js'\n\nconst name = 'csLu'\nconst dependencies = [\n 'abs',\n 'divideScalar',\n 'multiply',\n 'subtract',\n 'larger',\n 'largerEq',\n 'SparseMatrix'\n]\n\nexport const createCsLu = /* #__PURE__ */ factory(name, dependencies, ({ abs, divideScalar, multiply, subtract, larger, largerEq, SparseMatrix }) => {\n const csSpsolve = createCsSpsolve({ divideScalar, multiply, subtract })\n\n /**\n * Computes the numeric LU factorization of the sparse matrix A. Implements a Left-looking LU factorization\n * algorithm that computes L and U one column at a tume. At the kth step, it access columns 1 to k-1 of L\n * and column k of A. Given the fill-reducing column ordering q (see parameter s) computes L, U and pinv so\n * L * U = A(p, q), where p is the inverse of pinv.\n *\n * @param {Matrix} m The A Matrix to factorize\n * @param {Object} s The symbolic analysis from csSqr(). Provides the fill-reducing\n * column ordering q\n * @param {Number} tol Partial pivoting threshold (1 for partial pivoting)\n *\n * @return {Number} The numeric LU factorization of A or null\n */\n return function csLu (m, s, tol) {\n // validate input\n if (!m) { return null }\n // m arrays\n const size = m._size\n // columns\n const n = size[1]\n // symbolic analysis result\n let q\n let lnz = 100\n let unz = 100\n // update symbolic analysis parameters\n if (s) {\n q = s.q\n lnz = s.lnz || lnz\n unz = s.unz || unz\n }\n // L arrays\n const lvalues = [] // (lnz)\n const lindex = [] // (lnz)\n const lptr = [] // (n + 1)\n // L\n const L = new SparseMatrix({\n values: lvalues,\n index: lindex,\n ptr: lptr,\n size: [n, n]\n })\n // U arrays\n const uvalues = [] // (unz)\n const uindex = [] // (unz)\n const uptr = [] // (n + 1)\n // U\n const U = new SparseMatrix({\n values: uvalues,\n index: uindex,\n ptr: uptr,\n size: [n, n]\n })\n // inverse of permutation vector\n const pinv = [] // (n)\n // vars\n let i, p\n // allocate arrays\n const x = [] // (n)\n const xi = [] // (2 * n)\n // initialize variables\n for (i = 0; i < n; i++) {\n // clear workspace\n x[i] = 0\n // no rows pivotal yet\n pinv[i] = -1\n // no cols of L yet\n lptr[i + 1] = 0\n }\n // reset number of nonzero elements in L and U\n lnz = 0\n unz = 0\n // compute L(:,k) and U(:,k)\n for (let k = 0; k < n; k++) {\n // update ptr\n lptr[k] = lnz\n uptr[k] = unz\n // apply column permutations if needed\n const col = q ? q[k] : k\n // solve triangular system, x = L\\A(:,col)\n const top = csSpsolve(L, m, col, xi, x, pinv, 1)\n // find pivot\n let ipiv = -1\n let a = -1\n // loop xi[] from top -> n\n for (p = top; p < n; p++) {\n // x[i] is nonzero\n i = xi[p]\n // check row i is not yet pivotal\n if (pinv[i] < 0) {\n // absolute value of x[i]\n const xabs = abs(x[i])\n // check absoulte value is greater than pivot value\n if (larger(xabs, a)) {\n // largest pivot candidate so far\n a = xabs\n ipiv = i\n }\n } else {\n // x(i) is the entry U(pinv[i],k)\n uindex[unz] = pinv[i]\n uvalues[unz++] = x[i]\n }\n }\n // validate we found a valid pivot\n if (ipiv === -1 || a <= 0) { return null }\n // update actual pivot column, give preference to diagonal value\n if (pinv[col] < 0 && largerEq(abs(x[col]), multiply(a, tol))) { ipiv = col }\n // the chosen pivot\n const pivot = x[ipiv]\n // last entry in U(:,k) is U(k,k)\n uindex[unz] = k\n uvalues[unz++] = pivot\n // ipiv is the kth pivot row\n pinv[ipiv] = k\n // first entry in L(:,k) is L(k,k) = 1\n lindex[lnz] = ipiv\n lvalues[lnz++] = 1\n // L(k+1:n,k) = x / pivot\n for (p = top; p < n; p++) {\n // row\n i = xi[p]\n // check x(i) is an entry in L(:,k)\n if (pinv[i] < 0) {\n // save unpermuted row in L\n lindex[lnz] = i\n // scale pivot column\n lvalues[lnz++] = divideScalar(x[i], pivot)\n }\n // x[0..n-1] = 0 for next k\n x[i] = 0\n }\n }\n // update ptr\n lptr[n] = lnz\n uptr[n] = unz\n // fix row indices of L for final pinv\n for (p = 0; p < lnz; p++) { lindex[p] = pinv[lindex[p]] }\n // trim arrays\n lvalues.splice(lnz, lvalues.length - lnz)\n lindex.splice(lnz, lindex.length - lnz)\n uvalues.splice(unz, uvalues.length - unz)\n uindex.splice(unz, uindex.length - unz)\n // return LU factor\n return { L, U, pinv }\n }\n})\n","import { isInteger } from '../../../utils/number.js'\nimport { factory } from '../../../utils/factory.js'\nimport { createCsSqr } from '../sparse/csSqr.js'\nimport { createCsLu } from '../sparse/csLu.js'\n\nconst name = 'slu'\nconst dependencies = [\n 'typed',\n 'abs',\n 'add',\n 'multiply',\n 'transpose',\n 'divideScalar',\n 'subtract',\n 'larger',\n 'largerEq',\n 'SparseMatrix'\n]\n\nexport const createSlu = /* #__PURE__ */ factory(name, dependencies, ({ typed, abs, add, multiply, transpose, divideScalar, subtract, larger, largerEq, SparseMatrix }) => {\n const csSqr = createCsSqr({ add, multiply, transpose })\n const csLu = createCsLu({ abs, divideScalar, multiply, subtract, larger, largerEq, SparseMatrix })\n\n /**\n * Calculate the Sparse Matrix LU decomposition with full pivoting. Sparse Matrix `A` is decomposed in two matrices (`L`, `U`) and two permutation vectors (`pinv`, `q`) where\n *\n * `P * A * Q = L * U`\n *\n * Syntax:\n *\n * math.slu(A, order, threshold)\n *\n * Examples:\n *\n * const A = math.sparse([[4,3], [6, 3]])\n * math.slu(A, 1, 0.001)\n * // returns:\n * // {\n * // L: [[1, 0], [1.5, 1]]\n * // U: [[4, 3], [0, -1.5]]\n * // p: [0, 1]\n * // q: [0, 1]\n * // }\n *\n * See also:\n *\n * lup, lsolve, usolve, lusolve\n *\n * @param {SparseMatrix} A A two dimensional sparse matrix for which to get the LU decomposition.\n * @param {Number} order The Symbolic Ordering and Analysis order:\n * 0 - Natural ordering, no permutation vector q is returned\n * 1 - Matrix must be square, symbolic ordering and analisis is performed on M = A + A'\n * 2 - Symbolic ordering and analisis is performed on M = A' * A. Dense columns from A' are dropped, A recreated from A'.\n * This is appropriatefor LU factorization of unsymmetric matrices.\n * 3 - Symbolic ordering and analisis is performed on M = A' * A. This is best used for LU factorization is matrix M has no dense rows.\n * A dense row is a row with more than 10*sqr(columns) entries.\n * @param {Number} threshold Partial pivoting threshold (1 for partial pivoting)\n *\n * @return {Object} The lower triangular matrix, the upper triangular matrix and the permutation vectors.\n */\n return typed(name, {\n\n 'SparseMatrix, number, number': function (a, order, threshold) {\n // verify order\n if (!isInteger(order) || order < 0 || order > 3) { throw new Error('Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]') }\n // verify threshold\n if (threshold < 0 || threshold > 1) { throw new Error('Partial pivoting threshold must be a number from 0 to 1') }\n\n // perform symbolic ordering and analysis\n const s = csSqr(order, a, false)\n\n // perform lu decomposition\n const f = csLu(a, s, threshold)\n\n // return decomposition\n return {\n L: f.L,\n U: f.U,\n p: f.pinv,\n q: s.q,\n toString: function () {\n return 'L: ' + this.L.toString() + '\\nU: ' + this.U.toString() + '\\np: ' + this.p.toString() + (this.q ? '\\nq: ' + this.q.toString() : '') + '\\n'\n }\n }\n }\n })\n})\n","// Copyright (c) 2006-2024, Timothy A. Davis, All Rights Reserved.\n// SPDX-License-Identifier: LGPL-2.1+\n// https://github.com/DrTimothyAldenDavis/SuiteSparse/tree/dev/CSparse/Source\n\n/**\n * Permutes a vector; x = P'b. In MATLAB notation, x(p)=b.\n *\n * @param {Array} p The permutation vector of length n. null value denotes identity\n * @param {Array} b The input vector\n *\n * @return {Array} The output vector x = P'b\n */\nexport function csIpvec (p, b) {\n // vars\n let k\n const n = b.length\n const x = []\n // check permutation vector was provided, p = null denotes identity\n if (p) {\n // loop vector\n for (k = 0; k < n; k++) {\n // apply permutation\n x[p[k]] = b[k]\n }\n } else {\n // loop vector\n for (k = 0; k < n; k++) {\n // x[i] = b[i]\n x[k] = b[k]\n }\n }\n return x\n}\n","import { isArray, isMatrix } from '../../../utils/is.js'\nimport { factory } from '../../../utils/factory.js'\nimport { createSolveValidation } from './utils/solveValidation.js'\nimport { csIpvec } from '../sparse/csIpvec.js'\n\nconst name = 'lusolve'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'lup',\n 'slu',\n 'usolve',\n 'lsolve',\n 'DenseMatrix'\n]\n\nexport const createLusolve = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, lup, slu, usolve, lsolve, DenseMatrix }) => {\n const solveValidation = createSolveValidation({ DenseMatrix })\n\n /**\n * Solves the linear system `A * x = b` where `A` is an [n x n] matrix and `b` is a [n] column vector.\n *\n * Syntax:\n *\n * math.lusolve(A, b) // returns column vector with the solution to the linear system A * x = b\n * math.lusolve(lup, b) // returns column vector with the solution to the linear system A * x = b, lup = math.lup(A)\n *\n * Examples:\n *\n * const m = [[1, 0, 0, 0], [0, 2, 0, 0], [0, 0, 3, 0], [0, 0, 0, 4]]\n *\n * const x = math.lusolve(m, [-1, -1, -1, -1]) // x = [[-1], [-0.5], [-1/3], [-0.25]]\n *\n * const f = math.lup(m)\n * const x1 = math.lusolve(f, [-1, -1, -1, -1]) // x1 = [[-1], [-0.5], [-1/3], [-0.25]]\n * const x2 = math.lusolve(f, [1, 2, 1, -1]) // x2 = [[1], [1], [1/3], [-0.25]]\n *\n * const a = [[-2, 3], [2, 1]]\n * const b = [11, 9]\n * const x = math.lusolve(a, b) // [[2], [5]]\n *\n * See also:\n *\n * lup, slu, lsolve, usolve\n *\n * @param {Matrix | Array | Object} A Invertible Matrix or the Matrix LU decomposition\n * @param {Matrix | Array} b Column Vector\n * @param {number} [order] The Symbolic Ordering and Analysis order, see slu for details. Matrix must be a SparseMatrix\n * @param {Number} [threshold] Partial pivoting threshold (1 for partial pivoting), see slu for details. Matrix must be a SparseMatrix.\n *\n * @return {DenseMatrix | Array} Column vector with the solution to the linear system A * x = b\n */\n return typed(name, {\n\n 'Array, Array | Matrix': function (a, b) {\n a = matrix(a)\n const d = lup(a)\n const x = _lusolve(d.L, d.U, d.p, null, b)\n return x.valueOf()\n },\n\n 'DenseMatrix, Array | Matrix': function (a, b) {\n const d = lup(a)\n return _lusolve(d.L, d.U, d.p, null, b)\n },\n\n 'SparseMatrix, Array | Matrix': function (a, b) {\n const d = lup(a)\n return _lusolve(d.L, d.U, d.p, null, b)\n },\n\n 'SparseMatrix, Array | Matrix, number, number': function (a, b, order, threshold) {\n const d = slu(a, order, threshold)\n return _lusolve(d.L, d.U, d.p, d.q, b)\n },\n\n 'Object, Array | Matrix': function (d, b) {\n return _lusolve(d.L, d.U, d.p, d.q, b)\n }\n })\n\n function _toMatrix (a) {\n if (isMatrix(a)) { return a }\n if (isArray(a)) { return matrix(a) }\n throw new TypeError('Invalid Matrix LU decomposition')\n }\n\n function _lusolve (l, u, p, q, b) {\n // verify decomposition\n l = _toMatrix(l)\n u = _toMatrix(u)\n\n // apply row permutations if needed (b is a DenseMatrix)\n if (p) {\n b = solveValidation(l, b, true)\n b._data = csIpvec(p, b._data)\n }\n\n // use forward substitution to resolve L * y = b\n const y = lsolve(l, b)\n // use backward substitution to resolve U * x = y\n const x = usolve(u, y)\n\n // apply column permutations if needed (x is a DenseMatrix)\n if (q) { x._data = csIpvec(q, x._data) }\n\n return x\n }\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'polynomialRoot'\nconst dependencies = [\n 'typed',\n 'isZero',\n 'equalScalar',\n 'add',\n 'subtract',\n 'multiply',\n 'divide',\n 'sqrt',\n 'unaryMinus',\n 'cbrt',\n 'typeOf',\n 'im',\n 're'\n]\n\nexport const createPolynomialRoot = /* #__PURE__ */ factory(name, dependencies, ({\n typed,\n isZero,\n equalScalar,\n add,\n subtract,\n multiply,\n divide,\n sqrt,\n unaryMinus,\n cbrt,\n typeOf,\n im,\n re\n}) => {\n /**\n * Finds the numerical values of the distinct roots of a polynomial with real or complex coefficients.\n * Currently operates only on linear, quadratic, and cubic polynomials using the standard\n * formulas for the roots.\n *\n * Syntax:\n *\n * math.polynomialRoot(constant, linearCoeff, quadraticCoeff, cubicCoeff)\n *\n * Examples:\n * // linear\n * math.polynomialRoot(6, 3) // [-2]\n * math.polynomialRoot(math.complex(6,3), 3) // [-2 - i]\n * math.polynomialRoot(math.complex(6,3), math.complex(2,1)) // [-3 + 0i]\n * // quadratic\n * math.polynomialRoot(2, -3, 1) // [2, 1]\n * math.polynomialRoot(8, 8, 2) // [-2]\n * math.polynomialRoot(-2, 0, 1) // [1.4142135623730951, -1.4142135623730951]\n * math.polynomialRoot(2, -2, 1) // [1 + i, 1 - i]\n * math.polynomialRoot(math.complex(1,3), math.complex(-3, -2), 1) // [2 + i, 1 + i]\n * // cubic\n * math.polynomialRoot(-6, 11, -6, 1) // [1, 3, 2]\n * math.polynomialRoot(-8, 0, 0, 1) // [-1 - 1.7320508075688774i, 2, -1 + 1.7320508075688774i]\n * math.polynomialRoot(0, 8, 8, 2) // [0, -2]\n * math.polynomialRoot(1, 1, 1, 1) // [-1 + 0i, 0 - i, 0 + i]\n *\n * See also:\n * cbrt, sqrt\n *\n * @param {... number | Complex} coeffs\n * The coefficients of the polynomial, starting with with the constant coefficent, followed\n * by the linear coefficient and subsequent coefficients of increasing powers.\n * @return {Array} The distinct roots of the polynomial\n */\n\n return typed(name, {\n 'number|Complex, ...number|Complex': (constant, restCoeffs) => {\n const coeffs = [constant, ...restCoeffs]\n while (coeffs.length > 0 && isZero(coeffs[coeffs.length - 1])) {\n coeffs.pop()\n }\n if (coeffs.length < 2) {\n throw new RangeError(\n `Polynomial [${constant}, ${restCoeffs}] must have a non-zero non-constant coefficient`)\n }\n switch (coeffs.length) {\n case 2: // linear\n return [unaryMinus(divide(coeffs[0], coeffs[1]))]\n case 3: { // quadratic\n const [c, b, a] = coeffs\n const denom = multiply(2, a)\n const d1 = multiply(b, b)\n const d2 = multiply(4, a, c)\n if (equalScalar(d1, d2)) return [divide(unaryMinus(b), denom)]\n const discriminant = sqrt(subtract(d1, d2))\n return [\n divide(subtract(discriminant, b), denom),\n divide(subtract(unaryMinus(discriminant), b), denom)\n ]\n }\n case 4: { // cubic, cf. https://en.wikipedia.org/wiki/Cubic_equation\n const [d, c, b, a] = coeffs\n const denom = unaryMinus(multiply(3, a))\n const D0_1 = multiply(b, b)\n const D0_2 = multiply(3, a, c)\n const D1_1 = add(multiply(2, b, b, b), multiply(27, a, a, d))\n const D1_2 = multiply(9, a, b, c)\n if (equalScalar(D0_1, D0_2) && equalScalar(D1_1, D1_2)) {\n return [divide(b, denom)]\n }\n const Delta0 = subtract(D0_1, D0_2)\n const Delta1 = subtract(D1_1, D1_2)\n const discriminant1 = add(\n multiply(18, a, b, c, d), multiply(b, b, c, c))\n const discriminant2 = add(\n multiply(4, b, b, b, d),\n multiply(4, a, c, c, c),\n multiply(27, a, a, d, d))\n if (equalScalar(discriminant1, discriminant2)) {\n return [\n divide(\n subtract(\n multiply(4, a, b, c),\n add(multiply(9, a, a, d), multiply(b, b, b))),\n multiply(a, Delta0)), // simple root\n divide(\n subtract(multiply(9, a, d), multiply(b, c)),\n multiply(2, Delta0)) // double root\n ]\n }\n // OK, we have three distinct roots\n let Ccubed\n if (equalScalar(D0_1, D0_2)) {\n Ccubed = Delta1\n } else {\n Ccubed = divide(\n add(\n Delta1,\n sqrt(subtract(\n multiply(Delta1, Delta1), multiply(4, Delta0, Delta0, Delta0)))\n ),\n 2)\n }\n const allRoots = true\n const rawRoots = cbrt(Ccubed, allRoots).toArray().map(\n C => divide(add(b, C, divide(Delta0, C)), denom))\n return rawRoots.map(r => {\n if (typeOf(r) === 'Complex' && equalScalar(re(r), re(r) + im(r))) {\n return re(r)\n }\n return r\n })\n }\n default:\n throw new RangeError(`only implemented for cubic or lower-order polynomials, not ${coeffs}`)\n }\n }\n })\n})\n","import { isHelp } from '../utils/is.js'\nimport { clone } from '../utils/object.js'\nimport { format } from '../utils/string.js'\nimport { factory } from '../utils/factory.js'\n\nconst name = 'Help'\nconst dependencies = ['evaluate']\n\nexport const createHelpClass = /* #__PURE__ */ factory(name, dependencies, ({ evaluate }) => {\n /**\n * Documentation object\n * @param {Object} doc Object containing properties:\n * {string} name\n * {string} category\n * {string} description\n * {string[]} syntax\n * {string[]} examples\n * {string[]} seealso\n * @constructor\n */\n function Help (doc) {\n if (!(this instanceof Help)) {\n throw new SyntaxError('Constructor must be called with the new operator')\n }\n\n if (!doc) throw new Error('Argument \"doc\" missing')\n\n this.doc = doc\n }\n\n /**\n * Attach type information\n */\n Help.prototype.type = 'Help'\n Help.prototype.isHelp = true\n\n /**\n * Generate a string representation of the Help object\n * @return {string} Returns a string\n * @private\n */\n Help.prototype.toString = function () {\n const doc = this.doc || {}\n let desc = '\\n'\n\n if (doc.name) {\n desc += 'Name: ' + doc.name + '\\n\\n'\n }\n if (doc.category) {\n desc += 'Category: ' + doc.category + '\\n\\n'\n }\n if (doc.description) {\n desc += 'Description:\\n ' + doc.description + '\\n\\n'\n }\n if (doc.syntax) {\n desc += 'Syntax:\\n ' + doc.syntax.join('\\n ') + '\\n\\n'\n }\n if (doc.examples) {\n desc += 'Examples:\\n'\n\n // after evaluating the examples, we restore config in case the examples\n // did change the config.\n let configChanged = false\n const originalConfig = evaluate('config()')\n\n const scope = {\n config: (newConfig) => {\n configChanged = true\n return evaluate('config(newConfig)', { newConfig })\n }\n }\n\n for (let i = 0; i < doc.examples.length; i++) {\n const expr = doc.examples[i]\n desc += ' ' + expr + '\\n'\n\n let res\n try {\n // note: res can be undefined when `expr` is an empty string\n res = evaluate(expr, scope)\n } catch (e) {\n res = e\n }\n if (res !== undefined && !isHelp(res)) {\n desc += ' ' + format(res, { precision: 14 }) + '\\n'\n }\n }\n desc += '\\n'\n\n if (configChanged) {\n evaluate('config(originalConfig)', { originalConfig })\n }\n }\n if (doc.mayThrow && doc.mayThrow.length) {\n desc += 'Throws: ' + doc.mayThrow.join(', ') + '\\n\\n'\n }\n if (doc.seealso && doc.seealso.length) {\n desc += 'See also: ' + doc.seealso.join(', ') + '\\n'\n }\n\n return desc\n }\n\n /**\n * Export the help object to JSON\n */\n Help.prototype.toJSON = function () {\n const obj = clone(this.doc)\n obj.mathjs = 'Help'\n return obj\n }\n\n /**\n * Instantiate a Help object from a JSON object\n * @param {Object} json\n * @returns {Help} Returns a new Help object\n */\n Help.fromJSON = function (json) {\n const doc = {}\n\n Object.keys(json)\n .filter(prop => prop !== 'mathjs')\n .forEach(prop => {\n doc[prop] = json[prop]\n })\n\n return new Help(doc)\n }\n\n /**\n * Returns a string representation of the Help object\n */\n Help.prototype.valueOf = Help.prototype.toString\n\n return Help\n}, { isClass: true })\n","import { isChain } from '../../utils/is.js'\nimport { format } from '../../utils/string.js'\nimport { hasOwnProperty, lazy } from '../../utils/object.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'Chain'\nconst dependencies = ['?on', 'math', 'typed']\n\nexport const createChainClass = /* #__PURE__ */ factory(name, dependencies, ({ on, math, typed }) => {\n /**\n * @constructor Chain\n * Wrap any value in a chain, allowing to perform chained operations on\n * the value.\n *\n * All methods available in the math.js library can be called upon the chain,\n * and then will be evaluated with the value itself as first argument.\n * The chain can be closed by executing chain.done(), which will return\n * the final value.\n *\n * The Chain has a number of special functions:\n * - done() Finalize the chained operation and return the\n * chain's value.\n * - valueOf() The same as done()\n * - toString() Returns a string representation of the chain's value.\n *\n * @param {*} [value]\n */\n function Chain (value) {\n if (!(this instanceof Chain)) {\n throw new SyntaxError('Constructor must be called with the new operator')\n }\n\n if (isChain(value)) {\n this.value = value.value\n } else {\n this.value = value\n }\n }\n\n /**\n * Attach type information\n */\n Chain.prototype.type = 'Chain'\n Chain.prototype.isChain = true\n\n /**\n * Close the chain. Returns the final value.\n * Does the same as method valueOf()\n * @returns {*} value\n */\n Chain.prototype.done = function () {\n return this.value\n }\n\n /**\n * Close the chain. Returns the final value.\n * Does the same as method done()\n * @returns {*} value\n */\n Chain.prototype.valueOf = function () {\n return this.value\n }\n\n /**\n * Get a string representation of the value in the chain\n * @returns {string}\n */\n Chain.prototype.toString = function () {\n return format(this.value)\n }\n\n /**\n * Get a JSON representation of the chain\n * @returns {Object}\n */\n Chain.prototype.toJSON = function () {\n return {\n mathjs: 'Chain',\n value: this.value\n }\n }\n\n /**\n * Instantiate a Chain from its JSON representation\n * @param {Object} json An object structured like\n * `{\"mathjs\": \"Chain\", value: ...}`,\n * where mathjs is optional\n * @returns {Chain}\n */\n Chain.fromJSON = function (json) {\n return new Chain(json.value)\n }\n\n /**\n * Create a proxy method for the chain\n * @param {string} name\n * @param {Function} fn The function to be proxied\n * If fn is no function, it is silently ignored.\n * @private\n */\n function createProxy (name, fn) {\n if (typeof fn === 'function') {\n Chain.prototype[name] = chainify(fn)\n }\n }\n\n /**\n * Create a proxy method for the chain\n * @param {string} name\n * @param {function} resolver The function resolving with the\n * function to be proxied\n * @private\n */\n function createLazyProxy (name, resolver) {\n lazy(Chain.prototype, name, function outerResolver () {\n const fn = resolver()\n if (typeof fn === 'function') {\n return chainify(fn)\n }\n\n return undefined // if not a function, ignore\n })\n }\n\n /**\n * Make a function chainable\n * @param {function} fn\n * @return {Function} chain function\n * @private\n */\n function chainify (fn) {\n return function () {\n // Here, `this` will be the context of a Chain instance\n if (arguments.length === 0) {\n return new Chain(fn(this.value))\n }\n const args = [this.value]\n for (let i = 0; i < arguments.length; i++) {\n args[i + 1] = arguments[i]\n }\n if (typed.isTypedFunction(fn)) {\n const sigObject = typed.resolve(fn, args)\n // We want to detect if a rest parameter has matched across the\n // value in the chain and the current arguments of this call.\n // That is the case if and only if the matching signature has\n // exactly one parameter (which then must be a rest parameter\n // as it is matching at least two actual arguments).\n if (sigObject.params.length === 1) {\n throw new Error('chain function ' + fn.name + ' cannot match rest parameter between chain value and additional arguments.')\n }\n return new Chain(sigObject.implementation.apply(fn, args))\n }\n return new Chain(fn.apply(fn, args))\n }\n }\n\n /**\n * Create a proxy for a single method, or an object with multiple methods.\n * Example usage:\n *\n * Chain.createProxy('add', function add (x, y) {...})\n * Chain.createProxy({\n * add: function add (x, y) {...},\n * subtract: function subtract (x, y) {...}\n * }\n *\n * @param {string | Object} arg0 A name (string), or an object with\n * functions\n * @param {*} [arg1] A function, when arg0 is a name\n */\n Chain.createProxy = function (arg0, arg1) {\n if (typeof arg0 === 'string') {\n // createProxy(name, value)\n createProxy(arg0, arg1)\n } else {\n // createProxy(values)\n for (const name in arg0) {\n if (hasOwnProperty(arg0, name) && excludedNames[name] === undefined) {\n createLazyProxy(name, () => arg0[name])\n }\n }\n }\n }\n\n const excludedNames = {\n expression: true,\n docs: true,\n type: true,\n classes: true,\n json: true,\n error: true,\n isChain: true // conflicts with the property isChain of a Chain instance\n }\n\n // create proxy for everything that is in math.js\n Chain.createProxy(math)\n\n // register on the import event, automatically add a proxy for every imported function.\n if (on) {\n on('import', function (name, resolver, path) {\n if (!path) {\n // an imported function (not a data type or something special)\n createLazyProxy(name, resolver)\n }\n })\n }\n\n return Chain\n}, { isClass: true })\n","export const eDocs = {\n name: 'e',\n category: 'Constants',\n syntax: [\n 'e'\n ],\n description: 'Euler\\'s number, the base of the natural logarithm. Approximately equal to 2.71828',\n examples: [\n 'e',\n 'e ^ 2',\n 'exp(2)',\n 'log(e)'\n ],\n seealso: ['exp']\n}\n","export const piDocs = {\n name: 'pi',\n category: 'Constants',\n syntax: [\n 'pi'\n ],\n description: 'The number pi is a mathematical constant that is the ratio of a circle\\'s circumference to its diameter, and is approximately equal to 3.14159',\n examples: [\n 'pi',\n 'sin(pi/2)'\n ],\n seealso: ['tau']\n}\n","import { eDocs } from './constants/e.js'\nimport { falseDocs } from './constants/false.js'\nimport { iDocs } from './constants/i.js'\nimport { InfinityDocs } from './constants/Infinity.js'\nimport { LN10Docs } from './constants/LN10.js'\nimport { LN2Docs } from './constants/LN2.js'\nimport { LOG10EDocs } from './constants/LOG10E.js'\nimport { LOG2EDocs } from './constants/LOG2E.js'\nimport { NaNDocs } from './constants/NaN.js'\nimport { nullDocs } from './constants/null.js'\nimport { phiDocs } from './constants/phi.js'\nimport { piDocs } from './constants/pi.js'\nimport { SQRT12Docs } from './constants/SQRT1_2.js'\nimport { SQRT2Docs } from './constants/SQRT2.js'\nimport { tauDocs } from './constants/tau.js'\nimport { trueDocs } from './constants/true.js'\nimport { versionDocs } from './constants/version.js'\nimport { bignumberDocs } from './construction/bignumber.js'\nimport { bigintDocs } from './construction/bigint.js'\nimport { booleanDocs } from './construction/boolean.js'\nimport { complexDocs } from './construction/complex.js'\nimport { createUnitDocs } from './construction/createUnit.js'\nimport { fractionDocs } from './construction/fraction.js'\nimport { indexDocs } from './construction/index.js'\nimport { matrixDocs } from './construction/matrix.js'\nimport { numberDocs } from './construction/number.js'\nimport { sparseDocs } from './construction/sparse.js'\nimport { splitUnitDocs } from './construction/splitUnit.js'\nimport { stringDocs } from './construction/string.js'\nimport { unitDocs } from './construction/unit.js'\nimport { configDocs } from './core/config.js'\nimport { importDocs } from './core/import.js'\nimport { typedDocs } from './core/typed.js'\nimport { derivativeDocs } from './function/algebra/derivative.js'\nimport { leafCountDocs } from './function/algebra/leafCount.js'\nimport { lsolveDocs } from './function/algebra/lsolve.js'\nimport { lsolveAllDocs } from './function/algebra/lsolveAll.js'\nimport { lupDocs } from './function/algebra/lup.js'\nimport { lusolveDocs } from './function/algebra/lusolve.js'\nimport { polynomialRootDocs } from './function/algebra/polynomialRoot.js'\nimport { qrDocs } from './function/algebra/qr.js'\nimport { rationalizeDocs } from './function/algebra/rationalize.js'\nimport { resolveDocs } from './function/algebra/resolve.js'\nimport { simplifyDocs } from './function/algebra/simplify.js'\nimport { simplifyConstantDocs } from './function/algebra/simplifyConstant.js'\nimport { simplifyCoreDocs } from './function/algebra/simplifyCore.js'\nimport { sluDocs } from './function/algebra/slu.js'\nimport { symbolicEqualDocs } from './function/algebra/symbolicEqual.js'\nimport { usolveDocs } from './function/algebra/usolve.js'\nimport { usolveAllDocs } from './function/algebra/usolveAll.js'\nimport { absDocs } from './function/arithmetic/abs.js'\nimport { addDocs } from './function/arithmetic/add.js'\nimport { cbrtDocs } from './function/arithmetic/cbrt.js'\nimport { ceilDocs } from './function/arithmetic/ceil.js'\nimport { cubeDocs } from './function/arithmetic/cube.js'\nimport { divideDocs } from './function/arithmetic/divide.js'\nimport { dotDivideDocs } from './function/arithmetic/dotDivide.js'\nimport { dotMultiplyDocs } from './function/arithmetic/dotMultiply.js'\nimport { dotPowDocs } from './function/arithmetic/dotPow.js'\nimport { expDocs } from './function/arithmetic/exp.js'\nimport { expmDocs } from './function/arithmetic/expm.js'\nimport { expm1Docs } from './function/arithmetic/expm1.js'\nimport { fixDocs } from './function/arithmetic/fix.js'\nimport { floorDocs } from './function/arithmetic/floor.js'\nimport { gcdDocs } from './function/arithmetic/gcd.js'\nimport { hypotDocs } from './function/arithmetic/hypot.js'\nimport { invmodDocs } from './function/arithmetic/invmod.js'\nimport { lcmDocs } from './function/arithmetic/lcm.js'\nimport { logDocs } from './function/arithmetic/log.js'\nimport { log10Docs } from './function/arithmetic/log10.js'\nimport { log1pDocs } from './function/arithmetic/log1p.js'\nimport { log2Docs } from './function/arithmetic/log2.js'\nimport { modDocs } from './function/arithmetic/mod.js'\nimport { multiplyDocs } from './function/arithmetic/multiply.js'\nimport { normDocs } from './function/arithmetic/norm.js'\nimport { nthRootDocs } from './function/arithmetic/nthRoot.js'\nimport { nthRootsDocs } from './function/arithmetic/nthRoots.js'\nimport { powDocs } from './function/arithmetic/pow.js'\nimport { roundDocs } from './function/arithmetic/round.js'\nimport { signDocs } from './function/arithmetic/sign.js'\nimport { sqrtDocs } from './function/arithmetic/sqrt.js'\nimport { sqrtmDocs } from './function/arithmetic/sqrtm.js'\nimport { sylvesterDocs } from './function/algebra/sylvester.js'\nimport { schurDocs } from './function/algebra/schur.js'\nimport { lyapDocs } from './function/algebra/lyap.js'\nimport { squareDocs } from './function/arithmetic/square.js'\nimport { subtractDocs } from './function/arithmetic/subtract.js'\nimport { unaryMinusDocs } from './function/arithmetic/unaryMinus.js'\nimport { unaryPlusDocs } from './function/arithmetic/unaryPlus.js'\nimport { xgcdDocs } from './function/arithmetic/xgcd.js'\nimport { bitAndDocs } from './function/bitwise/bitAnd.js'\nimport { bitNotDocs } from './function/bitwise/bitNot.js'\nimport { bitOrDocs } from './function/bitwise/bitOr.js'\nimport { bitXorDocs } from './function/bitwise/bitXor.js'\nimport { leftShiftDocs } from './function/bitwise/leftShift.js'\nimport { rightArithShiftDocs } from './function/bitwise/rightArithShift.js'\nimport { rightLogShiftDocs } from './function/bitwise/rightLogShift.js'\nimport { bellNumbersDocs } from './function/combinatorics/bellNumbers.js'\nimport { catalanDocs } from './function/combinatorics/catalan.js'\nimport { compositionDocs } from './function/combinatorics/composition.js'\nimport { stirlingS2Docs } from './function/combinatorics/stirlingS2.js'\nimport { argDocs } from './function/complex/arg.js'\nimport { conjDocs } from './function/complex/conj.js'\nimport { imDocs } from './function/complex/im.js'\nimport { reDocs } from './function/complex/re.js'\nimport { evaluateDocs } from './function/expression/evaluate.js'\nimport { parserDocs } from './function/expression/parser.js'\nimport { parseDocs } from './function/expression/parse.js'\nimport { compileDocs } from './function/expression/compile.js'\nimport { helpDocs } from './function/expression/help.js'\nimport { distanceDocs } from './function/geometry/distance.js'\nimport { intersectDocs } from './function/geometry/intersect.js'\nimport { andDocs } from './function/logical/and.js'\nimport { notDocs } from './function/logical/not.js'\nimport { orDocs } from './function/logical/or.js'\nimport { xorDocs } from './function/logical/xor.js'\nimport { mapSlicesDocs } from './function/matrix/mapSlices.js'\nimport { columnDocs } from './function/matrix/column.js'\nimport { concatDocs } from './function/matrix/concat.js'\nimport { countDocs } from './function/matrix/count.js'\nimport { crossDocs } from './function/matrix/cross.js'\nimport { ctransposeDocs } from './function/matrix/ctranspose.js'\nimport { detDocs } from './function/matrix/det.js'\nimport { diagDocs } from './function/matrix/diag.js'\nimport { diffDocs } from './function/matrix/diff.js'\nimport { dotDocs } from './function/matrix/dot.js'\nimport { eigsDocs } from './function/matrix/eigs.js'\nimport { filterDocs } from './function/matrix/filter.js'\nimport { flattenDocs } from './function/matrix/flatten.js'\nimport { forEachDocs } from './function/matrix/forEach.js'\nimport { getMatrixDataTypeDocs } from './function/matrix/getMatrixDataType.js'\nimport { identityDocs } from './function/matrix/identity.js'\nimport { invDocs } from './function/matrix/inv.js'\nimport { pinvDocs } from './function/matrix/pinv.js'\nimport { kronDocs } from './function/matrix/kron.js'\nimport { mapDocs } from './function/matrix/map.js'\nimport { matrixFromColumnsDocs } from './function/matrix/matrixFromColumns.js'\nimport { matrixFromFunctionDocs } from './function/matrix/matrixFromFunction.js'\nimport { matrixFromRowsDocs } from './function/matrix/matrixFromRows.js'\nimport { onesDocs } from './function/matrix/ones.js'\nimport { partitionSelectDocs } from './function/matrix/partitionSelect.js'\nimport { rangeDocs } from './function/matrix/range.js'\nimport { reshapeDocs } from './function/matrix/reshape.js'\nimport { resizeDocs } from './function/matrix/resize.js'\nimport { rotateDocs } from './function/matrix/rotate.js'\nimport { rotationMatrixDocs } from './function/matrix/rotationMatrix.js'\nimport { rowDocs } from './function/matrix/row.js'\nimport { sizeDocs } from './function/matrix/size.js'\nimport { sortDocs } from './function/matrix/sort.js'\nimport { squeezeDocs } from './function/matrix/squeeze.js'\nimport { subsetDocs } from './function/matrix/subset.js'\nimport { traceDocs } from './function/matrix/trace.js'\nimport { transposeDocs } from './function/matrix/transpose.js'\nimport { zerosDocs } from './function/matrix/zeros.js'\nimport { fftDocs } from './function/matrix/fft.js'\nimport { ifftDocs } from './function/matrix/ifft.js'\nimport { combinationsDocs } from './function/probability/combinations.js'\nimport { combinationsWithRepDocs } from './function/probability/combinationsWithRep.js'\nimport { factorialDocs } from './function/probability/factorial.js'\nimport { gammaDocs } from './function/probability/gamma.js'\nimport { lgammaDocs } from './function/probability/lgamma.js'\nimport { kldivergenceDocs } from './function/probability/kldivergence.js'\nimport { multinomialDocs } from './function/probability/multinomial.js'\nimport { permutationsDocs } from './function/probability/permutations.js'\nimport { pickRandomDocs } from './function/probability/pickRandom.js'\nimport { randomDocs } from './function/probability/random.js'\nimport { randomIntDocs } from './function/probability/randomInt.js'\nimport { compareDocs } from './function/relational/compare.js'\nimport { compareNaturalDocs } from './function/relational/compareNatural.js'\nimport { compareTextDocs } from './function/relational/compareText.js'\nimport { deepEqualDocs } from './function/relational/deepEqual.js'\nimport { equalDocs } from './function/relational/equal.js'\nimport { equalTextDocs } from './function/relational/equalText.js'\nimport { largerDocs } from './function/relational/larger.js'\nimport { largerEqDocs } from './function/relational/largerEq.js'\nimport { smallerDocs } from './function/relational/smaller.js'\nimport { smallerEqDocs } from './function/relational/smallerEq.js'\nimport { unequalDocs } from './function/relational/unequal.js'\nimport { setCartesianDocs } from './function/set/setCartesian.js'\nimport { setDifferenceDocs } from './function/set/setDifference.js'\nimport { setDistinctDocs } from './function/set/setDistinct.js'\nimport { setIntersectDocs } from './function/set/setIntersect.js'\nimport { setIsSubsetDocs } from './function/set/setIsSubset.js'\nimport { setMultiplicityDocs } from './function/set/setMultiplicity.js'\nimport { setPowersetDocs } from './function/set/setPowerset.js'\nimport { setSizeDocs } from './function/set/setSize.js'\nimport { setSymDifferenceDocs } from './function/set/setSymDifference.js'\nimport { setUnionDocs } from './function/set/setUnion.js'\nimport { zpk2tfDocs } from './function/signal/zpk2tf.js'\nimport { freqzDocs } from './function/signal/freqz.js'\nimport { erfDocs } from './function/special/erf.js'\nimport { zetaDocs } from './function/special/zeta.js'\nimport { madDocs } from './function/statistics/mad.js'\nimport { maxDocs } from './function/statistics/max.js'\nimport { meanDocs } from './function/statistics/mean.js'\nimport { medianDocs } from './function/statistics/median.js'\nimport { minDocs } from './function/statistics/min.js'\nimport { modeDocs } from './function/statistics/mode.js'\nimport { prodDocs } from './function/statistics/prod.js'\nimport { quantileSeqDocs } from './function/statistics/quantileSeq.js'\nimport { stdDocs } from './function/statistics/std.js'\nimport { cumSumDocs } from './function/statistics/cumsum.js'\nimport { sumDocs } from './function/statistics/sum.js'\nimport { varianceDocs } from './function/statistics/variance.js'\nimport { corrDocs } from './function/statistics/corr.js'\nimport { acosDocs } from './function/trigonometry/acos.js'\nimport { acoshDocs } from './function/trigonometry/acosh.js'\nimport { acotDocs } from './function/trigonometry/acot.js'\nimport { acothDocs } from './function/trigonometry/acoth.js'\nimport { acscDocs } from './function/trigonometry/acsc.js'\nimport { acschDocs } from './function/trigonometry/acsch.js'\nimport { asecDocs } from './function/trigonometry/asec.js'\nimport { asechDocs } from './function/trigonometry/asech.js'\nimport { asinDocs } from './function/trigonometry/asin.js'\nimport { asinhDocs } from './function/trigonometry/asinh.js'\nimport { atanDocs } from './function/trigonometry/atan.js'\nimport { atan2Docs } from './function/trigonometry/atan2.js'\nimport { atanhDocs } from './function/trigonometry/atanh.js'\nimport { cosDocs } from './function/trigonometry/cos.js'\nimport { coshDocs } from './function/trigonometry/cosh.js'\nimport { cotDocs } from './function/trigonometry/cot.js'\nimport { cothDocs } from './function/trigonometry/coth.js'\nimport { cscDocs } from './function/trigonometry/csc.js'\nimport { cschDocs } from './function/trigonometry/csch.js'\nimport { secDocs } from './function/trigonometry/sec.js'\nimport { sechDocs } from './function/trigonometry/sech.js'\nimport { sinDocs } from './function/trigonometry/sin.js'\nimport { sinhDocs } from './function/trigonometry/sinh.js'\nimport { tanDocs } from './function/trigonometry/tan.js'\nimport { tanhDocs } from './function/trigonometry/tanh.js'\nimport { toDocs } from './function/units/to.js'\nimport { binDocs } from './function/utils/bin.js'\nimport { cloneDocs } from './function/utils/clone.js'\nimport { formatDocs } from './function/utils/format.js'\nimport { hasNumericValueDocs } from './function/utils/hasNumericValue.js'\nimport { hexDocs } from './function/utils/hex.js'\nimport { isIntegerDocs } from './function/utils/isInteger.js'\nimport { isNaNDocs } from './function/utils/isNaN.js'\nimport { isNegativeDocs } from './function/utils/isNegative.js'\nimport { isNumericDocs } from './function/utils/isNumeric.js'\nimport { isPositiveDocs } from './function/utils/isPositive.js'\nimport { isPrimeDocs } from './function/utils/isPrime.js'\nimport { isZeroDocs } from './function/utils/isZero.js'\nimport { numericDocs } from './function/utils/numeric.js'\nimport { octDocs } from './function/utils/oct.js'\nimport { printDocs } from './function/utils/print.js'\nimport { typeOfDocs } from './function/utils/typeOf.js'\nimport { solveODEDocs } from './function/numeric/solveODE.js'\n\nexport const embeddedDocs = {\n\n // construction functions\n bignumber: bignumberDocs,\n bigint: bigintDocs,\n boolean: booleanDocs,\n complex: complexDocs,\n createUnit: createUnitDocs,\n fraction: fractionDocs,\n index: indexDocs,\n matrix: matrixDocs,\n number: numberDocs,\n sparse: sparseDocs,\n splitUnit: splitUnitDocs,\n string: stringDocs,\n unit: unitDocs,\n\n // constants\n e: eDocs,\n E: eDocs,\n false: falseDocs,\n i: iDocs,\n Infinity: InfinityDocs,\n LN2: LN2Docs,\n LN10: LN10Docs,\n LOG2E: LOG2EDocs,\n LOG10E: LOG10EDocs,\n NaN: NaNDocs,\n null: nullDocs,\n pi: piDocs,\n PI: piDocs,\n phi: phiDocs,\n SQRT1_2: SQRT12Docs,\n SQRT2: SQRT2Docs,\n tau: tauDocs,\n true: trueDocs,\n version: versionDocs,\n\n // physical constants\n // TODO: more detailed docs for physical constants\n speedOfLight: { description: 'Speed of light in vacuum', examples: ['speedOfLight'] },\n gravitationConstant: { description: 'Newtonian constant of gravitation', examples: ['gravitationConstant'] },\n planckConstant: { description: 'Planck constant', examples: ['planckConstant'] },\n reducedPlanckConstant: { description: 'Reduced Planck constant', examples: ['reducedPlanckConstant'] },\n\n magneticConstant: { description: 'Magnetic constant (vacuum permeability)', examples: ['magneticConstant'] },\n electricConstant: { description: 'Electric constant (vacuum permeability)', examples: ['electricConstant'] },\n vacuumImpedance: { description: 'Characteristic impedance of vacuum', examples: ['vacuumImpedance'] },\n coulomb: { description: 'Coulomb\\'s constant. Deprecated in favor of coulombConstant', examples: ['coulombConstant'] },\n coulombConstant: { description: 'Coulomb\\'s constant', examples: ['coulombConstant'] },\n elementaryCharge: { description: 'Elementary charge', examples: ['elementaryCharge'] },\n bohrMagneton: { description: 'Bohr magneton', examples: ['bohrMagneton'] },\n conductanceQuantum: { description: 'Conductance quantum', examples: ['conductanceQuantum'] },\n inverseConductanceQuantum: { description: 'Inverse conductance quantum', examples: ['inverseConductanceQuantum'] },\n // josephson: {description: 'Josephson constant', examples: ['josephson']},\n magneticFluxQuantum: { description: 'Magnetic flux quantum', examples: ['magneticFluxQuantum'] },\n nuclearMagneton: { description: 'Nuclear magneton', examples: ['nuclearMagneton'] },\n klitzing: { description: 'Von Klitzing constant', examples: ['klitzing'] },\n\n bohrRadius: { description: 'Bohr radius', examples: ['bohrRadius'] },\n classicalElectronRadius: { description: 'Classical electron radius', examples: ['classicalElectronRadius'] },\n electronMass: { description: 'Electron mass', examples: ['electronMass'] },\n fermiCoupling: { description: 'Fermi coupling constant', examples: ['fermiCoupling'] },\n fineStructure: { description: 'Fine-structure constant', examples: ['fineStructure'] },\n hartreeEnergy: { description: 'Hartree energy', examples: ['hartreeEnergy'] },\n protonMass: { description: 'Proton mass', examples: ['protonMass'] },\n deuteronMass: { description: 'Deuteron Mass', examples: ['deuteronMass'] },\n neutronMass: { description: 'Neutron mass', examples: ['neutronMass'] },\n quantumOfCirculation: { description: 'Quantum of circulation', examples: ['quantumOfCirculation'] },\n rydberg: { description: 'Rydberg constant', examples: ['rydberg'] },\n thomsonCrossSection: { description: 'Thomson cross section', examples: ['thomsonCrossSection'] },\n weakMixingAngle: { description: 'Weak mixing angle', examples: ['weakMixingAngle'] },\n efimovFactor: { description: 'Efimov factor', examples: ['efimovFactor'] },\n\n atomicMass: { description: 'Atomic mass constant', examples: ['atomicMass'] },\n avogadro: { description: 'Avogadro\\'s number', examples: ['avogadro'] },\n boltzmann: { description: 'Boltzmann constant', examples: ['boltzmann'] },\n faraday: { description: 'Faraday constant', examples: ['faraday'] },\n firstRadiation: { description: 'First radiation constant', examples: ['firstRadiation'] },\n loschmidt: { description: 'Loschmidt constant at T=273.15 K and p=101.325 kPa', examples: ['loschmidt'] },\n gasConstant: { description: 'Gas constant', examples: ['gasConstant'] },\n molarPlanckConstant: { description: 'Molar Planck constant', examples: ['molarPlanckConstant'] },\n molarVolume: { description: 'Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa', examples: ['molarVolume'] },\n sackurTetrode: { description: 'Sackur-Tetrode constant at T=1 K and p=101.325 kPa', examples: ['sackurTetrode'] },\n secondRadiation: { description: 'Second radiation constant', examples: ['secondRadiation'] },\n stefanBoltzmann: { description: 'Stefan-Boltzmann constant', examples: ['stefanBoltzmann'] },\n wienDisplacement: { description: 'Wien displacement law constant', examples: ['wienDisplacement'] },\n // spectralRadiance: {description: 'First radiation constant for spectral radiance', examples: ['spectralRadiance']},\n\n molarMass: { description: 'Molar mass constant', examples: ['molarMass'] },\n molarMassC12: { description: 'Molar mass constant of carbon-12', examples: ['molarMassC12'] },\n gravity: { description: 'Standard acceleration of gravity (standard acceleration of free-fall on Earth)', examples: ['gravity'] },\n\n planckLength: { description: 'Planck length', examples: ['planckLength'] },\n planckMass: { description: 'Planck mass', examples: ['planckMass'] },\n planckTime: { description: 'Planck time', examples: ['planckTime'] },\n planckCharge: { description: 'Planck charge', examples: ['planckCharge'] },\n planckTemperature: { description: 'Planck temperature', examples: ['planckTemperature'] },\n\n // functions - algebra\n derivative: derivativeDocs,\n lsolve: lsolveDocs,\n lsolveAll: lsolveAllDocs,\n lup: lupDocs,\n lusolve: lusolveDocs,\n leafCount: leafCountDocs,\n polynomialRoot: polynomialRootDocs,\n resolve: resolveDocs,\n simplify: simplifyDocs,\n simplifyConstant: simplifyConstantDocs,\n simplifyCore: simplifyCoreDocs,\n symbolicEqual: symbolicEqualDocs,\n rationalize: rationalizeDocs,\n slu: sluDocs,\n usolve: usolveDocs,\n usolveAll: usolveAllDocs,\n qr: qrDocs,\n\n // functions - arithmetic\n abs: absDocs,\n add: addDocs,\n cbrt: cbrtDocs,\n ceil: ceilDocs,\n cube: cubeDocs,\n divide: divideDocs,\n dotDivide: dotDivideDocs,\n dotMultiply: dotMultiplyDocs,\n dotPow: dotPowDocs,\n exp: expDocs,\n expm: expmDocs,\n expm1: expm1Docs,\n fix: fixDocs,\n floor: floorDocs,\n gcd: gcdDocs,\n hypot: hypotDocs,\n lcm: lcmDocs,\n log: logDocs,\n log2: log2Docs,\n log1p: log1pDocs,\n log10: log10Docs,\n mod: modDocs,\n multiply: multiplyDocs,\n norm: normDocs,\n nthRoot: nthRootDocs,\n nthRoots: nthRootsDocs,\n pow: powDocs,\n round: roundDocs,\n sign: signDocs,\n sqrt: sqrtDocs,\n sqrtm: sqrtmDocs,\n square: squareDocs,\n subtract: subtractDocs,\n unaryMinus: unaryMinusDocs,\n unaryPlus: unaryPlusDocs,\n xgcd: xgcdDocs,\n invmod: invmodDocs,\n\n // functions - bitwise\n bitAnd: bitAndDocs,\n bitNot: bitNotDocs,\n bitOr: bitOrDocs,\n bitXor: bitXorDocs,\n leftShift: leftShiftDocs,\n rightArithShift: rightArithShiftDocs,\n rightLogShift: rightLogShiftDocs,\n\n // functions - combinatorics\n bellNumbers: bellNumbersDocs,\n catalan: catalanDocs,\n composition: compositionDocs,\n stirlingS2: stirlingS2Docs,\n\n // functions - core\n config: configDocs,\n import: importDocs,\n typed: typedDocs,\n\n // functions - complex\n arg: argDocs,\n conj: conjDocs,\n re: reDocs,\n im: imDocs,\n\n // functions - expression\n evaluate: evaluateDocs,\n help: helpDocs,\n parse: parseDocs,\n parser: parserDocs,\n compile: compileDocs,\n\n // functions - geometry\n distance: distanceDocs,\n intersect: intersectDocs,\n\n // functions - logical\n and: andDocs,\n not: notDocs,\n or: orDocs,\n xor: xorDocs,\n\n // functions - matrix\n mapSlices: mapSlicesDocs,\n concat: concatDocs,\n count: countDocs,\n cross: crossDocs,\n column: columnDocs,\n ctranspose: ctransposeDocs,\n det: detDocs,\n diag: diagDocs,\n diff: diffDocs,\n dot: dotDocs,\n getMatrixDataType: getMatrixDataTypeDocs,\n identity: identityDocs,\n filter: filterDocs,\n flatten: flattenDocs,\n forEach: forEachDocs,\n inv: invDocs,\n pinv: pinvDocs,\n eigs: eigsDocs,\n kron: kronDocs,\n matrixFromFunction: matrixFromFunctionDocs,\n matrixFromRows: matrixFromRowsDocs,\n matrixFromColumns: matrixFromColumnsDocs,\n map: mapDocs,\n ones: onesDocs,\n partitionSelect: partitionSelectDocs,\n range: rangeDocs,\n resize: resizeDocs,\n reshape: reshapeDocs,\n rotate: rotateDocs,\n rotationMatrix: rotationMatrixDocs,\n row: rowDocs,\n size: sizeDocs,\n sort: sortDocs,\n squeeze: squeezeDocs,\n subset: subsetDocs,\n trace: traceDocs,\n transpose: transposeDocs,\n zeros: zerosDocs,\n fft: fftDocs,\n ifft: ifftDocs,\n sylvester: sylvesterDocs,\n schur: schurDocs,\n lyap: lyapDocs,\n\n // functions - numeric\n solveODE: solveODEDocs,\n\n // functions - probability\n combinations: combinationsDocs,\n combinationsWithRep: combinationsWithRepDocs,\n // distribution: distributionDocs,\n factorial: factorialDocs,\n gamma: gammaDocs,\n kldivergence: kldivergenceDocs,\n lgamma: lgammaDocs,\n multinomial: multinomialDocs,\n permutations: permutationsDocs,\n pickRandom: pickRandomDocs,\n random: randomDocs,\n randomInt: randomIntDocs,\n\n // functions - relational\n compare: compareDocs,\n compareNatural: compareNaturalDocs,\n compareText: compareTextDocs,\n deepEqual: deepEqualDocs,\n equal: equalDocs,\n equalText: equalTextDocs,\n larger: largerDocs,\n largerEq: largerEqDocs,\n smaller: smallerDocs,\n smallerEq: smallerEqDocs,\n unequal: unequalDocs,\n\n // functions - set\n setCartesian: setCartesianDocs,\n setDifference: setDifferenceDocs,\n setDistinct: setDistinctDocs,\n setIntersect: setIntersectDocs,\n setIsSubset: setIsSubsetDocs,\n setMultiplicity: setMultiplicityDocs,\n setPowerset: setPowersetDocs,\n setSize: setSizeDocs,\n setSymDifference: setSymDifferenceDocs,\n setUnion: setUnionDocs,\n\n // functions - signal\n zpk2tf: zpk2tfDocs,\n freqz: freqzDocs,\n\n // functions - special\n erf: erfDocs,\n zeta: zetaDocs,\n\n // functions - statistics\n cumsum: cumSumDocs,\n mad: madDocs,\n max: maxDocs,\n mean: meanDocs,\n median: medianDocs,\n min: minDocs,\n mode: modeDocs,\n prod: prodDocs,\n quantileSeq: quantileSeqDocs,\n std: stdDocs,\n sum: sumDocs,\n variance: varianceDocs,\n corr: corrDocs,\n\n // functions - trigonometry\n acos: acosDocs,\n acosh: acoshDocs,\n acot: acotDocs,\n acoth: acothDocs,\n acsc: acscDocs,\n acsch: acschDocs,\n asec: asecDocs,\n asech: asechDocs,\n asin: asinDocs,\n asinh: asinhDocs,\n atan: atanDocs,\n atanh: atanhDocs,\n atan2: atan2Docs,\n cos: cosDocs,\n cosh: coshDocs,\n cot: cotDocs,\n coth: cothDocs,\n csc: cscDocs,\n csch: cschDocs,\n sec: secDocs,\n sech: sechDocs,\n sin: sinDocs,\n sinh: sinhDocs,\n tan: tanDocs,\n tanh: tanhDocs,\n\n // functions - units\n to: toDocs,\n\n // functions - utils\n clone: cloneDocs,\n format: formatDocs,\n bin: binDocs,\n oct: octDocs,\n hex: hexDocs,\n isNaN: isNaNDocs,\n isInteger: isIntegerDocs,\n isNegative: isNegativeDocs,\n isNumeric: isNumericDocs,\n hasNumericValue: hasNumericValueDocs,\n isPositive: isPositiveDocs,\n isPrime: isPrimeDocs,\n isZero: isZeroDocs,\n print: printDocs,\n typeOf: typeOfDocs,\n numeric: numericDocs\n}\n","export const bignumberDocs = {\n name: 'bignumber',\n category: 'Construction',\n syntax: [\n 'bignumber(x)'\n ],\n description:\n 'Create a big number from a number or string.',\n examples: [\n '0.1 + 0.2',\n 'bignumber(0.1) + bignumber(0.2)',\n 'bignumber(\"7.2\")',\n 'bignumber(\"7.2e500\")',\n 'bignumber([0.1, 0.2, 0.3])'\n ],\n seealso: [\n 'boolean', 'bigint', 'complex', 'fraction', 'index', 'matrix', 'string', 'unit'\n ]\n}\n","export const bigintDocs = {\n name: 'bigint',\n category: 'Construction',\n syntax: [\n 'bigint(x)'\n ],\n description:\n 'Create a bigint, an integer with an arbitrary number of digits, from a number or string.',\n examples: [\n '123123123123123123 # a large number will lose digits',\n 'bigint(\"123123123123123123\")',\n 'bignumber([\"1\", \"3\", \"5\"])'\n ],\n seealso: [\n 'boolean', 'bignumber', 'number', 'complex', 'fraction', 'index', 'matrix', 'string', 'unit'\n ]\n}\n","export const booleanDocs = {\n name: 'boolean',\n category: 'Construction',\n syntax: [\n 'x',\n 'boolean(x)'\n ],\n description:\n 'Convert a string or number into a boolean.',\n examples: [\n 'boolean(0)',\n 'boolean(1)',\n 'boolean(3)',\n 'boolean(\"true\")',\n 'boolean(\"false\")',\n 'boolean([1, 0, 1, 1])'\n ],\n seealso: [\n 'bignumber', 'complex', 'index', 'matrix', 'number', 'string', 'unit'\n ]\n}\n","export const complexDocs = {\n name: 'complex',\n category: 'Construction',\n syntax: [\n 'complex()',\n 'complex(re, im)',\n 'complex(string)'\n ],\n description:\n 'Create a complex number.',\n examples: [\n 'complex()',\n 'complex(2, 3)',\n 'complex(\"7 - 2i\")'\n ],\n seealso: [\n 'bignumber', 'boolean', 'index', 'matrix', 'number', 'string', 'unit'\n ]\n}\n","export const createUnitDocs = {\n name: 'createUnit',\n category: 'Construction',\n syntax: [\n 'createUnit(definitions)',\n 'createUnit(name, definition)'\n ],\n description:\n 'Create a user-defined unit and register it with the Unit type.',\n examples: [\n 'createUnit(\"foo\")',\n 'createUnit(\"knot\", {definition: \"0.514444444 m/s\", aliases: [\"knots\", \"kt\", \"kts\"]})',\n 'createUnit(\"mph\", \"1 mile/hour\")'\n ],\n seealso: [\n 'unit', 'splitUnit'\n ]\n}\n","export const fractionDocs = {\n name: 'fraction',\n category: 'Construction',\n syntax: [\n 'fraction(num)',\n 'fraction(matrix)',\n 'fraction(num,den)',\n 'fraction({n: num, d: den})'\n ],\n description:\n 'Create a fraction from a number or from integer numerator and denominator.',\n examples: [\n 'fraction(0.125)',\n 'fraction(1, 3) + fraction(2, 5)',\n 'fraction({n: 333, d: 53})',\n 'fraction([sqrt(9), sqrt(10), sqrt(11)])'\n ],\n seealso: [\n 'bignumber', 'boolean', 'complex', 'index', 'matrix', 'string', 'unit'\n ]\n}\n","export const indexDocs = {\n name: 'index',\n category: 'Construction',\n syntax: [\n '[start]',\n '[start:end]',\n '[start:step:end]',\n '[start1, start 2, ...]',\n '[start1:end1, start2:end2, ...]',\n '[start1:step1:end1, start2:step2:end2, ...]'\n ],\n description:\n 'Create an index to get or replace a subset of a matrix',\n examples: [\n 'A = [1, 2, 3; 4, 5, 6]',\n 'A[1, :]',\n 'A[1, 2] = 50',\n 'A[1:2, 1:2] = 1',\n 'B = [1, 2, 3]',\n 'B[B>1 and B<3]'\n ],\n seealso: [\n 'bignumber', 'boolean', 'complex', 'matrix', 'number', 'range', 'string', 'unit'\n ]\n}\n","export const matrixDocs = {\n name: 'matrix',\n category: 'Construction',\n syntax: [\n '[]',\n '[a1, b1, ...; a2, b2, ...]',\n 'matrix()',\n 'matrix(\"dense\")',\n 'matrix([...])'\n ],\n description:\n 'Create a matrix.',\n examples: [\n '[]',\n '[1, 2, 3]',\n '[1, 2, 3; 4, 5, 6]',\n 'matrix()',\n 'matrix([3, 4])',\n 'matrix([3, 4; 5, 6], \"sparse\")',\n 'matrix([3, 4; 5, 6], \"sparse\", \"number\")'\n ],\n seealso: [\n 'bignumber', 'boolean', 'complex', 'index', 'number', 'string', 'unit', 'sparse'\n ]\n}\n","export const numberDocs = {\n name: 'number',\n category: 'Construction',\n syntax: [\n 'x',\n 'number(x)',\n 'number(unit, valuelessUnit)'\n ],\n description:\n 'Create a number or convert a string or boolean into a number.',\n examples: [\n '2',\n '2e3',\n '4.05',\n 'number(2)',\n 'number(\"7.2\")',\n 'number(true)',\n 'number([true, false, true, true])',\n 'number(unit(\"52cm\"), \"m\")'\n ],\n seealso: [\n 'bignumber', 'bigint', 'boolean', 'complex', 'fraction', 'index', 'matrix', 'string', 'unit'\n ]\n}\n","export const sparseDocs = {\n name: 'sparse',\n category: 'Construction',\n syntax: [\n 'sparse()',\n 'sparse([a1, b1, ...; a1, b2, ...])',\n 'sparse([a1, b1, ...; a1, b2, ...], \"number\")'\n ],\n description:\n 'Create a sparse matrix.',\n examples: [\n 'sparse()',\n 'sparse([3, 4; 5, 6])',\n 'sparse([3, 0; 5, 0], \"number\")'\n ],\n seealso: [\n 'bignumber', 'boolean', 'complex', 'index', 'number', 'string', 'unit', 'matrix'\n ]\n}\n","export const splitUnitDocs = {\n name: 'splitUnit',\n category: 'Construction',\n syntax: [\n 'splitUnit(unit: Unit, parts: Unit[])'\n ],\n description:\n 'Split a unit in an array of units whose sum is equal to the original unit.',\n examples: [\n 'splitUnit(1 m, [\"feet\", \"inch\"])'\n ],\n seealso: [\n 'unit', 'createUnit'\n ]\n}\n","export const stringDocs = {\n name: 'string',\n category: 'Construction',\n syntax: [\n '\"text\"',\n 'string(x)'\n ],\n description:\n 'Create a string or convert a value to a string',\n examples: [\n '\"Hello World!\"',\n 'string(4.2)',\n 'string(3 + 2i)'\n ],\n seealso: [\n 'bignumber', 'boolean', 'complex', 'index', 'matrix', 'number', 'unit'\n ]\n}\n","export const unitDocs = {\n name: 'unit',\n category: 'Construction',\n syntax: [\n 'value unit',\n 'unit(value, unit)',\n 'unit(string)'\n ],\n description:\n 'Create a unit.',\n examples: [\n '5.5 mm',\n '3 inch',\n 'unit(7.1, \"kilogram\")',\n 'unit(\"23 deg\")'\n ],\n seealso: [\n 'bignumber', 'boolean', 'complex', 'index', 'matrix', 'number', 'string'\n ]\n}\n","export const falseDocs = {\n name: 'false',\n category: 'Constants',\n syntax: [\n 'false'\n ],\n description: 'Boolean value false',\n examples: [\n 'false'\n ],\n seealso: ['true']\n}\n","export const iDocs = {\n name: 'i',\n category: 'Constants',\n syntax: [\n 'i'\n ],\n description: 'Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.',\n examples: [\n 'i',\n 'i * i',\n 'sqrt(-1)'\n ],\n seealso: []\n}\n","export const InfinityDocs = {\n name: 'Infinity',\n category: 'Constants',\n syntax: [\n 'Infinity'\n ],\n description: 'Infinity, a number which is larger than the maximum number that can be handled by a floating point number.',\n examples: [\n 'Infinity',\n '1 / 0'\n ],\n seealso: []\n}\n","export const LN2Docs = {\n name: 'LN2',\n category: 'Constants',\n syntax: [\n 'LN2'\n ],\n description: 'Returns the natural logarithm of 2, approximately equal to 0.693',\n examples: [\n 'LN2',\n 'log(2)'\n ],\n seealso: []\n}\n","export const LN10Docs = {\n name: 'LN10',\n category: 'Constants',\n syntax: [\n 'LN10'\n ],\n description: 'Returns the natural logarithm of 10, approximately equal to 2.302',\n examples: [\n 'LN10',\n 'log(10)'\n ],\n seealso: []\n}\n","export const LOG2EDocs = {\n name: 'LOG2E',\n category: 'Constants',\n syntax: [\n 'LOG2E'\n ],\n description: 'Returns the base-2 logarithm of E, approximately equal to 1.442',\n examples: [\n 'LOG2E',\n 'log(e, 2)'\n ],\n seealso: []\n}\n","export const LOG10EDocs = {\n name: 'LOG10E',\n category: 'Constants',\n syntax: [\n 'LOG10E'\n ],\n description: 'Returns the base-10 logarithm of E, approximately equal to 0.434',\n examples: [\n 'LOG10E',\n 'log(e, 10)'\n ],\n seealso: []\n}\n","export const NaNDocs = {\n name: 'NaN',\n category: 'Constants',\n syntax: [\n 'NaN'\n ],\n description: 'Not a number',\n examples: [\n 'NaN',\n '0 / 0'\n ],\n seealso: []\n}\n","export const nullDocs = {\n name: 'null',\n category: 'Constants',\n syntax: [\n 'null'\n ],\n description: 'Value null',\n examples: [\n 'null'\n ],\n seealso: ['true', 'false']\n}\n","export const phiDocs = {\n name: 'phi',\n category: 'Constants',\n syntax: [\n 'phi'\n ],\n description: 'Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...',\n examples: [\n 'phi'\n ],\n seealso: []\n}\n","export const SQRT12Docs = {\n name: 'SQRT1_2',\n category: 'Constants',\n syntax: [\n 'SQRT1_2'\n ],\n description: 'Returns the square root of 1/2, approximately equal to 0.707',\n examples: [\n 'SQRT1_2',\n 'sqrt(1/2)'\n ],\n seealso: []\n}\n","export const SQRT2Docs = {\n name: 'SQRT2',\n category: 'Constants',\n syntax: [\n 'SQRT2'\n ],\n description: 'Returns the square root of 2, approximately equal to 1.414',\n examples: [\n 'SQRT2',\n 'sqrt(2)'\n ],\n seealso: []\n}\n","export const tauDocs = {\n name: 'tau',\n category: 'Constants',\n syntax: [\n 'tau'\n ],\n description: 'Tau is the ratio constant of a circle\\'s circumference to radius, equal to 2 * pi, approximately 6.2832.',\n examples: [\n 'tau',\n '2 * pi'\n ],\n seealso: ['pi']\n}\n","export const trueDocs = {\n name: 'true',\n category: 'Constants',\n syntax: [\n 'true'\n ],\n description: 'Boolean value true',\n examples: [\n 'true'\n ],\n seealso: ['false']\n}\n","export const versionDocs = {\n name: 'version',\n category: 'Constants',\n syntax: [\n 'version'\n ],\n description: 'A string with the version number of math.js',\n examples: [\n 'version'\n ],\n seealso: []\n}\n","export const derivativeDocs = {\n name: 'derivative',\n category: 'Algebra',\n syntax: [\n 'derivative(expr, variable)',\n 'derivative(expr, variable, {simplify: boolean})'\n ],\n description: 'Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.',\n examples: [\n 'derivative(\"2x^3\", \"x\")',\n 'derivative(\"2x^3\", \"x\", {simplify: false})',\n 'derivative(\"2x^2 + 3x + 4\", \"x\")',\n 'derivative(\"sin(2x)\", \"x\")',\n 'f = parse(\"x^2 + x\")',\n 'x = parse(\"x\")',\n 'df = derivative(f, x)',\n 'df.evaluate({x: 3})'\n ],\n seealso: [\n 'simplify', 'parse', 'evaluate'\n ]\n}\n","export const lsolveDocs = {\n name: 'lsolve',\n category: 'Algebra',\n syntax: [\n 'x=lsolve(L, b)'\n ],\n description:\n 'Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.',\n examples: [\n 'a = [-2, 3; 2, 1]',\n 'b = [11, 9]',\n 'x = lsolve(a, b)'\n ],\n seealso: [\n 'lsolveAll', 'lup', 'lusolve', 'usolve', 'matrix', 'sparse'\n ]\n}\n","export const lsolveAllDocs = {\n name: 'lsolveAll',\n category: 'Algebra',\n syntax: [\n 'x=lsolveAll(L, b)'\n ],\n description:\n 'Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.',\n examples: [\n 'a = [-2, 3; 2, 1]',\n 'b = [11, 9]',\n 'x = lsolve(a, b)'\n ],\n seealso: [\n 'lsolve', 'lup', 'lusolve', 'usolve', 'matrix', 'sparse'\n ]\n}\n","export const lupDocs = {\n name: 'lup',\n category: 'Algebra',\n syntax: [\n 'lup(m)'\n ],\n description:\n 'Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U',\n examples: [\n 'lup([[2, 1], [1, 4]])',\n 'lup(matrix([[2, 1], [1, 4]]))',\n 'lup(sparse([[2, 1], [1, 4]]))'\n ],\n seealso: [\n 'lusolve', 'lsolve', 'usolve', 'matrix', 'sparse', 'slu', 'qr'\n ]\n}\n","export const lusolveDocs = {\n name: 'lusolve',\n category: 'Algebra',\n syntax: [\n 'x=lusolve(A, b)',\n 'x=lusolve(lu, b)'\n ],\n description: 'Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.',\n examples: [\n 'a = [-2, 3; 2, 1]',\n 'b = [11, 9]',\n 'x = lusolve(a, b)'\n ],\n seealso: [\n 'lup', 'slu', 'lsolve', 'usolve', 'matrix', 'sparse'\n ]\n}\n","export const leafCountDocs = {\n name: 'leafCount',\n category: 'Algebra',\n syntax: ['leafCount(expr)'],\n description: 'Computes the number of leaves in the parse tree of the given expression',\n examples: [\n 'leafCount(\"e^(i*pi)-1\")',\n 'leafCount(parse(\"{a: 22/7, b: 10^(1/2)}\"))'\n ],\n seealso: ['simplify']\n}\n","export const polynomialRootDocs = {\n name: 'polynomialRoot',\n category: 'Algebra',\n syntax: [\n 'x=polynomialRoot(-6, 3)',\n 'x=polynomialRoot(4, -4, 1)',\n 'x=polynomialRoot(-8, 12, -6, 1)'\n ],\n description: 'Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.',\n examples: [\n 'a = polynomialRoot(-6, 11, -6, 1)'\n ],\n seealso: [\n 'cbrt', 'sqrt'\n ]\n}\n","export const resolveDocs = {\n name: 'resolve',\n category: 'Algebra',\n syntax: [\n 'resolve(node, scope)'\n ],\n description: 'Recursively substitute variables in an expression tree.',\n examples: [\n 'resolve(parse(\"1 + x\"), { x: 7 })',\n 'resolve(parse(\"size(text)\"), { text: \"Hello World\" })',\n 'resolve(parse(\"x + y\"), { x: parse(\"3z\") })',\n 'resolve(parse(\"3x\"), { x: parse(\"y+z\"), z: parse(\"w^y\") })'\n ],\n seealso: [\n 'simplify', 'evaluate'\n ],\n mayThrow: [\n 'ReferenceError'\n ]\n}\n","export const simplifyDocs = {\n name: 'simplify',\n category: 'Algebra',\n syntax: [\n 'simplify(expr)',\n 'simplify(expr, rules)'\n ],\n description: 'Simplify an expression tree.',\n examples: [\n 'simplify(\"3 + 2 / 4\")',\n 'simplify(\"2x + x\")',\n 'f = parse(\"x * (x + 2 + x)\")',\n 'simplified = simplify(f)',\n 'simplified.evaluate({x: 2})'\n ],\n seealso: [\n 'simplifyCore', 'derivative', 'evaluate', 'parse', 'rationalize', 'resolve'\n ]\n}\n","export const simplifyConstantDocs = {\n name: 'simplifyConstant',\n category: 'Algebra',\n syntax: [\n 'simplifyConstant(expr)',\n 'simplifyConstant(expr, options)'\n ],\n description: 'Replace constant subexpressions of node with their values.',\n examples: [\n 'simplifyConstant(\"(3-3)*x\")',\n 'simplifyConstant(parse(\"z-cos(tau/8)\"))'\n ],\n seealso: [\n 'simplify', 'simplifyCore', 'evaluate'\n ]\n}\n","export const simplifyCoreDocs = {\n name: 'simplifyCore',\n category: 'Algebra',\n syntax: [\n 'simplifyCore(node)'\n ],\n description: 'Perform simple one-pass simplifications on an expression tree.',\n examples: [\n 'simplifyCore(parse(\"0*x\"))',\n 'simplifyCore(parse(\"(x+0)*2\"))'\n ],\n seealso: [\n 'simplify', 'simplifyConstant', 'evaluate'\n ]\n}\n","export const symbolicEqualDocs = {\n name: 'symbolicEqual',\n category: 'Algebra',\n syntax: [\n 'symbolicEqual(expr1, expr2)',\n 'symbolicEqual(expr1, expr2, options)'\n ],\n description: 'Returns true if the difference of the expressions simplifies to 0',\n examples: [\n 'symbolicEqual(\"x*y\",\"y*x\")',\n 'symbolicEqual(\"abs(x^2)\", \"x^2\")',\n 'symbolicEqual(\"abs(x)\", \"x\", {context: {abs: {trivial: true}}})'\n ],\n seealso: ['simplify', 'evaluate']\n}\n","export const rationalizeDocs = {\n name: 'rationalize',\n category: 'Algebra',\n syntax: [\n 'rationalize(expr)',\n 'rationalize(expr, scope)',\n 'rationalize(expr, scope, detailed)'\n ],\n description: '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.',\n examples: [\n 'rationalize(\"2x/y - y/(x+1)\")',\n 'rationalize(\"2x/y - y/(x+1)\", true)'\n ],\n seealso: [\n 'simplify'\n ]\n}\n","export const sluDocs = {\n name: 'slu',\n category: 'Algebra',\n syntax: [\n 'slu(A, order, threshold)'\n ],\n description: 'Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U',\n examples: [\n 'slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)'\n ],\n seealso: [\n 'lusolve', 'lsolve', 'usolve', 'matrix', 'sparse', 'lup', 'qr'\n ]\n}\n","export const usolveDocs = {\n name: 'usolve',\n category: 'Algebra',\n syntax: [\n 'x=usolve(U, b)'\n ],\n description:\n 'Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.',\n examples: [\n 'x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])'\n ],\n seealso: [\n 'usolveAll', 'lup', 'lusolve', 'lsolve', 'matrix', 'sparse'\n ]\n}\n","export const usolveAllDocs = {\n name: 'usolveAll',\n category: 'Algebra',\n syntax: [\n 'x=usolve(U, b)'\n ],\n description:\n 'Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.',\n examples: [\n 'x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])'\n ],\n seealso: [\n 'usolve', 'lup', 'lusolve', 'lsolve', 'matrix', 'sparse'\n ]\n}\n","export const qrDocs = {\n name: 'qr',\n category: 'Algebra',\n syntax: [\n 'qr(A)'\n ],\n description:\n 'Calculates the Matrix QR decomposition. Matrix `A` is decomposed in two matrices (`Q`, `R`) where `Q` is an orthogonal matrix and `R` is an upper triangular matrix.',\n examples: [\n 'qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])'\n ],\n seealso: [\n 'lup', 'slu', 'matrix'\n ]\n}\n","export const absDocs = {\n name: 'abs',\n category: 'Arithmetic',\n syntax: [\n 'abs(x)'\n ],\n description: 'Compute the absolute value.',\n examples: [\n 'abs(3.5)',\n 'abs(-4.2)'\n ],\n seealso: ['sign']\n}\n","export const addDocs = {\n name: 'add',\n category: 'Operators',\n syntax: [\n 'x + y',\n 'add(x, y)'\n ],\n description: 'Add two values.',\n examples: [\n 'a = 2.1 + 3.6',\n 'a - 3.6',\n '3 + 2i',\n '3 cm + 2 inch',\n '\"2.3\" + \"4\"'\n ],\n seealso: [\n 'subtract'\n ]\n}\n","export const cbrtDocs = {\n name: 'cbrt',\n category: 'Arithmetic',\n syntax: [\n 'cbrt(x)',\n 'cbrt(x, allRoots)'\n ],\n description:\n 'Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned',\n examples: [\n 'cbrt(64)',\n 'cube(4)',\n 'cbrt(-8)',\n 'cbrt(2 + 3i)',\n 'cbrt(8i)',\n 'cbrt(8i, true)',\n 'cbrt(27 m^3)'\n ],\n seealso: [\n 'square',\n 'sqrt',\n 'cube',\n 'multiply'\n ]\n}\n","export const ceilDocs = {\n name: 'ceil',\n category: 'Arithmetic',\n syntax: [\n 'ceil(x)',\n 'ceil(x, n)',\n 'ceil(unit, valuelessUnit)',\n 'ceil(unit, n, valuelessUnit)'\n ],\n description:\n 'Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.',\n examples: [\n 'ceil(3.2)',\n 'ceil(3.8)',\n 'ceil(-4.2)',\n 'ceil(3.241cm, cm)',\n 'ceil(3.241cm, 2, cm)'\n ],\n seealso: ['floor', 'fix', 'round']\n}\n","export const cubeDocs = {\n name: 'cube',\n category: 'Arithmetic',\n syntax: [\n 'cube(x)'\n ],\n description: 'Compute the cube of a value. The cube of x is x * x * x.',\n examples: [\n 'cube(2)',\n '2^3',\n '2 * 2 * 2'\n ],\n seealso: [\n 'multiply',\n 'square',\n 'pow'\n ]\n}\n","export const divideDocs = {\n name: 'divide',\n category: 'Operators',\n syntax: [\n 'x / y',\n 'divide(x, y)'\n ],\n description: 'Divide two values.',\n examples: [\n 'a = 2 / 3',\n 'a * 3',\n '4.5 / 2',\n '3 + 4 / 2',\n '(3 + 4) / 2',\n '18 km / 4.5'\n ],\n seealso: [\n 'multiply'\n ]\n}\n","export const dotDivideDocs = {\n name: 'dotDivide',\n category: 'Operators',\n syntax: [\n 'x ./ y',\n 'dotDivide(x, y)'\n ],\n description: 'Divide two values element wise.',\n examples: [\n 'a = [1, 2, 3; 4, 5, 6]',\n 'b = [2, 1, 1; 3, 2, 5]',\n 'a ./ b'\n ],\n seealso: [\n 'multiply',\n 'dotMultiply',\n 'divide'\n ]\n}\n","export const dotMultiplyDocs = {\n name: 'dotMultiply',\n category: 'Operators',\n syntax: [\n 'x .* y',\n 'dotMultiply(x, y)'\n ],\n description: 'Multiply two values element wise.',\n examples: [\n 'a = [1, 2, 3; 4, 5, 6]',\n 'b = [2, 1, 1; 3, 2, 5]',\n 'a .* b'\n ],\n seealso: [\n 'multiply',\n 'divide',\n 'dotDivide'\n ]\n}\n","export const dotPowDocs = {\n name: 'dotPow',\n category: 'Operators',\n syntax: [\n 'x .^ y',\n 'dotPow(x, y)'\n ],\n description:\n 'Calculates the power of x to y element wise.',\n examples: [\n 'a = [1, 2, 3; 4, 5, 6]',\n 'a .^ 2'\n ],\n seealso: [\n 'pow'\n ]\n}\n","export const expDocs = {\n name: 'exp',\n category: 'Arithmetic',\n syntax: [\n 'exp(x)'\n ],\n description: 'Calculate the exponent of a value.',\n examples: [\n 'exp(1.3)',\n 'e ^ 1.3',\n 'log(exp(1.3))',\n 'x = 2.4',\n '(exp(i*x) == cos(x) + i*sin(x)) # Euler\\'s formula'\n ],\n seealso: [\n 'expm',\n 'expm1',\n 'pow',\n 'log'\n ]\n}\n","export const expmDocs = {\n name: 'expm',\n category: 'Arithmetic',\n syntax: [\n 'exp(x)'\n ],\n description: 'Compute the matrix exponential, expm(A) = e^A. ' +\n 'The matrix must be square. ' +\n 'Not to be confused with exp(a), which performs element-wise exponentiation.',\n examples: [\n 'expm([[0,2],[0,0]])'\n ],\n seealso: [\n 'exp'\n ]\n}\n","export const expm1Docs = {\n name: 'expm1',\n category: 'Arithmetic',\n syntax: [\n 'expm1(x)'\n ],\n description: 'Calculate the value of subtracting 1 from the exponential value.',\n examples: [\n 'expm1(2)',\n 'pow(e, 2) - 1',\n 'log(expm1(2) + 1)'\n ],\n seealso: [\n 'exp',\n 'pow',\n 'log'\n ]\n}\n","export const fixDocs = {\n name: 'fix',\n category: 'Arithmetic',\n syntax: [\n 'fix(x)',\n 'fix(x, n)',\n 'fix(unit, valuelessUnit)',\n 'fix(unit, n, valuelessUnit)'\n ],\n description:\n 'Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.',\n examples: [\n 'fix(3.2)',\n 'fix(3.8)',\n 'fix(-4.2)',\n 'fix(-4.8)',\n 'fix(3.241cm, cm)',\n 'fix(3.241cm, 2, cm)'\n ],\n seealso: ['ceil', 'floor', 'round']\n}\n","export const floorDocs = {\n name: 'floor',\n category: 'Arithmetic',\n syntax: [\n 'floor(x)',\n 'floor(x, n)',\n 'floor(unit, valuelessUnit)',\n 'floor(unit, n, valuelessUnit)'\n ],\n description:\n 'Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.',\n examples: [\n 'floor(3.2)',\n 'floor(3.8)',\n 'floor(-4.2)',\n 'floor(3.241cm, cm)',\n 'floor(3.241cm, 2, cm)'\n ],\n seealso: ['ceil', 'fix', 'round']\n}\n","export const gcdDocs = {\n name: 'gcd',\n category: 'Arithmetic',\n syntax: [\n 'gcd(a, b)',\n 'gcd(a, b, c, ...)'\n ],\n description: 'Compute the greatest common divisor.',\n examples: [\n 'gcd(8, 12)',\n 'gcd(-4, 6)',\n 'gcd(25, 15, -10)'\n ],\n seealso: ['lcm', 'xgcd']\n}\n","export const hypotDocs = {\n name: 'hypot',\n category: 'Arithmetic',\n syntax: [\n 'hypot(a, b, c, ...)',\n 'hypot([a, b, c, ...])'\n ],\n description: 'Calculate the hypotenuse of a list with values.',\n examples: [\n 'hypot(3, 4)',\n 'sqrt(3^2 + 4^2)',\n 'hypot(-2)',\n 'hypot([3, 4, 5])'\n ],\n seealso: ['abs', 'norm']\n}\n","export const lcmDocs = {\n name: 'lcm',\n category: 'Arithmetic',\n syntax: [\n 'lcm(x, y)'\n ],\n description: 'Compute the least common multiple.',\n examples: [\n 'lcm(4, 6)',\n 'lcm(6, 21)',\n 'lcm(6, 21, 5)'\n ],\n seealso: ['gcd']\n}\n","export const logDocs = {\n name: 'log',\n category: 'Arithmetic',\n syntax: [\n 'log(x)',\n 'log(x, base)'\n ],\n description: 'Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).',\n examples: [\n 'log(3.5)',\n 'a = log(2.4)',\n 'exp(a)',\n '10 ^ 4',\n 'log(10000, 10)',\n 'log(10000) / log(10)',\n 'b = log(1024, 2)',\n '2 ^ b'\n ],\n seealso: [\n 'exp',\n 'log1p',\n 'log2',\n 'log10'\n ]\n}\n","export const log2Docs = {\n name: 'log2',\n category: 'Arithmetic',\n syntax: [\n 'log2(x)'\n ],\n description: 'Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`.',\n examples: [\n 'log2(0.03125)',\n 'log2(16)',\n 'log2(16) / log2(2)',\n 'pow(2, 4)'\n ],\n seealso: [\n 'exp',\n 'log1p',\n 'log',\n 'log10'\n ]\n}\n","export const log1pDocs = {\n name: 'log1p',\n category: 'Arithmetic',\n syntax: [\n 'log1p(x)',\n 'log1p(x, base)'\n ],\n description: 'Calculate the logarithm of a `value+1`',\n examples: [\n 'log1p(2.5)',\n 'exp(log1p(1.4))',\n 'pow(10, 4)',\n 'log1p(9999, 10)',\n 'log1p(9999) / log(10)'\n ],\n seealso: [\n 'exp',\n 'log',\n 'log2',\n 'log10'\n ]\n}\n","export const log10Docs = {\n name: 'log10',\n category: 'Arithmetic',\n syntax: [\n 'log10(x)'\n ],\n description: 'Compute the 10-base logarithm of a value.',\n examples: [\n 'log10(0.00001)',\n 'log10(10000)',\n '10 ^ 4',\n 'log(10000) / log(10)',\n 'log(10000, 10)'\n ],\n seealso: [\n 'exp',\n 'log'\n ]\n}\n","export const modDocs = {\n name: 'mod',\n category: 'Operators',\n syntax: [\n 'x % y',\n 'x mod y',\n 'mod(x, y)'\n ],\n description:\n 'Calculates the modulus, the remainder of an integer division.',\n examples: [\n '7 % 3',\n '11 % 2',\n '10 mod 4',\n 'isOdd(x) = x % 2',\n 'isOdd(2)',\n 'isOdd(3)'\n ],\n seealso: ['divide']\n}\n","export const multiplyDocs = {\n name: 'multiply',\n category: 'Operators',\n syntax: [\n 'x * y',\n 'multiply(x, y)'\n ],\n description: 'multiply two values.',\n examples: [\n 'a = 2.1 * 3.4',\n 'a / 3.4',\n '2 * 3 + 4',\n '2 * (3 + 4)',\n '3 * 2.1 km'\n ],\n seealso: [\n 'divide'\n ]\n}\n","export const normDocs = {\n name: 'norm',\n category: 'Arithmetic',\n syntax: [\n 'norm(x)',\n 'norm(x, p)'\n ],\n description: 'Calculate the norm of a number, vector or matrix.',\n examples: [\n 'abs(-3.5)',\n 'norm(-3.5)',\n 'norm(3 - 4i)',\n 'norm([1, 2, -3], Infinity)',\n 'norm([1, 2, -3], -Infinity)',\n 'norm([3, 4], 2)',\n 'norm([[1, 2], [3, 4]], 1)',\n 'norm([[1, 2], [3, 4]], \"inf\")',\n 'norm([[1, 2], [3, 4]], \"fro\")'\n ]\n}\n","export const nthRootDocs = {\n name: 'nthRoot',\n category: 'Arithmetic',\n syntax: [\n 'nthRoot(a)',\n 'nthRoot(a, root)'\n ],\n description: 'Calculate the nth root of a value. ' +\n 'The principal nth root of a positive real number A, ' +\n 'is the positive real solution of the equation \"x^root = A\".',\n examples: [\n '4 ^ 3',\n 'nthRoot(64, 3)',\n 'nthRoot(9, 2)',\n 'sqrt(9)'\n ],\n seealso: [\n 'nthRoots',\n 'pow',\n 'sqrt'\n ]\n}\n","export const nthRootsDocs = {\n name: 'nthRoots',\n category: 'Arithmetic',\n syntax: [\n 'nthRoots(A)',\n 'nthRoots(A, root)'\n ],\n description: ('' +\n 'Calculate the nth roots of a value. ' +\n 'An nth root of a positive real number A, ' +\n 'is a positive real solution of the equation \"x^root = A\". ' +\n 'This function returns an array of complex values.'\n ),\n examples: [\n 'nthRoots(1)',\n 'nthRoots(1, 3)'\n ],\n seealso: [\n 'sqrt',\n 'pow',\n 'nthRoot'\n ]\n}\n","export const powDocs = {\n name: 'pow',\n category: 'Operators',\n syntax: [\n 'x ^ y',\n 'pow(x, y)'\n ],\n description:\n 'Calculates the power of x to y, x^y.',\n examples: [\n '2^3',\n '2*2*2',\n '1 + e ^ (pi * i)',\n 'pow([[1, 2], [4, 3]], 2)',\n 'pow([[1, 2], [4, 3]], -1)'\n ],\n seealso: [\n 'multiply',\n 'nthRoot',\n 'nthRoots',\n 'sqrt'\n ]\n}\n","export const roundDocs = {\n name: 'round',\n category: 'Arithmetic',\n syntax: [\n 'round(x)',\n 'round(x, n)',\n 'round(unit, valuelessUnit)',\n 'round(unit, n, valuelessUnit)'\n ],\n description:\n 'round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.',\n examples: [\n 'round(3.2)',\n 'round(3.8)',\n 'round(-4.2)',\n 'round(-4.8)',\n 'round(pi, 3)',\n 'round(123.45678, 2)',\n 'round(3.241cm, 2, cm)',\n 'round([3.2, 3.8, -4.7])'\n ],\n seealso: ['ceil', 'floor', 'fix']\n}\n","export const signDocs = {\n name: 'sign',\n category: 'Arithmetic',\n syntax: [\n 'sign(x)'\n ],\n description:\n 'Compute the sign of a value. The sign of a value x is 1 when x>0, -1 when x<0, and 0 when x=0.',\n examples: [\n 'sign(3.5)',\n 'sign(-4.2)',\n 'sign(0)'\n ],\n seealso: [\n 'abs'\n ]\n}\n","export const sqrtDocs = {\n name: 'sqrt',\n category: 'Arithmetic',\n syntax: [\n 'sqrt(x)'\n ],\n description:\n 'Compute the square root value. If x = y * y, then y is the square root of x.',\n examples: [\n 'sqrt(25)',\n '5 * 5',\n 'sqrt(-1)'\n ],\n seealso: [\n 'square',\n 'sqrtm',\n 'multiply',\n 'nthRoot',\n 'nthRoots',\n 'pow'\n ]\n}\n","export const sqrtmDocs = {\n name: 'sqrtm',\n category: 'Arithmetic',\n syntax: [\n 'sqrtm(x)'\n ],\n description:\n 'Calculate the principal square root of a square matrix. The principal square root matrix `X` of another matrix `A` is such that `X * X = A`.',\n examples: [\n 'sqrtm([[33, 24], [48, 57]])'\n ],\n seealso: [\n 'sqrt',\n 'abs',\n 'square',\n 'multiply'\n ]\n}\n","export const squareDocs = {\n name: 'square',\n category: 'Arithmetic',\n syntax: [\n 'square(x)'\n ],\n description:\n 'Compute the square of a value. The square of x is x * x.',\n examples: [\n 'square(3)',\n 'sqrt(9)',\n '3^2',\n '3 * 3'\n ],\n seealso: [\n 'multiply',\n 'pow',\n 'sqrt',\n 'cube'\n ]\n}\n","export const subtractDocs = {\n name: 'subtract',\n category: 'Operators',\n syntax: [\n 'x - y',\n 'subtract(x, y)'\n ],\n description: 'subtract two values.',\n examples: [\n 'a = 5.3 - 2',\n 'a + 2',\n '2/3 - 1/6',\n '2 * 3 - 3',\n '2.1 km - 500m'\n ],\n seealso: [\n 'add'\n ]\n}\n","export const unaryMinusDocs = {\n name: 'unaryMinus',\n category: 'Operators',\n syntax: [\n '-x',\n 'unaryMinus(x)'\n ],\n description:\n 'Inverse the sign of a value. Converts booleans and strings to numbers.',\n examples: [\n '-4.5',\n '-(-5.6)',\n '-\"22\"'\n ],\n seealso: [\n 'add', 'subtract', 'unaryPlus'\n ]\n}\n","export const unaryPlusDocs = {\n name: 'unaryPlus',\n category: 'Operators',\n syntax: [\n '+x',\n 'unaryPlus(x)'\n ],\n description:\n 'Converts booleans and strings to numbers.',\n examples: [\n '+true',\n '+\"2\"'\n ],\n seealso: [\n 'add', 'subtract', 'unaryMinus'\n ]\n}\n","export const xgcdDocs = {\n name: 'xgcd',\n category: 'Arithmetic',\n syntax: [\n 'xgcd(a, b)'\n ],\n description: 'Calculate the extended greatest common divisor for two values. The result is an array [d, x, y] with 3 entries, where d is the greatest common divisor, and d = x * a + y * b.',\n examples: [\n 'xgcd(8, 12)',\n 'gcd(8, 12)',\n 'xgcd(36163, 21199)'\n ],\n seealso: ['gcd', 'lcm']\n}\n","export const invmodDocs = {\n name: 'invmod',\n category: 'Arithmetic',\n syntax: [\n 'invmod(a, b)'\n ],\n description: 'Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax ≣ 1 (mod b)',\n examples: [\n 'invmod(8, 12)',\n 'invmod(7, 13)',\n 'invmod(15151, 15122)'\n ],\n seealso: ['gcd', 'xgcd']\n}\n","export const bitAndDocs = {\n name: 'bitAnd',\n category: 'Bitwise',\n syntax: [\n 'x & y',\n 'bitAnd(x, y)'\n ],\n description: 'Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0',\n examples: [\n '5 & 3',\n 'bitAnd(53, 131)',\n '[1, 12, 31] & 42'\n ],\n seealso: [\n 'bitNot', 'bitOr', 'bitXor', 'leftShift', 'rightArithShift', 'rightLogShift'\n ]\n}\n","export const bitNotDocs = {\n name: 'bitNot',\n category: 'Bitwise',\n syntax: [\n '~x',\n 'bitNot(x)'\n ],\n description: 'Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.',\n examples: [\n '~1',\n '~2',\n 'bitNot([2, -3, 4])'\n ],\n seealso: [\n 'bitAnd', 'bitOr', 'bitXor', 'leftShift', 'rightArithShift', 'rightLogShift'\n ]\n}\n","export const bitOrDocs = {\n name: 'bitOr',\n category: 'Bitwise',\n syntax: [\n 'x | y',\n 'bitOr(x, y)'\n ],\n description: 'Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.',\n examples: [\n '5 | 3',\n 'bitOr([1, 2, 3], 4)'\n ],\n seealso: [\n 'bitAnd', 'bitNot', 'bitXor', 'leftShift', 'rightArithShift', 'rightLogShift'\n ]\n}\n","export const bitXorDocs = {\n name: 'bitXor',\n category: 'Bitwise',\n syntax: [\n 'bitXor(x, y)'\n ],\n description: 'Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.',\n examples: [\n 'bitOr(1, 2)',\n 'bitXor([2, 3, 4], 4)'\n ],\n seealso: [\n 'bitAnd', 'bitNot', 'bitOr', 'leftShift', 'rightArithShift', 'rightLogShift'\n ]\n}\n","export const leftShiftDocs = {\n name: 'leftShift',\n category: 'Bitwise',\n syntax: [\n 'x << y',\n 'leftShift(x, y)'\n ],\n description: 'Bitwise left logical shift of a value x by y number of bits.',\n examples: [\n '4 << 1',\n '8 >> 1'\n ],\n seealso: [\n 'bitAnd', 'bitNot', 'bitOr', 'bitXor', 'rightArithShift', 'rightLogShift'\n ]\n}\n","export const rightArithShiftDocs = {\n name: 'rightArithShift',\n category: 'Bitwise',\n syntax: [\n 'x >> y',\n 'rightArithShift(x, y)'\n ],\n description: 'Bitwise right arithmetic shift of a value x by y number of bits.',\n examples: [\n '8 >> 1',\n '4 << 1',\n '-12 >> 2'\n ],\n seealso: [\n 'bitAnd', 'bitNot', 'bitOr', 'bitXor', 'leftShift', 'rightLogShift'\n ]\n}\n","export const rightLogShiftDocs = {\n name: 'rightLogShift',\n category: 'Bitwise',\n syntax: [\n 'x >>> y',\n 'rightLogShift(x, y)'\n ],\n description: 'Bitwise right logical shift of a value x by y number of bits.',\n examples: [\n '8 >>> 1',\n '4 << 1',\n '-12 >>> 2'\n ],\n seealso: [\n 'bitAnd', 'bitNot', 'bitOr', 'bitXor', 'leftShift', 'rightArithShift'\n ]\n}\n","export const bellNumbersDocs = {\n name: 'bellNumbers',\n category: 'Combinatorics',\n syntax: [\n 'bellNumbers(n)'\n ],\n description: 'The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. `bellNumbers` only takes integer arguments. The following condition must be enforced: n >= 0.',\n examples: [\n 'bellNumbers(3)',\n 'bellNumbers(8)'\n ],\n seealso: ['stirlingS2']\n}\n","export const catalanDocs = {\n name: 'catalan',\n category: 'Combinatorics',\n syntax: [\n 'catalan(n)'\n ],\n description: 'The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.',\n examples: [\n 'catalan(3)',\n 'catalan(8)'\n ],\n seealso: ['bellNumbers']\n}\n","export const compositionDocs = {\n name: 'composition',\n category: 'Combinatorics',\n syntax: [\n 'composition(n, k)'\n ],\n description: 'The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.',\n examples: [\n 'composition(5, 3)'\n ],\n seealso: ['combinations']\n}\n","export const stirlingS2Docs = {\n name: 'stirlingS2',\n category: 'Combinatorics',\n syntax: [\n 'stirlingS2(n, k)'\n ],\n description: 'he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.',\n examples: [\n 'stirlingS2(5, 3)'\n ],\n seealso: ['bellNumbers']\n}\n","export const configDocs = {\n name: 'config',\n category: 'Core',\n syntax: [\n 'config()',\n 'config(options)'\n ],\n description: 'Get configuration or change configuration.',\n examples: [\n 'config()',\n '1/3 + 1/4',\n 'config({number: \"Fraction\"})',\n '1/3 + 1/4'\n ],\n seealso: []\n}\n","export const importDocs = {\n name: 'import',\n category: 'Core',\n syntax: [\n 'import(functions)',\n 'import(functions, options)'\n ],\n description: 'Import functions or constants from an object.',\n examples: [\n 'import({myFn: f(x)=x^2, myConstant: 32 })',\n 'myFn(2)',\n 'myConstant'\n ],\n seealso: []\n}\n","export const typedDocs = {\n name: 'typed',\n category: 'Core',\n syntax: [\n 'typed(signatures)',\n 'typed(name, signatures)'\n ],\n description: 'Create a typed function.',\n examples: [\n 'double = typed({ \"number\": f(x)=x+x, \"string\": f(x)=concat(x,x) })',\n 'double(2)',\n 'double(\"hello\")'\n ],\n seealso: []\n}\n","export const argDocs = {\n name: 'arg',\n category: 'Complex',\n syntax: [\n 'arg(x)'\n ],\n description:\n 'Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).',\n examples: [\n 'arg(2 + 2i)',\n 'atan2(3, 2)',\n 'arg(2 + 3i)'\n ],\n seealso: [\n 're',\n 'im',\n 'conj',\n 'abs'\n ]\n}\n","export const conjDocs = {\n name: 'conj',\n category: 'Complex',\n syntax: [\n 'conj(x)'\n ],\n description:\n 'Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.',\n examples: [\n 'conj(2 + 3i)',\n 'conj(2 - 3i)',\n 'conj(-5.2i)'\n ],\n seealso: [\n 're',\n 'im',\n 'abs',\n 'arg'\n ]\n}\n","export const reDocs = {\n name: 're',\n category: 'Complex',\n syntax: [\n 're(x)'\n ],\n description: 'Get the real part of a complex number.',\n examples: [\n 're(2 + 3i)',\n 'im(2 + 3i)',\n 're(-5.2i)',\n 're(2.4)'\n ],\n seealso: [\n 'im',\n 'conj',\n 'abs',\n 'arg'\n ]\n}\n","export const imDocs = {\n name: 'im',\n category: 'Complex',\n syntax: [\n 'im(x)'\n ],\n description: 'Get the imaginary part of a complex number.',\n examples: [\n 'im(2 + 3i)',\n 're(2 + 3i)',\n 'im(-5.2i)',\n 'im(2.4)'\n ],\n seealso: [\n 're',\n 'conj',\n 'abs',\n 'arg'\n ]\n}\n","export const evaluateDocs = {\n name: 'evaluate',\n category: 'Expression',\n syntax: [\n 'evaluate(expression)',\n 'evaluate(expression, scope)',\n 'evaluate([expr1, expr2, expr3, ...])',\n 'evaluate([expr1, expr2, expr3, ...], scope)'\n ],\n description: 'Evaluate an expression or an array with expressions.',\n examples: [\n 'evaluate(\"2 + 3\")',\n 'evaluate(\"sqrt(16)\")',\n 'evaluate(\"2 inch to cm\")',\n 'evaluate(\"sin(x * pi)\", { \"x\": 1/2 })',\n 'evaluate([\"width=2\", \"height=4\",\"width*height\"])'\n ],\n seealso: ['parser', 'parse', 'compile']\n}\n","export const helpDocs = {\n name: 'help',\n category: 'Expression',\n syntax: [\n 'help(object)',\n 'help(string)'\n ],\n description: 'Display documentation on a function or data type.',\n examples: [\n 'help(sqrt)',\n 'help(\"complex\")'\n ],\n seealso: []\n}\n","export const parseDocs = {\n name: 'parse',\n category: 'Expression',\n syntax: [\n 'parse(expr)',\n 'parse(expr, options)',\n 'parse([expr1, expr2, expr3, ...])',\n 'parse([expr1, expr2, expr3, ...], options)'\n ],\n description: 'Parse an expression. Returns a node tree, which can be evaluated by invoking node.evaluate() or transformed into a functional object via node.compile().',\n examples: [\n 'node1 = parse(\"sqrt(3^2 + 4^2)\")',\n 'node1.evaluate()',\n 'code1 = node1.compile()',\n 'code1.evaluate()',\n 'scope = {a: 3, b: 4}',\n 'node2 = parse(\"a * b\")',\n 'node2.evaluate(scope)',\n 'code2 = node2.compile()',\n 'code2.evaluate(scope)'\n ],\n seealso: ['parser', 'evaluate', 'compile']\n}\n","export const parserDocs = {\n name: 'parser',\n category: 'Expression',\n syntax: [\n 'parser()'\n ],\n description: 'Create a parser object that keeps a context of variables and their values, allowing the evaluation of expressions in that context.',\n examples: [\n 'myParser = parser()',\n 'myParser.evaluate(\"sqrt(3^2 + 4^2)\")',\n 'myParser.set(\"x\", 3)',\n 'myParser.evaluate(\"y = x + 3\")',\n 'myParser.evaluate([\"y = x + 3\", \"y = y + 1\"])',\n 'myParser.get(\"y\")'\n ],\n seealso: ['evaluate', 'parse', 'compile']\n}\n","export const compileDocs = {\n name: 'compile',\n category: 'Expression',\n syntax: [\n 'compile(expr) ',\n 'compile([expr1, expr2, expr3, ...])'\n ],\n description: 'Parse and compile an expression. Returns a an object with a function evaluate([scope]) to evaluate the compiled expression.',\n examples: [\n 'code1 = compile(\"sqrt(3^2 + 4^2)\")',\n 'code1.evaluate() ',\n 'code2 = compile(\"a * b\")',\n 'code2.evaluate({a: 3, b: 4})'\n ],\n seealso: ['parser', 'parse', 'evaluate']\n}\n","export const distanceDocs = {\n name: 'distance',\n category: 'Geometry',\n syntax: [\n 'distance([x1, y1], [x2, y2])',\n 'distance([[x1, y1], [x2, y2]])'\n ],\n description: 'Calculates the Euclidean distance between two points.',\n examples: [\n 'distance([0,0], [4,4])',\n 'distance([[0,0], [4,4]])'\n ],\n seealso: []\n}\n","export const intersectDocs = {\n name: 'intersect',\n category: 'Geometry',\n syntax: [\n 'intersect(expr1, expr2, expr3, expr4)',\n 'intersect(expr1, expr2, expr3)'\n ],\n description: 'Computes the intersection point of lines and/or planes.',\n examples: [\n 'intersect([0, 0], [10, 10], [10, 0], [0, 10])',\n 'intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])'\n ],\n seealso: []\n}\n","export const andDocs = {\n name: 'and',\n category: 'Logical',\n syntax: [\n 'x and y',\n 'and(x, y)'\n ],\n description: 'Logical and. Test whether two values are both defined with a nonzero/nonempty value.',\n examples: [\n 'true and false',\n 'true and true',\n '2 and 4'\n ],\n seealso: [\n 'not', 'or', 'xor'\n ]\n}\n","export const notDocs = {\n name: 'not',\n category: 'Logical',\n syntax: [\n 'not x',\n 'not(x)'\n ],\n description: 'Logical not. Flips the boolean value of given argument.',\n examples: [\n 'not true',\n 'not false',\n 'not 2',\n 'not 0'\n ],\n seealso: [\n 'and', 'or', 'xor'\n ]\n}\n","export const orDocs = {\n name: 'or',\n category: 'Logical',\n syntax: [\n 'x or y',\n 'or(x, y)'\n ],\n description: 'Logical or. Test if at least one value is defined with a nonzero/nonempty value.',\n examples: [\n 'true or false',\n 'false or false',\n '0 or 4'\n ],\n seealso: [\n 'not', 'and', 'xor'\n ]\n}\n","export const xorDocs = {\n name: 'xor',\n category: 'Logical',\n syntax: [\n 'x xor y',\n 'xor(x, y)'\n ],\n description: 'Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.',\n examples: [\n 'true xor false',\n 'false xor false',\n 'true xor true',\n '0 xor 4'\n ],\n seealso: [\n 'not', 'and', 'or'\n ]\n}\n","export const mapSlicesDocs = {\n name: 'mapSlices',\n category: 'Matrix',\n syntax: ['mapSlices(A, dim, callback)'],\n description:\n 'Generate a matrix one dimension less than A by applying callback to ' +\n 'each slice of A along dimension dim.',\n examples: [\n 'A = [[1, 2], [3, 4]]',\n 'mapSlices(A, 1, sum)', // returns [4, 6]\n 'mapSlices(A, 2, prod)' // returns [2, 12]\n ],\n seealso: ['map', 'forEach']\n}\n","export const concatDocs = {\n name: 'concat',\n category: 'Matrix',\n syntax: [\n 'concat(A, B, C, ...)',\n 'concat(A, B, C, ..., dim)'\n ],\n description: 'Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.',\n examples: [\n 'A = [1, 2; 5, 6]',\n 'B = [3, 4; 7, 8]',\n 'concat(A, B)',\n 'concat(A, B, 1)',\n 'concat(A, B, 2)'\n ],\n seealso: [\n 'det', 'diag', 'identity', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros'\n ]\n}\n","export const countDocs = {\n name: 'count',\n category: 'Matrix',\n syntax: [\n 'count(x)'\n ],\n description: 'Count the number of elements of a matrix, array or string.',\n examples: [\n 'a = [1, 2; 3, 4; 5, 6]',\n 'count(a)',\n 'size(a)',\n 'count(\"hello world\")'\n ],\n seealso: [\n 'size'\n ]\n}\n","export const crossDocs = {\n name: 'cross',\n category: 'Matrix',\n syntax: [\n 'cross(A, B)'\n ],\n description: 'Calculate the cross product for two vectors in three dimensional space.',\n examples: [\n 'cross([1, 1, 0], [0, 1, 1])',\n 'cross([3, -3, 1], [4, 9, 2])',\n 'cross([2, 3, 4], [5, 6, 7])'\n ],\n seealso: [\n 'multiply',\n 'dot'\n ]\n}\n","export const columnDocs = {\n name: 'column',\n category: 'Matrix',\n syntax: [\n 'column(x, index)'\n ],\n description: 'Return a column from a matrix or array.',\n examples: [\n 'A = [[1, 2], [3, 4]]',\n 'column(A, 1)',\n 'column(A, 2)'\n ],\n seealso: ['row', 'matrixFromColumns']\n}\n","export const ctransposeDocs = {\n name: 'ctranspose',\n category: 'Matrix',\n syntax: [\n 'x\\'',\n 'ctranspose(x)'\n ],\n description: 'Complex Conjugate and Transpose a matrix',\n examples: [\n 'a = [1, 2, 3; 4, 5, 6]',\n 'a\\'',\n 'ctranspose(a)'\n ],\n seealso: [\n 'concat', 'det', 'diag', 'identity', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'zeros'\n ]\n}\n","export const detDocs = {\n name: 'det',\n category: 'Matrix',\n syntax: [\n 'det(x)'\n ],\n description: 'Calculate the determinant of a matrix',\n examples: [\n 'det([1, 2; 3, 4])',\n 'det([-2, 2, 3; -1, 1, 3; 2, 0, -1])'\n ],\n seealso: [\n 'concat', 'diag', 'identity', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros'\n ]\n}\n","export const diagDocs = {\n name: 'diag',\n category: 'Matrix',\n syntax: [\n 'diag(x)',\n 'diag(x, k)'\n ],\n description: 'Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.',\n examples: [\n 'diag(1:3)',\n 'diag(1:3, 1)',\n 'a = [1, 2, 3; 4, 5, 6; 7, 8, 9]',\n 'diag(a)'\n ],\n seealso: [\n 'concat', 'det', 'identity', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros'\n ]\n}\n","export const diffDocs = {\n name: 'diff',\n category: 'Matrix',\n syntax: [\n 'diff(arr)',\n 'diff(arr, dim)'\n ],\n description: [\n 'Create a new matrix or array with the difference of the passed matrix or array.',\n 'Dim parameter is optional and used to indicate the dimension of the array/matrix to apply the difference',\n 'If no dimension parameter is passed it is assumed as dimension 0',\n 'Dimension is zero-based in javascript and one-based in the parser',\n 'Arrays must be \\'rectangular\\' meaning arrays like [1, 2]',\n 'If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays'\n ],\n examples: [\n 'A = [1, 2, 4, 7, 0]',\n 'diff(A)',\n 'diff(A, 1)',\n 'B = [[1, 2], [3, 4]]',\n 'diff(B)',\n 'diff(B, 1)',\n 'diff(B, 2)',\n 'diff(B, bignumber(2))',\n 'diff([[1, 2], matrix([3, 4])], 2)'\n ],\n seealso: ['subtract', 'partitionSelect']\n}\n","export const dotDocs = {\n name: 'dot',\n category: 'Matrix',\n syntax: [\n 'dot(A, B)',\n 'A * B'\n ],\n description: 'Calculate the dot product of two vectors. ' +\n 'The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] ' +\n 'is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn',\n examples: [\n 'dot([2, 4, 1], [2, 2, 3])',\n '[2, 4, 1] * [2, 2, 3]'\n ],\n seealso: [\n 'multiply',\n 'cross'\n ]\n}\n","export const getMatrixDataTypeDocs = {\n name: 'getMatrixDataType',\n category: 'Matrix',\n syntax: [\n 'getMatrixDataType(x)'\n ],\n description: 'Find the data type of all elements in a matrix or array, ' +\n 'for example \"number\" if all items are a number ' +\n 'and \"Complex\" if all values are complex numbers. ' +\n 'If a matrix contains more than one data type, it will return \"mixed\".',\n examples: [\n 'getMatrixDataType([1, 2, 3])',\n 'getMatrixDataType([[5 cm], [2 inch]])',\n 'getMatrixDataType([1, \"text\"])',\n 'getMatrixDataType([1, bignumber(4)])'\n ],\n seealso: ['matrix', 'sparse', 'typeOf']\n}\n","export const identityDocs = {\n name: 'identity',\n category: 'Matrix',\n syntax: [\n 'identity(n)',\n 'identity(m, n)',\n 'identity([m, n])'\n ],\n description: 'Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.',\n examples: [\n 'identity(3)',\n 'identity(3, 5)',\n 'a = [1, 2, 3; 4, 5, 6]',\n 'identity(size(a))'\n ],\n seealso: [\n 'concat', 'det', 'diag', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros'\n ]\n}\n","export const filterDocs = {\n name: 'filter',\n category: 'Matrix',\n syntax: [\n 'filter(x, test)'\n ],\n description: 'Filter items in a matrix.',\n examples: [\n 'isPositive(x) = x > 0',\n 'filter([6, -2, -1, 4, 3], isPositive)',\n 'filter([6, -2, 0, 1, 0], x != 0)'\n ],\n seealso: ['sort', 'map', 'forEach']\n}\n","export const flattenDocs = {\n name: 'flatten',\n category: 'Matrix',\n syntax: [\n 'flatten(x)'\n ],\n description: 'Flatten a multi dimensional matrix into a single dimensional matrix.',\n examples: [\n 'a = [1, 2, 3; 4, 5, 6]',\n 'size(a)',\n 'b = flatten(a)',\n 'size(b)'\n ],\n seealso: [\n 'concat', 'resize', 'size', 'squeeze'\n ]\n}\n","export const forEachDocs = {\n name: 'forEach',\n category: 'Matrix',\n syntax: [\n 'forEach(x, callback)'\n ],\n description: 'Iterates over all elements of a matrix/array, and executes the given callback function.',\n examples: [\n 'numberOfPets = {}',\n 'addPet(n) = numberOfPets[n] = (numberOfPets[n] ? numberOfPets[n]:0 ) + 1;',\n 'forEach([\"Dog\",\"Cat\",\"Cat\"], addPet)',\n 'numberOfPets'\n ],\n seealso: ['map', 'sort', 'filter']\n}\n","export const invDocs = {\n name: 'inv',\n category: 'Matrix',\n syntax: [\n 'inv(x)'\n ],\n description: 'Calculate the inverse of a matrix',\n examples: [\n 'inv([1, 2; 3, 4])',\n 'inv(4)',\n '1 / 4'\n ],\n seealso: [\n 'concat', 'det', 'diag', 'identity', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros'\n ]\n}\n","export const pinvDocs = {\n name: 'pinv',\n category: 'Matrix',\n syntax: [\n 'pinv(x)'\n ],\n description: 'Calculate the Moore–Penrose inverse of a matrix',\n examples: [\n 'pinv([1, 2; 3, 4])',\n 'pinv([[1, 0], [0, 1], [0, 1]])',\n 'pinv(4)'\n ],\n seealso: [\n 'inv'\n ]\n}\n","export const eigsDocs = {\n name: 'eigs',\n category: 'Matrix',\n syntax: [\n 'eigs(x)'\n ],\n description: 'Calculate the eigenvalues and optionally eigenvectors of a square matrix',\n examples: [\n 'eigs([[5, 2.3], [2.3, 1]])',\n 'eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })'\n ],\n seealso: [\n 'inv'\n ]\n}\n","export const kronDocs = {\n name: 'kron',\n category: 'Matrix',\n syntax: [\n 'kron(x, y)'\n ],\n description: 'Calculates the Kronecker product of 2 matrices or vectors.',\n examples: [\n 'kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])',\n 'kron([1,1], [2,3,4])'\n ],\n seealso: [\n 'multiply', 'dot', 'cross'\n ]\n}\n","export const matrixFromFunctionDocs = {\n name: 'matrixFromFunction',\n category: 'Matrix',\n syntax: [\n 'matrixFromFunction(size, fn)',\n 'matrixFromFunction(size, fn, format)',\n 'matrixFromFunction(size, fn, format, datatype)',\n 'matrixFromFunction(size, format, fn)',\n 'matrixFromFunction(size, format, datatype, fn)'\n ],\n description: 'Create a matrix by evaluating a generating function at each index.',\n examples: [\n 'f(I) = I[1] - I[2]',\n 'matrixFromFunction([3,3], f)',\n 'g(I) = I[1] - I[2] == 1 ? 4 : 0',\n 'matrixFromFunction([100, 100], \"sparse\", g)',\n 'matrixFromFunction([5], random)'\n ],\n seealso: [\n 'matrix', 'matrixFromRows', 'matrixFromColumns', 'zeros'\n ]\n}\n","export const matrixFromRowsDocs = {\n name: 'matrixFromRows',\n category: 'Matrix',\n syntax: [\n 'matrixFromRows(...arr)',\n 'matrixFromRows(row1, row2)',\n 'matrixFromRows(row1, row2, row3)'\n ],\n description: 'Create a dense matrix from vectors as individual rows.',\n examples: [\n 'matrixFromRows([1, 2, 3], [[4],[5],[6]])'\n ],\n seealso: [\n 'matrix', 'matrixFromColumns', 'matrixFromFunction', 'zeros'\n ]\n}\n","export const matrixFromColumnsDocs = {\n name: 'matrixFromColumns',\n category: 'Matrix',\n syntax: [\n 'matrixFromColumns(...arr)',\n 'matrixFromColumns(row1, row2)',\n 'matrixFromColumns(row1, row2, row3)'\n ],\n description: 'Create a dense matrix from vectors as individual columns.',\n examples: [\n 'matrixFromColumns([1, 2, 3], [[4],[5],[6]])'\n ],\n seealso: [\n 'matrix', 'matrixFromRows', 'matrixFromFunction', 'zeros'\n ]\n}\n","export const mapDocs = {\n name: 'map',\n category: 'Matrix',\n syntax: [\n 'map(x, callback)',\n 'map(x, y, ..., callback)'\n ],\n description: 'Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array or the matrices/arrays.',\n examples: [\n 'map([1, 2, 3], square)',\n 'map([1, 2], [3, 4], f(a,b) = a + b)'\n ],\n seealso: ['filter', 'forEach']\n}\n","export const onesDocs = {\n name: 'ones',\n category: 'Matrix',\n syntax: [\n 'ones(m)',\n 'ones(m, n)',\n 'ones(m, n, p, ...)',\n 'ones([m])',\n 'ones([m, n])',\n 'ones([m, n, p, ...])'\n ],\n description: 'Create a matrix containing ones.',\n examples: [\n 'ones(3)',\n 'ones(3, 5)',\n 'ones([2,3]) * 4.5',\n 'a = [1, 2, 3; 4, 5, 6]',\n 'ones(size(a))'\n ],\n seealso: [\n 'concat', 'det', 'diag', 'identity', 'inv', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros'\n ]\n}\n","export const partitionSelectDocs = {\n name: 'partitionSelect',\n category: 'Matrix',\n syntax: [\n 'partitionSelect(x, k)',\n 'partitionSelect(x, k, compare)'\n ],\n description: 'Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.',\n examples: [\n 'partitionSelect([5, 10, 1], 2)',\n 'partitionSelect([\"C\", \"B\", \"A\", \"D\"], 1, compareText)',\n 'arr = [5, 2, 1]',\n 'partitionSelect(arr, 0) # returns 1, arr is now: [1, 2, 5]',\n 'arr',\n 'partitionSelect(arr, 1, \\'desc\\') # returns 2, arr is now: [5, 2, 1]',\n 'arr'\n ],\n seealso: ['sort']\n}\n","export const rangeDocs = {\n name: 'range',\n category: 'Type',\n syntax: [\n 'start:end',\n 'start:step:end',\n 'range(start, end)',\n 'range(start, end, step)',\n 'range(string)'\n ],\n description:\n 'Create a range. Lower bound of the range is included, upper bound is excluded.',\n examples: [\n '1:5',\n '3:-1:-3',\n 'range(3, 7)',\n 'range(0, 12, 2)',\n 'range(\"4:10\")',\n 'range(1m, 1m, 3m)',\n 'a = [1, 2, 3, 4; 5, 6, 7, 8]',\n 'a[1:2, 1:2]'\n ],\n seealso: [\n 'concat', 'det', 'diag', 'identity', 'inv', 'ones', 'size', 'squeeze', 'subset', 'trace', 'transpose', 'zeros'\n ]\n}\n","export const resizeDocs = {\n name: 'resize',\n category: 'Matrix',\n syntax: [\n 'resize(x, size)',\n 'resize(x, size, defaultValue)'\n ],\n description: 'Resize a matrix.',\n examples: [\n 'resize([1,2,3,4,5], [3])',\n 'resize([1,2,3], [5])',\n 'resize([1,2,3], [5], -1)',\n 'resize(2, [2, 3])',\n 'resize(\"hello\", [8], \"!\")'\n ],\n seealso: [\n 'size', 'subset', 'squeeze', 'reshape'\n ]\n}\n","export const reshapeDocs = {\n name: 'reshape',\n category: 'Matrix',\n syntax: [\n 'reshape(x, sizes)'\n ],\n description: 'Reshape a multi dimensional array to fit the specified dimensions.',\n examples: [\n 'reshape([1, 2, 3, 4, 5, 6], [2, 3])',\n 'reshape([[1, 2], [3, 4]], [1, 4])',\n 'reshape([[1, 2], [3, 4]], [4])',\n 'reshape([1, 2, 3, 4], [-1, 2])'\n ],\n seealso: [\n 'size', 'squeeze', 'resize'\n ]\n}\n","export const rotateDocs = {\n name: 'rotate',\n category: 'Matrix',\n syntax: [\n 'rotate(w, theta)',\n 'rotate(w, theta, v)'\n ],\n description: 'Returns a 2-D rotation matrix (2x2) for a given angle (in radians). ' +\n 'Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.',\n examples: [\n 'rotate([1, 0], pi / 2)',\n 'rotate(matrix([1, 0]), unit(\"35deg\"))',\n 'rotate([1, 0, 0], unit(\"90deg\"), [0, 0, 1])',\n 'rotate(matrix([1, 0, 0]), unit(\"90deg\"), matrix([0, 0, 1]))'\n ],\n seealso: [\n 'matrix', 'rotationMatrix'\n ]\n}\n","export const rotationMatrixDocs = {\n name: 'rotationMatrix',\n category: 'Matrix',\n syntax: [\n 'rotationMatrix(theta)',\n 'rotationMatrix(theta, v)',\n 'rotationMatrix(theta, v, format)'\n ],\n description: 'Returns a 2-D rotation matrix (2x2) for a given angle (in radians). ' +\n 'Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.',\n examples: [\n 'rotationMatrix(pi / 2)',\n 'rotationMatrix(unit(\"45deg\"), [0, 0, 1])',\n 'rotationMatrix(1, matrix([0, 0, 1]), \"sparse\")'\n ],\n seealso: [\n 'cos', 'sin'\n ]\n}\n","export const rowDocs = {\n name: 'row',\n category: 'Matrix',\n syntax: [\n 'row(x, index)'\n ],\n description: 'Return a row from a matrix or array.',\n examples: [\n 'A = [[1, 2], [3, 4]]',\n 'row(A, 1)',\n 'row(A, 2)'\n ],\n seealso: ['column', 'matrixFromRows']\n}\n","export const sizeDocs = {\n name: 'size',\n category: 'Matrix',\n syntax: [\n 'size(x)'\n ],\n description: 'Calculate the size of a matrix.',\n examples: [\n 'size(2.3)',\n 'size(\"hello world\")',\n 'a = [1, 2; 3, 4; 5, 6]',\n 'size(a)',\n 'size(1:6)'\n ],\n seealso: [\n 'concat', 'count', 'det', 'diag', 'identity', 'inv', 'ones', 'range', 'squeeze', 'subset', 'trace', 'transpose', 'zeros'\n ]\n}\n","export const sortDocs = {\n name: 'sort',\n category: 'Matrix',\n syntax: [\n 'sort(x)',\n 'sort(x, compare)'\n ],\n description: 'Sort the items in a matrix. Compare can be a string \"asc\", \"desc\", \"natural\", or a custom sort function.',\n examples: [\n 'sort([5, 10, 1])',\n 'sort([\"C\", \"B\", \"A\", \"D\"], \"natural\")',\n 'sortByLength(a, b) = size(a)[1] - size(b)[1]',\n 'sort([\"Langdon\", \"Tom\", \"Sara\"], sortByLength)',\n 'sort([\"10\", \"1\", \"2\"], \"natural\")'\n ],\n seealso: ['map', 'filter', 'forEach']\n}\n","export const squeezeDocs = {\n name: 'squeeze',\n category: 'Matrix',\n syntax: [\n 'squeeze(x)'\n ],\n description: 'Remove inner and outer singleton dimensions from a matrix.',\n examples: [\n 'a = zeros(3,2,1)',\n 'size(squeeze(a))',\n 'b = zeros(1,1,3)',\n 'size(squeeze(b))'\n ],\n seealso: [\n 'concat', 'det', 'diag', 'identity', 'inv', 'ones', 'range', 'size', 'subset', 'trace', 'transpose', 'zeros'\n ]\n}\n","export const subsetDocs = {\n name: 'subset',\n category: 'Matrix',\n syntax: [\n 'value(index)',\n 'value(index) = replacement',\n 'subset(value, [index])',\n 'subset(value, [index], replacement)'\n ],\n description: 'Get or set a subset of the entries of a matrix or ' +\n 'characters of a string. ' +\n 'Indexes are one-based. There should be one index specification for ' +\n 'each dimension of the target. Each specification can be a single ' +\n 'index, a list of indices, or a range in colon notation `l:u`. ' +\n 'In a range, both the lower bound l and upper bound u are included; ' +\n 'and if a bound is omitted it defaults to the most extreme valid value. ' +\n 'The cartesian product of the indices specified in each dimension ' +\n 'determines the target of the operation.',\n examples: [\n 'd = [1, 2; 3, 4]',\n 'e = []',\n 'e[1, 1:2] = [5, 6]',\n 'e[2, :] = [7, 8]',\n 'f = d * e',\n 'f[2, 1]',\n 'f[:, 1]',\n 'f[[1,2], [1,3]] = [9, 10; 11, 12]',\n 'f'\n ],\n seealso: [\n 'concat', 'det', 'diag', 'identity', 'inv', 'ones', 'range', 'size', 'squeeze', 'trace', 'transpose', 'zeros'\n ]\n}\n","export const traceDocs = {\n name: 'trace',\n category: 'Matrix',\n syntax: [\n 'trace(A)'\n ],\n description: 'Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.',\n examples: [\n 'A = [1, 2, 3; -1, 2, 3; 2, 0, 3]',\n 'trace(A)'\n ],\n seealso: [\n 'concat', 'det', 'diag', 'identity', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'transpose', 'zeros'\n ]\n}\n","export const transposeDocs = {\n name: 'transpose',\n category: 'Matrix',\n syntax: [\n 'x\\'',\n 'transpose(x)'\n ],\n description: 'Transpose a matrix',\n examples: [\n 'a = [1, 2, 3; 4, 5, 6]',\n 'a\\'',\n 'transpose(a)'\n ],\n seealso: [\n 'concat', 'det', 'diag', 'identity', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'zeros'\n ]\n}\n","export const zerosDocs = {\n name: 'zeros',\n category: 'Matrix',\n syntax: [\n 'zeros(m)',\n 'zeros(m, n)',\n 'zeros(m, n, p, ...)',\n 'zeros([m])',\n 'zeros([m, n])',\n 'zeros([m, n, p, ...])'\n ],\n description: 'Create a matrix containing zeros.',\n examples: [\n 'zeros(3)',\n 'zeros(3, 5)',\n 'a = [1, 2, 3; 4, 5, 6]',\n 'zeros(size(a))'\n ],\n seealso: [\n 'concat', 'det', 'diag', 'identity', 'inv', 'ones', 'range', 'size', 'squeeze', 'subset', 'trace', 'transpose'\n ]\n}\n","export const fftDocs = {\n name: 'fft',\n category: 'Matrix',\n syntax: [\n 'fft(x)'\n ],\n description: 'Calculate N-dimensional Fourier transform',\n examples: [\n 'fft([[1, 0], [1, 0]])'\n ],\n seealso: [\n 'ifft'\n ]\n}\n","export const ifftDocs = {\n name: 'ifft',\n category: 'Matrix',\n syntax: [\n 'ifft(x)'\n ],\n description: 'Calculate N-dimensional inverse Fourier transform',\n examples: [\n 'ifft([[2, 2], [0, 0]])'\n ],\n seealso: [\n 'fft'\n ]\n}\n","export const sylvesterDocs = {\n name: 'sylvester',\n category: 'Algebra',\n syntax: [\n 'sylvester(A,B,C)'\n ],\n description: 'Solves the real-valued Sylvester equation AX+XB=C for X',\n examples: [\n 'sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])',\n 'A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]',\n 'sylvester(A, B, C)'\n ],\n seealso: [\n 'schur', 'lyap'\n ]\n}\n","export const schurDocs = {\n name: 'schur',\n category: 'Algebra',\n syntax: [\n 'schur(A)'\n ],\n description: 'Performs a real Schur decomposition of the real matrix A = UTU\\'',\n examples: [\n 'schur([[1, 0], [-4, 3]])',\n 'A = [[1, 0], [-4, 3]]',\n 'schur(A)'\n ],\n seealso: [\n 'lyap', 'sylvester'\n ]\n}\n","export const lyapDocs = {\n name: 'lyap',\n category: 'Algebra',\n syntax: [\n 'lyap(A,Q)'\n ],\n description: 'Solves the Continuous-time Lyapunov equation AP+PA\\'+Q=0 for P',\n examples: [\n 'lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])',\n 'A = [[-2, 0], [1, -4]]',\n 'Q = [[3, 1], [1, 3]]',\n 'lyap(A,Q)'\n ],\n seealso: [\n 'schur', 'sylvester'\n ]\n}\n","export const solveODEDocs = {\n name: 'solveODE',\n category: 'Numeric',\n syntax: [\n 'solveODE(func, tspan, y0)',\n 'solveODE(func, tspan, y0, options)'\n ],\n description: 'Numerical Integration of Ordinary Differential Equations.',\n examples: [\n 'f(t,y) = y',\n 'tspan = [0, 4]',\n 'solveODE(f, tspan, 1)',\n 'solveODE(f, tspan, [1, 2])',\n 'solveODE(f, tspan, 1, { method:\"RK23\", maxStep:0.1 })'\n ],\n seealso: ['derivative', 'simplifyCore']\n}\n","export const combinationsDocs = {\n name: 'combinations',\n category: 'Probability',\n syntax: [\n 'combinations(n, k)'\n ],\n description: 'Compute the number of combinations of n items taken k at a time',\n examples: [\n 'combinations(7, 5)'\n ],\n seealso: ['combinationsWithRep', 'permutations', 'factorial']\n}\n","export const combinationsWithRepDocs = {\n name: 'combinationsWithRep',\n category: 'Probability',\n syntax: [\n 'combinationsWithRep(n, k)'\n ],\n description: 'Compute the number of combinations of n items taken k at a time with replacements.',\n examples: [\n 'combinationsWithRep(7, 5)'\n ],\n seealso: ['combinations', 'permutations', 'factorial']\n}\n","export const factorialDocs = {\n name: 'factorial',\n category: 'Probability',\n syntax: [\n 'n!',\n 'factorial(n)'\n ],\n description: 'Compute the factorial of a value',\n examples: [\n '5!',\n '5 * 4 * 3 * 2 * 1',\n '3!'\n ],\n seealso: ['combinations', 'combinationsWithRep', 'permutations', 'gamma']\n}\n","export const gammaDocs = {\n name: 'gamma',\n category: 'Probability',\n syntax: [\n 'gamma(n)'\n ],\n description: 'Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.',\n examples: [\n 'gamma(4)',\n '3!',\n 'gamma(1/2)',\n 'sqrt(pi)'\n ],\n seealso: ['factorial']\n}\n","export const kldivergenceDocs = {\n name: 'kldivergence',\n category: 'Probability',\n syntax: [\n 'kldivergence(x, y)'\n ],\n description: 'Calculate the Kullback-Leibler (KL) divergence between two distributions.',\n examples: [\n 'kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])'\n ],\n seealso: []\n}\n","export const lgammaDocs = {\n name: 'lgamma',\n category: 'Probability',\n syntax: ['lgamma(n)'],\n description:\n 'Logarithm of the gamma function for real, positive numbers and complex numbers, ' +\n 'using Lanczos approximation for numbers and Stirling series for complex numbers.',\n examples: [\n 'lgamma(4)',\n 'lgamma(1/2)',\n 'lgamma(i)',\n 'lgamma(complex(1.1, 2))'\n ],\n seealso: ['gamma']\n}\n","export const multinomialDocs = {\n name: 'multinomial',\n category: 'Probability',\n syntax: [\n 'multinomial(A)'\n ],\n description: 'Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.',\n examples: [\n 'multinomial([1, 2, 1])'\n ],\n seealso: ['combinations', 'factorial']\n}\n","export const permutationsDocs = {\n name: 'permutations',\n category: 'Probability',\n syntax: [\n 'permutations(n)',\n 'permutations(n, k)'\n ],\n description: 'Compute the number of permutations of n items taken k at a time',\n examples: [\n 'permutations(5)',\n 'permutations(5, 3)'\n ],\n seealso: ['combinations', 'combinationsWithRep', 'factorial']\n}\n","export const pickRandomDocs = {\n name: 'pickRandom',\n category: 'Probability',\n syntax: [\n 'pickRandom(array)',\n 'pickRandom(array, number)',\n 'pickRandom(array, weights)',\n 'pickRandom(array, number, weights)',\n 'pickRandom(array, weights, number)'\n ],\n description:\n 'Pick a random entry from a given array.',\n examples: [\n 'pickRandom(0:10)',\n 'pickRandom([1, 3, 1, 6])',\n 'pickRandom([1, 3, 1, 6], 2)',\n 'pickRandom([1, 3, 1, 6], [2, 3, 2, 1])',\n 'pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])',\n 'pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)'\n ],\n seealso: ['random', 'randomInt']\n}\n","export const randomDocs = {\n name: 'random',\n category: 'Probability',\n syntax: [\n 'random()',\n 'random(max)',\n 'random(min, max)',\n 'random(size)',\n 'random(size, max)',\n 'random(size, min, max)'\n ],\n description:\n 'Return a random number.',\n examples: [\n 'random()',\n 'random(10, 20)',\n 'random([2, 3])'\n ],\n seealso: ['pickRandom', 'randomInt']\n}\n","export const randomIntDocs = {\n name: 'randomInt',\n category: 'Probability',\n syntax: [\n 'randomInt(max)',\n 'randomInt(min, max)',\n 'randomInt(size)',\n 'randomInt(size, max)',\n 'randomInt(size, min, max)'\n ],\n description:\n 'Return a random integer number',\n examples: [\n 'randomInt(10, 20)',\n 'randomInt([2, 3], 10)'\n ],\n seealso: ['pickRandom', 'random']\n}\n","export const compareDocs = {\n name: 'compare',\n category: 'Relational',\n syntax: [\n 'compare(x, y)'\n ],\n description:\n 'Compare two values. ' +\n 'Returns 1 when x > y, -1 when x < y, and 0 when x == y.',\n examples: [\n 'compare(2, 3)',\n 'compare(3, 2)',\n 'compare(2, 2)',\n 'compare(5cm, 40mm)',\n 'compare(2, [1, 2, 3])'\n ],\n seealso: [\n 'equal', 'unequal', 'smaller', 'smallerEq', 'largerEq', 'compareNatural', 'compareText'\n ]\n}\n","export const compareNaturalDocs = {\n name: 'compareNatural',\n category: 'Relational',\n syntax: [\n 'compareNatural(x, y)'\n ],\n description:\n 'Compare two values of any type in a deterministic, natural way. ' +\n 'Returns 1 when x > y, -1 when x < y, and 0 when x == y.',\n examples: [\n 'compareNatural(2, 3)',\n 'compareNatural(3, 2)',\n 'compareNatural(2, 2)',\n 'compareNatural(5cm, 40mm)',\n 'compareNatural(\"2\", \"10\")',\n 'compareNatural(2 + 3i, 2 + 4i)',\n 'compareNatural([1, 2, 4], [1, 2, 3])',\n 'compareNatural([1, 5], [1, 2, 3])',\n 'compareNatural([1, 2], [1, 2])',\n 'compareNatural({a: 2}, {a: 4})'\n ],\n seealso: [\n 'equal', 'unequal', 'smaller', 'smallerEq', 'largerEq', 'compare', 'compareText'\n ]\n}\n","export const compareTextDocs = {\n name: 'compareText',\n category: 'Relational',\n syntax: [\n 'compareText(x, y)'\n ],\n description:\n 'Compare two strings lexically. Comparison is case sensitive. ' +\n 'Returns 1 when x > y, -1 when x < y, and 0 when x == y.',\n examples: [\n 'compareText(\"B\", \"A\")',\n 'compareText(\"A\", \"B\")',\n 'compareText(\"A\", \"A\")',\n 'compareText(\"2\", \"10\")',\n 'compare(\"2\", \"10\")',\n 'compare(2, 10)',\n 'compareNatural(\"2\", \"10\")',\n 'compareText(\"B\", [\"A\", \"B\", \"C\"])'\n ],\n seealso: [\n 'compare', 'compareNatural'\n ]\n}\n","export const deepEqualDocs = {\n name: 'deepEqual',\n category: 'Relational',\n syntax: [\n 'deepEqual(x, y)'\n ],\n description:\n 'Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.',\n examples: [\n 'deepEqual([1,3,4], [1,3,4])',\n 'deepEqual([1,3,4], [1,3])'\n ],\n seealso: [\n 'equal', 'unequal', 'smaller', 'larger', 'smallerEq', 'largerEq', 'compare'\n ]\n}\n","export const equalDocs = {\n name: 'equal',\n category: 'Relational',\n syntax: [\n 'x == y',\n 'equal(x, y)'\n ],\n description:\n 'Check equality of two values. Returns true if the values are equal, and false if not.',\n examples: [\n '2+2 == 3',\n '2+2 == 4',\n 'a = 3.2',\n 'b = 6-2.8',\n 'a == b',\n '50cm == 0.5m'\n ],\n seealso: [\n 'unequal', 'smaller', 'larger', 'smallerEq', 'largerEq', 'compare', 'deepEqual', 'equalText'\n ]\n}\n","export const equalTextDocs = {\n name: 'equalText',\n category: 'Relational',\n syntax: [\n 'equalText(x, y)'\n ],\n description:\n 'Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.',\n examples: [\n 'equalText(\"Hello\", \"Hello\")',\n 'equalText(\"a\", \"A\")',\n 'equal(\"2e3\", \"2000\")',\n 'equalText(\"2e3\", \"2000\")',\n 'equalText(\"B\", [\"A\", \"B\", \"C\"])'\n ],\n seealso: [\n 'compare', 'compareNatural', 'compareText', 'equal'\n ]\n}\n","export const largerDocs = {\n name: 'larger',\n category: 'Relational',\n syntax: [\n 'x > y',\n 'larger(x, y)'\n ],\n description:\n 'Check if value x is larger than y. Returns true if x is larger than y, and false if not. Comparing a value with NaN returns false.',\n examples: [\n '2 > 3',\n '5 > 2*2',\n 'a = 3.3',\n 'b = 6-2.8',\n '(a > b)',\n '(b < a)',\n '5 cm > 2 inch'\n ],\n seealso: [\n 'equal', 'unequal', 'smaller', 'smallerEq', 'largerEq', 'compare'\n ]\n}\n","export const largerEqDocs = {\n name: 'largerEq',\n category: 'Relational',\n syntax: [\n 'x >= y',\n 'largerEq(x, y)'\n ],\n description:\n 'Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.',\n examples: [\n '2 >= 1+1',\n '2 > 1+1',\n 'a = 3.2',\n 'b = 6-2.8',\n '(a >= b)'\n ],\n seealso: [\n 'equal', 'unequal', 'smallerEq', 'smaller', 'compare'\n ]\n}\n","export const smallerDocs = {\n name: 'smaller',\n category: 'Relational',\n syntax: [\n 'x < y',\n 'smaller(x, y)'\n ],\n description:\n 'Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not. Comparing a value with NaN returns false.',\n examples: [\n '2 < 3',\n '5 < 2*2',\n 'a = 3.3',\n 'b = 6-2.8',\n '(a < b)',\n '5 cm < 2 inch'\n ],\n seealso: [\n 'equal', 'unequal', 'larger', 'smallerEq', 'largerEq', 'compare'\n ]\n}\n","export const smallerEqDocs = {\n name: 'smallerEq',\n category: 'Relational',\n syntax: [\n 'x <= y',\n 'smallerEq(x, y)'\n ],\n description:\n 'Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.',\n examples: [\n '2 <= 1+1',\n '2 < 1+1',\n 'a = 3.2',\n 'b = 6-2.8',\n '(a <= b)'\n ],\n seealso: [\n 'equal', 'unequal', 'larger', 'smaller', 'largerEq', 'compare'\n ]\n}\n","export const unequalDocs = {\n name: 'unequal',\n category: 'Relational',\n syntax: [\n 'x != y',\n 'unequal(x, y)'\n ],\n description:\n 'Check unequality of two values. Returns true if the values are unequal, and false if they are equal.',\n examples: [\n '2+2 != 3',\n '2+2 != 4',\n 'a = 3.2',\n 'b = 6-2.8',\n 'a != b',\n '50cm != 0.5m',\n '5 cm != 2 inch'\n ],\n seealso: [\n 'equal', 'smaller', 'larger', 'smallerEq', 'largerEq', 'compare', 'deepEqual'\n ]\n}\n","export const setCartesianDocs = {\n name: 'setCartesian',\n category: 'Set',\n syntax: [\n 'setCartesian(set1, set2)'\n ],\n description:\n 'Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays and the values will be sorted in ascending order before the operation.',\n examples: [\n 'setCartesian([1, 2], [3, 4])'\n ],\n seealso: [\n 'setUnion', 'setIntersect', 'setDifference', 'setPowerset'\n ]\n}\n","export const setDifferenceDocs = {\n name: 'setDifference',\n category: 'Set',\n syntax: [\n 'setDifference(set1, set2)'\n ],\n description:\n 'Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.',\n examples: [\n 'setDifference([1, 2, 3, 4], [3, 4, 5, 6])',\n 'setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])'\n ],\n seealso: [\n 'setUnion', 'setIntersect', 'setSymDifference'\n ]\n}\n","export const setDistinctDocs = {\n name: 'setDistinct',\n category: 'Set',\n syntax: [\n 'setDistinct(set)'\n ],\n description:\n 'Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.',\n examples: [\n 'setDistinct([1, 1, 1, 2, 2, 3])'\n ],\n seealso: [\n 'setMultiplicity'\n ]\n}\n","export const setIntersectDocs = {\n name: 'setIntersect',\n category: 'Set',\n syntax: [\n 'setIntersect(set1, set2)'\n ],\n description:\n 'Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.',\n examples: [\n 'setIntersect([1, 2, 3, 4], [3, 4, 5, 6])',\n 'setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])'\n ],\n seealso: [\n 'setUnion', 'setDifference'\n ]\n}\n","export const setIsSubsetDocs = {\n name: 'setIsSubset',\n category: 'Set',\n syntax: [\n 'setIsSubset(set1, set2)'\n ],\n description:\n 'Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.',\n examples: [\n 'setIsSubset([1, 2], [3, 4, 5, 6])',\n 'setIsSubset([3, 4], [3, 4, 5, 6])'\n ],\n seealso: [\n 'setUnion', 'setIntersect', 'setDifference'\n ]\n}\n","export const setMultiplicityDocs = {\n name: 'setMultiplicity',\n category: 'Set',\n syntax: [\n 'setMultiplicity(element, set)'\n ],\n description:\n 'Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.',\n examples: [\n 'setMultiplicity(1, [1, 2, 2, 4])',\n 'setMultiplicity(2, [1, 2, 2, 4])'\n ],\n seealso: [\n 'setDistinct', 'setSize'\n ]\n}\n","export const setPowersetDocs = {\n name: 'setPowerset',\n category: 'Set',\n syntax: [\n 'setPowerset(set)'\n ],\n description:\n 'Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.',\n examples: [\n 'setPowerset([1, 2, 3])'\n ],\n seealso: [\n 'setCartesian'\n ]\n}\n","export const setSizeDocs = {\n name: 'setSize',\n category: 'Set',\n syntax: [\n 'setSize(set)',\n 'setSize(set, unique)'\n ],\n description:\n 'Count the number of elements of a (multi)set. When the second parameter \"unique\" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',\n examples: [\n 'setSize([1, 2, 2, 4])',\n 'setSize([1, 2, 2, 4], true)'\n ],\n seealso: [\n 'setUnion', 'setIntersect', 'setDifference'\n ]\n}\n","export const setSymDifferenceDocs = {\n name: 'setSymDifference',\n category: 'Set',\n syntax: [\n 'setSymDifference(set1, set2)'\n ],\n description:\n 'Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.',\n examples: [\n 'setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])',\n 'setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])'\n ],\n seealso: [\n 'setUnion', 'setIntersect', 'setDifference'\n ]\n}\n","export const setUnionDocs = {\n name: 'setUnion',\n category: 'Set',\n syntax: [\n 'setUnion(set1, set2)'\n ],\n description:\n 'Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.',\n examples: [\n 'setUnion([1, 2, 3, 4], [3, 4, 5, 6])',\n 'setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])'\n ],\n seealso: [\n 'setIntersect', 'setDifference'\n ]\n}\n","export const zpk2tfDocs = {\n name: 'zpk2tf',\n category: 'Signal',\n syntax: [\n 'zpk2tf(z, p, k)'\n ],\n description: 'Compute the transfer function of a zero-pole-gain model.',\n examples: [\n 'zpk2tf([1, 2], [-1, -2], 1)',\n 'zpk2tf([1, 2], [-1, -2])',\n 'zpk2tf([1 - 3i, 2 + 2i], [-1, -2])'\n ],\n seealso: []\n}\n","export const freqzDocs = {\n name: 'freqz',\n category: 'Signal',\n syntax: [\n 'freqz(b, a)',\n 'freqz(b, a, w)'\n ],\n description: 'Calculates the frequency response of a filter given its numerator and denominator coefficients.',\n examples: [\n 'freqz([1, 2], [1, 2, 3])',\n 'freqz([1, 2], [1, 2, 3], [0, 1])',\n 'freqz([1, 2], [1, 2, 3], 512)'\n ],\n seealso: []\n}\n","export const erfDocs = {\n name: 'erf',\n category: 'Special',\n syntax: [\n 'erf(x)'\n ],\n description: 'Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x',\n examples: [\n 'erf(0.2)',\n 'erf(-0.5)',\n 'erf(4)'\n ],\n seealso: []\n}\n","export const zetaDocs = {\n name: 'zeta',\n category: 'Special',\n syntax: [\n 'zeta(s)'\n ],\n description: 'Compute the Riemann Zeta Function using an infinite series and Riemann\\'s Functional Equation for the entire complex plane',\n examples: [\n 'zeta(0.2)',\n 'zeta(-0.5)',\n 'zeta(4)'\n ],\n seealso: []\n}\n","export const cumSumDocs = {\n name: 'cumsum',\n category: 'Statistics',\n syntax: [\n 'cumsum(a, b, c, ...)',\n 'cumsum(A)'\n ],\n description: 'Compute the cumulative sum of all values.',\n examples: [\n 'cumsum(2, 3, 4, 1)',\n 'cumsum([2, 3, 4, 1])',\n 'cumsum([1, 2; 3, 4])',\n 'cumsum([1, 2; 3, 4], 1)',\n 'cumsum([1, 2; 3, 4], 2)'\n ],\n seealso: [\n 'max',\n 'mean',\n 'median',\n 'min',\n 'prod',\n 'std',\n 'sum',\n 'variance'\n ]\n}\n","export const madDocs = {\n name: 'mad',\n category: 'Statistics',\n syntax: [\n 'mad(a, b, c, ...)',\n 'mad(A)'\n ],\n description: 'Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.',\n examples: [\n 'mad(10, 20, 30)',\n 'mad([1, 2, 3])'\n ],\n seealso: [\n 'mean',\n 'median',\n 'std',\n 'abs'\n ]\n}\n","export const maxDocs = {\n name: 'max',\n category: 'Statistics',\n syntax: [\n 'max(a, b, c, ...)',\n 'max(A)',\n 'max(A, dimension)'\n ],\n description: 'Compute the maximum value of a list of values. If any NaN values are found, the function yields the last NaN in the input.',\n examples: [\n 'max(2, 3, 4, 1)',\n 'max([2, 3, 4, 1])',\n 'max([2, 5; 4, 3])',\n 'max([2, 5; 4, 3], 1)',\n 'max([2, 5; 4, 3], 2)',\n 'max(2.7, 7.1, -4.5, 2.0, 4.1)',\n 'min(2.7, 7.1, -4.5, 2.0, 4.1)'\n ],\n seealso: [\n 'mean',\n 'median',\n 'min',\n 'prod',\n 'std',\n 'sum',\n 'variance'\n ]\n}\n","export const meanDocs = {\n name: 'mean',\n category: 'Statistics',\n syntax: [\n 'mean(a, b, c, ...)',\n 'mean(A)',\n 'mean(A, dimension)'\n ],\n description: 'Compute the arithmetic mean of a list of values.',\n examples: [\n 'mean(2, 3, 4, 1)',\n 'mean([2, 3, 4, 1])',\n 'mean([2, 5; 4, 3])',\n 'mean([2, 5; 4, 3], 1)',\n 'mean([2, 5; 4, 3], 2)',\n 'mean([1.0, 2.7, 3.2, 4.0])'\n ],\n seealso: [\n 'max',\n 'median',\n 'min',\n 'prod',\n 'std',\n 'sum',\n 'variance'\n ]\n}\n","export const medianDocs = {\n name: 'median',\n category: 'Statistics',\n syntax: [\n 'median(a, b, c, ...)',\n 'median(A)'\n ],\n description: 'Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.',\n examples: [\n 'median(5, 2, 7)',\n 'median([3, -1, 5, 7])'\n ],\n seealso: [\n 'max',\n 'mean',\n 'min',\n 'prod',\n 'std',\n 'sum',\n 'variance',\n 'quantileSeq'\n ]\n}\n","export const minDocs = {\n name: 'min',\n category: 'Statistics',\n syntax: [\n 'min(a, b, c, ...)',\n 'min(A)',\n 'min(A, dimension)'\n ],\n description: 'Compute the minimum value of a list of values. If any NaN values are found, the function yields the last NaN in the input.',\n examples: [\n 'min(2, 3, 4, 1)',\n 'min([2, 3, 4, 1])',\n 'min([2, 5; 4, 3])',\n 'min([2, 5; 4, 3], 1)',\n 'min([2, 5; 4, 3], 2)',\n 'min(2.7, 7.1, -4.5, 2.0, 4.1)',\n 'max(2.7, 7.1, -4.5, 2.0, 4.1)'\n ],\n seealso: [\n 'max',\n 'mean',\n 'median',\n 'prod',\n 'std',\n 'sum',\n 'variance'\n ]\n}\n","export const modeDocs = {\n name: 'mode',\n category: 'Statistics',\n syntax: [\n 'mode(a, b, c, ...)',\n 'mode(A)',\n 'mode(A, a, b, B, c, ...)'\n ],\n description: 'Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.',\n examples: [\n 'mode(2, 1, 4, 3, 1)',\n 'mode([1, 2.7, 3.2, 4, 2.7])',\n 'mode(1, 4, 6, 1, 6)'\n ],\n seealso: [\n 'max',\n 'mean',\n 'min',\n 'median',\n 'prod',\n 'std',\n 'sum',\n 'variance'\n ]\n}\n","export const prodDocs = {\n name: 'prod',\n category: 'Statistics',\n syntax: [\n 'prod(a, b, c, ...)',\n 'prod(A)'\n ],\n description: 'Compute the product of all values.',\n examples: [\n 'prod(2, 3, 4)',\n 'prod([2, 3, 4])',\n 'prod([2, 5; 4, 3])'\n ],\n seealso: [\n 'max',\n 'mean',\n 'min',\n 'median',\n 'min',\n 'std',\n 'sum',\n 'variance'\n ]\n}\n","export const quantileSeqDocs = {\n name: 'quantileSeq',\n category: 'Statistics',\n syntax: [\n 'quantileSeq(A, prob[, sorted])',\n 'quantileSeq(A, [prob1, prob2, ...][, sorted])',\n 'quantileSeq(A, N[, sorted])'\n ],\n description: 'Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probability are: Number, BigNumber. \\n\\nIn case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.',\n examples: [\n 'quantileSeq([3, -1, 5, 7], 0.5)',\n 'quantileSeq([3, -1, 5, 7], [1/3, 2/3])',\n 'quantileSeq([3, -1, 5, 7], 2)',\n 'quantileSeq([-1, 3, 5, 7], 0.5, true)'\n ],\n seealso: [\n 'mean',\n 'median',\n 'min',\n 'max',\n 'prod',\n 'std',\n 'sum',\n 'variance'\n ]\n}\n","export const stdDocs = {\n name: 'std',\n category: 'Statistics',\n syntax: [\n 'std(a, b, c, ...)',\n 'std(A)',\n 'std(A, dimension)',\n 'std(A, normalization)',\n 'std(A, dimension, normalization)'\n ],\n description: 'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be \"unbiased\" (default), \"uncorrected\", or \"biased\".',\n examples: [\n 'std(2, 4, 6)',\n 'std([2, 4, 6, 8])',\n 'std([2, 4, 6, 8], \"uncorrected\")',\n 'std([2, 4, 6, 8], \"biased\")',\n 'std([1, 2, 3; 4, 5, 6])'\n ],\n seealso: [\n 'max',\n 'mean',\n 'min',\n 'median',\n 'prod',\n 'sum',\n 'variance'\n ]\n}\n","export const sumDocs = {\n name: 'sum',\n category: 'Statistics',\n syntax: [\n 'sum(a, b, c, ...)',\n 'sum(A)',\n 'sum(A, dimension)'\n ],\n description: 'Compute the sum of all values.',\n examples: [\n 'sum(2, 3, 4, 1)',\n 'sum([2, 3, 4, 1])',\n 'sum([2, 5; 4, 3])'\n ],\n seealso: [\n 'max',\n 'mean',\n 'median',\n 'min',\n 'prod',\n 'std',\n 'variance'\n ]\n}\n","export const varianceDocs = {\n name: 'variance',\n category: 'Statistics',\n syntax: [\n 'variance(a, b, c, ...)',\n 'variance(A)',\n 'variance(A, dimension)',\n 'variance(A, normalization)',\n 'variance(A, dimension, normalization)'\n ],\n description: 'Compute the variance of all values. Optional parameter normalization can be \"unbiased\" (default), \"uncorrected\", or \"biased\".',\n examples: [\n 'variance(2, 4, 6)',\n 'variance([2, 4, 6, 8])',\n 'variance([2, 4, 6, 8], \"uncorrected\")',\n 'variance([2, 4, 6, 8], \"biased\")',\n 'variance([1, 2, 3; 4, 5, 6])'\n ],\n seealso: [\n 'max',\n 'mean',\n 'min',\n 'median',\n 'min',\n 'prod',\n 'std',\n 'sum'\n ]\n}\n","export const corrDocs = {\n name: 'corr',\n category: 'Statistics',\n syntax: [\n 'corr(A,B)'\n ],\n description: 'Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.',\n examples: [\n 'corr([2, 4, 6, 8],[1, 2, 3, 6])',\n 'corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))'\n ],\n seealso: [\n 'max',\n 'mean',\n 'min',\n 'median',\n 'min',\n 'prod',\n 'std',\n 'sum'\n ]\n}\n","export const acosDocs = {\n name: 'acos',\n category: 'Trigonometry',\n syntax: [\n 'acos(x)'\n ],\n description: 'Compute the inverse cosine of a value in radians.',\n examples: [\n 'acos(0.5)',\n 'acos(cos(2.3))'\n ],\n seealso: [\n 'cos',\n 'atan',\n 'asin'\n ]\n}\n","export const acoshDocs = {\n name: 'acosh',\n category: 'Trigonometry',\n syntax: [\n 'acosh(x)'\n ],\n description: 'Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.',\n examples: [\n 'acosh(1.5)'\n ],\n seealso: [\n 'cosh',\n 'asinh',\n 'atanh'\n ]\n}\n","export const acotDocs = {\n name: 'acot',\n category: 'Trigonometry',\n syntax: [\n 'acot(x)'\n ],\n description: 'Calculate the inverse cotangent of a value.',\n examples: [\n 'acot(0.5)',\n 'acot(cot(0.5))',\n 'acot(2)'\n ],\n seealso: [\n 'cot',\n 'atan'\n ]\n}\n","export const acothDocs = {\n name: 'acoth',\n category: 'Trigonometry',\n syntax: [\n 'acoth(x)'\n ],\n description: 'Calculate the inverse hyperbolic tangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.',\n examples: [\n 'acoth(2)',\n 'acoth(0.5)'\n ],\n seealso: [\n 'acsch',\n 'asech'\n ]\n}\n","export const acscDocs = {\n name: 'acsc',\n category: 'Trigonometry',\n syntax: [\n 'acsc(x)'\n ],\n description: 'Calculate the inverse cotangent of a value.',\n examples: [\n 'acsc(2)',\n 'acsc(csc(0.5))',\n 'acsc(0.5)'\n ],\n seealso: [\n 'csc',\n 'asin',\n 'asec'\n ]\n}\n","export const acschDocs = {\n name: 'acsch',\n category: 'Trigonometry',\n syntax: [\n 'acsch(x)'\n ],\n description: 'Calculate the inverse hyperbolic cosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.',\n examples: [\n 'acsch(0.5)'\n ],\n seealso: [\n 'asech',\n 'acoth'\n ]\n}\n","export const asecDocs = {\n name: 'asec',\n category: 'Trigonometry',\n syntax: [\n 'asec(x)'\n ],\n description: 'Calculate the inverse secant of a value.',\n examples: [\n 'asec(0.5)',\n 'asec(sec(0.5))',\n 'asec(2)'\n ],\n seealso: [\n 'acos',\n 'acot',\n 'acsc'\n ]\n}\n","export const asechDocs = {\n name: 'asech',\n category: 'Trigonometry',\n syntax: [\n 'asech(x)'\n ],\n description: 'Calculate the inverse secant of a value.',\n examples: [\n 'asech(0.5)'\n ],\n seealso: [\n 'acsch',\n 'acoth'\n ]\n}\n","export const asinDocs = {\n name: 'asin',\n category: 'Trigonometry',\n syntax: [\n 'asin(x)'\n ],\n description: 'Compute the inverse sine of a value in radians.',\n examples: [\n 'asin(0.5)',\n 'asin(sin(0.5))'\n ],\n seealso: [\n 'sin',\n 'acos',\n 'atan'\n ]\n}\n","export const asinhDocs = {\n name: 'asinh',\n category: 'Trigonometry',\n syntax: [\n 'asinh(x)'\n ],\n description: 'Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.',\n examples: [\n 'asinh(0.5)'\n ],\n seealso: [\n 'acosh',\n 'atanh'\n ]\n}\n","export const atanDocs = {\n name: 'atan',\n category: 'Trigonometry',\n syntax: [\n 'atan(x)'\n ],\n description: 'Compute the inverse tangent of a value in radians.',\n examples: [\n 'atan(0.5)',\n 'atan(tan(0.5))'\n ],\n seealso: [\n 'tan',\n 'acos',\n 'asin'\n ]\n}\n","export const atanhDocs = {\n name: 'atanh',\n category: 'Trigonometry',\n syntax: [\n 'atanh(x)'\n ],\n description: 'Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.',\n examples: [\n 'atanh(0.5)'\n ],\n seealso: [\n 'acosh',\n 'asinh'\n ]\n}\n","export const atan2Docs = {\n name: 'atan2',\n category: 'Trigonometry',\n syntax: [\n 'atan2(y, x)'\n ],\n description:\n 'Computes the principal value of the arc tangent of y/x in radians.',\n examples: [\n 'atan2(2, 2) / pi',\n 'angle = 60 deg in rad',\n 'x = cos(angle)',\n 'y = sin(angle)',\n 'atan2(y, x)'\n ],\n seealso: [\n 'sin',\n 'cos',\n 'tan'\n ]\n}\n","export const cosDocs = {\n name: 'cos',\n category: 'Trigonometry',\n syntax: [\n 'cos(x)'\n ],\n description: 'Compute the cosine of x in radians.',\n examples: [\n 'cos(2)',\n 'cos(pi / 4) ^ 2',\n 'cos(180 deg)',\n 'cos(60 deg)',\n 'sin(0.2)^2 + cos(0.2)^2'\n ],\n seealso: [\n 'acos',\n 'sin',\n 'tan'\n ]\n}\n","export const coshDocs = {\n name: 'cosh',\n category: 'Trigonometry',\n syntax: [\n 'cosh(x)'\n ],\n description: 'Compute the hyperbolic cosine of x in radians.',\n examples: [\n 'cosh(0.5)'\n ],\n seealso: [\n 'sinh',\n 'tanh',\n 'coth'\n ]\n}\n","export const cotDocs = {\n name: 'cot',\n category: 'Trigonometry',\n syntax: [\n 'cot(x)'\n ],\n description: 'Compute the cotangent of x in radians. Defined as 1/tan(x)',\n examples: [\n 'cot(2)',\n '1 / tan(2)'\n ],\n seealso: [\n 'sec',\n 'csc',\n 'tan'\n ]\n}\n","export const cothDocs = {\n name: 'coth',\n category: 'Trigonometry',\n syntax: [\n 'coth(x)'\n ],\n description: 'Compute the hyperbolic cotangent of x in radians.',\n examples: [\n 'coth(2)',\n '1 / tanh(2)'\n ],\n seealso: [\n 'sech',\n 'csch',\n 'tanh'\n ]\n}\n","export const cscDocs = {\n name: 'csc',\n category: 'Trigonometry',\n syntax: [\n 'csc(x)'\n ],\n description: 'Compute the cosecant of x in radians. Defined as 1/sin(x)',\n examples: [\n 'csc(2)',\n '1 / sin(2)'\n ],\n seealso: [\n 'sec',\n 'cot',\n 'sin'\n ]\n}\n","export const cschDocs = {\n name: 'csch',\n category: 'Trigonometry',\n syntax: [\n 'csch(x)'\n ],\n description: 'Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)',\n examples: [\n 'csch(2)',\n '1 / sinh(2)'\n ],\n seealso: [\n 'sech',\n 'coth',\n 'sinh'\n ]\n}\n","export const secDocs = {\n name: 'sec',\n category: 'Trigonometry',\n syntax: [\n 'sec(x)'\n ],\n description: 'Compute the secant of x in radians. Defined as 1/cos(x)',\n examples: [\n 'sec(2)',\n '1 / cos(2)'\n ],\n seealso: [\n 'cot',\n 'csc',\n 'cos'\n ]\n}\n","export const sechDocs = {\n name: 'sech',\n category: 'Trigonometry',\n syntax: [\n 'sech(x)'\n ],\n description: 'Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)',\n examples: [\n 'sech(2)',\n '1 / cosh(2)'\n ],\n seealso: [\n 'coth',\n 'csch',\n 'cosh'\n ]\n}\n","export const sinDocs = {\n name: 'sin',\n category: 'Trigonometry',\n syntax: [\n 'sin(x)'\n ],\n description: 'Compute the sine of x in radians.',\n examples: [\n 'sin(2)',\n 'sin(pi / 4) ^ 2',\n 'sin(90 deg)',\n 'sin(30 deg)',\n 'sin(0.2)^2 + cos(0.2)^2'\n ],\n seealso: [\n 'asin',\n 'cos',\n 'tan'\n ]\n}\n","export const sinhDocs = {\n name: 'sinh',\n category: 'Trigonometry',\n syntax: [\n 'sinh(x)'\n ],\n description: 'Compute the hyperbolic sine of x in radians.',\n examples: [\n 'sinh(0.5)'\n ],\n seealso: [\n 'cosh',\n 'tanh'\n ]\n}\n","export const tanDocs = {\n name: 'tan',\n category: 'Trigonometry',\n syntax: [\n 'tan(x)'\n ],\n description: 'Compute the tangent of x in radians.',\n examples: [\n 'tan(0.5)',\n 'sin(0.5) / cos(0.5)',\n 'tan(pi / 4)',\n 'tan(45 deg)'\n ],\n seealso: [\n 'atan',\n 'sin',\n 'cos'\n ]\n}\n","export const tanhDocs = {\n name: 'tanh',\n category: 'Trigonometry',\n syntax: [\n 'tanh(x)'\n ],\n description: 'Compute the hyperbolic tangent of x in radians.',\n examples: [\n 'tanh(0.5)',\n 'sinh(0.5) / cosh(0.5)'\n ],\n seealso: [\n 'sinh',\n 'cosh'\n ]\n}\n","export const toDocs = {\n name: 'to',\n category: 'Units',\n syntax: [\n 'x to unit',\n 'to(x, unit)'\n ],\n description: 'Change the unit of a value.',\n examples: [\n '5 inch to cm',\n '3.2kg to g',\n '16 bytes in bits'\n ],\n seealso: []\n}\n","export const cloneDocs = {\n name: 'clone',\n category: 'Utils',\n syntax: [\n 'clone(x)'\n ],\n description: 'Clone a variable. Creates a copy of primitive variables, and a deep copy of matrices',\n examples: [\n 'clone(3.5)',\n 'clone(2 - 4i)',\n 'clone(45 deg)',\n 'clone([1, 2; 3, 4])',\n 'clone(\"hello world\")'\n ],\n seealso: []\n}\n","export const formatDocs = {\n name: 'format',\n category: 'Utils',\n syntax: [\n 'format(value)',\n 'format(value, precision)'\n ],\n description: 'Format a value of any type as string.',\n examples: [\n 'format(2.3)',\n 'format(3 - 4i)',\n 'format([])',\n 'format(pi, 3)'\n ],\n seealso: ['print']\n}\n","export const binDocs = {\n name: 'bin',\n category: 'Utils',\n syntax: [\n 'bin(value)'\n ],\n description: 'Format a number as binary',\n examples: [\n 'bin(2)'\n ],\n seealso: ['oct', 'hex']\n}\n","export const octDocs = {\n name: 'oct',\n category: 'Utils',\n syntax: [\n 'oct(value)'\n ],\n description: 'Format a number as octal',\n examples: [\n 'oct(56)'\n ],\n seealso: ['bin', 'hex']\n}\n","export const hexDocs = {\n name: 'hex',\n category: 'Utils',\n syntax: [\n 'hex(value)'\n ],\n description: 'Format a number as hexadecimal',\n examples: [\n 'hex(240)'\n ],\n seealso: ['bin', 'oct']\n}\n","export const isNaNDocs = {\n name: 'isNaN',\n category: 'Utils',\n syntax: [\n 'isNaN(x)'\n ],\n description: 'Test whether a value is NaN (not a number)',\n examples: [\n 'isNaN(2)',\n 'isNaN(0 / 0)',\n 'isNaN(NaN)',\n 'isNaN(Infinity)'\n ],\n seealso: ['isNegative', 'isNumeric', 'isPositive', 'isZero']\n}\n","export const isIntegerDocs = {\n name: 'isInteger',\n category: 'Utils',\n syntax: [\n 'isInteger(x)'\n ],\n description: 'Test whether a value is an integer number.',\n examples: [\n 'isInteger(2)',\n 'isInteger(3.5)',\n 'isInteger([3, 0.5, -2])'\n ],\n seealso: ['isNegative', 'isNumeric', 'isPositive', 'isZero']\n}\n","export const isNegativeDocs = {\n name: 'isNegative',\n category: 'Utils',\n syntax: [\n 'isNegative(x)'\n ],\n description: 'Test whether a value is negative: smaller than zero.',\n examples: [\n 'isNegative(2)',\n 'isNegative(0)',\n 'isNegative(-4)',\n 'isNegative([3, 0.5, -2])'\n ],\n seealso: ['isInteger', 'isNumeric', 'isPositive', 'isZero']\n}\n","export const isNumericDocs = {\n name: 'isNumeric',\n category: 'Utils',\n syntax: [\n 'isNumeric(x)'\n ],\n description: 'Test whether a value is a numeric value. ' +\n 'Returns true when the input is a number, BigNumber, Fraction, or boolean.',\n examples: [\n 'isNumeric(2)',\n 'isNumeric(\"2\")',\n 'hasNumericValue(\"2\")',\n 'isNumeric(0)',\n 'isNumeric(bignumber(500))',\n 'isNumeric(fraction(0.125))',\n 'isNumeric(2 + 3i)',\n 'isNumeric([2.3, \"foo\", false])'\n ],\n seealso: ['isInteger', 'isZero', 'isNegative', 'isPositive', 'isNaN', 'hasNumericValue']\n}\n","export const hasNumericValueDocs = {\n name: 'hasNumericValue',\n category: 'Utils',\n syntax: [\n 'hasNumericValue(x)'\n ],\n description: 'Test whether a value is an numeric value. ' +\n 'In case of a string, true is returned if the string contains a numeric value.',\n examples: [\n 'hasNumericValue(2)',\n 'hasNumericValue(\"2\")',\n 'isNumeric(\"2\")',\n 'hasNumericValue(0)',\n 'hasNumericValue(bignumber(500))',\n 'hasNumericValue(fraction(0.125))',\n 'hasNumericValue(2 + 3i)',\n 'hasNumericValue([2.3, \"foo\", false])'\n ],\n seealso: ['isInteger', 'isZero', 'isNegative', 'isPositive', 'isNaN', 'isNumeric']\n}\n","export const isPositiveDocs = {\n name: 'isPositive',\n category: 'Utils',\n syntax: [\n 'isPositive(x)'\n ],\n description: 'Test whether a value is positive: larger than zero.',\n examples: [\n 'isPositive(2)',\n 'isPositive(0)',\n 'isPositive(-4)',\n 'isPositive([3, 0.5, -2])'\n ],\n seealso: ['isInteger', 'isNumeric', 'isNegative', 'isZero']\n}\n","export const isPrimeDocs = {\n name: 'isPrime',\n category: 'Utils',\n syntax: [\n 'isPrime(x)'\n ],\n description: 'Test whether a value is prime: has no divisors other than itself and one.',\n examples: [\n 'isPrime(3)',\n 'isPrime(-2)',\n 'isPrime([2, 17, 100])'\n ],\n seealso: ['isInteger', 'isNumeric', 'isNegative', 'isZero']\n}\n","export const isZeroDocs = {\n name: 'isZero',\n category: 'Utils',\n syntax: [\n 'isZero(x)'\n ],\n description: 'Test whether a value is zero.',\n examples: [\n 'isZero(2)',\n 'isZero(0)',\n 'isZero(-4)',\n 'isZero([3, 0, -2, 0])'\n ],\n seealso: ['isInteger', 'isNumeric', 'isNegative', 'isPositive']\n}\n","export const printDocs = {\n name: 'print',\n category: 'Utils',\n syntax: [\n 'print(template, values)',\n 'print(template, values, precision)'\n ],\n description: 'Interpolate values into a string template.',\n examples: [\n 'print(\"Lucy is $age years old\", {age: 5})',\n 'print(\"The value of pi is $pi\", {pi: pi}, 3)',\n 'print(\"Hello, $user.name!\", {user: {name: \"John\"}})',\n 'print(\"Values: $1, $2, $3\", [6, 9, 4])'\n ],\n seealso: ['format']\n}\n","export const typeOfDocs = {\n name: 'typeOf',\n category: 'Utils',\n syntax: [\n 'typeOf(x)'\n ],\n description: 'Get the type of a variable.',\n examples: [\n 'typeOf(3.5)',\n 'typeOf(2 - 4i)',\n 'typeOf(45 deg)',\n 'typeOf(\"hello world\")'\n ],\n seealso: ['getMatrixDataType']\n}\n","export const numericDocs = {\n name: 'numeric',\n category: 'Utils',\n syntax: [\n 'numeric(x)'\n ],\n description: 'Convert a numeric input to a specific numeric type: number, BigNumber, bigint, or Fraction.',\n examples: [\n 'numeric(\"4\")',\n 'numeric(\"4\", \"number\")',\n 'numeric(\"4\", \"bigint\")',\n 'numeric(\"4\", \"BigNumber\")',\n 'numeric(\"4\", \"Fraction\")',\n 'numeric(4, \"Fraction\")',\n 'numeric(fraction(2, 5), \"number\")'\n ],\n seealso: ['number', 'bigint', 'fraction', 'bignumber', 'string', 'format']\n}\n","import { factory } from '../../utils/factory.js'\nimport { getSafeProperty } from '../../utils/customs.js'\nimport { embeddedDocs } from '../embeddedDocs/embeddedDocs.js'\nimport { hasOwnProperty } from '../../utils/object.js'\n\nconst name = 'help'\nconst dependencies = ['typed', 'mathWithTransform', 'Help']\n\nexport const createHelp = /* #__PURE__ */ factory(name, dependencies, ({ typed, mathWithTransform, Help }) => {\n /**\n * Retrieve help on a function or data type.\n * Help files are retrieved from the embedded documentation in math.docs.\n *\n * Syntax:\n *\n * math.help(search)\n *\n * Examples:\n *\n * console.log(math.help('sin').toString())\n * console.log(math.help(math.add).toString())\n * console.log(math.help(math.add).toJSON())\n *\n * @param {Function | string | Object} search A function or function name\n * for which to get help\n * @return {Help} A help object\n */\n return typed(name, {\n any: function (search) {\n let prop\n let searchName = search\n\n if (typeof search !== 'string') {\n for (prop in mathWithTransform) {\n // search in functions and constants\n if (hasOwnProperty(mathWithTransform, prop) && (search === mathWithTransform[prop])) {\n searchName = prop\n break\n }\n }\n\n /* TODO: implement help for data types\n if (!text) {\n // search data type\n for (prop in math.type) {\n if (hasOwnProperty(math, prop)) {\n if (search === math.type[prop]) {\n text = prop\n break\n }\n }\n }\n }\n */\n }\n\n const doc = getSafeProperty(embeddedDocs, searchName)\n if (!doc) {\n const searchText = typeof searchName === 'function' ? searchName.name : searchName\n throw new Error('No documentation found on \"' + searchText + '\"')\n }\n return new Help(doc)\n }\n })\n})\n","import { factory } from '../../../utils/factory.js'\n\nconst name = 'chain'\nconst dependencies = ['typed', 'Chain']\n\nexport const createChain = /* #__PURE__ */ factory(name, dependencies, ({ typed, Chain }) => {\n /**\n * Wrap any value in a chain, allowing to perform chained operations on\n * the value.\n *\n * All methods available in the math.js library can be called upon the chain,\n * and then will be evaluated with the value itself as first argument.\n * The chain can be closed by executing `chain.done()`, which returns\n * the final value.\n *\n * The chain has a number of special functions:\n *\n * - `done()` Finalize the chain and return the chain's value.\n * - `valueOf()` The same as `done()`\n * - `toString()` Executes `math.format()` onto the chain's value, returning\n * a string representation of the value.\n *\n * Syntax:\n *\n * math.chain(value)\n *\n * Examples:\n *\n * math.chain(3)\n * .add(4)\n * .subtract(2)\n * .done() // 5\n *\n * math.chain( [[1, 2], [3, 4]] )\n * .subset(math.index(0, 0), 8)\n * .multiply(3)\n * .done() // [[24, 6], [9, 12]]\n *\n * @param {*} [value] A value of any type on which to start a chained operation.\n * @return {math.Chain} The created chain\n */\n return typed(name, {\n '': function () {\n return new Chain()\n },\n\n any: function (value) {\n return new Chain(value)\n }\n })\n})\n","import { isMatrix } from '../../utils/is.js'\nimport { clone } from '../../utils/object.js'\nimport { format } from '../../utils/string.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'det'\nconst dependencies = ['typed', 'matrix', 'subtractScalar', 'multiply', 'divideScalar', 'isZero', 'unaryMinus']\n\nexport const createDet = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, subtractScalar, multiply, divideScalar, isZero, unaryMinus }) => {\n /**\n * Calculate the determinant of a matrix.\n *\n * Syntax:\n *\n * math.det(x)\n *\n * Examples:\n *\n * math.det([[1, 2], [3, 4]]) // returns -2\n *\n * const A = [\n * [-2, 2, 3],\n * [-1, 1, 3],\n * [2, 0, -1]\n * ]\n * math.det(A) // returns 6\n *\n * See also:\n *\n * inv\n *\n * @param {Array | Matrix} x A matrix\n * @return {number} The determinant of `x`\n */\n return typed(name, {\n any: function (x) {\n return clone(x)\n },\n\n 'Array | Matrix': function det (x) {\n let size\n if (isMatrix(x)) {\n size = x.size()\n } else if (Array.isArray(x)) {\n x = matrix(x)\n size = x.size()\n } else {\n // a scalar\n size = []\n }\n\n switch (size.length) {\n case 0:\n // scalar\n return clone(x)\n\n case 1:\n // vector\n if (size[0] === 1) {\n return clone(x.valueOf()[0])\n } if (size[0] === 0) {\n return 1 // det of an empty matrix is per definition 1\n } else {\n throw new RangeError('Matrix must be square ' +\n '(size: ' + format(size) + ')')\n }\n\n case 2:\n {\n // two-dimensional array\n const rows = size[0]\n const cols = size[1]\n if (rows === cols) {\n return _det(x.clone().valueOf(), rows, cols)\n } if (cols === 0) {\n return 1 // det of an empty matrix is per definition 1\n } else {\n throw new RangeError('Matrix must be square ' +\n '(size: ' + format(size) + ')')\n }\n }\n\n default:\n // multi dimensional array\n throw new RangeError('Matrix must be two dimensional ' +\n '(size: ' + format(size) + ')')\n }\n }\n })\n\n /**\n * Calculate the determinant of a matrix\n * @param {Array[]} matrix A square, two dimensional matrix\n * @param {number} rows Number of rows of the matrix (zero-based)\n * @param {number} cols Number of columns of the matrix (zero-based)\n * @returns {number} det\n * @private\n */\n function _det (matrix, rows, cols) {\n if (rows === 1) {\n // this is a 1 x 1 matrix\n return clone(matrix[0][0])\n } else if (rows === 2) {\n // this is a 2 x 2 matrix\n // the determinant of [a11,a12;a21,a22] is det = a11*a22-a21*a12\n return subtractScalar(\n multiply(matrix[0][0], matrix[1][1]),\n multiply(matrix[1][0], matrix[0][1])\n )\n } else {\n // Bareiss algorithm\n // this algorithm have same complexity as LUP decomposition (O(n^3))\n // but it preserve precision of floating point more relative to the LUP decomposition\n let negated = false\n const rowIndices = new Array(rows).fill(0).map((_, i) => i) // matrix index of row i\n for (let k = 0; k < rows; k++) {\n let k_ = rowIndices[k]\n if (isZero(matrix[k_][k])) {\n let _k\n for (_k = k + 1; _k < rows; _k++) {\n if (!isZero(matrix[rowIndices[_k]][k])) {\n k_ = rowIndices[_k]\n rowIndices[_k] = rowIndices[k]\n rowIndices[k] = k_\n negated = !negated\n break\n }\n }\n if (_k === rows) return matrix[k_][k] // some zero of the type\n }\n const piv = matrix[k_][k]\n const piv_ = k === 0 ? 1 : matrix[rowIndices[k - 1]][k - 1]\n for (let i = k + 1; i < rows; i++) {\n const i_ = rowIndices[i]\n for (let j = k + 1; j < rows; j++) {\n matrix[i_][j] = divideScalar(subtractScalar(multiply(matrix[i_][j], piv), multiply(matrix[i_][k], matrix[k_][j])), piv_)\n }\n }\n }\n const det = matrix[rowIndices[rows - 1]][rows - 1]\n return negated ? unaryMinus(det) : det\n }\n }\n})\n","import { isMatrix } from '../../utils/is.js'\nimport { arraySize } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\nimport { format } from '../../utils/string.js'\n\nconst name = 'inv'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'divideScalar',\n 'addScalar',\n 'multiply',\n 'unaryMinus',\n 'det',\n 'identity',\n 'abs'\n]\n\nexport const createInv = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, divideScalar, addScalar, multiply, unaryMinus, det, identity, abs }) => {\n /**\n * Calculate the inverse of a square matrix.\n *\n * Syntax:\n *\n * math.inv(x)\n *\n * Examples:\n *\n * math.inv([[1, 2], [3, 4]]) // returns [[-2, 1], [1.5, -0.5]]\n * math.inv(4) // returns 0.25\n * 1 / 4 // returns 0.25\n *\n * See also:\n *\n * det, transpose\n *\n * @param {number | Complex | Array | Matrix} x Matrix to be inversed\n * @return {number | Complex | Array | Matrix} The inverse of `x`.\n */\n return typed(name, {\n 'Array | Matrix': function (x) {\n const size = isMatrix(x) ? x.size() : arraySize(x)\n switch (size.length) {\n case 1:\n // vector\n if (size[0] === 1) {\n if (isMatrix(x)) {\n return matrix([\n divideScalar(1, x.valueOf()[0])\n ])\n } else {\n return [\n divideScalar(1, x[0])\n ]\n }\n } else {\n throw new RangeError('Matrix must be square ' +\n '(size: ' + format(size) + ')')\n }\n\n case 2:\n // two dimensional array\n {\n const rows = size[0]\n const cols = size[1]\n if (rows === cols) {\n if (isMatrix(x)) {\n return matrix(\n _inv(x.valueOf(), rows, cols),\n x.storage()\n )\n } else {\n // return an Array\n return _inv(x, rows, cols)\n }\n } else {\n throw new RangeError('Matrix must be square ' +\n '(size: ' + format(size) + ')')\n }\n }\n\n default:\n // multi dimensional array\n throw new RangeError('Matrix must be two dimensional ' +\n '(size: ' + format(size) + ')')\n }\n },\n\n any: function (x) {\n // scalar\n return divideScalar(1, x) // FIXME: create a BigNumber one when configured for bignumbers\n }\n })\n\n /**\n * Calculate the inverse of a square matrix\n * @param {Array[]} mat A square matrix\n * @param {number} rows Number of rows\n * @param {number} cols Number of columns, must equal rows\n * @return {Array[]} inv Inverse matrix\n * @private\n */\n function _inv (mat, rows, cols) {\n let r, s, f, value, temp\n\n if (rows === 1) {\n // this is a 1 x 1 matrix\n value = mat[0][0]\n if (value === 0) {\n throw Error('Cannot calculate inverse, determinant is zero')\n }\n return [[\n divideScalar(1, value)\n ]]\n } else if (rows === 2) {\n // this is a 2 x 2 matrix\n const d = det(mat)\n if (d === 0) {\n throw Error('Cannot calculate inverse, determinant is zero')\n }\n return [\n [\n divideScalar(mat[1][1], d),\n divideScalar(unaryMinus(mat[0][1]), d)\n ],\n [\n divideScalar(unaryMinus(mat[1][0]), d),\n divideScalar(mat[0][0], d)\n ]\n ]\n } else {\n // this is a matrix of 3 x 3 or larger\n // calculate inverse using gauss-jordan elimination\n // https://en.wikipedia.org/wiki/Gaussian_elimination\n // http://mathworld.wolfram.com/MatrixInverse.html\n // http://math.uww.edu/~mcfarlat/inverse.htm\n\n // make a copy of the matrix (only the arrays, not of the elements)\n const A = mat.concat()\n for (r = 0; r < rows; r++) {\n A[r] = A[r].concat()\n }\n\n // create an identity matrix which in the end will contain the\n // matrix inverse\n const B = identity(rows).valueOf()\n\n // loop over all columns, and perform row reductions\n for (let c = 0; c < cols; c++) {\n // Pivoting: Swap row c with row r, where row r contains the largest element A[r][c]\n let ABig = abs(A[c][c])\n let rBig = c\n r = c + 1\n while (r < rows) {\n if (abs(A[r][c]) > ABig) {\n ABig = abs(A[r][c])\n rBig = r\n }\n r++\n }\n if (ABig === 0) {\n throw Error('Cannot calculate inverse, determinant is zero')\n }\n r = rBig\n if (r !== c) {\n temp = A[c]; A[c] = A[r]; A[r] = temp\n temp = B[c]; B[c] = B[r]; B[r] = temp\n }\n\n // eliminate non-zero values on the other rows at column c\n const Ac = A[c]\n const Bc = B[c]\n for (r = 0; r < rows; r++) {\n const Ar = A[r]\n const Br = B[r]\n if (r !== c) {\n // eliminate value at column c and row r\n if (Ar[c] !== 0) {\n f = divideScalar(unaryMinus(Ar[c]), Ac[c])\n\n // add (f * row c) to row r to eliminate the value\n // at column c\n for (s = c; s < cols; s++) {\n Ar[s] = addScalar(Ar[s], multiply(f, Ac[s]))\n }\n for (s = 0; s < cols; s++) {\n Br[s] = addScalar(Br[s], multiply(f, Bc[s]))\n }\n }\n } else {\n // normalize value at Acc to 1,\n // divide each value on row r with the value at Acc\n f = Ac[c]\n for (s = c; s < cols; s++) {\n Ar[s] = divideScalar(Ar[s], f)\n }\n for (s = 0; s < cols; s++) {\n Br[s] = divideScalar(Br[s], f)\n }\n }\n }\n }\n return B\n }\n }\n})\n","import { isMatrix } from '../../utils/is.js'\nimport { arraySize } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\nimport { format } from '../../utils/string.js'\nimport { clone } from '../../utils/object.js'\n\nconst name = 'pinv'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'inv',\n 'deepEqual',\n 'equal',\n 'dotDivide',\n 'dot',\n 'ctranspose',\n 'divideScalar',\n 'multiply',\n 'add',\n 'Complex'\n]\n\nexport const createPinv = /* #__PURE__ */ factory(name, dependencies, ({\n typed,\n matrix,\n inv,\n deepEqual,\n equal,\n dotDivide,\n dot,\n ctranspose,\n divideScalar,\n multiply,\n add,\n Complex\n}) => {\n /**\n * Calculate the Moore–Penrose inverse of a matrix.\n *\n * Syntax:\n *\n * math.pinv(x)\n *\n * Examples:\n *\n * math.pinv([[1, 2], [3, 4]]) // returns [[-2, 1], [1.5, -0.5]]\n * math.pinv([[1, 0], [0, 1], [0, 1]]) // returns [[1, 0, 0], [0, 0.5, 0.5]]\n * math.pinv(4) // returns 0.25\n *\n * See also:\n *\n * inv\n *\n * @param {number | Complex | Array | Matrix} x Matrix to be inversed\n * @return {number | Complex | Array | Matrix} The inverse of `x`.\n */\n return typed(name, {\n 'Array | Matrix': function (x) {\n const size = isMatrix(x) ? x.size() : arraySize(x)\n switch (size.length) {\n case 1:\n // vector\n if (_isZeros(x)) return ctranspose(x) // null vector\n if (size[0] === 1) {\n return inv(x) // invertible matrix\n } else {\n return dotDivide(ctranspose(x), dot(x, x))\n }\n\n case 2:\n // two dimensional array\n {\n if (_isZeros(x)) return ctranspose(x) // zero matrixx\n const rows = size[0]\n const cols = size[1]\n if (rows === cols) {\n try {\n return inv(x) // invertible matrix\n } catch (err) {\n if (err instanceof Error && err.message.match(/Cannot calculate inverse, determinant is zero/)) {\n // Expected\n } else {\n throw err\n }\n }\n }\n if (isMatrix(x)) {\n return matrix(\n _pinv(x.valueOf(), rows, cols),\n x.storage()\n )\n } else {\n // return an Array\n return _pinv(x, rows, cols)\n }\n }\n\n default:\n // multi dimensional array\n throw new RangeError('Matrix must be two dimensional ' +\n '(size: ' + format(size) + ')')\n }\n },\n\n any: function (x) {\n // scalar\n if (equal(x, 0)) return clone(x) // zero\n return divideScalar(1, x)\n }\n })\n\n /**\n * Calculate the Moore–Penrose inverse of a matrix\n * @param {Array[]} mat A matrix\n * @param {number} rows Number of rows\n * @param {number} cols Number of columns\n * @return {Array[]} pinv Pseudoinverse matrix\n * @private\n */\n function _pinv (mat, rows, cols) {\n const { C, F } = _rankFact(mat, rows, cols) // TODO: Use SVD instead (may improve precision)\n const Cpinv = multiply(inv(multiply(ctranspose(C), C)), ctranspose(C))\n const Fpinv = multiply(ctranspose(F), inv(multiply(F, ctranspose(F))))\n return multiply(Fpinv, Cpinv)\n }\n\n /**\n * Calculate the reduced row echelon form of a matrix\n *\n * Modified from https://rosettacode.org/wiki/Reduced_row_echelon_form\n *\n * @param {Array[]} mat A matrix\n * @param {number} rows Number of rows\n * @param {number} cols Number of columns\n * @return {Array[]} Reduced row echelon form\n * @private\n */\n function _rref (mat, rows, cols) {\n const M = clone(mat)\n let lead = 0\n for (let r = 0; r < rows; r++) {\n if (cols <= lead) {\n return M\n }\n let i = r\n while (_isZero(M[i][lead])) {\n i++\n if (rows === i) {\n i = r\n lead++\n if (cols === lead) {\n return M\n }\n }\n }\n\n [M[i], M[r]] = [M[r], M[i]]\n\n let val = M[r][lead]\n for (let j = 0; j < cols; j++) {\n M[r][j] = dotDivide(M[r][j], val)\n }\n\n for (let i = 0; i < rows; i++) {\n if (i === r) continue\n val = M[i][lead]\n for (let j = 0; j < cols; j++) {\n M[i][j] = add(M[i][j], multiply(-1, multiply(val, M[r][j])))\n }\n }\n lead++\n }\n return M\n }\n\n /**\n * Calculate the rank factorization of a matrix\n *\n * @param {Array[]} mat A matrix (M)\n * @param {number} rows Number of rows\n * @param {number} cols Number of columns\n * @return {{C: Array, F: Array}} rank factorization where M = C F\n * @private\n */\n function _rankFact (mat, rows, cols) {\n const rref = _rref(mat, rows, cols)\n const C = mat.map((_, i) => _.filter((_, j) => j < rows && !_isZero(dot(rref[j], rref[j]))))\n const F = rref.filter((_, i) => !_isZero(dot(rref[i], rref[i])))\n return { C, F }\n }\n\n function _isZero (x) {\n return equal(add(x, Complex(1, 1)), add(0, Complex(1, 1)))\n }\n\n function _isZeros (arr) {\n return deepEqual(add(arr, Complex(1, 1)), add(multiply(arr, 0), Complex(1, 1)))\n }\n})\n","import { factory } from '../../utils/factory.js'\nimport { format } from '../../utils/string.js'\nimport { createComplexEigs } from './eigs/complexEigs.js'\nimport { createRealSymmetric } from './eigs/realSymmetric.js'\nimport { typeOf, isNumber, isBigNumber, isComplex, isFraction } from '../../utils/is.js'\n\nconst name = 'eigs'\n\n// The absolute state of math.js's dependency system:\nconst dependencies = ['config', 'typed', 'matrix', 'addScalar', 'equal', 'subtract', 'abs', 'atan', 'cos', 'sin', 'multiplyScalar', 'divideScalar', 'inv', 'bignumber', 'multiply', 'add', 'larger', 'column', 'flatten', 'number', 'complex', 'sqrt', 'diag', 'size', 'reshape', 'qr', 'usolve', 'usolveAll', 'im', 're', 'smaller', 'matrixFromColumns', 'dot']\nexport const createEigs = /* #__PURE__ */ factory(name, dependencies, ({ config, typed, matrix, addScalar, subtract, equal, abs, atan, cos, sin, multiplyScalar, divideScalar, inv, bignumber, multiply, add, larger, column, flatten, number, complex, sqrt, diag, size, reshape, qr, usolve, usolveAll, im, re, smaller, matrixFromColumns, dot }) => {\n const doRealSymmetric = createRealSymmetric({ config, addScalar, subtract, column, flatten, equal, abs, atan, cos, sin, multiplyScalar, inv, bignumber, complex, multiply, add })\n const doComplexEigs = createComplexEigs({ config, addScalar, subtract, multiply, multiplyScalar, flatten, divideScalar, sqrt, abs, bignumber, diag, size, reshape, qr, inv, usolve, usolveAll, equal, complex, larger, smaller, matrixFromColumns, dot })\n\n /**\n * Compute eigenvalues and optionally eigenvectors of a square matrix.\n * The eigenvalues are sorted by their absolute value, ascending, and\n * returned as a vector in the `values` property of the returned project.\n * An eigenvalue with algebraic multiplicity k will be listed k times, so\n * that the returned `values` vector always has length equal to the size\n * of the input matrix.\n *\n * The `eigenvectors` property of the return value provides the eigenvectors.\n * It is an array of plain objects: the `value` property of each gives the\n * associated eigenvalue, and the `vector` property gives the eigenvector\n * itself. Note that the same `value` property will occur as many times in\n * the list provided by `eigenvectors` as the geometric multiplicity of\n * that value.\n *\n * If the algorithm fails to converge, it will throw an error –\n * in that case, however, you may still find useful information\n * in `err.values` and `err.vectors`.\n *\n * Note that the 'precision' option does not directly specify the _accuracy_\n * of the returned eigenvalues. Rather, it determines how small an entry\n * of the iterative approximations to an upper triangular matrix must be\n * in order to be considered zero. The actual accuracy of the returned\n * eigenvalues may be greater or less than the precision, depending on the\n * conditioning of the matrix and how far apart or close the actual\n * eigenvalues are. Note that currently, relatively simple, \"traditional\"\n * methods of eigenvalue computation are being used; this is not a modern,\n * high-precision eigenvalue computation. That said, it should typically\n * produce fairly reasonable results.\n *\n * Syntax:\n *\n * math.eigs(x, [prec])\n * math.eigs(x, {options})\n *\n * Examples:\n *\n * const { eigs, multiply, column, transpose, matrixFromColumns } = math\n * const H = [[5, 2.3], [2.3, 1]]\n * const ans = eigs(H) // returns {values: [E1,E2...sorted], eigenvectors: [{value: E1, vector: v2}, {value: e, vector: v2}, ...]\n * const E = ans.values\n * const V = ans.eigenvectors\n * multiply(H, V[0].vector)) // returns multiply(E[0], V[0].vector))\n * const U = matrixFromColumns(...V.map(obj => obj.vector))\n * const UTxHxU = multiply(transpose(U), H, U) // diagonalizes H if possible\n * E[0] == UTxHxU[0][0] // returns true always\n *\n * // Compute only approximate eigenvalues:\n * const {values} = eigs(H, {eigenvectors: false, precision: 1e-6})\n *\n * See also:\n *\n * inv\n *\n * @param {Array | Matrix} x Matrix to be diagonalized\n *\n * @param {number | BigNumber | OptsObject} [opts] Object with keys `precision`, defaulting to config.relTol, and `eigenvectors`, defaulting to true and specifying whether to compute eigenvectors. If just a number, specifies precision.\n * @return {{values: Array|Matrix, eigenvectors?: Array}} Object containing an array of eigenvalues and an array of {value: number|BigNumber, vector: Array|Matrix} objects. The eigenvectors property is undefined if eigenvectors were not requested.\n *\n */\n return typed('eigs', {\n\n // The conversion to matrix in the first two implementations,\n // just to convert back to an array right away in\n // computeValuesAndVectors, is unfortunate, and should perhaps be\n // streamlined. It is done because the Matrix object carries some\n // type information about its entries, and so constructing the matrix\n // is a roundabout way of doing type detection.\n Array: function (x) { return doEigs(matrix(x)) },\n 'Array, number|BigNumber': function (x, prec) {\n return doEigs(matrix(x), { precision: prec })\n },\n 'Array, Object' (x, opts) { return doEigs(matrix(x), opts) },\n Matrix: function (mat) {\n return doEigs(mat, { matricize: true })\n },\n 'Matrix, number|BigNumber': function (mat, prec) {\n return doEigs(mat, { precision: prec, matricize: true })\n },\n 'Matrix, Object': function (mat, opts) {\n const useOpts = { matricize: true }\n Object.assign(useOpts, opts)\n return doEigs(mat, useOpts)\n }\n })\n\n function doEigs (mat, opts = {}) {\n const computeVectors = 'eigenvectors' in opts ? opts.eigenvectors : true\n const prec = opts.precision ?? config.relTol\n const result = computeValuesAndVectors(mat, prec, computeVectors)\n if (opts.matricize) {\n result.values = matrix(result.values)\n if (computeVectors) {\n result.eigenvectors = result.eigenvectors.map(({ value, vector }) =>\n ({ value, vector: matrix(vector) }))\n }\n }\n if (computeVectors) {\n Object.defineProperty(result, 'vectors', {\n enumerable: false, // to make sure that the eigenvectors can still be\n // converted to string.\n get: () => {\n throw new Error('eigs(M).vectors replaced with eigs(M).eigenvectors')\n }\n })\n }\n return result\n }\n\n function computeValuesAndVectors (mat, prec, computeVectors) {\n const arr = mat.toArray() // NOTE: arr is guaranteed to be unaliased\n // and so safe to modify in place\n const asize = mat.size()\n\n if (asize.length !== 2 || asize[0] !== asize[1]) {\n throw new RangeError(`Matrix must be square (size: ${format(asize)})`)\n }\n\n const N = asize[0]\n\n if (isReal(arr, N, prec)) {\n coerceReal(arr, N) // modifies arr by side effect\n\n if (isSymmetric(arr, N, prec)) {\n const type = coerceTypes(mat, arr, N) // modifies arr by side effect\n return doRealSymmetric(arr, N, prec, type, computeVectors)\n }\n }\n\n const type = coerceTypes(mat, arr, N) // modifies arr by side effect\n return doComplexEigs(arr, N, prec, type, computeVectors)\n }\n\n /** @return {boolean} */\n function isSymmetric (arr, N, prec) {\n for (let i = 0; i < N; i++) {\n for (let j = i; j < N; j++) {\n // TODO proper comparison of bignum and frac\n if (larger(bignumber(abs(subtract(arr[i][j], arr[j][i]))), prec)) {\n return false\n }\n }\n }\n\n return true\n }\n\n /** @return {boolean} */\n function isReal (arr, N, prec) {\n for (let i = 0; i < N; i++) {\n for (let j = 0; j < N; j++) {\n // TODO proper comparison of bignum and frac\n if (larger(bignumber(abs(im(arr[i][j]))), prec)) {\n return false\n }\n }\n }\n\n return true\n }\n\n function coerceReal (arr, N) {\n for (let i = 0; i < N; i++) {\n for (let j = 0; j < N; j++) {\n arr[i][j] = re(arr[i][j])\n }\n }\n }\n\n /** @return {'number' | 'BigNumber' | 'Complex'} */\n function coerceTypes (mat, arr, N) {\n /** @type {string} */\n const type = mat.datatype()\n\n if (type === 'number' || type === 'BigNumber' || type === 'Complex') {\n return type\n }\n\n let hasNumber = false\n let hasBig = false\n let hasComplex = false\n\n for (let i = 0; i < N; i++) {\n for (let j = 0; j < N; j++) {\n const el = arr[i][j]\n\n if (isNumber(el) || isFraction(el)) {\n hasNumber = true\n } else if (isBigNumber(el)) {\n hasBig = true\n } else if (isComplex(el)) {\n hasComplex = true\n } else {\n throw TypeError('Unsupported type in Matrix: ' + typeOf(el))\n }\n }\n }\n\n if (hasBig && hasComplex) {\n console.warn('Complex BigNumbers not supported, this operation will lose precission.')\n }\n\n if (hasComplex) {\n for (let i = 0; i < N; i++) {\n for (let j = 0; j < N; j++) {\n arr[i][j] = complex(arr[i][j])\n }\n }\n\n return 'Complex'\n }\n\n if (hasBig) {\n for (let i = 0; i < N; i++) {\n for (let j = 0; j < N; j++) {\n arr[i][j] = bignumber(arr[i][j])\n }\n }\n\n return 'BigNumber'\n }\n\n if (hasNumber) {\n for (let i = 0; i < N; i++) {\n for (let j = 0; j < N; j++) {\n arr[i][j] = number(arr[i][j])\n }\n }\n\n return 'number'\n } else {\n throw TypeError('Matrix contains unsupported types only.')\n }\n }\n})\n","import { clone } from '../../../utils/object.js'\n\nexport function createRealSymmetric ({ config, addScalar, subtract, abs, atan, cos, sin, multiplyScalar, inv, bignumber, multiply, add }) {\n /**\n * @param {number[] | BigNumber[]} arr\n * @param {number} N\n * @param {number} prec\n * @param {'number' | 'BigNumber'} type\n */\n function main (arr, N, prec = config.relTol, type, computeVectors) {\n if (type === 'number') {\n return diag(arr, prec, computeVectors)\n }\n\n if (type === 'BigNumber') {\n return diagBig(arr, prec, computeVectors)\n }\n\n throw TypeError('Unsupported data type: ' + type)\n }\n\n // diagonalization implementation for number (efficient)\n function diag (x, precision, computeVectors) {\n const N = x.length\n const e0 = Math.abs(precision / N)\n let psi\n let Sij\n if (computeVectors) {\n Sij = new Array(N)\n // Sij is Identity Matrix\n for (let i = 0; i < N; i++) {\n Sij[i] = Array(N).fill(0)\n Sij[i][i] = 1.0\n }\n }\n // initial error\n let Vab = getAij(x)\n while (Math.abs(Vab[1]) >= Math.abs(e0)) {\n const i = Vab[0][0]\n const j = Vab[0][1]\n psi = getTheta(x[i][i], x[j][j], x[i][j])\n x = x1(x, psi, i, j)\n if (computeVectors) Sij = Sij1(Sij, psi, i, j)\n Vab = getAij(x)\n }\n const Ei = Array(N).fill(0) // eigenvalues\n for (let i = 0; i < N; i++) {\n Ei[i] = x[i][i]\n }\n return sorting(clone(Ei), Sij, computeVectors)\n }\n\n // diagonalization implementation for bigNumber\n function diagBig (x, precision, computeVectors) {\n const N = x.length\n const e0 = abs(precision / N)\n let psi\n let Sij\n if (computeVectors) {\n Sij = new Array(N)\n // Sij is Identity Matrix\n for (let i = 0; i < N; i++) {\n Sij[i] = Array(N).fill(0)\n Sij[i][i] = 1.0\n }\n }\n // initial error\n let Vab = getAijBig(x)\n while (abs(Vab[1]) >= abs(e0)) {\n const i = Vab[0][0]\n const j = Vab[0][1]\n psi = getThetaBig(x[i][i], x[j][j], x[i][j])\n x = x1Big(x, psi, i, j)\n if (computeVectors) Sij = Sij1Big(Sij, psi, i, j)\n Vab = getAijBig(x)\n }\n const Ei = Array(N).fill(0) // eigenvalues\n for (let i = 0; i < N; i++) {\n Ei[i] = x[i][i]\n }\n // return [clone(Ei), clone(Sij)]\n return sorting(clone(Ei), Sij, computeVectors)\n }\n\n // get angle\n function getTheta (aii, ajj, aij) {\n const denom = (ajj - aii)\n if (Math.abs(denom) <= config.relTol) {\n return Math.PI / 4.0\n } else {\n return 0.5 * Math.atan(2.0 * aij / (ajj - aii))\n }\n }\n\n // get angle\n function getThetaBig (aii, ajj, aij) {\n const denom = subtract(ajj, aii)\n if (abs(denom) <= config.relTol) {\n return bignumber(-1).acos().div(4)\n } else {\n return multiplyScalar(0.5, atan(multiply(2.0, aij, inv(denom))))\n }\n }\n\n // update eigvec\n function Sij1 (Sij, theta, i, j) {\n const N = Sij.length\n const c = Math.cos(theta)\n const s = Math.sin(theta)\n const Ski = Array(N).fill(0)\n const Skj = Array(N).fill(0)\n for (let k = 0; k < N; k++) {\n Ski[k] = c * Sij[k][i] - s * Sij[k][j]\n Skj[k] = s * Sij[k][i] + c * Sij[k][j]\n }\n for (let k = 0; k < N; k++) {\n Sij[k][i] = Ski[k]\n Sij[k][j] = Skj[k]\n }\n return Sij\n }\n // update eigvec for overlap\n function Sij1Big (Sij, theta, i, j) {\n const N = Sij.length\n const c = cos(theta)\n const s = sin(theta)\n const Ski = Array(N).fill(bignumber(0))\n const Skj = Array(N).fill(bignumber(0))\n for (let k = 0; k < N; k++) {\n Ski[k] = subtract(multiplyScalar(c, Sij[k][i]), multiplyScalar(s, Sij[k][j]))\n Skj[k] = addScalar(multiplyScalar(s, Sij[k][i]), multiplyScalar(c, Sij[k][j]))\n }\n for (let k = 0; k < N; k++) {\n Sij[k][i] = Ski[k]\n Sij[k][j] = Skj[k]\n }\n return Sij\n }\n\n // update matrix\n function x1Big (Hij, theta, i, j) {\n const N = Hij.length\n const c = bignumber(cos(theta))\n const s = bignumber(sin(theta))\n const c2 = multiplyScalar(c, c)\n const s2 = multiplyScalar(s, s)\n const Aki = Array(N).fill(bignumber(0))\n const Akj = Array(N).fill(bignumber(0))\n // 2cs Hij\n const csHij = multiply(bignumber(2), c, s, Hij[i][j])\n // Aii\n const Aii = addScalar(subtract(multiplyScalar(c2, Hij[i][i]), csHij), multiplyScalar(s2, Hij[j][j]))\n const Ajj = add(multiplyScalar(s2, Hij[i][i]), csHij, multiplyScalar(c2, Hij[j][j]))\n // 0 to i\n for (let k = 0; k < N; k++) {\n Aki[k] = subtract(multiplyScalar(c, Hij[i][k]), multiplyScalar(s, Hij[j][k]))\n Akj[k] = addScalar(multiplyScalar(s, Hij[i][k]), multiplyScalar(c, Hij[j][k]))\n }\n // Modify Hij\n Hij[i][i] = Aii\n Hij[j][j] = Ajj\n Hij[i][j] = bignumber(0)\n Hij[j][i] = bignumber(0)\n // 0 to i\n for (let k = 0; k < N; k++) {\n if (k !== i && k !== j) {\n Hij[i][k] = Aki[k]\n Hij[k][i] = Aki[k]\n Hij[j][k] = Akj[k]\n Hij[k][j] = Akj[k]\n }\n }\n return Hij\n }\n\n // update matrix\n function x1 (Hij, theta, i, j) {\n const N = Hij.length\n const c = Math.cos(theta)\n const s = Math.sin(theta)\n const c2 = c * c\n const s2 = s * s\n const Aki = Array(N).fill(0)\n const Akj = Array(N).fill(0)\n // Aii\n const Aii = c2 * Hij[i][i] - 2 * c * s * Hij[i][j] + s2 * Hij[j][j]\n const Ajj = s2 * Hij[i][i] + 2 * c * s * Hij[i][j] + c2 * Hij[j][j]\n // 0 to i\n for (let k = 0; k < N; k++) {\n Aki[k] = c * Hij[i][k] - s * Hij[j][k]\n Akj[k] = s * Hij[i][k] + c * Hij[j][k]\n }\n // Modify Hij\n Hij[i][i] = Aii\n Hij[j][j] = Ajj\n Hij[i][j] = 0\n Hij[j][i] = 0\n // 0 to i\n for (let k = 0; k < N; k++) {\n if (k !== i && k !== j) {\n Hij[i][k] = Aki[k]\n Hij[k][i] = Aki[k]\n Hij[j][k] = Akj[k]\n Hij[k][j] = Akj[k]\n }\n }\n return Hij\n }\n\n // get max off-diagonal value from Upper Diagonal\n function getAij (Mij) {\n const N = Mij.length\n let maxMij = 0\n let maxIJ = [0, 1]\n for (let i = 0; i < N; i++) {\n for (let j = i + 1; j < N; j++) {\n if (Math.abs(maxMij) < Math.abs(Mij[i][j])) {\n maxMij = Math.abs(Mij[i][j])\n maxIJ = [i, j]\n }\n }\n }\n return [maxIJ, maxMij]\n }\n\n // get max off-diagonal value from Upper Diagonal\n function getAijBig (Mij) {\n const N = Mij.length\n let maxMij = 0\n let maxIJ = [0, 1]\n for (let i = 0; i < N; i++) {\n for (let j = i + 1; j < N; j++) {\n if (abs(maxMij) < abs(Mij[i][j])) {\n maxMij = abs(Mij[i][j])\n maxIJ = [i, j]\n }\n }\n }\n return [maxIJ, maxMij]\n }\n\n // sort results\n function sorting (E, S, computeVectors) {\n const N = E.length\n const values = Array(N)\n let vecs\n if (computeVectors) {\n vecs = Array(N)\n for (let k = 0; k < N; k++) {\n vecs[k] = Array(N)\n }\n }\n for (let i = 0; i < N; i++) {\n let minID = 0\n let minE = E[0]\n for (let j = 0; j < E.length; j++) {\n if (abs(E[j]) < abs(minE)) {\n minID = j\n minE = E[minID]\n }\n }\n values[i] = E.splice(minID, 1)[0]\n if (computeVectors) {\n for (let k = 0; k < N; k++) {\n vecs[i][k] = S[k][minID]\n S[k].splice(minID, 1)\n }\n }\n }\n if (!computeVectors) return { values }\n const eigenvectors = vecs.map((vector, i) => ({ value: values[i], vector }))\n return { values, eigenvectors }\n }\n\n return main\n}\n","import { clone } from '../../../utils/object.js'\n\nexport function createComplexEigs ({ addScalar, subtract, flatten, multiply, multiplyScalar, divideScalar, sqrt, abs, bignumber, diag, size, reshape, inv, qr, usolve, usolveAll, equal, complex, larger, smaller, matrixFromColumns, dot }) {\n /**\n * @param {number[][]} arr the matrix to find eigenvalues of\n * @param {number} N size of the matrix\n * @param {number|BigNumber} prec precision, anything lower will be considered zero\n * @param {'number'|'BigNumber'|'Complex'} type\n * @param {boolean} findVectors should we find eigenvectors?\n *\n * @returns {{ values: number[], vectors: number[][] }}\n */\n function complexEigs (arr, N, prec, type, findVectors = true) {\n // TODO check if any row/col are zero except the diagonal\n\n // make sure corresponding rows and columns have similar magnitude\n // important because of numerical stability\n // MODIFIES arr by side effect!\n const R = balance(arr, N, prec, type, findVectors)\n\n // R is the row transformation matrix\n // arr = A' = R A R^-1, A is the original matrix\n // (if findVectors is false, R is undefined)\n // (And so to return to original matrix: A = R^-1 arr R)\n\n // TODO if magnitudes of elements vary over many orders,\n // move greatest elements to the top left corner\n\n // using similarity transformations, reduce the matrix\n // to Hessenberg form (upper triangular plus one subdiagonal row)\n // updates the transformation matrix R with new row operationsq\n // MODIFIES arr by side effect!\n reduceToHessenberg(arr, N, prec, type, findVectors, R)\n // still true that original A = R^-1 arr R)\n\n // find eigenvalues\n const { values, C } = iterateUntilTriangular(arr, N, prec, type, findVectors)\n\n // values is the list of eigenvalues, C is the column\n // transformation matrix that transforms arr, the hessenberg\n // matrix, to upper triangular\n // (So U = C^-1 arr C and the relationship between current arr\n // and original A is unchanged.)\n\n if (findVectors) {\n const eigenvectors = findEigenvectors(arr, N, C, R, values, prec, type)\n return { values, eigenvectors }\n }\n\n return { values }\n }\n\n /**\n * @param {number[][]} arr\n * @param {number} N\n * @param {number} prec\n * @param {'number'|'BigNumber'|'Complex'} type\n * @returns {number[][]}\n */\n function balance (arr, N, prec, type, findVectors) {\n const big = type === 'BigNumber'\n const cplx = type === 'Complex'\n\n const realzero = big ? bignumber(0) : 0\n const one = big ? bignumber(1) : cplx ? complex(1) : 1\n const realone = big ? bignumber(1) : 1\n\n // base of the floating-point arithmetic\n const radix = big ? bignumber(10) : 2\n const radixSq = multiplyScalar(radix, radix)\n\n // the diagonal transformation matrix R\n let Rdiag\n if (findVectors) {\n Rdiag = Array(N).fill(one)\n }\n\n // this isn't the only time we loop thru the matrix...\n let last = false\n\n while (!last) {\n // ...haha I'm joking! unless...\n last = true\n\n for (let i = 0; i < N; i++) {\n // compute the taxicab norm of i-th column and row\n // TODO optimize for complex numbers\n let colNorm = realzero\n let rowNorm = realzero\n\n for (let j = 0; j < N; j++) {\n if (i === j) continue\n colNorm = addScalar(colNorm, abs(arr[j][i]))\n rowNorm = addScalar(rowNorm, abs(arr[i][j]))\n }\n\n if (!equal(colNorm, 0) && !equal(rowNorm, 0)) {\n // find integer power closest to balancing the matrix\n // (we want to scale only by integer powers of radix,\n // so that we don't lose any precision due to round-off)\n\n let f = realone\n let c = colNorm\n\n const rowDivRadix = divideScalar(rowNorm, radix)\n const rowMulRadix = multiplyScalar(rowNorm, radix)\n\n while (smaller(c, rowDivRadix)) {\n c = multiplyScalar(c, radixSq)\n f = multiplyScalar(f, radix)\n }\n while (larger(c, rowMulRadix)) {\n c = divideScalar(c, radixSq)\n f = divideScalar(f, radix)\n }\n\n // check whether balancing is needed\n // condition = (c + rowNorm) / f < 0.95 * (colNorm + rowNorm)\n const condition = smaller(divideScalar(addScalar(c, rowNorm), f), multiplyScalar(addScalar(colNorm, rowNorm), 0.95))\n\n // apply balancing similarity transformation\n if (condition) {\n // we should loop once again to check whether\n // another rebalancing is needed\n last = false\n\n const g = divideScalar(1, f)\n\n for (let j = 0; j < N; j++) {\n if (i === j) {\n continue\n }\n arr[i][j] = multiplyScalar(arr[i][j], g)\n arr[j][i] = multiplyScalar(arr[j][i], f)\n }\n\n // keep track of transformations\n if (findVectors) {\n Rdiag[i] = multiplyScalar(Rdiag[i], g)\n }\n }\n }\n }\n }\n\n // return the diagonal row transformation matrix\n return findVectors ? diag(Rdiag) : null\n }\n\n /**\n * @param {number[][]} arr\n * @param {number} N\n * @param {number} prec\n * @param {'number'|'BigNumber'|'Complex'} type\n * @param {boolean} findVectors\n * @param {number[][]} R the row transformation matrix that will be modified\n */\n function reduceToHessenberg (arr, N, prec, type, findVectors, R) {\n const big = type === 'BigNumber'\n const cplx = type === 'Complex'\n\n const zero = big ? bignumber(0) : cplx ? complex(0) : 0\n\n if (big) { prec = bignumber(prec) }\n\n for (let i = 0; i < N - 2; i++) {\n // Find the largest subdiag element in the i-th col\n\n let maxIndex = 0\n let max = zero\n\n for (let j = i + 1; j < N; j++) {\n const el = arr[j][i]\n if (smaller(abs(max), abs(el))) {\n max = el\n maxIndex = j\n }\n }\n\n // This col is pivoted, no need to do anything\n if (smaller(abs(max), prec)) {\n continue\n }\n\n if (maxIndex !== i + 1) {\n // Interchange maxIndex-th and (i+1)-th row\n const tmp1 = arr[maxIndex]\n arr[maxIndex] = arr[i + 1]\n arr[i + 1] = tmp1\n\n // Interchange maxIndex-th and (i+1)-th column\n for (let j = 0; j < N; j++) {\n const tmp2 = arr[j][maxIndex]\n arr[j][maxIndex] = arr[j][i + 1]\n arr[j][i + 1] = tmp2\n }\n\n // keep track of transformations\n if (findVectors) {\n const tmp3 = R[maxIndex]\n R[maxIndex] = R[i + 1]\n R[i + 1] = tmp3\n }\n }\n\n // Reduce following rows and columns\n for (let j = i + 2; j < N; j++) {\n const n = divideScalar(arr[j][i], max)\n\n if (n === 0) {\n continue\n }\n\n // from j-th row subtract n-times (i+1)th row\n for (let k = 0; k < N; k++) {\n arr[j][k] = subtract(arr[j][k], multiplyScalar(n, arr[i + 1][k]))\n }\n\n // to (i+1)th column add n-times j-th column\n for (let k = 0; k < N; k++) {\n arr[k][i + 1] = addScalar(arr[k][i + 1], multiplyScalar(n, arr[k][j]))\n }\n\n // keep track of transformations\n if (findVectors) {\n for (let k = 0; k < N; k++) {\n R[j][k] = subtract(R[j][k], multiplyScalar(n, R[i + 1][k]))\n }\n }\n }\n }\n\n return R\n }\n\n /**\n * @returns {{values: values, C: Matrix}}\n * @see Press, Wiliams: Numerical recipes in Fortran 77\n * @see https://en.wikipedia.org/wiki/QR_algorithm\n */\n function iterateUntilTriangular (A, N, prec, type, findVectors) {\n const big = type === 'BigNumber'\n const cplx = type === 'Complex'\n\n const one = big ? bignumber(1) : cplx ? complex(1) : 1\n\n if (big) { prec = bignumber(prec) }\n\n // The Francis Algorithm\n // The core idea of this algorithm is that doing successive\n // A' = QtAQ transformations will eventually converge to block-\n // upper-triangular with diagonal blocks either 1x1 or 2x2.\n // The Q here is the one from the QR decomposition, A = QR.\n // Since the eigenvalues of a block-upper-triangular matrix are\n // the eigenvalues of its diagonal blocks and we know how to find\n // eigenvalues of a 2x2 matrix, we know the eigenvalues of A.\n\n let arr = clone(A)\n\n // the list of converged eigenvalues\n const lambdas = []\n\n // size of arr, which will get smaller as eigenvalues converge\n let n = N\n\n // the diagonal of the block-diagonal matrix that turns\n // converged 2x2 matrices into upper triangular matrices\n const Sdiag = []\n\n // N×N matrix describing the overall transformation done during the QR algorithm\n let Qtotal = findVectors ? diag(Array(N).fill(one)) : undefined\n\n // nxn matrix describing the QR transformations done since last convergence\n let Qpartial = findVectors ? diag(Array(n).fill(one)) : undefined\n\n // last eigenvalue converged before this many steps\n let lastConvergenceBefore = 0\n\n while (lastConvergenceBefore <= 100) {\n lastConvergenceBefore += 1\n\n // TODO if the convergence is slow, do something clever\n\n // Perform the factorization\n\n const k = arr[n - 1][n - 1] // TODO this is apparently a somewhat\n // old-fashioned choice; ideally set close to an eigenvalue, or\n // perhaps better yet switch to the implicit QR version that is sometimes\n // specifically called the \"Francis algorithm\" that is alluded to\n // in the following TODO. (Or perhaps we switch to an independently\n // optimized third-party package for the linear algebra operations...)\n\n for (let i = 0; i < n; i++) {\n arr[i][i] = subtract(arr[i][i], k)\n }\n\n // TODO do an implicit QR transformation\n const { Q, R } = qr(arr)\n arr = multiply(R, Q)\n\n for (let i = 0; i < n; i++) {\n arr[i][i] = addScalar(arr[i][i], k)\n }\n\n // keep track of transformations\n if (findVectors) {\n Qpartial = multiply(Qpartial, Q)\n }\n\n // The rightmost diagonal element converged to an eigenvalue\n if (n === 1 || smaller(abs(arr[n - 1][n - 2]), prec)) {\n lastConvergenceBefore = 0\n lambdas.push(arr[n - 1][n - 1])\n\n // keep track of transformations\n if (findVectors) {\n Sdiag.unshift([[1]])\n inflateMatrix(Qpartial, N)\n Qtotal = multiply(Qtotal, Qpartial)\n\n if (n > 1) {\n Qpartial = diag(Array(n - 1).fill(one))\n }\n }\n\n // reduce the matrix size\n n -= 1\n arr.pop()\n for (let i = 0; i < n; i++) {\n arr[i].pop()\n }\n\n // The rightmost diagonal 2x2 block converged\n } else if (n === 2 || smaller(abs(arr[n - 2][n - 3]), prec)) {\n lastConvergenceBefore = 0\n const ll = eigenvalues2x2(\n arr[n - 2][n - 2], arr[n - 2][n - 1],\n arr[n - 1][n - 2], arr[n - 1][n - 1]\n )\n lambdas.push(...ll)\n\n // keep track of transformations\n if (findVectors) {\n Sdiag.unshift(jordanBase2x2(\n arr[n - 2][n - 2], arr[n - 2][n - 1],\n arr[n - 1][n - 2], arr[n - 1][n - 1],\n ll[0], ll[1], prec, type\n ))\n inflateMatrix(Qpartial, N)\n Qtotal = multiply(Qtotal, Qpartial)\n if (n > 2) {\n Qpartial = diag(Array(n - 2).fill(one))\n }\n }\n\n // reduce the matrix size\n n -= 2\n arr.pop()\n arr.pop()\n for (let i = 0; i < n; i++) {\n arr[i].pop()\n arr[i].pop()\n }\n }\n\n if (n === 0) {\n break\n }\n }\n\n // standard sorting\n lambdas.sort((a, b) => +subtract(abs(a), abs(b)))\n\n // the algorithm didn't converge\n if (lastConvergenceBefore > 100) {\n const err = Error('The eigenvalues failed to converge. Only found these eigenvalues: ' + lambdas.join(', '))\n err.values = lambdas\n err.vectors = []\n throw err\n }\n\n // combine the overall QR transformation Qtotal with the subsequent\n // transformation S that turns the diagonal 2x2 blocks to upper triangular\n const C = findVectors ? multiply(Qtotal, blockDiag(Sdiag, N)) : undefined\n\n return { values: lambdas, C }\n }\n\n /**\n * @param {Matrix} A hessenberg-form matrix\n * @param {number} N size of A\n * @param {Matrix} C column transformation matrix that turns A into upper triangular\n * @param {Matrix} R similarity that turns original matrix into A\n * @param {number[]} values array of eigenvalues of A\n * @param {'number'|'BigNumber'|'Complex'} type\n * @returns {number[][]} eigenvalues\n */\n function findEigenvectors (A, N, C, R, values, prec, type) {\n const Cinv = inv(C)\n const U = multiply(Cinv, A, C)\n\n const big = type === 'BigNumber'\n const cplx = type === 'Complex'\n\n const zero = big ? bignumber(0) : cplx ? complex(0) : 0\n const one = big ? bignumber(1) : cplx ? complex(1) : 1\n\n // turn values into a kind of \"multiset\"\n // this way it is easier to find eigenvectors\n const uniqueValues = []\n const multiplicities = []\n\n for (const lambda of values) {\n const i = indexOf(uniqueValues, lambda, equal)\n\n if (i === -1) {\n uniqueValues.push(lambda)\n multiplicities.push(1)\n } else {\n multiplicities[i] += 1\n }\n }\n\n // find eigenvectors by solving U − lambdaE = 0\n // TODO replace with an iterative eigenvector algorithm\n // (this one might fail for imprecise eigenvalues)\n\n const vectors = []\n const len = uniqueValues.length\n const b = Array(N).fill(zero)\n const E = diag(Array(N).fill(one))\n\n for (let i = 0; i < len; i++) {\n const lambda = uniqueValues[i]\n const S = subtract(U, multiply(lambda, E)) // the characteristic matrix\n\n let solutions = usolveAll(S, b)\n solutions.shift() // ignore the null vector\n\n // looks like we missed something, try inverse iteration\n // But if that fails, just presume that the original matrix truly\n // was defective.\n while (solutions.length < multiplicities[i]) {\n const approxVec = inverseIterate(S, N, solutions, prec, type)\n if (approxVec === null) { break } // no more vectors were found\n solutions.push(approxVec)\n }\n\n // Transform back into original array coordinates\n const correction = multiply(inv(R), C)\n solutions = solutions.map(v => multiply(correction, v))\n\n vectors.push(\n ...solutions.map(v => ({ value: lambda, vector: flatten(v) })))\n }\n\n return vectors\n }\n\n /**\n * Compute the eigenvalues of an 2x2 matrix\n * @return {[number,number]}\n */\n function eigenvalues2x2 (a, b, c, d) {\n // lambda_+- = 1/2 trA +- 1/2 sqrt( tr^2 A - 4 detA )\n const trA = addScalar(a, d)\n const detA = subtract(multiplyScalar(a, d), multiplyScalar(b, c))\n const x = multiplyScalar(trA, 0.5)\n const y = multiplyScalar(sqrt(subtract(multiplyScalar(trA, trA), multiplyScalar(4, detA))), 0.5)\n\n return [addScalar(x, y), subtract(x, y)]\n }\n\n /**\n * For an 2x2 matrix compute the transformation matrix S,\n * so that SAS^-1 is an upper triangular matrix\n * @return {[[number,number],[number,number]]}\n * @see https://math.berkeley.edu/~ogus/old/Math_54-05/webfoils/jordan.pdf\n * @see http://people.math.harvard.edu/~knill/teaching/math21b2004/exhibits/2dmatrices/index.html\n */\n function jordanBase2x2 (a, b, c, d, l1, l2, prec, type) {\n const big = type === 'BigNumber'\n const cplx = type === 'Complex'\n\n const zero = big ? bignumber(0) : cplx ? complex(0) : 0\n const one = big ? bignumber(1) : cplx ? complex(1) : 1\n\n // matrix is already upper triangular\n // return an identity matrix\n if (smaller(abs(c), prec)) {\n return [[one, zero], [zero, one]]\n }\n\n // matrix is diagonalizable\n // return its eigenvectors as columns\n if (larger(abs(subtract(l1, l2)), prec)) {\n return [[subtract(l1, d), subtract(l2, d)], [c, c]]\n }\n\n // matrix is not diagonalizable\n // compute diagonal elements of N = A - lambdaI\n const na = subtract(a, l1)\n const nd = subtract(d, l1)\n\n // col(N,2) = 0 implies S = ( col(N,1), e_1 )\n // col(N,2) != 0 implies S = ( col(N,2), e_2 )\n\n if (smaller(abs(b), prec) && smaller(abs(nd), prec)) {\n return [[na, one], [c, zero]]\n } else {\n return [[b, zero], [nd, one]]\n }\n }\n\n /**\n * Enlarge the matrix from nxn to NxN, setting the new\n * elements to 1 on diagonal and 0 elsewhere\n */\n function inflateMatrix (arr, N) {\n // add columns\n for (let i = 0; i < arr.length; i++) {\n arr[i].push(...Array(N - arr[i].length).fill(0))\n }\n\n // add rows\n for (let i = arr.length; i < N; i++) {\n arr.push(Array(N).fill(0))\n arr[i][i] = 1\n }\n\n return arr\n }\n\n /**\n * Create a block-diagonal matrix with the given square matrices on the diagonal\n * @param {Matrix[] | number[][][]} arr array of matrices to be placed on the diagonal\n * @param {number} N the size of the resulting matrix\n */\n function blockDiag (arr, N) {\n const M = []\n for (let i = 0; i < N; i++) {\n M[i] = Array(N).fill(0)\n }\n\n let I = 0\n for (const sub of arr) {\n const n = sub.length\n\n for (let i = 0; i < n; i++) {\n for (let j = 0; j < n; j++) {\n M[I + i][I + j] = sub[i][j]\n }\n }\n\n I += n\n }\n\n return M\n }\n\n /**\n * Finds the index of an element in an array using a custom equality function\n * @template T\n * @param {Array} arr array in which to search\n * @param {T} el the element to find\n * @param {function(T, T): boolean} fn the equality function, first argument is an element of `arr`, the second is always `el`\n * @returns {number} the index of `el`, or -1 when it's not in `arr`\n */\n function indexOf (arr, el, fn) {\n for (let i = 0; i < arr.length; i++) {\n if (fn(arr[i], el)) {\n return i\n }\n }\n return -1\n }\n\n /**\n * Provided a near-singular upper-triangular matrix A and a list of vectors,\n * finds an eigenvector of A with the smallest eigenvalue, which is orthogonal\n * to each vector in the list\n * @template T\n * @param {T[][]} A near-singular square matrix\n * @param {number} N dimension\n * @param {T[][]} orthog list of vectors\n * @param {number} prec epsilon\n * @param {'number'|'BigNumber'|'Complex'} type\n * @return {T[] | null} eigenvector\n *\n * @see Numerical Recipes for Fortran 77 – 11.7 Eigenvalues or Eigenvectors by Inverse Iteration\n */\n function inverseIterate (A, N, orthog, prec, type) {\n const largeNum = type === 'BigNumber' ? bignumber(1000) : 1000\n\n let b // the vector\n\n // you better choose a random vector before I count to five\n let i = 0\n for (; i < 5; ++i) {\n b = randomOrthogonalVector(N, orthog, type)\n try {\n b = usolve(A, b)\n } catch {\n // That direction didn't work, likely because the original matrix\n // was defective. But still make the full number of tries...\n continue\n }\n if (larger(norm(b), largeNum)) { break }\n }\n if (i >= 5) {\n return null // couldn't find any orthogonal vector in the image\n }\n\n // you better converge before I count to ten\n i = 0\n while (true) {\n const c = usolve(A, b)\n\n if (smaller(norm(orthogonalComplement(b, [c])), prec)) { break }\n if (++i >= 10) { return null }\n\n b = normalize(c)\n }\n\n return b\n }\n\n /**\n * Generates a random unit vector of dimension N, orthogonal to each vector in the list\n * @template T\n * @param {number} N dimension\n * @param {T[][]} orthog list of vectors\n * @param {'number'|'BigNumber'|'Complex'} type\n * @returns {T[]} random vector\n */\n function randomOrthogonalVector (N, orthog, type) {\n const big = type === 'BigNumber'\n const cplx = type === 'Complex'\n\n // generate random vector with the correct type\n let v = Array(N).fill(0).map(_ => 2 * Math.random() - 1)\n if (big) { v = v.map(n => bignumber(n)) }\n if (cplx) { v = v.map(n => complex(n)) }\n\n // project to orthogonal complement\n v = orthogonalComplement(v, orthog)\n\n // normalize\n return normalize(v, type)\n }\n\n /**\n * Project vector v to the orthogonal complement of an array of vectors\n */\n function orthogonalComplement (v, orthog) {\n const vectorShape = size(v)\n for (let w of orthog) {\n w = reshape(w, vectorShape) // make sure this is just a vector computation\n // v := v − (w, v)/|w|^2 w\n v = subtract(v, multiply(divideScalar(dot(w, v), dot(w, w)), w))\n }\n\n return v\n }\n\n /**\n * Calculate the norm of a vector.\n * We can't use math.norm because factory can't handle circular dependency.\n * Seriously, I'm really fed up with factory.\n */\n function norm (v) {\n return abs(sqrt(dot(v, v)))\n }\n\n /**\n * Normalize a vector\n * @template T\n * @param {T[]} v\n * @param {'number'|'BigNumber'|'Complex'} type\n * @returns {T[]} normalized vec\n */\n function normalize (v, type) {\n const big = type === 'BigNumber'\n const cplx = type === 'Complex'\n const one = big ? bignumber(1) : cplx ? complex(1) : 1\n\n return multiply(divideScalar(one, norm(v)), v)\n }\n\n return complexEigs\n}\n","import { isSparseMatrix } from '../../utils/is.js'\nimport { format } from '../../utils/string.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'expm'\nconst dependencies = ['typed', 'abs', 'add', 'identity', 'inv', 'multiply']\n\nexport const createExpm = /* #__PURE__ */ factory(name, dependencies, ({ typed, abs, add, identity, inv, multiply }) => {\n /**\n * Compute the matrix exponential, expm(A) = e^A. The matrix must be square.\n * Not to be confused with exp(a), which performs element-wise\n * exponentiation.\n *\n * The exponential is calculated using the Padé approximant with scaling and\n * squaring; see \"Nineteen Dubious Ways to Compute the Exponential of a\n * Matrix,\" by Moler and Van Loan.\n *\n * Syntax:\n *\n * math.expm(x)\n *\n * Examples:\n *\n * const A = [[0,2],[0,0]]\n * math.expm(A) // returns [[1,2],[0,1]]\n *\n * See also:\n *\n * exp\n *\n * @param {Matrix} x A square Matrix\n * @return {Matrix} The exponential of x\n */\n return typed(name, {\n\n Matrix: function (A) {\n // Check matrix size\n const size = A.size()\n\n if (size.length !== 2 || size[0] !== size[1]) {\n throw new RangeError('Matrix must be square ' +\n '(size: ' + format(size) + ')')\n }\n\n const n = size[0]\n\n // Desired accuracy of the approximant (The actual accuracy\n // will be affected by round-off error)\n const eps = 1e-15\n\n // The Padé approximant is not so accurate when the values of A\n // are \"large\", so scale A by powers of two. Then compute the\n // exponential, and square the result repeatedly according to\n // the identity e^A = (e^(A/m))^m\n\n // Compute infinity-norm of A, ||A||, to see how \"big\" it is\n const infNorm = infinityNorm(A)\n\n // Find the optimal scaling factor and number of terms in the\n // Padé approximant to reach the desired accuracy\n const params = findParams(infNorm, eps)\n const q = params.q\n const j = params.j\n\n // The Pade approximation to e^A is:\n // Rqq(A) = Dqq(A) ^ -1 * Nqq(A)\n // where\n // Nqq(A) = sum(i=0, q, (2q-i)!p! / [ (2q)!i!(q-i)! ] A^i\n // Dqq(A) = sum(i=0, q, (2q-i)!q! / [ (2q)!i!(q-i)! ] (-A)^i\n\n // Scale A by 1 / 2^j\n const Apos = multiply(A, Math.pow(2, -j))\n\n // The i=0 term is just the identity matrix\n let N = identity(n)\n let D = identity(n)\n\n // Initialization (i=0)\n let factor = 1\n\n // Initialization (i=1)\n let AposToI = Apos // Cloning not necessary\n let alternate = -1\n\n for (let i = 1; i <= q; i++) {\n if (i > 1) {\n AposToI = multiply(AposToI, Apos)\n alternate = -alternate\n }\n factor = factor * (q - i + 1) / ((2 * q - i + 1) * i)\n\n N = add(N, multiply(factor, AposToI))\n D = add(D, multiply(factor * alternate, AposToI))\n }\n\n let R = multiply(inv(D), N)\n\n // Square j times\n for (let i = 0; i < j; i++) {\n R = multiply(R, R)\n }\n\n return isSparseMatrix(A)\n ? A.createSparseMatrix(R)\n : R\n }\n\n })\n\n function infinityNorm (A) {\n const n = A.size()[0]\n let infNorm = 0\n for (let i = 0; i < n; i++) {\n let rowSum = 0\n for (let j = 0; j < n; j++) {\n rowSum += abs(A.get([i, j]))\n }\n infNorm = Math.max(rowSum, infNorm)\n }\n return infNorm\n }\n\n /**\n * Find the best parameters for the Pade approximant given\n * the matrix norm and desired accuracy. Returns the first acceptable\n * combination in order of increasing computational load.\n */\n function findParams (infNorm, eps) {\n const maxSearchSize = 30\n for (let k = 0; k < maxSearchSize; k++) {\n for (let q = 0; q <= k; q++) {\n const j = k - q\n if (errorEstimate(infNorm, q, j) < eps) {\n return { q, j }\n }\n }\n }\n throw new Error('Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)')\n }\n\n /**\n * Returns the estimated error of the Pade approximant for the given\n * parameters.\n */\n function errorEstimate (infNorm, q, j) {\n let qfac = 1\n for (let i = 2; i <= q; i++) {\n qfac *= i\n }\n let twoqfac = qfac\n for (let i = q + 1; i <= 2 * q; i++) {\n twoqfac *= i\n }\n const twoqp1fac = twoqfac * (2 * q + 1)\n\n return 8.0 *\n Math.pow(infNorm / Math.pow(2, j), 2 * q) *\n qfac * qfac / (twoqfac * twoqp1fac)\n }\n})\n","import { isMatrix } from '../../utils/is.js'\nimport { format } from '../../utils/string.js'\nimport { arraySize } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'sqrtm'\nconst dependencies = ['typed', 'abs', 'add', 'multiply', 'map', 'sqrt', 'subtract', 'inv', 'size', 'max', 'identity']\n\nexport const createSqrtm = /* #__PURE__ */ factory(name, dependencies, ({ typed, abs, add, multiply, map, sqrt, subtract, inv, size, max, identity }) => {\n const _maxIterations = 1e3\n const _tolerance = 1e-6\n\n /**\n * Calculate the principal square root matrix using the Denman–Beavers iterative method\n *\n * https://en.wikipedia.org/wiki/Square_root_of_a_matrix#By_Denman–Beavers_iteration\n *\n * @param {Array | Matrix} A The square matrix `A`\n * @return {Array | Matrix} The principal square root of matrix `A`\n * @private\n */\n function _denmanBeavers (A) {\n let error\n let iterations = 0\n\n let Y = A\n let Z = identity(size(A))\n\n do {\n const Yk = Y\n Y = multiply(0.5, add(Yk, inv(Z)))\n Z = multiply(0.5, add(Z, inv(Yk)))\n\n error = max(abs(subtract(Y, Yk)))\n\n if (error > _tolerance && ++iterations > _maxIterations) {\n throw new Error('computing square root of matrix: iterative method could not converge')\n }\n } while (error > _tolerance)\n\n return Y\n }\n\n /**\n * Calculate the principal square root of a square matrix.\n * The principal square root matrix `X` of another matrix `A` is such that `X * X = A`.\n *\n * https://en.wikipedia.org/wiki/Square_root_of_a_matrix\n *\n * Syntax:\n *\n * math.sqrtm(A)\n *\n * Examples:\n *\n * math.sqrtm([[33, 24], [48, 57]]) // returns [[5, 2], [4, 7]]\n *\n * See also:\n *\n * sqrt, pow\n *\n * @param {Array | Matrix} A The square matrix `A`\n * @return {Array | Matrix} The principal square root of matrix `A`\n */\n return typed(name, {\n 'Array | Matrix': function (A) {\n const size = isMatrix(A) ? A.size() : arraySize(A)\n switch (size.length) {\n case 1:\n // Single element Array | Matrix\n if (size[0] === 1) {\n return map(A, sqrt)\n } else {\n throw new RangeError('Matrix must be square ' +\n '(size: ' + format(size) + ')')\n }\n\n case 2:\n {\n // Two-dimensional Array | Matrix\n const rows = size[0]\n const cols = size[1]\n if (rows === cols) {\n return _denmanBeavers(A)\n } else {\n throw new RangeError('Matrix must be square ' +\n '(size: ' + format(size) + ')')\n }\n }\n default:\n // Multi dimensional array\n throw new RangeError('Matrix must be at most two dimensional ' +\n '(size: ' + format(size) + ')')\n }\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'sylvester'\nconst dependencies = [\n 'typed',\n 'schur',\n 'matrixFromColumns',\n 'matrix',\n 'multiply',\n 'range',\n 'concat',\n 'transpose',\n 'index',\n 'subset',\n 'add',\n 'subtract',\n 'identity',\n 'lusolve',\n 'abs'\n]\n\nexport const createSylvester = /* #__PURE__ */ factory(name, dependencies, (\n {\n typed,\n schur,\n matrixFromColumns,\n matrix,\n multiply,\n range,\n concat,\n transpose,\n index,\n subset,\n add,\n subtract,\n identity,\n lusolve,\n abs\n }\n) => {\n /**\n *\n * Solves the real-valued Sylvester equation AX+XB=C for X, where A, B and C are\n * matrices of appropriate dimensions, being A and B squared. Notice that other\n * equivalent definitions for the Sylvester equation exist and this function\n * assumes the one presented in the original publication of the the Bartels-\n * Stewart algorithm, which is implemented by this function.\n * https://en.wikipedia.org/wiki/Sylvester_equation\n *\n * Syntax:\n *\n * math.sylvester(A, B, C)\n *\n * Examples:\n *\n * const A = [[-1, -2], [1, 1]]\n * const B = [[2, -1], [1, -2]]\n * const C = [[-3, 2], [3, 0]]\n * math.sylvester(A, B, C) // returns DenseMatrix [[-0.25, 0.25], [1.5, -1.25]]\n *\n * See also:\n *\n * schur, lyap\n *\n * @param {Matrix | Array} A Matrix A\n * @param {Matrix | Array} B Matrix B\n * @param {Matrix | Array} C Matrix C\n * @return {Matrix | Array} Matrix X, solving the Sylvester equation\n */\n return typed(name, {\n 'Matrix, Matrix, Matrix': _sylvester,\n 'Array, Matrix, Matrix': function (A, B, C) {\n return _sylvester(matrix(A), B, C)\n },\n 'Array, Array, Matrix': function (A, B, C) {\n return _sylvester(matrix(A), matrix(B), C)\n },\n 'Array, Matrix, Array': function (A, B, C) {\n return _sylvester(matrix(A), B, matrix(C))\n },\n 'Matrix, Array, Matrix': function (A, B, C) {\n return _sylvester(A, matrix(B), C)\n },\n 'Matrix, Array, Array': function (A, B, C) {\n return _sylvester(A, matrix(B), matrix(C))\n },\n 'Matrix, Matrix, Array': function (A, B, C) {\n return _sylvester(A, B, matrix(C))\n },\n 'Array, Array, Array': function (A, B, C) {\n return _sylvester(matrix(A), matrix(B), matrix(C)).toArray()\n }\n })\n function _sylvester (A, B, C) {\n const n = B.size()[0]\n const m = A.size()[0]\n\n const sA = schur(A)\n const F = sA.T\n const U = sA.U\n const sB = schur(multiply(-1, B))\n const G = sB.T\n const V = sB.U\n const D = multiply(multiply(transpose(U), C), V)\n const all = range(0, m)\n const y = []\n\n const hc = (a, b) => concat(a, b, 1)\n const vc = (a, b) => concat(a, b, 0)\n\n for (let k = 0; k < n; k++) {\n if (k < (n - 1) && abs(subset(G, index(k + 1, k))) > 1e-5) {\n let RHS = vc(subset(D, index(all, k)), subset(D, index(all, k + 1)))\n for (let j = 0; j < k; j++) {\n RHS = add(RHS,\n vc(multiply(y[j], subset(G, index(j, k))), multiply(y[j], subset(G, index(j, k + 1))))\n )\n }\n const gkk = multiply(identity(m), multiply(-1, subset(G, index(k, k))))\n const gmk = multiply(identity(m), multiply(-1, subset(G, index(k + 1, k))))\n const gkm = multiply(identity(m), multiply(-1, subset(G, index(k, k + 1))))\n const gmm = multiply(identity(m), multiply(-1, subset(G, index(k + 1, k + 1))))\n const LHS = vc(\n hc(add(F, gkk), gmk),\n hc(gkm, add(F, gmm))\n )\n const yAux = lusolve(LHS, RHS)\n y[k] = yAux.subset(index(range(0, m), 0))\n y[k + 1] = yAux.subset(index(range(m, 2 * m), 0))\n k++\n } else {\n let RHS = subset(D, index(all, k))\n for (let j = 0; j < k; j++) { RHS = add(RHS, multiply(y[j], subset(G, index(j, k)))) }\n const gkk = subset(G, index(k, k))\n const LHS = subtract(F, multiply(gkk, identity(m)))\n\n y[k] = lusolve(LHS, RHS)\n }\n }\n const Y = matrix(matrixFromColumns(...y))\n const X = multiply(U, multiply(Y, transpose(V)))\n\n return X\n }\n})\n","import { factory } from '../../../utils/factory.js'\n\nconst name = 'schur'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'identity',\n 'multiply',\n 'qr',\n 'norm',\n 'subtract'\n]\n\nexport const createSchur = /* #__PURE__ */ factory(name, dependencies, (\n {\n typed,\n matrix,\n identity,\n multiply,\n qr,\n norm,\n subtract\n }\n) => {\n /**\n *\n * Performs a real Schur decomposition of the real matrix A = UTU' where U is orthogonal\n * and T is upper quasi-triangular.\n * https://en.wikipedia.org/wiki/Schur_decomposition\n *\n * Syntax:\n *\n * math.schur(A)\n *\n * Examples:\n *\n * const A = [[1, 0], [-4, 3]]\n * math.schur(A) // returns {T: [[3, 4], [0, 1]], R: [[0, 1], [-1, 0]]}\n *\n * See also:\n *\n * sylvester, lyap, qr\n *\n * @param {Array | Matrix} A Matrix A\n * @return {{U: Array | Matrix, T: Array | Matrix}} Object containing both matrix U and T of the Schur Decomposition A=UTU'\n */\n return typed(name, {\n Array: function (X) {\n const r = _schur(matrix(X))\n return {\n U: r.U.valueOf(),\n T: r.T.valueOf()\n }\n },\n\n Matrix: function (X) {\n return _schur(X)\n }\n })\n function _schur (X) {\n const n = X.size()[0]\n let A = X\n let U = identity(n)\n let k = 0\n let A0\n do {\n A0 = A\n const QR = qr(A)\n const Q = QR.Q\n const R = QR.R\n A = multiply(R, Q)\n U = multiply(U, Q)\n if ((k++) > 100) { break }\n } while (norm(subtract(A, A0)) > 1e-4)\n return { U, T: A }\n }\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'lyap'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'sylvester',\n 'multiply',\n 'transpose'\n]\n\nexport const createLyap = /* #__PURE__ */ factory(name, dependencies, (\n {\n typed,\n matrix,\n sylvester,\n multiply,\n transpose\n }\n) => {\n /**\n *\n * Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P, where\n * Q is an input matrix. When Q is symmetric, P is also symmetric. Notice\n * that different equivalent definitions exist for the Continuous-time\n * Lyapunov equation.\n * https://en.wikipedia.org/wiki/Lyapunov_equation\n *\n * Syntax:\n *\n * math.lyap(A, Q)\n *\n * Examples:\n *\n * const A = [[-2, 0], [1, -4]]\n * const Q = [[3, 1], [1, 3]]\n * const P = math.lyap(A, Q)\n *\n * See also:\n *\n * sylvester, schur\n *\n * @param {Matrix | Array} A Matrix A\n * @param {Matrix | Array} Q Matrix Q\n * @return {Matrix | Array} Matrix P solution to the Continuous-time Lyapunov equation AP+PA'=Q\n */\n return typed(name, {\n 'Matrix, Matrix': function (A, Q) {\n return sylvester(A, transpose(A), multiply(-1, Q))\n },\n 'Array, Matrix': function (A, Q) {\n return sylvester(matrix(A), transpose(matrix(A)), multiply(-1, Q))\n },\n 'Matrix, Array': function (A, Q) {\n return sylvester(A, transpose(matrix(A)), matrix(multiply(-1, Q)))\n },\n 'Array, Array': function (A, Q) {\n return sylvester(matrix(A), transpose(matrix(A)), matrix(multiply(-1, Q))).toArray()\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\nimport { extend } from '../../utils/object.js'\nimport { createMatAlgo11xS0s } from '../../type/matrix/utils/matAlgo11xS0s.js'\nimport { createMatAlgo14xDs } from '../../type/matrix/utils/matAlgo14xDs.js'\n\nconst name = 'divide'\nconst dependencies = [\n 'typed',\n 'matrix',\n 'multiply',\n 'equalScalar',\n 'divideScalar',\n 'inv'\n]\n\nexport const createDivide = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, multiply, equalScalar, divideScalar, inv }) => {\n const matAlgo11xS0s = createMatAlgo11xS0s({ typed, equalScalar })\n const matAlgo14xDs = createMatAlgo14xDs({ typed })\n\n /**\n * Divide two values, `x / y`.\n * To divide matrices, `x` is multiplied with the inverse of `y`: `x * inv(y)`.\n *\n * Syntax:\n *\n * math.divide(x, y)\n *\n * Examples:\n *\n * math.divide(2, 3) // returns number 0.6666666666666666\n *\n * const a = math.complex(5, 14)\n * const b = math.complex(4, 1)\n * math.divide(a, b) // returns Complex 2 + 3i\n *\n * const c = [[7, -6], [13, -4]]\n * const d = [[1, 2], [4, 3]]\n * math.divide(c, d) // returns Array [[-9, 4], [-11, 6]]\n *\n * const e = math.unit('18 km')\n * math.divide(e, 4.5) // returns Unit 4 km\n *\n * See also:\n *\n * multiply\n *\n * @param {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} x Numerator\n * @param {number | BigNumber | bigint | Fraction | Complex | Array | Matrix} y Denominator\n * @return {number | BigNumber | bigint | Fraction | Complex | Unit | Array | Matrix} Quotient, `x / y`\n */\n return typed('divide', extend({\n // we extend the signatures of divideScalar with signatures dealing with matrices\n\n 'Array | Matrix, Array | Matrix': function (x, y) {\n // TODO: implement matrix right division using pseudo inverse\n // https://www.mathworks.nl/help/matlab/ref/mrdivide.html\n // https://www.gnu.org/software/octave/doc/interpreter/Arithmetic-Ops.html\n // https://stackoverflow.com/questions/12263932/how-does-gnu-octave-matrix-division-work-getting-unexpected-behaviour\n return multiply(x, inv(y))\n },\n\n 'DenseMatrix, any': function (x, y) {\n return matAlgo14xDs(x, y, divideScalar, false)\n },\n\n 'SparseMatrix, any': function (x, y) {\n return matAlgo11xS0s(x, y, divideScalar, false)\n },\n\n 'Array, any': function (x, y) {\n // use matrix implementation\n return matAlgo14xDs(matrix(x), y, divideScalar, false).valueOf()\n },\n\n 'any, Array | Matrix': function (x, y) {\n return multiply(x, inv(y))\n }\n }, divideScalar.signatures))\n})\n","import { isBigNumber } from '../../utils/is.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'distance'\nconst dependencies = [\n 'typed',\n 'addScalar',\n 'subtractScalar',\n 'divideScalar',\n 'multiplyScalar',\n 'deepEqual',\n 'sqrt',\n 'abs'\n]\n\nexport const createDistance = /* #__PURE__ */ factory(name, dependencies, ({ typed, addScalar, subtractScalar, multiplyScalar, divideScalar, deepEqual, sqrt, abs }) => {\n /**\n * Calculates:\n * The eucledian distance between two points in N-dimensional spaces.\n * Distance between point and a line in 2 and 3 dimensional spaces.\n * Pairwise distance between a set of 2D or 3D points\n * NOTE:\n * When substituting coefficients of a line(a, b and c), use ax + by + c = 0 instead of ax + by = c\n * For parametric equation of a 3D line, x0, y0, z0, a, b, c are from: (x−x0, y−y0, z−z0) = t(a, b, c)\n *\n * Syntax:\n *\n * math.distance([x1,y1], [x2,y2])\n * math.distance({pointOneX, pointOneY}, {pointTwoX, pointTwoY})\n * math.distance([x1,y1,z1], [x2,y2,z2])\n * math.distance({pointOneX, pointOneY, pointOneZ}, {pointTwoX, pointTwoY, pointTwoZ})\n * math.distance([x1,y1,z1,a1], [x2,y2,z2,a2])\n * math.distance([[x1,y1], [x2,y2], [x3,y3]])\n * math.distance([[x1,y1,z1], [x2,y2,z2], [x3,y3,z3]])\n * math.distance([pointX,pointY], [a,b,c])\n * math.distance([pointX,pointY], [lineOnePtX,lineOnePtY], [lineTwoPtX,lineTwoPtY])\n * math.distance({pointX, pointY}, {lineOnePtX, lineOnePtY}, {lineTwoPtX, lineTwoPtY})\n * math.distance([pointX,pointY,pointZ], [x0, y0, z0, a, b, c])\n * math.distance({pointX, pointY, pointZ}, {x0, y0, z0, a, b, c})\n *\n * Examples:\n * math.distance([0,0], [4,4]) // Returns 5.656854249492381\n * math.distance(\n * {pointOneX: 0, pointOneY: 0},\n * {pointTwoX: 10, pointTwoY: 10}) // Returns 14.142135623730951\n * math.distance([1, 0, 1], [4, -2, 2]) // Returns 3.7416573867739413\n * math.distance(\n * {pointOneX: 4, pointOneY: 5, pointOneZ: 8},\n * {pointTwoX: 2, pointTwoY: 7, pointTwoZ: 9}) // Returns 3\n * math.distance([1, 0, 1, 0], [0, -1, 0, -1]) // Returns 2\n * math.distance([[1, 2], [1, 2], [1, 3]]) // Returns [0, 1, 1]\n * math.distance([[1,2,4], [1,2,6], [8,1,3]]) // Returns [2, 7.14142842854285, 7.681145747868608]\n * math.distance([10, 10], [8, 1, 3]) // Returns 11.535230316796387\n * math.distance([0, 0], [3, 0], [0, 4]) // Returns 2.4\n * math.distance(\n * {pointX: 0, pointY: 0},\n * {lineOnePtX: 3, lineOnePtY: 0},\n * {lineTwoPtX: 0, lineTwoPtY: 4}) // Returns 2.4\n * math.distance([2, 3, 1], [1, 1, 2, 5, 0, 1]) // Returns 2.3204774044612857\n * math.distance(\n * {pointX: 2, pointY: 3, pointZ: 1},\n * {x0: 1, y0: 1, z0: 2, a: 5, b: 0, c: 1}) // Returns 2.3204774044612857\n *\n * @param {Array | Matrix | Object} x Co-ordinates of first point\n * @param {Array | Matrix | Object} y Co-ordinates of second point\n * @return {Number | BigNumber} Returns the distance from two/three points\n */\n return typed(name, {\n 'Array, Array, Array': function (x, y, z) {\n // Point to Line 2D (x=Point, y=LinePoint1, z=LinePoint2)\n if (x.length === 2 && y.length === 2 && z.length === 2) {\n if (!_2d(x)) { throw new TypeError('Array with 2 numbers or BigNumbers expected for first argument') }\n if (!_2d(y)) { throw new TypeError('Array with 2 numbers or BigNumbers expected for second argument') }\n if (!_2d(z)) { throw new TypeError('Array with 2 numbers or BigNumbers expected for third argument') }\n if (deepEqual(y, z)) { throw new TypeError('LinePoint1 should not be same with LinePoint2') }\n const xCoeff = subtractScalar(z[1], y[1])\n const yCoeff = subtractScalar(y[0], z[0])\n const constant = subtractScalar(multiplyScalar(z[0], y[1]), multiplyScalar(y[0], z[1]))\n\n return _distancePointLine2D(x[0], x[1], xCoeff, yCoeff, constant)\n } else {\n throw new TypeError('Invalid Arguments: Try again')\n }\n },\n 'Object, Object, Object': function (x, y, z) {\n if (Object.keys(x).length === 2 && Object.keys(y).length === 2 && Object.keys(z).length === 2) {\n if (!_2d(x)) { throw new TypeError('Values of pointX and pointY should be numbers or BigNumbers') }\n if (!_2d(y)) { throw new TypeError('Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers') }\n if (!_2d(z)) { throw new TypeError('Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers') }\n if (deepEqual(_objectToArray(y), _objectToArray(z))) { throw new TypeError('LinePoint1 should not be same with LinePoint2') }\n if ('pointX' in x && 'pointY' in x && 'lineOnePtX' in y &&\n 'lineOnePtY' in y && 'lineTwoPtX' in z && 'lineTwoPtY' in z) {\n const xCoeff = subtractScalar(z.lineTwoPtY, y.lineOnePtY)\n const yCoeff = subtractScalar(y.lineOnePtX, z.lineTwoPtX)\n const constant = subtractScalar(multiplyScalar(z.lineTwoPtX, y.lineOnePtY), multiplyScalar(y.lineOnePtX, z.lineTwoPtY))\n return _distancePointLine2D(x.pointX, x.pointY, xCoeff, yCoeff, constant)\n } else {\n throw new TypeError('Key names do not match')\n }\n } else {\n throw new TypeError('Invalid Arguments: Try again')\n }\n },\n 'Array, Array': function (x, y) {\n // Point to Line 2D (x=[pointX, pointY], y=[x-coeff, y-coeff, const])\n if (x.length === 2 && y.length === 3) {\n if (!_2d(x)) {\n throw new TypeError('Array with 2 numbers or BigNumbers expected for first argument')\n }\n if (!_3d(y)) {\n throw new TypeError('Array with 3 numbers or BigNumbers expected for second argument')\n }\n\n return _distancePointLine2D(x[0], x[1], y[0], y[1], y[2])\n } else if (x.length === 3 && y.length === 6) {\n // Point to Line 3D\n if (!_3d(x)) {\n throw new TypeError('Array with 3 numbers or BigNumbers expected for first argument')\n }\n if (!_parametricLine(y)) {\n throw new TypeError('Array with 6 numbers or BigNumbers expected for second argument')\n }\n\n return _distancePointLine3D(x[0], x[1], x[2], y[0], y[1], y[2], y[3], y[4], y[5])\n } else if (x.length === y.length && x.length > 0) {\n // Point to Point N-dimensions\n if (!_containsOnlyNumbers(x)) {\n throw new TypeError('All values of an array should be numbers or BigNumbers')\n }\n if (!_containsOnlyNumbers(y)) {\n throw new TypeError('All values of an array should be numbers or BigNumbers')\n }\n\n return _euclideanDistance(x, y)\n } else {\n throw new TypeError('Invalid Arguments: Try again')\n }\n },\n 'Object, Object': function (x, y) {\n if (Object.keys(x).length === 2 && Object.keys(y).length === 3) {\n if (!_2d(x)) {\n throw new TypeError('Values of pointX and pointY should be numbers or BigNumbers')\n }\n if (!_3d(y)) {\n throw new TypeError('Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers')\n }\n if ('pointX' in x && 'pointY' in x && 'xCoeffLine' in y && 'yCoeffLine' in y && 'constant' in y) {\n return _distancePointLine2D(x.pointX, x.pointY, y.xCoeffLine, y.yCoeffLine, y.constant)\n } else {\n throw new TypeError('Key names do not match')\n }\n } else if (Object.keys(x).length === 3 && Object.keys(y).length === 6) {\n // Point to Line 3D\n if (!_3d(x)) {\n throw new TypeError('Values of pointX, pointY and pointZ should be numbers or BigNumbers')\n }\n if (!_parametricLine(y)) {\n throw new TypeError('Values of x0, y0, z0, a, b and c should be numbers or BigNumbers')\n }\n if ('pointX' in x && 'pointY' in x && 'x0' in y && 'y0' in y && 'z0' in y && 'a' in y && 'b' in y && 'c' in y) {\n return _distancePointLine3D(x.pointX, x.pointY, x.pointZ, y.x0, y.y0, y.z0, y.a, y.b, y.c)\n } else {\n throw new TypeError('Key names do not match')\n }\n } else if (Object.keys(x).length === 2 && Object.keys(y).length === 2) {\n // Point to Point 2D\n if (!_2d(x)) {\n throw new TypeError('Values of pointOneX and pointOneY should be numbers or BigNumbers')\n }\n if (!_2d(y)) {\n throw new TypeError('Values of pointTwoX and pointTwoY should be numbers or BigNumbers')\n }\n if ('pointOneX' in x && 'pointOneY' in x && 'pointTwoX' in y && 'pointTwoY' in y) {\n return _euclideanDistance([x.pointOneX, x.pointOneY], [y.pointTwoX, y.pointTwoY])\n } else {\n throw new TypeError('Key names do not match')\n }\n } else if (Object.keys(x).length === 3 && Object.keys(y).length === 3) {\n // Point to Point 3D\n if (!_3d(x)) {\n throw new TypeError('Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers')\n }\n if (!_3d(y)) {\n throw new TypeError('Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers')\n }\n if ('pointOneX' in x && 'pointOneY' in x && 'pointOneZ' in x &&\n 'pointTwoX' in y && 'pointTwoY' in y && 'pointTwoZ' in y\n ) {\n return _euclideanDistance([x.pointOneX, x.pointOneY, x.pointOneZ], [y.pointTwoX, y.pointTwoY, y.pointTwoZ])\n } else {\n throw new TypeError('Key names do not match')\n }\n } else {\n throw new TypeError('Invalid Arguments: Try again')\n }\n },\n Array: function (arr) {\n if (!_pairwise(arr)) { throw new TypeError('Incorrect array format entered for pairwise distance calculation') }\n\n return _distancePairwise(arr)\n }\n })\n\n function _isNumber (a) {\n // distance supports numbers and bignumbers\n return (typeof a === 'number' || isBigNumber(a))\n }\n\n function _2d (a) {\n // checks if the number of arguments are correct in count and are valid (should be numbers)\n if (a.constructor !== Array) {\n a = _objectToArray(a)\n }\n return _isNumber(a[0]) && _isNumber(a[1])\n }\n\n function _3d (a) {\n // checks if the number of arguments are correct in count and are valid (should be numbers)\n if (a.constructor !== Array) {\n a = _objectToArray(a)\n }\n return _isNumber(a[0]) && _isNumber(a[1]) && _isNumber(a[2])\n }\n\n function _containsOnlyNumbers (a) {\n // checks if the number of arguments are correct in count and are valid (should be numbers)\n if (!Array.isArray(a)) {\n a = _objectToArray(a)\n }\n return a.every(_isNumber)\n }\n\n function _parametricLine (a) {\n if (a.constructor !== Array) {\n a = _objectToArray(a)\n }\n return _isNumber(a[0]) && _isNumber(a[1]) && _isNumber(a[2]) &&\n _isNumber(a[3]) && _isNumber(a[4]) && _isNumber(a[5])\n }\n\n function _objectToArray (o) {\n const keys = Object.keys(o)\n const a = []\n for (let i = 0; i < keys.length; i++) {\n a.push(o[keys[i]])\n }\n return a\n }\n\n function _pairwise (a) {\n // checks for valid arguments passed to _distancePairwise(Array)\n if (a[0].length === 2 && _isNumber(a[0][0]) && _isNumber(a[0][1])) {\n if (a.some(aI => aI.length !== 2 || !_isNumber(aI[0]) || !_isNumber(aI[1]))) {\n return false\n }\n } else if (a[0].length === 3 && _isNumber(a[0][0]) && _isNumber(a[0][1]) && _isNumber(a[0][2])) {\n if (a.some(aI => aI.length !== 3 || !_isNumber(aI[0]) || !_isNumber(aI[1]) || !_isNumber(aI[2]))) {\n return false\n }\n } else {\n return false\n }\n return true\n }\n\n function _distancePointLine2D (x, y, a, b, c) {\n const num = abs(addScalar(addScalar(multiplyScalar(a, x), multiplyScalar(b, y)), c))\n const den = sqrt(addScalar(multiplyScalar(a, a), multiplyScalar(b, b)))\n return divideScalar(num, den)\n }\n\n function _distancePointLine3D (x, y, z, x0, y0, z0, a, b, c) {\n let num = [subtractScalar(multiplyScalar(subtractScalar(y0, y), c), multiplyScalar(subtractScalar(z0, z), b)),\n subtractScalar(multiplyScalar(subtractScalar(z0, z), a), multiplyScalar(subtractScalar(x0, x), c)),\n subtractScalar(multiplyScalar(subtractScalar(x0, x), b), multiplyScalar(subtractScalar(y0, y), a))]\n num = sqrt(addScalar(addScalar(multiplyScalar(num[0], num[0]), multiplyScalar(num[1], num[1])), multiplyScalar(num[2], num[2])))\n const den = sqrt(addScalar(addScalar(multiplyScalar(a, a), multiplyScalar(b, b)), multiplyScalar(c, c)))\n return divideScalar(num, den)\n }\n\n function _euclideanDistance (x, y) {\n const vectorSize = x.length\n let result = 0\n let diff = 0\n for (let i = 0; i < vectorSize; i++) {\n diff = subtractScalar(x[i], y[i])\n result = addScalar(multiplyScalar(diff, diff), result)\n }\n return sqrt(result)\n }\n\n function _distancePairwise (a) {\n const result = []\n let pointA = []\n let pointB = []\n for (let i = 0; i < a.length - 1; i++) {\n for (let j = i + 1; j < a.length; j++) {\n if (a[0].length === 2) {\n pointA = [a[i][0], a[i][1]]\n pointB = [a[j][0], a[j][1]]\n } else if (a[0].length === 3) {\n pointA = [a[i][0], a[i][1], a[i][2]]\n pointB = [a[j][0], a[j][1], a[j][2]]\n }\n result.push(_euclideanDistance(pointA, pointB))\n }\n }\n return result\n }\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'intersect'\nconst dependencies = [\n 'typed', 'config', 'abs', 'add', 'addScalar', 'matrix', 'multiply', 'multiplyScalar', 'divideScalar', 'subtract', 'smaller', 'equalScalar', 'flatten', 'isZero', 'isNumeric'\n]\n\nexport const createIntersect = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, abs, add, addScalar, matrix, multiply, multiplyScalar, divideScalar, subtract, smaller, equalScalar, flatten, isZero, isNumeric }) => {\n /**\n * Calculates the point of intersection of two lines in two or three dimensions\n * and of a line and a plane in three dimensions. The inputs are in the form of\n * arrays or 1 dimensional matrices. The line intersection functions return null\n * if the lines do not meet.\n *\n * Note: Fill the plane coefficients as `x + y + z = c` and not as `x + y + z + c = 0`.\n *\n * Syntax:\n *\n * math.intersect(endPoint1Line1, endPoint2Line1, endPoint1Line2, endPoint2Line2)\n * math.intersect(endPoint1, endPoint2, planeCoefficients)\n *\n * Examples:\n *\n * math.intersect([0, 0], [10, 10], [10, 0], [0, 10]) // Returns [5, 5]\n * math.intersect([0, 0, 0], [10, 10, 0], [10, 0, 0], [0, 10, 0]) // Returns [5, 5, 0]\n * math.intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6]) // Returns [7, -4, 3]\n *\n * @param {Array | Matrix} w Co-ordinates of first end-point of first line\n * @param {Array | Matrix} x Co-ordinates of second end-point of first line\n * @param {Array | Matrix} y Co-ordinates of first end-point of second line\n * OR Co-efficients of the plane's equation\n * @param {Array | Matrix} z Co-ordinates of second end-point of second line\n * OR undefined if the calculation is for line and plane\n * @return {Array} Returns the point of intersection of lines/lines-planes\n */\n return typed('intersect', {\n 'Array, Array, Array': _AAA,\n\n 'Array, Array, Array, Array': _AAAA,\n\n 'Matrix, Matrix, Matrix': function (x, y, plane) {\n const arr = _AAA(x.valueOf(), y.valueOf(), plane.valueOf())\n return arr === null ? null : matrix(arr)\n },\n\n 'Matrix, Matrix, Matrix, Matrix': function (w, x, y, z) {\n // TODO: output matrix type should match input matrix type\n const arr = _AAAA(w.valueOf(), x.valueOf(), y.valueOf(), z.valueOf())\n return arr === null ? null : matrix(arr)\n }\n })\n\n function _AAA (x, y, plane) {\n x = _coerceArr(x)\n y = _coerceArr(y)\n plane = _coerceArr(plane)\n\n if (!_3d(x)) { throw new TypeError('Array with 3 numbers or BigNumbers expected for first argument') }\n if (!_3d(y)) { throw new TypeError('Array with 3 numbers or BigNumbers expected for second argument') }\n if (!_4d(plane)) { throw new TypeError('Array with 4 numbers expected as third argument') }\n\n return _intersectLinePlane(x[0], x[1], x[2], y[0], y[1], y[2], plane[0], plane[1], plane[2], plane[3])\n }\n\n function _AAAA (w, x, y, z) {\n w = _coerceArr(w)\n x = _coerceArr(x)\n y = _coerceArr(y)\n z = _coerceArr(z)\n\n if (w.length === 2) {\n if (!_2d(w)) { throw new TypeError('Array with 2 numbers or BigNumbers expected for first argument') }\n if (!_2d(x)) { throw new TypeError('Array with 2 numbers or BigNumbers expected for second argument') }\n if (!_2d(y)) { throw new TypeError('Array with 2 numbers or BigNumbers expected for third argument') }\n if (!_2d(z)) { throw new TypeError('Array with 2 numbers or BigNumbers expected for fourth argument') }\n\n return _intersect2d(w, x, y, z)\n } else if (w.length === 3) {\n if (!_3d(w)) { throw new TypeError('Array with 3 numbers or BigNumbers expected for first argument') }\n if (!_3d(x)) { throw new TypeError('Array with 3 numbers or BigNumbers expected for second argument') }\n if (!_3d(y)) { throw new TypeError('Array with 3 numbers or BigNumbers expected for third argument') }\n if (!_3d(z)) { throw new TypeError('Array with 3 numbers or BigNumbers expected for fourth argument') }\n\n return _intersect3d(w[0], w[1], w[2], x[0], x[1], x[2], y[0], y[1], y[2], z[0], z[1], z[2])\n } else {\n throw new TypeError('Arrays with two or thee dimensional points expected')\n }\n }\n\n /** Coerce row and column 2-dim arrays to 1-dim array */\n function _coerceArr (arr) {\n // row matrix\n if (arr.length === 1) return arr[0]\n\n // column matrix\n if (arr.length > 1 && Array.isArray(arr[0])) {\n if (arr.every(el => Array.isArray(el) && el.length === 1)) return flatten(arr)\n }\n\n return arr\n }\n\n function _2d (x) {\n return x.length === 2 && isNumeric(x[0]) && isNumeric(x[1])\n }\n\n function _3d (x) {\n return x.length === 3 && isNumeric(x[0]) && isNumeric(x[1]) && isNumeric(x[2])\n }\n\n function _4d (x) {\n return x.length === 4 && isNumeric(x[0]) && isNumeric(x[1]) && isNumeric(x[2]) && isNumeric(x[3])\n }\n\n function _intersect2d (p1a, p1b, p2a, p2b) {\n const o1 = p1a\n const o2 = p2a\n const d1 = subtract(o1, p1b)\n const d2 = subtract(o2, p2b)\n const det = subtract(multiplyScalar(d1[0], d2[1]), multiplyScalar(d2[0], d1[1]))\n if (isZero(det)) return null\n if (smaller(abs(det), config.relTol)) {\n return null\n }\n const d20o11 = multiplyScalar(d2[0], o1[1])\n const d21o10 = multiplyScalar(d2[1], o1[0])\n const d20o21 = multiplyScalar(d2[0], o2[1])\n const d21o20 = multiplyScalar(d2[1], o2[0])\n const t = divideScalar(addScalar(subtract(subtract(d20o11, d21o10), d20o21), d21o20), det)\n return add(multiply(d1, t), o1)\n }\n\n function _intersect3dHelper (a, b, c, d, e, f, g, h, i, j, k, l) {\n // (a - b)*(c - d) + (e - f)*(g - h) + (i - j)*(k - l)\n const add1 = multiplyScalar(subtract(a, b), subtract(c, d))\n const add2 = multiplyScalar(subtract(e, f), subtract(g, h))\n const add3 = multiplyScalar(subtract(i, j), subtract(k, l))\n return addScalar(addScalar(add1, add2), add3)\n }\n\n function _intersect3d (x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4) {\n const d1343 = _intersect3dHelper(x1, x3, x4, x3, y1, y3, y4, y3, z1, z3, z4, z3)\n const d4321 = _intersect3dHelper(x4, x3, x2, x1, y4, y3, y2, y1, z4, z3, z2, z1)\n const d1321 = _intersect3dHelper(x1, x3, x2, x1, y1, y3, y2, y1, z1, z3, z2, z1)\n const d4343 = _intersect3dHelper(x4, x3, x4, x3, y4, y3, y4, y3, z4, z3, z4, z3)\n const d2121 = _intersect3dHelper(x2, x1, x2, x1, y2, y1, y2, y1, z2, z1, z2, z1)\n const numerator = subtract(multiplyScalar(d1343, d4321), multiplyScalar(d1321, d4343))\n const denominator = subtract(multiplyScalar(d2121, d4343), multiplyScalar(d4321, d4321))\n if (isZero(denominator)) return null\n const ta = divideScalar(numerator, denominator)\n const tb = divideScalar(addScalar(d1343, multiplyScalar(ta, d4321)), d4343)\n\n const pax = addScalar(x1, multiplyScalar(ta, subtract(x2, x1)))\n const pay = addScalar(y1, multiplyScalar(ta, subtract(y2, y1)))\n const paz = addScalar(z1, multiplyScalar(ta, subtract(z2, z1)))\n const pbx = addScalar(x3, multiplyScalar(tb, subtract(x4, x3)))\n const pby = addScalar(y3, multiplyScalar(tb, subtract(y4, y3)))\n const pbz = addScalar(z3, multiplyScalar(tb, subtract(z4, z3)))\n if (equalScalar(pax, pbx) && equalScalar(pay, pby) && equalScalar(paz, pbz)) {\n return [pax, pay, paz]\n } else {\n return null\n }\n }\n\n function _intersectLinePlane (x1, y1, z1, x2, y2, z2, x, y, z, c) {\n const x1x = multiplyScalar(x1, x)\n const x2x = multiplyScalar(x2, x)\n const y1y = multiplyScalar(y1, y)\n const y2y = multiplyScalar(y2, y)\n const z1z = multiplyScalar(z1, z)\n const z2z = multiplyScalar(z2, z)\n\n const numerator = subtract(subtract(subtract(c, x1x), y1y), z1z)\n const denominator = subtract(subtract(subtract(addScalar(addScalar(x2x, y2y), z2z), x1x), y1y), z1z)\n\n const t = divideScalar(numerator, denominator)\n\n const px = addScalar(x1, multiplyScalar(t, subtract(x2, x1)))\n const py = addScalar(y1, multiplyScalar(t, subtract(y2, y1)))\n const pz = addScalar(z1, multiplyScalar(t, subtract(z2, z1)))\n return [px, py, pz]\n // TODO: Add cases when line is parallel to the plane:\n // (a) no intersection,\n // (b) line contained in plane\n }\n})\n","import { containsCollections, deepForEach, reduce } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\nimport { safeNumberType } from '../../utils/number.js'\nimport { improveErrorMessage } from './utils/improveErrorMessage.js'\n\nconst name = 'sum'\nconst dependencies = ['typed', 'config', 'add', 'numeric']\n\nexport const createSum = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, add, numeric }) => {\n /**\n * Compute the sum of a matrix or a list with values.\n * In case of a multidimensional array or matrix, the sum of all\n * elements will be calculated.\n *\n * Syntax:\n *\n * math.sum(a, b, c, ...)\n * math.sum(A)\n * math.sum(A, dimension)\n *\n * Examples:\n *\n * math.sum(2, 1, 4, 3) // returns 10\n * math.sum([2, 1, 4, 3]) // returns 10\n * math.sum([[2, 5], [4, 3], [1, 7]]) // returns 22\n *\n * See also:\n *\n * mean, median, min, max, prod, std, variance, cumsum\n *\n * @param {... *} args A single matrix or multiple scalar values\n * @return {*} The sum of all values\n */\n return typed(name, {\n // sum([a, b, c, d, ...])\n 'Array | Matrix': _sum,\n\n // sum([a, b, c, d, ...], dim)\n 'Array | Matrix, number | BigNumber': _nsumDim,\n\n // sum(a, b, c, d, ...)\n '...': function (args) {\n if (containsCollections(args)) {\n throw new TypeError('Scalar values expected in function sum')\n }\n\n return _sum(args)\n }\n })\n\n /**\n * Recursively calculate the sum of an n-dimensional array\n * @param {Array | Matrix} array\n * @return {number} sum\n * @private\n */\n function _sum (array) {\n let sum\n\n deepForEach(array, function (value) {\n try {\n sum = (sum === undefined) ? value : add(sum, value)\n } catch (err) {\n throw improveErrorMessage(err, 'sum', value)\n }\n })\n\n // make sure returning numeric value: parse a string into a numeric value\n if (sum === undefined) {\n sum = numeric(0, config.number)\n }\n if (typeof sum === 'string') {\n sum = numeric(sum, safeNumberType(sum, config))\n }\n\n return sum\n }\n\n function _nsumDim (array, dim) {\n try {\n const sum = reduce(array, dim, add)\n return sum\n } catch (err) {\n throw improveErrorMessage(err, 'sum')\n }\n }\n})\n","import { containsCollections } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\nimport { _switch } from '../../utils/switch.js'\nimport { improveErrorMessage } from './utils/improveErrorMessage.js'\nimport { arraySize } from '../../utils/array.js'\nimport { IndexError } from '../../error/IndexError.js'\n\nconst name = 'cumsum'\nconst dependencies = ['typed', 'add', 'unaryPlus']\n\nexport const createCumSum = /* #__PURE__ */ factory(name, dependencies, ({ typed, add, unaryPlus }) => {\n /**\n * Compute the cumulative sum of a matrix or a list with values.\n * In case of a (multi dimensional) array or matrix, the cumulative sums\n * along a specified dimension (defaulting to the first) will be calculated.\n *\n * Syntax:\n *\n * math.cumsum(a, b, c, ...)\n * math.cumsum(A)\n *\n * Examples:\n *\n * math.cumsum(2, 1, 4, 3) // returns [2, 3, 7, 10]\n * math.cumsum([2, 1, 4, 3]) // returns [2, 3, 7, 10]\n * math.cumsum([[1, 2], [3, 4]]) // returns [[1, 2], [4, 6]]\n * math.cumsum([[1, 2], [3, 4]], 0) // returns [[1, 2], [4, 6]]\n * math.cumsum([[1, 2], [3, 4]], 1) // returns [[1, 3], [3, 7]]\n * math.cumsum([[2, 5], [4, 3], [1, 7]]) // returns [[2, 5], [6, 8], [7, 15]]\n *\n * See also:\n *\n * mean, median, min, max, prod, std, variance, sum\n *\n * @param {... *} args A single matrix or or multiple scalar values\n * @return {*} The cumulative sum of all values\n */\n return typed(name, {\n // sum([a, b, c, d, ...])\n Array: _cumsum,\n Matrix: function (matrix) {\n return matrix.create(_cumsum(matrix.valueOf(), matrix.datatype()))\n },\n\n // sum([a, b, c, d, ...], dim)\n 'Array, number | BigNumber': _ncumSumDim,\n 'Matrix, number | BigNumber': function (matrix, dim) {\n return matrix.create(_ncumSumDim(matrix.valueOf(), dim), matrix.datatype())\n },\n\n // cumsum(a, b, c, d, ...)\n '...': function (args) {\n if (containsCollections(args)) {\n throw new TypeError('All values expected to be scalar in function cumsum')\n }\n\n return _cumsum(args)\n }\n })\n\n /**\n * Recursively calculate the cumulative sum of an n-dimensional array\n * @param {Array} array\n * @return {number} cumsum\n * @private\n */\n function _cumsum (array) {\n try {\n return _cumsummap(array)\n } catch (err) {\n throw improveErrorMessage(err, name)\n }\n }\n\n function _cumsummap (array) {\n if (array.length === 0) {\n return []\n }\n\n const sums = [unaryPlus(array[0])] // unaryPlus converts to number if need be\n for (let i = 1; i < array.length; ++i) {\n // Must use add below and not addScalar for the case of summing a\n // 2+-dimensional array along the 0th dimension (the row vectors,\n // or higher-d analogues, are literally added to each other).\n sums.push(add(sums[i - 1], array[i]))\n }\n return sums\n }\n\n function _ncumSumDim (array, dim) {\n const size = arraySize(array)\n if (dim < 0 || (dim >= size.length)) {\n // TODO: would be more clear when throwing a DimensionError here\n throw new IndexError(dim, size.length)\n }\n\n try {\n return _cumsumDimensional(array, dim)\n } catch (err) {\n throw improveErrorMessage(err, name)\n }\n }\n\n /* Possible TODO: Refactor _reduce in collection.js to be able to work here as well */\n function _cumsumDimensional (mat, dim) {\n let i, ret, tran\n\n if (dim <= 0) {\n const initialValue = mat[0][0]\n if (!Array.isArray(initialValue)) {\n return _cumsummap(mat)\n } else {\n tran = _switch(mat)\n ret = []\n for (i = 0; i < tran.length; i++) {\n ret[i] = _cumsumDimensional(tran[i], dim - 1)\n }\n return ret\n }\n } else {\n ret = []\n for (i = 0; i < mat.length; i++) {\n ret[i] = _cumsumDimensional(mat[i], dim - 1)\n }\n return ret\n }\n }\n})\n","import { containsCollections, deepForEach, reduce } from '../../utils/collection.js'\nimport { arraySize } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\nimport { improveErrorMessage } from './utils/improveErrorMessage.js'\n\nconst name = 'mean'\nconst dependencies = ['typed', 'add', 'divide']\n\nexport const createMean = /* #__PURE__ */ factory(name, dependencies, ({ typed, add, divide }) => {\n /**\n * Compute the mean value of matrix or a list with values.\n * In case of a multidimensional array, the mean of the flattened array\n * will be calculated. When `dim` is provided, the maximum over the selected\n * dimension will be calculated. Parameter `dim` is zero-based.\n *\n * Syntax:\n *\n * math.mean(a, b, c, ...)\n * math.mean(A)\n * math.mean(A, dimension)\n *\n * Examples:\n *\n * math.mean(2, 1, 4, 3) // returns 2.5\n * math.mean([1, 2.7, 3.2, 4]) // returns 2.725\n *\n * math.mean([[2, 5], [6, 3], [1, 7]], 0) // returns [3, 5]\n * math.mean([[2, 5], [6, 3], [1, 7]], 1) // returns [3.5, 4.5, 4]\n *\n * See also:\n *\n * median, min, max, sum, prod, std, variance\n *\n * @param {... *} args A single matrix or or multiple scalar values\n * @return {*} The mean of all values\n */\n return typed(name, {\n // mean([a, b, c, d, ...])\n 'Array | Matrix': _mean,\n\n // mean([a, b, c, d, ...], dim)\n 'Array | Matrix, number | BigNumber': _nmeanDim,\n\n // mean(a, b, c, d, ...)\n '...': function (args) {\n if (containsCollections(args)) {\n throw new TypeError('Scalar values expected in function mean')\n }\n\n return _mean(args)\n }\n })\n\n /**\n * Calculate the mean value in an n-dimensional array, returning a\n * n-1 dimensional array\n * @param {Array} array\n * @param {number} dim\n * @return {number} mean\n * @private\n */\n function _nmeanDim (array, dim) {\n try {\n const sum = reduce(array, dim, add)\n const s = Array.isArray(array) ? arraySize(array) : array.size()\n return divide(sum, s[dim])\n } catch (err) {\n throw improveErrorMessage(err, 'mean')\n }\n }\n\n /**\n * Recursively calculate the mean value in an n-dimensional array\n * @param {Array} array\n * @return {number} mean\n * @private\n */\n function _mean (array) {\n let sum\n let num = 0\n\n deepForEach(array, function (value) {\n try {\n sum = sum === undefined ? value : add(sum, value)\n num++\n } catch (err) {\n throw improveErrorMessage(err, 'mean', value)\n }\n })\n\n if (num === 0) {\n throw new Error('Cannot calculate the mean of an empty array')\n }\n return divide(sum, num)\n }\n})\n","import { containsCollections } from '../../utils/collection.js'\nimport { flatten } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\nimport { improveErrorMessage } from './utils/improveErrorMessage.js'\n\nconst name = 'median'\nconst dependencies = ['typed', 'add', 'divide', 'compare', 'partitionSelect']\n\nexport const createMedian = /* #__PURE__ */ factory(name, dependencies, ({ typed, add, divide, compare, partitionSelect }) => {\n /**\n * Recursively calculate the median of an n-dimensional array\n * @param {Array} array\n * @return {Number} median\n * @private\n */\n function _median (array) {\n try {\n array = flatten(array.valueOf())\n\n const num = array.length\n if (num === 0) {\n throw new Error('Cannot calculate median of an empty array')\n }\n\n if (num % 2 === 0) {\n // even: return the average of the two middle values\n const mid = num / 2 - 1\n const right = partitionSelect(array, mid + 1)\n\n // array now partitioned at mid + 1, take max of left part\n let left = array[mid]\n for (let i = 0; i < mid; ++i) {\n if (compare(array[i], left) > 0) {\n left = array[i]\n }\n }\n\n return middle2(left, right)\n } else {\n // odd: return the middle value\n const m = partitionSelect(array, (num - 1) / 2)\n\n return middle(m)\n }\n } catch (err) {\n throw improveErrorMessage(err, 'median')\n }\n }\n\n // helper function to type check the middle value of the array\n const middle = typed({\n 'number | BigNumber | Complex | Unit': function (value) {\n return value\n }\n })\n\n // helper function to type check the two middle value of the array\n const middle2 = typed({\n 'number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit': function (left, right) {\n return divide(add(left, right), 2)\n }\n })\n\n /**\n * Compute the median of a matrix or a list with values. The values are\n * sorted and the middle value is returned. In case of an even number of\n * values, the average of the two middle values is returned.\n * Supported types of values are: Number, BigNumber, Unit\n *\n * In case of a (multi dimensional) array or matrix, the median of all\n * elements will be calculated.\n *\n * Syntax:\n *\n * math.median(a, b, c, ...)\n * math.median(A)\n *\n * Examples:\n *\n * math.median(5, 2, 7) // returns 5\n * math.median([3, -1, 5, 7]) // returns 4\n *\n * See also:\n *\n * mean, min, max, sum, prod, std, variance, quantileSeq\n *\n * @param {... *} args A single matrix or or multiple scalar values\n * @return {*} The median\n */\n return typed(name, {\n // median([a, b, c, d, ...])\n 'Array | Matrix': _median,\n\n // median([a, b, c, d, ...], dim)\n 'Array | Matrix, number | BigNumber': function (array, dim) {\n // TODO: implement median(A, dim)\n throw new Error('median(A, dim) is not yet supported')\n // return reduce(arguments[0], arguments[1], ...)\n },\n\n // median(a, b, c, d, ...)\n '...': function (args) {\n if (containsCollections(args)) {\n throw new TypeError('Scalar values expected in function median')\n }\n\n return _median(args)\n }\n })\n})\n","import { flatten } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\nimport { improveErrorMessage } from './utils/improveErrorMessage.js'\n\nconst name = 'mad'\nconst dependencies = ['typed', 'abs', 'map', 'median', 'subtract']\n\nexport const createMad = /* #__PURE__ */ factory(name, dependencies, ({ typed, abs, map, median, subtract }) => {\n /**\n * Compute the median absolute deviation of a matrix or a list with values.\n * The median absolute deviation is defined as the median of the absolute\n * deviations from the median.\n *\n * Syntax:\n *\n * math.mad(a, b, c, ...)\n * math.mad(A)\n *\n * Examples:\n *\n * math.mad(10, 20, 30) // returns 10\n * math.mad([1, 2, 3]) // returns 1\n * math.mad([[1, 2, 3], [4, 5, 6]]) // returns 1.5\n *\n * See also:\n *\n * median, mean, std, abs\n *\n * @param {Array | Matrix} array\n * A single matrix or multiple scalar values.\n * @return {*} The median absolute deviation.\n */\n return typed(name, {\n // mad([a, b, c, d, ...])\n 'Array | Matrix': _mad,\n\n // mad(a, b, c, d, ...)\n '...': function (args) {\n return _mad(args)\n }\n })\n\n function _mad (array) {\n array = flatten(array.valueOf())\n\n if (array.length === 0) {\n throw new Error('Cannot calculate median absolute deviation (mad) of an empty array')\n }\n\n try {\n const med = median(array)\n return median(map(array, function (value) {\n return abs(subtract(value, med))\n }))\n } catch (err) {\n if (err instanceof TypeError && err.message.includes('median')) {\n throw new TypeError(err.message.replace('median', 'mad'))\n } else {\n throw improveErrorMessage(err, 'mad')\n }\n }\n }\n})\n","import { deepForEach } from '../../utils/collection.js'\nimport { isBigNumber } from '../../utils/is.js'\nimport { factory } from '../../utils/factory.js'\nimport { improveErrorMessage } from './utils/improveErrorMessage.js'\n\nconst DEFAULT_NORMALIZATION = 'unbiased'\n\nconst name = 'variance'\nconst dependencies = ['typed', 'add', 'subtract', 'multiply', 'divide', 'mapSlices', 'isNaN']\n\nexport const createVariance = /* #__PURE__ */ factory(name, dependencies, ({ typed, add, subtract, multiply, divide, mapSlices, isNaN: mathIsNaN }) => {\n /**\n * Compute the variance of a matrix or a list with values.\n * In case of a multidimensional array or matrix, the variance over all\n * elements will be calculated.\n *\n * Additionally, it is possible to compute the variance along the rows\n * or columns of a matrix by specifying the dimension as the second argument.\n *\n * Optionally, the type of normalization can be specified as the final\n * parameter. The parameter `normalization` can be one of the following values:\n *\n * - 'unbiased' (default) The sum of squared errors is divided by (n - 1)\n * - 'uncorrected' The sum of squared errors is divided by n\n * - 'biased' The sum of squared errors is divided by (n + 1)\n *\n *\n * Note that older browser may not like the variable name `var`. In that\n * case, the function can be called as `math['var'](...)` instead of\n * `math.var(...)`.\n *\n * Syntax:\n *\n * math.variance(a, b, c, ...)\n * math.variance(A)\n * math.variance(A, normalization)\n * math.variance(A, dimension)\n * math.variance(A, dimension, normalization)\n *\n * Examples:\n *\n * math.variance(2, 4, 6) // returns 4\n * math.variance([2, 4, 6, 8]) // returns 6.666666666666667\n * math.variance([2, 4, 6, 8], 'uncorrected') // returns 5\n * math.variance([2, 4, 6, 8], 'biased') // returns 4\n *\n * math.variance([[1, 2, 3], [4, 5, 6]]) // returns 3.5\n * math.variance([[1, 2, 3], [4, 6, 8]], 0) // returns [4.5, 8, 12.5]\n * math.variance([[1, 2, 3], [4, 6, 8]], 1) // returns [1, 4]\n * math.variance([[1, 2, 3], [4, 6, 8]], 1, 'biased') // returns [0.5, 2]\n *\n * See also:\n *\n * mean, median, max, min, prod, std, sum\n *\n * @param {Array | Matrix} array\n * A single matrix or or multiple scalar values\n * @param {string} [normalization='unbiased']\n * Determines how to normalize the variance.\n * Choose 'unbiased' (default), 'uncorrected', or 'biased'.\n * @param dimension {number | BigNumber}\n * Determines the axis to compute the variance for a matrix\n * @return {*} The variance\n */\n return typed(name, {\n // variance([a, b, c, d, ...])\n 'Array | Matrix': function (array) {\n return _var(array, DEFAULT_NORMALIZATION)\n },\n\n // variance([a, b, c, d, ...], normalization)\n 'Array | Matrix, string': _var,\n\n // variance([a, b, c, c, ...], dim)\n 'Array | Matrix, number | BigNumber': function (array, dim) {\n return _varDim(array, dim, DEFAULT_NORMALIZATION)\n },\n\n // variance([a, b, c, c, ...], dim, normalization)\n 'Array | Matrix, number | BigNumber, string': _varDim,\n\n // variance(a, b, c, d, ...)\n '...': function (args) {\n return _var(args, DEFAULT_NORMALIZATION)\n }\n })\n\n /**\n * Recursively calculate the variance of an n-dimensional array\n * @param {Array} array\n * @param {string} normalization\n * Determines how to normalize the variance:\n * - 'unbiased' The sum of squared errors is divided by (n - 1)\n * - 'uncorrected' The sum of squared errors is divided by n\n * - 'biased' The sum of squared errors is divided by (n + 1)\n * @return {number | BigNumber} variance\n * @private\n */\n function _var (array, normalization) {\n let sum\n let num = 0\n\n if (array.length === 0) {\n throw new SyntaxError('Function variance requires one or more parameters (0 provided)')\n }\n\n // calculate the mean and number of elements\n deepForEach(array, function (value) {\n try {\n sum = sum === undefined ? value : add(sum, value)\n num++\n } catch (err) {\n throw improveErrorMessage(err, 'variance', value)\n }\n })\n if (num === 0) throw new Error('Cannot calculate variance of an empty array')\n\n const mean = divide(sum, num)\n\n // calculate the variance\n sum = undefined\n deepForEach(array, function (value) {\n const diff = subtract(value, mean)\n sum = sum === undefined ? multiply(diff, diff) : add(sum, multiply(diff, diff))\n })\n\n if (mathIsNaN(sum)) {\n return sum\n }\n\n switch (normalization) {\n case 'uncorrected':\n return divide(sum, num)\n\n case 'biased':\n return divide(sum, num + 1)\n\n case 'unbiased':\n {\n const zero = isBigNumber(sum) ? sum.mul(0) : 0\n return (num === 1) ? zero : divide(sum, num - 1)\n }\n\n default:\n throw new Error('Unknown normalization \"' + normalization + '\". ' +\n 'Choose \"unbiased\" (default), \"uncorrected\", or \"biased\".')\n }\n }\n\n function _varDim (array, dim, normalization) {\n try {\n if (array.length === 0) {\n throw new SyntaxError('Function variance requires one or more parameters (0 provided)')\n }\n return mapSlices(array, dim, (x) => _var(x, normalization))\n } catch (err) {\n throw improveErrorMessage(err, 'variance')\n }\n }\n})\n","import { isNumber } from '../../utils/is.js'\nimport { flatten } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'quantileSeq'\nconst dependencies = ['typed', '?bignumber', 'add', 'subtract', 'divide', 'multiply', 'partitionSelect', 'compare', 'isInteger', 'smaller', 'smallerEq', 'larger', 'mapSlices']\n\nexport const createQuantileSeq = /* #__PURE__ */ factory(name, dependencies, ({ typed, bignumber, add, subtract, divide, multiply, partitionSelect, compare, isInteger, smaller, smallerEq, larger, mapSlices }) => {\n /**\n * Compute the prob order quantile of a matrix or a list with values.\n * The sequence is sorted and the middle value is returned.\n * Supported types of sequence values are: Number, BigNumber, Unit\n * Supported types of probability are: Number, BigNumber\n *\n * In case of a multidimensional array or matrix, the prob order quantile\n * of all elements will be calculated.\n *\n * Syntax:\n *\n * math.quantileSeq(A, prob[, sorted])\n * math.quantileSeq(A, [prob1, prob2, ...][, sorted])\n * math.quantileSeq(A, N[, sorted])\n *\n * Examples:\n *\n * math.quantileSeq([3, -1, 5, 7], 0.5) // returns 4\n * math.quantileSeq([3, -1, 5, 7], [1/3, 2/3]) // returns [3, 5]\n * math.quantileSeq([3, -1, 5, 7], 2) // returns [3, 5]\n * math.quantileSeq([-1, 3, 5, 7], 0.5, true) // returns 4\n *\n * See also:\n *\n * median, mean, min, max, sum, prod, std, variance\n *\n * @param {Array, Matrix} data A single matrix or Array\n * @param {Number, BigNumber, Array} probOrN prob is the order of the quantile, while N is\n * the amount of evenly distributed steps of\n * probabilities; only one of these options can\n * be provided\n * @param {Boolean} sorted=false is data sorted in ascending order\n * @return {Number, BigNumber, Unit, Array} Quantile(s)\n */\n return typed(name, {\n 'Array | Matrix, number | BigNumber': (data, p) => _quantileSeqProbNumber(data, p, false),\n 'Array | Matrix, number | BigNumber, number': (data, prob, dim) => _quantileSeqDim(data, prob, false, dim, _quantileSeqProbNumber),\n 'Array | Matrix, number | BigNumber, boolean': _quantileSeqProbNumber,\n 'Array | Matrix, number | BigNumber, boolean, number': (data, prob, sorted, dim) => _quantileSeqDim(data, prob, sorted, dim, _quantileSeqProbNumber),\n 'Array | Matrix, Array | Matrix': (data, p) => _quantileSeqProbCollection(data, p, false),\n 'Array | Matrix, Array | Matrix, number': (data, prob, dim) => _quantileSeqDim(data, prob, false, dim, _quantileSeqProbCollection),\n 'Array | Matrix, Array | Matrix, boolean': _quantileSeqProbCollection,\n 'Array | Matrix, Array | Matrix, boolean, number': (data, prob, sorted, dim) => _quantileSeqDim(data, prob, sorted, dim, _quantileSeqProbCollection)\n })\n\n function _quantileSeqDim (data, prob, sorted, dim, fn) {\n return mapSlices(data, dim, x => fn(x, prob, sorted))\n }\n\n function _quantileSeqProbNumber (data, probOrN, sorted) {\n let probArr\n const dataArr = data.valueOf()\n if (smaller(probOrN, 0)) {\n throw new Error('N/prob must be non-negative')\n }\n if (smallerEq(probOrN, 1)) {\n // quantileSeq([a, b, c, d, ...], prob[,sorted])\n return isNumber(probOrN)\n ? _quantileSeq(dataArr, probOrN, sorted)\n : bignumber(_quantileSeq(dataArr, probOrN, sorted))\n }\n if (larger(probOrN, 1)) {\n // quantileSeq([a, b, c, d, ...], N[,sorted])\n if (!isInteger(probOrN)) {\n throw new Error('N must be a positive integer')\n }\n\n // largest possible Array length is 2^32-1\n // 2^32 < 10^15, thus safe conversion guaranteed\n if (larger(probOrN, 4294967295)) {\n throw new Error('N must be less than or equal to 2^32-1, as that is the maximum length of an Array')\n }\n\n const nPlusOne = add(probOrN, 1)\n probArr = []\n\n for (let i = 0; smaller(i, probOrN); i++) {\n const prob = divide(i + 1, nPlusOne)\n probArr.push(_quantileSeq(dataArr, prob, sorted))\n }\n\n return isNumber(probOrN) ? probArr : bignumber(probArr)\n }\n }\n\n /**\n * Calculate the prob order quantile of an n-dimensional array.\n *\n * @param {Array, Matrix} array\n * @param {Array, Matrix} prob\n * @param {Boolean} sorted\n * @return {Number, BigNumber, Unit} prob order quantile\n * @private\n */\n\n function _quantileSeqProbCollection (data, probOrN, sorted) {\n const dataArr = data.valueOf()\n // quantileSeq([a, b, c, d, ...], [prob1, prob2, ...][,sorted])\n const probOrNArr = probOrN.valueOf()\n const probArr = []\n for (let i = 0; i < probOrNArr.length; ++i) {\n probArr.push(_quantileSeq(dataArr, probOrNArr[i], sorted))\n }\n return probArr\n }\n\n /**\n * Calculate the prob order quantile of an n-dimensional array.\n *\n * @param {Array} array\n * @param {Number, BigNumber} prob\n * @param {Boolean} sorted\n * @return {Number, BigNumber, Unit} prob order quantile\n * @private\n */\n function _quantileSeq (array, prob, sorted) {\n const flat = flatten(array)\n const len = flat.length\n if (len === 0) {\n throw new Error('Cannot calculate quantile of an empty sequence')\n }\n\n const index = isNumber(prob) ? prob * (len - 1) : prob.times(len - 1)\n const integerPart = isNumber(prob) ? Math.floor(index) : index.floor().toNumber()\n const fracPart = isNumber(prob) ? index % 1 : index.minus(integerPart)\n\n if (isInteger(index)) {\n return sorted\n ? flat[index]\n : partitionSelect(\n flat,\n isNumber(prob) ? index : index.valueOf()\n )\n }\n let left\n let right\n if (sorted) {\n left = flat[integerPart]\n right = flat[integerPart + 1]\n } else {\n right = partitionSelect(flat, integerPart + 1)\n\n // max of partition is kth largest\n left = flat[integerPart]\n for (let i = 0; i < integerPart; ++i) {\n if (compare(flat[i], left) > 0) {\n left = flat[i]\n }\n }\n }\n // Q(prob) = (1-f)*A[floor(index)] + f*A[floor(index)+1]\n return add(multiply(left, subtract(1, fracPart)), multiply(right, fracPart))\n }\n})\n","import { factory } from '../../utils/factory.js'\nimport { isCollection } from '../../utils/is.js'\nconst name = 'std'\nconst dependencies = ['typed', 'map', 'sqrt', 'variance']\n\nexport const createStd = /* #__PURE__ */ factory(name, dependencies, ({ typed, map, sqrt, variance }) => {\n /**\n * Compute the standard deviation of a matrix or a list with values.\n * The standard deviations is defined as the square root of the variance:\n * `std(A) = sqrt(variance(A))`.\n * In case of a (multi dimensional) array or matrix, the standard deviation\n * over all elements will be calculated by default, unless an axis is specified\n * in which case the standard deviation will be computed along that axis.\n *\n * Additionally, it is possible to compute the standard deviation along the rows\n * or columns of a matrix by specifying the dimension as the second argument.\n *\n * Optionally, the type of normalization can be specified as the final\n * parameter. The parameter `normalization` can be one of the following values:\n *\n * - 'unbiased' (default) The sum of squared errors is divided by (n - 1)\n * - 'uncorrected' The sum of squared errors is divided by n\n * - 'biased' The sum of squared errors is divided by (n + 1)\n *\n *\n * Syntax:\n *\n * math.std(a, b, c, ...)\n * math.std(A)\n * math.std(A, normalization)\n * math.std(A, dimension)\n * math.std(A, dimension, normalization)\n *\n * Examples:\n *\n * math.std(2, 4, 6) // returns 2\n * math.std([2, 4, 6, 8]) // returns 2.581988897471611\n * math.std([2, 4, 6, 8], 'uncorrected') // returns 2.23606797749979\n * math.std([2, 4, 6, 8], 'biased') // returns 2\n *\n * math.std([[1, 2, 3], [4, 5, 6]]) // returns 1.8708286933869707\n * math.std([[1, 2, 3], [4, 6, 8]], 0) // returns [2.1213203435596424, 2.8284271247461903, 3.5355339059327378]\n * math.std([[1, 2, 3], [4, 6, 8]], 1) // returns [1, 2]\n * math.std([[1, 2, 3], [4, 6, 8]], 1, 'biased') // returns [0.7071067811865476, 1.4142135623730951]\n *\n * See also:\n *\n * mean, median, max, min, prod, sum, variance\n *\n * @param {Array | Matrix} array\n * A single matrix or or multiple scalar values\n * @param {string} [normalization='unbiased']\n * Determines how to normalize the variance.\n * Choose 'unbiased' (default), 'uncorrected', or 'biased'.\n * @param dimension {number | BigNumber}\n * Determines the axis to compute the standard deviation for a matrix\n * @return {*} The standard deviation\n */\n return typed(name, {\n // std([a, b, c, d, ...])\n 'Array | Matrix': _std,\n\n // std([a, b, c, d, ...], normalization)\n 'Array | Matrix, string': _std,\n\n // std([a, b, c, c, ...], dim)\n 'Array | Matrix, number | BigNumber': _std,\n\n // std([a, b, c, c, ...], dim, normalization)\n 'Array | Matrix, number | BigNumber, string': _std,\n\n // std(a, b, c, d, ...)\n '...': function (args) {\n return _std(args)\n }\n })\n\n function _std (array, normalization) {\n if (array.length === 0) {\n throw new SyntaxError('Function std requires one or more parameters (0 provided)')\n }\n\n try {\n const v = variance.apply(null, arguments)\n if (isCollection(v)) {\n return map(v, sqrt)\n } else {\n return sqrt(v)\n }\n } catch (err) {\n if (err instanceof TypeError && err.message.includes(' variance')) {\n throw new TypeError(err.message.replace(' variance', ' std'))\n } else {\n throw err\n }\n }\n }\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'corr'\nconst dependencies = ['typed', 'matrix', 'mean', 'sqrt', 'sum', 'add', 'subtract', 'multiply', 'pow', 'divide']\n\nexport const createCorr = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, sqrt, sum, add, subtract, multiply, pow, divide }) => {\n /**\n * Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.\n *\n * Syntax:\n *\n * math.corr(A, B)\n *\n * Examples:\n *\n * math.corr([1, 2, 3, 4, 5], [4, 5, 6, 7, 8]) // returns 1\n * math.corr([1, 2.2, 3, 4.8, 5], [4, 5.3, 6.6, 7, 8]) //returns 0.9569941688503644\n * math.corr([[1, 2.2, 3, 4.8, 5], [4, 5.3, 6.6, 7, 8]],[[1, 2.2, 3, 4.8, 5], [4, 5.3, 6.6, 7, 8]]) // returns [1,1]\n *\n * See also:\n *\n * median, mean, min, max, sum, prod, std, variance\n *\n * @param {Array | Matrix} A The first array or matrix to compute correlation coefficient\n * @param {Array | Matrix} B The second array or matrix to compute correlation coefficient\n * @return {*} The correlation coefficient\n */\n return typed(name, {\n 'Array, Array': function (A, B) {\n return _corr(A, B)\n },\n 'Matrix, Matrix': function (A, B) {\n const res = _corr(A.toArray(), B.toArray())\n return Array.isArray(res) ? matrix(res) : res\n }\n })\n /**\n * Calculate the correlation coefficient between two arrays or matrices.\n * @param {Array | Matrix} A\n * @param {Array | Matrix} B\n * @return {*} correlation coefficient\n * @private\n */\n function _corr (A, B) {\n const correlations = []\n if (Array.isArray(A[0]) && Array.isArray(B[0])) {\n if (A.length !== B.length) {\n throw new SyntaxError('Dimension mismatch. Array A and B must have the same length.')\n }\n for (let i = 0; i < A.length; i++) {\n if (A[i].length !== B[i].length) {\n throw new SyntaxError('Dimension mismatch. Array A and B must have the same number of elements.')\n }\n correlations.push(correlation(A[i], B[i]))\n }\n return correlations\n } else {\n if (A.length !== B.length) {\n throw new SyntaxError('Dimension mismatch. Array A and B must have the same number of elements.')\n }\n return correlation(A, B)\n }\n }\n function correlation (A, B) {\n const n = A.length\n const sumX = sum(A)\n const sumY = sum(B)\n const sumXY = A.reduce((acc, x, index) => add(acc, multiply(x, B[index])), 0)\n const sumXSquare = sum(A.map(x => pow(x, 2)))\n const sumYSquare = sum(B.map(y => pow(y, 2)))\n const numerator = subtract(multiply(n, sumXY), multiply(sumX, sumY))\n const denominator = sqrt(multiply(subtract(multiply(n, sumXSquare), pow(sumX, 2)), subtract(multiply(n, sumYSquare), pow(sumY, 2))))\n return divide(numerator, denominator)\n }\n})\n","/** @param {number} i\n * @param {number} n\n * @returns {number} product of i to n\n */\nexport function product (i, n) {\n if (n < i) {\n return 1\n }\n\n if (n === i) {\n return n\n }\n\n const half = (n + i) >> 1 // divide (n + i) by 2 and truncate to integer\n return product(i, half) * product(half + 1, n)\n}\n","import { isInteger } from '../../utils/number.js'\nimport { product } from '../../utils/product.js'\n\nexport function combinationsNumber (n, k) {\n if (!isInteger(n) || n < 0) {\n throw new TypeError('Positive integer value expected in function combinations')\n }\n if (!isInteger(k) || k < 0) {\n throw new TypeError('Positive integer value expected in function combinations')\n }\n if (k > n) {\n throw new TypeError('k must be less than or equal to n')\n }\n\n const nMinusk = n - k\n\n let answer = 1\n const firstnumerator = (k < nMinusk) ? nMinusk + 1 : k + 1\n let nextdivisor = 2\n const lastdivisor = (k < nMinusk) ? k : nMinusk\n // balance multiplications and divisions to try to keep intermediate values\n // in exact-integer range as long as possible\n for (let nextnumerator = firstnumerator; nextnumerator <= n; ++nextnumerator) {\n answer *= nextnumerator\n while (nextdivisor <= lastdivisor && answer % nextdivisor === 0) {\n answer /= nextdivisor\n ++nextdivisor\n }\n }\n // for big n, k, floating point may have caused weirdness in remainder\n if (nextdivisor <= lastdivisor) {\n answer /= product(nextdivisor, lastdivisor)\n }\n return answer\n}\ncombinationsNumber.signature = 'number, number'\n","import { factory } from '../../utils/factory.js'\nimport { combinationsNumber } from '../../plain/number/combinations.js'\n\nconst name = 'combinations'\nconst dependencies = ['typed']\n\nexport const createCombinations = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Compute the number of ways of picking `k` unordered outcomes from `n`\n * possibilities.\n *\n * Combinations only takes integer arguments.\n * The following condition must be enforced: k <= n.\n *\n * Syntax:\n *\n * math.combinations(n, k)\n *\n * Examples:\n *\n * math.combinations(7, 5) // returns 21\n *\n * See also:\n *\n * combinationsWithRep, permutations, factorial\n *\n * @param {number | BigNumber} n Total number of objects in the set\n * @param {number | BigNumber} k Number of objects in the subset\n * @return {number | BigNumber} Number of possible combinations.\n */\n return typed(name, {\n 'number, number': combinationsNumber,\n\n 'BigNumber, BigNumber': function (n, k) {\n const BigNumber = n.constructor\n let result, i\n const nMinusk = n.minus(k)\n const one = new BigNumber(1)\n\n if (!isPositiveInteger(n) || !isPositiveInteger(k)) {\n throw new TypeError('Positive integer value expected in function combinations')\n }\n if (k.gt(n)) {\n throw new TypeError('k must be less than n in function combinations')\n }\n\n result = one\n if (k.lt(nMinusk)) {\n for (i = one; i.lte(nMinusk); i = i.plus(one)) {\n result = result.times(k.plus(i)).dividedBy(i)\n }\n } else {\n for (i = one; i.lte(k); i = i.plus(one)) {\n result = result.times(nMinusk.plus(i)).dividedBy(i)\n }\n }\n\n return result\n }\n\n // TODO: implement support for collection in combinations\n })\n})\n\n/**\n * Test whether BigNumber n is a positive integer\n * @param {BigNumber} n\n * @returns {boolean} isPositiveInteger\n */\nfunction isPositiveInteger (n) {\n return n.isInteger() && n.gte(0)\n}\n","import { factory } from '../../utils/factory.js'\nimport { isInteger } from '../../utils/number.js'\nimport { product } from '../../utils/product.js'\n\nconst name = 'combinationsWithRep'\nconst dependencies = ['typed']\n\nexport const createCombinationsWithRep = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Compute the number of ways of picking `k` unordered outcomes from `n`\n * possibilities, allowing individual outcomes to be repeated more than once.\n *\n * CombinationsWithRep only takes integer arguments.\n * The following condition must be enforced: k <= n + k -1.\n *\n * Syntax:\n *\n * math.combinationsWithRep(n, k)\n *\n * Examples:\n *\n * math.combinationsWithRep(7, 5) // returns 462\n *\n * See also:\n *\n * combinations, permutations, factorial\n *\n * @param {number | BigNumber} n Total number of objects in the set\n * @param {number | BigNumber} k Number of objects in the subset\n * @return {number | BigNumber} Number of possible combinations with replacement.\n */\n return typed(name, {\n 'number, number': function (n, k) {\n if (!isInteger(n) || n < 0) {\n throw new TypeError('Positive integer value expected in function combinationsWithRep')\n }\n if (!isInteger(k) || k < 0) {\n throw new TypeError('Positive integer value expected in function combinationsWithRep')\n }\n if (n < 1) {\n throw new TypeError('k must be less than or equal to n + k - 1')\n }\n\n if (k < n - 1) {\n const prodrange = product(n, n + k - 1)\n return prodrange / product(1, k)\n }\n const prodrange = product(k + 1, n + k - 1)\n return prodrange / product(1, n - 1)\n },\n\n 'BigNumber, BigNumber': function (n, k) {\n const BigNumber = n.constructor\n let result, i\n const one = new BigNumber(1)\n const nMinusOne = n.minus(one)\n\n if (!isPositiveInteger(n) || !isPositiveInteger(k)) {\n throw new TypeError('Positive integer value expected in function combinationsWithRep')\n }\n if (n.lt(one)) {\n throw new TypeError('k must be less than or equal to n + k - 1 in function combinationsWithRep')\n }\n\n result = one\n if (k.lt(nMinusOne)) {\n for (i = one; i.lte(nMinusOne); i = i.plus(one)) {\n result = result.times(k.plus(i)).dividedBy(i)\n }\n } else {\n for (i = one; i.lte(k); i = i.plus(one)) {\n result = result.times(nMinusOne.plus(i)).dividedBy(i)\n }\n }\n\n return result\n }\n })\n})\n\n/**\n * Test whether BigNumber n is a positive integer\n * @param {BigNumber} n\n * @returns {boolean} isPositiveInteger\n */\nfunction isPositiveInteger (n) {\n return n.isInteger() && n.gte(0)\n}\n","/* eslint-disable no-loss-of-precision */\n\nimport { isInteger } from '../../utils/number.js'\nimport { product } from '../../utils/product.js'\n\nexport function gammaNumber (n) {\n let x\n\n if (isInteger(n)) {\n if (n <= 0) {\n return isFinite(n) ? Infinity : NaN\n }\n\n if (n > 171) {\n return Infinity // Will overflow\n }\n\n return product(1, n - 1)\n }\n\n if (n < 0.5) {\n return Math.PI / (Math.sin(Math.PI * n) * gammaNumber(1 - n))\n }\n\n if (n >= 171.35) {\n return Infinity // will overflow\n }\n\n if (n > 85.0) { // Extended Stirling Approx\n const twoN = n * n\n const threeN = twoN * n\n const fourN = threeN * n\n const fiveN = fourN * n\n return Math.sqrt(2 * Math.PI / n) * Math.pow((n / Math.E), n) *\n (1 + 1 / (12 * n) + 1 / (288 * twoN) - 139 / (51840 * threeN) -\n 571 / (2488320 * fourN) + 163879 / (209018880 * fiveN) +\n 5246819 / (75246796800 * fiveN * n))\n }\n\n --n\n x = gammaP[0]\n for (let i = 1; i < gammaP.length; ++i) {\n x += gammaP[i] / (n + i)\n }\n\n const t = n + gammaG + 0.5\n return Math.sqrt(2 * Math.PI) * Math.pow(t, n + 0.5) * Math.exp(-t) * x\n}\ngammaNumber.signature = 'number'\n\n// TODO: comment on the variables g and p\n\nexport const gammaG = 4.7421875\n\nexport const gammaP = [\n 0.99999999999999709182,\n 57.156235665862923517,\n -59.597960355475491248,\n 14.136097974741747174,\n -0.49191381609762019978,\n 0.33994649984811888699e-4,\n 0.46523628927048575665e-4,\n -0.98374475304879564677e-4,\n 0.15808870322491248884e-3,\n -0.21026444172410488319e-3,\n 0.21743961811521264320e-3,\n -0.16431810653676389022e-3,\n 0.84418223983852743293e-4,\n -0.26190838401581408670e-4,\n 0.36899182659531622704e-5\n]\n\n// lgamma implementation ref: https://mrob.com/pub/ries/lanczos-gamma.html#code\n\n// log(2 * pi) / 2\nexport const lnSqrt2PI = 0.91893853320467274178\n\nexport const lgammaG = 5 // Lanczos parameter \"g\"\nexport const lgammaN = 7 // Range of coefficients \"n\"\n\nexport const lgammaSeries = [\n 1.000000000190015,\n 76.18009172947146,\n -86.50532032941677,\n 24.01409824083091,\n -1.231739572450155,\n 0.1208650973866179e-2,\n -0.5395239384953e-5\n]\n\nexport function lgammaNumber (n) {\n if (n < 0) return NaN\n if (n === 0) return Infinity\n if (!isFinite(n)) return n\n\n if (n < 0.5) {\n // Use Euler's reflection formula:\n // gamma(z) = PI / (sin(PI * z) * gamma(1 - z))\n return Math.log(Math.PI / Math.sin(Math.PI * n)) - lgammaNumber(1 - n)\n }\n\n // Compute the logarithm of the Gamma function using the Lanczos method\n\n n = n - 1\n const base = n + lgammaG + 0.5 // Base of the Lanczos exponential\n let sum = lgammaSeries[0]\n\n // We start with the terms that have the smallest coefficients and largest denominator\n for (let i = lgammaN - 1; i >= 1; i--) {\n sum += lgammaSeries[i] / (n + i)\n }\n\n return lnSqrt2PI + (n + 0.5) * Math.log(base) - base + Math.log(sum)\n}\nlgammaNumber.signature = 'number'\n","import { factory } from '../../utils/factory.js'\nimport { gammaG, gammaNumber, gammaP } from '../../plain/number/index.js'\n\nconst name = 'gamma'\nconst dependencies = ['typed', 'config', 'multiplyScalar', 'pow', 'BigNumber', 'Complex']\n\nexport const createGamma = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, multiplyScalar, pow, BigNumber, Complex }) => {\n /**\n * Compute the gamma function of a value using Lanczos approximation for\n * small values, and an extended Stirling approximation for large values.\n *\n * To avoid confusion with the matrix Gamma function, this function does\n * not apply to matrices.\n *\n * Syntax:\n *\n * math.gamma(n)\n *\n * Examples:\n *\n * math.gamma(5) // returns 24\n * math.gamma(-0.5) // returns -3.5449077018110335\n * math.gamma(math.i) // returns -0.15494982830180973 - 0.49801566811835596i\n *\n * See also:\n *\n * combinations, factorial, permutations\n *\n * @param {number | BigNumber | Complex} n A real or complex number\n * @return {number | BigNumber | Complex} The gamma of `n`\n */\n\n function gammaComplex (n) {\n if (n.im === 0) {\n return gammaNumber(n.re)\n }\n\n // Lanczos approximation doesn't work well with real part lower than 0.5\n // So reflection formula is required\n if (n.re < 0.5) { // Euler's reflection formula\n // gamma(1-z) * gamma(z) = PI / sin(PI * z)\n // real part of Z should not be integer [sin(PI) == 0 -> 1/0 - undefined]\n // thanks to imperfect sin implementation sin(PI * n) != 0\n // we can safely use it anyway\n const t = new Complex(1 - n.re, -n.im)\n const r = new Complex(Math.PI * n.re, Math.PI * n.im)\n\n return new Complex(Math.PI).div(r.sin()).div(gammaComplex(t))\n }\n\n // Lanczos approximation\n // z -= 1\n n = new Complex(n.re - 1, n.im)\n\n // x = gammaPval[0]\n let x = new Complex(gammaP[0], 0)\n // for (i, gammaPval) in enumerate(gammaP):\n for (let i = 1; i < gammaP.length; ++i) {\n // x += gammaPval / (z + i)\n const gammaPval = new Complex(gammaP[i], 0)\n x = x.add(gammaPval.div(n.add(i)))\n }\n // t = z + gammaG + 0.5\n const t = new Complex(n.re + gammaG + 0.5, n.im)\n\n // y = sqrt(2 * pi) * t ** (z + 0.5) * exp(-t) * x\n const twoPiSqrt = Math.sqrt(2 * Math.PI)\n const tpow = t.pow(n.add(0.5))\n const expt = t.neg().exp()\n\n // y = [x] * [sqrt(2 * pi)] * [t ** (z + 0.5)] * [exp(-t)]\n return x.mul(twoPiSqrt).mul(tpow).mul(expt)\n }\n\n return typed(name, {\n number: gammaNumber,\n Complex: gammaComplex,\n BigNumber: function (n) {\n if (n.isInteger()) {\n return (n.isNegative() || n.isZero())\n ? new BigNumber(Infinity)\n : bigFactorial(n.minus(1))\n }\n\n if (!n.isFinite()) {\n return new BigNumber(n.isNegative() ? NaN : Infinity)\n }\n\n throw new Error('Integer BigNumber expected')\n }\n })\n\n /**\n * Calculate factorial for a BigNumber\n * @param {BigNumber} n\n * @returns {BigNumber} Returns the factorial of n\n */\n function bigFactorial (n) {\n if (n < 8) {\n return new BigNumber([1, 1, 2, 6, 24, 120, 720, 5040][n])\n }\n\n const precision = config.precision + (Math.log(n.toNumber()) | 0)\n const Big = BigNumber.clone({ precision })\n\n if (n % 2 === 1) {\n return n.times(bigFactorial(new BigNumber(n - 1)))\n }\n\n let p = n\n let prod = new Big(n)\n let sum = n.toNumber()\n\n while (p > 2) {\n p -= 2\n sum += p\n prod = prod.times(sum)\n }\n\n return new BigNumber(prod.toPrecision(BigNumber.precision))\n }\n})\n","/* eslint-disable no-loss-of-precision */\n\n// References\n// ----------\n// [1] Hare, \"Computing the Principal Branch of log-Gamma\", Journal of Algorithms, 1997.\n// [2] https://math.stackexchange.com/questions/1338753/how-do-i-calculate-values-for-gamma-function-with-complex-arguments\n\nimport { lgammaNumber, lnSqrt2PI } from '../../plain/number/index.js'\nimport { factory } from '../../utils/factory.js'\nimport { copysign } from '../../utils/number.js'\n\nconst name = 'lgamma'\nconst dependencies = ['Complex', 'typed']\n\nexport const createLgamma = /* #__PURE__ */ factory(name, dependencies, ({ Complex, typed }) => {\n // Stirling series is non-convergent, we need to use the recurrence `lgamma(z) = lgamma(z+1) - log z` to get\n // sufficient accuracy.\n //\n // These two values are copied from Scipy implementation:\n // https://github.com/scipy/scipy/blob/v1.8.0/scipy/special/_loggamma.pxd#L37\n const SMALL_RE = 7\n const SMALL_IM = 7\n\n /**\n * The coefficients are B[2*n]/(2*n*(2*n - 1)) where B[2*n] is the (2*n)th Bernoulli number. See (1.1) in [1].\n *\n * If you cannot access the paper, can also get these values from the formula in [2].\n *\n * 1 / 12 = 0.00833333333333333333333333333333\n * 1 / 360 = 0.00277777777777777777777777777778\n * ...\n * 3617 / 133400 = 0.02955065359477124183006535947712\n */\n const coeffs = [\n -2.955065359477124183e-2, 6.4102564102564102564e-3, -1.9175269175269175269e-3, 8.4175084175084175084e-4,\n -5.952380952380952381e-4, 7.9365079365079365079e-4, -2.7777777777777777778e-3, 8.3333333333333333333e-2\n ]\n\n /**\n * Logarithm of the gamma function for real, positive numbers and complex numbers,\n * using Lanczos approximation for numbers and Stirling series for complex numbers.\n *\n * Syntax:\n *\n * math.lgamma(n)\n *\n * Examples:\n *\n * math.lgamma(5) // returns 3.178053830347945\n * math.lgamma(0) // returns Infinity\n * math.lgamma(-0.5) // returns NaN\n * math.lgamma(math.i) // returns -0.6509231993018536 - 1.8724366472624294i\n *\n * See also:\n *\n * gamma\n *\n * @param {number | Complex} n A real or complex number\n * @return {number | Complex} The log gamma of `n`\n */\n return typed(name, {\n number: lgammaNumber,\n Complex: lgammaComplex,\n BigNumber: function () {\n throw new Error(\"mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber\")\n }\n })\n\n function lgammaComplex (n) {\n const TWOPI = 6.2831853071795864769252842 // 2*pi\n const LOGPI = 1.1447298858494001741434262 // log(pi)\n\n const REFLECTION = 0.1\n\n if (n.isNaN()) {\n return new Complex(NaN, NaN)\n } else if (n.im === 0) {\n return new Complex(lgammaNumber(n.re), 0)\n } else if (n.re >= SMALL_RE || Math.abs(n.im) >= SMALL_IM) {\n return lgammaStirling(n)\n } else if (n.re <= REFLECTION) {\n // Reflection formula. see Proposition 3.1 in [1]\n const tmp = copysign(TWOPI, n.im) * Math.floor(0.5 * n.re + 0.25)\n const a = n.mul(Math.PI).sin().log()\n const b = lgammaComplex(new Complex(1 - n.re, -n.im))\n return new Complex(LOGPI, tmp).sub(a).sub(b)\n } else if (n.im >= 0) {\n return lgammaRecurrence(n)\n } else {\n return lgammaRecurrence(n.conjugate()).conjugate()\n }\n }\n\n function lgammaStirling (z) {\n // formula ref in [2]\n // computation ref:\n // https://github.com/scipy/scipy/blob/v1.8.0/scipy/special/_loggamma.pxd#L101\n\n // left part\n\n // x (log(x) - 1) + 1/2 (log(2PI) - log(x))\n // => (x - 0.5) * log(x) - x + log(2PI) / 2\n const leftPart = z.sub(0.5).mul(z.log()).sub(z).add(lnSqrt2PI)\n\n // right part\n\n const rz = new Complex(1, 0).div(z)\n const rzz = rz.div(z)\n\n let a = coeffs[0]\n let b = coeffs[1]\n const r = 2 * rzz.re\n const s = rzz.re * rzz.re + rzz.im * rzz.im\n\n for (let i = 2; i < 8; i++) {\n const tmp = b\n b = -s * a + coeffs[i]\n a = r * a + tmp\n }\n\n const rightPart = rz.mul(rzz.mul(a).add(b))\n\n // plus left and right\n\n return leftPart.add(rightPart)\n }\n\n function lgammaRecurrence (z) {\n // computation ref:\n // https://github.com/scipy/scipy/blob/v1.8.0/scipy/special/_loggamma.pxd#L78\n\n let signflips = 0\n let sb = 0\n let shiftprod = z\n\n z = z.add(1)\n while (z.re <= SMALL_RE) {\n shiftprod = shiftprod.mul(z)\n\n const nsb = shiftprod.im < 0 ? 1 : 0\n if (nsb !== 0 && sb === 0) signflips++\n sb = nsb\n\n z = z.add(1)\n }\n\n return lgammaStirling(z)\n .sub(shiftprod.log())\n .sub(new Complex(0, signflips * 2 * Math.PI * 1))\n }\n})\n","import { deepMap } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'factorial'\nconst dependencies = ['typed', 'gamma']\n\nexport const createFactorial = /* #__PURE__ */ factory(name, dependencies, ({ typed, gamma }) => {\n /**\n * Compute the factorial of a value\n *\n * Factorial only supports an integer value as argument.\n * For matrices, the function is evaluated element wise.\n *\n * Syntax:\n *\n * math.factorial(n)\n *\n * Examples:\n *\n * math.factorial(5) // returns 120\n * math.factorial(3) // returns 6\n *\n * See also:\n *\n * combinations, combinationsWithRep, gamma, permutations\n *\n * @param {number | BigNumber | Array | Matrix} n An integer number\n * @return {number | BigNumber | Array | Matrix} The factorial of `n`\n */\n return typed(name, {\n number: function (n) {\n if (n < 0) {\n throw new Error('Value must be non-negative')\n }\n\n return gamma(n + 1)\n },\n\n BigNumber: function (n) {\n if (n.isNegative()) {\n throw new Error('Value must be non-negative')\n }\n\n return gamma(n.plus(1))\n },\n\n 'Array | Matrix': typed.referToSelf(self => n => deepMap(n, self))\n })\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'kldivergence'\nconst dependencies = ['typed', 'matrix', 'divide', 'sum', 'multiply', 'map', 'dotDivide', 'log', 'isNumeric']\n\nexport const createKldivergence = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, divide, sum, multiply, map, dotDivide, log, isNumeric }) => {\n /**\n * Calculate the Kullback-Leibler (KL) divergence between two distributions\n *\n * Syntax:\n *\n * math.kldivergence(x, y)\n *\n * Examples:\n *\n * math.kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5]) //returns 0.24376698773121153\n *\n *\n * @param {Array | Matrix} q First vector\n * @param {Array | Matrix} p Second vector\n * @return {number} Returns distance between q and p\n */\n return typed(name, {\n 'Array, Array': function (q, p) {\n return _kldiv(matrix(q), matrix(p))\n },\n\n 'Matrix, Array': function (q, p) {\n return _kldiv(q, matrix(p))\n },\n\n 'Array, Matrix': function (q, p) {\n return _kldiv(matrix(q), p)\n },\n\n 'Matrix, Matrix': function (q, p) {\n return _kldiv(q, p)\n }\n\n })\n\n function _kldiv (q, p) {\n const plength = p.size().length\n const qlength = q.size().length\n if (plength > 1) {\n throw new Error('first object must be one dimensional')\n }\n\n if (qlength > 1) {\n throw new Error('second object must be one dimensional')\n }\n\n if (plength !== qlength) {\n throw new Error('Length of two vectors must be equal')\n }\n\n // Before calculation, apply normalization\n const sumq = sum(q)\n if (sumq === 0) {\n throw new Error('Sum of elements in first object must be non zero')\n }\n\n const sump = sum(p)\n if (sump === 0) {\n throw new Error('Sum of elements in second object must be non zero')\n }\n const qnorm = divide(q, sum(q))\n const pnorm = divide(p, sum(p))\n\n const result = sum(multiply(qnorm, map(dotDivide(qnorm, pnorm), x => log(x))))\n if (isNumeric(result)) {\n return result\n } else {\n return Number.NaN\n }\n }\n})\n","import { deepForEach } from '../../utils/collection.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'multinomial'\nconst dependencies = ['typed', 'add', 'divide', 'multiply', 'factorial', 'isInteger', 'isPositive']\n\nexport const createMultinomial = /* #__PURE__ */ factory(name, dependencies, ({ typed, add, divide, multiply, factorial, isInteger, isPositive }) => {\n /**\n * Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities.\n *\n * multinomial takes one array of integers as an argument.\n * The following condition must be enforced: every ai <= 0\n *\n * Syntax:\n *\n * math.multinomial(a) // a is an array type\n *\n * Examples:\n *\n * math.multinomial([1,2,1]) // returns 12\n *\n * See also:\n *\n * combinations, factorial\n *\n * @param {number[] | BigNumber[]} a Integer numbers of objects in the subset\n * @return {Number | BigNumber} Multinomial coefficient.\n */\n return typed(name, {\n 'Array | Matrix': function (a) {\n let sum = 0\n let denom = 1\n\n deepForEach(a, function (ai) {\n if (!isInteger(ai) || !isPositive(ai)) {\n throw new TypeError('Positive integer value expected in function multinomial')\n }\n sum = add(sum, ai)\n denom = multiply(denom, factorial(ai))\n })\n\n return divide(factorial(sum), denom)\n }\n })\n})\n","import { isInteger } from '../../utils/number.js'\nimport { product } from '../../utils/product.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'permutations'\nconst dependencies = ['typed', 'factorial']\n\nexport const createPermutations = /* #__PURE__ */ factory(name, dependencies, ({ typed, factorial }) => {\n /**\n * Compute the number of ways of obtaining an ordered subset of `k` elements\n * from a set of `n` elements.\n *\n * Permutations only takes integer arguments.\n * The following condition must be enforced: k <= n.\n *\n * Syntax:\n *\n * math.permutations(n)\n * math.permutations(n, k)\n *\n * Examples:\n *\n * math.permutations(5) // 120\n * math.permutations(5, 3) // 60\n *\n * See also:\n *\n * combinations, combinationsWithRep, factorial\n *\n * @param {number | BigNumber} n The number of objects in total\n * @param {number | BigNumber} [k] The number of objects in the subset\n * @return {number | BigNumber} The number of permutations\n */\n return typed(name, {\n 'number | BigNumber': factorial,\n 'number, number': function (n, k) {\n if (!isInteger(n) || n < 0) {\n throw new TypeError('Positive integer value expected in function permutations')\n }\n if (!isInteger(k) || k < 0) {\n throw new TypeError('Positive integer value expected in function permutations')\n }\n if (k > n) {\n throw new TypeError('second argument k must be less than or equal to first argument n')\n }\n // Permute n objects, k at a time\n return product((n - k) + 1, n)\n },\n\n 'BigNumber, BigNumber': function (n, k) {\n let result, i\n\n if (!isPositiveInteger(n) || !isPositiveInteger(k)) {\n throw new TypeError('Positive integer value expected in function permutations')\n }\n if (k.gt(n)) {\n throw new TypeError('second argument k must be less than or equal to first argument n')\n }\n\n const one = n.mul(0).add(1)\n result = one\n for (i = n.minus(k).plus(1); i.lte(n); i = i.plus(1)) {\n result = result.times(i)\n }\n\n return result\n }\n\n // TODO: implement support for collection in permutations\n })\n})\n\n/**\n * Test whether BigNumber n is a positive integer\n * @param {BigNumber} n\n * @returns {boolean} isPositiveInteger\n */\nfunction isPositiveInteger (n) {\n return n.isInteger() && n.gte(0)\n}\n","import seedrandom from 'seedrandom'\n\nconst singletonRandom = /* #__PURE__ */ seedrandom(Date.now())\n\nexport function createRng (randomSeed) {\n let random\n\n // create a new random generator with given seed\n function setSeed (seed) {\n random = seed === null ? singletonRandom : seedrandom(String(seed))\n }\n\n // initialize a seeded pseudo random number generator with config's random seed\n setSeed(randomSeed)\n\n // wrapper function so the rng can be updated via generator\n function rng () {\n return random()\n }\n\n return rng\n}\n","import { flatten } from '../../utils/array.js'\nimport { factory } from '../../utils/factory.js'\nimport { isMatrix, isNumber } from '../../utils/is.js'\nimport { createRng } from './util/seededRNG.js'\n\nconst name = 'pickRandom'\nconst dependencies = ['typed', 'config', '?on']\n\nexport const createPickRandom = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, on }) => {\n // seeded pseudo random number generator\n let rng = createRng(config.randomSeed)\n\n if (on) {\n on('config', function (curr, prev) {\n if (curr.randomSeed !== prev.randomSeed) {\n rng = createRng(curr.randomSeed)\n }\n })\n }\n\n /**\n * Random pick one or more values from a one dimensional array.\n * Array elements are picked using a random function with uniform or weighted distribution.\n *\n * Syntax:\n *\n * math.pickRandom(array)\n * math.pickRandom(array, number)\n * math.pickRandom(array, weights)\n * math.pickRandom(array, number, weights)\n * math.pickRandom(array, weights, number)\n * math.pickRandom(array, { weights, number, elementWise })\n *\n * Examples:\n *\n * math.pickRandom([3, 6, 12, 2]) // returns one of the values in the array\n * math.pickRandom([3, 6, 12, 2], 2) // returns an array of two of the values in the array\n * math.pickRandom([3, 6, 12, 2], { number: 2 }) // returns an array of two of the values in the array\n * math.pickRandom([3, 6, 12, 2], [1, 3, 2, 1]) // returns one of the values in the array with weighted distribution\n * math.pickRandom([3, 6, 12, 2], 2, [1, 3, 2, 1]) // returns an array of two of the values in the array with weighted distribution\n * math.pickRandom([3, 6, 12, 2], [1, 3, 2, 1], 2) // returns an array of two of the values in the array with weighted distribution\n *\n * math.pickRandom([{x: 1.0, y: 2.0}, {x: 1.1, y: 2.0}], { elementWise: false })\n * // returns one of the items in the array\n *\n * See also:\n *\n * random, randomInt\n *\n * @param {Array | Matrix} array A one dimensional array\n * @param {Int} number An int or float\n * @param {Array | Matrix} weights An array of ints or floats\n * @return {number | Array} Returns a single random value from array when number is undefined.\n * Returns an array with the configured number of elements when number is defined.\n */\n return typed(name, {\n 'Array | Matrix': function (possibles) {\n return _pickRandom(possibles, {})\n },\n\n 'Array | Matrix, Object': function (possibles, options) {\n return _pickRandom(possibles, options)\n },\n\n 'Array | Matrix, number': function (possibles, number) {\n return _pickRandom(possibles, { number })\n },\n\n 'Array | Matrix, Array | Matrix': function (possibles, weights) {\n return _pickRandom(possibles, { weights })\n },\n\n 'Array | Matrix, Array | Matrix, number': function (possibles, weights, number) {\n return _pickRandom(possibles, { number, weights })\n },\n\n 'Array | Matrix, number, Array | Matrix': function (possibles, number, weights) {\n return _pickRandom(possibles, { number, weights })\n }\n })\n\n /**\n * @param {Array | Matrix} possibles\n * @param {{\n * number?: number,\n * weights?: Array | Matrix,\n * elementWise: boolean\n * }} options\n * @returns {number | Array}\n * @private\n */\n function _pickRandom (possibles, { number, weights, elementWise = true }) {\n const single = (typeof number === 'undefined')\n if (single) {\n number = 1\n }\n\n const createMatrix = isMatrix(possibles)\n ? possibles.create\n : isMatrix(weights)\n ? weights.create\n : null\n\n possibles = possibles.valueOf() // get Array\n if (weights) {\n weights = weights.valueOf() // get Array\n }\n\n if (elementWise === true) {\n possibles = flatten(possibles)\n weights = flatten(weights)\n }\n\n let totalWeights = 0\n\n if (typeof weights !== 'undefined') {\n if (weights.length !== possibles.length) {\n throw new Error('Weights must have the same length as possibles')\n }\n\n for (let i = 0, len = weights.length; i < len; i++) {\n if (!isNumber(weights[i]) || weights[i] < 0) {\n throw new Error('Weights must be an array of positive numbers')\n }\n\n totalWeights += weights[i]\n }\n }\n\n const length = possibles.length\n\n const result = []\n let pick\n\n while (result.length < number) {\n if (typeof weights === 'undefined') {\n pick = possibles[Math.floor(rng() * length)]\n } else {\n let randKey = rng() * totalWeights\n\n for (let i = 0, len = possibles.length; i < len; i++) {\n randKey -= weights[i]\n\n if (randKey < 0) {\n pick = possibles[i]\n break\n }\n }\n }\n\n result.push(pick)\n }\n\n return single\n ? result[0]\n : createMatrix\n ? createMatrix(result)\n : result\n }\n})\n","/**\n * This is a util function for generating a random matrix recursively.\n * @param {number[]} size\n * @param {function} random\n * @returns {Array}\n */\nexport function randomMatrix (size, random) {\n const data = []\n size = size.slice(0)\n\n if (size.length > 1) {\n for (let i = 0, length = size.shift(); i < length; i++) {\n data.push(randomMatrix(size, random))\n }\n } else {\n for (let i = 0, length = size.shift(); i < length; i++) {\n data.push(random())\n }\n }\n\n return data\n}\n","import { factory } from '../../utils/factory.js'\nimport { isMatrix } from '../../utils/is.js'\nimport { createRng } from './util/seededRNG.js'\nimport { randomMatrix } from './util/randomMatrix.js'\n\nconst name = 'random'\nconst dependencies = ['typed', 'config', '?on']\n\nexport const createRandom = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, on }) => {\n // seeded pseudo random number generator\n let rng = createRng(config.randomSeed)\n\n if (on) {\n on('config', function (curr, prev) {\n if (curr.randomSeed !== prev.randomSeed) {\n rng = createRng(curr.randomSeed)\n }\n })\n }\n\n /**\n * Return a random number larger or equal to `min` and smaller than `max`\n * using a uniform distribution.\n *\n * Syntax:\n *\n * math.random() // generate a random number between 0 and 1\n * math.random(max) // generate a random number between 0 and max\n * math.random(min, max) // generate a random number between min and max\n * math.random(size) // generate a matrix with random numbers between 0 and 1\n * math.random(size, max) // generate a matrix with random numbers between 0 and max\n * math.random(size, min, max) // generate a matrix with random numbers between min and max\n *\n * Examples:\n *\n * math.random() // returns a random number between 0 and 1\n * math.random(100) // returns a random number between 0 and 100\n * math.random(30, 40) // returns a random number between 30 and 40\n * math.random([2, 3]) // returns a 2x3 matrix with random numbers between 0 and 1\n *\n * See also:\n *\n * randomInt, pickRandom\n *\n * @param {Array | Matrix} [size] If provided, an array or matrix with given\n * size and filled with random values is returned\n * @param {number} [min] Minimum boundary for the random value, included\n * @param {number} [max] Maximum boundary for the random value, excluded\n * @return {number | Array | Matrix} A random number\n */\n return typed(name, {\n '': () => _random(0, 1),\n number: (max) => _random(0, max),\n 'number, number': (min, max) => _random(min, max),\n 'Array | Matrix': (size) => _randomMatrix(size, 0, 1),\n 'Array | Matrix, number': (size, max) => _randomMatrix(size, 0, max),\n 'Array | Matrix, number, number': (size, min, max) => _randomMatrix(size, min, max)\n })\n\n function _randomMatrix (size, min, max) {\n const res = randomMatrix(size.valueOf(), () => _random(min, max))\n return isMatrix(size) ? size.create(res, 'number') : res\n }\n\n function _random (min, max) {\n return min + rng() * (max - min)\n }\n})\n\n// number only implementation of random, no matrix support\n// TODO: there is quite some duplicate code in both createRandom and createRandomNumber, can we improve that?\nexport const createRandomNumber = /* #__PURE__ */ factory(name, ['typed', 'config', '?on'], ({ typed, config, on, matrix }) => {\n // seeded pseudo random number generator1\n let rng = createRng(config.randomSeed)\n\n if (on) {\n on('config', function (curr, prev) {\n if (curr.randomSeed !== prev.randomSeed) {\n rng = createRng(curr.randomSeed)\n }\n })\n }\n\n return typed(name, {\n '': () => _random(0, 1),\n number: (max) => _random(0, max),\n 'number, number': (min, max) => _random(min, max)\n })\n\n function _random (min, max) {\n return min + rng() * (max - min)\n }\n})\n","import { factory } from '../../utils/factory.js'\nimport { randomMatrix } from './util/randomMatrix.js'\nimport { createRng } from './util/seededRNG.js'\nimport { isMatrix } from '../../utils/is.js'\n\nconst name = 'randomInt'\nconst dependencies = ['typed', 'config', 'log2', '?on']\n\nexport const createRandomInt = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, log2, on }) => {\n // seeded pseudo random number generator\n let rng = createRng(config.randomSeed)\n\n if (on) {\n on('config', function (curr, prev) {\n if (curr.randomSeed !== prev.randomSeed) {\n rng = createRng(curr.randomSeed)\n }\n })\n }\n\n /**\n * Return a random integer number larger or equal to `min` and smaller than `max`\n * using a uniform distribution.\n *\n * Syntax:\n *\n * math.randomInt() // generate either 0 or 1, randomly\n * math.randomInt(max) // generate a random integer between 0 and max\n * math.randomInt(min, max) // generate a random integer between min and max\n * math.randomInt(size) // generate a matrix with random integer between 0 and 1\n * math.randomInt(size, max) // generate a matrix with random integer between 0 and max\n * math.randomInt(size, min, max) // generate a matrix with random integer between min and max\n *\n * Examples:\n *\n * math.randomInt(100) // returns a random integer between 0 and 100\n * math.randomInt(30, 40) // returns a random integer between 30 and 40\n * math.randomInt([2, 3]) // returns a 2x3 matrix with random integers between 0 and 1\n *\n * See also:\n *\n * random, pickRandom\n *\n * @param {Array | Matrix} [size] If provided, an array or matrix with given\n * size and filled with random values is returned\n * @param {number} [min] Minimum boundary for the random value, included\n * @param {number} [max] Maximum boundary for the random value, excluded\n * @return {number | Array | Matrix} A random integer value\n */\n return typed(name, {\n '': () => _randomInt(0, 2),\n number: (max) => _randomInt(0, max),\n 'number, number': (min, max) => _randomInt(min, max),\n bigint: (max) => _randomBigint(0n, max),\n 'bigint, bigint': _randomBigint,\n 'Array | Matrix': (size) => _randomIntMatrix(size, 0, 1),\n 'Array | Matrix, number': (size, max) => _randomIntMatrix(size, 0, max),\n 'Array | Matrix, number, number': (size, min, max) => _randomIntMatrix(size, min, max)\n })\n\n function _randomIntMatrix (size, min, max) {\n const res = randomMatrix(size.valueOf(), () => _randomInt(min, max))\n return isMatrix(size) ? size.create(res, 'number') : res\n }\n\n function _randomInt (min, max) {\n return Math.floor(min + rng() * (max - min))\n }\n\n function _randomBigint (min, max) {\n const simpleCutoff = 2n ** 30n\n const width = max - min // number of choices\n if (width <= simpleCutoff) { // do it with number type\n return min + BigInt(_randomInt(0, Number(width)))\n }\n // Too big to choose accurately that way. Instead, choose the correct\n // number of random bits to cover the width, and repeat until the\n // resulting number falls within the width\n const bits = log2(width)\n let picked = width\n while (picked >= width) {\n picked = 0n\n for (let i = 0; i < bits; ++i) {\n picked = 2n * picked + ((rng() < 0.5) ? 0n : 1n)\n }\n }\n return min + picked\n }\n})\n","import { factory } from '../../utils/factory.js'\nimport { isNumber } from '../../utils/is.js'\n\nconst name = 'stirlingS2'\nconst dependencies = [\n 'typed',\n 'addScalar',\n 'subtractScalar',\n 'multiplyScalar',\n 'divideScalar',\n 'pow',\n 'factorial',\n 'combinations',\n 'isNegative',\n 'isInteger',\n 'number',\n '?bignumber',\n 'larger'\n]\n\nexport const createStirlingS2 = /* #__PURE__ */ factory(name, dependencies, (\n {\n typed,\n addScalar,\n subtractScalar,\n multiplyScalar,\n divideScalar,\n pow,\n factorial,\n combinations,\n isNegative,\n isInteger,\n number,\n bignumber,\n larger\n }\n) => {\n const smallCache = []\n const bigCache = []\n /**\n * The Stirling numbers of the second kind, counts the number of ways to partition\n * a set of n labelled objects into k nonempty unlabelled subsets.\n * stirlingS2 only takes integer arguments.\n * The following condition must be enforced: k <= n.\n *\n * If n = k or k = 1 <= n, then s(n,k) = 1\n * If k = 0 < n, then s(n,k) = 0\n *\n * Note that if either n or k is supplied as a BigNumber, the result will be\n * as well.\n *\n * Syntax:\n *\n * math.stirlingS2(n, k)\n *\n * Examples:\n *\n * math.stirlingS2(5, 3) //returns 25\n *\n * See also:\n *\n * bellNumbers\n *\n * @param {Number | BigNumber} n Total number of objects in the set\n * @param {Number | BigNumber} k Number of objects in the subset\n * @return {Number | BigNumber} S(n,k)\n */\n return typed(name, {\n 'number | BigNumber, number | BigNumber': function (n, k) {\n if (!isInteger(n) || isNegative(n) || !isInteger(k) || isNegative(k)) {\n throw new TypeError('Non-negative integer value expected in function stirlingS2')\n } else if (larger(k, n)) {\n throw new TypeError('k must be less than or equal to n in function stirlingS2')\n }\n\n const big = !(isNumber(n) && isNumber(k))\n const cache = big ? bigCache : smallCache\n const make = big ? bignumber : number\n const nn = number(n)\n const nk = number(k)\n /* See if we already have the value: */\n if (cache[nn] && cache[nn].length > nk) {\n return cache[nn][nk]\n }\n /* Fill the cache */\n for (let m = 0; m <= nn; ++m) {\n if (!cache[m]) {\n cache[m] = [m === 0 ? make(1) : make(0)]\n }\n if (m === 0) continue\n const row = cache[m]\n const prev = cache[m - 1]\n for (let i = row.length; i <= m && i <= nk; ++i) {\n if (i === m) {\n row[i] = 1\n } else {\n row[i] = addScalar(multiplyScalar(make(i), prev[i]), prev[i - 1])\n }\n }\n }\n return cache[nn][nk]\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'bellNumbers'\nconst dependencies = ['typed', 'addScalar', 'isNegative', 'isInteger', 'stirlingS2']\n\nexport const createBellNumbers = /* #__PURE__ */ factory(name, dependencies, ({ typed, addScalar, isNegative, isInteger, stirlingS2 }) => {\n /**\n * The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S.\n * bellNumbers only takes integer arguments.\n * The following condition must be enforced: n >= 0\n *\n * Syntax:\n *\n * math.bellNumbers(n)\n *\n * Examples:\n *\n * math.bellNumbers(3) // returns 5\n * math.bellNumbers(8) // returns 4140\n *\n * See also:\n *\n * stirlingS2\n *\n * @param {Number | BigNumber} n Total number of objects in the set\n * @return {Number | BigNumber} B(n)\n */\n return typed(name, {\n 'number | BigNumber': function (n) {\n if (!isInteger(n) || isNegative(n)) {\n throw new TypeError('Non-negative integer value expected in function bellNumbers')\n }\n\n // Sum (k=0, n) S(n,k).\n let result = 0\n for (let i = 0; i <= n; i++) {\n result = addScalar(result, stirlingS2(n, i))\n }\n\n return result\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'catalan'\nconst dependencies = [\n 'typed',\n 'addScalar',\n 'divideScalar',\n 'multiplyScalar',\n 'combinations',\n 'isNegative',\n 'isInteger'\n]\n\nexport const createCatalan = /* #__PURE__ */ factory(name, dependencies, (\n {\n typed,\n addScalar,\n divideScalar,\n multiplyScalar,\n combinations,\n isNegative,\n isInteger\n }\n) => {\n /**\n * The Catalan Numbers enumerate combinatorial structures of many different types.\n * catalan only takes integer arguments.\n * The following condition must be enforced: n >= 0\n *\n * Syntax:\n *\n * math.catalan(n)\n *\n * Examples:\n *\n * math.catalan(3) // returns 5\n * math.catalan(8) // returns 1430\n *\n * See also:\n *\n * bellNumbers\n *\n * @param {Number | BigNumber} n nth Catalan number\n * @return {Number | BigNumber} Cn(n)\n */\n return typed(name, {\n 'number | BigNumber': function (n) {\n if (!isInteger(n) || isNegative(n)) {\n throw new TypeError('Non-negative integer value expected in function catalan')\n }\n\n return divideScalar(combinations(multiplyScalar(n, 2), n), addScalar(n, 1))\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'composition'\nconst dependencies = [\n 'typed',\n 'addScalar',\n 'combinations',\n 'isNegative',\n 'isPositive',\n 'isInteger',\n 'larger'\n]\n\nexport const createComposition = /* #__PURE__ */ factory(name, dependencies, (\n {\n typed,\n addScalar,\n combinations,\n isPositive,\n isNegative,\n isInteger,\n larger\n }\n) => {\n /**\n * The composition counts of n into k parts.\n *\n * composition only takes integer arguments.\n * The following condition must be enforced: k <= n.\n *\n * Syntax:\n *\n * math.composition(n, k)\n *\n * Examples:\n *\n * math.composition(5, 3) // returns 6\n *\n * See also:\n *\n * combinations\n *\n * @param {Number | BigNumber} n Total number of objects in the set\n * @param {Number | BigNumber} k Number of objects in the subset\n * @return {Number | BigNumber} Returns the composition counts of n into k parts.\n */\n return typed(name, {\n 'number | BigNumber, number | BigNumber': function (n, k) {\n if (!isInteger(n) || !isPositive(n) || !isInteger(k) || !isPositive(k)) {\n throw new TypeError('Positive integer value expected in function composition')\n } else if (larger(k, n)) {\n throw new TypeError('k must be less than or equal to n in function composition')\n }\n\n return combinations(addScalar(n, -1), addScalar(k, -1))\n }\n })\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'leafCount'\nconst dependencies = [\n 'parse',\n 'typed'\n]\n\nexport const createLeafCount = /* #__PURE__ */ factory(name, dependencies, ({\n parse,\n typed\n}) => {\n // This does the real work, but we don't have to recurse through\n // a typed call if we separate it out\n function countLeaves (node) {\n let count = 0\n node.forEach(n => { count += countLeaves(n) })\n return count || 1\n }\n\n /**\n * Gives the number of \"leaf nodes\" in the parse tree of the given expression\n * A leaf node is one that has no subexpressions, essentially either a\n * symbol or a constant. Note that `5!` has just one leaf, the '5'; the\n * unary factorial operator does not add a leaf. On the other hand,\n * function symbols do add leaves, so `sin(x)/cos(x)` has four leaves.\n *\n * The `simplify()` function should generally not increase the `leafCount()`\n * of an expression, although currently there is no guarantee that it never\n * does so. In many cases, `simplify()` reduces the leaf count.\n *\n * Syntax:\n *\n * math.leafCount(expr)\n *\n * Examples:\n *\n * math.leafCount('x') // 1\n * math.leafCount(math.parse('a*d-b*c')) // 4\n * math.leafCount('[a,b;c,d][0,1]') // 6\n *\n * See also:\n *\n * simplify\n *\n * @param {Node|string} expr The expression to count the leaves of\n *\n * @return {number} The number of leaves of `expr`\n *\n */\n return typed(name, {\n Node: function (expr) {\n return countLeaves(expr)\n }\n })\n})\n","import { isConstantNode, isFunctionNode, isOperatorNode, isParenthesisNode } from '../../../utils/is.js'\nexport { isConstantNode, isSymbolNode as isVariableNode } from '../../../utils/is.js'\n\nexport function isNumericNode (x) {\n return isConstantNode(x) || (isOperatorNode(x) && x.isUnary() && isConstantNode(x.args[0]))\n}\n\nexport function isConstantExpression (x) {\n if (isConstantNode(x)) { // Basic Constant types\n return true\n }\n if ((isFunctionNode(x) || isOperatorNode(x)) && x.args.every(isConstantExpression)) { // Can be constant depending on arguments\n return true\n }\n if (isParenthesisNode(x) && isConstantExpression(x.content)) { // Parenthesis are transparent\n return true\n }\n return false // Probably missing some edge cases\n}\n","import { isFunctionNode, isOperatorNode, isParenthesisNode } from '../../../utils/is.js'\nimport { factory } from '../../../utils/factory.js'\nimport { hasOwnProperty } from '../../../utils/object.js'\n\nconst name = 'simplifyUtil'\nconst dependencies = [\n 'FunctionNode',\n 'OperatorNode',\n 'SymbolNode'\n]\n\nexport const createUtil = /* #__PURE__ */ factory(name, dependencies, ({ FunctionNode, OperatorNode, SymbolNode }) => {\n // TODO commutative/associative properties rely on the arguments\n // e.g. multiply is not commutative for matrices\n // The properties should be calculated from an argument to simplify, or possibly something in math.config\n // the other option is for typed() to specify a return type so that we can evaluate the type of arguments\n\n /* So that properties of an operator fit on one line: */\n const T = true\n const F = false\n\n const defaultName = 'defaultF'\n const defaultContext = {\n /* */ add: { trivial: T, total: T, commutative: T, associative: T },\n /**/ unaryPlus: { trivial: T, total: T, commutative: T, associative: T },\n /* */ subtract: { trivial: F, total: T, commutative: F, associative: F },\n /* */ multiply: { trivial: T, total: T, commutative: T, associative: T },\n /* */ divide: { trivial: F, total: T, commutative: F, associative: F },\n /* */ paren: { trivial: T, total: T, commutative: T, associative: F },\n /* */ defaultF: { trivial: F, total: T, commutative: F, associative: F }\n }\n const realContext = { divide: { total: F }, log: { total: F } }\n const positiveContext = {\n subtract: { total: F },\n abs: { trivial: T },\n log: { total: T }\n }\n\n function hasProperty (nodeOrName, property, context = defaultContext) {\n let name = defaultName\n if (typeof nodeOrName === 'string') {\n name = nodeOrName\n } else if (isOperatorNode(nodeOrName)) {\n name = nodeOrName.fn.toString()\n } else if (isFunctionNode(nodeOrName)) {\n name = nodeOrName.name\n } else if (isParenthesisNode(nodeOrName)) {\n name = 'paren'\n }\n if (hasOwnProperty(context, name)) {\n const properties = context[name]\n if (hasOwnProperty(properties, property)) {\n return properties[property]\n }\n if (hasOwnProperty(defaultContext, name)) {\n return defaultContext[name][property]\n }\n }\n if (hasOwnProperty(context, defaultName)) {\n const properties = context[defaultName]\n if (hasOwnProperty(properties, property)) {\n return properties[property]\n }\n return defaultContext[defaultName][property]\n }\n /* name not found in context and context has no global default */\n /* So use default context. */\n if (hasOwnProperty(defaultContext, name)) {\n const properties = defaultContext[name]\n if (hasOwnProperty(properties, property)) {\n return properties[property]\n }\n }\n return defaultContext[defaultName][property]\n }\n\n function isCommutative (node, context = defaultContext) {\n return hasProperty(node, 'commutative', context)\n }\n\n function isAssociative (node, context = defaultContext) {\n return hasProperty(node, 'associative', context)\n }\n\n /**\n * Merge the given contexts, with primary overriding secondary\n * wherever they might conflict\n */\n function mergeContext (primary, secondary) {\n const merged = { ...primary }\n for (const prop in secondary) {\n if (hasOwnProperty(primary, prop)) {\n merged[prop] = { ...secondary[prop], ...primary[prop] }\n } else {\n merged[prop] = secondary[prop]\n }\n }\n return merged\n }\n\n /**\n * Flatten all associative operators in an expression tree.\n * Assumes parentheses have already been removed.\n */\n function flatten (node, context) {\n if (!node.args || node.args.length === 0) {\n return node\n }\n node.args = allChildren(node, context)\n for (let i = 0; i < node.args.length; i++) {\n flatten(node.args[i], context)\n }\n }\n\n /**\n * Get the children of a node as if it has been flattened.\n * TODO implement for FunctionNodes\n */\n function allChildren (node, context) {\n let op\n const children = []\n const findChildren = function (node) {\n for (let i = 0; i < node.args.length; i++) {\n const child = node.args[i]\n if (isOperatorNode(child) && op === child.op) {\n findChildren(child)\n } else {\n children.push(child)\n }\n }\n }\n\n if (isAssociative(node, context)) {\n op = node.op\n findChildren(node)\n return children\n } else {\n return node.args\n }\n }\n\n /**\n * Unflatten all flattened operators to a right-heavy binary tree.\n */\n function unflattenr (node, context) {\n if (!node.args || node.args.length === 0) {\n return\n }\n const makeNode = createMakeNodeFunction(node)\n const l = node.args.length\n for (let i = 0; i < l; i++) {\n unflattenr(node.args[i], context)\n }\n if (l > 2 && isAssociative(node, context)) {\n let curnode = node.args.pop()\n while (node.args.length > 0) {\n curnode = makeNode([node.args.pop(), curnode])\n }\n node.args = curnode.args\n }\n }\n\n /**\n * Unflatten all flattened operators to a left-heavy binary tree.\n */\n function unflattenl (node, context) {\n if (!node.args || node.args.length === 0) {\n return\n }\n const makeNode = createMakeNodeFunction(node)\n const l = node.args.length\n for (let i = 0; i < l; i++) {\n unflattenl(node.args[i], context)\n }\n if (l > 2 && isAssociative(node, context)) {\n let curnode = node.args.shift()\n while (node.args.length > 0) {\n curnode = makeNode([curnode, node.args.shift()])\n }\n node.args = curnode.args\n }\n }\n\n function createMakeNodeFunction (node) {\n if (isOperatorNode(node)) {\n return function (args) {\n try {\n return new OperatorNode(node.op, node.fn, args, node.implicit)\n } catch (err) {\n console.error(err)\n return []\n }\n }\n } else {\n return function (args) {\n return new FunctionNode(new SymbolNode(node.name), args)\n }\n }\n }\n\n return {\n createMakeNodeFunction,\n hasProperty,\n isCommutative,\n isAssociative,\n mergeContext,\n flatten,\n allChildren,\n unflattenr,\n unflattenl,\n defaultContext,\n realContext,\n positiveContext\n }\n})\n","import { isParenthesisNode } from '../../utils/is.js'\nimport { isConstantNode, isVariableNode, isNumericNode, isConstantExpression } from './simplify/wildcards.js'\nimport { factory } from '../../utils/factory.js'\nimport { createUtil } from './simplify/util.js'\nimport { hasOwnProperty } from '../../utils/object.js'\nimport { createEmptyMap, createMap } from '../../utils/map.js'\n\nconst name = 'simplify'\nconst dependencies = [\n 'typed',\n 'parse',\n 'equal',\n 'resolve',\n 'simplifyConstant',\n 'simplifyCore',\n 'AccessorNode',\n 'ArrayNode',\n 'ConstantNode',\n 'FunctionNode',\n 'IndexNode',\n 'ObjectNode',\n 'OperatorNode',\n 'ParenthesisNode',\n 'SymbolNode',\n 'replacer'\n]\n\nexport const createSimplify = /* #__PURE__ */ factory(name, dependencies, (\n {\n typed,\n parse,\n equal,\n resolve,\n simplifyConstant,\n simplifyCore,\n AccessorNode,\n ArrayNode,\n ConstantNode,\n FunctionNode,\n IndexNode,\n ObjectNode,\n OperatorNode,\n ParenthesisNode,\n SymbolNode,\n replacer\n }\n) => {\n const { hasProperty, isCommutative, isAssociative, mergeContext, flatten, unflattenr, unflattenl, createMakeNodeFunction, defaultContext, realContext, positiveContext } =\n createUtil({ FunctionNode, OperatorNode, SymbolNode })\n\n /**\n * Simplify an expression tree.\n *\n * A list of rules are applied to an expression, repeating over the list until\n * no further changes are made.\n * It's possible to pass a custom set of rules to the function as second\n * argument. A rule can be specified as an object, string, or function:\n *\n * const rules = [\n * { l: 'n1*n3 + n2*n3', r: '(n1+n2)*n3' },\n * 'n1*n3 + n2*n3 -> (n1+n2)*n3',\n * function (node) {\n * // ... return a new node or return the node unchanged\n * return node\n * }\n * ]\n *\n * String and object rules consist of a left and right pattern. The left is\n * used to match against the expression and the right determines what matches\n * are replaced with. The main difference between a pattern and a normal\n * expression is that variables starting with the following characters are\n * interpreted as wildcards:\n *\n * - 'n' - Matches any node [Node]\n * - 'c' - Matches a constant literal (5 or 3.2) [ConstantNode]\n * - 'cl' - Matches a constant literal; same as c [ConstantNode]\n * - 'cd' - Matches a decimal literal (5 or -3.2) [ConstantNode or unaryMinus wrapping a ConstantNode]\n * - 'ce' - Matches a constant expression (-5 or √3) [Expressions consisting of only ConstantNodes, functions, and operators]\n * - 'v' - Matches a variable; anything not matched by c (-5 or x) [Node that is not a ConstantNode]\n * - 'vl' - Matches a variable literal (x or y) [SymbolNode]\n * - 'vd' - Matches a non-decimal expression; anything not matched by cd (x or √3) [Node that is not a ConstantNode or unaryMinus that is wrapping a ConstantNode]\n * - 've' - Matches a variable expression; anything not matched by ce (x or 2x) [Expressions that contain a SymbolNode or other non-constant term]\n *\n * The default list of rules is exposed on the function as `simplify.rules`\n * and can be used as a basis to built a set of custom rules. Note that since\n * the `simplifyCore` function is in the default list of rules, by default\n * simplify will convert any function calls in the expression that have\n * operator equivalents to their operator forms.\n *\n * To specify a rule as a string, separate the left and right pattern by '->'\n * When specifying a rule as an object, the following keys are meaningful:\n * - l - the left pattern\n * - r - the right pattern\n * - s - in lieu of l and r, the string form that is broken at -> to give them\n * - repeat - whether to repeat this rule until the expression stabilizes\n * - assuming - gives a context object, as in the 'context' option to\n * simplify. Every property in the context object must match the current\n * context in order, or else the rule will not be applied.\n * - imposeContext - gives a context object, as in the 'context' option to\n * simplify. Any settings specified will override the incoming context\n * for all matches of this rule.\n *\n * For more details on the theory, see:\n *\n * - [Strategies for simplifying math expressions (Stackoverflow)](https://stackoverflow.com/questions/7540227/strategies-for-simplifying-math-expressions)\n * - [Symbolic computation - Simplification (Wikipedia)](https://en.wikipedia.org/wiki/Symbolic_computation#Simplification)\n *\n * An optional `options` argument can be passed as last argument of `simplify`.\n * Currently available options (defaults in parentheses):\n * - `consoleDebug` (false): whether to write the expression being simplified\n * and any changes to it, along with the rule responsible, to console\n * - `context` (simplify.defaultContext): an object giving properties of\n * each operator, which determine what simplifications are allowed. The\n * currently meaningful properties are commutative, associative,\n * total (whether the operation is defined for all arguments), and\n * trivial (whether the operation applied to a single argument leaves\n * that argument unchanged). The default context is very permissive and\n * allows almost all simplifications. Only properties differing from\n * the default need to be specified; the default context is used as a\n * fallback. Additional contexts `simplify.realContext` and\n * `simplify.positiveContext` are supplied to cause simplify to perform\n * just simplifications guaranteed to preserve all values of the expression\n * assuming all variables and subexpressions are real numbers or\n * positive real numbers, respectively. (Note that these are in some cases\n * more restrictive than the default context; for example, the default\n * context will allow `x/x` to simplify to 1, whereas\n * `simplify.realContext` will not, as `0/0` is not equal to 1.)\n * - `exactFractions` (true): whether to try to convert all constants to\n * exact rational numbers.\n * - `fractionsLimit` (10000): when `exactFractions` is true, constants will\n * be expressed as fractions only when both numerator and denominator\n * are smaller than `fractionsLimit`.\n *\n * Syntax:\n *\n * math.simplify(expr)\n * math.simplify(expr, rules)\n * math.simplify(expr, rules)\n * math.simplify(expr, rules, scope)\n * math.simplify(expr, rules, scope, options)\n * math.simplify(expr, scope)\n * math.simplify(expr, scope, options)\n *\n * Examples:\n *\n * math.simplify('2 * 1 * x ^ (2 - 1)') // Node \"2 * x\"\n * math.simplify('2 * 3 * x', {x: 4}) // Node \"24\"\n * const f = math.parse('2 * 1 * x ^ (2 - 1)')\n * math.simplify(f) // Node \"2 * x\"\n * math.simplify('0.4 * x', {}, {exactFractions: true}) // Node \"x * 2 / 5\"\n * math.simplify('0.4 * x', {}, {exactFractions: false}) // Node \"0.4 * x\"\n *\n * See also:\n *\n * simplifyCore, derivative, evaluate, parse, rationalize, resolve\n *\n * @param {Node | string} expr\n * The expression to be simplified\n * @param {SimplifyRule[]} [rules]\n * Optional list with custom rules\n * @param {Object} [scope] Optional scope with variables\n * @param {SimplifyOptions} [options] Optional configuration settings\n * @return {Node} Returns the simplified form of `expr`\n */\n typed.addConversion({ from: 'Object', to: 'Map', convert: createMap })\n const simplify = typed('simplify', {\n Node: _simplify,\n 'Node, Map': (expr, scope) => _simplify(expr, false, scope),\n 'Node, Map, Object':\n (expr, scope, options) => _simplify(expr, false, scope, options),\n 'Node, Array': _simplify,\n 'Node, Array, Map': _simplify,\n 'Node, Array, Map, Object': _simplify\n })\n typed.removeConversion({ from: 'Object', to: 'Map', convert: createMap })\n\n simplify.defaultContext = defaultContext\n simplify.realContext = realContext\n simplify.positiveContext = positiveContext\n\n function removeParens (node) {\n return node.transform(function (node) {\n return isParenthesisNode(node)\n ? removeParens(node.content)\n : node\n })\n }\n\n // All constants that are allowed in rules\n const SUPPORTED_CONSTANTS = {\n true: true,\n false: true,\n e: true,\n i: true,\n Infinity: true,\n LN2: true,\n LN10: true,\n LOG2E: true,\n LOG10E: true,\n NaN: true,\n phi: true,\n pi: true,\n SQRT1_2: true,\n SQRT2: true,\n tau: true\n // null: false,\n // undefined: false,\n // version: false,\n }\n\n // Array of strings, used to build the ruleSet.\n // Each l (left side) and r (right side) are parsed by\n // the expression parser into a node tree.\n // Left hand sides are matched to subtrees within the\n // expression to be parsed and replaced with the right\n // hand side.\n // TODO: Add support for constraints on constants (either in the form of a '=' expression or a callback [callback allows things like comparing symbols alphabetically])\n // To evaluate lhs constants for rhs constants, use: { l: 'c1+c2', r: 'c3', evaluate: 'c3 = c1 + c2' }. Multiple assignments are separated by ';' in block format.\n // It is possible to get into an infinite loop with conflicting rules\n simplify.rules = [\n simplifyCore,\n // { l: 'n+0', r: 'n' }, // simplifyCore\n // { l: 'n^0', r: '1' }, // simplifyCore\n // { l: '0*n', r: '0' }, // simplifyCore\n // { l: 'n/n', r: '1'}, // simplifyCore\n // { l: 'n^1', r: 'n' }, // simplifyCore\n // { l: '+n1', r:'n1' }, // simplifyCore\n // { l: 'n--n1', r:'n+n1' }, // simplifyCore\n { l: 'log(e)', r: '1' },\n\n // temporary rules\n // Note initially we tend constants to the right because like-term\n // collection prefers the left, and we would rather collect nonconstants\n {\n s: 'n-n1 -> n+-n1', // temporarily replace 'subtract' so we can further flatten the 'add' operator\n assuming: { subtract: { total: true } }\n },\n {\n s: 'n-n -> 0', // partial alternative when we can't always subtract\n assuming: { subtract: { total: false } }\n },\n {\n s: '-(cl*v) -> v * (-cl)', // make non-constant terms positive\n assuming: { multiply: { commutative: true }, subtract: { total: true } }\n },\n {\n s: '-(cl*v) -> (-cl) * v', // non-commutative version, part 1\n assuming: { multiply: { commutative: false }, subtract: { total: true } }\n },\n {\n s: '-(v*cl) -> v * (-cl)', // non-commutative version, part 2\n assuming: { multiply: { commutative: false }, subtract: { total: true } }\n },\n { l: '-(n1/n2)', r: '-n1/n2' },\n { l: '-v', r: 'v * (-1)' }, // finish making non-constant terms positive\n { l: '(n1 + n2)*(-1)', r: 'n1*(-1) + n2*(-1)', repeat: true }, // expand negations to achieve as much sign cancellation as possible\n { l: 'n/n1^n2', r: 'n*n1^-n2' }, // temporarily replace 'divide' so we can further flatten the 'multiply' operator\n { l: 'n/n1', r: 'n*n1^-1' },\n {\n s: '(n1*n2)^n3 -> n1^n3 * n2^n3',\n assuming: { multiply: { commutative: true } }\n },\n {\n s: '(n1*n2)^(-1) -> n2^(-1) * n1^(-1)',\n assuming: { multiply: { commutative: false } }\n },\n\n // expand nested exponentiation\n {\n s: '(n ^ n1) ^ n2 -> n ^ (n1 * n2)',\n assuming: { divide: { total: true } } // 1/(1/n) = n needs 1/n to exist\n },\n\n // collect like factors; into a sum, only do this for nonconstants\n { l: ' vd * ( vd * n1 + n2)', r: 'vd^2 * n1 + vd * n2' },\n {\n s: ' vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2',\n assuming: { divide: { total: true } } // v*1/v = v^(1+-1) needs 1/v\n },\n {\n s: 'vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2',\n assuming: { divide: { total: true } }\n },\n {\n s: 'vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2',\n assuming: { divide: { total: true } }\n },\n { l: 'n*n', r: 'n^2' },\n {\n s: 'n * n^n1 -> n^(n1+1)',\n assuming: { divide: { total: true } } // n*1/n = n^(-1+1) needs 1/n\n },\n {\n s: 'n^n1 * n^n2 -> n^(n1+n2)',\n assuming: { divide: { total: true } } // ditto for n^2*1/n^2\n },\n\n // Unfortunately, to deal with more complicated cancellations, it\n // becomes necessary to simplify constants twice per pass. It's not\n // terribly expensive compared to matching rules, so this should not\n // pose a performance problem.\n simplifyConstant, // First: before collecting like terms\n\n // collect like terms\n {\n s: 'n+n -> 2*n',\n assuming: { add: { total: true } } // 2 = 1 + 1 needs to exist\n },\n { l: 'n+-n', r: '0' },\n { l: 'vd*n + vd', r: 'vd*(n+1)' }, // NOTE: leftmost position is special:\n { l: 'n3*n1 + n3*n2', r: 'n3*(n1+n2)' }, // All sub-monomials tried there.\n { l: 'n3^(-n4)*n1 + n3 * n2', r: 'n3^(-n4)*(n1 + n3^(n4+1) *n2)' },\n { l: 'n3^(-n4)*n1 + n3^n5 * n2', r: 'n3^(-n4)*(n1 + n3^(n4+n5)*n2)' },\n // noncommutative additional cases (term collection & factoring)\n {\n s: 'n*vd + vd -> (n+1)*vd',\n assuming: { multiply: { commutative: false } }\n },\n {\n s: 'vd + n*vd -> (1+n)*vd',\n assuming: { multiply: { commutative: false } }\n },\n {\n s: 'n1*n3 + n2*n3 -> (n1+n2)*n3',\n assuming: { multiply: { commutative: false } }\n },\n {\n s: 'n^n1 * n -> n^(n1+1)',\n assuming: { divide: { total: true }, multiply: { commutative: false } }\n },\n {\n s: 'n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)',\n assuming: { multiply: { commutative: false } }\n },\n {\n s: 'n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)',\n assuming: { multiply: { commutative: false } }\n },\n { l: 'n*cd + cd', r: '(n+1)*cd' },\n {\n s: 'cd*n + cd -> cd*(n+1)',\n assuming: { multiply: { commutative: false } }\n },\n {\n s: 'cd + cd*n -> cd*(1+n)',\n assuming: { multiply: { commutative: false } }\n },\n simplifyConstant, // Second: before returning expressions to \"standard form\"\n\n // make factors positive (and undo 'make non-constant terms positive')\n {\n s: '(-n)*n1 -> -(n*n1)',\n assuming: { subtract: { total: true } }\n },\n {\n s: 'n1*(-n) -> -(n1*n)', // in case * non-commutative\n assuming: { subtract: { total: true }, multiply: { commutative: false } }\n },\n\n // final ordering of constants\n {\n s: 'ce+ve -> ve+ce',\n assuming: { add: { commutative: true } },\n imposeContext: { add: { commutative: false } }\n },\n {\n s: 'vd*cd -> cd*vd',\n assuming: { multiply: { commutative: true } },\n imposeContext: { multiply: { commutative: false } }\n },\n\n // undo temporary rules\n // { l: '(-1) * n', r: '-n' }, // #811 added test which proved this is redundant\n { l: 'n+-n1', r: 'n-n1' }, // undo replace 'subtract'\n { l: 'n+-(n1)', r: 'n-(n1)' },\n {\n s: 'n*(n1^-1) -> n/n1', // undo replace 'divide'; for * commutative\n assuming: { multiply: { commutative: true } } // o.w. / not conventional\n },\n {\n s: 'n*n1^-n2 -> n/n1^n2',\n assuming: { multiply: { commutative: true } } // o.w. / not conventional\n },\n {\n s: 'n^-1 -> 1/n',\n assuming: { multiply: { commutative: true } } // o.w. / not conventional\n },\n { l: 'n^1', r: 'n' }, // can be produced by power cancellation\n {\n s: 'n*(n1/n2) -> (n*n1)/n2', // '*' before '/'\n assuming: { multiply: { associative: true } }\n },\n {\n s: 'n-(n1+n2) -> n-n1-n2', // '-' before '+'\n assuming: { addition: { associative: true, commutative: true } }\n },\n // { l: '(n1/n2)/n3', r: 'n1/(n2*n3)' },\n // { l: '(n*n1)/(n*n2)', r: 'n1/n2' },\n\n // simplifyConstant can leave an extra factor of 1, which can always\n // be eliminated, since the identity always commutes\n { l: '1*n', r: 'n', imposeContext: { multiply: { commutative: true } } },\n\n {\n s: 'n1/(n2/n3) -> (n1*n3)/n2',\n assuming: { multiply: { associative: true } }\n },\n\n { l: 'n1/(-n2)', r: '-n1/n2' }\n\n ]\n\n /**\n * Takes any rule object as allowed by the specification in simplify\n * and puts it in a standard form used by applyRule\n */\n function _canonicalizeRule (ruleObject, context) {\n const newRule = {}\n if (ruleObject.s) {\n const lr = ruleObject.s.split('->')\n if (lr.length === 2) {\n newRule.l = lr[0]\n newRule.r = lr[1]\n } else {\n throw SyntaxError('Could not parse rule: ' + ruleObject.s)\n }\n } else {\n newRule.l = ruleObject.l\n newRule.r = ruleObject.r\n }\n newRule.l = removeParens(parse(newRule.l))\n newRule.r = removeParens(parse(newRule.r))\n for (const prop of ['imposeContext', 'repeat', 'assuming']) {\n if (prop in ruleObject) {\n newRule[prop] = ruleObject[prop]\n }\n }\n if (ruleObject.evaluate) {\n newRule.evaluate = parse(ruleObject.evaluate)\n }\n\n if (isAssociative(newRule.l, context)) {\n const nonCommutative = !isCommutative(newRule.l, context)\n let leftExpandsym\n // Gen. the LHS placeholder used in this NC-context specific expansion rules\n if (nonCommutative) leftExpandsym = _getExpandPlaceholderSymbol()\n\n const makeNode = createMakeNodeFunction(newRule.l)\n const expandsym = _getExpandPlaceholderSymbol()\n newRule.expanded = {}\n newRule.expanded.l = makeNode([newRule.l, expandsym])\n // Push the expandsym into the deepest possible branch.\n // This helps to match the newRule against nodes returned from getSplits() later on.\n flatten(newRule.expanded.l, context)\n unflattenr(newRule.expanded.l, context)\n newRule.expanded.r = makeNode([newRule.r, expandsym])\n\n // In and for a non-commutative context, attempting with yet additional expansion rules makes\n // way for more matches cases of multi-arg expressions; such that associative rules (such as\n // 'n*n -> n^2') can be applied to exprs. such as 'a * b * b' and 'a * b * b * a'.\n if (nonCommutative) {\n // 'Non-commutative' 1: LHS (placeholder) only\n newRule.expandedNC1 = {}\n newRule.expandedNC1.l = makeNode([leftExpandsym, newRule.l])\n newRule.expandedNC1.r = makeNode([leftExpandsym, newRule.r])\n // 'Non-commutative' 2: farmost LHS and RHS placeholders\n newRule.expandedNC2 = {}\n newRule.expandedNC2.l = makeNode([leftExpandsym, newRule.expanded.l])\n newRule.expandedNC2.r = makeNode([leftExpandsym, newRule.expanded.r])\n }\n }\n\n return newRule\n }\n\n /**\n * Parse the string array of rules into nodes\n *\n * Example syntax for rules:\n *\n * Position constants to the left in a product:\n * { l: 'n1 * c1', r: 'c1 * n1' }\n * n1 is any Node, and c1 is a ConstantNode.\n *\n * Apply difference of squares formula:\n * { l: '(n1 - n2) * (n1 + n2)', r: 'n1^2 - n2^2' }\n * n1, n2 mean any Node.\n *\n * Short hand notation:\n * 'n1 * c1 -> c1 * n1'\n */\n function _buildRules (rules, context) {\n // Array of rules to be used to simplify expressions\n const ruleSet = []\n for (let i = 0; i < rules.length; i++) {\n let rule = rules[i]\n let newRule\n const ruleType = typeof rule\n switch (ruleType) {\n case 'string':\n rule = { s: rule }\n /* falls through */\n case 'object':\n newRule = _canonicalizeRule(rule, context)\n break\n case 'function':\n newRule = rule\n break\n default:\n throw TypeError('Unsupported type of rule: ' + ruleType)\n }\n // console.log('Adding rule: ' + rules[i])\n // console.log(newRule)\n ruleSet.push(newRule)\n }\n return ruleSet\n }\n\n let _lastsym = 0\n function _getExpandPlaceholderSymbol () {\n return new SymbolNode('_p' + _lastsym++)\n }\n\n function _simplify (expr, rules, scope = createEmptyMap(), options = {}) {\n const debug = options.consoleDebug\n rules = _buildRules(rules || simplify.rules, options.context)\n let res = resolve(expr, scope)\n res = removeParens(res)\n const visited = {}\n let str = res.toString({ parenthesis: 'all' })\n while (!visited[str]) {\n visited[str] = true\n _lastsym = 0 // counter for placeholder symbols\n let laststr = str\n if (debug) console.log('Working on: ', str)\n for (let i = 0; i < rules.length; i++) {\n let rulestr = ''\n if (typeof rules[i] === 'function') {\n res = rules[i](res, options)\n if (debug) rulestr = rules[i].name\n } else {\n flatten(res, options.context)\n res = applyRule(res, rules[i], options.context)\n if (debug) {\n rulestr = `${rules[i].l.toString()} -> ${rules[i].r.toString()}`\n }\n }\n if (debug) {\n const newstr = res.toString({ parenthesis: 'all' })\n if (newstr !== laststr) {\n console.log('Applying', rulestr, 'produced', newstr)\n laststr = newstr\n }\n }\n /* Use left-heavy binary tree internally,\n * since custom rule functions may expect it\n */\n unflattenl(res, options.context)\n }\n str = res.toString({ parenthesis: 'all' })\n }\n return res\n }\n\n function mapRule (nodes, rule, context) {\n let resNodes = nodes\n if (nodes) {\n for (let i = 0; i < nodes.length; ++i) {\n const newNode = applyRule(nodes[i], rule, context)\n if (newNode !== nodes[i]) {\n if (resNodes === nodes) {\n resNodes = nodes.slice()\n }\n resNodes[i] = newNode\n }\n }\n }\n return resNodes\n }\n\n /**\n * Returns a simplfied form of node, or the original node if no simplification was possible.\n *\n * @param {ConstantNode | SymbolNode | ParenthesisNode | FunctionNode | OperatorNode} node\n * @param {Object | Function} rule\n * @param {Object} context -- information about assumed properties of operators\n * @return {ConstantNode | SymbolNode | ParenthesisNode | FunctionNode | OperatorNode} The simplified form of `expr`, or the original node if no simplification was possible.\n */\n function applyRule (node, rule, context) {\n // console.log('Entering applyRule(\"', rule.l.toString({parenthesis:'all'}), '->', rule.r.toString({parenthesis:'all'}), '\",', node.toString({parenthesis:'all'}),')')\n\n // check that the assumptions for this rule are satisfied by the current\n // context:\n if (rule.assuming) {\n for (const symbol in rule.assuming) {\n for (const property in rule.assuming[symbol]) {\n if (hasProperty(symbol, property, context) !==\n rule.assuming[symbol][property]) {\n return node\n }\n }\n }\n }\n\n const mergedContext = mergeContext(rule.imposeContext, context)\n\n // Do not clone node unless we find a match\n let res = node\n\n // First replace our child nodes with their simplified versions\n // If a child could not be simplified, applying the rule to it\n // will have no effect since the node is returned unchanged\n if (res instanceof OperatorNode || res instanceof FunctionNode) {\n const newArgs = mapRule(res.args, rule, context)\n if (newArgs !== res.args) {\n res = res.clone()\n res.args = newArgs\n }\n } else if (res instanceof ParenthesisNode) {\n if (res.content) {\n const newContent = applyRule(res.content, rule, context)\n if (newContent !== res.content) {\n res = new ParenthesisNode(newContent)\n }\n }\n } else if (res instanceof ArrayNode) {\n const newItems = mapRule(res.items, rule, context)\n if (newItems !== res.items) {\n res = new ArrayNode(newItems)\n }\n } else if (res instanceof AccessorNode) {\n let newObj = res.object\n if (res.object) {\n newObj = applyRule(res.object, rule, context)\n }\n let newIndex = res.index\n if (res.index) {\n newIndex = applyRule(res.index, rule, context)\n }\n if (newObj !== res.object || newIndex !== res.index) {\n res = new AccessorNode(newObj, newIndex)\n }\n } else if (res instanceof IndexNode) {\n const newDims = mapRule(res.dimensions, rule, context)\n if (newDims !== res.dimensions) {\n res = new IndexNode(newDims)\n }\n } else if (res instanceof ObjectNode) {\n let changed = false\n const newProps = {}\n for (const prop in res.properties) {\n newProps[prop] = applyRule(res.properties[prop], rule, context)\n if (newProps[prop] !== res.properties[prop]) {\n changed = true\n }\n }\n if (changed) {\n res = new ObjectNode(newProps)\n }\n }\n\n // Try to match a rule against this node\n let repl = rule.r\n let matches = _ruleMatch(rule.l, res, mergedContext)[0]\n\n // If the rule is associative operator, we can try matching it while allowing additional terms.\n // This allows us to match rules like 'n+n' to the expression '(1+x)+x' or even 'x+1+x' if the operator is commutative.\n if (!matches && rule.expanded) {\n repl = rule.expanded.r\n matches = _ruleMatch(rule.expanded.l, res, mergedContext)[0]\n }\n // Additional, non-commutative context expansion-rules\n if (!matches && rule.expandedNC1) {\n repl = rule.expandedNC1.r\n matches = _ruleMatch(rule.expandedNC1.l, res, mergedContext)[0]\n if (!matches) { // Existence of NC1 implies NC2\n repl = rule.expandedNC2.r\n matches = _ruleMatch(rule.expandedNC2.l, res, mergedContext)[0]\n }\n }\n\n if (matches) {\n // const before = res.toString({parenthesis: 'all'})\n\n // Create a new node by cloning the rhs of the matched rule\n // we keep any implicit multiplication state if relevant\n const implicit = res.implicit\n res = repl.clone()\n if (implicit && 'implicit' in repl) {\n res.implicit = true\n }\n\n // Replace placeholders with their respective nodes without traversing deeper into the replaced nodes\n res = res.transform(function (node) {\n if (node.isSymbolNode && hasOwnProperty(matches.placeholders, node.name)) {\n return matches.placeholders[node.name].clone()\n } else {\n return node\n }\n })\n\n // const after = res.toString({parenthesis: 'all'})\n // console.log('Simplified ' + before + ' to ' + after)\n }\n\n if (rule.repeat && res !== node) {\n res = applyRule(res, rule, context)\n }\n\n return res\n }\n\n /**\n * Get (binary) combinations of a flattened binary node\n * e.g. +(node1, node2, node3) -> [\n * +(node1, +(node2, node3)),\n * +(node2, +(node1, node3)),\n * +(node3, +(node1, node2))]\n *\n */\n function getSplits (node, context) {\n const res = []\n let right, rightArgs\n const makeNode = createMakeNodeFunction(node)\n if (isCommutative(node, context)) {\n for (let i = 0; i < node.args.length; i++) {\n rightArgs = node.args.slice(0)\n rightArgs.splice(i, 1)\n right = (rightArgs.length === 1) ? rightArgs[0] : makeNode(rightArgs)\n res.push(makeNode([node.args[i], right]))\n }\n } else {\n // Keep order, but try all parenthesizations\n for (let i = 1; i < node.args.length; i++) {\n let left = node.args[0]\n if (i > 1) {\n left = makeNode(node.args.slice(0, i))\n }\n rightArgs = node.args.slice(i)\n right = (rightArgs.length === 1) ? rightArgs[0] : makeNode(rightArgs)\n res.push(makeNode([left, right]))\n }\n }\n return res\n }\n\n /**\n * Returns the set union of two match-placeholders or null if there is a conflict.\n */\n function mergeMatch (match1, match2) {\n const res = { placeholders: {} }\n\n // Some matches may not have placeholders; this is OK\n if (!match1.placeholders && !match2.placeholders) {\n return res\n } else if (!match1.placeholders) {\n return match2\n } else if (!match2.placeholders) {\n return match1\n }\n\n // Placeholders with the same key must match exactly\n for (const key in match1.placeholders) {\n if (hasOwnProperty(match1.placeholders, key)) {\n res.placeholders[key] = match1.placeholders[key]\n\n if (hasOwnProperty(match2.placeholders, key)) {\n if (!_exactMatch(match1.placeholders[key], match2.placeholders[key])) {\n return null\n }\n }\n }\n }\n\n for (const key in match2.placeholders) {\n if (hasOwnProperty(match2.placeholders, key)) {\n res.placeholders[key] = match2.placeholders[key]\n }\n }\n\n return res\n }\n\n /**\n * Combine two lists of matches by applying mergeMatch to the cartesian product of two lists of matches.\n * Each list represents matches found in one child of a node.\n */\n function combineChildMatches (list1, list2) {\n const res = []\n\n if (list1.length === 0 || list2.length === 0) {\n return res\n }\n\n let merged\n for (let i1 = 0; i1 < list1.length; i1++) {\n for (let i2 = 0; i2 < list2.length; i2++) {\n merged = mergeMatch(list1[i1], list2[i2])\n if (merged) {\n res.push(merged)\n }\n }\n }\n return res\n }\n\n /**\n * Combine multiple lists of matches by applying mergeMatch to the cartesian product of two lists of matches.\n * Each list represents matches found in one child of a node.\n * Returns a list of unique matches.\n */\n function mergeChildMatches (childMatches) {\n if (childMatches.length === 0) {\n return childMatches\n }\n\n const sets = childMatches.reduce(combineChildMatches)\n const uniqueSets = []\n const unique = {}\n for (let i = 0; i < sets.length; i++) {\n const s = JSON.stringify(sets[i], replacer)\n if (!unique[s]) {\n unique[s] = true\n uniqueSets.push(sets[i])\n }\n }\n return uniqueSets\n }\n\n /**\n * Determines whether node matches rule.\n *\n * @param {ConstantNode | SymbolNode | ParenthesisNode | FunctionNode | OperatorNode} rule\n * @param {ConstantNode | SymbolNode | ParenthesisNode | FunctionNode | OperatorNode} node\n * @param {Object} context -- provides assumed properties of operators\n * @param {Boolean} isSplit -- whether we are in process of splitting an\n * n-ary operator node into possible binary combinations.\n * Defaults to false.\n * @return {Object} Information about the match, if it exists.\n */\n function _ruleMatch (rule, node, context, isSplit) {\n // console.log('Entering _ruleMatch(' + JSON.stringify(rule) + ', ' + JSON.stringify(node) + ')')\n // console.log('rule = ' + rule)\n // console.log('node = ' + node)\n\n // console.log('Entering _ruleMatch(', rule.toString({parenthesis:'all'}), ', ', node.toString({parenthesis:'all'}), ', ', context, ')')\n let res = [{ placeholders: {} }]\n\n if ((rule instanceof OperatorNode && node instanceof OperatorNode) ||\n (rule instanceof FunctionNode && node instanceof FunctionNode)) {\n // If the rule is an OperatorNode or a FunctionNode, then node must match exactly\n if (rule instanceof OperatorNode) {\n if (rule.op !== node.op || rule.fn !== node.fn) {\n return []\n }\n } else if (rule instanceof FunctionNode) {\n if (rule.name !== node.name) {\n return []\n }\n }\n\n // rule and node match. Search the children of rule and node.\n if ((node.args.length === 1 && rule.args.length === 1) ||\n (!isAssociative(node, context) &&\n node.args.length === rule.args.length) ||\n isSplit) {\n // Expect non-associative operators to match exactly,\n // except in any order if operator is commutative\n let childMatches = []\n for (let i = 0; i < rule.args.length; i++) {\n const childMatch = _ruleMatch(rule.args[i], node.args[i], context)\n if (childMatch.length === 0) {\n // Child did not match, so stop searching immediately\n break\n }\n // The child matched, so add the information returned from the child to our result\n childMatches.push(childMatch)\n }\n if (childMatches.length !== rule.args.length) {\n if (!isCommutative(node, context) || // exact match in order needed\n rule.args.length === 1) { // nothing to commute\n return []\n }\n if (rule.args.length > 2) {\n /* Need to generate all permutations and try them.\n * It's a bit complicated, and unlikely to come up since there\n * are very few ternary or higher operators. So punt for now.\n */\n throw new Error('permuting >2 commutative non-associative rule arguments not yet implemented')\n }\n /* Exactly two arguments, try them reversed */\n const leftMatch = _ruleMatch(rule.args[0], node.args[1], context)\n if (leftMatch.length === 0) {\n return []\n }\n const rightMatch = _ruleMatch(rule.args[1], node.args[0], context)\n if (rightMatch.length === 0) {\n return []\n }\n childMatches = [leftMatch, rightMatch]\n }\n res = mergeChildMatches(childMatches)\n } else if (node.args.length >= 2 && rule.args.length === 2) { // node is flattened, rule is not\n // Associative operators/functions can be split in different ways so we check if the rule\n // matches for each of them and return their union.\n const splits = getSplits(node, context)\n let splitMatches = []\n for (let i = 0; i < splits.length; i++) {\n const matchSet = _ruleMatch(rule, splits[i], context, true) // recursing at the same tree depth here\n splitMatches = splitMatches.concat(matchSet)\n }\n return splitMatches\n } else if (rule.args.length > 2) {\n throw Error('Unexpected non-binary associative function: ' + rule.toString())\n } else {\n // Incorrect number of arguments in rule and node, so no match\n return []\n }\n } else if (rule instanceof SymbolNode) {\n // If the rule is a SymbolNode, then it carries a special meaning\n // according to the first one or two characters of the symbol node name.\n // These meanings are expalined in the documentation for simplify()\n if (rule.name.length === 0) {\n throw new Error('Symbol in rule has 0 length...!?')\n }\n if (SUPPORTED_CONSTANTS[rule.name]) {\n // built-in constant must match exactly\n if (rule.name !== node.name) {\n return []\n }\n } else {\n // wildcards are composed of up to two alphabetic or underscore characters\n switch (rule.name[1] >= 'a' && rule.name[1] <= 'z' ? rule.name.substring(0, 2) : rule.name[0]) {\n case 'n':\n case '_p':\n // rule matches _anything_, so assign this node to the rule.name placeholder\n // Assign node to the rule.name placeholder.\n // Our parent will check for matches among placeholders.\n res[0].placeholders[rule.name] = node\n break\n case 'c':\n case 'cl':\n // rule matches a ConstantNode\n if (isConstantNode(node)) {\n res[0].placeholders[rule.name] = node\n } else {\n // mis-match: rule does not encompass current node\n return []\n }\n break\n case 'v':\n // rule matches anything other than a ConstantNode\n if (!isConstantNode(node)) {\n res[0].placeholders[rule.name] = node\n } else {\n // mis-match: rule does not encompass current node\n return []\n }\n break\n case 'vl':\n // rule matches VariableNode\n if (isVariableNode(node)) {\n res[0].placeholders[rule.name] = node\n } else {\n // mis-match: rule does not encompass current node\n return []\n }\n break\n case 'cd':\n // rule matches a ConstantNode or unaryMinus-wrapped ConstantNode\n if (isNumericNode(node)) {\n res[0].placeholders[rule.name] = node\n } else {\n // mis-match: rule does not encompass current node\n return []\n }\n break\n case 'vd':\n // rule matches anything other than a ConstantNode or unaryMinus-wrapped ConstantNode\n if (!isNumericNode(node)) {\n res[0].placeholders[rule.name] = node\n } else {\n // mis-match: rule does not encompass current node\n return []\n }\n break\n case 'ce':\n // rule matches expressions that have a constant value\n if (isConstantExpression(node)) {\n res[0].placeholders[rule.name] = node\n } else {\n // mis-match: rule does not encompass current node\n return []\n }\n break\n case 've':\n // rule matches expressions that do not have a constant value\n if (!isConstantExpression(node)) {\n res[0].placeholders[rule.name] = node\n } else {\n // mis-match: rule does not encompass current node\n return []\n }\n break\n default:\n throw new Error('Invalid symbol in rule: ' + rule.name)\n }\n }\n } else if (rule instanceof ConstantNode) {\n // Literal constant must match exactly\n if (!equal(rule.value, node.value)) {\n return []\n }\n } else {\n // Some other node was encountered which we aren't prepared for, so no match\n return []\n }\n\n // It's a match!\n\n // console.log('_ruleMatch(' + rule.toString() + ', ' + node.toString() + ') found a match')\n return res\n }\n\n /**\n * Determines whether p and q (and all their children nodes) are identical.\n *\n * @param {ConstantNode | SymbolNode | ParenthesisNode | FunctionNode | OperatorNode} p\n * @param {ConstantNode | SymbolNode | ParenthesisNode | FunctionNode | OperatorNode} q\n * @return {Object} Information about the match, if it exists.\n */\n function _exactMatch (p, q) {\n if (p instanceof ConstantNode && q instanceof ConstantNode) {\n if (!equal(p.value, q.value)) {\n return false\n }\n } else if (p instanceof SymbolNode && q instanceof SymbolNode) {\n if (p.name !== q.name) {\n return false\n }\n } else if ((p instanceof OperatorNode && q instanceof OperatorNode) ||\n (p instanceof FunctionNode && q instanceof FunctionNode)) {\n if (p instanceof OperatorNode) {\n if (p.op !== q.op || p.fn !== q.fn) {\n return false\n }\n } else if (p instanceof FunctionNode) {\n if (p.name !== q.name) {\n return false\n }\n }\n\n if (p.args.length !== q.args.length) {\n return false\n }\n\n for (let i = 0; i < p.args.length; i++) {\n if (!_exactMatch(p.args[i], q.args[i])) {\n return false\n }\n }\n } else {\n return false\n }\n\n return true\n }\n\n return simplify\n})\n","import { isFraction, isMatrix, isNode, isArrayNode, isConstantNode, isIndexNode, isObjectNode, isOperatorNode } from '../../utils/is.js'\nimport { factory } from '../../utils/factory.js'\nimport { safeNumberType } from '../../utils/number.js'\nimport { createUtil } from './simplify/util.js'\nimport { noBignumber, noFraction } from '../../utils/noop.js'\n\nconst name = 'simplifyConstant'\nconst dependencies = [\n 'typed',\n 'config',\n 'mathWithTransform',\n 'matrix',\n '?fraction',\n '?bignumber',\n 'AccessorNode',\n 'ArrayNode',\n 'ConstantNode',\n 'FunctionNode',\n 'IndexNode',\n 'ObjectNode',\n 'OperatorNode',\n 'SymbolNode'\n]\n\nexport const createSimplifyConstant = /* #__PURE__ */ factory(name, dependencies, ({\n typed,\n config,\n mathWithTransform,\n matrix,\n fraction,\n bignumber,\n AccessorNode,\n ArrayNode,\n ConstantNode,\n FunctionNode,\n IndexNode,\n ObjectNode,\n OperatorNode,\n SymbolNode\n}) => {\n const { isCommutative, isAssociative, allChildren, createMakeNodeFunction } =\n createUtil({ FunctionNode, OperatorNode, SymbolNode })\n\n /**\n * simplifyConstant() takes a mathjs expression (either a Node representing\n * a parse tree or a string which it parses to produce a node), and replaces\n * any subexpression of it consisting entirely of constants with the computed\n * value of that subexpression.\n *\n * Syntax:\n *\n * math.simplifyConstant(expr)\n * math.simplifyConstant(expr, options)\n *\n * Examples:\n *\n * math.simplifyConstant('x + 4*3/6') // Node \"x + 2\"\n * math.simplifyConstant('z cos(0)') // Node \"z 1\"\n * math.simplifyConstant('(5.2 + 1.08)t', {exactFractions: false}) // Node \"6.28 t\"\n *\n * See also:\n *\n * simplify, simplifyCore, resolve, derivative\n *\n * @param {Node | string} node\n * The expression to be simplified\n * @param {Object} options\n * Simplification options, as per simplify()\n * @return {Node} Returns expression with constant subexpressions evaluated\n */\n const simplifyConstant = typed('simplifyConstant', {\n Node: node => _ensureNode(foldFraction(node, {})),\n\n 'Node, Object': function (expr, options) {\n return _ensureNode(foldFraction(expr, options))\n }\n })\n\n function _removeFractions (thing) {\n if (isFraction(thing)) {\n return thing.valueOf()\n }\n if (thing instanceof Array) {\n return thing.map(_removeFractions)\n }\n if (isMatrix(thing)) {\n return matrix(_removeFractions(thing.valueOf()))\n }\n return thing\n }\n\n function _eval (fnname, args, options) {\n try {\n return mathWithTransform[fnname].apply(null, args)\n } catch (ignore) {\n // sometimes the implicit type conversion causes the evaluation to fail, so we'll try again after removing Fractions\n args = args.map(_removeFractions)\n return _toNumber(mathWithTransform[fnname].apply(null, args), options)\n }\n }\n\n const _toNode = typed({\n Fraction: _fractionToNode,\n number: function (n) {\n if (n < 0) {\n return unaryMinusNode(new ConstantNode(-n))\n }\n return new ConstantNode(n)\n },\n BigNumber: function (n) {\n if (n < 0) {\n return unaryMinusNode(new ConstantNode(-n))\n }\n return new ConstantNode(n) // old parameters: (n.toString(), 'number')\n },\n bigint: function (n) {\n if (n < 0n) {\n return unaryMinusNode(new ConstantNode(-n))\n }\n return new ConstantNode(n)\n },\n Complex: function (s) {\n throw new Error('Cannot convert Complex number to Node')\n },\n string: function (s) {\n return new ConstantNode(s)\n },\n Matrix: function (m) {\n return new ArrayNode(m.valueOf().map(e => _toNode(e)))\n }\n })\n\n function _ensureNode (thing) {\n if (isNode(thing)) {\n return thing\n }\n return _toNode(thing)\n }\n\n // convert a number to a fraction only if it can be expressed exactly,\n // and when both numerator and denominator are small enough\n function _exactFraction (n, options) {\n const exactFractions = (options && options.exactFractions !== false)\n if (exactFractions && isFinite(n) && fraction) {\n const f = fraction(n)\n const fractionsLimit = (options && typeof options.fractionsLimit === 'number')\n ? options.fractionsLimit\n : Infinity // no limit by default\n\n if (f.valueOf() === n && f.n < fractionsLimit && f.d < fractionsLimit) {\n return f\n }\n }\n return n\n }\n\n // Convert numbers to a preferred number type in preference order: Fraction, number, Complex\n // BigNumbers are left alone\n const _toNumber = typed({\n 'string, Object': function (s, options) {\n const numericType = safeNumberType(s, config)\n\n if (numericType === 'BigNumber') {\n if (bignumber === undefined) {\n noBignumber()\n }\n return bignumber(s)\n } else if (numericType === 'bigint') {\n return BigInt(s)\n } else if (numericType === 'Fraction') {\n if (fraction === undefined) {\n noFraction()\n }\n return fraction(s)\n } else {\n const n = parseFloat(s)\n return _exactFraction(n, options)\n }\n },\n\n 'Fraction, Object': function (s, options) { return s }, // we don't need options here\n\n 'BigNumber, Object': function (s, options) { return s }, // we don't need options here\n\n 'number, Object': function (s, options) {\n return _exactFraction(s, options)\n },\n\n 'bigint, Object': function (s, options) {\n return s\n },\n\n 'Complex, Object': function (s, options) {\n if (s.im !== 0) {\n return s\n }\n return _exactFraction(s.re, options)\n },\n\n 'Matrix, Object': function (s, options) {\n return matrix(_exactFraction(s.valueOf()))\n },\n\n 'Array, Object': function (s, options) {\n return s.map(_exactFraction)\n }\n })\n\n function unaryMinusNode (n) {\n return new OperatorNode('-', 'unaryMinus', [n])\n }\n\n function _fractionToNode (f) {\n // note: we convert await from bigint values, because bigint values gives issues with divisions: 1n/2n=0n and not 0.5\n const fromBigInt = (value) => config.number === 'BigNumber' && bignumber ? bignumber(value) : Number(value)\n\n const numeratorValue = f.s * f.n\n const numeratorNode = (numeratorValue < 0n)\n ? new OperatorNode('-', 'unaryMinus', [new ConstantNode(-fromBigInt(numeratorValue))])\n : new ConstantNode(fromBigInt(numeratorValue))\n\n return (f.d === 1n)\n ? numeratorNode\n : new OperatorNode('/', 'divide', [numeratorNode, new ConstantNode(fromBigInt(f.d))])\n }\n\n /* Handles constant indexing of ArrayNodes, matrices, and ObjectNodes */\n function _foldAccessor (obj, index, options) {\n if (!isIndexNode(index)) { // don't know what to do with that...\n return new AccessorNode(_ensureNode(obj), _ensureNode(index))\n }\n if (isArrayNode(obj) || isMatrix(obj)) {\n const remainingDims = Array.from(index.dimensions)\n /* We will resolve constant indices one at a time, looking\n * just in the first or second dimensions because (a) arrays\n * of more than two dimensions are likely rare, and (b) pulling\n * out the third or higher dimension would be pretty intricate.\n * The price is that we miss simplifying [..3d array][x,y,1]\n */\n while (remainingDims.length > 0) {\n if (isConstantNode(remainingDims[0]) &&\n typeof remainingDims[0].value !== 'string') {\n const first = _toNumber(remainingDims.shift().value, options)\n if (isArrayNode(obj)) {\n obj = obj.items[first - 1]\n } else { // matrix\n obj = obj.valueOf()[first - 1]\n if (obj instanceof Array) {\n obj = matrix(obj)\n }\n }\n } else if (remainingDims.length > 1 &&\n isConstantNode(remainingDims[1]) &&\n typeof remainingDims[1].value !== 'string') {\n const second = _toNumber(remainingDims[1].value, options)\n const tryItems = []\n const fromItems = isArrayNode(obj) ? obj.items : obj.valueOf()\n for (const item of fromItems) {\n if (isArrayNode(item)) {\n tryItems.push(item.items[second - 1])\n } else if (isMatrix(obj)) {\n tryItems.push(item[second - 1])\n } else {\n break\n }\n }\n if (tryItems.length === fromItems.length) {\n if (isArrayNode(obj)) {\n obj = new ArrayNode(tryItems)\n } else { // matrix\n obj = matrix(tryItems)\n }\n remainingDims.splice(1, 1)\n } else { // extracting slice along 2nd dimension failed, give up\n break\n }\n } else { // neither 1st or 2nd dimension is constant, give up\n break\n }\n }\n if (remainingDims.length === index.dimensions.length) {\n /* No successful constant indexing */\n return new AccessorNode(_ensureNode(obj), index)\n }\n if (remainingDims.length > 0) {\n /* Indexed some but not all dimensions */\n index = new IndexNode(remainingDims)\n return new AccessorNode(_ensureNode(obj), index)\n }\n /* All dimensions were constant, access completely resolved */\n return obj\n }\n if (isObjectNode(obj) &&\n index.dimensions.length === 1 &&\n isConstantNode(index.dimensions[0])) {\n const key = index.dimensions[0].value\n if (key in obj.properties) {\n return obj.properties[key]\n }\n return new ConstantNode() // undefined\n }\n /* Don't know how to index this sort of obj, at least not with this index */\n return new AccessorNode(_ensureNode(obj), index)\n }\n\n /*\n * Create a binary tree from a list of Fractions and Nodes.\n * Tries to fold Fractions by evaluating them until the first Node in the list is hit, so\n * `args` should be sorted to have the Fractions at the start (if the operator is commutative).\n * @param args - list of Fractions and Nodes\n * @param fn - evaluator for the binary operation evaluator that accepts two Fractions\n * @param makeNode - creates a binary OperatorNode/FunctionNode from a list of child Nodes\n * if args.length is 1, returns args[0]\n * @return - Either a Node representing a binary expression or Fraction\n */\n function foldOp (fn, args, makeNode, options) {\n const first = args.shift()\n\n // In the following reduction, sofar always has one of the three following\n // forms: [NODE], [CONSTANT], or [NODE, CONSTANT]\n const reduction = args.reduce((sofar, next) => {\n if (!isNode(next)) {\n const last = sofar.pop()\n\n if (isNode(last)) {\n return [last, next]\n }\n // Two constants in a row, try to fold them into one\n try {\n sofar.push(_eval(fn, [last, next], options))\n return sofar\n } catch (ignoreandcontinue) {\n sofar.push(last)\n // fall through to Node case\n }\n }\n\n // Encountered a Node, or failed folding --\n // collapse everything so far into a single tree:\n sofar.push(_ensureNode(sofar.pop()))\n const newtree = (sofar.length === 1) ? sofar[0] : makeNode(sofar)\n return [makeNode([newtree, _ensureNode(next)])]\n }, [first])\n\n if (reduction.length === 1) {\n return reduction[0]\n }\n // Might end up with a tree and a constant at the end:\n return makeNode([reduction[0], _toNode(reduction[1])])\n }\n\n // destroys the original node and returns a folded one\n function foldFraction (node, options) {\n switch (node.type) {\n case 'SymbolNode':\n return node\n case 'ConstantNode':\n switch (typeof node.value) {\n case 'number': return _toNumber(node.value, options)\n case 'bigint': return _toNumber(node.value, options)\n case 'string': return node.value\n default:\n if (!isNaN(node.value)) return _toNumber(node.value, options)\n }\n return node\n case 'FunctionNode':\n if (mathWithTransform[node.name] && mathWithTransform[node.name].rawArgs) {\n return node\n }\n {\n // Process operators as OperatorNode\n const operatorFunctions = ['add', 'multiply']\n if (!operatorFunctions.includes(node.name)) {\n const args = node.args.map(arg => foldFraction(arg, options))\n\n // If all args are numbers\n if (!args.some(isNode)) {\n try {\n return _eval(node.name, args, options)\n } catch (ignoreandcontinue) { }\n }\n\n // Size of a matrix does not depend on entries\n if (node.name === 'size' &&\n args.length === 1 &&\n isArrayNode(args[0])) {\n const sz = []\n let section = args[0]\n while (isArrayNode(section)) {\n sz.push(section.items.length)\n section = section.items[0]\n }\n return matrix(sz)\n }\n\n // Convert all args to nodes and construct a symbolic function call\n return new FunctionNode(node.name, args.map(_ensureNode))\n } else {\n // treat as operator\n }\n }\n /* falls through */\n case 'OperatorNode':\n {\n const fn = node.fn.toString()\n let args\n let res\n const makeNode = createMakeNodeFunction(node)\n if (isOperatorNode(node) && node.isUnary()) {\n args = [foldFraction(node.args[0], options)]\n if (!isNode(args[0])) {\n res = _eval(fn, args, options)\n } else {\n res = makeNode(args)\n }\n } else if (isAssociative(node, options.context)) {\n args = allChildren(node, options.context)\n args = args.map(arg => foldFraction(arg, options))\n\n if (isCommutative(fn, options.context)) {\n // commutative binary operator\n const consts = []\n const vars = []\n\n for (let i = 0; i < args.length; i++) {\n if (!isNode(args[i])) {\n consts.push(args[i])\n } else {\n vars.push(args[i])\n }\n }\n\n if (consts.length > 1) {\n res = foldOp(fn, consts, makeNode, options)\n vars.unshift(res)\n res = foldOp(fn, vars, makeNode, options)\n } else {\n // we won't change the children order since it's not neccessary\n res = foldOp(fn, args, makeNode, options)\n }\n } else {\n // non-commutative binary operator\n res = foldOp(fn, args, makeNode, options)\n }\n } else {\n // non-associative binary operator\n args = node.args.map(arg => foldFraction(arg, options))\n res = foldOp(fn, args, makeNode, options)\n }\n return res\n }\n case 'ParenthesisNode':\n // remove the uneccessary parenthesis\n return foldFraction(node.content, options)\n case 'AccessorNode':\n return _foldAccessor(\n foldFraction(node.object, options),\n foldFraction(node.index, options),\n options)\n case 'ArrayNode': {\n const foldItems = node.items.map(item => foldFraction(item, options))\n if (foldItems.some(isNode)) {\n return new ArrayNode(foldItems.map(_ensureNode))\n }\n /* All literals -- return a Matrix so we can operate on it */\n return matrix(foldItems)\n }\n case 'IndexNode': {\n return new IndexNode(\n node.dimensions.map(n => simplifyConstant(n, options)))\n }\n case 'ObjectNode': {\n const foldProps = {}\n for (const prop in node.properties) {\n foldProps[prop] = simplifyConstant(node.properties[prop], options)\n }\n return new ObjectNode(foldProps)\n }\n case 'AssignmentNode':\n /* falls through */\n case 'BlockNode':\n /* falls through */\n case 'FunctionAssignmentNode':\n /* falls through */\n case 'RangeNode':\n /* falls through */\n case 'ConditionalNode':\n /* falls through */\n default:\n throw new Error(`Unimplemented node type in simplifyConstant: ${node.type}`)\n }\n }\n\n return simplifyConstant\n})\n","import { isAccessorNode, isArrayNode, isConstantNode, isFunctionNode, isIndexNode, isObjectNode, isOperatorNode } from '../../utils/is.js'\nimport { getOperator } from '../../expression/operators.js'\nimport { createUtil } from './simplify/util.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'simplifyCore'\nconst dependencies = [\n 'typed',\n 'parse',\n 'equal',\n 'isZero',\n 'add',\n 'subtract',\n 'multiply',\n 'divide',\n 'pow',\n 'AccessorNode',\n 'ArrayNode',\n 'ConstantNode',\n 'FunctionNode',\n 'IndexNode',\n 'ObjectNode',\n 'OperatorNode',\n 'ParenthesisNode',\n 'SymbolNode'\n]\n\nexport const createSimplifyCore = /* #__PURE__ */ factory(name, dependencies, ({\n typed,\n parse,\n equal,\n isZero,\n add,\n subtract,\n multiply,\n divide,\n pow,\n AccessorNode,\n ArrayNode,\n ConstantNode,\n FunctionNode,\n IndexNode,\n ObjectNode,\n OperatorNode,\n ParenthesisNode,\n SymbolNode\n}) => {\n const node0 = new ConstantNode(0)\n const node1 = new ConstantNode(1)\n const nodeT = new ConstantNode(true)\n const nodeF = new ConstantNode(false)\n // test if a node will always have a boolean value (true/false)\n // not sure if this list is complete\n function isAlwaysBoolean (node) {\n return isOperatorNode(node) && ['and', 'not', 'or'].includes(node.op)\n }\n\n const { hasProperty, isCommutative } =\n createUtil({ FunctionNode, OperatorNode, SymbolNode })\n /**\n * simplifyCore() performs single pass simplification suitable for\n * applications requiring ultimate performance. To roughly summarize,\n * it handles cases along the lines of simplifyConstant() but where\n * knowledge of a single argument is sufficient to determine the value.\n * In contrast, simplify() extends simplifyCore() with additional passes\n * to provide deeper simplification (such as gathering like terms).\n *\n * Specifically, simplifyCore:\n *\n * * Converts all function calls with operator equivalents to their\n * operator forms.\n * * Removes operators or function calls that are guaranteed to have no\n * effect (such as unary '+').\n * * Removes double unary '-', '~', and 'not'\n * * Eliminates addition/subtraction of 0 and multiplication/division/powers\n * by 1 or 0.\n * * Converts addition of a negation into subtraction.\n * * Eliminates logical operations with constant true or false leading\n * arguments.\n * * Puts constants on the left of a product, if multiplication is\n * considered commutative by the options (which is the default)\n *\n * Syntax:\n *\n * math.simplifyCore(expr)\n * math.simplifyCore(expr, options)\n *\n * Examples:\n *\n * const f = math.parse('2 * 1 * x ^ (1 - 0)')\n * math.simplifyCore(f) // Node \"2 * x\"\n * math.simplify('2 * 1 * x ^ (1 - 0)', [math.simplifyCore]) // Node \"2 * x\"\n *\n * See also:\n *\n * simplify, simplifyConstant, resolve, derivative\n *\n * @param {Node | string} node\n * The expression to be simplified\n * @param {Object} options\n * Simplification options, as per simplify()\n * @return {Node} Returns expression with basic simplifications applied\n */\n function _simplifyCore (nodeToSimplify, options = {}) {\n const context = options ? options.context : undefined\n if (hasProperty(nodeToSimplify, 'trivial', context)) {\n // This node does nothing if it has only one argument, so if so,\n // return that argument simplified\n if (isFunctionNode(nodeToSimplify) && nodeToSimplify.args.length === 1) {\n return _simplifyCore(nodeToSimplify.args[0], options)\n }\n // For other node types, we try the generic methods\n let simpChild = false\n let childCount = 0\n nodeToSimplify.forEach(c => {\n ++childCount\n if (childCount === 1) {\n simpChild = _simplifyCore(c, options)\n }\n })\n if (childCount === 1) {\n return simpChild\n }\n }\n let node = nodeToSimplify\n if (isFunctionNode(node)) {\n const op = getOperator(node.name)\n if (op) {\n // Replace FunctionNode with a new OperatorNode\n if (node.args.length > 2 && hasProperty(node, 'associative', context)) {\n // unflatten into binary operations since that's what simplifyCore handles\n while (node.args.length > 2) {\n const last = node.args.pop()\n const seclast = node.args.pop()\n node.args.push(new OperatorNode(op, node.name, [last, seclast]))\n }\n }\n node = new OperatorNode(op, node.name, node.args)\n } else {\n return new FunctionNode(\n _simplifyCore(node.fn), node.args.map(n => _simplifyCore(n, options)))\n }\n }\n if (isOperatorNode(node) && node.isUnary()) {\n const a0 = _simplifyCore(node.args[0], options)\n\n if (node.op === '~') { // bitwise not\n if (isOperatorNode(a0) && a0.isUnary() && a0.op === '~') {\n return a0.args[0]\n }\n }\n if (node.op === 'not') { // logical not\n if (isOperatorNode(a0) && a0.isUnary() && a0.op === 'not') {\n // Has the effect of turning the argument into a boolean\n // So can only eliminate the double negation if\n // the inside is already boolean\n if (isAlwaysBoolean(a0.args[0])) {\n return a0.args[0]\n }\n }\n }\n let finish = true\n if (node.op === '-') { // unary minus\n if (isOperatorNode(a0)) {\n if (a0.isBinary() && a0.fn === 'subtract') {\n node = new OperatorNode('-', 'subtract', [a0.args[1], a0.args[0]])\n finish = false // continue to process the new binary node\n }\n if (a0.isUnary() && a0.op === '-') {\n return a0.args[0]\n }\n }\n }\n if (finish) return new OperatorNode(node.op, node.fn, [a0])\n }\n if (isOperatorNode(node) && node.isBinary()) {\n const a0 = _simplifyCore(node.args[0], options)\n let a1 = _simplifyCore(node.args[1], options)\n\n if (node.op === '+') {\n if (isConstantNode(a0) && isZero(a0.value)) {\n return a1\n }\n if (isConstantNode(a1) && isZero(a1.value)) {\n return a0\n }\n if (isOperatorNode(a1) && a1.isUnary() && a1.op === '-') {\n a1 = a1.args[0]\n node = new OperatorNode('-', 'subtract', [a0, a1])\n }\n }\n if (node.op === '-') {\n if (isOperatorNode(a1) && a1.isUnary() && a1.op === '-') {\n return _simplifyCore(\n new OperatorNode('+', 'add', [a0, a1.args[0]]), options)\n }\n if (isConstantNode(a0) && isZero(a0.value)) {\n return _simplifyCore(new OperatorNode('-', 'unaryMinus', [a1]))\n }\n if (isConstantNode(a1) && isZero(a1.value)) {\n return a0\n }\n return new OperatorNode(node.op, node.fn, [a0, a1])\n }\n if (node.op === '*') {\n if (isConstantNode(a0)) {\n if (isZero(a0.value)) {\n return node0\n } else if (equal(a0.value, 1)) {\n return a1\n }\n }\n if (isConstantNode(a1)) {\n if (isZero(a1.value)) {\n return node0\n } else if (equal(a1.value, 1)) {\n return a0\n }\n if (isCommutative(node, context)) {\n return new OperatorNode(node.op, node.fn, [a1, a0], node.implicit) // constants on left\n }\n }\n return new OperatorNode(node.op, node.fn, [a0, a1], node.implicit)\n }\n if (node.op === '/') {\n if (isConstantNode(a0) && isZero(a0.value)) {\n return node0\n }\n if (isConstantNode(a1) && equal(a1.value, 1)) {\n return a0\n }\n return new OperatorNode(node.op, node.fn, [a0, a1])\n }\n if (node.op === '^') {\n if (isConstantNode(a1)) {\n if (isZero(a1.value)) {\n return node1\n } else if (equal(a1.value, 1)) {\n return a0\n }\n }\n }\n if (node.op === 'and') {\n if (isConstantNode(a0)) {\n if (a0.value) {\n if (isAlwaysBoolean(a1)) return a1\n if (isConstantNode(a1)) {\n return a1.value ? nodeT : nodeF\n }\n } else {\n return nodeF\n }\n }\n if (isConstantNode(a1)) {\n if (a1.value) {\n if (isAlwaysBoolean(a0)) return a0\n } else {\n return nodeF\n }\n }\n }\n if (node.op === 'or') {\n if (isConstantNode(a0)) {\n if (a0.value) {\n return nodeT\n } else {\n if (isAlwaysBoolean(a1)) return a1\n }\n }\n if (isConstantNode(a1)) {\n if (a1.value) {\n return nodeT\n } else {\n if (isAlwaysBoolean(a0)) return a0\n }\n }\n }\n return new OperatorNode(node.op, node.fn, [a0, a1])\n }\n if (isOperatorNode(node)) {\n return new OperatorNode(\n node.op, node.fn, node.args.map(a => _simplifyCore(a, options)))\n }\n if (isArrayNode(node)) {\n return new ArrayNode(node.items.map(n => _simplifyCore(n, options)))\n }\n if (isAccessorNode(node)) {\n return new AccessorNode(\n _simplifyCore(node.object, options), _simplifyCore(node.index, options))\n }\n if (isIndexNode(node)) {\n return new IndexNode(\n node.dimensions.map(n => _simplifyCore(n, options)))\n }\n if (isObjectNode(node)) {\n const newProps = {}\n for (const prop in node.properties) {\n newProps[prop] = _simplifyCore(node.properties[prop], options)\n }\n return new ObjectNode(newProps)\n }\n // cannot simplify\n return node\n }\n\n return typed(name, { Node: _simplifyCore, 'Node,Object': _simplifyCore })\n})\n","import { createMap } from '../../utils/map.js'\nimport { isFunctionNode, isNode, isOperatorNode, isParenthesisNode, isSymbolNode } from '../../utils/is.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'resolve'\nconst dependencies = [\n 'typed',\n 'parse',\n 'ConstantNode',\n 'FunctionNode',\n 'OperatorNode',\n 'ParenthesisNode'\n]\n\nexport const createResolve = /* #__PURE__ */ factory(name, dependencies, ({\n typed,\n parse,\n ConstantNode,\n FunctionNode,\n OperatorNode,\n ParenthesisNode\n}) => {\n /**\n * resolve(expr, scope) replaces variable nodes with their scoped values\n *\n * Syntax:\n *\n * math.resolve(expr, scope)\n *\n * Examples:\n *\n * math.resolve('x + y', {x:1, y:2}) // Node '1 + 2'\n * math.resolve(math.parse('x+y'), {x:1, y:2}) // Node '1 + 2'\n * math.simplify('x+y', {x:2, y: math.parse('x+x')}).toString() // \"6\"\n *\n * See also:\n *\n * simplify, evaluate\n *\n * @param {Node | Node[]} node\n * The expression tree (or trees) to be simplified\n * @param {Object} scope\n * Scope specifying variables to be resolved\n * @return {Node | Node[]} Returns `node` with variables recursively substituted.\n * @throws {ReferenceError}\n * If there is a cyclic dependency among the variables in `scope`,\n * resolution is impossible and a ReferenceError is thrown.\n */\n function _resolve (node, scope, within = new Set()) { // note `within`:\n // `within` is not documented, since it is for internal cycle\n // detection only\n if (!scope) {\n return node\n }\n if (isSymbolNode(node)) {\n if (within.has(node.name)) {\n const variables = Array.from(within).join(', ')\n throw new ReferenceError(\n `recursive loop of variable definitions among {${variables}}`\n )\n }\n const value = scope.get(node.name)\n if (isNode(value)) {\n const nextWithin = new Set(within)\n nextWithin.add(node.name)\n return _resolve(value, scope, nextWithin)\n } else if (typeof value === 'number') {\n return parse(String(value))\n } else if (value !== undefined) {\n return new ConstantNode(value)\n } else {\n return node\n }\n } else if (isOperatorNode(node)) {\n const args = node.args.map(function (arg) {\n return _resolve(arg, scope, within)\n })\n return new OperatorNode(node.op, node.fn, args, node.implicit)\n } else if (isParenthesisNode(node)) {\n return new ParenthesisNode(_resolve(node.content, scope, within))\n } else if (isFunctionNode(node)) {\n const args = node.args.map(function (arg) {\n return _resolve(arg, scope, within)\n })\n return new FunctionNode(node.name, args)\n }\n\n // Otherwise just recursively resolve any children (might also work\n // for some of the above special cases)\n return node.map(child => _resolve(child, scope, within))\n }\n\n return typed('resolve', {\n Node: _resolve,\n 'Node, Map | null | undefined': _resolve,\n 'Node, Object': (n, scope) => _resolve(n, createMap(scope)),\n // For arrays and matrices, we map `self` rather than `_resolve`\n // because resolve is fairly expensive anyway, and this way\n // we get nice error messages if one entry in the array has wrong type.\n 'Array | Matrix': typed.referToSelf(self => A => A.map(n => self(n))),\n 'Array | Matrix, null | undefined': typed.referToSelf(\n self => A => A.map(n => self(n))),\n 'Array, Object': typed.referTo(\n 'Array,Map', selfAM => (A, scope) => selfAM(A, createMap(scope))),\n 'Matrix, Object': typed.referTo(\n 'Matrix,Map', selfMM => (A, scope) => selfMM(A, createMap(scope))),\n 'Array | Matrix, Map': typed.referToSelf(\n self => (A, scope) => A.map(n => self(n, scope)))\n })\n})\n","import { isConstantNode } from '../../utils/is.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'symbolicEqual'\nconst dependencies = [\n 'parse',\n 'simplify',\n 'typed',\n 'OperatorNode'\n]\n\nexport const createSymbolicEqual = /* #__PURE__ */ factory(name, dependencies, ({\n parse,\n simplify,\n typed,\n OperatorNode\n}) => {\n /**\n * Attempts to determine if two expressions are symbolically equal, i.e.\n * one is the result of valid algebraic manipulations on the other.\n * Currently, this simply checks if the difference of the two expressions\n * simplifies down to 0. So there are two important caveats:\n * 1. whether two expressions are symbolically equal depends on the\n * manipulations allowed. Therefore, this function takes an optional\n * third argument, which are the options that control the behavior\n * as documented for the `simplify()` function.\n * 2. it is in general intractable to find the minimal simplification of\n * an arbitrarily complicated expression. So while a `true` value\n * of `symbolicEqual` ensures that the two expressions can be manipulated\n * to match each other, a `false` value does not absolutely rule this out.\n *\n * Syntax:\n *\n * math.symbolicEqual(expr1, expr2)\n * math.symbolicEqual(expr1, expr2, options)\n *\n * Examples:\n *\n * math.symbolicEqual('x*y', 'y*x') // Returns true\n * math.symbolicEqual('x*y', 'y*x', {context: {multiply: {commutative: false}}}) // Returns false\n * math.symbolicEqual('x/y', '(y*x^(-1))^(-1)') // Returns true\n * math.symbolicEqual('abs(x)','x') // Returns false\n * math.symbolicEqual('abs(x)','x', simplify.positiveContext) // Returns true\n *\n * See also:\n *\n * simplify, evaluate\n *\n * @param {Node|string} expr1 The first expression to compare\n * @param {Node|string} expr2 The second expression to compare\n * @param {Object} [options] Optional option object, passed to simplify\n * @returns {boolean}\n * Returns true if a valid manipulation making the expressions equal\n * is found.\n */\n function _symbolicEqual (e1, e2, options = {}) {\n const diff = new OperatorNode('-', 'subtract', [e1, e2])\n const simplified = simplify(diff, {}, options)\n return (isConstantNode(simplified) && !(simplified.value))\n }\n\n return typed(name, {\n 'Node, Node': _symbolicEqual,\n 'Node, Node, Object': _symbolicEqual\n })\n})\n","import { isConstantNode, typeOf } from '../../utils/is.js'\nimport { factory } from '../../utils/factory.js'\nimport { safeNumberType } from '../../utils/number.js'\n\nconst name = 'derivative'\nconst dependencies = [\n 'typed',\n 'config',\n 'parse',\n 'simplify',\n 'equal',\n 'isZero',\n 'numeric',\n 'ConstantNode',\n 'FunctionNode',\n 'OperatorNode',\n 'ParenthesisNode',\n 'SymbolNode'\n]\n\nexport const createDerivative = /* #__PURE__ */ factory(name, dependencies, ({\n typed,\n config,\n parse,\n simplify,\n equal,\n isZero,\n numeric,\n ConstantNode,\n FunctionNode,\n OperatorNode,\n ParenthesisNode,\n SymbolNode\n}) => {\n /**\n * Takes the derivative of an expression expressed in parser Nodes.\n * The derivative will be taken over the supplied variable in the\n * second parameter. If there are multiple variables in the expression,\n * it will return a partial derivative.\n *\n * This uses rules of differentiation which can be found here:\n *\n * - [Differentiation rules (Wikipedia)](https://en.wikipedia.org/wiki/Differentiation_rules)\n *\n * Syntax:\n *\n * math.derivative(expr, variable)\n * math.derivative(expr, variable, options)\n *\n * Examples:\n *\n * math.derivative('x^2', 'x') // Node '2 * x'\n * math.derivative('x^2', 'x', {simplify: false}) // Node '2 * 1 * x ^ (2 - 1)'\n * math.derivative('sin(2x)', 'x')) // Node '2 * cos(2 * x)'\n * math.derivative('2*x', 'x').evaluate() // number 2\n * math.derivative('x^2', 'x').evaluate({x: 4}) // number 8\n * const f = math.parse('x^2')\n * const x = math.parse('x')\n * math.derivative(f, x) // Node {2 * x}\n *\n * See also:\n *\n * simplify, parse, evaluate\n *\n * @param {Node | string} expr The expression to differentiate\n * @param {SymbolNode | string} variable The variable over which to differentiate\n * @param {{simplify: boolean}} [options]\n * There is one option available, `simplify`, which\n * is true by default. When false, output will not\n * be simplified.\n * @return {ConstantNode | SymbolNode | ParenthesisNode | FunctionNode | OperatorNode} The derivative of `expr`\n */\n function plainDerivative (expr, variable, options = { simplify: true }) {\n const cache = new Map()\n const variableName = variable.name\n function isConstCached (node) {\n const cached = cache.get(node)\n if (cached !== undefined) {\n return cached\n }\n const res = _isConst(isConstCached, node, variableName)\n cache.set(node, res)\n return res\n }\n\n const res = _derivative(expr, isConstCached)\n return options.simplify ? simplify(res) : res\n }\n\n function parseIdentifier (string) {\n const symbol = parse(string)\n if (!symbol.isSymbolNode) {\n throw new TypeError('Invalid variable. ' +\n `Cannot parse ${JSON.stringify(string)} into a variable in function derivative`)\n }\n return symbol\n }\n\n const derivative = typed(name, {\n 'Node, SymbolNode': plainDerivative,\n 'Node, SymbolNode, Object': plainDerivative,\n 'Node, string': (node, symbol) => plainDerivative(node, parseIdentifier(symbol)),\n 'Node, string, Object': (node, symbol, options) => plainDerivative(node, parseIdentifier(symbol), options)\n\n /* TODO: implement and test syntax with order of derivatives -> implement as an option {order: number}\n 'Node, SymbolNode, ConstantNode': function (expr, variable, {order}) {\n let res = expr\n for (let i = 0; i < order; i++) {\n \n res = _derivative(res, isConst)\n }\n return res\n }\n */\n })\n\n derivative._simplify = true\n\n derivative.toTex = function (deriv) {\n return _derivTex.apply(null, deriv.args)\n }\n\n // FIXME: move the toTex method of derivative to latex.js. Difficulty is that it relies on parse.\n // NOTE: the optional \"order\" parameter here is currently unused\n const _derivTex = typed('_derivTex', {\n 'Node, SymbolNode': function (expr, x) {\n if (isConstantNode(expr) && typeOf(expr.value) === 'string') {\n return _derivTex(parse(expr.value).toString(), x.toString(), 1)\n } else {\n return _derivTex(expr.toTex(), x.toString(), 1)\n }\n },\n 'Node, ConstantNode': function (expr, x) {\n if (typeOf(x.value) === 'string') {\n return _derivTex(expr, parse(x.value))\n } else {\n throw new Error(\"The second parameter to 'derivative' is a non-string constant\")\n }\n },\n 'Node, SymbolNode, ConstantNode': function (expr, x, order) {\n return _derivTex(expr.toString(), x.name, order.value)\n },\n 'string, string, number': function (expr, x, order) {\n let d\n if (order === 1) {\n d = '{d\\\\over d' + x + '}'\n } else {\n d = '{d^{' + order + '}\\\\over d' + x + '^{' + order + '}}'\n }\n return d + `\\\\left[${expr}\\\\right]`\n }\n })\n\n /**\n * Checks if a node is constants (e.g. 2 + 2).\n * Accepts (usually memoized) version of self as the first parameter for recursive calls.\n * Classification is done as follows:\n *\n * 1. ConstantNodes are constants.\n * 2. If there exists a SymbolNode, of which we are differentiating over,\n * in the subtree it is not constant.\n *\n * @param {function} isConst Function that tells whether sub-expression is a constant\n * @param {ConstantNode | SymbolNode | ParenthesisNode | FunctionNode | OperatorNode} node\n * @param {string} varName Variable that we are differentiating\n * @return {boolean} if node is constant\n */\n const _isConst = typed('_isConst', {\n 'function, ConstantNode, string': function () {\n return true\n },\n\n 'function, SymbolNode, string': function (isConst, node, varName) {\n // Treat other variables like constants. For reasoning, see:\n // https://en.wikipedia.org/wiki/Partial_derivative\n return node.name !== varName\n },\n\n 'function, ParenthesisNode, string': function (isConst, node, varName) {\n return isConst(node.content, varName)\n },\n\n 'function, FunctionAssignmentNode, string': function (isConst, node, varName) {\n if (!node.params.includes(varName)) {\n return true\n }\n return isConst(node.expr, varName)\n },\n\n 'function, FunctionNode | OperatorNode, string': function (isConst, node, varName) {\n return node.args.every(arg => isConst(arg, varName))\n }\n })\n\n /**\n * Applies differentiation rules.\n *\n * @param {ConstantNode | SymbolNode | ParenthesisNode | FunctionNode | OperatorNode} node\n * @param {function} isConst Function that tells if a node is constant\n * @return {ConstantNode | SymbolNode | ParenthesisNode | FunctionNode | OperatorNode} The derivative of `expr`\n */\n const _derivative = typed('_derivative', {\n 'ConstantNode, function': function () {\n return createConstantNode(0)\n },\n\n 'SymbolNode, function': function (node, isConst) {\n if (isConst(node)) {\n return createConstantNode(0)\n }\n return createConstantNode(1)\n },\n\n 'ParenthesisNode, function': function (node, isConst) {\n return new ParenthesisNode(_derivative(node.content, isConst))\n },\n\n 'FunctionAssignmentNode, function': function (node, isConst) {\n if (isConst(node)) {\n return createConstantNode(0)\n }\n return _derivative(node.expr, isConst)\n },\n\n 'FunctionNode, function': function (node, isConst) {\n if (isConst(node)) {\n return createConstantNode(0)\n }\n\n const arg0 = node.args[0]\n let arg1\n\n let div = false // is output a fraction?\n let negative = false // is output negative?\n\n let funcDerivative\n switch (node.name) {\n case 'cbrt':\n // d/dx(cbrt(x)) = 1 / (3x^(2/3))\n div = true\n funcDerivative = new OperatorNode('*', 'multiply', [\n createConstantNode(3),\n new OperatorNode('^', 'pow', [\n arg0,\n new OperatorNode('/', 'divide', [\n createConstantNode(2),\n createConstantNode(3)\n ])\n ])\n ])\n break\n case 'sqrt':\n case 'nthRoot':\n // d/dx(sqrt(x)) = 1 / (2*sqrt(x))\n if (node.args.length === 1) {\n div = true\n funcDerivative = new OperatorNode('*', 'multiply', [\n createConstantNode(2),\n new FunctionNode('sqrt', [arg0])\n ])\n } else if (node.args.length === 2) {\n // Rearrange from nthRoot(x, a) -> x^(1/a)\n arg1 = new OperatorNode('/', 'divide', [\n createConstantNode(1),\n node.args[1]\n ])\n\n return _derivative(new OperatorNode('^', 'pow', [arg0, arg1]), isConst)\n }\n break\n case 'log10':\n arg1 = createConstantNode(10)\n /* fall through! */\n case 'log':\n if (!arg1 && node.args.length === 1) {\n // d/dx(log(x)) = 1 / x\n funcDerivative = arg0.clone()\n div = true\n } else if ((node.args.length === 1 && arg1) ||\n (node.args.length === 2 && isConst(node.args[1]))) {\n // d/dx(log(x, c)) = 1 / (x*ln(c))\n funcDerivative = new OperatorNode('*', 'multiply', [\n arg0.clone(),\n new FunctionNode('log', [arg1 || node.args[1]])\n ])\n div = true\n } else if (node.args.length === 2) {\n // d/dx(log(f(x), g(x))) = d/dx(log(f(x)) / log(g(x)))\n return _derivative(new OperatorNode('/', 'divide', [\n new FunctionNode('log', [arg0]),\n new FunctionNode('log', [node.args[1]])\n ]), isConst)\n }\n break\n case 'pow':\n if (node.args.length === 2) {\n // Pass to pow operator node parser\n return _derivative(new OperatorNode('^', 'pow', [arg0, node.args[1]]), isConst)\n }\n break\n case 'exp':\n // d/dx(e^x) = e^x\n funcDerivative = new FunctionNode('exp', [arg0.clone()])\n break\n case 'sin':\n // d/dx(sin(x)) = cos(x)\n funcDerivative = new FunctionNode('cos', [arg0.clone()])\n break\n case 'cos':\n // d/dx(cos(x)) = -sin(x)\n funcDerivative = new OperatorNode('-', 'unaryMinus', [\n new FunctionNode('sin', [arg0.clone()])\n ])\n break\n case 'tan':\n // d/dx(tan(x)) = sec(x)^2\n funcDerivative = new OperatorNode('^', 'pow', [\n new FunctionNode('sec', [arg0.clone()]),\n createConstantNode(2)\n ])\n break\n case 'sec':\n // d/dx(sec(x)) = sec(x)tan(x)\n funcDerivative = new OperatorNode('*', 'multiply', [\n node,\n new FunctionNode('tan', [arg0.clone()])\n ])\n break\n case 'csc':\n // d/dx(csc(x)) = -csc(x)cot(x)\n negative = true\n funcDerivative = new OperatorNode('*', 'multiply', [\n node,\n new FunctionNode('cot', [arg0.clone()])\n ])\n break\n case 'cot':\n // d/dx(cot(x)) = -csc(x)^2\n negative = true\n funcDerivative = new OperatorNode('^', 'pow', [\n new FunctionNode('csc', [arg0.clone()]),\n createConstantNode(2)\n ])\n break\n case 'asin':\n // d/dx(asin(x)) = 1 / sqrt(1 - x^2)\n div = true\n funcDerivative = new FunctionNode('sqrt', [\n new OperatorNode('-', 'subtract', [\n createConstantNode(1),\n new OperatorNode('^', 'pow', [\n arg0.clone(),\n createConstantNode(2)\n ])\n ])\n ])\n break\n case 'acos':\n // d/dx(acos(x)) = -1 / sqrt(1 - x^2)\n div = true\n negative = true\n funcDerivative = new FunctionNode('sqrt', [\n new OperatorNode('-', 'subtract', [\n createConstantNode(1),\n new OperatorNode('^', 'pow', [\n arg0.clone(),\n createConstantNode(2)\n ])\n ])\n ])\n break\n case 'atan':\n // d/dx(atan(x)) = 1 / (x^2 + 1)\n div = true\n funcDerivative = new OperatorNode('+', 'add', [\n new OperatorNode('^', 'pow', [\n arg0.clone(),\n createConstantNode(2)\n ]),\n createConstantNode(1)\n ])\n break\n case 'asec':\n // d/dx(asec(x)) = 1 / (|x|*sqrt(x^2 - 1))\n div = true\n funcDerivative = new OperatorNode('*', 'multiply', [\n new FunctionNode('abs', [arg0.clone()]),\n new FunctionNode('sqrt', [\n new OperatorNode('-', 'subtract', [\n new OperatorNode('^', 'pow', [\n arg0.clone(),\n createConstantNode(2)\n ]),\n createConstantNode(1)\n ])\n ])\n ])\n break\n case 'acsc':\n // d/dx(acsc(x)) = -1 / (|x|*sqrt(x^2 - 1))\n div = true\n negative = true\n funcDerivative = new OperatorNode('*', 'multiply', [\n new FunctionNode('abs', [arg0.clone()]),\n new FunctionNode('sqrt', [\n new OperatorNode('-', 'subtract', [\n new OperatorNode('^', 'pow', [\n arg0.clone(),\n createConstantNode(2)\n ]),\n createConstantNode(1)\n ])\n ])\n ])\n break\n case 'acot':\n // d/dx(acot(x)) = -1 / (x^2 + 1)\n div = true\n negative = true\n funcDerivative = new OperatorNode('+', 'add', [\n new OperatorNode('^', 'pow', [\n arg0.clone(),\n createConstantNode(2)\n ]),\n createConstantNode(1)\n ])\n break\n case 'sinh':\n // d/dx(sinh(x)) = cosh(x)\n funcDerivative = new FunctionNode('cosh', [arg0.clone()])\n break\n case 'cosh':\n // d/dx(cosh(x)) = sinh(x)\n funcDerivative = new FunctionNode('sinh', [arg0.clone()])\n break\n case 'tanh':\n // d/dx(tanh(x)) = sech(x)^2\n funcDerivative = new OperatorNode('^', 'pow', [\n new FunctionNode('sech', [arg0.clone()]),\n createConstantNode(2)\n ])\n break\n case 'sech':\n // d/dx(sech(x)) = -sech(x)tanh(x)\n negative = true\n funcDerivative = new OperatorNode('*', 'multiply', [\n node,\n new FunctionNode('tanh', [arg0.clone()])\n ])\n break\n case 'csch':\n // d/dx(csch(x)) = -csch(x)coth(x)\n negative = true\n funcDerivative = new OperatorNode('*', 'multiply', [\n node,\n new FunctionNode('coth', [arg0.clone()])\n ])\n break\n case 'coth':\n // d/dx(coth(x)) = -csch(x)^2\n negative = true\n funcDerivative = new OperatorNode('^', 'pow', [\n new FunctionNode('csch', [arg0.clone()]),\n createConstantNode(2)\n ])\n break\n case 'asinh':\n // d/dx(asinh(x)) = 1 / sqrt(x^2 + 1)\n div = true\n funcDerivative = new FunctionNode('sqrt', [\n new OperatorNode('+', 'add', [\n new OperatorNode('^', 'pow', [\n arg0.clone(),\n createConstantNode(2)\n ]),\n createConstantNode(1)\n ])\n ])\n break\n case 'acosh':\n // d/dx(acosh(x)) = 1 / sqrt(x^2 - 1); XXX potentially only for x >= 1 (the real spectrum)\n div = true\n funcDerivative = new FunctionNode('sqrt', [\n new OperatorNode('-', 'subtract', [\n new OperatorNode('^', 'pow', [\n arg0.clone(),\n createConstantNode(2)\n ]),\n createConstantNode(1)\n ])\n ])\n break\n case 'atanh':\n // d/dx(atanh(x)) = 1 / (1 - x^2)\n div = true\n funcDerivative = new OperatorNode('-', 'subtract', [\n createConstantNode(1),\n new OperatorNode('^', 'pow', [\n arg0.clone(),\n createConstantNode(2)\n ])\n ])\n break\n case 'asech':\n // d/dx(asech(x)) = -1 / (x*sqrt(1 - x^2))\n div = true\n negative = true\n funcDerivative = new OperatorNode('*', 'multiply', [\n arg0.clone(),\n new FunctionNode('sqrt', [\n new OperatorNode('-', 'subtract', [\n createConstantNode(1),\n new OperatorNode('^', 'pow', [\n arg0.clone(),\n createConstantNode(2)\n ])\n ])\n ])\n ])\n break\n case 'acsch':\n // d/dx(acsch(x)) = -1 / (|x|*sqrt(x^2 + 1))\n div = true\n negative = true\n funcDerivative = new OperatorNode('*', 'multiply', [\n new FunctionNode('abs', [arg0.clone()]),\n new FunctionNode('sqrt', [\n new OperatorNode('+', 'add', [\n new OperatorNode('^', 'pow', [\n arg0.clone(),\n createConstantNode(2)\n ]),\n createConstantNode(1)\n ])\n ])\n ])\n break\n case 'acoth':\n // d/dx(acoth(x)) = -1 / (1 - x^2)\n div = true\n negative = true\n funcDerivative = new OperatorNode('-', 'subtract', [\n createConstantNode(1),\n new OperatorNode('^', 'pow', [\n arg0.clone(),\n createConstantNode(2)\n ])\n ])\n break\n case 'abs':\n // d/dx(abs(x)) = abs(x)/x\n funcDerivative = new OperatorNode('/', 'divide', [\n new FunctionNode(new SymbolNode('abs'), [arg0.clone()]),\n arg0.clone()\n ])\n break\n case 'gamma': // Needs digamma function, d/dx(gamma(x)) = gamma(x)digamma(x)\n default:\n throw new Error('Cannot process function \"' + node.name + '\" in derivative: ' +\n 'the function is not supported, undefined, or the number of arguments passed to it are not supported')\n }\n\n let op, func\n if (div) {\n op = '/'\n func = 'divide'\n } else {\n op = '*'\n func = 'multiply'\n }\n\n /* Apply chain rule to all functions:\n F(x) = f(g(x))\n F'(x) = g'(x)*f'(g(x)) */\n let chainDerivative = _derivative(arg0, isConst)\n if (negative) {\n chainDerivative = new OperatorNode('-', 'unaryMinus', [chainDerivative])\n }\n return new OperatorNode(op, func, [chainDerivative, funcDerivative])\n },\n\n 'OperatorNode, function': function (node, isConst) {\n if (isConst(node)) {\n return createConstantNode(0)\n }\n\n if (node.op === '+') {\n // d/dx(sum(f(x)) = sum(f'(x))\n return new OperatorNode(node.op, node.fn, node.args.map(function (arg) {\n return _derivative(arg, isConst)\n }))\n }\n\n if (node.op === '-') {\n // d/dx(+/-f(x)) = +/-f'(x)\n if (node.isUnary()) {\n return new OperatorNode(node.op, node.fn, [\n _derivative(node.args[0], isConst)\n ])\n }\n\n // Linearity of differentiation, d/dx(f(x) +/- g(x)) = f'(x) +/- g'(x)\n if (node.isBinary()) {\n return new OperatorNode(node.op, node.fn, [\n _derivative(node.args[0], isConst),\n _derivative(node.args[1], isConst)\n ])\n }\n }\n\n if (node.op === '*') {\n // d/dx(c*f(x)) = c*f'(x)\n const constantTerms = node.args.filter(function (arg) {\n return isConst(arg)\n })\n\n if (constantTerms.length > 0) {\n const nonConstantTerms = node.args.filter(function (arg) {\n return !isConst(arg)\n })\n\n const nonConstantNode = nonConstantTerms.length === 1\n ? nonConstantTerms[0]\n : new OperatorNode('*', 'multiply', nonConstantTerms)\n\n const newArgs = constantTerms.concat(_derivative(nonConstantNode, isConst))\n\n return new OperatorNode('*', 'multiply', newArgs)\n }\n\n // Product Rule, d/dx(f(x)*g(x)) = f'(x)*g(x) + f(x)*g'(x)\n return new OperatorNode('+', 'add', node.args.map(function (argOuter) {\n return new OperatorNode('*', 'multiply', node.args.map(function (argInner) {\n return (argInner === argOuter)\n ? _derivative(argInner, isConst)\n : argInner.clone()\n }))\n }))\n }\n\n if (node.op === '/' && node.isBinary()) {\n const arg0 = node.args[0]\n const arg1 = node.args[1]\n\n // d/dx(f(x) / c) = f'(x) / c\n if (isConst(arg1)) {\n return new OperatorNode('/', 'divide', [_derivative(arg0, isConst), arg1])\n }\n\n // Reciprocal Rule, d/dx(c / f(x)) = -c(f'(x)/f(x)^2)\n if (isConst(arg0)) {\n return new OperatorNode('*', 'multiply', [\n new OperatorNode('-', 'unaryMinus', [arg0]),\n new OperatorNode('/', 'divide', [\n _derivative(arg1, isConst),\n new OperatorNode('^', 'pow', [arg1.clone(), createConstantNode(2)])\n ])\n ])\n }\n\n // Quotient rule, d/dx(f(x) / g(x)) = (f'(x)g(x) - f(x)g'(x)) / g(x)^2\n return new OperatorNode('/', 'divide', [\n new OperatorNode('-', 'subtract', [\n new OperatorNode('*', 'multiply', [_derivative(arg0, isConst), arg1.clone()]),\n new OperatorNode('*', 'multiply', [arg0.clone(), _derivative(arg1, isConst)])\n ]),\n new OperatorNode('^', 'pow', [arg1.clone(), createConstantNode(2)])\n ])\n }\n\n if (node.op === '^' && node.isBinary()) {\n const arg0 = node.args[0]\n const arg1 = node.args[1]\n\n if (isConst(arg0)) {\n // If is secretly constant; 0^f(x) = 1 (in JS), 1^f(x) = 1\n if (isConstantNode(arg0) && (isZero(arg0.value) || equal(arg0.value, 1))) {\n return createConstantNode(0)\n }\n\n // d/dx(c^f(x)) = c^f(x)*ln(c)*f'(x)\n return new OperatorNode('*', 'multiply', [\n node,\n new OperatorNode('*', 'multiply', [\n new FunctionNode('log', [arg0.clone()]),\n _derivative(arg1.clone(), isConst)\n ])\n ])\n }\n\n if (isConst(arg1)) {\n if (isConstantNode(arg1)) {\n // If is secretly constant; f(x)^0 = 1 -> d/dx(1) = 0\n if (isZero(arg1.value)) {\n return createConstantNode(0)\n }\n // Ignore exponent; f(x)^1 = f(x)\n if (equal(arg1.value, 1)) {\n return _derivative(arg0, isConst)\n }\n }\n\n // Elementary Power Rule, d/dx(f(x)^c) = c*f'(x)*f(x)^(c-1)\n const powMinusOne = new OperatorNode('^', 'pow', [\n arg0.clone(),\n new OperatorNode('-', 'subtract', [\n arg1,\n createConstantNode(1)\n ])\n ])\n\n return new OperatorNode('*', 'multiply', [\n arg1.clone(),\n new OperatorNode('*', 'multiply', [\n _derivative(arg0, isConst),\n powMinusOne\n ])\n ])\n }\n\n // Functional Power Rule, d/dx(f^g) = f^g*[f'*(g/f) + g'ln(f)]\n return new OperatorNode('*', 'multiply', [\n new OperatorNode('^', 'pow', [arg0.clone(), arg1.clone()]),\n new OperatorNode('+', 'add', [\n new OperatorNode('*', 'multiply', [\n _derivative(arg0, isConst),\n new OperatorNode('/', 'divide', [arg1.clone(), arg0.clone()])\n ]),\n new OperatorNode('*', 'multiply', [\n _derivative(arg1, isConst),\n new FunctionNode('log', [arg0.clone()])\n ])\n ])\n ])\n }\n\n throw new Error('Cannot process operator \"' + node.op + '\" in derivative: ' +\n 'the operator is not supported, undefined, or the number of arguments passed to it are not supported')\n }\n })\n\n /**\n * Helper function to create a constant node with a specific type\n * (number, BigNumber, Fraction)\n * @param {number} value\n * @param {string} [valueType]\n * @return {ConstantNode}\n */\n function createConstantNode (value, valueType) {\n return new ConstantNode(numeric(value, valueType || safeNumberType(String(value), config)))\n }\n\n return derivative\n})\n","import { isInteger } from '../../utils/number.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'rationalize'\nconst dependencies = [\n 'config',\n 'typed',\n 'equal',\n 'isZero',\n 'add',\n 'subtract',\n 'multiply',\n 'divide',\n 'pow',\n 'parse',\n 'simplifyConstant',\n 'simplifyCore',\n 'simplify',\n '?bignumber',\n '?fraction',\n 'mathWithTransform',\n 'matrix',\n 'AccessorNode',\n 'ArrayNode',\n 'ConstantNode',\n 'FunctionNode',\n 'IndexNode',\n 'ObjectNode',\n 'OperatorNode',\n 'SymbolNode',\n 'ParenthesisNode'\n]\n\nexport const createRationalize = /* #__PURE__ */ factory(name, dependencies, ({\n config,\n typed,\n equal,\n isZero,\n add,\n subtract,\n multiply,\n divide,\n pow,\n parse,\n simplifyConstant,\n simplifyCore,\n simplify,\n fraction,\n bignumber,\n mathWithTransform,\n matrix,\n AccessorNode,\n ArrayNode,\n ConstantNode,\n FunctionNode,\n IndexNode,\n ObjectNode,\n OperatorNode,\n SymbolNode,\n ParenthesisNode\n}) => {\n /**\n * Transform a rationalizable expression in a rational fraction.\n * If rational fraction is one variable polynomial then converts\n * the numerator and denominator in canonical form, with decreasing\n * exponents, returning the coefficients of numerator.\n *\n * Syntax:\n *\n * math.rationalize(expr)\n * math.rationalize(expr, detailed)\n * math.rationalize(expr, scope)\n * math.rationalize(expr, scope, detailed)\n *\n * Examples:\n *\n * math.rationalize('sin(x)+y')\n * // Error: There is an unsolved function call\n * math.rationalize('2x/y - y/(x+1)')\n * // (2*x^2-y^2+2*x)/(x*y+y)\n * math.rationalize('(2x+1)^6')\n * // 64*x^6+192*x^5+240*x^4+160*x^3+60*x^2+12*x+1\n * math.rationalize('2x/( (2x-1) / (3x+2) ) - 5x/ ( (3x+4) / (2x^2-5) ) + 3')\n * // -20*x^4+28*x^3+104*x^2+6*x-12)/(6*x^2+5*x-4)\n * math.rationalize('x/(1-x)/(x-2)/(x-3)/(x-4) + 2x/ ( (1-2x)/(2-3x) )/ ((3-4x)/(4-5x) )') =\n * // (-30*x^7+344*x^6-1506*x^5+3200*x^4-3472*x^3+1846*x^2-381*x)/\n * // (-8*x^6+90*x^5-383*x^4+780*x^3-797*x^2+390*x-72)\n *\n * math.rationalize('x+x+x+y',{y:1}) // 3*x+1\n * math.rationalize('x+x+x+y',{}) // 3*x+y\n *\n * const ret = math.rationalize('x+x+x+y',{},true)\n * // ret.expression=3*x+y, ret.variables = [\"x\",\"y\"]\n * const ret = math.rationalize('-2+5x^2',{},true)\n * // ret.expression=5*x^2-2, ret.variables = [\"x\"], ret.coefficients=[-2,0,5]\n *\n * See also:\n *\n * simplify\n *\n * @param {Node|string} expr The expression to check if is a polynomial expression\n * @param {Object|boolean} optional scope of expression or true for already evaluated rational expression at input\n * @param {Boolean} detailed optional True if return an object, false if return expression node (default)\n *\n * @return {Object | Node} The rational polynomial of `expr` or an object\n * `{expression, numerator, denominator, variables, coefficients}`, where\n * `expression` is a `Node` with the node simplified expression,\n * `numerator` is a `Node` with the simplified numerator of expression,\n * `denominator` is a `Node` or `boolean` with the simplified denominator or `false` (if there is no denominator),\n * `variables` is an array with variable names,\n * and `coefficients` is an array with coefficients of numerator sorted by increased exponent\n * {Expression Node} node simplified expression\n *\n */\n function _rationalize (expr, scope = {}, detailed = false) {\n const setRules = rulesRationalize() // Rules for change polynomial in near canonical form\n const polyRet = polynomial(expr, scope, true, setRules.firstRules) // Check if expression is a rationalizable polynomial\n const nVars = polyRet.variables.length\n const noExactFractions = { exactFractions: false }\n const withExactFractions = { exactFractions: true }\n expr = polyRet.expression\n\n if (nVars >= 1) { // If expression in not a constant\n expr = expandPower(expr) // First expand power of polynomials (cannot be made from rules!)\n let sBefore // Previous expression\n let rules\n let eDistrDiv = true\n let redoInic = false\n // Apply the initial rules, including succ div rules:\n expr = simplify(expr, setRules.firstRules, {}, noExactFractions)\n let s\n while (true) {\n // Alternate applying successive division rules and distr.div.rules\n // until there are no more changes:\n rules = eDistrDiv ? setRules.distrDivRules : setRules.sucDivRules\n expr = simplify(expr, rules, {}, withExactFractions)\n eDistrDiv = !eDistrDiv // Swap between Distr.Div and Succ. Div. Rules\n\n s = expr.toString()\n if (s === sBefore) {\n break // No changes : end of the loop\n }\n\n redoInic = true\n sBefore = s\n }\n\n if (redoInic) { // Apply first rules again without succ div rules (if there are changes)\n expr = simplify(expr, setRules.firstRulesAgain, {}, noExactFractions)\n }\n // Apply final rules:\n expr = simplify(expr, setRules.finalRules, {}, noExactFractions)\n } // NVars >= 1\n\n const coefficients = []\n const retRationalize = {}\n\n if (expr.type === 'OperatorNode' && expr.isBinary() && expr.op === '/') { // Separate numerator from denominator\n if (nVars === 1) {\n expr.args[0] = polyToCanonical(expr.args[0], coefficients)\n expr.args[1] = polyToCanonical(expr.args[1])\n }\n if (detailed) {\n retRationalize.numerator = expr.args[0]\n retRationalize.denominator = expr.args[1]\n }\n } else {\n if (nVars === 1) {\n expr = polyToCanonical(expr, coefficients)\n }\n if (detailed) {\n retRationalize.numerator = expr\n retRationalize.denominator = null\n }\n }\n // nVars\n\n if (!detailed) return expr\n retRationalize.coefficients = coefficients\n retRationalize.variables = polyRet.variables\n retRationalize.expression = expr\n return retRationalize\n }\n\n return typed(name, {\n Node: _rationalize,\n 'Node, boolean': (expr, detailed) => _rationalize(expr, {}, detailed),\n 'Node, Object': _rationalize,\n 'Node, Object, boolean': _rationalize\n }) // end of typed rationalize\n\n /**\n * Function to simplify an expression using an optional scope and\n * return it if the expression is a polynomial expression, i.e.\n * an expression with one or more variables and the operators\n * +, -, *, and ^, where the exponent can only be a positive integer.\n *\n * Syntax:\n *\n * polynomial(expr,scope,extended, rules)\n *\n * @param {Node | string} expr The expression to simplify and check if is polynomial expression\n * @param {object} scope Optional scope for expression simplification\n * @param {boolean} extended Optional. Default is false. When true allows divide operator.\n * @param {array} rules Optional. Default is no rule.\n *\n *\n * @return {Object}\n * {Object} node: node simplified expression\n * {Array} variables: variable names\n */\n function polynomial (expr, scope, extended, rules) {\n const variables = []\n const node = simplify(expr, rules, scope, { exactFractions: false }) // Resolves any variables and functions with all defined parameters\n extended = !!extended\n\n const oper = '+-*' + (extended ? '/' : '')\n recPoly(node)\n const retFunc = {}\n retFunc.expression = node\n retFunc.variables = variables\n return retFunc\n\n // -------------------------------------------------------------------------------------------------------\n\n /**\n * Function to simplify an expression using an optional scope and\n * return it if the expression is a polynomial expression, i.e.\n * an expression with one or more variables and the operators\n * +, -, *, and ^, where the exponent can only be a positive integer.\n *\n * Syntax:\n *\n * recPoly(node)\n *\n *\n * @param {Node} node The current sub tree expression in recursion\n *\n * @return nothing, throw an exception if error\n */\n function recPoly (node) {\n const tp = node.type // node type\n if (tp === 'FunctionNode') {\n // No function call in polynomial expression\n throw new Error('There is an unsolved function call')\n } else if (tp === 'OperatorNode') {\n if (node.op === '^') {\n // TODO: handle negative exponents like in '1/x^(-2)'\n if (node.args[1].type !== 'ConstantNode' || !isInteger(parseFloat(node.args[1].value))) {\n throw new Error('There is a non-integer exponent')\n } else {\n recPoly(node.args[0])\n }\n } else {\n if (!oper.includes(node.op)) {\n throw new Error('Operator ' + node.op + ' invalid in polynomial expression')\n }\n for (let i = 0; i < node.args.length; i++) {\n recPoly(node.args[i])\n }\n } // type of operator\n } else if (tp === 'SymbolNode') {\n const name = node.name // variable name\n const pos = variables.indexOf(name)\n if (pos === -1) {\n // new variable in expression\n variables.push(name)\n }\n } else if (tp === 'ParenthesisNode') {\n recPoly(node.content)\n } else if (tp !== 'ConstantNode') {\n throw new Error('type ' + tp + ' is not allowed in polynomial expression')\n }\n } // end of recPoly\n } // end of polynomial\n\n // ---------------------------------------------------------------------------------------\n /**\n * Return a rule set to rationalize an polynomial expression in rationalize\n *\n * Syntax:\n *\n * rulesRationalize()\n *\n * @return {array} rule set to rationalize an polynomial expression\n */\n function rulesRationalize () {\n const oldRules = [simplifyCore, // sCore\n { l: 'n+n', r: '2*n' },\n { l: 'n+-n', r: '0' },\n simplifyConstant, // sConstant\n { l: 'n*(n1^-1)', r: 'n/n1' },\n { l: 'n*n1^-n2', r: 'n/n1^n2' },\n { l: 'n1^-1', r: '1/n1' },\n { l: 'n*(n1/n2)', r: '(n*n1)/n2' },\n { l: '1*n', r: 'n' }]\n\n const rulesFirst = [\n { l: '(-n1)/(-n2)', r: 'n1/n2' }, // Unary division\n { l: '(-n1)*(-n2)', r: 'n1*n2' }, // Unary multiplication\n { l: 'n1--n2', r: 'n1+n2' }, // '--' elimination\n { l: 'n1-n2', r: 'n1+(-n2)' }, // Subtraction turn into add with un�ry minus\n { l: '(n1+n2)*n3', r: '(n1*n3 + n2*n3)' }, // Distributive 1\n { l: 'n1*(n2+n3)', r: '(n1*n2+n1*n3)' }, // Distributive 2\n { l: 'c1*n + c2*n', r: '(c1+c2)*n' }, // Joining constants\n { l: 'c1*n + n', r: '(c1+1)*n' }, // Joining constants\n { l: 'c1*n - c2*n', r: '(c1-c2)*n' }, // Joining constants\n { l: 'c1*n - n', r: '(c1-1)*n' }, // Joining constants\n { l: 'v/c', r: '(1/c)*v' }, // variable/constant (new!)\n { l: 'v/-c', r: '-(1/c)*v' }, // variable/constant (new!)\n { l: '-v*-c', r: 'c*v' }, // Inversion constant and variable 1\n { l: '-v*c', r: '-c*v' }, // Inversion constant and variable 2\n { l: 'v*-c', r: '-c*v' }, // Inversion constant and variable 3\n { l: 'v*c', r: 'c*v' }, // Inversion constant and variable 4\n { l: '-(-n1*n2)', r: '(n1*n2)' }, // Unary propagation\n { l: '-(n1*n2)', r: '(-n1*n2)' }, // Unary propagation\n { l: '-(-n1+n2)', r: '(n1-n2)' }, // Unary propagation\n { l: '-(n1+n2)', r: '(-n1-n2)' }, // Unary propagation\n { l: '(n1^n2)^n3', r: '(n1^(n2*n3))' }, // Power to Power\n { l: '-(-n1/n2)', r: '(n1/n2)' }, // Division and Unary\n { l: '-(n1/n2)', r: '(-n1/n2)' }] // Divisao and Unary\n\n const rulesDistrDiv = [\n { l: '(n1/n2 + n3/n4)', r: '((n1*n4 + n3*n2)/(n2*n4))' }, // Sum of fractions\n { l: '(n1/n2 + n3)', r: '((n1 + n3*n2)/n2)' }, // Sum fraction with number 1\n { l: '(n1 + n2/n3)', r: '((n1*n3 + n2)/n3)' }] // Sum fraction with number 1\n\n const rulesSucDiv = [\n { l: '(n1/(n2/n3))', r: '((n1*n3)/n2)' }, // Division simplification\n { l: '(n1/n2/n3)', r: '(n1/(n2*n3))' }]\n\n const setRules = {} // rules set in 4 steps.\n\n // All rules => infinite loop\n // setRules.allRules =oldRules.concat(rulesFirst,rulesDistrDiv,rulesSucDiv)\n\n setRules.firstRules = oldRules.concat(rulesFirst, rulesSucDiv) // First rule set\n setRules.distrDivRules = rulesDistrDiv // Just distr. div. rules\n setRules.sucDivRules = rulesSucDiv // Jus succ. div. rules\n setRules.firstRulesAgain = oldRules.concat(rulesFirst) // Last rules set without succ. div.\n\n // Division simplification\n\n // Second rule set.\n // There is no aggregate expression with parentesis, but the only variable can be scattered.\n setRules.finalRules = [simplifyCore, // simplify.rules[0]\n { l: 'n*-n', r: '-n^2' }, // Joining multiply with power 1\n { l: 'n*n', r: 'n^2' }, // Joining multiply with power 2\n simplifyConstant, // simplify.rules[14] old 3rd index in oldRules\n { l: 'n*-n^n1', r: '-n^(n1+1)' }, // Joining multiply with power 3\n { l: 'n*n^n1', r: 'n^(n1+1)' }, // Joining multiply with power 4\n { l: 'n^n1*-n^n2', r: '-n^(n1+n2)' }, // Joining multiply with power 5\n { l: 'n^n1*n^n2', r: 'n^(n1+n2)' }, // Joining multiply with power 6\n { l: 'n^n1*-n', r: '-n^(n1+1)' }, // Joining multiply with power 7\n { l: 'n^n1*n', r: 'n^(n1+1)' }, // Joining multiply with power 8\n { l: 'n^n1/-n', r: '-n^(n1-1)' }, // Joining multiply with power 8\n { l: 'n^n1/n', r: 'n^(n1-1)' }, // Joining division with power 1\n { l: 'n/-n^n1', r: '-n^(1-n1)' }, // Joining division with power 2\n { l: 'n/n^n1', r: 'n^(1-n1)' }, // Joining division with power 3\n { l: 'n^n1/-n^n2', r: 'n^(n1-n2)' }, // Joining division with power 4\n { l: 'n^n1/n^n2', r: 'n^(n1-n2)' }, // Joining division with power 5\n { l: 'n1+(-n2*n3)', r: 'n1-n2*n3' }, // Solving useless parenthesis 1\n { l: 'v*(-c)', r: '-c*v' }, // Solving useless unary 2\n { l: 'n1+-n2', r: 'n1-n2' }, // Solving +- together (new!)\n { l: 'v*c', r: 'c*v' }, // inversion constant with variable\n { l: '(n1^n2)^n3', r: '(n1^(n2*n3))' } // Power to Power\n\n ]\n return setRules\n } // End rulesRationalize\n\n // ---------------------------------------------------------------------------------------\n /**\n * Expand recursively a tree node for handling with expressions with exponents\n * (it's not for constants, symbols or functions with exponents)\n * PS: The other parameters are internal for recursion\n *\n * Syntax:\n *\n * expandPower(node)\n *\n * @param {Node} node Current expression node\n * @param {node} parent Parent current node inside the recursion\n * @param (int} Parent number of chid inside the rercursion\n *\n * @return {node} node expression with all powers expanded.\n */\n function expandPower (node, parent, indParent) {\n const tp = node.type\n const internal = (arguments.length > 1) // TRUE in internal calls\n\n if (tp === 'OperatorNode' && node.isBinary()) {\n let does = false\n let val\n if (node.op === '^') { // First operator: Parenthesis or UnaryMinus\n if ((node.args[0].type === 'ParenthesisNode' ||\n node.args[0].type === 'OperatorNode') &&\n (node.args[1].type === 'ConstantNode')) { // Second operator: Constant\n val = parseFloat(node.args[1].value)\n does = (val >= 2 && isInteger(val))\n }\n }\n\n if (does) { // Exponent >= 2\n // Before:\n // operator A --> Subtree\n // parent pow\n // constant\n //\n if (val > 2) { // Exponent > 2,\n // AFTER: (exponent > 2)\n // operator A --> Subtree\n // parent *\n // deep clone (operator A --> Subtree\n // pow\n // constant - 1\n //\n const nEsqTopo = node.args[0]\n const nDirTopo = new OperatorNode('^', 'pow', [node.args[0].cloneDeep(), new ConstantNode(val - 1)])\n node = new OperatorNode('*', 'multiply', [nEsqTopo, nDirTopo])\n } else { // Expo = 2 - no power\n // AFTER: (exponent = 2)\n // operator A --> Subtree\n // parent oper\n // deep clone (operator A --> Subtree)\n //\n node = new OperatorNode('*', 'multiply', [node.args[0], node.args[0].cloneDeep()])\n }\n\n if (internal) {\n // Change parent references in internal recursive calls\n if (indParent === 'content') { parent.content = node } else { parent.args[indParent] = node }\n }\n } // does\n } // binary OperatorNode\n\n if (tp === 'ParenthesisNode') {\n // Recursion\n expandPower(node.content, node, 'content')\n } else if (tp !== 'ConstantNode' && tp !== 'SymbolNode') {\n for (let i = 0; i < node.args.length; i++) {\n expandPower(node.args[i], node, i)\n }\n }\n\n if (!internal) {\n // return the root node\n return node\n }\n } // End expandPower\n\n // ---------------------------------------------------------------------------------------\n /**\n * Auxilary function for rationalize\n * Convert near canonical polynomial in one variable in a canonical polynomial\n * with one term for each exponent in decreasing order\n *\n * Syntax:\n *\n * polyToCanonical(node [, coefficients])\n *\n * @param {Node | string} expr The near canonical polynomial expression to convert in a a canonical polynomial expression\n *\n * The string or tree expression needs to be at below syntax, with free spaces:\n * ( (^(-)? | [+-]? )cte (*)? var (^expo)? | cte )+\n * Where 'var' is one variable with any valid name\n * 'cte' are real numeric constants with any value. It can be omitted if equal than 1\n * 'expo' are integers greater than 0. It can be omitted if equal than 1.\n *\n * @param {array} coefficients Optional returns coefficients sorted by increased exponent\n *\n *\n * @return {node} new node tree with one variable polynomial or string error.\n */\n function polyToCanonical (node, coefficients) {\n if (coefficients === undefined) { coefficients = [] } // coefficients.\n\n coefficients[0] = 0 // index is the exponent\n const o = {}\n o.cte = 1\n o.oper = '+'\n\n // fire: mark with * or ^ when finds * or ^ down tree, reset to \"\" with + and -.\n // It is used to deduce the exponent: 1 for *, 0 for \"\".\n o.fire = ''\n\n let maxExpo = 0 // maximum exponent\n let varname = '' // variable name\n\n recurPol(node, null, o)\n maxExpo = coefficients.length - 1\n let first = true\n let no\n\n for (let i = maxExpo; i >= 0; i--) {\n if (coefficients[i] === 0) continue\n let n1 = new ConstantNode(\n first ? coefficients[i] : Math.abs(coefficients[i]))\n const op = coefficients[i] < 0 ? '-' : '+'\n\n if (i > 0) { // Is not a constant without variable\n let n2 = new SymbolNode(varname)\n if (i > 1) {\n const n3 = new ConstantNode(i)\n n2 = new OperatorNode('^', 'pow', [n2, n3])\n }\n if (coefficients[i] === -1 && first) { n1 = new OperatorNode('-', 'unaryMinus', [n2]) } else if (Math.abs(coefficients[i]) === 1) { n1 = n2 } else { n1 = new OperatorNode('*', 'multiply', [n1, n2]) }\n }\n\n if (first) { no = n1 } else if (op === '+') { no = new OperatorNode('+', 'add', [no, n1]) } else { no = new OperatorNode('-', 'subtract', [no, n1]) }\n\n first = false\n } // for\n\n if (first) { return new ConstantNode(0) } else { return no }\n\n /**\n * Recursive auxilary function inside polyToCanonical for\n * converting expression in canonical form\n *\n * Syntax:\n *\n * recurPol(node, noPai, obj)\n *\n * @param {Node} node The current subpolynomial expression\n * @param {Node | Null} noPai The current parent node\n * @param {object} obj Object with many internal flags\n *\n * @return {} No return. If error, throws an exception\n */\n function recurPol (node, noPai, o) {\n const tp = node.type\n if (tp === 'FunctionNode') {\n // ***** FunctionName *****\n // No function call in polynomial expression\n throw new Error('There is an unsolved function call')\n } else if (tp === 'OperatorNode') {\n // ***** OperatorName *****\n if (!'+-*^'.includes(node.op)) throw new Error('Operator ' + node.op + ' invalid')\n\n if (noPai !== null) {\n // -(unary),^ : children of *,+,-\n if ((node.fn === 'unaryMinus' || node.fn === 'pow') && noPai.fn !== 'add' &&\n noPai.fn !== 'subtract' && noPai.fn !== 'multiply') { throw new Error('Invalid ' + node.op + ' placing') }\n\n // -,+,* : children of +,-\n if ((node.fn === 'subtract' || node.fn === 'add' || node.fn === 'multiply') &&\n noPai.fn !== 'add' && noPai.fn !== 'subtract') { throw new Error('Invalid ' + node.op + ' placing') }\n\n // -,+ : first child\n if ((node.fn === 'subtract' || node.fn === 'add' ||\n node.fn === 'unaryMinus') && o.noFil !== 0) { throw new Error('Invalid ' + node.op + ' placing') }\n } // Has parent\n\n // Firers: ^,* Old: ^,&,-(unary): firers\n if (node.op === '^' || node.op === '*') {\n o.fire = node.op\n }\n\n for (let i = 0; i < node.args.length; i++) {\n // +,-: reset fire\n if (node.fn === 'unaryMinus') o.oper = '-'\n if (node.op === '+' || node.fn === 'subtract') {\n o.fire = ''\n o.cte = 1 // default if there is no constant\n o.oper = (i === 0 ? '+' : node.op)\n }\n o.noFil = i // number of son\n recurPol(node.args[i], node, o)\n } // for in children\n } else if (tp === 'SymbolNode') { // ***** SymbolName *****\n if (node.name !== varname && varname !== '') { throw new Error('There is more than one variable') }\n varname = node.name\n if (noPai === null) {\n coefficients[1] = 1\n return\n }\n\n // ^: Symbol is First child\n if (noPai.op === '^' && o.noFil !== 0) { throw new Error('In power the variable should be the first parameter') }\n\n // *: Symbol is Second child\n if (noPai.op === '*' && o.noFil !== 1) { throw new Error('In multiply the variable should be the second parameter') }\n\n // Symbol: firers '',* => it means there is no exponent above, so it's 1 (cte * var)\n if (o.fire === '' || o.fire === '*') {\n if (maxExpo < 1) coefficients[1] = 0\n coefficients[1] += o.cte * (o.oper === '+' ? 1 : -1)\n maxExpo = Math.max(1, maxExpo)\n }\n } else if (tp === 'ConstantNode') {\n const valor = parseFloat(node.value)\n if (noPai === null) {\n coefficients[0] = valor\n return\n }\n if (noPai.op === '^') {\n // cte: second child of power\n if (o.noFil !== 1) throw new Error('Constant cannot be powered')\n\n if (!isInteger(valor) || valor <= 0) { throw new Error('Non-integer exponent is not allowed') }\n\n for (let i = maxExpo + 1; i < valor; i++) coefficients[i] = 0\n if (valor > maxExpo) coefficients[valor] = 0\n coefficients[valor] += o.cte * (o.oper === '+' ? 1 : -1)\n maxExpo = Math.max(valor, maxExpo)\n return\n }\n o.cte = valor\n\n // Cte: firer '' => There is no exponent and no multiplication, so the exponent is 0.\n if (o.fire === '') { coefficients[0] += o.cte * (o.oper === '+' ? 1 : -1) }\n } else { throw new Error('Type ' + tp + ' is not allowed') }\n } // End of recurPol\n } // End of polyToCanonical\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'zpk2tf'\n\nconst dependencies = [\n 'typed',\n 'add',\n 'multiply',\n 'Complex',\n 'number'\n]\n\nexport const createZpk2tf = /* #__PURE__ */ factory(name, dependencies, ({ typed, add, multiply, Complex, number }) => {\n /**\n * Compute the transfer function of a zero-pole-gain model.\n *\n * Syntax:\n * math.zpk2tf(z, p, k)\n *\n * Examples:\n * math.zpk2tf([1, 2], [-1, -2], 1) // returns [[1, -3, 2], [1, 3, 2]]\n *\n * See also:\n * freqz\n *\n * @param {Array} z Array of zeros values\n * @param {Array} p Array of poles values\n * @param {number} k Gain value\n * @return {Array} Two dimensional array containing the numerator (first row) and denominator (second row) polynomials\n *\n */\n return typed(name, {\n 'Array,Array,number': function (z, p, k) {\n return _zpk2tf(z, p, k)\n },\n 'Array,Array': function (z, p) {\n return _zpk2tf(z, p, 1)\n },\n 'Matrix,Matrix,number': function (z, p, k) {\n return _zpk2tf(z.valueOf(), p.valueOf(), k)\n },\n 'Matrix,Matrix': function (z, p) {\n return _zpk2tf(z.valueOf(), p.valueOf(), 1)\n }\n })\n\n function _zpk2tf (z, p, k) {\n // if z is bignumber, convert it to number\n if (z.some((el) => el.type === 'BigNumber')) {\n z = z.map((el) => number(el))\n }\n // if p is bignumber, convert it to number\n if (p.some((el) => el.type === 'BigNumber')) {\n p = p.map((el) => number(el))\n }\n let num = [Complex(1, 0)]\n let den = [Complex(1, 0)]\n for (let i = 0; i < z.length; i++) {\n let zero = z[i]\n if (typeof zero === 'number') zero = Complex(zero, 0)\n num = _multiply(num, [Complex(1, 0), Complex(-zero.re, -zero.im)])\n }\n for (let i = 0; i < p.length; i++) {\n let pole = p[i]\n if (typeof pole === 'number') pole = Complex(pole, 0)\n den = _multiply(den, [Complex(1, 0), Complex(-pole.re, -pole.im)])\n }\n for (let i = 0; i < num.length; i++) {\n num[i] = multiply(num[i], k)\n }\n return [num, den]\n }\n\n function _multiply (a, b) {\n const c = []\n for (let i = 0; i < a.length + b.length - 1; i++) {\n c[i] = Complex(0, 0)\n for (let j = 0; j < a.length; j++) {\n if (i - j >= 0 && i - j < b.length) {\n c[i] = add(c[i], multiply(a[j], b[i - j]))\n }\n }\n }\n return c\n }\n})\n","import { factory } from '../../utils/factory.js'\n\nconst name = 'freqz'\n\nconst dependencies = [\n 'typed',\n 'add',\n 'multiply',\n 'Complex',\n 'divide',\n 'matrix'\n]\n\nexport const createFreqz = /* #__PURE__ */ factory(name, dependencies, ({ typed, add, multiply, Complex, divide, matrix }) => {\n /**\n * Calculates the frequency response of a filter given its numerator and denominator coefficients.\n *\n * Syntax:\n * math.freqz(b, a)\n * math.freqz(b, a, w)\n *\n * Examples:\n * math.freqz([1, 2], [1, 2, 3], 4) // returns { h: [0.5 + 0i, 0.4768589245763655 + 0.2861153547458193i, 0.25000000000000006 + 0.75i, -0.770976571635189 + 0.4625859429811135i], w: [0, 0.7853981633974483, 1.5707963267948966, 2.356194490192345 ] }\n * math.freqz([1, 2], [1, 2, 3], [0, 1]) // returns { h: [0.5 + 0i, 0.45436781 + 0.38598051i], w: [0, 1] }\n *\n * See also:\n * zpk2tf\n *\n * @param {Array.} b The numerator coefficients of the filter.\n * @param {Array.} a The denominator coefficients of the filter.\n * @param {Array.} [w] A vector of frequencies (in radians/sample) at which the frequency response is to be computed or the number of points to compute (if a number is not provided, the default is 512 points)\n * @returns {Object} An object with two properties: h, a vector containing the complex frequency response, and w, a vector containing the normalized frequencies (in radians/sample) at which the response was computed.\n *\n *\n */\n return typed(name, {\n 'Array, Array': function (b, a) {\n const w = createBins(512)\n return _freqz(b, a, w)\n },\n 'Array, Array, Array': function (b, a, w) {\n return _freqz(b, a, w)\n },\n 'Array, Array, number': function (b, a, w) {\n if (w < 0) {\n throw new Error('w must be a positive number')\n }\n const w2 = createBins(w)\n return _freqz(b, a, w2)\n },\n 'Matrix, Matrix': function (b, a) {\n // console.log('here')\n const _w = createBins(512)\n const { w, h } = _freqz(b.valueOf(), a.valueOf(), _w)\n return {\n w: matrix(w),\n h: matrix(h)\n }\n },\n 'Matrix, Matrix, Matrix': function (b, a, w) {\n const { h } = _freqz(b.valueOf(), a.valueOf(), w.valueOf())\n return {\n h: matrix(h),\n w: matrix(w)\n }\n },\n 'Matrix, Matrix, number': function (b, a, w) {\n if (w < 0) {\n throw new Error('w must be a positive number')\n }\n const _w = createBins(w)\n const { h } = _freqz(b.valueOf(), a.valueOf(), _w)\n return {\n h: matrix(h),\n w: matrix(_w)\n }\n }\n })\n\n function _freqz (b, a, w) {\n const num = []\n const den = []\n for (let i = 0; i < w.length; i++) {\n let sumNum = Complex(0, 0)\n let sumDen = Complex(0, 0)\n for (let j = 0; j < b.length; j++) {\n sumNum = add(sumNum, multiply(b[j], Complex(Math.cos(-j * w[i]), Math.sin(-j * w[i]))))\n }\n for (let j = 0; j < a.length; j++) {\n sumDen = add(sumDen, multiply(a[j], Complex(Math.cos(-j * w[i]), Math.sin(-j * w[i]))))\n }\n num.push(sumNum)\n den.push(sumDen)\n }\n const h = []\n for (let i = 0; i < num.length; i++) {\n h.push(divide(num[i], den[i]))\n }\n return { h, w }\n }\n\n function createBins (n) {\n const bins = []\n for (let i = 0; i < n; i++) {\n bins.push(i / n * Math.PI)\n }\n return bins\n }\n})\n","import { factory } from '../utils/factory.js'\n\nconst name = 'reviver'\nconst dependencies = [\n 'classes'\n]\n\nexport const createReviver = /* #__PURE__ */ factory(name, dependencies, ({ classes }) => {\n /**\n * Instantiate mathjs data types from their JSON representation\n * @param {string} key\n * @param {*} value\n * @returns {*} Returns the revived object\n */\n return function reviver (key, value) {\n const constructor = classes[value && value.mathjs]\n\n if (constructor && typeof constructor.fromJSON === 'function') {\n return constructor.fromJSON(value)\n }\n\n return value\n }\n})\n","import { factory } from '../utils/factory.js'\n\nconst name = 'replacer'\nconst dependencies = []\n\nexport const createReplacer = /* #__PURE__ */ factory(name, dependencies, () => {\n /**\n * Stringify data types into their JSON representation.\n * Most data types can be serialized using their `.toJSON` method,\n * but not all, for example the number `Infinity`. For these cases you have\n * to use the replacer. Example usage:\n *\n * JSON.stringify([2, Infinity], math.replacer)\n *\n * @param {string} key\n * @param {*} value\n * @returns {*} Returns the replaced object\n */\n return function replacer (key, value) {\n // the numeric values Infinitiy, -Infinity, and NaN cannot be serialized to JSON\n if (typeof value === 'number' && (!isFinite(value) || isNaN(value))) {\n return {\n mathjs: 'number',\n value: String(value)\n }\n }\n\n if (typeof value === 'bigint') {\n return {\n mathjs: 'bigint',\n value: String(value)\n }\n }\n\n return value\n }\n})\n","export const pi = Math.PI\nexport const tau = 2 * Math.PI\nexport const e = Math.E\nexport const phi = 1.6180339887498948 // eslint-disable-line no-loss-of-precision\n","import { factory } from './utils/factory.js'\nimport { version } from './version.js'\nimport {\n createBigNumberE,\n createBigNumberPhi,\n createBigNumberPi,\n createBigNumberTau\n} from './utils/bignumber/constants.js'\nimport { pi, tau, e, phi } from './plain/number/index.js'\n\nexport const createTrue = /* #__PURE__ */ factory('true', [], () => true)\nexport const createFalse = /* #__PURE__ */ factory('false', [], () => false)\nexport const createNull = /* #__PURE__ */ factory('null', [], () => null)\n\nexport const createInfinity = /* #__PURE__ */ recreateFactory(\n 'Infinity',\n ['config', '?BigNumber'],\n ({ config, BigNumber }) => (config.number === 'BigNumber')\n ? new BigNumber(Infinity)\n : Infinity\n)\n\nexport const createNaN = /* #__PURE__ */ recreateFactory(\n 'NaN',\n ['config', '?BigNumber'],\n ({ config, BigNumber }) => (config.number === 'BigNumber')\n ? new BigNumber(NaN)\n : NaN\n)\n\nexport const createPi = /* #__PURE__ */ recreateFactory(\n 'pi',\n ['config', '?BigNumber'],\n ({ config, BigNumber }) => (config.number === 'BigNumber')\n ? createBigNumberPi(BigNumber)\n : pi\n)\n\nexport const createTau = /* #__PURE__ */ recreateFactory(\n 'tau',\n ['config', '?BigNumber'],\n ({ config, BigNumber }) => (config.number === 'BigNumber')\n ? createBigNumberTau(BigNumber)\n : tau\n)\n\nexport const createE = /* #__PURE__ */ recreateFactory(\n 'e',\n ['config', '?BigNumber'],\n ({ config, BigNumber }) => (config.number === 'BigNumber')\n ? createBigNumberE(BigNumber)\n : e\n)\n\n// golden ratio, (1+sqrt(5))/2\nexport const createPhi = /* #__PURE__ */ recreateFactory(\n 'phi',\n ['config', '?BigNumber'],\n ({ config, BigNumber }) => (config.number === 'BigNumber')\n ? createBigNumberPhi(BigNumber)\n : phi\n)\n\nexport const createLN2 = /* #__PURE__ */ recreateFactory(\n 'LN2',\n ['config', '?BigNumber'],\n ({ config, BigNumber }) => (config.number === 'BigNumber')\n ? new BigNumber(2).ln()\n : Math.LN2\n)\n\nexport const createLN10 = /* #__PURE__ */ recreateFactory(\n 'LN10',\n ['config', '?BigNumber'],\n ({ config, BigNumber }) => (config.number === 'BigNumber')\n ? new BigNumber(10).ln()\n : Math.LN10\n)\n\nexport const createLOG2E = /* #__PURE__ */ recreateFactory(\n 'LOG2E',\n ['config', '?BigNumber'],\n ({ config, BigNumber }) => (config.number === 'BigNumber')\n ? new BigNumber(1).div(new BigNumber(2).ln())\n : Math.LOG2E\n)\n\nexport const createLOG10E = /* #__PURE__ */ recreateFactory(\n 'LOG10E',\n ['config', '?BigNumber'],\n ({ config, BigNumber }) => (config.number === 'BigNumber')\n ? new BigNumber(1).div(new BigNumber(10).ln())\n : Math.LOG10E\n)\n\nexport const createSQRT1_2 = /* #__PURE__ */ recreateFactory( // eslint-disable-line camelcase\n 'SQRT1_2',\n ['config', '?BigNumber'],\n ({ config, BigNumber }) => (config.number === 'BigNumber')\n ? new BigNumber('0.5').sqrt()\n : Math.SQRT1_2\n)\n\nexport const createSQRT2 = /* #__PURE__ */ recreateFactory(\n 'SQRT2',\n ['config', '?BigNumber'],\n ({ config, BigNumber }) => (config.number === 'BigNumber')\n ? new BigNumber(2).sqrt()\n : Math.SQRT2\n)\n\nexport const createI = /* #__PURE__ */ recreateFactory(\n 'i',\n ['Complex'],\n ({ Complex }) => Complex.I\n)\n\n// for backward compatibility with v5\nexport const createUppercasePi = /* #__PURE__ */ factory('PI', ['pi'], ({ pi }) => pi)\nexport const createUppercaseE = /* #__PURE__ */ factory('E', ['e'], ({ e }) => e)\n\nexport const createVersion = /* #__PURE__ */ factory('version', [], () => version)\n\n// helper function to create a factory with a flag recreateOnConfigChange\n// idea: allow passing optional properties to be attached to the factory function as 4th argument?\nfunction recreateFactory (name, dependencies, create) {\n return factory(name, dependencies, create, {\n recreateOnConfigChange: true\n })\n}\n","export const version = '14.5.2'\n// Note: This file is automatically generated when building math.js.\n// Changes made in this file will be overwritten.\n","import { factory } from '../../utils/factory.js'\n\n// Source: https://en.wikipedia.org/wiki/Physical_constant\n\n// Universal constants\nexport const createSpeedOfLight = /* #__PURE__ */ unitFactory('speedOfLight', '299792458', 'm s^-1')\nexport const createGravitationConstant = /* #__PURE__ */ unitFactory('gravitationConstant', '6.67430e-11', 'm^3 kg^-1 s^-2')\nexport const createPlanckConstant = /* #__PURE__ */ unitFactory('planckConstant', '6.62607015e-34', 'J s')\nexport const createReducedPlanckConstant = /* #__PURE__ */ unitFactory('reducedPlanckConstant', '1.0545718176461565e-34', 'J s')\n\n// Electromagnetic constants\nexport const createMagneticConstant = /* #__PURE__ */ unitFactory('magneticConstant', '1.25663706212e-6', 'N A^-2')\nexport const createElectricConstant = /* #__PURE__ */ unitFactory('electricConstant', '8.8541878128e-12', 'F m^-1')\nexport const createVacuumImpedance = /* #__PURE__ */ unitFactory('vacuumImpedance', '376.730313667', 'ohm')\nexport const createCoulomb = /* #__PURE__ */ unitFactory('coulomb', '8.987551792261171e9', 'N m^2 C^-2') // Deprecated in favor of coulombConstant\nexport const createCoulombConstant = /* #__PURE__ */ unitFactory('coulombConstant', '8.987551792261171e9', 'N m^2 C^-2')\nexport const createElementaryCharge = /* #__PURE__ */ unitFactory('elementaryCharge', '1.602176634e-19', 'C')\nexport const createBohrMagneton = /* #__PURE__ */ unitFactory('bohrMagneton', '9.2740100783e-24', 'J T^-1')\nexport const createConductanceQuantum = /* #__PURE__ */ unitFactory('conductanceQuantum', '7.748091729863649e-5', 'S')\nexport const createInverseConductanceQuantum = /* #__PURE__ */ unitFactory('inverseConductanceQuantum', '12906.403729652257', 'ohm')\nexport const createMagneticFluxQuantum = /* #__PURE__ */ unitFactory('magneticFluxQuantum', '2.0678338484619295e-15', 'Wb')\nexport const createNuclearMagneton = /* #__PURE__ */ unitFactory('nuclearMagneton', '5.0507837461e-27', 'J T^-1')\nexport const createKlitzing = /* #__PURE__ */ unitFactory('klitzing', '25812.807459304513', 'ohm')\nexport const createJosephson = /* #__PURE__ */ unitFactory('josephson', '4.835978484169836e14 Hz V', 'Hz V^-1') // TODO: support for Hz needed\n\n// Atomic and nuclear constants\nexport const createBohrRadius = /* #__PURE__ */ unitFactory('bohrRadius', '5.29177210903e-11', 'm')\nexport const createClassicalElectronRadius = /* #__PURE__ */ unitFactory('classicalElectronRadius', '2.8179403262e-15', 'm')\nexport const createElectronMass = /* #__PURE__ */ unitFactory('electronMass', '9.1093837015e-31', 'kg')\nexport const createFermiCoupling = /* #__PURE__ */ unitFactory('fermiCoupling', '1.1663787e-5', 'GeV^-2')\nexport const createFineStructure = numberFactory('fineStructure', 7.2973525693e-3)\nexport const createHartreeEnergy = /* #__PURE__ */ unitFactory('hartreeEnergy', '4.3597447222071e-18', 'J')\nexport const createProtonMass = /* #__PURE__ */ unitFactory('protonMass', '1.67262192369e-27', 'kg')\nexport const createDeuteronMass = /* #__PURE__ */ unitFactory('deuteronMass', '3.3435830926e-27', 'kg')\nexport const createNeutronMass = /* #__PURE__ */ unitFactory('neutronMass', '1.6749271613e-27', 'kg')\nexport const createQuantumOfCirculation = /* #__PURE__ */ unitFactory('quantumOfCirculation', '3.6369475516e-4', 'm^2 s^-1')\nexport const createRydberg = /* #__PURE__ */ unitFactory('rydberg', '10973731.568160', 'm^-1')\nexport const createThomsonCrossSection = /* #__PURE__ */ unitFactory('thomsonCrossSection', '6.6524587321e-29', 'm^2')\nexport const createWeakMixingAngle = numberFactory('weakMixingAngle', 0.22290)\nexport const createEfimovFactor = numberFactory('efimovFactor', 22.7)\n\n// Physico-chemical constants\nexport const createAtomicMass = /* #__PURE__ */ unitFactory('atomicMass', '1.66053906660e-27', 'kg')\nexport const createAvogadro = /* #__PURE__ */ unitFactory('avogadro', '6.02214076e23', 'mol^-1')\nexport const createBoltzmann = /* #__PURE__ */ unitFactory('boltzmann', '1.380649e-23', 'J K^-1')\nexport const createFaraday = /* #__PURE__ */ unitFactory('faraday', '96485.33212331001', 'C mol^-1')\nexport const createFirstRadiation = /* #__PURE__ */ unitFactory('firstRadiation', '3.7417718521927573e-16', 'W m^2')\n// TODO spectralRadiance = 1.1910429723971881e-16 W m^2 sr^-1\nexport const createLoschmidt = /* #__PURE__ */ unitFactory('loschmidt', '2.686780111798444e25', 'm^-3')\nexport const createGasConstant = /* #__PURE__ */ unitFactory('gasConstant', '8.31446261815324', 'J K^-1 mol^-1')\nexport const createMolarPlanckConstant = /* #__PURE__ */ unitFactory('molarPlanckConstant', '3.990312712893431e-10', 'J s mol^-1')\nexport const createMolarVolume = /* #__PURE__ */ unitFactory('molarVolume', '0.022413969545014137', 'm^3 mol^-1')\nexport const createSackurTetrode = numberFactory('sackurTetrode', -1.16487052358)\nexport const createSecondRadiation = /* #__PURE__ */ unitFactory('secondRadiation', '0.014387768775039337', 'm K')\nexport const createStefanBoltzmann = /* #__PURE__ */ unitFactory('stefanBoltzmann', '5.67037441918443e-8', 'W m^-2 K^-4')\nexport const createWienDisplacement = /* #__PURE__ */ unitFactory('wienDisplacement', '2.897771955e-3', 'm K')\n\n// Adopted values\nexport const createMolarMass = /* #__PURE__ */ unitFactory('molarMass', '0.99999999965e-3', 'kg mol^-1')\nexport const createMolarMassC12 = /* #__PURE__ */ unitFactory('molarMassC12', '11.9999999958e-3', 'kg mol^-1')\nexport const createGravity = /* #__PURE__ */ unitFactory('gravity', '9.80665', 'm s^-2')\n// atm is defined in Unit.js\n\n// Natural units\nexport const createPlanckLength = /* #__PURE__ */ unitFactory('planckLength', '1.616255e-35', 'm')\nexport const createPlanckMass = /* #__PURE__ */ unitFactory('planckMass', '2.176435e-8', 'kg')\nexport const createPlanckTime = /* #__PURE__ */ unitFactory('planckTime', '5.391245e-44', 's')\nexport const createPlanckCharge = /* #__PURE__ */ unitFactory('planckCharge', '1.87554603778e-18', 'C')\nexport const createPlanckTemperature = /* #__PURE__ */ unitFactory('planckTemperature', '1.416785e+32', 'K')\n\n// helper function to create a factory function which creates a physical constant,\n// a Unit with either a number value or a BigNumber value depending on the configuration\nfunction unitFactory (name, valueStr, unitStr) {\n const dependencies = ['config', 'Unit', 'BigNumber']\n\n return factory(name, dependencies, ({ config, Unit, BigNumber }) => {\n // Note that we can parse into number or BigNumber.\n // We do not parse into Fractions as that doesn't make sense: we would lose precision of the values\n // Therefore we dont use Unit.parse()\n const value = config.number === 'BigNumber'\n ? new BigNumber(valueStr)\n : parseFloat(valueStr)\n\n const unit = new Unit(value, unitStr)\n unit.fixPrefix = true\n return unit\n })\n}\n\n// helper function to create a factory function which creates a numeric constant,\n// either a number or BigNumber depending on the configuration\nfunction numberFactory (name, value) {\n const dependencies = ['config', 'BigNumber']\n\n return factory(name, dependencies, ({ config, BigNumber }) => {\n return config.number === 'BigNumber'\n ? new BigNumber(value)\n : value\n })\n}\n","import { errorTransform } from './utils/errorTransform.js'\nimport { factory } from '../../utils/factory.js'\nimport { createMapSlices } from '../../function/matrix/mapSlices.js'\nimport { isBigNumber, isNumber } from '../../utils/is.js'\n\nconst name = 'mapSlices'\nconst dependencies = ['typed', 'isInteger']\n\n/**\n * Attach a transform function to math.mapSlices\n * Adds a property transform containing the transform function.\n *\n * This transform changed the last `dim` parameter of function mapSlices\n * from one-based to zero based\n */\nexport const createMapSlicesTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, isInteger }) => {\n const mapSlices = createMapSlices({ typed, isInteger })\n\n // @see: comment of concat itself\n return typed('mapSlices', {\n '...any': function (args) {\n // change dim from one-based to zero-based\n const dim = args[1]\n\n if (isNumber(dim)) {\n args[1] = dim - 1\n } else if (isBigNumber(dim)) {\n args[1] = dim.minus(1)\n }\n\n try {\n return mapSlices.apply(null, args)\n } catch (err) {\n throw errorTransform(err)\n }\n }\n })\n}, { isTransformFunction: true, ...createMapSlices.meta })\n","import { errorTransform } from './utils/errorTransform.js'\nimport { factory } from '../../utils/factory.js'\nimport { createColumn } from '../../function/matrix/column.js'\nimport { isNumber } from '../../utils/is.js'\n\nconst name = 'column'\nconst dependencies = ['typed', 'Index', 'matrix', 'range']\n\n/**\n * Attach a transform function to matrix.column\n * Adds a property transform containing the transform function.\n *\n * This transform changed the last `index` parameter of function column\n * from zero-based to one-based\n */\nexport const createColumnTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, Index, matrix, range }) => {\n const column = createColumn({ typed, Index, matrix, range })\n\n // @see: comment of column itself\n return typed('column', {\n '...any': function (args) {\n // change last argument from zero-based to one-based\n const lastIndex = args.length - 1\n const last = args[lastIndex]\n if (isNumber(last)) {\n args[lastIndex] = last - 1\n }\n\n try {\n return column.apply(null, args)\n } catch (err) {\n throw errorTransform(err)\n }\n }\n })\n}, { isTransformFunction: true })\n","import { isSymbolNode } from '../../../utils/is.js'\nimport { PartitionedMap } from '../../../utils/map.js'\n\n/**\n * Compile an inline expression like \"x > 0\"\n * @param {Node} expression\n * @param {Object} math\n * @param {Map} scope\n * @return {function} Returns a function with one argument which fills in the\n * undefined variable (like \"x\") and evaluates the expression\n */\nexport function compileInlineExpression (expression, math, scope) {\n // find an undefined symbol\n const symbol = expression.filter(function (node) {\n return isSymbolNode(node) &&\n !(node.name in math) &&\n !(scope.has(node.name))\n })[0]\n\n if (!symbol) {\n throw new Error('No undefined variable found in inline expression \"' + expression + '\"')\n }\n\n // create a test function for this equation\n const name = symbol.name // variable name\n const argsScope = new Map()\n const subScope = new PartitionedMap(scope, argsScope, new Set([name]))\n const eq = expression.compile()\n return function inlineExpression (x) {\n argsScope.set(name, x)\n return eq.evaluate(subScope)\n }\n}\n","import { factory } from '../../../utils/factory.js'\n\nconst name = 'transformCallback'\nconst dependencies = ['typed']\n\nexport const createTransformCallback = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Transforms the given callback function based on its type and number of arrays.\n *\n * @param {Function} callback - The callback function to transform.\n * @param {number} numberOfArrays - The number of arrays to pass to the callback function.\n * @returns {*} - The transformed callback function.\n */\n return function (callback, numberOfArrays) {\n if (typed.isTypedFunction(callback)) {\n return _transformTypedCallbackFunction(callback, numberOfArrays)\n } else {\n return _transformCallbackFunction(callback, callback.length, numberOfArrays)\n }\n }\n\n /**\n * Transforms the given typed callback function based on the number of arrays.\n *\n * @param {Function} typedFunction - The typed callback function to transform.\n * @param {number} numberOfArrays - The number of arrays to pass to the callback function.\n * @returns {*} - The transformed callback function.\n */\n function _transformTypedCallbackFunction (typedFunction, numberOfArrays) {\n const signatures = Object.fromEntries(\n Object.entries(typedFunction.signatures)\n .map(([signature, callbackFunction]) => {\n const numberOfCallbackInputs = signature.split(',').length\n if (typed.isTypedFunction(callbackFunction)) {\n return [signature, _transformTypedCallbackFunction(callbackFunction, numberOfArrays)]\n } else {\n return [signature, _transformCallbackFunction(callbackFunction, numberOfCallbackInputs, numberOfArrays)]\n }\n })\n )\n\n if (typeof typedFunction.name === 'string') {\n return typed(typedFunction.name, signatures)\n } else {\n return typed(signatures)\n }\n }\n})\n\n/**\n * Transforms the callback function based on the number of callback inputs and arrays.\n * There are three cases:\n * 1. The callback function has N arguments.\n * 2. The callback function has N+1 arguments.\n * 3. The callback function has 2N+1 arguments.\n *\n * @param {Function} callbackFunction - The callback function to transform.\n * @param {number} numberOfCallbackInputs - The number of callback inputs.\n * @param {number} numberOfArrays - The number of arrays.\n * @returns {Function} The transformed callback function.\n */\nfunction _transformCallbackFunction (callbackFunction, numberOfCallbackInputs, numberOfArrays) {\n if (numberOfCallbackInputs === numberOfArrays) {\n return callbackFunction\n } else if (numberOfCallbackInputs === numberOfArrays + 1) {\n return function (...args) {\n const vals = args.slice(0, numberOfArrays)\n const idx = _transformDims(args[numberOfArrays])\n return callbackFunction(...vals, idx)\n }\n } else if (numberOfCallbackInputs > numberOfArrays + 1) {\n return function (...args) {\n const vals = args.slice(0, numberOfArrays)\n const idx = _transformDims(args[numberOfArrays])\n const rest = args.slice(numberOfArrays + 1)\n return callbackFunction(...vals, idx, ...rest)\n }\n } else {\n return callbackFunction\n }\n}\n\n/**\n * Transforms the dimensions by adding 1 to each dimension.\n *\n * @param {Array} dims - The dimensions to transform.\n * @returns {Array} The transformed dimensions.\n */\nfunction _transformDims (dims) {\n return dims.map(dim => dim + 1)\n}\n","import { createFilter } from '../../function/matrix/filter.js'\nimport { factory } from '../../utils/factory.js'\nimport { isFunctionAssignmentNode, isSymbolNode } from '../../utils/is.js'\nimport { compileInlineExpression } from './utils/compileInlineExpression.js'\nimport { createTransformCallback } from './utils/transformCallback.js'\n\nconst name = 'filter'\nconst dependencies = ['typed']\n\nexport const createFilterTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Attach a transform function to math.filter\n * Adds a property transform containing the transform function.\n *\n * This transform adds support for equations as test function for math.filter,\n * so you can do something like 'filter([3, -2, 5], x > 0)'.\n */\n function filterTransform (args, math, scope) {\n const filter = createFilter({ typed })\n const transformCallback = createTransformCallback({ typed })\n\n if (args.length === 0) {\n return filter()\n }\n let x = args[0]\n\n if (args.length === 1) {\n return filter(x)\n }\n\n const N = args.length - 1\n let callback = args[N]\n\n if (x) {\n x = _compileAndEvaluate(x, scope)\n }\n\n if (callback) {\n if (isSymbolNode(callback) || isFunctionAssignmentNode(callback)) {\n // a function pointer, like filter([3, -2, 5], myTestFunction)\n callback = _compileAndEvaluate(callback, scope)\n } else {\n // an expression like filter([3, -2, 5], x > 0)\n callback = compileInlineExpression(callback, math, scope)\n }\n }\n\n return filter(x, transformCallback(callback, N))\n }\n filterTransform.rawArgs = true\n\n function _compileAndEvaluate (arg, scope) {\n return arg.compile().evaluate(scope)\n }\n\n return filterTransform\n}, { isTransformFunction: true })\n","import { createForEach } from '../../function/matrix/forEach.js'\nimport { createTransformCallback } from './utils/transformCallback.js'\nimport { factory } from '../../utils/factory.js'\nimport { isFunctionAssignmentNode, isSymbolNode } from '../../utils/is.js'\nimport { compileInlineExpression } from './utils/compileInlineExpression.js'\n\nconst name = 'forEach'\nconst dependencies = ['typed']\n\nexport const createForEachTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Attach a transform function to math.forEach\n * Adds a property transform containing the transform function.\n *\n * This transform creates a one-based index instead of a zero-based index\n */\n const forEach = createForEach({ typed })\n const transformCallback = createTransformCallback({ typed })\n function forEachTransform (args, math, scope) {\n if (args.length === 0) {\n return forEach()\n }\n let x = args[0]\n\n if (args.length === 1) {\n return forEach(x)\n }\n\n const N = args.length - 1\n let callback = args[N]\n\n if (x) {\n x = _compileAndEvaluate(x, scope)\n }\n\n if (callback) {\n if (isSymbolNode(callback) || isFunctionAssignmentNode(callback)) {\n // a function pointer, like filter([3, -2, 5], myTestFunction)\n callback = _compileAndEvaluate(callback, scope)\n } else {\n // an expression like filter([3, -2, 5], x > 0)\n callback = compileInlineExpression(callback, math, scope)\n }\n }\n\n return forEach(x, transformCallback(callback, N))\n }\n forEachTransform.rawArgs = true\n\n function _compileAndEvaluate (arg, scope) {\n return arg.compile().evaluate(scope)\n }\n return forEachTransform\n}, { isTransformFunction: true })\n","import {\n isArray, isBigInt, isBigNumber, isMatrix, isNumber, isRange\n} from '../../utils/is.js'\nimport { factory } from '../../utils/factory.js'\n\nconst name = 'index'\nconst dependencies = ['Index', 'getMatrixDataType']\n\nexport const createIndexTransform = /* #__PURE__ */ factory(name, dependencies, ({ Index, getMatrixDataType }) => {\n /**\n * Attach a transform function to math.index\n * Adds a property transform containing the transform function.\n *\n * This transform creates a one-based index instead of a zero-based index\n */\n return function indexTransform () {\n const args = []\n for (let i = 0, ii = arguments.length; i < ii; i++) {\n let arg = arguments[i]\n\n // change from one-based to zero based, convert BigNumber to number and leave Array of Booleans as is\n if (isRange(arg)) {\n arg.start--\n arg.end -= (arg.step > 0 ? 0 : 2)\n } else if (arg && arg.isSet === true) {\n arg = arg.map(function (v) { return v - 1 })\n } else if (isArray(arg) || isMatrix(arg)) {\n if (getMatrixDataType(arg) !== 'boolean') {\n arg = arg.map(function (v) { return v - 1 })\n }\n } else if (isNumber(arg) || isBigInt(arg)) {\n arg--\n } else if (isBigNumber(arg)) {\n arg = arg.toNumber() - 1\n } else if (typeof arg === 'string') {\n // leave as is\n } else {\n throw new TypeError('Dimension must be an Array, Matrix, number, bigint, string, or Range')\n }\n\n args[i] = arg\n }\n\n const res = new Index()\n Index.apply(res, args)\n return res\n }\n}, { isTransformFunction: true })\n","import { factory } from '../../utils/factory.js'\nimport { isFunctionAssignmentNode, isSymbolNode } from '../../utils/is.js'\nimport { createMap } from '../../function/matrix/map.js'\nimport { compileInlineExpression } from './utils/compileInlineExpression.js'\nimport { createTransformCallback } from './utils/transformCallback.js'\n\nconst name = 'map'\nconst dependencies = ['typed']\n\nexport const createMapTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed }) => {\n /**\n * Attach a transform function to math.map\n * Adds a property transform containing the transform function.\n *\n * This transform creates a one-based index instead of a zero-based index\n */\n const map = createMap({ typed })\n const transformCallback = createTransformCallback({ typed })\n\n function mapTransform (args, math, scope) {\n if (args.length === 0) {\n return map()\n }\n\n if (args.length === 1) {\n return map(args[0])\n }\n const N = args.length - 1\n let X = args.slice(0, N)\n let callback = args[N]\n X = X.map(arg => _compileAndEvaluate(arg, scope))\n\n if (callback) {\n if (isSymbolNode(callback) || isFunctionAssignmentNode(callback)) {\n // a function pointer, like filter([3, -2, 5], myTestFunction)\n callback = _compileAndEvaluate(callback, scope)\n } else {\n // an expression like filter([3, -2, 5], x > 0)\n callback = compileInlineExpression(callback, math, scope)\n }\n }\n return map(...X, transformCallback(callback, N))\n\n function _compileAndEvaluate (arg, scope) {\n return arg.compile().evaluate(scope)\n }\n }\n mapTransform.rawArgs = true\n\n return mapTransform\n}, { isTransformFunction: true })\n","import { isCollection } from '../../../utils/is.js'\nimport { dimToZeroBase, isNumberOrBigNumber } from './dimToZeroBase.js'\n/**\n * Change last argument dim from one-based to zero-based.\n */\nexport function lastDimToZeroBase (args) {\n if (args.length === 2 && isCollection(args[0])) {\n args = args.slice()\n const dim = args[1]\n if (isNumberOrBigNumber(dim)) {\n args[1] = dimToZeroBase(dim)\n }\n }\n return args\n}\n","import { isNumber, isBigNumber } from '../../../utils/is.js'\n/**\n * Change last argument dim from one-based to zero-based.\n */\nexport function dimToZeroBase (dim) {\n if (isNumber(dim)) {\n return dim - 1\n } else if (isBigNumber(dim)) {\n return dim.minus(1)\n } else {\n return dim\n }\n}\n\nexport function isNumberOrBigNumber (n) {\n return isNumber(n) || isBigNumber(n)\n}\n","import { factory } from '../../utils/factory.js'\nimport { errorTransform } from './utils/errorTransform.js'\nimport { createMax } from '../../function/statistics/max.js'\nimport { lastDimToZeroBase } from './utils/lastDimToZeroBase.js'\n\nconst name = 'max'\nconst dependencies = ['typed', 'config', 'numeric', 'larger', 'isNaN']\n\nexport const createMaxTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, numeric, larger, isNaN: mathIsNaN }) => {\n const max = createMax({ typed, config, numeric, larger, isNaN: mathIsNaN })\n\n /**\n * Attach a transform function to math.max\n * Adds a property transform containing the transform function.\n *\n * This transform changed the last `dim` parameter of function max\n * from one-based to zero based\n */\n return typed('max', {\n '...any': function (args) {\n args = lastDimToZeroBase(args)\n\n try {\n return max.apply(null, args)\n } catch (err) {\n throw errorTransform(err)\n }\n }\n })\n}, { isTransformFunction: true })\n","import { factory } from '../../utils/factory.js'\nimport { errorTransform } from './utils/errorTransform.js'\nimport { createMean } from '../../function/statistics/mean.js'\nimport { lastDimToZeroBase } from './utils/lastDimToZeroBase.js'\n\nconst name = 'mean'\nconst dependencies = ['typed', 'add', 'divide']\n\nexport const createMeanTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, add, divide }) => {\n const mean = createMean({ typed, add, divide })\n\n /**\n * Attach a transform function to math.mean\n * Adds a property transform containing the transform function.\n *\n * This transform changed the last `dim` parameter of function mean\n * from one-based to zero based\n */\n return typed('mean', {\n '...any': function (args) {\n args = lastDimToZeroBase(args)\n\n try {\n return mean.apply(null, args)\n } catch (err) {\n throw errorTransform(err)\n }\n }\n })\n}, { isTransformFunction: true })\n","import { factory } from '../../utils/factory.js'\nimport { errorTransform } from './utils/errorTransform.js'\nimport { createMin } from '../../function/statistics/min.js'\nimport { lastDimToZeroBase } from './utils/lastDimToZeroBase.js'\n\nconst name = 'min'\nconst dependencies = ['typed', 'config', 'numeric', 'smaller', 'isNaN']\n\nexport const createMinTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, numeric, smaller, isNaN: mathIsNaN }) => {\n const min = createMin({ typed, config, numeric, smaller, isNaN: mathIsNaN })\n\n /**\n * Attach a transform function to math.min\n * Adds a property transform containing the transform function.\n *\n * This transform changed the last `dim` parameter of function min\n * from one-based to zero based\n */\n return typed('min', {\n '...any': function (args) {\n args = lastDimToZeroBase(args)\n\n try {\n return min.apply(null, args)\n } catch (err) {\n throw errorTransform(err)\n }\n }\n })\n}, { isTransformFunction: true })\n","import { factory } from '../../utils/factory.js'\nimport { createRange } from '../../function/matrix/range.js'\n\nconst name = 'range'\nconst dependencies = ['typed', 'config', '?matrix', '?bignumber', 'smaller', 'smallerEq', 'larger', 'largerEq', 'add', 'isPositive']\n\nexport const createRangeTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, matrix, bignumber, smaller, smallerEq, larger, largerEq, add, isPositive }) => {\n const range = createRange({ typed, config, matrix, bignumber, smaller, smallerEq, larger, largerEq, add, isPositive })\n\n /**\n * Attach a transform function to math.range\n * Adds a property transform containing the transform function.\n *\n * This transform creates a range which includes the end value\n */\n return typed('range', {\n '...any': function (args) {\n const lastIndex = args.length - 1\n const last = args[lastIndex]\n if (typeof last !== 'boolean') {\n // append a parameter includeEnd=true\n args.push(true)\n }\n\n return range.apply(null, args)\n }\n })\n}, { isTransformFunction: true })\n","import { factory } from '../../utils/factory.js'\nimport { createRow } from '../../function/matrix/row.js'\nimport { errorTransform } from './utils/errorTransform.js'\nimport { isNumber } from '../../utils/is.js'\n\nconst name = 'row'\nconst dependencies = ['typed', 'Index', 'matrix', 'range']\n\n/**\n * Attach a transform function to matrix.column\n * Adds a property transform containing the transform function.\n *\n * This transform changed the last `index` parameter of function column\n * from zero-based to one-based\n */\nexport const createRowTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, Index, matrix, range }) => {\n const row = createRow({ typed, Index, matrix, range })\n\n // @see: comment of row itself\n return typed('row', {\n '...any': function (args) {\n // change last argument from zero-based to one-based\n const lastIndex = args.length - 1\n const last = args[lastIndex]\n if (isNumber(last)) {\n args[lastIndex] = last - 1\n }\n\n try {\n return row.apply(null, args)\n } catch (err) {\n throw errorTransform(err)\n }\n }\n })\n}, { isTransformFunction: true })\n","import { factory } from '../../utils/factory.js'\nimport { errorTransform } from './utils/errorTransform.js'\nimport { createSubset } from '../../function/matrix/subset.js'\n\nconst name = 'subset'\nconst dependencies = ['typed', 'matrix', 'zeros', 'add']\n\nexport const createSubsetTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, zeros, add }) => {\n const subset = createSubset({ typed, matrix, zeros, add })\n\n /**\n * Attach a transform function to math.subset\n * Adds a property transform containing the transform function.\n *\n * This transform creates a range which includes the end value\n */\n return typed('subset', {\n '...any': function (args) {\n try {\n return subset.apply(null, args)\n } catch (err) {\n throw errorTransform(err)\n }\n }\n })\n}, { isTransformFunction: true })\n","import { isBigNumber, isNumber } from '../../utils/is.js'\nimport { errorTransform } from './utils/errorTransform.js'\nimport { factory } from '../../utils/factory.js'\nimport { createConcat } from '../../function/matrix/concat.js'\n\nconst name = 'concat'\nconst dependencies = ['typed', 'matrix', 'isInteger']\n\nexport const createConcatTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, isInteger }) => {\n const concat = createConcat({ typed, matrix, isInteger })\n\n /**\n * Attach a transform function to math.range\n * Adds a property transform containing the transform function.\n *\n * This transform changed the last `dim` parameter of function concat\n * from one-based to zero based\n */\n return typed('concat', {\n '...any': function (args) {\n // change last argument from one-based to zero-based\n const lastIndex = args.length - 1\n const last = args[lastIndex]\n if (isNumber(last)) {\n args[lastIndex] = last - 1\n } else if (isBigNumber(last)) {\n args[lastIndex] = last.minus(1)\n }\n\n try {\n return concat.apply(null, args)\n } catch (err) {\n throw errorTransform(err)\n }\n }\n })\n}, { isTransformFunction: true })\n","import { factory } from '../../utils/factory.js'\nimport { errorTransform } from './utils/errorTransform.js'\nimport { createDiff } from '../../function/matrix/diff.js'\nimport { lastDimToZeroBase } from './utils/lastDimToZeroBase.js'\n\nconst name = 'diff'\nconst dependencies = ['typed', 'matrix', 'subtract', 'number', 'bignumber']\n\nexport const createDiffTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, subtract, number, bignumber }) => {\n const diff = createDiff({ typed, matrix, subtract, number, bignumber })\n\n /**\n * Attach a transform function to math.diff\n * Adds a property transform containing the transform function.\n *\n * This transform creates a range which includes the end value\n */\n return typed(name, {\n '...any': function (args) {\n args = lastDimToZeroBase(args)\n\n try {\n return diff.apply(null, args)\n } catch (err) {\n throw errorTransform(err)\n }\n }\n })\n}, { isTransformFunction: true })\n","import { factory } from '../../utils/factory.js'\nimport { createStd } from '../../function/statistics/std.js'\nimport { errorTransform } from './utils/errorTransform.js'\nimport { lastDimToZeroBase } from './utils/lastDimToZeroBase.js'\n\nconst name = 'std'\nconst dependencies = ['typed', 'map', 'sqrt', 'variance']\n\n/**\n * Attach a transform function to math.std\n * Adds a property transform containing the transform function.\n *\n * This transform changed the `dim` parameter of function std\n * from one-based to zero based\n */\nexport const createStdTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, map, sqrt, variance }) => {\n const std = createStd({ typed, map, sqrt, variance })\n\n return typed('std', {\n '...any': function (args) {\n args = lastDimToZeroBase(args)\n\n try {\n return std.apply(null, args)\n } catch (err) {\n throw errorTransform(err)\n }\n }\n })\n}, { isTransformFunction: true })\n","import { factory } from '../../utils/factory.js'\nimport { errorTransform } from './utils/errorTransform.js'\nimport { createSum } from '../../function/statistics/sum.js'\nimport { lastDimToZeroBase } from './utils/lastDimToZeroBase.js'\n\n/**\n * Attach a transform function to math.sum\n * Adds a property transform containing the transform function.\n *\n * This transform changed the last `dim` parameter of function sum\n * from one-based to zero based\n */\nconst name = 'sum'\nconst dependencies = ['typed', 'config', 'add', 'numeric']\n\nexport const createSumTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, add, numeric }) => {\n const sum = createSum({ typed, config, add, numeric })\n\n return typed(name, {\n '...any': function (args) {\n args = lastDimToZeroBase(args)\n\n try {\n return sum.apply(null, args)\n } catch (err) {\n throw errorTransform(err)\n }\n }\n })\n}, { isTransformFunction: true })\n","import { factory } from '../../utils/factory.js'\nimport { createQuantileSeq } from '../../function/statistics/quantileSeq.js'\nimport { lastDimToZeroBase } from './utils/lastDimToZeroBase.js'\n\nconst name = 'quantileSeq'\nconst dependencies = ['typed', 'bignumber', 'add', 'subtract', 'divide', 'multiply', 'partitionSelect', 'compare', 'isInteger', 'smaller', 'smallerEq', 'larger', 'mapSlices']\n\n/**\n * Attach a transform function to math.quantileSeq\n * Adds a property transform containing the transform function.\n *\n * This transform changed the `dim` parameter of function std\n * from one-based to zero based\n */\nexport const createQuantileSeqTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, bignumber, add, subtract, divide, multiply, partitionSelect, compare, isInteger, smaller, smallerEq, larger, mapSlices }) => {\n const quantileSeq = createQuantileSeq({ typed, bignumber, add, subtract, divide, multiply, partitionSelect, compare, isInteger, smaller, smallerEq, larger, mapSlices })\n\n return typed('quantileSeq', {\n 'Array | Matrix, number | BigNumber': quantileSeq,\n 'Array | Matrix, number | BigNumber, number': (arr, prob, dim) => quantileSeq(arr, prob, dimToZeroBase(dim)),\n 'Array | Matrix, number | BigNumber, boolean': quantileSeq,\n 'Array | Matrix, number | BigNumber, boolean, number': (arr, prob, sorted, dim) => quantileSeq(arr, prob, sorted, dimToZeroBase(dim)),\n 'Array | Matrix, Array | Matrix': quantileSeq,\n 'Array | Matrix, Array | Matrix, number': (data, prob, dim) => quantileSeq(data, prob, dimToZeroBase(dim)),\n 'Array | Matrix, Array | Matrix, boolean': quantileSeq,\n 'Array | Matrix, Array | Matrix, boolean, number': (data, prob, sorted, dim) => quantileSeq(data, prob, sorted, dimToZeroBase(dim))\n })\n\n function dimToZeroBase (dim) {\n // TODO: find a better way, maybe lastDimToZeroBase could apply to more cases.\n return lastDimToZeroBase([[], dim])[1]\n }\n}, { isTransformFunction: true })\n","import { isBigNumber, isCollection, isNumber } from '../../utils/is.js'\nimport { factory } from '../../utils/factory.js'\nimport { errorTransform } from './utils/errorTransform.js'\nimport { createCumSum } from '../../function/statistics/cumsum.js'\n\n/**\n * Attach a transform function to math.sum\n * Adds a property transform containing the transform function.\n *\n * This transform changed the last `dim` parameter of function sum\n * from one-based to zero based\n */\nconst name = 'cumsum'\nconst dependencies = ['typed', 'add', 'unaryPlus']\n\nexport const createCumSumTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, add, unaryPlus }) => {\n const cumsum = createCumSum({ typed, add, unaryPlus })\n\n return typed(name, {\n '...any': function (args) {\n // change last argument dim from one-based to zero-based\n if (args.length === 2 && isCollection(args[0])) {\n const dim = args[1]\n if (isNumber(dim)) {\n args[1] = dim - 1\n } else if (isBigNumber(dim)) {\n args[1] = dim.minus(1)\n }\n }\n\n try {\n return cumsum.apply(null, args)\n } catch (err) {\n throw errorTransform(err)\n }\n }\n })\n}, { isTransformFunction: true })\n","import { factory } from '../../utils/factory.js'\nimport { errorTransform } from './utils/errorTransform.js'\nimport { createVariance } from '../../function/statistics/variance.js'\nimport { lastDimToZeroBase } from './utils/lastDimToZeroBase.js'\n\nconst name = 'variance'\nconst dependencies = ['typed', 'add', 'subtract', 'multiply', 'divide', 'mapSlices', 'isNaN']\n\n/**\n * Attach a transform function to math.var\n * Adds a property transform containing the transform function.\n *\n * This transform changed the `dim` parameter of function var\n * from one-based to zero based\n */\nexport const createVarianceTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, add, subtract, multiply, divide, mapSlices, isNaN: mathIsNaN }) => {\n const variance = createVariance({ typed, add, subtract, multiply, divide, mapSlices, isNaN: mathIsNaN })\n\n return typed(name, {\n '...any': function (args) {\n args = lastDimToZeroBase(args)\n\n try {\n return variance.apply(null, args)\n } catch (err) {\n throw errorTransform(err)\n }\n }\n })\n}, { isTransformFunction: true })\n","import { createPrint } from '../../function/string/print.js'\nimport { factory } from '../../utils/factory.js'\nimport { printTemplate } from '../../utils/print.js'\n\nconst name = 'print'\nconst dependencies = ['typed', 'matrix', 'zeros', 'add']\n\nexport const createPrintTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, zeros, add }) => {\n const print = createPrint({ typed, matrix, zeros, add })\n return typed(name, {\n 'string, Object | Array': function (template, values) { return print(_convertTemplateToZeroBasedIndex(template), values) },\n 'string, Object | Array, number | Object': function (template, values, options) { return print(_convertTemplateToZeroBasedIndex(template), values, options) }\n })\n\n function _convertTemplateToZeroBasedIndex (template) {\n return template.replace(printTemplate, (x) => {\n const parts = x.slice(1).split('.')\n const result = parts.map(function (part) {\n if (!isNaN(part) && part.length > 0) {\n return parseInt(part) - 1\n } else {\n return part\n }\n })\n return '$' + result.join('.')\n })\n }\n}, { isTransformFunction: true })\n","import { createAnd } from '../../function/logical/and.js'\nimport { factory } from '../../utils/factory.js'\nimport { isCollection } from '../../utils/is.js'\n\nconst name = 'and'\nconst dependencies = ['typed', 'matrix', 'zeros', 'add', 'equalScalar', 'not', 'concat']\n\nexport const createAndTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, zeros, not, concat }) => {\n const and = createAnd({ typed, matrix, equalScalar, zeros, not, concat })\n\n function andTransform (args, math, scope) {\n const condition1 = args[0].compile().evaluate(scope)\n if (!isCollection(condition1) && !and(condition1, true)) {\n return false\n }\n const condition2 = args[1].compile().evaluate(scope)\n return and(condition1, condition2)\n }\n\n andTransform.rawArgs = true\n\n return andTransform\n}, { isTransformFunction: true })\n","import { createOr } from '../../function/logical/or.js'\nimport { factory } from '../../utils/factory.js'\nimport { isCollection } from '../../utils/is.js'\n\nconst name = 'or'\nconst dependencies = ['typed', 'matrix', 'equalScalar', 'DenseMatrix', 'concat']\n\nexport const createOrTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, DenseMatrix, concat }) => {\n const or = createOr({ typed, matrix, equalScalar, DenseMatrix, concat })\n\n function orTransform (args, math, scope) {\n const condition1 = args[0].compile().evaluate(scope)\n if (!isCollection(condition1) && or(condition1, false)) {\n return true\n }\n const condition2 = args[1].compile().evaluate(scope)\n return or(condition1, condition2)\n }\n\n orTransform.rawArgs = true\n\n return orTransform\n}, { isTransformFunction: true })\n","import { createBitAnd } from '../../function/bitwise/bitAnd.js'\nimport { factory } from '../../utils/factory.js'\nimport { isCollection } from '../../utils/is.js'\n\nconst name = 'bitAnd'\nconst dependencies = ['typed', 'matrix', 'zeros', 'add', 'equalScalar', 'not', 'concat']\n\nexport const createBitAndTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, zeros, not, concat }) => {\n const bitAnd = createBitAnd({ typed, matrix, equalScalar, zeros, not, concat })\n\n function bitAndTransform (args, math, scope) {\n const condition1 = args[0].compile().evaluate(scope)\n if (!isCollection(condition1)) {\n if (isNaN(condition1)) {\n return NaN\n }\n if (condition1 === 0 || condition1 === false) {\n return 0\n }\n }\n const condition2 = args[1].compile().evaluate(scope)\n return bitAnd(condition1, condition2)\n }\n\n bitAndTransform.rawArgs = true\n\n return bitAndTransform\n}, { isTransformFunction: true })\n","import { createBitOr } from '../../function/bitwise/bitOr.js'\nimport { factory } from '../../utils/factory.js'\nimport { isCollection } from '../../utils/is.js'\n\nconst name = 'bitOr'\nconst dependencies = ['typed', 'matrix', 'equalScalar', 'DenseMatrix', 'concat']\n\nexport const createBitOrTransform = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, DenseMatrix, concat }) => {\n const bitOr = createBitOr({ typed, matrix, equalScalar, DenseMatrix, concat })\n\n function bitOrTransform (args, math, scope) {\n const condition1 = args[0].compile().evaluate(scope)\n if (!isCollection(condition1)) {\n if (isNaN(condition1)) {\n return NaN\n }\n if (condition1 === (-1)) {\n return -1\n }\n if (condition1 === true) {\n return 1\n }\n }\n const condition2 = args[1].compile().evaluate(scope)\n return bitOr(condition1, condition2)\n }\n\n bitOrTransform.rawArgs = true\n\n return bitOrTransform\n}, { isTransformFunction: true })\n","export const DEFAULT_CONFIG = {\n // minimum relative difference between two compared values,\n // used by all comparison functions\n relTol: 1e-12,\n\n // minimum absolute difference between two compared values,\n // used by all comparison functions\n absTol: 1e-15,\n\n // type of default matrix output. Choose 'matrix' (default) or 'array'\n matrix: 'Matrix',\n\n // type of default number output. Choose 'number' (default) 'BigNumber', 'bigint', or 'Fraction'\n number: 'number',\n\n // type of fallback used for config { number: 'bigint' } when a value cannot be represented\n // in the configured numeric type. Choose 'number' (default) or 'BigNumber'.\n numberFallback: 'number',\n\n // number of significant digits in BigNumbers\n precision: 64,\n\n // predictable output type of functions. When true, output type depends only\n // on the input types. When false (default), output type can vary depending\n // on input values. For example `math.sqrt(-4)` returns `complex('2i')` when\n // predictable is false, and returns `NaN` when true.\n predictable: false,\n\n // random seed for seeded pseudo random number generation\n // null = randomly seed\n randomSeed: null\n}\n","import { clone, deepExtend } from '../../utils/object.js'\nimport { DEFAULT_CONFIG } from '../config.js'\n\nexport const MATRIX_OPTIONS = ['Matrix', 'Array'] // valid values for option matrix\nexport const NUMBER_OPTIONS = ['number', 'BigNumber', 'Fraction'] // valid values for option number\n\nexport function configFactory (config, emit) {\n /**\n * Set configuration options for math.js, and get current options.\n * Will emit a 'config' event, with arguments (curr, prev, changes).\n *\n * This function is only available on a mathjs instance created using `create`.\n *\n * Syntax:\n *\n * math.config(config: Object): Object\n *\n * Examples:\n *\n *\n * import { create, all } from 'mathjs'\n *\n * // create a mathjs instance\n * const math = create(all)\n *\n * math.config().number // outputs 'number'\n * math.evaluate('0.4') // outputs number 0.4\n * math.config({number: 'Fraction'})\n * math.evaluate('0.4') // outputs Fraction 2/5\n *\n * @param {Object} [options] Available options:\n * {number} relTol\n * Minimum relative difference between two\n * compared values, used by all comparison functions.\n * {number} absTol\n * Minimum absolute difference between two\n * compared values, used by all comparison functions.\n * {string} matrix\n * A string 'Matrix' (default) or 'Array'.\n * {string} number\n * A string 'number' (default), 'BigNumber', 'bigint', or 'Fraction'\n * {number} precision\n * The number of significant digits for BigNumbers.\n * Not applicable for Numbers.\n * {string} parenthesis\n * How to display parentheses in LaTeX and string\n * output.\n * {string} randomSeed\n * Random seed for seeded pseudo random number generator.\n * Set to null to randomly seed.\n * @return {Object} Returns the current configuration\n */\n function _config (options) {\n if (options) {\n if (options.epsilon !== undefined) {\n // this if is only for backwards compatibility, it can be removed in the future.\n console.warn('Warning: The configuration option \"epsilon\" is deprecated. Use \"relTol\" and \"absTol\" instead.')\n const optionsFix = clone(options)\n optionsFix.relTol = options.epsilon\n optionsFix.absTol = options.epsilon * 1e-3\n delete optionsFix.epsilon\n return _config(optionsFix)\n }\n const prev = clone(config)\n\n // validate some of the options\n validateOption(options, 'matrix', MATRIX_OPTIONS)\n validateOption(options, 'number', NUMBER_OPTIONS)\n\n // merge options\n deepExtend(config, options)\n\n const curr = clone(config)\n\n const changes = clone(options)\n\n // emit 'config' event\n emit('config', curr, prev, changes)\n\n return curr\n } else {\n return clone(config)\n }\n }\n\n // attach the valid options to the function so they can be extended\n _config.MATRIX_OPTIONS = MATRIX_OPTIONS\n _config.NUMBER_OPTIONS = NUMBER_OPTIONS\n\n // attach the config properties as readonly properties to the config function\n Object.keys(DEFAULT_CONFIG).forEach(key => {\n Object.defineProperty(_config, key, {\n get: () => config[key],\n enumerable: true,\n configurable: true\n })\n })\n\n return _config\n}\n\n/**\n * Validate an option\n * @param {Object} options Object with options\n * @param {string} name Name of the option to validate\n * @param {Array.} values Array with valid values for this option\n */\nfunction validateOption (options, name, values) {\n if (options[name] !== undefined && !values.includes(options[name])) {\n // unknown value\n console.warn('Warning: Unknown value \"' + options[name] + '\" for configuration option \"' + name + '\". ' +\n 'Available options: ' + values.map(value => JSON.stringify(value)).join(', ') + '.')\n }\n}\n","import * as all from './factoriesAny.js'\nimport { create } from './core/create.js'\n\nexport default create(all)\n","import typedFunction from 'typed-function'\nimport { ArgumentsError } from '../error/ArgumentsError.js'\nimport { DimensionError } from '../error/DimensionError.js'\nimport { IndexError } from '../error/IndexError.js'\nimport { factory, isFactory } from '../utils/factory.js'\nimport {\n isAccessorNode,\n isArray,\n isArrayNode,\n isAssignmentNode,\n isBigInt,\n isBigNumber,\n isBlockNode,\n isBoolean,\n isChain,\n isCollection,\n isComplex,\n isConditionalNode,\n isConstantNode,\n isDate,\n isDenseMatrix,\n isFraction,\n isFunction,\n isFunctionAssignmentNode,\n isFunctionNode,\n isHelp,\n isIndex,\n isIndexNode,\n isMap,\n isMatrix,\n isNode,\n isNull,\n isNumber,\n isObject,\n isObjectNode,\n isObjectWrappingMap,\n isOperatorNode,\n isParenthesisNode,\n isPartitionedMap,\n isRange,\n isRangeNode,\n isRegExp,\n isRelationalNode,\n isResultSet,\n isSparseMatrix,\n isString,\n isSymbolNode,\n isUndefined,\n isUnit\n} from '../utils/is.js'\nimport { deepFlatten, isLegacyFactory } from '../utils/object.js'\nimport * as emitter from './../utils/emitter.js'\nimport { DEFAULT_CONFIG } from './config.js'\nimport { configFactory } from './function/config.js'\nimport { importFactory } from './function/import.js'\n\n/**\n * Create a mathjs instance from given factory functions and optionally config\n *\n * Usage:\n *\n * const mathjs1 = create({ createAdd, createMultiply, ...})\n * const config = { number: 'BigNumber' }\n * const mathjs2 = create(all, config)\n *\n * @param {Object} [factories] An object with factory functions\n * The object can contain nested objects,\n * all nested objects will be flattened.\n * @param {Object} [config] Available options:\n * {number} relTol\n * Minimum relative difference between two\n * compared values, used by all comparison functions.\n * {number} absTol\n * Minimum absolute difference between two\n * compared values, used by all comparison functions.\n * {string} matrix\n * A string 'Matrix' (default) or 'Array'.\n * {string} number\n * A string 'number' (default), 'BigNumber', or 'Fraction'\n * {number} precision\n * The number of significant digits for BigNumbers.\n * Not applicable for Numbers.\n * {boolean} predictable\n * Predictable output type of functions. When true,\n * output type depends only on the input types. When\n * false (default), output type can vary depending\n * on input values. For example `math.sqrt(-4)`\n * returns `complex('2i')` when predictable is false, and\n * returns `NaN` when true.\n * {string} randomSeed\n * Random seed for seeded pseudo random number generator.\n * Set to null to randomly seed.\n * @returns {Object} Returns a bare-bone math.js instance containing\n * functions:\n * - `import` to add new functions\n * - `config` to change configuration\n * - `on`, `off`, `once`, `emit` for events\n */\nexport function create (factories, config) {\n const configInternal = Object.assign({}, DEFAULT_CONFIG, config)\n\n // simple test for ES5 support\n if (typeof Object.create !== 'function') {\n throw new Error('ES5 not supported by this JavaScript engine. ' +\n 'Please load the es5-shim and es5-sham library for compatibility.')\n }\n\n // create the mathjs instance\n const math = emitter.mixin({\n // only here for backward compatibility for legacy factory functions\n isNumber,\n isComplex,\n isBigNumber,\n isBigInt,\n isFraction,\n isUnit,\n isString,\n isArray,\n isMatrix,\n isCollection,\n isDenseMatrix,\n isSparseMatrix,\n isRange,\n isIndex,\n isBoolean,\n isResultSet,\n isHelp,\n isFunction,\n isDate,\n isRegExp,\n isObject,\n isMap,\n isPartitionedMap,\n isObjectWrappingMap,\n isNull,\n isUndefined,\n\n isAccessorNode,\n isArrayNode,\n isAssignmentNode,\n isBlockNode,\n isConditionalNode,\n isConstantNode,\n isFunctionAssignmentNode,\n isFunctionNode,\n isIndexNode,\n isNode,\n isObjectNode,\n isOperatorNode,\n isParenthesisNode,\n isRangeNode,\n isRelationalNode,\n isSymbolNode,\n\n isChain\n })\n\n // load config function and apply provided config\n math.config = configFactory(configInternal, math.emit)\n\n math.expression = {\n transform: {},\n mathWithTransform: {\n config: math.config\n }\n }\n\n // cached factories and instances used by function load\n const legacyFactories = []\n const legacyInstances = []\n\n /**\n * Load a function or data type from a factory.\n * If the function or data type already exists, the existing instance is\n * returned.\n * @param {Function} factory\n * @returns {*}\n */\n function load (factory) {\n if (isFactory(factory)) {\n return factory(math)\n }\n\n const firstProperty = factory[Object.keys(factory)[0]]\n if (isFactory(firstProperty)) {\n return firstProperty(math)\n }\n\n if (!isLegacyFactory(factory)) {\n console.warn('Factory object with properties `type`, `name`, and `factory` expected', factory)\n throw new Error('Factory object with properties `type`, `name`, and `factory` expected')\n }\n\n const index = legacyFactories.indexOf(factory)\n let instance\n if (index === -1) {\n // doesn't yet exist\n if (factory.math === true) {\n // pass with math namespace\n instance = factory.factory(math.type, configInternal, load, math.typed, math)\n } else {\n instance = factory.factory(math.type, configInternal, load, math.typed)\n }\n\n // append to the cache\n legacyFactories.push(factory)\n legacyInstances.push(instance)\n } else {\n // already existing function, return the cached instance\n instance = legacyInstances[index]\n }\n\n return instance\n }\n\n const importedFactories = {}\n\n // load the import function\n function lazyTyped (...args) {\n return math.typed.apply(math.typed, args)\n }\n lazyTyped.isTypedFunction = typedFunction.isTypedFunction\n\n const internalImport = importFactory(lazyTyped, load, math, importedFactories)\n math.import = internalImport\n\n // listen for changes in config, import all functions again when changed\n // TODO: move this listener into the import function?\n math.on('config', () => {\n Object.values(importedFactories).forEach(factory => {\n if (factory && factory.meta && factory.meta.recreateOnConfigChange) {\n // FIXME: only re-create when the current instance is the same as was initially created\n // FIXME: delete the functions/constants before importing them again?\n internalImport(factory, { override: true })\n }\n })\n })\n\n // the create function exposed on the mathjs instance is bound to\n // the factory functions passed before\n math.create = create.bind(null, factories)\n\n // export factory function\n math.factory = factory\n\n // import the factory functions like createAdd as an array instead of object,\n // else they will get a different naming (`createAdd` instead of `add`).\n math.import(Object.values(deepFlatten(factories)))\n\n math.ArgumentsError = ArgumentsError\n math.DimensionError = DimensionError\n math.IndexError = IndexError\n\n return math\n}\n","import Emitter from 'tiny-emitter'\n\n/**\n * Extend given object with emitter functions `on`, `off`, `once`, `emit`\n * @param {Object} obj\n * @return {Object} obj\n */\nexport function mixin (obj) {\n // create event emitter\n const emitter = new Emitter()\n\n // bind methods to obj (we don't want to expose the emitter.e Array...)\n obj.on = emitter.on.bind(emitter)\n obj.off = emitter.off.bind(emitter)\n obj.once = emitter.once.bind(emitter)\n obj.emit = emitter.emit.bind(emitter)\n\n return obj\n}\n","import { isBigNumber, isComplex, isFraction, isMatrix, isObject, isUnit } from '../../utils/is.js'\nimport { isFactory, stripOptionalNotation } from '../../utils/factory.js'\nimport { hasOwnProperty, lazy } from '../../utils/object.js'\nimport { ArgumentsError } from '../../error/ArgumentsError.js'\n\nexport function importFactory (typed, load, math, importedFactories) {\n /**\n * Import functions from an object or a module.\n *\n * This function is only available on a mathjs instance created using `create`.\n *\n * Syntax:\n *\n * math.import(functions)\n * math.import(functions, options)\n *\n * Where:\n *\n * - `functions: Object`\n * An object with functions or factories to be imported.\n * - `options: Object` An object with import options. Available options:\n * - `override: boolean`\n * If true, existing functions will be overwritten. False by default.\n * - `silent: boolean`\n * If true, the function will not throw errors on duplicates or invalid\n * types. False by default.\n * - `wrap: boolean`\n * If true, the functions will be wrapped in a wrapper function\n * which converts data types like Matrix to primitive data types like Array.\n * The wrapper is needed when extending math.js with libraries which do not\n * support these data type. False by default.\n *\n * Examples:\n *\n * import { create, all } from 'mathjs'\n * import * as numbers from 'numbers'\n *\n * // create a mathjs instance\n * const math = create(all)\n *\n * // define new functions and variables\n * math.import({\n * myvalue: 42,\n * hello: function (name) {\n * return 'hello, ' + name + '!'\n * }\n * })\n *\n * // use the imported function and variable\n * math.myvalue * 2 // 84\n * math.hello('user') // 'hello, user!'\n *\n * // import the npm module 'numbers'\n * // (must be installed first with `npm install numbers`)\n * math.import(numbers, {wrap: true})\n *\n * math.fibonacci(7) // returns 13\n *\n * @param {Object | Array} functions Object with functions to be imported.\n * @param {Object} [options] Import options.\n */\n function mathImport (functions, options) {\n const num = arguments.length\n if (num !== 1 && num !== 2) {\n throw new ArgumentsError('import', num, 1, 2)\n }\n\n if (!options) {\n options = {}\n }\n\n function flattenImports (flatValues, value, name) {\n if (Array.isArray(value)) {\n value.forEach(item => flattenImports(flatValues, item))\n } else if (isObject(value) || isModule(value)) {\n for (const name in value) {\n if (hasOwnProperty(value, name)) {\n flattenImports(flatValues, value[name], name)\n }\n }\n } else if (isFactory(value) || name !== undefined) {\n const flatName = isFactory(value)\n ? isTransformFunctionFactory(value)\n ? (value.fn + '.transform') // TODO: this is ugly\n : value.fn\n : name\n\n // we allow importing the same function twice if it points to the same implementation\n if (hasOwnProperty(flatValues, flatName) && flatValues[flatName] !== value && !options.silent) {\n throw new Error('Cannot import \"' + flatName + '\" twice')\n }\n\n flatValues[flatName] = value\n } else {\n if (!options.silent) {\n throw new TypeError('Factory, Object, or Array expected')\n }\n }\n }\n\n const flatValues = {}\n flattenImports(flatValues, functions)\n\n for (const name in flatValues) {\n if (hasOwnProperty(flatValues, name)) {\n // console.log('import', name)\n const value = flatValues[name]\n\n if (isFactory(value)) {\n // we ignore name here and enforce the name of the factory\n // maybe at some point we do want to allow overriding it\n // in that case we can implement an option overrideFactoryNames: true\n _importFactory(value, options)\n } else if (isSupportedType(value)) {\n _import(name, value, options)\n } else {\n if (!options.silent) {\n throw new TypeError('Factory, Object, or Array expected')\n }\n }\n }\n }\n }\n\n /**\n * Add a property to the math namespace\n * @param {string} name\n * @param {*} value\n * @param {Object} options See import for a description of the options\n * @private\n */\n function _import (name, value, options) {\n // TODO: refactor this function, it's to complicated and contains duplicate code\n if (options.wrap && typeof value === 'function') {\n // create a wrapper around the function\n value = _wrap(value)\n }\n\n // turn a plain function with a typed-function signature into a typed-function\n if (hasTypedFunctionSignature(value)) {\n value = typed(name, {\n [value.signature]: value\n })\n }\n\n if (typed.isTypedFunction(math[name]) && typed.isTypedFunction(value)) {\n if (options.override) {\n // give the typed function the right name\n value = typed(name, value.signatures)\n } else {\n // merge the existing and typed function\n value = typed(math[name], value)\n }\n\n math[name] = value\n delete importedFactories[name]\n\n _importTransform(name, value)\n math.emit('import', name, function resolver () {\n return value\n })\n return\n }\n\n const isDefined = math[name] !== undefined\n const isValuelessUnit = math.Unit?.isValuelessUnit(name)\n if ((!isDefined && !isValuelessUnit) || options.override) {\n math[name] = value\n delete importedFactories[name]\n\n _importTransform(name, value)\n math.emit('import', name, function resolver () {\n return value\n })\n return\n }\n\n if (!options.silent) {\n throw new Error('Cannot import \"' + name + '\": already exists')\n }\n }\n\n function _importTransform (name, value) {\n if (value && typeof value.transform === 'function') {\n math.expression.transform[name] = value.transform\n if (allowedInExpressions(name)) {\n math.expression.mathWithTransform[name] = value.transform\n }\n } else {\n // remove existing transform\n delete math.expression.transform[name]\n if (allowedInExpressions(name)) {\n math.expression.mathWithTransform[name] = value\n }\n }\n }\n\n function _deleteTransform (name) {\n delete math.expression.transform[name]\n if (allowedInExpressions(name)) {\n math.expression.mathWithTransform[name] = math[name]\n } else {\n delete math.expression.mathWithTransform[name]\n }\n }\n\n /**\n * Create a wrapper a round an function which converts the arguments\n * to their primitive values (like convert a Matrix to Array)\n * @param {Function} fn\n * @return {Function} Returns the wrapped function\n * @private\n */\n function _wrap (fn) {\n const wrapper = function wrapper () {\n const args = []\n for (let i = 0, len = arguments.length; i < len; i++) {\n const arg = arguments[i]\n args[i] = arg && arg.valueOf()\n }\n return fn.apply(math, args)\n }\n\n if (fn.transform) {\n wrapper.transform = fn.transform\n }\n\n return wrapper\n }\n\n /**\n * Import an instance of a factory into math.js\n * @param {function(scope: object)} factory\n * @param {Object} options See import for a description of the options\n * @param {string} [name=factory.name] Optional custom name\n * @private\n */\n function _importFactory (factory, options, name = factory.fn) {\n if (name.includes('.')) {\n throw new Error('Factory name should not contain a nested path. ' +\n 'Name: ' + JSON.stringify(name))\n }\n\n const namespace = isTransformFunctionFactory(factory)\n ? math.expression.transform\n : math\n\n const existingTransform = name in math.expression.transform\n const existing = hasOwnProperty(namespace, name) ? namespace[name] : undefined\n\n const resolver = function () {\n // collect all dependencies, handle finding both functions and classes and other special cases\n const dependencies = {}\n factory.dependencies\n .map(stripOptionalNotation)\n .forEach(dependency => {\n if (dependency.includes('.')) {\n throw new Error('Factory dependency should not contain a nested path. ' +\n 'Name: ' + JSON.stringify(dependency))\n }\n\n if (dependency === 'math') {\n dependencies.math = math\n } else if (dependency === 'mathWithTransform') {\n dependencies.mathWithTransform = math.expression.mathWithTransform\n } else if (dependency === 'classes') { // special case for json reviver\n dependencies.classes = math\n } else {\n dependencies[dependency] = math[dependency]\n }\n })\n\n const instance = /* #__PURE__ */ factory(dependencies)\n\n if (instance && typeof instance.transform === 'function') {\n throw new Error('Transforms cannot be attached to factory functions. ' +\n 'Please create a separate function for it with export const path = \"expression.transform\"')\n }\n\n if (existing === undefined || options.override) {\n return instance\n }\n\n if (typed.isTypedFunction(existing) && typed.isTypedFunction(instance)) {\n // merge the existing and new typed function\n return typed(existing, instance)\n }\n\n if (options.silent) {\n // keep existing, ignore imported function\n return existing\n } else {\n throw new Error('Cannot import \"' + name + '\": already exists')\n }\n }\n\n const former = factory.meta?.formerly ?? ''\n const needsTransform = isTransformFunctionFactory(factory) ||\n factoryAllowedInExpressions(factory)\n const withTransform = math.expression.mathWithTransform\n\n // TODO: add unit test with non-lazy factory\n if (!factory.meta || factory.meta.lazy !== false) {\n lazy(namespace, name, resolver)\n if (former) lazy(namespace, former, resolver)\n\n // FIXME: remove the `if (existing &&` condition again. Can we make sure subset is loaded before subset.transform? (Name collision, and no dependencies between the two)\n if (existing && existingTransform) {\n _deleteTransform(name)\n if (former) _deleteTransform(former)\n } else {\n if (needsTransform) {\n lazy(withTransform, name, () => namespace[name])\n if (former) lazy(withTransform, former, () => namespace[name])\n }\n }\n } else {\n namespace[name] = resolver()\n if (former) namespace[former] = namespace[name]\n\n // FIXME: remove the `if (existing &&` condition again. Can we make sure subset is loaded before subset.transform? (Name collision, and no dependencies between the two)\n if (existing && existingTransform) {\n _deleteTransform(name)\n if (former) _deleteTransform(former)\n } else {\n if (needsTransform) {\n lazy(withTransform, name, () => namespace[name])\n if (former) lazy(withTransform, former, () => namespace[name])\n }\n }\n }\n\n // TODO: improve factories, store a list with imports instead which can be re-played\n importedFactories[name] = factory\n\n math.emit('import', name, resolver)\n }\n\n /**\n * Check whether given object is a type which can be imported\n * @param {Function | number | string | boolean | null | Unit | Complex} object\n * @return {boolean}\n * @private\n */\n function isSupportedType (object) {\n return typeof object === 'function' ||\n typeof object === 'number' ||\n typeof object === 'string' ||\n typeof object === 'boolean' ||\n object === null ||\n isUnit(object) ||\n isComplex(object) ||\n isBigNumber(object) ||\n isFraction(object) ||\n isMatrix(object) ||\n Array.isArray(object)\n }\n\n function isModule (object) {\n return typeof object === 'object' && object[Symbol.toStringTag] === 'Module'\n }\n\n function hasTypedFunctionSignature (fn) {\n return typeof fn === 'function' && typeof fn.signature === 'string'\n }\n\n function allowedInExpressions (name) {\n return !hasOwnProperty(unsafe, name)\n }\n\n function factoryAllowedInExpressions (factory) {\n return !factory.fn.includes('.') && // FIXME: make checking on path redundant, check on meta data instead\n !hasOwnProperty(unsafe, factory.fn) &&\n (!factory.meta || !factory.meta.isClass)\n }\n\n function isTransformFunctionFactory (factory) {\n return (factory !== undefined &&\n factory.meta !== undefined &&\n factory.meta.isTransformFunction === true) || false\n }\n\n // namespaces and functions not available in the parser for safety reasons\n const unsafe = {\n expression: true,\n type: true,\n docs: true,\n error: true,\n json: true,\n chain: true // chain method not supported. Note that there is a unit chain too.\n }\n\n return mathImport\n}\n"],"names":["root","factory","exports","module","define","amd","this","isCallable","it","call","aCallable","anObject","tryToString","getIteratorMethod","$TypeError","TypeError","argument","usingIterator","iteratorMethod","arguments","length","$","iterate","getIteratorDirect","iteratorClose","findWithoutClosingOnEarlyError","iteratorHelperWithoutClosingOnEarlyError","target","proto","real","forced","find","predicate","error","record","counter","value","stop","IS_RECORD","INTERRUPTED","result","getBuiltIn","IS_PURE","NativePromiseConstructor","FORCED_PROMISE_CONSTRUCTOR","promiseResolve","PromiseConstructorWrapper","CHECK_WRAPPER","stat","resolve","x","uncurryThis","fails","hasOwn","DESCRIPTORS","CONFIGURABLE_FUNCTION_NAME","inspectSource","InternalStateModule","enforceInternalState","enforce","getInternalState","get","$String","String","defineProperty","Object","stringSlice","slice","replace","join","CONFIGURABLE_LENGTH","TEMPLATE","split","makeBuiltIn","name","options","getter","setter","configurable","arity","constructor","writable","prototype","undefined","state","source","Function","toString","FunctionPrototype","getDescriptor","getOwnPropertyDescriptor","EXISTS","PROPER","CONFIGURABLE","Internal","OwnPromiseCapability","nativeThen","IS_NODE","globalThis","defineBuiltIn","setPrototypeOf","setToStringTag","setSpecies","isObject","anInstance","speciesConstructor","task","microtask","hostReportErrors","perform","Queue","PromiseConstructorDetection","newPromiseCapabilityModule","PROMISE","CONSTRUCTOR","NATIVE_PROMISE_REJECTION_EVENT","REJECTION_EVENT","NATIVE_PROMISE_SUBCLASSING","SUBCLASSING","getInternalPromiseState","getterFor","setInternalState","set","NativePromisePrototype","PromiseConstructor","PromisePrototype","document","process","newPromiseCapability","f","newGenericPromiseCapability","DISPATCH_EVENT","createEvent","dispatchEvent","UNHANDLED_REJECTION","isThenable","then","callReaction","reaction","exited","ok","handler","fail","reject","domain","rejection","onHandleUnhandled","enter","exit","promise","notify","isReject","notified","reactions","onUnhandled","reason","event","initEvent","facade","isUnhandled","emit","parent","bind","fn","unwrap","internalReject","done","internalResolve","wrapper","executor","type","onFulfilled","onRejected","add","C","PromiseWrapper","that","unsafe","global","wrap","Promise","checkCorrectnessOfIteration","iterable","all","test","hasOwnProperty","classof","isPrototypeOf","Prototype","TO_STRING_TAG","wellKnownSymbol","TAG","STATIC","ceil","Math","floor","trunc","n","USE_SYMBOL_AS_UID","$Object","$Symbol","MATCH","isRegExp","getMethod","isNullOrUndefined","Iterators","ITERATOR","isForced","ENVIRONMENT","V8_VERSION","SPECIES","PromiseRejectionEvent","PROMISE_CONSTRUCTOR_SOURCE","GLOBAL_CORE_JS_PROMISE","FakePromise","exec","toObject","IndexedObject","lengthOfArrayLike","REDUCE_EMPTY","createMethod","IS_RIGHT","callbackfn","argumentsLength","memo","O","self","index","i","left","right","regExpFlags","RegExpPrototype","RegExp","R","flags","Target","Source","key","internalObjectKeys","enumBugKeys","keys","everyWithoutClosingOnEarlyError","every","stopped","has","NATIVE_WEAK_MAP","createNonEnumerableProperty","shared","sharedKey","hiddenKeys","OBJECT_ALREADY_INITIALIZED","WeakMap","store","metadata","STATE","TYPE","number","r","capability","capabilityReject","E","on","callback","ctx","e","push","once","listener","off","apply","_","data","evtArr","len","evts","liveEvents","TinyEmitter","createIteratorProxy","callWithSafeIterationClosing","mapWithoutClosingOnEarlyError","IteratorProxy","iterator","next","mapper","map","obj","toArray","toIndexedObject","indexOf","object","names","naturalSort","a","b","oFxNcL","oFyNcL","re","sre","dre","hre","ore","s","insensitive","toLowerCase","y","xN","yN","xD","parseInt","match","Date","parse","yD","cLoc","numS","max","parseFloat","isNaN","toggle","node","safeGetBuiltIn","macrotask","IS_IOS","IS_IOS_PEBBLE","IS_WEBOS_WEBKIT","MutationObserver","WebKitMutationObserver","queue","flush","head","nextTick","createTextNode","observe","characterData","method","descriptor","F","getPrototypeOf","aConstructor","defaultConstructor","S","activeXDocument","definePropertiesModule","html","documentCreateElement","PROTOTYPE","SCRIPT","IE_PROTO","EmptyConstructor","scriptTag","content","LT","NullProtoObjectViaActiveX","write","close","temp","parentWindow","NullProtoObject","ActiveXObject","iframeDocument","iframe","JS","style","display","appendChild","src","contentWindow","open","create","Properties","notOk","undef","NOT_TYPED_FUNCTION","isPlainObject","_types","Array","isArray","anyType","isAny","typeMap","typeList","nConversions","typed","createCount","findType","typeName","message","otherName","addTypes","types","beforeSpec","beforeIndex","newTypes","conversionsTo","affectedTypes","concat","clear","Map","findTypeNames","matches","filter","isTypedFunction","entity","findSignature","signature","exact","params","parseSignature","canonicalSignature","stringifyParams","signatures","_typedFunctionData","signatureMap","nParams","remainingSignatures","candidate","want","filteredSignatures","possibility","have","getParamAtIndex","restParam","hasAny","haveTypes","paramTypeSet","some","wtype","separator","p","parseParam","param","typeDefs","trim","paramName","typeIndex","conversion","conversionIndex","hasConversion","expandParam","matchingConversions","typeNames","sort","t1","t2","knownTypes","Set","newMatch","from","availableConversions","t","newName","convertibleTypes","typeSet","forEach","rawSignature","rawParams","parsedParam","SyntaxError","hasRestParam","last","compileTest","test0","test1","tests","compileTests","initial","varIndex","lastTest","testRestParam","args","getTypeSetAtIndex","isExactType","mergeExpectedParams","paramSet","createError","err","expected","_name","matchingSignatures","nextMatchingDefs","actualTypes","category","actual","lengths","Infinity","min","maxLength","expectedLength","argTypes","getLowestTypeIndex","getLowestConversionIndex","compareParams","param1","param2","typeDiff","convDiff","compareSignatures","signature1","signature2","pars1","pars2","last1","last2","hasRest1","hasRest2","par","any1","conv1","any2","conv2","lengthCriterion","comparisons","c","tc","thisComparison","compileArgsPreprocessing","fnConvert","compiledConversions","compileArgConversion","fnPreprocess","offset","conversion0","conversion1","conversions","convert","arg","splitParams","_splitParams","paramsSoFar","resultingParams","exactTypes","arr","nextParam","conflicting","params1","params2","ii","typeSet1","typeSet2","overlap","len1","len2","restParam1","restParam2","collectResolutions","references","functionList","resolvedReferences","reference","resolution","resolveReferences","resolvedFunctions","isReferToSelf","referToSelf","isReferTo","makeReferTo","referTo","clearResolutions","isResolved","fill","leftUnresolved","nothingResolved","createTypedFunction","rawSignaturesMap","warnAgainstDeprecatedThis","signaturesMap","deprecatedThisRegex","validateDeprecatedThis","parsedParams","originalFunctions","preliminarySignatures","pp","functionIndex","conversionParams","sp","spName","theTypedFn","internalSignatureMap","ok0","ok1","ok2","ok3","ok4","ok5","allOk","test00","test10","test20","test30","test40","test50","test01","test11","test21","test31","test41","test51","implementation","fn0","fn1","fn2","fn3","fn4","fn5","len0","len3","len4","len5","iStart","iEnd","fns","generic","onMismatch","arg0","arg1","_onMismatch","start","end","objectOrFn","checkName","nameSoFar","Error","getObjectName","mergeSignatures","dest","sourceFunction","destFunction","saveTyped","_validateConversion","to","maybeName","named","allSignatures","item","thisName","theseSignatures","throwMismatchError","clearConversions","_findType","addType","beforeObjectTest","before","addConversion","override","existing","other","removeConversion","addConversions","existingConversion","findInArray","splice","tf","argList","sigs","charAt","SUBSTITUTION_SYMBOLS","SUBSTITUTION_SYMBOLS_NO_NAMED","matched","str","position","captures","namedCaptures","replacement","tailPos","m","symbols","ch","capture","filterWithoutClosingOnEarlyError","isArrayIteratorMethod","getIterator","Result","ResultPrototype","unboundFunction","iterFn","step","AS_ENTRIES","IS_ITERATOR","condition","callFn","$reduce","arrayMethodIsStrict","CHROME_VERSION","reduce","isSymbol","ordinaryToPrimitive","TO_PRIMITIVE","input","pref","exoticToPrim","CORRECT_PROTOTYPE_GETTER","ObjectPrototype","feature","detection","normalize","POLYFILL","NATIVE","string","passed","required","navigator","userAgent","uncurryThisAccessor","requireObjectCoercible","aPossiblePrototype","CORRECT_SETTER","__proto__","XorGen","seed","me","strseed","z","w","v","d","k","charCodeAt","copy","impl","opts","xg","prng","double","int32","quick","xorwow","arraySlice","getReplacerFunction","NATIVE_SYMBOL","$stringify","numberToString","tester","low","hi","WRONG_SYMBOLS_CONVERSION","symbol","ILL_FORMED_UNICODE","stringifyWithSymbolsFix","replacer","$replacer","fixIllFormed","prev","stringify","space","console","_extends","assign","defaultEscapes","formatEscapes","defaultEscapeMapFn","_ref","_ref$preserveFormatti","preserveFormatting","_ref$escapeMapFn","escapeMapFn","runningStr","escapes","escapeKeys","_loop","specialCharFound","$this","dummy","Wrapper","NewTarget","NewTargetPrototype","xor128","id","postfix","random","promiseCapability","isPossiblePrototype","noop","construct","constructorRegExp","INCORRECT_TO_STRING","isConstructorModern","isConstructorLegacy","sham","called","someWithoutClosingOnEarlyError","webkit","$RegExp","dotAll","functionToString","firefox","getOwnPropertySymbols","UA","createProperty","fromEntries","createElement","ArrayPrototype","userAgentStartsWith","Bun","version","Deno","window","Pebble","val","valueOf","$includes","addToUnscopables","includes","el","SAFE_CLOSING","iteratorWithReturn","SKIP_CLOSING","ITERATION_SUPPORT","array","comparefn","element","j","middle","llength","rlength","lindex","rindex","Symbol","METHOD_NAME","ExpectedError","Iterator","IteratorPrototype","CLOSED","check","P","definePropertyModule","createPropertyDescriptor","pool","math","nodecrypto","width","startdenom","pow","significance","overflow","mask","seedrandom","shortseed","mixkey","flatten","entropy","tostring","out","randomBytes","Uint8Array","crypto","msCrypto","getRandomValues","browser","plugins","screen","autoseed","arc4","ARC4","g","pass","is_math_call","keylen","count","depth","prop","typ","smear","stringseed","fromCharCode","ex","inheritIfRequired","getOwnPropertyNames","getRegExpFlags","stickyHelpers","proxyAccessor","UNSUPPORTED_DOT_ALL","UNSUPPORTED_NCG","NativeRegExp","stringIndexOf","IS_NCG","re1","re2","CORRECT_NEW","MISSED_STICKY","UNSUPPORTED_Y","RegExpWrapper","pattern","rawFlags","sticky","handled","thisIsRegExp","patternIsRegExp","flagsAreUndefined","groups","rawPattern","chr","brackets","ncg","groupid","groupname","handleNCG","raw","handleDotAll","documentAll","IE8_DOM_DEFINE","V8_PROTOTYPE_DEFINE_BUG","toPropertyKey","$defineProperty","$getOwnPropertyDescriptor","ENUMERABLE","WRITABLE","Attributes","current","enumerable","getOwnPropertyNamesModule","getOwnPropertySymbolsModule","fixRegExpWellKnownSymbolLogic","toIntegerOrInfinity","toLength","advanceStringIndex","getSubstitution","regExpExec","REPLACE","REPLACE_KEEPS_$0","REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE","nativeReplace","maybeCallNative","UNSAFE_SUBSTITUTE","searchValue","replaceValue","rx","res","functionalReplace","fullUnicode","unicode","lastIndex","results","accumulatedResult","nextSourcePosition","replacerArgs","isConstructor","integer","V","func","PromiseCapability","$$resolve","$$reject","NATIVE_BIND","tychei","uid","ENTRIES","UNSCOPABLES","$promiseResolve","values","remaining","alreadyCalled","defineGlobalProperty","copyConstructorProperties","targetProperty","sourceProperty","TARGET","GLOBAL","dontCallGetSet","regexpExec","objectKeys","defineProperties","props","X","limit","init","xor4096","simple","nonConfigurable","nonWritable","deletePropertyOrThrow","internalSort","FF","IE_OR_EDGE","V8","WEBKIT","nativeSort","FAILS_ON_UNDEFINED","FAILS_ON_NULL","STRICT_METHOD","STABLE_SORT","code","itemsLength","items","arrayLength","getSortCompare","rawLength","keysLength","TO_STRING_TAG_SUPPORT","classofRaw","CORRECT_ARGUMENTS","tag","tryGet","callee","toPrimitive","bitmap","propertyIsEnumerable","Alea","mash","h","s0","s1","s2","alea","regexpFlags","nativeExec","patchedExec","UPDATES_LAST_INDEX_WRONG","BROKEN_CARET","NPCG_INCLUDED","reCopy","group","charsAdded","strCopy","multiline","propertyIsEnumerableModule","xorshift7","sr","defineBuiltInAccessor","forEachWithoutClosingOnEarlyError","SHARED","versions","mode","copyright","license","CONSTRUCTOR_NAME","Constructor","PrototypeOfArrayIteratorPrototype","arrayIterator","BUGGY_SAFARI_ITERATORS","ownKeys","getOwnPropertyDescriptorModule","exceptions","race","namespace","hasIndices","ignoreCase","unicodeSets","NativeIterator","FORCED","IteratorConstructor","defineIteratorPrototypeAccessor","CONVERT_TO_STRING","pos","first","second","size","codeAt","WellKnownSymbolsStore","createWellKnownSymbol","withoutSetter","FAILS_ON_INITIAL_UNDEFINED","reduceWithoutClosingOnEarlyError","reducer","noInitial","accumulator","tail","entry","Reflect","$propertyIsEnumerable","NASHORN_BUG","$location","defer","channel","port","validateArgumentsLength","setImmediate","clearImmediate","Dispatch","MessageChannel","ONREADYSTATECHANGE","location","run","runner","eventListener","globalPostMessageDefer","postMessage","protocol","host","now","port2","port1","onmessage","addEventListener","importScripts","removeChild","setTimeout","KEY","SHAM","SYMBOL","DELEGATES_TO_SYMBOL","DELEGATES_TO_EXEC","execCalled","nativeRegExpMethod","methods","nativeMethod","regexp","arg2","forceStringMethod","$exec","defineBuiltIns","createIterResultObject","ITERATOR_HELPER","WRAP_FOR_VALID_ITERATOR","createIteratorProxyPrototype","nextHandler","returnHandlerResult","returnMethod","inner","WrapForValidIteratorPrototype","IteratorHelperPrototype","RETURN_HANDLER_RESULT","NativeSymbol","SymbolPrototype","description","EmptyStringDescriptionStore","SymbolWrapper","thisSymbolValue","symbolDescriptiveString","desc","uncurryThisWithBind","v8","kind","innerResult","innerError","toAbsoluteIndex","IS_INCLUDES","fromIndex","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","loaded","__webpack_modules__","amdD","amdO","definition","o","toStringTag","nmd","paths","children","getSafeProperty","isSafeProperty","isSafeMethod","setSafeProperty","safeNativeProperties","safeNativeMethods","toLocaleString","ObjectWrappingMap","wrappedObject","entries","mapIterator","delete","PartitionedMap","bKeys","createEmptyMap","createMap","mapOrObject","isMap","isNumber","isBigNumber","isDecimal","isBigInt","isComplex","isFraction","isUnit","isString","isMatrix","isCollection","isDenseMatrix","isSparseMatrix","isRange","isIndex","isBoolean","isResultSet","isHelp","isFunction","isDate","isPartitionedMap","isObjectWrappingMap","isNull","isUndefined","isAccessorNode","isNode","isArrayNode","isAssignmentNode","isBlockNode","isConditionalNode","isConstantNode","rule2Node","isOperatorNode","op","isFunctionAssignmentNode","isFunctionNode","isIndexNode","isObjectNode","isParenthesisNode","isRangeNode","isRelationalNode","isSymbolNode","isChain","typeOf","clone","mapObject","extend","deepExtend","deepStrictEqual","deepFlatten","nestedObject","flattenedObject","_deepFlatten","lazy","valueResolver","_value","_uninitialized","property","dependencies","meta","assertAndCreate","scope","deps","properties","pickShallow","stripOptionalNotation","dependency","isOptionalDependency","missingDependencies","assertDependencies","isFactory","isInteger","isFinite","round","safeNumberType","numberStr","config","BigInt","_unused","numberFallback","sign","log2","log","LN2","log10","LN10","log1p","cbrt","negate","exp","expm1","formatNumberToBase","base","prefix","suffix","format","notation","precision","wordSize","normalizeFormatOptions","toFixed","toExponential","rounded","roundDigits","splitNumber","exponent","coefficients","newExp","missingZeros","abs","expDiff","decimalIdx","decimals","decimalVal","toEngineering","lowerExp","_toNumberOrDefault","upperExp","zeros","dot","toPrecision","digits","toNumber","_toNumberOrThrow","splitValue","shift","unshift","pop","nearlyEqual","relTol","absTol","acosh","sqrt","asinh","atanh","cosh","sinh","tanh","onError","defaultValue","_createTyped","typedFunction","createTyped","BigNumber","Complex","DenseMatrix","Fraction","throwNoBignumber","throwNoComplex","Number","MAX_SAFE_INTEGER","throwNoFraction","throwNoMatrix","matrix","usualError","sig","createResultSet","ResultSet","toJSON","mathjs","fromJSON","json","isClass","inexact","quadrant","EXP_LIMIT","MAX_DIGITS","NUMERALS","PI","DEFAULTS","rounding","modulo","toExpNeg","toExpPos","minE","maxE","external","decimalError","invalidArgument","precisionLimitExceeded","cryptoUnavailable","mathfloor","mathpow","isBinary","isHex","isOctal","BASE","LN10_PRECISION","PI_PRECISION","digitsToString","ws","indexOfLastWord","getZeroString","checkInt32","checkRoundingDigits","rm","repeating","di","rd","convertBase","baseIn","baseOut","arrL","strL","reverse","absoluteValue","finalise","clampedTo","clamp","Ctor","NaN","gt","cmp","comparedTo","xdL","ydL","xd","yd","xs","ys","cosine","cos","pr","sd","isZero","tinyPow","taylorSeries","times","cos2x","minus","plus","toLessThanHalfPi","neg","cubeRoot","rep","t3","t3plusx","divide","eq","decimalPlaces","dp","dividedBy","div","dividedToIntegerBy","divToInt","equals","greaterThan","greaterThanOrEqualTo","gte","hyperbolicCosine","one","cosh2_x","d8","hyperbolicSine","sinh2_x","d5","d16","d20","hyperbolicTangent","inverseCosine","acos","isNeg","getPi","atan","inverseHyperbolicCosine","lte","ln","inverseHyperbolicSine","inverseHyperbolicTangent","wpr","xsd","inverseSine","asin","halfPi","inverseTangent","px","x2","isInt","isNegative","isPositive","isPos","lessThan","lt","lessThanOrEqualTo","logarithm","isBase10","denominator","inf","num","naturalLogarithm","getLn10","sub","xe","xLTy","getBase10Exponent","mod","q","naturalExponential","negated","carry","getPrecision","sine","sin","sin2_x","squareRoot","tangent","tan","mul","rL","toBinary","toStringBinary","toDecimalPlaces","toDP","finiteToString","toFraction","maxD","d0","d1","d2","n0","n1","toHexadecimal","toHex","toNearest","toOctal","toPower","yn","intPow","toSignificantDigits","toSD","truncated","multiplyInteger","compare","aL","bL","subtract","logBase","more","prod","prodL","qd","rem","remL","rem0","xi","xL","yd0","yL","yz","isTruncated","roundUp","xdi","isExp","nonFiniteToString","zs","truncate","isOdd","maxOrMin","guard","sum","c0","numerator","x1","parseDecimal","search","substring","parseOther","divisor","isFloat","Decimal","isHyperbolic","u","pi","atan2","useDefaults","defaults","ps","hypot","isDecimalInstance","Uint32Array","for","ROUND_UP","ROUND_DOWN","ROUND_CEIL","ROUND_FLOOR","ROUND_HALF_UP","ROUND_HALF_DOWN","ROUND_HALF_EVEN","ROUND_HALF_CEIL","ROUND_HALF_FLOOR","EUCLID","createBigNumberClass","curr","parser_exit","logHypot","_a","_b","tokens","tInfin","zInfin","tIsZero","zIsZero","loh","im","er","xx","cosm1","tmp","noIM","oneMinus","onePlus","places","ret","createComplexClass","toPolar","phi","strRe","strIm","epsilon","fromPolar","hasBase","C_ZERO","C_ONE","C_TWO","C_FIVE","C_TEN","InvalidParameter","newFraction","DivisionByZero","gcd","factorize","factors","p1","p2","NonIntegerParameter","A","B","D","N","M","ndx","allPrimes","baseFactors","T1","numberFactors","T2","prime","retN","retD","baseExponent","numberExponent","curN","curD","gcdValue","dec","cycLen","cycleLen","cycOff","rem1","rem2","modpow","cycleStart","showMixed","whole","eps","ieps","thisABS","cont","createFractionClass","createRangeClass","Range","hasStart","hasEnd","hasStep","nums","diff","createMatrixClass","Matrix","storage","datatype","subset","resize","reshape","skipZeros","formatBigNumberToBase","big2","BigNumberCtor","endsWith","text","formatNumber","valueStr","formatBigNumber","looksLikeFraction","fraction","formatArray","syntax","_format","escaped","controlCharacters","escape","compareText","DimensionError","relation","stack","IndexError","arraySize","_validate","dim","dimNext","child","validate","validateIndexSourceSize","valueSize","_size","_sourceSize","sourceDim","validateIndex","isEmptyIndex","_dimensions","dimension","_data","_resize","elem","oldLen","newLen","minLen","sizes","flatArray","currentLength","newLength","product","processSizesWildcard","tmpArray2","tmpArray","sizeIndex","_reshape","processedSizes","wildCardIndex","squeeze","dims","_squeeze","unsqueeze","outer","_unsqueeze","isRectangular","flat","_flattenRectangular","_flatten","filterRegExp","identify","identifier","generalize","getArrayDataType","itemType","concatRecursive","concatDim","arrays","broadcastSizes","_len","_key","dimensions","sizeMax","checkBroadcastingRules","toSize","broadcastTo","Asize","broadcastedSize","paddedSize","arrayToStretch","sizeToStretch","dimToStretch","acc","deepMap","skipIndex","recursiveMap","recursiveMapWithIndex","deepForEach","recursiveForEach","recursiveForEachWithIndex","optimizeCallback","isUnary","numberOfArguments","fastCallback","firstIndex","firstValue","testArgs","_findNumberOfArgumentsTyped","dataType","singleSignature","matchingFunctions","_findSingleSignatureWithArity","_tryFunctionWithArgs","_len2","_key2","_findIfCallbackIsUnary","callbackStr","paramsStr","mappingFnName","callbackName","_err$data","argsDesc","_typeOf","JSON","_createCallbackError","RangeError","isDimensionError","isIndexError","createDenseMatrixClass","_datatype","preprocess","_fit","newSize","changed","createDenseMatrix","getDataType","isScalar","returnMatrix","submatrix","maxDepth","getSubmatrixRecursive","ranges","rangeIndex","_getSubmatrix","_get","iSize","sSize","setSubmatrixRecursive","range","_setSubmatrix","_set","indexI","sizeArray","fastCallbackFn","iterateUnary","inputData","recurse","rows","row","columns","col","diagonal","kSuper","kSub","ms","swapRows","_swapRows","vi","createClone","any","objectClone","_switch","mat","I","J","containsCollections","arrayDeepForEach","arrayDeepMap","skipZerosCallback","_reduce","tran","scatter","mark","cindex","inverse","update","avalues","_values","aindex","_index","aptr","_ptr","k0","k1","createIsInteger","isIntegerNumber","bigint","isNegativeNumber","isPositiveNumber","isNaNNumber","createIsNegative","bigNearlyEqual","Unit","valueType","createIsNumeric","number | BigNumber | bigint | Fraction | boolean","Complex | Unit | string | null | undefined | Node","createHasNumericValue","isNumeric","boolean","createIsPositive","createIsZero","equalScalar","createIsNaN","createTypeOf","createCompareUnits","equalBase","createEqualScalar","compareUnits","complexEquals","createSparseMatrixClass","_ref2","SparseMatrix","_createFromArray","_createFromMatrix","ptr","zero","_getValueIndex","top","bottom","_insert","ins","_toArray","createSparseMatrix","density","idx","kk","mvalues","mindex","mptr","pv","_getsubset","dataIndex","subIndex","firstDimensionRange","secondDimensionRange","firstDataIndex","firstSubIndex","secondDataIndex","secondSubIndex","_setsubset","_remove","colIndex","rowIndex","r1","c1","minRow","maxRow","minColumn","maxColumn","invoke","_map","_forEachRow","kx","ky","vx","vy","createNumber","nonDecimalNumberParts","nonDecimalWithRadixMatch","radix","integerPart","fractionalPart","getNonDecimalNumberParts","parts","makeNumberFromNonDecimalParts","wordSizeSuffixMatch","null","unit","valuelessUnit","createBigint","createString","createBoolean","lcase","createBignumber","twoPowSize","twoPowSizeSubOne","_x","createComplex","ZERO","createFraction","createMatrix","_create","createMatrixFromFunction","createMatrixFromRows","_createArray","checkVectorTypeAndReturnLength","rowLength","vec","createMatrixFromColumns","colLength","createSplitUnit","splitUnit","n2","absNumber","addNumber","subtractNumber","multiplyNumber","unaryMinusNumber","unaryPlusNumber","cbrtNumber","cubeNumber","expNumber","expm1Number","lcmNumber","logNumber","log10Number","log2Number","nthRootNumber","inv","signNumber","squareNumber","xgcdNumber","lastx","lasty","powNumber","roundNumber","createUnaryMinus","createUnaryPlus","numeric","createAbs","createMapSlices","_mapSlices","formerly","createAddScalar","fixPrefix","createSubtractScalar","createCbrt","unaryMinus","_cbrtComplex","third","allRoots","arg3","principal","createMatAlgo11xS0s","asize","adt","dt","cf","cvalues","cptr","createMatAlgo12xSfs","cdata","createMatAlgo14xDs","adata","_iterate","level","av","bv","cv","bigTen","createCeilNumber","_ceilNumber","createCeil","matAlgo11xS0s","matAlgo12xSfs","matAlgo14xDs","ceilNumber","_bigCeil","bne","bigint, number","_dummy","bigint, BigNumber","valueless","toNumeric","multiply","createCube","createExp","createExpm1","createFixNumber","createFix","fixNumber","bn","createFloorNumber","_floorNumber","createFloor","floorNumber","_bigFloor","createMatAlgo02xDS0","denseMatrix","sparseMatrix","bvalues","bindex","bptr","bsize","bdt","cij","createMatAlgo03xDSf","createMatAlgo05xSfSf","xa","xb","wa","wb","wai","wbi","vc","createMatAlgo13xDD","bdata","csize","broadcast","_broadcastTo","createMatrixAlgorithmSuite","matAlgo13xDD","elop","SD","DS","matrixSignatures","DenseMatrix, DenseMatrix","Array, Array","Array, DenseMatrix","DenseMatrix, Array","SS","scalar","Ds","Ss","sS","createMod","matAlgo02xDS0","matAlgo03xDSf","matAlgo05xSfSf","matrixAlgorithmSuite","createMatAlgo01xDSid","createMatAlgo04xSidSid","createMatAlgo10xSids","ArgumentsError","isArgumentsError","gcdTypes","gcdManyTypesSignature","is1d","createGcd","matAlgo01xDSid","matAlgo04xSidSid","matAlgo10xSids","Fraction, Fraction","createMatAlgo06xS0S0","createLcm","matAlgo06xS0S0","lcmTypes","lcmManySignature","lcm","promoteLogarithm","log16","numberLog","cplx","predictable","s15","createLog10","complexLog","complexLogNumber","createLog2","complexLog2Number","_log2Complex","newX","createMultiplyScalar","number | Fraction | BigNumber | Complex, Unit","Unit, number | Fraction | BigNumber | Complex | Unit","createMultiply","addScalar","multiplyScalar","_validateMatrixDimensions","size1","size2","_multiplyMatrixVector","arows","acolumns","af","mf","brows","ib","vbi","ka0","ka1","ka","ia","ic","_multiplyMatrixMatrix","bcolumns","jb","kb0","kb1","kb","vbij","p0","selfMM","xsize","ysize","_multiplyVectorVector","alength","_multiplyVectorDenseMatrix","_multiplyVectorMatrix","rest","createNthRoot","complexErr","_bigNthRoot","selfDn","selfSn","selfDS","Big","createSign","complex","_isDerived","units","createSqrt","_sqrtNumber","createSquare","createSubtract","subtractScalar","createXgcd","createInvmod","xgcd","equal","smaller","invmod","createMatAlgo09xS0Sf","vb","createDotMultiply","matAlgo09xS0Sf","bitAndBigNumber","bitwise","bitNotBigNumber","prevPrec","bitOrBigNumber","negOne","xBits","yBits","xSign","ySign","decCoefficientToBinaryString","minBits","maxBits","minSign","shortLen","longLen","expFuncVal","outVal","twoPower","two","bitXor","leftShiftBigNumber","rightArithShiftBigNumber","bitAndNumber","bitNotNumber","bitOrNumber","bitXorNumber","leftShiftNumber","rightArithShiftNumber","rightLogShiftNumber","createBitAnd","bigint, bigint","createBitNot","createBitOr","createMatAlgo07xSSf","nonZeroCount","_scatter","createBitXor","matAlgo07xSSf","bigBitXor","createArg","createConj","conjugate","formatUnits","createIm","createRe","notNumber","orNumber","xorNumber","andNumber","createNot","null | undefined","createOr","createXor","createConcat","prevDim","asMatrix","matrices","_concat","createColumn","Index","_column","column","rowRange","createCross","_cross","highestDimension","xSize","ySize","createDiag","_diag","l","_createDiagonalMatrix","dm","vector","_getDiagonal","createFilter","_filterCallback","createFlatten","flattenArray","createForEach","_forEach","createGetMatrixDataType","createIdentity","_identity","cols","_identityVector","minimum","createKron","_kron","_mapArray","Array|Matrix, Array|Matrix, ...Array|Matrix|function","Arrays","multiCallback","firstArrayIsMatrix","broadcastedArrays","firstValues","callbackCase","_getTypedCallbackCase","_getLimitedCallback","numberOfArrays","_getCallbackCase","broadcastedArraysCallback","_mapMultiple","createDiff","_diff","_recursive","selfAn","selfMn","_ElementDiff","obj1","obj2","obj1IsArray","obj2IsArray","arr1","arr2","_ArrayDiff","createOnes","_ones","hasBigNumbers","_normalize","noBignumber","noFraction","noMatrix","createRange","bignumber","smallerEq","larger","largerEq","_strRange","oops","_out","_range","includeEnd","_parse","ongoing","createReshape","arrayReshape","createResize","defaultChar","_resizeString","arrayResize","createRotate","rotationMatrix","theta","_validateSize","expectedSize","actualSize","createRotationMatrix","norm","_rotationMatrix2x2","matrixV","_validateVector","_rotationMatrix3x3","storageType","minusOne","cosTheta","sinTheta","_convertToFormat","_mul","normV","vz","oneMinusC","createRow","_row","columnRange","createSize","createSqueeze","arraySqueeze","createSubset","subsetRef","subsetResult","_getObjectProperty","_getSubstring","_isScalar","indexSize","_broadcastReplacement","_setSubstring","_setObjectProperty","strLen","substr","chars","updated","createTranspose","transposeMatrix","transposed","transposedRow","_denseTranspose","_sparseTranspose","createCtranspose","transpose","conj","createZeros","_zeros","createFft","divideScalar","tau","dotDivide","_ndFft","_fft","_1dFft","_transpose","chirp","N2","xp","ichirp","fftXp","fftIchirp","fftProduct","ifftProduct","_czt","createIfft","fft","createSolveODE","_rk","butcherTableau","tspan","y0","isNumOrBig","t0","isForwards","firstStep","maxStep","minStep","timeVars","tol","minDelta","maxDelta","maxIter","bp","deltaB","iter","_createOngoing","trimStep","outOfBounds","_createTrimStep","TE","delta","_rk23","_rk45","_solveODE","opt","RK23","RK45","toUpperCase","methodOptions","methodsWithQuotes","availableMethodsString","_matrixSolveODE","T","sol","function, Array, Array","function, Matrix, Matrix","function, Array, number | BigNumber | Unit","Y","function, Matrix, number | BigNumber | Unit","function, Array, number | BigNumber | Unit, Object","function, Matrix, number | BigNumber | Unit, Object","createErf","MAX_NUM","THRESH","ysq","xnum","xden","Q","erf1","del","erfc2","SQRPI","erfc3","createZeta","factorial","gamma","zetaNumeric","zeta","createValue","determineDigits","getRe","factor","createMode","mathIsNaN","_mode","improveErrorMessage","fnName","details","createProd","_prod","createFormat","formatString","createBin","createOct","createHex","printTemplate","createPrint","_print","template","original","createTo","Unit, Unit | string","createIsPrime","modPow","modulus","bases","adn","createNumeric","validInputTypes","validOutputTypes","outputType","inputType","createDivideScalar","Unit, number | Complex | Fraction | BigNumber | Unit","number | Fraction | Complex | BigNumber, Unit","divideInto","createPow","identity","_pow","_powArray","_powMatrix","yFrac","yNum","NO_INT","createRound","toExponent","xEpsilon","epsilonExponent","_n","nlg16","createLog","createLog1p","_log1p","_log1pComplex","xRe1p","createNthRoots","_calculateExactResult","_nthComplexRoots","aIsNumeric","roots","halfPiFactor","createDotPow","powScalarSignatures","powScalar","createDotDivide","createSolveValidation","mSize","bSize","createLsolve","solveValidation","bj","vjj","jValues","jIndices","xj","_sparseForwardSubstitution","_denseForwardSubstitution","mdata","createUsolve","_sparseBackwardSubstitution","_denseBackwardSubstitution","createLsolveAll","b_","L","iValues","iIndices","Mii","bNew","createUsolveAll","createMatAlgo08xS0Sid","createUseMatrixForArrayScalar","selfDB","selfnD","selfBD","createLeftShift","matAlgo08xS0Sid","useMatrixForArrayScalar","createRightArithShift","createRightLogShift","createAnd","not","createCompare","createCompareNumber","createCompareNatural","compareBooleans","_compareNatural","typeX","typeY","matTypes","compareMatricesAndArrays","compareComplexNumbers","compareArrays","compareNatural","keysX","keysY","compareObjects","_compareText","createCompareText","createEqual","createEqualNumber","createEqualText","createSmaller","bignumSmaller","createSmallerNumber","boolean, boolean","createSmallerEq","createSmallerEqNumber","createLarger","bignumLarger","createLargerNumber","createLargerEq","createLargerEqNumber","createDeepEqual","_deepEqual","createUnequal","createUnequalNumber","createPartitionSelect","asc","_partitionSelect","quickSelect","pivot","createSort","compareAsc","compareDesc","_arrayIsVector","_matrixIsVector","_comparator","order","createMax","_max","_largest","createMin","_min","_smallest","createImmutableDenseMatrixClass","ImmutableDenseMatrix","isImmutableDenseMatrix","createIndexClass","getMatrixDataType","argIsArray","argIsMatrix","argType","sourceSize","_createImmutableMatrix","_booleansArrayToNumbersForIndex","isObjectProperty","getObjectProperty","strings","booleanArrayIndex","indexOfNumbers","bool","createFibonacciHeapClass","oneOverLogPhi","FibonacciHeap","_minimum","_cut","degree","_cascadingCut","isFibonacciHeap","insert","isEmpty","extractMinimum","numberOfChildren","tempRight","numRoots","_linkNodes","_findMinimumNode","remove","_decreaseKey","createSpaClass","Spa","_heap","isSpa","accumulate","heap","nodes","swap","nodei","nodej","lruQueue","oldIndex","hit","nuIndex","memoize","hasher","POSITIVE_INFINITY","cache","lru","hash","newVal","createBigNumberE","createBigNumberPhi","createBigNumberPi","createBigNumberTau","createUnitClass","fix","skipAutomaticSimplification","BASE_DIMENSIONS","skipWhitespace","isDigit","revert","parseNumber","isDigitDot","tentativeNumber","tentativeIndex","parseUnit","unitName","isValidAlpha","firstC","parseCharacter","toFind","powerMultiplierCurrent","expectingUnit","powerMultiplierStack","powerMultiplierStackProduct","uStr","oldC","_findUnit","power","baseDim","UNIT_SYSTEMS","auto","allowNoUnits","_getNumberConverter","unitValue","unitPrefixValue","unitPower","_denormalize","prefixValue","UNITS","prefixes","prefixLen","prefixName","getNumericIfUnitless","BASE_UNITS","NONE","typeOfValue","isValuelessUnit","_other","inverted","valThis","valOther","_numberConverter","nominalOffset","unitOffset","W","thisUnitValue","thisNominalOffset","thisUnitOffset","otherUnitValue","otherNominalOffset","otherUnitOffset","_json$unit","simplify","proposedUnitList","matchingBase","currentUnitSystem","matchingUnit","missingBaseDim","toSI","si","strNum","strDen","nNum","nDen","simp","isImaginary","VAR","VA","_bestPrefix","unitStr","absValue","absUnitValue","bestPrefix","bestDiff","scientific","xNumeric","xRounded","xFixed","testSum","PREFIXES","SHORT","da","G","Z","LONG","deca","hecto","kilo","mega","giga","tera","peta","exa","zetta","yotta","ronna","quetta","deci","centi","milli","micro","nano","pico","femto","atto","zepto","yocto","ronto","quecto","SQUARED","CUBIC","BINARY_SHORT_SI","BINARY_SHORT_IEC","Ki","Mi","Gi","Ti","Pi","Ei","Zi","Yi","BINARY_LONG_SI","BINARY_LONG_IEC","kibi","mebi","gibi","tebi","pebi","exi","zebi","yobi","BTU","MM","SHORTLONG","BINARY_SHORT","BINARY_LONG","MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","FORCE","SURFACE","VOLUME","ENERGY","POWER","PRESSURE","ELECTRIC_CHARGE","ELECTRIC_CAPACITANCE","ELECTRIC_POTENTIAL","ELECTRIC_RESISTANCE","ELECTRIC_INDUCTANCE","ELECTRIC_CONDUCTANCE","MAGNETIC_FLUX","MAGNETIC_FLUX_DENSITY","FREQUENCY","ANGLE","BIT","UNIT_NONE","meter","inch","foot","yard","mile","link","rod","chain","angstrom","in","ft","mi","li","mil","m2","sqin","sqft","sqyd","sqmi","sqrd","sqch","sqmil","acre","hectare","m3","litre","cuin","cuft","cuyd","teaspoon","tablespoon","drop","gtt","minim","fluiddram","fluidounce","gill","cc","cup","pint","quart","gallon","beerbarrel","oilbarrel","hogshead","gram","ton","tonne","grain","dram","ounce","poundmass","hundredweight","stick","stone","gr","dr","oz","lbm","cwt","sec","minute","hour","day","week","month","year","decade","century","millennium","hertz","reciprocal","Hz","rad","radian","deg","grad","gradian","cycle","arcsec","arcmin","ampere","K","degC","degF","degR","kelvin","celsius","fahrenheit","rankine","mol","mole","cd","candela","newton","dyn","dyne","lbf","poundforce","kip","kilogramforce","joule","erg","Wh","eV","electronvolt","watt","hp","Pa","psi","atm","bar","torr","mmHg","mmH2O","cmH2O","coulomb","farad","volt","ohm","henry","H","siemens","weber","Wb","tesla","bits","bytes","ALIASES","meters","inches","feet","yards","miles","links","rods","chains","angstroms","litres","liter","liters","teaspoons","tablespoons","minims","fldr","fluiddrams","floz","fluidounces","gi","gills","cp","cups","pt","pints","qt","quarts","gal","gallons","bbl","beerbarrels","obl","oilbarrels","hogsheads","gtts","grams","tons","tonnes","grains","drams","ounces","poundmasses","hundredweights","sticks","lb","lbs","kips","kgf","acres","hectares","sqfeet","sqyard","sqmile","sqmiles","mmhg","mmh2o","cmh2o","seconds","secs","minutes","mins","hours","hr","hrs","days","weeks","months","years","decades","centuries","millennia","radians","degrees","gradians","cycles","arcsecond","arcseconds","arcminute","arcminutes","BTUs","watts","joules","amperes","amps","amp","coulombs","volts","ohms","farads","webers","teslas","electronvolts","moles","bit","byte","calculateAngleValues","createPi","cgs","us","setUnitSystem","getUnitSystem","typeConverters","alias","createUnit","deleteUnit","aliases","lastUnit","createUnitSingle","assertUnitNameIsValid","baseName","defUnit","newUnit","anyMatch","newBaseUnit","aliasName","createUnitFunction","createSparse","createCreateUnit","def","createAcos","acoshNumber","acotNumber","acothNumber","acscNumber","acschNumber","xInv","asecNumber","asechNumber","asinhNumber","atanhNumber","cotNumber","cothNumber","cscNumber","cschNumber","secNumber","sechNumber","sinhNumber","createAcosh","createAcot","acot","createAcoth","acoth","createAcsc","acsc","createAcsch","acsch","createAsec","asec","createAsech","asech","createAsin","createAsinh","createAtan","createAtan2","BigNumber, BigNumber","createAtanh","createTrigUnit","createCos","trigUnit","createCosh","coshNumber","createCot","cot","createCoth","coth","createCsc","csc","createCsch","csch","createSec","createSech","sech","createSin","createSinh","createTan","createTanh","_tanh","createSetCartesian","a1","a2","b1","b2","createSetDifference","inb2","createSetDistinct","createSetIntersect","createSetIsSubset","createSetMultiplicity","createSetPowerset","_subset","_sort","bitarray","createSetSize","unique","createSetSymDifference","setDifference","createSetUnion","setIntersect","setSymDifference","createAdd","createHypot","_hypot","largest","createNorm","ctranspose","eigs","_norm","sizeX","pinf","_vectorNormPlusInfinity","NEGATIVE_INFINITY","ninf","_vectorNormMinusInfinity","_vectorNorm","maxc","cj","_matrixNormOne","maxr","ri","_matrixNormInfinity","fro","_matrixNormFrobenius","tx","squaredX","eigenVals","rho","_matrixNormTwo","_matrixNorm","createDot","_validateDim","aIsColumn","bIsColumn","xindex","xvalues","yindex","yvalues","xLen","yLen","createTrace","_denseTrace","createIndex","keywords","createNode","mathWithTransform","evaluate","compile","expr","_compile","_validateScope","argNames","_ifNode","traverse","_traverse","path","transform","_transform","cloneDeep","customString","_getCustomString","_toString","toHTML","_toHTML","toTex","_toTex","getIdentifier","getContent","_typeof","_defineProperty","errorTransform","accessFactory","createAccessorNode","Node","access","needParenthesis","AccessorNode","super","evalObject","evalIndex","context","createArrayNode","ArrayNode","evalItems","evalItem","itemsToTex","nested","mixedItems","itemsFormRow","itemSep","itemsTex","AssignmentNode","FunctionAssignmentNode","ConditionalNode","latexLeftParens","latexRightParens","latexParens","associativity","associativeWith","RelationalNode","RangeNode","unwrapParen","_node","parenthesis","getPrecedence","implicit","precedence","leftArg","getAssociativity","isAssociativeWith","nodeA","nodeB","identifierA","identifierB","createAssignmentNode","assignFactory","exprPrecedence","evalValue","childObject","evalParentObject","parentProp","evalParentIndex","parentIndex","createBlockNode","BlockNode","blocks","block","visible","evalBlocks","createConditionalNode","trueExpr","falseExpr","evalCondition","evalTrueExpr","evalFalseExpr","testCondition","conditionPrecedence","truePrecedence","falsePrecedence","latexSymbols","Alpha","alpha","Beta","beta","Gamma","Delta","Epsilon","varepsilon","Zeta","Eta","eta","Theta","vartheta","Iota","iota","Kappa","kappa","varkappa","Lambda","lambda","Mu","mu","Nu","nu","Xi","Omicron","omicron","varpi","Rho","varrho","Sigma","sigma","varsigma","Tau","Upsilon","upsilon","Phi","varphi","Chi","chi","Psi","Omega","omega","true","false","Inf","infinity","oo","lim","latexOperators","dotPow","unaryPlus","bitNot","dotMultiply","leftShift","rightArithShift","rightLogShift","unequal","bitAnd","bitOr","and","xor","or","latexFunctions","cube","nthRoot","nthRoots","square","bellNumbers","catalan","stirlingS2","cross","det","expm","pinv","sqrtm","trace","combinations","combinationsWithRep","lgamma","erf","variance","sparse","latexUnits","escapeLatex","escapeLatexLib","toSymbol","createConstantNode","ConstantNode","toLatex","createFunctionAssignmentNode","paramNames","childArgNames","evalExpr","childArgs","createIndexNode","IndexNode","dotNotation","evalDimensions","_evalDimension","evalDimension","createObjectNode","ObjectNode","evalEntries","stringifiedKey","parsedKey","createSubScope","parentScope","createOperatorNode","startsWithConstant","curNode","calculateNecessaryParentheses","latex","operandPrecedence","operandIdentifier","rootIdentifier","lhsParens","lhsPrecedence","assocWithLhs","rhsParens","rhsPrecedence","assocWithRhs","lhsIdentifier","rhsIdentifier","argPrecedence","assocWithArg","argAssociativity","OperatorNode","isPercentage","evalArgs","rawArgs","evalArg0","evalArg1","evalArg","parens","assoc","operand","opIsNamed","lhs","rhs","stringifiedArgs","lhsTex","rhsTex","texifiedArgs","createParenthesisNode","ParenthesisNode","createRangeNode","startPrecedence","stepPrecedence","endPrecedence","needsEnd","evalStart","evalEnd","evalStep","createRelationalNode","operatorMap","conditionals","compiled","evalLhs","evalRhs","condFn","paramStrings","paramPrecedence","createSymbolNode","SymbolNode","onUndefinedSymbol","createFunctionNode","_FunctionNode","strin","expandTemplate","regex","inputPos","ReferenceError","FunctionNode","getSafeMethod","fnExpr","evalFn","isRaw","resolveFn","onUndefinedFunction","customTex","latexConverter","customToTex","createParse","expression","parseStart","expressions","parseMultiple","extraNodes","TOKENTYPE","NULL","DELIMITER","NUMBER","UNKNOWN","DELIMITERS","NAMED_DELIMITERS","CONSTANTS","NUMERIC_CONSTANTS","ESCAPE_CHARACTERS","currentString","currentCharacter","prevCharacter","nextCharacter","getToken","tokenType","token","comment","isWhitespace","nestingLevel","c2","c3","isHexDigit","isDecimalMark","createSyntaxError","isAlpha","getTokenSkipNewline","openParams","closeParams","conditionalLevel","parseAssignment","parseBlock","valid","parseLogicalXor","parseLogicalOr","parseConditional","parseLogicalAnd","parseBitwiseOr","parseBitwiseXor","parseBitwiseAnd","parseRelational","parseShift","operators","cond","parseConversion","parseRange","parseAddSubtract","parseMultiplyDivideModulusPercentage","rightNode","parseImplicitMultiplication","parseRule2","parseUnary","tokenStates","CustomNode","parseAccessors","parseStringToken","parseRow","numericType","parseEnd","parseParentheses","parseObject","parseMatrix","parseString","parseSymbol","parseCustomNodes","parseLeftHandOperators","parsePow","quote","char","escapeChar","cPrev","cNext","isValidLatinOrGreek","isValidMathSymbol","high","createCompile","createEvaluate","createParserClass","Parser","isParser","getAll","getAllAsMap","isValidVariableName","createParser","createLup","_denseLUP","lvalues","lptr","lsize","uvalues","uindex","uptr","usize","pvCo","pvOc","swapIndeces","spa","vkj","vik","pabsv","absv","U","_sparseLUP","ldata","udata","vij","createQr","_denseQR","_sparseQR","_denseQRimpl","Qdata","Rdata","sgn","conjSgn","alphaSquared","u1","csTdfs","post","csFlip","createCsAmd","lemax","dense","cm","at","tindex","tptr","_createTargetMatrix","nz","csFkeep","cnz","nv","elen","hhead","k2","pj","nvi","pk","eln","pn","_wclear","_initializeQuotientGraph","nel","_initializeDegreeLists","mindeg","elenk","nvk","dk","pk1","pk2","wnvi","dext","p3","p4","nvj","jlast","csLeaf","maxfirst","prevleaf","ancestor","sparent","jleaf","jprev","createCsCounts","ata","colcount","createCsSqr","csAmd","csCounts","qr","csPermute","inext","csEtree","csPost","leftmost","nque","lnz","pa","_vcount","unz","csMarked","csMark","csUnflip","csDfs","jnew","createCsSpsolve","lo","gvalues","gindex","gptr","gsize","csReach","createCsLu","csSpsolve","ipiv","xabs","createSlu","csSqr","csLu","threshold","csIpvec","createLusolve","lup","slu","usolve","lsolve","_lusolve","_toMatrix","createPolynomialRoot","number|Complex, ...number|Complex","constant","restCoeffs","coeffs","denom","discriminant","D0_1","D0_2","D1_1","D1_2","Delta0","Delta1","discriminant1","discriminant2","Ccubed","createHelpClass","Help","doc","examples","configChanged","originalConfig","newConfig","mayThrow","seealso","createChainClass","Chain","createLazyProxy","resolver","chainify","sigObject","createProxy","excludedNames","docs","classes","eDocs","piDocs","embeddedDocs","LOG2E","LOG10E","SQRT1_2","SQRT2","speedOfLight","gravitationConstant","planckConstant","reducedPlanckConstant","magneticConstant","electricConstant","vacuumImpedance","coulombConstant","elementaryCharge","bohrMagneton","conductanceQuantum","inverseConductanceQuantum","magneticFluxQuantum","nuclearMagneton","klitzing","bohrRadius","classicalElectronRadius","electronMass","fermiCoupling","fineStructure","hartreeEnergy","protonMass","deuteronMass","neutronMass","quantumOfCirculation","rydberg","thomsonCrossSection","weakMixingAngle","efimovFactor","atomicMass","avogadro","boltzmann","faraday","firstRadiation","loschmidt","gasConstant","molarPlanckConstant","molarVolume","sackurTetrode","secondRadiation","stefanBoltzmann","wienDisplacement","molarMass","molarMassC12","gravity","planckLength","planckMass","planckTime","planckCharge","planckTemperature","derivative","lsolveAll","lusolve","leafCount","polynomialRoot","simplifyConstant","simplifyCore","symbolicEqual","rationalize","usolveAll","composition","import","help","parser","distance","intersect","mapSlices","diag","kron","matrixFromFunction","matrixFromRows","matrixFromColumns","ones","partitionSelect","rotate","ifft","sylvester","schur","lyap","solveODE","kldivergence","multinomial","permutations","pickRandom","randomInt","deepEqual","equalText","setCartesian","setDistinct","setIsSubset","setMultiplicity","setPowerset","setSize","setUnion","zpk2tf","freqz","cumsum","mad","mean","median","quantileSeq","std","corr","bin","oct","hex","hasNumericValue","isPrime","print","createHelp","searchName","searchText","createChain","createDet","rowIndices","k_","_k","piv","piv_","i_","_det","createInv","_inv","ABig","rBig","Ac","Bc","Ar","Br","createPinv","_isZeros","_pinv","rref","lead","_isZero","_rref","_rankFact","Cpinv","Fpinv","createEigs","doRealSymmetric","getTheta","aii","ajj","aij","getThetaBig","Sij1","Sij","Ski","Skj","Sij1Big","x1Big","Hij","Aki","Akj","csHij","Aii","Ajj","getAij","Mij","maxMij","maxIJ","getAijBig","sorting","computeVectors","vecs","minID","eigenvectors","prec","e0","Vab","diagBig","createRealSymmetric","doComplexEigs","eigenvalues2x2","trA","detA","jordanBase2x2","l1","l2","big","na","nd","inflateMatrix","inverseIterate","orthog","largeNum","randomOrthogonalVector","orthogonalComplement","vectorShape","findVectors","realzero","realone","radixSq","Rdiag","colNorm","rowNorm","rowDivRadix","rowMulRadix","balance","maxIndex","tmp1","tmp2","tmp3","reduceToHessenberg","lambdas","Sdiag","Qtotal","Qpartial","lastConvergenceBefore","ll","vectors","blockDiag","iterateUntilTriangular","Cinv","uniqueValues","multiplicities","solutions","approxVec","correction","findEigenvectors","createComplexEigs","doEigs","Array, Object","matricize","useOpts","_opts$precision","isReal","coerceReal","isSymmetric","coerceTypes","computeValuesAndVectors","hasNumber","hasBig","hasComplex","warn","createExpm","infNorm","rowSum","infinityNorm","errorEstimate","findParams","Apos","AposToI","alternate","qfac","twoqfac","twoqp1fac","createSqrtm","_tolerance","_denmanBeavers","iterations","Yk","createSylvester","_sylvester","sA","sB","hc","RHS","gkk","gmk","gkm","gmm","LHS","yAux","createSchur","_schur","A0","QR","createLyap","createDivide","createDistance","_2d","xCoeff","yCoeff","_distancePointLine2D","_objectToArray","lineTwoPtY","lineOnePtY","lineOnePtX","lineTwoPtX","pointX","pointY","_3d","_parametricLine","_distancePointLine3D","_containsOnlyNumbers","_euclideanDistance","xCoeffLine","yCoeffLine","pointZ","x0","z0","pointOneX","pointOneY","pointTwoX","pointTwoY","pointOneZ","pointTwoZ","_isNumber","aI","_pairwise","pointA","pointB","_distancePairwise","den","vectorSize","createIntersect","_AAA","_AAAA","plane","_coerceArr","_4d","y1","z1","y2","z2","x1x","x2x","y1y","y2y","z1z","z2z","_intersectLinePlane","p1a","p1b","p2a","p2b","o1","o2","d20o11","d21o10","d20o21","d21o20","_intersect2d","x3","y3","z3","x4","y4","z4","d1343","_intersect3dHelper","d4321","d1321","d4343","d2121","ta","tb","pax","pay","paz","pbx","pby","pbz","_intersect3d","add1","add2","add3","createSum","_sum","createCumSum","_cumsum","_ncumSumDim","_cumsummap","sums","_cumsumDimensional","initialValue","createMean","_mean","createMedian","_median","mid","middle2","createMad","_mad","med","DEFAULT_NORMALIZATION","createVariance","_var","_varDim","normalization","createQuantileSeq","Array | Matrix, number | BigNumber","_quantileSeqProbNumber","Array | Matrix, number | BigNumber, number","prob","_quantileSeqDim","Array | Matrix, number | BigNumber, boolean, number","sorted","Array | Matrix, Array | Matrix","_quantileSeqProbCollection","Array | Matrix, Array | Matrix, number","Array | Matrix, Array | Matrix, boolean, number","probOrN","probArr","dataArr","_quantileSeq","nPlusOne","probOrNArr","fracPart","createStd","_std","createCorr","_corr","correlations","correlation","sumX","sumY","sumXY","sumXSquare","sumYSquare","half","combinationsNumber","nMinusk","answer","nextdivisor","lastdivisor","nextnumerator","createCombinations","isPositiveInteger","createCombinationsWithRep","nMinusOne","gammaNumber","twoN","threeN","fourN","fiveN","gammaP","gammaG","lnSqrt2PI","lgammaSeries","lgammaNumber","lgammaN","createGamma","gammaComplex","gammaPval","twoPiSqrt","tpow","expt","bigFactorial","createLgamma","lgammaComplex","lgammaStirling","lgammaRecurrence","leftPart","rz","rzz","rightPart","signflips","sb","shiftprod","nsb","createFactorial","createKldivergence","_kldiv","plength","qlength","qnorm","pnorm","createMultinomial","ai","createPermutations","singletonRandom","createRng","randomSeed","createPickRandom","rng","possibles","_pickRandom","weights","elementWise","single","totalWeights","pick","randKey","randomMatrix","createRandom","_random","number, number","_randomMatrix","Array | Matrix, number","Array | Matrix, number, number","createRandomInt","_randomInt","_randomBigint","_randomIntMatrix","picked","createStirlingS2","smallCache","bigCache","make","nn","nk","createBellNumbers","createCatalan","createComposition","createLeafCount","countLeaves","isNumericNode","isConstantExpression","createUtil","defaultName","defaultContext","trivial","total","commutative","associative","paren","defaultF","hasProperty","nodeOrName","isAssociative","allChildren","findChildren","createMakeNodeFunction","isCommutative","mergeContext","primary","secondary","merged","unflattenr","makeNode","curnode","unflattenl","realContext","positiveContext","createSimplify","_simplify","Node, Map","Node, Map, Object","removeParens","SUPPORTED_CONSTANTS","_canonicalizeRule","ruleObject","newRule","lr","nonCommutative","leftExpandsym","_getExpandPlaceholderSymbol","expandsym","expanded","expandedNC1","expandedNC2","rules","assuming","repeat","imposeContext","addition","_lastsym","debug","consoleDebug","ruleSet","rule","ruleType","_buildRules","visited","laststr","rulestr","applyRule","newstr","mapRule","resNodes","newNode","mergedContext","newArgs","newContent","newItems","newObj","newIndex","newDims","newProps","repl","_ruleMatch","placeholders","mergeMatch","match1","match2","_exactMatch","combineChildMatches","list1","list2","i1","i2","isSplit","splits","rightArgs","getSplits","splitMatches","matchSet","childMatches","childMatch","leftMatch","rightMatch","sets","uniqueSets","mergeChildMatches","isVariableNode","createSimplifyConstant","_ensureNode","foldFraction","_removeFractions","thing","_eval","fnname","ignore","_toNumber","_toNode","fromBigInt","numeratorValue","numeratorNode","unaryMinusNode","_exactFraction","exactFractions","fractionsLimit","foldOp","reduction","sofar","ignoreandcontinue","newtree","sz","section","consts","vars","remainingDims","tryItems","fromItems","_foldAccessor","foldItems","foldProps","createSimplifyCore","node0","node1","nodeT","nodeF","isAlwaysBoolean","_simplifyCore","nodeToSimplify","simpChild","childCount","getOperator","seclast","a0","finish","createResolve","_resolve","within","variables","nextWithin","Node, Object","selfAM","createSymbolicEqual","_symbolicEqual","e1","e2","simplified","createDerivative","plainDerivative","variable","variableName","_derivative","isConstCached","cached","_isConst","parseIdentifier","Node, string","Node, string, Object","deriv","_derivTex","isConst","varName","funcDerivative","negative","chainDerivative","constantTerms","nonConstantTerms","nonConstantNode","argOuter","argInner","powMinusOne","createRationalize","_rationalize","detailed","setRules","oldRules","rulesFirst","rulesSucDiv","firstRules","distrDivRules","sucDivRules","firstRulesAgain","finalRules","rulesRationalize","polyRet","extended","oper","recPoly","tp","retFunc","polynomial","nVars","noExactFractions","withExactFractions","sBefore","expandPower","eDistrDiv","redoInic","retRationalize","polyToCanonical","Node, boolean","indParent","internal","does","nEsqTopo","nDirTopo","maxExpo","varname","recurPol","noPai","noFil","fire","cte","valor","no","n3","createZpk2tf","_zpk2tf","_multiply","pole","createFreqz","_freqz","createBins","_w","sumNum","sumDen","bins","createReviver","createReplacer","createTrue","createFalse","createNull","createInfinity","recreateFactory","createNaN","_ref3","createTau","_ref4","createE","_ref5","createPhi","_ref6","createLN2","_ref7","createLN10","_ref8","createLOG2E","_ref9","createLOG10E","_ref0","createSQRT1_2","_ref1","createSQRT2","_ref10","createI","_ref11","createUppercasePi","_ref12","createUppercaseE","_ref13","createVersion","recreateOnConfigChange","createSpeedOfLight","unitFactory","createGravitationConstant","createPlanckConstant","createReducedPlanckConstant","createMagneticConstant","createElectricConstant","createVacuumImpedance","createCoulomb","createCoulombConstant","createElementaryCharge","createBohrMagneton","createConductanceQuantum","createInverseConductanceQuantum","createMagneticFluxQuantum","createNuclearMagneton","createKlitzing","createBohrRadius","createClassicalElectronRadius","createElectronMass","createFermiCoupling","createFineStructure","numberFactory","createHartreeEnergy","createProtonMass","createDeuteronMass","createNeutronMass","createQuantumOfCirculation","createRydberg","createThomsonCrossSection","createWeakMixingAngle","createEfimovFactor","createAtomicMass","createAvogadro","createBoltzmann","createFaraday","createFirstRadiation","createLoschmidt","createGasConstant","createMolarPlanckConstant","createMolarVolume","createSackurTetrode","createSecondRadiation","createStefanBoltzmann","createWienDisplacement","createMolarMass","createMolarMassC12","createGravity","createPlanckLength","createPlanckMass","createPlanckTime","createPlanckCharge","createPlanckTemperature","createMapSlicesTransform","isTransformFunction","createColumnTransform","compileInlineExpression","argsScope","subScope","createTransformCallback","_transformTypedCallbackFunction","_transformCallbackFunction","callbackFunction","numberOfCallbackInputs","vals","_transformDims","createFilterTransform","filterTransform","transformCallback","_compileAndEvaluate","createForEachTransform","forEachTransform","createIndexTransform","isSet","createMapTransform","mapTransform","lastDimToZeroBase","dimToZeroBase","createMaxTransform","createMeanTransform","createMinTransform","createRangeTransform","createRowTransform","createSubsetTransform","createConcatTransform","createDiffTransform","createStdTransform","createSumTransform","createQuantileSeqTransform","createCumSumTransform","createVarianceTransform","createPrintTransform","_convertTemplateToZeroBasedIndex","part","createAndTransform","andTransform","condition1","condition2","createOrTransform","orTransform","createBitAndTransform","bitAndTransform","createBitOrTransform","bitOrTransform","DEFAULT_CONFIG","MATRIX_OPTIONS","NUMBER_OPTIONS","configFactory","_config","optionsFix","validateOption","changes","factories","configInternal","emitter","Emitter","importedFactories","lazyTyped","internalImport","load","_import","_math$Unit","_wrap","_importTransform","isDefined","silent","allowedInExpressions","_deleteTransform","_importFactory","_factory$meta$formerl","_factory$meta","isTransformFunctionFactory","existingTransform","instance","former","needsTransform","factoryAllowedInExpressions","withTransform","functions","flatValues","flattenImports","flatName","importFactory"],"sourceRoot":""} \ No newline at end of file diff --git a/js/lib/package.json b/js/lib/package.json deleted file mode 100644 index 5bbefffbab..0000000000 --- a/js/lib/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "commonjs" -} diff --git a/mathjs-src b/mathjs-src deleted file mode 160000 index 50bd26c469..0000000000 --- a/mathjs-src +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 50bd26c469361b851c7bedb58ca680ea353e82cf diff --git a/package-lock.json b/package-lock.json index 8c473b301a..507584f0a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,2044 +1,1765 @@ { "name": "mathjs-website", - "version": "1.0.0", - "lockfileVersion": 2, + "version": "0.0.1", + "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mathjs-website", - "version": "1.0.0", + "version": "0.0.1", "dependencies": { - "mathjs": "14.5.2" - }, - "devDependencies": { - "fancy-log": "2.0.0", - "glob": "11.0.2", - "gulp": "5.0.0", - "gulp-header": "2.0.9", - "gulp-rename": "2.0.0", - "gulp-replace": "1.1.4", - "handlebars": "4.7.8", - "rimraf": "6.0.1" + "@tailwindcss/vite": "^4.1.8", + "astro": "^5.8.2", + "flyonui": "^2.2.0" } }, - "node_modules/@babel/runtime": { - "version": "7.27.0", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.0.tgz", - "integrity": "sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==", - "license": "MIT", + "node_modules/@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "license": "Apache-2.0", "dependencies": { - "regenerator-runtime": "^0.14.0" + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" }, "engines": { - "node": ">=6.9.0" + "node": ">=6.0.0" } }, - "node_modules/@gulpjs/messages": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@gulpjs/messages/-/messages-1.1.0.tgz", - "integrity": "sha512-Ys9sazDatyTgZVb4xPlDufLweJ/Os2uHWOv+Caxvy2O85JcnT4M3vc73bi8pdLWlv3fdWQz3pdI9tVwo8rQQSg==", - "dev": true, - "engines": { - "node": ">=10.13.0" - } + "node_modules/@astrojs/compiler": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-2.12.0.tgz", + "integrity": "sha512-7bCjW6tVDpUurQLeKBUN9tZ5kSv5qYrGmcn0sG0IwacL7isR2ZbyyA3AdZ4uxsuUFOS2SlgReTH7wkxO6zpqWA==", + "license": "MIT" }, - "node_modules/@gulpjs/to-absolute-glob": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@gulpjs/to-absolute-glob/-/to-absolute-glob-4.0.0.tgz", - "integrity": "sha512-kjotm7XJrJ6v+7knhPaRgaT6q8F8K2jiafwYdNHLzmV0uGLuZY43FK6smNSHUPrhq5kX2slCUy+RGG/xGqmIKA==", - "dev": true, - "dependencies": { - "is-negated-glob": "^1.0.0" - }, - "engines": { - "node": ">=10.13.0" - } + "node_modules/@astrojs/internal-helpers": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.6.1.tgz", + "integrity": "sha512-l5Pqf6uZu31aG+3Lv8nl/3s4DbUzdlxTWDof4pEpto6GUJNhhCbelVi9dEyurOVyqaelwmS9oSyOWOENSfgo9A==", + "license": "MIT" }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, - "license": "ISC", + "node_modules/@astrojs/markdown-remark": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-6.3.2.tgz", + "integrity": "sha512-bO35JbWpVvyKRl7cmSJD822e8YA8ThR/YbUsciWNA7yTcqpIAL2hJDToWP5KcZBWxGT6IOdOkHSXARSNZc4l/Q==", + "license": "MIT", + "dependencies": { + "@astrojs/internal-helpers": "0.6.1", + "@astrojs/prism": "3.3.0", + "github-slugger": "^2.0.0", + "hast-util-from-html": "^2.0.3", + "hast-util-to-text": "^4.0.2", + "import-meta-resolve": "^4.1.0", + "js-yaml": "^4.1.0", + "mdast-util-definitions": "^6.0.0", + "rehype-raw": "^7.0.0", + "rehype-stringify": "^10.0.1", + "remark-gfm": "^4.0.1", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.1.2", + "remark-smartypants": "^3.0.2", + "shiki": "^3.2.1", + "smol-toml": "^1.3.1", + "unified": "^11.0.5", + "unist-util-remove-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "unist-util-visit-parents": "^6.0.1", + "vfile": "^6.0.3" + } + }, + "node_modules/@astrojs/prism": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-3.3.0.tgz", + "integrity": "sha512-q8VwfU/fDZNoDOf+r7jUnMC2//H2l0TuQ6FkGJL8vD8nw/q5KiL3DS1KKBI3QhI9UQhpJ5dc7AtqfbXWuOgLCQ==", + "license": "MIT", "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + "prismjs": "^1.30.0" }, "engines": { - "node": ">=12" + "node": "18.20.8 || ^20.3.0 || >=22.0.0" } }, - "node_modules/@isaacs/cliui/node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@isaacs/cliui/node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, + "node_modules/@astrojs/telemetry": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.3.0.tgz", + "integrity": "sha512-UFBgfeldP06qu6khs/yY+q1cDAaArM2/7AEIqQ9Cuvf7B1hNLq0xDrZkct+QoIGyjq56y8IaE2I3CTvG99mlhQ==", "license": "MIT", "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" + "ci-info": "^4.2.0", + "debug": "^4.4.0", + "dlv": "^1.1.3", + "dset": "^3.1.4", + "is-docker": "^3.0.0", + "is-wsl": "^3.1.0", + "which-pm-runs": "^1.1.0" }, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": "18.20.8 || ^20.3.0 || >=22.0.0" } }, - "node_modules/@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "dev": true, + "node_modules/@babel/helper-string-parser": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", "license": "MIT", - "optional": true, "engines": { - "node": ">=14" - } - }, - "node_modules/@types/expect": { - "version": "1.20.4", - "resolved": "https://registry.npmjs.org/@types/expect/-/expect-1.20.4.tgz", - "integrity": "sha512-Q5Vn3yjTDyCMV50TB6VRIbQNxSE4OmZR86VSbGaNpfUolm0iePBB4KdEEHmxoY5sT2+2DIvXW0rvMDP2nHZ4Mg==", - "dev": true - }, - "node_modules/@types/node": { - "version": "14.14.45", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.45.tgz", - "integrity": "sha512-DssMqTV9UnnoxDWu959sDLZzfvqCF0qDNRjaWeYSui9xkFe61kKo4l1TWNTQONpuXEm+gLMRvdlzvNHBamzmEw==", - "dev": true - }, - "node_modules/@types/vinyl": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/vinyl/-/vinyl-2.0.4.tgz", - "integrity": "sha512-2o6a2ixaVI2EbwBPg1QYLGQoHK56p/8X/sGfKbFC8N6sY9lfjsMf/GprtkQkSya0D4uRiutRZ2BWj7k3JvLsAQ==", - "dev": true, - "dependencies": { - "@types/expect": "^1.20.4", - "@types/node": "*" + "node": ">=6.9.0" } }, - "node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", + "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", "license": "MIT", "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" + "node": ">=6.9.0" } }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, + "node_modules/@babel/parser": { + "version": "7.27.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.5.tgz", + "integrity": "sha512-OsQd175SxWkGlzbny8J3K8TnnDD0N3lrIUtB92xwyRpzaenGZhxDvxN/JgU00U3CDZNj9tPuDJ5H0WS4Nt3vKg==", + "license": "MIT", "dependencies": { - "color-convert": "^2.0.1" + "@babel/types": "^7.27.3" }, - "engines": { - "node": ">=8" + "bin": { + "parser": "bin/babel-parser.js" }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "engines": { + "node": ">=6.0.0" } }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, + "node_modules/@babel/types": { + "version": "7.27.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.3.tgz", + "integrity": "sha512-Y1GkI4ktrtvmawoSq+4FCVHNryea6uR+qUQy0AGxLSsjCX0nVmkYQMBLHDkXZuo5hGx7eYdnIaslsdBFm7zbUw==", + "license": "MIT", "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1" }, "engines": { - "node": ">= 8" + "node": ">=6.9.0" } }, - "node_modules/array-each": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", - "integrity": "sha512-zHjL5SZa68hkKHBFBK6DJCTtr9sfTCPCaph/L7tMSLcTFgy+zX7E+6q5UArbtOtMBCtxdICpfTCspRse+ywyXA==", - "dev": true, - "engines": { - "node": ">=0.10.0" + "node_modules/@capsizecss/unpack": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@capsizecss/unpack/-/unpack-2.4.0.tgz", + "integrity": "sha512-GrSU71meACqcmIUxPYOJvGKF0yryjN/L1aCuE9DViCTJI7bfkjgYDPD1zbNDcINJwSSP6UaBZY9GAbYDO7re0Q==", + "license": "MIT", + "dependencies": { + "blob-to-buffer": "^1.2.8", + "cross-fetch": "^3.0.4", + "fontkit": "^2.0.2" } }, - "node_modules/array-slice": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", - "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==", - "dev": true, - "engines": { - "node": ">=0.10.0" + "node_modules/@emnapi/runtime": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.4.3.tgz", + "integrity": "sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" } }, - "node_modules/async-done": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/async-done/-/async-done-2.0.0.tgz", - "integrity": "sha512-j0s3bzYq9yKIVLKGE/tWlCpa3PfFLcrDZLTSVdnnCTGagXuXBJO4SsY9Xdk/fQBirCkH4evW5xOeJXqlAQFdsw==", - "dev": true, - "dependencies": { - "end-of-stream": "^1.4.4", - "once": "^1.4.0", - "stream-exhaust": "^1.0.2" - }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.5.tgz", + "integrity": "sha512-9o3TMmpmftaCMepOdA5k/yDw8SfInyzWWTjYTFCX3kPSDJMROQTb8jg+h9Cnwnmm1vOzvxN7gIfB5V2ewpjtGA==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], "engines": { - "node": ">= 10.13.0" + "node": ">=18" } }, - "node_modules/async-settle": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/async-settle/-/async-settle-2.0.0.tgz", - "integrity": "sha512-Obu/KE8FurfQRN6ODdHN9LuXqwC+JFIM9NRyZqJJ4ZfLJmIYN9Rg0/kb+wF70VV5+fJusTMQlJ1t5rF7J/ETdg==", - "dev": true, - "dependencies": { - "async-done": "^2.0.0" - }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.5.tgz", + "integrity": "sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">= 10.13.0" + "node": ">=18" } }, - "node_modules/b4a": { - "version": "1.6.6", - "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.6.tgz", - "integrity": "sha512-5Tk1HLk6b6ctmjIkAcU/Ujv/1WqiDl0F0JdRCR80VsOcUlHcu7pWeWRlOqQLHfDEsVx9YH/aif5AG4ehoCtTmg==", - "dev": true - }, - "node_modules/bach": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/bach/-/bach-2.0.1.tgz", - "integrity": "sha512-A7bvGMGiTOxGMpNupYl9HQTf0FFDNF4VCmks4PJpFyN1AX2pdKuxuwdvUz2Hu388wcgp+OvGFNsumBfFNkR7eg==", - "dev": true, - "dependencies": { - "async-done": "^2.0.0", - "async-settle": "^2.0.0", - "now-and-later": "^3.0.0" - }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.5.tgz", + "integrity": "sha512-VGzGhj4lJO+TVGV1v8ntCZWJktV7SGCs3Pn1GRWI1SBFtRALoomm8k5E9Pmwg3HOAal2VDc2F9+PM/rEY6oIDg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">=10.13.0" + "node": ">=18" } }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true, - "license": "MIT" - }, - "node_modules/bare-events": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.4.2.tgz", - "integrity": "sha512-qMKFd2qG/36aA4GwvKq8MxnPgCQAmBWmSyLWsJcbn8v03wvIPQ/hG1Ms8bPzndZxMDoHpxez5VOS+gC9Yi24/Q==", - "dev": true, - "optional": true - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "dev": true, + "node_modules/@esbuild/android-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.5.tgz", + "integrity": "sha512-D2GyJT1kjvO//drbRT3Hib9XPwQeWd9vZoBJn+bu/lVsOZ13cqNdDeqIF/xQ5/VmWvMduP6AmXvylO/PIc2isw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=18" } }, - "node_modules/binaryextensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binaryextensions/-/binaryextensions-2.3.0.tgz", - "integrity": "sha512-nAihlQsYGyc5Bwq6+EsubvANYGExeJKHDO3RjnvwU042fawQTQfM3Kxn7IHUXQOz4bzfwsGYYHGSvXyW4zOGLg==", - "dev": true, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.5.tgz", + "integrity": "sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=0.8" - }, - "funding": { - "url": "https://bevry.me/fund" + "node": ">=18" } }, - "node_modules/bl": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz", - "integrity": "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==", - "dev": true, - "dependencies": { - "buffer": "^6.0.3", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.5.tgz", + "integrity": "sha512-1iT4FVL0dJ76/q1wd7XDsXrSW+oLoquptvh4CLR4kITDtqi2e/xwXwdCVH8hVHU43wgJdsq7Gxuzcs6Iq/7bxQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" } }, - "node_modules/bl/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.5.tgz", + "integrity": "sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], "engines": { - "node": ">= 6" + "node": ">=18" } }, - "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.5.tgz", + "integrity": "sha512-PrikaNjiXdR2laW6OIjlbeuCPrPaAl0IwPIaRv+SMV8CiM8i2LqVUHFC1+8eORgWyY7yhQY+2U2fA55mBzReaw==", + "cpu": [ + "x64" + ], "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" } }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, - "dependencies": { - "fill-range": "^7.1.1" - }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.5.tgz", + "integrity": "sha512-cPzojwW2okgh7ZlRpcBEtsX7WBuqbLrNXqLU89GxWbNt6uIg78ET82qifUy3W6OVww6ZWobWub5oqZOVtwolfw==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=8" + "node": ">=18" } }, - "node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.5.tgz", + "integrity": "sha512-Z9kfb1v6ZlGbWj8EJk9T6czVEjjq2ntSYLY2cw6pAZl4oKtfgQuS4HOq41M/BcoLPzrUbNd+R4BXFyH//nHxVg==", + "cpu": [ + "arm64" ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" } }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.5.tgz", + "integrity": "sha512-sQ7l00M8bSv36GLV95BVAdhJ2QsIbCuCjh/uYrWiMQSUuV+LpXwIqhgJDcvMTj+VsQmqAHL2yYaasENvJ7CDKA==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "node": ">=18" } }, - "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "dev": true, - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.5.tgz", + "integrity": "sha512-0ur7ae16hDUC4OL5iEnDb0tZHDxYmuQyhKhsPBV8f99f6Z9KQM02g33f93rNH5A30agMS46u2HP6qTdEt6Q1kg==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">= 8.10.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" + "node": ">=18" } }, - "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.5.tgz", + "integrity": "sha512-kB/66P1OsHO5zLz0i6X0RxlQ+3cu0mkxS3TKFvkb5lin6uwZ/ttOkP3Z8lfR9mJOBk14ZwZ9182SIIWFGNmqmg==", + "cpu": [ + "mips64el" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" } }, - "node_modules/cliui/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.5.tgz", + "integrity": "sha512-UZCmJ7r9X2fe2D6jBmkLBMQetXPXIsZjQJCjgwpVDz+YMcS6oFR27alkgGv3Oqkv07bxdvw7fyB71/olceJhkQ==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=8" + "node": ">=18" } }, - "node_modules/cliui/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.5.tgz", + "integrity": "sha512-kTxwu4mLyeOlsVIFPfQo+fQJAV9mh24xL+y+Bm6ej067sYANjyEw1dNHmvoqxJUCMnkBdKpvOn0Ahql6+4VyeA==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=8" + "node": ">=18" } }, - "node_modules/cliui/node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.5.tgz", + "integrity": "sha512-K2dSKTKfmdh78uJ3NcWFiqyRrimfdinS5ErLSn3vluHNeHVnBAFWC8a4X5N+7FgVE1EjXS1QDZbpqZBjfrqMTQ==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + "node": ">=18" } }, - "node_modules/clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", - "dev": true, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.5.tgz", + "integrity": "sha512-uhj8N2obKTE6pSZ+aMUbqq+1nXxNjZIIjCjGLfsWvVpy7gKCOL6rsY1MhRh9zLtUtAI7vpgLMK6DxjO8Qm9lJw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=0.8" + "node": ">=18" } }, - "node_modules/clone-stats": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", - "integrity": "sha512-au6ydSpg6nsrigcZ4m8Bc9hxjeW+GJ8xh5G3BJCMt4WXe1H10UNaVOamqQTmrx1kjVuxAHIQSNU6hY4Nsn9/ag==", - "dev": true - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.5.tgz", + "integrity": "sha512-pwHtMP9viAy1oHPvgxtOv+OkduK5ugofNTVDilIzBLpoWAM16r7b/mxBvfpuQDpRQFMfuVr5aLcn4yveGvBZvw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/color-support": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "dev": true, - "bin": { - "color-support": "bin.js" + "node": ">=18" } }, - "node_modules/complex.js": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/complex.js/-/complex.js-2.4.2.tgz", - "integrity": "sha512-qtx7HRhPGSCBtGiST4/WGHuW+zeaND/6Ld+db6PbrulIB1i2Ev/2UPiqcmpQNPSyfBKraC0EOvOKCB5dGZKt3g==", + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.5.tgz", + "integrity": "sha512-WOb5fKrvVTRMfWFNCroYWWklbnXH0Q5rZppjq0vQIdlsQKuw6mdSihwSo4RV/YdQ5UCKKvBy7/0ZZYLBZKIbwQ==", + "cpu": [ + "x64" + ], "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], "engines": { - "node": "*" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/rawify" + "node": ">=18" } }, - "node_modules/concat-with-sourcemaps": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz", - "integrity": "sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg==", - "dev": true, - "dependencies": { - "source-map": "^0.6.1" + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.5.tgz", + "integrity": "sha512-7A208+uQKgTxHd0G0uqZO8UjK2R0DDb4fDmERtARjSHWxqMTye4Erz4zZafx7Di9Cv+lNHYuncAkiGFySoD+Mw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" } }, - "node_modules/concat-with-sourcemaps/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.5.tgz", + "integrity": "sha512-G4hE405ErTWraiZ8UiSoesH8DaCsMm0Cay4fsFWOOUcz8b8rC6uCvnagr+gnioEjWn0wC+o1/TAHt+It+MpIMg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], "engines": { - "node": ">=0.10.0" + "node": ">=18" } }, - "node_modules/convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true - }, - "node_modules/copy-props": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/copy-props/-/copy-props-4.0.0.tgz", - "integrity": "sha512-bVWtw1wQLzzKiYROtvNlbJgxgBYt2bMJpkCbKmXM3xyijvcjjWXEk5nyrrT3bgJ7ODb19ZohE2T0Y3FgNPyoTw==", - "dev": true, - "dependencies": { - "each-props": "^3.0.0", - "is-plain-object": "^5.0.0" - }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.5.tgz", + "integrity": "sha512-l+azKShMy7FxzY0Rj4RCt5VD/q8mG/e+mDivgspo+yL8zW7qEwctQ6YqKX34DTEleFAvCIUviCFX1SDZRSyMQA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], "engines": { - "node": ">= 10.13.0" + "node": ">=18" } }, - "node_modules/core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "dev": true, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.5.tgz", + "integrity": "sha512-O2S7SNZzdcFG7eFKgvwUEZ2VG9D/sn/eIiz8XRZ1Q/DO5a3s76Xv0mdBzVM5j5R639lXQmPmSo0iRpHqUUrsxw==", + "cpu": [ + "arm64" + ], "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">= 8" + "node": ">=18" } }, - "node_modules/decimal.js": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", - "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==" - }, - "node_modules/detect-file": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", - "integrity": "sha512-DtCOLG98P007x7wiiOmfI0fi3eIKyWiLTGJ2MDnVi/E04lWGbf+JzrRHMm0rgIIZJGtHpKpbVgLWHrv8xXpc3Q==", - "dev": true, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.5.tgz", + "integrity": "sha512-onOJ02pqs9h1iMJ1PQphR+VZv8qBMQ77Klcsqv9CNW2w6yLqoURLcgERAIurY6QE63bbLuqgP9ATqajFLK5AMQ==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=0.10.0" + "node": ">=18" } }, - "node_modules/each-props": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/each-props/-/each-props-3.0.0.tgz", - "integrity": "sha512-IYf1hpuWrdzse/s/YJOrFmU15lyhSzxelNVAHTEG3DtP4QsLTWZUzcUL3HMXmKQxXpa4EIrBPpwRgj0aehdvAw==", - "dev": true, - "dependencies": { - "is-plain-object": "^5.0.0", - "object.defaults": "^1.1.0" - }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.5.tgz", + "integrity": "sha512-TXv6YnJ8ZMVdX+SXWVBo/0p8LTcrUYngpWjvm91TMjjBQii7Oz11Lw5lbDV5Y0TzuhSJHwiH4hEtC1I42mMS0g==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">= 10.13.0" + "node": ">=18" } }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true, - "license": "MIT" - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, + "node_modules/@floating-ui/core": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.7.1.tgz", + "integrity": "sha512-azI0DrjMMfIug/ExbBaeDVJXcY0a7EPvPjb2xAJPa4HeimBX+Z18HK8QQR3jb6356SnDDdxx+hinMLcJEDdOjw==", + "license": "MIT", "dependencies": { - "once": "^1.4.0" + "@floating-ui/utils": "^0.2.9" } }, - "node_modules/escalade": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", - "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", - "dev": true, - "engines": { - "node": ">=6" + "node_modules/@floating-ui/dom": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.1.tgz", + "integrity": "sha512-cwsmW/zyw5ltYTUeeYJ60CnQuPqmGwuGVhG9w0PRaRKkAyi38BT5CKrpIbb+jtahSwUl04cWzSx9ZOIxeS6RsQ==", + "license": "MIT", + "dependencies": { + "@floating-ui/core": "^1.7.1", + "@floating-ui/utils": "^0.2.9" } }, - "node_modules/escape-latex": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/escape-latex/-/escape-latex-1.2.0.tgz", - "integrity": "sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw==" + "node_modules/@floating-ui/utils": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.9.tgz", + "integrity": "sha512-MDWhGtE+eHw5JW7lq4qhc5yRLS11ERl1c7Z6Xd0a58DozHES6EnNNwUWbMiG4J9Cgj053Bhk8zvlhFYKVhULwg==", + "license": "MIT" }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz", + "integrity": "sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/expand-tilde": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", - "integrity": "sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw==", - "dev": true, - "dependencies": { - "homedir-polyfill": "^1.0.1" + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true - }, - "node_modules/fancy-log": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-2.0.0.tgz", - "integrity": "sha512-9CzxZbACXMUXW13tS0tI8XsGGmxWzO2DmYrGuBJOJ8k8q2K7hwfJA5qHjuPPe8wtsco33YR9wc+Rlr5wYFvhSA==", - "dev": true, - "dependencies": { - "color-support": "^1.1.3" + "funding": { + "url": "https://opencollective.com/libvips" }, - "engines": { - "node": ">=10.13.0" + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.0.4" } }, - "node_modules/fast-fifo": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", - "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", - "dev": true - }, - "node_modules/fast-levenshtein": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-3.0.0.tgz", - "integrity": "sha512-hKKNajm46uNmTlhHSyZkmToAc56uZJwYq7yrciZjqOxnlfQwERDQJmHPUp7m1m9wx8vgOe8IaCKZ5Kv2k1DdCQ==", - "dev": true, - "dependencies": { - "fastest-levenshtein": "^1.0.7" + "node_modules/@img/sharp-darwin-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.5.tgz", + "integrity": "sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.0.4" } }, - "node_modules/fastest-levenshtein": { - "version": "1.0.16", - "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", - "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", - "dev": true, - "engines": { - "node": ">= 4.9.1" + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.0.4.tgz", + "integrity": "sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" } }, - "node_modules/fastq": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", - "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", - "dev": true, - "dependencies": { - "reusify": "^1.0.4" + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.0.4.tgz", + "integrity": "sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" } }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.0.5.tgz", + "integrity": "sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==", + "cpu": [ + "arm" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" } }, - "node_modules/findup-sync": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-5.0.0.tgz", - "integrity": "sha512-MzwXju70AuyflbgeOhzvQWAvvQdo1XL0A9bVvlXsYcFEBM87WR4OakL4OfZq+QRmr+duJubio+UtNQCPsVESzQ==", - "dev": true, - "dependencies": { - "detect-file": "^1.0.0", - "is-glob": "^4.0.3", - "micromatch": "^4.0.4", - "resolve-dir": "^1.0.1" - }, - "engines": { - "node": ">= 10.13.0" + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.0.4.tgz", + "integrity": "sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" } }, - "node_modules/fined": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fined/-/fined-2.0.0.tgz", - "integrity": "sha512-OFRzsL6ZMHz5s0JrsEr+TpdGNCtrVtnuG3x1yzGNiQHT0yaDnXAj8V/lWcpJVrnoDpcwXcASxAZYbuXda2Y82A==", - "dev": true, - "dependencies": { - "expand-tilde": "^2.0.2", - "is-plain-object": "^5.0.0", - "object.defaults": "^1.1.0", - "object.pick": "^1.3.0", - "parse-filepath": "^1.0.2" - }, - "engines": { - "node": ">= 10.13.0" + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.0.4.tgz", + "integrity": "sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA==", + "cpu": [ + "s390x" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" } }, - "node_modules/flagged-respawn": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-2.0.0.tgz", - "integrity": "sha512-Gq/a6YCi8zexmGHMuJwahTGzXlAZAOsbCVKduWXC6TlLCjjFRlExMJc4GC2NYPYZ0r/brw9P7CpRgQmlPVeOoA==", - "dev": true, - "engines": { - "node": ">= 10.13.0" + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.4.tgz", + "integrity": "sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" } }, - "node_modules/for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.0.4.tgz", + "integrity": "sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" } }, - "node_modules/for-own": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", - "integrity": "sha512-0OABksIGrxKK8K4kynWkQ7y1zounQxP+CWnyclVwj81KW3vlLlGUx57DKGcP/LH216GzqnstnPocF16Nxs0Ycg==", - "dev": true, - "dependencies": { - "for-in": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.4.tgz", + "integrity": "sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" } }, - "node_modules/foreground-child": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz", - "integrity": "sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.5.tgz", + "integrity": "sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ==", + "cpu": [ + "arm" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=14" + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.0.5" } }, - "node_modules/fraction.js": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.2.1.tgz", - "integrity": "sha512-Ah6t/7YCYjrPUFUFsOsRLMXAdnYM+aQwmojD2Ayb/Ezr82SwES0vuyQ8qZ3QO8n9j7W14VJuVZZet8U3bhSdQQ==", - "license": "MIT", + "node_modules/@img/sharp-linux-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.5.tgz", + "integrity": "sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">= 12" + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" }, "funding": { - "type": "github", - "url": "https://github.com/sponsors/rawify" + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.0.4" } }, - "node_modules/fs-mkdirp-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fs-mkdirp-stream/-/fs-mkdirp-stream-2.0.1.tgz", - "integrity": "sha512-UTOY+59K6IA94tec8Wjqm0FSh5OVudGNB0NL/P6fB3HiE3bYOY3VYBGijsnOHNkQSwC1FKkU77pmq7xp9CskLw==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.8", - "streamx": "^2.12.0" - }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.5.tgz", + "integrity": "sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q==", + "cpu": [ + "s390x" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=10.13.0" + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.0.4" } }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, + "node_modules/@img/sharp-linux-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.5.tgz", + "integrity": "sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", "optional": true, "os": [ - "darwin" + "linux" ], "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.0.4" } }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.5.tgz", + "integrity": "sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/glob": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.2.tgz", - "integrity": "sha512-YT7U7Vye+t5fZ/QMkBFrTJ7ZQxInIUjwyAjVj84CYXqgBdv30MFUPGnBR6sQaVq6Is15wYJUsnzTuWaGRBhBAQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^4.0.1", - "minimatch": "^10.0.0", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^2.0.0" + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" }, - "bin": { - "glob": "dist/esm/bin.mjs" + "funding": { + "url": "https://opencollective.com/libvips" }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.5.tgz", + "integrity": "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": "20 || >=22" + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" }, "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" + "url": "https://opencollective.com/libvips" }, - "engines": { - "node": ">= 6" + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.0.4" } }, - "node_modules/glob-stream": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-8.0.2.tgz", - "integrity": "sha512-R8z6eTB55t3QeZMmU1C+Gv+t5UnNRkA55c5yo67fAVfxODxieTwsjNG7utxS/73NdP1NbDgCrhVEg2h00y4fFw==", - "dev": true, + "node_modules/@img/sharp-wasm32": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.33.5.tgz", + "integrity": "sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg==", + "cpu": [ + "wasm32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, "dependencies": { - "@gulpjs/to-absolute-glob": "^4.0.0", - "anymatch": "^3.1.3", - "fastq": "^1.13.0", - "glob-parent": "^6.0.2", - "is-glob": "^4.0.3", - "is-negated-glob": "^1.0.0", - "normalize-path": "^3.0.0", - "streamx": "^2.12.5" + "@emnapi/runtime": "^1.2.0" }, "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/glob-stream/node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.3" + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" }, - "engines": { - "node": ">=10.13.0" + "funding": { + "url": "https://opencollective.com/libvips" } }, - "node_modules/glob-watcher": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-6.0.0.tgz", - "integrity": "sha512-wGM28Ehmcnk2NqRORXFOTOR064L4imSw3EeOqU5bIwUf62eXGwg89WivH6VMahL8zlQHeodzvHpXplrqzrz3Nw==", - "dev": true, - "dependencies": { - "async-done": "^2.0.0", - "chokidar": "^3.5.3" - }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.5.tgz", + "integrity": "sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ==", + "cpu": [ + "ia32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/global-modules": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", - "dev": true, - "dependencies": { - "global-prefix": "^1.0.1", - "is-windows": "^1.0.1", - "resolve-dir": "^1.0.0" + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" }, - "engines": { - "node": ">=0.10.0" + "funding": { + "url": "https://opencollective.com/libvips" } }, - "node_modules/global-prefix": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", - "integrity": "sha512-5lsx1NUDHtSjfg0eHlmYvZKv8/nVqX4ckFbM+FrGcQ+04KWcWFo9P5MxPZYSzUvyzmdTbI7Eix8Q4IbELDqzKg==", - "dev": true, - "dependencies": { - "expand-tilde": "^2.0.2", - "homedir-polyfill": "^1.0.1", - "ini": "^1.3.4", - "is-windows": "^1.0.1", - "which": "^1.2.14" - }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.5.tgz", + "integrity": "sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/global-prefix/node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" }, - "bin": { - "which": "bin/which" + "funding": { + "url": "https://opencollective.com/libvips" } }, - "node_modules/glogg": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/glogg/-/glogg-2.2.0.tgz", - "integrity": "sha512-eWv1ds/zAlz+M1ioHsyKJomfY7jbDDPpwSkv14KQj89bycx1nvK5/2Cj/T9g7kzJcX5Bc7Yv22FjfBZS/jl94A==", - "dev": true, + "node_modules/@isaacs/fs-minipass": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz", + "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==", + "license": "ISC", "dependencies": { - "sparkles": "^2.1.0" + "minipass": "^7.0.4" }, "engines": { - "node": ">= 10.13.0" + "node": ">=18.0.0" } }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true - }, - "node_modules/gulp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/gulp/-/gulp-5.0.0.tgz", - "integrity": "sha512-S8Z8066SSileaYw1S2N1I64IUc/myI2bqe2ihOBzO6+nKpvNSg7ZcWJt/AwF8LC/NVN+/QZ560Cb/5OPsyhkhg==", - "dev": true, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", + "license": "MIT", "dependencies": { - "glob-watcher": "^6.0.0", - "gulp-cli": "^3.0.0", - "undertaker": "^2.0.0", - "vinyl-fs": "^4.0.0" - }, - "bin": { - "gulp": "bin/gulp.js" + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" }, "engines": { - "node": ">=10.13.0" + "node": ">=6.0.0" } }, - "node_modules/gulp-cli": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/gulp-cli/-/gulp-cli-3.0.0.tgz", - "integrity": "sha512-RtMIitkT8DEMZZygHK2vEuLPqLPAFB4sntSxg4NoDta7ciwGZ18l7JuhCTiS5deOJi2IoK0btE+hs6R4sfj7AA==", - "dev": true, - "dependencies": { - "@gulpjs/messages": "^1.1.0", - "chalk": "^4.1.2", - "copy-props": "^4.0.0", - "gulplog": "^2.2.0", - "interpret": "^3.1.1", - "liftoff": "^5.0.0", - "mute-stdout": "^2.0.0", - "replace-homedir": "^2.0.0", - "semver-greatest-satisfied-range": "^2.0.0", - "string-width": "^4.2.3", - "v8flags": "^4.0.0", - "yargs": "^16.2.0" - }, - "bin": { - "gulp": "bin/gulp.js" - }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "license": "MIT", "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/gulp-header": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/gulp-header/-/gulp-header-2.0.9.tgz", - "integrity": "sha512-LMGiBx+qH8giwrOuuZXSGvswcIUh0OiioNkUpLhNyvaC6/Ga8X6cfAeme2L5PqsbXMhL8o8b/OmVqIQdxprhcQ==", - "dev": true, - "dependencies": { - "concat-with-sourcemaps": "^1.1.0", - "lodash.template": "^4.5.0", - "map-stream": "0.0.7", - "through2": "^2.0.0" + "node": ">=6.0.0" } }, - "node_modules/gulp-rename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-2.0.0.tgz", - "integrity": "sha512-97Vba4KBzbYmR5VBs9mWmK+HwIf5mj+/zioxfZhOKeXtx5ZjBk57KFlePf5nxq9QsTtFl0ejnHE3zTC9MHXqyQ==", - "dev": true, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "license": "MIT", "engines": { - "node": ">=4" + "node": ">=6.0.0" } }, - "node_modules/gulp-replace": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/gulp-replace/-/gulp-replace-1.1.4.tgz", - "integrity": "sha512-SVSF7ikuWKhpAW4l4wapAqPPSToJoiNKsbDoUnRrSgwZHH7lH8pbPeQj1aOVYQrbZKhfSVBxVW+Py7vtulRktw==", - "dev": true, - "dependencies": { - "@types/node": "*", - "@types/vinyl": "^2.0.4", - "istextorbinary": "^3.0.0", - "replacestream": "^4.0.3", - "yargs-parser": ">=5.0.0-security.0" - }, - "engines": { - "node": ">=10" - } + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "license": "MIT" }, - "node_modules/gulplog": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-2.2.0.tgz", - "integrity": "sha512-V2FaKiOhpR3DRXZuYdRLn/qiY0yI5XmqbTKrYbdemJ+xOh2d2MOweI/XFgMzd/9+1twdvMwllnZbWZNJ+BOm4A==", - "dev": true, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "license": "MIT", "dependencies": { - "glogg": "^2.2.0" - }, - "engines": { - "node": ">= 10.13.0" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/handlebars": { - "version": "4.7.8", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", - "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", - "dev": true, + "node_modules/@oslojs/encoding": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@oslojs/encoding/-/encoding-1.1.0.tgz", + "integrity": "sha512-70wQhgYmndg4GCPxPPxPGevRKqTIJ2Nh4OkiMWmDAVYsTQ+Ta7Sq+rPevXyXGdzr30/qZBnyOalCszoMxlyldQ==", + "license": "MIT" + }, + "node_modules/@rollup/pluginutils": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.4.tgz", + "integrity": "sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==", + "license": "MIT", "dependencies": { - "minimist": "^1.2.5", - "neo-async": "^2.6.2", - "source-map": "^0.6.1", - "wordwrap": "^1.0.0" - }, - "bin": { - "handlebars": "bin/handlebars" + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^4.0.2" }, "engines": { - "node": ">=0.4.7" + "node": ">=14.0.0" }, - "optionalDependencies": { - "uglify-js": "^3.1.4" - } - }, - "node_modules/handlebars/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } } }, - "node_modules/hasown": { + "node_modules/@rollup/pluginutils/node_modules/estree-walker": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "license": "MIT" }, - "node_modules/homedir-polyfill": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", - "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", - "dev": true, - "dependencies": { - "parse-passwd": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.41.1.tgz", + "integrity": "sha512-NELNvyEWZ6R9QMkiytB4/L4zSEaBC03KIXEghptLGLZWJ6VPrL63ooZQCOnlx36aQPGhzuOMwDerC1Eb2VmrLw==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] }, - "node_modules/iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "dev": true, - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.41.1.tgz", + "integrity": "sha512-DXdQe1BJ6TK47ukAoZLehRHhfKnKg9BjnQYUu9gzhI8Mwa1d2fzxA1aw2JixHVl403bwp1+/o/NhhHtxWJBgEA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.41.1.tgz", + "integrity": "sha512-5afxvwszzdulsU2w8JKWwY8/sJOLPzf0e1bFuvcW5h9zsEg+RQAojdW0ux2zyYAz7R8HvvzKCjLNJhVq965U7w==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" ] }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "dev": true - }, - "node_modules/interpret": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", - "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", - "dev": true, - "engines": { - "node": ">=10.13.0" - } + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.41.1.tgz", + "integrity": "sha512-egpJACny8QOdHNNMZKf8xY0Is6gIMz+tuqXlusxquWu3F833DcMwmGM7WlvCO9sB3OsPjdC4U0wHw5FabzCGZg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] }, - "node_modules/is-absolute": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", - "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", - "dev": true, - "dependencies": { - "is-relative": "^1.0.0", - "is-windows": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.41.1.tgz", + "integrity": "sha512-DBVMZH5vbjgRk3r0OzgjS38z+atlupJ7xfKIDJdZZL6sM6wjfDNo64aowcLPKIx7LMQi8vybB56uh1Ftck/Atg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.41.1.tgz", + "integrity": "sha512-3FkydeohozEskBxNWEIbPfOE0aqQgB6ttTkJ159uWOFn42VLyfAiyD9UK5mhu+ItWzft60DycIN1Xdgiy8o/SA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] }, - "node_modules/is-core-module": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.14.0.tgz", - "integrity": "sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==", - "dev": true, - "dependencies": { - "hasown": "^2.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.41.1.tgz", + "integrity": "sha512-wC53ZNDgt0pqx5xCAgNunkTzFE8GTgdZ9EwYGVcg+jEjJdZGtq9xPjDnFgfFozQI/Xm1mh+D9YlYtl+ueswNEg==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.41.1.tgz", + "integrity": "sha512-jwKCca1gbZkZLhLRtsrka5N8sFAaxrGz/7wRJ8Wwvq3jug7toO21vWlViihG85ei7uJTpzbXZRcORotE+xyrLA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.41.1.tgz", + "integrity": "sha512-g0UBcNknsmmNQ8V2d/zD2P7WWfJKU0F1nu0k5pW4rvdb+BIqMm8ToluW/eeRmxCared5dD76lS04uL4UaNgpNA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.41.1.tgz", + "integrity": "sha512-XZpeGB5TKEZWzIrj7sXr+BEaSgo/ma/kCgrZgL0oo5qdB1JlTzIYQKel/RmhT6vMAvOdM2teYlAaOGJpJ9lahg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] }, - "node_modules/is-negated-glob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", - "integrity": "sha512-czXVVn/QEmgvej1f50BZ648vUI+em0xqMq2Sn+QncCLN4zj1UAxlT+kw/6ggQTOaZPd1HqKQGEqbpQVtJucWug==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } + "node_modules/@rollup/rollup-linux-loongarch64-gnu": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.41.1.tgz", + "integrity": "sha512-bkCfDJ4qzWfFRCNt5RVV4DOw6KEgFTUZi2r2RuYhGWC8WhCA8lCAJhDeAmrM/fdiAH54m0mA0Vk2FGRPyzI+tw==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.41.1.tgz", + "integrity": "sha512-3mr3Xm+gvMX+/8EKogIZSIEF0WUu0HL9di+YWlJpO8CQBnoLAEL/roTCxuLncEdgcfJcvA4UMOf+2dnjl4Ut1A==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] }, - "node_modules/is-plain-object": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", - "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.41.1.tgz", + "integrity": "sha512-3rwCIh6MQ1LGrvKJitQjZFuQnT2wxfU+ivhNBzmxXTXPllewOF7JR1s2vMX/tWtUYFgphygxjqMl76q4aMotGw==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] }, - "node_modules/is-relative": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", - "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", - "dev": true, - "dependencies": { - "is-unc-path": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.41.1.tgz", + "integrity": "sha512-LdIUOb3gvfmpkgFZuccNa2uYiqtgZAz3PTzjuM5bH3nvuy9ty6RGc/Q0+HDFrHrizJGVpjnTZ1yS5TNNjFlklw==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] }, - "node_modules/is-unc-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", - "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", - "dev": true, - "dependencies": { - "unc-path-regex": "^0.1.2" - }, - "engines": { - "node": ">=0.10.0" - } + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.41.1.tgz", + "integrity": "sha512-oIE6M8WC9ma6xYqjvPhzZYk6NbobIURvP/lEbh7FWplcMO6gn7MM2yHKA1eC/GvYwzNKK/1LYgqzdkZ8YFxR8g==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] }, - "node_modules/is-valid-glob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-1.0.0.tgz", - "integrity": "sha512-AhiROmoEFDSsjx8hW+5sGwgKVIORcXnrlAx/R0ZSeaPw70Vw0CqkGBBhHGL58Uox2eXnU1AnvXJl1XlyedO5bA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.41.1.tgz", + "integrity": "sha512-cWBOvayNvA+SyeQMp79BHPK8ws6sHSsYnK5zDcsC3Hsxr1dgTABKjMnMslPq1DvZIp6uO7kIWhiGwaTdR4Og9A==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] }, - "node_modules/is-windows": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.41.1.tgz", + "integrity": "sha512-y5CbN44M+pUCdGDlZFzGGBSKCA4A/J2ZH4edTYSSxFg7ce1Xt3GtydbVKWLlzL+INfFIZAEg1ZV6hh9+QQf9YQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.41.1.tgz", + "integrity": "sha512-lZkCxIrjlJlMt1dLO/FbpZbzt6J/A8p4DnqzSa4PWqPEUUUnzXLeki/iyPLfV0BmHItlYgHUqJe+3KiyydmiNQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.41.1.tgz", + "integrity": "sha512-+psFT9+pIh2iuGsxFYYa/LhS5MFKmuivRsx9iPJWNSGbh2XVEjk90fmpUEjCnILPEPJnikAU6SFDiEUyOv90Pg==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] }, - "node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.41.1.tgz", + "integrity": "sha512-Wq2zpapRYLfi4aKxf2Xff0tN+7slj2d4R87WEzqw7ZLsVvO5zwYCIuEGSZYiK41+GlwUo1HiR+GdkLEJnCKTCw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] }, - "node_modules/istextorbinary": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-3.3.0.tgz", - "integrity": "sha512-Tvq1W6NAcZeJ8op+Hq7tdZ434rqnMx4CCZ7H0ff83uEloDvVbqAwaMTZcafKGJT0VHkYzuXUiCY4hlXQg6WfoQ==", - "dev": true, + "node_modules/@shikijs/core": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-3.5.0.tgz", + "integrity": "sha512-iycvvnVG7MWZHRNuoqpYkV3Qc8DNLU74Lxh/roDwUqJJoXRnCTbbVJGfSWAdBslUgJMsjSHwFL42i55voavDDg==", + "license": "MIT", "dependencies": { - "binaryextensions": "^2.2.0", - "textextensions": "^3.2.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://bevry.me/fund" + "@shikijs/types": "3.5.0", + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4", + "hast-util-to-html": "^9.0.5" } }, - "node_modules/jackspeak": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.1.tgz", - "integrity": "sha512-cub8rahkh0Q/bw1+GxP7aeSe29hHHn2V4m29nnDlvCdlgU+3UGxkZp7Z53jLUdpX3jdTO0nJZUDl3xvbWc2Xog==", - "dev": true, - "license": "BlueOak-1.0.0", + "node_modules/@shikijs/engine-javascript": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-3.5.0.tgz", + "integrity": "sha512-3MhSnVHEdGb4L4FS/HAPc7WtPmIfHjRZraObf6tKxQaGuQGZfBsoLVCGuoGfiqt/zy0MKpll3oiZiQ/maT/wlQ==", + "license": "MIT", "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" + "@shikijs/types": "3.5.0", + "@shikijs/vscode-textmate": "^10.0.2", + "oniguruma-to-es": "^4.3.3" } }, - "node_modules/javascript-natural-sort": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz", - "integrity": "sha1-+eIwPUUH9tdDVac2ZNFED7Wg71k=" - }, - "node_modules/last-run": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/last-run/-/last-run-2.0.0.tgz", - "integrity": "sha512-j+y6WhTLN4Itnf9j5ZQos1BGPCS8DAwmgMroR3OzfxAsBxam0hMw7J8M3KqZl0pLQJ1jNnwIexg5DYpC/ctwEQ==", - "dev": true, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/lead": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/lead/-/lead-4.0.0.tgz", - "integrity": "sha512-DpMa59o5uGUWWjruMp71e6knmwKU3jRBBn1kjuLWN9EeIOxNeSAwvHf03WIl8g/ZMR2oSQC9ej3yeLBwdDc/pg==", - "dev": true, - "engines": { - "node": ">=10.13.0" + "node_modules/@shikijs/engine-oniguruma": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.5.0.tgz", + "integrity": "sha512-DLM1VL+WvWFHQlikP8MTc8T2MdEGAOJhAi9+48wkQ7kO7c/99h4ALK0b0CPQBCeLMp37raoM1Ucuo3OTSjtUxA==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.5.0", + "@shikijs/vscode-textmate": "^10.0.2" } }, - "node_modules/liftoff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-5.0.0.tgz", - "integrity": "sha512-a5BQjbCHnB+cy+gsro8lXJ4kZluzOijzJ1UVVfyJYZC+IP2pLv1h4+aysQeKuTmyO8NAqfyQAk4HWaP/HjcKTg==", - "dev": true, + "node_modules/@shikijs/langs": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.5.0.tgz", + "integrity": "sha512-kBJhmj0ZkULbf3O+Asr8Xs7hcFtQdPnqIld2kKrG9WhDpIvqMRWSj3L9LECi2TH7vV6ROrvJ78/1yEASL0d00w==", + "license": "MIT", "dependencies": { - "extend": "^3.0.2", - "findup-sync": "^5.0.0", - "fined": "^2.0.0", - "flagged-respawn": "^2.0.0", - "is-plain-object": "^5.0.0", - "rechoir": "^0.8.0", - "resolve": "^1.20.0" - }, - "engines": { - "node": ">=10.13.0" + "@shikijs/types": "3.5.0" } }, - "node_modules/lodash._reinterpolate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", - "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", - "dev": true - }, - "node_modules/lodash.template": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz", - "integrity": "sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A==", - "dev": true, + "node_modules/@shikijs/themes": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.5.0.tgz", + "integrity": "sha512-xr4bPmAORm2fhfVeaCDfRXiq0rxAxPRR0Bhiw+EaofgJ79Jj61fnVZDF40nJKvmMoKnC60TqCTpbr15ToTgTOA==", + "license": "MIT", "dependencies": { - "lodash._reinterpolate": "^3.0.0", - "lodash.templatesettings": "^4.0.0" + "@shikijs/types": "3.5.0" } }, - "node_modules/lodash.templatesettings": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz", - "integrity": "sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ==", - "dev": true, + "node_modules/@shikijs/types": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.5.0.tgz", + "integrity": "sha512-VvqGHhS8BWClF7eVnEJLe0nAhQw/1L+xC5mp6uj+tVr3tjD2ASx2Mx9M9l7tZQO++1qwZeIIusvSRhz4aKODFQ==", + "license": "MIT", "dependencies": { - "lodash._reinterpolate": "^3.0.0" + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" } }, - "node_modules/lru-cache": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.0.tgz", - "integrity": "sha512-Qv32eSV1RSCfhY3fpPE2GNZ8jgM9X7rdAfemLWqTUxwiyIC4jJ6Sy0fZ8H+oLWevO6i4/bizg7c8d8i6bxrzbA==", - "dev": true, - "license": "ISC", - "engines": { - "node": "20 || >=22" - } + "node_modules/@shikijs/vscode-textmate": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz", + "integrity": "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==", + "license": "MIT" }, - "node_modules/map-cache": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg==", - "dev": true, - "engines": { - "node": ">=0.10.0" + "node_modules/@swc/helpers": { + "version": "0.5.17", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.17.tgz", + "integrity": "sha512-5IKx/Y13RsYd+sauPb2x+U/xZikHjolzfuDgTAl/Tdf3Q8rslRvC19NKDLgAJQ6wsqADk10ntlv08nPFw/gO/A==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.8.0" } }, - "node_modules/map-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz", - "integrity": "sha1-ih8HiW2CsQkmvTdEokIACfiJdKg=", - "dev": true - }, - "node_modules/mathjs": { - "version": "14.5.2", - "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-14.5.2.tgz", - "integrity": "sha512-51U6hp7j4M4Rj+l+q2KbmXAV9EhQVQzUdw1wE67RnUkKKq5ibxdrl9Ky2YkSUEIc2+VU8/IsThZNu6QSHUoyTA==", - "license": "Apache-2.0", + "node_modules/@tailwindcss/node": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.1.8.tgz", + "integrity": "sha512-OWwBsbC9BFAJelmnNcrKuf+bka2ZxCE2A4Ft53Tkg4uoiE67r/PMEYwCsourC26E+kmxfwE0hVzMdxqeW+xu7Q==", + "license": "MIT", + "dependencies": { + "@ampproject/remapping": "^2.3.0", + "enhanced-resolve": "^5.18.1", + "jiti": "^2.4.2", + "lightningcss": "1.30.1", + "magic-string": "^0.30.17", + "source-map-js": "^1.2.1", + "tailwindcss": "4.1.8" + } + }, + "node_modules/@tailwindcss/oxide": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.1.8.tgz", + "integrity": "sha512-d7qvv9PsM5N3VNKhwVUhpK6r4h9wtLkJ6lz9ZY9aeZgrUWk1Z8VPyqyDT9MZlem7GTGseRQHkeB1j3tC7W1P+A==", + "hasInstallScript": true, + "license": "MIT", "dependencies": { - "@babel/runtime": "^7.26.10", - "complex.js": "^2.2.5", - "decimal.js": "^10.4.3", - "escape-latex": "^1.2.0", - "fraction.js": "^5.2.1", - "javascript-natural-sort": "^0.7.1", - "seedrandom": "^3.0.5", - "tiny-emitter": "^2.1.0", - "typed-function": "^4.2.1" + "detect-libc": "^2.0.4", + "tar": "^7.4.3" }, - "bin": { - "mathjs": "bin/cli.js" + "engines": { + "node": ">= 10" }, + "optionalDependencies": { + "@tailwindcss/oxide-android-arm64": "4.1.8", + "@tailwindcss/oxide-darwin-arm64": "4.1.8", + "@tailwindcss/oxide-darwin-x64": "4.1.8", + "@tailwindcss/oxide-freebsd-x64": "4.1.8", + "@tailwindcss/oxide-linux-arm-gnueabihf": "4.1.8", + "@tailwindcss/oxide-linux-arm64-gnu": "4.1.8", + "@tailwindcss/oxide-linux-arm64-musl": "4.1.8", + "@tailwindcss/oxide-linux-x64-gnu": "4.1.8", + "@tailwindcss/oxide-linux-x64-musl": "4.1.8", + "@tailwindcss/oxide-wasm32-wasi": "4.1.8", + "@tailwindcss/oxide-win32-arm64-msvc": "4.1.8", + "@tailwindcss/oxide-win32-x64-msvc": "4.1.8" + } + }, + "node_modules/@tailwindcss/oxide-android-arm64": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.1.8.tgz", + "integrity": "sha512-Fbz7qni62uKYceWYvUjRqhGfZKwhZDQhlrJKGtnZfuNtHFqa8wmr+Wn74CTWERiW2hn3mN5gTpOoxWKk0jRxjg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">= 18" + "node": ">= 10" } }, - "node_modules/micromatch": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", - "dev": true, + "node_modules/@tailwindcss/oxide-darwin-arm64": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.1.8.tgz", + "integrity": "sha512-RdRvedGsT0vwVVDztvyXhKpsU2ark/BjgG0huo4+2BluxdXo8NDgzl77qh0T1nUxmM11eXwR8jA39ibvSTbi7A==", + "cpu": [ + "arm64" + ], "license": "MIT", - "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - }, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=8.6" + "node": ">= 10" } }, - "node_modules/minimatch": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", - "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, + "node_modules/@tailwindcss/oxide-darwin-x64": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.1.8.tgz", + "integrity": "sha512-t6PgxjEMLp5Ovf7uMb2OFmb3kqzVTPPakWpBIFzppk4JE4ix0yEtbtSjPbU8+PZETpaYMtXvss2Sdkx8Vs4XRw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "node": ">= 10" } }, - "node_modules/minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true - }, - "node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true, - "license": "ISC", + "node_modules/@tailwindcss/oxide-freebsd-x64": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.1.8.tgz", + "integrity": "sha512-g8C8eGEyhHTqwPStSwZNSrOlyx0bhK/V/+zX0Y+n7DoRUzyS8eMbVshVOLJTDDC+Qn9IJnilYbIKzpB9n4aBsg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], "engines": { - "node": ">=16 || 14 >=14.17" + "node": ">= 10" } }, - "node_modules/mute-stdout": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mute-stdout/-/mute-stdout-2.0.0.tgz", - "integrity": "sha512-32GSKM3Wyc8dg/p39lWPKYu8zci9mJFzV1Np9Of0ZEpe6Fhssn/FbI7ywAMd40uX+p3ZKh3T5EeCFv81qS3HmQ==", - "dev": true, + "node_modules/@tailwindcss/oxide-linux-arm-gnueabihf": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.1.8.tgz", + "integrity": "sha512-Jmzr3FA4S2tHhaC6yCjac3rGf7hG9R6Gf2z9i9JFcuyy0u79HfQsh/thifbYTF2ic82KJovKKkIB6Z9TdNhCXQ==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">= 10.13.0" + "node": ">= 10" } }, - "node_modules/neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, + "node_modules/@tailwindcss/oxide-linux-arm64-gnu": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.1.8.tgz", + "integrity": "sha512-qq7jXtO1+UEtCmCeBBIRDrPFIVI4ilEQ97qgBGdwXAARrUqSn/L9fUrkb1XP/mvVtoVeR2bt/0L77xx53bPZ/Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=0.10.0" + "node": ">= 10" } }, - "node_modules/now-and-later": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-3.0.0.tgz", - "integrity": "sha512-pGO4pzSdaxhWTGkfSfHx3hVzJVslFPwBp2Myq9MYN/ChfJZF87ochMAXnvz6/58RJSf5ik2q9tXprBBrk2cpcg==", - "dev": true, - "dependencies": { - "once": "^1.4.0" - }, + "node_modules/@tailwindcss/oxide-linux-arm64-musl": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.1.8.tgz", + "integrity": "sha512-O6b8QesPbJCRshsNApsOIpzKt3ztG35gfX9tEf4arD7mwNinsoCKxkj8TgEE0YRjmjtO3r9FlJnT/ENd9EVefQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">= 10.13.0" + "node": ">= 10" } }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true, + "node_modules/@tailwindcss/oxide-linux-x64-gnu": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.1.8.tgz", + "integrity": "sha512-32iEXX/pXwikshNOGnERAFwFSfiltmijMIAbUhnNyjFr3tmWmMJWQKU2vNcFX0DACSXJ3ZWcSkzNbaKTdngH6g==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=0.10.0" + "node": ">= 10" } }, - "node_modules/object.defaults": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz", - "integrity": "sha512-c/K0mw/F11k4dEUBMW8naXUuBuhxRCfG7W+yFy8EcijU/rSmazOUd1XAEEe6bC0OuXY4HUKjTJv7xbxIMqdxrA==", - "dev": true, - "dependencies": { - "array-each": "^1.0.1", - "array-slice": "^1.0.0", - "for-own": "^1.0.0", - "isobject": "^3.0.0" - }, + "node_modules/@tailwindcss/oxide-linux-x64-musl": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.1.8.tgz", + "integrity": "sha512-s+VSSD+TfZeMEsCaFaHTaY5YNj3Dri8rST09gMvYQKwPphacRG7wbuQ5ZJMIJXN/puxPcg/nU+ucvWguPpvBDg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=0.10.0" + "node": ">= 10" } }, - "node_modules/object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ==", - "dev": true, + "node_modules/@tailwindcss/oxide-wasm32-wasi": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.1.8.tgz", + "integrity": "sha512-CXBPVFkpDjM67sS1psWohZ6g/2/cd+cq56vPxK4JeawelxwK4YECgl9Y9TjkE2qfF+9/s1tHHJqrC4SS6cVvSg==", + "bundleDependencies": [ + "@napi-rs/wasm-runtime", + "@emnapi/core", + "@emnapi/runtime", + "@tybys/wasm-util", + "@emnapi/wasi-threads", + "tslib" + ], + "cpu": [ + "wasm32" + ], + "license": "MIT", + "optional": true, "dependencies": { - "isobject": "^3.0.1" + "@emnapi/core": "^1.4.3", + "@emnapi/runtime": "^1.4.3", + "@emnapi/wasi-threads": "^1.0.2", + "@napi-rs/wasm-runtime": "^0.2.10", + "@tybys/wasm-util": "^0.9.0", + "tslib": "^2.8.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=14.0.0" } }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/package-json-from-dist": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", - "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", - "dev": true - }, - "node_modules/parse-filepath": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", - "integrity": "sha512-FwdRXKCohSVeXqwtYonZTXtbGJKrn+HNyWDYVcp5yuJlesTwNH4rsmRZ+GrKAPJ5bLpRxESMeS+Rl0VCHRvB2Q==", - "dev": true, - "dependencies": { - "is-absolute": "^1.0.0", - "map-cache": "^0.2.0", - "path-root": "^0.1.1" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/parse-passwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", - "integrity": "sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==", - "dev": true, + "node_modules/@tailwindcss/oxide-win32-arm64-msvc": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.1.8.tgz", + "integrity": "sha512-7GmYk1n28teDHUjPlIx4Z6Z4hHEgvP5ZW2QS9ygnDAdI/myh3HTHjDqtSqgu1BpRoI4OiLx+fThAyA1JePoENA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=0.10.0" + "node": ">= 10" } }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, + "node_modules/@tailwindcss/oxide-win32-x64-msvc": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.1.8.tgz", + "integrity": "sha512-fou+U20j+Jl0EHwK92spoWISON2OBnCazIc038Xj2TdweYV33ZRkS9nwqiUi2d/Wba5xg5UoHfvynnb/UB49cQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=8" + "node": ">= 10" } }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "node_modules/path-root": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz", - "integrity": "sha512-QLcPegTHF11axjfojBIoDygmS2E3Lf+8+jI6wOVmNVenrKSo3mFdSGiIgdSHenczw3wPtlVMQaFVwGmM7BJdtg==", - "dev": true, + "node_modules/@tailwindcss/vite": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.1.8.tgz", + "integrity": "sha512-CQ+I8yxNV5/6uGaJjiuymgw0kEQiNKRinYbZXPdx1fk5WgiyReG0VaUx/Xq6aVNSUNJFzxm6o8FNKS5aMaim5A==", + "license": "MIT", "dependencies": { - "path-root-regex": "^0.1.0" + "@tailwindcss/node": "4.1.8", + "@tailwindcss/oxide": "4.1.8", + "tailwindcss": "4.1.8" }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-root-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/path-root-regex/-/path-root-regex-0.1.2.tgz", - "integrity": "sha512-4GlJ6rZDhQZFE0DPVKh0e9jmZ5egZfxTkp7bcRDuPlJXbAwhxcl2dINPUAsjLdejqaLsCeg8axcLjIbvBjN4pQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" + "peerDependencies": { + "vite": "^5.2.0 || ^6" } }, - "node_modules/path-scurry": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", - "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", - "dev": true, - "license": "BlueOak-1.0.0", + "node_modules/@types/debug": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", + "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "license": "MIT", "dependencies": { - "lru-cache": "^11.0.0", - "minipass": "^7.1.2" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "@types/ms": "*" } }, - "node_modules/process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "dev": true - }, - "node_modules/queue-tick": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", - "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==", - "dev": true + "node_modules/@types/estree": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", + "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", + "license": "MIT" }, - "node_modules/readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, + "node_modules/@types/fontkit": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/@types/fontkit/-/fontkit-2.0.8.tgz", + "integrity": "sha512-wN+8bYxIpJf+5oZdrdtaX04qUuWHcKxcDEgRS9Qm9ZClSHjzEn13SxUC+5eRM+4yXIeTYk8mTzLAWGF64847ew==", + "license": "MIT", "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" + "@types/node": "*" } }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "license": "MIT", "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" + "@types/unist": "*" } }, - "node_modules/rechoir": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", - "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", - "dev": true, + "node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "license": "MIT", "dependencies": { - "resolve": "^1.20.0" - }, - "engines": { - "node": ">= 10.13.0" + "@types/unist": "*" } }, - "node_modules/regenerator-runtime": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", - "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", "license": "MIT" }, - "node_modules/remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==", - "dev": true - }, - "node_modules/replace-ext": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-2.0.0.tgz", - "integrity": "sha512-UszKE5KVK6JvyD92nzMn9cDapSk6w/CaFZ96CnmDMUqH9oowfxF/ZjRITD25H4DnOQClLA4/j7jLGXXLVKxAug==", - "dev": true, - "engines": { - "node": ">= 10" - } - }, - "node_modules/replace-homedir": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/replace-homedir/-/replace-homedir-2.0.0.tgz", - "integrity": "sha512-bgEuQQ/BHW0XkkJtawzrfzHFSN70f/3cNOiHa2QsYxqrjaC30X1k74FJ6xswVBP0sr0SpGIdVFuPwfrYziVeyw==", - "dev": true, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/replacestream": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/replacestream/-/replacestream-4.0.3.tgz", - "integrity": "sha512-AC0FiLS352pBBiZhd4VXB1Ab/lh0lEgpP+GGvZqbQh8a5cmXVoTe5EX/YeTFArnp4SRGTHh1qCHu9lGs1qG8sA==", - "dev": true, - "dependencies": { - "escape-string-regexp": "^1.0.3", - "object-assign": "^4.0.1", - "readable-stream": "^2.0.2" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/resolve": { - "version": "1.22.8", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", - "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", - "dev": true, - "dependencies": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/resolve-dir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", - "integrity": "sha512-R7uiTjECzvOsWSfdM0QKFNBVFcK27aHOUwdvK53BcW8zqnGdYp0Fbj82cy54+2A4P2tFM22J5kRfe1R+lM/1yg==", - "dev": true, - "dependencies": { - "expand-tilde": "^2.0.0", - "global-modules": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/resolve-options": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve-options/-/resolve-options-2.0.0.tgz", - "integrity": "sha512-/FopbmmFOQCfsCx77BRFdKOniglTiHumLgwvd6IDPihy1GKkadZbgQJBcTb2lMzSR1pndzd96b1nZrreZ7+9/A==", - "dev": true, + "node_modules/@types/nlcst": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/nlcst/-/nlcst-2.0.3.tgz", + "integrity": "sha512-vSYNSDe6Ix3q+6Z7ri9lyWqgGhJTmzRjZRqyq15N0Z/1/UnVsno9G/N40NBijoYx2seFDIl0+B2mgAb9mezUCA==", + "license": "MIT", "dependencies": { - "value-or-function": "^4.0.0" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true, - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" + "@types/unist": "*" } }, - "node_modules/rimraf": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.0.1.tgz", - "integrity": "sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A==", - "dev": true, - "license": "ISC", + "node_modules/@types/node": { + "version": "22.15.29", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.29.tgz", + "integrity": "sha512-LNdjOkUDlU1RZb8e1kOIUpN1qQUlzGkEtbVNo53vbrwDg5om6oduhm4SiUaPW5ASTXhAiP0jInWG8Qx9fVlOeQ==", + "license": "MIT", "dependencies": { - "glob": "^11.0.0", - "package-json-from-dist": "^1.0.0" - }, - "bin": { - "rimraf": "dist/esm/bin.mjs" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "undici-types": "~6.21.0" } }, - "node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "node_modules/seedrandom": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz", - "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==" + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "license": "MIT" }, - "node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "optional": true, + "node_modules/@ungap/structured-clone": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "license": "ISC" + }, + "node_modules/acorn": { + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", + "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", + "license": "MIT", "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/semver-greatest-satisfied-range": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/semver-greatest-satisfied-range/-/semver-greatest-satisfied-range-2.0.0.tgz", - "integrity": "sha512-lH3f6kMbwyANB7HuOWRMlLCa2itaCrZJ+SAqqkSZrZKO/cAsk2EOyaKHUtNkVLFyFW9pct22SFesFp3Z7zpA0g==", - "dev": true, - "dependencies": { - "sver": "^1.8.3" + "acorn": "bin/acorn" }, "engines": { - "node": ">= 10.13.0" + "node": ">=0.4.0" } }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, + "node_modules/ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "license": "ISC", "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" + "string-width": "^4.1.0" } }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, + "node_modules/ansi-align/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", "engines": { "node": ">=8" } }, - "node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/sparkles": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-2.1.0.tgz", - "integrity": "sha512-r7iW1bDw8R/cFifrD3JnQJX0K1jqT0kprL48BiBpLZLJPmAm34zsVBsK5lc7HirZYZqMW65dOXZgbAGt/I6frg==", - "dev": true, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/stream-composer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/stream-composer/-/stream-composer-1.0.2.tgz", - "integrity": "sha512-bnBselmwfX5K10AH6L4c8+S5lgZMWI7ZYrz2rvYjCPB2DIMC4Ig8OpxGpNJSxRZ58oti7y1IcNvjBAz9vW5m4w==", - "dev": true, - "dependencies": { - "streamx": "^2.13.2" - } - }, - "node_modules/stream-exhaust": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/stream-exhaust/-/stream-exhaust-1.0.2.tgz", - "integrity": "sha512-b/qaq/GlBK5xaq1yrK9/zFcyRSTNxmcZwFLGSTG0mXgZl/4Z6GgiyYOXOvY7N3eEvFRAG1bkDRz5EPGSvPYQlw==", - "dev": true - }, - "node_modules/streamx": { - "version": "2.18.0", - "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.18.0.tgz", - "integrity": "sha512-LLUC1TWdjVdn1weXGcSxyTR3T4+acB6tVGXT95y0nGbca4t4o/ng1wKAGTljm9VicuCVLvRlqFYXYy5GwgM7sQ==", - "dev": true, - "dependencies": { - "fast-fifo": "^1.3.2", - "queue-tick": "^1.0.1", - "text-decoder": "^1.1.0" - }, - "optionalDependencies": { - "bare-events": "^2.2.0" - } - }, - "node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } + "node_modules/ansi-align/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" }, - "node_modules/string-width-cjs": { - "name": "string-width", + "node_modules/ansi-align/node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", @@ -2049,21 +1770,10 @@ "node": ">=8" } }, - "node_modules/string-width-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/strip-ansi": { + "node_modules/ansi-align/node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" @@ -2072,2363 +1782,3781 @@ "node": ">=8" } }, - "node_modules/string-width/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, + "node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "license": "MIT", "engines": { - "node": ">=8" - } - }, - "node_modules/string-width/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" + "node": ">=12" }, - "engines": { - "node": ">=8" + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, - "node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, + "node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, "engines": { "node": ">=12" }, "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "license": "ISC", "dependencies": { - "ansi-regex": "^5.0.1" + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" }, "engines": { - "node": ">=8" + "node": ">= 8" } }, - "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, + "node_modules/anymatch/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" + }, + "node_modules/aria-query": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.2.tgz", + "integrity": "sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==", + "license": "Apache-2.0", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/array-iterate": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/array-iterate/-/array-iterate-2.0.1.tgz", + "integrity": "sha512-I1jXZMjAgCMmxT4qxXfPXa6SthSoE8h6gkSI9BGGNv8mP8G/v0blc+qFnZu6K42vTOiuME596QaLO0TP3Lk0xg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/astro": { + "version": "5.8.2", + "resolved": "https://registry.npmjs.org/astro/-/astro-5.8.2.tgz", + "integrity": "sha512-t0TBpBdVluA2QVmbFBwpIqmTvBwNhIz1XTIT1BWPkDkoIgsiEMf6BOZqcoGG7f4GVKkUB9bTgMOhPgU3tbJ6vQ==", + "license": "MIT", "dependencies": { - "has-flag": "^4.0.0" + "@astrojs/compiler": "^2.11.0", + "@astrojs/internal-helpers": "0.6.1", + "@astrojs/markdown-remark": "6.3.2", + "@astrojs/telemetry": "3.3.0", + "@capsizecss/unpack": "^2.4.0", + "@oslojs/encoding": "^1.1.0", + "@rollup/pluginutils": "^5.1.4", + "acorn": "^8.14.1", + "aria-query": "^5.3.2", + "axobject-query": "^4.1.0", + "boxen": "8.0.1", + "ci-info": "^4.2.0", + "clsx": "^2.1.1", + "common-ancestor-path": "^1.0.1", + "cookie": "^1.0.2", + "cssesc": "^3.0.0", + "debug": "^4.4.0", + "deterministic-object-hash": "^2.0.2", + "devalue": "^5.1.1", + "diff": "^5.2.0", + "dlv": "^1.1.3", + "dset": "^3.1.4", + "es-module-lexer": "^1.6.0", + "esbuild": "^0.25.0", + "estree-walker": "^3.0.3", + "flattie": "^1.1.1", + "fontace": "~0.3.0", + "github-slugger": "^2.0.0", + "html-escaper": "3.0.3", + "http-cache-semantics": "^4.1.1", + "import-meta-resolve": "^4.1.0", + "js-yaml": "^4.1.0", + "kleur": "^4.1.5", + "magic-string": "^0.30.17", + "magicast": "^0.3.5", + "mrmime": "^2.0.1", + "neotraverse": "^0.6.18", + "p-limit": "^6.2.0", + "p-queue": "^8.1.0", + "package-manager-detector": "^1.1.0", + "picomatch": "^4.0.2", + "prompts": "^2.4.2", + "rehype": "^13.0.2", + "semver": "^7.7.1", + "shiki": "^3.2.1", + "tinyexec": "^0.3.2", + "tinyglobby": "^0.2.12", + "tsconfck": "^3.1.5", + "ultrahtml": "^1.6.0", + "unifont": "~0.5.0", + "unist-util-visit": "^5.0.0", + "unstorage": "^1.15.0", + "vfile": "^6.0.3", + "vite": "^6.3.4", + "vitefu": "^1.0.6", + "xxhash-wasm": "^1.1.0", + "yargs-parser": "^21.1.1", + "yocto-spinner": "^0.2.1", + "zod": "^3.24.2", + "zod-to-json-schema": "^3.24.5", + "zod-to-ts": "^1.2.0" + }, + "bin": { + "astro": "astro.js" }, "engines": { - "node": ">=8" + "node": "18.20.8 || ^20.3.0 || >=22.0.0", + "npm": ">=9.6.5", + "pnpm": ">=7.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/astrodotbuild" + }, + "optionalDependencies": { + "sharp": "^0.33.3" } }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, + "node_modules/axobject-query": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", + "integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==", + "license": "Apache-2.0", "engines": { "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/sver": { - "version": "1.8.4", - "resolved": "https://registry.npmjs.org/sver/-/sver-1.8.4.tgz", - "integrity": "sha512-71o1zfzyawLfIWBOmw8brleKyvnbn73oVHNCsu51uPMz/HWiKkkXsI31JjHW5zqXEqnPYkIiHd8ZmL7FCimLEA==", - "dev": true, - "optionalDependencies": { - "semver": "^6.3.0" + "node_modules/bail": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", + "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/teex": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/teex/-/teex-1.0.1.tgz", - "integrity": "sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg==", - "dev": true, + "node_modules/base-64": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz", + "integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==", + "license": "MIT" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/blob-to-buffer": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/blob-to-buffer/-/blob-to-buffer-1.2.9.tgz", + "integrity": "sha512-BF033y5fN6OCofD3vgHmNtwZWRcq9NLyyxyILx9hfMy1sXYy4ojFl765hJ2lP0YaN2fuxPaLO2Vzzoxy0FLFFA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/boxen": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-8.0.1.tgz", + "integrity": "sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw==", + "license": "MIT", "dependencies": { - "streamx": "^2.12.5" + "ansi-align": "^3.0.1", + "camelcase": "^8.0.0", + "chalk": "^5.3.0", + "cli-boxes": "^3.0.0", + "string-width": "^7.2.0", + "type-fest": "^4.21.0", + "widest-line": "^5.0.0", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/text-decoder": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.1.0.tgz", - "integrity": "sha512-TmLJNj6UgX8xcUZo4UDStGQtDiTzF7BzWlzn9g7UWrjkpHr5uJTK1ld16wZ3LXb2vb6jH8qU89dW5whuMdXYdw==", - "dev": true, + "node_modules/brotli": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/brotli/-/brotli-1.3.3.tgz", + "integrity": "sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg==", + "license": "MIT", "dependencies": { - "b4a": "^1.6.4" + "base64-js": "^1.1.2" } }, - "node_modules/textextensions": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/textextensions/-/textextensions-3.3.0.tgz", - "integrity": "sha512-mk82dS8eRABNbeVJrEiN5/UMSCliINAuz8mkUwH4SwslkNP//gbEzlWNS5au0z5Dpx40SQxzqZevZkn+WYJ9Dw==", - "dev": true, + "node_modules/camelcase": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-8.0.0.tgz", + "integrity": "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==", + "license": "MIT", "engines": { - "node": ">=8" + "node": ">=16" }, "funding": { - "url": "https://bevry.me/fund" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "dev": true, - "dependencies": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/chalk": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz", + "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==", + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/character-entities": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/tiny-emitter": { + "node_modules/character-entities-html4": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", - "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==" + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, + "node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "license": "MIT", "dependencies": { - "is-number": "^7.0.0" + "readdirp": "^4.0.1" }, "engines": { - "node": ">=8.0" + "node": ">= 14.16.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" } }, - "node_modules/to-through": { + "node_modules/chownr": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/to-through/-/to-through-3.0.0.tgz", - "integrity": "sha512-y8MN937s/HVhEoBU1SxfHC+wxCHkV1a9gW8eAdTadYh/bGyesZIVcbjI+mSpFbSVwQici/XjBjuUyri1dnXwBw==", - "dev": true, - "dependencies": { - "streamx": "^2.12.5" - }, + "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz", + "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==", + "license": "BlueOak-1.0.0", "engines": { - "node": ">=10.13.0" + "node": ">=18" } }, - "node_modules/typed-function": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/typed-function/-/typed-function-4.2.1.tgz", - "integrity": "sha512-EGjWssW7Tsk4DGfE+5yluuljS1OGYWiI1J6e8puZz9nTMM51Oug8CD5Zo4gWMsOhq5BI+1bF+rWTm4Vbj3ivRA==", + "node_modules/ci-info": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.2.0.tgz", + "integrity": "sha512-cYY9mypksY8NRqgDB1XD1RiJL338v/551niynFTGkZOO2LHuB2OmOYxDIe/ttN9AHwrqdum1360G3ald0W9kCg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", "engines": { - "node": ">= 18" + "node": ">=8" } }, - "node_modules/uglify-js": { - "version": "3.13.6", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.6.tgz", - "integrity": "sha512-rRprLwl8RVaS+Qvx3Wh5hPfPBn9++G6xkGlUupya0s5aDmNjI7z3lnRLB3u7sN4OmbB0pWgzhM9BEJyiWAwtAA==", - "dev": true, - "optional": true, - "bin": { - "uglifyjs": "bin/uglifyjs" + "node_modules/cli-boxes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz", + "integrity": "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==", + "license": "MIT", + "engines": { + "node": ">=10" }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", + "license": "MIT", "engines": { - "node": ">=0.8.0" + "node": ">=0.8" } }, - "node_modules/unc-path-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", - "integrity": "sha512-eXL4nmJT7oCpkZsHZUOJo8hcX3GbsiDOa0Qu9F646fi8dT3XuSVopVqAcEiVzSKKH7UoDti23wNX3qGFxcW5Qg==", - "dev": true, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=6" } }, - "node_modules/undertaker": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/undertaker/-/undertaker-2.0.0.tgz", - "integrity": "sha512-tO/bf30wBbTsJ7go80j0RzA2rcwX6o7XPBpeFcb+jzoeb4pfMM2zUeSDIkY1AWqeZabWxaQZ/h8N9t35QKDLPQ==", - "dev": true, + "node_modules/color": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz", + "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==", + "license": "MIT", + "optional": true, "dependencies": { - "bach": "^2.0.1", - "fast-levenshtein": "^3.0.0", - "last-run": "^2.0.0", - "undertaker-registry": "^2.0.0" + "color-convert": "^2.0.1", + "color-string": "^1.9.0" }, "engines": { - "node": ">=10.13.0" + "node": ">=12.5.0" } }, - "node_modules/undertaker-registry": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/undertaker-registry/-/undertaker-registry-2.0.0.tgz", - "integrity": "sha512-+hhVICbnp+rlzZMgxXenpvTxpuvA67Bfgtt+O9WOE5jo7w/dyiF1VmoZVIHvP2EkUjsyKyTwYKlLhA+j47m1Ew==", - "dev": true, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "color-name": "~1.1.4" + }, "engines": { - "node": ">= 10.13.0" + "node": ">=7.0.0" } }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT", + "optional": true }, - "node_modules/v8flags": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-4.0.1.tgz", - "integrity": "sha512-fcRLaS4H/hrZk9hYwbdRM35D0U8IYMfEClhXxCivOojl+yTRAZH3Zy2sSy6qVCiGbV9YAtPssP6jaChqC9vPCg==", - "dev": true, - "engines": { - "node": ">= 10.13.0" + "node_modules/color-string": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", + "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", + "license": "MIT", + "optional": true, + "dependencies": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" } }, - "node_modules/value-or-function": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/value-or-function/-/value-or-function-4.0.0.tgz", - "integrity": "sha512-aeVK81SIuT6aMJfNo9Vte8Dw0/FZINGBV8BfCraGtqVxIeLAEhJyoWs8SmvRVmXfGss2PmmOwZCuBPbZR+IYWg==", - "dev": true, - "engines": { - "node": ">= 10.13.0" + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/vinyl": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-3.0.0.tgz", - "integrity": "sha512-rC2VRfAVVCGEgjnxHUnpIVh3AGuk62rP3tqVrn+yab0YH7UULisC085+NYH+mnqf3Wx4SpSi1RQMwudL89N03g==", - "dev": true, - "dependencies": { - "clone": "^2.1.2", - "clone-stats": "^1.0.0", - "remove-trailing-separator": "^1.1.0", - "replace-ext": "^2.0.0", - "teex": "^1.0.1" - }, + "node_modules/common-ancestor-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz", + "integrity": "sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==", + "license": "ISC" + }, + "node_modules/cookie": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.0.2.tgz", + "integrity": "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==", + "license": "MIT", "engines": { - "node": ">=10.13.0" + "node": ">=18" } }, - "node_modules/vinyl-contents": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/vinyl-contents/-/vinyl-contents-2.0.0.tgz", - "integrity": "sha512-cHq6NnGyi2pZ7xwdHSW1v4Jfnho4TEGtxZHw01cmnc8+i7jgR6bRnED/LbrKan/Q7CvVLbnvA5OepnhbpjBZ5Q==", - "dev": true, + "node_modules/cookie-es": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.2.2.tgz", + "integrity": "sha512-+W7VmiVINB+ywl1HGXJXmrqkOhpKrIiVZV6tQuV54ZyQC7MMuBt81Vc336GMLoHBq5hV/F9eXgt5Mnx0Rha5Fg==", + "license": "MIT" + }, + "node_modules/cross-fetch": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.2.0.tgz", + "integrity": "sha512-Q+xVJLoGOeIMXZmbUK4HYk+69cQH6LudR0Vu/pRm2YlU/hDV9CiS0gKUMaWY5f2NeUH9C1nV3bsTlCo0FsTV1Q==", + "license": "MIT", "dependencies": { - "bl": "^5.0.0", - "vinyl": "^3.0.0" - }, - "engines": { - "node": ">=10.13.0" + "node-fetch": "^2.7.0" } }, - "node_modules/vinyl-fs": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-4.0.0.tgz", - "integrity": "sha512-7GbgBnYfaquMk3Qu9g22x000vbYkOex32930rBnc3qByw6HfMEAoELjCjoJv4HuEQxHAurT+nvMHm6MnJllFLw==", - "dev": true, - "dependencies": { - "fs-mkdirp-stream": "^2.0.1", - "glob-stream": "^8.0.0", - "graceful-fs": "^4.2.11", - "iconv-lite": "^0.6.3", - "is-valid-glob": "^1.0.0", - "lead": "^4.0.0", - "normalize-path": "3.0.0", - "resolve-options": "^2.0.0", - "stream-composer": "^1.0.2", - "streamx": "^2.14.0", - "to-through": "^3.0.0", - "value-or-function": "^4.0.0", - "vinyl": "^3.0.0", - "vinyl-sourcemap": "^2.0.0" - }, - "engines": { - "node": ">=10.13.0" + "node_modules/crossws": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/crossws/-/crossws-0.3.5.tgz", + "integrity": "sha512-ojKiDvcmByhwa8YYqbQI/hg7MEU0NC03+pSdEq4ZUnZR9xXpwk7E43SMNGkn+JxJGPFtNvQ48+vV2p+P1ml5PA==", + "license": "MIT", + "dependencies": { + "uncrypto": "^0.1.3" } }, - "node_modules/vinyl-sourcemap": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/vinyl-sourcemap/-/vinyl-sourcemap-2.0.0.tgz", - "integrity": "sha512-BAEvWxbBUXvlNoFQVFVHpybBbjW1r03WhohJzJDSfgrrK5xVYIDTan6xN14DlyImShgDRv2gl9qhM6irVMsV0Q==", - "dev": true, + "node_modules/css-tree": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.1.0.tgz", + "integrity": "sha512-0eW44TGN5SQXU1mWSkKwFstI/22X2bG1nYzZTYMAWjylYURhse752YgbE4Cx46AC+bAvI+/dYTPRk1LqSUnu6w==", + "license": "MIT", "dependencies": { - "convert-source-map": "^2.0.0", - "graceful-fs": "^4.2.10", - "now-and-later": "^3.0.0", - "streamx": "^2.12.5", - "vinyl": "^3.0.0", - "vinyl-contents": "^2.0.0" + "mdn-data": "2.12.2", + "source-map-js": "^1.0.1" }, "engines": { - "node": ">=10.13.0" + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" } }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "license": "MIT", "bin": { - "node-which": "bin/node-which" + "cssesc": "bin/cssesc" }, "engines": { - "node": ">= 8" + "node": ">=4" } }, - "node_modules/wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true - }, - "node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, + "node_modules/debug": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", "license": "MIT", "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" + "ms": "^2.1.3" }, "engines": { - "node": ">=12" + "node": ">=6.0" }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, + "node_modules/decode-named-character-reference": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.1.0.tgz", + "integrity": "sha512-Wy+JTSbFThEOXQIR2L6mxJvEs+veIzpmqD7ynWxMXGpnk3smkHQOp6forLdHsKpAMW9iJpaBBIxz285t1n1C3w==", "license": "MIT", "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" + "character-entities": "^2.0.0" }, "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, + "node_modules/defu": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz", + "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==", + "license": "MIT" + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/destr": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/destr/-/destr-2.0.5.tgz", + "integrity": "sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA==", + "license": "MIT" + }, + "node_modules/detect-libc": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz", + "integrity": "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==", + "license": "Apache-2.0", "engines": { "node": ">=8" } }, - "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, + "node_modules/deterministic-object-hash": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/deterministic-object-hash/-/deterministic-object-hash-2.0.2.tgz", + "integrity": "sha512-KxektNH63SrbfUyDiwXqRb1rLwKt33AmMv+5Nhsw1kqZ13SJBRTgZHtGbE+hH3a1mVW1cz+4pqSWVPAtLVXTzQ==", "license": "MIT", "dependencies": { - "ansi-regex": "^5.0.1" + "base-64": "^1.0.0" }, "engines": { - "node": ">=8" + "node": ">=18" } }, - "node_modules/wrap-ansi/node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/wrap-ansi/node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true, + "node_modules/devalue": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.1.1.tgz", + "integrity": "sha512-maua5KUiapvEwiEAe+XnlZ3Rh0GD+qI1J/nb9vrJc3muPXvcF/8gXYTWF76+5DAqHyDUtOIImEuo0YKE9mshVw==", "license": "MIT" }, - "node_modules/wrap-ansi/node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", "license": "MIT", "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" + "dequal": "^2.0.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "node_modules/dfa": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/dfa/-/dfa-1.2.0.tgz", + "integrity": "sha512-ED3jP8saaweFTjeGX8HQPjeC1YYyZs98jGNZx6IiBvxW7JG5v492kamAQB3m2wop07CvU/RQmzcKr6bgcC5D/Q==", + "license": "MIT" }, - "node_modules/xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true, + "node_modules/diff": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", + "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", + "license": "BSD-3-Clause", "engines": { - "node": ">=0.4" + "node": ">=0.3.1" } }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, + "node_modules/dlv": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", + "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", + "license": "MIT" + }, + "node_modules/dset": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/dset/-/dset-3.1.4.tgz", + "integrity": "sha512-2QF/g9/zTaPDc3BjNcVTGoBbXBgYfMTTceLaYcFJ/W9kggFUkhxD/hMEeuLKbugyef9SqAx8cpgwlIP/jinUTA==", + "license": "MIT", "engines": { - "node": ">=10" + "node": ">=4" } }, - "node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, + "node_modules/emoji-regex": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.4.0.tgz", + "integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==", + "license": "MIT" + }, + "node_modules/enhanced-resolve": { + "version": "5.18.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.1.tgz", + "integrity": "sha512-ZSW3ma5GkcQBIpwZTSRAI8N71Uuwgs93IezB7mf7R60tC8ZbJideoDNKjHn2O9KIlx6rkGTTEk1xUCK2E1Y2Yg==", + "license": "MIT", "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" }, "engines": { - "node": ">=10" + "node": ">=10.13.0" } }, - "node_modules/yargs-parser": { - "version": "20.2.7", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", - "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==", - "dev": true, + "node_modules/entities": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.0.tgz", + "integrity": "sha512-aKstq2TDOndCn4diEyp9Uq/Flu2i1GlLkc6XIDQSDMuaFE3OPW5OphLCyQ5SpSJZTb4reN+kTcYru5yIfXoRPw==", + "license": "BSD-2-Clause", "engines": { - "node": ">=10" - } - } - }, - "dependencies": { - "@babel/runtime": { - "version": "7.27.0", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.0.tgz", - "integrity": "sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==", - "requires": { - "regenerator-runtime": "^0.14.0" - } - }, - "@gulpjs/messages": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@gulpjs/messages/-/messages-1.1.0.tgz", - "integrity": "sha512-Ys9sazDatyTgZVb4xPlDufLweJ/Os2uHWOv+Caxvy2O85JcnT4M3vc73bi8pdLWlv3fdWQz3pdI9tVwo8rQQSg==", - "dev": true - }, - "@gulpjs/to-absolute-glob": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@gulpjs/to-absolute-glob/-/to-absolute-glob-4.0.0.tgz", - "integrity": "sha512-kjotm7XJrJ6v+7knhPaRgaT6q8F8K2jiafwYdNHLzmV0uGLuZY43FK6smNSHUPrhq5kX2slCUy+RGG/xGqmIKA==", - "dev": true, - "requires": { - "is-negated-glob": "^1.0.0" - } - }, - "@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, - "requires": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "dependencies": { - "emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true - }, - "string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "requires": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - } - } + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" } }, - "@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "dev": true, - "optional": true - }, - "@types/expect": { - "version": "1.20.4", - "resolved": "https://registry.npmjs.org/@types/expect/-/expect-1.20.4.tgz", - "integrity": "sha512-Q5Vn3yjTDyCMV50TB6VRIbQNxSE4OmZR86VSbGaNpfUolm0iePBB4KdEEHmxoY5sT2+2DIvXW0rvMDP2nHZ4Mg==", - "dev": true - }, - "@types/node": { - "version": "14.14.45", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.45.tgz", - "integrity": "sha512-DssMqTV9UnnoxDWu959sDLZzfvqCF0qDNRjaWeYSui9xkFe61kKo4l1TWNTQONpuXEm+gLMRvdlzvNHBamzmEw==", - "dev": true + "node_modules/es-module-lexer": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", + "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "license": "MIT" }, - "@types/vinyl": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/vinyl/-/vinyl-2.0.4.tgz", - "integrity": "sha512-2o6a2ixaVI2EbwBPg1QYLGQoHK56p/8X/sGfKbFC8N6sY9lfjsMf/GprtkQkSya0D4uRiutRZ2BWj7k3JvLsAQ==", - "dev": true, - "requires": { - "@types/expect": "^1.20.4", - "@types/node": "*" + "node_modules/esbuild": { + "version": "0.25.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.5.tgz", + "integrity": "sha512-P8OtKZRv/5J5hhz0cUAdu/cLuPIKXpQl1R9pZtvmHWQvrAUVd0UNIPT4IB4W3rNOqVO0rlqHmCIbSwxh/c9yUQ==", + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.5", + "@esbuild/android-arm": "0.25.5", + "@esbuild/android-arm64": "0.25.5", + "@esbuild/android-x64": "0.25.5", + "@esbuild/darwin-arm64": "0.25.5", + "@esbuild/darwin-x64": "0.25.5", + "@esbuild/freebsd-arm64": "0.25.5", + "@esbuild/freebsd-x64": "0.25.5", + "@esbuild/linux-arm": "0.25.5", + "@esbuild/linux-arm64": "0.25.5", + "@esbuild/linux-ia32": "0.25.5", + "@esbuild/linux-loong64": "0.25.5", + "@esbuild/linux-mips64el": "0.25.5", + "@esbuild/linux-ppc64": "0.25.5", + "@esbuild/linux-riscv64": "0.25.5", + "@esbuild/linux-s390x": "0.25.5", + "@esbuild/linux-x64": "0.25.5", + "@esbuild/netbsd-arm64": "0.25.5", + "@esbuild/netbsd-x64": "0.25.5", + "@esbuild/openbsd-arm64": "0.25.5", + "@esbuild/openbsd-x64": "0.25.5", + "@esbuild/sunos-x64": "0.25.5", + "@esbuild/win32-arm64": "0.25.5", + "@esbuild/win32-ia32": "0.25.5", + "@esbuild/win32-x64": "0.25.5" } }, - "ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" + "node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" } }, - "array-each": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", - "integrity": "sha512-zHjL5SZa68hkKHBFBK6DJCTtr9sfTCPCaph/L7tMSLcTFgy+zX7E+6q5UArbtOtMBCtxdICpfTCspRse+ywyXA==", - "dev": true + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "license": "MIT" }, - "array-slice": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", - "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==", - "dev": true + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "license": "MIT" }, - "async-done": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/async-done/-/async-done-2.0.0.tgz", - "integrity": "sha512-j0s3bzYq9yKIVLKGE/tWlCpa3PfFLcrDZLTSVdnnCTGagXuXBJO4SsY9Xdk/fQBirCkH4evW5xOeJXqlAQFdsw==", - "dev": true, - "requires": { - "end-of-stream": "^1.4.4", - "once": "^1.4.0", - "stream-exhaust": "^1.0.2" - } + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" }, - "async-settle": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/async-settle/-/async-settle-2.0.0.tgz", - "integrity": "sha512-Obu/KE8FurfQRN6ODdHN9LuXqwC+JFIM9NRyZqJJ4ZfLJmIYN9Rg0/kb+wF70VV5+fJusTMQlJ1t5rF7J/ETdg==", - "dev": true, - "requires": { - "async-done": "^2.0.0" + "node_modules/fdir": { + "version": "6.4.5", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.5.tgz", + "integrity": "sha512-4BG7puHpVsIYxZUbiUE3RqGloLaSSwzYie5jvasC4LWuBWzZawynvYouhjbQKw2JuIGYdm0DzIxl8iVidKlUEw==", + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } } }, - "b4a": { - "version": "1.6.6", - "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.6.tgz", - "integrity": "sha512-5Tk1HLk6b6ctmjIkAcU/Ujv/1WqiDl0F0JdRCR80VsOcUlHcu7pWeWRlOqQLHfDEsVx9YH/aif5AG4ehoCtTmg==", - "dev": true - }, - "bach": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/bach/-/bach-2.0.1.tgz", - "integrity": "sha512-A7bvGMGiTOxGMpNupYl9HQTf0FFDNF4VCmks4PJpFyN1AX2pdKuxuwdvUz2Hu388wcgp+OvGFNsumBfFNkR7eg==", - "dev": true, - "requires": { - "async-done": "^2.0.0", - "async-settle": "^2.0.0", - "now-and-later": "^3.0.0" + "node_modules/flattie": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/flattie/-/flattie-1.1.1.tgz", + "integrity": "sha512-9UbaD6XdAL97+k/n+N7JwX46K/M6Zc6KcFYskrYL8wbBV/Uyk0CTAMY0VT+qiK5PM7AIc9aTWYtq65U7T+aCNQ==", + "license": "MIT", + "engines": { + "node": ">=8" } }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "bare-events": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.4.2.tgz", - "integrity": "sha512-qMKFd2qG/36aA4GwvKq8MxnPgCQAmBWmSyLWsJcbn8v03wvIPQ/hG1Ms8bPzndZxMDoHpxez5VOS+gC9Yi24/Q==", - "dev": true, - "optional": true - }, - "base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "dev": true - }, - "binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "dev": true - }, - "binaryextensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binaryextensions/-/binaryextensions-2.3.0.tgz", - "integrity": "sha512-nAihlQsYGyc5Bwq6+EsubvANYGExeJKHDO3RjnvwU042fawQTQfM3Kxn7IHUXQOz4bzfwsGYYHGSvXyW4zOGLg==", - "dev": true - }, - "bl": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz", - "integrity": "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==", - "dev": true, - "requires": { - "buffer": "^6.0.3", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - }, - "dependencies": { - "readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } + "node_modules/flyonui": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/flyonui/-/flyonui-2.2.0.tgz", + "integrity": "sha512-Gncal89zwklAYpqV8IjSgN/1edsXnbTlxhfKRcYa2WgeY8jBSuoNBQWqdL1DSLuXarxYluimwIv34YaRKNuSzg==", + "license": "MIT", + "dependencies": { + "@floating-ui/dom": "^1.6.13" } }, - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" + "node_modules/fontace": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/fontace/-/fontace-0.3.0.tgz", + "integrity": "sha512-czoqATrcnxgWb/nAkfyIrRp6Q8biYj7nGnL6zfhTcX+JKKpWHFBnb8uNMw/kZr7u++3Y3wYSYoZgHkCcsuBpBg==", + "license": "MIT", + "dependencies": { + "@types/fontkit": "^2.0.8", + "fontkit": "^2.0.4" } }, - "braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, - "requires": { - "fill-range": "^7.1.1" + "node_modules/fontkit": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/fontkit/-/fontkit-2.0.4.tgz", + "integrity": "sha512-syetQadaUEDNdxdugga9CpEYVaQIxOwk7GlwZWWZ19//qW4zE5bknOKeMBDYAASwnpaSHKJITRLMF9m1fp3s6g==", + "license": "MIT", + "dependencies": { + "@swc/helpers": "^0.5.12", + "brotli": "^1.3.2", + "clone": "^2.1.2", + "dfa": "^1.2.0", + "fast-deep-equal": "^3.1.3", + "restructure": "^3.0.0", + "tiny-inflate": "^1.0.3", + "unicode-properties": "^1.4.0", + "unicode-trie": "^2.0.0" } }, - "buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "dev": true, - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "dev": true, - "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - } - }, - "cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - } + "node_modules/get-east-asian-width": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.3.0.tgz", + "integrity": "sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", - "dev": true + "node_modules/github-slugger": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-2.0.0.tgz", + "integrity": "sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==", + "license": "ISC" }, - "clone-stats": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", - "integrity": "sha512-au6ydSpg6nsrigcZ4m8Bc9hxjeW+GJ8xh5G3BJCMt4WXe1H10UNaVOamqQTmrx1kjVuxAHIQSNU6hY4Nsn9/ag==", - "dev": true + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC" }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" + "node_modules/h3": { + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.3.tgz", + "integrity": "sha512-z6GknHqyX0h9aQaTx22VZDf6QyZn+0Nh+Ym8O/u0SGSkyF5cuTJYKlc8MkzW3Nzf9LE1ivcpmYC3FUGpywhuUQ==", + "license": "MIT", + "dependencies": { + "cookie-es": "^1.2.2", + "crossws": "^0.3.4", + "defu": "^6.1.4", + "destr": "^2.0.5", + "iron-webcrypto": "^1.2.1", + "node-mock-http": "^1.0.0", + "radix3": "^1.1.2", + "ufo": "^1.6.1", + "uncrypto": "^0.1.3" + } + }, + "node_modules/hast-util-from-html": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/hast-util-from-html/-/hast-util-from-html-2.0.3.tgz", + "integrity": "sha512-CUSRHXyKjzHov8yKsQjGOElXy/3EKpyX56ELnkHH34vDVw1N1XSQ1ZcAvTyAPtGqLTuKP/uxM+aLkSPqF/EtMw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "devlop": "^1.1.0", + "hast-util-from-parse5": "^8.0.0", + "parse5": "^7.0.0", + "vfile": "^6.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "color-support": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "dev": true - }, - "complex.js": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/complex.js/-/complex.js-2.4.2.tgz", - "integrity": "sha512-qtx7HRhPGSCBtGiST4/WGHuW+zeaND/6Ld+db6PbrulIB1i2Ev/2UPiqcmpQNPSyfBKraC0EOvOKCB5dGZKt3g==" - }, - "concat-with-sourcemaps": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz", - "integrity": "sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg==", - "dev": true, - "requires": { - "source-map": "^0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } + "node_modules/hast-util-from-parse5": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-8.0.3.tgz", + "integrity": "sha512-3kxEVkEKt0zvcZ3hCRYI8rqrgwtlIOFMWkbclACvjlDw8Li9S2hk/d51OI0nr/gIpdMHNepwgOKqZ/sy0Clpyg==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "devlop": "^1.0.0", + "hastscript": "^9.0.0", + "property-information": "^7.0.0", + "vfile": "^6.0.0", + "vfile-location": "^5.0.0", + "web-namespaces": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true + "node_modules/hast-util-is-element": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-3.0.0.tgz", + "integrity": "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } }, - "copy-props": { + "node_modules/hast-util-parse-selector": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/copy-props/-/copy-props-4.0.0.tgz", - "integrity": "sha512-bVWtw1wQLzzKiYROtvNlbJgxgBYt2bMJpkCbKmXM3xyijvcjjWXEk5nyrrT3bgJ7ODb19ZohE2T0Y3FgNPyoTw==", - "dev": true, - "requires": { - "each-props": "^3.0.0", - "is-plain-object": "^5.0.0" + "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-4.0.0.tgz", + "integrity": "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "decimal.js": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", - "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==" - }, - "detect-file": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", - "integrity": "sha512-DtCOLG98P007x7wiiOmfI0fi3eIKyWiLTGJ2MDnVi/E04lWGbf+JzrRHMm0rgIIZJGtHpKpbVgLWHrv8xXpc3Q==", - "dev": true - }, - "each-props": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/each-props/-/each-props-3.0.0.tgz", - "integrity": "sha512-IYf1hpuWrdzse/s/YJOrFmU15lyhSzxelNVAHTEG3DtP4QsLTWZUzcUL3HMXmKQxXpa4EIrBPpwRgj0aehdvAw==", - "dev": true, - "requires": { - "is-plain-object": "^5.0.0", - "object.defaults": "^1.1.0" + "node_modules/hast-util-raw": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-9.1.0.tgz", + "integrity": "sha512-Y8/SBAHkZGoNkpzqqfCldijcuUKh7/su31kEBp67cFY09Wy0mTRgtsLYsiIxMJxlu0f6AA5SUTbDR8K0rxnbUw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "@ungap/structured-clone": "^1.0.0", + "hast-util-from-parse5": "^8.0.0", + "hast-util-to-parse5": "^8.0.0", + "html-void-elements": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "parse5": "^7.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0", + "web-namespaces": "^2.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true + "node_modules/hast-util-to-html": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.5.tgz", + "integrity": "sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-whitespace": "^3.0.0", + "html-void-elements": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0", + "stringify-entities": "^4.0.0", + "zwitch": "^2.0.4" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } }, - "emoji-regex": { + "node_modules/hast-util-to-parse5": { "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, - "requires": { - "once": "^1.4.0" + "resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-8.0.0.tgz", + "integrity": "sha512-3KKrV5ZVI8if87DVSi1vDeByYrkGzg4mEfeu4alwgmmIeARiBLKCZS2uw5Gb6nU9x9Yufyj3iudm6i7nl52PFw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "devlop": "^1.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0", + "web-namespaces": "^2.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "escalade": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", - "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", - "dev": true - }, - "escape-latex": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/escape-latex/-/escape-latex-1.2.0.tgz", - "integrity": "sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw==" - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true + "node_modules/hast-util-to-parse5/node_modules/property-information": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-6.5.0.tgz", + "integrity": "sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } }, - "expand-tilde": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", - "integrity": "sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw==", - "dev": true, - "requires": { - "homedir-polyfill": "^1.0.1" + "node_modules/hast-util-to-text": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/hast-util-to-text/-/hast-util-to-text-4.0.2.tgz", + "integrity": "sha512-KK6y/BN8lbaq654j7JgBydev7wuNMcID54lkRav1P0CaE1e47P72AWWPiGKXTJU271ooYzcvTAn/Zt0REnvc7A==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "hast-util-is-element": "^3.0.0", + "unist-util-find-after": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true + "node_modules/hast-util-whitespace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } }, - "fancy-log": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-2.0.0.tgz", - "integrity": "sha512-9CzxZbACXMUXW13tS0tI8XsGGmxWzO2DmYrGuBJOJ8k8q2K7hwfJA5qHjuPPe8wtsco33YR9wc+Rlr5wYFvhSA==", - "dev": true, - "requires": { - "color-support": "^1.1.3" + "node_modules/hastscript": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-9.0.1.tgz", + "integrity": "sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-parse-selector": "^4.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "fast-fifo": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", - "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", - "dev": true + "node_modules/html-escaper": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz", + "integrity": "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==", + "license": "MIT" }, - "fast-levenshtein": { + "node_modules/html-void-elements": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-3.0.0.tgz", - "integrity": "sha512-hKKNajm46uNmTlhHSyZkmToAc56uZJwYq7yrciZjqOxnlfQwERDQJmHPUp7m1m9wx8vgOe8IaCKZ5Kv2k1DdCQ==", - "dev": true, - "requires": { - "fastest-levenshtein": "^1.0.7" - } - }, - "fastest-levenshtein": { - "version": "1.0.16", - "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", - "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", - "dev": true - }, - "fastq": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", - "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", - "dev": true, - "requires": { - "reusify": "^1.0.4" - } - }, - "fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "findup-sync": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-5.0.0.tgz", - "integrity": "sha512-MzwXju70AuyflbgeOhzvQWAvvQdo1XL0A9bVvlXsYcFEBM87WR4OakL4OfZq+QRmr+duJubio+UtNQCPsVESzQ==", - "dev": true, - "requires": { - "detect-file": "^1.0.0", - "is-glob": "^4.0.3", - "micromatch": "^4.0.4", - "resolve-dir": "^1.0.1" + "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz", + "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "fined": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fined/-/fined-2.0.0.tgz", - "integrity": "sha512-OFRzsL6ZMHz5s0JrsEr+TpdGNCtrVtnuG3x1yzGNiQHT0yaDnXAj8V/lWcpJVrnoDpcwXcASxAZYbuXda2Y82A==", - "dev": true, - "requires": { - "expand-tilde": "^2.0.2", - "is-plain-object": "^5.0.0", - "object.defaults": "^1.1.0", - "object.pick": "^1.3.0", - "parse-filepath": "^1.0.2" - } - }, - "flagged-respawn": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-2.0.0.tgz", - "integrity": "sha512-Gq/a6YCi8zexmGHMuJwahTGzXlAZAOsbCVKduWXC6TlLCjjFRlExMJc4GC2NYPYZ0r/brw9P7CpRgQmlPVeOoA==", - "dev": true - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==", - "dev": true + "node_modules/http-cache-semantics": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz", + "integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==", + "license": "BSD-2-Clause" }, - "for-own": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", - "integrity": "sha512-0OABksIGrxKK8K4kynWkQ7y1zounQxP+CWnyclVwj81KW3vlLlGUx57DKGcP/LH216GzqnstnPocF16Nxs0Ycg==", - "dev": true, - "requires": { - "for-in": "^1.0.1" + "node_modules/import-meta-resolve": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.1.0.tgz", + "integrity": "sha512-I6fiaX09Xivtk+THaMfAwnA3MVA5Big1WHF1Dfx9hFuvNIWpXnorlkzhcQf6ehrqQiiZECRt1poOAkPmer3ruw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "foreground-child": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz", - "integrity": "sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" + "node_modules/iron-webcrypto": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.2.1.tgz", + "integrity": "sha512-feOM6FaSr6rEABp/eDfVseKyTMDt+KGpeB35SkVn9Tyn0CqvVsY3EwI0v5i8nMHyJnzCIQf7nsy3p41TPkJZhg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/brc-dd" + } + }, + "node_modules/is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", + "license": "MIT", + "optional": true + }, + "node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "license": "MIT", + "dependencies": { + "is-docker": "^3.0.0" + }, + "bin": { + "is-inside-container": "cli.js" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-wsl": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", + "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", + "license": "MIT", + "dependencies": { + "is-inside-container": "^1.0.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/jiti": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.4.2.tgz", + "integrity": "sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==", + "license": "MIT", + "bin": { + "jiti": "lib/jiti-cli.mjs" + } + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/kleur": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/lightningcss": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.30.1.tgz", + "integrity": "sha512-xi6IyHML+c9+Q3W0S4fCQJOym42pyurFiJUHEcEyHS0CeKzia4yZDEsLlqOFykxOdHpNy0NmvVO31vcSqAxJCg==", + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-darwin-arm64": "1.30.1", + "lightningcss-darwin-x64": "1.30.1", + "lightningcss-freebsd-x64": "1.30.1", + "lightningcss-linux-arm-gnueabihf": "1.30.1", + "lightningcss-linux-arm64-gnu": "1.30.1", + "lightningcss-linux-arm64-musl": "1.30.1", + "lightningcss-linux-x64-gnu": "1.30.1", + "lightningcss-linux-x64-musl": "1.30.1", + "lightningcss-win32-arm64-msvc": "1.30.1", + "lightningcss-win32-x64-msvc": "1.30.1" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.30.1.tgz", + "integrity": "sha512-c8JK7hyE65X1MHMN+Viq9n11RRC7hgin3HhYKhrMyaXflk5GVplZ60IxyoVtzILeKr+xAJwg6zK6sjTBJ0FKYQ==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.30.1.tgz", + "integrity": "sha512-k1EvjakfumAQoTfcXUcHQZhSpLlkAuEkdMBsI/ivWw9hL+7FtilQc0Cy3hrx0AAQrVtQAbMI7YjCgYgvn37PzA==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.30.1.tgz", + "integrity": "sha512-kmW6UGCGg2PcyUE59K5r0kWfKPAVy4SltVeut+umLCFoJ53RdCUWxcRDzO1eTaxf/7Q2H7LTquFHPL5R+Gjyig==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.30.1.tgz", + "integrity": "sha512-MjxUShl1v8pit+6D/zSPq9S9dQ2NPFSQwGvxBCYaBYLPlCWuPh9/t1MRS8iUaR8i+a6w7aps+B4N0S1TYP/R+Q==", + "cpu": [ + "arm" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.30.1.tgz", + "integrity": "sha512-gB72maP8rmrKsnKYy8XUuXi/4OctJiuQjcuqWNlJQ6jZiWqtPvqFziskH3hnajfvKB27ynbVCucKSm2rkQp4Bw==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.30.1.tgz", + "integrity": "sha512-jmUQVx4331m6LIX+0wUhBbmMX7TCfjF5FoOH6SD1CttzuYlGNVpA7QnrmLxrsub43ClTINfGSYyHe2HWeLl5CQ==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.30.1.tgz", + "integrity": "sha512-piWx3z4wN8J8z3+O5kO74+yr6ze/dKmPnI7vLqfSqI8bccaTGY5xiSGVIJBDd5K5BHlvVLpUB3S2YCfelyJ1bw==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.30.1.tgz", + "integrity": "sha512-rRomAK7eIkL+tHY0YPxbc5Dra2gXlI63HL+v1Pdi1a3sC+tJTcFrHX+E86sulgAXeI7rSzDYhPSeHHjqFhqfeQ==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.30.1.tgz", + "integrity": "sha512-mSL4rqPi4iXq5YVqzSsJgMVFENoa4nGTT/GjO2c0Yl9OuQfPsIfncvLrEW6RbbB24WtZ3xP/2CCmI3tNkNV4oA==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.30.1.tgz", + "integrity": "sha512-PVqXh48wh4T53F/1CCu8PIPCxLzWyCnn/9T5W1Jpmdy5h9Cwd+0YQS6/LwhHXSafuc61/xg9Lv5OrCby6a++jg==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/longest-streak": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", + "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "license": "ISC" + }, + "node_modules/magic-string": { + "version": "0.30.17", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", + "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, + "node_modules/magicast": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.5.tgz", + "integrity": "sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==", + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.25.4", + "@babel/types": "^7.25.4", + "source-map-js": "^1.2.0" + } + }, + "node_modules/markdown-table": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz", + "integrity": "sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-definitions": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-6.0.0.tgz", + "integrity": "sha512-scTllyX6pnYNZH/AIp/0ePz6s4cZtARxImwoPJ7kS42n+MnVsI4XbnG6d4ibehRIldYMWM2LD7ImQblVhUejVQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "unist-util-visit": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-find-and-replace": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.2.tgz", + "integrity": "sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "escape-string-regexp": "^5.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-from-markdown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz", + "integrity": "sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark": "^4.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-3.1.0.tgz", + "integrity": "sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ==", + "license": "MIT", + "dependencies": { + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-gfm-autolink-literal": "^2.0.0", + "mdast-util-gfm-footnote": "^2.0.0", + "mdast-util-gfm-strikethrough": "^2.0.0", + "mdast-util-gfm-table": "^2.0.0", + "mdast-util-gfm-task-list-item": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-autolink-literal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.0.1.tgz", + "integrity": "sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "ccount": "^2.0.0", + "devlop": "^1.0.0", + "mdast-util-find-and-replace": "^3.0.0", + "micromark-util-character": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-footnote": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-2.1.0.tgz", + "integrity": "sha512-sqpDWlsHn7Ac9GNZQMeUzPQSMzR6Wv0WKRNvQRg0KqHh02fpTz69Qc1QSseNX29bhz1ROIyNyxExfawVKTm1GQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-strikethrough": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-2.0.0.tgz", + "integrity": "sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-table": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-2.0.0.tgz", + "integrity": "sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "markdown-table": "^3.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-task-list-item": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-2.0.0.tgz", + "integrity": "sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-phrasing": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz", + "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-hast": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz", + "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@ungap/structured-clone": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "trim-lines": "^3.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-markdown": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2.tgz", + "integrity": "sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "longest-streak": "^3.0.0", + "mdast-util-phrasing": "^4.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "unist-util-visit": "^5.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", + "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdn-data": { + "version": "2.12.2", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.12.2.tgz", + "integrity": "sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==", + "license": "CC0-1.0" + }, + "node_modules/micromark": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.2.tgz", + "integrity": "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-core-commonmark": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.3.tgz", + "integrity": "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-extension-gfm": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-3.0.0.tgz", + "integrity": "sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==", + "license": "MIT", + "dependencies": { + "micromark-extension-gfm-autolink-literal": "^2.0.0", + "micromark-extension-gfm-footnote": "^2.0.0", + "micromark-extension-gfm-strikethrough": "^2.0.0", + "micromark-extension-gfm-table": "^2.0.0", + "micromark-extension-gfm-tagfilter": "^2.0.0", + "micromark-extension-gfm-task-list-item": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-autolink-literal": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-2.1.0.tgz", + "integrity": "sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==", + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-footnote": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-footnote/-/micromark-extension-gfm-footnote-2.1.0.tgz", + "integrity": "sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-strikethrough": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-2.1.0.tgz", + "integrity": "sha512-ADVjpOOkjz1hhkZLlBiYA9cR2Anf8F4HqZUO6e5eDcPQd0Txw5fxLzzxnEkSkfnD0wziSGiv7sYhk/ktvbf1uw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-table": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.1.1.tgz", + "integrity": "sha512-t2OU/dXXioARrC6yWfJ4hqB7rct14e8f7m0cbI5hUmDyyIlwv5vEtooptH8INkbLzOatzKuVbQmAYcbWoyz6Dg==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-tagfilter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-2.0.0.tgz", + "integrity": "sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg==", + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-task-list-item": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-2.1.0.tgz", + "integrity": "sha512-qIBZhqxqI6fjLDYFTBIa4eivDMnP+OZqsNwmQ3xNLE4Cxwc+zfQEfbs6tzAo2Hjq+bh6q5F+Z8/cksrLFYWQQw==", + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-factory-destination": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz", + "integrity": "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-label": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz", + "integrity": "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-space": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.1.tgz", + "integrity": "sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-title": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz", + "integrity": "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-whitespace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz", + "integrity": "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-chunked": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz", + "integrity": "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-classify-character": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz", + "integrity": "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-combine-extensions": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz", + "integrity": "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-numeric-character-reference": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz", + "integrity": "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-string": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz", + "integrity": "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-html-tag-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz", + "integrity": "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-normalize-identifier": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz", + "integrity": "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-resolve-all": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz", + "integrity": "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-subtokenize": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.1.0.tgz", + "integrity": "sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz", + "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/minizlib": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.0.2.tgz", + "integrity": "sha512-oG62iEk+CYt5Xj2YqI5Xi9xWUeZhDI8jjQmC5oThVH5JGCTgIjr7ciJDzC7MBzYd//WvR1OTmP5Q38Q8ShQtVA==", + "license": "MIT", + "dependencies": { + "minipass": "^7.1.2" + }, + "engines": { + "node": ">= 18" } }, - "fraction.js": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.2.1.tgz", - "integrity": "sha512-Ah6t/7YCYjrPUFUFsOsRLMXAdnYM+aQwmojD2Ayb/Ezr82SwES0vuyQ8qZ3QO8n9j7W14VJuVZZet8U3bhSdQQ==" + "node_modules/mkdirp": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz", + "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==", + "license": "MIT", + "bin": { + "mkdirp": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } }, - "fs-mkdirp-stream": { + "node_modules/mrmime": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fs-mkdirp-stream/-/fs-mkdirp-stream-2.0.1.tgz", - "integrity": "sha512-UTOY+59K6IA94tec8Wjqm0FSh5OVudGNB0NL/P6fB3HiE3bYOY3VYBGijsnOHNkQSwC1FKkU77pmq7xp9CskLw==", - "dev": true, - "requires": { - "graceful-fs": "^4.2.8", - "streamx": "^2.12.0" + "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz", + "integrity": "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==", + "license": "MIT", + "engines": { + "node": ">=10" } }, - "fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "optional": true + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" }, - "function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "glob": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.2.tgz", - "integrity": "sha512-YT7U7Vye+t5fZ/QMkBFrTJ7ZQxInIUjwyAjVj84CYXqgBdv30MFUPGnBR6sQaVq6Is15wYJUsnzTuWaGRBhBAQ==", - "dev": true, - "requires": { - "foreground-child": "^3.1.0", - "jackspeak": "^4.0.1", - "minimatch": "^10.0.0", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^2.0.0" - } - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "glob-stream": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-8.0.2.tgz", - "integrity": "sha512-R8z6eTB55t3QeZMmU1C+Gv+t5UnNRkA55c5yo67fAVfxODxieTwsjNG7utxS/73NdP1NbDgCrhVEg2h00y4fFw==", - "dev": true, - "requires": { - "@gulpjs/to-absolute-glob": "^4.0.0", - "anymatch": "^3.1.3", - "fastq": "^1.13.0", - "glob-parent": "^6.0.2", - "is-glob": "^4.0.3", - "is-negated-glob": "^1.0.0", - "normalize-path": "^3.0.0", - "streamx": "^2.12.5" + "node_modules/neotraverse": { + "version": "0.6.18", + "resolved": "https://registry.npmjs.org/neotraverse/-/neotraverse-0.6.18.tgz", + "integrity": "sha512-Z4SmBUweYa09+o6pG+eASabEpP6QkQ70yHj351pQoEXIs8uHbaU2DWVmzBANKgflPa47A50PtB2+NgRpQvr7vA==", + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/nlcst-to-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/nlcst-to-string/-/nlcst-to-string-4.0.0.tgz", + "integrity": "sha512-YKLBCcUYKAg0FNlOBT6aI91qFmSiFKiluk655WzPF+DDMA02qIyy8uiRqI8QXtcFpEvll12LpL5MXqEmAZ+dcA==", + "license": "MIT", + "dependencies": { + "@types/nlcst": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-fetch-native": { + "version": "1.6.6", + "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.6.tgz", + "integrity": "sha512-8Mc2HhqPdlIfedsuZoc3yioPuzp6b+L5jRCRY1QzuWZh2EGJVQrGppC6V6cF0bLdbW0+O2YpqCA25aF/1lvipQ==", + "license": "MIT" + }, + "node_modules/node-mock-http": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-mock-http/-/node-mock-http-1.0.0.tgz", + "integrity": "sha512-0uGYQ1WQL1M5kKvGRXWQ3uZCHtLTO8hln3oBjIusM75WoesZ909uQJs/Hb946i2SS+Gsrhkaa6iAO17jRIv6DQ==", + "license": "MIT" + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ofetch": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.4.1.tgz", + "integrity": "sha512-QZj2DfGplQAr2oj9KzceK9Hwz6Whxazmn85yYeVuS3u9XTMOGMRx0kO95MQ+vLsj/S/NwBDMMLU5hpxvI6Tklw==", + "license": "MIT", + "dependencies": { + "destr": "^2.0.3", + "node-fetch-native": "^1.6.4", + "ufo": "^1.5.4" + } + }, + "node_modules/ohash": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/ohash/-/ohash-2.0.11.tgz", + "integrity": "sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==", + "license": "MIT" + }, + "node_modules/oniguruma-parser": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.1.tgz", + "integrity": "sha512-8Unqkvk1RYc6yq2WBYRj4hdnsAxVze8i7iPfQr8e4uSP3tRv0rpZcbGUDvxfQQcdwHt/e9PrMvGCsa8OqG9X3w==", + "license": "MIT" + }, + "node_modules/oniguruma-to-es": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.3.tgz", + "integrity": "sha512-rPiZhzC3wXwE59YQMRDodUwwT9FZ9nNBwQQfsd1wfdtlKEyCdRV0avrTcSZ5xlIvGRVPd/cx6ZN45ECmS39xvg==", + "license": "MIT", + "dependencies": { + "oniguruma-parser": "^0.12.1", + "regex": "^6.0.1", + "regex-recursion": "^6.0.2" + } + }, + "node_modules/p-limit": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-6.2.0.tgz", + "integrity": "sha512-kuUqqHNUqoIWp/c467RI4X6mmyuojY5jGutNU0wVTmEOOfcuwLqyMVoAi9MKi2Ak+5i9+nhmrK4ufZE8069kHA==", + "license": "MIT", + "dependencies": { + "yocto-queue": "^1.1.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-queue": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-8.1.0.tgz", + "integrity": "sha512-mxLDbbGIBEXTJL0zEx8JIylaj3xQ7Z/7eEVjcF9fJX4DBiH9oqe+oahYnlKKxm0Ci9TlWTyhSHgygxMxjIB2jw==", + "license": "MIT", + "dependencies": { + "eventemitter3": "^5.0.1", + "p-timeout": "^6.1.2" }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-timeout": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.4.tgz", + "integrity": "sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg==", + "license": "MIT", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/package-manager-detector": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/package-manager-detector/-/package-manager-detector-1.3.0.tgz", + "integrity": "sha512-ZsEbbZORsyHuO00lY1kV3/t72yp6Ysay6Pd17ZAlNGuGwmWDLCJxFpRs0IzfXfj1o4icJOkUEioexFHzyPurSQ==", + "license": "MIT" + }, + "node_modules/pako": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", + "integrity": "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==", + "license": "MIT" + }, + "node_modules/parse-latin": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/parse-latin/-/parse-latin-7.0.0.tgz", + "integrity": "sha512-mhHgobPPua5kZ98EF4HWiH167JWBfl4pvAIXXdbaVohtK7a6YBOy56kvhCqduqyo/f3yrHFWmqmiMg/BkBkYYQ==", + "license": "MIT", + "dependencies": { + "@types/nlcst": "^2.0.0", + "@types/unist": "^3.0.0", + "nlcst-to-string": "^4.0.0", + "unist-util-modify-children": "^4.0.0", + "unist-util-visit-children": "^3.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/parse5": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz", + "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==", + "license": "MIT", "dependencies": { - "glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "requires": { - "is-glob": "^4.0.3" - } + "entities": "^6.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.4", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.4.tgz", + "integrity": "sha512-QSa9EBe+uwlGTFmHsPKokv3B/oEMQZxfqW0QqNCyhpa6mB1afzulwn8hihglqAb2pOw+BJgNlmXQ8la2VeHB7w==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/prismjs": { + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz", + "integrity": "sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "license": "MIT", + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/prompts/node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/property-information": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz", + "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/radix3": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/radix3/-/radix3-1.1.2.tgz", + "integrity": "sha512-b484I/7b8rDEdSDKckSSBA8knMpcdsXudlE/LNL639wFoHKwLbEkQFZHWEYwDC0wa0FKUcCY+GAF73Z7wxNVFA==", + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "license": "MIT", + "engines": { + "node": ">= 14.18.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/regex/-/regex-6.0.1.tgz", + "integrity": "sha512-uorlqlzAKjKQZ5P+kTJr3eeJGSVroLKoHmquUj4zHWuR+hEyNqlXsSKlYYF5F4NI6nl7tWCs0apKJ0lmfsXAPA==", + "license": "MIT", + "dependencies": { + "regex-utilities": "^2.3.0" + } + }, + "node_modules/regex-recursion": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/regex-recursion/-/regex-recursion-6.0.2.tgz", + "integrity": "sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg==", + "license": "MIT", + "dependencies": { + "regex-utilities": "^2.3.0" + } + }, + "node_modules/regex-utilities": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/regex-utilities/-/regex-utilities-2.3.0.tgz", + "integrity": "sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==", + "license": "MIT" + }, + "node_modules/rehype": { + "version": "13.0.2", + "resolved": "https://registry.npmjs.org/rehype/-/rehype-13.0.2.tgz", + "integrity": "sha512-j31mdaRFrwFRUIlxGeuPXXKWQxet52RBQRvCmzl5eCefn/KGbomK5GMHNMsOJf55fgo3qw5tST5neDuarDYR2A==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "rehype-parse": "^9.0.0", + "rehype-stringify": "^10.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/rehype-parse": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/rehype-parse/-/rehype-parse-9.0.1.tgz", + "integrity": "sha512-ksCzCD0Fgfh7trPDxr2rSylbwq9iYDkSn8TCDmEJ49ljEUBxDVCzCHv7QNzZOfODanX4+bWQ4WZqLCRWYLfhag==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "hast-util-from-html": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/rehype-raw": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/rehype-raw/-/rehype-raw-7.0.0.tgz", + "integrity": "sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "hast-util-raw": "^9.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/rehype-stringify": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/rehype-stringify/-/rehype-stringify-10.0.1.tgz", + "integrity": "sha512-k9ecfXHmIPuFVI61B9DeLPN0qFHfawM6RsuX48hoqlaKSF61RskNjSm1lI8PhBEM0MRdLxVVm4WmTqJQccH9mA==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "hast-util-to-html": "^9.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "glob-watcher": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-6.0.0.tgz", - "integrity": "sha512-wGM28Ehmcnk2NqRORXFOTOR064L4imSw3EeOqU5bIwUf62eXGwg89WivH6VMahL8zlQHeodzvHpXplrqzrz3Nw==", - "dev": true, - "requires": { - "async-done": "^2.0.0", - "chokidar": "^3.5.3" + "node_modules/remark-gfm": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-4.0.1.tgz", + "integrity": "sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-gfm": "^3.0.0", + "micromark-extension-gfm": "^3.0.0", + "remark-parse": "^11.0.0", + "remark-stringify": "^11.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "global-modules": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", - "dev": true, - "requires": { - "global-prefix": "^1.0.1", - "is-windows": "^1.0.1", - "resolve-dir": "^1.0.0" + "node_modules/remark-parse": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", + "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "global-prefix": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", - "integrity": "sha512-5lsx1NUDHtSjfg0eHlmYvZKv8/nVqX4ckFbM+FrGcQ+04KWcWFo9P5MxPZYSzUvyzmdTbI7Eix8Q4IbELDqzKg==", - "dev": true, - "requires": { - "expand-tilde": "^2.0.2", - "homedir-polyfill": "^1.0.1", - "ini": "^1.3.4", - "is-windows": "^1.0.1", - "which": "^1.2.14" - }, - "dependencies": { - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } + "node_modules/remark-rehype": { + "version": "11.1.2", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.2.tgz", + "integrity": "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "mdast-util-to-hast": "^13.0.0", + "unified": "^11.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "glogg": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/glogg/-/glogg-2.2.0.tgz", - "integrity": "sha512-eWv1ds/zAlz+M1ioHsyKJomfY7jbDDPpwSkv14KQj89bycx1nvK5/2Cj/T9g7kzJcX5Bc7Yv22FjfBZS/jl94A==", - "dev": true, - "requires": { - "sparkles": "^2.1.0" + "node_modules/remark-smartypants": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/remark-smartypants/-/remark-smartypants-3.0.2.tgz", + "integrity": "sha512-ILTWeOriIluwEvPjv67v7Blgrcx+LZOkAUVtKI3putuhlZm84FnqDORNXPPm+HY3NdZOMhyDwZ1E+eZB/Df5dA==", + "license": "MIT", + "dependencies": { + "retext": "^9.0.0", + "retext-smartypants": "^6.0.0", + "unified": "^11.0.4", + "unist-util-visit": "^5.0.0" + }, + "engines": { + "node": ">=16.0.0" } }, - "graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true - }, - "gulp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/gulp/-/gulp-5.0.0.tgz", - "integrity": "sha512-S8Z8066SSileaYw1S2N1I64IUc/myI2bqe2ihOBzO6+nKpvNSg7ZcWJt/AwF8LC/NVN+/QZ560Cb/5OPsyhkhg==", - "dev": true, - "requires": { - "glob-watcher": "^6.0.0", - "gulp-cli": "^3.0.0", - "undertaker": "^2.0.0", - "vinyl-fs": "^4.0.0" + "node_modules/remark-stringify": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-11.0.0.tgz", + "integrity": "sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-to-markdown": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "gulp-cli": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/gulp-cli/-/gulp-cli-3.0.0.tgz", - "integrity": "sha512-RtMIitkT8DEMZZygHK2vEuLPqLPAFB4sntSxg4NoDta7ciwGZ18l7JuhCTiS5deOJi2IoK0btE+hs6R4sfj7AA==", - "dev": true, - "requires": { - "@gulpjs/messages": "^1.1.0", - "chalk": "^4.1.2", - "copy-props": "^4.0.0", - "gulplog": "^2.2.0", - "interpret": "^3.1.1", - "liftoff": "^5.0.0", - "mute-stdout": "^2.0.0", - "replace-homedir": "^2.0.0", - "semver-greatest-satisfied-range": "^2.0.0", - "string-width": "^4.2.3", - "v8flags": "^4.0.0", - "yargs": "^16.2.0" - } - }, - "gulp-header": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/gulp-header/-/gulp-header-2.0.9.tgz", - "integrity": "sha512-LMGiBx+qH8giwrOuuZXSGvswcIUh0OiioNkUpLhNyvaC6/Ga8X6cfAeme2L5PqsbXMhL8o8b/OmVqIQdxprhcQ==", - "dev": true, - "requires": { - "concat-with-sourcemaps": "^1.1.0", - "lodash.template": "^4.5.0", - "map-stream": "0.0.7", - "through2": "^2.0.0" - } - }, - "gulp-rename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-2.0.0.tgz", - "integrity": "sha512-97Vba4KBzbYmR5VBs9mWmK+HwIf5mj+/zioxfZhOKeXtx5ZjBk57KFlePf5nxq9QsTtFl0ejnHE3zTC9MHXqyQ==", - "dev": true + "node_modules/restructure": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/restructure/-/restructure-3.0.2.tgz", + "integrity": "sha512-gSfoiOEA0VPE6Tukkrr7I0RBdE0s7H1eFCDBk05l1KIQT1UIKNc5JZy6jdyW6eYH3aR3g5b3PuL77rq0hvwtAw==", + "license": "MIT" }, - "gulp-replace": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/gulp-replace/-/gulp-replace-1.1.4.tgz", - "integrity": "sha512-SVSF7ikuWKhpAW4l4wapAqPPSToJoiNKsbDoUnRrSgwZHH7lH8pbPeQj1aOVYQrbZKhfSVBxVW+Py7vtulRktw==", - "dev": true, - "requires": { - "@types/node": "*", - "@types/vinyl": "^2.0.4", - "istextorbinary": "^3.0.0", - "replacestream": "^4.0.3", - "yargs-parser": ">=5.0.0-security.0" - } - }, - "gulplog": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-2.2.0.tgz", - "integrity": "sha512-V2FaKiOhpR3DRXZuYdRLn/qiY0yI5XmqbTKrYbdemJ+xOh2d2MOweI/XFgMzd/9+1twdvMwllnZbWZNJ+BOm4A==", - "dev": true, - "requires": { - "glogg": "^2.2.0" - } - }, - "handlebars": { - "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.2", - "source-map": "^0.6.1", - "uglify-js": "^3.1.4", - "wordwrap": "^1.0.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } + "node_modules/retext": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/retext/-/retext-9.0.0.tgz", + "integrity": "sha512-sbMDcpHCNjvlheSgMfEcVrZko3cDzdbe1x/e7G66dFp0Ff7Mldvi2uv6JkJQzdRcvLYE8CA8Oe8siQx8ZOgTcA==", + "license": "MIT", + "dependencies": { + "@types/nlcst": "^2.0.0", + "retext-latin": "^4.0.0", + "retext-stringify": "^4.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "has-flag": { + "node_modules/retext-latin": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "dev": true, - "requires": { - "function-bind": "^1.1.2" + "resolved": "https://registry.npmjs.org/retext-latin/-/retext-latin-4.0.0.tgz", + "integrity": "sha512-hv9woG7Fy0M9IlRQloq/N6atV82NxLGveq+3H2WOi79dtIYWN8OaxogDm77f8YnVXJL2VD3bbqowu5E3EMhBYA==", + "license": "MIT", + "dependencies": { + "@types/nlcst": "^2.0.0", + "parse-latin": "^7.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "homedir-polyfill": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", - "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", - "dev": true, - "requires": { - "parse-passwd": "^1.0.0" + "node_modules/retext-smartypants": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/retext-smartypants/-/retext-smartypants-6.2.0.tgz", + "integrity": "sha512-kk0jOU7+zGv//kfjXEBjdIryL1Acl4i9XNkHxtM7Tm5lFiCog576fjNC9hjoR7LTKQ0DsPWy09JummSsH1uqfQ==", + "license": "MIT", + "dependencies": { + "@types/nlcst": "^2.0.0", + "nlcst-to-string": "^4.0.0", + "unist-util-visit": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3.0.0" + "node_modules/retext-stringify": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/retext-stringify/-/retext-stringify-4.0.0.tgz", + "integrity": "sha512-rtfN/0o8kL1e+78+uxPTqu1Klt0yPzKuQ2BfWwwfgIUSayyzxpM1PJzkKt4V8803uB9qSy32MvI7Xep9khTpiA==", + "license": "MIT", + "dependencies": { + "@types/nlcst": "^2.0.0", + "nlcst-to-string": "^4.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "dev": true - }, - "interpret": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", - "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", - "dev": true - }, - "is-absolute": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", - "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", - "dev": true, - "requires": { - "is-relative": "^1.0.0", - "is-windows": "^1.0.1" + "node_modules/rollup": { + "version": "4.41.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.41.1.tgz", + "integrity": "sha512-cPmwD3FnFv8rKMBc1MxWCwVQFxwf1JEmSX3iQXrRVVG15zerAIXRjMFVWnd5Q5QvgKF7Aj+5ykXFhUl+QGnyOw==", + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.7" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.41.1", + "@rollup/rollup-android-arm64": "4.41.1", + "@rollup/rollup-darwin-arm64": "4.41.1", + "@rollup/rollup-darwin-x64": "4.41.1", + "@rollup/rollup-freebsd-arm64": "4.41.1", + "@rollup/rollup-freebsd-x64": "4.41.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.41.1", + "@rollup/rollup-linux-arm-musleabihf": "4.41.1", + "@rollup/rollup-linux-arm64-gnu": "4.41.1", + "@rollup/rollup-linux-arm64-musl": "4.41.1", + "@rollup/rollup-linux-loongarch64-gnu": "4.41.1", + "@rollup/rollup-linux-powerpc64le-gnu": "4.41.1", + "@rollup/rollup-linux-riscv64-gnu": "4.41.1", + "@rollup/rollup-linux-riscv64-musl": "4.41.1", + "@rollup/rollup-linux-s390x-gnu": "4.41.1", + "@rollup/rollup-linux-x64-gnu": "4.41.1", + "@rollup/rollup-linux-x64-musl": "4.41.1", + "@rollup/rollup-win32-arm64-msvc": "4.41.1", + "@rollup/rollup-win32-ia32-msvc": "4.41.1", + "@rollup/rollup-win32-x64-msvc": "4.41.1", + "fsevents": "~2.3.2" } }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" + "node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" } }, - "is-core-module": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.14.0.tgz", - "integrity": "sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==", - "dev": true, - "requires": { - "hasown": "^2.0.2" + "node_modules/sharp": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.5.tgz", + "integrity": "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw==", + "hasInstallScript": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "color": "^4.2.3", + "detect-libc": "^2.0.3", + "semver": "^7.6.3" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.33.5", + "@img/sharp-darwin-x64": "0.33.5", + "@img/sharp-libvips-darwin-arm64": "1.0.4", + "@img/sharp-libvips-darwin-x64": "1.0.4", + "@img/sharp-libvips-linux-arm": "1.0.5", + "@img/sharp-libvips-linux-arm64": "1.0.4", + "@img/sharp-libvips-linux-s390x": "1.0.4", + "@img/sharp-libvips-linux-x64": "1.0.4", + "@img/sharp-libvips-linuxmusl-arm64": "1.0.4", + "@img/sharp-libvips-linuxmusl-x64": "1.0.4", + "@img/sharp-linux-arm": "0.33.5", + "@img/sharp-linux-arm64": "0.33.5", + "@img/sharp-linux-s390x": "0.33.5", + "@img/sharp-linux-x64": "0.33.5", + "@img/sharp-linuxmusl-arm64": "0.33.5", + "@img/sharp-linuxmusl-x64": "0.33.5", + "@img/sharp-wasm32": "0.33.5", + "@img/sharp-win32-ia32": "0.33.5", + "@img/sharp-win32-x64": "0.33.5" + } + }, + "node_modules/shiki": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-3.5.0.tgz", + "integrity": "sha512-1lyPuqIPPAlmR1BKtDkxiuoZTB2IKSyr+GeHXu4ReOyHoEMhCnUoGZDUv4SJRH0Bi4QmsEPsrkQCRSOgnVRC+g==", + "license": "MIT", + "dependencies": { + "@shikijs/core": "3.5.0", + "@shikijs/engine-javascript": "3.5.0", + "@shikijs/engine-oniguruma": "3.5.0", + "@shikijs/langs": "3.5.0", + "@shikijs/themes": "3.5.0", + "@shikijs/types": "3.5.0", + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" } }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" + "node_modules/simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", + "license": "MIT", + "optional": true, + "dependencies": { + "is-arrayish": "^0.3.1" } }, - "is-negated-glob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", - "integrity": "sha512-czXVVn/QEmgvej1f50BZ648vUI+em0xqMq2Sn+QncCLN4zj1UAxlT+kw/6ggQTOaZPd1HqKQGEqbpQVtJucWug==", - "dev": true - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "is-plain-object": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", - "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", - "dev": true + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "license": "MIT" }, - "is-relative": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", - "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", - "dev": true, - "requires": { - "is-unc-path": "^1.0.0" + "node_modules/smol-toml": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.3.4.tgz", + "integrity": "sha512-UOPtVuYkzYGee0Bd2Szz8d2G3RfMfJ2t3qVdZUAozZyAk+a0Sxa+QKix0YCwjL/A1RR0ar44nCxaoN9FxdJGwA==", + "license": "BSD-3-Clause", + "engines": { + "node": ">= 18" + }, + "funding": { + "url": "https://github.com/sponsors/cyyynthia" } }, - "is-unc-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", - "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", - "dev": true, - "requires": { - "unc-path-regex": "^0.1.2" + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" } }, - "is-valid-glob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-1.0.0.tgz", - "integrity": "sha512-AhiROmoEFDSsjx8hW+5sGwgKVIORcXnrlAx/R0ZSeaPw70Vw0CqkGBBhHGL58Uox2eXnU1AnvXJl1XlyedO5bA==", - "dev": true - }, - "is-windows": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", - "dev": true - }, - "istextorbinary": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-3.3.0.tgz", - "integrity": "sha512-Tvq1W6NAcZeJ8op+Hq7tdZ434rqnMx4CCZ7H0ff83uEloDvVbqAwaMTZcafKGJT0VHkYzuXUiCY4hlXQg6WfoQ==", - "dev": true, - "requires": { - "binaryextensions": "^2.2.0", - "textextensions": "^3.2.0" + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "jackspeak": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.1.tgz", - "integrity": "sha512-cub8rahkh0Q/bw1+GxP7aeSe29hHHn2V4m29nnDlvCdlgU+3UGxkZp7Z53jLUdpX3jdTO0nJZUDl3xvbWc2Xog==", - "dev": true, - "requires": { - "@isaacs/cliui": "^8.0.2", - "@pkgjs/parseargs": "^0.11.0" + "node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "javascript-natural-sort": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz", - "integrity": "sha1-+eIwPUUH9tdDVac2ZNFED7Wg71k=" - }, - "last-run": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/last-run/-/last-run-2.0.0.tgz", - "integrity": "sha512-j+y6WhTLN4Itnf9j5ZQos1BGPCS8DAwmgMroR3OzfxAsBxam0hMw7J8M3KqZl0pLQJ1jNnwIexg5DYpC/ctwEQ==", - "dev": true - }, - "lead": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/lead/-/lead-4.0.0.tgz", - "integrity": "sha512-DpMa59o5uGUWWjruMp71e6knmwKU3jRBBn1kjuLWN9EeIOxNeSAwvHf03WIl8g/ZMR2oSQC9ej3yeLBwdDc/pg==", - "dev": true - }, - "liftoff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-5.0.0.tgz", - "integrity": "sha512-a5BQjbCHnB+cy+gsro8lXJ4kZluzOijzJ1UVVfyJYZC+IP2pLv1h4+aysQeKuTmyO8NAqfyQAk4HWaP/HjcKTg==", - "dev": true, - "requires": { - "extend": "^3.0.2", - "findup-sync": "^5.0.0", - "fined": "^2.0.0", - "flagged-respawn": "^2.0.0", - "is-plain-object": "^5.0.0", - "rechoir": "^0.8.0", - "resolve": "^1.20.0" - } - }, - "lodash._reinterpolate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", - "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", - "dev": true - }, - "lodash.template": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz", - "integrity": "sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A==", - "dev": true, - "requires": { - "lodash._reinterpolate": "^3.0.0", - "lodash.templatesettings": "^4.0.0" + "node_modules/stringify-entities": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "license": "MIT", + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "lodash.templatesettings": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz", - "integrity": "sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ==", - "dev": true, - "requires": { - "lodash._reinterpolate": "^3.0.0" + "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "lru-cache": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.0.tgz", - "integrity": "sha512-Qv32eSV1RSCfhY3fpPE2GNZ8jgM9X7rdAfemLWqTUxwiyIC4jJ6Sy0fZ8H+oLWevO6i4/bizg7c8d8i6bxrzbA==", - "dev": true + "node_modules/tailwindcss": { + "version": "4.1.8", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.8.tgz", + "integrity": "sha512-kjeW8gjdxasbmFKpVGrGd5T4i40mV5J2Rasw48QARfYeQ8YS9x02ON9SFWax3Qf616rt4Cp3nVNIj6Hd1mP3og==", + "license": "MIT" }, - "map-cache": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg==", - "dev": true - }, - "map-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz", - "integrity": "sha1-ih8HiW2CsQkmvTdEokIACfiJdKg=", - "dev": true - }, - "mathjs": { - "version": "14.5.2", - "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-14.5.2.tgz", - "integrity": "sha512-51U6hp7j4M4Rj+l+q2KbmXAV9EhQVQzUdw1wE67RnUkKKq5ibxdrl9Ky2YkSUEIc2+VU8/IsThZNu6QSHUoyTA==", - "requires": { - "@babel/runtime": "^7.26.10", - "complex.js": "^2.2.5", - "decimal.js": "^10.4.3", - "escape-latex": "^1.2.0", - "fraction.js": "^5.2.1", - "javascript-natural-sort": "^0.7.1", - "seedrandom": "^3.0.5", - "tiny-emitter": "^2.1.0", - "typed-function": "^4.2.1" - } - }, - "micromatch": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", - "dev": true, - "requires": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - } - }, - "minimatch": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", - "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" + "node_modules/tapable": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.2.tgz", + "integrity": "sha512-Re10+NauLTMCudc7T5WLFLAwDhQ0JWdrMK+9B2M8zR5hRExKmsRDCBA7/aV/pNJFltmBFO5BAMlQFi/vq3nKOg==", + "license": "MIT", + "engines": { + "node": ">=6" } }, - "minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true - }, - "minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true - }, - "mute-stdout": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mute-stdout/-/mute-stdout-2.0.0.tgz", - "integrity": "sha512-32GSKM3Wyc8dg/p39lWPKYu8zci9mJFzV1Np9Of0ZEpe6Fhssn/FbI7ywAMd40uX+p3ZKh3T5EeCFv81qS3HmQ==", - "dev": true + "node_modules/tar": { + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/tar/-/tar-7.4.3.tgz", + "integrity": "sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==", + "license": "ISC", + "dependencies": { + "@isaacs/fs-minipass": "^4.0.0", + "chownr": "^3.0.0", + "minipass": "^7.1.2", + "minizlib": "^3.0.1", + "mkdirp": "^3.0.1", + "yallist": "^5.0.0" + }, + "engines": { + "node": ">=18" + } }, - "neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true + "node_modules/tiny-inflate": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.3.tgz", + "integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==", + "license": "MIT" }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true + "node_modules/tinyexec": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", + "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", + "license": "MIT" }, - "now-and-later": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-3.0.0.tgz", - "integrity": "sha512-pGO4pzSdaxhWTGkfSfHx3hVzJVslFPwBp2Myq9MYN/ChfJZF87ochMAXnvz6/58RJSf5ik2q9tXprBBrk2cpcg==", - "dev": true, - "requires": { - "once": "^1.4.0" + "node_modules/tinyglobby": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz", + "integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==", + "license": "MIT", + "dependencies": { + "fdir": "^6.4.4", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" } }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" }, - "object.defaults": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz", - "integrity": "sha512-c/K0mw/F11k4dEUBMW8naXUuBuhxRCfG7W+yFy8EcijU/rSmazOUd1XAEEe6bC0OuXY4HUKjTJv7xbxIMqdxrA==", - "dev": true, - "requires": { - "array-each": "^1.0.1", - "array-slice": "^1.0.0", - "for-own": "^1.0.0", - "isobject": "^3.0.0" + "node_modules/trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ==", - "dev": true, - "requires": { - "isobject": "^3.0.1" + "node_modules/trough": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz", + "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "requires": { - "wrappy": "1" + "node_modules/tsconfck": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-3.1.6.tgz", + "integrity": "sha512-ks6Vjr/jEw0P1gmOVwutM3B7fWxoWBL2KRDb1JfqGVawBmO5UsvmWOQFGHBPl5yxYz4eERr19E6L7NMv+Fej4w==", + "license": "MIT", + "bin": { + "tsconfck": "bin/tsconfck.js" + }, + "engines": { + "node": "^18 || >=20" + }, + "peerDependencies": { + "typescript": "^5.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "package-json-from-dist": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", - "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", - "dev": true + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, - "parse-filepath": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", - "integrity": "sha512-FwdRXKCohSVeXqwtYonZTXtbGJKrn+HNyWDYVcp5yuJlesTwNH4rsmRZ+GrKAPJ5bLpRxESMeS+Rl0VCHRvB2Q==", - "dev": true, - "requires": { - "is-absolute": "^1.0.0", - "map-cache": "^0.2.0", - "path-root": "^0.1.1" + "node_modules/type-fest": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", + "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "parse-passwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", - "integrity": "sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==", - "dev": true - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true - }, - "path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "path-root": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz", - "integrity": "sha512-QLcPegTHF11axjfojBIoDygmS2E3Lf+8+jI6wOVmNVenrKSo3mFdSGiIgdSHenczw3wPtlVMQaFVwGmM7BJdtg==", - "dev": true, - "requires": { - "path-root-regex": "^0.1.0" - } - }, - "path-root-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/path-root-regex/-/path-root-regex-0.1.2.tgz", - "integrity": "sha512-4GlJ6rZDhQZFE0DPVKh0e9jmZ5egZfxTkp7bcRDuPlJXbAwhxcl2dINPUAsjLdejqaLsCeg8axcLjIbvBjN4pQ==", - "dev": true - }, - "path-scurry": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", - "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", - "dev": true, - "requires": { - "lru-cache": "^11.0.0", - "minipass": "^7.1.2" + "node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "license": "Apache-2.0", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" } }, - "picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true + "node_modules/ufo": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.1.tgz", + "integrity": "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==", + "license": "MIT" }, - "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "dev": true + "node_modules/ultrahtml": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/ultrahtml/-/ultrahtml-1.6.0.tgz", + "integrity": "sha512-R9fBn90VTJrqqLDwyMph+HGne8eqY1iPfYhPzZrvKpIfwkWZbcYlfpsb8B9dTvBfpy1/hqAD7Wi8EKfP9e8zdw==", + "license": "MIT" }, - "queue-tick": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", - "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==", - "dev": true - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "requires": { - "picomatch": "^2.2.1" - } - }, - "rechoir": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", - "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", - "dev": true, - "requires": { - "resolve": "^1.20.0" - } - }, - "regenerator-runtime": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", - "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" - }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==", - "dev": true + "node_modules/uncrypto": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/uncrypto/-/uncrypto-0.1.3.tgz", + "integrity": "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==", + "license": "MIT" }, - "replace-ext": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-2.0.0.tgz", - "integrity": "sha512-UszKE5KVK6JvyD92nzMn9cDapSk6w/CaFZ96CnmDMUqH9oowfxF/ZjRITD25H4DnOQClLA4/j7jLGXXLVKxAug==", - "dev": true + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "license": "MIT" + }, + "node_modules/unicode-properties": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/unicode-properties/-/unicode-properties-1.4.1.tgz", + "integrity": "sha512-CLjCCLQ6UuMxWnbIylkisbRj31qxHPAurvena/0iwSVbQ2G1VY5/HjV0IRabOEbDHlzZlRdCrD4NhB0JtU40Pg==", + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.0", + "unicode-trie": "^2.0.0" + } }, - "replace-homedir": { + "node_modules/unicode-trie": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/replace-homedir/-/replace-homedir-2.0.0.tgz", - "integrity": "sha512-bgEuQQ/BHW0XkkJtawzrfzHFSN70f/3cNOiHa2QsYxqrjaC30X1k74FJ6xswVBP0sr0SpGIdVFuPwfrYziVeyw==", - "dev": true + "resolved": "https://registry.npmjs.org/unicode-trie/-/unicode-trie-2.0.0.tgz", + "integrity": "sha512-x7bc76x0bm4prf1VLg79uhAzKw8DVboClSN5VxJuQ+LKDOVEW9CdH+VY7SP+vX7xCYQqzzgQpFqz15zeLvAtZQ==", + "license": "MIT", + "dependencies": { + "pako": "^0.2.5", + "tiny-inflate": "^1.0.0" + } }, - "replacestream": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/replacestream/-/replacestream-4.0.3.tgz", - "integrity": "sha512-AC0FiLS352pBBiZhd4VXB1Ab/lh0lEgpP+GGvZqbQh8a5cmXVoTe5EX/YeTFArnp4SRGTHh1qCHu9lGs1qG8sA==", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.3", - "object-assign": "^4.0.1", - "readable-stream": "^2.0.2" + "node_modules/unified": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", + "integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "bail": "^2.0.0", + "devlop": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true - }, - "resolve": { - "version": "1.22.8", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", - "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", - "dev": true, - "requires": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - } - }, - "resolve-dir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", - "integrity": "sha512-R7uiTjECzvOsWSfdM0QKFNBVFcK27aHOUwdvK53BcW8zqnGdYp0Fbj82cy54+2A4P2tFM22J5kRfe1R+lM/1yg==", - "dev": true, - "requires": { - "expand-tilde": "^2.0.0", - "global-modules": "^1.0.0" + "node_modules/unifont": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/unifont/-/unifont-0.5.0.tgz", + "integrity": "sha512-4DueXMP5Hy4n607sh+vJ+rajoLu778aU3GzqeTCqsD/EaUcvqZT9wPC8kgK6Vjh22ZskrxyRCR71FwNOaYn6jA==", + "license": "MIT", + "dependencies": { + "css-tree": "^3.0.0", + "ohash": "^2.0.0" } }, - "resolve-options": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve-options/-/resolve-options-2.0.0.tgz", - "integrity": "sha512-/FopbmmFOQCfsCx77BRFdKOniglTiHumLgwvd6IDPihy1GKkadZbgQJBcTb2lMzSR1pndzd96b1nZrreZ7+9/A==", - "dev": true, - "requires": { - "value-or-function": "^4.0.0" + "node_modules/unist-util-find-after": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-find-after/-/unist-util-find-after-5.0.0.tgz", + "integrity": "sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true + "node_modules/unist-util-is": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", + "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } }, - "rimraf": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.0.1.tgz", - "integrity": "sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A==", - "dev": true, - "requires": { - "glob": "^11.0.0", - "package-json-from-dist": "^1.0.0" + "node_modules/unist-util-modify-children": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-modify-children/-/unist-util-modify-children-4.0.0.tgz", + "integrity": "sha512-+tdN5fGNddvsQdIzUF3Xx82CU9sMM+fA0dLgR9vOmT0oPT2jH+P1nd5lSqfCfXAw+93NhcXNY2qqvTUtE4cQkw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "array-iterate": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "node_modules/unist-util-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "seedrandom": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz", - "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==" - }, - "semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "optional": true + "node_modules/unist-util-remove-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-5.0.0.tgz", + "integrity": "sha512-Hp5Kh3wLxv0PHj9m2yZhhLt58KzPtEYKQQ4yxfYFEO7EvHwzyDYnduhHnY1mDxoqr7VUwVuHXk9RXKIiYS1N8Q==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-visit": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } }, - "semver-greatest-satisfied-range": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/semver-greatest-satisfied-range/-/semver-greatest-satisfied-range-2.0.0.tgz", - "integrity": "sha512-lH3f6kMbwyANB7HuOWRMlLCa2itaCrZJ+SAqqkSZrZKO/cAsk2EOyaKHUtNkVLFyFW9pct22SFesFp3Z7zpA0g==", - "dev": true, - "requires": { - "sver": "^1.8.3" + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "requires": { - "shebang-regex": "^3.0.0" + "node_modules/unist-util-visit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", + "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "shebang-regex": { + "node_modules/unist-util-visit-children": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true - }, - "signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true - }, - "sparkles": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-2.1.0.tgz", - "integrity": "sha512-r7iW1bDw8R/cFifrD3JnQJX0K1jqT0kprL48BiBpLZLJPmAm34zsVBsK5lc7HirZYZqMW65dOXZgbAGt/I6frg==", - "dev": true - }, - "stream-composer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/stream-composer/-/stream-composer-1.0.2.tgz", - "integrity": "sha512-bnBselmwfX5K10AH6L4c8+S5lgZMWI7ZYrz2rvYjCPB2DIMC4Ig8OpxGpNJSxRZ58oti7y1IcNvjBAz9vW5m4w==", - "dev": true, - "requires": { - "streamx": "^2.13.2" + "resolved": "https://registry.npmjs.org/unist-util-visit-children/-/unist-util-visit-children-3.0.0.tgz", + "integrity": "sha512-RgmdTfSBOg04sdPcpTSD1jzoNBjt9a80/ZCzp5cI9n1qPzLZWF9YdvWGN2zmTumP1HWhXKdUWexjy/Wy/lJ7tA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "stream-exhaust": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/stream-exhaust/-/stream-exhaust-1.0.2.tgz", - "integrity": "sha512-b/qaq/GlBK5xaq1yrK9/zFcyRSTNxmcZwFLGSTG0mXgZl/4Z6GgiyYOXOvY7N3eEvFRAG1bkDRz5EPGSvPYQlw==", - "dev": true - }, - "streamx": { - "version": "2.18.0", - "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.18.0.tgz", - "integrity": "sha512-LLUC1TWdjVdn1weXGcSxyTR3T4+acB6tVGXT95y0nGbca4t4o/ng1wKAGTljm9VicuCVLvRlqFYXYy5GwgM7sQ==", - "dev": true, - "requires": { - "bare-events": "^2.2.0", - "fast-fifo": "^1.3.2", - "queue-tick": "^1.0.1", - "text-decoder": "^1.1.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" + "node_modules/unist-util-visit-parents": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz", + "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, + "node_modules/unstorage": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.16.0.tgz", + "integrity": "sha512-WQ37/H5A7LcRPWfYOrDa1Ys02xAbpPJq6q5GkO88FBXVSQzHd7+BjEwfRqyaSWCv9MbsJy058GWjjPjcJ16GGA==", + "license": "MIT", "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true + "anymatch": "^3.1.3", + "chokidar": "^4.0.3", + "destr": "^2.0.5", + "h3": "^1.15.2", + "lru-cache": "^10.4.3", + "node-fetch-native": "^1.6.6", + "ofetch": "^1.4.1", + "ufo": "^1.6.1" + }, + "peerDependencies": { + "@azure/app-configuration": "^1.8.0", + "@azure/cosmos": "^4.2.0", + "@azure/data-tables": "^13.3.0", + "@azure/identity": "^4.6.0", + "@azure/keyvault-secrets": "^4.9.0", + "@azure/storage-blob": "^12.26.0", + "@capacitor/preferences": "^6.0.3 || ^7.0.0", + "@deno/kv": ">=0.9.0", + "@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.1.0", + "@planetscale/database": "^1.19.0", + "@upstash/redis": "^1.34.3", + "@vercel/blob": ">=0.27.1", + "@vercel/kv": "^1.0.1", + "aws4fetch": "^1.0.20", + "db0": ">=0.2.1", + "idb-keyval": "^6.2.1", + "ioredis": "^5.4.2", + "uploadthing": "^7.4.4" + }, + "peerDependenciesMeta": { + "@azure/app-configuration": { + "optional": true + }, + "@azure/cosmos": { + "optional": true + }, + "@azure/data-tables": { + "optional": true + }, + "@azure/identity": { + "optional": true + }, + "@azure/keyvault-secrets": { + "optional": true + }, + "@azure/storage-blob": { + "optional": true + }, + "@capacitor/preferences": { + "optional": true + }, + "@deno/kv": { + "optional": true + }, + "@netlify/blobs": { + "optional": true + }, + "@planetscale/database": { + "optional": true + }, + "@upstash/redis": { + "optional": true + }, + "@vercel/blob": { + "optional": true + }, + "@vercel/kv": { + "optional": true + }, + "aws4fetch": { + "optional": true }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } + "db0": { + "optional": true + }, + "idb-keyval": { + "optional": true + }, + "ioredis": { + "optional": true + }, + "uploadthing": { + "optional": true } } }, - "string-width-cjs": { - "version": "npm:string-width@4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, + "node_modules/vfile": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "license": "MIT", "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - } + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, - "requires": { - "ansi-regex": "^6.0.1" + "node_modules/vfile-location": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-5.0.3.tgz", + "integrity": "sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "strip-ansi-cjs": { - "version": "npm:strip-ansi@6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" + "node_modules/vfile-message": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.2.tgz", + "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vite": { + "version": "6.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.3.5.tgz", + "integrity": "sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ==", + "license": "MIT", "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true + "esbuild": "^0.25.0", + "fdir": "^6.4.4", + "picomatch": "^4.0.2", + "postcss": "^8.5.3", + "rollup": "^4.34.9", + "tinyglobby": "^0.2.13" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "jiti": ">=1.21.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true } } }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" + "node_modules/vitefu": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.0.6.tgz", + "integrity": "sha512-+Rex1GlappUyNN6UfwbVZne/9cYC4+R2XDk9xkNXBKMw6HQagdX9PgZ8V2v1WUSK1wfBLp7qbI1+XSNIlB1xmA==", + "license": "MIT", + "workspaces": [ + "tests/deps/*", + "tests/projects/*" + ], + "peerDependencies": { + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" + }, + "peerDependenciesMeta": { + "vite": { + "optional": true + } } }, - "supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true - }, - "sver": { - "version": "1.8.4", - "resolved": "https://registry.npmjs.org/sver/-/sver-1.8.4.tgz", - "integrity": "sha512-71o1zfzyawLfIWBOmw8brleKyvnbn73oVHNCsu51uPMz/HWiKkkXsI31JjHW5zqXEqnPYkIiHd8ZmL7FCimLEA==", - "dev": true, - "requires": { - "semver": "^6.3.0" + "node_modules/web-namespaces": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/web-namespaces/-/web-namespaces-2.0.1.tgz", + "integrity": "sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "teex": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/teex/-/teex-1.0.1.tgz", - "integrity": "sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg==", - "dev": true, - "requires": { - "streamx": "^2.12.5" + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" } }, - "text-decoder": { + "node_modules/which-pm-runs": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.1.0.tgz", - "integrity": "sha512-TmLJNj6UgX8xcUZo4UDStGQtDiTzF7BzWlzn9g7UWrjkpHr5uJTK1ld16wZ3LXb2vb6jH8qU89dW5whuMdXYdw==", - "dev": true, - "requires": { - "b4a": "^1.6.4" + "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.1.0.tgz", + "integrity": "sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==", + "license": "MIT", + "engines": { + "node": ">=4" } }, - "textextensions": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/textextensions/-/textextensions-3.3.0.tgz", - "integrity": "sha512-mk82dS8eRABNbeVJrEiN5/UMSCliINAuz8mkUwH4SwslkNP//gbEzlWNS5au0z5Dpx40SQxzqZevZkn+WYJ9Dw==", - "dev": true - }, - "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "dev": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" + "node_modules/widest-line": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-5.0.0.tgz", + "integrity": "sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA==", + "license": "MIT", + "dependencies": { + "string-width": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "tiny-emitter": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", - "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==" - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" + "node_modules/wrap-ansi": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.0.tgz", + "integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "to-through": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/to-through/-/to-through-3.0.0.tgz", - "integrity": "sha512-y8MN937s/HVhEoBU1SxfHC+wxCHkV1a9gW8eAdTadYh/bGyesZIVcbjI+mSpFbSVwQici/XjBjuUyri1dnXwBw==", - "dev": true, - "requires": { - "streamx": "^2.12.5" - } - }, - "typed-function": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/typed-function/-/typed-function-4.2.1.tgz", - "integrity": "sha512-EGjWssW7Tsk4DGfE+5yluuljS1OGYWiI1J6e8puZz9nTMM51Oug8CD5Zo4gWMsOhq5BI+1bF+rWTm4Vbj3ivRA==" - }, - "uglify-js": { - "version": "3.13.6", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.6.tgz", - "integrity": "sha512-rRprLwl8RVaS+Qvx3Wh5hPfPBn9++G6xkGlUupya0s5aDmNjI7z3lnRLB3u7sN4OmbB0pWgzhM9BEJyiWAwtAA==", - "dev": true, - "optional": true - }, - "unc-path-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", - "integrity": "sha512-eXL4nmJT7oCpkZsHZUOJo8hcX3GbsiDOa0Qu9F646fi8dT3XuSVopVqAcEiVzSKKH7UoDti23wNX3qGFxcW5Qg==", - "dev": true + "node_modules/xxhash-wasm": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.1.0.tgz", + "integrity": "sha512-147y/6YNh+tlp6nd/2pWq38i9h6mz/EuQ6njIrmW8D1BS5nCqs0P6DG+m6zTGnNz5I+uhZ0SHxBs9BsPrwcKDA==", + "license": "MIT" }, - "undertaker": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/undertaker/-/undertaker-2.0.0.tgz", - "integrity": "sha512-tO/bf30wBbTsJ7go80j0RzA2rcwX6o7XPBpeFcb+jzoeb4pfMM2zUeSDIkY1AWqeZabWxaQZ/h8N9t35QKDLPQ==", - "dev": true, - "requires": { - "bach": "^2.0.1", - "fast-levenshtein": "^3.0.0", - "last-run": "^2.0.0", - "undertaker-registry": "^2.0.0" + "node_modules/yallist": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz", + "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" } }, - "undertaker-registry": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/undertaker-registry/-/undertaker-registry-2.0.0.tgz", - "integrity": "sha512-+hhVICbnp+rlzZMgxXenpvTxpuvA67Bfgtt+O9WOE5jo7w/dyiF1VmoZVIHvP2EkUjsyKyTwYKlLhA+j47m1Ew==", - "dev": true - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "v8flags": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-4.0.1.tgz", - "integrity": "sha512-fcRLaS4H/hrZk9hYwbdRM35D0U8IYMfEClhXxCivOojl+yTRAZH3Zy2sSy6qVCiGbV9YAtPssP6jaChqC9vPCg==", - "dev": true - }, - "value-or-function": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/value-or-function/-/value-or-function-4.0.0.tgz", - "integrity": "sha512-aeVK81SIuT6aMJfNo9Vte8Dw0/FZINGBV8BfCraGtqVxIeLAEhJyoWs8SmvRVmXfGss2PmmOwZCuBPbZR+IYWg==", - "dev": true - }, - "vinyl": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-3.0.0.tgz", - "integrity": "sha512-rC2VRfAVVCGEgjnxHUnpIVh3AGuk62rP3tqVrn+yab0YH7UULisC085+NYH+mnqf3Wx4SpSi1RQMwudL89N03g==", - "dev": true, - "requires": { - "clone": "^2.1.2", - "clone-stats": "^1.0.0", - "remove-trailing-separator": "^1.1.0", - "replace-ext": "^2.0.0", - "teex": "^1.0.1" + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "license": "ISC", + "engines": { + "node": ">=12" } }, - "vinyl-contents": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/vinyl-contents/-/vinyl-contents-2.0.0.tgz", - "integrity": "sha512-cHq6NnGyi2pZ7xwdHSW1v4Jfnho4TEGtxZHw01cmnc8+i7jgR6bRnED/LbrKan/Q7CvVLbnvA5OepnhbpjBZ5Q==", - "dev": true, - "requires": { - "bl": "^5.0.0", - "vinyl": "^3.0.0" + "node_modules/yocto-queue": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.2.1.tgz", + "integrity": "sha512-AyeEbWOu/TAXdxlV9wmGcR0+yh2j3vYPGOECcIj2S7MkrLyC7ne+oye2BKTItt0ii2PHk4cDy+95+LshzbXnGg==", + "license": "MIT", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "vinyl-fs": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-4.0.0.tgz", - "integrity": "sha512-7GbgBnYfaquMk3Qu9g22x000vbYkOex32930rBnc3qByw6HfMEAoELjCjoJv4HuEQxHAurT+nvMHm6MnJllFLw==", - "dev": true, - "requires": { - "fs-mkdirp-stream": "^2.0.1", - "glob-stream": "^8.0.0", - "graceful-fs": "^4.2.11", - "iconv-lite": "^0.6.3", - "is-valid-glob": "^1.0.0", - "lead": "^4.0.0", - "normalize-path": "3.0.0", - "resolve-options": "^2.0.0", - "stream-composer": "^1.0.2", - "streamx": "^2.14.0", - "to-through": "^3.0.0", - "value-or-function": "^4.0.0", - "vinyl": "^3.0.0", - "vinyl-sourcemap": "^2.0.0" - } - }, - "vinyl-sourcemap": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/vinyl-sourcemap/-/vinyl-sourcemap-2.0.0.tgz", - "integrity": "sha512-BAEvWxbBUXvlNoFQVFVHpybBbjW1r03WhohJzJDSfgrrK5xVYIDTan6xN14DlyImShgDRv2gl9qhM6irVMsV0Q==", - "dev": true, - "requires": { - "convert-source-map": "^2.0.0", - "graceful-fs": "^4.2.10", - "now-and-later": "^3.0.0", - "streamx": "^2.12.5", - "vinyl": "^3.0.0", - "vinyl-contents": "^2.0.0" - } - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" + "node_modules/yocto-spinner": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/yocto-spinner/-/yocto-spinner-0.2.3.tgz", + "integrity": "sha512-sqBChb33loEnkoXte1bLg45bEBsOP9N1kzQh5JZNKj/0rik4zAPTNSAVPj3uQAdc6slYJ0Ksc403G2XgxsJQFQ==", + "license": "MIT", + "dependencies": { + "yoctocolors": "^2.1.1" + }, + "engines": { + "node": ">=18.19" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true + "node_modules/yoctocolors": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/yoctocolors/-/yoctocolors-2.1.1.tgz", + "integrity": "sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, - "requires": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true - }, - "emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true - }, - "string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "requires": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - } - } + "node_modules/zod": { + "version": "3.25.51", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.51.tgz", + "integrity": "sha512-TQSnBldh+XSGL+opiSIq0575wvDPqu09AqWe1F7JhUMKY+M91/aGlK4MhpVNO7MgYfHcVCB1ffwAUTJzllKJqg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" } }, - "wrap-ansi-cjs": { - "version": "npm:wrap-ansi@7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - } + "node_modules/zod-to-json-schema": { + "version": "3.24.5", + "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.5.tgz", + "integrity": "sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g==", + "license": "ISC", + "peerDependencies": { + "zod": "^3.24.1" } }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "node_modules/zod-to-ts": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/zod-to-ts/-/zod-to-ts-1.2.0.tgz", + "integrity": "sha512-x30XE43V+InwGpvTySRNz9kB7qFU8DlyEy7BsSTCHPH1R0QasMmHWZDCzYm6bVXtj/9NNJAZF3jW8rzFvH5OFA==", + "peerDependencies": { + "typescript": "^4.9.4 || ^5.0.2", + "zod": "^3" + } }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true - }, - "y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true - }, - "yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "requires": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - } - }, - "yargs-parser": { - "version": "20.2.7", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", - "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==", - "dev": true + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } } } } diff --git a/package.json b/package.json index 31fdd11a71..8451484951 100644 --- a/package.json +++ b/package.json @@ -1,25 +1,16 @@ { "name": "mathjs-website", - "version": "1.0.0", - "repository": { - "type": "git", - "url": "https://github.com/josdejong/mathjs.git" + "type": "module", + "version": "0.0.1", + "scripts": { + "dev": "astro dev", + "build": "astro build", + "preview": "astro preview", + "astro": "astro" }, "dependencies": { - "mathjs": "14.5.2" - }, - "devDependencies": { - "fancy-log": "2.0.0", - "glob": "11.0.2", - "gulp": "5.0.0", - "gulp-header": "2.0.9", - "gulp-rename": "2.0.0", - "gulp-replace": "1.1.4", - "handlebars": "4.7.8", - "rimraf": "6.0.1" - }, - "scripts": { - "update:mathjs-src": "git submodule init && git submodule update && cd mathjs-src && git checkout master && git pull && npm install && npm run build ; cd ..", - "build": "npm run update:mathjs-src && gulp" + "@tailwindcss/vite": "^4.1.8", + "astro": "^5.8.2", + "flyonui": "^2.2.0" } } diff --git a/favicon.ico b/public/favicon.ico similarity index 100% rename from favicon.ico rename to public/favicon.ico diff --git a/css/img/mathjs.svg b/public/mathjs.svg similarity index 100% rename from css/img/mathjs.svg rename to public/mathjs.svg diff --git a/css/img/mathjs_100x30.png b/public/mathjs_100x30.png similarity index 100% rename from css/img/mathjs_100x30.png rename to public/mathjs_100x30.png diff --git a/css/img/mathjs_165x50.png b/public/mathjs_165x50.png similarity index 100% rename from css/img/mathjs_165x50.png rename to public/mathjs_165x50.png diff --git a/css/img/mathjs_330x100.png b/public/mathjs_330x100.png similarity index 100% rename from css/img/mathjs_330x100.png rename to public/mathjs_330x100.png diff --git a/src/assets/global.css b/src/assets/global.css new file mode 100644 index 0000000000..8ae830efbf --- /dev/null +++ b/src/assets/global.css @@ -0,0 +1,4 @@ +@import "tailwindcss"; +@plugin "flyonui"; +@import "flyonui/variants.css"; +@source "../node_modules/flyonui/flyonui.js"; \ No newline at end of file diff --git a/src/components/Navbar.astro b/src/components/Navbar.astro new file mode 100644 index 0000000000..e0c59263e8 --- /dev/null +++ b/src/components/Navbar.astro @@ -0,0 +1,75 @@ +
diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro new file mode 100644 index 0000000000..c950e0b1dd --- /dev/null +++ b/src/layouts/Layout.astro @@ -0,0 +1,23 @@ + + + + + + + + + math.js | an extensive math library for JavaScript and Node.js + + + + + + + + + + + + + + diff --git a/src/pages/index.astro b/src/pages/index.astro new file mode 100644 index 0000000000..150ca819db --- /dev/null +++ b/src/pages/index.astro @@ -0,0 +1,9 @@ +--- +import Layout from "../layouts/Layout.astro"; +import Navbar from "../components/Navbar.astro"; +import "../assets/global.css"; +--- + + + + diff --git a/test/commandline.html b/test/commandline.html deleted file mode 100644 index e465c50868..0000000000 --- a/test/commandline.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - Commandline - - - - -
loading...
- - - - diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000000..8bf91d3bb9 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist"] +}