=1&&C[s]++,2===S.jleaf&&C[S.q]--}-1!==n[s]&&(y[0+s]=n[s])}for(s=0;s{var{add:t,multiply:n,transpose:r}=e,a=createCsAmd({add:t,multiply:n,transpose:r}),i=createCsCounts({transpose:r});return function(e,t,n){var r,s=t._ptr,o=t._size[1],l={};if(l.q=a(e,t),e&&!l.q)return null;if(n){var u=e?csPermute(t,null,l.q,0):t;l.parent=csEtree(u,1);var c=csPost(l.parent,o);if(l.cp=i(u,l.parent,c,1),u&&l.parent&&l.cp&&function(e,t){var n=e._ptr,r=e._index,a=e._size,i=a[0],s=a[1];t.pinv=[],t.leftmost=[];var o,l,u,c,p,d=t.parent,m=t.pinv,h=t.leftmost,f=[],y=i,g=i+s,b=i+2*s;for(l=0;l=0;l--)for(c=n[l],p=n[l+1],u=c;u=0;o--)m[o]=-1,-1!==(l=h[o])&&(0==f[b+l]++&&(f[g+l]=o),f[0+o]=f[y+l],f[y+l]=o);for(t.lnz=0,t.m2=i,l=0;l=0;){e=r[p];var d=a?a[e]:e;csMarked(u,e)||(csMark(u,e),r[c+p]=d<0?0:csUnflip(u[d]));var m=1;for(s=r[c+p],o=d<0?0:csUnflip(u[d+1]);s{var{divideScalar:t,multiply:n,subtract:r}=e;return function(e,a,i,s,o,l,u){var c,p,d,m,h=e._values,f=e._index,y=e._ptr,g=e._size[1],b=a._values,v=a._index,N=a._ptr,T=csReach(e,a,i,s,l);for(c=T;c{var{abs:t,divideScalar:n,multiply:r,subtract:a,larger:i,largerEq:s,SparseMatrix:o}=e,l=createCsSpsolve({divideScalar:n,multiply:r,subtract:a});return function(e,a,u){if(!e)return null;var c,p=e._size[1],d=100,m=100;a&&(c=a.q,d=a.lnz||d,m=a.unz||m);var h,f,y=[],g=[],b=[],v=new o({values:y,index:g,ptr:b,size:[p,p]}),N=[],T=[],C=[],A=new o({values:N,index:T,ptr:C,size:[p,p]}),V=[],x=[],S=[];for(h=0;h{var{typed:t,abs:n,add:r,multiply:a,transpose:i,divideScalar:s,subtract:o,larger:l,largerEq:u,SparseMatrix:c}=e,p=createCsSqr({add:r,multiply:a,transpose:i}),d=createCsLu({abs:n,divideScalar:s,multiply:a,subtract:o,larger:l,largerEq:u,SparseMatrix:c});return t(name$12,{"SparseMatrix, number, number":function(e,t,n){if(!isInteger$1(t)||t<0||t>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(n<0||n>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var r=p(t,e,!1),a=d(e,r,n);return{L:a.L,U:a.U,p:a.pinv,q:r.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}})}));function csIpvec(e,t){var n,r=t.length,a=[];if(e)for(n=0;n{var{typed:t,matrix:n,lup:r,slu:a,usolve:i,lsolve:s,DenseMatrix:o}=e,l=createSolveValidation({DenseMatrix:o});return t(name$11,{"Array, Array | Matrix":function(e,t){e=n(e);var a=r(e);return c(a.L,a.U,a.p,null,t).valueOf()},"DenseMatrix, Array | Matrix":function(e,t){var n=r(e);return c(n.L,n.U,n.p,null,t)},"SparseMatrix, Array | Matrix":function(e,t){var n=r(e);return c(n.L,n.U,n.p,null,t)},"SparseMatrix, Array | Matrix, number, number":function(e,t,n,r){var i=a(e,n,r);return c(i.L,i.U,i.p,i.q,t)},"Object, Array | Matrix":function(e,t){return c(e.L,e.U,e.p,e.q,t)}});function u(e){if(isMatrix(e))return e;if(isArray$1(e))return n(e);throw new TypeError("Invalid Matrix LU decomposition")}function c(e,t,n,r,a){e=u(e),t=u(t),n&&((a=l(e,a,!0))._data=csIpvec(n,a._data));var o=s(e,a),c=i(t,o);return r&&(c._data=csIpvec(r,c._data)),c}})),name$10="Help",dependencies$10=["parse"],createHelpClass=factory(name$10,dependencies$10,(e=>{var{parse:t}=e;function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!e)throw new Error('Argument "doc" missing');this.doc=e}return n.prototype.type="Help",n.prototype.isHelp=!0,n.prototype.toString=function(){var e=this.doc||{},n="\n";if(e.name&&(n+="Name: "+e.name+"\n\n"),e.category&&(n+="Category: "+e.category+"\n\n"),e.description&&(n+="Description:\n "+e.description+"\n\n"),e.syntax&&(n+="Syntax:\n "+e.syntax.join("\n ")+"\n\n"),e.examples){n+="Examples:\n";for(var r={},a=0;a"mathjs"!==e)).forEach((n=>{t[n]=e[n]})),new n(t)},n.prototype.valueOf=n.prototype.toString,n}),{isClass:!0}),name$$="Chain",dependencies$$=["?on","math"],createChainClass=factory(name$$,dependencies$$,(e=>{var{on:t,math:n}=e;function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");isChain(e)?this.value=e.value:this.value=e}function a(e,t){lazy(r.prototype,e,(function(){var e=t();if("function"==typeof e)return i(e)}))}function i(e){return function(){for(var t=[this.value],n=0;ne[t]))};for(var o in e)n(o)}};var s={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return r.createProxy(n),t&&t("import",(function(e,t,n){n||a(e,t)})),r}),{isClass:!0}),eDocs={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"]},falseDocs={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]},iDocs={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:[]},InfinityDocs={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:[]},LN10Docs={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]},LN2Docs={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]},LOG10EDocs={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:[]},LOG2EDocs={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:[]},NaNDocs={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]},nullDocs={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]},phiDocs={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:[]},piDocs={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"]},SQRT12Docs={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:[]},SQRT2Docs={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]},tauDocs={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"]},trueDocs={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]},versionDocs={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]},bignumberDocs={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"]},booleanDocs={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"]},complexDocs={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"]},createUnitDocs={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"]},fractionDocs={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"]},indexDocs={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"]},matrixDocs={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"]},numberDocs={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"]},sparseDocs={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"]},splitUnitDocs={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"]},stringDocs={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"]},unitDocs={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"]},configDocs={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:[]},importDocs={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:[]},typedDocs={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:[]},derivativeDocs={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"]},leafCountDocs={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"]},lsolveDocs={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"]},lsolveAllDocs={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"]},lupDocs={name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2, 1], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]},lusolveDocs={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"]},qrDocs={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"]},rationalizeDocs={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"]},resolveDocs={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"]},simplifyDocs={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"]},simplifyCoreDocs={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"]},sluDocs={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"]},symbolicEqualDocs={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"]},usolveDocs={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"]},usolveAllDocs={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"]},absDocs={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]},addDocs={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"]},cbrtDocs={name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]},ceilDocs={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"]},cubeDocs={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"]},divideDocs={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"]},dotDivideDocs={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"]},dotMultiplyDocs={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"]},dotPowDocs={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"]},expDocs={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"]},expmDocs={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"]},expm1Docs={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"]},fixDocs={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"]},floorDocs={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"]},gcdDocs={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"]},hypotDocs={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"]},invmodDocs={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"]},lcmDocs={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"]},logDocs={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"]},log10Docs={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"]},log1pDocs={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"]},log2Docs={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"]},modDocs={name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]},multiplyDocs={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"]},normDocs={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")']},nthRootDocs={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"]},nthRootsDocs={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"]},powDocs={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"]},roundDocs={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"]},signDocs={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"]},sqrtDocs={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"]},sqrtmDocs={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"]},squareDocs={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"]},subtractDocs={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"]},unaryMinusDocs={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"]},unaryPlusDocs={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]},xgcdDocs={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"]},bitAndDocs={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"]},bitNotDocs={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"]},bitOrDocs={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"]},bitXorDocs={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"]},leftShiftDocs={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"]},rightArithShiftDocs={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"]},rightLogShiftDocs={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"]},bellNumbersDocs={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"]},catalanDocs={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"]},compositionDocs={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"]},stirlingS2Docs={name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers"]},argDocs={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"]},conjDocs={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"]},imDocs={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"]},reDocs={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"]},evaluateDocs={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:[]},helpDocs={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]},distanceDocs={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:[]},intersectDocs={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:[]},andDocs={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"]},notDocs={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"]},orDocs={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"]},xorDocs={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"]},columnDocs={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"]},concatDocs={name:"concat",category:"Matrix",syntax:["concat(A, B, C, ...)","concat(A, B, C, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},countDocs={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"]},crossDocs={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"]},ctransposeDocs={name:"ctranspose",category:"Matrix",syntax:["x'","ctranspose(x)"],description:"Complex Conjugate and Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","ctranspose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]},detDocs={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"]},diagDocs={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"]},diffDocs={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"]},dotDocs={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"]},eigsDocs={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"]},filterDocs={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"]},flattenDocs={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"]},forEachDocs={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"]},getMatrixDataTypeDocs={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"]},identityDocs={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"]},invDocs={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"]},pinvDocs={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"]},kronDocs={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"]},mapDocs={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"]},matrixFromColumnsDocs={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"]},matrixFromFunctionDocs={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)"],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"]},matrixFromRowsDocs={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"]},onesDocs={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"]},partitionSelectDocs={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"]},rangeDocs={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","ones","size","squeeze","subset","trace","transpose","zeros"]},reshapeDocs={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"]},resizeDocs={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"]},rotateDocs={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"]},rotationMatrixDocs={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"]},rowDocs={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"]},sizeDocs={name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","count","det","diag","identity","inv","ones","range","squeeze","subset","trace","transpose","zeros"]},sortDocs={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"]},squeezeDocs={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"]},subsetDocs={name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation `l:u`. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]","f[[1,2], [1,3]] = [9, 10; 11, 12]","f"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","trace","transpose","zeros"]},traceDocs={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"]},transposeDocs={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"]},zerosDocs={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"]},fftDocs={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]},ifftDocs={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]},combinationsDocs={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"]},combinationsWithRepDocs={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"]},factorialDocs={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"]},gammaDocs={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"]},lgammaDocs={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"]},kldivergenceDocs={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:[]},multinomialDocs={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"]},permutationsDocs={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"]},pickRandomDocs={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"]},randomDocs={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"]},randomIntDocs={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"]},compareDocs={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"]},compareNaturalDocs={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"]},compareTextDocs={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"]},deepEqualDocs={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"]},equalDocs={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"]},equalTextDocs={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"]},largerDocs={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"]},largerEqDocs={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"]},smallerDocs={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"]},smallerEqDocs={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"]},unequalDocs={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"]},setCartesianDocs={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"]},setDifferenceDocs={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"]},setDistinctDocs={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"]},setIntersectDocs={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"]},setIsSubsetDocs={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"]},setMultiplicityDocs={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"]},setPowersetDocs={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"]},setSizeDocs={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"]},setSymDifferenceDocs={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"]},setUnionDocs={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"]},erfDocs={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:[]},madDocs={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"]},maxDocs={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"]},meanDocs={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"]},medianDocs={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"]},minDocs={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"]},modeDocs={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"]},prodDocs={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"]},quantileSeqDocs={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"]},stdDocs={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"]},cumSumDocs={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"]},sumDocs={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"]},varianceDocs={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"]},acosDocs={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"]},acoshDocs={name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]},acotDocs={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"]},acothDocs={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"]},acscDocs={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"]},acschDocs={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"]},asecDocs={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"]},asechDocs={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]},asinDocs={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"]},asinhDocs={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"]},atanDocs={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"]},atan2Docs={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"]},atanhDocs={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"]},cosDocs={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"]},coshDocs={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]},cotDocs={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"]},cothDocs={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"]},cscDocs={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"]},cschDocs={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"]},secDocs={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"]},sechDocs={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"]},sinDocs={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"]},sinhDocs={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]},tanDocs={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"]},tanhDocs={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"]},toDocs={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:[]},binDocs={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]},cloneDocs={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:[]},formatDocs={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"]},hasNumericValueDocs={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"]},hexDocs={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]},isIntegerDocs={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"]},isNaNDocs={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"]},isNegativeDocs={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"]},isNumericDocs={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"]},isPositiveDocs={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"]},isPrimeDocs={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"]},isZeroDocs={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"]},numericDocs={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"]},octDocs={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]},printDocs={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"]},typeOfDocs={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"]},embeddedDocs={bignumber:bignumberDocs,boolean:booleanDocs,complex:complexDocs,createUnit:createUnitDocs,fraction:fractionDocs,index:indexDocs,matrix:matrixDocs,number:numberDocs,sparse:sparseDocs,splitUnit:splitUnitDocs,string:stringDocs,unit:unitDocs,e:eDocs,E:eDocs,false:falseDocs,i:iDocs,Infinity:InfinityDocs,LN2:LN2Docs,LN10:LN10Docs,LOG2E:LOG2EDocs,LOG10E:LOG10EDocs,NaN:NaNDocs,null:nullDocs,pi:piDocs,PI:piDocs,phi:phiDocs,SQRT1_2:SQRT12Docs,SQRT2:SQRT2Docs,tau:tauDocs,true:trueDocs,version:versionDocs,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:derivativeDocs,lsolve:lsolveDocs,lsolveAll:lsolveAllDocs,lup:lupDocs,lusolve:lusolveDocs,leafCount:leafCountDocs,resolve:resolveDocs,simplify:simplifyDocs,simplifyCore:simplifyCoreDocs,symbolicEqual:symbolicEqualDocs,rationalize:rationalizeDocs,slu:sluDocs,usolve:usolveDocs,usolveAll:usolveAllDocs,qr:qrDocs,abs:absDocs,add:addDocs,cbrt:cbrtDocs,ceil:ceilDocs,cube:cubeDocs,divide:divideDocs,dotDivide:dotDivideDocs,dotMultiply:dotMultiplyDocs,dotPow:dotPowDocs,exp:expDocs,expm:expmDocs,expm1:expm1Docs,fix:fixDocs,floor:floorDocs,gcd:gcdDocs,hypot:hypotDocs,lcm:lcmDocs,log:logDocs,log2:log2Docs,log1p:log1pDocs,log10:log10Docs,mod:modDocs,multiply:multiplyDocs,norm:normDocs,nthRoot:nthRootDocs,nthRoots:nthRootsDocs,pow:powDocs,round:roundDocs,sign:signDocs,sqrt:sqrtDocs,sqrtm:sqrtmDocs,square:squareDocs,subtract:subtractDocs,unaryMinus:unaryMinusDocs,unaryPlus:unaryPlusDocs,xgcd:xgcdDocs,invmod:invmodDocs,bitAnd:bitAndDocs,bitNot:bitNotDocs,bitOr:bitOrDocs,bitXor:bitXorDocs,leftShift:leftShiftDocs,rightArithShift:rightArithShiftDocs,rightLogShift:rightLogShiftDocs,bellNumbers:bellNumbersDocs,catalan:catalanDocs,composition:compositionDocs,stirlingS2:stirlingS2Docs,config:configDocs,import:importDocs,typed:typedDocs,arg:argDocs,conj:conjDocs,re:reDocs,im:imDocs,evaluate:evaluateDocs,help:helpDocs,distance:distanceDocs,intersect:intersectDocs,and:andDocs,not:notDocs,or:orDocs,xor:xorDocs,concat:concatDocs,count:countDocs,cross:crossDocs,column:columnDocs,ctranspose:ctransposeDocs,det:detDocs,diag:diagDocs,diff:diffDocs,dot:dotDocs,getMatrixDataType:getMatrixDataTypeDocs,identity:identityDocs,filter:filterDocs,flatten:flattenDocs,forEach:forEachDocs,inv:invDocs,pinv:pinvDocs,eigs:eigsDocs,kron:kronDocs,matrixFromFunction:matrixFromFunctionDocs,matrixFromRows:matrixFromRowsDocs,matrixFromColumns:matrixFromColumnsDocs,map:mapDocs,ones:onesDocs,partitionSelect:partitionSelectDocs,range:rangeDocs,resize:resizeDocs,reshape:reshapeDocs,rotate:rotateDocs,rotationMatrix:rotationMatrixDocs,row:rowDocs,size:sizeDocs,sort:sortDocs,squeeze:squeezeDocs,subset:subsetDocs,trace:traceDocs,transpose:transposeDocs,zeros:zerosDocs,fft:fftDocs,ifft:ifftDocs,combinations:combinationsDocs,combinationsWithRep:combinationsWithRepDocs,factorial:factorialDocs,gamma:gammaDocs,kldivergence:kldivergenceDocs,lgamma:lgammaDocs,multinomial:multinomialDocs,permutations:permutationsDocs,pickRandom:pickRandomDocs,random:randomDocs,randomInt:randomIntDocs,compare:compareDocs,compareNatural:compareNaturalDocs,compareText:compareTextDocs,deepEqual:deepEqualDocs,equal:equalDocs,equalText:equalTextDocs,larger:largerDocs,largerEq:largerEqDocs,smaller:smallerDocs,smallerEq:smallerEqDocs,unequal:unequalDocs,setCartesian:setCartesianDocs,setDifference:setDifferenceDocs,setDistinct:setDistinctDocs,setIntersect:setIntersectDocs,setIsSubset:setIsSubsetDocs,setMultiplicity:setMultiplicityDocs,setPowerset:setPowersetDocs,setSize:setSizeDocs,setSymDifference:setSymDifferenceDocs,setUnion:setUnionDocs,erf:erfDocs,cumsum:cumSumDocs,mad:madDocs,max:maxDocs,mean:meanDocs,median:medianDocs,min:minDocs,mode:modeDocs,prod:prodDocs,quantileSeq:quantileSeqDocs,std:stdDocs,sum:sumDocs,variance:varianceDocs,acos:acosDocs,acosh:acoshDocs,acot:acotDocs,acoth:acothDocs,acsc:acscDocs,acsch:acschDocs,asec:asecDocs,asech:asechDocs,asin:asinDocs,asinh:asinhDocs,atan:atanDocs,atanh:atanhDocs,atan2:atan2Docs,cos:cosDocs,cosh:coshDocs,cot:cotDocs,coth:cothDocs,csc:cscDocs,csch:cschDocs,sec:secDocs,sech:sechDocs,sin:sinDocs,sinh:sinhDocs,tan:tanDocs,tanh:tanhDocs,to:toDocs,clone:cloneDocs,format:formatDocs,bin:binDocs,oct:octDocs,hex:hexDocs,isNaN:isNaNDocs,isInteger:isIntegerDocs,isNegative:isNegativeDocs,isNumeric:isNumericDocs,hasNumericValue:hasNumericValueDocs,isPositive:isPositiveDocs,isPrime:isPrimeDocs,isZero:isZeroDocs,print:printDocs,typeOf:typeOfDocs,numeric:numericDocs},name$_="help",dependencies$_=["typed","mathWithTransform","Help"],createHelp=factory(name$_,dependencies$_,(e=>{var{typed:t,mathWithTransform:n,Help:r}=e;return t(name$_,{any:function(e){var t,a=e;if("string"!=typeof e)for(t in n)if(hasOwnProperty$2(n,t)&&e===n[t]){a=t;break}var i=getSafeProperty(embeddedDocs,a);if(!i){var s="function"==typeof a?a.name:a;throw new Error('No documentation found on "'+s+'"')}return new r(i)}})})),name$Z="chain",dependencies$Z=["typed","Chain"],createChain=factory(name$Z,dependencies$Z,(e=>{var{typed:t,Chain:n}=e;return t(name$Z,{"":function(){return new n},any:function(e){return new n(e)}})})),name$Y="det",dependencies$Y=["typed","matrix","subtract","multiply","divideScalar","isZero","unaryMinus"],createDet=factory(name$Y,dependencies$Y,(e=>{var{typed:t,matrix:n,subtract:r,multiply:a,divideScalar:i,isZero:s,unaryMinus:o}=e;return t(name$Y,{any:function(e){return clone$3(e)},"Array | Matrix":function(e){var t;switch((t=isMatrix(e)?e.size():Array.isArray(e)?(e=n(e)).size():[]).length){case 0:return clone$3(e);case 1:if(1===t[0])return clone$3(e.valueOf()[0]);throw new RangeError("Matrix must be square (size: "+format$1(t)+")");case 2:var l=t[0];if(l===t[1])return function(e,t,n){if(1===t)return clone$3(e[0][0]);if(2===t)return r(a(e[0][0],e[1][1]),a(e[1][0],e[0][1]));for(var l=!1,u=new Array(t).fill(0).map(((e,t)=>t)),c=0;c{var{typed:t,matrix:n,divideScalar:r,addScalar:a,multiply:i,unaryMinus:s,det:o,identity:l,abs:u}=e;return t(name$X,{"Array | Matrix":function(e){var t=isMatrix(e)?e.size():arraySize(e);switch(t.length){case 1:if(1===t[0])return isMatrix(e)?n([r(1,e.valueOf()[0])]):[r(1,e[0])];throw new RangeError("Matrix must be square (size: "+format$1(t)+")");case 2:var a=t[0],i=t[1];if(a===i)return isMatrix(e)?n(c(e.valueOf(),a,i),e.storage()):c(e,a,i);throw new RangeError("Matrix must be square (size: "+format$1(t)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+format$1(t)+")")}},any:function(e){return r(1,e)}});function c(e,t,n){var c,p,d,m,h;if(1===t){if(0===(m=e[0][0]))throw Error("Cannot calculate inverse, determinant is zero");return[[r(1,m)]]}if(2===t){var f=o(e);if(0===f)throw Error("Cannot calculate inverse, determinant is zero");return[[r(e[1][1],f),r(s(e[0][1]),f)],[r(s(e[1][0]),f),r(e[0][0],f)]]}var y=e.concat();for(c=0;cv&&(v=u(y[c][b]),N=c),c++;if(0===v)throw Error("Cannot calculate inverse, determinant is zero");(c=N)!==b&&(h=y[b],y[b]=y[c],y[c]=h,h=g[b],g[b]=g[c],g[c]=h);var T=y[b],C=g[b];for(c=0;c{var{typed:t,matrix:n,inv:r,deepEqual:a,equal:i,dotDivide:s,dot:o,ctranspose:l,divideScalar:u,multiply:c,add:p,Complex:d}=e;return t(name$W,{"Array | Matrix":function(e){var t=isMatrix(e)?e.size():arraySize(e);switch(t.length){case 1:return f(e)?l(e):1===t[0]?r(e):s(l(e),o(e,e));case 2:if(f(e))return l(e);var a=t[0],i=t[1];if(a===i)try{return r(e)}catch(e){if(!(e instanceof Error&&e.message.match(/Cannot calculate inverse, determinant is zero/)))throw e}return isMatrix(e)?n(m(e.valueOf(),a,i),e.storage()):m(e,a,i);default:throw new RangeError("Matrix must be two dimensional (size: "+format$1(t)+")")}},any:function(e){return i(e,0)?clone$3(e):u(1,e)}});function m(e,t,n){var{C:a,F:i}=function(e,t,n){var r=function(e,t,n){for(var r=clone$3(e),a=0,i=0;ie.filter(((e,n)=>n!h(o(r[t],r[t]))));return{C:a,F:i}}(e,t,n),u=c(r(c(l(a),a)),l(a)),d=c(l(i),r(c(i,l(i))));return c(d,u)}function h(e){return i(p(e,d(1,1)),p(0,d(1,1)))}function f(e){return a(p(e,d(1,1)),p(c(e,0),d(1,1)))}}));function createComplexEigs(e){var{addScalar:t,subtract:n,flatten:r,multiply:a,multiplyScalar:i,divideScalar:s,sqrt:o,abs:l,bignumber:u,diag:c,inv:p,qr:d,usolve:m,usolveAll:h,equal:f,complex:y,larger:g,smaller:b,matrixFromColumns:v,dot:N}=e;function T(e,r,a,s){var l=t(e,s),u=n(i(e,s),i(r,a)),c=i(l,.5),p=i(o(n(i(l,l),i(4,u))),.5);return[t(c,p),n(c,p)]}function C(e,t,r,a,i,s,o,c){var p="BigNumber"===c,d="Complex"===c,m=p?u(0):d?y(0):0,h=p?u(1):d?y(1):1;if(b(l(r),o))return[[h,m],[m,h]];if(g(l(n(i,s)),o))return[[n(i,a),n(s,a)],[r,r]];var f=n(e,i),v=n(t,i),N=n(r,i),T=n(a,i);return b(l(v),o)?[[f,h],[N,m]]:[[v,m],[T,h]]}function A(e,t){for(var n=0;n=5)return null;for(o=0;;){var l=m(e,i);if(b(E(w(i,[l])),r))break;if(++o>=10)return null;i=D(l)}return i}function S(e,t,n){var r="BigNumber"===n,a="Complex"===n,i=Array(e).fill(0).map((e=>2*Math.random()-1));return r&&(i=i.map((e=>u(e)))),a&&(i=i.map((e=>y(e)))),D(i=w(i,t),n)}function w(e,t){for(var r of t)e=n(e,a(s(N(r,e),N(r,r)),r));return e}function E(e){return l(o(N(e,e)))}function D(e,t){var n="Complex"===t,r="BigNumber"===t?u(1):n?y(1):1;return a(s(r,E(e)),e)}return function(e,o,m,N,S){void 0===S&&(S=!0);var w=function(e,n,r,a,o){var p,d="BigNumber"===a,m="Complex"===a,h=d?u(0):0,v=d?u(1):m?y(1):1,N=d?u(1):1,T=d?u(10):2,C=i(T,T);o&&(p=Array(n).fill(v));for(var A=!1;!A;){A=!0;for(var V=0;V1&&(x=c(Array(v-1).fill(h)))),v-=1,f.pop();for(var I=0;I2&&(x=c(Array(v-2).fill(h)))),v-=2,f.pop(),f.pop();for(var _=0;_+n(l(e),l(t)))),S>100){var M=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+g.join(", "));throw M.values=g,M.vectors=[],M}var P=o?a(V,function(e,t){for(var n=[],r=0;ra(f,e))),E.push(...c.map((e=>r(e))))},M=0;M2&&void 0!==arguments[2]?arguments[2]:t.epsilon,i=arguments.length>3?arguments[3]:void 0;if("number"===i)return function(e,t){for(var n,r=e.length,a=Math.abs(t/r),i=new Array(r),s=0;s=Math.abs(a);){var l=o[0][0],u=o[0][1];e=b(e,n=m(e[l][l],e[u][u],e[l][u]),l,u),i=f(i,n,l,u),o=v(e)}for(var c=C(r,0),p=0;p=a(i);){var u=l[0][0],c=l[0][1];e=g(e,n=h(e[u][u],e[c][c],e[u][c]),u,c),s=y(s,n,u,c),l=N(e)}for(var p=C(r,0),d=0;d{var{config:t,typed:n,matrix:r,addScalar:a,subtract:i,equal:s,abs:o,atan:l,cos:u,sin:c,multiplyScalar:p,divideScalar:d,inv:m,bignumber:h,multiply:f,add:y,larger:g,column:b,flatten:v,number:N,complex:T,sqrt:C,diag:A,qr:V,usolve:x,usolveAll:S,im:w,re:E,smaller:D,matrixFromColumns:O,dot:I}=e,R=createRealSymmetric({config:t,addScalar:a,subtract:i,column:b,flatten:v,equal:s,abs:o,atan:l,cos:u,sin:c,multiplyScalar:p,inv:m,bignumber:h,complex:T,multiply:f,add:y}),_=createComplexEigs({config:t,addScalar:a,subtract:i,multiply:f,multiplyScalar:p,flatten:v,divideScalar:d,sqrt:C,abs:o,bignumber:h,diag:A,qr:V,inv:m,usolve:x,usolveAll:S,equal:s,complex:T,larger:g,smaller:D,matrixFromColumns:O,dot:I});return n("eigs",{Array:function(e){return M(r(e))},"Array, number|BigNumber":function(e,t){return M(r(e),t)},Matrix:function(e){var{values:t,vectors:n}=M(e);return{values:r(t),vectors:r(n)}},"Matrix, number|BigNumber":function(e,t){var{values:n,vectors:a}=M(e,t);return{values:r(n),vectors:r(a)}}});function M(e,n){void 0===n&&(n=t.epsilon);var r=e.size();if(2!==r.length||r[0]!==r[1])throw new RangeError("Matrix must be square (size: "+format$1(r)+")");var a=e.toArray(),s=r[0];if(function(e,t,n){for(var r=0;r{var{typed:t,abs:n,add:r,identity:a,inv:i,multiply:s}=e;return t(name$U,{Matrix:function(e){var t=e.size();if(2!==t.length||t[0]!==t[1])throw new RangeError("Matrix must be square (size: "+format$1(t)+")");for(var l=t[0],u=function(e){for(var t=e.size()[0],r=0,a=0;a1&&(g=s(g,m),b=-b),h=r(h,s(y=y*(p-v+1)/((2*p-v+1)*v),g)),f=r(f,s(y*b,g));for(var N=s(i(f),h),T=0;T{var{typed:t,abs:n,add:r,multiply:a,sqrt:i,subtract:s,inv:o,size:l,max:u,identity:c}=e,p=1e-6;return t(name$T,{"Array | Matrix":function(e){var t=isMatrix(e)?e.size():arraySize(e);switch(t.length){case 1:if(1===t[0])return i(e);throw new RangeError("Matrix must be square (size: "+format$1(t)+")");case 2:if(t[0]===t[1])return function(e){var t,i=0,d=e,m=c(l(e));do{var h=d;if(d=a(.5,r(h,o(m))),m=a(.5,r(m,o(h))),(t=u(n(s(d,h))))>p&&++i>1e3)throw new Error("computing square root of matrix: iterative method could not converge")}while(t>p);return d}(e);throw new RangeError("Matrix must be square (size: "+format$1(t)+")");default:throw new RangeError("Matrix must be at most two dimensional (size: "+format$1(t)+")")}}})})),name$S="divide",dependencies$S=["typed","matrix","multiply","equalScalar","divideScalar","inv"],createDivide=factory(name$S,dependencies$S,(e=>{var{typed:t,matrix:n,multiply:r,equalScalar:a,divideScalar:i,inv:s}=e,o=createAlgorithm11({typed:t,equalScalar:a}),l=createAlgorithm14({typed:t});return t("divide",extend$2({"Array | Matrix, Array | Matrix":function(e,t){return r(e,s(t))},"DenseMatrix, any":function(e,t){return l(e,t,i,!1)},"SparseMatrix, any":function(e,t){return o(e,t,i,!1)},"Array, any":function(e,t){return l(n(e),t,i,!1).valueOf()},"any, Array | Matrix":function(e,t){return r(e,s(t))}},i.signatures))})),name$R="distance",dependencies$R=["typed","addScalar","subtract","divideScalar","multiplyScalar","unaryMinus","sqrt","abs"],createDistance=factory(name$R,dependencies$R,(e=>{var{typed:t,addScalar:n,subtract:r,multiplyScalar:a,divideScalar:i,unaryMinus:s,sqrt:o,abs:l}=e;return t(name$R,{"Array, Array, Array":function(e,t,n){if(2===e.length&&2===t.length&&2===n.length){if(!c(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!c(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!c(n))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");var o=i(r(n[1],n[0]),r(t[1],t[0])),l=a(a(o,o),t[0]),u=s(a(o,t[0])),p=e[1];return f(e[0],e[1],l,u,p)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(e,t,n){if(2===Object.keys(e).length&&2===Object.keys(t).length&&2===Object.keys(n).length){if(!c(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!c(t))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!c(n))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 n&&"lineTwoPtY"in n){var o=i(r(n.lineTwoPtY,n.lineTwoPtX),r(t.lineOnePtY,t.lineOnePtX)),l=a(a(o,o),t.lineOnePtX),u=s(a(o,t.lineOnePtX)),p=e.pointX;return f(e.pointX,e.pointY,l,u,p)}throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(e,t){if(2===e.length&&3===t.length){if(!c(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 f(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(!m(t))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return y(e[0],e[1],e[2],t[0],t[1],t[2],t[3],t[4],t[5])}if(e.length===t.length&&e.length>0){if(!d(e))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!d(t))throw new TypeError("All values of an array should be numbers or BigNumbers");return g(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(!c(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 f(e.pointX,e.pointY,t.xCoeffLine,t.yCoeffLine,t.constant);throw new TypeError("Key names do not match")}if(3===Object.keys(e).length&&6===Object.keys(t).length){if(!p(e))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!m(t))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"x0"in t&&"y0"in t&&"z0"in t&&"a"in t&&"b"in t&&"c"in t)return y(e.pointX,e.pointY,e.pointZ,t.x0,t.y0,t.z0,t.a,t.b,t.c);throw new TypeError("Key names do not match")}if(2===Object.keys(e).length&&2===Object.keys(t).length){if(!c(e))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!c(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 g([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 g([e.pointOneX,e.pointOneY,e.pointOneZ],[t.pointTwoX,t.pointTwoY,t.pointTwoZ]);throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},Array:function(e){if(!function(e){if(2===e[0].length&&u(e[0][0])&&u(e[0][1])){if(e.some((e=>2!==e.length||!u(e[0])||!u(e[1]))))return!1}else{if(!(3===e[0].length&&u(e[0][0])&&u(e[0][1])&&u(e[0][2])))return!1;if(e.some((e=>3!==e.length||!u(e[0])||!u(e[1])||!u(e[2]))))return!1}return!0}(e))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return function(e){for(var t=[],n=[],r=[],a=0;a{var{typed:t,config:n,abs:r,add:a,addScalar:i,matrix:s,multiply:o,multiplyScalar:l,divideScalar:u,subtract:c,smaller:p,equalScalar:d,flatten:m,isZero:h,isNumeric:f}=e;return t("intersect",{"Array, Array, Array":y,"Array, Array, Array, Array":g,"Matrix, Matrix, Matrix":function(e,t,n){var r=y(e.valueOf(),t.valueOf(),n.valueOf());return null===r?null:s(r)},"Matrix, Matrix, Matrix, Matrix":function(e,t,n,r){var a=g(e.valueOf(),t.valueOf(),n.valueOf(),r.valueOf());return null===a?null:s(a)}});function y(e,t,n){if(e=b(e),t=b(t),n=b(n),!N(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!N(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!function(e){return 4===e.length&&f(e[0])&&f(e[1])&&f(e[2])&&f(e[3])}(n))throw new TypeError("Array with 4 numbers expected as third argument");return function(e,t,n,r,a,s,o,p,d,m){var h=l(e,o),f=l(r,o),y=l(t,p),g=l(a,p),b=l(n,d),v=l(s,d),N=c(c(c(m,h),y),b),T=c(c(c(i(i(f,g),v),h),y),b),C=u(N,T);return[i(e,l(C,c(r,e))),i(t,l(C,c(a,t))),i(n,l(C,c(s,n)))]}(e[0],e[1],e[2],t[0],t[1],t[2],n[0],n[1],n[2],n[3])}function g(e,t,s,m){if(e=b(e),t=b(t),s=b(s),m=b(m),2===e.length){if(!v(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!v(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!v(s))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!v(m))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return function(e,t,s,d){var m=e,f=s,y=c(m,t),g=c(f,d),b=c(l(y[0],g[1]),l(g[0],y[1]));if(h(b))return null;if(p(r(b),n.epsilon))return null;var v=l(g[0],m[1]),N=l(g[1],m[0]),T=l(g[0],f[1]),C=l(g[1],f[0]),A=u(i(c(c(v,N),T),C),b);return a(o(y,A),m)}(e,t,s,m)}if(3===e.length){if(!N(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!N(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!N(s))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!N(m))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return function(e,t,n,r,a,s,o,p,m,f,y,g){var b=T(e,o,f,o,t,p,y,p,n,m,g,m),v=T(f,o,r,e,y,p,a,t,g,m,s,n),N=T(e,o,r,e,t,p,a,t,n,m,s,n),C=T(f,o,f,o,y,p,y,p,g,m,g,m),A=T(r,e,r,e,a,t,a,t,s,n,s,n),V=c(l(b,v),l(N,C)),x=c(l(A,C),l(v,v));if(h(x))return null;var S=u(V,x),w=u(i(b,l(S,v)),C),E=i(e,l(S,c(r,e))),D=i(t,l(S,c(a,t))),O=i(n,l(S,c(s,n))),I=i(o,l(w,c(f,o))),R=i(p,l(w,c(y,p))),_=i(m,l(w,c(g,m)));return d(E,I)&&d(D,R)&&d(O,_)?[E,D,O]:null}(e[0],e[1],e[2],t[0],t[1],t[2],s[0],s[1],s[2],m[0],m[1],m[2])}throw new TypeError("Arrays with two or thee dimensional points expected")}function b(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 v(e){return 2===e.length&&f(e[0])&&f(e[1])}function N(e){return 3===e.length&&f(e[0])&&f(e[1])&&f(e[2])}function T(e,t,n,r,a,s,o,u,p,d,m,h){var f=l(c(e,t),c(n,r)),y=l(c(a,s),c(o,u)),g=l(c(p,d),c(m,h));return i(i(f,y),g)}})),name$P="sum",dependencies$P=["typed","config","add","numeric"],createSum=factory(name$P,dependencies$P,(e=>{var{typed:t,config:n,add:r,numeric:a}=e;return t(name$P,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(e,t){try{return reduce$2(e,t,r)}catch(e){throw improveErrorMessage(e,"sum")}},"...":function(e){if(containsCollections(e))throw new TypeError("Scalar values expected in function sum");return i(e)}});function i(e){var t;return deepForEach(e,(function(e){try{t=void 0===t?e:r(t,e)}catch(t){throw improveErrorMessage(t,"sum",e)}})),void 0===t&&(t=a(0,n.number)),"string"==typeof t&&(t=a(t,n.number)),t}})),name$O="cumsum",dependencies$O=["typed","add","unaryPlus"],createCumSum=factory(name$O,dependencies$O,(e=>{var{typed:t,add:n,unaryPlus:r}=e;return t(name$O,{Array:a,Matrix:function(e){return e.create(a(e.valueOf()))},"Array, number | BigNumber":s,"Matrix, number | BigNumber":function(e,t){return e.create(s(e.valueOf(),t))},"...":function(e){if(containsCollections(e))throw new TypeError("All values expected to be scalar in function cumsum");return a(e)}});function a(e){try{return i(e)}catch(e){throw improveErrorMessage(e,name$O)}}function i(e){if(0===e.length)return[];for(var t=[r(e[0])],a=1;a=n.length)throw new IndexError(t,n.length);try{return o(e,t)}catch(e){throw improveErrorMessage(e,name$O)}}function o(e,t){var n,r,a;if(t<=0){var s=e[0][0];if(Array.isArray(s)){for(a=_switch$1(e),r=[],n=0;n{var{typed:t,add:n,divide:r}=e;return t(name$N,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){try{var a=reduce$2(e,t,n),i=Array.isArray(e)?arraySize(e):e.size();return r(a,i[t])}catch(e){throw improveErrorMessage(e,"mean")}},"...":function(e){if(containsCollections(e))throw new TypeError("Scalar values expected in function mean");return a(e)}});function a(e){var t,a=0;if(deepForEach(e,(function(e){try{t=void 0===t?e:n(t,e),a++}catch(t){throw improveErrorMessage(t,"mean",e)}})),0===a)throw new Error("Cannot calculate the mean of an empty array");return r(t,a)}})),name$M="median",dependencies$M=["typed","add","divide","compare","partitionSelect"],createMedian=factory(name$M,dependencies$M,(e=>{var{typed:t,add:n,divide:r,compare:a,partitionSelect:i}=e;function s(e){try{var t=(e=flatten$4(e.valueOf())).length;if(0===t)throw new Error("Cannot calculate median of an empty array");if(t%2==0){for(var n=t/2-1,r=i(e,n+1),s=e[n],u=0;u0&&(s=e[u]);return l(s,r)}var c=i(e,(t-1)/2);return o(c)}catch(e){throw improveErrorMessage(e,"median")}}var o=t({"number | BigNumber | Complex | Unit":function(e){return e}}),l=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(e,t){return r(n(e,t),2)}});return t(name$M,{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("median(A, dim) is not yet supported")},"...":function(e){if(containsCollections(e))throw new TypeError("Scalar values expected in function median");return s(e)}})})),name$L="mad",dependencies$L=["typed","abs","map","median","subtract"],createMad=factory(name$L,dependencies$L,(e=>{var{typed:t,abs:n,map:r,median:a,subtract:i}=e;return t(name$L,{"Array | Matrix":s,"...":function(e){return s(e)}});function s(e){if(0===(e=flatten$4(e.valueOf())).length)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var t=a(e);return a(r(e,(function(e){return n(i(e,t))})))}catch(e){throw e instanceof TypeError&&-1!==e.message.indexOf("median")?new TypeError(e.message.replace("median","mad")):improveErrorMessage(e,"mad")}}})),DEFAULT_NORMALIZATION="unbiased",name$K="variance",dependencies$K=["typed","add","subtract","multiply","divide","apply","isNaN"],createVariance=factory(name$K,dependencies$K,(e=>{var{typed:t,add:n,subtract:r,multiply:a,divide:i,apply:s,isNaN:o}=e;return t(name$K,{"Array | Matrix":function(e){return l(e,DEFAULT_NORMALIZATION)},"Array | Matrix, string":l,"Array | Matrix, number | BigNumber":function(e,t){return u(e,t,DEFAULT_NORMALIZATION)},"Array | Matrix, number | BigNumber, string":u,"...":function(e){return l(e,DEFAULT_NORMALIZATION)}});function l(e,t){var s,l=0;if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(deepForEach(e,(function(e){try{s=void 0===s?e:n(s,e),l++}catch(t){throw improveErrorMessage(t,"variance",e)}})),0===l)throw new Error("Cannot calculate variance of an empty array");var u=i(s,l);if(s=void 0,deepForEach(e,(function(e){var t=r(e,u);s=void 0===s?a(t,t):n(s,a(t,t))})),o(s))return s;switch(t){case"uncorrected":return i(s,l);case"biased":return i(s,l+1);case"unbiased":var c=isBigNumber(s)?s.mul(0):0;return 1===l?c:i(s,l-1);default:throw new Error('Unknown normalization "'+t+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function u(e,t,n){try{if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return s(e,t,(e=>l(e,n)))}catch(e){throw improveErrorMessage(e,"variance")}}})),name$J="quantileSeq",dependencies$J=["typed","add","multiply","partitionSelect","compare"],createQuantileSeq=factory(name$J,dependencies$J,(e=>{var{typed:t,add:n,multiply:r,partitionSelect:a,compare:i}=e;function s(e,t,s){var l=flatten$4(e),u=l.length;if(0===u)throw new Error("Cannot calculate quantile of an empty sequence");if(isNumber$1(t)){var c=t*(u-1),p=c%1;if(0===p){var d=s?l[c]:a(l,c);return o(d),d}var m,h,f=Math.floor(c);if(s)m=l[f],h=l[f+1];else{h=a(l,f+1),m=l[f];for(var y=0;y0&&(m=l[y])}return o(m),o(h),n(r(m,1-p),r(h,p))}var g=t.times(u-1);if(g.isInteger()){g=g.toNumber();var b=s?l[g]:a(l,g);return o(b),b}var v,N,T=g.floor(),C=g.minus(T),A=T.toNumber();if(s)v=l[A],N=l[A+1];else{N=a(l,A+1),v=l[A];for(var V=0;V0&&(v=l[V])}o(v),o(N);var x=new C.constructor(1);return n(r(v,x.minus(C)),r(N,C))}var o=t({"number | BigNumber | Unit":function(e){return e}});return function(e,t,n){var r,a,i;if(arguments.length<2||arguments.length>3)throw new SyntaxError("Function quantileSeq requires two or three parameters");if(isCollection(e)){if("boolean"==typeof(n=n||!1)){if(a=e.valueOf(),isNumber$1(t)){if(t<0)throw new Error("N/prob must be non-negative");if(t<=1)return s(a,t,n);if(t>1){if(!isInteger$1(t))throw new Error("N must be a positive integer");var o=t+1;r=new Array(t);for(var l=0;l4294967295)throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var p=new u(c+1);r=new Array(c);for(var d=0;d1)throw new Error("Probability must be between 0 and 1, inclusive")}else{if(!isBigNumber(h))throw new TypeError("Unexpected type of argument in function quantileSeq");if(i=new h.constructor(1),h.isNegative()||h.gt(i))throw new Error("Probability must be between 0 and 1, inclusive")}r[m]=s(a,h,n)}return r}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")}})),name$I="std",dependencies$I=["typed","sqrt","variance"],createStd=factory(name$I,dependencies$I,(e=>{var{typed:t,sqrt:n,variance:r}=e;return t(name$I,{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(e){return a(e)}});function a(e,t){if(0===e.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{return n(r.apply(null,arguments))}catch(e){throw e instanceof TypeError&&-1!==e.message.indexOf(" variance")?new TypeError(e.message.replace(" variance"," std")):e}}})),name$H="combinations",dependencies$H=["typed"],createCombinations=factory(name$H,dependencies$H,(e=>{var{typed:t}=e;return t(name$H,{"number, number":combinationsNumber,"BigNumber, BigNumber":function(e,t){var n,r,a=e.constructor,i=e.minus(t),s=new a(1);if(!isPositiveInteger$2(e)||!isPositiveInteger$2(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(n=s,t.lt(i))for(r=s;r.lte(i);r=r.plus(s))n=n.times(t.plus(r)).dividedBy(r);else for(r=s;r.lte(t);r=r.plus(s))n=n.times(i.plus(r)).dividedBy(r);return n}})}));function isPositiveInteger$2(e){return e.isInteger()&&e.gte(0)}var name$G="combinationsWithRep",dependencies$G=["typed"],createCombinationsWithRep=factory(name$G,dependencies$G,(e=>{var{typed:t}=e;return t(name$G,{"number, number":function(e,t){if(!isInteger$1(e)||e<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!isInteger$1(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{var{typed:t,config:n,multiplyScalar:r,pow:a,BigNumber:i,Complex:s}=e;return t(name$F,{number:gammaNumber,Complex:function(e){if(0===e.im)return this(e.re);if(e.re<.5){var t=new s(1-e.re,-e.im),n=new s(Math.PI*e.re,Math.PI*e.im);return new s(Math.PI).div(n.sin()).div(this(t))}e=new s(e.re-1,e.im);for(var r=new s(gammaP[0],0),a=1;a2;)l+=a-=2,s=s.times(l);return new i(s.toPrecision(i.precision))}})),name$E="lgamma",dependencies$E=["Complex","typed"],createLgamma=factory(name$E,dependencies$E,(e=>{var{Complex:t,typed:n}=e,r=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return n(name$E,{number:lgammaNumber,Complex:function(e){if(e.isNaN())return new t(NaN,NaN);if(0===e.im)return new t(lgammaNumber(e.re),0);if(e.re>=7||Math.abs(e.im)>=7)return a(e);if(e.re<=.1){var n=copysign(6.283185307179586,e.im)*Math.floor(.5*e.re+.25),r=e.mul(Math.PI).sin().log(),s=this(new t(1-e.re,-e.im));return new t(1.1447298858494002,n).sub(r).sub(s)}return e.im>=0?i(e):i(e.conjugate()).conjugate()},BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function a(e){for(var n=e.sub(.5).mul(e.log()).sub(e).add(lnSqrt2PI),a=new t(1,0).div(e),i=a.div(e),s=r[0],o=r[1],l=2*i.re,u=i.re*i.re+i.im*i.im,c=2;c<8;c++){var p=o;o=-u*s+r[c],s=l*s+p}var d=a.mul(i.mul(s).add(o));return n.add(d)}function i(e){var n=0,r=0,i=e;for(e=e.add(1);e.re<=7;){var s=(i=i.mul(e)).im<0?1:0;0!==s&&0===r&&n++,r=s,e=e.add(1)}return a(e).sub(i.log()).sub(new t(0,2*n*Math.PI*1))}})),name$D="factorial",dependencies$D=["typed","gamma"],createFactorial=factory(name$D,dependencies$D,(e=>{var{typed:t,gamma:n}=e;return t(name$D,{number:function(e){if(e<0)throw new Error("Value must be non-negative");return n(e+1)},BigNumber:function(e){if(e.isNegative())throw new Error("Value must be non-negative");return n(e.plus(1))},"Array | Matrix":function(e){return deepMap(e,this)}})})),name$C="kldivergence",dependencies$C=["typed","matrix","divide","sum","multiply","dotDivide","log","isNumeric"],createKldivergence=factory(name$C,dependencies$C,(e=>{var{typed:t,matrix:n,divide:r,sum:a,multiply:i,dotDivide:s,log:o,isNumeric:l}=e;return t(name$C,{"Array, Array":function(e,t){return u(n(e),n(t))},"Matrix, Array":function(e,t){return u(e,n(t))},"Array, Matrix":function(e,t){return u(n(e),t)},"Matrix, Matrix":function(e,t){return u(e,t)}});function u(e,t){var n=t.size().length,u=e.size().length;if(n>1)throw new Error("first object must be one dimensional");if(u>1)throw new Error("second object must be one dimensional");if(n!==u)throw new Error("Length of two vectors must be equal");if(0===a(e))throw new Error("Sum of elements in first object must be non zero");if(0===a(t))throw new Error("Sum of elements in second object must be non zero");var c=r(e,a(e)),p=r(t,a(t)),d=a(i(c,o(s(c,p))));return l(d)?d:Number.NaN}})),name$B="multinomial",dependencies$B=["typed","add","divide","multiply","factorial","isInteger","isPositive"],createMultinomial=factory(name$B,dependencies$B,(e=>{var{typed:t,add:n,divide:r,multiply:a,factorial:i,isInteger:s,isPositive:o}=e;return t(name$B,{"Array | Matrix":function(e){var t=0,l=1;return deepForEach(e,(function(e){if(!s(e)||!o(e))throw new TypeError("Positive integer value expected in function multinomial");t=n(t,e),l=a(l,i(e))})),r(i(t),l)}})})),name$A="permutations",dependencies$A=["typed","factorial"],createPermutations=factory(name$A,dependencies$A,(e=>{var{typed:t,factorial:n}=e;return t(name$A,{"number | BigNumber":n,"number, number":function(e,t){if(!isInteger$1(e)||e<0)throw new TypeError("Positive integer value expected in function permutations");if(!isInteger$1(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 product(e-t+1,e)},"BigNumber, BigNumber":function(e,t){var n,r;if(!isPositiveInteger(e)||!isPositiveInteger(t))throw new TypeError("Positive integer value expected in function permutations");if(t.gt(e))throw new TypeError("second argument k must be less than or equal to first argument n");for(n=e.mul(0).add(1),r=e.minus(t).plus(1);r.lte(e);r=r.plus(1))n=n.times(r);return n}})}));function isPositiveInteger(e){return e.isInteger()&&e.gte(0)}var alea$1={exports:{}};!function(e){!function(e,t,n){function r(e){var t=this,n=function(){var e=4022871197;return function(t){t=String(t);for(var n=0;n>>0,e=(r*=e)>>>0,e+=4294967296*(r-=e)}return 2.3283064365386963e-10*(e>>>0)}}();t.next=function(){var e=2091639*t.s0+2.3283064365386963e-10*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=0|e)},t.c=1,t.s0=n(" "),t.s1=n(" "),t.s2=n(" "),t.s0-=n(e),t.s0<0&&(t.s0+=1),t.s1-=n(e),t.s1<0&&(t.s1+=1),t.s2-=n(e),t.s2<0&&(t.s2+=1),n=null}function a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function i(e,t){var n=new r(e),i=t&&t.state,s=n.next;return s.int32=function(){return 4294967296*n.next()|0},s.double=function(){return s()+11102230246251565e-32*(2097152*s()|0)},s.quick=s,i&&("object"==typeof i&&a(i,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=i:this.alea=i}(0,e)}(alea$1);var xor128$1={exports:{}};!function(e){!function(e,t,n){function r(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r>>0)/4294967296};return s.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},s.int32=n.next,s.quick=s,i&&("object"==typeof i&&a(i,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=i:this.xor128=i}(0,e)}(xor128$1);var xorwow$1={exports:{}};!function(e){!function(e,t,n){function r(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r>>4),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function i(e,t){var n=new r(e),i=t&&t.state,s=function(){return(n.next()>>>0)/4294967296};return s.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},s.int32=n.next,s.quick=s,i&&("object"==typeof i&&a(i,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=i:this.xorwow=i}(0,e)}(xorwow$1);var xorshift7$1={exports:{}};!function(e){!function(e,t,n){function r(e){var t=this;t.next=function(){var e,n,r=t.x,a=t.i;return e=r[a],n=(e^=e>>>7)^e<<24,n^=(e=r[a+1&7])^e>>>10,n^=(e=r[a+3&7])^e>>>3,n^=(e=r[a+4&7])^e<<7,e=r[a+7&7],n^=(e^=e<<13)^e<<9,r[a]=n,t.i=a+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n0;--n)e.next()}(t,e)}function a(e,t){return t.x=e.x.slice(),t.i=e.i,t}function i(e,t){null==e&&(e=+new Date);var n=new r(e),i=t&&t.state,s=function(){return(n.next()>>>0)/4294967296};return s.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},s.int32=n.next,s.quick=s,i&&(i.x&&a(i,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=i:this.xorshift7=i}(0,e)}(xorshift7$1);var xor4096$1={exports:{}};!function(e){!function(e,t,n){function r(e){var t=this;t.next=function(){var e,n,r=t.w,a=t.X,i=t.i;return t.w=r=r+1640531527|0,n=a[i+34&127],e=a[i=i+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=a[i]=n^e,t.i=i,n+(r^r>>>16)|0},function(e,t){var n,r,a,i,s,o=[],l=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,l=Math.max(l,t.length)),a=0,i=-32;i>>15,r^=r<<4,r^=r>>>13,i>=0&&(s=s+1640531527|0,a=0==(n=o[127&i]^=r+s)?a+1:0);for(a>=128&&(o[127&(t&&t.length||0)]=-1),a=127,i=512;i>0;--i)r=o[a+34&127],n=o[a=a+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,o[a]=r^n;e.w=s,e.X=o,e.i=a}(t,e)}function a(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function i(e,t){null==e&&(e=+new Date);var n=new r(e),i=t&&t.state,s=function(){return(n.next()>>>0)/4294967296};return s.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},s.int32=n.next,s.quick=s,i&&(i.X&&a(i,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=i:this.xor4096=i}(0,e)}(xor4096$1);var tychei$1={exports:{}};!function(e){!function(e,t,n){function r(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,a=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^a,a=a-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^a,t.a=a-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r>>0)/4294967296};return s.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},s.int32=n.next,s.quick=s,i&&("object"==typeof i&&a(i,n),s.state=function(){return a(n,{})}),s}t&&t.exports?t.exports=i:this.tychei=i}(0,e)}(tychei$1);var seedrandom$2={exports:{}},_nodeResolve_empty={},_nodeResolve_empty$1=Object.freeze({__proto__:null,default:_nodeResolve_empty}),require$$0=getAugmentedNamespace(_nodeResolve_empty$1);!function(e){!function(t,n,r){var a,i=256,s="random",o=r.pow(i,6),l=r.pow(2,52),u=2*l,c=255;function p(e,c,p){var g=[],b=f(h((c=1==c?{entropy:!0}:c||{}).entropy?[e,y(n)]:null==e?function(){try{var e;return a&&(e=a.randomBytes)?e=e(i):(e=new Uint8Array(i),(t.crypto||t.msCrypto).getRandomValues(e)),y(e)}catch(e){var r=t.navigator,s=r&&r.plugins;return[+new Date,t,s,t.screen,y(n)]}}():e,3),g),v=new d(g),N=function(){for(var e=v.g(6),t=o,n=0;e=u;)e/=2,t/=2,n>>>=1;return(e+n)/t};return N.int32=function(){return 0|v.g(4)},N.quick=function(){return v.g(4)/4294967296},N.double=N,f(y(v.S),n),(c.pass||p||function(e,t,n,a){return a&&(a.S&&m(a,v),e.state=function(){return m(v,{})}),n?(r[s]=e,t):e})(N,b,"global"in c?c.global:this==r,c.state)}function d(e){var t,n=e.length,r=this,a=0,s=r.i=r.j=0,o=r.S=[];for(n||(e=[n++]);a{var{typed:t,config:n,on:r}=e,a=createRng(n.randomSeed);return r&&r("config",(function(e,t){e.randomSeed!==t.randomSeed&&(a=createRng(e.randomSeed))})),t(name$z,{"Array | Matrix":function(e){return i(e,{})},"Array | Matrix, Object":function(e,t){return i(e,t)},"Array | Matrix, number":function(e,t){return i(e,{number:t})},"Array | Matrix, Array | Matrix":function(e,t){return i(e,{weights:t})},"Array | Matrix, Array | Matrix, number":function(e,t,n){return i(e,{number:n,weights:t})},"Array | Matrix, number, Array | Matrix":function(e,t,n){return i(e,{number:t,weights:n})}});function i(e,t){var{number:n,weights:r,elementWise:i=!0}=t,s=void 0===n;s&&(n=1);var o=isMatrix(e)?e.create:isMatrix(r)?r.create:null;e=e.valueOf(),r&&(r=r.valueOf()),!0===i&&(e=flatten$4(e),r=flatten$4(r));var l=0;if(void 0!==r){if(r.length!==e.length)throw new Error("Weights must have the same length as possibles");for(var u=0,c=r.length;u1)for(var r=0,a=e.shift();r{var{typed:t,config:n,on:r}=e,a=createRng(n.randomSeed);return r&&r("config",(function(e,t){e.randomSeed!==t.randomSeed&&(a=createRng(e.randomSeed))})),t(name$y,{"":()=>s(0,1),number:e=>s(0,e),"number, number":(e,t)=>s(e,t),"Array | Matrix":e=>i(e,0,1),"Array | Matrix, number":(e,t)=>i(e,0,t),"Array | Matrix, number, number":(e,t,n)=>i(e,t,n)});function i(e,t,n){var r=randomMatrix(e.valueOf(),(()=>s(t,n)));return isMatrix(e)?e.create(r):r}function s(e,t){return e+a()*(t-e)}})),name$x="randomInt",dependencies$x=["typed","config","?on"],createRandomInt=factory(name$x,dependencies$x,(e=>{var{typed:t,config:n,on:r}=e,a=createRng(n.randomSeed);return r&&r("config",(function(e,t){e.randomSeed!==t.randomSeed&&(a=createRng(e.randomSeed))})),t(name$x,{"":()=>s(0,1),number:e=>s(0,e),"number, number":(e,t)=>s(e,t),"Array | Matrix":e=>i(e,0,1),"Array | Matrix, number":(e,t)=>i(e,0,t),"Array | Matrix, number, number":(e,t,n)=>i(e,t,n)});function i(e,t,n){var r=randomMatrix(e.valueOf(),(()=>s(t,n)));return isMatrix(e)?e.create(r):r}function s(e,t){return Math.floor(e+a()*(t-e))}})),name$w="stirlingS2",dependencies$w=["typed","addScalar","subtract","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],createStirlingS2=factory(name$w,dependencies$w,(e=>{var{typed:t,addScalar:n,subtract:r,multiplyScalar:a,divideScalar:i,pow:s,factorial:o,combinations:l,isNegative:u,isInteger:c,number:p,bignumber:d,larger:m}=e,h=[],f=[];return t(name$w,{"number | BigNumber, number | BigNumber":function(e,t){if(!c(e)||u(e)||!c(t)||u(t))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(m(t,e))throw new TypeError("k must be less than or equal to n in function stirlingS2");var r=!(isNumber$1(e)&&isNumber$1(t)),i=r?f:h,s=r?d:p,o=p(e),l=p(t);if(i[o]&&i[o].length>l)return i[o][l];for(var y=0;y<=o;++y)if(i[y]||(i[y]=[s(0===y?1:0)]),0!==y)for(var g=i[y],b=i[y-1],v=g.length;v<=y&&v<=l;++v)g[v]=v===y?1:n(a(s(v),b[v]),b[v-1]);return i[o][l]}})})),name$v="bellNumbers",dependencies$v=["typed","addScalar","isNegative","isInteger","stirlingS2"],createBellNumbers=factory(name$v,dependencies$v,(e=>{var{typed:t,addScalar:n,isNegative:r,isInteger:a,stirlingS2:i}=e;return t(name$v,{"number | BigNumber":function(e){if(!a(e)||r(e))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var t=0,s=0;s<=e;s++)t=n(t,i(e,s));return t}})})),name$u="catalan",dependencies$u=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],createCatalan=factory(name$u,dependencies$u,(e=>{var{typed:t,addScalar:n,divideScalar:r,multiplyScalar:a,combinations:i,isNegative:s,isInteger:o}=e;return t(name$u,{"number | BigNumber":function(e){if(!o(e)||s(e))throw new TypeError("Non-negative integer value expected in function catalan");return r(i(a(e,2),e),n(e,1))}})})),name$t="composition",dependencies$t=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],createComposition=factory(name$t,dependencies$t,(e=>{var{typed:t,addScalar:n,combinations:r,isPositive:a,isNegative:i,isInteger:s,larger:o}=e;return t(name$t,{"number | BigNumber, number | BigNumber":function(e,t){if(!(s(e)&&a(e)&&s(t)&&a(t)))throw new TypeError("Positive integer value expected in function composition");if(o(t,e))throw new TypeError("k must be less than or equal to n in function composition");return r(n(e,-1),n(t,-1))}})})),name$s="leafCount",dependencies$s=["parse","typed"],createLeafCount=factory(name$s,dependencies$s,(e=>{var{parse:t,typed:n}=e;function r(e){var t=0;return e.forEach((e=>{t+=r(e)})),t||1}return n(name$s,{string:function(e){return this(t(e))},Node:function(e){return r(e)}})}));function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _objectSpread(e){for(var t=1;t{var{FunctionNode:t,OperatorNode:n,SymbolNode:r}=e,a=!0,i=!1,s="defaultF",o={add:{trivial:a,total:a,commutative:a,associative:a},unaryPlus:{trivial:a,total:a,commutative:a,associative:a},subtract:{trivial:i,total:a,commutative:i,associative:i},multiply:{trivial:a,total:a,commutative:a,associative:a},divide:{trivial:i,total:a,commutative:i,associative:i},paren:{trivial:a,total:a,commutative:a,associative:i},defaultF:{trivial:i,total:a,commutative:i,associative:i}};function l(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o,r=s;if("string"==typeof e?r=e:isOperatorNode(e)?r=e.fn.toString():isFunctionNode(e)?r=e.name:isParenthesisNode(e)&&(r="paren"),hasOwnProperty$2(n,r)){var a=n[r];if(hasOwnProperty$2(a,t))return a[t];if(hasOwnProperty$2(o,r))return o[r][t]}if(hasOwnProperty$2(n,s)){var i=n[s];return hasOwnProperty$2(i,t)?i[t]:o[s][t]}if(hasOwnProperty$2(o,r)){var l=o[r];if(hasOwnProperty$2(l,t))return l[t]}return o[s][t]}function u(e){return l(e,"associative",arguments.length>1&&void 0!==arguments[1]?arguments[1]:o)}function c(e,t){var n,r=[];return u(e,t)?(n=e.op,function e(t){for(var a=0;a1&&void 0!==arguments[1]?arguments[1]:o)},isAssociative:u,mergeContext:function(e,t){var n=_objectSpread({},e);for(var r in t)hasOwnProperty$2(e,r)?n[r]=_objectSpread(_objectSpread({},t[r]),e[r]):n[r]=t[r];return n},flatten:function e(t,n){if(!t.args||0===t.args.length)return t;t.args=c(t,n);for(var r=0;r2&&u(t,n)){for(var s=t.args.pop();t.args.length>0;)s=r([t.args.pop(),s]);t.args=s.args}}},unflattenl:function e(t,n){if(t.args&&0!==t.args.length){for(var r=p(t),a=t.args.length,i=0;i2&&u(t,n)){for(var s=t.args.shift();t.args.length>0;)s=r([s,t.args.shift()]);t.args=s.args}}},defaultContext:o,realContext:{divide:{total:i},log:{total:i}},positiveContext:{subtract:{total:i},abs:{trivial:a},log:{total:a}}}})),name$q="simplifyConstant",dependencies$q=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],createSimplifyConstant=factory(name$q,dependencies$q,(e=>{var{typed:t,config:n,mathWithTransform:r,matrix:a,fraction:i,bignumber:s,AccessorNode:o,ArrayNode:l,ConstantNode:u,FunctionNode:c,IndexNode:p,ObjectNode:d,OperatorNode:m,SymbolNode:h}=e,{isCommutative:f,isAssociative:y,allChildren:g,createMakeNodeFunction:b}=createUtil({FunctionNode:c,OperatorNode:m,SymbolNode:h});function v(e,t){return A(E(e,t))}function N(e){return isFraction(e)?e.valueOf():e instanceof Array?e.map(N):isMatrix(e)?a(N(e.valueOf())):e}function T(e,t,n){try{return r[e].apply(null,t)}catch(a){return t=t.map(N),x(r[e].apply(null,t),n)}}var C=t({Fraction:function(e){var t,n=e.s*e.n;return t=n<0?new m("-","unaryMinus",[new u(-n)]):new u(n),1===e.d?t:new m("/","divide",[t,new u(e.d)])},number:function(e){return e<0?S(new u(-e)):new u(e)},BigNumber:function(e){return e<0?S(new u(-e)):new u(e)},Complex:function(e){throw new Error("Cannot convert Complex number to Node")},string:function(e){return new u(e)},Matrix:function(e){return new l(e.valueOf().map((e=>C(e))))}});function A(e){return isNode(e)?e:C(e)}function V(e,t){if(t&&!1!==t.exactFractions&&isFinite(e)&&i){var n=i(e),r=t&&"number"==typeof t.fractionsLimit?t.fractionsLimit:1/0;if(n.valueOf()===e&&n.nE(e,t)));if(!n.some(isNode))try{return T(e.name,n,t)}catch(e){}if("size"===e.name&&1===n.length&&isArrayNode(n[0])){for(var i=[],s=n[0];isArrayNode(s);)i.push(s.items.length),s=s.items[0];return a(i)}return new c(e.name,n.map(A))}case"OperatorNode":var m,h,N=e.fn.toString(),C=b(e);if(isOperatorNode(e)&&e.isUnary())h=isNode((m=[E(e.args[0],t)])[0])?C(m):T(N,m,t);else if(y(e,t.context))if(m=(m=g(e,t.context)).map((e=>E(e,t))),f(N,t.context)){for(var V=[],S=[],D=0;D1?(h=w(N,V,C,t),S.unshift(h),h=w(N,S,C,t)):h=w(N,m,C,t)}else h=w(N,m,C,t);else h=w(N,m=e.args.map((e=>E(e,t))),C,t);return h;case"ParenthesisNode":return E(e.content,t);case"AccessorNode":return function(e,t,n){if(!isIndexNode(t))return new o(A(e),A(t));if(isArrayNode(e)||isMatrix(e)){for(var r=Array.from(t.dimensions);r.length>0;)if(isConstantNode(r[0])&&"string"!=typeof r[0].value){var i=x(r.shift().value,n);isArrayNode(e)?e=e.items[i-1]:(e=e.valueOf()[i-1])instanceof Array&&(e=a(e))}else{if(!(r.length>1&&isConstantNode(r[1])&&"string"!=typeof r[1].value))break;var s=x(r[1].value,n),c=[],d=isArrayNode(e)?e.items:e.valueOf();for(var m of d)if(isArrayNode(m))c.push(m.items[s-1]);else{if(!isMatrix(e))break;c.push(m[s-1])}if(c.length!==d.length)break;e=isArrayNode(e)?new l(c):a(c),r.splice(1,1)}return r.length===t.dimensions.length?new o(A(e),t):r.length>0?(t=new p(r),new o(A(e),t)):e}if(isObjectNode(e)&&1===t.dimensions.length&&isConstantNode(t.dimensions[0])){var h=t.dimensions[0].value;return h in e.properties?e.properties[h]:new u}return new o(A(e),t)}(E(e.object,t),E(e.index,t),t);case"ArrayNode":var O=e.items.map((e=>E(e,t)));return O.some(isNode)?new l(O.map(A)):a(O);case"IndexNode":return new p(e.dimensions.map((e=>v(e,t))));case"ObjectNode":var I={};for(var R in e.properties)I[R]=v(e.properties[R],t);return new d(I);default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(e.type))}}return v})),name$p="simplify",dependencies$p=["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"],createSimplify=factory(name$p,dependencies$p,(e=>{var{config:t,typed:n,parse:r,add:a,subtract:i,multiply:s,divide:o,pow:l,isZero:u,equal:c,resolve:p,simplifyCore:d,fraction:m,bignumber:h,mathWithTransform:f,matrix:y,AccessorNode:g,ArrayNode:b,ConstantNode:v,FunctionNode:N,IndexNode:T,ObjectNode:C,OperatorNode:A,ParenthesisNode:V,SymbolNode:x}=e,S=createSimplifyConstant({typed:n,config:t,mathWithTransform:f,matrix:y,fraction:m,bignumber:h,AccessorNode:g,ArrayNode:b,ConstantNode:v,FunctionNode:N,IndexNode:T,ObjectNode:C,OperatorNode:A,SymbolNode:x}),{hasProperty:w,isCommutative:E,isAssociative:D,mergeContext:O,flatten:I,unflattenr:R,unflattenl:_,createMakeNodeFunction:M,defaultContext:P,realContext:F,positiveContext:k}=createUtil({FunctionNode:N,OperatorNode:A,SymbolNode:x}),$=n("simplify",{string:function(e){return this(r(e),this.rules,createEmptyMap(),{})},"string, Map | Object":function(e,t){return this(r(e),this.rules,t,{})},"string, Map | Object, Object":function(e,t,n){return this(r(e),this.rules,t,n)},"string, Array":function(e,t){return this(r(e),t,createEmptyMap(),{})},"string, Array, Map | Object":function(e,t,n){return this(r(e),t,n,{})},"string, Array, Map | Object, Object":function(e,t,n,a){return this(r(e),t,n,a)},"Node, Map | Object":function(e,t){return this(e,this.rules,t,{})},"Node, Map | Object, Object":function(e,t,n){return this(e,this.rules,t,n)},Node:function(e){return this(e,this.rules,createEmptyMap(),{})},"Node, Array":function(e,t){return this(e,t,createEmptyMap(),{})},"Node, Array, Map | Object":function(e,t,n){return this(e,t,n,{})},"Node, Array, Object, Object":function(e,t,n,r){return this(e,t,createMap$1(n),r)},"Node, Array, Map, Object":function(e,t,n,r){var a=r.consoleDebug;t=function(e,t){for(var n=[],r=0;r ").concat(t[u].r.toString()))),a){var d=i.toString({parenthesis:"all"});d!==l&&(console.log("Applying",c,"produced",d),l=d)}_(i,r.context)}o=i.toString({parenthesis:"all"})}return i}});function B(e){return e.transform((function(e,t,n){return isParenthesisNode(e)?B(e.content):e}))}$.defaultContext=P,$.realContext=F,$.positiveContext=k;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 z(e,t){var n={};if(e.s){var a=e.s.split("->");if(2!==a.length)throw SyntaxError("Could not parse rule: "+e.s);n.l=a[0],n.r=a[1]}else n.l=e.l,n.r=e.r;for(var i of(n.l=B(r(n.l)),n.r=B(r(n.r)),["imposeContext","repeat","assuming"]))i in e&&(n[i]=e[i]);if(e.evaluate&&(n.evaluate=r(e.evaluate)),D(n.l,t)){var s=M(n.l),o=new x("_p"+U++);n.expanded={},n.expanded.l=s([n.l.clone(),o]),I(n.expanded.l,t),R(n.expanded.l,t),n.expanded.r=s([n.r,o])}return n}$.rules=[d,{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}}},S,{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}}},S,{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 U=0;function j(e,t,n){var r=e;if(e)for(var a=0;a=2&&2===e.args.length){for(var i=function(e,t){var n,r,a=[],i=M(e);if(E(e,t))for(var s=0;s1&&(l=i(e.args.slice(0,o))),n=1===(r=e.args.slice(o)).length?r[0]:i(r),a.push(i([l,n]))}return a}(t,n),s=[],o=0;o2)throw Error("Unexpected non-binary associative function: "+e.toString());return[]}for(var u=[],p=0;p2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var m=W(e.args[0],t.args[1],n);if(0===m.length)return[];var h=W(e.args[1],t.args[0],n);if(0===h.length)return[];u=[m,h]}a=function(e){if(0===e.length)return e;for(var t=e.reduce(H),n=[],r={},a=0;a{var{equal:t,isZero:n,add:r,subtract:a,multiply:i,divide:s,pow:o,AccessorNode:l,ArrayNode:u,ConstantNode:c,FunctionNode:p,IndexNode:d,ObjectNode:m,OperatorNode:h,ParenthesisNode:f,SymbolNode:y}=e,g=new c(0),b=new c(1),{hasProperty:v,isCommutative:N}=createUtil({FunctionNode:p,OperatorNode:h,SymbolNode:y});return function e(f,y){var T=y?y.context:void 0;if(v(f,"trivial",T)){if(isFunctionNode(f)&&1===f.args.length)return e(f.args[0],y);var C=!1,A=0;if(f.forEach((t=>{1==++A&&(C=e(t,y))})),1===A)return C}if(isOperatorNode(f)&&f.isUnary()){var V=e(f.args[0],y);if("-"===f.op){if(isOperatorNode(V)){if(V.isUnary()&&"-"===V.op)return V.args[0];if(V.isBinary()&&"subtract"===V.fn)return new h("-","subtract",[V.args[1],V.args[0]])}return new h(f.op,f.fn,[V])}}else{if(isOperatorNode(f)&&f.isBinary()){var x=e(f.args[0],y),S=e(f.args[1],y);if("+"===f.op){if(isConstantNode(x)){if(n(x.value))return S;if(isConstantNode(S))return new c(r(x.value,S.value))}return isConstantNode(S)&&n(S.value)?x:isOperatorNode(S)&&S.isUnary()&&"-"===S.op?new h("-","subtract",[x,S.args[0]]):new h(f.op,f.fn,S?[x,S]:[x])}if("-"===f.op){if(isConstantNode(x)&&S){if(isConstantNode(S))return new c(a(x.value,S.value));if(n(x.value))return new h("-","unaryMinus",[S])}if("subtract"===f.fn)return isConstantNode(S)&&n(S.value)?x:isOperatorNode(S)&&S.isUnary()&&"-"===S.op?e(new h("+","add",[x,S.args[0]]),y):new h(f.op,f.fn,[x,S])}else{if("*"===f.op){if(isConstantNode(x)){if(n(x.value))return g;if(t(x.value,1))return S;if(isConstantNode(S))return new c(i(x.value,S.value))}if(isConstantNode(S)){if(n(S.value))return g;if(t(S.value,1))return x;if(isOperatorNode(x)&&x.isBinary()&&x.op===f.op&&N(f,T)){var w=x.args[0];if(isConstantNode(w)){var E=new c(i(w.value,S.value));return new h(f.op,f.fn,[E,x.args[1]],f.implicit)}}return N(f,T)?new h(f.op,f.fn,[S,x],f.implicit):new h(f.op,f.fn,[x,S],f.implicit)}return new h(f.op,f.fn,[x,S],f.implicit)}if("/"===f.op){if(isConstantNode(x)){if(n(x.value))return g;if(isConstantNode(S)&&(t(S.value,1)||t(S.value,2)||t(S.value,4)))return new c(s(x.value,S.value))}return new h(f.op,f.fn,[x,S])}if("^"===f.op&&isConstantNode(S)){if(n(S.value))return b;if(t(S.value,1))return x;if(isConstantNode(x))return new c(o(x.value,S.value));if(isOperatorNode(x)&&x.isBinary()&&"^"===x.op){var D=x.args[1];if(isConstantNode(D))return new h(f.op,f.fn,[x.args[0],new c(i(D.value,S.value))])}}}return new h(f.op,f.fn,[x,S])}if(isFunctionNode(f))return new p(e(f.fn),f.args.map((t=>e(t,y))));if(isArrayNode(f))return new u(f.items.map((t=>e(t,y))));if(isAccessorNode(f))return new l(e(f.object,y),e(f.index,y));if(isIndexNode(f))return new d(f.dimensions.map((t=>e(t,y))));if(isObjectNode(f)){var O={};for(var I in f.properties)O[I]=e(f.properties[I],y);return new m(O)}}return f}})),name$n="resolve",dependencies$n=["parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],createResolve=factory(name$n,dependencies$n,(e=>{var{parse:t,ConstantNode:n,FunctionNode:r,OperatorNode:a,ParenthesisNode:i}=e;return function e(s,o){var l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;if(!o)return s;if(isMap$1(o)||(o=createMap$1(o)),isSymbolNode(s)){if(l.has(s.name)){var u=Array.from(l).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(u,"}"))}var c=o.get(s.name);if(isNode(c)){var p=new Set(l);return p.add(s.name),e(c,o,p)}return"number"==typeof c?t(String(c)):void 0!==c?new n(c):s}if(isOperatorNode(s)){var d=s.args.map((function(t){return e(t,o,l)}));return new a(s.op,s.fn,d,s.implicit)}if(isParenthesisNode(s))return new i(e(s.content,o,l));if(isFunctionNode(s)){var m=s.args.map((function(t){return e(t,o,l)}));return new r(s.name,m)}return s.map((t=>e(t,o,l)))}})),name$m="symbolicEqual",dependencies$m=["parse","simplify","typed","OperatorNode"],createSymbolicEqual=factory(name$m,dependencies$m,(e=>{var{parse:t,simplify:n,typed:r,OperatorNode:a}=e;return r(name$m,{"string, string":function(e,n){return this(t(e),t(n),{})},"string, string, Object":function(e,n,r){return this(t(e),t(n),r)},"Node, string":function(e,n){return this(e,t(n),{})},"Node, string, Object":function(e,n,r){return this(e,t(n),r)},"string, Node":function(e,n){return this(t(e),n,{})},"string, Node, Object":function(e,n,r){return this(t(e),n,r)},"Node, Node":function(e,t){return this(e,t,{})},"Node, Node, Object":function(e,t,r){var i=new a("-","subtract",[e,t]),s=n(i,{},r);return isConstantNode(s)&&!s.value}})})),name$l="derivative",dependencies$l=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],createDerivative=factory(name$l,dependencies$l,(e=>{var{typed:t,config:n,parse:r,simplify:a,equal:i,isZero:s,numeric:o,ConstantNode:l,FunctionNode:u,OperatorNode:c,ParenthesisNode:p,SymbolNode:d}=e,m=t("derivative",{"Node, SymbolNode, Object":function(e,t,n){var r={};f(r,e,t.name);var i=y(e,r);return n.simplify?a(i):i},"Node, SymbolNode":function(e,t){return this(e,t,{simplify:!0})},"string, SymbolNode":function(e,t){return this(r(e),t)},"string, SymbolNode, Object":function(e,t,n){return this(r(e),t,n)},"string, string":function(e,t){return this(r(e),r(t))},"string, string, Object":function(e,t,n){return this(r(e),r(t),n)},"Node, string":function(e,t){return this(e,r(t))},"Node, string, Object":function(e,t,n){return this(e,r(t),n)}});m._simplify=!0,m.toTex=function(e){return h.apply(null,e.args)};var h=t("_derivTex",{"Node, SymbolNode":function(e,t){return isConstantNode(e)&&"string"===typeOf$1(e.value)?h(r(e.value).toString(),t.toString(),1):h(e.toTex(),t.toString(),1)},"Node, ConstantNode":function(e,t){if("string"===typeOf$1(t.value))return h(e,r(t.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(e,t,n){return h(e.toString(),t.name,n.value)},"string, string, number":function(e,t,n){return(1===n?"{d\\over d"+t+"}":"{d^{"+n+"}\\over d"+t+"^{"+n+"}}")+"\\left[".concat(e,"\\right]")}}),f=t("constTag",{"Object, ConstantNode, string":function(e,t){return e[t]=!0,!0},"Object, SymbolNode, string":function(e,t,n){return t.name!==n&&(e[t]=!0,!0)},"Object, ParenthesisNode, string":function(e,t,n){return f(e,t.content,n)},"Object, FunctionAssignmentNode, string":function(e,t,n){return-1===t.params.indexOf(n)?(e[t]=!0,!0):f(e,t.expr,n)},"Object, FunctionNode | OperatorNode, string":function(e,t,n){if(t.args.length>0){for(var r=f(e,t.args[0],n),a=1;a0){var r=e.args.filter((function(e){return void 0===t[e]})),a=1===r.length?r[0]:new c("*","multiply",r),o=n.concat(y(a,t));return new c("*","multiply",o)}return new c("+","add",e.args.map((function(n){return new c("*","multiply",e.args.map((function(e){return e===n?y(e,t):e.clone()})))})))}if("/"===e.op&&e.isBinary()){var l=e.args[0],p=e.args[1];return void 0!==t[p]?new c("/","divide",[y(l,t),p]):void 0!==t[l]?new c("*","multiply",[new c("-","unaryMinus",[l]),new c("/","divide",[y(p,t),new c("^","pow",[p.clone(),g(2)])])]):new c("/","divide",[new c("-","subtract",[new c("*","multiply",[y(l,t),p.clone()]),new c("*","multiply",[l.clone(),y(p,t)])]),new c("^","pow",[p.clone(),g(2)])])}if("^"===e.op&&e.isBinary()){var d=e.args[0],m=e.args[1];if(void 0!==t[d])return isConstantNode(d)&&(s(d.value)||i(d.value,1))?g(0):new c("*","multiply",[e,new c("*","multiply",[new u("log",[d.clone()]),y(m.clone(),t)])]);if(void 0!==t[m]){if(isConstantNode(m)){if(s(m.value))return g(0);if(i(m.value,1))return y(d,t)}var h=new c("^","pow",[d.clone(),new c("-","subtract",[m,g(1)])]);return new c("*","multiply",[m.clone(),new c("*","multiply",[y(d,t),h])])}return new c("*","multiply",[new c("^","pow",[d.clone(),m.clone()]),new c("+","add",[new c("*","multiply",[y(d,t),new c("/","divide",[m.clone(),d.clone()])]),new c("*","multiply",[y(m,t),new u("log",[d.clone()])])])])}throw new Error('Operator "'+e.op+'" is not supported by derivative, or a wrong number of arguments is passed')}});function g(e,t){return new l(o(e,t||n.number))}return m})),name$k="rationalize",dependencies$k=["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"],createRationalize=factory(name$k,dependencies$k,(e=>{var{config:t,typed:n,equal:r,isZero:a,add:i,subtract:s,multiply:o,divide:l,pow:u,parse:c,simplifyCore:p,simplify:d,fraction:m,bignumber:h,mathWithTransform:f,matrix:y,AccessorNode:g,ArrayNode:b,ConstantNode:v,FunctionNode:N,IndexNode:T,ObjectNode:C,OperatorNode:A,SymbolNode:V,ParenthesisNode:x}=e,S=createSimplifyConstant({typed:n,config:t,mathWithTransform:f,matrix:y,fraction:m,bignumber:h,AccessorNode:g,ArrayNode:b,ConstantNode:v,FunctionNode:N,IndexNode:T,ObjectNode:C,OperatorNode:A,SymbolNode:V});return n(name$k,{string:function(e){return this(c(e),{},!1)},"string, boolean":function(e,t){return this(c(e),{},t)},"string, Object":function(e,t){return this(c(e),t,!1)},"string, Object, boolean":function(e,t,n){return this(c(e),t,n)},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,n){var r=function(){var e=[p,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},S,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}],t=[{l:"(-n1)/(-n2)",r:"n1/n2"},{l:"(-n1)*(-n2)",r:"n1*n2"},{l:"n1--n2",r:"n1+n2"},{l:"n1-n2",r:"n1+(-n2)"},{l:"(n1+n2)*n3",r:"(n1*n3 + n2*n3)"},{l:"n1*(n2+n3)",r:"(n1*n2+n1*n3)"},{l:"c1*n + c2*n",r:"(c1+c2)*n"},{l:"c1*n + n",r:"(c1+1)*n"},{l:"c1*n - c2*n",r:"(c1-c2)*n"},{l:"c1*n - n",r:"(c1-1)*n"},{l:"v/c",r:"(1/c)*v"},{l:"v/-c",r:"-(1/c)*v"},{l:"-v*-c",r:"c*v"},{l:"-v*c",r:"-c*v"},{l:"v*-c",r:"-c*v"},{l:"v*c",r:"c*v"},{l:"-(-n1*n2)",r:"(n1*n2)"},{l:"-(n1*n2)",r:"(-n1*n2)"},{l:"-(-n1+n2)",r:"(n1-n2)"},{l:"-(n1+n2)",r:"(-n1-n2)"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"},{l:"-(-n1/n2)",r:"(n1/n2)"},{l:"-(n1/n2)",r:"(-n1/n2)"}],n=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],r={};return r.firstRules=e.concat(t,n),r.distrDivRules=[{l:"(n1/n2 + n3/n4)",r:"((n1*n4 + n3*n2)/(n2*n4))"},{l:"(n1/n2 + n3)",r:"((n1 + n3*n2)/n2)"},{l:"(n1 + n2/n3)",r:"((n1*n3 + n2)/n3)"}],r.sucDivRules=n,r.firstRulesAgain=e.concat(t),r.finalRules=[p,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},S,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],r}(),a=function(e,t,n,r){var a=[],i=d(e,r,t,{exactFractions:!1}),s="+-*"+((n=!!n)?"/":"");!function e(t){var n=t.type;if("FunctionNode"===n)throw new Error("There is an unsolved function call");if("OperatorNode"===n)if("^"===t.op){if("ConstantNode"!==t.args[1].type||!isInteger$1(parseFloat(t.args[1].value)))throw new Error("There is a non-integer exponent");e(t.args[0])}else{if(-1===s.indexOf(t.op))throw new Error("Operator "+t.op+" invalid in polynomial expression");for(var r=0;r=1){var l,u;e=w(e);var c,m=!0,h=!1;for(e=d(e,r.firstRules,{},s);u=m?r.distrDivRules:r.sucDivRules,m=!m,(c=(e=d(e,u,{},o)).toString())!==l;)h=!0,l=c;h&&(e=d(e,r.firstRulesAgain,{},s)),e=d(e,r.finalRules,{},s)}var f=[],y={};return"OperatorNode"===e.type&&e.isBinary()&&"/"===e.op?(1===i&&(e.args[0]=E(e.args[0],f),e.args[1]=E(e.args[1])),n&&(y.numerator=e.args[0],y.denominator=e.args[1])):(1===i&&(e=E(e,f)),n&&(y.numerator=e,y.denominator=null)),n?(y.coefficients=f,y.variables=a.variables,y.expression=e,y):e}});function w(e,t,n){var r=e.type,a=arguments.length>1;if("OperatorNode"===r&&e.isBinary()){var i,s=!1;if("^"===e.op&&("ParenthesisNode"!==e.args[0].type&&"OperatorNode"!==e.args[0].type||"ConstantNode"!==e.args[1].type||(s=(i=parseFloat(e.args[1].value))>=2&&isInteger$1(i))),s){if(i>2){var o=e.args[0],l=new A("^","pow",[e.args[0].cloneDeep(),new v(i-1)]);e=new A("*","multiply",[o,l])}else e=new A("*","multiply",[e.args[0],e.args[0].cloneDeep()]);a&&("content"===n?t.content=e:t.args[n]=e)}}if("ParenthesisNode"===r)w(e.content,e,"content");else if("ConstantNode"!==r&&"SymbolNode"!==r)for(var u=0;un&&(t[u]=0),t[u]+=s.cte*("+"===s.oper?1:-1),void(n=Math.max(u,n))}s.cte=u,""===s.fire&&(t[0]+=s.cte*("+"===s.oper?1:-1))}}(e,null,{cte:1,oper:"+",fire:""});for(var a,i=!0,s=n=t.length-1;s>=0;s--)if(0!==t[s]){var o=new v(i?t[s]:Math.abs(t[s])),l=t[s]<0?"-":"+";if(s>0){var u=new V(r);if(s>1){var c=new v(s);u=new A("^","pow",[u,c])}o=-1===t[s]&&i?new A("-","unaryMinus",[u]):1===Math.abs(t[s])?u:new A("*","multiply",[o,u])}a=i?o:"+"===l?new A("+","add",[a,o]):new A("-","subtract",[a,o]),i=!1}return i?new v(0):a}})),name$j="reviver",dependencies$j=["classes"],createReviver=factory(name$j,dependencies$j,(e=>{var{classes:t}=e;return function(e,n){var r=t[n&&n.mathjs];return r&&"function"==typeof r.fromJSON?r.fromJSON(n):n}})),name$i="replacer",dependencies$i=[],createReplacer=factory(name$i,dependencies$i,(()=>function(e,t){return"number"!=typeof t||isFinite(t)&&!isNaN(t)?t:{mathjs:"number",value:String(t)}})),version$2="10.6.4",createTrue=factory("true",[],(()=>!0)),createFalse=factory("false",[],(()=>!1)),createNull=factory("null",[],(()=>null)),createInfinity=recreateFactory("Infinity",["config","?BigNumber"],(e=>{var{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(1/0):1/0})),createNaN=recreateFactory("NaN",["config","?BigNumber"],(e=>{var{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(NaN):NaN})),createPi=recreateFactory("pi",["config","?BigNumber"],(e=>{var{config:t,BigNumber:n}=e;return"BigNumber"===t.number?createBigNumberPi(n):pi$1})),createTau=recreateFactory("tau",["config","?BigNumber"],(e=>{var{config:t,BigNumber:n}=e;return"BigNumber"===t.number?createBigNumberTau(n):tau$1})),createE=recreateFactory("e",["config","?BigNumber"],(e=>{var{config:t,BigNumber:n}=e;return"BigNumber"===t.number?createBigNumberE(n):e$1})),createPhi=recreateFactory("phi",["config","?BigNumber"],(e=>{var{config:t,BigNumber:n}=e;return"BigNumber"===t.number?createBigNumberPhi(n):phi$1})),createLN2=recreateFactory("LN2",["config","?BigNumber"],(e=>{var{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(2).ln():Math.LN2})),createLN10=recreateFactory("LN10",["config","?BigNumber"],(e=>{var{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(10).ln():Math.LN10})),createLOG2E=recreateFactory("LOG2E",["config","?BigNumber"],(e=>{var{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(1).div(new n(2).ln()):Math.LOG2E})),createLOG10E=recreateFactory("LOG10E",["config","?BigNumber"],(e=>{var{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(1).div(new n(10).ln()):Math.LOG10E})),createSQRT1_2=recreateFactory("SQRT1_2",["config","?BigNumber"],(e=>{var{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n("0.5").sqrt():Math.SQRT1_2})),createSQRT2=recreateFactory("SQRT2",["config","?BigNumber"],(e=>{var{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(2).sqrt():Math.SQRT2})),createI=recreateFactory("i",["Complex"],(e=>{var{Complex:t}=e;return t.I})),createUppercasePi=factory("PI",["pi"],(e=>{var{pi:t}=e;return t})),createUppercaseE=factory("E",["e"],(e=>{var{e:t}=e;return t})),createVersion=factory("version",[],(()=>version$2));function recreateFactory(e,t,n){return factory(e,t,n,{recreateOnConfigChange:!0})}var createSpeedOfLight=unitFactory("speedOfLight","299792458","m s^-1"),createGravitationConstant=unitFactory("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),createPlanckConstant=unitFactory("planckConstant","6.62607015e-34","J s"),createReducedPlanckConstant=unitFactory("reducedPlanckConstant","1.0545718176461565e-34","J s"),createMagneticConstant=unitFactory("magneticConstant","1.25663706212e-6","N A^-2"),createElectricConstant=unitFactory("electricConstant","8.8541878128e-12","F m^-1"),createVacuumImpedance=unitFactory("vacuumImpedance","376.730313667","ohm"),createCoulomb=unitFactory("coulomb","8.987551792261171e9","N m^2 C^-2"),createElementaryCharge=unitFactory("elementaryCharge","1.602176634e-19","C"),createBohrMagneton=unitFactory("bohrMagneton","9.2740100783e-24","J T^-1"),createConductanceQuantum=unitFactory("conductanceQuantum","7.748091729863649e-5","S"),createInverseConductanceQuantum=unitFactory("inverseConductanceQuantum","12906.403729652257","ohm"),createMagneticFluxQuantum=unitFactory("magneticFluxQuantum","2.0678338484619295e-15","Wb"),createNuclearMagneton=unitFactory("nuclearMagneton","5.0507837461e-27","J T^-1"),createKlitzing=unitFactory("klitzing","25812.807459304513","ohm"),createBohrRadius=unitFactory("bohrRadius","5.29177210903e-11","m"),createClassicalElectronRadius=unitFactory("classicalElectronRadius","2.8179403262e-15","m"),createElectronMass=unitFactory("electronMass","9.1093837015e-31","kg"),createFermiCoupling=unitFactory("fermiCoupling","1.1663787e-5","GeV^-2"),createFineStructure=numberFactory("fineStructure",.0072973525693),createHartreeEnergy=unitFactory("hartreeEnergy","4.3597447222071e-18","J"),createProtonMass=unitFactory("protonMass","1.67262192369e-27","kg"),createDeuteronMass=unitFactory("deuteronMass","3.3435830926e-27","kg"),createNeutronMass=unitFactory("neutronMass","1.6749271613e-27","kg"),createQuantumOfCirculation=unitFactory("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),createRydberg=unitFactory("rydberg","10973731.568160","m^-1"),createThomsonCrossSection=unitFactory("thomsonCrossSection","6.6524587321e-29","m^2"),createWeakMixingAngle=numberFactory("weakMixingAngle",.2229),createEfimovFactor=numberFactory("efimovFactor",22.7),createAtomicMass=unitFactory("atomicMass","1.66053906660e-27","kg"),createAvogadro=unitFactory("avogadro","6.02214076e23","mol^-1"),createBoltzmann=unitFactory("boltzmann","1.380649e-23","J K^-1"),createFaraday=unitFactory("faraday","96485.33212331001","C mol^-1"),createFirstRadiation=unitFactory("firstRadiation","3.7417718521927573e-16","W m^2"),createLoschmidt=unitFactory("loschmidt","2.686780111798444e25","m^-3"),createGasConstant=unitFactory("gasConstant","8.31446261815324","J K^-1 mol^-1"),createMolarPlanckConstant=unitFactory("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),createMolarVolume=unitFactory("molarVolume","0.022413969545014137","m^3 mol^-1"),createSackurTetrode=numberFactory("sackurTetrode",-1.16487052358),createSecondRadiation=unitFactory("secondRadiation","0.014387768775039337","m K"),createStefanBoltzmann=unitFactory("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),createWienDisplacement=unitFactory("wienDisplacement","2.897771955e-3","m K"),createMolarMass=unitFactory("molarMass","0.99999999965e-3","kg mol^-1"),createMolarMassC12=unitFactory("molarMassC12","11.9999999958e-3","kg mol^-1"),createGravity=unitFactory("gravity","9.80665","m s^-2"),createPlanckLength=unitFactory("planckLength","1.616255e-35","m"),createPlanckMass=unitFactory("planckMass","2.176435e-8","kg"),createPlanckTime=unitFactory("planckTime","5.391245e-44","s"),createPlanckCharge=unitFactory("planckCharge","1.87554603778e-18","C"),createPlanckTemperature=unitFactory("planckTemperature","1.416785e+32","K");function unitFactory(e,t,n){return factory(e,["config","Unit","BigNumber"],(e=>{var{config:r,Unit:a,BigNumber:i}=e,s=new a("BigNumber"===r.number?new i(t):parseFloat(t),n);return s.fixPrefix=!0,s}))}function numberFactory(e,t){return factory(e,["config","BigNumber"],(e=>{var{config:n,BigNumber:r}=e;return"BigNumber"===n.number?new r(t):t}))}var name$h="apply",dependencies$h=["typed","isInteger"],createApplyTransform=factory(name$h,dependencies$h,(e=>{var{typed:t,isInteger:n}=e,r=createApply({typed:t,isInteger:n});return t("apply",{"...any":function(e){var t=e[1];isNumber$1(t)?e[1]=t-1:isBigNumber(t)&&(e[1]=t.minus(1));try{return r.apply(null,e)}catch(e){throw errorTransform(e)}}})}),{isTransformFunction:!0}),name$g="column",dependencies$g=["typed","Index","matrix","range"],createColumnTransform=factory(name$g,dependencies$g,(e=>{var{typed:t,Index:n,matrix:r,range:a}=e,i=createColumn({typed:t,Index:n,matrix:r,range:a});return t("column",{"...any":function(e){var t=e.length-1,n=e[t];isNumber$1(n)&&(e[t]=n-1);try{return i.apply(null,e)}catch(e){throw errorTransform(e)}}})}),{isTransformFunction:!0});function compileInlineExpression(e,t,n){var r=e.filter((function(e){return isSymbolNode(e)&&!(e.name in t)&&!n.has(e.name)}))[0];if(!r)throw new Error('No undefined variable found in inline expression "'+e+'"');var a=r.name,i=createSubScope(n),s=e.compile();return function(e){return i.set(a,e),s.evaluate(i)}}var name$f="filter",dependencies$f=["typed"],createFilterTransform=factory(name$f,dependencies$f,(e=>{var{typed:t}=e;function n(e,t,n){var a,i;return e[0]&&(a=e[0].compile().evaluate(n)),e[1]&&(i=isSymbolNode(e[1])||isFunctionAssignmentNode(e[1])?e[1].compile().evaluate(n):compileInlineExpression(e[1],t,n)),r(a,i)}n.rawArgs=!0;var r=t("filter",{"Array, function":_filter,"Matrix, function":function(e,t){return e.create(_filter(e.toArray(),t))},"Array, RegExp":filterRegExp,"Matrix, RegExp":function(e,t){return e.create(filterRegExp(e.toArray(),t))}});return n}),{isTransformFunction:!0});function _filter(e,t){var n=maxArgumentCount(t);return filter$2(e,(function(e,r,a){return 1===n?t(e):2===n?t(e,[r+1]):t(e,[r+1],a)}))}var name$e="forEach",dependencies$e=["typed"],createForEachTransform=factory(name$e,dependencies$e,(e=>{var{typed:t}=e;function n(e,t,n){var a,i;return e[0]&&(a=e[0].compile().evaluate(n)),e[1]&&(i=isSymbolNode(e[1])||isFunctionAssignmentNode(e[1])?e[1].compile().evaluate(n):compileInlineExpression(e[1],t,n)),r(a,i)}n.rawArgs=!0;var r=t("forEach",{"Array | Matrix, function":function(e,t){var n=maxArgumentCount(t);!function r(a,i){Array.isArray(a)?forEach$1(a,(function(e,t){r(e,i.concat(t+1))})):1===n?t(a):2===n?t(a,i):t(a,i,e)}(e.valueOf(),[])}});return n}),{isTransformFunction:!0}),name$d="index",dependencies$d=["Index"],createIndexTransform=factory(name$d,dependencies$d,(e=>{var{Index:t}=e;return function(){for(var e=[],n=0,r=arguments.length;n0?0:2;else if(a&&!0===a.isSet)a=a.map((function(e){return e-1}));else if(isArray$1(a)||isMatrix(a))a=a.map((function(e){return e-1}));else if(isNumber$1(a))a--;else if(isBigNumber(a))a=a.toNumber()-1;else if("string"!=typeof a)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");e[n]=a}var i=new t;return t.apply(i,e),i}}),{isTransformFunction:!0}),name$c="map",dependencies$c=["typed"],createMapTransform=factory(name$c,dependencies$c,(e=>{var{typed:t}=e;function n(e,t,n){var a,i;return e[0]&&(a=e[0].compile().evaluate(n)),e[1]&&(i=isSymbolNode(e[1])||isFunctionAssignmentNode(e[1])?e[1].compile().evaluate(n):compileInlineExpression(e[1],t,n)),r(a,i)}n.rawArgs=!0;var r=t("map",{"Array, function":function(e,t){return _map(e,t,e)},"Matrix, function":function(e,t){return e.create(_map(e.valueOf(),t,e))}});return n}),{isTransformFunction:!0});function _map(e,t,n){var r=maxArgumentCount(t);return function e(a,i){return Array.isArray(a)?map$2(a,(function(t,n){return e(t,i.concat(n+1))})):1===r?t(a):2===r?t(a,i):t(a,i,n)}(e,[])}function lastDimToZeroBase(e){if(2===e.length&&isCollection(e[0])){var t=(e=e.slice())[1];isNumber$1(t)?e[1]=t-1:isBigNumber(t)&&(e[1]=t.minus(1))}return e}var name$b="max",dependencies$b=["typed","config","numeric","larger"],createMaxTransform=factory(name$b,dependencies$b,(e=>{var{typed:t,config:n,numeric:r,larger:a}=e,i=createMax({typed:t,config:n,numeric:r,larger:a});return t("max",{"...any":function(e){e=lastDimToZeroBase(e);try{return i.apply(null,e)}catch(e){throw errorTransform(e)}}})}),{isTransformFunction:!0}),name$a="mean",dependencies$a=["typed","add","divide"],createMeanTransform=factory(name$a,dependencies$a,(e=>{var{typed:t,add:n,divide:r}=e,a=createMean({typed:t,add:n,divide:r});return t("mean",{"...any":function(e){e=lastDimToZeroBase(e);try{return a.apply(null,e)}catch(e){throw errorTransform(e)}}})}),{isTransformFunction:!0}),name$9="min",dependencies$9=["typed","config","numeric","smaller"],createMinTransform=factory(name$9,dependencies$9,(e=>{var{typed:t,config:n,numeric:r,smaller:a}=e,i=createMin({typed:t,config:n,numeric:r,smaller:a});return t("min",{"...any":function(e){e=lastDimToZeroBase(e);try{return i.apply(null,e)}catch(e){throw errorTransform(e)}}})}),{isTransformFunction:!0}),name$8="range",dependencies$8=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq"],createRangeTransform=factory(name$8,dependencies$8,(e=>{var{typed:t,config:n,matrix:r,bignumber:a,smaller:i,smallerEq:s,larger:o,largerEq:l}=e,u=createRange({typed:t,config:n,matrix:r,bignumber:a,smaller:i,smallerEq:s,larger:o,largerEq:l});return t("range",{"...any":function(e){return"boolean"!=typeof e[e.length-1]&&e.push(!0),u.apply(null,e)}})}),{isTransformFunction:!0}),name$7="row",dependencies$7=["typed","Index","matrix","range"],createRowTransform=factory(name$7,dependencies$7,(e=>{var{typed:t,Index:n,matrix:r,range:a}=e,i=createRow({typed:t,Index:n,matrix:r,range:a});return t("row",{"...any":function(e){var t=e.length-1,n=e[t];isNumber$1(n)&&(e[t]=n-1);try{return i.apply(null,e)}catch(e){throw errorTransform(e)}}})}),{isTransformFunction:!0}),name$6="subset",dependencies$6=["typed","matrix"],createSubsetTransform=factory(name$6,dependencies$6,(e=>{var{typed:t,matrix:n}=e,r=createSubset({typed:t,matrix:n});return t("subset",{"...any":function(e){try{return r.apply(null,e)}catch(e){throw errorTransform(e)}}})}),{isTransformFunction:!0}),name$5="concat",dependencies$5=["typed","matrix","isInteger"],createConcatTransform=factory(name$5,dependencies$5,(e=>{var{typed:t,matrix:n,isInteger:r}=e,a=createConcat({typed:t,matrix:n,isInteger:r});return t("concat",{"...any":function(e){var t=e.length-1,n=e[t];isNumber$1(n)?e[t]=n-1:isBigNumber(n)&&(e[t]=n.minus(1));try{return a.apply(null,e)}catch(e){throw errorTransform(e)}}})}),{isTransformFunction:!0}),name$4="diff",dependencies$4=["typed","matrix","subtract","number","bignumber"],createDiffTransform=factory(name$4,dependencies$4,(e=>{var{typed:t,matrix:n,subtract:r,number:a,bignumber:i}=e,s=createDiff({typed:t,matrix:n,subtract:r,number:a,bignumber:i});return t(name$4,{"...any":function(e){e=lastDimToZeroBase(e);try{return s.apply(null,e)}catch(e){throw errorTransform(e)}}})}),{isTransformFunction:!0}),name$3="std",dependencies$3=["typed","sqrt","variance"],createStdTransform=factory(name$3,dependencies$3,(e=>{var{typed:t,sqrt:n,variance:r}=e,a=createStd({typed:t,sqrt:n,variance:r});return t("std",{"...any":function(e){e=lastDimToZeroBase(e);try{return a.apply(null,e)}catch(e){throw errorTransform(e)}}})}),{isTransformFunction:!0}),name$2="sum",dependencies$2=["typed","config","add","numeric"],createSumTransform=factory(name$2,dependencies$2,(e=>{var{typed:t,config:n,add:r,numeric:a}=e,i=createSum({typed:t,config:n,add:r,numeric:a});return t(name$2,{"...any":function(e){e=lastDimToZeroBase(e);try{return i.apply(null,e)}catch(e){throw errorTransform(e)}}})}),{isTransformFunction:!0}),name$1="cumsum",dependencies$1=["typed","add","unaryPlus"],createCumSumTransform=factory(name$1,dependencies$1,(e=>{var{typed:t,add:n,unaryPlus:r}=e,a=createCumSum({typed:t,add:n,unaryPlus:r});return t(name$1,{"...any":function(e){if(2===e.length&&isCollection(e[0])){var t=e[1];isNumber$1(t)?e[1]=t-1:isBigNumber(t)&&(e[1]=t.minus(1))}try{return a.apply(null,e)}catch(e){throw errorTransform(e)}}})}),{isTransformFunction:!0}),name="variance",dependencies=["typed","add","subtract","multiply","divide","apply","isNaN"],createVarianceTransform=factory(name,dependencies,(e=>{var{typed:t,add:n,subtract:r,multiply:a,divide:i,apply:s,isNaN:o}=e,l=createVariance({typed:t,add:n,subtract:r,multiply:a,divide:i,apply:s,isNaN:o});return t(name,{"...any":function(e){e=lastDimToZeroBase(e);try{return l.apply(null,e)}catch(e){throw errorTransform(e)}}})}),{isTransformFunction:!0}),allFactories=Object.freeze({__proto__:null,createTyped:createTyped,createResultSet:createResultSet,createBigNumberClass:createBigNumberClass,createComplexClass:createComplexClass,createFractionClass:createFractionClass,createRangeClass:createRangeClass,createMatrixClass:createMatrixClass,createDenseMatrixClass:createDenseMatrixClass,createClone:createClone,createIsInteger:createIsInteger,createIsNegative:createIsNegative,createIsNumeric:createIsNumeric,createHasNumericValue:createHasNumericValue,createIsPositive:createIsPositive,createIsZero:createIsZero,createIsNaN:createIsNaN,createTypeOf:createTypeOf,createEqualScalar:createEqualScalar,createSparseMatrixClass:createSparseMatrixClass,createNumber:createNumber,createString:createString,createBoolean:createBoolean,createBignumber:createBignumber,createComplex:createComplex,createFraction:createFraction,createMatrix:createMatrix,createMatrixFromFunction:createMatrixFromFunction,createMatrixFromRows:createMatrixFromRows,createMatrixFromColumns:createMatrixFromColumns,createSplitUnit:createSplitUnit,createUnaryMinus:createUnaryMinus,createUnaryPlus:createUnaryPlus,createAbs:createAbs,createApply:createApply,createAddScalar:createAddScalar,createCbrt:createCbrt,createCeil:createCeil,createCube:createCube,createExp:createExp,createExpm1:createExpm1,createFix:createFix,createFloor:createFloor,createGcd:createGcd,createLcm:createLcm,createLog10:createLog10,createLog2:createLog2,createMod:createMod,createMultiplyScalar:createMultiplyScalar,createMultiply:createMultiply,createNthRoot:createNthRoot,createSign:createSign,createSqrt:createSqrt,createSquare:createSquare,createSubtract:createSubtract,createXgcd:createXgcd,createInvmod:createInvmod,createDotMultiply:createDotMultiply,createBitAnd:createBitAnd,createBitNot:createBitNot,createBitOr:createBitOr,createBitXor:createBitXor,createArg:createArg,createConj:createConj,createIm:createIm,createRe:createRe,createNot:createNot,createOr:createOr,createXor:createXor,createConcat:createConcat,createColumn:createColumn,createCount:createCount,createCross:createCross,createDiag:createDiag,createFilter:createFilter,createFlatten:createFlatten,createForEach:createForEach,createGetMatrixDataType:createGetMatrixDataType,createIdentity:createIdentity,createKron:createKron,createMap:createMap,createDiff:createDiff,createOnes:createOnes,createRange:createRange,createReshape:createReshape,createResize:createResize,createRotate:createRotate,createRotationMatrix:createRotationMatrix,createRow:createRow,createSize:createSize,createSqueeze:createSqueeze,createSubset:createSubset,createTranspose:createTranspose,createCtranspose:createCtranspose,createZeros:createZeros,createFft:createFft,createIfft:createIfft,createErf:createErf,createMode:createMode,createProd:createProd,createFormat:createFormat,createBin:createBin,createOct:createOct,createHex:createHex,createPrint:createPrint,createTo:createTo,createIsPrime:createIsPrime,createNumeric:createNumeric,createDivideScalar:createDivideScalar,createPow:createPow,createRound:createRound,createLog:createLog,createLog1p:createLog1p,createNthRoots:createNthRoots,createDotPow:createDotPow,createDotDivide:createDotDivide,createLsolve:createLsolve,createUsolve:createUsolve,createLsolveAll:createLsolveAll,createUsolveAll:createUsolveAll,createLeftShift:createLeftShift,createRightArithShift:createRightArithShift,createRightLogShift:createRightLogShift,createAnd:createAnd,createCompare:createCompare,createCompareNatural:createCompareNatural,createCompareText:createCompareText,createEqual:createEqual,createEqualText:createEqualText,createSmaller:createSmaller,createSmallerEq:createSmallerEq,createLarger:createLarger,createLargerEq:createLargerEq,createDeepEqual:createDeepEqual,createUnequal:createUnequal,createPartitionSelect:createPartitionSelect,createSort:createSort,createMax:createMax,createMin:createMin,createImmutableDenseMatrixClass:createImmutableDenseMatrixClass,createIndexClass:createIndexClass,createFibonacciHeapClass:createFibonacciHeapClass,createSpaClass:createSpaClass,createUnitClass:createUnitClass,createUnitFunction:createUnitFunction,createSparse:createSparse,createCreateUnit:createCreateUnit,createAcos:createAcos,createAcosh:createAcosh,createAcot:createAcot,createAcoth:createAcoth,createAcsc:createAcsc,createAcsch:createAcsch,createAsec:createAsec,createAsech:createAsech,createAsin:createAsin,createAsinh:createAsinh,createAtan:createAtan,createAtan2:createAtan2,createAtanh:createAtanh,createCos:createCos,createCosh:createCosh,createCot:createCot,createCoth:createCoth,createCsc:createCsc,createCsch:createCsch,createSec:createSec,createSech:createSech,createSin:createSin,createSinh:createSinh,createTan:createTan,createTanh:createTanh,createSetCartesian:createSetCartesian,createSetDifference:createSetDifference,createSetDistinct:createSetDistinct,createSetIntersect:createSetIntersect,createSetIsSubset:createSetIsSubset,createSetMultiplicity:createSetMultiplicity,createSetPowerset:createSetPowerset,createSetSize:createSetSize,createSetSymDifference:createSetSymDifference,createSetUnion:createSetUnion,createAdd:createAdd,createHypot:createHypot,createNorm:createNorm,createDot:createDot,createTrace:createTrace,createIndex:createIndex,createNode:createNode,createAccessorNode:createAccessorNode,createArrayNode:createArrayNode,createAssignmentNode:createAssignmentNode,createBlockNode:createBlockNode,createConditionalNode:createConditionalNode,createConstantNode:createConstantNode,createFunctionAssignmentNode:createFunctionAssignmentNode,createIndexNode:createIndexNode,createObjectNode:createObjectNode,createOperatorNode:createOperatorNode,createParenthesisNode:createParenthesisNode,createRangeNode:createRangeNode,createRelationalNode:createRelationalNode,createSymbolNode:createSymbolNode,createFunctionNode:createFunctionNode,createParse:createParse,createCompile:createCompile,createEvaluate:createEvaluate,createParserClass:createParserClass,createParser:createParser,createLup:createLup,createQr:createQr,createSlu:createSlu,createLusolve:createLusolve,createHelpClass:createHelpClass,createChainClass:createChainClass,createHelp:createHelp,createChain:createChain,createDet:createDet,createInv:createInv,createPinv:createPinv,createEigs:createEigs,createExpm:createExpm,createSqrtm:createSqrtm,createDivide:createDivide,createDistance:createDistance,createIntersect:createIntersect,createSum:createSum,createCumSum:createCumSum,createMean:createMean,createMedian:createMedian,createMad:createMad,createVariance:createVariance,createQuantileSeq:createQuantileSeq,createStd:createStd,createCombinations:createCombinations,createCombinationsWithRep:createCombinationsWithRep,createGamma:createGamma,createLgamma:createLgamma,createFactorial:createFactorial,createKldivergence:createKldivergence,createMultinomial:createMultinomial,createPermutations:createPermutations,createPickRandom:createPickRandom,createRandom:createRandom,createRandomInt:createRandomInt,createStirlingS2:createStirlingS2,createBellNumbers:createBellNumbers,createCatalan:createCatalan,createComposition:createComposition,createLeafCount:createLeafCount,createSimplify:createSimplify,createSimplifyCore:createSimplifyCore,createResolve:createResolve,createSymbolicEqual:createSymbolicEqual,createDerivative:createDerivative,createRationalize:createRationalize,createReviver:createReviver,createReplacer:createReplacer,createE:createE,createUppercaseE:createUppercaseE,createFalse:createFalse,createI:createI,createInfinity:createInfinity,createLN10:createLN10,createLN2:createLN2,createLOG10E:createLOG10E,createLOG2E:createLOG2E,createNaN:createNaN,createNull:createNull,createPhi:createPhi,createPi:createPi,createUppercasePi:createUppercasePi,createSQRT1_2:createSQRT1_2,createSQRT2:createSQRT2,createTau:createTau,createTrue:createTrue,createVersion:createVersion,createAtomicMass:createAtomicMass,createAvogadro:createAvogadro,createBohrMagneton:createBohrMagneton,createBohrRadius:createBohrRadius,createBoltzmann:createBoltzmann,createClassicalElectronRadius:createClassicalElectronRadius,createConductanceQuantum:createConductanceQuantum,createCoulomb:createCoulomb,createDeuteronMass:createDeuteronMass,createEfimovFactor:createEfimovFactor,createElectricConstant:createElectricConstant,createElectronMass:createElectronMass,createElementaryCharge:createElementaryCharge,createFaraday:createFaraday,createFermiCoupling:createFermiCoupling,createFineStructure:createFineStructure,createFirstRadiation:createFirstRadiation,createGasConstant:createGasConstant,createGravitationConstant:createGravitationConstant,createGravity:createGravity,createHartreeEnergy:createHartreeEnergy,createInverseConductanceQuantum:createInverseConductanceQuantum,createKlitzing:createKlitzing,createLoschmidt:createLoschmidt,createMagneticConstant:createMagneticConstant,createMagneticFluxQuantum:createMagneticFluxQuantum,createMolarMass:createMolarMass,createMolarMassC12:createMolarMassC12,createMolarPlanckConstant:createMolarPlanckConstant,createMolarVolume:createMolarVolume,createNeutronMass:createNeutronMass,createNuclearMagneton:createNuclearMagneton,createPlanckCharge:createPlanckCharge,createPlanckConstant:createPlanckConstant,createPlanckLength:createPlanckLength,createPlanckMass:createPlanckMass,createPlanckTemperature:createPlanckTemperature,createPlanckTime:createPlanckTime,createProtonMass:createProtonMass,createQuantumOfCirculation:createQuantumOfCirculation,createReducedPlanckConstant:createReducedPlanckConstant,createRydberg:createRydberg,createSackurTetrode:createSackurTetrode,createSecondRadiation:createSecondRadiation,createSpeedOfLight:createSpeedOfLight,createStefanBoltzmann:createStefanBoltzmann,createThomsonCrossSection:createThomsonCrossSection,createVacuumImpedance:createVacuumImpedance,createWeakMixingAngle:createWeakMixingAngle,createWienDisplacement:createWienDisplacement,createApplyTransform:createApplyTransform,createColumnTransform:createColumnTransform,createFilterTransform:createFilterTransform,createForEachTransform:createForEachTransform,createIndexTransform:createIndexTransform,createMapTransform:createMapTransform,createMaxTransform:createMaxTransform,createMeanTransform:createMeanTransform,createMinTransform:createMinTransform,createRangeTransform:createRangeTransform,createRowTransform:createRowTransform,createSubsetTransform:createSubsetTransform,createConcatTransform:createConcatTransform,createDiffTransform:createDiffTransform,createStdTransform:createStdTransform,createSumTransform:createSumTransform,createCumSumTransform:createCumSumTransform,createVarianceTransform:createVarianceTransform}),BigNumber=createBigNumberClass({config:config$2}),Complex=createComplexClass({}),e=createE({BigNumber:BigNumber,config:config$2}),_false=createFalse({}),fineStructure=createFineStructure({BigNumber:BigNumber,config:config$2}),Fraction=createFractionClass({}),i=createI({Complex:Complex}),_Infinity=createInfinity({BigNumber:BigNumber,config:config$2}),LN10=createLN10({BigNumber:BigNumber,config:config$2}),LOG10E=createLOG10E({BigNumber:BigNumber,config:config$2}),Matrix=createMatrixClass({}),_NaN=createNaN({BigNumber:BigNumber,config:config$2}),_null=createNull({}),phi=createPhi({BigNumber:BigNumber,config:config$2}),Range=createRangeClass({}),ResultSet=createResultSet({}),SQRT1_2=createSQRT1_2({BigNumber:BigNumber,config:config$2}),sackurTetrode=createSackurTetrode({BigNumber:BigNumber,config:config$2}),tau=createTau({BigNumber:BigNumber,config:config$2}),_true=createTrue({}),version$1=createVersion({}),DenseMatrix=createDenseMatrixClass({Matrix:Matrix}),efimovFactor=createEfimovFactor({BigNumber:BigNumber,config:config$2}),LN2=createLN2({BigNumber:BigNumber,config:config$2}),pi=createPi({BigNumber:BigNumber,config:config$2}),replacer=createReplacer({}),SQRT2=createSQRT2({BigNumber:BigNumber,config:config$2}),typed=createTyped({BigNumber:BigNumber,Complex:Complex,DenseMatrix:DenseMatrix,Fraction:Fraction}),unaryPlus=createUnaryPlus({BigNumber:BigNumber,config:config$2,typed:typed}),weakMixingAngle=createWeakMixingAngle({BigNumber:BigNumber,config:config$2}),abs$1=createAbs({typed:typed}),acos$1=createAcos({Complex:Complex,config:config$2,typed:typed}),acot$1=createAcot({BigNumber:BigNumber,typed:typed}),acsc$1=createAcsc({BigNumber:BigNumber,Complex:Complex,config:config$2,typed:typed}),addScalar=createAddScalar({typed:typed}),arg=createArg({typed:typed}),asech$1=createAsech({BigNumber:BigNumber,Complex:Complex,config:config$2,typed:typed}),asinh$1=createAsinh({typed:typed}),atan$1=createAtan({typed:typed}),atanh$1=createAtanh({Complex:Complex,config:config$2,typed:typed}),bignumber=createBignumber({BigNumber:BigNumber,typed:typed}),bitNot=createBitNot({typed:typed}),boolean=createBoolean({typed:typed}),clone$1=createClone({typed:typed}),combinations=createCombinations({typed:typed}),complex=createComplex({Complex:Complex,typed:typed}),conj$1=createConj({typed:typed}),cosh$1=createCosh({typed:typed}),coth$1=createCoth({BigNumber:BigNumber,typed:typed}),csc$1=createCsc({BigNumber:BigNumber,typed:typed}),cube=createCube({typed:typed}),equalScalar=createEqualScalar({config:config$2,typed:typed}),erf$1=createErf({typed:typed}),exp$1=createExp({typed:typed}),expm1=createExpm1({Complex:Complex,typed:typed}),filter$1=createFilter({typed:typed}),forEach=createForEach({typed:typed}),format=createFormat({typed:typed}),getMatrixDataType=createGetMatrixDataType({typed:typed}),hex=createHex({format:format,typed:typed}),im$1=createIm({typed:typed}),isInteger=createIsInteger({typed:typed}),isNegative=createIsNegative({typed:typed}),isPositive=createIsPositive({typed:typed}),isZero=createIsZero({typed:typed}),LOG2E=createLOG2E({BigNumber:BigNumber,config:config$2}),lgamma=createLgamma({Complex:Complex,typed:typed}),log10$1=createLog10({Complex:Complex,config:config$2,typed:typed}),log2=createLog2({Complex:Complex,config:config$2,typed:typed}),map$1=createMap({typed:typed}),multiplyScalar=createMultiplyScalar({typed:typed}),not=createNot({typed:typed}),number=createNumber({typed:typed}),oct=createOct({format:format,typed:typed}),pickRandom=createPickRandom({config:config$2,typed:typed}),print=createPrint({typed:typed}),random$1=createRandom({config:config$2,typed:typed}),re$1=createRe({typed:typed}),sec$1=createSec({BigNumber:BigNumber,typed:typed}),sign$1=createSign({BigNumber:BigNumber,Fraction:Fraction,complex:complex,typed:typed}),sin$1=createSin({typed:typed}),SparseMatrix=createSparseMatrixClass({Matrix:Matrix,equalScalar:equalScalar,typed:typed}),splitUnit=createSplitUnit({typed:typed}),square=createSquare({typed:typed}),string=createString({typed:typed}),tan$1=createTan({typed:typed}),typeOf=createTypeOf({typed:typed}),acosh$1=createAcosh({Complex:Complex,config:config$2,typed:typed}),acsch$1=createAcsch({BigNumber:BigNumber,typed:typed}),apply=createApply({isInteger:isInteger,typed:typed}),asec$1=createAsec({BigNumber:BigNumber,Complex:Complex,config:config$2,typed:typed}),bin=createBin({format:format,typed:typed}),combinationsWithRep=createCombinationsWithRep({typed:typed}),cos$1=createCos({typed:typed}),csch$1=createCsch({BigNumber:BigNumber,typed:typed}),isNaN$2=createIsNaN({typed:typed}),isPrime=createIsPrime({typed:typed}),randomInt=createRandomInt({config:config$2,typed:typed}),sech$1=createSech({BigNumber:BigNumber,typed:typed}),sinh$1=createSinh({typed:typed}),sparse=createSparse({SparseMatrix:SparseMatrix,typed:typed}),sqrt$1=createSqrt({Complex:Complex,config:config$2,typed:typed}),tanh$1=createTanh({typed:typed}),unaryMinus=createUnaryMinus({typed:typed}),acoth$1=createAcoth({BigNumber:BigNumber,Complex:Complex,config:config$2,typed:typed}),cot$1=createCot({BigNumber:BigNumber,typed:typed}),fraction=createFraction({Fraction:Fraction,typed:typed}),isNumeric=createIsNumeric({typed:typed}),matrix$2=createMatrix({DenseMatrix:DenseMatrix,Matrix:Matrix,SparseMatrix:SparseMatrix,typed:typed}),matrixFromFunction=createMatrixFromFunction({isZero:isZero,matrix:matrix$2,typed:typed}),mod$1=createMod({DenseMatrix:DenseMatrix,equalScalar:equalScalar,matrix:matrix$2,typed:typed}),nthRoot=createNthRoot({BigNumber:BigNumber,equalScalar:equalScalar,matrix:matrix$2,typed:typed}),numeric=createNumeric({bignumber:bignumber,fraction:fraction,number:number}),or=createOr({DenseMatrix:DenseMatrix,equalScalar:equalScalar,matrix:matrix$2,typed:typed}),prod=createProd({config:config$2,multiplyScalar:multiplyScalar,numeric:numeric,typed:typed}),reshape=createReshape({isInteger:isInteger,matrix:matrix$2,typed:typed}),size$1=createSize({matrix:matrix$2,config:config$2,typed:typed}),smaller=createSmaller({DenseMatrix:DenseMatrix,config:config$2,matrix:matrix$2,typed:typed}),squeeze=createSqueeze({matrix:matrix$2,typed:typed}),subset=createSubset({matrix:matrix$2,typed:typed}),subtract$1=createSubtract({DenseMatrix:DenseMatrix,addScalar:addScalar,equalScalar:equalScalar,matrix:matrix$2,typed:typed,unaryMinus:unaryMinus}),to=createTo({matrix:matrix$2,typed:typed}),transpose=createTranspose({matrix:matrix$2,typed:typed}),xgcd=createXgcd({BigNumber:BigNumber,config:config$2,matrix:matrix$2,typed:typed}),zeros=createZeros({BigNumber:BigNumber,config:config$2,matrix:matrix$2,typed:typed}),and=createAnd({equalScalar:equalScalar,matrix:matrix$2,not:not,typed:typed,zeros:zeros}),bitAnd=createBitAnd({equalScalar:equalScalar,matrix:matrix$2,typed:typed}),bitXor=createBitXor({DenseMatrix:DenseMatrix,matrix:matrix$2,typed:typed}),cbrt=createCbrt({BigNumber:BigNumber,Complex:Complex,Fraction:Fraction,config:config$2,isNegative:isNegative,matrix:matrix$2,typed:typed,unaryMinus:unaryMinus}),compare=createCompare({BigNumber:BigNumber,DenseMatrix:DenseMatrix,Fraction:Fraction,config:config$2,equalScalar:equalScalar,matrix:matrix$2,typed:typed}),compareText=createCompareText({matrix:matrix$2,typed:typed}),concat=createConcat({isInteger:isInteger,matrix:matrix$2,typed:typed}),count=createCount({prod:prod,size:size$1,typed:typed}),ctranspose=createCtranspose({conj:conj$1,transpose:transpose,typed:typed}),diag=createDiag({DenseMatrix:DenseMatrix,SparseMatrix:SparseMatrix,matrix:matrix$2,typed:typed}),divideScalar=createDivideScalar({numeric:numeric,typed:typed}),dotDivide=createDotDivide({DenseMatrix:DenseMatrix,divideScalar:divideScalar,equalScalar:equalScalar,matrix:matrix$2,typed:typed}),equal$1=createEqual({DenseMatrix:DenseMatrix,equalScalar:equalScalar,matrix:matrix$2,typed:typed}),fft=createFft({addScalar:addScalar,divideScalar:divideScalar,exp:exp$1,i:i,matrix:matrix$2,multiplyScalar:multiplyScalar,tau:tau,typed:typed}),flatten$3=createFlatten({matrix:matrix$2,typed:typed}),gcd=createGcd({BigNumber:BigNumber,DenseMatrix:DenseMatrix,equalScalar:equalScalar,matrix:matrix$2,typed:typed}),hasNumericValue=createHasNumericValue({isNumeric:isNumeric,typed:typed}),hypot=createHypot({abs:abs$1,addScalar:addScalar,divideScalar:divideScalar,isPositive:isPositive,multiplyScalar:multiplyScalar,smaller:smaller,sqrt:sqrt$1,typed:typed}),ifft=createIfft({conj:conj$1,dotDivide:dotDivide,fft:fft,typed:typed}),kron=createKron({matrix:matrix$2,multiplyScalar:multiplyScalar,typed:typed}),largerEq=createLargerEq({DenseMatrix:DenseMatrix,config:config$2,matrix:matrix$2,typed:typed}),leftShift=createLeftShift({DenseMatrix:DenseMatrix,equalScalar:equalScalar,matrix:matrix$2,typed:typed,zeros:zeros}),lsolve=createLsolve({DenseMatrix:DenseMatrix,divideScalar:divideScalar,equalScalar:equalScalar,matrix:matrix$2,multiplyScalar:multiplyScalar,subtract:subtract$1,typed:typed}),matrixFromColumns=createMatrixFromColumns({flatten:flatten$3,matrix:matrix$2,size:size$1,typed:typed}),min$1=createMin({config:config$2,numeric:numeric,smaller:smaller,typed:typed}),mode=createMode({isNaN:isNaN$2,isNumeric:isNumeric,typed:typed}),nthRoots=createNthRoots({Complex:Complex,config:config$2,divideScalar:divideScalar,typed:typed}),ones=createOnes({BigNumber:BigNumber,config:config$2,matrix:matrix$2,typed:typed}),partitionSelect=createPartitionSelect({compare:compare,isNaN:isNaN$2,isNumeric:isNumeric,typed:typed}),resize=createResize({config:config$2,matrix:matrix$2}),rightArithShift=createRightArithShift({DenseMatrix:DenseMatrix,equalScalar:equalScalar,matrix:matrix$2,typed:typed,zeros:zeros}),round$1=createRound({BigNumber:BigNumber,DenseMatrix:DenseMatrix,equalScalar:equalScalar,matrix:matrix$2,typed:typed,zeros:zeros}),smallerEq=createSmallerEq({DenseMatrix:DenseMatrix,config:config$2,matrix:matrix$2,typed:typed}),unequal=createUnequal({DenseMatrix:DenseMatrix,config:config$2,equalScalar:equalScalar,matrix:matrix$2,typed:typed}),usolve=createUsolve({DenseMatrix:DenseMatrix,divideScalar:divideScalar,equalScalar:equalScalar,matrix:matrix$2,multiplyScalar:multiplyScalar,subtract:subtract$1,typed:typed}),xor=createXor({DenseMatrix:DenseMatrix,matrix:matrix$2,typed:typed}),add$1=createAdd({DenseMatrix:DenseMatrix,SparseMatrix:SparseMatrix,addScalar:addScalar,equalScalar:equalScalar,matrix:matrix$2,typed:typed}),atan2$1=createAtan2({BigNumber:BigNumber,DenseMatrix:DenseMatrix,equalScalar:equalScalar,matrix:matrix$2,typed:typed}),bitOr=createBitOr({DenseMatrix:DenseMatrix,equalScalar:equalScalar,matrix:matrix$2,typed:typed}),catalan=createCatalan({addScalar:addScalar,combinations:combinations,divideScalar:divideScalar,isInteger:isInteger,isNegative:isNegative,multiplyScalar:multiplyScalar,typed:typed}),compareNatural=createCompareNatural({compare:compare,typed:typed}),cumsum=createCumSum({add:add$1,typed:typed,unaryPlus:unaryPlus}),deepEqual=createDeepEqual({equal:equal$1,typed:typed}),diff=createDiff({matrix:matrix$2,number:number,subtract:subtract$1,typed:typed}),dot=createDot({addScalar:addScalar,conj:conj$1,multiplyScalar:multiplyScalar,size:size$1,typed:typed}),equalText=createEqualText({compareText:compareText,isZero:isZero,typed:typed}),floor=createFloor({DenseMatrix:DenseMatrix,config:config$2,equalScalar:equalScalar,matrix:matrix$2,round:round$1,typed:typed,zeros:zeros}),identity$1=createIdentity({BigNumber:BigNumber,DenseMatrix:DenseMatrix,SparseMatrix:SparseMatrix,config:config$2,matrix:matrix$2,typed:typed}),invmod=createInvmod({BigNumber:BigNumber,add:add$1,config:config$2,equal:equal$1,isInteger:isInteger,mod:mod$1,smaller:smaller,typed:typed,xgcd:xgcd}),larger=createLarger({DenseMatrix:DenseMatrix,config:config$2,matrix:matrix$2,typed:typed}),log$1=createLog({Complex:Complex,config:config$2,divideScalar:divideScalar,typed:typed}),lsolveAll=createLsolveAll({DenseMatrix:DenseMatrix,divideScalar:divideScalar,equalScalar:equalScalar,matrix:matrix$2,multiplyScalar:multiplyScalar,subtract:subtract$1,typed:typed}),matrixFromRows=createMatrixFromRows({flatten:flatten$3,matrix:matrix$2,size:size$1,typed:typed}),multiply$1=createMultiply({addScalar:addScalar,dot:dot,equalScalar:equalScalar,matrix:matrix$2,multiplyScalar:multiplyScalar,typed:typed}),qr=createQr({addScalar:addScalar,complex:complex,conj:conj$1,divideScalar:divideScalar,equal:equal$1,identity:identity$1,isZero:isZero,matrix:matrix$2,multiplyScalar:multiplyScalar,sign:sign$1,sqrt:sqrt$1,subtract:subtract$1,typed:typed,unaryMinus:unaryMinus,zeros:zeros}),range$1=createRange({bignumber:bignumber,matrix:matrix$2,config:config$2,larger:larger,largerEq:largerEq,smaller:smaller,smallerEq:smallerEq,typed:typed}),rightLogShift=createRightLogShift({DenseMatrix:DenseMatrix,equalScalar:equalScalar,matrix:matrix$2,typed:typed,zeros:zeros}),setSize=createSetSize({compareNatural:compareNatural,typed:typed}),slu=createSlu({SparseMatrix:SparseMatrix,abs:abs$1,add:add$1,divideScalar:divideScalar,larger:larger,largerEq:largerEq,multiply:multiply$1,subtract:subtract$1,transpose:transpose,typed:typed}),sum=createSum({add:add$1,config:config$2,numeric:numeric,typed:typed}),trace=createTrace({add:add$1,matrix:matrix$2,typed:typed}),usolveAll=createUsolveAll({DenseMatrix:DenseMatrix,divideScalar:divideScalar,equalScalar:equalScalar,matrix:matrix$2,multiplyScalar:multiplyScalar,subtract:subtract$1,typed:typed}),asin$1=createAsin({Complex:Complex,config:config$2,typed:typed}),ceil=createCeil({DenseMatrix:DenseMatrix,config:config$2,equalScalar:equalScalar,matrix:matrix$2,round:round$1,typed:typed,zeros:zeros}),composition=createComposition({addScalar:addScalar,combinations:combinations,isInteger:isInteger,isNegative:isNegative,isPositive:isPositive,larger:larger,typed:typed}),cross=createCross({matrix:matrix$2,multiply:multiply$1,subtract:subtract$1,typed:typed}),det=createDet({divideScalar:divideScalar,isZero:isZero,matrix:matrix$2,multiply:multiply$1,subtract:subtract$1,typed:typed,unaryMinus:unaryMinus}),distance=createDistance({abs:abs$1,addScalar:addScalar,divideScalar:divideScalar,multiplyScalar:multiplyScalar,sqrt:sqrt$1,subtract:subtract$1,typed:typed,unaryMinus:unaryMinus}),dotMultiply=createDotMultiply({equalScalar:equalScalar,matrix:matrix$2,multiplyScalar:multiplyScalar,typed:typed}),FibonacciHeap=createFibonacciHeapClass({larger:larger,smaller:smaller}),fix=createFix({Complex:Complex,DenseMatrix:DenseMatrix,ceil:ceil,equalScalar:equalScalar,floor:floor,matrix:matrix$2,typed:typed,zeros:zeros}),ImmutableDenseMatrix=createImmutableDenseMatrixClass({DenseMatrix:DenseMatrix,smaller:smaller}),Index=createIndexClass({ImmutableDenseMatrix:ImmutableDenseMatrix}),intersect=createIntersect({abs:abs$1,add:add$1,addScalar:addScalar,config:config$2,divideScalar:divideScalar,equalScalar:equalScalar,flatten:flatten$3,isNumeric:isNumeric,isZero:isZero,matrix:matrix$2,multiply:multiply$1,multiplyScalar:multiplyScalar,smaller:smaller,subtract:subtract$1,typed:typed}),lcm=createLcm({equalScalar:equalScalar,matrix:matrix$2,typed:typed}),log1p=createLog1p({Complex:Complex,config:config$2,divideScalar:divideScalar,log:log$1,typed:typed}),max$1=createMax({config:config$2,larger:larger,numeric:numeric,typed:typed}),quantileSeq=createQuantileSeq({add:add$1,compare:compare,multiply:multiply$1,partitionSelect:partitionSelect,typed:typed}),row=createRow({Index:Index,matrix:matrix$2,range:range$1,typed:typed}),setCartesian=createSetCartesian({DenseMatrix:DenseMatrix,Index:Index,compareNatural:compareNatural,size:size$1,subset:subset,typed:typed}),setDistinct=createSetDistinct({DenseMatrix:DenseMatrix,Index:Index,compareNatural:compareNatural,size:size$1,subset:subset,typed:typed}),setIsSubset=createSetIsSubset({Index:Index,compareNatural:compareNatural,size:size$1,subset:subset,typed:typed}),setPowerset=createSetPowerset({Index:Index,compareNatural:compareNatural,size:size$1,subset:subset,typed:typed}),sort=createSort({compare:compare,compareNatural:compareNatural,matrix:matrix$2,typed:typed}),column=createColumn({Index:Index,matrix:matrix$2,range:range$1,typed:typed}),index=createIndex({Index:Index,typed:typed}),inv=createInv({abs:abs$1,addScalar:addScalar,det:det,divideScalar:divideScalar,identity:identity$1,matrix:matrix$2,multiply:multiply$1,typed:typed,unaryMinus:unaryMinus}),pinv=createPinv({Complex:Complex,add:add$1,ctranspose:ctranspose,deepEqual:deepEqual,divideScalar:divideScalar,dot:dot,dotDivide:dotDivide,equal:equal$1,inv:inv,matrix:matrix$2,multiply:multiply$1,typed:typed}),pow$1=createPow({Complex:Complex,config:config$2,fraction:fraction,identity:identity$1,inv:inv,matrix:matrix$2,multiply:multiply$1,number:number,typed:typed}),setDifference=createSetDifference({DenseMatrix:DenseMatrix,Index:Index,compareNatural:compareNatural,size:size$1,subset:subset,typed:typed}),setMultiplicity=createSetMultiplicity({Index:Index,compareNatural:compareNatural,size:size$1,subset:subset,typed:typed}),Spa=createSpaClass({FibonacciHeap:FibonacciHeap,addScalar:addScalar,equalScalar:equalScalar}),sqrtm=createSqrtm({abs:abs$1,add:add$1,identity:identity$1,inv:inv,max:max$1,multiply:multiply$1,size:size$1,sqrt:sqrt$1,subtract:subtract$1,typed:typed}),Unit=createUnitClass({BigNumber:BigNumber,Complex:Complex,Fraction:Fraction,abs:abs$1,addScalar:addScalar,config:config$2,divideScalar:divideScalar,equal:equal$1,fix:fix,format:format,isNumeric:isNumeric,multiplyScalar:multiplyScalar,number:number,pow:pow$1,round:round$1,subtract:subtract$1}),vacuumImpedance=createVacuumImpedance({BigNumber:BigNumber,Unit:Unit,config:config$2}),wienDisplacement=createWienDisplacement({BigNumber:BigNumber,Unit:Unit,config:config$2}),atomicMass=createAtomicMass({BigNumber:BigNumber,Unit:Unit,config:config$2}),bohrMagneton=createBohrMagneton({BigNumber:BigNumber,Unit:Unit,config:config$2}),boltzmann=createBoltzmann({BigNumber:BigNumber,Unit:Unit,config:config$2}),conductanceQuantum=createConductanceQuantum({BigNumber:BigNumber,Unit:Unit,config:config$2}),createUnit=createCreateUnit({Unit:Unit,typed:typed}),deuteronMass=createDeuteronMass({BigNumber:BigNumber,Unit:Unit,config:config$2}),dotPow=createDotPow({DenseMatrix:DenseMatrix,equalScalar:equalScalar,matrix:matrix$2,pow:pow$1,typed:typed}),electricConstant=createElectricConstant({BigNumber:BigNumber,Unit:Unit,config:config$2}),elementaryCharge=createElementaryCharge({BigNumber:BigNumber,Unit:Unit,config:config$2}),expm=createExpm({abs:abs$1,add:add$1,identity:identity$1,inv:inv,multiply:multiply$1,typed:typed}),faraday=createFaraday({BigNumber:BigNumber,Unit:Unit,config:config$2}),firstRadiation=createFirstRadiation({BigNumber:BigNumber,Unit:Unit,config:config$2}),gamma$1=createGamma({BigNumber:BigNumber,Complex:Complex,config:config$2,multiplyScalar:multiplyScalar,pow:pow$1,typed:typed}),gravitationConstant=createGravitationConstant({BigNumber:BigNumber,Unit:Unit,config:config$2}),hartreeEnergy=createHartreeEnergy({BigNumber:BigNumber,Unit:Unit,config:config$2}),klitzing=createKlitzing({BigNumber:BigNumber,Unit:Unit,config:config$2}),loschmidt=createLoschmidt({BigNumber:BigNumber,Unit:Unit,config:config$2}),magneticConstant=createMagneticConstant({BigNumber:BigNumber,Unit:Unit,config:config$2}),molarMass=createMolarMass({BigNumber:BigNumber,Unit:Unit,config:config$2}),molarPlanckConstant=createMolarPlanckConstant({BigNumber:BigNumber,Unit:Unit,config:config$2}),neutronMass=createNeutronMass({BigNumber:BigNumber,Unit:Unit,config:config$2}),nuclearMagneton=createNuclearMagneton({BigNumber:BigNumber,Unit:Unit,config:config$2}),planckCharge=createPlanckCharge({BigNumber:BigNumber,Unit:Unit,config:config$2}),planckLength=createPlanckLength({BigNumber:BigNumber,Unit:Unit,config:config$2}),planckTemperature=createPlanckTemperature({BigNumber:BigNumber,Unit:Unit,config:config$2}),protonMass=createProtonMass({BigNumber:BigNumber,Unit:Unit,config:config$2}),reducedPlanckConstant=createReducedPlanckConstant({BigNumber:BigNumber,Unit:Unit,config:config$2}),rydberg=createRydberg({BigNumber:BigNumber,Unit:Unit,config:config$2}),setIntersect=createSetIntersect({DenseMatrix:DenseMatrix,Index:Index,compareNatural:compareNatural,size:size$1,subset:subset,typed:typed}),speedOfLight=createSpeedOfLight({BigNumber:BigNumber,Unit:Unit,config:config$2}),stefanBoltzmann=createStefanBoltzmann({BigNumber:BigNumber,Unit:Unit,config:config$2}),thomsonCrossSection=createThomsonCrossSection({BigNumber:BigNumber,Unit:Unit,config:config$2}),avogadro=createAvogadro({BigNumber:BigNumber,Unit:Unit,config:config$2}),bohrRadius=createBohrRadius({BigNumber:BigNumber,Unit:Unit,config:config$2}),coulomb=createCoulomb({BigNumber:BigNumber,Unit:Unit,config:config$2}),divide$1=createDivide({divideScalar:divideScalar,equalScalar:equalScalar,inv:inv,matrix:matrix$2,multiply:multiply$1,typed:typed}),electronMass=createElectronMass({BigNumber:BigNumber,Unit:Unit,config:config$2}),factorial$1=createFactorial({gamma:gamma$1,typed:typed}),gravity=createGravity({BigNumber:BigNumber,Unit:Unit,config:config$2}),inverseConductanceQuantum=createInverseConductanceQuantum({BigNumber:BigNumber,Unit:Unit,config:config$2}),lup=createLup({DenseMatrix:DenseMatrix,Spa:Spa,SparseMatrix:SparseMatrix,abs:abs$1,addScalar:addScalar,divideScalar:divideScalar,equalScalar:equalScalar,larger:larger,matrix:matrix$2,multiplyScalar:multiplyScalar,subtract:subtract$1,typed:typed,unaryMinus:unaryMinus}),magneticFluxQuantum=createMagneticFluxQuantum({BigNumber:BigNumber,Unit:Unit,config:config$2}),molarMassC12=createMolarMassC12({BigNumber:BigNumber,Unit:Unit,config:config$2}),multinomial=createMultinomial({add:add$1,divide:divide$1,factorial:factorial$1,isInteger:isInteger,isPositive:isPositive,multiply:multiply$1,typed:typed}),permutations=createPermutations({factorial:factorial$1,typed:typed}),planckMass=createPlanckMass({BigNumber:BigNumber,Unit:Unit,config:config$2}),quantumOfCirculation=createQuantumOfCirculation({BigNumber:BigNumber,Unit:Unit,config:config$2}),secondRadiation=createSecondRadiation({BigNumber:BigNumber,Unit:Unit,config:config$2}),stirlingS2=createStirlingS2({bignumber:bignumber,addScalar:addScalar,combinations:combinations,divideScalar:divideScalar,factorial:factorial$1,isInteger:isInteger,isNegative:isNegative,larger:larger,multiplyScalar:multiplyScalar,number:number,pow:pow$1,subtract:subtract$1,typed:typed}),unit=createUnitFunction({Unit:Unit,typed:typed}),bellNumbers=createBellNumbers({addScalar:addScalar,isInteger:isInteger,isNegative:isNegative,stirlingS2:stirlingS2,typed:typed}),eigs=createEigs({abs:abs$1,add:add$1,addScalar:addScalar,atan:atan$1,bignumber:bignumber,column:column,complex:complex,config:config$2,cos:cos$1,diag:diag,divideScalar:divideScalar,dot:dot,equal:equal$1,flatten:flatten$3,im:im$1,inv:inv,larger:larger,matrix:matrix$2,matrixFromColumns:matrixFromColumns,multiply:multiply$1,multiplyScalar:multiplyScalar,number:number,qr:qr,re:re$1,sin:sin$1,smaller:smaller,sqrt:sqrt$1,subtract:subtract$1,typed:typed,usolve:usolve,usolveAll:usolveAll}),fermiCoupling=createFermiCoupling({BigNumber:BigNumber,Unit:Unit,config:config$2}),mean=createMean({add:add$1,divide:divide$1,typed:typed}),molarVolume=createMolarVolume({BigNumber:BigNumber,Unit:Unit,config:config$2}),planckConstant=createPlanckConstant({BigNumber:BigNumber,Unit:Unit,config:config$2}),setSymDifference=createSetSymDifference({Index:Index,concat:concat,setDifference:setDifference,size:size$1,subset:subset,typed:typed}),classicalElectronRadius=createClassicalElectronRadius({BigNumber:BigNumber,Unit:Unit,config:config$2}),lusolve=createLusolve({DenseMatrix:DenseMatrix,lsolve:lsolve,lup:lup,matrix:matrix$2,slu:slu,typed:typed,usolve:usolve}),median=createMedian({add:add$1,compare:compare,divide:divide$1,partitionSelect:partitionSelect,typed:typed}),setUnion=createSetUnion({Index:Index,concat:concat,setIntersect:setIntersect,setSymDifference:setSymDifference,size:size$1,subset:subset,typed:typed}),variance=createVariance({add:add$1,apply:apply,divide:divide$1,isNaN:isNaN$2,multiply:multiply$1,subtract:subtract$1,typed:typed}),kldivergence=createKldivergence({divide:divide$1,dotDivide:dotDivide,isNumeric:isNumeric,log:log$1,matrix:matrix$2,multiply:multiply$1,sum:sum,typed:typed}),norm=createNorm({abs:abs$1,add:add$1,conj:conj$1,ctranspose:ctranspose,eigs:eigs,equalScalar:equalScalar,larger:larger,matrix:matrix$2,multiply:multiply$1,pow:pow$1,smaller:smaller,sqrt:sqrt$1,typed:typed}),planckTime=createPlanckTime({BigNumber:BigNumber,Unit:Unit,config:config$2}),rotationMatrix=createRotationMatrix({BigNumber:BigNumber,DenseMatrix:DenseMatrix,SparseMatrix:SparseMatrix,addScalar:addScalar,config:config$2,cos:cos$1,matrix:matrix$2,multiplyScalar:multiplyScalar,norm:norm,sin:sin$1,typed:typed,unaryMinus:unaryMinus}),gasConstant=createGasConstant({BigNumber:BigNumber,Unit:Unit,config:config$2}),std=createStd({sqrt:sqrt$1,typed:typed,variance:variance}),mad=createMad({abs:abs$1,map:map$1,median:median,subtract:subtract$1,typed:typed}),rotate=createRotate({multiply:multiply$1,rotationMatrix:rotationMatrix,typed:typed}),math$2={},mathWithTransform={},classes={},Chain=createChainClass({math:math$2}),Node=createNode({mathWithTransform:mathWithTransform}),ObjectNode=createObjectNode({Node:Node}),OperatorNode=createOperatorNode({Node:Node}),ParenthesisNode=createParenthesisNode({Node:Node}),RelationalNode=createRelationalNode({Node:Node}),ArrayNode=createArrayNode({Node:Node}),BlockNode=createBlockNode({Node:Node,ResultSet:ResultSet}),ConditionalNode=createConditionalNode({Node:Node}),ConstantNode=createConstantNode({Node:Node}),RangeNode=createRangeNode({Node:Node}),reviver=createReviver({classes:classes}),chain$1=createChain({Chain:Chain,typed:typed}),FunctionAssignmentNode=createFunctionAssignmentNode({Node:Node,typed:typed}),AccessorNode=createAccessorNode({Node:Node,subset:subset}),AssignmentNode=createAssignmentNode({matrix:matrix$2,Node:Node,subset:subset}),IndexNode=createIndexNode({Node:Node,size:size$1}),SymbolNode=createSymbolNode({Unit:Unit,Node:Node,math:math$2}),FunctionNode=createFunctionNode({Node:Node,SymbolNode:SymbolNode,math:math$2}),parse$2=createParse({AccessorNode:AccessorNode,ArrayNode:ArrayNode,AssignmentNode:AssignmentNode,BlockNode:BlockNode,ConditionalNode:ConditionalNode,ConstantNode:ConstantNode,FunctionAssignmentNode:FunctionAssignmentNode,FunctionNode:FunctionNode,IndexNode:IndexNode,ObjectNode:ObjectNode,OperatorNode:OperatorNode,ParenthesisNode:ParenthesisNode,RangeNode:RangeNode,RelationalNode:RelationalNode,SymbolNode:SymbolNode,config:config$2,numeric:numeric,typed:typed}),resolve=createResolve({ConstantNode:ConstantNode,FunctionNode:FunctionNode,OperatorNode:OperatorNode,ParenthesisNode:ParenthesisNode,parse:parse$2}),simplifyCore=createSimplifyCore({AccessorNode:AccessorNode,ArrayNode:ArrayNode,ConstantNode:ConstantNode,FunctionNode:FunctionNode,IndexNode:IndexNode,ObjectNode:ObjectNode,OperatorNode:OperatorNode,ParenthesisNode:ParenthesisNode,SymbolNode:SymbolNode,add:add$1,divide:divide$1,equal:equal$1,isZero:isZero,multiply:multiply$1,pow:pow$1,subtract:subtract$1}),compile=createCompile({parse:parse$2,typed:typed}),Help=createHelpClass({parse:parse$2}),leafCount=createLeafCount({parse:parse$2,typed:typed}),simplify$2=createSimplify({bignumber:bignumber,fraction:fraction,AccessorNode:AccessorNode,ArrayNode:ArrayNode,ConstantNode:ConstantNode,FunctionNode:FunctionNode,IndexNode:IndexNode,ObjectNode:ObjectNode,OperatorNode:OperatorNode,ParenthesisNode:ParenthesisNode,SymbolNode:SymbolNode,add:add$1,config:config$2,divide:divide$1,equal:equal$1,isZero:isZero,mathWithTransform:mathWithTransform,matrix:matrix$2,multiply:multiply$1,parse:parse$2,pow:pow$1,resolve:resolve,simplifyCore:simplifyCore,subtract:subtract$1,typed:typed}),symbolicEqual=createSymbolicEqual({OperatorNode:OperatorNode,parse:parse$2,simplify:simplify$2,typed:typed}),evaluate$1=createEvaluate({parse:parse$2,typed:typed}),help=createHelp({Help:Help,mathWithTransform:mathWithTransform,typed:typed}),Parser=createParserClass({evaluate:evaluate$1}),rationalize=createRationalize({bignumber:bignumber,fraction:fraction,AccessorNode:AccessorNode,ArrayNode:ArrayNode,ConstantNode:ConstantNode,FunctionNode:FunctionNode,IndexNode:IndexNode,ObjectNode:ObjectNode,OperatorNode:OperatorNode,ParenthesisNode:ParenthesisNode,SymbolNode:SymbolNode,add:add$1,config:config$2,divide:divide$1,equal:equal$1,isZero:isZero,mathWithTransform:mathWithTransform,matrix:matrix$2,multiply:multiply$1,parse:parse$2,pow:pow$1,simplify:simplify$2,simplifyCore:simplifyCore,subtract:subtract$1,typed:typed}),derivative$1=createDerivative({ConstantNode:ConstantNode,FunctionNode:FunctionNode,OperatorNode:OperatorNode,ParenthesisNode:ParenthesisNode,SymbolNode:SymbolNode,config:config$2,equal:equal$1,isZero:isZero,numeric:numeric,parse:parse$2,simplify:simplify$2,typed:typed}),parser=createParser({Parser:Parser,typed:typed});_extends$1(math$2,{e:e,false:_false,fineStructure:fineStructure,i:i,Infinity:_Infinity,LN10:LN10,LOG10E:LOG10E,NaN:_NaN,null:_null,phi:phi,SQRT1_2:SQRT1_2,sackurTetrode:sackurTetrode,tau:tau,true:_true,E:e,version:version$1,efimovFactor:efimovFactor,LN2:LN2,pi:pi,replacer:replacer,reviver:reviver,SQRT2:SQRT2,typed:typed,unaryPlus:unaryPlus,PI:pi,weakMixingAngle:weakMixingAngle,abs:abs$1,acos:acos$1,acot:acot$1,acsc:acsc$1,addScalar:addScalar,arg:arg,asech:asech$1,asinh:asinh$1,atan:atan$1,atanh:atanh$1,bignumber:bignumber,bitNot:bitNot,boolean:boolean,chain:chain$1,clone:clone$1,combinations:combinations,complex:complex,conj:conj$1,cosh:cosh$1,coth:coth$1,csc:csc$1,cube:cube,equalScalar:equalScalar,erf:erf$1,exp:exp$1,expm1:expm1,filter:filter$1,forEach:forEach,format:format,getMatrixDataType:getMatrixDataType,hex:hex,im:im$1,isInteger:isInteger,isNegative:isNegative,isPositive:isPositive,isZero:isZero,LOG2E:LOG2E,lgamma:lgamma,log10:log10$1,log2:log2,map:map$1,multiplyScalar:multiplyScalar,not:not,number:number,oct:oct,pickRandom:pickRandom,print:print,random:random$1,re:re$1,sec:sec$1,sign:sign$1,sin:sin$1,splitUnit:splitUnit,square:square,string:string,tan:tan$1,typeOf:typeOf,acosh:acosh$1,acsch:acsch$1,apply:apply,asec:asec$1,bin:bin,combinationsWithRep:combinationsWithRep,cos:cos$1,csch:csch$1,isNaN:isNaN$2,isPrime:isPrime,randomInt:randomInt,sech:sech$1,sinh:sinh$1,sparse:sparse,sqrt:sqrt$1,tanh:tanh$1,unaryMinus:unaryMinus,acoth:acoth$1,cot:cot$1,fraction:fraction,isNumeric:isNumeric,matrix:matrix$2,matrixFromFunction:matrixFromFunction,mod:mod$1,nthRoot:nthRoot,numeric:numeric,or:or,prod:prod,reshape:reshape,size:size$1,smaller:smaller,squeeze:squeeze,subset:subset,subtract:subtract$1,to:to,transpose:transpose,xgcd:xgcd,zeros:zeros,and:and,bitAnd:bitAnd,bitXor:bitXor,cbrt:cbrt,compare:compare,compareText:compareText,concat:concat,count:count,ctranspose:ctranspose,diag:diag,divideScalar:divideScalar,dotDivide:dotDivide,equal:equal$1,fft:fft,flatten:flatten$3,gcd:gcd,hasNumericValue:hasNumericValue,hypot:hypot,ifft:ifft,kron:kron,largerEq:largerEq,leftShift:leftShift,lsolve:lsolve,matrixFromColumns:matrixFromColumns,min:min$1,mode:mode,nthRoots:nthRoots,ones:ones,partitionSelect:partitionSelect,resize:resize,rightArithShift:rightArithShift,round:round$1,smallerEq:smallerEq,unequal:unequal,usolve:usolve,xor:xor,add:add$1,atan2:atan2$1,bitOr:bitOr,catalan:catalan,compareNatural:compareNatural,cumsum:cumsum,deepEqual:deepEqual,diff:diff,dot:dot,equalText:equalText,floor:floor,identity:identity$1,invmod:invmod,larger:larger,log:log$1,lsolveAll:lsolveAll,matrixFromRows:matrixFromRows,multiply:multiply$1,qr:qr,range:range$1,rightLogShift:rightLogShift,setSize:setSize,slu:slu,sum:sum,trace:trace,usolveAll:usolveAll,asin:asin$1,ceil:ceil,composition:composition,cross:cross,det:det,distance:distance,dotMultiply:dotMultiply,fix:fix,intersect:intersect,lcm:lcm,log1p:log1p,max:max$1,quantileSeq:quantileSeq,row:row,setCartesian:setCartesian,setDistinct:setDistinct,setIsSubset:setIsSubset,setPowerset:setPowerset,sort:sort,column:column,index:index,inv:inv,pinv:pinv,pow:pow$1,setDifference:setDifference,setMultiplicity:setMultiplicity,sqrtm:sqrtm,vacuumImpedance:vacuumImpedance,wienDisplacement:wienDisplacement,atomicMass:atomicMass,bohrMagneton:bohrMagneton,boltzmann:boltzmann,conductanceQuantum:conductanceQuantum,createUnit:createUnit,deuteronMass:deuteronMass,dotPow:dotPow,electricConstant:electricConstant,elementaryCharge:elementaryCharge,expm:expm,faraday:faraday,firstRadiation:firstRadiation,gamma:gamma$1,gravitationConstant:gravitationConstant,hartreeEnergy:hartreeEnergy,klitzing:klitzing,loschmidt:loschmidt,magneticConstant:magneticConstant,molarMass:molarMass,molarPlanckConstant:molarPlanckConstant,neutronMass:neutronMass,nuclearMagneton:nuclearMagneton,planckCharge:planckCharge,planckLength:planckLength,planckTemperature:planckTemperature,protonMass:protonMass,reducedPlanckConstant:reducedPlanckConstant,rydberg:rydberg,setIntersect:setIntersect,speedOfLight:speedOfLight,stefanBoltzmann:stefanBoltzmann,thomsonCrossSection:thomsonCrossSection,avogadro:avogadro,bohrRadius:bohrRadius,coulomb:coulomb,divide:divide$1,electronMass:electronMass,factorial:factorial$1,gravity:gravity,inverseConductanceQuantum:inverseConductanceQuantum,lup:lup,magneticFluxQuantum:magneticFluxQuantum,molarMassC12:molarMassC12,multinomial:multinomial,parse:parse$2,permutations:permutations,planckMass:planckMass,quantumOfCirculation:quantumOfCirculation,resolve:resolve,secondRadiation:secondRadiation,simplifyCore:simplifyCore,stirlingS2:stirlingS2,unit:unit,bellNumbers:bellNumbers,compile:compile,eigs:eigs,fermiCoupling:fermiCoupling,leafCount:leafCount,mean:mean,molarVolume:molarVolume,planckConstant:planckConstant,setSymDifference:setSymDifference,simplify:simplify$2,symbolicEqual:symbolicEqual,classicalElectronRadius:classicalElectronRadius,evaluate:evaluate$1,help:help,lusolve:lusolve,median:median,rationalize:rationalize,setUnion:setUnion,variance:variance,derivative:derivative$1,kldivergence:kldivergence,norm:norm,planckTime:planckTime,rotationMatrix:rotationMatrix,gasConstant:gasConstant,parser:parser,std:std,mad:mad,rotate:rotate,config:config$2}),_extends$1(mathWithTransform,math$2,{filter:createFilterTransform({typed:typed}),forEach:createForEachTransform({typed:typed}),map:createMapTransform({typed:typed}),apply:createApplyTransform({isInteger:isInteger,typed:typed}),diff:createDiffTransform({bignumber:bignumber,matrix:matrix$2,number:number,subtract:subtract$1,typed:typed}),subset:createSubsetTransform({matrix:matrix$2,typed:typed}),concat:createConcatTransform({isInteger:isInteger,matrix:matrix$2,typed:typed}),max:createMaxTransform({config:config$2,larger:larger,numeric:numeric,typed:typed}),min:createMinTransform({config:config$2,numeric:numeric,smaller:smaller,typed:typed}),range:createRangeTransform({bignumber:bignumber,matrix:matrix$2,config:config$2,larger:larger,largerEq:largerEq,smaller:smaller,smallerEq:smallerEq,typed:typed}),sum:createSumTransform({add:add$1,config:config$2,numeric:numeric,typed:typed}),cumsum:createCumSumTransform({add:add$1,typed:typed,unaryPlus:unaryPlus}),row:createRowTransform({Index:Index,matrix:matrix$2,range:range$1,typed:typed}),column:createColumnTransform({Index:Index,matrix:matrix$2,range:range$1,typed:typed}),index:createIndexTransform({Index:Index}),mean:createMeanTransform({add:add$1,divide:divide$1,typed:typed}),variance:createVarianceTransform({add:add$1,apply:apply,divide:divide$1,isNaN:isNaN$2,multiply:multiply$1,subtract:subtract$1,typed:typed}),std:createStdTransform({sqrt:sqrt$1,typed:typed,variance:variance})}),_extends$1(classes,{BigNumber:BigNumber,Chain:Chain,Complex:Complex,Fraction:Fraction,Matrix:Matrix,Node:Node,ObjectNode:ObjectNode,OperatorNode:OperatorNode,ParenthesisNode:ParenthesisNode,Range:Range,RelationalNode:RelationalNode,ResultSet:ResultSet,ArrayNode:ArrayNode,BlockNode:BlockNode,ConditionalNode:ConditionalNode,ConstantNode:ConstantNode,DenseMatrix:DenseMatrix,RangeNode:RangeNode,FunctionAssignmentNode:FunctionAssignmentNode,SparseMatrix:SparseMatrix,AccessorNode:AccessorNode,AssignmentNode:AssignmentNode,IndexNode:IndexNode,FibonacciHeap:FibonacciHeap,ImmutableDenseMatrix:ImmutableDenseMatrix,Index:Index,Spa:Spa,Unit:Unit,SymbolNode:SymbolNode,FunctionNode:FunctionNode,Help:Help,Parser:Parser}),Chain.createProxy(math$2);var all=allFactories;Number.isFinite=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},Number.isNaN=Number.isNaN||function(e){return e!=e};var tinyEmitter={exports:{}};function E(){}function mixin$1(e){var t=new tinyEmitter.exports;return e.on=t.on.bind(t),e.off=t.off.bind(t),e.once=t.once.bind(t),e.emit=t.emit.bind(t),e}function importFactory(e,t,n,r){function a(t,a,s){var o;if(s.wrap&&"function"==typeof a&&(a=function(e){var t=function(){for(var t=[],r=0,a=arguments.length;r2&&void 0!==arguments[2]?arguments[2]:t.fn;if(contains$1(i,"."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(i));var o=d(t)?n.expression.transform:n,l=i in n.expression.transform,c=hasOwnProperty$2(o,i)?o[i]:void 0,m=function(){var r={};t.dependencies.map(stripOptionalNotation).forEach((e=>{if(contains$1(e,"."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(e));"math"===e?r.math=n:"mathWithTransform"===e?r.mathWithTransform=n.expression.mathWithTransform:"classes"===e?r.classes=n:r[e]=n[e]}));var s=t(r);if(s&&"function"==typeof s.transform)throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(void 0===c||a.override)return s;if(u(c)&&u(s))return e(c,s);if(a.silent)return c;throw new Error('Cannot import "'+i+'": already exists')};t.meta&&!1===t.meta.lazy?(o[i]=m(),c&&l?s(i):(d(t)||p(t))&&lazy(n.expression.mathWithTransform,i,(()=>o[i]))):(lazy(o,i,m),c&&l?s(i):(d(t)||p(t))&&lazy(n.expression.mathWithTransform,i,(()=>o[i]))),r[i]=t,n.emit("import",i,m)}function l(e){return"function"==typeof e||"number"==typeof e||"string"==typeof e||"boolean"==typeof e||null===e||isUnit(e)||isComplex(e)||isBigNumber(e)||isFraction(e)||isMatrix(e)||Array.isArray(e)}function u(e){return"function"==typeof e&&"object"==typeof e.signatures}function c(e){return!hasOwnProperty$2(m,e)}function p(e){return!(-1!==e.fn.indexOf(".")||hasOwnProperty$2(m,e.fn)||e.meta&&e.meta.isClass)}function d(e){return void 0!==e&&void 0!==e.meta&&!0===e.meta.isTransformFunction||!1}var m={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(e,t){var n=arguments.length;if(1!==n&&2!==n)throw new ArgumentsError("import",n,1,2);t||(t={});var r={};for(var i in function e(n,r,a){if(Array.isArray(r))r.forEach((t=>e(n,t)));else if("object"==typeof r)for(var i in r)hasOwnProperty$2(r,i)&&e(n,r[i],i);else if(isFactory(r)||void 0!==a){var s=isFactory(r)?d(r)?r.fn+".transform":r.fn:a;if(hasOwnProperty$2(n,s)&&n[s]!==r&&!t.silent)throw new Error('Cannot import "'+s+'" twice');n[s]=r}else if(!t.silent)throw new TypeError("Factory, Object, or Array expected")}(r,e),r)if(hasOwnProperty$2(r,i)){var s=r[i];if(isFactory(s))o(s,t);else if(l(s))a(i,s,t);else if(!t.silent)throw new TypeError("Factory, Object, or Array expected")}}}function create$1(e,t){var n=_extends$1({},DEFAULT_CONFIG,t);if("function"!=typeof Object.create)throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var r=mixin$1({isNumber:isNumber$1,isComplex:isComplex,isBigNumber:isBigNumber,isFraction:isFraction,isUnit:isUnit,isString:isString$1,isArray:isArray$1,isMatrix:isMatrix,isCollection:isCollection,isDenseMatrix:isDenseMatrix,isSparseMatrix:isSparseMatrix,isRange:isRange,isIndex:isIndex,isBoolean:isBoolean$1,isResultSet:isResultSet,isHelp:isHelp,isFunction:isFunction$2,isDate:isDate$1,isRegExp:isRegExp$1,isObject:isObject$1,isNull:isNull$1,isUndefined:isUndefined$1,isAccessorNode:isAccessorNode,isArrayNode:isArrayNode,isAssignmentNode:isAssignmentNode,isBlockNode:isBlockNode,isConditionalNode:isConditionalNode,isConstantNode:isConstantNode,isFunctionAssignmentNode:isFunctionAssignmentNode,isFunctionNode:isFunctionNode,isIndexNode:isIndexNode,isNode:isNode,isObjectNode:isObjectNode,isOperatorNode:isOperatorNode,isParenthesisNode:isParenthesisNode,isRangeNode:isRangeNode,isSymbolNode:isSymbolNode,isChain:isChain});r.config=configFactory(n,r.emit),r.expression={transform:{},mathWithTransform:{config:r.config}};var a=[],i=[],s={},o=importFactory((function(){for(var e=arguments.length,t=new Array(e),n=0;n{values$1(s).forEach((e=>{e&&e.meta&&e.meta.recreateOnConfigChange&&o(e,{override:!0})}))})),r.create=create$1.bind(null,e),r.factory=factory,r.import(values$1(deepFlatten(e))),r.ArgumentsError=ArgumentsError,r.DimensionError=DimensionError,r.IndexError=IndexError,r}E.prototype={on:function(e,t,n){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var r=this;function a(){r.off(e,a),t.apply(n,arguments)}return a._=t,this.on(e,a,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),r=0,a=n.length;r3;a-=4)e(),e(),e(),e();for(;a>0;)e(),a--;if(new Date-n>t)break}for(a=r;a>3;a-=4)e(),e(),e(),e();for(;a>0;)e(),a--;return 1e3*(3*r-1)/(new Date-n)},numeric._myIndexOf=function(e){var t,n=this.length;for(t=0;tnumeric.largeArray)return n.push("...Large Array..."),!0;for(u=!1,n.push("["),a=0;a0&&(n.push(","),u&&n.push("\n ")),u=e(r[a]);return n.push("]"),!0}for(a in n.push("{"),u=!1,r)r.hasOwnProperty(a)&&(u&&n.push(",\n"),u=!0,n.push(a),n.push(": \n"),e(r[a]));return n.push("}"),!0}(e),n.join("")},numeric.parseDate=function(e){return function e(t){if("string"==typeof t)return Date.parse(t.replace(/-/g,"/"));if(!(t instanceof Array))throw new Error("parseDate: parameter must be arrays of strings");var n,r=[];for(n=0;n0){for(i[l]=[],t=0;t>>8^a[255&(i^e[r])];return-1^i}var n,r,a,i,s,o,l,u,c,p,d=e[0].length,m=e[0][0].length,h=[137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,m>>24&255,m>>16&255,m>>8&255,255&m,d>>24&255,d>>16&255,d>>8&255,255&d,8,2,0,0,0,-1,-2,-3,-4,-5,-6,-7,-8,73,68,65,84,8,29];for(p=t(h,12,29),h[29]=p>>24&255,h[30]=p>>16&255,h[31]=p>>8&255,h[32]=255&p,n=1,r=0,l=0;l>8&255,h.push(s),h.push(o),h.push(255&~s),h.push(255&~o),0===l&&h.push(0),u=0;u255?255:s<0?0:Math.round(s)))%65521))%65521,h.push(s);h.push(0)}return c=(r<<16)+n,h.push(c>>24&255),h.push(c>>16&255),h.push(c>>8&255),h.push(255&c),i=h.length-41,h[33]=i>>24&255,h[34]=i>>16&255,h[35]=i>>8&255,h[36]=255&i,p=t(h,37),h.push(p>>24&255),h.push(p>>16&255),h.push(p>>8&255),h.push(255&p),h.push(0),h.push(0),h.push(0),h.push(0),h.push(73),h.push(69),h.push(78),h.push(68),h.push(174),h.push(66),h.push(96),h.push(130),"data:image/png;base64,"+function(e){var t,n,r,a,i,s,o,l=e.length,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="";for(t=0;t>4),s=((15&r)<<2)+((a=e[t+2])>>6),o=63&a,t+1>=l?s=o=64:t+2>=l&&(o=64),c+=u.charAt(n>>2)+u.charAt(i)+u.charAt(s)+u.charAt(o);return c}(h)},numeric._dim=function(e){for(var t=[];"object"==typeof e;)t.push(e.length),e=e[0];return t},numeric.dim=function(e){var t;return"object"==typeof e?"object"==typeof(t=e[0])?"object"==typeof t[0]?numeric._dim(e):[e.length,t.length]:[e.length]:[]},numeric.mapreduce=function(e,t){return Function("x","accum","_s","_k",'if(typeof accum === "undefined") accum = '+t+';\nif(typeof x === "number") { var xi = x; '+e+'; return accum; }\nif(typeof _s === "undefined") _s = numeric.dim(x);\nif(typeof _k === "undefined") _k = 0;\nvar _n = _s[_k];\nvar i,xi;\nif(_k < _s.length-1) {\n for(i=_n-1;i>=0;i--) {\n accum = arguments.callee(x[i],accum,_s,_k+1);\n } return accum;\n}\nfor(i=_n-1;i>=1;i-=2) { \n xi = x[i];\n '+e+";\n xi = x[i-1];\n "+e+";\n}\nif(i === 0) {\n xi = x[i];\n "+e+"\n}\nreturn accum;")},numeric.mapreduce2=function(e,t){return Function("x","var n = x.length;\nvar i,xi;\n"+t+";\nfor(i=n-1;i!==-1;--i) { \n xi = x[i];\n "+e+";\n}\nreturn accum;")},numeric.same=function e(t,n){var r,a;if(!(t instanceof Array&&n instanceof Array))return!1;if((a=t.length)!==n.length)return!1;for(r=0;r=0;r-=2)i[r+1]=t,i[r]=t;return-1===r&&(i[0]=t),i}for(r=a-1;r>=0;r--)i[r]=numeric.rep(e,t,n+1);return i},numeric.dotMMsmall=function(e,t){var n,r,a,i,s,o,l,u,c,p,d;for(i=e.length,s=t.length,o=t[0].length,l=Array(i),n=i-1;n>=0;n--){for(u=Array(o),c=e[n],a=o-1;a>=0;a--){for(p=c[s-1]*t[s-1][a],r=s-2;r>=1;r-=2)d=r-1,p+=c[r]*t[r][a]+c[d]*t[d][a];0===r&&(p+=c[0]*t[0][a]),u[a]=p}l[n]=u}return l},numeric._getCol=function(e,t,n){var r;for(r=e.length-1;r>0;--r)n[r]=e[r][t],n[--r]=e[r][t];0===r&&(n[0]=e[0][t])},numeric.dotMMbig=function(e,t){var n,r,a,i=numeric._getCol,s=t.length,o=Array(s),l=e.length,u=t[0].length,c=new Array(l),p=numeric.dotVV;for(--s,r=--l;-1!==r;--r)c[r]=Array(u);for(r=--u;-1!==r;--r)for(i(t,r,o),a=l;-1!==a;--a)n=e[a],c[a][r]=p(n,o);return c},numeric.dotMV=function(e,t){var n,r=e.length;t.length;var a=Array(r),i=numeric.dotVV;for(n=r-1;n>=0;n--)a[n]=i(e[n],t);return a},numeric.dotVM=function(e,t){var n,r,a,i,s,o,l;for(a=e.length,i=t[0].length,s=Array(i),r=i-1;r>=0;r--){for(o=e[a-1]*t[a-1][r],n=a-2;n>=1;n-=2)l=n-1,o+=e[n]*t[n][r]+e[l]*t[l][r];0===n&&(o+=e[0]*t[0][r]),s[r]=o}return s},numeric.dotVV=function(e,t){var n,r,a=e.length,i=e[a-1]*t[a-1];for(n=a-2;n>=1;n-=2)r=n-1,i+=e[n]*t[n]+e[r]*t[r];return 0===n&&(i+=e[0]*t[0]),i},numeric.dot=function(e,t){var n=numeric.dim;switch(1e3*n(e).length+n(t).length){case 2002:return t.length<10?numeric.dotMMsmall(e,t):numeric.dotMMbig(e,t);case 2001:return numeric.dotMV(e,t);case 1002:return numeric.dotVM(e,t);case 1001:return numeric.dotVV(e,t);case 1e3:return numeric.mulVS(e,t);case 1:return numeric.mulSV(e,t);case 0:return e*t;default:throw new Error("numeric.dot only works on vectors and matrices")}},numeric.diag=function(e){var t,n,r,a,i=e.length,s=Array(i);for(t=i-1;t>=0;t--){for(a=Array(i),n=t+2,r=i-1;r>=n;r-=2)a[r]=0,a[r-1]=0;for(r>t&&(a[r]=0),a[t]=e[t],r=t-1;r>=1;r-=2)a[r]=0,a[r-1]=0;0===r&&(a[0]=0),s[t]=a}return s},numeric.getDiag=function(e){var t,n=Math.min(e.length,e[0].length),r=Array(n);for(t=n-1;t>=1;--t)r[t]=e[t][t],r[--t]=e[t][t];return 0===t&&(r[0]=e[0][0]),r},numeric.identity=function(e){return numeric.diag(numeric.rep([e],1))},numeric.pointwise=function(e,t,n){void 0===n&&(n="");var r,a,i=[],s=/\[i\]$/,o="",l=!1;for(r=0;r=0;i--) ret[i] = arguments.callee("+e.join(",")+",_s,_k+1);\n return ret;\n}\n"+n+"\nfor(i=_n-1;i!==-1;--i) {\n "+t+"\n}\nreturn ret;",Function.apply(null,i)},numeric.pointwise2=function(e,t,n){void 0===n&&(n="");var r,a,i=[],s=/\[i\]$/,o="",l=!1;for(r=0;r=0;s--)e("object"==typeof t?t[s]:t,"object"==typeof n?n[s]:n,r,a+1,i);else i(t,n)},numeric._biforeach2=function e(t,n,r,a,i){if(a===r.length-1)return i(t,n);var s,o=r[a],l=Array(o);for(s=o-1;s>=0;--s)l[s]=e("object"==typeof t?t[s]:t,"object"==typeof n?n[s]:n,r,a+1,i);return l},numeric._foreach=function e(t,n,r,a){var i;if(r!==n.length-1)for(i=n[r]-1;i>=0;i--)e(t[i],n,r+1,a);else a(t)},numeric._foreach2=function e(t,n,r,a){if(r===n.length-1)return a(t);var i,s=n[r],o=Array(s);for(i=s-1;i>=0;i--)o[i]=e(t[i],n,r+1,a);return o},numeric.ops2={add:"+",sub:"-",mul:"*",div:"/",mod:"%",and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">=",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"},numeric.opseq={addeq:"+=",subeq:"-=",muleq:"*=",diveq:"/=",modeq:"%=",lshifteq:"<<=",rshifteq:">>=",rrshifteq:">>>=",bandeq:"&=",boreq:"|=",bxoreq:"^="},numeric.mathfuns=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan","isNaN","isFinite"],numeric.mathfuns2=["atan2","pow","max","min"],numeric.ops1={neg:"-",not:"!",bnot:"~",clone:""},numeric.mapreducers={any:["if(xi) return true;","var accum = false;"],all:["if(!xi) return false;","var accum = true;"],sum:["accum += xi;","var accum = 0;"],prod:["accum *= xi;","var accum = 1;"],norm2Squared:["accum += xi*xi;","var accum = 0;"],norminf:["accum = max(accum,abs(xi));","var accum = 0, max = Math.max, abs = Math.abs;"],norm1:["accum += abs(xi)","var accum = 0, abs = Math.abs;"],sup:["accum = max(accum,xi);","var accum = -Infinity, max = Math.max;"],inf:["accum = min(accum,xi);","var accum = Infinity, min = Math.min;"]},function(){var e,t;for(e=0;ef&&(h=i,f=o);for(n=d[h],d[h]=d[s],d[s]=n,a=m[h],m[h]=m[s],m[s]=a,e=n[s],o=s;o!==p;++o)n[o]/=e;for(o=p-1;-1!==o;--o)a[o]/=e;for(i=c-1;-1!==i;--i)if(i!==s){for(t=d[i],r=m[i],e=t[s],o=s+1;o!==p;++o)t[o]-=n[o]*e;for(o=p-1;o>0;--o)r[o]-=a[o]*e,r[--o]-=a[o]*e;0===o&&(r[0]-=a[0]*e)}}return m},numeric.det=function(e){var t=numeric.dim(e);if(2!==t.length||t[0]!==t[1])throw new Error("numeric: det() only works on square matrices");var n,r,a,i,s,o,l,u,c=t[0],p=1,d=numeric.clone(e);for(r=0;rMath.abs(d[a][r])&&(a=n);for(a!==r&&(l=d[a],d[a]=d[r],d[r]=l,p*=-1),i=d[r],n=r+1;n=1;t-=2){for(a=e[t],r=e[t-1],n=o-1;n>=1;--n)(i=l[n])[t]=a[n],i[t-1]=r[n],(i=l[--n])[t]=a[n],i[t-1]=r[n];0===n&&((i=l[0])[t]=a[0],i[t-1]=r[0])}if(0===t){for(r=e[0],n=o-1;n>=1;--n)l[n][0]=r[n],l[--n][0]=r[n];0===n&&(l[0][0]=r[0])}return l},numeric.negtranspose=function(e){var t,n,r,a,i,s=e.length,o=e[0].length,l=Array(o);for(n=0;n=1;t-=2){for(a=e[t],r=e[t-1],n=o-1;n>=1;--n)(i=l[n])[t]=-a[n],i[t-1]=-r[n],(i=l[--n])[t]=-a[n],i[t-1]=-r[n];0===n&&((i=l[0])[t]=-a[0],i[t-1]=-r[0])}if(0===t){for(r=e[0],n=o-1;n>=1;--n)l[n][0]=-r[n],l[--n][0]=-r[n];0===n&&(l[0][0]=-r[0])}return l},numeric._random=function e(t,n){var r,a,i=t[n],s=Array(i);if(n===t.length-1){for(a=Math.random,r=i-1;r>=1;r-=2)s[r]=a(),s[r-1]=a();return 0===r&&(s[0]=a()),s}for(r=i-1;r>=0;r--)s[r]=e(t,n+1);return s},numeric.random=function(e){return numeric._random(e,0)},numeric.norm2=function(e){return Math.sqrt(numeric.norm2Squared(e))},numeric.linspace=function(e,t,n){if(void 0===n&&(n=Math.max(Math.round(t-e)+1,1)),n<2)return 1===n?[e]:[];var r,a=Array(n);for(r=--n;r>=0;r--)a[r]=(r*t+(n-r)*e)/n;return a},numeric.getBlock=function(e,t,n){var r=numeric.dim(e);return function e(a,i){var s,o=t[i],l=n[i]-o,u=Array(l);if(i===r.length-1){for(s=l;s>=0;s--)u[s]=a[s+o];return u}for(s=l;s>=0;s--)u[s]=e(a[s+o],i+1);return u}(e,0)},numeric.setBlock=function(e,t,n,r){var a=numeric.dim(e);return function e(r,i,s){var o,l=t[s],u=n[s]-l;if(s===a.length-1)for(o=u;o>=0;o--)r[o+l]=i[o];for(o=u;o>=0;o--)e(r[o+l],i[o],s+1)}(e,r,0),e},numeric.getRange=function(e,t,n){var r,a,i,s,o=t.length,l=n.length,u=Array(o);for(r=o-1;-1!==r;--r)for(u[r]=Array(l),i=u[r],s=e[t[r]],a=l-1;-1!==a;--a)i[a]=s[n[a]];return u},numeric.blockMatrix=function(e){var t=numeric.dim(e);if(t.length<4)return numeric.blockMatrix([e]);var n,r,a,i,s,o=t[0],l=t[1];for(n=0,r=0,a=0;a=0;i--){for(a=Array(u),o=e[i],s=u-1;s>=3;--s)a[s]=o*t[s],a[--s]=o*t[s],a[--s]=o*t[s],a[--s]=o*t[s];for(;s>=0;)a[s]=o*t[s],--s;c[i]=a}return c},numeric.T=function(e,t){this.x=e,this.y=t},numeric.t=function(e,t){return new numeric.T(e,t)},numeric.Tbinop=function(e,t,n,r,a){var i;if(numeric.indexOf,"string"!=typeof a)for(i in a="",numeric)numeric.hasOwnProperty(i)&&(e.indexOf(i)>=0||t.indexOf(i)>=0||n.indexOf(i)>=0||r.indexOf(i)>=0)&&i.length>1&&(a+="var "+i+" = numeric."+i+";\n");return Function(["y"],"var x = this;\nif(!(y instanceof numeric.T)) { y = new numeric.T(y); }\n"+a+"\nif(x.y) { if(y.y) { return new numeric.T("+r+");\n }\n return new numeric.T("+n+");\n}\nif(y.y) {\n return new numeric.T("+t+");\n}\nreturn new numeric.T("+e+");\n")},numeric.T.prototype.add=numeric.Tbinop("add(x.x,y.x)","add(x.x,y.x),y.y","add(x.x,y.x),x.y","add(x.x,y.x),add(x.y,y.y)"),numeric.T.prototype.sub=numeric.Tbinop("sub(x.x,y.x)","sub(x.x,y.x),neg(y.y)","sub(x.x,y.x),x.y","sub(x.x,y.x),sub(x.y,y.y)"),numeric.T.prototype.mul=numeric.Tbinop("mul(x.x,y.x)","mul(x.x,y.x),mul(x.x,y.y)","mul(x.x,y.x),mul(x.y,y.x)","sub(mul(x.x,y.x),mul(x.y,y.y)),add(mul(x.x,y.y),mul(x.y,y.x))"),numeric.T.prototype.reciprocal=function(){var e=numeric.mul,t=numeric.div;if(this.y){var n=numeric.add(e(this.x,this.x),e(this.y,this.y));return new numeric.T(t(this.x,n),t(numeric.neg(this.y),n))}return new T(t(1,this.x))},numeric.T.prototype.div=function(e){if(e instanceof numeric.T||(e=new numeric.T(e)),e.y)return this.mul(e.reciprocal());var t=numeric.div;return this.y?new numeric.T(t(this.x,e.x),t(this.y,e.x)):new numeric.T(t(this.x,e.x))},numeric.T.prototype.dot=numeric.Tbinop("dot(x.x,y.x)","dot(x.x,y.x),dot(x.x,y.y)","dot(x.x,y.x),dot(x.y,y.x)","sub(dot(x.x,y.x),dot(x.y,y.y)),add(dot(x.x,y.y),dot(x.y,y.x))"),numeric.T.prototype.transpose=function(){var e=numeric.transpose,t=this.x,n=this.y;return n?new numeric.T(e(t),e(n)):new numeric.T(e(t))},numeric.T.prototype.transjugate=function(){var e=numeric.transpose,t=this.x,n=this.y;return n?new numeric.T(e(t),numeric.negtranspose(n)):new numeric.T(e(t))},numeric.Tunop=function(e,t,n){return"string"!=typeof n&&(n=""),Function("var x = this;\n"+n+"\nif(x.y) { "+t+";\n}\n"+e+";\n")},numeric.T.prototype.exp=numeric.Tunop("return new numeric.T(ex)","return new numeric.T(mul(cos(x.y),ex),mul(sin(x.y),ex))","var ex = numeric.exp(x.x), cos = numeric.cos, sin = numeric.sin, mul = numeric.mul;"),numeric.T.prototype.conj=numeric.Tunop("return new numeric.T(x.x);","return new numeric.T(x.x,numeric.neg(x.y));"),numeric.T.prototype.neg=numeric.Tunop("return new numeric.T(neg(x.x));","return new numeric.T(neg(x.x),neg(x.y));","var neg = numeric.neg;"),numeric.T.prototype.sin=numeric.Tunop("return new numeric.T(numeric.sin(x.x))","return x.exp().sub(x.neg().exp()).div(new numeric.T(0,2));"),numeric.T.prototype.cos=numeric.Tunop("return new numeric.T(numeric.cos(x.x))","return x.exp().add(x.neg().exp()).div(2);"),numeric.T.prototype.abs=numeric.Tunop("return new numeric.T(numeric.abs(x.x));","return new numeric.T(numeric.sqrt(numeric.add(mul(x.x,x.x),mul(x.y,x.y))));","var mul = numeric.mul;"),numeric.T.prototype.log=numeric.Tunop("return new numeric.T(numeric.log(x.x));","var theta = new numeric.T(numeric.atan2(x.y,x.x)), r = x.abs();\nreturn new numeric.T(numeric.log(r.x),theta.x);"),numeric.T.prototype.norm2=numeric.Tunop("return numeric.norm2(x.x);","var f = numeric.norm2Squared;\nreturn Math.sqrt(f(x.x)+f(x.y));"),numeric.T.prototype.inv=function(){var e=this;if(void 0===e.y)return new numeric.T(numeric.inv(e.x));var t,n,r,a,i,s,o,l,u,c,p,d,m,h,f,y,g,b,v=e.x.length,N=numeric.identity(v),T=numeric.rep([v,v],0),C=numeric.clone(e.x),A=numeric.clone(e.y);for(u=0;ud&&(p=c,d=m);for(p!==u&&(b=C[u],C[u]=C[p],C[p]=b,b=A[u],A[u]=A[p],A[p]=b,b=N[u],N[u]=N[p],N[p]=b,b=T[u],T[u]=T[p],T[p]=b),t=C[u],n=A[u],i=N[u],s=T[u],h=t[u],f=n[u],c=u+1;c0;u--)for(i=N[u],s=T[u],c=u-1;c>=0;c--)for(o=N[c],l=T[c],h=C[c][u],f=A[c][u],p=v-1;p>=0;p--)y=i[p],g=s[p],o[p]-=h*y-f*g,l[p]-=h*g+f*y;return new numeric.T(N,T)},numeric.T.prototype.get=function(e){var t,n=this.x,r=this.y,a=0,i=e.length;if(r){for(;a=0?1:-1)*numeric.norm2(e);t[0]+=n;var r=numeric.norm2(t);if(0===r)throw new Error("eig: internal error");return numeric.div(t,r)},numeric.toUpperHessenberg=function(e){var t=numeric.dim(e);if(2!==t.length||t[0]!==t[1])throw new Error("numeric: toUpperHessenberg() only works on square matrices");var n,r,a,i,s,o,l,u,c,p,d=t[0],m=numeric.clone(e),h=numeric.identity(d);for(r=0;r0){for(s=numeric.house(i),o=numeric.getBlock(m,[r+1,r],[d-1,d-1]),l=numeric.tensor(s,numeric.dot(s,o)),n=r+1;n=4*l?(x=.5*(u+Math.sqrt(u*u-4*l)),S=.5*(u-Math.sqrt(u*u-4*l)),c=numeric.add(numeric.sub(numeric.dot(c,c),numeric.mul(c,x+S)),numeric.diag(numeric.rep([3],x*S)))):c=numeric.add(numeric.sub(numeric.dot(c,c),numeric.mul(c,u)),numeric.diag(numeric.rep([3],l))),n=[c[0][0],c[1][0],c[2][0]],r=numeric.house(n),m=[e[0],e[1],e[2]],h=numeric.tensor(r,numeric.dot(r,m)),y=0;y<3;y++)for(d=e[y],f=h[y],b=0;b=0?((y=(s-(d=c<0?-.5*(c-S(p)):-.5*(c+S(p))))*(s-d)+o*o)>(g=l*l+(u-d)*(u-d))?(h=(s-d)/(y=S(y)),f=o/y):(h=l/(g=S(g)),f=(u-d)/g),a=new N([[f,-h],[h,f]]),V.setRows(n,i,a.dot(V.getRows(n,i)))):(d=-.5*c,m=.5*S(-p),(y=(s-d)*(s-d)+o*o)>(g=l*l+(u-d)*(u-d))?(h=(s-d)/(y=S(y+m*m)),f=o/y,d=0,m/=y):(h=l/(g=S(g+m*m)),f=(u-d)/g,d=m/g,m=0),a=new N([[f,-h],[h,f]],[[d,m],[m,-d]]),V.setRows(n,i,a.dot(V.getRows(n,i))))}var w=V.dot(e).dot(V.transjugate()),E=(T=e.length,numeric.T.identity(T));for(i=0;i0)for(r=i-1;r>=0;r--){var D=w.get([r,r]),O=w.get([i,i]);numeric.neq(D.x,O.x)||numeric.neq(D.y,O.y)?(d=w.getRow(r).getBlock([r],[i-1]),m=E.getRow(i).getBlock([r],[i-1]),E.set([i,r],w.get([r,i]).neg().sub(d.dot(m)).div(D.sub(O)))):E.setRow(i,E.getRow(r))}for(i=0;i=i.length;)i[i.length]=0;0!==t[r]&&i[r]++}var s=i.length,o=Array(s+1);for(o[0]=0,n=0;n=l){if(a[c]=m[u],0===u)return;++c,o=p[--u],l=d[u]}else 0===r[s=i[n[o]]]?(r[s]=1,p[u]=o,m[++u]=s,o=t[s],d[u]=l=t[s+1]):++o},numeric.ccsLPSolve=function(e,t,n,r,a,i,s){var o=e[0],l=e[1],u=e[2];o.length;var c,p,d,m,h,f,y,g,b,v=t[0],N=t[1],T=t[2];for(p=v[a],d=v[a+1],r.length=0,c=p;ci&&(s=a,i=o);for(T(b[n])=u){if(a[p]=i[h[c]],0===c)return;++p,l=d[--c],u=m[c]}else 0===r[o=n[l]]?(r[o]=1,d[c]=l,h[++c]=o,l=t[o=i[o]],m[c]=u=t[o+1]):++l}},numeric.ccsLPSolve0=function(e,t,n,r,a,i,s,o){var l=e[0],u=e[1],c=e[2];l.length;var p,d,m,h,f,y,g,b,v,N=t[0],T=t[1],C=t[2];for(d=N[a],m=N[a+1],r.length=0,p=d;pi&&(s=a,i=o);for(T(b[C[n]])n[r]&&(n[r]=t.length),t)t.hasOwnProperty(a)&&e(t[a],n,r+1);return n},numeric.sclone=function e(t,n,r){void 0===n&&(n=0),void 0===r&&(r=numeric.sdim(t).length);var a,i=Array(t.length);if(n===r-1){for(a in t)t.hasOwnProperty(a)&&(i[a]=t[a]);return i}for(a in t)t.hasOwnProperty(a)&&(i[a]=e(t[a],n+1,r));return i},numeric.sdiag=function(e){var t,n,r=e.length,a=Array(r);for(t=r-1;t>=1;t-=2)n=t-1,a[t]=[],a[t][t]=e[t],a[n]=[],a[n][n]=e[n];return 0===t&&(a[0]=[],a[0][0]=e[t]),a},numeric.sidentity=function(e){return numeric.sdiag(numeric.rep([e],1))},numeric.stranspose=function(e){var t,n,r,a=[];for(t in e.length,e)if(e.hasOwnProperty(t))for(n in r=e[t])r.hasOwnProperty(n)&&("object"!=typeof a[n]&&(a[n]=[]),a[n][t]=r[n]);return a},numeric.sLUP=function(e,t){throw new Error("The function numeric.sLUP had a bug in it and has been removed. Please use the new numeric.ccsLUP function instead.")},numeric.sdotMM=function(e,t){var n=e.length;t.length;var r,a,i,s,o,l,u,c=numeric.stranspose(t),p=c.length,d=Array(n);for(i=n-1;i>=0;i--){for(u=[],r=e[i],o=p-1;o>=0;o--){for(s in l=0,a=c[o],r)r.hasOwnProperty(s)&&s in a&&(l+=r[s]*a[s]);l&&(u[o]=l)}d[i]=u}return d},numeric.sdotMV=function(e,t){var n,r,a,i,s=e.length,o=Array(s);for(r=s-1;r>=0;r--){for(a in i=0,n=e[r])n.hasOwnProperty(a)&&t[a]&&(i+=n[a]*t[a]);i&&(o[r]=i)}return o},numeric.sdotVM=function(e,t){var n,r,a,i,s=[];for(n in e)if(e.hasOwnProperty(n))for(r in a=t[n],i=e[n],a)a.hasOwnProperty(r)&&(s[r]||(s[r]=0),s[r]+=i*a[r]);return s},numeric.sdotVV=function(e,t){var n,r=0;for(n in e)e[n]&&t[n]&&(r+=e[n]*t[n]);return r},numeric.sdot=function(e,t){var n=numeric.sdim(e).length,r=numeric.sdim(t).length;switch(1e3*n+r){case 0:return e*t;case 1001:return numeric.sdotVV(e,t);case 2001:return numeric.sdotMV(e,t);case 1002:return numeric.sdotVM(e,t);case 2002:return numeric.sdotMM(e,t);default:throw new Error("numeric.sdot not implemented for tensors of order "+n+" and "+r)}},numeric.sscatter=function(e){var t,n,r,a,i=e[0].length,s=e.length,o=[];for(n=i-1;n>=0;--n)if(e[s-1][n]){for(a=o,r=0;r=0;--i)n[i]=[];for(i=a;i>=0;--i)n[i].push(r[i]);n[a+1].push(s)}}else e(s,n,r);return r.length>a&&r.pop(),n},numeric.cLU=function(e){var t,n,r,a,i,s,o=e[0],l=e[1],u=e[2],c=o.length,p=0;for(t=0;tp&&(p=o[t]);p++;var d,m=Array(p),h=Array(p),f=numeric.rep([p],1/0),y=numeric.rep([p],-1/0);for(r=0;ry[t]&&(y[t]=n);for(t=0;ty[t+1]&&(y[t+1]=y[t]);for(t=p-1;t>=1;t--)f[t]=0;d--){for(;u[m]>d;)a[d]-=c[m]*a[u[m]],m--;a[d]/=c[m],m--}return a},numeric.cgrid=function(e,t){"number"==typeof e&&(e=[e,e]);var n,r,a,i=numeric.rep(e,-1);for("function"!=typeof t&&(t="L"===t?function(t,n){return t>=e[0]/2||na&&(a=i[r]);for(a++,n=numeric.rep([a],0),r=0;r1;)a[r=s((t+n)/2)]<=e?t=r:n=r;return this._at(e,t)}i=e.length;var o,l=Array(i);for(o=i-1;-1!==o;--o)l[o]=this.at(e[o]);return l},numeric.Spline.prototype.diff=function(){var e,t,n,r=this.x,a=this.yl,i=this.yr,s=this.kl,o=this.kr,l=a.length,u=s,c=o,p=Array(l),d=Array(l),m=numeric.add,h=numeric.mul,f=numeric.div,y=numeric.sub;for(e=l-1;-1!==e;--e)t=r[e+1]-r[e],n=y(i[e+1],a[e]),p[e]=f(m(h(n,6),h(s[e],-4*t),h(o[e+1],-2*t)),t*t),d[e+1]=f(m(h(n,-6),h(s[e],2*t),h(o[e+1],4*t)),t*t);return new numeric.Spline(r,u,c,p,d)},numeric.Spline.prototype.roots=function(){function e(e){return e*e}var t=[],n=this.x,r=this.yl,a=this.yr,i=this.kl,s=this.kr;"number"==typeof r[0]&&(r=[r],a=[a],i=[i],s=[s]);var o,l,u,c,p,d,m,h,f,y,g,b,v,N,T,C,A,V,x,S,w,E,D,O=r.length,I=n.length-1,R=(t=Array(O),Math.sqrt);for(o=0;o!==O;++o){for(c=r[o],p=a[o],d=i[o],m=s[o],h=[],l=0;l!==I;l++){for(l>0&&p[l]*c[l]<0&&h.push(n[l]),C=n[l+1]-n[l],n[l],g=c[l],b=p[l+1],f=d[l]/C,v=(y=m[l+1]/C)+3*g+2*f-3*b,N=3*(y+f+2*(g-b)),(T=e(f-y+3*(g-b))+12*y*g)<=0?A=(V=v/N)>n[l]&&Vn[l]&&Vn[l]&&x0)w=E,V=x;else{for(var _=0;!((D=(V*E-x*w)/(V-x))<=w||D>=E);)if((S=this._at(D,l))*x>0)E=D,x=S,-1===_&&(V*=.5),_=-1;else{if(!(S*V>0))break;w=D,V=S,1===_&&(x*=.5),_=1}h.push(D),w=A[u+1],V=this._at(w,l)}else h.push(w),w=E,V=x;0===x&&h.push(E)}t[o]=h}return"number"==typeof this.yl[0]?t[0]:t},numeric.spline=function(e,t,n,r){var a,i=e.length,s=[],o=[],l=[],u=numeric.sub,c=numeric.mul,p=numeric.add;for(a=i-2;a>=0;a--)o[a]=e[a+1]-e[a],l[a]=u(t[a+1],t[a]);"string"!=typeof n&&"string"!=typeof r||(n=r="periodic");var d=[[],[],[]];switch(typeof n){case"undefined":s[0]=c(3/(o[0]*o[0]),l[0]),d[0].push(0,0),d[1].push(0,1),d[2].push(2/o[0],1/o[0]);break;case"string":s[0]=p(c(3/(o[i-2]*o[i-2]),l[i-2]),c(3/(o[0]*o[0]),l[0])),d[0].push(0,0,0),d[1].push(i-2,0,1),d[2].push(1/o[i-2],2/o[i-2]+2/o[0],1/o[0]);break;default:s[0]=n,d[0].push(0),d[1].push(0),d[2].push(1)}for(a=1;a20)throw new Error("Numerical gradient fails");if(l[a]=t[a]+v,i=e(l),l[a]=t[a]-v,s=e(l),l[a]=t[a],isNaN(i)||isNaN(s))v/=16;else{if(u[a]=(i-s)/(2*v),c=t[a]-v,p=t[a],d=t[a]+v,m=(i-r)/v,h=(r-s)/v,f=o(y(u[a]),y(r),y(i),y(s),y(c),y(p),y(d),1e-8),!(g(o(y(m-u[a]),y(h-u[a]),y(m-h))/f,v/f)>.001))break;v/=16}}return u},numeric.uncmin=function(e,t,n,r,a,i,s){var o=numeric.gradient;void 0===s&&(s={}),void 0===n&&(n=1e-8),void 0===r&&(r=function(t){return o(e,t)}),void 0===a&&(a=1e3);var l,u,c=(t=numeric.clone(t)).length,p=e(t);if(isNaN(p))throw new Error("uncmin: f(x0) is a NaN!");var d=Math.max,m=numeric.norm2;n=d(n,numeric.epsilon);var h,f,y,g=s.Hinv||numeric.identity(c),b=numeric.dot;numeric.inv;var v,N,T,C,A,V,x,S=numeric.sub,w=numeric.add,E=numeric.tensor,D=numeric.div,O=numeric.mul,I=numeric.all,R=numeric.isFinite,_=numeric.neg,M=0,P="";for(f=r(t);M=.1*V*u||isNaN(l));)V*=.5,++M;if(V*x1;)o[r=a(.5*(t+n))]<=e?t=r:n=r;return this._at(e,t)},numeric.dopri=function(e,t,n,r,a,i,s){void 0===a&&(a=1e-6),void 0===i&&(i=1e3);var o,l,u,c,p,d,m,h,f,y,g,b,v,N=[e],T=[n],C=[r(e,n)],A=[],V=[3/40,9/40],x=[44/45,-56/15,32/9],S=[19372/6561,-25360/2187,64448/6561,-212/729],w=[9017/3168,-355/33,46732/5247,49/176,-5103/18656],E=[35/384,0,500/1113,125/192,-2187/6784,11/84],D=[.10013431883002395,0,.3918321794184259,-.02982460176594817,.05893268337240795,-.04497888809104361,5618549.5/235043384],O=[.2,.3,.8,8/9,1,1],I=[-71/57600,0,71/16695,-71/1920,17253/339200,-22/525,1/40],R=0,_=(t-e)/10,M=0,P=numeric.add,F=numeric.mul,k=Math.min,$=Math.abs,B=numeric.norminf,L=Math.pow,z=numeric.any,U=numeric.lt,j=numeric.and;numeric.sub;var q=new numeric.Dopri(N,T,C,A,-1,"");for("function"==typeof s&&(g=s(e,n));et&&(_=t-e),o=r(e+O[0]*_,P(n,F(.2*_,C[R]))),l=r(e+O[1]*_,P(P(n,F(V[0]*_,C[R])),F(V[1]*_,o))),u=r(e+O[2]*_,P(P(P(n,F(x[0]*_,C[R])),F(x[1]*_,o)),F(x[2]*_,l))),c=r(e+O[3]*_,P(P(P(P(n,F(S[0]*_,C[R])),F(S[1]*_,o)),F(S[2]*_,l)),F(S[3]*_,u))),p=r(e+O[4]*_,P(P(P(P(P(n,F(w[0]*_,C[R])),F(w[1]*_,o)),F(w[2]*_,l)),F(w[3]*_,u)),F(w[4]*_,c))),d=r(e+_,f=P(P(P(P(P(n,F(C[R],_*E[0])),F(l,_*E[2])),F(u,_*E[3])),F(c,_*E[4])),F(p,_*E[5]))),(y="number"==typeof(m=P(P(P(P(P(F(C[R],_*I[0]),F(l,_*I[2])),F(u,_*I[3])),F(c,_*I[4])),F(p,_*I[5])),F(d,_*I[6])))?$(m):B(m))>a){if(e+(_=.2*_*L(a/y,.25))===e){q.msg="Step size became too small";break}}else{if(A[R]=P(P(P(P(P(P(n,F(C[R],_*D[0])),F(l,_*D[2])),F(u,_*D[3])),F(c,_*D[4])),F(p,_*D[5])),F(d,_*D[6])),N[++R]=e+_,T[R]=f,C[R]=d,"function"==typeof s){var G,H,W=e,K=e+.5*_;if(b=s(K,A[R-1]),z(v=j(U(g,0),U(0,b)))||(W=K,g=b,b=s(K=e+_,f),v=j(U(g,0),U(0,b))),z(v)){for(var Z,X,Y=0,Q=1,J=1;;){if("number"==typeof g)H=(J*b*W-Q*g*K)/(J*b-Q*g);else for(H=K,h=g.length-1;-1!==h;--h)g[h]<0&&b[h]>0&&(H=k(H,(J*b[h]*W-Q*g[h]*K)/(J*b[h]-Q*g[h])));if(H<=W||H>=K)break;X=s(H,G=q._at(H,R-1)),z(Z=j(U(g,0),U(0,X)))?(K=H,b=X,v=Z,J=1,-1===Y?Q*=.5:Q=1,Y=-1):(W=H,g=X,Q=1,1===Y?J*=.5:J=1,Y=1)}return f=q._at(.5*(e+H),R-1),q.f[R]=r(H,G),q.x[R]=H,q.y[R]=G,q.ymid[R-1]=f,q.events=v,q.iterations=M,q}}e+=_,n=f,g=b,_=k(.8*_*L(a/y,.25),4*_)}return q.iterations=M,q},numeric.LU=function(e,t){t=t||!1;var n,r,a,i,s,o,l,u,c,p=Math.abs,d=e.length,m=d-1,h=new Array(d);for(t||(e=numeric.clone(e)),a=0;a=0;--n){for(i=o[n],r=n+1;rP)&&(g=P),E=m(e,u(g,x)),T=p(M,S),R=h-1;-1!==R;--R)T[R][R]+=1;_=D(T,d(E,g),!0);var F=d(O,p(t,_)),k=1;for(R=f-1;-1!==R;--R)F[R]<0&&(k=C(k,-.999*F[R]));if(l=c(i,u(_,k)),!A(V(O=c(n,p(t,l)),0)))return{solution:i,message:"",iterations:w};if(i=l,g=0);if(y)return{solution:l,message:"Unbounded",iterations:w}}return{solution:i,message:"maximum iteration count exceeded",iterations:w}},numeric._solveLP=function(e,t,n,r,a){var i=e.length,s=n.length;numeric.sum,numeric.log,numeric.mul;var o=numeric.sub,l=numeric.dot;numeric.div,numeric.add;var u=numeric.rep([i],0).concat([1]),c=numeric.rep([s,1],-1),p=numeric.blockMatrix([[t,c]]),d=n,m=numeric.rep([i],0).concat(Math.max(0,numeric.sup(numeric.neg(n)))+1),h=numeric.__solveLP(u,p,d,r,a,m,!1),f=numeric.clone(h.solution);if(f.length=i,numeric.inf(o(n,l(t,f)))<0)return{solution:NaN,message:"Infeasible",iterations:h.iterations};var y=numeric.__solveLP(e,t,n,r,a-h.iterations,f,!0);return y.iterations+=h.iterations,y},numeric.solveLP=function(e,t,n,r,a,i,s){if(void 0===s&&(s=1e3),void 0===i&&(i=numeric.epsilon),void 0===r)return numeric._solveLP(e,t,n,i,s);var o,l=r.length,u=r[0].length,c=t.length,p=numeric.echelonize(r),d=numeric.rep([u],0),m=p.P,h=[];for(o=m.length-1;-1!==o;--o)d[m[o]]=1;for(o=u-1;-1!==o;--o)0===d[o]&&h.push(o);var f=numeric.getRange,y=numeric.linspace(0,l-1),g=numeric.linspace(0,c-1),b=f(r,y,h),v=f(t,g,m),N=f(t,g,h),T=numeric.dot,C=numeric.sub,A=T(v,p.I),V=C(N,T(A,b)),x=C(n,T(A,a)),S=Array(m.length),w=Array(h.length);for(o=m.length-1;-1!==o;--o)S[o]=e[m[o]];for(o=h.length-1;-1!==o;--o)w[o]=e[h[o]];var E=C(w,T(S,T(p.I,b))),D=numeric._solveLP(E,V,x,i,s),O=D.solution;if(O!=O)return D;var I=T(p.I,C(a,T(b,O))),R=Array(e.length);for(o=m.length-1;-1!==o;--o)R[m[o]]=I[o];for(o=h.length-1;-1!==o;--o)R[h[o]]=O[o];return{solution:R,message:D.message,iterations:D.iterations}},numeric.MPStoLP=function(e){e instanceof String&&e.split("\n");var t,n,r,a,i=0,s=["Initial state","NAME","ROWS","COLUMNS","RHS","BOUNDS","ENDATA"],o=e.length,l=0,u={},c=[],p=0,d={},m=0,h=[],f=[],y=[];function g(n){throw new Error("MPStoLP: "+n+"\nLine "+t+": "+e[t]+"\nCurrent state: "+s[i]+"\n")}for(t=0;t