PageSourceSearch

https://permission.click/js-respond/26.6.0.0/mathjs.4fc0f0ece1d6c90d990a.js

js permission.click collected 2026-09-24 11:51:48 UTC 527,966 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkpc_frontend_respond=self.webpackChunkpc_frontend_respond||[]).push([[2492],{26756(e,t,r){function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},n.apply(this,arguments)}r.d(t,{qg:()=>Ex});var i={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},a=function(e){if(e)throw new Error("The global config is readonly. \nPlease create a mathjs instance if you want to change the default configuration. \nExample:\n\n  import { create, all } from 'mathjs';\n  const mathjs = create(all);\n  mathjs.config({ number: 'BigNumber' });\n");return Object.freeze(i)};n(a,i,{MATRIX_OPTIONS:["Matrix","Array"],NUMBER_OPTIONS:["number","BigNumber","Fraction"]});var o=r(14943);function s(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}var u=Math.sign||function(e){return e>0?1:e<0?-1:0},c=Math.log2||function(e){return Math.log(e)/Math.LN2},l=Math.log10||function(e){return Math.log(e)/Math.LN10},f=Math.log1p||function(e){return Math.log(e+1)},p=Math.cbrt||function(e){if(0===e)return e;var t,r=e<0;return r&&(e=-e),t=isFinite(e)?(e/((t=Math.exp(Math.log(e)/3))*t)+2*t)/3:e,r?-t:t},m=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function d(e,t,r){var n={2:"0b",8:"0o",16:"0x"}[t],i="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!s(r))throw new Error("size must be an integer");if(e>2**(r-1)-1||e<-(2**(r-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!s(e))throw new Error("Value must be an integer");e<0&&(e+=2**r),i="i".concat(r)}var a="";return e<0&&(e=-e,a="-"),"".concat(a).concat(n).concat(e.toString(t)).concat(i)}function h(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";var r,n,i="auto";if(t&&(t.notation&&(i=t.notation),(0,o.Et)(t)?r=t:(0,o.Et)(t.precision)&&(r=t.precision),t.wordSize&&"number"!=typeof(n=t.wordSize)))throw new Error('Option "wordSize" must be a number');switch(i){case"fixed":return g(e,r);case"exponential":return v(e,r);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=x(y(e),t),n=r.exponent,i=r.coefficients,a=n%3==0?n:n<0?n-3-n%3:n-n%3;if((0,o.Et)(t))for(;t>i.length||n-a+1>i.length;)i.push(0);else for(var s=Math.abs(n-a)-(i.length-1),u=0;u<s;u++)i.push(0);for(var c=Math.abs(n-a),l=1;c>0;)l++,c--;var f=i.slice(l).join(""),p=(0,o.Et)(t)&&f.length||f.match(/[1-9]/)?"."+f:"",m=i.slice(0,l).join("")+p+"e"+(n>=0?"+":"")+a.toString();return r.sign+m}(e,r);case"bin":return d(e,2,n);case"oct":return d(e,8,n);case"hex":return d(e,16,n);case"auto":return function(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var n=r&&void 0!==r.lowerExp?r.lowerExp:-3,i=r&&void 0!==r.upperExp?r.upperExp:5,a=y(e),o=t?x(a,t):a;if(o.exponent<n||o.exponent>=i)return v(e,t);var s=o.coefficients,u=o.exponent;s.length<t&&(s=s.concat(b(t-s.length))),s=s.concat(b(u-s.length+1+(s.length<t?t-s.length:0)));var c=u>0?u:0;return c<(s=b(-u).concat(s)).length-1&&s.splice(c+1,0,"."),o.sign+s.join("")}(e,r,t&&t).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw new Error('Unknown notation "'+i+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function y(e){var t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw new SyntaxError("Invalid number "+e);var r=t[1],n=t[2],i=parseFloat(t[4]||"0"),a=n.indexOf(".");i+=-1!==a?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,function(e){return i-=e.length,""}).replace(/0*$/,"").split("").map(function(e){return parseInt(e)});return 0===o.length&&(o.push(0),i++),{sign:r,coefficients:o,exponent:i}}function g(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=y(e),n="number"==typeof t?x(r,r.exponent+1+t):r,i=n.coefficients,a=n.exponent+1,o=a+(t||0);return i.length<o&&(i=i.concat(b(o-i.length))),a<0&&(i=b(1-a).concat(i),a=1),a<i.length&&i.splice(a,0,0===a?"0.":"."),n.sign+i.join("")}function v(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=y(e),n=t?x(r,t):r,i=n.coefficients,a=n.exponent;i.length<t&&(i=i.concat(b(t-i.length)));var o=i.shift();return n.sign+o+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function x(e,t){for(var r={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=r.coefficients;t<=0;)n.unshift(0),r.exponent++,t++;if(n.length>t&&n.splice(t,n.length-t)[0]>=5){var i=t-1;for(n[i]++;10===n[i];)n.pop(),0===i&&(n.unshift(0),r.exponent++,i++),n[--i]++}return r}function b(e){for(var t=[],r=0;r<e;r++)t.push(0);return t}var w=Number.EPSILON||2220446049250313e-31;function N(e,t,r){if(null==r)return e===t;if(e===t)return!0;
1if(isNaN(e)||isNaN(t))return!1;if(isFinite(e)&&isFinite(t)){var n=Math.abs(e-t);return n<w||n<=Math.max(Math.abs(e),Math.abs(t))*r}return!1}var M=Math.acosh||function(e){return Math.log(Math.sqrt(e*e-1)+e)},S=Math.asinh||function(e){return Math.log(Math.sqrt(e*e+1)+e)},E=Math.atanh||function(e){return Math.log((1+e)/(1-e))/2},A=Math.cosh||function(e){return(Math.exp(e)+Math.exp(-e))/2},O=Math.sinh||function(e){return(Math.exp(e)-Math.exp(-e))/2},C=Math.tanh||function(e){var t=Math.exp(2*e);return(t-1)/(t+1)};function _(e,t,r){var n=new(0,e.constructor)(2),i="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!s(r))throw new Error("size must be an integer");if(e.greaterThan(n.pow(r-1).sub(1))||e.lessThan(n.pow(r-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!e.isInteger())throw new Error("Value must be an integer");e.lessThan(0)&&(e=e.add(n.pow(r))),i="i".concat(r)}switch(t){case 2:return"".concat(e.toBinary()).concat(i);case 8:return"".concat(e.toOctal()).concat(i);case 16:return"".concat(e.toHexadecimal()).concat(i);default:throw new Error("Base ".concat(t," not supported "))}}function T(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function B(e,t){var r=e.length-t.length,n=e.length;return e.substring(r,n)===t}function z(e,t){var r=function(e,t){return"number"==typeof e?h(e,t):(0,o.C4)(e)?function(e,t){if("function"==typeof t)return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var r,n,i="auto";if(void 0!==t&&(t.notation&&(i=t.notation),"number"==typeof t?r=t:t.precision&&(r=t.precision),t.wordSize&&"number"!=typeof(n=t.wordSize)))throw new Error('Option "wordSize" must be a number');switch(i){case"fixed":return function(e,t){return e.toFixed(t)}(e,r);case"exponential":return T(e,r);case"engineering":return function(e,t){var r=e.e,n=r%3==0?r:r<0?r-3-r%3:r-r%3,i=e.mul(Math.pow(10,-n)),a=i.toPrecision(t);return-1!==a.indexOf("e")&&(a=i.toString()),a+"e"+(r>=0?"+":"")+n.toString()}(e,r);case"bin":return _(e,2,n);case"oct":return _(e,8,n);case"hex":return _(e,16,n);case"auto":var a=t&&void 0!==t.lowerExp?t.lowerExp:-3,o=t&&void 0!==t.upperExp?t.upperExp:5;if(e.isZero())return"0";var s=e.toSignificantDigits(r),u=s.e;return(u>=a&&u<o?s.toFixed():T(e,r)).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw new Error('Unknown notation "'+i+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(e,t):function(e){return e&&"object"==typeof e&&"number"==typeof e.s&&"number"==typeof e.n&&"number"==typeof e.d||!1}(e)?t&&"decimal"===t.fraction?e.toString():e.s*e.n+"/"+e.d:Array.isArray(e)?I(e,t):(0,o.Kg)(e)?'"'+e+'"':"function"==typeof e?e.syntax?String(e.syntax):"function":e&&"object"==typeof e?"function"==typeof e.format?e.format(t):e&&e.toString(t)!=={}.toString()?e.toString(t):"{"+Object.keys(e).map(r=>'"'+r+'": '+z(e[r],t)).join(", ")+"}":String(e)}(e,t);return t&&"object"==typeof t&&"truncate"in t&&r.length>t.truncate?r.substring(0,t.truncate-3)+"...":r}function q(e){for(var t=String(e),r="",n=0;n<t.length;){var i=t.charAt(n);"\\"===i?(r+=i,n++,""!==(i=t.charAt(n))&&-1!=='"\\/bfnrtu'.indexOf(i)||(r+="\\"),r+=i):r+='"'===i?'\\"':i,n++}return'"'+r+'"'}function D(e){var t=String(e);return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function I(e,t){if(Array.isArray(e)){for(var r="[",n=e.length,i=0;i<n;i++)0!==i&&(r+=", "),r+=I(e[i],t);return r+"]"}return z(e,t)}function k(e,t){if(!(0,o.Kg)(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+(0,o.QP)(e)+", index: 0)");if(!(0,o.Kg)(t))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+(0,o.QP)(t)+", index: 1)");return e===t?0:e>t?1:-1}function R(e){var t=typeof e;if("number"===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 R(e)});if(e instanceof Date)return new Date(e.valueOf());if((0,o.C4)(e))return e;if(e instanceof RegExp)throw new TypeError("Cannot clone "+e);return function(e,t){var r={};for(var n in e)F(e,n)&&(r[n]=t(e[n]));return r}(e,R)}function U(e,t){for(var r in t)F(t,r)&&(e[r]=t[r]);return e}function P(e,t){var r,n,i;if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(n=0,i=e.length;n<i;n++)if(!P(e[n],t[n]))return!1;return!0}if("function"==typeof e)return e===t;if(e instanceof Object){if(Array.isArray(t)||!(t instanceof Object))return!1;for(r in e)if(!(r in t)||!P(e[r],t[r]))return!1;for(r in t)if(!(r in e))return!1;return!0}return e===t}function F(e,t){return e&&Object.hasOwnProperty.call(e,t)}function j(e,t,r,n){function i(n){var i=function(e,t){for(var r={},n=0;n<t.length;n++){var i=t[n],a=e[i];void 0!==a&&(r[i]=a)}return r}(n,t.map(L));return function(e,t,r){if(!t.filter(e=>!function(e){return e&&"?"===e[0]}(e)).every(e=>void 0!==r[e])){var n=t.filter(e=>void 0===r[e]);throw new Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(n.map(e=>'"'.concat(e,'"')).join(", "),"."))}}
1(e,t,n),r(i)}return i.isFactory=!0,i.fn=e,i.dependencies=t.slice().sort(),n&&(i.meta=n),i}function L(e){return e&&"?"===e[0]?e.slice(1):e}var $=j("Chain",["?on","math"],e=>{var{on:t,math:r}=e;function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");(0,o.o_)(e)?this.value=e.value:this.value=e}function i(e,t){var r,i,o,s,u;r=n.prototype,i=e,o=function(){var e=t();if("function"==typeof e)return a(e)},u=!0,Object.defineProperty(r,i,{get:function(){return u&&(s=o(),u=!1),s},set:function(e){s=e,u=!1},configurable:!0,enumerable:!0})}function a(e){return function(){for(var t=[this.value],r=0;r<arguments.length;r++)t[r+1]=arguments[r];return new n(e.apply(e,t))}}n.prototype.type="Chain",n.prototype.isChain=!0,n.prototype.done=function(){return this.value},n.prototype.valueOf=function(){return this.value},n.prototype.toString=function(){return z(this.value)},n.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},n.fromJSON=function(e){return new n(e.value)},n.createProxy=function(e,t){if("string"==typeof e)u=e,"function"==typeof(c=t)&&(n.prototype[u]=a(c));else{var r=function(t){F(e,t)&&void 0===s[t]&&i(t,()=>e[t])};for(var o in e)r(o)}var u,c};var s={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return n.createProxy(r),t&&t("import",function(e,t,r){r||i(e,t)}),n},{isClass:!0}),H=new Set(["end"]);function G(e,t){if(J(e)&&Z(e,t))return e[t];if("function"==typeof e[t]&&W(e,t))throw new Error('Cannot access method "'+t+'" as a property');throw new Error('No access to property "'+t+'"')}function V(e,t,r){if(J(e)&&Z(e,t))return e[t]=r,r;throw new Error('No access to property "'+t+'"')}function Z(e,t){return!(!e||"object"!=typeof e||!F(Y,t)&&(t in Object.prototype||t in Function.prototype))}function W(e,t){return!(null==e||"function"!=typeof e[t]||F(e,t)&&Object.getPrototypeOf&&t in Object.getPrototypeOf(e)||!F(Q,t)&&(t in Object.prototype||t in Function.prototype))}function J(e){return"object"==typeof e&&e&&e.constructor===Object}var Y={length:!0,name:!0},Q={toString:!0,valueOf:!0,toLocaleString:!0};class X{constructor(e){this.wrappedObject=e}keys(){return Object.keys(this.wrappedObject)}get(e){return G(this.wrappedObject,e)}set(e,t){return V(this.wrappedObject,e,t),this}has(e){return e in this.wrappedObject}}function K(){return new Map}function ee(e){if(!e)return K();if(te(e))return e;if((0,o.Gv)(e))return new X(e);throw new Error("createMap can create maps from objects or Maps")}function te(e){return!!e&&(e instanceof Map||e instanceof X||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}function re(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var i of r)if(i)if(te(i))for(var a of i.keys())e.set(a,i.get(a));else if((0,o.Gv)(i))for(var s of Object.keys(i))e.set(s,i[s]);return e}var ne=j("Node",["mathWithTransform"],e=>{var{mathWithTransform:t}=e;function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator")}return r.prototype.evaluate=function(e){return this.compile().evaluate(e)},r.prototype.type="Node",r.prototype.isNode=!0,r.prototype.comment="",r.prototype.compile=function(){var e=this._compile(t,{}),r={};return{evaluate:function(t){var n=ee(t);return function(e){for(var t of[...H])if(e.has(t))throw new Error('Scope contains an illegal symbol, "'+t+'" is a reserved keyword')}(n),e(n,r,null)}}},r.prototype._compile=function(e,t){throw new Error("Method _compile should be implemented by type "+this.type)},r.prototype.forEach=function(e){throw new Error("Cannot run forEach on a Node interface")},r.prototype.map=function(e){throw new Error("Cannot run map on a Node interface")},r.prototype._ifNode=function(e){if(!(0,o.Ll)(e))throw new TypeError("Callback function must return a Node");return e},r.prototype.traverse=function(e){e(this,null,null),function e(t,r){t.forEach(function(t,n,i){r(t,n,i),e(t,r)})}(this,e)},r.prototype.transform=function(e){return function t(r,n,i){var a=e(r,n,i);return a!==r?a:r.map(t)}(this,null,null)},r.prototype.filter=function(e){var t=[];
1return this.traverse(function(r,n,i){e(r,n,i)&&t.push(r)}),t},r.prototype.clone=function(){throw new Error("Cannot clone a Node interface")},r.prototype.cloneDeep=function(){return this.map(function(e){return e.cloneDeep()})},r.prototype.equals=function(e){return!!e&&P(this,e)},r.prototype.toString=function(e){var t=this._getCustomString(e);return void 0!==t?t:this._toString(e)},r.prototype.toJSON=function(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)},r.prototype.toHTML=function(e){var t=this._getCustomString(e);return void 0!==t?t:this.toHTML(e)},r.prototype._toString=function(){throw new Error("_toString not implemented for "+this.type)},r.prototype.toTex=function(e){var t=this._getCustomString(e);return void 0!==t?t:this._toTex(e)},r.prototype._toTex=function(e){throw new Error("_toTex not implemented for "+this.type)},r.prototype._getCustomString=function(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")}},r.prototype.getIdentifier=function(){return this.type},r.prototype.getContent=function(){return this},r},{isClass:!0,isNode:!0}),ie=j("ObjectNode",["Node"],e=>{var{Node:t}=e;function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(this.properties=e||{},e&&("object"!=typeof e||!Object.keys(e).every(function(t){return(0,o.Ll)(e[t])})))throw new TypeError("Object containing Nodes expected")}return r.prototype=new t,r.prototype.type="ObjectNode",r.prototype.isObjectNode=!0,r.prototype._compile=function(e,t){var r={};for(var n in this.properties)if(F(this.properties,n)){var i=q(n),a=JSON.parse(i);if(!Z(this.properties,a))throw new Error('No access to property "'+a+'"');r[a]=this.properties[n]._compile(e,t)}return function(e,t,n){var i={};for(var a in r)F(r,a)&&(i[a]=r[a](e,t,n));return i}},r.prototype.forEach=function(e){for(var t in this.properties)F(this.properties,t)&&e(this.properties[t],"properties["+q(t)+"]",this)},r.prototype.map=function(e){var t={};for(var n in this.properties)F(this.properties,n)&&(t[n]=this._ifNode(e(this.properties[n],"properties["+q(n)+"]",this)));return new r(t)},r.prototype.clone=function(){var e={};for(var t in this.properties)F(this.properties,t)&&(e[t]=this.properties[t]);return new r(e)},r.prototype._toString=function(e){var t=[];for(var r in this.properties)F(this.properties,r)&&t.push(q(r)+": "+this.properties[r].toString(e));return"{"+t.join(", ")+"}"},r.prototype.toJSON=function(){return{mathjs:"ObjectNode",properties:this.properties}},r.fromJSON=function(e){return new r(e.properties)},r.prototype.toHTML=function(e){var t=[];for(var r in this.properties)F(this.properties,r)&&t.push('<span class="math-symbol math-property">'+D(r)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[r].toHTML(e));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'},r.prototype._toTex=function(e){var t=[];for(var r in this.properties)F(this.properties,r)&&t.push("\\mathbf{"+r+":} & "+this.properties[r].toTex(e)+"\\\\");return"\\left\\{\\begin{array}{ll}".concat(t.join("\n"),"\\end{array}\\right\\}")},r},{isClass:!0,isNode:!0});function ae(e,t,r){if(!(this instanceof ae))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=(new Error).stack}function oe(e,t,r){if(!(this instanceof oe))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=r),void 0!==this.min&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&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 se(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function ue(e,t,r){var n,i=e.length;if(i!==t[r])throw new ae(i,t[r]);if(r<t.length-1){var a=r+1;for(n=0;n<i;n++){var o=e[n];if(!Array.isArray(o))throw new ae(t.length-1,t.length,"<");ue(e[n],t,a)}}else for(n=0;n<i;n++)if(Array.isArray(e[n]))throw new ae(t.length+1,t.length,">")}function ce(e,t){if(0===t.length){if(Array.isArray(e))throw new ae(e.length,0)}else ue(e,t,0)}function le(e,t){if(!(0,o.Et)(e)||!s(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new oe(e,t)}function fe(e,t,r){if(!Array.isArray(e)||!Array.isArray(t))throw new TypeError("Array expected");if(0===t.length)throw new Error("Resizing to scalar is not supported");return t.forEach(function(e){if(!(0,o.Et)(e)||!s(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+z(t)+")")}),pe(e,t,0,void 0!==r?r:0),e}function pe(e,t,r,n){var i,a,o=e.length,s=t[r],u=Math.min(o,s);if(e.length=s,r<t.length-1){var c=r+1;for(i=0;i<u;i++)a=e[i],Array.isArray(a)||(a=[a],e[i]=a),pe(a,t,c,n);for(i=u;i<s;i++)a=[],e[i]=a,pe(a,t,c,n)}else{for(i=0;i<u;i++)for(;Array.isArray(e[i]);)e[i]=e[i][0];for(i=u;i<s;i++)e[i]=n}}function me(e,t){var r=be(e),n=r.length;if(!Array.isArray(e)||!Array.isArray(t))throw new TypeError("Array expected");if(0===t.length)throw new ae(0,n,"!=");var i=he(t=de(t,n));if(n!==i)throw new ae(i,n,"!=");try{return function(e,t){for(var r,n=e,i=t.length-1;i>0;i--){var a=t[i];r=[];for(var o=n.length/a,s=0;s<o;s++)r.push(n.slice(s*a,(s+1)*a));n=r}return n}(r,t)}catch(e){if(e instanceof ae)throw new ae(i,n,"!=");throw e}}function de(e,t){var r=he(e),n=e.slice(),i=e.indexOf(-1);if(e.indexOf(-1,i+1)>=0)throw new Error("More than one wildcard in sizes");if(i>=0){if(t%r!==0)throw new Error("Could not replace wildcard, since "+t+" is no multiple of "+-r);n[i]=-t/r}return n}function he(e){return e.reduce((e,t)=>
1e*t,1)}function ye(e,t){for(var r=t||se(e);Array.isArray(e)&&1===e.length;)e=e[0],r.shift();for(var n=r.length;1===r[n-1];)n--;return n<r.length&&(e=ge(e,n,0),r.length=n),e}function ge(e,t,r){var n,i;if(r<t){var a=r+1;for(n=0,i=e.length;n<i;n++)e[n]=ge(e[n],t,a)}else for(;Array.isArray(e);)e=e[0];return e}function ve(e,t,r,n){var i=n||se(e);if(r)for(var a=0;a<r;a++)e=[e],i.unshift(1);for(e=xe(e,t,0);i.length<t;)i.push(1);return e}function xe(e,t,r){var n,i;if(Array.isArray(e)){var a=r+1;for(n=0,i=e.length;n<i;n++)e[n]=xe(e[n],t,a)}else for(var o=r;o<t;o++)e=[e];return e}function be(e){if(!Array.isArray(e))return e;var t=[];return e.forEach(function e(r){Array.isArray(r)?r.forEach(e):t.push(r)}),t}function we(e,t){return Array.prototype.map.call(e,t)}function Ne(e,t){Array.prototype.forEach.call(e,t)}function Me(e,t){if(1!==se(e).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,t)}function Se(e,t){if(1!==se(e).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,e=>t.test(e))}function Ee(e,t){return Array.prototype.join.call(e,t)}function Ae(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;var t=[],r=0;t[0]={value:e[0],identifier:0};for(var n=1;n<e.length;n++)e[n]===e[n-1]?r++:r=0,t.push({value:e[n],identifier:r});return t}function Oe(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;for(var t=[],r=0;r<e.length;r++)t.push(e[r].value);return t}function Ce(e,t){for(var r,n=0,i=0;i<e.length;i++){var a=e[i],o=Array.isArray(a);if(0===i&&o&&(n=a.length),o&&a.length!==n)return;var s=o?Ce(a,t):t(a);if(void 0===r)r=s;else if(r!==s)return"mixed"}return r}ae.prototype=new RangeError,ae.prototype.constructor=RangeError,ae.prototype.name="DimensionError",ae.prototype.isDimensionError=!0,oe.prototype=new RangeError,oe.prototype.constructor=RangeError,oe.prototype.name="IndexError",oe.prototype.isIndexError=!0;var _e=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{associativity:"left",associativeWith:[]}},{"OperatorNode:and":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{associativity:"left",associativeWith:[]},"OperatorNode:unequal":{associativity:"left",associativeWith:[]},"OperatorNode:smaller":{associativity:"left",associativeWith:[]},"OperatorNode:larger":{associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{associativity:"left",associativeWith:[]}},{"OperatorNode:to":{associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{associativity:"left",associativeWith:[]},"OperatorNode:mod":{associativity:"left",associativeWith:[]}},{"OperatorNode:unaryPlus":{associativity:"right"},"OperatorNode:unaryMinus":{associativity:"right"},"OperatorNode:bitNot":{associativity:"right"},"OperatorNode:not":{associativity:"right"}},{"OperatorNode:pow":{associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{associativity:"left"}},{"OperatorNode:transpose":{associativity:"left"}}];function Te(e,t){var r=e;"keep"!==t&&(r=e.getContent());for(var n=r.getIdentifier(),i=0;i<_e.length;i++)if(n in _e[i])return i;return null}function Be(e,t){var r=e;"keep"!==t&&(r=e.getContent());var n=r.getIdentifier(),i=Te(r,t);if(null===i)return null;var a=_e[i][n];if(F(a,"associativity")){if("left"===a.associativity)return"left";if("right"===a.associativity)return"right";throw Error("'"+n+"' has the invalid associativity '"+a.associativity+"'.")}return null}function ze(e,t,r){var n="keep"!==r?e.getContent():e,i="keep"!==r?e.getContent():t,a=n.getIdentifier(),o=i.getIdentifier(),s=Te(n,r);if(null===s)return null;var u=_e[s][a];if(F(u,"associativeWith")&&u.associativeWith instanceof Array){for(var c=0;c<u.associativeWith.length;c++)if(u.associativeWith[c]===o)return!0;return!1}return null}var qe=r(43144),De={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{?}"},Ie={transpose:"^\\top",ctranspose:"^H",factorial:"!",pow:"^",dotPow:".^\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"\\~",not:"\\neg",multiply:"\\cdot",divi
1de:"\\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"},ke={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(Ie.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]}".concat(Ie.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(Ie.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(Ie.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(Ie.pow,"{${args[0]}}-1\\right)"),fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},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]}".concat(Ie.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(Ie.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)".concat(Ie.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]}".concat(Ie.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(Ie.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(Ie.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(Ie.bitAnd,"${args[1]}\\right)")},bitNot:{1:Ie.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(Ie.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(Ie.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(Ie.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(Ie.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(Ie.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]}".concat(Ie.and,"${args[1]}\\right)")},not:{1:Ie.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(Ie.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(Ie.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(Ie.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]}}".concat(Ie.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(Ie.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(Ie.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(Ie.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(Ie.larger,"${args[1]}\\right)")}
1,largerEq:{2:"\\left(${args[0]}".concat(Ie.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(Ie.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(Ie.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(Ie.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]}".concat(Ie.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)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(De.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)"}},Re={deg:"^\\circ"};function Ue(e){return qe(e,{preserveFormatting:!0})}function Pe(e,t){return(t=void 0!==t&&t)?F(Re,e)?Re[e]:"\\mathrm{"+Ue(e)+"}":F(De,e)?De[e]:Ue(e)}var Fe=j("OperatorNode",["Node"],e=>{var{Node:t}=e;function r(e,t,n,i,a){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof e)throw new TypeError('string expected for parameter "op"');if("string"!=typeof t)throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(n)||!n.every(o.Ll))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=!0===i,this.isPercentage=!0===a,this.op=e,this.fn=t,this.args=n||[]}function n(e,t,r,n,i){var a,o=Te(e,t),s=Be(e,t);if("all"===t||n.length>2&&"OperatorNode:add"!==e.getIdentifier()&&"OperatorNode:multiply"!==e.getIdentifier())return n.map(function(e){switch(e.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});switch(n.length){case 0:a=[];break;case 1:var u=Te(n[0],t);if(i&&null!==u){var c,l;if("keep"===t?(c=n[0].getIdentifier(),l=e.getIdentifier()):(c=n[0].getContent().getIdentifier(),l=e.getContent().getIdentifier()),!1===_e[o][l].latexLeftParens){a=[!1];break}if(!1===_e[u][c].latexParens){a=[!1];break}}if(null===u){a=[!1];break}if(u<=o){a=[!0];break}a=[!1];break;case 2:var f,p,m=Te(n[0],t),d=ze(e,n[0],t);f=null!==m&&(m===o&&"right"===s&&!d||m<o);var h,y,g,v=Te(n[1],t),x=ze(e,n[1],t);p=null!==v&&(v===o&&"left"===s&&!x||v<o),i&&("keep"===t?(h=e.getIdentifier(),y=e.args[0].getIdentifier(),g=e.args[1].getIdentifier()):(h=e.getContent().getIdentifier(),y=e.args[0].getContent().getIdentifier(),g=e.args[1].getContent().getIdentifier()),null!==m&&(!1===_e[o][h].latexLeftParens&&(f=!1),!1===_e[m][y].latexParens&&(f=!1)),null!==v&&(!1===_e[o][h].latexRightParens&&(p=!1),!1===_e[v][g].latexParens&&(p=!1))),a=[f,p];break;default:"OperatorNode:add"!==e.getIdentifier()&&"OperatorNode:multiply"!==e.getIdentifier()||(a=n.map(function(r){var n=Te(r,t),i=ze(e,r,t),a=Be(r,t);return null!==n&&(o===n&&s===a&&!i||n<o)}))}return n.length>=2&&"OperatorNode:multiply"===e.getIdentifier()&&e.implicit&&"auto"===t&&"hide"===r&&(a=n.map(function(e,t){var r="ParenthesisNode"===e.getIdentifier();return!(!a[t]&&!r)})),a}return r.prototype=new t,r.prototype.type="OperatorNode",r.prototype.isOperatorNode=!0,r.prototype._compile=function(e,t){if("string"!=typeof this.fn||!W(e,this.fn
1))throw e[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var r=G(e,this.fn),n=we(this.args,function(r){return r._compile(e,t)});if(1===n.length){var i=n[0];return function(e,t,n){return r(i(e,t,n))}}if(2===n.length){var a=n[0],o=n[1];return function(e,t,n){return r(a(e,t,n),o(e,t,n))}}return function(e,t,i){return r.apply(null,we(n,function(r){return r(e,t,i)}))}},r.prototype.forEach=function(e){for(var t=0;t<this.args.length;t++)e(this.args[t],"args["+t+"]",this)},r.prototype.map=function(e){for(var t=[],n=0;n<this.args.length;n++)t[n]=this._ifNode(e(this.args[n],"args["+n+"]",this));return new r(this.op,this.fn,t,this.implicit,this.isPercentage)},r.prototype.clone=function(){return new r(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)},r.prototype.isUnary=function(){return 1===this.args.length},r.prototype.isBinary=function(){return 2===this.args.length},r.prototype._toString=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=e&&e.implicit?e.implicit:"hide",i=this.args,a=n(this,t,r,i,!1);if(1===i.length){var o=Be(this,t),s=i[0].toString(e);a[0]&&(s="("+s+")");var u=/[a-zA-Z]+/.test(this.op);return"right"===o?this.op+(u?" ":"")+s:"left"===o?s+(u?" ":"")+this.op:s+this.op}if(2===i.length){var c=i[0].toString(e),l=i[1].toString(e);return a[0]&&(c="("+c+")"),a[1]&&(l="("+l+")"),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===r?c+" "+l:c+" "+this.op+" "+l}if(i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var f=i.map(function(t,r){return t=t.toString(e),a[r]&&(t="("+t+")"),t});return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===r?f.join(" "):f.join(" "+this.op+" ")}return this.fn+"("+this.args.join(", ")+")"},r.prototype.toJSON=function(){return{mathjs:"OperatorNode",op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}},r.fromJSON=function(e){return new r(e.op,e.fn,e.args,e.implicit,e.isPercentage)},r.prototype.toHTML=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=e&&e.implicit?e.implicit:"hide",i=this.args,a=n(this,t,r,i,!1);if(1===i.length){var o=Be(this,t),s=i[0].toHTML(e);return a[0]&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),"right"===o?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+D(this.op)+"</span>
1"+s:s+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+D(this.op)+"</span>"}if(2===i.length){var u=i[0].toHTML(e),c=i[1].toHTML(e);return a[0]&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>'),a[1]&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===r?u+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+c:u+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+D(this.op)+"</span>"+c}var l=i.map(function(t,r){return t=t.toHTML(e),a[r]&&(t='<span class="math-parenthesis math-round-parenthesis">(</span>'+t+'<span class="math-parenthesis math-round-parenthesis">)</span>'),t});return i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===r?l.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):l.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+D(this.op)+"</span>"):'<span class="math-function">'+D(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+l.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'},r.prototype._toTex=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=e&&e.implicit?e.implicit:"hide",i=this.args,a=n(this,t,r,i,!0),o=Ie[this.fn];if(o=void 0===o?this.op:o,1===i.length){var s=Be(this,t),u=i[0].toTex(e);return a[0]&&(u="\\left(".concat(u,"\\right)")),"right"===s?o+u:u+o}if(2===i.length){var c=i[0],l=c.toTex(e);a[0]&&(l="\\left(".concat(l,"\\right)"));var f,p=i[1].toTex(e);switch(a[1]&&(p="\\left(".concat(p,"\\right)")),f="keep"===t?c.getIdentifier():c.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return o+"{"+l+"}{"+p+"}";case"OperatorNode:pow":switch(l="{"+l+"}",p="{"+p+"}",f){case"ConditionalNode":case"OperatorNode:divide":l="\\left(".concat(l,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&"hide"===r)return l+"~"+p}return l+o+p}if(i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var m=i.map(function(t,r){return t=t.toTex(e),a[r]&&(t="\\left(".concat(t,"\\right)")),t});return"OperatorNode:multiply"===this.getIdentifier()&&this.implicit?m.join("~"):m.join(o)}return"\\mathrm{"+this.fn+"}\\left("+i.map(function(t){return t.toTex(e)}).join(",")+"\\right)"},r.prototype.getIdentifier=function(){return this.type+":"+this.fn},r},{isClass:!0,isNode:!0}),je=j("ParenthesisNode",["Node"],e=>{var{Node:t}=e;function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(!(0,o.Ll)(e))throw new TypeError('Node expected for parameter "content"');this.content=e}return r.prototype=new t,r.prototype.type="ParenthesisNode",r.prototype.isParenthesisNode=!0,r.prototype._compile=function(e,t){return this.content._compile(e,t)},r.prototype.getContent=function(){return this.content.getContent()},r.prototype.forEach=function(e){e(this.content,"content",this)},r.prototype.map=function(e){return new r(e(this.content,"content",this))},r.prototype.clone=function(){return new r(this.content)},r.prototype._toString=function(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"("+this.content.toString(e)+")":this.content.toString(e)},r.prototype.toJSON=function(){return{mathjs:"ParenthesisNode",content:this.content}},r.fromJSON=function(e){return new r(e.content)},r.prototype.toHTML=function(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(e)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(e)},r.prototype._toTex=function(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"\\left(".concat(this.content.toTex(e),"\\right)"):this.content.toTex(e)},r},{isClass:!0,isNode:!0}),Le=j("RelationalNode",["Node"],e=>{var{Node:t}=e;function r(e,t){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(!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}return r.prototype=new t,r.prototype.type="RelationalNode",r.prototype.isRelationalNode=!0,r.prototype._compile=function(e,t){var r=this,n=this.params.map(r=>r._compile(e,t));return function(t,i,a){for(var o,s=n[0](t,i,a),u=0;u<r.conditionals.length;
1u++)if(o=s,s=n[u+1](t,i,a),!G(e,r.conditionals[u])(o,s))return!1;return!0}},r.prototype.forEach=function(e){this.params.forEach((t,r)=>e(t,"params["+r+"]",this),this)},r.prototype.map=function(e){return new r(this.conditionals.slice(),this.params.map((t,r)=>this._ifNode(e(t,"params["+r+"]",this)),this))},r.prototype.clone=function(){return new r(this.conditionals,this.params)},r.prototype._toString=function(e){for(var t=e&&e.parenthesis?e.parenthesis:"keep",r=Te(this,t),n=this.params.map(function(n,i){var a=Te(n,t);return"all"===t||null!==a&&a<=r?"("+n.toString(e)+")":n.toString(e)}),i={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="},a=n[0],o=0;o<this.conditionals.length;o++)a+=" "+i[this.conditionals[o]]+" "+n[o+1];return a},r.prototype.toJSON=function(){return{mathjs:"RelationalNode",conditionals:this.conditionals,params:this.params}},r.fromJSON=function(e){return new r(e.conditionals,e.params)},r.prototype.toHTML=function(e){for(var t=e&&e.parenthesis?e.parenthesis:"keep",r=Te(this,t),n=this.params.map(function(n,i){var a=Te(n,t);return"all"===t||null!==a&&a<=r?'<span class="math-parenthesis math-round-parenthesis">(</span>'+n.toHTML(e)+'<span class="math-parenthesis math-round-parenthesis">)</span>':n.toHTML(e)}),i={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="},a=n[0],o=0;o<this.conditionals.length;o++)a+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+D(i[this.conditionals[o]])+"</span>"+n[o+1];return a},r.prototype._toTex=function(e){for(var t=e&&e.parenthesis?e.parenthesis:"keep",r=Te(this,t),n=this.params.map(function(n,i){var a=Te(n,t);return"all"===t||null!==a&&a<=r?"\\left("+n.toTex(e)+"\right)":n.toTex(e)}),i=n[0],a=0;a<this.conditionals.length;a++)i+=Ie[this.conditionals[a]]+n[a+1];return i},r},{isClass:!0,isNode:!0}),$e=j("ArrayNode",["Node"],e=>{var{Node:t}=e;function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(this.items=e||[],!Array.isArray(this.items)||!this.items.every(o.Ll))throw new TypeError("Array containing Nodes expected")}return r.prototype=new t,r.prototype.type="ArrayNode",r.prototype.isArrayNode=!0,r.prototype._compile=function(e,t){var r=we(this.items,function(r){return r._compile(e,t)});if("Array"!==e.config.matrix){var n=e.matrix;return function(e,t,i){return n(we(r,function(r){return r(e,t,i)}))}}return function(e,t,n){return we(r,function(r){return r(e,t,n)})}},r.prototype.forEach=function(e){for(var t=0;t<this.items.length;t++)e(this.items[t],"items["+t+"]",this)},r.prototype.map=function(e){for(var t=[],n=0;n<this.items.length;n++)t[n]=this._ifNode(e(this.items[n],"items["+n+"]",this));return new r(t)},r.prototype.clone=function(){return new r(this.items.slice(0))},r.prototype._toString=function(e){return"["+this.items.map(function(t){return t.toString(e)}).join(", ")+"]"},r.prototype.toJSON=function(){return{mathjs:"ArrayNode",items:this.items}},r.fromJSON=function(e){return new r(e.items)},r.prototype.toHTML=function(e){return'<span class="math-parenthesis math-square-parenthesis">[</span>'+this.items.map(function(t){return t.toHTML(e)}).join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'},r.prototype._toTex=function(e){return function t(r,n){var i=r.some(o.gO)&&!r.every(o.gO),a=n||i,s=a?"&":"\\\\",u=r.map(function(r){return r.items?t(r.items,!n):r.toTex(e)}).join(s);return i||!a||a&&!n?"\\begin{bmatrix}"+u+"\\end{bmatrix}":u}(this.items,!1)},r},{isClass:!0,isNode:!0}),He=j("BlockNode",["ResultSet","Node"],e=>{var{ResultSet:t,Node:r}=e;function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!Array.isArray(e))throw new Error("Array expected");this.blocks=e.map(function(e){var t=e&&e.node,r=!e||void 0===e.visible||e.visible;if(!(0,o.Ll)(t))throw new TypeError('Property "node" must be a Node');if("boolean"!=typeof r)throw new TypeError('Property "visible" must be a boolean');return{node:t,visible:r}})}return n.prototype=new r,n.prototype.type="BlockNode",n.prototype.isBlockNode=!0,n.prototype._compile=function(e,r){var n=we(this.blocks,function(t){return{evaluate:t.node._compile(e,r),visible:t.visible}});return function(e,r,i){var a=[];return Ne(n,function(t){var n=t.evaluate(e,r,i);t.visible&&a.push(n)}),new t(a)}},n.prototype.forEach=function(e){for(var t=0;t<this.blocks.length;t++)e(this.blocks[t].node,"blocks["+t+"].node",this)},n.prototype.map=function(e){for(var t=[],r=0;r<this.blocks.length;r++){var i=this.blocks[r],a=this._ifNode(e(i.node,"blocks["+r+"].node",this));t[r]={node:a,visible:i.visible}}return new n(t)},n.prototype.clone=function(){return new n(this.blocks.map(function(e){return{node:e.node,visible:e.visible}}))},n.prototype._toString=function(e){return this.blocks.map(function(t){return t.node.toString(e)+(t.visible?"":";")}).join("\n")},n.prototype.toJSON=function(){return{mathjs:"BlockNode",blocks:this.blocks}},n.fromJSON=function(e){return new n(e.blocks)},n.prototype.toHTML=function(e){return this.blocks.map(function(t){return t.node.toHTML(e)+(t.visible?"":'<span class="math-separator">;</span>')}).join('<span class="math-separator"><br /></span>')},n.prototype._toTex=function(e){return this.blocks.map(function(t){return t.node.toTex(e)+(t.visible?"":";")}).join("\\;\\;\n")},n},{isClass:!0,isNode:!0}),Ge=j("ConditionalNode",["Node"],e=>{var{Node:t}=e;function r(e,t,n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(!(0,o.Ll)(e))throw new TypeError("Parameter condition must be a Node");if(!(0,o.Ll)(t))throw new TypeError("Parameter trueExpr must be a Node");if(!(0,o.Ll)(n))throw new TypeError("Parameter falseExpr must be a Node");this.condition=e,this.trueExpr=t,this.falseExpr=n}return r.prototype=new t,r.prototype.type="ConditionalNode",r.prototype.isConditionalNode=!0,r.prototype._compile=function(e,t){var r=this.condition._c
1ompile(e,t),n=this.trueExpr._compile(e,t),i=this.falseExpr._compile(e,t);return function(e,t,a){return function(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return!!e;if(e){if((0,o.C4)(e))return!e.isZero();if((0,o.Zd)(e))return!(!e.re&&!e.im);if((0,o.vO)(e))return!!e.value}if(null==e)return!1;throw new TypeError('Unsupported type of condition "'+(0,o.QP)(e)+'"')}(r(e,t,a))?n(e,t,a):i(e,t,a)}},r.prototype.forEach=function(e){e(this.condition,"condition",this),e(this.trueExpr,"trueExpr",this),e(this.falseExpr,"falseExpr",this)},r.prototype.map=function(e){return new r(this._ifNode(e(this.condition,"condition",this)),this._ifNode(e(this.trueExpr,"trueExpr",this)),this._ifNode(e(this.falseExpr,"falseExpr",this)))},r.prototype.clone=function(){return new r(this.condition,this.trueExpr,this.falseExpr)},r.prototype._toString=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=Te(this,t),n=this.condition.toString(e),i=Te(this.condition,t);("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=r)&&(n="("+n+")");var a=this.trueExpr.toString(e),o=Te(this.trueExpr,t);("all"===t||"OperatorNode"===this.trueExpr.type||null!==o&&o<=r)&&(a="("+a+")");var s=this.falseExpr.toString(e),u=Te(this.falseExpr,t);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==u&&u<=r)&&(s="("+s+")"),n+" ? "+a+" : "+s},r.prototype.toJSON=function(){return{mathjs:"ConditionalNode",condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}},r.fromJSON=function(e){return new r(e.condition,e.trueExpr,e.falseExpr)},r.prototype.toHTML=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=Te(this,t),n=this.condition.toHTML(e),i=Te(this.condition,t);("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=r)&&(n='<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>');var a=this.trueExpr.toHTML(e),o=Te(this.trueExpr,t);("all"===t||"OperatorNode"===this.trueExpr.type||null!==o&&o<=r)&&(a='<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>');var s=this.falseExpr.toHTML(e),u=Te(this.falseExpr,t);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==u&&u<=r)&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),n+'<span class="math-operator math-conditional-operator">?</span>'+a+'<span class="math-operator math-conditional-operator">:</span>'+s},r.prototype._toTex=function(e){return"\\begin{cases} {"+this.trueExpr.toTex(e)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(e)+"}\\\\{"+this.falseExpr.toTex(e)+"}, &\\quad{\\text{otherwise}}\\end{cases}"},r},{isClass:!0,isNode:!0}),Ve=j("ConstantNode",["Node"],e=>{var{Node:t}=e;function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.value=e}return r.prototype=new t,r.prototype.type="ConstantNode",r.prototype.isConstantNode=!0,r.prototype._compile=function(e,t){var r=this.value;return function(){return r}},r.prototype.forEach=function(e){},r.prototype.map=function(e){return this.clone()},r.prototype.clone=function(){return new r(this.value)},r.prototype._toString=function(e){return z(this.value,e)},r.prototype.toHTML=function(e){var t=this._toString(e);switch((0,o.QP)(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+t+"</span>";case"string":return'<span class="math-string">'+t+"</span>";case"boolean":return'<span class="math-boolean">'+t+"</span>";case"null":return'<span class="math-null-symbol">'+t+"</span>";case"undefined":return'<span class="math-undefined">'+t+"</span>";default:return'<span class="math-symbol">'+t+"</span>"}},r.prototype.toJSON=function(){return{mathjs:"ConstantNode",value:this.value}},r.fromJSON=function(e){return new r(e.value)},r.prototype._toTex=function(e){var t=this._toString(e);switch((0,o.QP)(this.value)){case"string":return"\\mathtt{"+Ue(t)+"}";case"number":case"BigNumber":if(!isFinite(this.value))return this.value.valueOf()<0?"-\\infty":"\\infty";var r=t.toLowerCase().indexOf("e");return-1!==r?t.substring(0,r)+"\\cdot10^{"+t.substring(r+1)+"}":t;case"Fraction":return this.value.toLatex();default:return t}},r},{isClass:!0,isNode:!0}),Ze=j("RangeNode",["Node"],e=>{var{Node:t}=e;function r(e,t,n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(!(0,o.Ll)(e))throw new TypeError("Node expected");if(!(0,o.Ll)(t))throw new TypeError("Node expected");if(n&&!(0,o.Ll)(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}function n(e,t){var r=Te(e,t),n={},i=Te(e.start,t);if(n.start=null!==i&&i<=r||"all"===t,e.step){var a=Te(e.step,t);n.step=null!==a&&a<=r||"all"===t}var o=Te(e.end,t);return n.end=null!==o&&o<=r||"all"===t,n}return r.prototype=new t,r.prototype.type="RangeNode",r.prototype.isRangeNode=!0,r.prototype.needsEnd=function(){return this.filter(function(e){return(0,o.li)(e)&&"end"===e.name}).length>0},r.prototype._compile=function(e,t){var r=e.range,n=this.start._compile(e,t),i=this.end._compile(e,t);if(this.step){var a=this.step._compile(e,t);return function(e,t,o){return r(n(e,t,o),i(e,t,o),a(e,t,o))}}return function(e,t,a){return r(n(e,t,a),i(e,t,a))}},r.prototype.forEach=function(e){e(this.start,"start",this),e(this.end,"end",this),this.step&&e(this.step,"step",this)},r.prototype.map=function(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)))},r.prototype.clone=function(){return new r(this.start,this.end,this.step&&this.step)},r.prototype._toString=function(e){var t,r=n(this,e&&e.parenthesis?e.parenthesis:"keep"),i=this.start.toString(e);if(r.start&&(i="("+i+")"),t=i,this.step){var a=this.step.toString(e);r.step&&(a="("+a+")"),t+=":"+a}var o=this.end.toString(e);return r.end&&(o="("+o+")"),t+":"+o},r.prototype.toJSON=function(){return{mathjs:"RangeNode",start:this.start,end:this.end,step:this.step}},r.fromJSON=function(e){return new r(e.start,e.end,e.step)},r.prototype.toHTML=function(e){var t,r=n(this,e&&e.parenthesis?e.parenthesis:"keep"),i=this.start.toHTML(e);if(r.start&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>'),t=i,this.step){var a=this.step.toHTML(e);
1r.step&&(a='<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>'),t+='<span class="math-operator math-range-operator">:</span>'+a}var o=this.end.toHTML(e);return r.end&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>'),t+'<span class="math-operator math-range-operator">:</span>'+o},r.prototype._toTex=function(e){var t=n(this,e&&e.parenthesis?e.parenthesis:"keep"),r=this.start.toTex(e);if(t.start&&(r="\\left(".concat(r,"\\right)")),this.step){var i=this.step.toTex(e);t.step&&(i="\\left(".concat(i,"\\right)")),r+=":"+i}var a=this.end.toTex(e);return t.end&&(a="\\left(".concat(a,"\\right)")),r+":"+a},r},{isClass:!0,isNode:!0}),We=j("reviver",["classes"],e=>{var{classes:t}=e;return function(e,r){var n=t[r&&r.mathjs];return n&&"function"==typeof n.fromJSON?n.fromJSON(r):r}}),Je="chain",Ye=j(Je,["typed","Chain"],e=>{var{typed:t,Chain:r}=e;return t(Je,{"":function(){return new r},any:function(e){return new r(e)}})}),Qe=j("FunctionAssignmentNode",["typed","Node"],e=>{var{typed:t,Node:r}=e;function n(e,t,r){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof e)throw new TypeError('String expected for parameter "name"');
1if(!Array.isArray(t))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!(0,o.Ll)(r))throw new TypeError('Node expected for parameter "expr"');if(H.has(e))throw new Error('Illegal function name, "'+e+'" is a reserved keyword');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=r}function i(e,t){var r=Te(e,t),n=Te(e.expr,t);return"all"===t||null!==n&&n<=r}return n.prototype=new r,n.prototype.type="FunctionAssignmentNode",n.prototype.isFunctionAssignmentNode=!0,n.prototype._compile=function(e,r){var n=Object.create(r);Ne(this.params,function(e){n[e]=!0});var i=this.expr._compile(e,n),a=this.name,o=this.params,s=Ee(this.types,","),u=a+"("+Ee(this.params,", ")+")";return function(e,r,n){var c={};c[s]=function(){for(var t=Object.create(r),a=0;a<o.length;a++)t[o[a]]=arguments[a];return i(e,t,n)};var l=t(a,c);return l.syntax=u,e.set(a,l),l}},n.prototype.forEach=function(e){e(this.expr,"expr",this)},n.prototype.map=function(e){var t=this._ifNode(e(this.expr,"expr",this));return new n(this.name,this.params.slice(0),t)},n.prototype.clone=function(){return new n(this.name,this.params.slice(0),this.expr)},n.prototype._toString=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=this.expr.toString(e);return i(this,t)&&(r="("+r+")"),this.name+"("+this.params.join(", ")+") = "+r},n.prototype.toJSON=function(){var e=this.types;return{mathjs:"FunctionAssignmentNode",name:this.name,params:this.params.map(function(t,r){return{name:t,type:e[r]}}),expr:this.expr}},n.fromJSON=function(e){return new n(e.name,e.params,e.expr)},n.prototype.toHTML=function(e){for(var t=e&&e.parenthesis?e.parenthesis:"keep",r=[],n=0;n<this.params.length;n++)r.push('<span class="math-symbol math-parameter">'+D(this.params[n])+"</span>");var a=this.expr.toHTML(e);return i(this,t)&&(a='<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+D(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+r.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-round-parenthesis">)</span><span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+a},n.prototype._toTex=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=this.expr.toTex(e);return i(this,t)&&(r="\\left(".concat(r,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(Pe).join(",")+"\\right):="+r},n},{isClass:!0,isNode:!0});function Xe(e){return e&&e.isIndexError?new oe(e.index+1,e.min+1,void 0!==e.max?e.max+1:void 0):e}function Ke(e){var{subset:t}=e;return function(e,r){try{if(Array.isArray(e))return t(e,r);if(e&&"function"==typeof e.subset)return e.subset(r);if("string"==typeof e)return t(e,r);if("object"==typeof e){if(!r.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return G(e,r.getObjectProperty())}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw Xe(e)}}}var et=j("AccessorNode",["subset","Node"],e=>{var{subset:t,Node:r}=e,n=Ke({subset:t});function i(e,t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(!(0,o.Ll)(e))throw new TypeError('Node expected for parameter "object"');if(!(0,o.$I)(t))throw new TypeError('IndexNode expected for parameter "index"');this.object=e||null,this.index=t,Object.defineProperty(this,"name",{get:function(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}})}function a(e){return!((0,o.AS)(e)||(0,o.gO)(e)||(0,o.BA)(e)||(0,o.Px)(e)||(0,o.GJ)(e)||(0,o.tv)(e)||(0,o.li)(e))}return i.prototype=new r,i.prototype.type="AccessorNode",i.prototype.isAccessorNode=!0,i.prototype._compile=function(e,t){var r=this.object._compile(e,t),i=this.index._compile(e,t);if(this.index.isObjectProperty()){var a=this.index.getObjectProperty();return function(e,t,n){return G(r(e,t,n),a)}}return function(e,t,a){var o=r(e,t,a),s=i(e,t,o);return n(o,s)}},i.prototype.forEach=function(e){e(this.object,"object",this),e(this.index,"index",this)},i.prototype.map=function(e){return new i(this._ifNode(e(this.object,"object",this)),this._ifNode(e(this.index,"index",this)))},i.prototype.clone=function(){return new i(this.object,this.index)},i.prototype._toString=function(e){var t=this.object.toString(e);return a(this.object)&&(t="("+t+")"),t+this.index.toString(e)},i.prototype.toHTML=function(e){var t=this.object.toHTML(e);return a(this.object)&&(t='<span class="math-parenthesis math-round-parenthesis">(</span>'+t+'<span class="math-parenthesis math-round-parenthesis">)</span>'),t+this.index.toHTML(e)},i.prototype._toTex=function(e){var t=this.object.toTex(e);return a(this.object)&&(t="\\left(' + object + '\\right)"),t+this.index.toTex(e)},i.prototype.toJSON=function(){return{mathjs:"AccessorNode",object:this.object,index:this.index}},i.fromJSON=function(e){return new i(e.object,e.index)},i},{isClass:!0,isNode:!0}),tt=j("AssignmentNode",["subset","?matrix","Node"],e=>{var{subset:t,matrix:r,Node:n}=e,i=Ke({subset:t}),a=function(e){var{subset:t,matrix:r}=e;return function(e,n,i){try{if(Array.isArray(e))return r(e).subset(n,i).valueOf();if(e&&"function"==typeof e.subset)return e.subset(n,i);if("string"==typeof e)return t(e,n,i);if("object"==typeof e){if(!n.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return V(e,n.getObjectProperty(),i),e}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw Xe(e)}}}({subset:t,matrix:r});function s(e,t,r){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");if(this.object=e,this.index=r?t:null,this.value=r||t,!(0,o.li)(e)&&!(0,o.AS)(e))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if((0,o.li)(e)&&"end"===e.name)throw new Error('Cannot assign to symbol "end"');if(this.index&&!(0,o.$I)(this.index))throw new TypeError('IndexNode expected as "index"');if(!(0,o.Ll)(this.value))throw new TypeError('Node expected as "value"');Object.defineProperty(this,"name",{get:function(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}})}function u(e,t){t||(t="keep");var r=Te(e,t),n=Te(e.value,t);return"all"===t||null!==n&&n<=r}return s.prototype=new n,s.prototype.type="AssignmentNode",s.prototype.isAssignmentNode=!0,s.prototype._compile=function(e,t){var r=this.object._compile(e,t),n=this.index?this.index._compile(e,t):null,s=this.value._compile(e,t),u=this.object.name;if(this.index){if(this.index.isObjectProperty()){var c=this.index.getObjectProperty();return function(e,t,n){var i=r(e,t,n),a=s(e,t,n);return V(i,c,a),a}}if((0,o.li)(this.object))return function(e,t,i){var o=r(e,t,i),c=s(e,t,i),l=n(e,t,o);return e.set(u,a(o,l,c)),c};var l=this.object.object._compile(e,t);if(this.object.index.isObjectProperty()){var f=this.object.index.getObjectProperty();return function(e,t,r){var i=l(e,t,r),o=G(i,f),u=n(e,t,o),c=s(e,t,r);return V(i,f,a(o,u,c)),c}}var p=this.object.index._compile(e,t);return function(e,t,r){var o=l(e,t,r),u=p(e,t,o),c=i(o,u),f=n(e,t,c),m=s(e,t,r);return a(o,u,a(c,f,m)),m}}if(!(0,o.li)(this.object))throw new TypeError("SymbolNode expected as object");return function(e,t,r){var n=s(e,t,r);return e.set(u,n),n}},s.prototype.forEach=function(e){e(this.object,"object",this),this.index&&e(this.index,"index",this),e(this.value,"value",this)},s.prototype.map=function(e){return new s(this._ifNode(e(this.object,"object",this)),this.index?this._ifNode(e(this.index,"index",this)):null,this._ifNode(e(this.value,"value",this)))},s.prototype.clone=function(){return new s(this.object,this.index,this.value)},s.prototype._toString=function(e){var t=this.object.toString(e),r=this.index?this.index.toString(e):"",n=this.value.toString(e);return u(this,e&&e.parenthesis)&&(n="("+n+")"),t+r+" = "+n},s.prototype.toJSON=function(){return{mathjs:"AssignmentNode",object:this.object,index:this.index,value:this.value}},s.fromJSON=function(e){return new s(e.object,e.index,e.value)},s.prototype.toHTML=function(e){var t=this.object.toHTML(e),r=this.index?this.index.toHTML(e):"",n=this.value.toHTML(e);return u(this,e&&e.parenthesis)&&(n='<span class="math-paranthesis math-round-parenthesis">(</span>'+n+'<span class="math-paranthesis math-round-parenthesis">)</span>'),t+r+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+n},s.prototype._toTex=function(e){var t=this.object.toTex(e),r=this.index?this.index.toTex(e):"",n=this.value.toTex(e);return u(this,e&&e.parenthesis)&&(n="\\left(".concat(n,"\\right)")),t+r+":="+n},s},{isClass:!0,isNode:!0}),rt=j("IndexNode",["Node","size"],e=>{var{Node:t,size:r}=e;function n(e,t){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(this.dimensions=e,this.dotNotation=t||!1,!Array.isArray(e)||!e.every(o.Ll))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}return n.prototype=new t,n.prototype.type="IndexNode",n.prototype.isIndexNode=!0,n.prototype._compile=function(e,t){var n=we(this.dimensions,function(n,i){if
1(n.filter(e=>e.isSymbolNode&&"end"===e.name).length>0){var a=Object.create(t);a.end=!0;var s=n._compile(e,a);return function(e,t,n){if(!(0,o.OA)(n)&&!(0,o.cy)(n)&&!(0,o.Kg)(n))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+(0,o.QP)(n));var a=r(n).valueOf(),u=Object.create(t);return u.end=a[i],s(e,u,n)}}return n._compile(e,t)}),i=G(e,"index");return function(e,t,r){var a=we(n,function(n){return n(e,t,r)});return i(...a)}},n.prototype.forEach=function(e){for(var t=0;t<this.dimensions.length;t++)e(this.dimensions[t],"dimensions["+t+"]",this)},n.prototype.map=function(e){for(var t=[],r=0;r<this.dimensions.length;r++)t[r]=this._ifNode(e(this.dimensions[r],"dimensions["+r+"]",this));return new n(t,this.dotNotation)},n.prototype.clone=function(){return new n(this.dimensions.slice(0),this.dotNotation)},n.prototype.isObjectProperty=function(){return 1===this.dimensions.length&&(0,o.BA)(this.dimensions[0])&&"string"==typeof this.dimensions[0].value},n.prototype.getObjectProperty=function(){return this.isObjectProperty()?this.dimensions[0].value:null},n.prototype._toString=function(e){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"},n.prototype.toJSON=function(){return{mathjs:"IndexNode",dimensions:this.dimensions,dotNotation:this.dotNotation}},n.fromJSON=function(e){return new n(e.dimensions,e.dotNotation)},n.prototype.toHTML=function(e){for(var t=[],r=0;r<this.dimensions.length;r++)t[r]=this.dimensions[r].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+D(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'},n.prototype._toTex=function(e){var t=this.dimensions.map(function(t){return t.toTex(e)});return this.dotNotation?"."+this.getObjectProperty():"_{"+t.join(",")+"}"},n},{isClass:!0,isNode:!0}),nt=j("SymbolNode",["math","?Unit","Node"],e=>{var{math:t,Unit:r,Node:n}=e;function i(e){return!!r&&r.isValuelessUnit(e)}function a(e){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof e)throw new TypeError('String expected for parameter "name"');this.name=e}return a.prototype=new n,a.prototype.type="SymbolNode",a.prototype.isSymbolNode=!0,a.prototype._compile=function(e,t){var n=this.name;if(!0===t[n])return function(e,t,r){return t[n]};if(n in e)return function(t,r,i){return t.has(n)?t.get(n):G(e,n)};var o=i(n);return function(e,t,i){return e.has(n)?e.get(n):o?new r(null,n):a.onUndefinedSymbol(n)}},a.prototype.forEach=function(e){},a.prototype.map=function(e){return this.clone()},a.onUndefinedSymbol=function(e){throw new Error("Undefined symbol "+e)},a.prototype.clone=function(){return new a(this.name)},a.prototype._toString=function(e){return this.name},a.prototype.toHTML=function(e){var t=D(this.name);return"true"===t||"false"===t?'<span class="math-symbol math-boolean">'+t+"</span>":"i"===t?'<span class="math-symbol math-imaginary-symbol">'+t+"</span>":"Infinity"===t?'<span class="math-symbol math-infinity-symbol">'+t+"</span>":"NaN"===t?'<span class="math-symbol math-nan-symbol">'+t+"</span>":"null"===t?'<span class="math-symbol math-null-symbol">'+t+"</span>":"undefined"===t?'<span class="math-symbol math-undefined-symbol">'+t+"</span>":'<span class="math-symbol">'+t+"</span>"},a.prototype.toJSON=function(){return{mathjs:"SymbolNode",name:this.name}},a.fromJSON=function(e){return new a(e.name)},a.prototype._toTex=function(e){var r=!1;void 0===t[this.name]&&i(this.name)&&(r=!0);var n=Pe(this.name,r);return"\\"===n[0]?n:" "+n},a},{isClass:!0,isNode:!0});function it(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return"function"==typeof e.createSubScope?re(e.createSubScope(),...r):re(K(),e,...r)}var at=j("FunctionNode",["math","Node","SymbolNode"],e=>{var{math:t,Node:r,SymbolNode:n}=e;function i(e,t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if("string"==typeof e&&(e=new n(e)),!(0,o.Ll)(e))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(t)||!t.every(o.Ll))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=e,this.args=t||[],Object.defineProperty(this,"name",{get:function(){return this.fn.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}})}i.prototype=new r,i.prototype.type="FunctionNode",i.prototype.isFunctionNode=!0;var a=e=>z(e,{truncate:78});i.prototype._compile=function(e,t){if(!(this instanceof i))throw new TypeError("No valid FunctionNode");var r=this.args.map(r=>r._compile(e,t));if(!(0,o.li)(this.fn)){if((0,o.AS)(this.fn)&&(0,o.$I)(this.fn.index)&&this.fn.index.isObjectProperty()){var n=this.fn.object._compile(e,t),s=this.fn.index.getObjectProperty(),u=this.args;return function(t,i,a){var o=n(t,i,a);if(function(e,t){if(!W(e,t))throw new Error('No access to method "'+t+'"')}(o,s),o[s]&&o[s].rawArgs)return o[s](u,e,it(t,i),t);var c=r.map(e=>e(t,i,a));return o[s].apply(o,c)}}var c=this.fn.toString(),l=this.fn._compile(e,t),f=this.args;return function(t,n,i){var o=l(t,n,i);if("function"!=typeof o)throw new TypeError("Expression '".concat(c,"' did not evaluate to a function; value is:")+"\n  ".concat(a(o)));if(o.rawArgs)return o(f,e,it(t,n),t);var s=r.map(e=>e(t,n,i));return o.apply(o,s)}}var p=this.fn.name;if(t[p]){var m=this.args;return function(t,n,i){var o=n[p];if("function"!=typeof o)throw new TypeError("Argument '".concat(p,"' was not a function; received: ").concat(a(o)));if(o.rawArgs)return o(m,e,it(t,n),t);var s=r.map(e=>e(t,n,i));return o.apply(o,s)}}var d=p in e?G(e,p):void 0,h="function"==typeof d&&!0===d.rawArgs,y=t=>{var r;if(t.has(p))r=t.get(p);else{if(!(p in e))return i.onUndefinedFunction(p);r=G(e,p)}if("function"==typeof r)return r;throw new TypeError("'".concat(p,"' is not a function; its value is:\n  ").concat(a(r)))};if(h){var g=this.args;return function(t,r,n){return y(t)(g,e,it(t,r),t)}}switch(r.length){case 0:return function(e,t,r){return y(e)()};case 1:return function(e,t,n){return y(e)((0,r[0])(e,t,n))};case 2:return function(e,t,n){var i=y(e),a=r[0],o=r[1];
1return i(a(e,t,n),o(e,t,n))};default:return function(e,t,n){return y(e)(...r.map(r=>r(e,t,n)))}}},i.prototype.forEach=function(e){e(this.fn,"fn",this);for(var t=0;t<this.args.length;t++)e(this.args[t],"args["+t+"]",this)},i.prototype.map=function(e){for(var t=this._ifNode(e(this.fn,"fn",this)),r=[],n=0;n<this.args.length;n++)r[n]=this._ifNode(e(this.args[n],"args["+n+"]",this));return new i(t,r)},i.prototype.clone=function(){return new i(this.fn,this.args.slice(0))},i.onUndefinedFunction=function(e){throw new Error("Undefined function "+e)};var s=i.prototype.toString;function u(e,t,r){for(var n,i="",a=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,s=0;null!==(n=a.exec(e));)if(i+=e.substring(s,n.index),s=n.index,"$$"===n[0])i+="$",s++;else{s+=n[0].length;var u=t[n[1]];if(!u)throw new ReferenceError("Template: Property "+n[1]+" does not exist.");if(void 0===n[2])switch(typeof u){case"string":i+=u;break;case"object":if((0,o.Ll)(u))i+=u.toTex(r);else{if(!Array.isArray(u))throw new TypeError("Template: "+n[1]+" has to be a Node, String or array of Nodes");i+=u.map(function(e,t){if((0,o.Ll)(e))return e.toTex(r);throw new TypeError("Template: "+n[1]+"["+t+"] is not a Node.")}).join(",")}break;default:throw new TypeError("Template: "+n[1]+" has to be a Node, String or array of Nodes")}else{if(!(0,o.Ll)(u[n[2]]&&u[n[2]]))throw new TypeError("Template: "+n[1]+"["+n[2]+"] is not a Node.");i+=u[n[2]].toTex(r)}}return i+e.slice(s)}i.prototype.toString=function(e){var t,r=this.fn.toString(e);return e&&"object"==typeof e.handler&&F(e.handler,r)&&(t=e.handler[r](this,e)),void 0!==t?t:s.call(this,e)},i.prototype._toString=function(e){var t=this.args.map(function(t){return t.toString(e)});return((0,o.m2)(this.fn)?"("+this.fn.toString(e)+")":this.fn.toString(e))+"("+t.join(", ")+")"},i.prototype.toJSON=function(){return{mathjs:"FunctionNode",fn:this.fn,args:this.args}},i.fromJSON=function(e){return new i(e.fn,e.args)},i.prototype.toHTML=function(e){var t=this.args.map(function(t){return t.toHTML(e)});return'<span class="math-function">'+D(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'};var c=i.prototype.toTex;return i.prototype.toTex=function(e){var t;return e&&"object"==typeof e.handler&&F(e.handler,this.name)&&(t=e.handler[this.name](this,e)),void 0!==t?t:c.call(this,e)},i.prototype._toTex=function(e){var r,n,i=this.args.map(function(t){return t.toTex(e)});switch(ke[this.name]&&(r=ke[this.name]),!t[this.name]||"function"!=typeof t[this.name].toTex&&"object"!=typeof t[this.name].toTex&&"string"!=typeof t[this.name].toTex||(r=t[this.name].toTex),typeof r){case"function":n=r(this,e);break;case"string":n=u(r,this,e);break;case"object":switch(typeof r[i.length]){case"function":n=r[i.length](this,e);break;case"string":n=u(r[i.length],this,e)}}return void 0!==n?n:u("\\mathrm{${name}}\\left(${args}\\right)",this,e)},i.prototype.getIdentifier=function(){return this.type+":"+this.name},i},{isClass:!0,isNode:!0});function ot(e){var t,r,n=e.length,i=e[0].length,a=[];for(r=0;r<i;r++){var o=[];for(t=0;t<n;t++)o.push(e[t][r]);a.push(o)}return a}function st(e){for(var t=0;t<e.length;t++)if((0,o.P3)(e[t]))return!0;return!1}function ut(e,t){(0,o.OA)(e)&&(e=e.valueOf());for(var r=0,n=e.length;r<n;r++){var i=e[r];Array.isArray(i)?ut(i,t):t(i)}}function ct(e,t,r){return e&&"function"==typeof e.map?e.map(function(e){return ct(e,t,r)}):t(e)}function lt(e,t,r){var n=Array.isArray(e)?se(e):e.size();if(t<0||t>=n.length)throw new oe(t,n.length);return(0,o.OA)(e)?e.create(ft(e.valueOf(),t,r)):ft(e,t,r)}function ft(e,t,r){var n,i,a,o;if(t<=0){if(Array.isArray(e[0])){for(o=ot(e),i=[],n=0;n<o.length;n++)i[n]=ft(o[n],t-1,r);return i}for(a=e[0],n=1;n<e.length;n++)a=r(a,e[n]);return a}for(i=[],n=0;n<e.length;n++)i[n]=ft(e[n],t-1,r);return i}function pt(e,t,r,n,i,a,o,s,u,c,l){var f,p,m,d,h=e._values,y=e._index,g=e._ptr;if(n)for(p=g[t],m=g[t+1],f=p;f<m;f++)r[d=y[f]]!==a?(r[d]=a,o.push(d),c?(n[d]=u?s(h[f],l):s(l,h[f]),i[d]=a):n[d]=h[f]):(n[d]=u?s(h[f],n[d]):s(n[d],h[f]),i[d]=a);else for(p=g[t],m=g[t+1],f=p;f<m;f++)r[d=y[f]]!==a?(r[d]=a,o.push(d)):i[d]=a}var mt="parse",dt=j(mt,["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],e=>
1{var{typed:t,numeric:r,config:i,AccessorNode:a,ArrayNode:s,AssignmentNode:u,BlockNode:c,ConditionalNode:l,ConstantNode:f,FunctionAssignmentNode:p,FunctionNode:m,IndexNode:d,ObjectNode:h,OperatorNode:y,ParenthesisNode:g,RangeNode:v,RelationalNode:x,SymbolNode:b}=e,w=t(mt,{string:function(e){return R(e,{})},"Array | Matrix":function(e){return N(e,{})},"string, Object":function(e,t){return R(e,void 0!==t.nodes?t.nodes:{})},"Array | Matrix, Object":N});function N(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=void 0!==t.nodes?t.nodes:{};return ct(e,function(e){if("string"!=typeof e)throw new TypeError("String expected");return R(e,r)})}var M={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},S={",":!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},O=["NaN","Infinity"];function C(e,t){return e.expression.substr(e.index,t)}function _(e){return C(e,1)}function T(e){e.index++}function B(e){return e.expression.charAt(e.index-1)}function z(e){return e.expression.charAt(e.index+1)}function q(e){for(e.tokenType=M.NULL,e.token="",e.comment="";;){if("#"===_(e))for(;"\n"!==_(e)&&""!==_(e);)e.comment+=_(e),T(e);if(!w.isWhitespace(_(e),e.nestingLevel))break;T(e)}if(""!==_(e)){if("\n"===_(e)&&!e.nestingLevel)return e.tokenType=M.DELIMITER,e.token=_(e),void T(e);var t=_(e),r=C(e,2),n=C(e,3);if(3===n.length&&S[n])return e.tokenType=M.DELIMITER,e.token=n,T(e),T(e),void T(e);if(2===r.length&&S[r])return e.tokenType=M.DELIMITER,e.token=r,T(e),void T(e);if(S[t])return e.tokenType=M.DELIMITER,e.token=t,void T(e);if(w.isDigitDot(t)){e.tokenType=M.NUMBER;var i=C(e,2);if("0b"===i||"0o"===i||"0x"===i){for(e.token+=_(e),T(e),e.token+=_(e),T(e);w.isHexDigit(_(e));)e.token+=_(e),T(e);if("."===_(e))for(e.token+=".",T(e);w.isHexDigit(_(e));)e.token+=_(e),T(e);else if("i"===_(e))for(e.token+="i",T(e);w.isDigit(_(e));)e.token+=_(e),T(e);return}if("."===_(e)){if(e.token+=_(e),T(e),!w.isDigit(_(e)))return void(e.tokenType=M.DELIMITER)}else{for(;w.isDigit(_(e));)e.token+=_(e),T(e);w.isDecimalMark(_(e),z(e))&&(e.token+=_(e),T(e))}for(;w.isDigit(_(e));)e.token+=_(e),T(e);if("E"===_(e)||"e"===_(e))if(w.isDigit(z(e))||"-"===z(e)||"+"===z(e)){if(e.token+=_(e),T(e),"+"!==_(e)&&"-"!==_(e)||(e.token+=_(e),T(e)),!w.isDigit(_(e)))throw oe(e,'Digit expected, got "'+_(e)+'"');for(;w.isDigit(_(e));)e.token+=_(e),T(e);if(w.isDecimalMark(_(e),z(e)))throw oe(e,'Digit expected, got "'+_(e)+'"')}else if("."===z(e))throw T(e),oe(e,'Digit expected, got "'+_(e)+'"')}else{if(!w.isAlpha(_(e),B(e),z(e))){for(e.tokenType=M.UNKNOWN;""!==_(e);)e.token+=_(e),T(e);throw oe(e,'Syntax error in part "'+e.token+'"')}for(;w.isAlpha(_(e),B(e),z(e))||w.isDigit(_(e));)e.token+=_(e),T(e);F(E,e.token)?e.tokenType=M.DELIMITER:e.tokenType=M.SYMBOL}}else e.tokenType=M.DELIMITER}function D(e){do{q(e)}while("\n"===e.token)}function I(e){e.nestingLevel++}function k(e){e.nestingLevel--}function R(e,t){var r={extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:M.NULL,nestingLevel:0,conditionalLevel:null};n(r,{expression:e,extraNodes:t}),q(r);var i=function(e){var t,r,n=[];for(""!==e.token&&"\n"!==e.token&&";"!==e.token&&((t=U(e)).comment=e.comment);"\n"===e.token||";"===e.token;)0===n.length&&t&&(r=";"!==e.token,n.push({node:t,visible:r})),q(e),"\n"!==e.token&&";"!==e.token&&""!==e.token&&((t=U(e)).comment=e.comment,r=";"!==e.token,n.push({node:t,visible:r}));return n.length>0?new c(n):(t||((t=new f(void 0)).comment=e.comment),t)}(r);if(""!==r.token)throw r.tokenType===M.DELIMITER?se(r,"Unexpected operator "+r.token):oe(r,'Unexpected part "'+r.token+'"');return i}function U(e){var t,r,n,i,a=function(e){for(var t=function(e){for(var t=P(e);"or"===e.token;)D(e),t=new y("or","or",[t,P(e)]);return t}(e);"?"===e.token;){var r=e.conditionalLevel;e.conditionalLevel=e.nestingLevel,D(e);var n=t,i=U(e);if(":"!==e.token)throw oe(e,"False part of conditional expression expected");e.conditionalLevel=null,D(e);var a=U(e);t=new l(n,i,a),e.conditionalLevel=r}return t}(e);if("="===e.token){if((0,o.li)(a))return t=a.name,D(e),n=U(e),new u(new b(t),n);if((0,o.AS)(a))return D(e),n=U(e),new u(a.object,a.index,n);if((0,o.Px)(a)&&(0,o.li)(a.fn)&&(i=!0,r=[],t=a.name,a.args.forEac
1h(function(e,t){(0,o.li)(e)?r[t]=e.name:i=!1}),i))return D(e),n=U(e),new p(t,r,n);throw oe(e,"Invalid left hand side of assignment operator =")}return a}function P(e){for(var t=j(e);"xor"===e.token;)D(e),t=new y("xor","xor",[t,j(e)]);return t}function j(e){for(var t=L(e);"and"===e.token;)D(e),t=new y("and","and",[t,L(e)]);return t}function L(e){for(var t=$(e);"|"===e.token;)D(e),t=new y("|","bitOr",[t,$(e)]);return t}function $(e){for(var t=H(e);"^|"===e.token;)D(e),t=new y("^|","bitXor",[t,H(e)]);return t}function H(e){for(var t=G(e);"&"===e.token;)D(e),t=new y("&","bitAnd",[t,G(e)]);return t}function G(e){for(var t=[V(e)],r=[],n={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};F(n,e.token);){var i={name:e.token,fn:n[e.token]};r.push(i),D(e),t.push(V(e))}return 1===t.length?t[0]:2===t.length?new y(r[0].name,r[0].fn,t):new x(r.map(e=>e.fn),t)}function V(e){var t,r,n,i;t=Z(e);for(var a={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};F(a,e.token);)n=a[r=e.token],D(e),i=[t,Z(e)],t=new y(r,n,i);return t}function Z(e){var t,r,n,i;t=W(e);for(var a={to:"to",in:"to"};F(a,e.token);)n=a[r=e.token],D(e),"in"===r&&""===e.token?t=new y("*","multiply",[t,new b("in")],!0):(i=[t,W(e)],t=new y(r,n,i));return t}function W(e){var t,r=[];if(t=":"===e.token?new f(1):J(e),":"===e.token&&e.conditionalLevel!==e.nestingLevel){for(r.push(t);":"===e.token&&r.length<3;)D(e),")"===e.token||"]"===e.token||","===e.token||""===e.token?r.push(new b("end")):r.push(J(e));t=3===r.length?new v(r[0],r[2],r[1]):new v(r[0],r[1])}return t}function J(e){var t,r,n,i;t=Y(e);for(var a={"+":"add","-":"subtract"};F(a,e.token);){n=a[r=e.token],D(e);var o=Y(e);i=o.isPercentage?[t,new y("*","multiply",[t,o])]:[t,o],t=new y(r,n,i)}return t}function Y(e){var t,r,n,i;r=t=Q(e);for(var a={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};F(a,e.token);)i=a[n=e.token],D(e),r=Q(e),t=new y(n,i,[t,r]);return t}function Q(e){var t,r;for(r=t=X(e);e.tokenType===M.SYMBOL||"in"===e.token&&(0,o.BA)(t)||!(e.tokenType!==M.NUMBER||(0,o.BA)(r)||(0,o.$$)(r)&&"!"!==r.op)||"("===e.token;)r=X(e),t=new y("*","multiply",[t,r],!0);return t}function X(e){for(var t=K(e),r=t,i=[];"/"===e.token&&(0,o.BA)(r);){if(i.push(n({},e)),D(e),e.tokenType!==M.NUMBER){n(e,i.pop());break}if(i.push(n({},e)),D(e),e.tokenType!==M.SYMBOL&&"("!==e.token){i.pop(),n(e,i.pop());break}n(e,i.pop()),i.pop(),r=K(e),t=new y("/","divide",[t,r])}return t}function K(e){var t,r,n,i;t=ee(e);for(var a={"%":"mod",mod:"mod"};F(a,e.token);)n=a[r=e.token],D(e),"%"===r&&e.tokenType===M.DELIMITER&&"("!==e.token?t=new y("/","divide",[t,new f(100)],!1,!0):(i=[t,ee(e)],t=new y(r,n,i));return t}function ee(e){var t,n,a,o={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return F(o,e.token)?(a=o[e.token],t=e.token,D(e),n=[ee(e)],new y(t,a,n)):function(e){var t,n,a,o;return t=function(e){var t,n,a;t=function(e){var t=[];if(e.tokenType===M.SYMBOL&&F(e.extraNodes,e.token)){var n=e.extraNodes[e.token];if(q(e),"("===e.token){if(t=[],I(e),q(e),")"!==e.token)for(t.push(U(e));","===e.token;)q(e),t.push(U(e));if(")"!==e.token)throw oe(e,"Parenthesis ) expected");k(e),q(e)}return new n(t)}return function(e){var t;return e.tokenType===M.SYMBOL||e.tokenType===M.DELIMITER&&e.token in E?(t=e.token,q(e),te(e,F(A,t)?new f(A[t]):-1!==O.indexOf(t)?new f(r(t,"number")):new b(t))):function(e){var t;return'"'===e.token?(t=re(e),te(e,new f(t))):function(e){var t;return"'"===e.token?(t=ne(e),te(e,new f(t))):function(e){var t,n,a,o;if("["===e.token){if(I(e),q(e),"]"!==e.token){var u=ie(e);if(";"===e.token){for(a=1,n=[u];";"===e.token;)q(e),n[a]=ie(e),a++;if("]"!==e.token)throw oe(e,"End of matrix ] expected");k(e),q(e),o=n[0].items.length;for(var c=1;c<a;c++)if(n[c].items.length!==o)throw se(e,"Column dimensions mismatch ("+n[c].items.length+" !== "+o+")");t=new s(n)}else{if("]"!==e.token)throw oe(e,"End of matrix ] expected");k(e),q(e),t=u}}else k(e),q(e),t=new s([]);return te(e,t)}return function(e){if("{"===e.token){var t;I(e);var n={};do{if(q(e),"}"!==e.token){if('"'===e.token)t=re(e);else if("'"===e.token)t=ne(e);else{if(!(e.tokenType===M.SYMBOL||e.tokenType===M.DELIMITER&&e.token in E))throw oe(e,"Symbol or string expected as object key");t=e.token,q(e)}if(":"!==e.token)throw oe(e,"Colon : expected after object key");q(e),n[t]=U(e)}}while(","===e.token);if("}"!==e.token)throw oe(e,"Comma , or bracket } expected after object value");k(e),q(e);var a=new h(n);return te(e,a)}return function(e){var t;return e.tokenType===M.NUMBER?(t=e.token,q(e),new f(r(t,i.number))):function(e){var t;if("("===e.token){if(I(e),q(e),t=U(e),")"!==e.token)throw oe(e,"Parenthesis ) expected");return k(e),q(e),te(e,t=new g(t))}return function(e){throw""===e.token?oe(e,"Unexpected end of expression"):oe(e,"Value expected")}(e)}(e)}(e)}(e)}(e)}(e)}(e)}(e)}(e);for(var o={"!":"factorial","'":"ctranspose"};F(o,e.token);)a=o[n=e.token],q(e),t=te(e,t=new y(n,a,[t]));return t}(e),("^"===e.token||".^"===e.token)&&(a="^"===(n=e.token)?"pow":"dotPow",D(e),o=[t,ee(e)],t=new y(n,a,o)),t}(e)}function te(e,t,r){for(var n;!("("!==e.token&&"["!==e.token&&"."!==e.token||r&&-1===r.indexOf(e.token));)if(n=[],"("===e.token){if(!(0,o.li)(t)&&!(0,o.AS)(t))return t;if(I(e),q(e),")"!==e.token)for(n.push(U(e));","===e.token;)q(e),n.push(U(e));if(")"!==e.token)throw oe(e,"Parenthesis ) expected");k(e),q(e),t=new m(t,n)}else if("["===e.token){if(I(e),q(e),"]"!==e.token)for(n.push(U(e));","===e.token;)q(e),n.push(U(e));if("]"!==e.token)throw oe(e,"Parenthesis ] expected");k(e),q(e),t=new a(t,new d(n))}else{if(q(e),e.tokenType!==M.SYMBOL)throw oe(e,"Property name expected after dot");n.push(new f(e.token)),q(e),t=new a(t,new d(n,!0))}return t}function re(e){for(var t="";""!==_(e)&&'"'!==_(e);)"\\"===_(e)&&(t+=_(e),T(e)),t+=_(e),T(e);if(q(e),'"'!==e.token)throw oe(e,'End of string " expected');return q(e),JSON.parse('"'+t+'"')}function ne(e){for(var t="";""!==_(e)&&"'"!==_(e);)"\\"===_(e)&&(t+=_(e),T(e)),t+=_(e),T(e);if(q(e),"'"!==e.token)throw oe(e,"End of string ' expected");return q(e),JSON.parse('"'+t+'"')}function ie(e){for(var t=[U(e)],r=1;","===e.token;)q(e),t[r]=U(e),r++;return new s(t)}function ae(e){return e.index-e.token.length+1}function oe(e,t){var r=ae(e),n=new SyntaxError(t+" (char "+r+")");return n.char=r,n}function se(e,t){var r=ae(e),n=new SyntaxError(t+" (char "+r+")");return n.char=r,n}return w.isAlpha=function(e,t,r){return w.isValidLatinOrGreek(e)||w.isValidMathSymbol(e,r)||w.isValidMathSymbol(t,e)},w.isValidLatinOrGreek=function(e){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(e)},w.isValidMathSymbol=function(e,t){return/^[\uD835]$/.test(e)&&/^[\uDC00-\uDFFF]$/.test(t)&&/^[^\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(t)},w.isWhitespace=function(e,t){return" "===e||"\t"===e||"\n"===e&&t>0},w.isDecimalMark=function(e,t){return"."===e&&"/"!==t&&"*"!==t&&"^"!==t},w.isDigitDot=function(e){return e>="0"&&e<="9"||"."===e},w.isDigit=function(e){return e>="0"&&e<="9"},w.isHexDigit=function(e){return e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"},w}),ht=j("resolve",["parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],e=>{var{parse:t,ConstantNode:r,FunctionNode:n,OperatorNode:i,ParenthesisNode:a}=e;return function e(s,u){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;if(!u)return s;if(te(u)||(u=ee(u)),(0,o.li)(s)){if(c.has(s.name)){var l=Array.from(c).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(l,"}"))}var f=u.get(s.name);if((0,o.Ll)(f)){var p=new Set(c);return p.add(s.name),e(f,u,p)}return"number"==typeof f?t(String(f)):void 0!==f?new r(f):s}if((0,o.$$)(s)){var m=s.args.map(function(t){return e(t,u,c)});return new i(s.op,s.fn,m,s.implicit)}if((0,o.tv)(s))return new a(e(s.content,u,c));if((0,o.Px)(s)){var d=s.args.map(function(t){return e(t,u,c)});return new n(s.name,d)}return s.map(t=>e(t,u,c))}});function yt(e){return yt="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},yt(e)}function gt(e,t,r){return(t=function(e){var t=function(e){if("object"!=yt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=yt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==yt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function xt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};
1t%2?vt(Object(r),!0).forEach(function(t){gt(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var bt=j("simplifyUtil",["FunctionNode","OperatorNode","SymbolNode"],e=>{var{FunctionNode:t,OperatorNode:r,SymbolNode:n}=e,i=!0,a=!1,s="defaultF",u={add:{trivial:i,total:i,commutative:i,associative:i},unaryPlus:{trivial:i,total:i,commutative:i,associative:i},subtract:{trivial:a,total:i,commutative:a,associative:a},multiply:{trivial:i,total:i,commutative:i,associative:i},divide:{trivial:a,total:i,commutative:a,associative:a},paren:{trivial:i,total:i,commutative:i,associative:a},defaultF:{trivial:a,total:i,commutative:a,associative:a}};function c(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u,n=s;if("string"==typeof e?n=e:(0,o.$$)(e)?n=e.fn.toString():(0,o.Px)(e)?n=e.name:(0,o.tv)(e)&&(n="paren"),F(r,n)){var i=r[n];if(F(i,t))return i[t];if(F(u,n))return u[n][t]}if(F(r,s)){var a=r[s];return F(a,t)?a[t]:u[s][t]}if(F(u,n)){var c=u[n];if(F(c,t))return c[t]}return u[s][t]}function l(e){return c(e,"associative",arguments.length>1&&void 0!==arguments[1]?arguments[1]:u)}function f(e,t){var r,n=[];return l(e,t)?(r=e.op,function e(t){for(var i=0;i<t.args.length;i++){var a=t.args[i];(0,o.$$)(a)&&r===a.op?e(a):n.push(a)}}(e),n):e.args}function p(e){return(0,o.$$)(e)?function(t){try{return new r(e.op,e.fn,t,e.implicit)}catch(e){return console.error(e),[]}}:function(r){return new t(new n(e.name),r)}}return{createMakeNodeFunction:p,hasProperty:c,isCommutative:function(e){return c(e,"commutative",arguments.length>1&&void 0!==arguments[1]?arguments[1]:u)},isAssociative:l,mergeContext:function(e,t){var r=xt({},e);for(var n in t)F(e,n)?r[n]=xt(xt({},t[n]),e[n]):r[n]=t[n];return r},flatten:function e(t,r){if(!t.args||0===t.args.length)return t;t.args=f(t,r);for(var n=0;n<t.args.length;n++)e(t.args[n],r)},allChildren:f,unflattenr:function e(t,r){if(t.args&&0!==t.args.length){for(var n=p(t),i=t.args.length,a=0;a<i;a++)e(t.args[a],r);if(i>2&&l(t,r)){for(var o=t.args.pop();t.args.length>0;)o=n([t.args.pop(),o]);t.args=o.args}}},unflattenl:function e(t,r){if(t.args&&0!==t.args.length){for(var n=p(t),i=t.args.length,a=0;a<i;a++)e(t.args[a],r);if(i>2&&l(t,r)){for(var o=t.args.shift();t.args.length>0;)o=n([o,t.args.shift()]);t.args=o.args}}},defaultContext:u,realContext:{divide:{total:a},log:{total:a}},positiveContext:{subtract:{total:a},abs:{trivial:i},log:{total:i}}}}),wt=j("simplifyCore",["equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],e=>{var{equal:t,isZero:r,add:n,subtract:i,multiply:a,divide:s,pow:u,AccessorNode:c,ArrayNode:l,ConstantNode:f,FunctionNode:p,IndexNode:m,ObjectNode:d,OperatorNode:h,ParenthesisNode:y,SymbolNode:g}=e,v=new f(0),x=new f(1),{hasProperty:b,isCommutative:w}=bt({FunctionNode:p,OperatorNode:h,SymbolNode:g});return function e(y,g){var N=g?g.context:void 0;if(b(y,"trivial",N)){if((0,o.Px)(y)&&1===y.args.length)return e(y.args[0],g);var M=!1,S=0;if(y.forEach(t=>{1===++S&&(M=e(t,g))}),1===S)return M}if((0,o.$$)(y)&&y.isUnary()){var E=e(y.args[0],g);if("-"===y.op){if((0,o.$$)(E)){if(E.isUnary()&&"-"===E.op)return E.args[0];if(E.isBinary()&&"subtract"===E.fn)return new h("-","subtract",[E.args[1],E.args[0]])}return new h(y.op,y.fn,[E])}}else{if((0,o.$$)(y)&&y.isBinary()){var A=e(y.args[0],g),O=e(y.args[1],g);if("+"===y.op){if((0,o.BA)(A)){if(r(A.value))return O;if((0,o.BA)(O))return new f(n(A.value,O.value))}return(0,o.BA)(O)&&r(O.value)?A:(0,o.$$)(O)&&O.isUnary()&&"-"===O.op?new h("-","subtract",[A,O.args[0]]):new h(y.op,y.fn,O?[A,O]:[A])}if("-"===y.op){if((0,o.BA)(A)&&O){if((0,o.BA)(O))return new f(i(A.value,O.value));if(r(A.value))return new h("-","unaryMinus",[O])}if("subtract"===y.fn)return(0,o.BA)(O)&&r(O.value)?A:(0,o.$$)(O)&&O.isUnary()&&"-"===O.op?e(new h("+","add",[A,O.args[0]]),g):new h(y.op,y.fn,[A,O])}else{if("*"===y.op){if((0,o.BA)(A)){if(r(A.value))return v;if(t(A.value,1))return O;if((0,o.BA)(O))return new f(a(A.value,O.value))}if((0,o.BA)(O)){if(r(O.value))return v;if(t(O.value,1))return A;if((0,o.$$)(A)&&A.isBinary()&&A.op===y.op&&w(y,N)){var C=A.args[0];if((0,o.BA)(C)){var _=new f(a(C.value,O.value));return new h(y.op,y.fn,[_,A.args[1]],y.implicit)}}return w(y,N)?new h(y.op,y.fn,[O,A],y.implicit):new h(y.op,y.fn,[A,O],y.implicit)}return new h(y.op,y.fn,[A,O],y.implicit)}if("/"===y.op){if((0,o.BA)(A)){if(r(A.value))return v;if((0,o.BA)(O)&&(t(O.value,1)||t(O.value,2)||t(O.value,4)))return new f(s(A.value,O.value))}return new h(y.op,y.fn,[A,O])}if("^"===y.op&&(0,o.BA)(O)){if(r(O.value))return x;if(t(O.value,1))return A;if((0,o.BA)(A))return new f(u(A.value,O.value));if((0,o.$$)(A)&&A.isBinary()&&"^"===A.op){var T=A.args[1];if((0,o.BA)(T))return new h(y.op,y.fn,[A.args[0],new f(a(T.value,O.value))])}}}return new h(y.op,y.fn,[A,O])}if((0,o.Px)(y))return new p(e(y.fn),y.args.map(t=>e(t,g)));if((0,o.gO)(y))return new l(y.items.map(t=>e(t,g)));if((0,o.AS)(y))return new c(e(y.object,g),e(y.index,g));if((0,o.$I)(y))return new m(y.dimensions.map(t=>e(t,g)));if((0,o.GJ)(y)){var B={};for(var z in y.properties)B[z]=e(y.properties[z],g);return new d(B)}}return y}}),Nt="compile",Mt=j(Nt,["typed","parse"],e=>{var{typed:t,parse:r}=e;
1return t(Nt,{string:function(e){return r(e).compile()},"Array | Matrix":function(e){return ct(e,function(e){return r(e).compile()})}})}),St=j("Help",["parse"],e=>{var{parse:t}=e;function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(!e)throw new Error('Argument "doc" missing');this.doc=e}return r.prototype.type="Help",r.prototype.isHelp=!0,r.prototype.toString=function(){var e=this.doc||{},r="\n";if(e.name&&(r+="Name: "+e.name+"\n\n"),e.category&&(r+="Category: "+e.category+"\n\n"),e.description&&(r+="Description:\n    "+e.description+"\n\n"),e.syntax&&(r+="Syntax:\n    "+e.syntax.join("\n    ")+"\n\n"),e.examples){r+="Examples:\n";for(var n={},i=0;i<e.examples.length;i++){var a=e.examples[i];r+="    "+a+"\n";var s=void 0;try{s=t(a).compile().evaluate(n)}catch(e){s=e}void 0===s||(0,o.gS)(s)||(r+="        "+z(s,{precision:14})+"\n")}r+="\n"}return e.mayThrow&&e.mayThrow.length&&(r+="Throws: "+e.mayThrow.join(", ")+"\n\n"),e.seealso&&e.seealso.length&&(r+="See also: "+e.seealso.join(", ")+"\n"),r},r.prototype.toJSON=function(){var e=R(this.doc);return e.mathjs="Help",e},r.fromJSON=function(e){var t={};return Object.keys(e).filter(e=>"mathjs"!==e).forEach(r=>{t[r]=e[r]}),new r(t)},r.prototype.valueOf=r.prototype.toString,r},{isClass:!0}),Et="leafCount",At=j(Et,["parse","typed"],e=>{var{parse:t,typed:r}=e;function n(e){var t=0;return e.forEach(e=>{t+=n(e)}),t||1}return r(Et,{string:function(e){return this(t(e))},Node:function(e){return n(e)}})});function Ot(){throw new Error('No "bignumber" implementation available')}function Ct(){throw new Error('No "fraction" implementation available')}function _t(){throw new Error('No "matrix" implementation available')}var Tt=j("simplifyConstant",["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],e=>{var{typed:t,config:r,mathWithTransform:n,matrix:i,fraction:a,bignumber:s,AccessorNode:u,ArrayNode:c,ConstantNode:l,FunctionNode:f,IndexNode:p,ObjectNode:m,OperatorNode:d,SymbolNode:h}=e,{isCommutative:y,isAssociative:g,allChildren:v,createMakeNodeFunction:x}=bt({FunctionNode:f,OperatorNode:d,SymbolNode:h});function b(e,t){return S(_(e,t))}function w(e){return(0,o.fU)(e)?e.valueOf():e instanceof Array?e.map(w):(0,o.OA)(e)?i(w(e.valueOf())):e}function N(e,t,r){try{return n[e].apply(null,t)}catch(i){return t=t.map(w),A(n[e].apply(null,t),r)}}var M=t({Fraction:function(e){var t,r=e.s*e.n;return t=r<0?new d("-","unaryMinus",[new l(-r)]):new l(r),1===e.d?t:new d("/","divide",[t,new l(e.d)])},number:function(e){return e<0?O(new l(-e)):new l(e)},BigNumber:function(e){return e<0?O(new l(-e)):new l(e)},Complex:function(e){throw new Error("Cannot convert Complex number to Node")},string:function(e){return new l(e)},Matrix:function(e){return new c(e.valueOf().map(e=>M(e)))}});function S(e){return(0,o.Ll)(e)?e:M(e)}function E(e,t){if(t&&!1!==t.exactFractions&&isFinite(e)&&a){var r=a(e),n=t&&"number"==typeof t.fractionsLimit?t.fractionsLimit:1/0;if(r.valueOf()===e&&r.n<n&&r.d<n)return r}return e}var A=t({"string, Object":function(e,t){return"BigNumber"===r.number?(void 0===s&&Ot(),s(e)):"Fraction"===r.number?(void 0===a&&Ct(),a(e)):E(parseFloat(e),t)},"Fraction, Object":function(e,t){return e},"BigNumber, Object":function(e,t){return e},"number, Object":function(e,t){return E(e,t)},"Complex, Object":function(e,t){return 0!==e.im?e:E(e.re,t)},"Matrix, Object":function(e,t){return i(E(e.valueOf()))},"Array, Object":function(e,t){return e.map(E)}});function O(e){return new d("-","unaryMinus",[e])}function C(e,t,r,n){return t.reduce(function(t,i){if((0,o.Ll)(t)||(0,o.Ll)(i))(0,o.Ll)(t)?(0,o.Ll)(i)||(i=M(i)):t=M(t);else{try{return N(e,[t,i],n)}catch(e){}t=M(t),i=M(i)}return r([t,i])})}function _(e,t){switch(e.type){case"SymbolNode":return e;case"ConstantNode":switch(typeof e.value){case"number":return A(e.value,t);case"string":return e.value;default:if(!isNaN(e.value))return A(e.value,t)}return e;case"FunctionNode":if(n[e.name]&&n[e.name].rawArgs)return e;if(-1===["add","multiply"].indexOf(e.name)){var r=e.args.map(e=>_(e,t));if(!r.some(o.Ll))try{return N(e.name,r,t)}catch(e){}if("size"===e.name&&1===r.length&&(0,o.gO)(r[0])){for(var a=[],s=r[0];(0,o.gO)(s);)a.push(s.items.length),s=s.items[0];return i(a)}return new f(e.name,r.map(S))}case"OperatorNode":var d,h,w=e.fn.toString(),M=x(e);if((0,o.$$)(e)&&e.isUnary())d=[_(e.args[0],t)],h=(0,o.Ll)(d[0])?M(d):N(w,d,t);else if(g(e,t.context))if(d=(d=v(e,t.context)).map(e=>_(e,t)),y(w,t.context)){for(var E=[],O=[],T=0;T<d.length;T++)(0,o.Ll)(d[T])?O.push(d[T]):E.push(d[T]);E.length>1?(h=C(w,E,M,t),O.unshift(h),h=C(w,O,M,t)):h=C(w,d,M,t)}else h=C(w,d,M,t);else d=e.args.map(e=>_(e,t)),h=C(w,d,M,t);return h;case"ParenthesisNode":return _(e.content,t);case"AccessorNode":return function(e,t,r){if(!(0,o.$I)(t))return new u(S(e),S(t));if((0,o.gO)(e)||(0,o.OA)(e)){for(var n=Array.from(t.dimensions);n.length>0;)if((0,o.BA)(n[0])&&"string"!=typeof n[0].value){var a=A(n.shift().value,r);
1(0,o.gO)(e)?e=e.items[a-1]:(e=e.valueOf()[a-1])instanceof Array&&(e=i(e))}else{if(!(n.length>1&&(0,o.BA)(n[1])&&"string"!=typeof n[1].value))break;var s=A(n[1].value,r),f=[],m=(0,o.gO)(e)?e.items:e.valueOf();for(var d of m)if((0,o.gO)(d))f.push(d.items[s-1]);else{if(!(0,o.OA)(e))break;f.push(d[s-1])}if(f.length!==m.length)break;e=(0,o.gO)(e)?new c(f):i(f),n.splice(1,1)}return n.length===t.dimensions.length?new u(S(e),t):n.length>0?(t=new p(n),new u(S(e),t)):e}if((0,o.GJ)(e)&&1===t.dimensions.length&&(0,o.BA)(t.dimensions[0])){var h=t.dimensions[0].value;return h in e.properties?e.properties[h]:new l}return new u(S(e),t)}(_(e.object,t),_(e.index,t),t);case"ArrayNode":var B=e.items.map(e=>_(e,t));return B.some(o.Ll)?new c(B.map(S)):i(B);case"IndexNode":return new p(e.dimensions.map(e=>b(e,t)));case"ObjectNode":var z={};for(var q in e.properties)z[q]=b(e.properties[q],t);return new m(z);default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(e.type))}}return b}),Bt=j("simplify",["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],e=>{var{config:t,typed:r,parse:n,add:i,subtract:a,multiply:s,divide:u,pow:c,isZero:l,equal:f,resolve:p,simplifyCore:m,fraction:d,bignumber:h,mathWithTransform:y,matrix:g,AccessorNode:v,ArrayNode:x,ConstantNode:b,FunctionNode:w,IndexNode:N,ObjectNode:M,OperatorNode:S,ParenthesisNode:E,SymbolNode:A}=e,O=Tt({typed:r,config:t,mathWithTransform:y,matrix:g,fraction:d,bignumber:h,AccessorNode:v,ArrayNode:x,ConstantNode:b,FunctionNode:w,IndexNode:N,ObjectNode:M,OperatorNode:S,SymbolNode:A}),{hasProperty:C,isCommutative:_,isAssociative:T,mergeContext:B,flatten:z,unflattenr:q,unflattenl:D,createMakeNodeFunction:I,defaultContext:k,realContext:R,positiveContext:U}=bt({FunctionNode:w,OperatorNode:S,SymbolNode:A}),P=r("simplify",{string:function(e){return this(n(e),this.rules,K(),{})},"string, Map | Object":function(e,t){return this(n(e),this.rules,t,{})},"string, Map | Object, Object":function(e,t,r){return this(n(e),this.rules,t,r)},"string, Array":function(e,t){return this(n(e),t,K(),{})},"string, Array, Map | Object":function(e,t,r){return this(n(e),t,r,{})},"string, Array, Map | Object, Object":function(e,t,r,i){return this(n(e),t,r,i)},"Node, Map | Object":function(e,t){return this(e,this.rules,t,{})},"Node, Map | Object, Object":function(e,t,r){return this(e,this.rules,t,r)},Node:function(e){return this(e,this.rules,K(),{})},"Node, Array":function(e,t){return this(e,t,K(),{})},"Node, Array, Map | Object":function(e,t,r){return this(e,t,r,{})},"Node, Array, Object, Object":function(e,t,r,n){return this(e,t,ee(r),n)},"Node, Array, Map, Object":function(e,t,r,n){var i=n.consoleDebug;t=function(e,t){for(var r=[],n=0;n<e.length;n++){var i=e[n],a=void 0,o=typeof i;switch(o){case"string":i={s:i};case"object":a=$(i,t);break;case"function":a=i;break;default:throw TypeError("Unsupported type of rule: "+o)}r.push(a)}return r}(t,n.context);for(var a=p(e,r),o={},s=(a=j(a)).toString({parenthesis:"all"});!o[s];){o[s]=!0,H=0;var u=s;i&&console.log("Working on: ",s);for(var c=0;c<t.length;c++){var l="";if("function"==typeof t[c]?(a=t[c](a,n),i&&(l=t[c].name)):(z(a,n.context),a=V(a,t[c],n.context),i&&(l="".concat(t[c].l.toString()," -> ").concat(t[c].r.toString()))),i){var f=a.toString({parenthesis:"all"});f!==u&&(console.log("Applying",l,"produced",f),u=f)}D(a,n.context)}s=a.toString({parenthesis:"all"})}return a}});function j(e){return e.transform(function(e,t,r){return(0,o.tv)(e)?j(e.content):e})}P.defaultContext=k,P.realContext=R,P.positiveContext=U;var L={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){var r={};if(e.s){var i=e.s.split("->");if(2!==i.length)throw SyntaxError("Could not parse rule: "+e.s);r.l=i[0],r.r=i[1]}else r.l=e.l,r.r=e.r;for(var a of(r.l=j(n(r.l)),r.r=j(n(r.r)),["imposeContext","repeat","assuming"]))a in e&&(r[a]=e[a]);if(e.evaluate&&(r.evaluate=n(e.evaluate)),T(r.l,t)){var o=I(r.l),s=new A("_p"+H++);r.expanded={},r.expanded.l=o([r.l.clone(),s]),z(r.expanded.l,t),q(r.expanded.l,t),r.expanded.r=o([r.r,s])}return r}P.rules=[m,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(c*v) -> v * (-c)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(c*v) -> (-c) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*c) -> v * (-c)",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:" v   * ( v   * n1 + n2)",r:"v^2       * n1 +  v   * n2"},{s:" v   * (v^n4 * n1 + n2)   ->  v^(1+n4)  * n1 +  v   * n2",assuming:{divide:{total:!0}}},{s:"v^n3 * ( v   * n1 + n2)   ->  v^(n3+1)  * n1 + v^n3 * n2",assuming:{divide:{total:!0}}},{s:"v^n3 * (v^n4 * n1 + n2)   ->  v^(n3+n4) * n1 + v^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:"v*n + v",r:"v*(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*v + v -> (n+1)*v",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{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*c + c",r:"(n+1)*c"},{s:"c*n + c -> c*(n+1)",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:"c+v -> v+c",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"v*c -> c*v",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{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"}];var H=0;function G(e,t,r){var n=e;if(e)for(var i=0;i<e.length;++i){var a=V(e[i],t,r);a!==e[i]&&(n===e&&(n=e.slice()),n[i]=a)}return n}function V(e,t,r){if(t.assuming)for(var n in t.assuming)for(var i in t.assuming[n])if(C(n,i,r)!==t.assuming[n][i])return e;var a=B(t.imposeContext,r),o=e;if(o instanceof S||o instanceof w){var s=G(o.args,t,r);s!==o.args&&((o=o.clone()).args=s)}else if(o instanceof E){if(o.content){var u=V(o.content,t,r);u!==o.content&&(o=new E(u))}}else if(o instanceof x){var c=G(o.items,t,r);c!==o.items&&(o=new x(c))}else if(o instanceof v){var l=o.object;o.object&&(l=V(o.object,t,r));var f=o.index;o.index&&(f=V(o.index,t,r)),l===o.object&&f===o.index||(o=new v(l,f))}else if(o instanceof N){var p=G(o.dimensions,t,r);p!==o.dimensions&&(o=new N(p))}else if(o instanceof M){var m=!1,d={};for(var h in o.properties)d[h]=V(o.properties[h],t,r),d[h]!==o.properties[h]&&(m=!0);m&&(o=new M(d))}var y=t.r,g=J(t.l,o,a)[0];if(!g&&t.expanded&&(y=t.expanded.r,g=J(t.expanded.l,o,a)[0]),g){var b=o.implicit;o=y.clone(),b&&"implicit"in y&&(o.implicit=!0),o=o.transform(function(e){return e.isSymbolNode&&F(g.placeholders,e.name)?g.placeholders[e.name].clone():e})}return t.repeat&&o!==e&&(o=V(o,t,r)),o}function Z(e,t){var r={placeholders:{}};if(!e.placeholders&&!t.placeholders)return r;if(!e.placeholders)return t;if(!t.placeholders)return e;for(var n in e.placeholders)if(F(e.placeholders,n)&&(r.placeholders[n]=e.placeholders[n],F(t.placeholders,n)&&!Y(e.placeholders[n],t.placeholders[n])))return null;for(var i in t.placeholders)F(t.placeholders,i)&&(r.placeholders[i]=t.placeholders[i]);return r}function W(e,t){var r,n=[];if(0===e.length||0===t.length)return n;for(var i=0;i<e.length;i++)for(var a=0;a<t.length;a++)(r=Z(e[i],t[a]))&&n.push(r);return n}function J(e,t,r,n){var i=[{placeholders:{}}];if(e instanceof S&&t instanceof S||e instanceof w&&t instanceof w){if(e instanceof S){if(e.op!==t.op||e.fn!==t.fn)return[]}else if(e instanceof w&&e.name!==t.name)return[];if(!(1===t.args.length&&1===e.args.length||!T(t,r)&&t.args.length===e.args.length||n)){if(t.args.length>=2&&2===e.args.length){for(var a=function(e,t){var r,n,i=[],a=I(e);if(_(e,t))for(var o=0;o<e.args.length;o++)(n=e.args.slice(0)).splice(o,1),r=1===n.length?n[0]:a(n),i.push(a([e.args[o],r]));else for(var s=1;s<e.args.length;s++){var u=e.args[0];s>1&&(u=a(e.args.slice(0,s))),r=1===(n=e.args.slice(s)).length?n[0]:a(n),i.push(a([u,r]))}return i}(t,r),s=[],u=0;u<a.length;u++){var c=J(e,a[u],r,!0);s=s.concat(c)}return s}if(e.args.length>2)throw Error("Unexpected non-binary associative function: "+e.toString());return[]}for(var l=[],p=0;p<e.args.length;p++){var m=J(e.args[p],t.args[p],r);if(0===m.length)break;l.push(m)}if(l.length!==e.args.length){if(!_(t,r)||1===e.args.length)return[];if(e.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var d=J(e.args[0],t.args[1],r);if(0===d.length)return[];var h=J(e.args[1],t.args[0],r);if(0===h.length)return[];l=[d,h]}i=function(e){if(0===e.length)return e;for(var t=e.reduce(W),r=[],n={},i=0;i<t.length;i++){var a=JSON.stringify(t[i]);
1n[a]||(n[a]=!0,r.push(t[i]))}return r}(l)}else if(e instanceof A){if(0===e.name.length)throw new Error("Symbol in rule has 0 length...!?");if(L[e.name]){if(e.name!==t.name)return[]}else if("n"===e.name[0]||"_p"===e.name.substring(0,2))i[0].placeholders[e.name]=t;else if("v"===e.name[0]){if((0,o.BA)(t))return[];i[0].placeholders[e.name]=t}else{if("c"!==e.name[0])throw new Error("Invalid symbol in rule: "+e.name);if(!(t instanceof b))return[];i[0].placeholders[e.name]=t}}else{if(!(e instanceof b))return[];if(!f(e.value,t.value))return[]}return i}function Y(e,t){if(e instanceof b&&t instanceof b){if(!f(e.value,t.value))return!1}else if(e instanceof A&&t instanceof A){if(e.name!==t.name)return!1}else{if(!(e instanceof S&&t instanceof S||e instanceof w&&t instanceof w))return!1;if(e instanceof S){if(e.op!==t.op||e.fn!==t.fn)return!1}else if(e instanceof w&&e.name!==t.name)return!1;if(e.args.length!==t.args.length)return!1;for(var r=0;r<e.args.length;r++)if(!Y(e.args[r],t.args[r]))return!1}return!0}return P}),zt="symbolicEqual",qt=j(zt,["parse","simplify","typed","OperatorNode"],e=>{var{parse:t,simplify:r,typed:n,OperatorNode:i}=e;return n(zt,{"string, string":function(e,r){return this(t(e),t(r),{})},"string, string, Object":function(e,r,n){return this(t(e),t(r),n)},"Node, string":function(e,r){return this(e,t(r),{})},"Node, string, Object":function(e,r,n){return this(e,t(r),n)},"string, Node":function(e,r){return this(t(e),r,{})},"string, Node, Object":function(e,r,n){return this(t(e),r,n)},"Node, Node":function(e,t){return this(e,t,{})},"Node, Node, Object":function(e,t,n){var a=new i("-","subtract",[e,t]),s=r(a,{},n);return(0,o.BA)(s)&&!s.value}})}),Dt="evaluate",It=j(Dt,["typed","parse"],e=>{var{typed:t,parse:r}=e;return t(Dt,{string:function(e){var t=K();return r(e).compile().evaluate(t)},"string, Map | Object":function(e,t){return r(e).compile().evaluate(t)},"Array | Matrix":function(e){var t=K();return ct(e,function(e){return r(e).compile().evaluate(t)})},"Array | Matrix, Map | Object":function(e,t){return ct(e,function(e){return r(e).compile().evaluate(t)})}})}),kt={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"]},Rt={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"]},Ut={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","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:["[]","[1, 2, 3]","A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[0:2, 0:2] = ones(2, 2)"],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"]}
1,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","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:kt,E:kt,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:Rt,PI:Rt,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"]}
1,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",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh 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:"Borh 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, 
11], [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"]},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"]},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","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 cub
1ic 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)"],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)"],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)"],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)"],seealso:["ceil","floor","round"]},floor:{name:"floor",category:"Arithmetic",syntax:["floor(x)"],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)"],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 hypotenusa 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:["divi
1de"]},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)","math.pow([[1, 2], [4, 3]], 2)","math.pow([[1, 2], [4, 3]], -1)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]},round:{name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)"],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)"],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>1, -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"]}
1,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([[1, 2], [3, 4]])"],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"]}
1,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)=NaN","invmod(7, 13)=2","math.invmod(15151, 15122)=10429"],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
1(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 })',"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([expr1, expr2, expr3, ...])"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(" + 4 + ")")'],seealso:[]},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:[]},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"]},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","one
1s","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","one
1s","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 indicant 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:["diff([1, 2, 4, 7, 0])","diff([1, 2, 4, 7, 0], 0)","diff(matrix([1, 2, 4, 7, 0]))","diff([[1, 2], [3, 4]])","diff([[1, 2], [3, 4]], 0)","diff([[1, 2], [3, 4]], 1)","diff([[1, 2], [3, 4]], bignumber(1))","diff(matrix([[1, 2], [3, 4]]), 1)","diff([[1, 2], matrix([3, 4])], 1)"],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"]}
1,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 eigenvectors of a real symmetric matrix",examples:["eigs([[5, 2.3], [2.3, 1]])"],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:["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
1)"],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:["math.matrixFromRows(...arr)","math.matrixFromRows(row1, row2)","math.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:["math.matrixFromColumns(...arr)","math.matrixFromColumns(row1, row2)","math.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)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],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)'],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")',"a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","one
1s","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])"],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], math.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","one
1s","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"])',"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","one
1s","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"]},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(math.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.",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"]}
1,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.",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"]},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:[]},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, dim)"],description:"Compute the maximum value of a list of values.",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, dim)"],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, dim)"],description:"Compute the minimum value of a list of values.",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 probablity 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, 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)"],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","sum","variance"]},variance:{name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, 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"]},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","asin
1h","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 hyperbolic arccotangent 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 hyperbolic arccosecant 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"]}
1,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: $0, $1, $2", [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, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction)','numeric(4, "Fraction")','numeric(fraction(2, 5), "number)'],seealso:["number","fraction","bignumber","string","format"]}},Pt="help",Ft=j(Pt,["typed","mathWithTransform","Help"],e=>{var{typed:t,mathWithTransform:r,Help:n}=e;return t(Pt,{any:function(e){var t,i=e;if("string"!=typeof e)for(t in r)if(F(r,t)&&e===r[t]){i=t;break}var a=G(Ut,i);if(!a){var o="function"==typeof i?i.name:i;throw new Error('No documentation found on "'+o+'"')}return new n(a)}})}),jt=j("Parser",["evaluate"],e=>{var{evaluate:t}=e;function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:K(),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 X)return e.wrappedObject;var t={};for(var r of e.keys())V(t,r,e.get(r));return t}(this.scope)},r.prototype.getAllAsMap=function(){return this.scope},r.prototype.set=function(e,t){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}),Lt="rationalize",$t=j(Lt,["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],e=>{var{config:t,typed:r,equal:n,isZero:i,add:a,subtract:o,multiply:u,divide:c,pow:l,parse:f,simplifyCore:p,simplify:m,fraction:d,bignumber:h,mathWithTransform:y,matrix:g,AccessorNode:v,ArrayNode:x,ConstantNode:b,FunctionNode:w,IndexNode:N,ObjectNode:M,OperatorNode:S,SymbolNode:E,ParenthesisNode:A}=e,O=Tt({typed:r,config:t,mathWithTransform:y,matrix:g,fraction:d,bignumber:h,AccessorNode:v,ArrayNode:x,ConstantNode:b,FunctionNode:w,IndexNode:N,ObjectNode:M,OperatorNode:S,SymbolNode:E});return r(Lt,{string:function(e){return this(f(e),{},!1)},"string, boolean":function(e,t){return this(f(e),{},t)},"string, Object":function(e,t){return this(f(e),t,!1)},"string, Object, boolean":function(e,t,r){return this(f(e),t,r)},Node:function(e){return this(e,{},!1)},"Node, boolean":function(e,t){return this(e,{},t)},"Node, Object":function(e,t){return this(e,t,!1)},"Node, Object, boolean":function(e,t,r){var n=function(){var e=[p,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},O,{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)"}],r=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],n={};return n.firstRules=e.concat(t,r),n.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)"}],n.sucDivRules=r,n.firstRulesAgain=e.concat(t),n.finalRules=[p,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},O,{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))"}],n}(),i=function(e,t,r,n){var i=[],a=m(e,n,t,{exactFractions:!1}),o="+-*"+((r=!!r)?"/":"");!function e(t){var r=t.type;if("FunctionNode"===r)throw new Error("There is an unsolved function call");if("OperatorNode"===r)if("^"===t.op){if("ConstantNode"!==t.args[1].type||!s(parseFloat(t.args[1].value)))throw new Error("There is a non-integer exponent");e(t.args[0])}else{if(-1===o.indexOf(t.op))throw new Error("Operator "+t.op+" invalid in polynomial expression");for(var n=0;n<t.args.length;n++)e(t.args[n])}else if("SymbolNode"===r){var a=t.name;-1===i.indexOf(a)&&i.push(a)}else if("ParenthesisNode"===r)e(t.content);else if("ConstantNode"!==r)throw new Error("type "+r+" is not allowed in polynomial expression")}(a);var u={};return u.expression=a,u.variables=i,u}(e,t,!0,n.firstRules),a=i.variables.length,o={exactFractions:!1},u={exactFractions:!0};if(e=i.expression,a>=1){var c,l;e=C(e);var f,d=!0,h=!1;for(e=m(e,n.firstRules,{},o);l=d?n.distrDivRules:n.sucDivRules,d=!d,(f=(e=m(e,l,{},u)).toString())!==c;)h=!0,c=f;h&&(e=m(e,n.firstRulesAgain,{},o)),e=m(e,n.finalRules,{},o)}var y=[],g={};return"OperatorNode"===e.type&&e.isBinary()&&"/"===e.op?(1===a&&(e.args[0]=_(e.args[0],y),e.args[1]=_(e.args[1])),r&&(g.numerator=e.args[0],g.denominator=e.args[1])):(1===a&&(e=_(e,y)),r&&(g.numerator=e,g.denominator=null)),r?(g.coefficients=y,g.variables=i.variables,g.expression=e,g):e}});function C(e,t,r){var n=e.type,i=arguments.length>1;if("OperatorNode"===n&&e.isBinary()){var a,o=!1;if("^"===e.op&&("ParenthesisNode"!==e.args[0].type&&"OperatorNode"!==e.args[0].type||"ConstantNode"!==e.args[1].type||(o=(a=parseFloat(e.args[1].value))>=2&&s(a))),o){if(a>2){var u=e.args[0],c=new S("^","pow",[e.args[0].cloneDeep(),new b(a-1)]);e=new S("*","multiply",[u,c])}else e=new S("*","multiply",[e.args[0],e.args[0].cloneDeep()]);i&&("content"===r?t.content=e:t.args[r]=e)}}if("ParenthesisNode"===n)C(e.content,e,"content");else if("ConstantNode"!==n&&"SymbolNode"!==n)for(var l=0;l<e.args.length;l++)C(e.args[l],e,l);if(!i)return e}function _(e,t){void 0===t&&(t=[]),t[0]=0;var r=0,n="";!function e(i,a,o){var u=i.type;if("FunctionNode"===u)throw new Error("There is an unsolved function call");if("OperatorNode"===u){if(-1==="+-*^".indexOf(i.op))throw new Error("Operator "+i.op+" invalid");if(null!==a){if(("unaryMinus"===i.fn||"pow"===i.fn)&&"add"!==a.fn&&"subtract"!==a.fn&&"multiply"!==a.fn)throw new Error("Invalid "+i.op+" placing");if(("subtract"===i.fn||"add"===i.fn||"multiply"===i.fn)&&"add"!==a.fn&&"subtract"!==a.fn)throw new Error("Invalid "+i.op+" placing");if(("subtract"===i.fn||"add"===i.fn||"unaryMinus"===i.fn)&&0!==o.noFil)throw new Error("Invalid "+i.op+" placing")}"^"!==i.op&&"*"!==i.op||(o.fire=i.op);for(var c=0;c<i.args.length;c++)"unaryMinus"===i.fn&&(o.oper="-"),"+"!==i.op&&"subtract"!==i.fn||(o.fire="",o.cte=1,o.oper=0===c?"+":i.op
1),o.noFil=c,e(i.args[c],i,o)}else if("SymbolNode"===u){if(i.name!==n&&""!==n)throw new Error("There is more than one variable");if(n=i.name,null===a)return void(t[1]=1);if("^"===a.op&&0!==o.noFil)throw new Error("In power the variable should be the first parameter");if("*"===a.op&&1!==o.noFil)throw new Error("In multiply the variable should be the second parameter");""!==o.fire&&"*"!==o.fire||(r<1&&(t[1]=0),t[1]+=o.cte*("+"===o.oper?1:-1),r=Math.max(1,r))}else{if("ConstantNode"!==u)throw new Error("Type "+u+" is not allowed");var l=parseFloat(i.value);if(null===a)return void(t[0]=l);if("^"===a.op){if(1!==o.noFil)throw new Error("Constant cannot be powered");if(!s(l)||l<=0)throw new Error("Non-integer exponent is not allowed");for(var f=r+1;f<l;f++)t[f]=0;return l>r&&(t[l]=0),t[l]+=o.cte*("+"===o.oper?1:-1),void(r=Math.max(l,r))}o.cte=l,""===o.fire&&(t[0]+=o.cte*("+"===o.oper?1:-1))}}(e,null,{cte:1,oper:"+",fire:""});for(var i,a=!0,o=r=t.length-1;o>=0;o--)if(0!==t[o]){var u=new b(a?t[o]:Math.abs(t[o])),c=t[o]<0?"-":"+";if(o>0){var l=new E(n);if(o>1){var f=new b(o);l=new S("^","pow",[l,f])}u=-1===t[o]&&a?new S("-","unaryMinus",[l]):1===Math.abs(t[o])?l:new S("*","multiply",[u,l])}i=a?u:"+"===c?new S("+","add",[i,u]):new S("-","subtract",[i,u]),a=!1}return a?new b(0):i}}),Ht=j("derivative",["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],e=>{var{typed:t,config:r,parse:n,simplify:i,equal:a,isZero:s,numeric:u,ConstantNode:c,FunctionNode:l,OperatorNode:f,ParenthesisNode:p,SymbolNode:m}=e,d=t("derivative",{"Node, SymbolNode, Object":function(e,t,r){var n={};y(n,e,t.name);var a=g(e,n);return r.simplify?i(a):a},"Node, SymbolNode":function(e,t){return this(e,t,{simplify:!0})},"string, SymbolNode":function(e,t){return this(n(e),t)},"string, SymbolNode, Object":function(e,t,r){return this(n(e),t,r)},"string, string":function(e,t){return this(n(e),n(t))},"string, string, Object":function(e,t,r){return this(n(e),n(t),r)},"Node, string":function(e,t){return this(e,n(t))},"Node, string, Object":function(e,t,r){return this(e,n(t),r)}});d._simplify=!0,d.toTex=function(e){return h.apply(null,e.args)};var h=t("_derivTex",{"Node, SymbolNode":function(e,t){return(0,o.BA)(e)&&"string"===(0,o.QP)(e.value)?h(n(e.value).toString(),t.toString(),1):h(e.toTex(),t.toString(),1)},"Node, ConstantNode":function(e,t){if("string"===(0,o.QP)(t.value))return h(e,n(t.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(e,t,r){return h(e.toString(),t.name,r.value)},"string, string, number":function(e,t,r){return(1===r?"{d\\over d"+t+"}":"{d^{"+r+"}\\over d"+t+"^{"+r+"}}")+"\\left[".concat(e,"\\right]")}}),y=t("constTag",{"Object, ConstantNode, string":function(e,t){return e[t]=!0,!0},"Object, SymbolNode, string":function(e,t,r){return t.name!==r&&(e[t]=!0,!0)},"Object, ParenthesisNode, string":function(e,t,r){return y(e,t.content,r)},"Object, FunctionAssignmentNode, string":function(e,t,r){return-1===t.params.indexOf(r)?(e[t]=!0,!0):y(e,t.expr,r)},"Object, FunctionNode | OperatorNode, string":function(e,t,r){if(t.args.length>0){for(var n=y(e,t.args[0],r),i=1;i<t.args.length;++i)n=y(e,t.args[i],r)&&n;if(n)return e[t]=!0,!0}return!1}}),g=t("_derivative",{"ConstantNode, Object":function(e){return v(0)},"SymbolNode, Object":function(e,t){return void 0!==t[e]?v(0):v(1)},"ParenthesisNode, Object":function(e,t){return new p(g(e.content,t))},"FunctionAssignmentNode, Object":function(e,t){return void 0!==t[e]?v(0):g(e.expr,t)},"FunctionNode, Object":function(e,t){if(1!==e.args.length&&function(e){if("log"!==e.name&&"nthRoot"!==e.name&&"pow"!==e.name||2!==e.args.length){for(var t=0;t<e.args.length;++t)e.args[t]=v(0);throw e.compile().evaluate(),new Error("Expected TypeError, but none found")}}(e),void 0!==t[e])return v(0);var r,n,i,a,o=e.args[0],s=!1,u=!1;switch(e.name){case"cbrt":s=!0,n=new f("*","multiply",[v(3),new f("^","pow",[o,new f("/","divide",[v(2),v(3)])])]);break;case"sqrt":case"nthRoot":if(1===e.args.length)s=!0,n=new f("*","multiply",[v(2),new l("sqrt",[o])]);else if(2===e.args.length)return t[r=new f("/","divide",[v(1),e.args[1]])]=t[e.args[1]],g(new f("^","pow",[o,r]),t);break;case"log10":r=v(10);case"log":if(r||1!==e.args.length){if(1===e.args.length&&r||2===e.args.length&&void 0!==t[e.args[1]])n=new f("*","multiply",[o.clone(),new l("log",[r||e.args[1]])]),s=!0;else if(2===e.args.length)return g(new f("/","divide",[new l("log",[o]),new l("log",[e.args[1]])]),t)}else n=o.clone(),s=!0;break;case"pow":return t[r]=t[e.args[1]],g(new f("^","pow",[o,e.args[1]]),t);case"exp":n=new l("exp",[o.clone()]);break;case"sin":n=new l("cos",[o.clone()]);break;case"cos":n=new f("-","unaryMinus",[new l("sin",[o.clone()])]);break;case"tan":n=new f("^","pow",[new l("sec",[o.clone()]),v(2)]);break;case"sec":n=new f("*","multiply",[e,new l("tan",[o.clone()])]);break;case"csc":u=!0,n=new f("*","multiply",[e,new l("cot",[o.clone()])]);break;case"cot":u=!0,n=new f("^","pow",[new l("csc",[o.clone()]),v(2)]);break;case"asin":s=!0,n=new l("sqrt",[new f("-","subtract",[v(1),new f("^","pow",[o.clone(),v(2)])])]);break;case"acos":s=!0,u=!0,n=new l("sqrt",[new f("-","subtract",[v(1),new f("^","pow",[o.clone(),v(2)])])]);break;case"atan":s=!0,n=new f("+","add",[new f("^","pow",[o.clone(),v(2)]),v(1)]);break;case"asec":s=!0,n=new f("*","multiply",[new l("abs",[o.clone()]),new l("sqrt",[new f("-","subtract",[new f("^","pow",[o.clone(),v(2)]),v(1)])])]);break;case"acsc":s=!0,u=!0,n=new f("*","multiply",[new l("abs",[o.clone()]),new l("sqrt",[new f("-","subtract",[new f("^","pow",[o.clone(),v(2)]),v(1)])])]);break;case"acot":s=!0,u=!0,n=new f("+","add",[new f("^","pow",[o.clone(),v(2)]),v(1)]);break;case"sinh":n=new l("cosh",[o.clone()]);break;case"cosh":n=new l("sinh",[o.clone()]);break;case"tanh":n=new f("^","pow",[new l("sech",[o.clone()]),v(2)]);break;case"sech":u=!0,n=new f("*","multiply",[e,new l("tanh",[o.clone()])]);break;case"csch":u=!0,n=new f("*","multiply",[e,new l("coth",[o.clone()])]);break;case"coth":u=!0,n=new f("^","pow",[new l("csch",[o.clone()]),v(2)]);break;
1case"asinh":s=!0,n=new l("sqrt",[new f("+","add",[new f("^","pow",[o.clone(),v(2)]),v(1)])]);break;case"acosh":s=!0,n=new l("sqrt",[new f("-","subtract",[new f("^","pow",[o.clone(),v(2)]),v(1)])]);break;case"atanh":s=!0,n=new f("-","subtract",[v(1),new f("^","pow",[o.clone(),v(2)])]);break;case"asech":s=!0,u=!0,n=new f("*","multiply",[o.clone(),new l("sqrt",[new f("-","subtract",[v(1),new f("^","pow",[o.clone(),v(2)])])])]);break;case"acsch":s=!0,u=!0,n=new f("*","multiply",[new l("abs",[o.clone()]),new l("sqrt",[new f("+","add",[new f("^","pow",[o.clone(),v(2)]),v(1)])])]);break;case"acoth":s=!0,u=!0,n=new f("-","subtract",[v(1),new f("^","pow",[o.clone(),v(2)])]);break;case"abs":n=new f("/","divide",[new l(new m("abs"),[o.clone()]),o.clone()]);break;default:throw new Error('Function "'+e.name+'" is not supported by derivative, or a wrong number of arguments is passed')}s?(i="/",a="divide"):(i="*",a="multiply");var c=g(o,t);return u&&(c=new f("-","unaryMinus",[c])),new f(i,a,[c,n])},"OperatorNode, Object":function(e,t){if(void 0!==t[e])return v(0);if("+"===e.op)return new f(e.op,e.fn,e.args.map(function(e){return g(e,t)}));if("-"===e.op){if(e.isUnary())return new f(e.op,e.fn,[g(e.args[0],t)]);if(e.isBinary())return new f(e.op,e.fn,[g(e.args[0],t),g(e.args[1],t)])}if("*"===e.op){var r=e.args.filter(function(e){return void 0!==t[e]});if(r.length>0){var n=e.args.filter(function(e){return void 0===t[e]}),i=1===n.length?n[0]:new f("*","multiply",n),u=r.concat(g(i,t));return new f("*","multiply",u)}return new f("+","add",e.args.map(function(r){return new f("*","multiply",e.args.map(function(e){return e===r?g(e,t):e.clone()}))}))}if("/"===e.op&&e.isBinary()){var c=e.args[0],p=e.args[1];return void 0!==t[p]?new f("/","divide",[g(c,t),p]):void 0!==t[c]?new f("*","multiply",[new f("-","unaryMinus",[c]),new f("/","divide",[g(p,t),new f("^","pow",[p.clone(),v(2)])])]):new f("/","divide",[new f("-","subtract",[new f("*","multiply",[g(c,t),p.clone()]),new f("*","multiply",[c.clone(),g(p,t)])]),new f("^","pow",[p.clone(),v(2)])])}if("^"===e.op&&e.isBinary()){var m=e.args[0],d=e.args[1];if(void 0!==t[m])return(0,o.BA)(m)&&(s(m.value)||a(m.value,1))?v(0):new f("*","multiply",[e,new f("*","multiply",[new l("log",[m.clone()]),g(d.clone(),t)])]);if(void 0!==t[d]){if((0,o.BA)(d)){if(s(d.value))return v(0);if(a(d.value,1))return g(m,t)}var h=new f("^","pow",[m.clone(),new f("-","subtract",[d,v(1)])]);return new f("*","multiply",[d.clone(),new f("*","multiply",[g(m,t),h])])}return new f("*","multiply",[new f("^","pow",[m.clone(),d.clone()]),new f("+","add",[new f("*","multiply",[g(m,t),new f("/","divide",[d.clone(),m.clone()])]),new f("*","multiply",[g(d,t),new l("log",[m.clone()])])])])}throw new Error('Operator "'+e.op+'" is not supported by derivative, or a wrong number of arguments is passed')}});function v(e,t){return new c(u(e,t||r.number))}return d}),Gt="parser",Vt=j(Gt,["typed","Parser"],e=>{var{typed:t,Parser:r}=e;return t(Gt,{"":function(){return new r}})});function Zt(e){var t=0,r=1,n=Object.create(null),i=Object.create(null),a=0,o=function(e){var o=i[e];if(o&&(delete n[o],delete i[e],--t,r===o)){if(!t)return a=0,void(r=1);for(;!hasOwnProperty.call(n,++r););}};return e=Math.abs(e),{hit:function(s){var u=i[s],c=++a;if(n[c]=s,i[s]=c,!u){if(++t<=e)return;return s=n[r],o(s),s}if(delete n[u],r===u)for(;!hasOwnProperty.call(n,++r););},delete:o,clear:function(){t=a=0,r=1,n=Object.create(null),i=Object.create(null)}}}function Wt(e){var{hasher:t,limit:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r=null==r?Number.POSITIVE_INFINITY:r,t=null==t?JSON.stringify:t,function n(){"object"!=typeof n.cache&&(n.cache={values:new Map,lru:Zt(r||Number.POSITIVE_INFINITY)});for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var o=t(i);if(n.cache.values.has(o))return n.cache.lru.hit(o),n.cache.values.get(o);var s=e.apply(e,i);return n.cache.values.set(o,s),n.cache.values.delete(n.cache.lru.hit(o)),s}}function Jt(e){return Object.keys(e.signatures||{}).reduce(function(e,t){var r=(t.match(/,/g)||[]).length+1;return Math.max(e,r)},-1)}function Yt(e,t,r){var n=e.filter(function(e){return(0,o.li)(e)&&!(e.name in t)&&!r.has(e.name)})[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');var i=n.name,a=it(r),s=e.compile();return function(e){return a.set(i,e),s.evaluate(a)}}var Qt=j("filter",["typed"],e=>{var{typed:t}=e;function r(e,t,r){var i,a;return e[0]&&(i=e[0].compile().evaluate(r)),e[1]&&(a=(0,o.li)(e[1])||(0,o.m2)(e[1])?e[1].compile().evaluate(r):Yt(e[1],t,r)),n(i,a)}r.rawArgs=!0;var n=t("filter",{"Array, function":Xt,"Matrix, function":function(e,t){return e.create(Xt(e.toArray(),t))},"Array, RegExp":Se,"Matrix, RegExp":function(e,t){return e.create(Se(e.toArray(),t))}});return r},{isTransformFunction:!0});function Xt(e,t){var r=Jt(t);return Me(e,function(e,n,i){return 1===r?t(e):2===r?t(e,[n+1]):t(e,[n+1],i)})}
1var Kt=j("forEach",["typed"],e=>{var{typed:t}=e;function r(e,t,r){var i,a;return e[0]&&(i=e[0].compile().evaluate(r)),e[1]&&(a=(0,o.li)(e[1])||(0,o.m2)(e[1])?e[1].compile().evaluate(r):Yt(e[1],t,r)),n(i,a)}r.rawArgs=!0;var n=t("forEach",{"Array | Matrix, function":function(e,t){var r=Jt(t);!function n(i,a){Array.isArray(i)?Ne(i,function(e,t){n(e,a.concat(t+1))}):1===r?t(i):2===r?t(i,a):t(i,a,e)}(e.valueOf(),[])}});return r},{isTransformFunction:!0}),er=j("map",["typed"],e=>{var{typed:t}=e;function r(e,t,r){var i,a;return e[0]&&(i=e[0].compile().evaluate(r)),e[1]&&(a=(0,o.li)(e[1])||(0,o.m2)(e[1])?e[1].compile().evaluate(r):Yt(e[1],t,r)),n(i,a)}r.rawArgs=!0;var n=t("map",{"Array, function":function(e,t){return tr(e,t,e)},"Matrix, function":function(e,t){return e.create(tr(e.valueOf(),t,e))}});return r},{isTransformFunction:!0});function tr(e,t,r){var n=Jt(t);return function e(i,a){return Array.isArray(i)?we(i,function(t,r){return e(t,a.concat(r+1))}):1===n?t(i):2===n?t(i,a):t(i,a,r)}(e,[])}var rr="apply",nr=j(rr,["typed","isInteger"],e=>{var{typed:t,isInteger:r}=e;return t(rr,{"Array | Matrix, number | BigNumber, function":function(e,t,n){if(!r(t))throw new TypeError("Integer number expected for dimension");var i=Array.isArray(e)?se(e):e.size();if(t<0||t>=i.length)throw new oe(t,i.length);return(0,o.OA)(e)?e.create(ir(e.valueOf(),t,n)):ir(e,t,n)}})});function ir(e,t,r){var n,i,a;if(t<=0){if(Array.isArray(e[0])){for(a=function(e){var t,r,n=e.length,i=e[0].length,a=[];for(r=0;r<i;r++){var o=[];for(t=0;t<n;t++)o.push(e[t][r]);a.push(o)}return a}(e),i=[],n=0;n<a.length;n++)i[n]=ir(a[n],t-1,r);return i}return r(e)}for(i=[],n=0;n<e.length;n++)i[n]=ir(e[n],t-1,r);return i}var ar=j("apply",["typed","isInteger"],e=>{var{typed:t,isInteger:r}=e,n=nr({typed:t,isInteger:r});return t("apply",{"...any":function(e){var t=e[1];(0,o.Et)(t)?e[1]=t-1:(0,o.C4)(t)&&(e[1]=t.minus(1));try{return n.apply(null,e)}catch(e){throw Xe(e)}}})},{isTransformFunction:!0}),or="diff",sr=j(or,["typed","matrix","subtract","number"],e=>{var{typed:t,matrix:r,subtract:n,number:i}=e;return t(or,{"Array | Matrix":function(e){return(0,o.OA)(e)?r(u(e.toArray())):u(e)},"Array | Matrix, number":function(e,t){if(!s(t))throw new RangeError("Dimension must be a whole number");return(0,o.OA)(e)?r(a(e.toArray(),t)):a(e,t)},"Array | Matrix, BigNumber":function(e,t){return this(e,i(t))}});function a(e,t){if((0,o.OA)(e)&&(e=e.toArray()),!Array.isArray(e))throw RangeError("Array/Matrix does not have that many dimensions");if(t>0){var r=[];return e.forEach(e=>{r.push(a(e,t-1))}),r}if(0===t)return u(e);throw RangeError("Cannot have negative dimension")}function u(e){var t=[],r=e.length;if(r<2)return e;for(var n=1;n<r;n++)t.push(c(e[n-1],e[n]));return t}function c(e,t){(0,o.OA)(e)&&(e=e.toArray()),(0,o.OA)(t)&&(t=t.toArray());var r=Array.isArray(e),i=Array.isArray(t);if(r&&i)return function(e,t){if(e.length!==t.length)throw RangeError("Not all sub-arrays have the same length");for(var r=[],n=e.length,i=0;i<n;i++)r.push(c(e[i],t[i]));return r}(e,t);if(!r&&!i)return n(t,e);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}});function ur(e){if(2===e.length&&(0,o.P3)(e[0])){var t=(e=e.slice())[1];(0,o.Et)(t)?e[1]=t-1:(0,o.C4)(t)&&(e[1]=t.minus(1))}return e}var cr="diff",lr=j(cr,["typed","matrix","subtract","number","bignumber"],e=>{var{typed:t,matrix:r,subtract:n,number:i,bignumber:a}=e,o=sr({typed:t,matrix:r,subtract:n,number:i,bignumber:a});return t(cr,{"...any":function(e){e=ur(e);try{return o.apply(null,e)}catch(e){throw Xe(e)}}})},{isTransformFunction:!0}),fr="subset",pr=j(fr,["typed","matrix"],e=>{var{typed:t,matrix:r}=e;return t(fr,{"Array, Index":function(e,t){var n=r(e).subset(t);return t.isScalar()?n:n.valueOf()},"Matrix, Index":function(e,t){return e.subset(t)},"Object, Index":hr,"string, Index":mr,"Array, Index, any":function(e,t,n){return r(R(e)).subset(t,n,void 0).valueOf()},"Array, Index, any, any":function(e,t,n,i){return r(R(e)).subset(t,n,i).valueOf()},"Matrix, Index, any":function(e,t,r){return e.clone().subset(t,r)},"Matrix, Index, any, any":function(e,t,r,n){return e.clone().subset(t,r,n)},"string, Index, string":dr,"string, Index, string, string":dr,"Object, Index, any":yr})});function mr(e,t){if(!(0,o.nw)(t))throw new TypeError("Index expected");if(1!==t.size().length)throw new ae(t.size().length,1);var r=e.length;le(t.min()[0],r),le(t.max()[0],r);var n=t.dimension(0),i="";
1return n.forEach(function(t){i+=e.charAt(t)}),i}function dr(e,t,r,n){if(!t||!0!==t.isIndex)throw new TypeError("Index expected");if(1!==t.size().length)throw new ae(t.size().length,1);if(void 0!==n){if("string"!=typeof n||1!==n.length)throw new TypeError("Single character expected as defaultValue")}else n=" ";var i=t.dimension(0);if(i.size()[0]!==r.length)throw new ae(i.size()[0],r.length);var a=e.length;le(t.min()[0]),le(t.max()[0]);for(var o=[],s=0;s<a;s++)o[s]=e.charAt(s);if(i.forEach(function(e,t){o[e]=r.charAt(t[0])}),o.length>a)for(var u=a-1,c=o.length;u<c;u++)o[u]||(o[u]=n);return o.join("")}function hr(e,t){if(1!==t.size().length)throw new ae(t.size(),1);var r=t.dimension(0);if("string"!=typeof r)throw new TypeError("String expected as index to retrieve an object property");return G(e,r)}function yr(e,t,r){if(1!==t.size().length)throw new ae(t.size(),1);var n=t.dimension(0);if("string"!=typeof n)throw new TypeError("String expected as index to retrieve an object property");var i=R(e);return V(i,n,r),i}var gr=j("subset",["typed","matrix"],e=>{var{typed:t,matrix:r}=e,n=pr({typed:t,matrix:r});return t("subset",{"...any":function(e){try{return n.apply(null,e)}catch(e){throw Xe(e)}}})},{isTransformFunction:!0}),vr="concat",xr=j(vr,["typed","matrix","isInteger"],e=>{var{typed:t,matrix:r,isInteger:n}=e;return t(vr,{"...Array | Matrix | number | BigNumber":function(e){var t,i,a=e.length,s=-1,u=!1,c=[];for(t=0;t<a;t++){var l=e[t];if((0,o.OA)(l)&&(u=!0),(0,o.Et)(l)||(0,o.C4)(l)){if(t!==a-1)throw new Error("Dimension must be specified as last argument");if(i=s,s=l.valueOf(),!n(s))throw new TypeError("Integer number expected for dimension");if(s<0||t>0&&s>i)throw new oe(s,i+1)}else{var f=R(l).valueOf(),p=se(f);if(c[t]=f,i=s,s=p.length-1,t>0&&s!==i)throw new ae(i+1,s+1)}}if(0===c.length)throw new SyntaxError("At least one matrix expected");for(var m=c.shift();c.length;)m=br(m,c.shift(),s,0);return u?r(m):m},"...string":function(e){return e.join("")}})});function br(e,t,r,n){if(n<r){if(e.length!==t.length)throw new ae(e.length,t.length);for(var i=[],a=0;a<e.length;a++)i[a]=br(e[a],t[a],r,n+1);return i}return e.concat(t)}var wr=j("concat",["typed","matrix","isInteger"],e=>{var{typed:t,matrix:r,isInteger:n}=e,i=xr({typed:t,matrix:r,isInteger:n});return t("concat",{"...any":function(e){var t=e.length-1,r=e[t];(0,o.Et)(r)?e[t]=r-1:(0,o.C4)(r)&&(e[t]=r.minus(1));try{return i.apply(null,e)}catch(e){throw Xe(e)}}})},{isTransformFunction:!0});function Nr(e,t,r){var n;return-1!==String(e).indexOf("Unexpected type")?(n=arguments.length>2?" (type: "+(0,o.QP)(r)+", value: "+JSON.stringify(r)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+t+", unexpected type of argument"+n)):-1!==String(e).indexOf("complex numbers")?(n=arguments.length>2?" (type: "+(0,o.QP)(r)+", value: "+JSON.stringify(r)+")":"",new TypeError("Cannot calculate "+t+", no ordering relation is defined for complex numbers"+n)):e}var Mr=j("max",["typed","config","numeric","larger"],e=>{var{typed:t,config:r,numeric:n,larger:i}=e;return t("max",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){return lt(e,t.valueOf(),a)},"...":function(e){if(st(e))throw new TypeError("Scalar values expected in function max");return o(e)}});function a(e,t){try{return i(e,t)?e:t}catch(e){throw Nr(e,"max",t)}}function o(e){var t;if(ut(e,function(e){try{isNaN(e)&&"number"==typeof e?t=NaN:(void 0===t||i(e,t))&&(t=e)}catch(t){throw Nr(t,"max",e)}}),void 0===t)throw new Error("Cannot calculate max of an empty array");return"string"==typeof t&&(t=n(t,r.number)),t}}),Sr=j("max",["typed","config","numeric","larger"],e=>{var{typed:t,config:r,numeric:n,larger:i}=e,a=Mr({typed:t,config:r,numeric:n,larger:i});return t("max",{"...any":function(e){e=ur(e);try{return a.apply(null,e)}catch(e){throw Xe(e)}}})},{isTransformFunction:!0}),Er=j("min",["typed","config","numeric","smaller"],e=>{var{typed:t,config:r,numeric:n,smaller:i}=e;return t("min",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){return lt(e,t.valueOf(),a)},"...":function(e){if(st(e))throw new TypeError("Scalar values expected in function min");return o(e)}});function a(e,t){try{return i(e,t)?e:t}catch(e){throw Nr(e,"min",t)}}function o(e){var t;if(ut(e,function(e){try{isNaN(e)&&"number"==typeof e?t=NaN:(void 0===t||i(e,t))&&(t=e)}catch(t){throw Nr(t,"min",e)}}),void 0===t)throw new Error("Cannot calculate min of an empty array");return"string"==typeof t&&(t=n(t,r.number)),t}}),Ar=j("min",["typed","config","numeric","smaller"],e=>{var{typed:t,config:r,numeric:n,smaller:i}=e,a=Er({typed:t,config:r,numeric:n,smaller:i});return t("min",{"...any":function(e){e=ur(e);try{return a.apply(null,e)}catch(e){throw Xe(e)}}})},{isTransformFunction:!0}),Or="range",Cr=j(Or,["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq"],e=>{var{typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:u}=e;return t(Or,{string:l,"string, boolean":l,"number, number":function(e,t){return c(f(e,t,1))},"number, number, number":function(e,t,r){return c(f(e,t,r))},"number, number, boolean":function(e,t,r){return c(r?p(e,t,1):f(e,t,1))},"number, number, number, boolean":function(e,t,r,n){return c(n?p(e,t,r):f(e,t,r))},"BigNumber, BigNumber":function(e,t){return c(m(e,t,new(0,e.constructor)(1)))},"BigNumber, BigNumber, BigNumber":function(e,t,r){return c(m(e,t,r))},"BigNumber, BigNumber, boolean":function(e,t,r){var n=e.constructor;return c(r?d(e,t,new n(1)):m(e,t,new n(1)))},"BigNumber, BigNumber, BigNumber, boolean":function(e,t,r,n){return c(n?d(e,t,r):m(e,t,r))}});function c(e){return"Matrix"===r.matrix?n?n(e):_t():e}function l(e,t){var n=function(e){var 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(!n)throw new SyntaxError('String "'+e+'" is no valid range');return"BigNumber"===r.number?(void 0===i&&Ot(),c((t?d:m)(i(n.start),i(n.end),i(n.step)))):c((t?p:f)(n.start,n.end,n.step))}function f(e,t,r){var n=[],i=e;if(r>0)for(;a(i,t);)n.push(i),i+=r;else if(r<0)for(;s(i,t);)n.push(i),i+=r;return n}function p(e,t,r){var n=[],i=e;if(r>0)for(;o(i,t);)n.push(i),i+=r;else if(r<0)for(;u(i,t);)n.push(i),i+=r;return n}function m(e,t,r){var n=i(0),o=[],u=e;if(r.gt(n))for(;a(u,t);)o.push(u),u=u.plus(r);else if(r.lt(n))for(;s(u,t);)o.push(u),u=u.plus(r);return o}function d(e,t,r){var n=i(0),a=[],s=e;if(r.gt(n))for(;o(s,t);)a.push(s),s=s.plus(r);else if(r.lt(n))for(;u(s,t);)a.push(s),s=s.plus(r);return a}}),_r=j("range",["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq"],e=>{var{typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:u}=e,c=Cr({typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:u});return t("range",{"...any":function(e){return"boolean"!=typeof e[e.length-1]&&e.push(!0),c.apply(null,e)}})},{isTransformFunction:!0}),Tr=j("sum",["typed","config","add","numeric"],e=>{var{typed:t,config:r,add:n,numeric:i}=e;return t("sum",{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){try{return lt(e,t,n)}catch(e){throw Nr(e,"sum")}},"...":function(e){if(st(e))throw new TypeError("Scalar values expected in function sum");return a(e)}});function a(e){var t;return ut(e,function(e){try{t=void 0===t?e:n(t,e)}catch(t){throw Nr(t,"sum",e)}}),void 0===t&&(t=i(0,r.number)),"string"==typeof t&&(t=i(t,r.number)),t}}),Br=j("sum",["typed","config","add","numeric"],e=>{var{typed:t,config:r,add:n,numeric:i}=e,a=Tr({typed:t,config:r,add:n,numeric:i});return t("sum",{"...any":function(e){e=ur(e);try{return a.apply(null,e)}catch(e){throw Xe(e)}}})},{isTransformFunction:!0}),zr="cumsum",qr=j(zr,["typed","add","unaryPlus"],e=>{var{typed:t,add:r,unaryPlus:n}=e;return t(zr,{Array:i,Matrix:function(e){return e.create(i(e.valueOf()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(e,t){return e.create(o(e.valueOf(),t))},"...":function(e){if(st(e))throw new TypeError("All values expected to be scalar in function cumsum");return i(e)}});function i(e){try{return a(e)}catch(e){throw Nr(e,zr)}}function a(e){if(0===e.length)return[];for(var t=[n(e[0])],i=1;i<e.length;++i)t.push(r(t[i-1],e[i]));return t}function o(e,t){var r=se(e);if(t<0||t>=r.length)throw new oe(t,r.length);try{return s(e,t)}catch(e){throw Nr(e,zr)}}function s(e,t){var r,n,i;if(t<=0){var o=e[0][0];if(Array.isArray(o)){for(i=ot(e),n=[],r=0;r<i.length;r++)n[r]=s(i[r],t-1);return n}return a(e)}for(n=[],r=0;r<e.length;r++)n[r]=s(e[r],t-1);return n}}),Dr="cumsum",Ir=j(Dr,["typed","add","unaryPlus"],e=>{var{typed:t,add:r,unaryPlus:n}=e,i=qr({typed:t,add:r,unaryPlus:n});return t(Dr,{"...any":function(e){if(2===e.length&&(0,o.P3)(e[0])){var t=e[1];(0,o.Et)(t)?e[1]=t-1:(0,o.C4)(t)&&(e[1]=t.minus(1))}try{return i.apply(null,e)}catch(e){throw Xe(e)}}})},{isTransformFunction:!0}),kr=j("row",["typed","Index","matrix","range"],e=>{var{typed:t,Index:r,matrix:n,range:i}=e;return t("row",{"Matrix, number":a,"Array, number":function(e,t){return a(n(R(e)),t).valueOf()}});function a(e,t){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");le(t,e.size()[0]);var n=i(0,e.size()[1]),a=new r(t,n);
1return e.subset(a)}}),Rr=j("row",["typed","Index","matrix","range"],e=>{var{typed:t,Index:r,matrix:n,range:i}=e,a=kr({typed:t,Index:r,matrix:n,range:i});return t("row",{"...any":function(e){var t=e.length-1,r=e[t];(0,o.Et)(r)&&(e[t]=r-1);try{return a.apply(null,e)}catch(e){throw Xe(e)}}})},{isTransformFunction:!0}),Ur="column",Pr=j(Ur,["typed","Index","matrix","range"],e=>{var{typed:t,Index:r,matrix:n,range:i}=e;return t(Ur,{"Matrix, number":a,"Array, number":function(e,t){return a(n(R(e)),t).valueOf()}});function a(e,t){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");le(t,e.size()[1]);var n=i(0,e.size()[0]),a=new r(n,t);return e.subset(a)}}),Fr=j("column",["typed","Index","matrix","range"],e=>{var{typed:t,Index:r,matrix:n,range:i}=e,a=Pr({typed:t,Index:r,matrix:n,range:i});return t("column",{"...any":function(e){var t=e.length-1,r=e[t];(0,o.Et)(r)&&(e[t]=r-1);try{return a.apply(null,e)}catch(e){throw Xe(e)}}})},{isTransformFunction:!0}),jr=j("index",["Index"],e=>{var{Index:t}=e;return function(){for(var e=[],r=0,n=arguments.length;r<n;r++){var i=arguments[r];if((0,o._Z)(i))i.start--,i.end-=i.step>0?0:2;else if(i&&!0===i.isSet)i=i.map(function(e){return e-1});else if((0,o.cy)(i)||(0,o.OA)(i))i=i.map(function(e){return e-1});else if((0,o.Et)(i))i--;else if((0,o.C4)(i))i=i.toNumber()-1;else if("string"!=typeof i)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");e[r]=i}var a=new t;return t.apply(a,e),a}},{isTransformFunction:!0}),Lr="mean",$r=j(Lr,["typed","add","divide"],e=>{var{typed:t,add:r,divide:n}=e;return t(Lr,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(e,t){try{var i=lt(e,t,r),a=Array.isArray(e)?se(e):e.size();return n(i,a[t])}catch(e){throw Nr(e,"mean")}},"...":function(e){if(st(e))throw new TypeError("Scalar values expected in function mean");return i(e)}});function i(e){var t,i=0;if(ut(e,function(e){try{t=void 0===t?e:r(t,e),i++}catch(t){throw Nr(t,"mean",e)}}),0===i)throw new Error("Cannot calculate the mean of an empty array");return n(t,i)}}),Hr=j("mean",["typed","add","divide"],e=>{var{typed:t,add:r,divide:n}=e,i=$r({typed:t,add:r,divide:n});return t("mean",{"...any":function(e){e=ur(e);try{return i.apply(null,e)}catch(e){throw Xe(e)}}})},{isTransformFunction:!0}),Gr="unbiased",Vr="variance",Zr=j(Vr,["typed","add","subtract","multiply","divide","apply","isNaN"],e=>{var{typed:t,add:r,subtract:n,multiply:i,divide:a,apply:s,isNaN:u}=e;return t(Vr,{"Array | Matrix":function(e){return c(e,Gr)},"Array | Matrix, string":c,"Array | Matrix, number | BigNumber":function(e,t){return l(e,t,Gr)},"Array | Matrix, number | BigNumber, string":l,"...":function(e){return c(e,Gr)}});function c(e,t){var s,c=0;if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(ut(e,function(e){try{s=void 0===s?e:r(s,e),c++}catch(t){throw Nr(t,"variance",e)}}),0===c)throw new Error("Cannot calculate variance of an empty array");var l=a(s,c);if(s=void 0,ut(e,function(e){var t=n(e,l);s=void 0===s?i(t,t):r(s,i(t,t))}),u(s))return s;switch(t){case"uncorrected":return a(s,c);case"biased":return a(s,c+1);case"unbiased":var f=(0,o.C4)(s)?s.mul(0):0;return 1===c?f:a(s,c-1);default:throw new Error('Unknown normalization "'+t+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function l(e,t,r){try{if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return s(e,t,e=>c(e,r))}catch(e){throw Nr(e,"variance")}}}),Wr="variance",Jr=j(Wr,["typed","add","subtract","multiply","divide","apply","isNaN"],e=>{var{typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s}=e,u=Zr({typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:s});return t(Wr,{"...any":function(e){e=ur(e);try{return u.apply(null,e)}catch(e){throw Xe(e)}}})},{isTransformFunction:!0}),Yr=j("std",["typed","sqrt","variance"],e=>{var{typed:t,sqrt:r,variance:n}=e;return t("std",{"Array | Matrix":i,"Array | Matrix, string":i,"Array | Matrix, number | BigNumber":i,"Array | Matrix, number | BigNumber, string":i,"...":function(e){return i(e)}});function i(e,t){if(0===e.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{return r(n.apply(null,arguments))}catch(e){throw e instanceof TypeError&&-1!==e.message.indexOf(" variance")?new TypeError(e.message.replace(" variance"," std")):e}}}),Qr=j("std",["typed","sqrt","variance"],e=>{var{typed:t,sqrt:r,variance:n}=e,i=Yr({typed:t,sqrt:r,variance:n});return t("std",{"...any":function(e){e=ur(e);try{return i.apply(null,e)}catch(e){throw Xe(e)}}})},{isTransformFunction:!0}),Xr=r(76582),Kr=j("BigNumber",["?on","config"],e=>{var{on:t,config:r}=e,n=Xr.A.clone({precision:r.precision,modulo:Xr.A.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(e){return new n(e.value)},t&&t("config",function(e,t){e.precision!==t.precision&&n.config({precision:e.precision})}),n},{isClass:!0}),en=r(35716),tn=j("Complex",[],()=>(en.prototype.type="Complex",en.prototype.isComplex=!0,en.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},en.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},en.prototype.format=function(e){var t=this.im,r=this.re,n=h(this.re,e),i=h(this.im,e),a=(0,o.Et)(e)?e:e?e.precision:null;if(null!==a){var s=Math.pow(10,-a);Math.abs(r/t)<s&&(r=0),Math.abs(t/r)<s&&(t=0)}return 0===t?n:0===r?1===t?"i":-1===t?"-i":i+"i":t<0?-1===t?n+" - i":n+" - "+i.substring(1)+"i":1===t?n+" + i":n+" + "+i+"i"},en.fromPolar=function(e){switch(arguments.length){case 1:var t=
1arguments[0];if("object"==typeof t)return en(t);throw new TypeError("Input has to be an object with r and phi keys.");case 2:var r=arguments[0],n=arguments[1];if((0,o.Et)(r)){if((0,o.vO)(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),(0,o.Et)(n))return new en({r,phi:n});throw new TypeError("Phi is not a number nor an angle unit.")}throw new TypeError("Radius r is not a number.");default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},en.prototype.valueOf=en.prototype.toString,en.fromJSON=function(e){return new en(e)},en.compare=function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0},en),{isClass:!0}),rn=Wt(function(e){return new e(1).exp()},{hasher:sn}),nn=Wt(function(e){return new e(1).plus(new e(5).sqrt()).div(2)},{hasher:sn}),an=Wt(function(e){return e.acos(-1)},{hasher:sn}),on=Wt(function(e){return an(e).times(2)},{hasher:sn});function sn(e){return e[0].precision}var un=Math.PI,cn=2*Math.PI,ln=Math.E,fn=j("true",[],()=>!0),pn=j("false",[],()=>!1),mn=j("null",[],()=>null),dn=Cn("Infinity",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(1/0):1/0}),hn=Cn("NaN",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(NaN):NaN}),yn=Cn("pi",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return"BigNumber"===t.number?an(r):un}),gn=Cn("tau",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return"BigNumber"===t.number?on(r):cn}),vn=Cn("e",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return"BigNumber"===t.number?rn(r):ln}),xn=Cn("phi",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return"BigNumber"===t.number?nn(r):1.618033988749895}),bn=Cn("LN2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(2).ln():Math.LN2}),wn=Cn("LN10",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(10).ln():Math.LN10}),Nn=Cn("LOG2E",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(1).div(new r(2).ln()):Math.LOG2E}),Mn=Cn("LOG10E",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(1).div(new r(10).ln()):Math.LOG10E}),Sn=Cn("SQRT1_2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r("0.5").sqrt():Math.SQRT1_2}),En=Cn("SQRT2",["config","?BigNumber"],e=>{var{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(2).sqrt():Math.SQRT2}),An=Cn("i",["Complex"],e=>{var{Complex:t}=e;return t.I}),On=j("version",[],()=>"10.6.4");function Cn(e,t,r){return j(e,t,r,{recreateOnConfigChange:!0})}var _n=Ei("speedOfLight","299792458","m s^-1"),Tn=Ei("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),Bn=Ei("planckConstant","6.62607015e-34","J s"),zn=Ei("reducedPlanckConstant","1.0545718176461565e-34","J s"),qn=Ei("magneticConstant","1.25663706212e-6","N A^-2"),Dn=Ei("electricConstant","8.8541878128e-12","F m^-1"),In=Ei("vacuumImpedance","376.730313667","ohm"),kn=Ei("coulomb","8.987551792261171e9","N m^2 C^-2"),Rn=Ei("elementaryCharge","1.602176634e-19","C"),Un=Ei("bohrMagneton","9.2740100783e-24","J T^-1"),Pn=Ei("conductanceQuantum","7.748091729863649e-5","S"),Fn=Ei("inverseConductanceQuantum","12906.403729652257","ohm"),jn=Ei("magneticFluxQuantum","2.0678338484619295e-15","Wb"),Ln=Ei("nuclearMagneton","5.0507837461e-27","J T^-1"),$n=Ei("klitzing","25812.807459304513","ohm"),Hn=Ei("bohrRadius","5.29177210903e-11","m"),Gn=Ei("classicalElectronRadius","2.8179403262e-15","m"),Vn=Ei("electronMass","9.1093837015e-31","kg"),Zn=Ei("fermiCoupling","1.1663787e-5","GeV^-2"),Wn=Ai("fineStructure",.0072973525693),Jn=Ei("hartreeEnergy","4.3597447222071e-18","J"),Yn=Ei("protonMass","1.67262192369e-27","kg"),Qn=Ei("deuteronMass","3.3435830926e-27","kg"),Xn=Ei("neutronMass","1.6749271613e-27","kg"),Kn=Ei("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),ei=Ei("rydberg","10973731.568160","m^-1"),ti=Ei("thomsonCrossSection","6.6524587321e-29","m^2"),ri=Ai("weakMixingAngle",.2229),ni=Ai("efimovFactor",22.7),ii=Ei("atomicMass","1.66053906660e-27","kg"),ai=Ei("avogadro","6.02214076e23","mol^-1"),oi=Ei("boltzmann","1.380649e-23","J K^-1"),si=Ei("faraday","96485.33212331001","C mol^-1"),ui=Ei("firstRadiation","3.7417718521927573e-16","W m^2"),ci=Ei("loschmidt","2.686780111798444e25","m^-3"),li=Ei("gasConstant","8.31446261815324","J K^-1 mol^-1"),fi=Ei("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),pi=Ei("molarVolume","0.022413969545014137","m^3 mol^-1"),mi=Ai("sackurTetrode",-1.16487052358),di=Ei("secondRadiation","0.014387768775039337","m K"),hi=Ei("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),yi=Ei("wienDisplacement","2.897771955e-3","m K"),gi=Ei("molarMass","0.99999999965e-3","kg mol^-1"),vi=Ei("molarMassC12","11.9999999958e-3","kg mol^-1"),xi=Ei("gravity","9.80665","m s^-2"),bi=Ei("planckLength","1.616255e-35","m"),wi=Ei("planckMass","2.176435e-8","kg"),Ni=Ei("planckTime","5.391245e-44","s"),Mi=Ei("planckCharge","1.87554603778e-18","C"),Si=Ei("planckTemperature","1.416785e+32","K");function Ei(e,t,r){return j(e,["config","Unit","BigNumber"],e=>{var{config:n,Unit:i,BigNumber:a}=e,o=new i("BigNumber"===n.number?new a(t):parseFloat(t),r);return o.fixPrefix=!0,o})}function Ai(e,t){return j(e,["config","BigNumber"],e=>{var{config:r,BigNumber:n}=e;return"BigNumber"===r.number?new n(t):t})}var Oi=r(70065),Ci=j("Fraction",[],()=>(Oi.A.prototype.type="Fraction",Oi.A.prototype.isFraction=!0,Oi.A.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Oi.A.fromJSON=function(e){return new Oi.A(e)},Oi.A),{isClass:!0}),_i=j("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,r){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,r){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}),Ti=j("Range",[],()=>{function e(t,r,n){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");var i=null!=t,a=null!=r,s=null!=n;if(i)if((0,o.C4)(t))t=t.toNumber();else if("number"!=typeof t)throw new TypeError("Parameter start must be a number");if(a)if((0,o.C4)(r))r=r.toNumber();else if("number"!=typeof r)throw new TypeError("Parameter end must be a number");if(s)if((0,o.C4)(n))n=n.toNumber();else if("number"!=typeof n)throw new TypeError("Parameter step must be a number");this.start=i?parseFloat(t):0,this.end=a?parseFloat(r):0,this.step=s?parseFloat(n):1}return e.prototype.type="Range",e.prototype.isRange=!0,e.parse=function(t){if("string"!=typeof t)return null;var r=t.split(":").map(function(e){return parseFloat(e)});if(r.some(function(e){return isNaN(e)}))return null;switch(r.length){case 2:return new e(r[0],r[1]);case 3:return new e(r[0],r[2],r[1]);default:return null}},e.prototype.clone=function(){return new e(this.start,this.end,this.step)},e.prototype.size=function(){var e=0,t=this.start,r=this.step,n=this.end-t;return u(r)===u(n)?e=Math.ceil(n/r):0===n&&(e=0),isNaN(e)&&(e=0),[e]},e.prototype.min=function(){var e=this.size()[0];return e>0?this.step>0?this.start:this.start+(e-1)*this.step:void 0},e.prototype.max=function(){var 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){var t=this.start,r=this.step,n=this.end,i=0;if(r>0)for(;t<n;)e(t,[i],this),t+=r,i++;else if(r<0)for(;t>n;)e(t,[i],this),t+=r,i++},e.prototype.map=function(e){var t=[];return this.forEach(function(r,n,i){t[n[0]]=e(r,n,i)}),t},e.prototype.toArray=function(){var e=[];return this.forEach(function(t,r){e[r[0]]=t}),e},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(e){var t=h(this.start,e);return 1!==this.step&&(t+=":"+h(this.step,e)),t+":"+h(this.end,e)},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}),Bi=j("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.join(", ")+"]"},e.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},e.fromJSON=function(t){return new e(t.entries)},e},{isClass:!0}
1),zi=j("DenseMatrix",["Matrix"],e=>{var{Matrix:t}=e;function r(e,t){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!(0,o.Kg)(t))throw new Error("Invalid datatype: "+t);if((0,o.OA)(e))"DenseMatrix"===e.type?(this._data=R(e._data),this._size=R(e._size),this._datatype=t||e._datatype):(this._data=e.toArray(),this._size=e.size(),this._datatype=t||e._datatype);else if(e&&(0,o.cy)(e.data)&&(0,o.cy)(e.size))this._data=e.data,this._size=e.size,ce(this._data,this._size),this._datatype=t||e.datatype;else if((0,o.cy)(e))this._data=c(e),this._size=se(this._data),ce(this._data,this._size),this._datatype=t;else{if(e)throw new TypeError("Unsupported type of data ("+(0,o.QP)(e)+")");this._data=[],this._size=[0],this._datatype=t}}function n(e,t,r,i){var a=i===r-1,o=t.dimension(i);return a?o.map(function(t){return le(t,e.length),e[t]}).valueOf():o.map(function(a){return le(a,e.length),n(e[a],t,r,i+1)}).valueOf()}function i(e,t,r,n,a){var o=a===n-1,s=t.dimension(a);o?s.forEach(function(t,n){le(t),e[t]=r[n[0]]}):s.forEach(function(o,s){le(o),i(e[o],t,r[s[0]],n,a+1)})}function a(e,t,r){if(0===t.length){for(var n=e._data;(0,o.cy)(n);)n=n[0];return n}return e._size=t.slice(0),e._data=fe(e._data,e._size,r),e}function u(e,t,r){for(var n=e._size.slice(0),i=!1;n.length<t.length;)n.push(0),i=!0;for(var o=0,s=t.length;o<s;o++)t[o]>n[o]&&(n[o]=t[o],i=!0);i&&a(e,n,r)}function c(e){for(var t=0,r=e.length;t<r;t++){var n=e[t];(0,o.cy)(n)?e[t]=c(n):n&&!0===n.isMatrix&&(e[t]=c(n.valueOf()))}return e}return r.prototype=new t,r.prototype.createDenseMatrix=function(e,t){return new r(e,t)},r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return Ce(this._data,o.QP)},r.prototype.storage=function(){return"dense"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(e,t){return new r(e,t)},r.prototype.subset=function(e,t,a){switch(arguments.length){case 1:return function(e,t){if(!(0,o.nw)(t))throw new TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var i=t.size();if(i.length!==e._size.length)throw new ae(i.length,e._size.length);for(var a=t.min(),s=t.max(),u=0,c=e._size.length;u<c;u++)le(a[u],e._size[u]),le(s[u],e._size[u]);return new r(n(e._data,t,i.length,0),e._datatype)}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw new TypeError("Invalid index");var a,s=t.size(),c=t.isScalar();if((0,o.OA)(r)?(a=r.size(),r=r.valueOf()):a=se(r),c){if(0!==a.length)throw new TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(s.length<e._size.length)throw new ae(s.length,e._size.length,"<");if(a.length<s.length){for(var l=0,f=0;1===s[l]&&1===a[l];)l++;for(;1===s[l];)f++,l++;r=ve(r,s.length,f,a)}if(!P(s,a))throw new ae(s,a,">");var p=t.max().map(function(e){return e+1});u(e,p,n);var m=s.length;i(e._data,t,r,m,0)}return e}(this,e,t,a);default:throw new SyntaxError("Wrong number of arguments")}},r.prototype.get=function(e){if(!(0,o.cy)(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new ae(e.length,this._size.length);for(var t=0;t<e.length;t++)le(e[t],this._size[t]);for(var r=this._data,n=0,i=e.length;n<i;n++){var a=e[n];le(a,r.length),r=r[a]}return r},r.prototype.set=function(e,t,r){if(!(0,o.cy)(e))throw new TypeError("Array expected");if(e.length<this._size.length)throw new ae(e.length,this._size.length,"<");var n,i,a,s=e.map(function(e){return e+1});u(this,s,r);var c=this._data;for(n=0,i=e.length-1;n<i;n++)le(a=e[n],c.length),c=c[a];return le(a=e[e.length-1],c.length),c[a]=t,this},r.prototype.resize=function(e,t,r){if(!(0,o.P3)(e))throw new TypeError("Array or Matrix expected");var n=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);return a(r?this.clone():this,n,t)},r.prototype.reshape=function(e,t){var r=t?this.clone():this;r._data=me(r._data,e);var n=r._size.reduce((e,t)=>e*t);return r._size=de(e,n),r},r.prototype.clone=function(){return new r({data:R(this._data),size:R(this._size),datatype:this._datatype})},r.prototype.size=function(){return this._size.slice(0)},r.prototype.map=function(e){var t=this,n=function r(n,i){return(0,o.cy)(n)?n.map(function(e,t){return r(e,i.concat(t))}):e(n,i,t)}(this._data,[]);return new r(n,void 0!==this._datatype?Ce(n,o.QP):void 0)},r.prototype.forEach=function(e){var t=this;
1!function r(n,i){(0,o.cy)(n)?n.forEach(function(e,t){r(e,i.concat(t))}):e(n,i,t)}(this._data,[])},r.prototype[Symbol.iterator]=function*(){yield*function*e(t,r){if((0,o.cy)(t))for(var n=0;n<t.length;n++)yield*e(t[n],r.concat(n));else yield{value:t,index:r}}(this._data,[])},r.prototype.rows=function(){var e=[];if(2!==this.size().length)throw new TypeError("Rows can only be returned for a 2D matrix.");var t=this._data;for(var n of t)e.push(new r([n],this._datatype));return e},r.prototype.columns=function(){var e=this,t=[],n=this.size();if(2!==n.length)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var i=this._data,a=function(n){var a=i.map(e=>[e[n]]);t.push(new r(a,e._datatype))},o=0;o<n[1];o++)a(o);return t},r.prototype.toArray=function(){return R(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(e){return z(this._data,e)},r.prototype.toString=function(){return z(this._data)},r.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.prototype.diagonal=function(e){if(e){if((0,o.C4)(e)&&(e=e.toNumber()),!(0,o.Et)(e)||!s(e))throw new TypeError("The parameter k must be an integer number")}else e=0;for(var t=e>0?e:0,n=e<0?-e:0,i=this._size[0],a=this._size[1],u=Math.min(i-n,a-t),c=[],l=0;l<u;l++)c[l]=this._data[l+n][l+t];return new r({data:c,size:[u],datatype:this._datatype})},r.diagonal=function(e,t,n,i){if(!(0,o.cy)(e))throw new TypeError("Array expected, size parameter");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if((0,o.C4)(e)&&(e=e.toNumber()),!(0,o.Et)(e)||!s(e)||e<1)throw new Error("Size values must be positive integers");return e}),n){if((0,o.C4)(n)&&(n=n.toNumber()),!(0,o.Et)(n)||!s(n))throw new TypeError("The parameter k must be an integer number")}else n=0;var a,u=n>0?n:0,c=n<0?-n:0,l=e[0],f=e[1],p=Math.min(l-c,f-u);if((0,o.cy)(t)){if(t.length!==p)throw new Error("Invalid value array length");a=function(e){return t[e]}}else if((0,o.OA)(t)){var m=t.size();if(1!==m.length||m[0]!==p)throw new Error("Invalid matrix length");a=function(e){return t.get([e])}}else a=function(){return t};i||(i=(0,o.C4)(a(0))?a(0).mul(0):0);var d=[];if(e.length>0){d=fe(d,e,i);for(var h=0;h<p;h++)d[h+c][h+u]=a(h)}return new r({data:d,size:[l,f]})},r.fromJSON=function(e){return new r(e)},r.prototype.swapRows=function(e,t){if(!((0,o.Et)(e)&&s(e)&&(0,o.Et)(t)&&s(t)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return le(e,this._size[0]),le(t,this._size[0]),r._swapRows(e,t,this._data),this},r._swapRows=function(e,t,r){var n=r[e];r[e]=r[t],r[t]=n},r},{isClass:!0}),qi=j("replacer",[],()=>function(e,t){return"number"!=typeof t||isFinite(t)&&!isNaN(t)?t:{mathjs:"number",value:String(t)}}),Di=r(1623),Ii=function(){return Ii=Di.create,Di},ki=j("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(e){var{BigNumber:t,Complex:r,DenseMatrix:n,Fraction:i}=e,a=Ii();return a.types=[{name:"number",test:o.Et},{name:"Complex",test:o.Zd},{name:"BigNumber",test:o.C4},{name:"Fraction",test:o.fU},{name:"Unit",test:o.vO},{name:"string",test:o.Kg},{name:"Chain",test:o.o_},{name:"Array",test:o.cy},{name:"Matrix",test:o.OA},{name:"DenseMatrix",test:o.zR},{name:"SparseMatrix",test:o.AF},{name:"Range",test:o._Z},{name:"Index",test:o.nw},{name:"boolean",test:o.Lm},{name:"ResultSet",test:o.eW},{name:"Help",test:o.gS},{name:"function",test:o.Tn},{name:"Date",test:o.$P},{name:"RegExp",test:o.gd},{name:"null",test:o.kZ},{name:"undefined",test:o.b0}
1,{name:"AccessorNode",test:o.AS},{name:"ArrayNode",test:o.gO},{name:"AssignmentNode",test:o.qM},{name:"BlockNode",test:o.CD},{name:"ConditionalNode",test:o.PO},{name:"ConstantNode",test:o.BA},{name:"FunctionNode",test:o.Px},{name:"FunctionAssignmentNode",test:o.m2},{name:"IndexNode",test:o.$I},{name:"Node",test:o.Ll},{name:"ObjectNode",test:o.GJ},{name:"OperatorNode",test:o.$$},{name:"ParenthesisNode",test:o.tv},{name:"RangeNode",test:o.Ye},{name:"SymbolNode",test:o.li},{name:"Map",test:te},{name:"Object",test:o.Gv}],a.conversions=[{from:"number",to:"BigNumber",convert:function(e){if(t||Ri(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 r||Ui(e),new r(e,0)}},{from:"number",to:"string",convert:function(e){return e+""}},{from:"BigNumber",to:"Complex",convert:function(e){return r||Ui(e),new r(e.toNumber(),0)}},{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 r||Ui(e),new r(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||Pi(e);var 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){var 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||Ri(e);try{return new t(e)}catch(t){throw new Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){i||Pi(e);try{return new i(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){r||Ui(e);try{return new r(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||Ri(e),new t(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||Pi(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return n||function(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new n(e)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}],a});function Ri(e){throw new Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function Ui(e){throw new Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function Pi(e){throw new Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var Fi="number",ji="number, number";function Li(e){return Math.abs(e)}function $i(e,t){return e+t}function Hi(e,t){return e*t}function Gi(e){return-e}function Vi(e){return e}function Zi(e){return p(e)}function Wi(e){return e*e*e}function Ji(e){return Math.exp(e)}function Yi(e){return m(e)}function Qi(e,t){if(!s(e)||!s(t))throw new Error("Parameters in function gcd must be integer numbers");for(var r;0!==t;)r=e%t,e=t,t=r;return e<0?-e:e}function Xi(e,t){if(!s(e)||!s(t))throw new Error("Parameters in function lcm must be integer numbers");if(0===e||0===t)return 0;for(var r,n=e*t;0!==t;)t=e%(r=t),e=r;return Math.abs(n/e)}function Ki(e){return l(e)}function ea(e){return c(e)}function ta(e,t){if(t>0)return e-t*Math.floor(e/t);if(0===t)return e;throw new Error("Cannot calculate mod for a negative divisor")}function ra(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,r=t<0;if(r&&(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 r?1/0:0;if(!isFinite(e))return r?0:e;var n=Math.pow(Math.abs(e),1/t);return n=e<0?-n:n,r?1/n:n}function na(e){return u(e)}function ia(e){return e*e}function aa(e,t){var r,n,i,a=0,o=1,u=1,c=0;if(!s(e)||!s(t))throw new Error("Parameters in function xgcd must be integer numbers");for(;t;)i=e-(n=Math.floor(e/t))*t,r=a,a=o-n*a,o=r,r=u,u=c-n*u,c=r,e=t,t=i;
1return e<0?[-e,-o,-c]:[e,e?o:0,c]}function oa(e,t){return e*e<1&&t===1/0||e*e>1&&t===-1/0?0:Math.pow(e,t)}function sa(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!s(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(g(e,t))}Li.signature=Fi,$i.signature=ji,Hi.signature=ji,Gi.signature=Fi,Vi.signature=Fi,Zi.signature=Fi,Wi.signature=Fi,Ji.signature=Fi,Yi.signature=Fi,Qi.signature=ji,Xi.signature=ji,Ki.signature=Fi,ea.signature=Fi,ta.signature=ji,na.signature=Fi,ia.signature=Fi,aa.signature=ji,oa.signature=ji;var ua="unaryPlus",ca=j(ua,["typed","config","BigNumber"],e=>{var{typed:t,config:r,BigNumber:n}=e;return t(ua,{number:Vi,Complex:function(e){return e},BigNumber:function(e){return e},Fraction:function(e){return e},Unit:function(e){return e.clone()},"Array | Matrix":function(e){return ct(e,this,!0)},"boolean | string":function(e){return"BigNumber"===r.number?new n(+e):+e}})}),la=j("abs",["typed"],e=>{var{typed:t}=e;return t("abs",{number:Li,Complex:function(e){return e.abs()},BigNumber:function(e){return e.abs()},Fraction:function(e){return e.abs()},"Array | Matrix":function(e){return ct(e,this,!0)},Unit:function(e){return e.abs()}})}),fa="acos",pa=j(fa,["typed","config","Complex"],e=>{var{typed:t,config:r,Complex:n}=e;return t(fa,{number:function(e){return e>=-1&&e<=1||r.predictable?Math.acos(e):new n(e,0).acos()},Complex:function(e){return e.acos()},BigNumber:function(e){return e.acos()},"Array | Matrix":function(e){return ct(e,this)}})}),ma="number";function da(e){return M(e)}function ha(e){return Math.atan(1/e)}function ya(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}function ga(e){return Math.asin(1/e)}function va(e){var t=1/e;return Math.log(t+Math.sqrt(t*t+1))}function xa(e){return Math.acos(1/e)}function ba(e){var t=1/e,r=Math.sqrt(t*t-1);return Math.log(r+t)}function wa(e){return S(e)}function Na(e){return E(e)}function Ma(e){return 1/Math.tan(e)}function Sa(e){var t=Math.exp(2*e);return(t+1)/(t-1)}function Ea(e){return 1/Math.sin(e)}function Aa(e){return 0===e?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*u(e)}function Oa(e){return 1/Math.cos(e)}function Ca(e){return 2/(Math.exp(e)+Math.exp(-e))}function _a(e){return O(e)}da.signature=ma,ha.signature=ma,ya.signature=ma,ga.signature=ma,va.signature=ma,xa.signature=ma,ba.signature=ma,wa.signature=ma,Na.signature=ma,Ma.signature=ma,Sa.signature=ma,Ea.signature=ma,Aa.signature=ma,Oa.signature=ma,Ca.signature=ma,_a.signature=ma;var Ta="acot",Ba=j(Ta,["typed","BigNumber"],e=>{var{typed:t,BigNumber:r}=e;return t(Ta,{number:ha,Complex:function(e){return e.acot()},BigNumber:function(e){return new r(1).div(e).atan()},"Array | Matrix":function(e){return ct(e,this)}})}),za="acsc",qa=j(za,["typed","config","Complex","BigNumber"],e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(za,{number:function(e){return e<=-1||e>=1||r.predictable?ga(e):new n(e,0).acsc()},Complex:function(e){return e.acsc()},BigNumber:function(e){return new i(1).div(e).asin()},"Array | Matrix":function(e){return ct(e,this)}})}),Da="addScalar",Ia=j(Da,["typed"],e=>{var{typed:t}=e;return t(Da,{"number, number":$i,"Complex, Complex":function(e,t){return e.add(t)},"BigNumber, BigNumber":function(e,t){return e.plus(t)},"Fraction, Fraction":function(e,t){return e.add(t)},"Unit, Unit":function(e,t){if(null===e.value||void 0===e.value)throw new Error("Parameter x contains a unit with undefined value");if(null===t.value||void 0===t.value)throw new Error("Parameter y contains a unit with undefined value");if(!e.equalBase(t))throw new Error("Units do not match");var r=e.clone();return r.value=this(r.value,t.value),r.fixPrefix=!1,r}})}),ka=j("arg",["typed"],e=>{var{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":function(e){return ct(e,this)}})}),Ra="asech",Ua=j(Ra,["typed","config","Complex","BigNumber"],e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(Ra,{number:function(e){if(e<=1&&e>=-1||r.predictable){var t=1/e;if(t>0||r.predictable)return ba(e);var i=Math.sqrt(t*t-1);return new n(Math.log(i-t),Math.PI)}return new n(e,0).asech()},Complex:function(e){return e.asech()},BigNumber:function(e){return new i(1).div(e).acosh()},"Array | Matrix":function(e){return ct(e,this)}})}),Pa=j("asinh",["typed"],e=>{var{typed:t}=e;
1return t("asinh",{number:wa,Complex:function(e){return e.asinh()},BigNumber:function(e){return e.asinh()},"Array | Matrix":function(e){return ct(e,this,!0)}})}),Fa=j("atan",["typed"],e=>{var{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()},"Array | Matrix":function(e){return ct(e,this,!0)}})}),ja="atanh",La=j(ja,["typed","config","Complex"],e=>{var{typed:t,config:r,Complex:n}=e;return t(ja,{number:function(e){return e<=1&&e>=-1||r.predictable?Na(e):new n(e,0).atanh()},Complex:function(e){return e.atanh()},BigNumber:function(e){return e.atanh()},"Array | Matrix":function(e){return ct(e,this,!0)}})}),$a=j("bignumber",["typed","BigNumber"],e=>{var{typed:t,BigNumber:r}=e;return t("bignumber",{"":function(){return new r(0)},number:function(e){return new r(e+"")},string:function(e){var t=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(t){var n=t[2],i=r(t[1]),a=new r(2).pow(Number(n));if(i.gt(a.sub(1)))throw new SyntaxError('String "'.concat(e,'" is out of range'));var o=new r(2).pow(Number(n)-1);return i.gte(o)?i.sub(a):i}return new r(e)},BigNumber:function(e){return e},Fraction:function(e){return new r(e.n).div(e.d).times(e.s)},null:function(e){return new r(0)},"Array | Matrix":function(e){return ct(e,this)}})});function Ha(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitAnd");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(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 r(0);if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new r(0):t;if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new r(0):e}return Za(e,t,function(e,t){return e&t})}function Ga(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");var t=e.constructor,r=t.precision;t.config({precision:1e9});var n=e.plus(new t(1));return n.s=-n.s||null,t.config({precision:r}),n}function Va(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitOr");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);var n=new r(-1);return e.isZero()||t.eq(n)||e.eq(t)?t:t.isZero()||e.eq(n)?e:e.isFinite()&&t.isFinite()?Za(e,t,function(e,t){return e|t}):!e.isFinite()&&!e.isNegative()&&t.isNegative()||e.isNegative()&&!t.isNegative()&&!t.isFinite()?n:e.isNegative()&&t.isNegative()?e.isFinite()?e:t:e.isFinite()?t:e}function Za(e,t,r){var n,i,a,o,s,u=e.constructor,c=+(e.s<0),l=+(t.s<0);if(c){n=Wa(Ga(e));for(var f=0;f<n.length;++f)n[f]^=1}else n=Wa(e);if(l){i=Wa(Ga(t));for(var p=0;p<i.length;++p)i[p]^=1}else i=Wa(t);n.length<=i.length?(a=n,o=i,s=c):(a=i,o=n,s=l);var m=a.length,d=o.length,h=1^r(c,l),y=new u(1^h),g=new u(1),v=new u(2),x=u.precision;for(u.config({precision:1e9});m>0;)r(a[--m],o[--d])===h&&(y=y.plus(g)),g=g.times(v);for(;d>0;)r(s,o[--d])===h&&(y=y.plus(g)),g=g.times(v);return u.config({precision:x}),0===h&&(y.s=-y.s),y}function Wa(e){for(var t=e.d,r=t[0]+"",n=1;n<t.length;++n){for(var i=t[n]+"",a=7-i.length;a--;)i="0"+i;r+=i}for(var o=r.length;"0"===r.charAt(o);)o--;var s=e.e,u=r.slice(0,o+1||1),c=u.length;if(s>0)if(++s>c)for(s-=c;s--;)u+="0";else s<c&&(u=u.slice(0,s)+"."+u.slice(s));for(var l=[0],f=0;f<u.length;){for(var p=l.length;p--;)l[p]*=10;l[0]+=parseInt(u.charAt(f++));for(var m=0;m<l.length;++m)l[m]>1&&(null!==l[m+1]&&void 0!==l[m+1]||(l[m+1]=0),l[m+1]+=l[m]>>1,l[m]&=1)}return l.reverse()}function Ja(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitXor");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);if(e.isZero())return t;if(t.isZero())return e;if(e.eq(t))return new r(0);var n=new r(-1);return e.eq(n)?Ga(t):t.eq(n)?Ga(e):e.isFinite()&&t.isFinite()?Za(e,t,function(e,t){return e^t}):e.isFinite()||t.isFinite()?new r(e.isNegative()===t.isNegative()?1/0:-1/0):n}function Ya(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function leftShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:e.isFinite()||t.isFinite()?t.lt(55)?e.times(Math.pow(2,t.toNumber())+""):e.times(new r(2).pow(t)):new r(NaN)}function Qa(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function rightArithShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:t.isFinite()?t.lt(55)?e.div(Math.pow(2,t.toNumber())+"").floor():e.div(new r(2).pow(t)).floor():e.isNegative()?new r(-1):e.isFinite()?new r(0):new r(NaN)}var Xa="number, number";function Ka(e,t){if(!s(e)||!s(t))throw new Error("Integers expected in function bitAnd");return e&t}function eo(e){if(!s(e))throw new Error("Integer expected in function bitNot");return~e}function to(e,t){if(!s(e)||!s(t))throw new Error("Integers expected in function bitOr");return e|t}function ro(e,t){if(!s(e)||!s(t))throw new Error("Integers expected in function bitXor");return e^t}function no(e,t){if(!s(e)||!s(t))throw new Error("Integers expected in function leftShift");return e<<t}function io(e,t){if(!s(e)||!s(t))throw new Error("Integers expected in function rightArithShift");return e>>t}function ao(e,t){if(!s(e)||!s(t))throw new Error("Integers expected in function rightLogShift");return e>>>t}Ka.signature=Xa,eo.signature="number",to.signature=Xa,ro.signature=Xa,no.signature=Xa,io.signature=Xa,ao.signature=Xa;var oo="bitNot",so=j(oo,["typed"],e=>{var{typed:t}=e;return t(oo,{number:eo,BigNumber:Ga,"Array | Matrix":function(e){return ct(e,this)}})}),uo="boolean",co=j(uo,["typed"],e=>{var{typed:t}=e;return t(uo,{"":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){var t=e.toLowerCase();if("true"===t)return!0;
1if("false"===t)return!1;var r=Number(e);if(""!==e&&!isNaN(r))return!!r;throw new Error('Cannot convert "'+e+'" to a boolean')},"Array | Matrix":function(e){return ct(e,this)}})}),lo="clone",fo=j(lo,["typed"],e=>{var{typed:t}=e;return t(lo,{any:R})});function po(e,t){if(t<e)return 1;if(t===e)return t;var r=t+e>>1;return po(e,r)*po(r+1,t)}function mo(e,t){if(!s(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!s(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");for(var r=e-t,n=1,i=2,a=t<r?t:r,o=t<r?r+1:t+1;o<=e;++o)for(n*=o;i<=a&&n%i===0;)n/=i,++i;return i<=a&&(n/=po(i,a)),n}mo.signature="number, number";var ho="combinations",yo=j(ho,["typed"],e=>{var{typed:t}=e;return t(ho,{"number, number":mo,"BigNumber, BigNumber":function(e,t){var r,n,i=e.constructor,a=e.minus(t),o=new i(1);if(!go(e)||!go(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=o,t.lt(a))for(n=o;n.lte(a);n=n.plus(o))r=r.times(t.plus(n)).dividedBy(n);else for(n=o;n.lte(t);n=n.plus(o))r=r.times(a.plus(n)).dividedBy(n);return r}})});function go(e){return e.isInteger()&&e.gte(0)}var vo=j("complex",["typed","Complex"],e=>{var{typed:t,Complex:r}=e;return t("complex",{"":function(){return r.ZERO},number:function(e){return new r(e,0)},"number, number":function(e,t){return new r(e,t)},"BigNumber, BigNumber":function(e,t){return new r(e.toNumber(),t.toNumber())},Fraction:function(e){return new r(e.valueOf(),0)},Complex:function(e){return e.clone()},string:function(e){return r(e)},null:function(e){return r(0)},Object:function(e){if("re"in e&&"im"in e)return new r(e.re,e.im);if("r"in e&&"phi"in e||"abs"in e&&"arg"in e)return new r(e);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":function(e){return ct(e,this)}})}),xo="conj",bo=j(xo,["typed"],e=>{var{typed:t}=e;return t(xo,{number:function(e){return e},BigNumber:function(e){return e},Complex:function(e){return e.conjugate()},"Array | Matrix":function(e){return ct(e,this)}})}),wo="cosh",No=j(wo,["typed"],e=>{var{typed:t}=e;return t(wo,{number:A,Complex:function(e){return e.cosh()},BigNumber:function(e){return e.cosh()},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cosh is no angle");return this(e.value)},"Array | Matrix":function(e){return ct(e,this)}})}),Mo="coth",So=j(Mo,["typed","BigNumber"],e=>{var{typed:t,BigNumber:r}=e;return t(Mo,{number:Sa,Complex:function(e){return e.coth()},BigNumber:function(e){return new r(1).div(e.tanh())},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function coth is no angle");return this(e.value)},"Array | Matrix":function(e){return ct(e,this)}})}),Eo=j("csc",["typed","BigNumber"],e=>{var{typed:t,BigNumber:r}=e;return t("csc",{number:Ea,Complex:function(e){return e.csc()},BigNumber:function(e){return new r(1).div(e.sin())},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function csc is no angle");return this(e.value)},"Array | Matrix":function(e){return ct(e,this)}})}),Ao="cube",Oo=j(Ao,["typed"],e=>{var{typed:t}=e;return t(Ao,{number:Wi,Complex:function(e){return e.mul(e).mul(e)},BigNumber:function(e){return e.times(e).times(e)},Fraction:function(e){return e.pow(3)},"Array | Matrix":function(e){return ct(e,this,!0)},Unit:function(e){return e.pow(3)}})});function Co(e,t,r){if(null==r)return e.eq(t);if(e.eq(t))return!0;if(e.isNaN()||t.isNaN())return!1;if(e.isFinite()&&t.isFinite()){var n=e.minus(t).abs();if(n.isZero())return!0;var i=e.constructor.max(e.abs(),t.abs());return n.lte(i.times(r))}return!1}var _o="equalScalar",To=j(_o,["typed","config"],e=>{var{typed:t,config:r}=e;return t(_o,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return N(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||Co(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){return function(e,t,r){return N(e.re,t.re,r)&&N(e.im,t.im,r)}(e,t,r.epsilon)},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return this(e.value,t.value)}})}),Bo=(j(_o,["typed","config"],e=>{var{typed:t,config:r}=e;return t(_o,{"number, number":function(e,t){return N(e,t,r.epsilon)}})}),j("erf",["typed"],e=>{var{typed:t}=e;return t("name",{number:function(e){var t=Math.abs(e);return t>=ko?u(e):t<=zo?u(e)*function(e){var t,r=e*e,n=Do[0][4]*r,i=r;for(t=0;t<3;t+=1)n=(n+Do[0][t])*r,i=(i+Io[0][t])*r;return e*(n+Do[0][3])/(i+Io[0][3])}(t):t<=4?u(e)*(1-function(e){var t,r=Do[1][8]*e,n=e;for(t=0;t<7;t+=1)r=(r+Do[1][t])*e,n=(n+Io[1][t])*e;
1var i=(r+Do[1][7])/(n+Io[1][7]),a=parseInt(16*e)/16,o=(e-a)*(e+a);return Math.exp(-a*a)*Math.exp(-o)*i}(t)):u(e)*(1-function(e){var t,r=1/(e*e),n=Do[2][5]*r,i=r;for(t=0;t<4;t+=1)n=(n+Do[2][t])*r,i=(i+Io[2][t])*r;var a=r*(n+Do[2][4])/(i+Io[2][4]);a=(qo-a)/e;var o=(e-(r=parseInt(16*e)/16))*(e+r);return Math.exp(-r*r)*Math.exp(-o)*a}(t))},"Array | Matrix":function(e){return ct(e,this)}})})),zo=.46875,qo=.5641895835477563,Do=[[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]],Io=[[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]],ko=Math.pow(2,53),Ro=j("exp",["typed"],e=>{var{typed:t}=e;return t("exp",{number:Ji,Complex:function(e){return e.exp()},BigNumber:function(e){return e.exp()},"Array | Matrix":function(e){return ct(e,this)}})}),Uo="expm1",Po=j(Uo,["typed","Complex"],e=>{var{typed:t,Complex:r}=e;return t(Uo,{number:Yi,Complex:function(e){var t=Math.exp(e.re);return new r(t*Math.cos(e.im)-1,t*Math.sin(e.im))},BigNumber:function(e){return e.exp().minus(1)},"Array | Matrix":function(e){return ct(e,this)}})}),Fo=j("filter",["typed"],e=>{var{typed:t}=e;return t("filter",{"Array, function":jo,"Matrix, function":function(e,t){return e.create(jo(e.toArray(),t))},"Array, RegExp":Se,"Matrix, RegExp":function(e,t){return e.create(Se(e.toArray(),t))}})});function jo(e,t){var r=Jt(t);return Me(e,function(e,n,i){return 1===r?t(e):2===r?t(e,[n]):t(e,[n],i)})}var Lo="forEach",$o=j(Lo,["typed"],e=>{var{typed:t}=e;return t(Lo,{"Array, function":Ho,"Matrix, function":function(e,t){return e.forEach(t)}})});function Ho(e,t){var r=Jt(t);!function n(i,a){Array.isArray(i)?Ne(i,function(e,t){n(e,a.concat(t))}):1===r?t(i):2===r?t(i,a):t(i,a,e)}(e,[])}var Go="format",Vo=j(Go,["typed"],e=>{var{typed:t}=e;return t(Go,{any:z,"any, Object | function | number":z})}
1),Zo="getMatrixDataType",Wo=j(Zo,["typed"],e=>{var{typed:t}=e;return t(Zo,{Array:function(e){return Ce(e,o.QP)},Matrix:function(e){return e.getDataType()}})}),Jo=j("hex",["typed","format"],e=>{var{typed:t,format:r}=e;return t("hex",{"number | BigNumber":function(e){return r(e,{notation:"hex"})},"number | BigNumber, number":function(e,t){return r(e,{notation:"hex",wordSize:t})}})}),Yo=j("im",["typed"],e=>{var{typed:t}=e;return t("im",{number:function(e){return 0},BigNumber:function(e){return e.mul(0)},Fraction:function(e){return e.mul(0)},Complex:function(e){return e.im},"Array | Matrix":function(e){return ct(e,this)}})}),Qo="isInteger",Xo=j(Qo,["typed"],e=>{var{typed:t}=e;return t(Qo,{number:s,BigNumber:function(e){return e.isInt()},Fraction:function(e){return 1===e.d&&isFinite(e.n)},"Array | Matrix":function(e){return ct(e,this)}})}),Ko="number";function es(e){return e<0}function ts(e){return e>0}function rs(e){return 0===e}function ns(e){return Number.isNaN(e)}es.signature=Ko,ts.signature=Ko,rs.signature=Ko,ns.signature=Ko;var is="isNegative",as=j(is,["typed"],e=>{var{typed:t}=e;return t(is,{number:es,BigNumber:function(e){return e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return e.s<0},Unit:function(e){return this(e.value)},"Array | Matrix":function(e){return ct(e,this)}})}),os="isPositive",ss=j(os,["typed"],e=>{var{typed:t}=e;return t(os,{number:ts,BigNumber:function(e){return!e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return e.s>0&&e.n>0},Unit:function(e){return this(e.value)},"Array | Matrix":function(e){return ct(e,this)}})}),us="isZero",cs=j(us,["typed"],e=>{var{typed:t}=e;return t(us,{number:rs,BigNumber:function(e){return e.isZero()},Complex:function(e){return 0===e.re&&0===e.im},Fraction:function(e){return 1===e.d&&0===e.n},Unit:function(e){return this(e.value)},"Array | Matrix":function(e){return ct(e,this)}})});function ls(e){var t;if(s(e))return e<=0?isFinite(e)?1/0:NaN:e>171?1/0:po(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*ls(1-e));if(e>=171.35)return 1/0;if(e>85){var r=e*e,n=r*e,i=n*e,a=i*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*r)-139/(51840*n)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*e))}--e,t=ps[0];for(var o=1;o<ps.length;++o)t+=ps[o]/(e+o);var u=e+fs+.5;return Math.sqrt(2*Math.PI)*Math.pow(u,e+.5)*Math.exp(-u)*t}ls.signature="number";var fs=4.7421875,ps=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],ms=.9189385332046728,ds=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function hs(e){if(e<0)return NaN;if(0===e)return 1/0;if(!isFinite(e))return e;if(e<.5)return Math.log(Math.PI/Math.sin(Math.PI*e))-hs(1-e);for(var t=5+(e-=1)+.5,r=ds[0],n=6;n>=1;n--)r+=ds[n]/(e+n);return ms+(e+.5)*Math.log(t)-t+Math.log(r)}hs.signature="number";var ys="lgamma",gs=j(ys,["Complex","typed"],e=>{var{Complex:t,typed:r}=e,n=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return r(ys,{number:hs,Complex:function(e){var r,n;if(e.isNaN())return new t(NaN,NaN);if(0===e.im)return new t(hs(e.re),0);if(e.re>=7||Math.abs(e.im)>=7)return i(e);if(e.re<=.1){var o=(r=6.283185307179586,(!0^((n=e.im)>0||!(n<0)&&1/n==1/0)?-r:r)*Math.floor(.5*e.re+.25)),s=e.mul(Math.PI).sin().log(),u=this(new t(1-e.re,-e.im));return new t(1.1447298858494002,o).sub(s).sub(u)}return e.im>=0?a(e):a(e.conjugate()).conjugate()},BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function i(e){for(var r=e.sub(.5).mul(e.log()).sub(e).add(ms),i=new t(1,0).div(e),a=i.div(e),o=n[0],s=n[1],u=2*a.re,c=a.re*a.re+a.im*a.im,l=2;l<8;l++){var f=s;s=-c*o+n[l],o=u*o+f}var p=i.mul(a.mul(o).add(s));return r.add(p)}function a(e){var r=0,n=0,a=e;for(e=e.add(1);e.re<=7;){var o=(a=a.mul(e)).im<0?1:0;0!==o&&0===n&&r++,n=o,e=e.add(1)}return i(e).sub(a.log()).sub(new t(0,2*r*Math.PI*1))}}),vs="log10",xs=j(vs,["typed","config","Complex"],e=>{var{typed:t,config:r,Complex:n}=e;return t(vs,{number:function(e){return e>=0||r.predictable?Ki(e):new n(e,0).log().div(Math.LN10)}
1,Complex:function(e){return new n(e).log().div(Math.LN10)},BigNumber:function(e){return!e.isNegative()||r.predictable?e.log():new n(e.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":function(e){return ct(e,this)}})}),bs="log2",ws=j(bs,["typed","config","Complex"],e=>{var{typed:t,config:r,Complex:n}=e;return t(bs,{number:function(e){return e>=0||r.predictable?ea(e):i(new n(e,0))},Complex:i,BigNumber:function(e){return!e.isNegative()||r.predictable?e.log(2):i(new n(e.toNumber(),0))},"Array | Matrix":function(e){return ct(e,this)}});function i(e){var t=Math.sqrt(e.re*e.re+e.im*e.im);return new n(Math.log2?Math.log2(t):Math.log(t)/Math.LN2,Math.atan2(e.im,e.re)/Math.LN2)}}),Ns=j("map",["typed"],e=>{var{typed:t}=e;return t("map",{"Array, function":Ms,"Matrix, function":function(e,t){return e.map(t)}})});function Ms(e,t){var r=Jt(t);return function n(i,a){if(Array.isArray(i))return i.map(function(e,t){return n(e,a.concat(t))});try{return 1===r?t(i):2===r?t(i,a):t(i,a,e)}catch(t){if(t instanceof TypeError&&"data"in t&&"wrongType"===t.data.category){var o="map attempted to call '".concat(t.data.fn,"(").concat(i),s=JSON.stringify(a);throw 2===r?o+=","+s:1!==r&&(o+=",".concat(s,",").concat(e)),o+=")' but argument ".concat(t.data.index+1," of type "),o+="".concat(t.data.actual," does not match expected type "),o+=t.data.expected.join(" or "),new TypeError(o)}throw t}}(e,[])}var Ss=j("multiplyScalar",["typed"],e=>{var{typed:t}=e;return t("multiplyScalar",{"number, number":Hi,"Complex, Complex":function(e,t){return e.mul(t)},"BigNumber, BigNumber":function(e,t){return e.times(t)},"Fraction, Fraction":function(e,t){return e.mul(t)},"number | Fraction | BigNumber | Complex, Unit":function(e,t){var r=t.clone();return r.value=null===r.value?r._normalize(e):this(r.value,e),r},"Unit, number | Fraction | BigNumber | Complex":function(e,t){var r=e.clone();return r.value=null===r.value?r._normalize(t):this(r.value,t),r},"Unit, Unit":function(e,t){return e.multiply(t)}})}),Es="number, number";function As(e){return!e}function Os(e,t){return!(!e&&!t)}function Cs(e,t){return!!e!=!!t}function _s(e,t){return!(!e||!t)}As.signature="number",Os.signature=Es,Cs.signature=Es,_s.signature=Es;var Ts=j("not",["typed"],e=>{var{typed:t}=e;return t("not",{number:As,Complex:function(e){return 0===e.re&&0===e.im},BigNumber:function(e){return e.isZero()||e.isNaN()},Unit:function(e){return null===e.value||this(e.value)},"Array | Matrix":function(e){return ct(e,this)}})}),Bs=j("number",["typed"],e=>{var{typed:t}=e,r=t("number",{"":function(){return 0},number:function(e){return e},string:function(e){if("NaN"===e)return NaN;var t,r,n=(r=(t=e).match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/))?{input:t,radix:{"0b":2,"0o":8,"0x":16}[r[1]],integerPart:r[2],fractionalPart:r[3]}:null;if(n)return function(e){for(var t=parseInt(e.integerPart,e.radix),r=0,n=0;n<e.fractionalPart.length;n++)r+=parseInt(e.fractionalPart[n],e.radix)/Math.pow(e.radix,n+1);var i=t+r;if(isNaN(i))throw new SyntaxError('String "'+e.input+'" is no valid number');return i}(n);var i=0,a=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);a&&(i=Number(a[2]),e=a[1]);var o=Number(e);if(isNaN(o))throw new SyntaxError('String "'+e+'" is no valid number');if(a){if(o>2**i-1)throw new SyntaxError('String "'.concat(e,'" is out of range'));o>=2**(i-1)&&(o-=2**i)}return o},BigNumber:function(e){return e.toNumber()},Fraction:function(e){return e.valueOf()},Unit:function(e){throw new Error("Second argument with valueless unit expected")},null:function(e){return 0},"Unit, string | Unit":function(e,t){return e.toNumber(t)},"Array | Matrix":function(e){return ct(e,this)}});return r.fromJSON=function(e){return parseFloat(e.value)},r}),zs=j("oct",["typed","format"],e=>{var{typed:t,format:r}=e;return t("oct",{"number | BigNumber":function(e){return r(e,{notation:"oct"})},"number | BigNumber, number":function(e,t){return r(e,{notation:"oct",wordSize:t})}})}),qs=r(7391),Ds=qs(Date.now());function Is(e){var t,r;return t=null===(r=e)?Ds:qs(String(r)),function(){return t()}}var ks="pickRandom",Rs=j(ks,["typed","config","?on"],e=>{var{typed:t,config:r,on:n}=e,i=Is(r.randomSeed);return n&&n("config",function(e,t){e.randomSeed!==t.randomSeed&&(i=Is(e.randomSeed))}),t(ks,{"Array | Matrix":function(e){return a(e,{})},"Array | Matrix, Object":function(e,t){return a(e,t)},"Array | Matrix, number":function(e,t){return a(e,{number:t})},"Array | Matrix, Array | Matrix":function(e,t){return a(e,{weights:t})},"Array | Matrix, Array | Matrix, number":function(e,t,r){return a(e,{number:r,weights:t})},"Array | Matrix, number, Array | Matrix":function(e,t,r){return a(e,{number:t,weights:r})}});function a(e,t){var{number:r,weights:n,elementWise:a=!0}=t,s=void 0===r;s&&(r=1);var u=(0,o.OA)(e)?e.create:(0,o.OA)(n)?n.create:null;e=e.valueOf(),n&&(n=n.valueOf()),!0===a&&(e=be(e),n=be(n));var c=0;
1if(void 0!==n){if(n.length!==e.length)throw new Error("Weights must have the same length as possibles");for(var l=0,f=n.length;l<f;l++){if(!(0,o.Et)(n[l])||n[l]<0)throw new Error("Weights must be an array of positive numbers");c+=n[l]}}for(var p,m=e.length,d=[];d.length<r;){if(void 0===n)p=e[Math.floor(i()*m)];else for(var h=i()*c,y=0,g=e.length;y<g;y++)if((h-=n[y])<0){p=e[y];break}d.push(p)}return s?d[0]:u?u(d):d}}),Us="print",Ps=j(Us,["typed"],e=>{var{typed:t}=e;return t(Us,{"string, Object | Array":Fs,"string, Object | Array, number | Object":Fs})});function Fs(e,t,r){return e.replace(/\$([\w.]+)/g,function(e,n){for(var i=n.split("."),a=t[i.shift()];i.length&&void 0!==a;){var s=i.shift();a=s?a[s]:a+"."}return void 0!==a?(0,o.Kg)(a)?a:z(a,r):e})}function js(e,t){var r=[];if((e=e.slice(0)).length>1)for(var n=0,i=e.shift();n<i;n++)r.push(js(e,t));else for(var a=0,o=e.shift();a<o;a++)r.push(t());return r}var Ls="random",$s=j(Ls,["typed","config","?on"],e=>{var{typed:t,config:r,on:n}=e,i=Is(r.randomSeed);return n&&n("config",function(e,t){e.randomSeed!==t.randomSeed&&(i=Is(e.randomSeed))}),t(Ls,{"":()=>s(0,1),number:e=>s(0,e),"number, number":(e,t)=>s(e,t),"Array | Matrix":e=>a(e,0,1),"Array | Matrix, number":(e,t)=>a(e,0,t),"Array | Matrix, number, number":(e,t,r)=>a(e,t,r)});function a(e,t,r){var n=js(e.valueOf(),()=>s(t,r));return(0,o.OA)(e)?e.create(n):n}function s(e,t){return e+i()*(t-e)}}),Hs=j("re",["typed"],e=>{var{typed:t}=e;return t("re",{number:function(e){return e},BigNumber:function(e){return e},Fraction:function(e){return e},Complex:function(e){return e.re},"Array | Matrix":function(e){return ct(e,this)}})}),Gs=j("sec",["typed","BigNumber"],e=>{var{typed:t,BigNumber:r}=e;return t("sec",{number:Oa,Complex:function(e){return e.sec()},BigNumber:function(e){return new r(1).div(e.cos())},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sec is no angle");return this(e.value)},"Array | Matrix":function(e){return ct(e,this)}})}),Vs="sign",Zs=j(Vs,["typed","BigNumber","Fraction","complex"],e=>{var{typed:t,BigNumber:r,complex:n,Fraction:i}=e;return t(Vs,{number:na,Complex:function(e){return 0===e.im?n(na(e.re)):e.sign()},BigNumber:function(e){return new r(e.cmp(0))},Fraction:function(e){return new i(e.s,1)},"Array | Matrix":function(e){return ct(e,this,!0)},Unit:function(e){if(!e._isDerived()&&0!==e.units[0].unit.offset)throw new TypeError("sign is ambiguous for units with offset");return this(e.value)}})}),Ws=j("sin",["typed"],e=>{var{typed:t}=e;return t("sin",{number:Math.sin,Complex:function(e){return e.sin()},BigNumber:function(e){return e.sin()},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sin is no angle");return this(e.value)},"Array | Matrix":function(e){return ct(e,this,!0)}})}),Js=j("SparseMatrix",["typed","equalScalar","Matrix"],e=>{var{typed:t,equalScalar:r,Matrix:n}=e;function i(e,t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!(0,o.Kg)(t))throw new Error("Invalid datatype: "+t);if((0,o.OA)(e))!function(e,t,r){"SparseMatrix"===t.type?(e._values=t._values?R(t._values):void 0,e._index=R(t._index),e._ptr=R(t._ptr),e._size=R(t._size),e._datatype=r||t._datatype):a(e,t.valueOf(),r||t._datatype)}(this,e,t);else if(e&&(0,o.cy)(e.index)&&(0,o.cy)(e.ptr)&&(0,o.cy)(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((0,o.cy)(e))a(this,e,t);else{if(e)throw new TypeError("Unsupported type of data ("+(0,o.QP)(e)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}}function a(e,n,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;var a=n.length,s=0,u=r,c=0;if((0,o.Kg)(i)&&(u=t.find(r,[i,i])||r,c=t.convert(0,i)),a>0){var l=0;do{e._ptr.push(e._index.length);for(var f=0;f<a;f++){var p=n[f];if((0,o.cy)(p)){if(0===l&&s<p.length&&(s=p.length),l<p.length){var m=p[l];u(m,c)||(e._values.push(m),e._index.push(f))}}else 0===l&&s<1&&(s=1),u(p,c)||(e._values.push(p),e._index.push(f))}l++}while(l<s)}e._ptr.push(e._index.length),e._size=[a,s]}function u(e,t,r,n){if(r-t===0)return r;for(var i=t;i<r;i++)if(n[i]===e)return i;return t}function c(e,t,r,n,i,a,o){i.splice(e,0,n),a.splice(e,0,t);for(var s=r+1;s<o.length;s++)o[s]++}function l(e,n,i,a){var s=a||0,u=r,c=0;(0,o.Kg)(e._datatype)&&(u=t.find(r,[e._datatype,e._datatype])||r,c=t.convert(0,e._datatype),s=t.convert(s,e._datatype));var l,f,p,m=!u(s,c),d=e._size[0],h=e._size[1];if(i>h){for(f=h;f<i;f++)if(e._ptr[f]=e._values.length,m)for(l=0;l<d;l++)e._values.push(s),e._index.push(l);e._ptr[i]=e._values.length}
1else i<h&&(e._ptr.splice(i+1,h-i),e._values.splice(e._ptr[i],e._values.length),e._index.splice(e._ptr[i],e._index.length));if(h=i,n>d){if(m){var y=0;for(f=0;f<h;f++){e._ptr[f]=e._ptr[f]+y,p=e._ptr[f+1]+y;var g=0;for(l=d;l<n;l++,g++)e._values.splice(p+g,0,s),e._index.splice(p+g,0,l),y++}e._ptr[h]=e._values.length}}else if(n<d){var v=0;for(f=0;f<h;f++){e._ptr[f]=e._ptr[f]-v;var x=e._ptr[f],b=e._ptr[f+1]-v;for(p=x;p<b;p++)(l=e._index[p])>n-1&&(e._values.splice(p,1),e._index.splice(p,1),v++)}e._ptr[f]=e._values.length}return e._size[0]=n,e._size[1]=i,e}function f(e,t,r,n,i){var a,o,s=n[0],u=n[1],c=[];for(a=0;a<s;a++)for(c[a]=[],o=0;o<u;o++)c[a][o]=0;for(o=0;o<u;o++)for(var l=r[o],f=r[o+1],p=l;p<f;p++)c[a=t[p]][o]=e?i?R(e[p]):e[p]:1;return c}return i.prototype=new n,i.prototype.createSparseMatrix=function(e,t){return new i(e,t)},i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return Ce(this._values,o.QP)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(e,t){return new i(e,t)},i.prototype.density=function(){var e=this._size[0],t=this._size[1];return 0!==e&&0!==t?this._index.length/(e*t):0},i.prototype.subset=function(e,t,r){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(e,t){if(!(0,o.nw)(t))throw new TypeError("Invalid index");if(t.isScalar())return e.get(t.min());var r,n,a,s,u=t.size();if(u.length!==e._size.length)throw new ae(u.length,e._size.length);var c=t.min(),l=t.max();for(r=0,n=e._size.length;r<n;r++)le(c[r],e._size[r]),le(l[r],e._size[r]);var f=e._values,p=e._index,m=e._ptr,d=t.dimension(0),h=t.dimension(1),y=[],g=[];d.forEach(function(e,t){g[e]=t[0],y[e]=!0});var v=f?[]:void 0,x=[],b=[];return h.forEach(function(e){for(b.push(x.length),a=m[e],s=m[e+1];a<s;a++)r=p[a],!0===y[r]&&(x.push(g[r]),v&&v.push(f[a]))}),b.push(x.length),new i({values:v,index:x,ptr:b,size:u,datatype:e._datatype})}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw new TypeError("Invalid index");var i,a=t.size(),s=t.isScalar();if((0,o.OA)(r)?(i=r.size(),r=r.toArray()):i=se(r),s){if(0!==i.length)throw new TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(1!==a.length&&2!==a.length)throw new ae(a.length,e._size.length,"<");if(i.length<a.length){for(var u=0,c=0;1===a[u]&&1===i[u];)u++;for(;1===a[u];)c++,u++;r=ve(r,a.length,c,i)}if(!P(a,i))throw new ae(a,i,">");if(1===a.length)t.dimension(0).forEach(function(t,i){le(t),e.set([t,0],r[i[0]],n)});else{var l=t.dimension(0),f=t.dimension(1);l.forEach(function(t,i){le(t),f.forEach(function(a,o){le(a),e.set([t,a],r[i[0]][o[0]],n)})})}}return e}(this,e,t,r);default:throw new SyntaxError("Wrong number of arguments")}},i.prototype.get=function(e){if(!(0,o.cy)(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new ae(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var t=e[0],r=e[1];le(t,this._size[0]),le(r,this._size[1]);var n=u(t,this._ptr[r],this._ptr[r+1],this._index);return n<this._ptr[r+1]&&this._index[n]===t?this._values[n]:0},i.prototype.set=function(e,n,i){if(!(0,o.cy)(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new ae(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var a=e[0],s=e[1],f=this._size[0],p=this._size[1],m=r,d=0;(0,o.Kg)(this._datatype)&&(m=t.find(r,[this._datatype,this._datatype])||r,d=t.convert(0,this._datatype)),(a>f-1||s>p-1)&&(l(this,Math.max(a+1,f),Math.max(s+1,p),i),f=this._size[0],p=this._size[1]),le(a,f),le(s,p);var h=u(a,this._ptr[s],this._ptr[s+1],this._index);return h<this._ptr[s+1]&&this._index[h]===a?m(n,d)?function(e,t,r,n,i){r.splice(e,1),n.splice(e,1);for(var a=t+1;a<i.length;a++)i[a]--}(h,s,this._values,this._index,this._ptr):this._values[h]=n:c(h,a,s,n,this._values,this._index,this._ptr),this},i.prototype.resize=function(e,t,r){if(!(0,o.P3)(e))throw new TypeError("Array or Matrix expected");var n=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);if(2!==n.length)throw new Error("Only two dimensions matrix are supported");
1return n.forEach(function(e){if(!(0,o.Et)(e)||!s(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+z(n)+")")}),l(r?this.clone():this,n[0],n[1],t)},i.prototype.reshape=function(e,t){if(!(0,o.cy)(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(!(0,o.Et)(t)||!s(t)||t<=-2||0===t)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+z(e)+")")});var r=this._size[0]*this._size[1];if(r!==(e=de(e,r))[0]*e[1])throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var n=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return n;for(var i=[],a=0;a<n._ptr.length;a++)for(var l=0;l<n._ptr[a+1]-n._ptr[a];l++)i.push(a);for(var f=n._values.slice(),p=n._index.slice(),m=0;m<n._index.length;m++){var d=p[m],h=i[m],y=d*n._size[1]+h;i[m]=y%e[1],p[m]=Math.floor(y/e[1])}n._values.length=0,n._index.length=0,n._ptr.length=e[1]+1,n._size=e.slice();for(var g=0;g<n._ptr.length;g++)n._ptr[g]=0;for(var v=0;v<f.length;v++){var x=p[v],b=i[v],w=f[v];c(u(x,n._ptr[b],n._ptr[b+1],n._index),x,b,w,n._values,n._index,n._ptr)}return n},i.prototype.clone=function(){return new i({values:this._values?R(this._values):void 0,index:R(this._index),ptr:R(this._ptr),size:R(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(e,n){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var a=this;return function(e,n,a,s,u,c,l){var f=[],p=[],m=[],d=r,h=0;(0,o.Kg)(e._datatype)&&(d=t.find(r,[e._datatype,e._datatype])||r,h=t.convert(0,e._datatype));for(var y=function(e,t,r){e=c(e,t,r),d(e,h)||(f.push(e),p.push(t))},g=0;g<=u;g++){m.push(f.length);var v=e._ptr[g],x=e._ptr[g+1];if(l)for(var b=v;b<x;b++){var w=e._index[b];w>=0&&w<=a&&y(e._values[b],w-0,g-0)}else{for(var N={},M=v;M<x;M++)N[e._index[M]]=e._values[M];for(var S=0;S<=a;S++)y(S in N?N[S]:0,S-0,g-0)}}return m.push(f.length),new i({values:f,index:p,ptr:m,size:[a-0+1,u-0+1]})}(this,0,this._size[0]-1,0,this._size[1]-1,function(t,r,n){return e(t,[r,n],a)},n)},i.prototype.forEach=function(e,t){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var r=this._size[0],n=this._size[1],i=0;i<n;i++){var a=this._ptr[i],o=this._ptr[i+1];if(t)for(var s=a;s<o;s++){var u=this._index[s];e(this._values[s],[u,i],this)}else{for(var c={},l=a;l<o;l++)c[this._index[l]]=this._values[l];for(var f=0;f<r;f++)e(f in c?c[f]:0,[f,i],this)}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var e=this._size[1],t=0;t<e;t++)for(var r=this._ptr[t],n=this._ptr[t+1],i=r;i<n;i++){var a=this._index[i];yield{value:this._values[i],index:[a,t]}}},i.prototype.toArray=function(){return f(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return f(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(e){for(var t=this._size[0],r=this._size[1],n=this.density(),i="Sparse Matrix ["+z(t,e)+" x "+z(r,e)+"] density: "+z(n,e)+"\n",a=0;a<r;a++)for(var o=this._ptr[a],s=this._ptr[a+1],u=o;u<s;u++)i+="\n    ("+z(this._index[u],e)+", "+z(a,e)+") ==> "+(this._values?z(this._values[u],e):"X");return i},i.prototype.toString=function(){return z(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((0,o.C4)(e)&&(e=e.toNumber()),!(0,o.Et)(e)||!s(e))throw new TypeError("The parameter k must be an integer number")}else e=0;var t=e>0?e:0,r=e<0?-e:0,n=this._size[0],a=this._size[1],u=Math.min(n-r,a-t),c=[],l=[],f=[];f[0]=0;for(var p=t;p<a&&c.length<u;p++)for(var m=this._ptr[p],d=this._ptr[p+1],h=m;h<d;h++){var y=this._index[h];if(y===p-t+r){c.push(this._values[h]),l[c.length-1]=y-r;break}}return f.push(c.length),new i({values:c,index:l,ptr:f,size:[u,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,n,a,u,c){if(!(0,o.cy)(e))throw new TypeError("Array expected, size parameter");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if((0,o.C4)(e)&&(e=e.toNumber()),!(0,o.Et)(e)||!s(e)||e<1)throw new Error("Size values must be positive integers");return e}),a){if((0,o.C4)(a)&&(a=a.toNumber()),!(0,o.Et)(a)||!s(a))throw new TypeError("The parameter k must be an integer number")}else a=0;var l=r,f=0;(0,o.Kg)(c)&&(l=t.find(r,[c,c])||r,f=t.convert(0,c));var p,m=a>0?a:0,d=a<0?-a:0,h=e[0],y=e[1],g=Math.min(h-d,y-m);if((0,o.cy)(n)){if(n.length!==g)throw new Error("Invalid value array length");p=function(e){return n[e]}}else if((0,o.OA)(n)){var v=n.size();if(1!==v.length||v[0]!==g)throw new Error("Invalid matrix length");p=function(e){return n.get([e])}}else p=function(){return n};for(var x=[],b=[],w=[],N=0;N<y;N++){w.push(x.length);var M=N-m;if(M>=0&&M<g){var S=p(M);l(S,f)||(b.push(M+d),x.push(S))}}return w.push(x.length),new i({values:x,index:b,ptr:w,size:[h,y]})},i.prototype.swapRows=function(e,t){if(!((0,o.Et)(e)&&s(e)&&(0,o.Et)(t)&&s(t)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return le(e,this._size[0]),le(t,this._size[0]),i._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this}
1,i._forEachRow=function(e,t,r,n,i){for(var a=n[e],o=n[e+1],s=a;s<o;s++)i(r[s],t[s])},i._swapRows=function(e,t,r,n,i,a){for(var o=0;o<r;o++){var s=a[o],c=a[o+1],l=u(e,s,c,i),f=u(t,s,c,i);if(l<c&&f<c&&i[l]===e&&i[f]===t){if(n){var p=n[l];n[l]=n[f],n[f]=p}}else if(l<c&&i[l]===e&&(f>=c||i[f]!==t)){var m=n?n[l]:void 0;i.splice(f,0,t),n&&n.splice(f,0,m),i.splice(f<=l?l+1:l,1),n&&n.splice(f<=l?l+1:l,1)}else if(f<c&&i[f]===t&&(l>=c||i[l]!==e)){var d=n?n[f]:void 0;i.splice(l,0,e),n&&n.splice(l,0,d),i.splice(l<=f?f+1:f,1),n&&n.splice(l<=f?f+1:f,1)}}},i},{isClass:!0}),Ys="splitUnit",Qs=j(Ys,["typed"],e=>{var{typed:t}=e;return t(Ys,{"Unit, Array":function(e,t){return e.splitUnit(t)}})}),Xs="square",Ks=j(Xs,["typed"],e=>{var{typed:t}=e;return t(Xs,{number:ia,Complex:function(e){return e.mul(e)},BigNumber:function(e){return e.times(e)},Fraction:function(e){return e.mul(e)},"Array | Matrix":function(e){return ct(e,this,!0)},Unit:function(e){return e.pow(2)}})}),eu="string",tu=j(eu,["typed"],e=>{var{typed:t}=e;return t(eu,{"":function(){return""},number:h,null:function(e){return"null"},boolean:function(e){return e+""},string:function(e){return e},"Array | Matrix":function(e){return ct(e,this)},any:function(e){return String(e)}})}),ru=j("tan",["typed"],e=>{var{typed:t}=e;return t("tan",{number:Math.tan,Complex:function(e){return e.tan()},BigNumber:function(e){return e.tan()},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function tan is no angle");return this(e.value)},"Array | Matrix":function(e){return ct(e,this,!0)}})}),nu="typeOf",iu=j(nu,["typed"],e=>{var{typed:t}=e;return t(nu,{any:o.QP})}),au="acosh",ou=j(au,["typed","config","Complex"],e=>{var{typed:t,config:r,Complex:n}=e;return t(au,{number:function(e){return e>=1||r.predictable?da(e):e<=-1?new n(Math.log(Math.sqrt(e*e-1)-e),Math.PI):new n(e,0).acosh()},Complex:function(e){return e.acosh()},BigNumber:function(e){return e.acosh()},"Array | Matrix":function(e){return ct(e,this)}})}),su="acsch",uu=j(su,["typed","BigNumber"],e=>{var{typed:t,BigNumber:r}=e;return t(su,{number:va,Complex:function(e){return e.acsch()},BigNumber:function(e){return new r(1).div(e).asinh()},"Array | Matrix":function(e){return ct(e,this)}})}),cu="asec",lu=j(cu,["typed","config","Complex","BigNumber"],e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(cu,{number:function(e){return e<=-1||e>=1||r.predictable?xa(e):new n(e,0).asec()},Complex:function(e){return e.asec()},BigNumber:function(e){return new i(1).div(e).acos()},"Array | Matrix":function(e){return ct(e,this)}})}),fu=j("bin",["typed","format"],e=>{var{typed:t,format:r}=e;return t("bin",{"number | BigNumber":function(e){return r(e,{notation:"bin"})},"number | BigNumber, number":function(e,t){return r(e,{notation:"bin",wordSize:t})}})}),pu="combinationsWithRep",mu=j(pu,["typed"],e=>{var{typed:t}=e;return t(pu,{"number, number":function(e,t){if(!s(e)||e<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!s(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 t<e-1?po(e,e+t-1)/po(1,t):po(t+1,e+t-1)/po(1,e-1)},"BigNumber, BigNumber":function(e,t){var r,n,i=new(0,e.constructor)(1),a=e.minus(i);if(!du(e)||!du(t))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(e.lt(i))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(r=i,t.lt(a))for(n=i;n.lte(a);n=n.plus(i))r=r.times(t.plus(n)).dividedBy(n);else for(n=i;n.lte(t);n=n.plus(i))r=r.times(a.plus(n)).dividedBy(n);return r}})});function du(e){return e.isInteger()&&e.gte(0)}var hu=j("cos",["typed"],e=>{var{typed:t}=e;return t("cos",{number:Math.cos,Complex:function(e){return e.cos()},BigNumber:function(e){return e.cos()},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cos is no angle");return this(e.value)},"Array | Matrix":function(e){return ct(e,this)}})}),yu="csch",gu=j(yu,["typed","BigNumber"],e=>{var{typed:t,BigNumber:r}=e;return t(yu,{number:Aa,Complex:function(e){return e.csch()},BigNumber:function(e){return new r(1).div(e.sinh())},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function csch is no angle");return this(e.value)},"Array | Matrix":function(e){return ct(e,this)}})}),vu="isNaN",xu=j(vu,["typed"],e=>{var{typed:t}=e;return t(vu,{number:ns,BigNumber:function(e){return e.isNaN()},Fraction:function(e){return!1},Complex:function(e){return e.isNaN()},Unit:function(e){return Number.isNaN(e.value)},"Array | Matrix":function(e){return ct(e,Number.isNaN)}})}),bu="isPrime",wu=j(bu,["typed"],e=>{var{typed:t}=e;return t(bu,{number:function(e){if(0*e!=0)return!1;if(e<=3)return e>1;if(e%2==0||e%3==0)return!1;for(var t=5;t*t<=e;t+=6)if(e%t===0||e%(t+2)===0)return!1;return!0},BigNumber:function(e){if(0*e.toNumber()!=0)return!1;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))){for(var t=e.toNumber(),r=5;r*r<=t;r+=6)if(t%r===0||t%(r+2)===0)return!1;return!0}function n(e,t,r){for(var n=1;!t.eq(0);)t.mod(2).eq(0)?(t=t.div(2),e=e.mul(e).mod(r)):(t=t.sub(1),n=e.mul(n).mod(r));return n}for(var i=e.constructor.clone({precision:2*e.toFixed(0).length}),a=0,o=(e=new i(e)).sub(1);o.mod(2).eq(0);)o=o.div(2),a+=1;var s=null;if(e.lt("3317044064679887385961981"))s=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(t=>t<e);else{var u=Math.min(e.toNumber()-2,Math.floor(2*Math.pow(e.toFixed(0).length*Math.log(10),2)));s=[];for(var c=2;c<=u;c+=1)s.push(u)}for(var l=0;l<s.length;l+=1){var f=s[l],p=n(e.sub(e).add(f),o,e);if(!p.eq(1))for(var m=0,d=p;!d.eq(e.sub(1));m+=1,d=d.mul(d).mod(e))if(m===a-1)return!1}return!0},"Array | Matrix":function(e){return ct(e,this)}})}),Nu="randomInt",Mu=j(Nu,["typed","config","?on"],e=>{var{typed:t,config:r,on:n}=e,i=Is(r.randomSeed);return n&&n("config",function(e,t){e.randomSeed!==t.randomSeed&&(i=Is(e.randomSeed))}),t(Nu,{"":()=>s(0,1),number:e=>s(0,e),"number, number":(e,t)=>s(e,t),"Array | Matrix":e=>a(e,0,1),"Array | Matrix, number":(e,t)=>a(e,0,t),"Array | Matrix, number, number":(e,t,r)=>a(e,t,r)});function a(e,t,r){var n=js(e.valueOf(),()=>s(t,r));return(0,o.OA)(e)?e.create(n):n}function s(e,t){return Math.floor(e+i()*(t-e))}}),Su="sech",Eu=j(Su,["typed","BigNumber"],e=>{var{typed:t,BigNumber:r}=e;return t(Su,{number:Ca,Complex:function(e){return e.sech()},BigNumber:function(e){return new r(1).div(e.cosh())},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sech is no angle");return this(e.value)},"Array | Matrix":function(e){return ct(e,this)}})}),Au="sinh",Ou=j(Au,["typed"],e=>{var{typed:t}=e;return t(Au,{number:_a,Complex:function(e){return e.sinh()},BigNumber:function(e){return e.sinh()},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sinh is no angle");return this(e.value)},"Array | Matrix":function(e){return ct(e,this,!0)}})}),Cu="sparse",_u=j(Cu,["typed","SparseMatrix"],e=>{var{typed:t,SparseMatrix:r}=e;return t(Cu,{"":function(){return new r([])}
1,string:function(e){return new r([],e)},"Array | Matrix":function(e){return new r(e)},"Array | Matrix, string":function(e,t){return new r(e,t)}})}),Tu=j("sqrt",["config","typed","Complex"],e=>{var{config:t,typed:r,Complex:n}=e;return r("sqrt",{number:i,Complex:function(e){return e.sqrt()},BigNumber:function(e){return!e.isNegative()||t.predictable?e.sqrt():i(e.toNumber())},"Array | Matrix":function(e){return ct(e,this,!0)},Unit:function(e){return e.pow(.5)}});function i(e){return isNaN(e)?NaN:e>=0||t.predictable?Math.sqrt(e):new n(e,0).sqrt()}}),Bu=j("tanh",["typed"],e=>{var{typed:t}=e;return t("tanh",{number:C,Complex:function(e){return e.tanh()},BigNumber:function(e){return e.tanh()},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function tanh is no angle");return this(e.value)},"Array | Matrix":function(e){return ct(e,this,!0)}})}),zu="unaryMinus",qu=j(zu,["typed"],e=>{var{typed:t}=e;return t(zu,{number:Gi,Complex:function(e){return e.neg()},BigNumber:function(e){return e.neg()},Fraction:function(e){return e.neg()},Unit:function(e){var t=e.clone();return t.value=this(e.value),t},"Array | Matrix":function(e){return ct(e,this,!0)}})}),Du="acoth",Iu=j(Du,["typed","config","Complex","BigNumber"],e=>{var{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(Du,{number:function(e){return e>=1||e<=-1||r.predictable?ya(e):new n(e,0).acoth()},Complex:function(e){return e.acoth()},BigNumber:function(e){return new i(1).div(e).atanh()},"Array | Matrix":function(e){return ct(e,this)}})}),ku=j("cot",["typed","BigNumber"],e=>{var{typed:t,BigNumber:r}=e;return t("cot",{number:Ma,Complex:function(e){return e.cot()},BigNumber:function(e){return new r(1).div(e.tan())},Unit:function(e){if(!e.hasBase(e.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return this(e.value)},"Array | Matrix":function(e){return ct(e,this)}})}),Ru=j("fraction",["typed","Fraction"],e=>{var{typed:t,Fraction:r}=e;return t("fraction",{number:function(e){if(!isFinite(e)||isNaN(e))throw new Error(e+" cannot be represented as a fraction");return new r(e)},string:function(e){return new r(e)},"number, number":function(e,t){return new r(e,t)},null:function(e){return new r(0)},BigNumber:function(e){return new r(e.toString())},Fraction:function(e){return e},Object:function(e){return new r(e)},"Array | Matrix":function(e){return ct(e,this)}})}),Uu="isNumeric",Pu=j(Uu,["typed"],e=>{var{typed:t}=e;return t(Uu,{"number | BigNumber | Fraction | boolean":function(){return!0},"Complex | Unit | string | null | undefined | Node":function(){return!1},"Array | Matrix":function(e){return ct(e,this)}})}),Fu="matrix",ju=j(Fu,["typed","Matrix","DenseMatrix","SparseMatrix"],e=>{var{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(Fu,{"":function(){return a([])},string:function(e){return a([],e)},"string, string":function(e,t){return a([],e,t)},Array:function(e){return a(e)},Matrix:function(e){return a(e,e.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(e,t,r){if("dense"===t||"default"===t||void 0===t)return new n(e,r);if("sparse"===t)return new i(e,r);throw new TypeError("Unknown matrix type "+JSON.stringify(t)+".")}}),Lu="matrixFromFunction",$u=j(Lu,["typed","matrix","isZero"],e=>{var{typed:t,matrix:r,isZero:n}=e;return t(Lu,{"Array | Matrix, function, string, string":function(e,t,r,n){return i(e,t,r,n)},"Array | Matrix, function, string":function(e,t,r){return i(e,t,r)},"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,r){return i(e,r,t)},"Array | Matrix, string, string, function":function(e,t,r,n){return i(e,n,t,r)}});function i(e,t,i,a){var o;return(o=void 0!==a?r(i,a):r(i)).resize(e),o.forEach(function(e,r){var i=t(r);n(i)||o.set(r,i)}),o}}),Hu=j("algorithm02",["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return function(e,n,i,a){var o=e._data,s=e._size,u=e._datatype,c=n._values,l=n._index,f=n._ptr,p=n._size,m=n._datatype;if(s.length!==p.length)throw new ae(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");var d,h=s[0],y=s[1],g=r,v=0,x=i;"string"==typeof u&&u===m&&(d=u,g=t.find(r,[d,d]),v=t.convert(0,d),x=t.find(i,[d,d]));for(var b=[],w=[],N=[],M=0;M<y;M++){N[M]=w.length;for(var S=f[M],E=f[M+1],A=S;A<E;A++){var O=l[A],C=a?x(c[A],o[O][M]):x(o[O][M],c[A]);g(C,v)||(w.push(O),b.push(C))}}return N[y]=w.length,n.createSparseMatrix({values:b,index:w,ptr:N,size:[h,y],datatype:d})}}),Gu=j("algorithm03",["typed"],e=>{var{typed:t}=e;return function(e,r,n,i){var a=e._data,o=e._size,s=e._datatype,u=r._values,c=r._index,l=r._ptr,f=r._size,p=r._datatype;if(o.length!==f.length)throw new ae(o.length,f.length);if(o[0]!==f[0]||o[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+f+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m,d=o[0],h=o[1],y=0,g=n;"string"==typeof s&&s===p&&(m=s,y=t.convert(0,m),g=t.find(n,[m,m]));for(var v=[],x=0;x<d;x++)v[x]=[];for(var b=[],w=[],N=0;N<h;N++){for(var M=N+1,S=l[N],E=l[N+1],A=S;A<E;A++){var O=c[A];b[O]=i?g(u[A],a[O][N]):g(a[O][N],u[A]),w[O]=M}for(var C=0;C<d;C++)w[C]===M?v[C][N]=b[C]:v[C][N]=i?g(y,a[C][N]):g(a[C][N],y)}return e.createDenseMatrix({data:v,size:[d,h],datatype:m})}}),Vu=j("algorithm05",["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return function(e,n,i){var a=e._values,o=e._index,s=e._ptr,u=e._size,c=e._datatype,l=n._values,f=n._index,p=n._ptr,m=n._size,d=n._datatype;if(u.length!==m.length)throw new ae(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+")");var h,y=u[0],g=u[1],v=r,x=0,b=i;"string"==typeof c&&c===d&&(h=c,v=t.find(r,[h,h]),x=t.convert(0,h),b=t.find(i,[h,h]));var w,N,M,S,E=a&&l?[]:void 0,A=[],O=[],C=E?[]:void 0,_=E?[]:void 0,T=[],B=[];for(N=0;N<g;N++){O[N]=A.length;var z=N+1;for(M=s[N],S=s[N+1];M<S;M++)w=o[M],A.push(w),T[w]=z,C&&(C[w]=a[M]);for(M=p[N],S=p[N+1];M<S;M++)T[w=f[M]]!==z&&A.push(w),B[w]=z,_&&(_[w]=l[M]);if(E)for(M=O[N];M<A.length;){var q=T[w=A[M]],D=B[w];if(q===z||D===z){var I=b(q===z?C[w]:x,D===z?_[w]:x);v(I,x)?A.splice(M,1):(E.push(I),M++)}}}return O[g]=A.length,e.createSparseMatrix({values:E,index:A,ptr:O,size:[y,g],datatype:h})}}),Zu=j("algorithm11",["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return function(e,n,i,a){var o=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!o)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var f,p=c[0],m=c[1],d=r,h=0,y=i;"string"==typeof l&&(f=l,d=t.find(r,[f,f]),h=t.convert(0,f),n=t.convert(n,f),y=t.find(i,[f,f]));for(var g=[],v=[],x=[],b=0;b<m;b++){x[b]=v.length;
1for(var w=u[b],N=u[b+1],M=w;M<N;M++){var S=s[M],E=a?y(n,o[M]):y(o[M],n);d(E,h)||(v.push(S),g.push(E))}}return x[m]=v.length,e.createSparseMatrix({values:g,index:v,ptr:x,size:[p,m],datatype:f})}}),Wu=j("algorithm12",["typed","DenseMatrix"],e=>{var{typed:t,DenseMatrix:r}=e;return function(e,n,i,a){var o=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!o)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var f,p=c[0],m=c[1],d=i;"string"==typeof l&&(f=l,n=t.convert(n,f),d=t.find(i,[f,f]));for(var h=[],y=[],g=[],v=0;v<m;v++){for(var x=v+1,b=u[v],w=u[v+1],N=b;N<w;N++){var M=s[N];y[M]=o[N],g[M]=x}for(var S=0;S<p;S++)0===v&&(h[S]=[]),g[S]===x?h[S][v]=a?d(n,y[S]):d(y[S],n):h[S][v]=a?d(n,0):d(0,n)}return new r({data:h,size:[p,m],datatype:f})}}),Ju=j("algorithm13",["typed"],e=>{var{typed:t}=e;return function(e,n,i){var a,o=e._data,s=e._size,u=e._datatype,c=n._data,l=n._size,f=n._datatype,p=[];if(s.length!==l.length)throw new ae(s.length,l.length);for(var m=0;m<s.length;m++){if(s[m]!==l[m])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+l+")");p[m]=s[m]}var d=i;"string"==typeof u&&u===f&&(a=u,d=t.find(i,[a,a]));var h=p.length>0?r(d,0,p,p[0],o,c):[];return e.createDenseMatrix({data:h,size:p,datatype:a})};function r(e,t,n,i,a,o){var s=[];if(t===n.length-1)for(var u=0;u<i;u++)s[u]=e(a[u],o[u]);else for(var c=0;c<i;c++)s[c]=r(e,t+1,n,n[t+1],a[c],o[c]);return s}}),Yu=j("algorithm14",["typed"],e=>{var{typed:t}=e;return function(e,n,i,a){var o,s=e._data,u=e._size,c=e._datatype,l=i;"string"==typeof c&&(o=c,n=t.convert(n,o),l=t.find(i,[o,o]));var f=u.length>0?r(l,0,u,u[0],s,n,a):[];return e.createDenseMatrix({data:f,size:R(u),datatype:o})};function r(e,t,n,i,a,o,s){var u=[];if(t===n.length-1)for(var c=0;c<i;c++)u[c]=s?e(o,a[c]):e(a[c],o);else for(var l=0;l<i;l++)u[l]=r(e,t+1,n,n[t+1],a[l],o,s);return u}}),Qu=j("mod",["typed","matrix","equalScalar","DenseMatrix"],e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i}=e,a=Hu({typed:t,equalScalar:n}),o=Gu({typed:t}),s=Vu({typed:t,equalScalar:n}),u=Zu({typed:t,equalScalar:n}),c=Wu({typed:t,DenseMatrix:i}),l=Ju({typed:t}),f=Yu({typed:t});return t("mod",{"number, number":ta,"BigNumber, BigNumber":function(e,t){if(t.isNeg())throw new Error("Cannot calculate mod for a negative divisor");return t.isZero()?e:e.mod(t)},"Fraction, Fraction":function(e,t){if(t.compare(0)<0)throw new Error("Cannot calculate mod for a negative divisor");return e.compare(0)>=0?e.mod(t):e.mod(t).add(t).mod(t)},"SparseMatrix, SparseMatrix":function(e,t){return s(e,t,this,!1)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return o(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return l(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, any":function(e,t){return u(e,t,this,!1)},"DenseMatrix, any":function(e,t){return f(e,t,this,!1)},"any, SparseMatrix":function(e,t){return c(t,e,this,!0)},"any, DenseMatrix":function(e,t){return f(t,e,this,!0)},"Array, any":function(e,t){return f(r(e),t,this,!1).valueOf()},"any, Array":function(e,t){return f(r(t),e,this,!0).valueOf()}})}),Xu=j("algorithm01",["typed"],e=>{var{typed:t}=e;return function(e,r,n,i){var a=e._data,o=e._size,s=e._datatype,u=r._values,c=r._index,l=r._ptr,f=r._size,p=r._datatype;if(o.length!==f.length)throw new ae(o.length,f.length);if(o[0]!==f[0]||o[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+f+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m,d,h=o[0],y=o[1],g="string"==typeof s&&s===p?s:void 0,v=g?t.find(n,[g,g]):n,x=[];for(m=0;m<h;m++)x[m]=[];var b=[],w=[];for(d=0;d<y;d++){for(var N=d+1,M=l[d],S=l[d+1],E=M;E<S;E++)b[m=c[E]]=i?v(u[E],a[m][d]):v(a[m][d],u[E]),w[m]=N;for(m=0;m<h;m++)w[m]===N?x[m][d]=b[m]:x[m][d]=a[m][d]}return e.createDenseMatrix({data:x,size:[h,y],datatype:g})}}),Ku=j("algorithm06",["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return function(e,n,i){var a=e._values,o=e._size,s=e._datatype,u=n._values,c=n._size,l=n._datatype;if(o.length!==c.length)throw new ae(o.length,c.length);if(o[0]!==c[0]||o[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+c+")");
1var f,p=o[0],m=o[1],d=r,h=0,y=i;"string"==typeof s&&s===l&&(f=s,d=t.find(r,[f,f]),h=t.convert(0,f),y=t.find(i,[f,f]));for(var g=a&&u?[]:void 0,v=[],x=[],b=g?[]:void 0,w=[],N=[],M=0;M<m;M++){x[M]=v.length;var S=M+1;if(pt(e,M,w,b,N,S,v,y),pt(n,M,w,b,N,S,v,y),b)for(var E=x[M];E<v.length;){var A=v[E];if(N[A]===S){var O=b[A];d(O,h)?v.splice(E,1):(g.push(O),E++)}else v.splice(E,1)}else for(var C=x[M];C<v.length;)N[v[C]]!==S?v.splice(C,1):C++}return x[m]=v.length,e.createSparseMatrix({values:g,index:v,ptr:x,size:[p,m],datatype:f})}}),ec="nthRoot",tc=j(ec,["typed","matrix","equalScalar","BigNumber"],e=>{var{typed:t,matrix:r,equalScalar:n,BigNumber:i}=e,a=Xu({typed:t}),o=Hu({typed:t,equalScalar:n}),s=Ku({typed:t,equalScalar:n}),u=Zu({typed:t,equalScalar:n}),c=Ju({typed:t}),l=Yu({typed:t}),f="Complex number not supported in function nthRoot. Use nthRoots instead.";return t(ec,{number:ra,"number, number":ra,BigNumber:function(e){return p(e,new i(2))},Complex:function(e){throw new Error(f)},"Complex, number":function(e,t){throw new Error(f)},"BigNumber, BigNumber":p,"Array | Matrix":function(e){return this(e,2)},"SparseMatrix, SparseMatrix":function(e,t){if(1===t.density())return s(e,t,this);throw new Error("Root must be non-zero")},"SparseMatrix, DenseMatrix":function(e,t){return o(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){if(1===t.density())return a(e,t,this,!1);throw new Error("Root must be non-zero")},"DenseMatrix, DenseMatrix":function(e,t){return c(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, number | BigNumber":function(e,t){return u(e,t,this,!1)},"DenseMatrix, number | BigNumber":function(e,t){return l(e,t,this,!1)},"number | BigNumber, SparseMatrix":function(e,t){if(1===t.density())return u(t,e,this,!0);throw new Error("Root must be non-zero")},"number | BigNumber, DenseMatrix":function(e,t){return l(t,e,this,!0)},"Array, number | BigNumber":function(e,t){return this(r(e),t).valueOf()},"number | BigNumber, Array":function(e,t){return this(e,r(t)).valueOf()}});function p(e,t){var r=i.precision,n=i.clone({precision:r+2}),a=new i(0),o=new n(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 n(1/0):0;if(!e.isFinite())return s?a:e;var u=e.abs().pow(o.div(t));return u=e.isNeg()?u.neg():u,new i((s?o.div(u):u).toPrecision(r))}}),rc=j("numeric",["number","?bignumber","?fraction"],e=>{var{number:t,bignumber:r,fraction:n}=e,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:e=>t(e),BigNumber:r?e=>r(e):Ot,Fraction:n?e=>n(e):Ct};return function(e,t){var r=(0,o.QP)(e);if(!(r in i))throw new TypeError("Cannot convert "+e+' of type "'+r+'"; valid input types are '+Object.keys(i).join(", "));if(!(t in a))throw new TypeError("Cannot convert "+e+' to type "'+t+'"; valid output types are '+Object.keys(a).join(", "));return t===r?e:a[t](e)}}),nc=j("or",["typed","matrix","equalScalar","DenseMatrix"],e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i}=e,a=Gu({typed:t}),o=Vu({typed:t,equalScalar:n}),s=Wu({typed:t,DenseMatrix:i}),u=Ju({typed:t}),c=Yu({typed:t});return t("or",{"number, number":Os,"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()},"Unit, Unit":function(e,t){return this(e.value||0,t.value||0)},"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,this)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return a(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, any":function(e,t){return s(e,t,this,!1)},"DenseMatrix, any":function(e,t){return c(e,t,this,!1)},"any, SparseMatrix":function(e,t){return s(t,e,this,!0)},"any, DenseMatrix":function(e,t){return c(t,e,this,!0)},"Array, any":function(e,t){return c(r(e),t,this,!1).valueOf()}
1,"any, Array":function(e,t){return c(r(t),e,this,!0).valueOf()}})}),ic="prod",ac=j(ic,["typed","config","multiplyScalar","numeric"],e=>{var{typed:t,config:r,multiplyScalar:n,numeric:i}=e;return t(ic,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("prod(A, dim) is not yet supported")},"...":function(e){return a(e)}});function a(e){var t;if(ut(e,function(e){try{t=void 0===t?e:n(t,e)}catch(t){throw Nr(t,"prod",e)}}),"string"==typeof t&&(t=i(t,r.number)),void 0===t)throw new Error("Cannot calculate prod of an empty array");return t}}),oc="reshape",sc=j(oc,["typed","isInteger","matrix"],e=>{var{typed:t,isInteger:r}=e;return t(oc,{"Matrix, Array":function(e,t){return e.reshape(t)},"Array, Array":function(e,t){return t.forEach(function(e){if(!r(e))throw new TypeError("Invalid size for dimension: "+e)}),me(e,t)}})}),uc="size",cc=j(uc,["typed","config","?matrix"],e=>{var{typed:t,config:r,matrix:n}=e;return t(uc,{Matrix:function(e){return e.create(e.size())},Array:se,string:function(e){return"Array"===r.matrix?[e.length]:n([e.length])},"number | Complex | BigNumber | Unit | boolean | null":function(e){return"Array"===r.matrix?[]:n?n([]):_t()}})}),lc=j("algorithm07",["typed","DenseMatrix"],e=>{var{typed:t,DenseMatrix:r}=e;return function(e,i,a){var o=e._size,s=e._datatype,u=i._size,c=i._datatype;if(o.length!==u.length)throw new ae(o.length,u.length);if(o[0]!==u[0]||o[1]!==u[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+u+")");var l,f,p,m=o[0],d=o[1],h=0,y=a;"string"==typeof s&&s===c&&(l=s,h=t.convert(0,l),y=t.find(a,[l,l]));var g=[];for(f=0;f<m;f++)g[f]=[];var v=[],x=[],b=[],w=[];for(p=0;p<d;p++){var N=p+1;for(n(e,p,b,v,N),n(i,p,w,x,N),f=0;f<m;f++){var M=b[f]===N?v[f]:h,S=w[f]===N?x[f]:h;g[f][p]=y(M,S)}}return new r({data:g,size:[m,d],datatype:l})};function n(e,t,r,n,i){for(var a=e._values,o=e._index,s=e._ptr,u=s[t],c=s[t+1];u<c;u++){var l=o[u];r[l]=i,n[l]=a[u]}}}),fc="smaller",pc=j(fc,["typed","config","matrix","DenseMatrix"],e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i}=e,a=Gu({typed:t}),o=lc({typed:t,DenseMatrix:i}),s=Wu({typed:t,DenseMatrix:i}),u=Ju({typed:t}),c=Yu({typed:t});return t(fc,{"boolean, boolean":function(e,t){return e<t},"number, number":function(e,t){return e<t&&!N(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.lt(t)&&!Co(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return-1===e.compare(t)},"Complex, Complex":function(e,t){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return this(e.value,t.value)},"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,this)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return a(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,this)},"Array, Array":function(e,t){return this(n(e),n(t)).valueOf()},"Array, Matrix":function(e,t){return this(n(e),t)},"Matrix, Array":function(e,t){return this(e,n(t))},"SparseMatrix, any":function(e,t){return s(e,t,this,!1)},"DenseMatrix, any":function(e,t){return c(e,t,this,!1)},"any, SparseMatrix":function(e,t){return s(t,e,this,!0)},"any, DenseMatrix":function(e,t){return c(t,e,this,!0)},"Array, any":function(e,t){return c(n(e),t,this,!1).valueOf()},"any, Array":function(e,t){return c(n(t),e,this,!0).valueOf()}})}),mc="squeeze",dc=j(mc,["typed","matrix"],e=>{var{typed:t,matrix:r}=e;return t(mc,{Array:function(e){return ye(R(e))},Matrix:function(e){var t=ye(e.toArray());return Array.isArray(t)?r(t):t},any:function(e){return R(e)}})}),hc=j("algorithm10",["typed","DenseMatrix"],e=>{var{typed:t,DenseMatrix:r}=e;return function(e,n,i,a){var o=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!o)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var f,p=c[0],m=c[1],d=i;"string"==typeof l&&(f=l,n=t.convert(n,f),d=t.find(i,[f,f]));for(var h=[],y=[],g=[],v=0;v<m;v++){for(var x=v+1,b=u[v],w=u[v+1],N=b;N<w;N++){var M=s[N];y[M]=o[N],g[M]=x}for(var S=0;S<p;S++)0===v&&(h[S]=[]),g[S]===x?h[S][v]=a?d(n,y[S]):d(y[S],n):h[S][v]=n}return new r({data:h,size:[p,m],datatype:f})}}),yc="subtract",gc=j(yc,["typed","matrix","equalScalar","addScalar","unaryMinus","DenseMatrix"],e=>{var{typed:t,matrix:r,equalScalar:n,addScalar:i,unaryMinus:a,DenseMatrix:o}=e,s=Xu({typed:t}),u=Gu({typed:t}),c=Vu({typed:t,equalScalar:n}),l=hc({typed:t,DenseMatrix:o}),f=Ju({typed:t}),p=Yu({typed:t});return t(yc,{"number, number":function(e,t){return e-t},"Complex, Complex":function(e,t){return e.sub(t)},"BigNumber, BigNumber":function(e,t){return e.minus(t)},"Fraction, Fraction":function(e,t){return e.sub(t)},"Unit, Unit":function(e,t){if(null===e.value)throw new Error("Parameter x contains a unit with undefined value");if(null===t.value)throw new Error("Parameter y contains a unit with undefined value");if(!e.equalBase(t))throw new Error("Units do not match");var r=e.clone();return r.value=this(r.value,t.value),r.fixPrefix=!1,r}
1,"SparseMatrix, SparseMatrix":function(e,t){return vc(e,t),c(e,t,this)},"SparseMatrix, DenseMatrix":function(e,t){return vc(e,t),u(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return vc(e,t),s(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return vc(e,t),f(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, any":function(e,t){return l(e,a(t),i)},"DenseMatrix, any":function(e,t){return p(e,t,this)},"any, SparseMatrix":function(e,t){return l(t,e,this,!0)},"any, DenseMatrix":function(e,t){return p(t,e,this,!0)},"Array, any":function(e,t){return p(r(e),t,this,!1).valueOf()},"any, Array":function(e,t){return p(r(t),e,this,!0).valueOf()}})});function vc(e,t){var r=e.size(),n=t.size();if(r.length!==n.length)throw new ae(r.length,n.length)}var xc=j("to",["typed","matrix"],e=>{var{typed:t,matrix:r}=e,n=Ju({typed:t}),i=Yu({typed:t});return t("to",{"Unit, Unit | string":function(e,t){return e.to(t)},"Matrix, Matrix":function(e,t){return n(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"Matrix, any":function(e,t){return i(e,t,this,!1)},"any, Matrix":function(e,t){return i(t,e,this,!0)},"Array, any":function(e,t){return i(r(e),t,this,!1).valueOf()},"any, Array":function(e,t){return i(r(t),e,this,!0).valueOf()}})}),bc=j("transpose",["typed","matrix"],e=>{var{typed:t,matrix:r}=e;return t("transpose",{Array:function(e){return this(r(e)).valueOf()},Matrix:function(e){var t,r=e.size();switch(r.length){case 1:t=e.clone();break;case 2:var n=r[0],i=r[1];if(0===i)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+z(r)+")");switch(e.storage()){case"dense":t=function(e,t,r){for(var n,i=e._data,a=[],o=0;o<r;o++){n=a[o]=[];for(var s=0;s<t;s++)n[s]=R(i[s][o])}return e.createDenseMatrix({data:a,size:[r,t],datatype:e._datatype})}(e,n,i);break;case"sparse":t=function(e,t,r){for(var n,i,a,o=e._values,s=e._index,u=e._ptr,c=o?[]:void 0,l=[],f=[],p=[],m=0;m<t;m++)p[m]=0;for(n=0,i=s.length;n<i;n++)p[s[n]]++;for(var d=0,h=0;h<t;h++)f.push(d),d+=p[h],p[h]=f[h];for(f.push(d),a=0;a<r;a++)for(var y=u[a],g=u[a+1],v=y;v<g;v++){var x=p[s[v]]++;l[x]=a,o&&(c[x]=R(o[v]))}return e.createSparseMatrix({values:c,index:l,ptr:f,size:[r,t],datatype:e._datatype})}(e,n,i)}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+z(this._size)+")")}return t},any:function(e){return R(e)}})}),wc="xgcd",Nc=j(wc,["typed","config","matrix","BigNumber"],e=>{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t(wc,{"number, number":function(e,t){var i=aa(e,t);return"Array"===r.matrix?i:n(i)},"BigNumber, BigNumber":function(e,t){var a,o,s,u,c=new i(0),l=new i(1),f=c,p=l,m=l,d=c;if(!e.isInt()||!t.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!t.isZero();)o=e.div(t).floor(),s=e.mod(t),a=f,f=p.minus(o.times(f)),p=a,a=m,m=d.minus(o.times(m)),d=a,e=t,t=s;return u=e.lt(c)?[e.neg(),p.neg(),d.neg()]:[e,e.isZero()?0:p,d],"Array"===r.matrix?u:n(u)}})}),Mc="zeros",Sc=j(Mc,["typed","config","matrix","BigNumber"],e=>{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t(Mc,{"":function(){return"Array"===r.matrix?a([]):a([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){var t=e.pop();return a(e,t)}return"Array"===r.matrix?a(e):a(e,"default")},Array:a,Matrix:function(e){var t=e.storage();return a(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return a(e.valueOf(),t)}});function a(e,t){var r=function(e){var t=!1;return e.forEach(function(e,r,n){(0,o.C4)(e)&&(t=!0,n[r]=e.toNumber())}),t}(e),a=r?new i(0):0;if(function(e){e.forEach(function(e){if("number"!=typeof e||!s(e)||e<0)throw new Error("Parameters in function zeros must be positive integers")})}(e),t){var u=n(t);return e.length>0?u.resize(e,a):u}var c=[];return e.length>0?fe(c,e,a):c}}
1),Ec=j("and",["typed","matrix","equalScalar","zeros","not"],e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,not:a}=e,o=Hu({typed:t,equalScalar:n}),s=Ku({typed:t,equalScalar:n}),u=Zu({typed:t,equalScalar:n}),c=Ju({typed:t}),l=Yu({typed:t});return t("and",{"number, number":_s,"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())},"Unit, Unit":function(e,t){return this(e.value||0,t.value||0)},"SparseMatrix, SparseMatrix":function(e,t){return s(e,t,this,!1)},"SparseMatrix, DenseMatrix":function(e,t){return o(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return o(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return c(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, any":function(e,t){return a(t)?i(e.size(),e.storage()):u(e,t,this,!1)},"DenseMatrix, any":function(e,t){return a(t)?i(e.size(),e.storage()):l(e,t,this,!1)},"any, SparseMatrix":function(e,t){return a(e)?i(e.size(),e.storage()):u(t,e,this,!0)},"any, DenseMatrix":function(e,t){return a(e)?i(e.size(),e.storage()):l(t,e,this,!0)},"Array, any":function(e,t){return this(r(e),t).valueOf()},"any, Array":function(e,t){return this(e,r(t)).valueOf()}})}),Ac="bitAnd",Oc=j(Ac,["typed","matrix","equalScalar"],e=>{var{typed:t,matrix:r,equalScalar:n}=e,i=Hu({typed:t,equalScalar:n}),a=Ku({typed:t,equalScalar:n}),o=Zu({typed:t,equalScalar:n}),s=Ju({typed:t}),u=Yu({typed:t});return t(Ac,{"number, number":Ka,"BigNumber, BigNumber":Ha,"SparseMatrix, SparseMatrix":function(e,t){return a(e,t,this,!1)},"SparseMatrix, DenseMatrix":function(e,t){return i(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return i(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return s(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, any":function(e,t){return o(e,t,this,!1)},"DenseMatrix, any":function(e,t){return u(e,t,this,!1)},"any, SparseMatrix":function(e,t){return o(t,e,this,!0)},"any, DenseMatrix":function(e,t){return u(t,e,this,!0)},"Array, any":function(e,t){return u(r(e),t,this,!1).valueOf()},"any, Array":function(e,t){return u(r(t),e,this,!0).valueOf()}})}),Cc="bitXor",_c=j(Cc,["typed","matrix","DenseMatrix"],e=>{var{typed:t,matrix:r,DenseMatrix:n}=e,i=Gu({typed:t}),a=lc({typed:t,DenseMatrix:n}),o=Wu({typed:t,DenseMatrix:n}),s=Ju({typed:t}),u=Yu({typed:t});return t(Cc,{"number, number":ro,"BigNumber, BigNumber":Ja,"SparseMatrix, SparseMatrix":function(e,t){return a(e,t,this)},"SparseMatrix, DenseMatrix":function(e,t){return i(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return i(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return s(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, any":function(e,t){return o(e,t,this,!1)},"DenseMatrix, any":function(e,t){return u(e,t,this,!1)},"any, SparseMatrix":function(e,t){return o(t,e,this,!0)},"any, DenseMatrix":function(e,t){return u(t,e,this,!0)},"Array, any":function(e,t){return u(r(e),t,this,!1).valueOf()},"any, Array":function(e,t){return u(r(t),e,this,!0).valueOf()}})}),Tc="cbrt",Bc=j(Tc,["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],e=>{var{config:t,typed:r,isNegative:n,unaryMinus:i,matrix:a,Complex:s,BigNumber:u,Fraction:c}=e;return r(Tc,{number:Zi,Complex:l,"Complex, boolean":l,BigNumber:function(e){return e.cbrt()},Unit:function(e){if(e.value&&(0,o.Zd)(e.value)){var t=e.clone();return t.value=1,(t=t.pow(1/3)).value=l(e.value),t}var r,a=n(e.value);a&&(e.value=i(e.value)),r=(0,o.C4)(e.value)?new u(1).div(3):(0,o.fU)(e.value)?new c(1,3):1/3;var s=e.pow(r);return a&&(s.value=i(s.value)),s},"Array | Matrix":function(e){return ct(e,this,!0)}});function l(e,r){var n=e.arg()/3,i=e.abs(),o=new s(Zi(i),0).mul(new s(0,n).exp());if(r){var u=[o,new s(Zi(i),0).mul(new s(0,n+2*Math.PI/3).exp()),new s(Zi(i),0).mul(new s(0,n-2*Math.PI/3).exp())];return"Array"===t.matrix?u:a(u)}return o}}),zc="compare",qc=j(zc,["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix"],e=>{var{typed:t,config:r,equalScalar:n,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:s}=e,u=Gu({typed:t}),c=Vu({typed:t,equalScalar:n}),l=Wu({typed:t,DenseMatrix:s}),f=Ju({typed:t}),p=Yu({typed:t});return t(zc,{"boolean, boolean":function(e,t){return e===t?0:e>t?1:-1},"number, number":function(e,t){return N(e,t,r.epsilon)?0:e>t?1:-1},"BigNumber, BigNumber":function(e,t){return Co(e,t,r.epsilon)?new a(0):new a(e.cmp(t))},"Fraction, Fraction":function(e,t){return new o(e.compare(t))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for c
1omplex numbers")},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return this(e.value,t.value)},"SparseMatrix, SparseMatrix":function(e,t){return c(e,t,this)},"SparseMatrix, DenseMatrix":function(e,t){return u(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return u(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return f(e,t,this)},"Array, Array":function(e,t){return this(i(e),i(t)).valueOf()},"Array, Matrix":function(e,t){return this(i(e),t)},"Matrix, Array":function(e,t){return this(e,i(t))},"SparseMatrix, any":function(e,t){return l(e,t,this,!1)},"DenseMatrix, any":function(e,t){return p(e,t,this,!1)},"any, SparseMatrix":function(e,t){return l(t,e,this,!0)},"any, DenseMatrix":function(e,t){return p(t,e,this,!0)},"Array, any":function(e,t){return p(i(e),t,this,!1).valueOf()},"any, Array":function(e,t){return p(i(t),e,this,!0).valueOf()}})}),Dc="compareText",Ic=j(Dc,["typed","matrix"],e=>{var{typed:t,matrix:r}=e,n=Ju({typed:t}),i=Yu({typed:t});return t(Dc,{"any, any":k,"DenseMatrix, DenseMatrix":function(e,t){return n(e,t,k)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"DenseMatrix, any":function(e,t){return i(e,t,k,!1)},"any, DenseMatrix":function(e,t){return i(t,e,k,!0)},"Array, any":function(e,t){return i(r(e),t,k,!1).valueOf()},"any, Array":function(e,t){return i(r(t),e,k,!0).valueOf()}})}),kc="count",Rc=j(kc,["typed","size","prod"],e=>{var{typed:t,size:r,prod:n}=e;return t(kc,{string:function(e){return e.length},"Matrix | Array":function(e){return n(r(e))}})}),Uc="ctranspose",Pc=j(Uc,["typed","transpose","conj"],e=>{var{typed:t,transpose:r,conj:n}=e;return t(Uc,{any:function(e){return n(r(e))}})}),Fc="diag",jc=j(Fc,["typed","matrix","DenseMatrix","SparseMatrix"],e=>{var{typed:t,matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(Fc,{Array:function(e){return a(e,0,se(e),null)},"Array, number":function(e,t){return a(e,t,se(e),null)},"Array, BigNumber":function(e,t){return a(e,t.toNumber(),se(e),null)},"Array, string":function(e,t){return a(e,0,se(e),t)},"Array, number, string":function(e,t,r){return a(e,t,se(e),r)},"Array, BigNumber, string":function(e,t,r){return a(e,t.toNumber(),se(e),r)},Matrix:function(e){return a(e,0,e.size(),e.storage())},"Matrix, number":function(e,t){return a(e,t,e.size(),e.storage())},"Matrix, BigNumber":function(e,t){return a(e,t.toNumber(),e.size(),e.storage())},"Matrix, string":function(e,t){return a(e,0,e.size(),t)},"Matrix, number, string":function(e,t,r){return a(e,t,e.size(),r)},"Matrix, BigNumber, string":function(e,t,r){return a(e,t.toNumber(),e.size(),r)}});function a(e,t,a,u){if(!s(t))throw new TypeError("Second parameter in function diag must be an integer");var c=t>0?t:0,l=t<0?-t:0;switch(a.length){case 1:return function(e,t,r,a,o,s){var u=[a+o,a+s];if(r&&"sparse"!==r&&"dense"!==r)throw new TypeError("Unknown matrix type ".concat(r,'"'));var c="sparse"===r?i.diagonal(u,e,t):n.diagonal(u,e,t);return null!==r?c:c.valueOf()}(e,t,u,a[0],l,c);case 2:return function(e,t,n,i,a,s){if((0,o.OA)(e)){var u=e.diagonal(t);return null!==n?n!==u.storage()?r(u,n):u:u.valueOf()}for(var c=Math.min(i[0]-a,i[1]-s),l=[],f=0;f<c;f++)l[f]=e[f+a][f+s];return null!==n?r(l):l}(e,t,u,a,l,c)}throw new RangeError("Matrix for function diag must be 2 dimensional")}}),Lc="divideScalar",$c=j(Lc,["typed","numeric"],e=>{var{typed:t,numeric:r}=e;return t(Lc,{"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)},"Fraction, Fraction":function(e,t){return e.div(t)},"Unit, number | Fraction | BigNumber":function(e,t){var n=e.clone(),i=r(1,(0,o.QP)(t));return n.value=this(null===n.value?n._normalize(i):n.value,t),n},"number | Fraction | BigNumber, Unit":function(e,t){var n=t.clone();n=n.pow(-1);var i=r(1,(0,o.QP)(e));return n.value=this(e,null===t.value?t._normalize(i):t.value),n},"Unit, Unit":function(e,t){return e.divide(t)}})}),Hc="dotDivide",Gc=j(Hc,["typed","matrix","equalScalar","divideScalar","DenseMatrix"],e=>{var{typed:t,matrix:r,equalScalar:n,divideScalar:i,DenseMatrix:a}=e,o=Hu({typed:t,equalScalar:n}),s=Gu({typed:t}),u=lc({typed:t,DenseMatrix:a}),c=Zu({typed:t,equalScalar:n}),l=Wu({typed:t,DenseMatrix:a}),f=Ju({typed:t}),p=Yu({typed:t});return t(Hc,{"any, any":i,"SparseMatrix, SparseMatrix":function(e,t){return u(e,t,i,!1)},"SparseMatrix, DenseMatrix":function(e,t){return o(t,e,i,!0)},"DenseMatrix, SparseMatrix":function(e,t){return s(e,t,i,!1)},"DenseMatrix, DenseMatrix":function(e,t){return f(e,t,i)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, any":function(e,t){return c(e,t,i,!1)},"DenseMatrix, any":function(e,t){return p(e,t,i,!1)},"any, SparseMatrix":function(e,t){return l(t,e,i,!0)},"any, DenseMatrix":function(e,t){return p(t,e,i,!0)},"Array, any":function(e,t){return p(r(e),t,i,!1).valueOf()},"any, Array":function(e,t){return p(r(t),e,i,!0).valueOf()}})}),Vc="equal",Zc=j(Vc,["typed","matrix","equalScalar","DenseMatrix"],e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i}=e,a=Gu({typed:t}),o=lc({typed:t,DenseMatrix:i}),s=Wu({typed:t,DenseMatrix:i}),u=Ju({typed:t}),c=Yu({typed:t});return t(Vc,{"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)},"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,n)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,n,!0)},"DenseMatrix, SparseMatrix":function(e,t){return a(e,t,n,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,n)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, any":function(e,t){return s(e,t,n,!1)},"DenseMatrix, any":function(e,t){return c(e,t,n,!1)},"any, SparseMatrix":function(e,t){return s(t,e,n,!0)},"any, DenseMatrix":function(e,t){return c(t,e,n,!0)},"Array, any":function(e,t){return c(r(e),t,n,!1).valueOf()},"any, Array":function(e,t){return c(r(t),e,n,!0).valueOf()}})}),Wc=(j(Vc,["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return t(Vc,{"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:r(e,t)}})}),j("fft",["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i"],e=>{var{typed:t,matrix:r,addScalar:n,multiplyScalar:i,divideScalar:a,exp:o,tau:s,i:u}=e;return t("fft",{Array:c,Matrix:function(e){return e.create(c(e.toArray()))}});function c(e){var t=se(e);return 1===t.length?f(e,t[0]):l(e.map(e=>c(e,t.slice(1))),0)}function l(e,t){var r=se(e);if(0!==t)return new Array(r[0]).fill(0).map((r,n)=>l(e[n],t-1));if(1===r.length)return f(e);function n(e){var t=se(e);return new Array(t[1]).fill(0).map((r,n)=>new Array(t[0]).fill(0).map((t,r)=>e[r][n]))}return n(l(n(e),1))}function f(e){var t=e.length;if(1===t)return[e[0]];if(t%2==0){for(var r=[...f(e.filter((e,t)=>
1t%2==0)),...f(e.filter((e,t)=>t%2==1))],c=0;c<t/2;c++){var l=r[c],p=i(r[c+t/2],o(i(i(s,u),a(-c,t))));r[c]=n(l,p),r[c+t/2]=n(l,i(-1,p))}return r}throw new Error("Can only calculate FFT of power-of-two size")}})),Jc="flatten",Yc=j(Jc,["typed","matrix"],e=>{var{typed:t,matrix:r}=e;return t(Jc,{Array:function(e){return be(R(e))},Matrix:function(e){var t=be(R(e.toArray()));return r(t)}})}),Qc=j("algorithm04",["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return function(e,n,i){var a=e._values,o=e._index,s=e._ptr,u=e._size,c=e._datatype,l=n._values,f=n._index,p=n._ptr,m=n._size,d=n._datatype;if(u.length!==m.length)throw new ae(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+")");var h,y=u[0],g=u[1],v=r,x=0,b=i;"string"==typeof c&&c===d&&(h=c,v=t.find(r,[h,h]),x=t.convert(0,h),b=t.find(i,[h,h]));var w,N,M,S,E,A=a&&l?[]:void 0,O=[],C=[],_=a&&l?[]:void 0,T=a&&l?[]:void 0,B=[],z=[];for(N=0;N<g;N++){C[N]=O.length;var q=N+1;for(S=s[N],E=s[N+1],M=S;M<E;M++)w=o[M],O.push(w),B[w]=q,_&&(_[w]=a[M]);for(S=p[N],E=p[N+1],M=S;M<E;M++)if(B[w=f[M]]===q){if(_){var D=b(_[w],l[M]);v(D,x)?B[w]=null:_[w]=D}}else O.push(w),z[w]=q,T&&(T[w]=l[M]);if(_&&T)for(M=C[N];M<O.length;)B[w=O[M]]===q?(A[M]=_[w],M++):z[w]===q?(A[M]=T[w],M++):O.splice(M,1)}return C[g]=O.length,e.createSparseMatrix({values:A,index:O,ptr:C,size:[y,g],datatype:h})}}),Xc=j("gcd",["typed","matrix","equalScalar","BigNumber","DenseMatrix"],e=>{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a}=e,o=Xu({typed:t}),s=Qc({typed:t,equalScalar:n}),u=hc({typed:t,DenseMatrix:a}),c=Ju({typed:t}),l=Yu({typed:t});return t("gcd",{"number, number":Qi,"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var r=new i(0);!t.isZero();){var n=e.mod(t);e=t,t=n}return e.lt(r)?e.neg():e},"Fraction, Fraction":function(e,t){return e.gcd(t)},"SparseMatrix, SparseMatrix":function(e,t){return s(e,t,this)},"SparseMatrix, DenseMatrix":function(e,t){return o(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return o(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return c(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, number | BigNumber":function(e,t){return u(e,t,this,!1)},"DenseMatrix, number | BigNumber":function(e,t){return l(e,t,this,!1)},"number | BigNumber, SparseMatrix":function(e,t){return u(t,e,this,!0)},"number | BigNumber, DenseMatrix":function(e,t){return l(t,e,this,!0)},"Array, number | BigNumber":function(e,t){return l(r(e),t,this,!1).valueOf()},"number | BigNumber, Array":function(e,t){return l(r(t),e,this,!0).valueOf()},"Array | Matrix | number | BigNumber, Array | Matrix | number | BigNumber, ...Array | Matrix | number | BigNumber":function(e,t,r){for(var n=this(e,t),i=0;i<r.length;i++)n=this(n,r[i]);return n}})}),Kc="hasNumericValue",el=j(Kc,["typed","isNumeric"],e=>{var{typed:t,isNumeric:r}=e;return t(Kc,{string:function(e){return e.trim().length>0&&!isNaN(Number(e))},any:function(e){return r(e)}})}),tl="hypot",rl=j(tl,["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],e=>{var{typed:t,abs:r,addScalar:n,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:s,isPositive:u}=e;return t(tl,{"... number | BigNumber":function(e){for(var t=0,c=0,l=0;l<e.length;l++){var f=r(e[l]);s(c,f)?(t=a(t,a(i(c,f),i(c,f))),t=n(t,1),c=f):t=n(t,u(f)?a(i(f,c),i(f,c)):f)}return a(c,o(t))},Array:function(e){return this.apply(this,be(e))},Matrix:function(e){return this.apply(this,be(e.toArray()))}})}),nl="ifft",il=j(nl,["typed","fft","dotDivide","conj"],e=>{var{typed:t,fft:r,dotDivide:n,conj:i}=e;return t(nl,{"Array | Matrix":function(e){var t=(0,o.OA)(e)?e.size():se(e);return n(i(r(i(e))),t.reduce((e,t)=>e*t,1))}})}),al="kron",ol=j(al,["typed","matrix","multiplyScalar"],e=>{var{typed:t,matrix:r,multiplyScalar:n}=e;return t(al,{"Matrix, Matrix":function(e,t){return r(i(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return r(i(e.toArray(),t))},"Array, Matrix":function(e,t){return r(i(e,t.toArray()))},"Array, Array":i});function i(e,t){if(1===se(e).length&&(e=[e]),1===se(t).length&&(t=[t]),se(e).length>2||se(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)+")");var r=[],i=[];return e.map(function(e){return t.map(function(t){return i=[],r.push(i),e.map(function(e){return t.map(function(t){return i.push(n(e,t))})})})})&&r}}),sl="largerEq",ul=j(sl,["typed","config","matrix","DenseMatrix"],e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i}=e,a=Gu({typed:t}),o=lc({typed:t,DenseMatrix:i}),s=Wu({typed:t,DenseMatrix:i}),u=Ju({typed:t}),c=Yu({typed:t});return t(sl,{"boolean, boolean":function(e,t){return e>=t},"number, number":function(e,t){return e>=t||N(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.gte(t)||Co(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return-1!==e.compare(t)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for c
1omplex numbers")},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return this(e.value,t.value)},"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,this)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return a(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,this)},"Array, Array":function(e,t){return this(n(e),n(t)).valueOf()},"Array, Matrix":function(e,t){return this(n(e),t)},"Matrix, Array":function(e,t){return this(e,n(t))},"SparseMatrix, any":function(e,t){return s(e,t,this,!1)},"DenseMatrix, any":function(e,t){return c(e,t,this,!1)},"any, SparseMatrix":function(e,t){return s(t,e,this,!0)},"any, DenseMatrix":function(e,t){return c(t,e,this,!0)},"Array, any":function(e,t){return c(n(e),t,this,!1).valueOf()},"any, Array":function(e,t){return c(n(t),e,this,!0).valueOf()}})}),cl=j("algorithm08",["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return function(e,n,i){var a=e._values,o=e._index,s=e._ptr,u=e._size,c=e._datatype,l=n._values,f=n._index,p=n._ptr,m=n._size,d=n._datatype;if(u.length!==m.length)throw new ae(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(!a||!l)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var h,y=u[0],g=u[1],v=r,x=0,b=i;"string"==typeof c&&c===d&&(h=c,v=t.find(r,[h,h]),x=t.convert(0,h),b=t.find(i,[h,h]));for(var w,N,M,S,E=[],A=[],O=[],C=[],_=[],T=0;T<g;T++){O[T]=A.length;var B=T+1;for(N=s[T],M=s[T+1],w=N;w<M;w++)_[S=o[w]]=B,C[S]=a[w],A.push(S);for(N=p[T],M=p[T+1],w=N;w<M;w++)_[S=f[w]]===B&&(C[S]=b(C[S],l[w]));for(w=O[T];w<A.length;){var z=C[S=A[w]];v(z,x)?A.splice(w,1):(E.push(z),w++)}}return O[g]=A.length,e.createSparseMatrix({values:E,index:A,ptr:O,size:[y,g],datatype:h})}}),ll="leftShift",fl=j(ll,["typed","matrix","equalScalar","zeros","DenseMatrix"],e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a}=e,o=Xu({typed:t}),s=Hu({typed:t,equalScalar:n}),u=cl({typed:t,equalScalar:n}),c=hc({typed:t,DenseMatrix:a}),l=Zu({typed:t,equalScalar:n}),f=Ju({typed:t}),p=Yu({typed:t});return t(ll,{"number, number":no,"BigNumber, BigNumber":Ya,"SparseMatrix, SparseMatrix":function(e,t){return u(e,t,this,!1)},"SparseMatrix, DenseMatrix":function(e,t){return s(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return o(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return f(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, number | BigNumber":function(e,t){return n(t,0)?e.clone():l(e,t,this,!1)},"DenseMatrix, number | BigNumber":function(e,t){return n(t,0)?e.clone():p(e,t,this,!1)},"number | BigNumber, SparseMatrix":function(e,t){return n(e,0)?i(t.size(),t.storage()):c(t,e,this,!0)},"number | BigNumber, DenseMatrix":function(e,t){return n(e,0)?i(t.size(),t.storage()):p(t,e,this,!0)},"Array, number | BigNumber":function(e,t){return this(r(e),t).valueOf()},"number | BigNumber, Array":function(e,t){return this(e,r(t)).valueOf()}})});function pl(e){var{DenseMatrix:t}=e;return function(e,r,n){var i=e.size();if(2!==i.length)throw new RangeError("Matrix must be two dimensional (size: "+z(i)+")");var a=i[0];if(a!==i[1])throw new RangeError("Matrix must be square (size: "+z(i)+")");var s=[];if((0,o.OA)(r)){var u=r.size(),c=r._data;if(1===u.length){if(u[0]!==a)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var l=0;l<a;l++)s[l]=[c[l]];return new t({data:s,size:[a,1],datatype:r._datatype})}if(2===u.length){if(u[0]!==a||1!==u[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if((0,o.zR)(r)){if(n){s=[];for(var f=0;f<a;f++)s[f]=[c[f][0]];return new t({data:s,size:[a,1],datatype:r._datatype})}return r}if((0,o.AF)(r)){for(var p=0;p<a;p++)s[p]=[0];for(var m=r._values,d=r._index,h=r._ptr,y=h[1],g=h[0];g<y;g++)s[d[g]][0]=m[g];return new t({data:s,size:[a,1],datatype:r._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if((0,o.cy)(r)){var v=se(r);if(1===v.length){if(v[0]!==a)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var x=0;x<a;x++)s[x]=[r[x]];return new t({data:s,size:[a,1]})}if(2===v.length){if(v[0]!==a||1!==v[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var b=0;b<a;b++)s[b]=[r[b][0]];return new t({data:s,size:[a,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}var ml="lsolve",dl=j(ml,["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],e=>{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:s}=e,u=pl({DenseMatrix:s});
1return t(ml,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){for(var r=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr,d=[],h=0;h<l;h++){var y=r[h][0]||0;if(o(y,0))d[h]=[0];else{for(var g=0,v=[],x=[],b=m[h],w=m[h+1],N=b;N<w;N++){var M=p[N];M===h?g=f[N]:M>h&&(v.push(f[N]),x.push(M))}if(o(g,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var S=n(y,g),E=0,A=x.length;E<A;E++){var O=x[E];r[O]=[a(r[O][0]||0,i(S,v[E]))]}d[h]=[S]}}return new s({data:d,size:[c,1]})}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(r(e),t).valueOf()}});function c(e,t){for(var r=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=[],p=e._data,m=0;m<l;m++){var d=r[m][0]||0,h=void 0;if(o(d,0))h=0;else{var y=p[m][m];if(o(y,0))throw new Error("Linear system cannot be solved since matrix is singular");h=n(d,y);for(var g=m+1;g<c;g++)r[g]=[a(r[g][0]||0,i(h,p[g][m]))]}f[m]=[h]}return new s({data:f,size:[c,1]})}}),hl="matrixFromColumns",yl=j(hl,["typed","matrix","flatten","size"],e=>{var{typed:t,matrix:r,flatten:n,size:i}=e;return t(hl,{"...Array":function(e){return a(e)},"...Matrix":function(e){return r(a(e.map(e=>e.toArray())))}});function a(e){if(0===e.length)throw new TypeError("At least one column is needed to construct a matrix.");for(var t=o(e[0]),r=[],i=0;i<t;i++)r[i]=[];for(var a of e){var s=o(a);if(s!==t)throw new TypeError("The vectors had different length: "+(0|t)+" ≠ "+(0|s));for(var u=n(a),c=0;c<t;c++)r[c].push(u[c])}return r}function o(e){var 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.")}}),gl="mode",vl=j(gl,["typed","isNaN","isNumeric"],e=>{var{typed:t,isNaN:r,isNumeric:n}=e;return t(gl,{"Array | Matrix":i,"...":function(e){return i(e)}});function i(e){if(0===(e=be(e.valueOf())).length)throw new Error("Cannot calculate mode of an empty array");for(var t={},i=[],a=0,o=0;o<e.length;o++){var s=e[o];if(n(s)&&r(s))throw new Error("Cannot calculate mode of an array containing NaN values");s in t||(t[s]=0),t[s]++,t[s]===a?i.push(s):t[s]>a&&(a=t[s],i=[s])}return i}}),xl="nthRoots",bl=j(xl,["config","typed","divideScalar","Complex"],e=>{var{typed:t,config:r,divideScalar:n,Complex:i}=e,a=[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 o(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)];var r,n="number"==typeof e;(n||0===e.re||0===e.im)&&(r=n?2*+(e<0):0===e.im?2*+(e.re<0):2*+(e.im<0)+1);for(var o=e.arg(),s=e.abs(),u=[],c=Math.pow(s,1/t),l=0;l<t;l++){var f=(r+4*l)/t;f!==Math.round(f)?u.push(new i({r:c,phi:(o+2*Math.PI*l)/t})):u.push(a[f%4](c))}return u}return t(xl,{Complex:function(e){return o(e,2)},"Complex, number":o})}),wl=j("ones",["typed","config","matrix","BigNumber"],e=>{var{typed:t,config:r,matrix:n,BigNumber:i}=e;return t("ones",{"":function(){return"Array"===r.matrix?a([]):a([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){var t=e.pop();return a(e,t)}return"Array"===r.matrix?a(e):a(e,"default")},Array:a,Matrix:function(e){var t=e.storage();return a(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return a(e.valueOf(),t)}});function a(e,t){var r=function(e){var t=!1;return e.forEach(function(e,r,n){(0,o.C4)(e)&&(t=!0,n[r]=e.toNumber())}),t}(e),a=r?new i(1):1;if(function(e){e.forEach(function(e){if("number"!=typeof e||!s(e)||e<0)throw new Error("Parameters in function ones must be positive integers")})}(e),t){var u=n(t);return e.length>0?u.resize(e,a):u}var c=[];return e.length>0?fe(c,e,a):c}}),Nl="partitionSelect",Ml=j(Nl,["typed","isNumeric","isNaN","compare"],e=>{var{typed:t,isNumeric:r,isNaN:n,compare:i}=e,a=i,u=(e,t)=>
1-i(e,t);return t(Nl,{"Array | Matrix, number":function(e,t){return c(e,t,a)},"Array | Matrix, number, string":function(e,t,r){if("asc"===r)return c(e,t,a);if("desc"===r)return c(e,t,u);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":c});function c(e,t,r){if(!s(t)||t<0)throw new Error("k must be a non-negative integer");if((0,o.OA)(e)){if(e.size().length>1)throw new Error("Only one dimensional matrices supported");return l(e.valueOf(),t,r)}if(Array.isArray(e))return l(e,t,r)}function l(e,t,i){if(t>=e.length)throw new Error("k out of bounds");for(var a=0;a<e.length;a++)if(r(e[a])&&n(e[a]))return e[a];for(var o=0,s=e.length-1;o<s;){for(var u=o,c=s,l=e[Math.floor(Math.random()*(s-o+1))+o];u<c;)if(i(e[u],l)>=0){var f=e[c];e[c]=e[u],e[u]=f,--c}else++u;i(e[u],l)>0&&--u,t<=u?s=u:o=u+1}return e[t]}});function Sl(e,t,r,n){if(!(this instanceof Sl))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=r,this.max=n,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+r+(null!=n?"-"+n:"")+" expected)",this.stack=(new Error).stack}Sl.prototype=new Error,Sl.prototype.constructor=Error,Sl.prototype.name="ArgumentsError",Sl.prototype.isArgumentsError=!0;var El=j("resize",["config","matrix"],e=>{var{config:t,matrix:r}=e;return function(e,n,i){if(2!==arguments.length&&3!==arguments.length)throw new Sl("resize",arguments.length,2,3);if((0,o.OA)(n)&&(n=n.valueOf()),(0,o.C4)(n[0])&&(n=n.map(function(e){return(0,o.C4)(e)?e.toNumber():e})),(0,o.OA)(e))return e.resize(n,i,!0);if("string"==typeof e)return function(e,t,r){if(void 0!==r){if("string"!=typeof r||1!==r.length)throw new TypeError("Single character expected as defaultValue")}else r=" ";if(1!==t.length)throw new ae(t.length,1);var n=t[0];if("number"!=typeof n||!s(n))throw new TypeError("Invalid size, must contain positive integers (size: "+z(t)+")");if(e.length>n)return e.substring(0,n);if(e.length<n){for(var i=e,a=0,o=n-e.length;a<o;a++)i+=r;return i}return e}(e,n,i);var a=!Array.isArray(e)&&"Array"!==t.matrix;if(0===n.length){for(;Array.isArray(e);)e=e[0];return R(e)}Array.isArray(e)||(e=[e]);var u=fe(e=R(e),n,i);return a?r(u):u}}),Al="rightArithShift",Ol=j(Al,["typed","matrix","equalScalar","zeros","DenseMatrix"],e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a}=e,o=Xu({typed:t}),s=Hu({typed:t,equalScalar:n}),u=cl({typed:t,equalScalar:n}),c=hc({typed:t,DenseMatrix:a}),l=Zu({typed:t,equalScalar:n}),f=Ju({typed:t}),p=Yu({typed:t});return t(Al,{"number, number":io,"BigNumber, BigNumber":Qa,"SparseMatrix, SparseMatrix":function(e,t){return u(e,t,this,!1)},"SparseMatrix, DenseMatrix":function(e,t){return s(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return o(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return f(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, number | BigNumber":function(e,t){return n(t,0)?e.clone():l(e,t,this,!1)},"DenseMatrix, number | BigNumber":function(e,t){return n(t,0)?e.clone():p(e,t,this,!1)},"number | BigNumber, SparseMatrix":function(e,t){return n(e,0)?i(t.size(),t.storage()):c(t,e,this,!0)},"number | BigNumber, DenseMatrix":function(e,t){return n(e,0)?i(t.size(),t.storage()):p(t,e,this,!0)},"Array, number | BigNumber":function(e,t){return this(r(e),t).valueOf()},"number | BigNumber, Array":function(e,t){return this(e,r(t)).valueOf()}})}),Cl="Number of decimals in function round must be an integer",_l="round",Tl=j(_l,["typed","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,BigNumber:a,DenseMatrix:o}=e,s=Zu({typed:t,equalScalar:n}),u=Wu({typed:t,DenseMatrix:o}),c=Yu({typed:t});return t(_l,{number:sa,"number, number":sa,"number, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(Cl);return new a(e).toDecimalPlaces(t.toNumber())},Complex:function(e){return e.round()},"Complex, number":function(e,t){if(t%1)throw new TypeError(Cl);return e.round(t)},"Complex, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(Cl);var r=t.toNumber();return e.round(r)},BigNumber:function(e){return e.toDecimalPlaces(0)},"BigNumber, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(Cl);return e.toDecimalPlaces(t.toNumber())},Fraction:function(e){return e.round()},"Fraction, number":function(e,t){if(t%1)throw new TypeError(Cl);return e.round(t)},"Fraction, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(Cl);return e.round(t.toNumber())},"Array | Matrix":function(e){return ct(e,this,!0)},"SparseMatrix, number | BigNumber":function(e,t){return s(e,t,this,!1)},"DenseMatrix, number | BigNumber":function(e,t){return c(e,t,this,!1)},"Array, number | BigNumber":function(e,t){return c(r(e),t,this,!1).valueOf()},"number | Complex | BigNumber | Fraction, SparseMatrix":function(e,t){return n(e,0)?i(t.size(),t.storage()):u(t,e,this,!0)},"number | Complex | BigNumber | Fraction, DenseMatrix":function(e,t){return n(e,0)?i(t.size(),t.storage()):c(t,e,this,!0)},"number | Complex | BigNumber | Fraction, Array":function(e,t){return c(r(t),e,this,
1!0).valueOf()}})}),Bl="smallerEq",zl=j(Bl,["typed","config","matrix","DenseMatrix"],e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i}=e,a=Gu({typed:t}),o=lc({typed:t,DenseMatrix:i}),s=Wu({typed:t,DenseMatrix:i}),u=Ju({typed:t}),c=Yu({typed:t});return t(Bl,{"boolean, boolean":function(e,t){return e<=t},"number, number":function(e,t){return e<=t||N(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.lte(t)||Co(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return 1!==e.compare(t)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return this(e.value,t.value)},"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,this)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return a(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,this)},"Array, Array":function(e,t){return this(n(e),n(t)).valueOf()},"Array, Matrix":function(e,t){return this(n(e),t)},"Matrix, Array":function(e,t){return this(e,n(t))},"SparseMatrix, any":function(e,t){return s(e,t,this,!1)},"DenseMatrix, any":function(e,t){return c(e,t,this,!1)},"any, SparseMatrix":function(e,t){return s(t,e,this,!0)},"any, DenseMatrix":function(e,t){return c(t,e,this,!0)},"Array, any":function(e,t){return c(n(e),t,this,!1).valueOf()},"any, Array":function(e,t){return c(n(t),e,this,!0).valueOf()}})}),ql="unequal",Dl=j(ql,["typed","config","equalScalar","matrix","DenseMatrix"],e=>{var{typed:t,config:r,equalScalar:n,matrix:i,DenseMatrix:a}=e,o=Gu({typed:t}),s=lc({typed:t,DenseMatrix:a}),u=Wu({typed:t,DenseMatrix:a}),c=Ju({typed:t}),l=Yu({typed:t});return t("unequal",{"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:f(e,t)},"SparseMatrix, SparseMatrix":function(e,t){return s(e,t,f)},"SparseMatrix, DenseMatrix":function(e,t){return o(t,e,f,!0)},"DenseMatrix, SparseMatrix":function(e,t){return o(e,t,f,!1)},"DenseMatrix, DenseMatrix":function(e,t){return c(e,t,f)},"Array, Array":function(e,t){return this(i(e),i(t)).valueOf()},"Array, Matrix":function(e,t){return this(i(e),t)},"Matrix, Array":function(e,t){return this(e,i(t))},"SparseMatrix, any":function(e,t){return u(e,t,f,!1)},"DenseMatrix, any":function(e,t){return l(e,t,f,!1)},"any, SparseMatrix":function(e,t){return u(t,e,f,!0)},"any, DenseMatrix":function(e,t){return l(t,e,f,!0)},"Array, any":function(e,t){return l(i(e),t,f,!1).valueOf()},"any, Array":function(e,t){return l(i(t),e,f,!0).valueOf()}});function f(e,t){return!n(e,t)}}),Il=(j(ql,["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return t(ql,{"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:!r(e,t)}})}),"usolve"),kl=j(Il,["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],e=>{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:s}=e,u=pl({DenseMatrix:s});return t(Il,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){for(var r=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr,d=[],h=l-1;h>=0;h--){var y=r[h][0]||0;if(o(y,0))d[h]=[0];else{for(var g=0,v=[],x=[],b=m[h],w=m[h+1]-1;w>=b;w--){var N=p[w];N===h?g=f[w]:N<h&&(v.push(f[w]),x.push(N))}if(o(g,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var M=n(y,g),S=0,E=x.length;S<E;S++){var A=x[S];r[A]=[a(r[A][0],i(M,v[S]))]}d[h]=[M]}}return new s({data:d,size:[c,1]})}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(r(e),t).valueOf()}});function c(e,t){for(var r=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=[],p=e._data,m=l-1;m>=0;m--){var d=r[m][0]||0,h=void 0;if(o(d,0))h=0;else{var y=p[m][m];if(o(y,0))throw new Error("Linear system cannot be solved since matrix is singular");h=n(d,y);for(var g=m-1;g>=0;g--)r[g]=[a(r[g][0]||0,i(h,p[g][m]))]}f[m]=[h]}return new s({data:f,size:[c,1]})}}),Rl=j("xor",["typed","matrix","DenseMatrix"],e=>{var{typed:t,matrix:r,DenseMatrix:n}=e,i=Gu({typed:t}),a=lc({typed:t,DenseMatrix:n}),o=Wu({typed:t,DenseMatrix:n}),s=Ju({typed:t}),u=Yu({typed:t});return t("xor",{"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())},"Unit, Unit":function(e,t){return this(e.value||0,t.value||0)}
1,"SparseMatrix, SparseMatrix":function(e,t){return a(e,t,this)},"SparseMatrix, DenseMatrix":function(e,t){return i(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return i(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return s(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, any":function(e,t){return o(e,t,this,!1)},"DenseMatrix, any":function(e,t){return u(e,t,this,!1)},"any, SparseMatrix":function(e,t){return o(t,e,this,!0)},"any, DenseMatrix":function(e,t){return u(t,e,this,!0)},"Array, any":function(e,t){return u(r(e),t,this,!1).valueOf()},"any, Array":function(e,t){return u(r(t),e,this,!0).valueOf()}})}),Ul=j("add",["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix"],e=>{var{typed:t,matrix:r,addScalar:n,equalScalar:i,DenseMatrix:a,SparseMatrix:o}=e,s=Xu({typed:t}),u=Qc({typed:t,equalScalar:i}),c=hc({typed:t,DenseMatrix:a}),l=Ju({typed:t}),f=Yu({typed:t});return t("add",U({"DenseMatrix, DenseMatrix":function(e,t){return l(e,t,n)},"DenseMatrix, SparseMatrix":function(e,t){return s(e,t,n,!1)},"SparseMatrix, DenseMatrix":function(e,t){return s(t,e,n,!0)},"SparseMatrix, SparseMatrix":function(e,t){return u(e,t,n)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"DenseMatrix, any":function(e,t){return f(e,t,n,!1)},"SparseMatrix, any":function(e,t){return c(e,t,n,!1)},"any, DenseMatrix":function(e,t){return f(t,e,n,!0)},"any, SparseMatrix":function(e,t){return c(t,e,n,!0)},"Array, any":function(e,t){return f(r(e),t,n,!1).valueOf()},"any, Array":function(e,t){return f(r(t),e,n,!0).valueOf()},"any, any":n,"any, any, ...any":function(e,t,r){for(var n=this(e,t),i=0;i<r.length;i++)n=this(n,r[i]);return n}},n.signatures))}),Pl=j("algorithm09",["typed","equalScalar"],e=>{var{typed:t,equalScalar:r}=e;return function(e,n,i){var a=e._values,o=e._index,s=e._ptr,u=e._size,c=e._datatype,l=n._values,f=n._index,p=n._ptr,m=n._size,d=n._datatype;if(u.length!==m.length)throw new ae(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+")");var h,y=u[0],g=u[1],v=r,x=0,b=i;"string"==typeof c&&c===d&&(h=c,v=t.find(r,[h,h]),x=t.convert(0,h),b=t.find(i,[h,h]));var w,N,M,S,E,A=a&&l?[]:void 0,O=[],C=[],_=A?[]:void 0,T=[];for(N=0;N<g;N++){C[N]=O.length;var B=N+1;if(_)for(S=p[N],E=p[N+1],M=S;M<E;M++)T[w=f[M]]=B,_[w]=l[M];for(S=s[N],E=s[N+1],M=S;M<E;M++)if(w=o[M],_){var z=T[w]===B?_[w]:x,q=b(a[M],z);v(q,x)||(O.push(w),A.push(q))}else O.push(w)}return C[g]=O.length,e.createSparseMatrix({values:A,index:O,ptr:C,size:[y,g],datatype:h})}}),Fl="atan2",jl=j(Fl,["typed","matrix","equalScalar","BigNumber","DenseMatrix"],e=>{var{typed:t,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:a}=e,o=Hu({typed:t,equalScalar:n}),s=Gu({typed:t}),u=Pl({typed:t,equalScalar:n}),c=Zu({typed:t,equalScalar:n}),l=Wu({typed:t,DenseMatrix:a}),f=Ju({typed:t}),p=Yu({typed:t});return t(Fl,{"number, number":Math.atan2,"BigNumber, BigNumber":function(e,t){return i.atan2(e,t)},"SparseMatrix, SparseMatrix":function(e,t){return u(e,t,this,!1)},"SparseMatrix, DenseMatrix":function(e,t){return o(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return s(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return f(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, number | BigNumber":function(e,t){return c(e,t,this,!1)},"DenseMatrix, number | BigNumber":function(e,t){return p(e,t,this,!1)},"number | BigNumber, SparseMatrix":function(e,t){return l(t,e,this,!0)},"number | BigNumber, DenseMatrix":function(e,t){return p(t,e,this,!0)},"Array, number | BigNumber":function(e,t){return p(r(e),t,this,!1).valueOf()},"number | BigNumber, Array":function(e,t){return p(r(t),e,this,!0).valueOf()}})}),Ll="bitOr",$l=j(Ll,["typed","matrix","equalScalar","DenseMatrix"],e=>{var{typed:t,matrix:r,equalScalar:n,DenseMatrix:i}=e,a=Xu({typed:t}),o=Qc({typed:t,equalScalar:n}),s=hc({typed:t,DenseMatrix:i}),u=Ju({typed:t}),c=Yu({typed:t});return t(Ll,{"number, number":to,"BigNumber, BigNumber":Va,"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,this)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return a(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, any":function(e,t){return s(e,t,this,!1)},"DenseMatrix, any":function(e,t){return c(e,t,this,!1)},"any, SparseMatrix":function(e,t){return s(t,e,this,!0)},"any, DenseMatrix":function(e,t){return c(t,e,this,!0)},"Array, any":function(e,t){return c(r(e),t,this,!1).valueOf()}
1,"any, Array":function(e,t){return c(r(t),e,this,!0).valueOf()}})}),Hl="catalan",Gl=j(Hl,["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],e=>{var{typed:t,addScalar:r,divideScalar:n,multiplyScalar:i,combinations:a,isNegative:o,isInteger:s}=e;return t(Hl,{"number | BigNumber":function(e){if(!s(e)||o(e))throw new TypeError("Non-negative integer value expected in function catalan");return n(a(i(e,2),e),r(e,1))}})}),Vl=r(31880),Zl="compareNatural",Wl=j(Zl,["typed","compare"],e=>{var{typed:t,compare:r}=e,n=r.signatures["boolean,boolean"];return t(Zl,{"any, any":function(e,t){var s,u=(0,o.QP)(e),c=(0,o.QP)(t);if(!("number"!==u&&"BigNumber"!==u&&"Fraction"!==u||"number"!==c&&"BigNumber"!==c&&"Fraction"!==c))return"0"!==(s=r(e,t)).toString()?s>0?1:-1:Vl(u,c);if("Array"===u||"Matrix"===u||"Array"===c||"Matrix"===c)return 0!==(s=i(this,e,t))?s:Vl(u,c);if(u!==c)return Vl(u,c);if("Complex"===u)return function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0}(e,t);if("Unit"===u)return e.equalBase(t)?this(e.value,t.value):a(this,e.formatUnits(),t.formatUnits());if("boolean"===u)return n(e,t);if("string"===u)return Vl(e,t);if("Object"===u)return function(e,t,r){var n=Object.keys(t),i=Object.keys(r);n.sort(Vl),i.sort(Vl);var o=a(e,n,i);if(0!==o)return o;for(var s=0;s<n.length;s++){var u=e(t[n[s]],r[i[s]]);if(0!==u)return u}return 0}(this,e,t);if("null"===u)return 0;if("undefined"===u)return 0;throw new TypeError('Unsupported type of value "'+u+'"')}});function i(e,t,r){return(0,o.AF)(t)&&(0,o.AF)(r)?a(e,t.toJSON().values,r.toJSON().values):(0,o.AF)(t)?i(e,t.toArray(),r):(0,o.AF)(r)?i(e,t,r.toArray()):(0,o.zR)(t)?i(e,t.toJSON().data,r):(0,o.zR)(r)?i(e,t,r.toJSON().data):Array.isArray(t)?Array.isArray(r)?a(e,t,r):i(e,t,[r]):i(e,[t],r)}function a(e,t,r){for(var n=0,i=Math.min(t.length,r.length);n<i;n++){var a=e(t[n],r[n]);if(0!==a)return a}return t.length>r.length?1:t.length<r.length?-1:0}}),Jl="deepEqual",Yl=j(Jl,["typed","equal"],e=>{var{typed:t,equal:r}=e;return t(Jl,{"any, any":function(e,t){return n(e.valueOf(),t.valueOf())}});function n(e,t){if(Array.isArray(e)){if(Array.isArray(t)){var i=e.length;if(i!==t.length)return!1;for(var a=0;a<i;a++)if(!n(e[a],t[a]))return!1;return!0}return!1}return!Array.isArray(t)&&r(e,t)}}),Ql=j("dot",["typed","addScalar","multiplyScalar","conj","size"],e=>{var{typed:t,addScalar:r,multiplyScalar:n,conj:i,size:a}=e;return t("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(e,a){var c=s(e,a),l=(0,o.OA)(e)?e._data:e,f=(0,o.OA)(e)?e._datatype:void 0,p=(0,o.OA)(a)?a._data:a,m=(0,o.OA)(a)?a._datatype:void 0,d=2===u(e).length,h=2===u(a).length,y=r,g=n;if(f&&m&&f===m&&"string"==typeof f){var v=f;y=t.find(r,[v,v]),g=t.find(n,[v,v])}if(!d&&!h){for(var x=g(i(l[0]),p[0]),b=1;b<c;b++)x=y(x,g(i(l[b]),p[b]));return x}if(!d&&h){for(var w=g(i(l[0]),p[0][0]),N=1;N<c;N++)w=y(w,g(i(l[N]),p[N][0]));return w}if(d&&!h){for(var M=g(i(l[0][0]),p[0]),S=1;S<c;S++)M=y(M,g(i(l[S][0]),p[S]));return M}if(d&&h){for(var E=g(i(l[0][0]),p[0][0]),A=1;A<c;A++)E=y(E,g(i(l[A][0]),p[A][0]));return E}},"SparseMatrix, SparseMatrix":function(e,t){s(e,t);for(var i=e._index,a=e._values,o=t._index,u=t._values,c=0,l=r,f=n,p=0,m=0;p<i.length&&m<o.length;){var d=i[p],h=o[m];d<h?p++:d>h?m++:d===h&&(c=l(c,f(a[p],u[m])),p++,m++)}return c}});function s(e,t){var r,n,i=u(e),a=u(t);if(1===i.length)r=i[0];else{if(2!==i.length||1!==i[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+i.join(", ")+")");r=i[0]}if(1===a.length)n=a[0];else{if(2!==a.length||1!==a[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+a.join(", ")+")");n=a[0]}if(r!==n)throw new RangeError("Vectors must have equal length ("+r+" != "+n+")");if(0===r)throw new RangeError("Cannot calculate the dot product of empty vectors");return r}function u(e){return(0,o.OA)(e)?e.size():a(e)}}),Xl="equalText",Kl=j(Xl,["typed","compareText","isZero"],e=>{var{typed:t,compareText:r,isZero:n}=e;return t(Xl,{"any, any":function(e,t){return n(r(e,t))}})}),ef="floor",tf=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],rf=j(ef,["typed","config","round"],e=>{var{typed:t,config:r,round:n}=e;return t(ef,{number:function(e){return N(e,n(e),r.epsilon)?n(e):Math.floor(e)},"number, number":function(e,t){if(N(e,n(e,t),r.epsilon))return n(e,t);var[i,a]="".concat(e,"e").split("e"),o=Math.floor(Number("".concat(i,"e").concat(Number(a)+t)));return[i,a]="".concat(o,"e").split("e"),Number("".concat(i,"e").concat(Number(a)-t))}})}),nf=j(ef,tf,e=>{var{typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,u=Zu({typed:t,equalScalar:a}),c=Wu({typed:t,DenseMatrix:s}),l=Yu({typed:t}),f=rf({typed:t,config:r,round:n});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:function(e){return Co(e,n(e),r.epsilon)?n(e):e.floor()},"BigNumber, BigNumber":function(e,t){return Co(e,n(e,t),r.epsilon)?n(e,t):e.toDecimalPlaces(t.toNumber(),Xr.A.ROUND_FLOOR)},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())},"Array | Matrix":function(e){return ct(e,this,!0)},"Array, number | BigNumber":function(e,t){return ct(e,e=>this(e,t),!0)},"SparseMatrix, number | BigNumber":function(e,t){return u(e,t,this,!1)},"DenseMatrix, number | BigNumber":function(e,t){return l(e,t,this,!1)},"number | Complex | Fraction | BigNumber, Array":function(e,t){return l(i(t),e,this,
1!0).valueOf()},"number | Complex | Fraction | BigNumber, Matrix":function(e,t){return a(e,0)?o(t.size(),t.storage()):"dense"===t.storage()?l(t,e,this,!0):c(t,e,this,!0)}})}),af="identity",of=j(af,["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],e=>{var{typed:t,config:r,matrix:n,BigNumber:i,DenseMatrix:a,SparseMatrix:u}=e;return t(af,{"":function(){return"Matrix"===r.matrix?n([]):[]},string:function(e){return n(e)},"number | BigNumber":function(e){return l(e,e,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, string":function(e,t){return l(e,e,t)},"number | BigNumber, number | BigNumber":function(e,t){return l(e,t,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(e,t,r){return l(e,t,r)},Array:function(e){return c(e)},"Array, string":function(e,t){return c(e,t)},Matrix:function(e){return c(e.valueOf(),e.storage())},"Matrix, string":function(e,t){return c(e.valueOf(),t)}});function c(e,t){switch(e.length){case 0:return t?n(t):[];case 1:return l(e[0],e[0],t);case 2:return l(e[0],e[1],t);default:throw new Error("Vector containing two values expected")}}function l(e,t,r){var n=(0,o.C4)(e)||(0,o.C4)(t)?i:null;if((0,o.C4)(e)&&(e=e.toNumber()),(0,o.C4)(t)&&(t=t.toNumber()),!s(e)||e<1)throw new Error("Parameters in function identity must be positive integers");if(!s(t)||t<1)throw new Error("Parameters in function identity must be positive integers");var c=n?new i(1):1,l=n?new n(0):0,f=[e,t];if(r){if("sparse"===r)return u.diagonal(f,c,0,l);if("dense"===r)return a.diagonal(f,c,0,l);throw new TypeError('Unknown matrix type "'.concat(r,'"'))}for(var p=fe([],f,l),m=e<t?e:t,d=0;d<m;d++)p[d][d]=c;return p}}),sf="invmod",uf=j(sf,["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],e=>{var{typed:t,config:r,BigNumber:n,xgcd:i,equal:a,smaller:o,mod:s,add:u,isInteger:c}=e;return t(sf,{"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),a(t,0))throw new Error("Divisor must be non zero");var r=i(e,t);r=r.valueOf();var[l,f]=r;return a(l,n(1))?(f=s(f,t),o(f,n(0))&&(f=u(f,t)),f):NaN}}),cf="larger",lf=j(cf,["typed","config","matrix","DenseMatrix"],e=>{var{typed:t,config:r,matrix:n,DenseMatrix:i}=e,a=Gu({typed:t}),o=lc({typed:t,DenseMatrix:i}),s=Wu({typed:t,DenseMatrix:i}),u=Ju({typed:t}),c=Yu({typed:t});return t(cf,{"boolean, boolean":function(e,t){return e>t},"number, number":function(e,t){return e>t&&!N(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.gt(t)&&!Co(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return 1===e.compare(t)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return this(e.value,t.value)},"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,this)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return a(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,this)},"Array, Array":function(e,t){return this(n(e),n(t)).valueOf()},"Array, Matrix":function(e,t){return this(n(e),t)},"Matrix, Array":function(e,t){return this(e,n(t))},"SparseMatrix, any":function(e,t){return s(e,t,this,!1)},"DenseMatrix, any":function(e,t){return c(e,t,this,!1)},"any, SparseMatrix":function(e,t){return s(t,e,this,!0)},"any, DenseMatrix":function(e,t){return c(t,e,this,!0)},"Array, any":function(e,t){return c(n(e),t,this,!1).valueOf()},"any, Array":function(e,t){return c(n(t),e,this,!0).valueOf()}})}),ff=j("log",["config","typed","divideScalar","Complex"],e=>{var{typed:t,config:r,divideScalar:n,Complex:i}=e;return t("log",{number:function(e){return e>=0||r.predictable?function(e){return Math.log(e)}(e):new i(e,0).log()},Complex:function(e){return e.log()},BigNumber:function(e){return!e.isNegative()||r.predictable?e.ln():new i(e.toNumber(),0).log()},"Array | Matrix":function(e){return ct(e,this)},"any, any":function(e,t){return n(this(e),this(t))}})}),pf="lsolveAll",mf=j(pf,["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],e=>{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:s}=e,u=pl({DenseMatrix:s});return t(pf,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){for(var r=[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,d=0;d<l;d++)for(var h=r.length,y=0;y<h;y++){for(var g=r[y],v=[],x=[],b=m[d],w=m[d+1],N=0,M=b;M<w;M++){var S=p[M];S===d?N=f[M]:S>d&&(v.push(f[M]),x.push(S))}if(o(N,0))if(o(g[d],0)){if(0===y){var E=[...g];E[d]=1;for(var A=0,O=x.length;A<O;A++){var C=x[A];E[C]=a(E[C],v[A])}r.push(E)}}else{if(0===y)return[];r.splice(y,1),y-=1,h-=1}else{g[d]=n(g[d],N);for(var _=0,T=x.length;_<T;_++){var B=x[_];g[B]=a(g[B],i(g[d],v[_]))}}}return r.map(e=>new 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(r(e),t).map(e=>e.valueOf())}});function c(e,t){for(var r=[u(e,t,!0)._data.map(e=>e[0])],c=e._data,l=e._size[0],f=e._size[1],p=0;p<f;p++)for(var m=r.length,d=0;d<m;d++){var h=r[d];if(o(c[p][p],0))if(o(h[p],0)){if(0===d){var y=[...h];
1y[p]=1;for(var g=p+1;g<f;g++)y[g]=a(y[g],c[g][p]);r.push(y)}}else{if(0===d)return[];r.splice(d,1),d-=1,m-=1}else{h[p]=n(h[p],c[p][p]);for(var v=p+1;v<f;v++)h[v]=a(h[v],i(h[p],c[v][p]))}}return r.map(e=>new s({data:e.map(e=>[e]),size:[l,1]}))}}),df="matrixFromRows",hf=j(df,["typed","matrix","flatten","size"],e=>{var{typed:t,matrix:r,flatten:n,size:i}=e;return t(df,{"...Array":function(e){return a(e)},"...Matrix":function(e){return r(a(e.map(e=>e.toArray())))}});function a(e){if(0===e.length)throw new TypeError("At least one row is needed to construct a matrix.");var t=o(e[0]),r=[];for(var i of e){var a=o(i);if(a!==t)throw new TypeError("The vectors had different length: "+(0|t)+" ≠ "+(0|a));r.push(n(i))}return r}function o(e){var 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.")}}),yf="multiply",gf=j(yf,["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],e=>{var{typed:t,matrix:r,addScalar:n,multiplyScalar:i,equalScalar:a,dot:s}=e,u=Zu({typed:t,equalScalar:a}),c=Yu({typed:t});function l(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)")}}var f=t("_multiplyMatrixVector",{"DenseMatrix, any":function(e,r){var a,o=e._data,s=e._size,u=e._datatype,c=r._data,l=r._datatype,f=s[0],p=s[1],m=n,d=i;u&&l&&u===l&&"string"==typeof u&&(a=u,m=t.find(n,[a,a]),d=t.find(i,[a,a]));for(var h=[],y=0;y<f;y++){for(var g=o[y],v=d(g[0],c[0]),x=1;x<p;x++)v=m(v,d(g[x],c[x]));h[y]=v}return e.createDenseMatrix({data:h,size:[f],datatype:a})},"SparseMatrix, any":function(e,r){var o=e._values,s=e._index,u=e._ptr,c=e._datatype;if(!o)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var l,f=r._data,p=r._datatype,m=e._size[0],d=r._size[0],h=[],y=[],g=[],v=n,x=i,b=a,w=0;c&&p&&c===p&&"string"==typeof c&&(l=c,v=t.find(n,[l,l]),x=t.find(i,[l,l]),b=t.find(a,[l,l]),w=t.convert(0,l));var N=[],M=[];g[0]=0;for(var S=0;S<d;S++){var E=f[S];if(!b(E,w))for(var A=u[S],O=u[S+1],C=A;C<O;C++){var _=s[C];M[_]?N[_]=v(N[_],x(E,o[C])):(M[_]=!0,y.push(_),N[_]=x(E,o[C]))}}for(var T=y.length,B=0;B<T;B++){var z=y[B];h[B]=N[z]}return g[1]=y.length,e.createSparseMatrix({values:h,index:y,ptr:g,size:[m,1],datatype:l})}}),p=t("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(e,r){var a,o=e._data,s=e._size,u=e._datatype,c=r._data,l=r._size,f=r._datatype,p=s[0],m=s[1],d=l[1],h=n,y=i;u&&f&&u===f&&"string"==typeof u&&(a=u,h=t.find(n,[a,a]),y=t.find(i,[a,a]));for(var g=[],v=0;v<p;v++){var x=o[v];g[v]=[];for(var b=0;b<d;b++){for(var w=y(x[0],c[0][b]),N=1;N<m;N++)w=h(w,y(x[N],c[N][b]));g[v][b]=w}}return e.createDenseMatrix({data:g,size:[p,d],datatype:a})},"DenseMatrix, SparseMatrix":function(e,r){var o=e._data,s=e._size,u=e._datatype,c=r._values,l=r._index,f=r._ptr,p=r._size,m=r._datatype;if(!c)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var d,h=s[0],y=p[1],g=n,v=i,x=a,b=0;u&&m&&u===m&&"string"==typeof u&&(d=u,g=t.find(n,[d,d]),v=t.find(i,[d,d]),x=t.find(a,[d,d]),b=t.convert(0,d));for(var w=[],N=[],M=[],S=r.createSparseMatrix({values:w,index:N,ptr:M,size:[h,y],datatype:d}),E=0;E<y;E++){M[E]=N.length;var A=f[E],O=f[E+1];if(O>A)for(var C=0,_=0;_<h;_++){for(var T=_+1,B=void 0,z=A;z<O;z++){var q=l[z];C!==T?(B=v(o[_][q],c[z]),C=T):B=g(B,v(o[_][q],c[z]))}C!==T||x(B,b)||(N.push(_),w.push(B))}}return M[y]=N.length,S},"SparseMatrix, DenseMatrix":function(e,r){var o=e._values,s=e._index,u=e._ptr,c=e._datatype;if(!o)throw new Error("Cannot multiply Pattern only Matrix times De
1nse Matrix");var l,f=r._data,p=r._datatype,m=e._size[0],d=r._size[0],h=r._size[1],y=n,g=i,v=a,x=0;c&&p&&c===p&&"string"==typeof c&&(l=c,y=t.find(n,[l,l]),g=t.find(i,[l,l]),v=t.find(a,[l,l]),x=t.convert(0,l));for(var b=[],w=[],N=[],M=e.createSparseMatrix({values:b,index:w,ptr:N,size:[m,h],datatype:l}),S=[],E=[],A=0;A<h;A++){N[A]=w.length;for(var O=A+1,C=0;C<d;C++){var _=f[C][A];if(!v(_,x))for(var T=u[C],B=u[C+1],z=T;z<B;z++){var q=s[z];E[q]!==O?(E[q]=O,w.push(q),S[q]=g(_,o[z])):S[q]=y(S[q],g(_,o[z]))}}for(var D=N[A],I=w.length,k=D;k<I;k++){var R=w[k];b[k]=S[R]}}return N[h]=w.length,M},"SparseMatrix, SparseMatrix":function(e,r){var a,o=e._values,s=e._index,u=e._ptr,c=e._datatype,l=r._values,f=r._index,p=r._ptr,m=r._datatype,d=e._size[0],h=r._size[1],y=o&&l,g=n,v=i;c&&m&&c===m&&"string"==typeof c&&(a=c,g=t.find(n,[a,a]),v=t.find(i,[a,a]));for(var x,b,w,N,M,S,E,A,O=y?[]:void 0,C=[],_=[],T=e.createSparseMatrix({values:O,index:C,ptr:_,size:[d,h],datatype:a}),B=y?[]:void 0,z=[],q=0;q<h;q++){_[q]=C.length;var D=q+1;for(M=p[q],S=p[q+1],N=M;N<S;N++)if(A=f[N],y)for(b=u[A],w=u[A+1],x=b;x<w;x++)z[E=s[x]]!==D?(z[E]=D,C.push(E),B[E]=v(l[N],o[x])):B[E]=g(B[E],v(l[N],o[x]));else for(b=u[A],w=u[A+1],x=b;x<w;x++)z[E=s[x]]!==D&&(z[E]=D,C.push(E));if(y)for(var I=_[q],k=C.length,R=I;R<k;R++){var U=C[R];O[R]=B[U]}}return _[h]=C.length,T}});return t(yf,U({"Array, Array":function(e,t){l(se(e),se(t));var n=this(r(e),r(t));return(0,o.OA)(n)?n.valueOf():n},"Matrix, Matrix":function(e,r){var a=e.size(),o=r.size();return l(a,o),1===a.length?1===o.length?function(e,t,r){if(0===r)throw new Error("Cannot multiply two empty vectors");return s(e,t)}(e,r,a[0]):function(e,r){if("dense"!==r.storage())throw new Error("Support for SparseMatrix not implemented");return function(e,r){var a,o=e._data,s=e._size,u=e._datatype,c=r._data,l=r._size,f=r._datatype,p=s[0],m=l[1],d=n,h=i;u&&f&&u===f&&"string"==typeof u&&(a=u,d=t.find(n,[a,a]),h=t.find(i,[a,a]));for(var y=[],g=0;g<m;g++){for(var v=h(o[0],c[0][g]),x=1;x<p;x++)v=d(v,h(o[x],c[x][g]));y[g]=v}return e.createDenseMatrix({data:y,size:[m],datatype:a})}(e,r)}(e,r):1===o.length?f(e,r):p(e,r)},"Matrix, Array":function(e,t){return this(e,r(t))},"Array, Matrix":function(e,t){return this(r(e,t.storage()),t)},"SparseMatrix, any":function(e,t){return u(e,t,i,!1)},"DenseMatrix, any":function(e,t){return c(e,t,i,!1)},"any, SparseMatrix":function(e,t){return u(t,e,i,!0)},"any, DenseMatrix":function(e,t){return c(t,e,i,!0)},"Array, any":function(e,t){return c(r(e),t,i,!1).valueOf()},"any, Array":function(e,t){return c(r(t),e,i,!0).valueOf()},"any, any":i,"any, any, ...any":function(e,t,r){for(var n=this(e,t),i=0;i<r.length;i++)n=this(n,r[i]);return n}},i.signatures))}),vf=j("qr",["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtract","complex"],e=>{var{typed:t,matrix:r,zeros:i,identity:a,isZero:o,equal:s,sign:u,sqrt:c,conj:l,unaryMinus:f,addScalar:p,divideScalar:m,multiplyScalar:d,subtract:h,complex:y}=e;return n(t("qr",{DenseMatrix:function(e){return v(e)},SparseMatrix:function(e){return function(){throw new Error("qr not implemented for sparse matrices yet")}()},Array:function(e){var t=v(r(e));return{Q:t.Q.valueOf(),R:t.R.valueOf()}}}),{_denseQRimpl:g});function g(e){var t,r,n,y=e._size[0],g=e._size[1],v=a([y],"dense"),x=v._data,b=e.clone(),w=b._data,N=i([y],"");for(n=0;n<Math.min(g,y);++n){var M=w[n][n],S=f(s(M,0)?1:u(M)),E=l(S),A=0;for(t=n;t<y;t++)A=p(A,d(w[t][n],l(w[t][n])));var O=d(S,c(A));if(!o(O)){var C=h(M,O);for(N[n]=1,t=n+1;t<y;t++)N[t]=m(w[t][n],C);var _=f(l(m(C,O))),T=void 0;for(r=n;r<g;r++){for(T=0,t=n;t<y;t++)T=p(T,d(l(N[t]),w[t][r]));for(T=d(T,_),t=n;t<y;t++)w[t][r]=d(h(w[t][r],d(N[t],T)),E)}for(t=0;t<y;t++){for(T=0,r=n;r<y;r++)T=p(T,d(x[t][r],N[r]));for(T=d(T,_),r=n;r<y;++r)x[t][r]=m(h(x[t][r],d(T,l(N[r]))),E)}}}return{Q:v,R:b,toString:function(){return"Q: "+this.Q.toString()+"\nR: "+this.R.toString()}}}function v(e){var t=g(e),r=t.R._data;if(e._data.length>0)for(var n="Complex"===r[0][0].type?y(0):0,i=0;i<r.length;++i)for(var a=0;a<i&&a<(r[0]||[]).length;++a)r[i][a]=n;return t}}),xf="rightLogShift",bf=j(xf,["typed","matrix","equalScalar","zeros","DenseMatrix"],e=>{var{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:a}=e,o=Xu({typed:t}),s=Hu({typed:t,equalScalar:n}),u=cl({typed:t,equalScalar:n}),c=hc({typed:t,DenseMatrix:a}),l=Zu({typed:t,equalScalar:n}),f=Ju({typed:t}),p=Yu({typed:t});return t(xf,{"number, number":ao,"SparseMatrix, SparseMatrix":function(e,t){return u(e,t,this,!1)},"SparseMatrix, DenseMatrix":function(e,t){return s(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return o(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return f(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, number | BigNumber":function(e,t){return n(t,0)?e.clone():l(e,t,this,!1)},"DenseMatrix, number | BigNumber":function(e,t){return n(t,0)?e.clone():p(e,t,this,!1)},"number | BigNumber, SparseMatrix":function(e,t){return n(e,0)?i(t.size(),t.storage()):c(t,e,this,!0)},"number | BigNumber, DenseMatrix":function(e,t){return n(e,0)?i(t.size(),t.storage()):p(t,e,this,!0)},"Array, number | BigNumber":function(e,t){return this(r(e),t).valueOf()},"number | BigNumber, Array":function(e,t){return this(e,r(t)).valueOf()}})}),wf="setSize",Nf=j(wf,["typed","compareNatural"],e=>{var{typed:t,compareNatural:r}=e;return t(wf,{"Array | Matrix":function(e){return Array.isArray(e)?be(e).length:be(e.toArray()).length},"Array | Matrix, boolean":function(e,t){if(!1===t||0===e.length)return Array.isArray(e)?be(e).length:be(e.toArray()).length;for(var n=be(Array.isArray(e)?e:e.toArray()).sort(r),i=1,a=1;a<n.length;a++)0!==r(n[a],n[a-1])&&i++;return i}})});function Mf(e,t,r,n,i,a,o){var s=0;for(r[o]=e;s>=0;){var u=r[o+s],c=r[n+u];-1===c?(s--,a[t++]=u):(r[n+u]=r[i+c],r[o+ ++s]=c)}return t}function Sf(e){return-e-2}var Ef=j("csAmd",["add","multiply","transpose"],e=>{var{add:t,multiply:r,transpose:n}=e;return function(e,o){if(!o||e<=0||e>3)return null;var s=o._size,u=s[0],c=s[1],l=0,f=Math.max(16,10*Math.sqrt(c)),p=function(e,i,a,o,s){var u=n(i);if(1===e&&o===a)return t(i,u);if(2===e){for(var c=u._index,l=u._ptr,f=0,p=0;p<a;p++){var m=l[p];if(l[p]=f,!(l[p+1]-m>s))for(var d=l[p+1];m<d;m++)c[f++]=c[m]}return l[a]=f,i=n(u),r(u,i)}return r(u,i)}(e,o,u,c,f=Math.min(c-2,f));!function(e,t){for(var r=e._values,n=e._index,i=e._ptr,a=e._size[1],o=0,s=0;s<a;s++){var u=i[s];for(i[s]=o;u<i[s+1];u++)t(n[u],s,r?r[u]:1,null)&&(n[o]=n[u],r&&(r[o]=r[u]),o++)}i[a]=o,n.splice(o,n.length-o),r&&r.splice(o,r.length-o)}(p,a);for(var m,d,h,y,g,v,x,b,w,N,M,S,E,A,O,C,_=p._index,T=p._ptr,B=T[c],z=[],q=[],D=c+1,I=2*(c+1),k=3*(c+1),R=4*(c+1),U=5*(c+1),P=6*(c+1),F=7*(c+1),j=z,L=function(e,t,r,n,a,o,s,u,c,l,f,p){for(var m=0;m<e;m++)r[0+m]=t[m+1]-t[m];r[0+e]=0;for(var d=0;d<=e;d++)r[a+d]=-1,o[d]=-1,r[s+d]=-1,r[u+d]=-1,r[c+d]=1,r[l+d]=1,r[f+d]=0,r[p+d]=r[0+d];var h=i(0,0,r,l,e);return r[f+e]=-2,t[e]=-1,r[l+e]=0,h}
1(c,T,q,0,k,j,I,F,D,P,R,U),$=function(e,t,r,n,i,a,o,s,u,c,l){for(var f=0,p=0;p<e;p++){var m=r[n+p];if(0===m)r[i+p]=-2,f++,t[p]=-1,r[a+p]=0;else if(m>o)r[s+p]=0,r[i+p]=-1,f++,t[p]=Sf(e),r[s+e]++;else{var d=r[u+m];-1!==d&&(c[d]=p),r[l+p]=r[u+m],r[u+m]=p}}return f}(c,T,q,U,R,P,f,D,k,j,I),H=0;$<c;){for(h=-1;H<c&&-1===(h=q[k+H]);H++);-1!==q[I+h]&&(j[q[I+h]]=-1),q[k+H]=q[I+h];var G=q[R+h],V=q[D+h];$+=V;var Z=0;q[D+h]=-V;var W=T[h],J=0===G?W:B,Y=J;for(y=1;y<=G+1;y++){for(y>G?(v=h,x=W,b=q[0+h]-G):(x=T[v=_[W++]],b=q[0+v]),g=1;g<=b;g++)(w=q[D+(m=_[x++])])<=0||(Z+=w,q[D+m]=-w,_[Y++]=m,-1!==q[I+m]&&(j[q[I+m]]=j[m]),-1!==j[m]?q[I+j[m]]=q[I+m]:q[k+q[U+m]]=q[I+m]);v!==h&&(T[v]=Sf(h),q[P+v]=0)}for(0!==G&&(B=Y),q[U+h]=Z,T[h]=J,q[0+h]=Y-J,q[R+h]=-2,L=i(L,l,q,P,c),N=J;N<Y;N++)if(!((M=q[R+(m=_[N])])<=0)){var Q=L-(w=-q[D+m]);for(W=T[m],S=T[m]+M-1;W<=S;W++)q[P+(v=_[W])]>=L?q[P+v]-=w:0!==q[P+v]&&(q[P+v]=q[U+v]+Q)}for(N=J;N<Y;N++){for(E=(S=T[m=_[N]])+q[R+m]-1,A=S,O=0,C=0,W=S;W<=E;W++)if(0!==q[P+(v=_[W])]){var X=q[P+v]-L;X>0?(C+=X,_[A++]=v,O+=v):(T[v]=Sf(h),q[P+v]=0)}q[R+m]=A-S+1;var K=A,ee=S+q[0+m];for(W=E+1;W<ee;W++){var te=q[D+(d=_[W])];te<=0||(C+=te,_[A++]=d,O+=d)}0===C?(T[m]=Sf(h),Z-=w=-q[D+m],V+=w,$+=w,q[D+m]=0,q[R+m]=-1):(q[U+m]=Math.min(q[U+m],C),_[A]=_[K],_[K]=_[S],_[S]=h,q[0+m]=A-S+1,O=(O<0?-O:O)%c,q[I+m]=q[F+O],q[F+O]=m,j[m]=O)}for(q[U+h]=Z,L=i(L+(l=Math.max(l,Z)),l,q,P,c),N=J;N<Y;N++)if(!(q[D+(m=_[N])]>=0))for(m=q[F+(O=j[m])],q[F+O]=-1;-1!==m&&-1!==q[I+m];m=q[I+m],L++){for(b=q[0+m],M=q[R+m],W=T[m]+1;W<=T[m]+b-1;W++)q[P+_[W]]=L;var re=m;for(d=q[I+m];-1!==d;){var ne=q[0+d]===b&&q[R+d]===M;for(W=T[d]+1;ne&&W<=T[d]+b-1;W++)q[P+_[W]]!==L&&(ne=0);ne?(T[d]=Sf(m),q[D+m]+=q[D+d],q[D+d]=0,q[R+d]=-1,d=q[I+d],q[I+re]=d):(re=d,d=q[I+d])}}for(W=J,N=J;N<Y;N++)(w=-q[D+(m=_[N])])<=0||(q[D+m]=w,C=q[U+m]+Z-w,-1!==q[k+(C=Math.min(C,c-$-w))]&&(j[q[k+C]]=m),q[I+m]=q[k+C],j[m]=-1,q[k+C]=m,H=Math.min(H,C),q[U+m]=C,_[W++]=m);q[D+h]=V,0===(q[0+h]=W-J)&&(T[h]=-1,q[P+h]=0),0!==G&&(B=W)}for(m=0;m<c;m++)T[m]=Sf(T[m]);for(d=0;d<=c;d++)q[k+d]=-1;for(d=c;d>=0;d--)q[D+d]>0||(q[I+d]=q[k+T[d]],q[k+T[d]]=d);for(v=c;v>=0;v--)q[D+v]<=0||-1!==T[v]&&(q[I+v]=q[k+T[v]],q[k+T[v]]=v);for(h=0,m=0;m<=c;m++)-1===T[m]&&(h=Mf(m,h,q,k,I,z,P));return z.splice(z.length-1,1),z};function i(e,t,r,n,i){if(e<2||e+t<0){for(var a=0;a<i;a++)0!==r[n+a]&&(r[n+a]=1);e=2}return e}function a(e,t){return e!==t}});function Af(e,t,r,n,i,a,o){var s,u,c,l=0;if(e<=t||r[n+t]<=r[i+e])return-1;r[i+e]=r[n+t];var f=r[a+e];if(r[a+e]=t,-1===f)l=1,c=e;else{for(l=2,c=f;c!==r[o+c];c=r[o+c]);for(s=f;s!==c;s=u)u=r[o+s],r[o+s]=c}return{jleaf:l,q:c}}var Of=j("csCounts",["transpose"],e=>{var{transpose:t}=e;return function(e,r,n,i){if(!e||!r||!n)return null;var a,o,s,u,c,l,f,p=e._size,m=p[0],d=p[1],h=4*d+(i?d+m+1:0),y=[],g=d,v=2*d,x=3*d,b=4*d,w=5*d+1;for(s=0;s<h;s++)y[s]=-1;var N=[],M=t(e),S=M._index,E=M._ptr;for(s=0;s<d;s++)for(N[o=n[s]]=-1===y[x+o]?1:0;-1!==o&&-1===y[x+o];o=r[o])y[x+o]=s;if(i){for(s=0;s<d;s++)y[n[s]]=s;for(a=0;a<m;a++){for(s=d,l=E[a],f=E[a+1],c=l;c<f;c++)s=Math.min(s,y[S[c]]);y[w+a]=y[b+s],y[b+s]=a}}for(a=0;a<d;a++)y[0+a]=a;for(s=0;s<d;s++){for(-1!==r[o=n[s]]&&N[r[o]]--,u=i?y[b+s]:o;-1!==u;u=i?y[w+u]:-1)for(c=E[u];c<E[u+1];c++){var A=Af(a=S[c],o,y,x,g,v,0);A.jleaf>=1&&N[o]++,2===A.jleaf&&N[A.q]--}-1!==r[o]&&(y[0+o]=r[o])}for(o=0;o<d;o++)-1!==r[o]&&(N[r[o]]+=N[o]);return N}}),Cf=j("csSqr",["add","multiply","transpose"],e=>{var{add:t,multiply:r,transpose:n}=e,i=Ef({add:t,multiply:r,transpose:n}),a=Of({transpose:n});return function(e,t,r){var n,o=t._ptr,s=t._size[1],u={};if(u.q=i(e,t),e&&!u.q)return null;if(r){var c=e?function(e,t,r){for(var n=e._values,i=e._index,a=e._ptr,o=e._size,s=e._datatype,u=o[0],c=o[1],l=null,f=[],p=[],m=0,d=0;d<c;d++){p[d]=m;for(var h=r?r[d]:d,y=a[h],g=a[h+1],v=y;v<g;v++){var x=i[v];f[m]=x,l&&(l[m]=n[v]),m++}}return p[c]=m,e.createSparseMatrix({values:l,index:f,ptr:p,size:[u,c],datatype:s})}(t,0,u.q):t;u.parent=function(e){if(!e)return null;var t,r,n=e._index,i=e._ptr,a=e._size,o=a[0],s=a[1],u=[],c=[],l=s;for(t=0;t<o;t++)c[l+t]=-1;for(var f=0;f<s;f++){u[f]=-1,c[0+f]=-1;for(var p=i[f],m=i[f+1],d=p;d<m;d++){var h=n[d];for(t=c[l+h];-1!==t&&t<f;
1t=r)r=c[0+t],c[0+t]=f,-1===r&&(u[t]=f);c[l+h]=f}}return u}(c);var l=function(e,t){if(!e)return null;var r,n=0,i=[],a=[],o=t,s=2*t;for(r=0;r<t;r++)a[0+r]=-1;for(r=t-1;r>=0;r--)-1!==e[r]&&(a[o+r]=a[0+e[r]],a[0+e[r]]=r);for(r=0;r<t;r++)-1===e[r]&&(n=Mf(r,n,a,0,o,i,s));return i}(u.parent,s);if(u.cp=a(c,u.parent,l,1),c&&u.parent&&u.cp&&function(e,t){var r=e._ptr,n=e._index,i=e._size,a=i[0],o=i[1];t.pinv=[],t.leftmost=[];var s,u,c,l,f,p=t.parent,m=t.pinv,d=t.leftmost,h=[],y=a,g=a+o,v=a+2*o;for(u=0;u<o;u++)h[y+u]=-1,h[g+u]=-1,h[v+u]=0;for(s=0;s<a;s++)d[s]=-1;for(u=o-1;u>=0;u--)for(l=r[u],f=r[u+1],c=l;c<f;c++)d[n[c]]=u;for(s=a-1;s>=0;s--)m[s]=-1,-1!==(u=d[s])&&(0===h[v+u]++&&(h[g+u]=s),h[0+s]=h[y+u],h[y+u]=s);for(t.lnz=0,t.m2=a,u=0;u<o;u++)if(s=h[y+u],t.lnz++,s<0&&(s=t.m2++),m[s]=u,!(--v[u]<=0)){t.lnz+=h[v+u];var x=p[u];-1!==x&&(0===h[v+x]&&(h[g+x]=h[g+u]),h[0+h[g+u]]=h[y+x],h[y+x]=h[0+s],h[v+x]+=h[v+u])}for(s=0;s<a;s++)m[s]<0&&(m[s]=u++);return!0}(c,u))for(u.unz=0,n=0;n<s;n++)u.unz+=u.cp[n]}else u.unz=4*o[s]+s,u.lnz=u.unz;return u}});function _f(e,t){return e[t]<0}function Tf(e,t){e[t]=Sf(e[t])}function Bf(e){return e<0?Sf(e):e}function zf(e,t,r,n,i){var a,o,s,u=t._index,c=t._ptr,l=t._size[1],f=0;for(n[0]=e;f>=0;){e=n[f];var p=i?i[e]:e;_f(c,e)||(Tf(c,e),n[l+f]=p<0?0:Bf(c[p]));var m=1;for(o=n[l+f],s=p<0?0:Bf(c[p+1]);o<s;o++)if(!_f(c,a=u[o])){n[l+f]=o,n[++f]=a,m=0;break}m&&(f--,n[--r]=e)}return r}var qf=j("csSpsolve",["divideScalar","multiply","subtract"],e=>{var{divideScalar:t,multiply:r,subtract:n}=e;return function(e,i,a,o,s,u,c){var l,f,p,m,d=e._values,h=e._index,y=e._ptr,g=e._size[1],v=i._values,x=i._index,b=i._ptr,w=function(e,t,r,n,i){var a,o,s,u=e._ptr,c=e._size,l=t._index,f=t._ptr,p=c[1],m=p;for(o=f[r],s=f[r+1],a=o;a<s;a++){var d=l[a];_f(u,d)||(m=zf(d,e,m,n,i))}for(a=m;a<p;a++)Tf(u,n[a]);return m}(e,i,a,o,u);for(l=w;l<g;l++)s[o[l]]=0;for(f=b[a],p=b[a+1],l=f;l<p;l++)s[x[l]]=v[l];for(var N=w;N<g;N++){var M=o[N],S=u?u[M]:M;if(!(S<0))for(f=y[S],p=y[S+1],s[M]=t(s[M],d[c?f:p-1]),l=c?f+1:f,m=c?p:p-1;l<m;l++){var E=h[l];s[E]=n(s[E],r(d[l],s[M]))}}return w}}),Df=j("csLu",["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],e=>{var{abs:t,divideScalar:r,multiply:n,subtract:i,larger:a,largerEq:o,SparseMatrix:s}=e,u=qf({divideScalar:r,multiply:n,subtract:i});return function(e,i,c){if(!e)return null;var l,f=e._size[1],p=100,m=100;i&&(l=i.q,p=i.lnz||p,m=i.unz||m);var d,h,y=[],g=[],v=[],x=new s({values:y,index:g,ptr:v,size:[f,f]}),b=[],w=[],N=[],M=new s({values:b,index:w,ptr:N,size:[f,f]}),S=[],E=[],A=[];for(d=0;d<f;d++)E[d]=0,S[d]=-1,v[d+1]=0;p=0,m=0;for(var O=0;O<f;O++){v[O]=p,N[O]=m;var C=l?l[O]:O,_=u(x,e,C,A,E,S,1),T=-1,B=-1;for(h=_;h<f;h++)if(S[d=A[h]]<0){var z=t(E[d]);a(z,B)&&(B=z,T=d)}else w[m]=S[d],b[m++]=E[d];if(-1===T||B<=0)return null;S[C]<0&&o(t(E[C]),n(B,c))&&(T=C);var q=E[T];for(w[m]=O,b[m++]=q,S[T]=O,g[p]=T,y[p++]=1,h=_;h<f;h++)S[d=A[h]]<0&&(g[p]=d,y[p++]=r(E[d],q)),E[d]=0}for(v[f]=p,N[f]=m,h=0;h<p;h++)g[h]=S[g[h]];return y.splice(p,y.length-p),g.splice(p,g.length-p),b.splice(m,b.length-m),w.splice(m,w.length-m),{L:x,U:M,pinv:S}}}),If=j("slu",["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],e=>{var{typed:t,abs:r,add:n,multiply:i,transpose:a,divideScalar:o,subtract:u,larger:c,largerEq:l,SparseMatrix:f}=e,p=Cf({add:n,multiply:i,transpose:a}),m=Df({abs:r,divideScalar:o,multiply:i,subtract:u,larger:c,largerEq:l,SparseMatrix:f});return t("slu",{"SparseMatrix, number, number":function(e,t,r){if(!s(t)||t<0||t>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(r<0||r>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var n=p(t,e,!1),i=m(e,n,r);return{L:i.L,U:i.U,p:i.pinv,q:n.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}})}),kf=j("trace",["typed","matrix","add"],e=>{var{typed:t,matrix:r,add:n}=e;return t("trace",{Array:function(e){return i(r(e))},SparseMatrix:function(e){var t=e._values,r=e._index,i=e._ptr,a=e._size,o=a[0],s=a[1];if(o===s){var u=0;if(t.length>0)for(var c=0;c<s;c++)for(var l=i[c],f=i[c+1],p=l;p<f;p++){var m=r[p];if(m===c){u=n(u,t[p]);break}if(m>c)break}return u}throw new RangeError("Matrix must be square (size: "+z(a)+")")},DenseMatrix:i,any:R});function i(e){var t=e._size,r=e._data;switch(t.length){case 1:if(1===t[0])return R(r[0]);throw new RangeError("Matrix must be square (size: "+z(t)+")");case 2:var i=t[0];if(i===t[1]){for(var a=0,o=0;o<i;o++)a=n(a,r[o][o]);return a}throw new RangeError("Matrix must be square (size: "+z(t)+")");
1default:throw new RangeError("Matrix must be two dimensional (size: "+z(t)+")")}}}),Rf="usolveAll",Uf=j(Rf,["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],e=>{var{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtract:a,equalScalar:o,DenseMatrix:s}=e,u=pl({DenseMatrix:s});return t(Rf,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){for(var r=[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,d=l-1;d>=0;d--)for(var h=r.length,y=0;y<h;y++){for(var g=r[y],v=[],x=[],b=m[d],w=0,N=m[d+1]-1;N>=b;N--){var M=p[N];M===d?w=f[N]:M<d&&(v.push(f[N]),x.push(M))}if(o(w,0))if(o(g[d],0)){if(0===y){var S=[...g];S[d]=1;for(var E=0,A=x.length;E<A;E++){var O=x[E];S[O]=a(S[O],v[E])}r.push(S)}}else{if(0===y)return[];r.splice(y,1),y-=1,h-=1}else{g[d]=n(g[d],w);for(var C=0,_=x.length;C<_;C++){var T=x[C];g[T]=a(g[T],i(g[d],v[C]))}}}return r.map(e=>new 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(r(e),t).map(e=>e.valueOf())}});function c(e,t){for(var r=[u(e,t,!0)._data.map(e=>e[0])],c=e._data,l=e._size[0],f=e._size[1]-1;f>=0;f--)for(var p=r.length,m=0;m<p;m++){var d=r[m];if(o(c[f][f],0))if(o(d[f],0)){if(0===m){var h=[...d];h[f]=1;for(var y=f-1;y>=0;y--)h[y]=a(h[y],c[y][f]);r.push(h)}}else{if(0===m)return[];r.splice(m,1),m-=1,p-=1}else{d[f]=n(d[f],c[f][f]);for(var g=f-1;g>=0;g--)d[g]=a(d[g],i(d[f],c[g][f]))}}return r.map(e=>new s({data:e.map(e=>[e]),size:[l,1]}))}}),Pf="asin",Ff=j(Pf,["typed","config","Complex"],e=>{var{typed:t,config:r,Complex:n}=e;return t(Pf,{number:function(e){return e>=-1&&e<=1||r.predictable?Math.asin(e):new n(e,0).asin()},Complex:function(e){return e.asin()},BigNumber:function(e){return e.asin()},"Array | Matrix":function(e){return ct(e,this,!0)}})}),jf="ceil",Lf=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],$f=j(jf,["typed","config","round"],e=>{var{typed:t,config:r,round:n}=e;return t(jf,{number:function(e){return N(e,n(e),r.epsilon)?n(e):Math.ceil(e)},"number, number":function(e,t){if(N(e,n(e,t),r.epsilon))return n(e,t);var[i,a]="".concat(e,"e").split("e"),o=Math.ceil(Number("".concat(i,"e").concat(Number(a)+t)));return[i,a]="".concat(o,"e").split("e"),Number("".concat(i,"e").concat(Number(a)-t))}})}),Hf=j(jf,Lf,e=>{var{typed:t,config:r,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,u=Zu({typed:t,equalScalar:a}),c=Wu({typed:t,DenseMatrix:s}),l=Yu({typed:t}),f=$f({typed:t,config:r,round:n});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:function(e){return Co(e,n(e),r.epsilon)?n(e):e.ceil()},"BigNumber, BigNumber":function(e,t){return Co(e,n(e,t),r.epsilon)?n(e,t):e.toDecimalPlaces(t.toNumber(),Xr.A.ROUND_CEIL)},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())},"Array | Matrix":function(e){return ct(e,this,!0)},"Array, number | BigNumber":function(e,t){return ct(e,e=>this(e,t),!0)},"SparseMatrix, number | BigNumber":function(e,t){return u(e,t,this,!1)},"DenseMatrix, number | BigNumber":function(e,t){return l(e,t,this,!1)},"number | Complex | Fraction | BigNumber, Array":function(e,t){return l(i(t),e,this,!0).valueOf()},"number | Complex | Fraction | BigNumber, Matrix":function(e,t){return a(e,0)?o(t.size(),t.storage()):"dense"===t.storage()?l(t,e,this,!0):c(t,e,this,!0)}})}),Gf="composition",Vf=j(Gf,["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],e=>{var{typed:t,addScalar:r,combinations:n,isPositive:i,isNegative:a,isInteger:o,larger:s}=e;return t(Gf,{"number | BigNumber, number | BigNumber":function(e,t){if(!(o(e)&&i(e)&&o(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 n(r(e,-1),r(t,-1))}})}),Zf="cross",Wf=j(Zf,["typed","matrix","subtract","multiply"],e=>{var{typed:t,matrix:r,subtract:n,multiply:i}=e;return t(Zf,{"Matrix, Matrix":function(e,t){return r(a(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return r(a(e.toArray(),t))},"Array, Matrix":function(e,t){return r(a(e,t.toArray()))},"Array, Array":a});function a(e,t){var r=Math.max(se(e).length,se(t).length);e=ye(e),t=ye(t);var a=se(e),o=se(t);if(1!==a.length||1!==o.length||3!==a[0]||3!==o[0])throw new RangeError("Vectors with length 3 expected (Size A = ["+a.join(", ")+"], B = ["+o.join(", ")+"])");var s=[n(i(e[1],t[2]),i(e[2],t[1])),n(i(e[2],t[0]),i(e[0],t[2])),n(i(e[0],t[1]),i(e[1],t[0]))];return r>1?[s]:s}}),Jf=j("det",["typed","matrix","subtract","multiply","divideScalar","isZero","unaryMinus"],e=>{var{typed:t,matrix:r,subtract:n,multiply:i,divideScalar:a,isZero:s,unaryMinus:u}=e;return t("det",{any:function(e){return R(e)},"Array | Matrix":function(e){var t;switch((t=(0,o.OA)(e)?e.size():Array.isArray(e)?(e=r(e)).size():[]).length){case 0:return R(e);case 1:if(1===t[0])return R(e.valueOf()[0]);throw new RangeError("Matrix must be square (size: "+z(t)+")");case 2:var c=t[0];if(c===t[1])return function(e,t){if(1===t)return R(e[0][0]);if(2===t)return n(i(e[0][0],e[1][1]),i(e[1][0],e[0][1]));for(var r=!1,o=new Array(t).fill(0).map((e,t)=>t),c=0;c<t;c++){var l=o[c];if(s(e[l][c])){var f=void 0;for(f=c+1;f<t;f++)if(!s(e[o[f]][c])){l=o[f],o[f]=o[c],o[c]=l,r=!r;break}if(f===t)return e[l][c]}for(var p=e[l][c],m=0===c?1:e[o[c-1]][c-1],d=c+1;d<t;d++)for(var h=o[d],y=c+1;y<t;
1y++)e[h][y]=a(n(i(e[h][y],p),i(e[h][c],e[l][y])),m)}var g=e[o[t-1]][t-1];return r?u(g):g}(e.clone().valueOf(),c);throw new RangeError("Matrix must be square (size: "+z(t)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+z(t)+")")}}})}),Yf="distance",Qf=j(Yf,["typed","addScalar","subtract","divideScalar","multiplyScalar","unaryMinus","sqrt","abs"],e=>{var{typed:t,addScalar:r,subtract:n,multiplyScalar:i,divideScalar:a,unaryMinus:s,sqrt:u,abs:c}=e;return t(Yf,{"Array, Array, Array":function(e,t,r){if(2===e.length&&2===t.length&&2===r.length){if(!f(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!f(r))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");var o=a(n(r[1],r[0]),n(t[1],t[0])),u=i(i(o,o),t[0]),c=s(i(o,t[0])),l=e[1];return y(e[0],e[1],u,c,l)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(e,t,r){if(2===Object.keys(e).length&&2===Object.keys(t).length&&2===Object.keys(r).length){if(!f(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(t))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!f(r))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"lineOnePtX"in t&&"lineOnePtY"in t&&"lineTwoPtX"in r&&"lineTwoPtY"in r){var o=a(n(r.lineTwoPtY,r.lineTwoPtX),n(t.lineOnePtY,t.lineOnePtX)),u=i(i(o,o),t.lineOnePtX),c=s(i(o,t.lineOnePtX)),l=e.pointX;return y(e.pointX,e.pointY,u,c,l)}
1throw 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(!f(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!p(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return y(e[0],e[1],t[0],t[1],t[2])}if(3===e.length&&6===t.length){if(!p(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!d(t))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return g(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(!m(e))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!m(t))throw new TypeError("All values of an array should be numbers or BigNumbers");return v(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(!f(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!p(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 y(e.pointX,e.pointY,t.xCoeffLine,t.yCoeffLine,t.constant);
1throw new TypeError("Key names do not match")}if(3===Object.keys(e).length&&6===Object.keys(t).length){if(!p(e))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!d(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 g(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(!f(e))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!f(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 v([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(!p(e))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!p(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 v([e.pointOneX,e.pointOneY,e.pointOneZ],[t.pointTwoX,t.pointTwoY,t.pointTwoZ]);
1throw 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&&l(e[0][0])&&l(e[0][1])){if(e.some(e=>2!==e.length||!l(e[0])||!l(e[1])))return!1}else{if(!(3===e[0].length&&l(e[0][0])&&l(e[0][1])&&l(e[0][2])))return!1;if(e.some(e=>3!==e.length||!l(e[0])||!l(e[1])||!l(e[2])))return!1}return!0}(e))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return function(e){for(var t=[],r=[],n=[],i=0;i<e.length-1;i++)for(var a=i+1;a<e.length;a++)2===e[0].length?(r=[e[i][0],e[i][1]],n=[e[a][0],e[a][1]]):3===e[0].length&&(r=[e[i][0],e[i][1],e[i][2]],n=[e[a][0],e[a][1],e[a][2]]),t.push(v(r,n));return t}(e)}});function l(e){return"number"==typeof e||(0,o.C4)(e)}function f(e){return e.constructor!==Array&&(e=h(e)),l(e[0])&&l(e[1])}function p(e){return e.constructor!==Array&&(e=h(e)),l(e[0])&&l(e[1])&&l(e[2])}function m(e){return Array.isArray(e)||(e=h(e)),e.every(l)}function d(e){return e.constructor!==Array&&(e=h(e)),l(e[0])&&l(e[1])&&l(e[2])&&l(e[3])&&l(e[4])&&l(e[5])}function h(e){for(var t=Object.keys(e),r=[],n=0;n<t.length;n++)r.push(e[t[n]]);return r}function y(e,t,n,o,s){var l=c(r(r(i(n,e),i(o,t)),s)),f=u(r(i(n,n),i(o,o)));return a(l,f)}function g(e,t,o,s,c,l,f,p,m){var d=[n(i(n(c,t),m),i(n(l,o),p)),n(i(n(l,o),f),i(n(s,e),m)),n(i(n(s,e),p),i(n(c,t),f))];d=u(r(r(i(d[0],d[0]),i(d[1],d[1])),i(d[2],d[2])));var h=u(r(r(i(f,f),i(p,p)),i(m,m)));return a(d,h)}function v(e,t){for(var a=e.length,o=0,s=0,c=0;c<a;c++)s=n(e[c],t[c]),o=r(i(s,s),o);return u(o)}}),Xf="dotMultiply",Kf=j(Xf,["typed","matrix","equalScalar","multiplyScalar"],e=>{var{typed:t,matrix:r,equalScalar:n,multiplyScalar:i}=e,a=Hu({typed:t,equalScalar:n}),o=Pl({typed:t,equalScalar:n}),s=Zu({typed:t,equalScalar:n}),u=Ju({typed:t}),c=Yu({typed:t});return t(Xf,{"any, any":i,"SparseMatrix, SparseMatrix":function(e,t){return o(e,t,i,!1)},"SparseMatrix, DenseMatrix":function(e,t){return a(t,e,i,!0)},"DenseMatrix, SparseMatrix":function(e,t){return a(e,t,i,!1)},"DenseMatrix, DenseMatrix":function(e,t){return u(e,t,i)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, any":function(e,t){return s(e,t,i,!1)},"DenseMatrix, any":function(e,t){return c(e,t,i,!1)},"any, SparseMatrix":function(e,t){return s(t,e,i,!0)},"any, DenseMatrix":function(e,t){return c(t,e,i,!0)},"Array, any":function(e,t){return c(r(e),t,i,!1).valueOf()},"any, Array":function(e,t){return c(r(t),e,i,!0).valueOf()}})}),ep=j("FibonacciHeap",["smaller","larger"],e=>{var{smaller:t,larger:r}=e,n=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 a(e,t,r){t.left.right=t.right,t.right.left=t.left,r.degree--,r.child===t&&(r.child=t.right),0===r.degree&&(r.child=null),t.left=e,t.right=e.right,e.right=t,t.right.left=t,t.parent=null,t.mark=!1}function o(e,t){var r=t.parent;r&&(t.mark?(a(e,t,r),o(r)):t.mark=!0)}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(e,r){var n={key:e,value:r,degree:0};if(this._minimum){var i=this._minimum;n.left=i,n.right=i.right,i.right=n,n.right.left=n,t(e,i.key)&&(this._minimum=n)}else n.left=n,n.right=n,this._minimum=n;return this._size++,n},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(){var e=this._minimum;if(null===e)return e;for(var i=this._minimum,a=e.degree,o=e.child;a>0;){var u=o.right;o.left.right=o.right,o.right.left=o.left,o.left=i,o.right=i.right,i.right=o,o.right.left=o,o.parent=null,o=u,a--}return e.left.right=e.right,e.right.left=e.left,i=e===e.right?null:function(e,i){var a,o=Math.floor(Math.log(i)*n)+1,u=new Array(o),c=0,l=e;if(l)for(c++,l=l.right;l!==e;)c++,l=l.right;for(;c>0;){for(var f=l.degree,p=l.right;a=u[f];){if(r(l.key,a.key)){var m=a;a=l,l=m}s(a,l),u[f]=null,f++}u[f]=l,l=p,c--}e=null;for(var d=0;d<o;d++)(a=u[d])&&(e?(a.left.right=a.right,a.right.left=a.left,a.left=e,a.right=e.right,e.right=a,a.right.left=a,t(a.key,e.key)&&(e=a)):e=a);return e}(i=e.right,this._size),this._size--,this._minimum=i,e},i.prototype.remove=function(e){this._minimum=function(e,r){r.key=-1;var n=r.parent;return n&&t(r.key,n.key)&&(a(e,r,n),o(e,n)),t(r.key,e.key)&&(e=r),e}(this._minimum,e),this.extractMinimum()};var s=function(e,t){e.left.right=e.right,e.right.left=e.left,e.parent=t,t.child?(e.left=t.child,e.right=t.child.right,t.child.right=e,e.right.left=e):(t.child=e,e.right=e,e.left=e),t.degree++,e.mark=!1};return i},{isClass:!0}),tp="fix",rp=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],np=j(tp,["typed","ceil","floor"],e=>{var{typed:t,ceil:r,floor:n}=e;return t(tp,{number:function(e){return e>0?n(e):r(e)},"number, number":function(e,t){return e>0?n(e,t):r(e,t)}})}),ip=j(tp,rp,e=>{var{typed:t,Complex:r,matrix:n,ceil:i,floor:a,equalScalar:o,zeros:s,DenseMatrix:u}=e,c=Wu({typed:t,DenseMatrix:u}),l=Yu({typed:t}),f=np({typed:t,ceil:i,floor:a});return t("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(e){return new r(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 r(e.re>0?a(e.re,t):i(e.re,t),e.im>0?a(e.im,t):i(e.im,t))},"Complex, BigNumber":function(e,t){var n=t.toNumber();return new r(e.re>0?a(e.re,n):i(e.re,n),e.im>0?a(e.im,n):i(e.im,n))},BigNumber:function(e){return e.isNegative()?i(e):a(e)},"BigNumber, number | BigNumber":function(e,t){return e.isNegative()?i(e,t):a(e,t)},Fraction:function(e){return e.s<0?e.ceil():e.floor()},"Fraction, number | BigNumber":function(e,t){return e.s<0?i(e,t):a(e,t)},"Array | Matrix":function(e){return ct(e,this,!0)},"Array | Matrix, number | BigNumber":function(e,t){return ct(e,e=>this(e,t),!0)},"number | Complex | Fraction | BigNumber, Array":function(e,t){return l(n(t),e,this,
1!0).valueOf()},"number | Complex | Fraction | BigNumber, Matrix":function(e,t){return o(e,0)?s(t.size(),t.storage()):"dense"===t.storage()?l(t,e,this,!0):c(t,e,this,!0)}})}),ap=j("ImmutableDenseMatrix",["smaller","DenseMatrix"],e=>{var{smaller:t,DenseMatrix:r}=e;function n(e,t){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!(0,o.Kg)(t))throw new Error("Invalid datatype: "+t);if((0,o.OA)(e)||(0,o.cy)(e)){var i=new r(e,t);this._data=i._data,this._size=i._size,this._datatype=i._datatype,this._min=null,this._max=null}else if(e&&(0,o.cy)(e.data)&&(0,o.cy)(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 ("+(0,o.QP)(e)+")");this._data=[],this._size=[0],this._datatype=t,this._min=null,this._max=null}}return n.prototype=new r,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(e){switch(arguments.length){case 1:var t=r.prototype.subset.call(this,e);return(0,o.OA)(t)?new n({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")}},n.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},n.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},n.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},n.prototype.clone=function(){return new n({data:R(this._data),size:R(this._size),datatype:this._datatype})},n.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.fromJSON=function(e){return new n(e)},n.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},n.prototype.min=function(){if(null===this._min){var e=null;this.forEach(function(r){(null===e||t(r,e))&&(e=r)}),this._min=null!==e?e:void 0}return this._min},n.prototype.max=function(){if(null===this._max){var e=null;this.forEach(function(r){(null===e||t(e,r))&&(e=r)}),this._max=null!==e?e:void 0}return this._max},n},{isClass:!0}),op=j("Index",["ImmutableDenseMatrix"],e=>{var{ImmutableDenseMatrix:t}=e;function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._isScalar=!0;for(var t=0,i=arguments.length;t<i;t++){var a=arguments[t];if((0,o._Z)(a))this._dimensions.push(a),this._isScalar=!1;else if(Array.isArray(a)||(0,o.OA)(a)){var s=n(a.valueOf());this._dimensions.push(s);var u=s.size();1===u.length&&1===u[0]||(this._isScalar=!1)}else if("number"==typeof a)this._dimensions.push(n([a]));else{if("string"!=typeof a)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");this._dimensions.push(a)}}}function n(e){for(var r=0,n=e.length;r<n;r++)if("number"!=typeof e[r]||!s(e[r]))throw new TypeError("Index parameters must be positive integer numbers");return new t(e)}return r.prototype.type="Index",r.prototype.isIndex=!0,r.prototype.clone=function(){var e=new r;return e._dimensions=R(this._dimensions),e._isScalar=this._isScalar,e},r.create=function(e){var t=new r;return r.apply(t,e),t},r.prototype.size=function(){for(var e=[],t=0,r=this._dimensions.length;t<r;t++){var n=this._dimensions[t];e[t]="string"==typeof n?1:n.size()[0]}return e},r.prototype.max=function(){for(var e=[],t=0,r=this._dimensions.length;t<r;t++){var n=this._dimensions[t];e[t]="string"==typeof n?n:n.max()}return e},r.prototype.min=function(){for(var e=[],t=0,r=this._dimensions.length;t<r;t++){var n=this._dimensions[t];e[t]="string"==typeof n?n:n.min()}return e},r.prototype.forEach=function(e){for(var t=0,r=this._dimensions.length;t<r;t++)e(this._dimensions[t],t,this)},r.prototype.dimension=function(e){return this._dimensions[e]||null},r.prototype.isObjectProperty=function(){return 1===this._dimensions.length&&"string"==typeof this._dimensions[0]},r.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},r.prototype.isScalar=function(){return this._isScalar},r.prototype.toArray=function(){for(var e=[],t=0,r=this._dimensions.length;t<r;t++){var n=this._dimensions[t];e.push("string"==typeof n?n:n.toArray())}return e},r.prototype.valueOf=r.prototype.toArray,r.prototype.toString=function(){for(var e=[],t=0,r=this._dimensions.length;t<r;t++){var n=this._dimensions[t];"string"==typeof n?e.push(JSON.stringify(n)):e.push(n.toString())}return"["+e.join(", ")+"]"},r.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},r.fromJSON=function(e){return r.create(e.dimensions)},r},{isClass:!0}),sp=j("intersect",["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],e=>{var{typed:t,config:r,abs:n,add:i,addScalar:a,matrix:o,multiply:s,multiplyScalar:u,divi
1deScalar:c,subtract:l,smaller:f,equalScalar:p,flatten:m,isZero:d,isNumeric:h}=e;return t("intersect",{"Array, Array, Array":y,"Array, Array, Array, Array":g,"Matrix, Matrix, Matrix":function(e,t,r){var n=y(e.valueOf(),t.valueOf(),r.valueOf());return null===n?null:o(n)},"Matrix, Matrix, Matrix, Matrix":function(e,t,r,n){var i=g(e.valueOf(),t.valueOf(),r.valueOf(),n.valueOf());return null===i?null:o(i)}});function y(e,t,r){if(e=v(e),t=v(t),r=v(r),!b(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!b(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!function(e){return 4===e.length&&h(e[0])&&h(e[1])&&h(e[2])&&h(e[3])}(r))throw new TypeError("Array with 4 numbers expected as third argument");return function(e,t,r,n,i,o,s,f,p,m){var d=u(e,s),h=u(n,s),y=u(t,f),g=u(i,f),v=u(r,p),x=u(o,p),b=l(l(l(m,d),y),v),w=l(l(l(a(a(h,g),x),d),y),v),N=c(b,w);return[a(e,u(N,l(n,e))),a(t,u(N,l(i,t))),a(r,u(N,l(o,r)))]}(e[0],e[1],e[2],t[0],t[1],t[2],r[0],r[1],r[2],r[3])}function g(e,t,o,m){if(e=v(e),t=v(t),o=v(o),m=v(m),2===e.length){if(!x(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!x(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!x(o))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!x(m))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return function(e,t,o,p){var m=e,h=o,y=l(m,t),g=l(h,p),v=l(u(y[0],g[1]),u(g[0],y[1]));if(d(v))return null;if(f(n(v),r.epsilon))return null;var x=u(g[0],m[1]),b=u(g[1],m[0]),w=u(g[0],h[1]),N=u(g[1],h[0]),M=c(a(l(l(x,b),w),N),v);return i(s(y,M),m)}(e,t,o,m)}if(3===e.length){if(!b(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!b(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!b(o))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!b(m))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return function(e,t,r,n,i,o,s,f,m,h,y,g){var v=w(e,s,h,s,t,f,y,f,r,m,g,m),x=w(h,s,n,e,y,f,i,t,g,m,o,r),b=w(e,s,n,e,t,f,i,t,r,m,o,r),N=w(h,s,h,s,y,f,y,f,g,m,g,m),M=w(n,e,n,e,i,t,i,t,o,r,o,r),S=l(u(v,x),u(b,N)),E=l(u(M,N),u(x,x));if(d(E))return null;var A=c(S,E),O=c(a(v,u(A,x)),N),C=a(e,u(A,l(n,e))),_=a(t,u(A,l(i,t))),T=a(r,u(A,l(o,r))),B=a(s,u(O,l(h,s))),z=a(f,u(O,l(y,f))),q=a(m,u(O,l(g,m)));return p(C,B)&&p(_,z)&&p(T,q)?[C,_,T]:null}(e[0],e[1],e[2],t[0],t[1],t[2],o[0],o[1],o[2],m[0],m[1],m[2])}throw new TypeError("Arrays with two or thee dimensional points expected")}function v(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 x(e){return 2===e.length&&h(e[0])&&h(e[1])}function b(e){return 3===e.length&&h(e[0])&&h(e[1])&&h(e[2])}function w(e,t,r,n,i,o,s,c,f,p,m,d){var h=u(l(e,t),l(r,n)),y=u(l(i,o),l(s,c)),g=u(l(f,p),l(m,d));return a(a(h,y),g)}}),up=j("lcm",["typed","matrix","equalScalar"],e=>{var{typed:t,matrix:r,equalScalar:n}=e,i=Hu({typed:t,equalScalar:n}),a=Ku({typed:t,equalScalar:n}),o=Zu({typed:t,equalScalar:n}),s=Ju({typed:t}),u=Yu({typed:t});return t("lcm",{"number, number":Xi,"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(e.isZero())return e;if(t.isZero())return t;for(var r=e.times(t);!t.isZero();){var n=t;t=e.mod(n),e=n}return r.div(e).abs()},"Fraction, Fraction":function(e,t){return e.lcm(t)},"SparseMatrix, SparseMatrix":function(e,t){return a(e,t,this)},"SparseMatrix, DenseMatrix":function(e,t){return i(t,e,this,!0)},"DenseMatrix, SparseMatrix":function(e,t){return i(e,t,this,!1)},"DenseMatrix, DenseMatrix":function(e,t){return s(e,t,this)},"Array, Array":function(e,t){return this(r(e),r(t)).valueOf()},"Array, Matrix":function(e,t){return this(r(e),t)},"Matrix, Array":function(e,t){return this(e,r(t))},"SparseMatrix, number | BigNumber":function(e,t){return o(e,t,this,!1)},"DenseMatrix, number | BigNumber":function(e,t){return u(e,t,this,!1)},"number | BigNumber, SparseMatrix":function(e,t){return o(t,e,this,!0)},"number | BigNumber, DenseMatrix":function(e,t){return u(t,e,this,!0)},"Array, number | BigNumber":function(e,t){return u(r(e),t,this,!1).valueOf()},"number | BigNumber, Array":function(e,t){return u(r(t),e,this,
1!0).valueOf()},"Array | Matrix | number | BigNumber, Array | Matrix | number | BigNumber, ...Array | Matrix | number | BigNumber":function(e,t,r){for(var n=this(e,t),i=0;i<r.length;i++)n=this(n,r[i]);return n}})}),cp="log1p",lp=j(cp,["typed","config","divideScalar","log","Complex"],e=>{var{typed:t,config:r,divideScalar:n,log:i,Complex:a}=e;return t(cp,{number:function(e){return e>=-1||r.predictable?f(e):o(new a(e,0))},Complex:o,BigNumber:function(e){var t=e.plus(1);return!t.isNegative()||r.predictable?t.ln():o(new a(e.toNumber(),0))},"Array | Matrix":function(e){return ct(e,this)},"any, any":function(e,t){return n(this(e),i(t))}});function o(e){var t=e.re+1;return new a(Math.log(Math.sqrt(t*t+e.im*e.im)),Math.atan2(e.im,t))}}),fp=j("quantileSeq",["typed","add","multiply","partitionSelect","compare"],e=>{var{typed:t,add:r,multiply:n,partitionSelect:i,compare:a}=e;function u(e,t,s){var u=be(e),l=u.length;if(0===l)throw new Error("Cannot calculate quantile of an empty sequence");if((0,o.Et)(t)){var f=t*(l-1),p=f%1;if(0===p){var m=s?u[f]:i(u,f);return c(m),m}var d,h,y=Math.floor(f);if(s)d=u[y],h=u[y+1];else{h=i(u,y+1),d=u[y];for(var g=0;g<y;++g)a(u[g],d)>0&&(d=u[g])}return c(d),c(h),r(n(d,1-p),n(h,p))}var v=t.times(l-1);if(v.isInteger()){v=v.toNumber();var x=s?u[v]:i(u,v);return c(x),x}var b,w,N=v.floor(),M=v.minus(N),S=N.toNumber();if(s)b=u[S],w=u[S+1];else{w=i(u,S+1),b=u[S];for(var E=0;E<S;++E)a(u[E],b)>0&&(b=u[E])}c(b),c(w);var A=new M.constructor(1);return r(n(b,A.minus(M)),n(w,M))}var c=t({"number | BigNumber | Unit":function(e){return e}});return function(e,t,r){var n,i,a;if(arguments.length<2||arguments.length>3)throw new SyntaxError("Function quantileSeq requires two or three parameters");if((0,o.P3)(e)){if("boolean"==typeof(r=r||!1)){if(i=e.valueOf(),(0,o.Et)(t)){if(t<0)throw new Error("N/prob must be non-negative");if(t<=1)return u(i,t,r);if(t>1){if(!s(t))throw new Error("N must be a positive integer");var c=t+1;n=new Array(t);for(var l=0;l<t;)n[l]=u(i,++l/c,r);return n}}if((0,o.C4)(t)){var f=t.constructor;if(t.isNegative())throw new Error("N/prob must be non-negative");if(a=new f(1),t.lte(a))return new f(u(i,t,r));if(t.gt(a)){if(!t.isInteger())throw new Error("N must be a positive integer");var p=t.toNumber();if(p>4294967295)throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var m=new f(p+1);n=new Array(p);for(var d=0;d<p;)n[d]=new f(u(i,new f(++d).div(m),r));return n}}if(Array.isArray(t)){n=new Array(t.length);for(var h=0;h<n.length;++h){var y=t[h];if((0,o.Et)(y)){if(y<0||y>1)throw new Error("Probability must be between 0 and 1, inclusive")}else{if(!(0,o.C4)(y))throw new TypeError("Unexpected type of argument in function quantileSeq");if(a=new y.constructor(1),y.isNegative()||y.gt(a))throw new Error("Probability must be between 0 and 1, inclusive")}n[h]=u(i,y,r)}return n}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}}),pp="setCartesian",mp=j(pp,["typed","size","subset","compareNatural","Index","DenseMatrix"],e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(pp,{"Array | Matrix, Array | Matrix":function(e,t){var s=[];if(0!==n(r(e),new a(0))&&0!==n(r(t),new a(0))){var u=be(Array.isArray(e)?e:e.toArray()).sort(i),c=be(Array.isArray(t)?t:t.toArray()).sort(i);s=[];for(var l=0;l<u.length;l++)for(var f=0;f<c.length;f++)s.push([u[l],c[f]])}return Array.isArray(e)&&Array.isArray(t)?s:new o(s)}})}),dp="setDistinct",hp=j(dp,["typed","size","subset","compareNatural","Index","DenseMatrix"],e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(dp,{"Array | Matrix":function(e){var t;if(0===n(r(e),new a(0)))t=[];else{var s=be(Array.isArray(e)?e:e.toArray()).sort(i);(t=[]).push(s[0]);for(var u=1;u<s.length;u++)0!==i(s[u],s[u-1])&&t.push(s[u])}return Array.isArray(e)?t:new o(t)}})}),yp="setIsSubset",gp=j(yp,["typed","size","subset","compareNatural","Index"],e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a}=e;return t(yp,{"Array | Matrix, Array | Matrix":function(e,t){if(0===n(r(e),new a(0)))return!0;
1if(0===n(r(t),new a(0)))return!1;for(var o,s=Ae(be(Array.isArray(e)?e:e.toArray()).sort(i)),u=Ae(be(Array.isArray(t)?t:t.toArray()).sort(i)),c=0;c<s.length;c++){o=!1;for(var l=0;l<u.length;l++)if(0===i(s[c].value,u[l].value)&&s[c].identifier===u[l].identifier){o=!0;break}if(!1===o)return!1}return!0}})}),vp="setPowerset",xp=j(vp,["typed","size","subset","compareNatural","Index"],e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a}=e;return t(vp,{"Array | Matrix":function(e){if(0===n(r(e),new a(0)))return[];for(var t=be(Array.isArray(e)?e:e.toArray()).sort(i),s=[],u=0;u.toString(2).length<=t.length;)s.push(o(t,u.toString(2).split("").reverse())),u++;return function(e){for(var t=[],r=e.length-1;r>0;r--)for(var n=0;n<r;n++)e[n].length>e[n+1].length&&(t=e[n],e[n]=e[n+1],e[n+1]=t);return e}(s)}});function o(e,t){for(var r=[],n=0;n<t.length;n++)"1"===t[n]&&r.push(e[n]);return r}}),bp="sort",wp=j(bp,["typed","matrix","compare","compareNatural"],e=>{var{typed:t,matrix:r,compare:n,compareNatural:i}=e,a=n,o=(e,t)=>-n(e,t);return t(bp,{Array:function(e){return u(e),e.sort(a)},Matrix:function(e){return c(e),r(e.toArray().sort(a),e.storage())},"Array, function":function(e,t){return u(e),e.sort(t)},"Matrix, function":function(e,t){return c(e),r(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),r(e.toArray().sort(s(t)),e.storage())}});function s(e){if("asc"===e)return a;
1if("desc"===e)return o;if("natural"===e)return i;throw new Error('String "asc", "desc", or "natural" expected')}function u(e){if(1!==se(e).length)throw new Error("One dimensional array expected")}function c(e){if(1!==e.size().length)throw new Error("One dimensional matrix expected")}}),Np="index",Mp=j(Np,["typed","Index"],e=>{var{typed:t,Index:r}=e;return t(Np,{"...number | string | BigNumber | Range | Array | Matrix":function(e){var t=e.map(function(e){return(0,o.C4)(e)?e.toNumber():Array.isArray(e)||(0,o.OA)(e)?e.map(function(e){return(0,o.C4)(e)?e.toNumber():e}):e}),n=new r;return r.apply(n,t),n}})}),Sp=j("inv",["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],e=>{var{typed:t,matrix:r,divideScalar:n,addScalar:i,multiply:a,unaryMinus:s,det:u,identity:c,abs:l}=e;return t("inv",{"Array | Matrix":function(e){var t=(0,o.OA)(e)?e.size():se(e);switch(t.length){case 1:if(1===t[0])return(0,o.OA)(e)?r([n(1,e.valueOf()[0])]):[n(1,e[0])];throw new RangeError("Matrix must be square (size: "+z(t)+")");case 2:var i=t[0],a=t[1];if(i===a)return(0,o.OA)(e)?r(f(e.valueOf(),i,a),e.storage()):f(e,i,a);throw new RangeError("Matrix must be square (size: "+z(t)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+z(t)+")")}},any:function(e){return n(1,e)}});function f(e,t,r){var o,f,p,m,d;if(1===t){if(0===(m=e[0][0]))throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,m)]]}if(2===t){var h=u(e);if(0===h)throw Error("Cannot calculate inverse, determinant is zero");return[[n(e[1][1],h),n(s(e[0][1]),h)],[n(s(e[1][0]),h),n(e[0][0],h)]]}var y=e.concat();for(o=0;o<t;o++)y[o]=y[o].concat();for(var g=c(t).valueOf(),v=0;v<r;v++){var x=l(y[v][v]),b=v;for(o=v+1;o<t;)l(y[o][v])>x&&(x=l(y[o][v]),b=o),o++;if(0===x)throw Error("Cannot calculate inverse, determinant is zero");(o=b)!==v&&(d=y[v],y[v]=y[o],y[o]=d,d=g[v],g[v]=g[o],g[o]=d);var w=y[v],N=g[v];for(o=0;o<t;o++){var M=y[o],S=g[o];if(o!==v){if(0!==M[v]){for(p=n(s(M[v]),w[v]),f=v;f<r;f++)M[f]=i(M[f],a(p,w[f]));for(f=0;f<r;f++)S[f]=i(S[f],a(p,N[f]))}}else{for(p=w[v],f=v;f<r;f++)M[f]=n(M[f],p);for(f=0;f<r;f++)S[f]=n(S[f],p)}}}return g}}),Ep="pinv",Ap=j(Ep,["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],e=>{var{typed:t,matrix:r,inv:n,deepEqual:i,equal:a,dotDivide:s,dot:u,ctranspose:c,divideScalar:l,multiply:f,add:p,Complex:m}=e;return t(Ep,{"Array | Matrix":function(e){var t=(0,o.OA)(e)?e.size():se(e);switch(t.length){case 1:return y(e)?c(e):1===t[0]?n(e):s(c(e),u(e,e));case 2:if(y(e))return c(e);var i=t[0],a=t[1];if(i===a)try{return n(e)}catch(e){if(!(e instanceof Error&&e.message.match(/Cannot calculate inverse, determinant is zero/)))throw e}return(0,o.OA)(e)?r(d(e.valueOf(),i,a),e.storage()):d(e,i,a);default:throw new RangeError("Matrix must be two dimensional (size: "+z(t)+")")}},any:function(e){return a(e,0)?R(e):l(1,e)}});function d(e,t,r){var{C:i,F:a}=function(e,t,r){var n=function(e,t,r){for(var n=R(e),i=0,a=0;a<t;a++){if(r<=i)return n;for(var o=a;h(n[o][i]);)if(t===++o&&(o=a,r===++i))return n;[n[o],n[a]]=[n[a],n[o]];for(var u=n[a][i],c=0;c<r;c++)n[a][c]=s(n[a][c],u);for(var l=0;l<t;l++)if(l!==a){u=n[l][i];for(var m=0;m<r;m++)n[l][m]=p(n[l][m],f(-1,f(u,n[a][m])))}i++}return n}(e,t,r),i=e.map((e,r)=>e.filter((e,r)=>r<t&&!h(u(n[r],n[r])))),a=n.filter((e,t)=>!h(u(n[t],n[t])));return{C:i,F:a}}(e,t,r),o=f(n(f(c(i),i)),c(i)),l=f(c(a),n(f(a,c(a))));return f(l,o)}function h(e){return a(p(e,m(1,1)),p(0,m(1,1)))}function y(e){return i(p(e,m(1,1)),p(f(e,0),m(1,1)))}}),Op=j("pow",["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],e=>{var{typed:t,config:r,identity:n,multiply:i,matrix:a,inv:o,number:u,fraction:c,Complex:l}=e;return t("pow",{"number, number":f,"Complex, Complex":function(e,t){return e.pow(t)},"BigNumber, BigNumber":function(e,t){return t.isInteger()||e>=0||r.predictable?e.pow(t):new l(e.toNumber(),0).pow(t.toNumber(),0)},"Fraction, Fraction":function(e,t){var n=e.pow(t);if(null!=n)return n;if(r.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return f(e.valueOf(),t.valueOf())},"Array, number":p,"Array, BigNumber":function(e,t){return p(e,t.toNumber())},"Matrix, number":m,"Matrix, BigNumber":function(e,t){return m(e,t.toNumber())},"Unit, number | BigNumber":function(e,t){return e.pow(t)}});function f(e,t){if(r.predictable&&!s(t)&&e<0)try{var n=c(t),i=u(n);if((t===i||Math.abs((t-i)/t)<1e-14)&&n.d%2==1)return(n.n%2==0?1:-1)*Math.pow(-e,t)}catch(e){}return r.predictable&&(e<-1&&t===1/0||e>-1&&e<0&&t===-1/0)?NaN:s(t)||e>=0||r.predictable?oa(e,t):e*e<1&&t===1/0||e*e>1&&t===-1/0?0:new l(e,0).pow(t,0)}function p(e,t){if(!s(t))throw new TypeError("For A^b, b must be an integer (value is "+t+")");var r=se(e);if(2!==r.length)throw new Error("For A^b, A must be 2 dimensional (A has "+r.length+" dimensions)");if(r[0]!==r[1])throw new Error("For A^b, A must be square (size is "+r[0]+"x"+r[1]+")");if(t<0)try{return p(o(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}for(var a=n(r[0]).valueOf(),u=e;t>=1;)1&~t||(a=i(u,a)),t>>=1,u=i(u,u);return a}function m(e,t){return a(p(e.valueOf(),t))}}),Cp="setDifference",_p=j(Cp,["typed","size","subset","compareNatural","Index","DenseMatrix"],e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(Cp,{"Array | Matrix, Array | Matrix":function(e,t){var s;if(0===n(r(e),new a(0)))s=[];else{if(0===n(r(t),new a(0)))return be(e.toArray());var u,c=Ae(be(Array.isArray(e)?e:e.toArray()).sort(i)),l=Ae(be(Array.isArray(t)?t:t.toArray()).sort(i));s=[];for(var f=0;f<c.length;f++){u=!1;for(var p=0;p<l.length;p++)if(0===i(c[f].value,l[p].value)&&c[f].identifier===l[p].identifier){u=!0;break}u||s.push(c[f])}}return Array.isArray(e)&&Array.isArray(t)?Oe(s):new o(Oe(s))}})}),Tp="setMultiplicity",Bp=j(Tp,["typed","size","subset","compareNatural","Index"],e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a}=e;return t(Tp,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(e,t){if(0===n(r(t),new a(0)))return 0;for(var o=be(Array.isArray(t)?t:t.toArray()),s=0,u=0;u<o.length;u++)0===i(o[u],e)&&s++;return s}})}),zp=j("Spa",["addScalar","equalScalar","FibonacciHeap"],e=>{var{addScalar:t,equalScalar:r,FibonacciHeap:n}=e;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new n}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{var r=this._heap.insert(e,t);this._values[e]=r}},i.prototype.get=function(e){var t=this._values[e];return t?t.value:0},i.prototype.accumulate=function(e,r){var n=this._values[e];n?n.value=t(n.value,r):(n=this._heap.insert(e,r),this._values[e]=n)},i.prototype.forEach=function(e,t,n){var i=this._heap,a=this._values,o=[],s=i.extractMinimum();for(s&&o.push(s);s&&s.key<=t;)s.key>=e&&(r(s.value,0)||n(s.key,s.value,this)),(s=i.extractMinimum())&&o.push(s);for(var u=0;u<o.length;u++){var c=o[u];a[(s=i.insert(c.key,c.value)).key]=s}},i.prototype.swap=function(e,t){var r=this._values[e],n=this._values[t];if(!r&&n)r=this._heap.insert(e,n.value),this._heap.remove(n),this._values[e]=r,this._values[t]=void 0;else if(r&&!n)n=this._heap.insert(t,r.value),this._heap.remove(r),this._values[t]=n,this._values[e]=void 0;else if(r&&n){var i=r.value;
1r.value=n.value,n.value=i}},i},{isClass:!0}),qp="sqrtm",Dp=j(qp,["typed","abs","add","multiply","sqrt","subtract","inv","size","max","identity"],e=>{var{typed:t,abs:r,add:n,multiply:i,sqrt:a,subtract:s,inv:u,size:c,max:l,identity:f}=e,p=1e-6;function m(e){var t,a=0,o=e,m=f(c(e));do{var d=o;if(o=i(.5,n(d,u(m))),m=i(.5,n(m,u(d))),(t=l(r(s(o,d))))>p&&++a>1e3)throw new Error("computing square root of matrix: iterative method could not converge")}while(t>p);return o}return t(qp,{"Array | Matrix":function(e){var t=(0,o.OA)(e)?e.size():se(e);switch(t.length){case 1:if(1===t[0])return a(e);throw new RangeError("Matrix must be square (size: "+z(t)+")");case 2:if(t[0]===t[1])return m(e);throw new RangeError("Matrix must be square (size: "+z(t)+")");default:throw new RangeError("Matrix must be at most two dimensional (size: "+z(t)+")")}}})});function Ip(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function kp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ip(Object(r),!0).forEach(function(t){gt(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ip(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Rp=j("Unit",["?on","config","addScalar","subtract","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],e=>{var t,r,i,{on:a,config:s,addScalar:u,subtract:c,multiplyScalar:l,divideScalar:f,pow:p,abs:m,fix:d,round:h,equal:y,isNumeric:g,format:v,number:x,Complex:b,BigNumber:w,Fraction:N}=e,M=x;function S(e,t){if(!(this instanceof S))throw new Error("Constructor must be called with the new operator");if(null!=e&&!g(e)&&!(0,o.Zd)(e))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(void 0!==t&&("string"!=typeof t||""===t))throw new TypeError("Second parameter in Unit constructor must be a string");if(void 0!==t){var r=S.parse(t);this.units=r.units,this.dimensions=r.dimensions}else{this.units=[{unit:j,prefix:I.NONE,power:0}],this.dimensions=[];for(var n=0;n<k.length;n++)this.dimensions[n]=0}this.value=null!=e?this._normalize(e):null,this.fixPrefix=!1,this.skipAutomaticSimplification=!0}function E(){for(;" "===i||"\t"===i;)O()}function A(e){return e>="0"&&e<="9"}function O(){r++,i=t.charAt(r)}function C(e){r=e,i=t.charAt(r)}function _(){var e="",t=r;if("+"===i?O():"-"===i&&(e+=i,O()),!function(e){return e>="0"&&e<="9"||"."===e}(i))return C(t),null;if("."===i){if(e+=i,O(),!A(i))return C(t),null}else{for(;A(i);)e+=i,O();"."===i&&(e+=i,O())}for(;A(i);)e+=i,O();if("E"===i||"e"===i){var n="",a=r;if(n+=i,O(),"+"!==i&&"-"!==i||(n+=i,O()),!A(i))return C(a),e;for(e+=n;A(i);)e+=i,O()}return e}function T(){for(var e="";A(i)||S.isValidAlpha(i);)e+=i,O();var t=e.charAt(0);return S.isValidAlpha(t)?e:null}function z(e){return i===e?(O(),e):null}S.prototype.type="Unit",S.prototype.isUnit=!0,S.parse=function(e,n){if(n=n||{},r=-1,i="","string"!=typeof(t=e))throw new TypeError("Invalid argument in Unit.parse, string expected");var a=new S;a.units=[];var o=1,u=!1;O(),E();var c=_(),l=null;if(c){if("BigNumber"===s.number)l=new w(c);else if("Fraction"===s.number)try{l=new N(c)}catch(e){l=parseFloat(c)}else l=parseFloat(c);E(),z("*")?(o=1,u=!0):z("/")&&(o=-1,u=!0)}for(var f=[],p=1;;){for(E();"("===i;)f.push(o),p*=o,o=1,O(),E();var m;if(!i)break;var d=i;if(null===(m=T()))throw new SyntaxError('Unexpected "'+d+'" in "'+t+'" at index '+r.toString());var h=q(m);if(null===h)throw new SyntaxError('Unit "'+m+'" not found.');var y=o*p;if(E(),z("^")){E();var g=_();if(null===g)throw new SyntaxError('In "'+e+'", "^" must be followed by a floating-point number');y*=g}a.units.push({unit:h.unit,prefix:h.prefix,power:y});for(var v=0;v<k.length;v++)a.dimensions[v]+=(h.unit.dimensions[v]||0)*y;for(E();")"===i;){if(0===f.length)throw new SyntaxError('Unmatched ")" in "'+t+'" at index '+r.toString());p/=f.pop(),O(),E()}if(u=!1,z("*")?(o=1,u=!0):z("/")?(o=-1,u=!0):o=1,h.unit.base){var x=h.unit.base.ke
1y;G.auto[x]={unit:h.unit,prefix:h.prefix}}}if(E(),i)throw new SyntaxError('Could not parse: "'+e+'"');if(u)throw new SyntaxError('Trailing characters: "'+e+'"');if(0!==f.length)throw new SyntaxError('Unmatched "(" in "'+t+'"');if(0===a.units.length&&!n.allowNoUnits)throw new SyntaxError('"'+e+'" contains no units');return a.value=void 0!==l?a._normalize(l):null,a},S.prototype.clone=function(){var e=new S;e.fixPrefix=this.fixPrefix,e.skipAutomaticSimplification=this.skipAutomaticSimplification,e.value=R(this.value),e.dimensions=this.dimensions.slice(0),e.units=[];for(var t=0;t<this.units.length;t++)for(var r in e.units[t]={},this.units[t])F(this.units[t],r)&&(e.units[t][r]=this.units[t][r]);return e},S.prototype._isDerived=function(){return 0!==this.units.length&&(this.units.length>1||Math.abs(this.units[0].power-1)>1e-15)},S.prototype._normalize=function(e){if(null==e||0===this.units.length)return e;for(var t=e,r=S._getNumberConverter((0,o.QP)(e)),n=0;n<this.units.length;n++){var i=r(this.units[n].unit.value),a=r(this.units[n].prefix.value),s=r(this.units[n].power);t=l(t,p(l(i,a),s))}return t},S.prototype._denormalize=function(e,t){if(null==e||0===this.units.length)return e;for(var r=e,n=S._getNumberConverter((0,o.QP)(e)),i=0;i<this.units.length;i++){var a=n(this.units[i].unit.value),s=n(this.units[i].prefix.value),u=n(this.units[i].power);r=f(r,p(l(a,s),u))}return r};var q=Wt(e=>{if(F(L,e)){var t=L[e];return{unit:t,prefix:t.prefixes[""]}}for(var r in L)if(F(L,r)&&B(e,r)){var n=L[r],i=e.length-r.length,a=e.substring(0,i),o=F(n.prefixes,a)?n.prefixes[a]:void 0;if(void 0!==o)return{unit:n,prefix:o}}return null},{hasher:e=>e[0],limit:100});function D(e){return e.equalBase(U.NONE)&&null!==e.value&&!s.predictable?e.value:e}S.isValuelessUnit=function(e){return null!==q(e)},S.prototype.hasBase=function(e){if("string"==typeof e&&(e=U[e]),!e)return!1;for(var t=0;t<k.length;t++)if(Math.abs((this.dimensions[t]||0)-(e.dimensions[t]||0))>1e-12)return!1;return!0},S.prototype.equalBase=function(e){for(var t=0;t<k.length;t++)if(Math.abs((this.dimensions[t]||0)-(e.dimensions[t]||0))>1e-12)return!1;return!0},S.prototype.equals=function(e){return this.equalBase(e)&&y(this.value,e.value)},S.prototype.multiply=function(e){for(var t=this.clone(),r=0;r<k.length;r++)t.dimensions[r]=(this.dimensions[r]||0)+(e.dimensions[r]||0);for(var n=0;n<e.units.length;n++){var i=kp({},e.units[n]);t.units.push(i)}if(null!==this.value||null!==e.value){var a=null===this.value?this._normalize(1):this.value,o=null===e.value?e._normalize(1):e.value;t.value=l(a,o)}else t.value=null;return t.skipAutomaticSimplification=!1,D(t)},S.prototype.divide=function(e){for(var t=this.clone(),r=0;r<k.length;r++)t.dimensions[r]=(this.dimensions[r]||0)-(e.dimensions[r]||0);for(var n=0;n<e.units.length;n++){var i=kp(kp({},e.units[n]),{},{power:-e.units[n].power});t.units.push(i)}if(null!==this.value||null!==e.value){var a=null===this.value?this._normalize(1):this.value,o=null===e.value?e._normalize(1):e.value;t.value=f(a,o)}else t.value=null;return t.skipAutomaticSimplification=!1,D(t)},S.prototype.pow=function(e){for(var t=this.clone(),r=0;r<k.length;r++)t.dimensions[r]=(this.dimensions[r]||0)*e;for(var n=0;n<t.units.length;n++)t.units[n].power*=e;return null!==t.value?t.value=p(t.value,e):t.value=null,t.skipAutomaticSimplification=!1,D(t)},S.prototype.abs=function(){var e=this.clone();if(null!==e.value)if(e._isDerived()||0===e.units[0].unit.offset)e.value=m(e.value);else{var t=S._getNumberConverter((0,o.QP)(e.value)),r=t(e.units[0].unit.value),n=t(e.units[0].unit.offset),i=l(r,n);e.value=c(m(u(e.value,i)),i)}for(var a in e.units)"VA"!==e.units[a].unit.name&&"VAR"!==e.units[a].unit.name||(e.units[a].unit=L.W);return e},S.prototype.to=function(e){var t,r=null===this.value?this._normalize(1):this.value;if("string"==typeof e)t=S.parse(e);else{if(!(0,o.vO)(e))throw new Error("String or Unit expected as parameter");t=e.clone()}if(!this.equalBase(t))throw new Error("Units do not match ('".concat(t.toString(),"' != '").concat(this.toString(),"')"));if(null!==t.value)throw new Error("Cannot convert to a unit with a value");if(null===this.value||this._isDerived()||this.units[0].unit.offset===t.units[0].unit.offset)t.value=R(r);else{var n=S._getNumberConverter((0,o.QP)(r)),i=n(this.units[0].unit.value),a=n(this.units[0].unit.offset),s=l(i,a),f=n(t.units[0].unit.value),p=n(t.units[0].unit.offset),m=l(f,p);t.value=c(u(r,s),m)}return t.fixPrefix=!0,t.skipAutomaticSimplification=!0,t},S.prototype.toNumber=function(e){return M(this.toNumeric(e))},S.prototype.toNumeric=function(e){var t;return(t=e?this.to(e):this.clone())._isDerived()||0===t.units.length?t._denormalize(t.value):t._denormalize(t.value,t.units[0].prefix.value)},S.prototype.toString=function(){return this.format()},S.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.formatUnits(),fixPrefix:this.fixPrefix}},S.fromJSON=function(e){var t=new S(e.value,e.unit);return t.fixPrefix=e.fixPrefix||!1,t},S.prototype.valueOf=S.prototype.toString,S.prototype.simplify=function(){var e,t,r=this.clone(),n=[];for(var i in V)if(F(V,i)&&r.hasBase(U[i])){e=i;break}if("NONE"===e)r.units=[];else if(e&&F(V,e)&&(t=V[e]),t)r.units=[{unit:t.unit,prefix:t.prefix,power:1}];else{for(var a=!1,o=0;o<k.length;o++){var s=k[o];Math.abs(r.dimensions[o]||0)>1e-12&&(F(V,s)?n.push({unit:V[s].unit,prefix:V[s].prefix,power:r.dimensions[o]||0}):a=!0)}n.length<r.units.length&&!a&&(r.units=n)}return r},S.prototype.toSI=function(){for(var e=this.clone(),t=[],r=0;r<k.length;r++){var n=k[r];if(Math.abs(e.dimensions[r]||0)>1e-12){if(!F(G.si,n))throw new Error("Cannot express custom unit "+n+" in SI units");t.push({unit:G.si[n].unit,prefix:G.si[n].prefix,power:e.dimensions[r]||0})}}return e.units=t,e.fixPrefix=!0,e.skipAutomaticSimplification=!0,e},S.prototype.formatUnits=function(){for(var e="",t="",r=0,n=0,i=0;i<this.units.length;i++)this.units[i].power>0?(r++,e+=" "+this.units[i].prefix.name+this.units[i].unit.name,Math.abs(this.units[i].power-1)>1e-15&&(e+="^"+this.units[i].power)):this.units[i].power<0&&n++;if(n>0)for(var a=0;a<this.units.length;a++)this.units[a].power<0&&(r>0?(t+=" "+this.units[a].prefix.name+this.units[a].unit.name,Math.abs(this.units[a].power+1)>1e-15&&(t+="^"+-this.units[a].power)):(t+=" "+this.units[a].prefix.name+this.units[a].unit.name,t+="^"+this.units[a].power));e=e.substr(1),t=t.substr(1),r>1&&n>0&&(e="("+e+")"),n>1&&r>0&&(t="("+t+")");var o=e;return r>0&&n>0&&(o+=" / "),o+t},S.prototype.format=function(e){var t=this.skipAutomaticSimplification||null===this.value?this.clone():this.simplify(),r=!1;for(var n in void 0!==t.value&&null!==t.value&&(0,o.Zd)(t.value)&&(r=Math.abs(t.value.re)<1e-14),t.units)F(t.units,n)&&t.units[n].unit&&("VA"===t.units[n].unit.name&&r?t.units[n].unit=L.VAR:"VAR"!==t.units[n].unit.name||r||(t.units[n].unit=L.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());var i=t._denormalize(t.value),a=null!==t.value?v(i,e||{}):"",s=t.formatUnits();return t.value&&(0,o.Zd)(t.value)&&(a="("+a+")"),s.length>0&&a.length>0&&(a+=" "),a+s},S.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!");var e=null!==this.value?m(this.value):0,t=m(this.units[0].unit.value),r=this.units[0].prefix;if(0===e)return r;var n=this.units[0].power,i=Math.log(e/Math.pow(r.value*t,n))/Math.LN10-1.2;if(i>-2.200001&&i<1.800001)return r;i=Math.abs(i);var a=this.units[0].unit.prefixes;for(var o in a)if(F(a,o)){var s=a[o];if(s.scientific){var u=Math.abs(Math.log(e/Math.pow(s.value*t,n))/Math.LN10-1.2);(u<i||u===i&&s.name.length<r.name.length)&&(r=s,i=u)}}return r},S.prototype.splitUnit=function(e){for(var t=this.clone(),r=[],n=0;n<e.length&&(t=t.to(e[n]),n!==e.length-1);n++){var i=t.toNumeric(),a=h(i),o=new S(y(a,i)?a:d(t.toNumeric()),e[n].toString());r.push(o),t=c(t,o)}for(var s=0,l=0;l<r.length;l++)s=u(s,r[l].value);return y(s,this.value)&&(t.value=0),r.push(t),r};var I={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!1},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0}}
1,LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};I.SHORTLONG=n({},I.SHORT,I.LONG),I.BINARY_SHORT=n({},I.BINARY_SHORT_SI,I.BINARY_SHORT_IEC),I.BINARY_LONG=n({},I.BINARY_LONG_SI,I.BINARY_LONG_IEC);var k=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],U={
1NONE:{dimensions:[0,0,0,0,0,0,0,0,0]},MASS:{dimensions:[1,0,0,0,0,0,0,0,0]},LENGTH:{dimensions:[0,1,0,0,0,0,0,0,0]},TIME:{dimensions:[0,0,1,0,0,0,0,0,0]},CURRENT:{dimensions:[0,0,0,1,0,0,0,0,0]},TEMPERATURE:{dimensions:[0,0,0,0,1,0,0,0,0]},LUMINOUS_INTENSITY:{dimensions:[0,0,0,0,0,1,0,0,0]},AMOUNT_OF_SUBSTANCE:{dimensions:[0,0,0,0,0,0,1,0,0]},FORCE:{dimensions:[1,1,-2,0,0,0,0,0,0]},SURFACE:{dimensions:[0,2,0,0,0,0,0,0,0]},VOLUME:{dimensions:[0,3,0,0,0,0,0,0,0]},ENERGY:{dimensions:[1,2,-2,0,0,0,0,0,0]},POWER:{dimensions:[1,2,-3,0,0,0,0,0,0]},PRESSURE:{dimensions:[1,-1,-2,0,0,0,0,0,0]},ELECTRIC_CHARGE:{dimensions:[0,0,1,1,0,0,0,0,0]},ELECTRIC_CAPACITANCE:{dimensions:[-1,-2,4,2,0,0,0,0,0]},ELECTRIC_POTENTIAL:{dimensions:[1,2,-3,-1,0,0,0,0,0]},ELECTRIC_RESISTANCE:{dimensions:[1,2,-3,-2,0,0,0,0,0]},ELECTRIC_INDUCTANCE:{dimensions:[1,2,-2,-2,0,0,0,0,0]},ELECTRIC_CONDUCTANCE:{dimensions:[-1,-2,3,2,0,0,0,0,0]},MAGNETIC_FLUX:{dimensions:[1,2,-2,-1,0,0,0,0,0]},MAGNETIC_FLUX_DENSITY:{dimensions:[1,0,-2,-1,0,0,0,0,0]},FREQUENCY:{dimensions:[0,0,-1,0,0,0,0,0,0]},ANGLE:{dimensions:[0,0,0,0,0,0,0,1,0]},BIT:{dimensions:[0,0,0,0,0,0,0,0,1]}};for(var P in U)F(U,P)&&(U[P].key=P);var j={name:"",base:{},value:1,offset:0,dimensions:k.map(e=>0)},L={meter:{name:"meter",base:U.LENGTH,prefixes:I.LONG,value:1,offset:0},inch:{name:"inch",base:U.LENGTH,prefixes:I.NONE,value:.0254,offset:0},foot:{name:"foot",base:U.LENGTH,prefixes:I.NONE,value:.3048,offset:0},yard:{name:"yard",base:U.LENGTH,prefixes:I.NONE,value:.9144,offset:0},mile:{name:"mile",base:U.LENGTH,prefixes:I.NONE,value:1609.344,offset:0},link:{name:"link",base:U.LENGTH,prefixes:I.NONE,value:.201168,offset:0},rod:{name:"rod",base:U.LENGTH,prefixes:I.NONE,value:5.0292,offset:0},chain:{name:"chain",base:U.LENGTH,prefixes:I.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:U.LENGTH,prefixes:I.NONE,value:1e-10,offset:0},m:{name:"m",base:U.LENGTH,prefixes:I.SHORT,value:1,offset:0},in:{name:"in",base:U.LENGTH,prefixes:I.NONE,value:.0254,offset:0},ft:{name:"ft",base:U.LENGTH,prefixes:I.NONE,value:.3048,offset:0},yd:{name:"yd",base:U.LENGTH,prefixes:I.NONE,value:.9144,offset:0}
1,mi:{name:"mi",base:U.LENGTH,prefixes:I.NONE,value:1609.344,offset:0},li:{name:"li",base:U.LENGTH,prefixes:I.NONE,value:.201168,offset:0},rd:{name:"rd",base:U.LENGTH,prefixes:I.NONE,value:5.02921,offset:0},ch:{name:"ch",base:U.LENGTH,prefixes:I.NONE,value:20.1168,offset:0},mil:{name:"mil",base:U.LENGTH,prefixes:I.NONE,value:254e-7,offset:0},m2:{name:"m2",base:U.SURFACE,prefixes:I.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:U.SURFACE,prefixes:I.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:U.SURFACE,prefixes:I.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:U.SURFACE,prefixes:I.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:U.SURFACE,prefixes:I.NONE,value:2589988.110336,offset:0},sqrd:{name:"sqrd",base:U.SURFACE,prefixes:I.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:U.SURFACE,prefixes:I.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:U.SURFACE,prefixes:I.NONE,value:6.4516e-10,offset:0},acre:{name:"acre",base:U.SURFACE,prefixes:I.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:U.SURFACE,prefixes:I.NONE,value:1e4,offset:0},m3:{name:"m3",base:U.VOLUME,prefixes:I.CUBIC,value:1,offset:0},L:{name:"L",base:U.VOLUME,prefixes:I.SHORT,value:.001,offset:0},l:{name:"l",base:U.VOLUME,prefixes:I.SHORT,value:.001,offset:0},litre:{name:"litre",base:U.VOLUME,prefixes:I.LONG,value:.001,offset:0},cuin:{name:"cuin",base:U.VOLUME,prefixes:I.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:U.VOLUME,prefixes:I.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:U.VOLUME,prefixes:I.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:U.VOLUME,prefixes:I.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:U.VOLUME,prefixes:I.NONE,value:15e-6,offset:0},drop:{name:"drop",base:U.VOLUME,prefixes:I.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:U.VOLUME,prefixes:I.NONE,value:5e-8,offset:0},minim:{name:"minim",base:U.VOLUME,prefixes:I.NONE,value:6.161152e-8,offset:0},fluiddram:{name:"fluiddram",base:U.VOLUME,prefixes:I.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:U.VOLUME,prefixes:I.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:U.VOLUME,prefixes:I.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:U.VOLUME,prefixes:I.NONE,value:1e-6,offset:0},cup:{name:"cup",base:U.VOLUME,prefixes:I.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:U.VOLUME,prefixes:I.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:U.VOLUME,prefixes:I.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:U.VOLUME,prefixes:I.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:U.VOLUME,prefixes:I.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:U.VOLUME,prefixes:I.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:U.VOLUME,prefixes:I.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:U.VOLUME,prefixes:I.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:U.VOLUME,prefixes:I.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:U.VOLUME,prefixes:I.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:U.VOLUME,prefixes:I.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:U.VOLUME,prefixes:I.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:U.VOLUME,prefixes:I.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:U.VOLUME,prefixes:I.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:U.VOLUME,prefixes:I.NONE,value:.1173478,offset:0},obl:{name:"obl",base:U.VOLUME,prefixes:I.NONE,value:.1589873,offset:0},g:{name:"g",base:U.MASS,prefixes:I.SHORT,value:.001,offset:0},gram:{name:"gram",base:U.MASS,prefixes:I.LONG,value:.001,offset:0},ton:{name:"ton",base:U.MASS,prefixes:I.SHORT,value:907.18474,offset:0},t:{name:"t",base:U.MASS,prefixes:I.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:U.MASS,prefixes:I.LONG,value:1e3,offset:0},grain:{name:"grain",base:U.MASS,prefixes:I.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:U.MASS,prefixes:I.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:U.MASS,prefixes:I.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:U.MASS,prefixes:I.NONE,value:.45359237,offset:0}
1,hundredweight:{name:"hundredweight",base:U.MASS,prefixes:I.NONE,value:45.359237,offset:0},stick:{name:"stick",base:U.MASS,prefixes:I.NONE,value:.115,offset:0},stone:{name:"stone",base:U.MASS,prefixes:I.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:U.MASS,prefixes:I.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:U.MASS,prefixes:I.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:U.MASS,prefixes:I.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:U.MASS,prefixes:I.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:U.MASS,prefixes:I.NONE,value:45.359237,offset:0},s:{name:"s",base:U.TIME,prefixes:I.SHORT,value:1,offset:0},min:{name:"min",base:U.TIME,prefixes:I.NONE,value:60,offset:0},h:{name:"h",base:U.TIME,prefixes:I.NONE,value:3600,offset:0},second:{name:"second",base:U.TIME,prefixes:I.LONG,value:1,offset:0},sec:{name:"sec",base:U.TIME,prefixes:I.LONG,value:1,offset:0},minute:{name:"minute",base:U.TIME,prefixes:I.NONE,value:60,offset:0},hour:{name:"hour",base:U.TIME,prefixes:I.NONE,value:3600,offset:0},day:{name:"day",base:U.TIME,prefixes:I.NONE,value:86400,offset:0},week:{name:"week",base:U.TIME,prefixes:I.NONE,value:604800,offset:0},month:{name:"month",base:U.TIME,prefixes:I.NONE,value:2629800,offset:0},year:{name:"year",base:U.TIME,prefixes:I.NONE,value:31557600,offset:0},decade:{name:"decade",base:U.TIME,prefixes:I.NONE,value:315576e3,offset:0},century:{name:"century",base:U.TIME,prefixes:I.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:U.TIME,prefixes:I.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:U.FREQUENCY,prefixes:I.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:U.FREQUENCY,prefixes:I.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:U.ANGLE,prefixes:I.SHORT,value:1,offset:0},radian:{name:"radian",base:U.ANGLE,prefixes:I.LONG,value:1,offset:0},deg:{name:"deg",base:U.ANGLE,prefixes:I.SHORT,value:null,offset:0},degree:{name:"degree",base:U.ANGLE,prefixes:I.LONG,value:null,offset:0},grad:{name:"grad",base:U.ANGLE,prefixes:I.SHORT,value:null,offset:0},gradian:{name:"gradian",base:U.ANGLE,prefixes:I.LONG,value:null,offset:0},cycle:{name:"cycle",base:U.ANGLE,prefixes:I.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:U.ANGLE,prefixes:I.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:U.ANGLE,prefixes:I.NONE,value:null,offset:0},A:{name:"A",base:U.CURRENT,prefixes:I.SHORT,value:1,offset:0},ampere:{name:"ampere",base:U.CURRENT,prefixes:I.LONG,value:1,offset:0}
1,K:{name:"K",base:U.TEMPERATURE,prefixes:I.NONE,value:1,offset:0},degC:{name:"degC",base:U.TEMPERATURE,prefixes:I.NONE,value:1,offset:273.15},degF:{name:"degF",base:U.TEMPERATURE,prefixes:I.NONE,value:1/1.8,offset:459.67},degR:{name:"degR",base:U.TEMPERATURE,prefixes:I.NONE,value:1/1.8,offset:0},kelvin:{name:"kelvin",base:U.TEMPERATURE,prefixes:I.NONE,value:1,offset:0},celsius:{name:"celsius",base:U.TEMPERATURE,prefixes:I.NONE,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:U.TEMPERATURE,prefixes:I.NONE,value:1/1.8,offset:459.67},rankine:{name:"rankine",base:U.TEMPERATURE,prefixes:I.NONE,value:1/1.8,offset:0},mol:{name:"mol",base:U.AMOUNT_OF_SUBSTANCE,prefixes:I.SHORT,value:1,offset:0},mole:{name:"mole",base:U.AMOUNT_OF_SUBSTANCE,prefixes:I.LONG,value:1,offset:0},cd:{name:"cd",base:U.LUMINOUS_INTENSITY,prefixes:I.SHORT,value:1,offset:0},candela:{name:"candela",base:U.LUMINOUS_INTENSITY,prefixes:I.LONG,value:1,offset:0},N:{name:"N",base:U.FORCE,prefixes:I.SHORT,value:1,offset:0},newton:{name:"newton",base:U.FORCE,prefixes:I.LONG,value:1,offset:0},dyn:{name:"dyn",base:U.FORCE,prefixes:I.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:U.FORCE,prefixes:I.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:U.FORCE,prefixes:I.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:U.FORCE,prefixes:I.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:U.FORCE,prefixes:I.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:U.FORCE,prefixes:I.NONE,value:9.80665,offset:0},J:{name:"J",base:U.ENERGY,prefixes:I.SHORT,value:1,offset:0},joule:{name:"joule",base:U.ENERGY,prefixes:I.SHORT,value:1,offset:0},erg:{name:"erg",base:U.ENERGY,prefixes:I.NONE,value:1e-7,offset:0},Wh:{name:"Wh",base:U.ENERGY,prefixes:I.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:U.ENERGY,prefixes:I.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:U.ENERGY,prefixes:I.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:U.ENERGY,prefixes:I.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:U.POWER,prefixes:I.SHORT,value:1,offset:0},watt:{name:"watt",base:U.POWER,prefixes:I.LONG,value:1,offset:0},hp:{name:"hp",base:U.POWER,prefixes:I.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:U.POWER,prefixes:I.SHORT,value:b.I,offset:0},VA:{name:"VA",base:U.POWER,prefixes:I.SHORT,value:1,offset:0},Pa:{name:"Pa",base:U.PRESSURE,prefixes:I.SHORT,value:1,offset:0},psi:{name:"psi",base:U.PRESSURE,prefixes:I.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:U.PRESSURE,prefixes:I.NONE,value:101325,offset:0},bar:{name:"bar",base:U.PRESSURE,prefixes:I.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:U.PRESSURE,prefixes:I.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:U.PRESSURE,prefixes:I.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:U.PRESSURE,prefixes:I.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:U.PRESSURE,prefixes:I.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:U.ELECTRIC_CHARGE,prefixes:I.LONG,value:1,offset:0},C:{name:"C",base:U.ELECTRIC_CHARGE,prefixes:I.SHORT,value:1,offset:0},farad:{name:"farad",base:U.ELECTRIC_CAPACITANCE,prefixes:I.LONG,value:1,offset:0},F:{name:"F",base:U.ELECTRIC_CAPACITANCE,prefixes:I.SHORT,value:1,offset:0},volt:{name:"volt",base:U.ELECTRIC_POTENTIAL,prefixes:I.LONG,value:1,offset:0},V:{name:"V",base:U.ELECTRIC_POTENTIAL,prefixes:I.SHORT,value:1,offset:0},ohm:{name:"ohm",base:U.ELECTRIC_RESISTANCE,prefixes:I.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:U.ELECTRIC_INDUCTANCE,prefixes:I.LONG,value:1,offset:0},H:{name:"H",base:U.ELECTRIC_INDUCTANCE,prefixes:I.SHORT,value:1,offset:0},siemens:{name:"siemens",base:U.ELECTRIC_CONDUCTANCE,prefixes:I.LONG,value:1,offset:0},S:{name:"S",base:U.ELECTRIC_CONDUCTANCE,prefixes:I.SHORT,value:1,offset:0},weber:{name:"weber",base:U.MAGNETIC_FLUX,prefixes:I.LONG,value:1,offset:0},Wb:{name:"Wb",base:U.MAGNETIC_FLUX,prefixes:I.SHORT,value:1,offset:0},tesla:{name:"tesla",base:U.MAGNETIC_FLUX_DENSITY,prefixes:I.LONG,value:1,offset:0},T:{name:"T",base:U.MAGNETIC_FLUX_DENSITY,prefixes:I.SHORT,value:1,offset:0},b:{name:"b",base:U.BIT,prefixes:I.BINARY_SHORT,value:1,offset:0}
1,bits:{name:"bits",base:U.BIT,prefixes:I.BINARY_LONG,value:1,offset:0},B:{name:"B",base:U.BIT,prefixes:I.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:U.BIT,prefixes:I.BINARY_LONG,value:8,offset:0}},$={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",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",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",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function H(e){if("BigNumber"===e.number){var t=an(w);L.rad.value=new w(1),L.deg.value=t.div(180),L.grad.value=t.div(200),L.cycle.value=t.times(2),L.arcsec.value=t.div(648e3),L.arcmin.value=t.div(10800)}else L.rad.value=1,L.deg.value=Math.PI/180,L.grad.value=Math.PI/200,L.cycle.value=2*Math.PI,L.arcsec.value=Math.PI/648e3,L.arcmin.value=Math.PI/10800;L.radian.value=L.rad.value,L.degree.value=L.deg.value,L.gradian.value=L.grad.value}H(s),a&&a("config",function(e,t){e.number!==t.number&&H(e)});var G={si:{NONE:{unit:j,prefix:I.NONE[""]},LENGTH:{unit:L.m,prefix:I.SHORT[""]},MASS:{unit:L.g,prefix:I.SHORT.k},TIME:{unit:L.s,prefix:I.SHORT[""]},CURRENT:{unit:L.A,prefix:I.SHORT[""]},TEMPERATURE:{unit:L.K,prefix:I.SHORT[""]},LUMINOUS_INTENSITY:{unit:L.cd,prefix:I.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:L.mol,prefix:I.SHORT[""]},ANGLE:{unit:L.rad,prefix:I.SHORT[""]},BIT:{unit:L.bits,prefix:I.SHORT[""]},FORCE:{unit:L.N,prefix:I.SHORT[""]},ENERGY:{unit:L.J,prefix:I.SHORT[""]},POWER:{unit:L.W,prefix:I.SHORT[""]},PRESSURE:{unit:L.Pa,prefix:I.SHORT[""]},ELECTRIC_CHARGE:{unit:L.C,prefix:I.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:L.F,prefix:I.SHORT[""]},ELECTRIC_POTENTIAL:{unit:L.V,prefix:I.SHORT[""]},ELECTRIC_RESISTANCE:{unit:L.ohm,prefix:I.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:L.H,prefix:I.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:L.S,prefix:I.SHORT[""]},MAGNETIC_FLUX:{unit:L.Wb,prefix:I.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:L.T,prefix:I.SHORT[""]},FREQUENCY:{unit:L.Hz,prefix:I.SHORT[""]}}};G.cgs=JSON.parse(JSON.stringify(G.si)),G.cgs.LENGTH={unit:L.m,prefix:I.SHORT.c},G.cgs.MASS={unit:L.g,prefix:I.SHORT[""]},G.cgs.FORCE={unit:L.dyn,prefix:I.SHORT[""]},G.cgs.ENERGY={unit:L.erg,prefix:I.NONE[""]},G.us=JSON.parse(JSON.stringify(G.si)),G.us.LENGTH={unit:L.ft,prefix:I.NONE[""]},G.us.MASS={unit:L.lbm,prefix:I.NONE[""]},G.us.TEMPERATURE={unit:L.degF,prefix:I.NONE[""]},G.us.FORCE={unit:L.lbf,prefix:I.NONE[""]},G.us.ENERGY={unit:L.BTU,prefix:I.BTU[""]},G.us.POWER={unit:L.hp,prefix:I.NONE[""]},G.us.PRESSURE={unit:L.psi,prefix:I.NONE[""]},G.auto=JSON.parse(JSON.stringify(G.si));var V=G.auto;for(var Z in S.setUnitSystem=function(e){if(!F(G,e))throw new Error("Unit system "+e+" does not exist. Choices are: "+Object.keys(G).join(", "));V=G[e]},S.getUnitSystem=function(){for(var e in G)if(F(G,e)&&G[e]===V)return e},S.typeConverters={BigNumber:function(e){return new w(e+"")},Fraction:function(e){return new N(e)},Complex:function(e){return e},number:function(e){return e}},S._getNumberConverter=function(e){if(!S.typeConverters[e])throw new TypeError('Unsupported type "'+e+'"');return S.typeConverters[e]},L)if(F(L,Z)){var W=L[Z];W.dimensions=W.base.dimensions}for(var J in $)if(F($,J)){var Y=L[$[J]],Q={};for(var X in Y)F(Y,X)&&(Q[X]=Y[X]);Q.name=J,L[J]=Q}return S.isValidAlpha=function(e){return/^[a-zA-Z]$/.test(e)},S.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(var r in e)if(F(e,r)&&S.deleteUnit(r),e[r].aliases)for(var n=0;n<e[r].aliases.length;n++)S.deleteUnit(e[r].aliases[n]);var i;for(var a in e)F(e,a)&&(i=S.createUnitSingle(a,e[a]));return i},S.createUnitSingle=function(e,t,r){if(null==t&&(t={}),"string"!=typeof e)throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(F(L,e))throw new Error('Cannot create unit "'+e+'": a unit with that name already exists');!function(e){for(var t=0;t<e.length;t++){if(i=e.charAt(t),0===t&&!S.isValidAlpha(i))throw new Error('Invalid unit name (must begin with alpha character): "'+e+'"');if(t>0&&!S.isValidAlpha(i)&&!A(i))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+e+'"')}}(e);var n,a,o,s=null,u=[],c=0;if(t&&"Unit"===t.type)s=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,a=t.prefixes,c=t.offset,o=t.baseName,t.aliases&&(u=t.aliases.valueOf())}if(u)for(var l=0;l<u.length;l++)if(F(L,u[l]))throw new Error('Cannot create alias "'+u[l]+'": a unit with that name already exists');if(n&&"string"==typeof n&&!s)try{s=S.parse(n,{allowNoUnits:!0})}catch(t){throw t.message='Could not create unit "'+e+'" from "'+n+'": '+t.message,t}else n&&"Unit"===n.type&&(s=n.clone());u=u||[],c=c||0,a=a&&a.toUpperCase&&I[a.toUpperCase()]||I.NONE;var f={};if(s){f={name:e,value:s.value,dimensions:s.dimensions.slice(0),prefixes:a,offset:c};var p=!1;for(var m in U)if(F(U,m)){for(var d=!0,h=0;h<k.length;h++)if(Math.abs((f.dimensions[h]||0)-(U[m].dimensions[h]||0))>1e-12){d=!1;break}if(d){p=!0,f.base=U[m];break}}if(!p){o=o||e+"_STUFF";var y={dimensions:s.dimensions.slice(0)};y.key=o,U[o]=y,V[o]={unit:f,prefix:I.NONE[""]}
1,f.base=U[o]}}else{if(o=o||e+"_STUFF",k.indexOf(o)>=0)throw new Error('Cannot create new base unit "'+e+'": a base unit with that name already exists (and cannot be overridden)');for(var g in k.push(o),U)F(U,g)&&(U[g].dimensions[k.length-1]=0);for(var v={dimensions:[]},x=0;x<k.length;x++)v.dimensions[x]=0;v.dimensions[k.length-1]=1,v.key=o,U[o]=v,f={name:e,value:1,dimensions:U[o].dimensions.slice(0),prefixes:a,offset:c,base:U[o]},V[o]={unit:f,prefix:I.NONE[""]}}S.UNITS[e]=f;for(var b=0;b<u.length;b++){var w=u[b],N={};for(var M in f)F(f,M)&&(N[M]=f[M]);N.name=w,S.UNITS[w]=N}return delete q.cache,new S(null,e)},S.deleteUnit=function(e){delete S.UNITS[e]},S.PREFIXES=I,S.BASE_DIMENSIONS=k,S.BASE_UNITS=U,S.UNIT_SYSTEMS=G,S.UNITS=L,S},{isClass:!0}),Up="createUnit",Pp=j(Up,["typed","Unit"],e=>{var{typed:t,Unit:r}=e;return t(Up,{"Object, Object":function(e,t){return r.createUnit(e,t)},Object:function(e){return r.createUnit(e,{})},"string, Unit | string | Object, Object":function(e,t,n){var i={};return i[e]=t,r.createUnit(i,n)},"string, Unit | string | Object":function(e,t){var n={};return n[e]=t,r.createUnit(n,{})},string:function(e){var t={};return t[e]={},r.createUnit(t,{})}})}),Fp="dotPow",jp=j(Fp,["typed","equalScalar","matrix","pow","DenseMatrix"],e=>{var{typed:t,equalScalar:r,matrix:n,pow:i,DenseMatrix:a}=e,o=Gu({typed:t}),s=lc({typed:t,DenseMatrix:a}),u=Zu({typed:t,equalScalar:r}),c=Wu({typed:t,DenseMatrix:a}),l=Ju({typed:t}),f=Yu({typed:t});return t(Fp,{"any, any":i,"SparseMatrix, SparseMatrix":function(e,t){return s(e,t,i,!1)},"SparseMatrix, DenseMatrix":function(e,t){return o(t,e,i,!0)},"DenseMatrix, SparseMatrix":function(e,t){return o(e,t,i,!1)},"DenseMatrix, DenseMatrix":function(e,t){return l(e,t,i)},"Array, Array":function(e,t){return this(n(e),n(t)).valueOf()},"Array, Matrix":function(e,t){return this(n(e),t)},"Matrix, Array":function(e,t){return this(e,n(t))},"SparseMatrix, any":function(e,t){return u(e,t,this,!1)},"DenseMatrix, any":function(e,t){return f(e,t,this,!1)},"any, SparseMatrix":function(e,t){return c(t,e,this,!0)},"any, DenseMatrix":function(e,t){return f(t,e,this,!0)},"Array, any":function(e,t){return f(n(e),t,this,!1).valueOf()},"any, Array":function(e,t){return f(n(t),e,this,!0).valueOf()}})}),Lp="expm",$p=j(Lp,["typed","abs","add","identity","inv","multiply"],e=>{var{typed:t,abs:r,add:n,identity:i,inv:a,multiply:s}=e;return t(Lp,{Matrix:function(e){var t=e.size();if(2!==t.length||t[0]!==t[1])throw new RangeError("Matrix must be square (size: "+z(t)+")");for(var c=t[0],l=function(e){for(var t=e.size()[0],n=0,i=0;i<t;i++){for(var a=0,o=0;o<t;o++)a+=r(e.get([i,o]));n=Math.max(a,n)}return n}(e),f=function(e){for(var t=0;t<30;t++)for(var r=0;r<=t;r++){var n=t-r;if(u(e,r,n)<1e-15)return{q:r,j:n}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}(l),p=f.q,m=f.j,d=s(e,Math.pow(2,-m)),h=i(c),y=i(c),g=1,v=d,x=-1,b=1;b<=p;b++)b>1&&(v=s(v,d),x=-x),h=n(h,s(g=g*(p-b+1)/((2*p-b+1)*b),v)),y=n(y,s(g*x,v));for(var w=s(a(y),h),N=0;N<m;N++)w=s(w,w);return(0,o.AF)(e)?e.createSparseMatrix(w):w}});function u(e,t,r){for(var n=1,i=2;i<=t;i++)n*=i;for(var a=n,o=t+1;o<=2*t;o++)a*=o;var s=a*(2*t+1);return 8*Math.pow(e/Math.pow(2,r),2*t)*n*n/(a*s)}}),Hp="gamma",Gp=j(Hp,["typed","config","multiplyScalar","pow","BigNumber","Complex"],e=>{var{typed:t,config:r,multiplyScalar:n,pow:i,BigNumber:a,Complex:o}=e;return t(Hp,{number:ls,Complex:function(e){if(0===e.im)return this(e.re);if(e.re<.5){var t=new o(1-e.re,-e.im),r=new o(Math.PI*e.re,Math.PI*e.im);return new o(Math.PI).div(r.sin()).div(this(t))}e=new o(e.re-1,e.im);for(var n=new o(ps[0],0),i=1;i<ps.length;++i){var a=new o(ps[i],0);n=n.add(a.div(e.add(i)))}var s=new o(e.re+fs+.5,e.im),u=Math.sqrt(2*Math.PI),c=s.pow(e.add(.5)),l=s.neg().exp();return n.mul(u).mul(c).mul(l)},BigNumber:function(e){if(e.isInteger())return e.isNegative()||e.isZero()?new a(1/0):s(e.minus(1));if(!e.isFinite())return new a(e.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")},"Array | Matrix":function(e){return ct(e,this)}});function s(e){if(e<8)return new a([1,1,2,6,24,120,720,5040][e]);var t=r.precision+(0|Math.log(e.toNumber())),n=a.clone({precision:t});if(e%2==1)return e.times(s(new a(e-1)));for(var i=e,o=new n(e),u=e.toNumber();i>2;)u+=i-=2,o=o.times(u);return new a(o.toPrecision(a.precision))}}),Vp="setIntersect",Zp=j(Vp,["typed","size","subset","compareNatural","Index","DenseMatrix"],e=>{var{typed:t,size:r,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return t(Vp,{"Array | Matrix, Array | Matrix":function(e,t){var s;if(0===n(r(e),new a(0))||0===n(r(t),new a(0)))s=[];else{var u=Ae(be(Array.isArray(e)?e:e.toArray()).sort(i)),c=Ae(be(Array.isArray(t)?t:t.toArray()).sort(i));s=[];for(var l=0;l<u.length;l++)for(var f=0;f<c.length;f++)if(0===i(u[l].value,c[f].value)&&u[l].identifier===c[f].identifier){s.push(u[l]);break}}return Array.isArray(e)&&Array.isArray(t)?Oe(s):new o(Oe(s))}})}),Wp=j("divide",["typed","matrix","multiply","equalScalar","divideScalar","inv"],e=>{var{typed:t,matrix:r,multiply:n,equalScalar:i,divideScalar:a,inv:o}=e,s=Zu({typed:t,equalScalar:i}),u=Yu({typed:t});return t("divide",U({"Array | Matrix, Array | Matrix":function(e,t){return n(e,o(t))},"DenseMatrix, any":function(e,t){return u(e,t,a,!1)},"SparseMatrix, any":function(e,t){return s(e,t,a,!1)},"Array, any":function(e,t){return u(r(e),t,a,!1).valueOf()},"any, Array | Matrix":function(e,t){return n(e,o(t))}},a.signatures))}),Jp="factorial",Yp=j(Jp,["typed","gamma"],e=>{var{typed:t,gamma:r}=e;return t(Jp,{number:function(e){if(e<0)throw new Error("Value must be non-negative");return r(e+1)},BigNumber:function(e){if(e.isNegative())throw new Error("Value must be non-negative");return r(e.plus(1))},"Array | Matrix":function(e){return ct(e,this)}})}),Qp=j("lup",["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtract","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],e=>{var{typed:t,matrix:r,abs:n,addScalar:i,divideScalar:a,multiplyScalar:o,subtract:s,larger:u,equalScalar:c,unaryMinus:l,DenseMatrix:f,SparseMatrix:p,Spa:m}=e;return t("lup",{DenseMatrix:function(e){return d(e)},SparseMatrix:function(e){return function(e){var t,r,i,s=e._size[0],f=e._size[1],d=Math.min(s,f),h=e._values,y=e._index,g=e._ptr,v=[],x=[],b=[],w=[s,d],N=[],M=[],S=[],E=[d,f],A=[],O=[];for(t=0;t<s;t++)A[t]=t,O[t]=t;var C=function(){var e=new m;r<s&&(b.push(v.length),v.push(1),x.push(r)),S.push(N.length);var f=g[r],d=g[r+1];for(i=f;i<d;i++)t=y[i],e.set(A[t],h[i]);r>
10&&e.forEach(0,r-1,function(t,r){p._forEachRow(t,v,x,b,function(n,i){n>t&&e.accumulate(n,l(o(i,r)))})});var C,_,T,B,z=r,q=e.get(r),D=n(q);e.forEach(r+1,s-1,function(e,t){var r=n(t);u(r,D)&&(z=e,D=r,q=t)}),r!==z&&(p._swapRows(r,z,w[1],v,x,b),p._swapRows(r,z,E[1],N,M,S),e.swap(r,z),_=z,T=O[C=r],B=O[_],A[T]=_,A[B]=C,O[C]=B,O[_]=T),e.forEach(0,s-1,function(e,t){e<=r?(N.push(t),M.push(e)):(t=a(t,q),c(t,0)||(v.push(t),x.push(e)))})};for(r=0;r<f;r++)C();return S.push(N.length),b.push(v.length),{L:new p({values:v,index:x,ptr:b,size:w}),U:new p({values:N,index:M,ptr:S,size:E}),p:A,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}(e)},Array:function(e){var t=d(r(e));return{L:t.L.valueOf(),U:t.U.valueOf(),p:t.p}}});function d(e){var t,r,l,p=e._size[0],m=e._size[1],d=Math.min(p,m),h=R(e._data),y=[],g=[p,d],v=[],x=[d,m],b=[];for(t=0;t<p;t++)b[t]=t;for(r=0;r<m;r++){if(r>0)for(t=0;t<p;t++){var w=Math.min(t,r),N=0;for(l=0;l<w;l++)N=i(N,o(h[t][l],h[l][r]));h[t][r]=s(h[t][r],N)}var M=r,S=0,E=0;for(t=r;t<p;t++){var A=h[t][r],O=n(A);u(O,S)&&(M=t,S=O,E=A)}if(r!==M&&(b[r]=[b[M],b[M]=b[r]][0],f._swapRows(r,M,h)),r<p)for(t=r+1;t<p;t++){var C=h[t][r];c(C,0)||(h[t][r]=a(h[t][r],E))}}for(r=0;r<m;r++)for(t=0;t<p;t++)0===r&&(t<m&&(v[t]=[]),y[t]=[]),t<r?(t<m&&(v[t][r]=h[t][r]),r<p&&(y[t][r]=0)):t!==r?(t<m&&(v[t][r]=0),r<p&&(y[t][r]=h[t][r])):(t<m&&(v[t][r]=h[t][r]),r<p&&(y[t][r]=1));var _=new f({data:y,size:g}),T=new f({data:v,size:x}),B=[];for(t=0,d=b.length;t<d;t++)B[b[t]]=t;return{L:_,U:T,p:B,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}}),Xp="multinomial",Kp=j(Xp,["typed","add","divide","multiply","factorial","isInteger","isPositive"],e=>{var{typed:t,add:r,divide:n,multiply:i,factorial:a,isInteger:o,isPositive:s}=e;return t(Xp,{"Array | Matrix":function(e){var t=0,u=1;return ut(e,function(e){if(!o(e)||!s(e))throw new TypeError("Positive integer value expected in function multinomial");t=r(t,e),u=i(u,a(e))}),n(a(t),u)}})}),em="permutations",tm=j(em,["typed","factorial"],e=>{var{typed:t,factorial:r}=e;return t(em,{"number | BigNumber":r,"number, number":function(e,t){if(!s(e)||e<0)throw new TypeError("Positive integer value expected in function permutations");if(!s(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 po(e-t+1,e)},"BigNumber, BigNumber":function(e,t){var r,n;if(!rm(e)||!rm(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(r=e.mul(0).add(1),n=e.minus(t).plus(1);n.lte(e);n=n.plus(1))r=r.times(n);return r}})});function rm(e){return e.isInteger()&&e.gte(0)}var nm="stirlingS2",im=j(nm,["typed","addScalar","subtract","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],e=>{var{typed:t,addScalar:r,subtract:n,multiplyScalar:i,divideScalar:a,pow:s,factorial:u,combinations:c,isNegative:l,isInteger:f,number:p,bignumber:m,larger:d}=e,h=[],y=[];return t(nm,{"number | BigNumber, number | BigNumber":function(e,t){if(!f(e)||l(e)||!f(t)||l(t))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(d(t,e))throw new TypeError("k must be less than or equal to n in function stirlingS2");var n=!((0,o.Et)(e)&&(0,o.Et)(t)),a=n?y:h,s=n?m:p,u=p(e),c=p(t);if(a[u]&&a[u].length>c)return a[u][c];for(var g=0;g<=u;++g)if(a[g]||(a[g]=[s(0===g?1:0)]),0!==g)for(var v=a[g],x=a[g-1],b=v.length;b<=g&&b<=c;++b)v[b]=b===g?1:r(i(s(b),x[b]),x[b-1]);return a[u][c]}})}),am="unit",om=j(am,["typed","Unit"],e=>{var{typed:t,Unit:r}=e;return t(am,{Unit:function(e){return e.clone()},string:function(e){return r.isValuelessUnit(e)?new r(null,e):r.parse(e,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string":function(e,t){return new r(e,t)},"Array | Matrix":function(e){return ct(e,this)}})}),sm="bellNumbers",um=j(sm,["typed","addScalar","isNegative","isInteger","stirlingS2"],e=>{var{typed:t,addScalar:r,isNegative:n,isInteger:i,stirlingS2:a}=e;return t(sm,{"number | BigNumber":function(e){if(!i(e)||n(e))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var t=0,o=0;o<=e;o++)t=r(t,a(e,o));return t}})});var cm=j("eigs",["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],e=>{var{config:t,typed:r,matrix:n,addScalar:i,subtract:a,equal:s,abs:u,atan:c,cos:l,sin:f,multiplyScalar:p,divideScalar:m,inv:d,bignumber:h,multiply:y,add:g,larger:v,column:x,flatten:b,number:w,complex:N,sqrt:M,diag:S,qr:E,usolve:A,usolveAll:O,im:C,re:_,smaller:T,matrixFromColumns:B,dot:q}=e,D=function(e){var{config:t,addScalar:r,subtract:n,abs:i,atan:a,cos:o,sin:s,multiplyScalar:u,inv:c,bignumber:l,multiply:f,add:p}=e;function m(e,r,n){var i=r-e;return Math.abs(i)<=t.epsilon?Math.PI/4:.5*Math.atan(2*n/(r-e))}function d(e,r,o){var s=n(r,e);return i(s)<=t.epsilon?l(-1).acos().div(4):u(.5,a(f(2,o,c(s))))}function h(e,t,r,n){for(var i=e.length,a=Math.cos(t),o=Math.sin(t),s=N(i,0),u=N(i,0),c=0;c<i;c++)s[c]=a*e[c][r]-o*e[c][n],u[c]=o*e[c][r]+a*e[c][n];for(var l=0;l<i;l++)e[l][r]=s[l],e[l][n]=u[l];return e}function y(e,t,i,a){for(var c=e.length,f=o(t),p=s(t),m=N(c,l(0)),d=N(c,l(0)),h=0;h<c;h++)m[h]=n(u(f,e[h][i]),u(p,e[h][a])),d[h]=r(u(p,e[h][i]),u(f,e[h][a]));for(var y=0;y<c;y++)e[y][i]=m[y],e[y][a]=d[y];return e}function g(e,t,i,a){for(var c=e.length,m=l(o(t)),d=l(s(t)),h=u(m,m),y=u(d,d),g=N(c,l(0)),v=N(c,l(0)),x=f(l(2),m,d,e[i][a]),b=r(n(u(h,e[i][i]),x),u(y,e[a][a])),w=p(u(y,e[i][i]),x,u(h,e[a][a])),M=0;M<c;M++)g[M]=n(u(m,e[i][M]),u(d,e[a][M])),v[M]=r(u(d,e[i][M]),u(m,e[a][M]));e[i][i]=b,e[a][a]=w,e[i][a]=l(0),e[a][i]=l(0);for(var S=0;S<c;S++)S!==i&&S!==a&&(e[i][S]=g[S],e[S][i]=g[S],e[a][S]=v[S],e[S][a]=v[S]);return e}function v(e,t,r,n){for(var i=e.length,a=Math.cos(t),o=Math.sin(t),s=a*a,u=o*o,c=N(i,0),l=N(i,0),f=s*e[r][r]-2*a*o*e[r][n]+u*e[n][n],p=u*e[r][r]+2*a*o*e[r][n]+s*e[n][n],m=0;m<i;m++)c[m]=a*e[r][m]-o*e[n][m],l[m]=o*e[r][m]+a*e[n][m];e[r][r]=f,e[n][n]=p,e[r][n]=0,e[n][r]=0;for(var d=0;d<i;d++)d!==r&&d!==n&&(e[r][d]=c[d],e[d][r]=c[d],e[n][d]=l[d],e[d][n]=l[d]);return e}function x(e){for(var t=e.length,r=0,n=[0,1],i=0;i<t;i++)for(var a=i+1;a<t;a++)Math.abs(r)<Math.abs(e[i][a])&&(r=Math.abs(e[i][a]),n=[i,a]);return[n,r]}function b(e){for(var t=e.length,r=0,n=[0,1],a=0;a<t;a++)for(var o=a+1;o<t;o++)i(r)<i(e[a][o])&&(r=i(e[a][o]),n=[a,o]);return[n,r]}function w(e,t){for(var r=e.length,n=Array(r),a=Array(r),o=0;o<r;o++)a[o]=Array(r);for(var s=0;s<r;s++){for(var u=0,c=e[0],l=0;l<e.length;l++)i(e[l])<i(c)&&(c=e[u=l]);n[s]=e.splice(u,1)[0];for(var f=0;f<r;f++)a[f][s]=t[f][u],t[f].splice(u,1)}return{values:n,vectors:a}}function N(e,t){for(var r=new Array(e),n=0;n<e;n++)r[n]=t;return r}return function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.epsilon,a=arguments.length>3?arguments[3]:void 0;if("number"===a)return function(e,t){for(var r,n=e.length,i=Math.abs(t/n),a=new Array(n),o=0;o<n;o++)a[o]=N(n,0),a[o][o]=1;for(var s=x(e);Math.abs(s[1])>=Math.abs(i);){var u=s[0][0],c=s[0][1];e=v(e,r=m(e[u][u],e[c][c],e[u][c]),u,c),a=h(a,r,u,c),s=x(e)}for(var l=N(n,0),f=0;f<n;f++)l[f]=e[f][f];return w(R(l),R(a))}(e,n);if("BigNumber"===a)return function(e,t){for(var r,n=e.length,a=i(t/n),o=new Array(n),s=0;s<n;s++)o[s]=N(n,0),o[s][s]=1;for(var u=b(e);i(u[1])>=i(a);){var c=u[0][0],l=u[0][1];e=g(e,r=d(e[c][c],e[l][l],e[c][l]),c,l),o=y(o,r,c,l),u=b(e)}for(var f=N(n,0),p=0;p<n;p++)f[p]=e[p][p];return w(R(f),R(o))}(e,n);throw TypeError("Unsupported data type: "+a)}}({config:t,addScalar:i,subtract:a,column:x,flatten:b,equal:s,abs:u,atan:c,cos:l,sin:f,multiplyScalar:p,inv:d,bignumber:h,complex:N,multiply:y,add:g}),I=function(e){var{addScalar:t,subtract:r,flatten:n,multiply:i,multiplyScalar:a,divideScalar:o,sqrt:s,abs:u,bignumber:c,diag:l,inv:f,qr:p,usolve:m,usolveAll:d,equal:h,complex:y,larger:g,smaller:v,matrixFromColumns:x,dot:b}=e;function w(e,n,i,o){var u=t(e,o),c=r(a(e,o),a(n,i)),l=a(u,.5),f=a(s(r(a(u,u),a(4,c))),.5);return[t(l,f),r(l,f)]}function N(e,t,n,i,a,o,s,l){var f="BigNumber"===l,p="Complex"===l,m=f?c(0):p?y(0):0,d=f?c(1):p?y(1):1;if(v(u(n),s))return[[d,m],[m,d]];if(g(u(r(a,o)),s))return[[r(a,i),r(o,i)],[n,n]];var h=r(e,a),x=r(t,a),b=r(n,a),w=r(i,a);return v(u(x),s)?[[h,d],[b,m]]:[[x,m],[w,d]]}function M(e,t){for(var r=0;r<e.length;r++)e[r].push(...Array(t-e[r].length).fill(0));for(var n=e.length;n<t;n++)e.push(Array(t).fill(0)),e[n][n]=1;return e}function S(e,t,r){for(var n=0;n<e.length;n++)if(r(e[n],t))return n;return-1}function E(e,t,r,n,i){for(var a,o="BigNumber"===i?c(1e3):1e3,s=0;a=A(t,r,i),a=m(e,a),!g(C(a),o);)if(++s>=5)return null;for(s=0;;){var u=m(e,a);if(v(C(O(a,[u])),n))break;if(++s>=10)return null;a=_(u)}return a}function A(e,t,r){var n="BigNumber"===r,i="Complex"===r,a=Array(e).fill(0).map(e=>2*Math.random()-1);return n&&(a=a.map(e=>c(e))),i&&(a=a.map(e=>y(e))),_(a=O(a,t),r)}function O(e,t){for(var n of t)e=r(e,i(o(b(n,e),b(n,n)),n));return e}function C(e){return u(s(b(e,e)))}function _(e,t){var r="Complex"===t,n="BigNumber"===t?c(1):r?y(1):1;return i(o(n,C(e)),e)}return function(e,s,m,b,A){void 0===A&&(A=!0);var O=function(e,r,n,i,s){var f,p="BigNumber"===i,m="Complex"===i,d=p?c(0):0,x=p?c(1):m?y(1):1,b=p?c(1):1,w=p?c(10):2,N=a(w,w);s&&(f=Array(r).fill(x));for(var M=!1;!M;){M=!0;for(var S=0;S<r;S++){for(var E=d,A=d,O=0;O<r;O++)if(S!==O){var C=u(e[S][O]);E=t(E,C),A=t(A,C)}if(!h(E,0)&&!h(A,0)){for(var _=b,T=E,B=o(A,w),z=a(A,w);v(T,B);)T=a(T,N),_=a(_,w);for(;g(T,z);)T=o(T,N),_=o(_,w);
1if(v(o(t(T,A),_),a(t(E,A),.95))){M=!1;for(var q=o(1,_),D=0;D<r;D++)S!==D&&(e[S][D]=a(e[S][D],_),e[D][S]=a(e[D][S],q));s&&(f[S]=a(f[S],_))}}}}return l(f)}(e,s,0,b,A);!function(e,n,i,s,l,f){var p="BigNumber"===s,m="Complex"===s,d=p?c(0):m?y(0):0;p&&(i=c(i));for(var h=0;h<n-2;h++){for(var g=0,x=d,b=h+1;b<n;b++){var w=e[b][h];v(u(x),u(w))&&(x=w,g=b)}if(!v(u(x),i)){if(g!==h+1){var N=e[g];e[g]=e[h+1],e[h+1]=N;for(var M=0;M<n;M++){var S=e[M][g];e[M][g]=e[M][h+1],e[M][h+1]=S}if(l){var E=f[g];f[g]=f[h+1],f[h+1]=E}}for(var A=h+2;A<n;A++){var O=o(e[A][h],x);if(0!==O){for(var C=0;C<n;C++)e[A][C]=r(e[A][C],a(O,e[h+1][C]));for(var _=0;_<n;_++)e[_][h+1]=t(e[_][h+1],a(O,e[_][A]));if(l)for(var T=0;T<n;T++)f[A][T]=r(f[A][T],a(O,f[h+1][T]))}}}}}(e,s,m,b,A,O);var C,{values:_,C:T}=function(e,n,a,o,s){var f="BigNumber"===o,m="Complex"===o,d=f?c(1):m?y(1):1;f&&(a=c(a));for(var h=R(e),g=[],x=n,b=[],S=s?l(Array(n).fill(d)):void 0,E=s?l(Array(x).fill(d)):void 0,A=0;A<=100;){A+=1;for(var O=0;O<x;O++)h[O][O]=r(h[O][O],0);var{Q:C,R:_}=p(h);h=i(_,C);for(var T=0;T<x;T++)h[T][T]=t(h[T][T],0);if(s&&(E=i(E,C)),1===x||v(u(h[x-1][x-2]),a)){A=0,g.push(h[x-1][x-1]),s&&(b.unshift([[1]]),M(E,n),S=i(S,E),x>1&&(E=l(Array(x-1).fill(d)))),x-=1,h.pop();for(var B=0;B<x;B++)h[B].pop()}else if(2===x||v(u(h[x-2][x-3]),a)){A=0;var z=w(h[x-2][x-2],h[x-2][x-1],h[x-1][x-2],h[x-1][x-1]);g.push(...z),s&&(b.unshift(N(h[x-2][x-2],h[x-2][x-1],h[x-1][x-2],h[x-1][x-1],z[0],z[1],a,o)),M(E,n),S=i(S,E),x>2&&(E=l(Array(x-2).fill(d)))),x-=2,h.pop(),h.pop();for(var q=0;q<x;q++)h[q].pop(),h[q].pop()}if(0===x)break}if(g.sort((e,t)=>+r(u(e),u(t))),A>100){var D=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+g.join(", "));throw D.values=g,D.vectors=[],D}var I=s?i(S,function(e,t){for(var r=[],n=0;n<t;n++)r[n]=Array(t).fill(0);var i=0;for(var a of e){for(var o=a.length,s=0;s<o;s++)for(var u=0;u<o;u++)r[i+s][i+u]=a[s][u];i+=o}return r}(b,n)):void 0;return{values:g,C:I}}(e,s,m,b,A);return A&&(C=function(e,t,a,o,s,u,p){var m=f(a),g=i(m,e,a),v="BigNumber"===p,x="Complex"===p,b=v?c(0):x?y(0):0,w=v?c(1):x?y(1):1,N=[],M=[];for(var A of s){var O=S(N,A,h);-1===O?(N.push(A),M.push(1)):M[O]+=1}for(var C=[],_=N.length,T=Array(t).fill(b),B=l(Array(t).fill(w)),z=[],q=function(e){var s=N[e],c=r(g,i(s,B)),l=d(c,T);for(l.shift();l.length<M[e];){var m=E(c,t,l,u,p);if(null==m){z.push(s);break}l.push(m)}var h=i(f(o),a);l=l.map(e=>i(h,e)),C.push(...l.map(e=>n(e)))},D=0;D<_;D++)q(D);if(0!==z.length){var I=new Error("Failed to find eigenvectors for the following eigenvalues: "+z.join(", "));throw I.values=s,I.vectors=C,I}return C}(e,s,T,O,_,m,b),C=x(...C)),{values:_,vectors:C}}}({config:t,addScalar:i,subtract:a,multiply:y,multiplyScalar:p,flatten:b,divideScalar:m,sqrt:M,abs:u,bignumber:h,diag:S,qr:E,inv:d,usolve:A,usolveAll:O,equal:s,complex:N,larger:v,smaller:T,matrixFromColumns:B,dot:q});return r("eigs",{Array:function(e){return k(n(e))},"Array, number|BigNumber":function(e,t){return k(n(e),t)},Matrix:function(e){var{values:t,vectors:r}=k(e);return{values:n(t),vectors:n(r)}},"Matrix, number|BigNumber":function(e,t){var{values:r,vectors:i}=k(e,t);return{values:n(r),vectors:n(i)}}});function k(e,r){void 0===r&&(r=t.epsilon);var n=e.size();if(2!==n.length||n[0]!==n[1])throw new RangeError("Matrix must be square (size: "+z(n)+")");var i=e.toArray(),o=n[0];if(function(e,t,r){for(var n=0;n<t;n++)for(var i=0;i<t;i++)if(v(h(u(C(e[n][i]))),r))return!1;return!0}(i,o,r)&&(function(e,t){for(var r=0;r<t;r++)for(var n=0;n<t;n++)e[r][n]=_(e[r][n])}(i,o),function(e,t,r){for(var n=0;n<t;n++)for(var i=n;i<t;i++)if(v(h(u(a(e[n][i],e[i][n]))),r))return!1;return!0}(i,o,r))){var s=U(e,i,o);return D(i,o,r,s)}var c=U(e,i,o);return I(i,o,r,c)}function U(e,t,r){var n=e.datatype();if("number"===n||"BigNumber"===n||"Complex"===n)return n;for(var i=!1,a=!1,s=!1,u=0;u<r;u++)for(var c=0;c<r;c++){var l=t[u][c];if((0,o.Et)(l)||(0,o.fU)(l))i=!0;else if((0,o.C4)(l))a=!0;else{if(!(0,o.Zd)(l))throw TypeError("Unsupported type in Matrix: "+(0,o.QP)(l));s=!0}}if(a&&s&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),s){for(var f=0;f<r;f++)for(var p=0;p<r;p++)t[f][p]=N(t[f][p]);return"Complex"}if(a){for(var m=0;m<r;m++)for(var d=0;d<r;d++)t[m][d]=h(t[m][d]);return"BigNumber"}if(i){for(var y=0;y<r;y++)for(var g=0;g<r;g++)t[y][g]=w(t[y][g]);return"number"}throw TypeError("Matrix contains unsupported types only.")}}),lm="setSymDifference",fm=j(lm,["typed","size","concat","subset","setDifference","Index"],e=>{var{typed:t,size:r,concat:n,subset:i,setDifference:a,Index:o}=e;return t(lm,{"Array | Matrix, Array | Matrix":function(e,t){if(0===i(r(e),new o(0)))return be(t);if(0===i(r(t),new o(0)))return be(e);var s=be(e),u=be(t);return n(a(s,u),a(u,s))}})});function pm(e,t){var r,n=t.length,i=[];if(e)for(r=0;r<n;r++)i[e[r]]=t[r];else for(r=0;r<n;r++)i[r]=t[r];return i}var mm="lusolve",dm=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],hm=j(mm,dm,e=>{var{typed:t,matrix:r,lup:n,slu:i,usolve:a,lsolve:s,DenseMatrix:u}=e,c=pl({DenseMatrix:u});return t(mm,{"Array, Array | Matrix":function(e,t){e=r(e);var i=n(e);return f(i.L,i.U,i.p,null,t).valueOf()},"DenseMatrix, Array | Matrix":function(e,t){var r=n(e);return f(r.L,r.U,r.p,null,t)},"SparseMatrix, Array | Matrix":function(e,t){var r=n(e);return f(r.L,r.U,r.p,null,t)},"SparseMatrix, Array | Matrix, number, number":function(e,t,r,n){var a=i(e,r,n);return f(a.L,a.U,a.p,a.q,t)},"Object, Array | Matrix":function(e,t){return f(e.L,e.U,e.p,e.q,t)}});function l(e){if((0,o.OA)(e))return e;if((0,o.cy)(e))return r(e);throw new TypeError("Invalid Matrix LU decomposition")}function f(e,t,r,n,i){e=l(e),t=l(t),r&&((i=c(e,i,!0))._data=pm(r,i._data));var o=s(e,i),u=a(t,o);return n&&(u._data=pm(n,u._data)),u}}),ym="median",gm=["typed","add","divide","compare","partitionSelect"],vm=j(ym,gm,e=>{var{typed:t,add:r,divide:n,compare:i,partitionSelect:a}=e;function o(e){try{var t=(e=be(e.valueOf())).length;if(0===t)throw new Error("Cannot calculate median of an empty array");if(t%2==0){for(var r=t/2-1,n=a(e,r+1),o=e[r],c=0;c<r;++c)i(e[c],o)>0&&(o=e[c]);return u(o,n)}var l=a(e,(t-1)/2);return s(l)}catch(e){throw Nr(e,"median")}}var s=t({"number | BigNumber | Complex | Unit":function(e){return e}}),u=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(e,t){return n(r(e,t),2)}});return t(ym,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("median(A, dim) is not yet supported")},"...":function(e){if(st(e))throw new TypeError("Scalar values expected in function median");return o(e)}})}),xm="setUnion",bm=["typed","size","concat","subset","setIntersect","setSymDifference","Index"],wm=j(xm,bm,e=>{var{typed:t,size:r,concat:n,subset:i,setIntersect:a,setSymDifference:o,Index:s}=e;return t(xm,{"Array | Matrix, Array | Matrix":function(e,t){if(0===i(r(e),new s(0)))return be(t);if(0===i(r(t),new s(0)))return be(e);var u=be(e),c=be(t);return n(o(u,c),a(u,c))}})}),Nm="kldivergence",Mm=["typed","matrix","divide","sum","multiply","dotDivide","log","isNumeric"],Sm=j(Nm,Mm,e=>{var{typed:t,matrix:r,divide:n,sum:i,multiply:a,dotDivide:o,log:s,isNumeric:u}=e;return t(Nm,{"Array, Array":function(e,t){return c(r(e),r(t))},"Matrix, Array":function(e,t){return c(e,r(t))},"Array, Matrix":function(e,t){return c(r(e),t)},"Matrix, Matrix":function(e,t){return c(e,t)}});function c(e,t){var r=t.size().length,c=e.size().length;if(r>1)throw new Error("first object must be one dimensional");if(c>1)throw new Error("second object must be one dimensional");if(r!==c)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");var l=n(e,i(e)),f=n(t,i(t)),p=i(a(l,s(o(l,f))));return u(p)?p:Number.NaN}}),Em="norm",Am=["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],Om=j(Em,Am,e=>{var{typed:t,abs:r,add:n,pow:i,conj:a,sqrt:o,multiply:s,equalScalar:u,larger:c,smaller:l,matrix:f,ctranspose:p,eigs:m}=e;return t(Em,{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 d(f(e),2)},Matrix:function(e){return d(e,2)},"number | Complex | BigNumber | boolean, number | BigNumber | string":function(e){return this(e)},"Array, number | BigNumber | string":function(e,t){return d(f(e),t)},"Matrix, number | BigNumber | string":function(e,t){return d(e,t)}});function d(e,t){var f=e.size();if(1===f.length)return function(e,t){if(t===Number.POSITIVE_INFINITY||"inf"===t)return function(e){var t=0;return e.forEach(function(e){var n=r(e);c(n,t)&&(t=n)},!0),t}(e);if(t===Number.NEGATIVE_INFINITY||"-inf"===t)return function(e){var t;return e.forEach(function(e){var n=r(e);t&&!l(n,t)||(t=n)},!0),t||0}(e);if("fro"===t)return d(e,2);if("number"==typeof t&&!isNaN(t)){if(!u(t,0)){var a=0;return e.forEach(function(e){a=n(i(r(e),t),a)},!0),i(a,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){var t=[],i=0;return e.forEach(function(e,a){var o=a[1],s=n(t[o]||0,r(e));c(s,i)&&(i=s),t[o]=s},!0),i}(e);if(t===Number.POSITIVE_INFINITY||"inf"===t)return function(e){var t=[],i=0;return e.forEach(function(e,a){var o=a[0],s=n(t[o]||0,r(e));c(s,i)&&(i=s),t[o]=s},!0),i}(e);if("fro"===t)return function(e){var t=0;return e.forEach(function(e,r){t=n(t,s(e,a(e)))}),r(o(t))}(e);if(2===t)return function(e){var t=e.size();if(t[0]!==t[1])throw new RangeError("Invalid matrix dimensions");var n=p(e),i=s(n,e),a=m(i).values.toArray(),u=a[a.length-1];return r(o(u))}(e);throw new Error("Unsupported parameter value "+t)}(e,t);throw new RangeError("Invalid matrix dimensions")}}}),Cm="rotationMatrix",_m=["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],Tm=j(Cm,_m,e=>{var{typed:t,config:r,multiplyScalar:n,addScalar:i,unaryMinus:a,norm:s,BigNumber:u,matrix:c,DenseMatrix:l,SparseMatrix:f,cos:p,sin:m}=e;return t(Cm,{"":function(){return"Matrix"===r.matrix?c([]):[]},string:function(e){return c(e)},"number | BigNumber | Complex | Unit":function(e){return d(e,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(e,t){return d(e,t)},"number | BigNumber | Complex | Unit, Array":function(e,t){var r=c(t);return h(r),v(e,r,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(e,t){h(t);var n=t.storage()||("Matrix"===r.matrix?"dense":void 0);return v(e,t,n)},"number | BigNumber | Complex | Unit, Array, string":function(e,t,r){var n=c(t);return h(n),v(e,n,r)},"number | BigNumber | Complex | Unit, Matrix, string":function(e,t,r){return h(t),v(e,t,r)}});function d(e,t){var r=(0,o.C4)(e)?new u(-1):-1,i=p(e),a=m(e);return g([[i,n(r,a)],[a,i]],t)}function h(e){var t=e.size();if(t.length<1||3!==t[0])throw new RangeError("Vector must be of dimensions 1x3")}function y(e){return e.reduce((e,t)=>
1n(e,t))}function g(e,t){if(t){if("sparse"===t)return new f(e);if("dense"===t)return new l(e);throw new TypeError('Unknown matrix type "'.concat(t,'"'))}return e}function v(e,t,r){var n=s(t);if(0===n)throw new RangeError("Rotation around zero vector");var c=(0,o.C4)(e)?u:null,l=c?new c(1):1,f=c?new c(-1):-1,d=c?new c(t.get([0])/n):t.get([0])/n,h=c?new c(t.get([1])/n):t.get([1])/n,v=c?new c(t.get([2])/n):t.get([2])/n,x=p(e),b=i(l,a(x)),w=m(e);return g([[i(x,y([d,d,b])),i(y([d,h,b]),y([f,v,w])),i(y([d,v,b]),y([h,w]))],[i(y([d,h,b]),y([v,w])),i(x,y([h,h,b])),i(y([h,v,b]),y([f,d,w]))],[i(y([d,v,b]),y([f,h,w])),i(y([h,v,b]),y([d,w])),i(x,y([v,v,b]))]],r)}}),Bm=["typed","abs","map","median","subtract"],zm=j("mad",Bm,e=>{var{typed:t,abs:r,map:n,median:i,subtract:a}=e;return t("mad",{"Array | Matrix":o,"...":function(e){return o(e)}});function o(e){if(0===(e=be(e.valueOf())).length)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var t=i(e);return i(n(e,function(e){return r(a(e,t))}))}catch(e){throw e instanceof TypeError&&-1!==e.message.indexOf("median")?new TypeError(e.message.replace("median","mad")):Nr(e,"mad")}}}),qm="rotate",Dm=["typed","multiply","rotationMatrix"],Im=j(qm,Dm,e=>{var{typed:t,multiply:r,rotationMatrix:n}=e;return t(qm,{"Array , number | BigNumber | Complex | Unit":function(e,t){return i(e,2),r(n(t),e).toArray()},"Matrix , number | BigNumber | Complex | Unit":function(e,t){return i(e,2),r(n(t),e)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(e,t,a){return i(e,3),r(n(t,a),e)},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(e,t,a){return i(e,3),r(n(t,a),e)}});function i(e,t){var r=Array.isArray(e)?se(e):e.size();if(r.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(t));if(2===r.length&&1!==r[1])throw new RangeError("Vector must be of dimensions 1x".concat(t));if(r[0]!==t)throw new RangeError("Vector must be of dimensions 1x".concat(t))}}),km=Kr({config:a}),Rm=tn({}),Um=vn({BigNumber:km,config:a}),Pm=pn({}),Fm=Wn({BigNumber:km,config:a}),jm=Ci({}),Lm=An({Complex:Rm}),$m=dn({BigNumber:km,config:a}),Hm=wn({BigNumber:km,config:a}),Gm=Mn({BigNumber:km,config:a}),Vm=_i({}),Zm=hn({BigNumber:km,config:a}),Wm=mn({}),Jm=xn({BigNumber:km,config:a}),Ym=Ti({}),Qm=Bi({}),Xm=Sn({BigNumber:km,config:a}),Km=mi({BigNumber:km,config:a}),ed=gn({BigNumber:km,config:a}),td=fn({}),rd=On({}),nd=zi({Matrix:Vm}),id=ni({BigNumber:km,config:a}),ad=bn({BigNumber:km,config:a}),od=yn({BigNumber:km,config:a}),sd=qi({}),ud=En({BigNumber:km,config:a}),cd=ki({BigNumber:km,Complex:Rm,DenseMatrix:nd,Fraction:jm}),ld=ca({BigNumber:km,config:a,typed:cd}),fd=ri({BigNumber:km,config:a}),pd=la({typed:cd}),md=pa({Complex:Rm,config:a,typed:cd}),dd=Ba({BigNumber:km,typed:cd}),hd=qa({BigNumber:km,Complex:Rm,config:a,typed:cd}),yd=Ia({typed:cd}),gd=ka({typed:cd}),vd=Ua({BigNumber:km,Complex:Rm,config:a,typed:cd}),xd=Pa({typed:cd}),bd=Fa({typed:cd}),wd=La({Complex:Rm,config:a,typed:cd}),Nd=$a({BigNumber:km,typed:cd}),Md=so({typed:cd}),Sd=co({typed:cd}),Ed=fo({typed:cd}),Ad=yo({typed:cd}),Od=vo({Complex:Rm,typed:cd}),Cd=bo({typed:cd}),_d=No({typed:cd}),Td=So({BigNumber:km,typed:cd}),Bd=Eo({BigNumber:km,typed:cd}),zd=Oo({typed:cd}),qd=To({config:a,typed:cd}),Dd=Bo({typed:cd}),Id=Ro({typed:cd}),kd=Po({Complex:Rm,typed:cd}),Rd=Fo({typed:cd}),Ud=$o({typed:cd}),Pd=Vo({typed:cd}),Fd=Wo({typed:cd}),jd=Jo({format:Pd,typed:cd}),Ld=Yo({typed:cd}),$d=Xo({typed:cd}),Hd=as({typed:cd}),Gd=ss({typed:cd}),Vd=cs({typed:cd}),Zd=Nn({BigNumber:km,config:a}),Wd=gs({Complex:Rm,typed:cd}),Jd=xs({Complex:Rm,config:a,typed:cd}),Yd=ws({Complex:Rm,config:a,typed:cd}),Qd=Ns({typed:cd}),Xd=Ss({typed:cd}),Kd=Ts({typed:cd}),eh=Bs({typed:cd}),th=zs({format:Pd,typed:cd}),rh=Rs({config:a,typed:cd}),nh=Ps({typed:cd}),ih=$s({config:a,typed:cd}),ah=Hs({typed:cd}),oh=Gs({BigNumber:km,typed:cd}),sh=Zs({BigNumber:km,Fraction:jm,complex:Od,typed:cd}),uh=Ws({typed:cd}),ch=Js({Matrix:Vm,equalScalar:qd,typed:cd}),lh=Qs({typed:cd}),fh=Ks({typed:cd}),ph=tu({typed:cd}),mh=ru({typed:cd}),dh=iu({typed:cd}),hh=ou({Complex:Rm,config:a,typed:cd}),yh=uu({BigNumber:km,typed:cd}),gh=nr({isInteger:$d,typed:cd}),vh=lu({BigNumber:km,Complex:Rm,config:a,typed:cd}),xh=fu({format:Pd,typed:cd}),bh=mu({typed:cd}),wh=hu({typed:cd}),Nh=gu({BigNumber:km,typed:cd}),Mh=xu({typed:cd}),Sh=wu({typed:cd}),Eh=Mu({config:a,typed:cd}),Ah=Eu({BigNumber:km,typed:cd}),Oh=Ou({typed:cd}),Ch=_u({SparseMatrix:ch,typed:cd}),_h=Tu({Complex:Rm,config:a,typed:cd}),Th=Bu({typed:cd}),Bh=qu({typed:cd}),zh=Iu({BigNumber:km,Complex:Rm,config:a,typed:cd}),qh=ku({BigNumber:km,typed:cd}),Dh=Ru({Fraction:jm,typed:cd}),Ih=Pu({typed:cd}),kh=ju({DenseMatrix:nd,Matrix:Vm,SparseMatrix:ch,typed:cd}),Rh=$u({isZero:Vd,matrix:kh,typed:cd}),Uh=Qu({DenseMatrix:nd,equalScalar:qd,matrix:kh,typed:cd}),Ph=tc({BigNumber:km,equalScalar:qd,matrix:kh,typed:cd}),Fh=rc({bignumber:Nd,fraction:Dh,number:eh}),jh=nc({DenseMatrix:nd,equalScalar:qd,matrix:kh,typed:cd}),Lh=ac({config:a,multiplyScalar:Xd,numeric:Fh,typed:cd}),$h=sc({isInteger:$d,matrix:kh,typed:cd}),Hh=cc({matrix:kh,config:a,typed:cd}),Gh=pc({DenseMatrix:nd,config:a,matrix:kh,typed:cd}),Vh=dc({matrix:kh,typed:cd}),Zh=pr({matrix:kh,typed:cd}),Wh=gc({DenseMatrix:nd,addScalar:yd,equalScalar:qd,matrix:kh,typed:cd,unaryMinus:Bh}),Jh=xc({matrix:kh,typed:cd}),Yh=bc({matrix:kh,typed:cd}),Qh=Nc({BigNumber:km,config:a,matrix:kh,typed:cd}),Xh=Sc({BigNumber:km,config:a,matrix:kh,typed:cd}),Kh=Ec({equalScalar:qd,matrix:kh,not:Kd,typed:cd,zeros:Xh}),ey=Oc({equalScalar:qd,matrix:kh,typed:cd}),ty=_c({DenseMatrix:nd,matrix:kh,typed:cd}),ry=Bc({BigNumber:km,Complex:Rm,Fraction:jm,config:a,isNegative:Hd,matrix:kh,typed:cd,unaryMinus:Bh}),ny=qc({BigNumber:km,DenseMatrix:nd,Fraction:jm,config:a,equalScalar:qd,matrix:kh,typed:cd}),iy=Ic({matrix:kh,typed:cd}),ay=xr({isInteger:$d,matrix:kh,typed:cd}),oy=Rc({prod:Lh,size:Hh,typed:cd}),sy=Pc({conj:Cd,transpose:Yh,typed:cd}),uy=jc({DenseMatrix:nd,SparseMatrix:ch,matrix:kh,typed:cd}),cy=$c({numeric:Fh,typed:cd}),ly=Gc({DenseMatrix:nd,divideScalar:cy,equalScalar:qd,matrix:kh,typed:cd}),fy=Zc({DenseMatrix:nd,equalScalar:qd,matrix:kh,typed:cd}),py=Wc({addScalar:yd,divideScalar:cy,exp:Id,i:Lm,matrix:kh,multiplyScalar:Xd,tau:ed,typed:cd}),my=Yc({matrix:kh,typed:cd}),dy=Xc({BigNumber:km,DenseMatrix:nd,equalScalar:qd,matrix:kh,typed:cd}),hy=el({isNumeric:Ih,typed:cd}),yy=rl({abs:pd,addScalar:yd,divideScalar:cy,isPositive:Gd,multiplyScalar:Xd,smaller:Gh,sqrt:_h,typed:cd}),gy=il({conj:Cd,dotDivide:ly,fft:py,typed:cd}),vy=ol({matrix:kh,multiplyScalar:Xd,typed:cd}),xy=ul({DenseMatrix:nd,config:a,matrix:kh,typed:cd}),by=fl({DenseMatrix:nd,equalScalar:qd,matrix:kh,typed:cd,zeros:Xh}),wy=dl({DenseMatrix:nd,divideScalar:cy,equalScalar:qd,matrix:kh,multiplyScalar:Xd,subtract:Wh,typed:cd}),Ny=yl({flatten:my,matrix:kh,size:Hh,typed:cd}),My=Er({config:a,numeric:Fh,smaller:Gh,typed:cd}),Sy=vl({isNaN:Mh,isNumeric:Ih,typed:cd}),Ey=bl({Complex:Rm,config:a,divideScalar:cy,typed:cd}),Ay=wl({BigNumber:km,config:a,matrix:kh,typed:cd}),Oy=Ml({compare:ny,isNaN:Mh,isNumeric:Ih,typed:cd}),Cy=El({config:a,matrix:kh}),_y=Ol({DenseMatrix:nd,equalScalar:qd,matrix:kh,typed:cd,zeros:Xh}),Ty=Tl({BigNumber:km,DenseMatrix:nd,equalScalar:qd,matrix:kh,typed:cd,zeros:Xh}),By=zl({DenseMatrix:nd,config:a,matrix:kh,typed:cd}),zy=Dl({DenseMatrix:nd,config:a,equalScalar:qd,matrix:kh,typed:cd}),qy=kl({DenseMatrix:nd,divideScalar:cy,equalScalar:qd,matrix:kh,multiplyScalar:Xd,subtract:Wh,typed:cd}),Dy=Rl({DenseMatrix:nd,matrix:kh,typed:cd}),Iy=Ul({DenseMatrix:nd,SparseMatrix:ch,addScalar:yd,equalScalar:qd,matrix:kh,typed:cd}),ky=jl({BigNumber:km,DenseMatrix:nd,equalScalar:qd,matrix:kh,typed:cd}),Ry=$l({DenseMatrix:nd,equalScalar:qd,matrix:kh,typed:cd}),Uy=Gl({addScalar:yd,combinations:Ad,divideScalar:cy,isInteger:$d,isNegative:Hd,multiplyScalar:Xd,typed:cd}),Py=Wl({compare:ny,typed:cd}),Fy=qr({add:Iy,typed:cd,unaryPlus:ld}),jy=Yl({equal:fy,typed:cd}),Ly=sr({matrix:kh,number:eh,subtract:Wh,typed:cd}),$y=Ql({addScalar:yd,conj:Cd,multiplyScalar:Xd,size:Hh,typed:cd}),Hy=Kl({compareText:iy,isZero:Vd,typed:cd}
1),Gy=nf({DenseMatrix:nd,config:a,equalScalar:qd,matrix:kh,round:Ty,typed:cd,zeros:Xh}),Vy=of({BigNumber:km,DenseMatrix:nd,SparseMatrix:ch,config:a,matrix:kh,typed:cd}),Zy=uf({BigNumber:km,add:Iy,config:a,equal:fy,isInteger:$d,mod:Uh,smaller:Gh,typed:cd,xgcd:Qh}),Wy=lf({DenseMatrix:nd,config:a,matrix:kh,typed:cd}),Jy=ff({Complex:Rm,config:a,divideScalar:cy,typed:cd}),Yy=mf({DenseMatrix:nd,divideScalar:cy,equalScalar:qd,matrix:kh,multiplyScalar:Xd,subtract:Wh,typed:cd}),Qy=hf({flatten:my,matrix:kh,size:Hh,typed:cd}),Xy=gf({addScalar:yd,dot:$y,equalScalar:qd,matrix:kh,multiplyScalar:Xd,typed:cd}),Ky=vf({addScalar:yd,complex:Od,conj:Cd,divideScalar:cy,equal:fy,identity:Vy,isZero:Vd,matrix:kh,multiplyScalar:Xd,sign:sh,sqrt:_h,subtract:Wh,typed:cd,unaryMinus:Bh,zeros:Xh}),eg=Cr({bignumber:Nd,matrix:kh,config:a,larger:Wy,largerEq:xy,smaller:Gh,smallerEq:By,typed:cd}),tg=bf({DenseMatrix:nd,equalScalar:qd,matrix:kh,typed:cd,zeros:Xh}),rg=Nf({compareNatural:Py,typed:cd}),ng=If({SparseMatrix:ch,abs:pd,add:Iy,divideScalar:cy,larger:Wy,largerEq:xy,multiply:Xy,subtract:Wh,transpose:Yh,typed:cd}),ig=Tr({add:Iy,config:a,numeric:Fh,typed:cd}),ag=kf({add:Iy,matrix:kh,typed:cd}),og=Uf({DenseMatrix:nd,divideScalar:cy,equalScalar:qd,matrix:kh,multiplyScalar:Xd,subtract:Wh,typed:cd}),sg=Ff({Complex:Rm,config:a,typed:cd}),ug=Hf({DenseMatrix:nd,config:a,equalScalar:qd,matrix:kh,round:Ty,typed:cd,zeros:Xh}),cg=Vf({addScalar:yd,combinations:Ad,isInteger:$d,isNegative:Hd,isPositive:Gd,larger:Wy,typed:cd}),lg=Wf({matrix:kh,multiply:Xy,subtract:Wh,typed:cd}),fg=Jf({divideScalar:cy,isZero:Vd,matrix:kh,multiply:Xy,subtract:Wh,typed:cd,unaryMinus:Bh}),pg=Qf({abs:pd,addScalar:yd,divideScalar:cy,multiplyScalar:Xd,sqrt:_h,subtract:Wh,typed:cd,unaryMinus:Bh}),mg=Kf({equalScalar:qd,matrix:kh,multiplyScalar:Xd,typed:cd}),dg=ep({larger:Wy,smaller:Gh}),hg=ip({Complex:Rm,DenseMatrix:nd,ceil:ug,equalScalar:qd,floor:Gy,matrix:kh,typed:cd,zeros:Xh}),yg=ap({DenseMatrix:nd,smaller:Gh}),gg=op({ImmutableDenseMatrix:yg}),vg=sp({abs:pd,add:Iy,addScalar:yd,config:a,divideScalar:cy,equalScalar:qd,flatten:my,isNumeric:Ih,isZero:Vd,matrix:kh,multiply:Xy,multiplyScalar:Xd,smaller:Gh,subtract:Wh,typed:cd}),xg=up({equalScalar:qd,matrix:kh,typed:cd}),bg=lp({Complex:Rm,config:a,divideScalar:cy,log:Jy,typed:cd}),wg=Mr({config:a,larger:Wy,numeric:Fh,typed:cd}),Ng=fp({add:Iy,compare:ny,multiply:Xy,partitionSelect:Oy,typed:cd}),Mg=kr({Index:gg,matrix:kh,range:eg,typed:cd}),Sg=mp({DenseMatrix:nd,Index:gg,compareNatural:Py,size:Hh,subset:Zh,typed:cd}),Eg=hp({DenseMatrix:nd,Index:gg,compareNatural:Py,size:Hh,subset:Zh,typed:cd}),Ag=gp({Index:gg,compareNatural:Py,size:Hh,subset:Zh,typed:cd}),Og=xp({Index:gg,compareNatural:Py,size:Hh,subset:Zh,typed:cd}),Cg=wp({compare:ny,compareNatural:Py,matrix:kh,typed:cd}),_g=Pr({Index:gg,matrix:kh,range:eg,typed:cd}),Tg=Mp({Index:gg,typed:cd}),Bg=Sp({abs:pd,addScalar:yd,det:fg,divideScalar:cy,identity:Vy,matrix:kh,multiply:Xy,typed:cd,unaryMinus:Bh}),zg=Ap({Complex:Rm,add:Iy,ctranspose:sy,deepEqual:jy,divideScalar:cy,dot:$y,dotDivide:ly,equal:fy,inv:Bg,matrix:kh,multiply:Xy,typed:cd}),qg=Op({Complex:Rm,config:a,fraction:Dh,identity:Vy,inv:Bg,matrix:kh,multiply:Xy,number:eh,typed:cd}),Dg=_p({DenseMatrix:nd,Index:gg,compareNatural:Py,size:Hh,subset:Zh,typed:cd}),Ig=Bp({Index:gg,compareNatural:Py,size:Hh,subset:Zh,typed:cd}),kg=zp({FibonacciHeap:dg,addScalar:yd,equalScalar:qd}),Rg=Dp({abs:pd,add:Iy,identity:Vy,inv:Bg,max:wg,multiply:Xy,size:Hh,sqrt:_h,subtract:Wh,typed:cd}),Ug=Rp({BigNumber:km,Complex:Rm,Fraction:jm,abs:pd,addScalar:yd,config:a,divideScalar:cy,equal:fy,fix:hg,format:Pd,isNumeric:Ih,multiplyScalar:Xd,number:eh,pow:qg,round:Ty,subtract:Wh}),Pg=In({BigNumber:km,Unit:Ug,config:a}),Fg=yi({BigNumber:km,Unit:Ug,config:a}),jg=ii({BigNumber:km,Unit:Ug,config:a}),Lg=Un({BigNumber:km,Unit:Ug,config:a}),$g=oi({BigNumber:km,Unit:Ug,config:a}),Hg=Pn({BigNumber:km,Unit:Ug,config:a}),Gg=Pp({Unit:Ug,typed:cd}),Vg=Qn({BigNumber:km,Unit:Ug,config:a}),Zg=jp({DenseMatrix:nd,equalScalar:qd,matrix:kh,pow:qg,typed:cd}),Wg=Dn({BigNumber:km,Unit:Ug,config:a}),Jg=Rn({BigNumber:km,Unit:Ug,config:a}),Yg=$p({abs:pd,add:Iy,identity:Vy,inv:Bg,multiply:Xy,typed:cd}),Qg=si({BigNumber:km,Unit:Ug,config:a}),Xg=ui({BigNumber:km,Unit:Ug,config:a}),Kg=Gp({BigNumber:km,Complex:Rm,config:a,multiplyScalar:Xd,pow:qg,typed:cd}),ev=Tn({BigNumber:km,Unit:Ug,config:a}),tv=Jn({BigNumber:km,Unit:Ug,config:a}),rv=$n({BigNumber:km,Unit:Ug,config:a}),nv=ci({BigNumber:km,Unit:Ug,config:a}),iv=qn({BigNumber:km,Unit:Ug,config:a}),av=gi({BigNumber:km,Unit:Ug,config:a}),ov=fi({BigNumber:km,Unit:Ug,config:a}),sv=Xn({BigNumber:km,Unit:Ug,config:a}),uv=Ln({BigNumber:km,Unit:Ug,config:a}),cv=Mi({BigNumber:km,Unit:Ug,config:a}),lv=bi({BigNumber:km,Unit:Ug,config:a}),fv=Si({BigNumber:km,Unit:Ug,config:a}),pv=Yn({BigNumber:km,Unit:Ug,config:a}),mv=zn({BigNumber:km,Unit:Ug,config:a}),dv=ei({BigNumber:km,Unit:Ug,config:a}
1),hv=Zp({DenseMatrix:nd,Index:gg,compareNatural:Py,size:Hh,subset:Zh,typed:cd}),yv=_n({BigNumber:km,Unit:Ug,config:a}),gv=hi({BigNumber:km,Unit:Ug,config:a}),vv=ti({BigNumber:km,Unit:Ug,config:a}),xv=ai({BigNumber:km,Unit:Ug,config:a}),bv=Hn({BigNumber:km,Unit:Ug,config:a}),wv=kn({BigNumber:km,Unit:Ug,config:a}),Nv=Wp({divideScalar:cy,equalScalar:qd,inv:Bg,matrix:kh,multiply:Xy,typed:cd}),Mv=Vn({BigNumber:km,Unit:Ug,config:a}),Sv=Yp({gamma:Kg,typed:cd}),Ev=xi({BigNumber:km,Unit:Ug,config:a}),Av=Fn({BigNumber:km,Unit:Ug,config:a}),Ov=Qp({DenseMatrix:nd,Spa:kg,SparseMatrix:ch,abs:pd,addScalar:yd,divideScalar:cy,equalScalar:qd,larger:Wy,matrix:kh,multiplyScalar:Xd,subtract:Wh,typed:cd,unaryMinus:Bh}),Cv=jn({BigNumber:km,Unit:Ug,config:a}),_v=vi({BigNumber:km,Unit:Ug,config:a}),Tv=Kp({add:Iy,divide:Nv,factorial:Sv,isInteger:$d,isPositive:Gd,multiply:Xy,typed:cd}),Bv=tm({factorial:Sv,typed:cd}),zv=wi({BigNumber:km,Unit:Ug,config:a}),qv=Kn({BigNumber:km,Unit:Ug,config:a}),Dv=di({BigNumber:km,Unit:Ug,config:a}),Iv=im({bignumber:Nd,addScalar:yd,combinations:Ad,divideScalar:cy,factorial:Sv,isInteger:$d,isNegative:Hd,larger:Wy,multiplyScalar:Xd,number:eh,pow:qg,subtract:Wh,typed:cd}),kv=om({Unit:Ug,typed:cd}),Rv=um({addScalar:yd,isInteger:$d,isNegative:Hd,stirlingS2:Iv,typed:cd}),Uv=cm({abs:pd,add:Iy,addScalar:yd,atan:bd,bignumber:Nd,column:_g,complex:Od,config:a,cos:wh,diag:uy,divideScalar:cy,dot:$y,equal:fy,flatten:my,im:Ld,inv:Bg,larger:Wy,matrix:kh,matrixFromColumns:Ny,multiply:Xy,multiplyScalar:Xd,number:eh,qr:Ky,re:ah,sin:uh,smaller:Gh,sqrt:_h,subtract:Wh,typed:cd,usolve:qy,usolveAll:og}),Pv=Zn({BigNumber:km,Unit:Ug,config:a}),Fv=$r({add:Iy,divide:Nv,typed:cd}),jv=pi({BigNumber:km,Unit:Ug,config:a}),Lv=Bn({BigNumber:km,Unit:Ug,config:a}),$v=fm({Index:gg,concat:ay,setDifference:Dg,size:Hh,subset:Zh,typed:cd}),Hv=Gn({BigNumber:km,Unit:Ug,config:a}),Gv=hm({DenseMatrix:nd,lsolve:wy,lup:Ov,matrix:kh,slu:ng,typed:cd,usolve:qy}),Vv=vm({add:Iy,compare:ny,divide:Nv,partitionSelect:Oy,typed:cd}),Zv=wm({Index:gg,concat:ay,setIntersect:hv,setSymDifference:$v,size:Hh,subset:Zh,typed:cd}),Wv=Zr({add:Iy,apply:gh,divide:Nv,isNaN:Mh,multiply:Xy,subtract:Wh,typed:cd}),Jv=Sm({divide:Nv,dotDivide:ly,isNumeric:Ih,log:Jy,matrix:kh,multiply:Xy,sum:ig,typed:cd}),Yv=Om({abs:pd,add:Iy,conj:Cd,ctranspose:sy,eigs:Uv,equalScalar:qd,larger:Wy,matrix:kh,multiply:Xy,pow:qg,smaller:Gh,sqrt:_h,typed:cd}),Qv=Ni({BigNumber:km,Unit:Ug,config:a}),Xv=Tm({BigNumber:km,DenseMatrix:nd,SparseMatrix:ch,addScalar:yd,config:a,cos:wh,matrix:kh,multiplyScalar:Xd,norm:Yv,sin:uh,typed:cd,unaryMinus:Bh}),Kv=li({BigNumber:km,Unit:Ug,config:a}),ex=Yr({sqrt:_h,typed:cd,variance:Wv}),tx=zm({abs:pd,map:Qd,median:Vv,subtract:Wh,typed:cd}),rx=Im({multiply:Xy,rotationMatrix:Xv,typed:cd}),nx={},ix={},ax={},ox=$({math:nx}),sx=ne({mathWithTransform:ix}),ux=ie({Node:sx}),cx=Fe({Node:sx}),lx=je({Node:sx}),fx=Le({Node:sx}),px=$e({Node:sx}),mx=He({Node:sx,ResultSet:Qm}),dx=Ge({Node:sx}),hx=Ve({Node:sx}),yx=Ze({Node:sx}),gx=We({classes:ax}),vx=Ye({Chain:ox,typed:cd}),xx=Qe({Node:sx,typed:cd}),bx=et({Node:sx,subset:Zh}),wx=tt({matrix:kh,Node:sx,subset:Zh}),Nx=rt({Node:sx,size:Hh}),Mx=nt({Unit:Ug,Node:sx,math:nx}),Sx=at({Node:sx,SymbolNode:Mx,math:nx}),Ex=dt({AccessorNode:bx,ArrayNode:px,AssignmentNode:wx,BlockNode:mx,ConditionalNode:dx,ConstantNode:hx,FunctionAssignmentNode:xx,FunctionNode:Sx,IndexNode:Nx,ObjectNode:ux,OperatorNode:cx,ParenthesisNode:lx,RangeNode:yx,RelationalNode:fx,SymbolNode:Mx,config:a,numeric:Fh,typed:cd}),Ax=ht({ConstantNode:hx,FunctionNode:Sx,OperatorNode:cx,ParenthesisNode:lx,parse:Ex}),Ox=wt({AccessorNode:bx,ArrayNode:px,ConstantNode:hx,FunctionNode:Sx,IndexNode:Nx,ObjectNode:ux,OperatorNode:cx,ParenthesisNode:lx,SymbolNode:Mx,add:Iy,divide:Nv,equal:fy,isZero:Vd,multiply:Xy,pow:qg,subtract:Wh}),Cx=Mt({parse:Ex,typed:cd}),_x=St({parse:Ex}),Tx=At({parse:Ex,typed:cd}),Bx=Bt({bignumber:Nd,fraction:Dh,AccessorNode:bx,ArrayNode:px,ConstantNode:hx,FunctionNode:Sx,IndexNode:Nx,ObjectNode:ux,OperatorNode:cx,ParenthesisNode:lx,SymbolNode:Mx,add:Iy,config:a,divide:Nv,equal:fy,isZero:Vd,mathWithTransform:ix,matrix:kh,multiply:Xy,parse:Ex,pow:qg,resolve:Ax,simplifyCore:Ox,subtract:Wh,typed:cd}),zx=qt({OperatorNode:cx,parse:Ex,simplify:Bx,typed:cd}),qx=It({parse:Ex,typed:cd}),Dx=Ft({Help:_x,mathWithTransform:ix,typed:cd}),Ix=jt({evaluate:qx}),kx=$t({bignumber:Nd,fraction:Dh,AccessorNode:bx,ArrayNode:px,ConstantNode:hx,FunctionNode:Sx,IndexNode:Nx,ObjectNode:ux,OperatorNode:cx,ParenthesisNode:lx,SymbolNode:Mx,add:Iy,config:a,divide:Nv,equal:fy,isZero:Vd,mathWithTransform:ix,matrix:kh,multiply:Xy,parse:Ex,pow:qg,simplify:Bx,simplifyCore:Ox,subtract:Wh,typed:cd}),Rx=Ht({ConstantNode:hx,FunctionNode:Sx,OperatorNode:cx,ParenthesisNode:lx,SymbolNode:Mx,config:a,equal:fy,isZero:Vd,numeric:Fh,parse:Ex,simplify:Bx,typed:cd}),Ux=Vt({Parser:Ix,typed:cd});n(nx,{e:Um,false:Pm,fineStructure:Fm,i:Lm,Infinity:$m,LN10:Hm,LOG10E:Gm,NaN:Zm,null:Wm,phi:Jm,SQRT1_2:Xm,sackurTetrode:Km,tau:ed,true:td,E:Um,version:rd,efimovFactor:id,LN2:ad,pi:od,replacer:sd,reviver:gx,SQRT2:ud,typed:cd,unaryPlus:ld,PI:od,weakMixingAngle:fd,abs:pd,acos:md,acot:dd,acsc:hd,addScalar:yd,arg:gd,asech:vd,asinh:xd,atan:bd,atanh:wd,bignumber:Nd,bitNot:Md,boolean:Sd,chain:vx,clone:Ed,combinations:Ad,complex:Od,conj:Cd,cosh:_d,coth:Td,csc:Bd,cube:zd,equalScalar:qd,erf:Dd,exp:Id,expm1:kd,filter:Rd,forEac
1h:Ud,format:Pd,getMatrixDataType:Fd,hex:jd,im:Ld,isInteger:$d,isNegative:Hd,isPositive:Gd,isZero:Vd,LOG2E:Zd,lgamma:Wd,log10:Jd,log2:Yd,map:Qd,multiplyScalar:Xd,not:Kd,number:eh,oct:th,pickRandom:rh,print:nh,random:ih,re:ah,sec:oh,sign:sh,sin:uh,splitUnit:lh,square:fh,string:ph,tan:mh,typeOf:dh,acosh:hh,acsch:yh,apply:gh,asec:vh,bin:xh,combinationsWithRep:bh,cos:wh,csch:Nh,isNaN:Mh,isPrime:Sh,randomInt:Eh,sech:Ah,sinh:Oh,sparse:Ch,sqrt:_h,tanh:Th,unaryMinus:Bh,acoth:zh,cot:qh,fraction:Dh,isNumeric:Ih,matrix:kh,matrixFromFunction:Rh,mod:Uh,nthRoot:Ph,numeric:Fh,or:jh,prod:Lh,reshape:$h,size:Hh,smaller:Gh,squeeze:Vh,subset:Zh,subtract:Wh,to:Jh,transpose:Yh,xgcd:Qh,zeros:Xh,and:Kh,bitAnd:ey,bitXor:ty,cbrt:ry,compare:ny,compareText:iy,concat:ay,count:oy,ctranspose:sy,diag:uy,divideScalar:cy,dotDivide:ly,equal:fy,fft:py,flatten:my,gcd:dy,hasNumericValue:hy,hypot:yy,ifft:gy,kron:vy,largerEq:xy,leftShift:by,lsolve:wy,matrixFromColumns:Ny,min:My,mode:Sy,nthRoots:Ey,ones:Ay,partitionSelect:Oy,resize:Cy,rightArithShift:_y,round:Ty,smallerEq:By,unequal:zy,usolve:qy,xor:Dy,add:Iy,atan2:ky,bitOr:Ry,catalan:Uy,compareNatural:Py,cumsum:Fy,deepEqual:jy,diff:Ly,dot:$y,equalText:Hy,floor:Gy,identity:Vy,invmod:Zy,larger:Wy,log:Jy,lsolveAll:Yy,matrixFromRows:Qy,multiply:Xy,qr:Ky,range:eg,rightLogShift:tg,setSize:rg,slu:ng,sum:ig,trace:ag,usolveAll:og,asin:sg,ceil:ug,composition:cg,cross:lg,det:fg,distance:pg,dotMultiply:mg,fix:hg,intersect:vg,lcm:xg,log1p:bg,max:wg,quantileSeq:Ng,row:Mg,setCartesian:Sg,setDistinct:Eg,setIsSubset:Ag,setPowerset:Og,sort:Cg,column:_g,index:Tg,inv:Bg,pinv:zg,pow:qg,setDifference:Dg,setMultiplicity:Ig,sqrtm:Rg,vacuumImpedance:Pg,wienDisplacement:Fg,atomicMass:jg,bohrMagneton:Lg,boltzmann:$g,conductanceQuantum:Hg,createUnit:Gg,deuteronMass:Vg,dotPow:Zg,electricConstant:Wg,elementaryCharge:Jg,expm:Yg,faraday:Qg,firstRadiation:Xg,gamma:Kg,gravitationConstant:ev,hartreeEnergy:tv,klitzing:rv,loschmidt:nv,magneticConstant:iv,molarMass:av,molarPlanckConstant:ov,neutronMass:sv,nuclearMagneton:uv,planckCharge:cv,planckLength:lv,planckTemperature:fv,protonMass:pv,reducedPlanckConstant:mv,rydberg:dv,setIntersect:hv,speedOfLight:yv,stefanBoltzmann:gv,thomsonCrossSection:vv,avogadro:xv,bohrRadius:bv,coulomb:wv,divide:Nv,electronMass:Mv,factorial:Sv,gravity:Ev,inverseConductanceQuantum:Av,lup:Ov,magneticFluxQuantum:Cv,molarMassC12:_v,multinomial:Tv,parse:Ex,permutations:Bv,planckMass:zv,quantumOfCirculation:qv,resolve:Ax,secondRadiation:Dv,simplifyCore:Ox,stirlingS2:Iv,unit:kv,bellNumbers:Rv,compile:Cx,eigs:Uv,fermiCoupling:Pv,leafCount:Tx,mean:Fv,molarVolume:jv,planckConstant:Lv,setSymDifference:$v,simplify:Bx,symbolicEqual:zx,classicalElectronRadius:Hv,evaluate:qx,help:Dx,lusolve:Gv,median:Vv,rationalize:kx,setUnion:Zv,variance:Wv,derivative:Rx,kldivergence:Jv,norm:Yv,planckTime:Qv,rotationMatrix:Xv,gasConstant:Kv,parser:Ux,std:ex,mad:tx,rotate:rx,config:a}),n(ix,nx,{filter:Qt({typed:cd}),forEach:Kt({typed:cd}),map:er({typed:cd}),apply:ar({isInteger:$d,typed:cd}),diff:lr({bignumber:Nd,matrix:kh,number:eh,subtract:Wh,typed:cd}),subset:gr({matrix:kh,typed:cd}),concat:wr({isInteger:$d,matrix:kh,typed:cd}),max:Sr({config:a,larger:Wy,numeric:Fh,typed:cd}),min:Ar({config:a,numeric:Fh,smaller:Gh,typed:cd}),range:_r({bignumber:Nd,matrix:kh,config:a,larger:Wy,largerEq:xy,smaller:Gh,smallerEq:By,typed:cd}),sum:Br({add:Iy,config:a,numeric:Fh,typed:cd}),cumsum:Ir({add:Iy,typed:cd,unaryPlus:ld}),row:Rr({Index:gg,matrix:kh,range:eg,typed:cd}),column:Fr({Index:gg,matrix:kh,range:eg,typed:cd}),index:jr({Index:gg}),mean:Hr({add:Iy,divide:Nv,typed:cd}),variance:Jr({add:Iy,apply:gh,divide:Nv,isNaN:Mh,multiply:Xy,subtract:Wh,typed:cd}),std:Qr({sqrt:_h,typed:cd,variance:Wv})}),n(ax,{BigNumber:km,Chain:ox,Complex:Rm,Fraction:jm,Matrix:Vm,Node:sx,ObjectNode:ux,OperatorNode:cx,ParenthesisNode:lx,Range:Ym,RelationalNode:fx,ResultSet:Qm,ArrayNode:px,BlockNode:mx,ConditionalNode:dx,ConstantNode:hx,DenseMatrix:nd,RangeNode:yx,FunctionAssignmentNode:xx,SparseMatrix:ch,AccessorNode:bx,AssignmentNode:wx,IndexNode:Nx,FibonacciHeap:dg,ImmutableDenseMatrix:yg,Index:gg,Spa:kg,Unit:Ug,SymbolNode:Mx,FunctionNode:Sx,Help:_x,Parser:Ix}),ox.createProxy(nx)},14943(e,t,r){function n(e){return"number"==typeof e}function i(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 a(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function o(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function s(e){return e&&!0===e.constructor.prototype.isUnit||!1}function u(e){return"string"==typeof e}r.d(t,{$$:()=>k,$I:()=>q,$P:()=>b,AF:()=>m,AS:()=>E,BA:()=>T,C4:()=>i,CD:()=>C,Et:()=>n,GJ:()=>I,Gv:()=>N,Kg:()=>u,Ll:()=>D,Lm:()=>y,OA:()=>l,P3:()=>f,PO:()=>_,Px:()=>z,QP:()=>j,Tn:()=>x,Ye:()=>U,Zd:()=>a,_Z:()=>d,b0:()=>S,cy:()=>c,eW:()=>g,fU:()=>o,gO:()=>A,gS:()=>v,gd:()=>w,kZ:()=>M,li:()=>P,m2:()=>B,nw:()=>h,o_:()=>F,qM:()=>O,tv:()=>R,vO:()=>s,zR:()=>p});var c=Array.isArray;function l(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function f(e){return Array.isArray(e)||l(e)}function p(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 d(e){return e&&!0===e.constructor.prototype.isRange||!1}function h(e){return e&&!0===e.constructor.prototype.isIndex||!1}function y(e){return"boolean"==typeof e}function g(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function v(e){return e&&!0===e.constructor.prototype.isHelp||!1}function x(e){return"function"==typeof e}function b(e){return e instanceof Date}function w(e){return e instanceof RegExp}function N(e){return!(!e||"object"!=typeof e||e.constructor!==Object||a(e)||o(e))}function M(e){return null===e}function S(e){return void 0===e}function E(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function A(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function O(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function C(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function _(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function T(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function B(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function z(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function q(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function D(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function I(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 R(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function U(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function P(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function F(e){return e&&!0===e.constructor.prototype.isChain||!1}function j(e){var t=typeof e;return"object"===t?null===e?"null":Array.isArray(e)?"Array":e instanceof Date?"Date":e instanceof RegExp?"RegExp":i(e)?"BigNumber":a(e)?"Complex":o(e)?"Fraction":l(e)?"Matrix":s(e)?"Unit":h(e)?"Index":d(e)?"Range":g(e)?"ResultSet":D(e)?e.type:F(e)?"Chain":v(e)?"Help":"Object":"function"===t?"Function":t}}}]);
2//# sourceMappingURL=mathjs.4fc0f0ece1d6c90d990a.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.