Intial Commit
This commit is contained in:
commit
664c6d8ca3
5892 files changed
+759183
No files matched your search
+56616
File diff suppressed because it is too large.
Load diff
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["math.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","deepMap","array","callback","skipZeros","map","x","type","config","load","typed","_create","data","format","datatype","M","Matrix","storage","matrix","","string","string, string","Array","Array | Matrix, string","Array | Matrix, string, string","toTex","0","1","2","zeros","length","arr","push","isNumber","isInteger","isFinite","Math","round","sign","options","Infinity","isNaN","notation","precision","undefined","toFixed","toExponential","toEngineering","toPrecision","exponential","replace","digits","arguments","e","Error","splitNumber","match","String","toLowerCase","SyntaxError","exponent","parseFloat","dot","indexOf","coefficients","split","parseInt","rounded","roundDigits","newExp","significandsDiff","abs","concat","expDiff","decimalIdx","decimals","slice","join","decimalVal","str","toString","splitValue","pp","splice","first","shift","lower","upper","pow","unshift","removed","pop","DBL_EPSILON","Number","EPSILON","nearlyEqual","y","epsilon","diff","max","symbols","Alpha","alpha","Beta","beta","Gamma","gamma","Delta","delta","Epsilon","varepsilon","Zeta","zeta","Eta","eta","Theta","theta","vartheta","Iota","iota","Kappa","kappa","varkappa","Lambda","lambda","Mu","mu","Nu","nu","Xi","xi","Omicron","omicron","Pi","pi","varpi","Rho","rho","varrho","Sigma","sigma","varsigma","Tau","tau","Upsilon","upsilon","Phi","phi","varphi","Chi","chi","Psi","psi","Omega","omega","true","false","inf","Inf","infinity","oo","lim","operators","transpose","factorial","dotPow","unaryPlus","unaryMinus","bitNot","not","multiply","divide","dotMultiply","dotDivide","mod","add","subtract","to","leftShift","rightArithShift","rightLogShift","equal","unequal","smaller","larger","smallerEq","largerEq","bitAnd","bitXor","bitOr","and","xor","or","defaultTemplate","units","deg","toSymbol","isUnit","index","substring","clone","isArray","valueOf","Boolean","Date","isBigNumber","RegExp","TypeError","key","extend","a","b","prop","deepExtend","constructor","deepEqual","len","canDefineProperty","lazy","fn","_value","_uninitialized","set","traverse","path","obj","names","isFactory","DenseMatrix","algorithm14","inverse","dt","adata","_data","asize","_size","adt","_datatype","cf","convert","find","cdata","_iterate","size","f","level","av","bv","cv","j","algorithm13","bdata","bsize","bdt","csize","DimensionError","RangeError","util","isString","_validate","dim","dimNext","child","_resize","defaultValue","elem","oldLen","newLen","minLen","min","UNINITIALIZED","_squeeze","dims","ii","next","_unsqueeze","number","IndexError","validate","isScalar","validateIndex","resize","forEach","_defaultValue","squeeze","unsqueeze","outer","flatten","flat","equalScalar","boolean, boolean","number, number","BigNumber, BigNumber","eq","bigNearlyEqual","Fraction, Fraction","equals","Complex, Complex","Unit, Unit","equalBase","actual","expected","relation","message","stack","isDimensionError","latex","addScalar","multiplyScalar","algorithm11","SparseMatrix","Array, Array","_validateMatrixDimensions","isMatrix","Matrix, Matrix","xsize","ysize","_multiplyVectorVector","_multiplyVectorMatrix","_multiplyMatrixVector","_multiplyMatrixMatrix","Matrix, Array","Array, Matrix","Matrix, any","any, Matrix","Array, any","any, Array","any, any","any, any, ...any","rest","result","signatures","size1","size2","af","mf","_multiplyVectorDenseMatrix","alength","bcolumns","sum","_multiplyDenseMatrixVector","_multiplySparseMatrixVector","_multiplyDenseMatrixDenseMatrix","_multiplyDenseMatrixSparseMatrix","_multiplySparseMatrixDenseMatrix","_multiplySparseMatrixSparseMatrix","arows","acolumns","row","bvalues","_values","bindex","_index","bptr","_ptr","zero","cvalues","cindex","cptr","values","ptr","jb","kb0","kb1","last","cij","mark","kb","ib","avalues","aindex","aptr","brows","w","vbi","ka0","ka1","ka","ia","p1","ic","vbij","p0","math","Node","_validateScope","scope","symbol","keywords","eval","compile","isNode","comment","defs","expression","transform","args","code","_compile","defsCode","keys","factoryCode","Function","_ifNode","node","_traverse","parent","_transform","replacement","filter","nodes","cloneDeep","other","customString","handler","_toString","customTex","_toTex","getIdentifier","getContent","algorithm03","denseMatrix","sparseMatrix","rows","columns","z","k0","k1","k","v","algorithm12","r","algorithm01","algorithm04","algorithm10","divideScalar","div","Unit, number | Fraction | BigNumber","res","_normalize","number | Fraction | BigNumber, Unit","plus","fixPrefix","algorithm05","sub","minus","formatArray","formatNumber","formatBigNumber","endsWith","text","search","start","end","isFraction","fraction","syntax","entries","mul","times","number | Fraction | BigNumber | Complex, Unit","Unit, number | Fraction | BigNumber | Complex","algorithm02","algorithm07","xa","xb","wa","wb","_scatter","va","vb","types","emitter","SymbolNode","undef","Unit","isSymbolNode","isValuelessUnit","Complex","BigNumber","Fraction","Array | Matrix","gt","compare","parse","expr","ArgumentsError","extra_nodes","parseStart","charAt","nesting_level","conditional_level","prevPreview","nextPreview","nextNextPreview","getToken","token_type","TOKENTYPE","NULL","token","isWhitespace","DELIMITER","c2","c3","DELIMITERS","isDigitDot","isAlpha","isDigit","NAMED_DELIMITERS","SYMBOL","UNKNOWN","createSyntaxError","NUMBER","isDecimalMark","getTokenSkipNewline","openParams","closeParams","parseBlock","createError","visible","blocks","parseAssignment","BlockNode","ConstantNode","valid","parseConditional","AssignmentNode","isAccessorNode","isFunctionNode","arg","FunctionAssignmentNode","parseLogicalOr","prev","condition","trueExpr","falseExpr","ConditionalNode","parseLogicalXor","OperatorNode","parseLogicalAnd","parseBitwiseOr","parseBitwiseXor","parseBitwiseAnd","parseRelational","params","parseShift","==","!=","<",">","<=",">=","parseConversion","<<",">>",">>>","parseRange","in","parseAddSubtract","RangeNode","parseMultiplyDivide","+","-","parseUnary","*",".*","/","./","%","isConstantNode","isOperatorNode","op","~","parsePow","parseLeftHandOperators","parseCustomNodes","!","'","parseAccessors","parseSymbol","parseString","FunctionNode","AccessorNode","IndexNode","dotNotation","parseStringToken","parseMatrix","cols","parseRow","items","ArrayNode","parseObject","properties","ObjectNode","parseNumber","parseParentheses","ParenthesisNode","parseEnd","col","error",",","(",")","[","]","{","}","\"",";","^",".^","&","|","^|","=",":","?","cPrev","cNext","isValidLatinOrGreek","isValidMathSymbol","test","high","low","nestingLevel","err","isIndexError","isZero","lte","deepForEach","memoize","hasher","cache","hash","JSON","stringify","apply","maxArgumentCount","reduce","signature","count","inv","Array | Matrix, Array | Matrix","any, Array | Matrix","_pow","predictable","yFrac","yNum","ex","_powArray","eye","px","_powMatrix","toNumber","Array, number","Array, BigNumber","Matrix, number","Matrix, BigNumber","Unit, number","neg","_zeros","hasBigNumbers","...number | BigNumber | string","lt","isInt","isArgumentsError","valueType","getType","SUPPORTED_TYPES","boolean","null","numConfig","every","bind","deprecated","expandTemplate","template","regex","inputPos","exec","ReferenceError","argsName","jsFn","jsArgs","jsScope","_compileScope","isRaw","rawArgs","_getUniqueArgumentsName","isObjectProperty","jsObject","getObjectProperty","nodeToString","nodeToTex","latexConverter","customToTex","getPrecedence","_node","parenthesis","identifier","getAssociativity","associativity","isAssociativeWith","nodeA","nodeB","identifierA","identifierB","associativeWith","latexLeftParens","latexRightParens","latexParens","OperatorNode:or","OperatorNode:xor","OperatorNode:and","OperatorNode:bitOr","OperatorNode:bitXor","OperatorNode:bitAnd","OperatorNode:equal","OperatorNode:unequal","OperatorNode:smaller","OperatorNode:larger","OperatorNode:smallerEq","OperatorNode:largerEq","OperatorNode:leftShift","OperatorNode:rightArithShift","OperatorNode:rightLogShift","OperatorNode:to","OperatorNode:add","OperatorNode:subtract","OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:dotDivide","OperatorNode:mod","OperatorNode:unaryPlus","OperatorNode:unaryMinus","OperatorNode:bitNot","OperatorNode:not","OperatorNode:pow","OperatorNode:dotPow","OperatorNode:factorial","OperatorNode:transpose","cmp","isNegative","isNeg","implicit","calculateNecessaryParentheses","precedence","parens","operandPrecedence","operandIdentifier","rootIdentifier","lhsParens","lhsPrecedence","assocWithLhs","rhsParens","rhsPrecedence","assocWithRhs","lhsIdentifier","rhsIdentifier","parensArray","argPrecedence","assocWithArg","argAssociativity","assoc","operand","lhs","rhs","stringifiedArgs","lhsTex","rhsTex","texifiedArgs","content","isParenthesisNode","_sqrtNumber","sqrt","_getSubstring","isIndex","strLen","range","dimension","substr","_setSubstring","chars","subset","Array, Index","Matrix, Index","Object, Index","_getObjectProperty","string, Index","Array, Index, any","Array, Index, any, any","Matrix, Index, any","Matrix, Index, any, any","string, Index, string","string, Index, string, string","Object, Index, any","_setObjectProperty","updated","_denseTranspose","_sparseTranspose","any","transposedRow","transposed","q","combinations","one","isPositiveInteger","dividedBy","gte","isPositive","wai","wbi","vc","algorithm06","u","scatter","isCollection","_reduce","mat","ret","val","tran","_switch","I","J","tmp","arraySize","create","item","isArrayNode","asMatrix","childNode","step","startPrecedence","stepPrecedence","endPrecedence","isRangeNode","needsEnd","endSymbols","solveValidation","copy","msize","isDenseMatrix","cs_Line truncated
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* math.js
|
||||
* https://github.com/josdejong/mathjs
|
||||
*
|
||||
* Math.js is an extensive math library for JavaScript and Node.js,
|
||||
* It features real and complex numbers, units, matrices, a large set of
|
||||
* mathematical functions, and a flexible expression parser.
|
||||
*
|
||||
* @version 3.9.3
|
||||
* @date 2017-02-22
|
||||
*
|
||||
* @license
|
||||
* Copyright (C) 2013-2017 Jos de Jong <wjosdejong@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.math=t():e.math=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=509)}([function(e,t,r){"use strict";e.exports=function e(t,r,n){return t&&"function"==typeof t.map?t.map(function(t){return e(t,r,n)}):r(t)}},function(e,t,r){"use strict";function n(e,t,r,n){function i(t,r,n){var i=e.Matrix.storage(r||"default");return new i(t,n)}var a=n("matrix",{"":function(){return i([])},string:function(e){return i([],e)},"string, string":function(e,t){return i([],e,t)},Array:function(e){return i(e)},Matrix:function(e){return i(e,e.storage())},"Array | Matrix, string":i,"Array | Matrix, string, string":i});return a.toTex={0:"\\begin{bmatrix}\\end{bmatrix}",1:"\\left(${args[0]}\\right)",2:"\\left(${args[0]}\\right)"},a}t.name="matrix",t.factory=n},function(e,t,r){"use strict";function n(e){for(var t=[],r=0;r<e;r++)t.push(0);return t}t.isNumber=function(e){return"number"==typeof e},t.isInteger=function(e){return!!isFinite(e)&&e==Math.round(e)},t.sign=Math.sign||function(e){return e>0?1:e<0?-1:0},t.format=function(e,r){if("function"==typeof r)return r(e);if(e===1/0)return"Infinity";if(e===-(1/0))return"-Infinity";if(isNaN(e))return"NaN";var n="auto",i=void 0;switch(r&&(r.notation&&(n=r.notation),t.isNumber(r)?i=r:r.precision&&(i=r.precision)),n){case"fixed":return t.toFixed(e,i);case"exponential":return t.toExponential(e,i);case"engineering":return t.toEngineering(e,i);case"auto":return t.toPrecision(e,i,r&&r.exponential).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t});default:throw new Error('Unknown notation "'+n+'". Choose "auto", "exponential", or "fixed".')}},t.splitNumber=function(e){var t=String(e).toLowerCase().match(/^0*?(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw new SyntaxError("Invalid number "+e);var r=t[1],n=t[2],i=parseFloat(t[4]||"0"),a=n.indexOf(".");i+=a!==-1?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,function(e){return i-=e.length,""}).replace(/0*$/,"").split("").map(function(e){return parseInt(e)});return 0===o.length&&(o.push(0),i++),{sign:r,coefficients:o,exponent:i}},t.toEngineering=function(e,r){if(isNaN(e)||!isFinite(e))return String(e);var i=t.roundDigits(t.splitNumber(e),r),a=i.exponent,o=i.coefficients,s=a%3===0?a:a<0?a-3-a%3:a-a%3,u=a>=0?a:Math.abs(s);o.length-1<u&&(o=o.concat(n(u-(o.length-1))));for(var c=Math.abs(a-s),f=1;--c>=0;)f++;var l=o.slice(f).join(""),p=l.match(/[1-9]/)?"."+l:"",h=o.slice(0,f).join("")+p+"e"+(a>=0?"+":"")+s.toString();return i.sign+h},t.toFixed=function(e,r){if(isNaN(e)||!isFinite(e))return String(e);var i=t.splitNumber(e),a=t.roundDigits(i,i.exponent+1+(r||0)),o=a.coefficients,s=a.exponent+1,u=s+(r||0);return o.length<u&&(o=o.concat(n(u-o.length))),s<0&&(o=n(-s+1).concat(o),s=1),r&&o.splice(s,0,0===s?"0.":"."),a.sign+o.join("")},t.toExponential=function(e,r){if(isNaN(e)||!isFinite(e))return String(e);var i=t.splitNumber(e),a=r?t.roundDigits(i,r):i,o=a.coefficients,s=a.exponent;o.length<r&&(o=o.concat(n(r-o.length)));var u=o.shift();return a.sign+u+(o.length>0?"."+o.join(""):"")+"e"+(s>=0?"+":"")+s},t.toPrecision=function(e,r,i){if(isNaN(e)||!isFinite(e))return String(e);var a=i&&void 0!==i.lower?i.lower:.001,o=i&&void 0!==i.upper?i.upper:1e5,s=t.splitNumber(e),u=Math.abs(Math.pow(10,s.exponent));if(u<a||u>=o)return t.toExponential(e,r);var c=r?t.roundDigits(s,r):s,f=c.coefficients,l=c.exponent;f.length<r&&(f=f.concat(n(r-f.length))),f=f.concat(n(l-f.length+1+(f.length<r?r-f.length:0))),f=n(-l).concat(f);var p=l>0?l:0;return p<f.length-1&&f.splice(p+1,0,"."),c.sign+f.join("")},t.roundDigits=function(e,t){for(var r={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=r.coefficients;t<=0;)n.unshift(0),r.exponent++,t++;if(n.length>t){var i=n.splice(t,n.length-t);if(i[0]>=5){var a=t-1;for(n[a]++;10===n[a];)n.pop(),0===a&&(n.unshift(0),r.exponent++,a++),a--,n[a]++}}return r},t.digits=function(e){return e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length},t.DBL_EPSILON=Number.EPSILON||2.220446049250313e-16,t.nearlyEqual=function(e,r,n){if(null==n)return e==r;if(e==r)return!0;if(isNaN(e)||isNaN(r))return!1;if(isFinite(e)&&isFinite(r)){var i=Math.abs(e-r);return i<t.DBL_EPSILON||i<=Math.max(Math.abs(e),Math.abs(r))*n}return!1}},function(e,t,r){"use strict";t.symbols={Alpha:"A",alpha:"\\alpha",Beta:"B",beta:"\\beta",Gamma:"\\Gamma",gamma:"\\gamma",Delta:"\\Delta",delta:"\\delta",Epsilon:"E",epsilon:"\\epsilon",varepsilon:"\\varepsilon",Zeta:"Z",zeta:"\\zeta",Eta:"H",eta:"\\eta",Theta:"\\Theta",theta:"\\theta",vartheta:"\\vartheta",Iota:"I",iota:"\\iota",Kappa:"K",kappa:"\\kappa",varkappa:"\\varkappa",Lambda:"\\Lambda",lambda:"\\lambda",Mu:"M",mu:"\\mu",Nu:"N",nu:"\\nu",Xi:"\\Xi",xi:"\\xi",Omicron:"O",omicron:"o",Pi:"\\Pi",pi:"\\pi",varpi:"\\varpi",Rho:"P",rho:"\\rho",varrho:"\\varrho",Sigma:"\\Sigma",sigma:"\\sigma",varsigma:"\\varsigma",Tau:"T",tau:"\\tau",Upsilon:"\\Upsilon",upsilon:"\\upsilon",Phi:"\\Phi",phi:"\\phi",varphi:"\\varphi",Chi:"X",chi:"\\chi",Psi:"\\Psi",psi:"\\psi",Omega:"\\Omega",omega:"\\omega",true:"\\mathrm{True}",false:"\\mathrm{False}",i:"i",inf:"\\infty",Inf:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:"\\lim",undefined:"\\mathbf{?}"},t.operators={transpose:"^\\top",factorial:"!",pow:"^",dotPow:".^\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"~",not:"\\neg",multiply:"\\cdot",divide:"\\frac",dotMultiply:".\\cdot",dotDivide:".:",mod:"\\mod",add:"+",subtract:"-",to:"\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"},t.defaultTemplate="\\mathrm{${name}}\\left(${args}\\right)";var n={deg:"^\\circ"};t.toSymbol=function(e,r){if(r="undefined"!=typeof r&&r)return n.hasOwnProperty(e)?n[e]:"\\mathrm{"+e+"}";if(t.symbols.hasOwnProperty(e))return t.symbols[e];if(e.indexOf("_")!==-1){var i=e.indexOf("_");return t.toSymbol(e.substring(0,i))+"_{"+t.toSymbol(e.substring(i+1))+"}"}return e}},function(e,t,r){"use strict";t.clone=function e(t){var r=typeof t;if("number"===r||"string"===r||"boolean"===r||null===t||void 0===t)return t;if("function"==typeof t.clone)return t.clone();if(Array.isArray(t))return t.map(function(t){return e(t)});if(t instanceof Number)return new Number(t.valueOf());if(t instanceof String)return new String(t.valueOf());if(t instanceof Boolean)return new Boolean(t.valueOf());if(t instanceof Date)return new Date(t.valueOf());if(t&&t.isBigNumber===!0)return t;if(t instanceof RegExp)throw new TypeError("Cannot clone "+t);var n={};for(var i in t)t.hasOwnProperty(i)&&(n[i]=e(t[i]));return n},t.extend=function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e},t.deepExtend=function e(t,r){if(Array.isArray(r))throw new TypeError("Arrays are not supported by deepExtend");for(var n in r)if(r.hasOwnProperty(n))if(r[n]&&r[n].constructor===Object)void 0===t[n]&&(t[n]={}),t[n].constructor===Object?e(t[n],r[n]):t[n]=r[n];else{if(Array.isArray(r[n]))throw new TypeError("Arrays are not supported by deepExtend");t[n]=r[n]}return t},t.deepEqual=function(e,r){var n,i,a;if(Array.isArray(e)){if(!Array.isArray(r))return!1;if(e.length!=r.length)return!1;for(i=0,a=e.length;i<a;i++)if(!t.deepEqual(e[i],r[i]))return!1;return!0}if(e instanceof Object){if(Array.isArray(r)||!(r instanceof Object))return!1;for(n in e)if(!t.deepEqual(e[n],r[n]))return!1;for(n in r)if(!t.deepEqual(e[n],r[n]))return!1;return!0}return typeof e==typeof r&&e==r},t.canDefineProperty=function(){try{if(Object.defineProperty)return Object.defineProperty({},"x",{get:function(){}}),!0}catch(e){}return!1},t.lazy=function(e,r,n){if(t.canDefineProperty()){var i,a=!0;Object.defineProperty(e,r,{get:function(){return a&&(i=n(),a=!1),i},set:function(e){i=e,a=!1},configurable:!0,enumerable:!0})}else e[r]=n()},t.traverse=function(e,t){var r=e;if(t)for(var n=t.split("."),i=0;i<n.length;i++){var a=n[i];a in r||(r[a]={}),r=r[a]}return r},t.isFactory=function(e){return e&&"function"==typeof e.factory}},function(e,t,r){"use strict";function n(e,t,r,n){var a=e.DenseMatrix,o=function(e,t,r,o){var u,c=e._data,f=e._size,l=e._datatype,p=r;"string"==typeof l&&(u=l,t=n.convert(t,u),p=n.find(r,[u,u]));var h=f.length>0?s(p,0,f,f[0],c,t,o):[];return new a({data:h,size:i(f),datatype:u})},s=function(e,t,r,n,i,a,o){var u=[];if(t===r.length-1)for(var c=0;c<n;c++)u[c]=o?e(a,i[c]):e(i[c],a);else for(var f=0;f<n;f++)u[f]=s(e,t+1,r,r[t+1],i[f],a,o);return u};return o}var i=r(4).clone;t.name="algorithm14",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var i=e.DenseMatrix,o=function(e,t,r){var o=e._data,u=e._size,c=e._datatype,f=t._data,l=t._size,p=t._datatype,h=[];if(u.length!==l.length)throw new a(u.length,l.length);for(var m=0;m<u.length;m++){if(u[m]!==l[m])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+l+")");h[m]=u[m]}var d,g=r;"string"==typeof c&&c===p&&(d=c,t=n.convert(t,d),g=n.find(r,[d,d]));var v=h.length>0?s(g,0,h,h[0],o,f):[];return new i({data:v,size:h,datatype:d})},s=function(e,t,r,n,i,a){var o=[];if(t===r.length-1)for(var u=0;u<n;u++)o[u]=e(i[u],a[u]);else for(var c=0;c<n;c++)o[c]=s(e,t+1,r,r[t+1],i[c],a[c]);return o};return o}var i=r(23),a=r(9),o=i.string;o.isString;t.name="algorithm13",t.factory=n},function(e,t,r){"use strict";function n(e,t,r){var i,a=eLine truncated
|
||||
}),w=[],b=[],N=[],E=[];for(v=0;v<h;v++){var M=v+1;for(s(e,v,N,w,M),s(t,v,E,b,M),g=0;g<p;g++){var A=N[g]===M?w[g]:m,O=E[g]===M?b[g]:m;y[g][v]=d(A,O)}}return x},s=function(e,t,r,n,i){for(var a=e._values,o=e._index,s=e._ptr,u=s[t],c=s[t+1];u<c;u++){var f=o[u];r[f]=i,n[f]=a[u]}};return o}var i=r(9);t.name="algorithm07",t.factory=n},function(e,t,r){"use strict";t.array=r(7),t.boolean=r(501),t.function=r(33),t.number=r(2),t.object=r(4),t.string=r(19),t.types=r(60),t.emitter=r(132)},function(e,t,r){"use strict";function n(e,t,n,a,o){function s(e){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof e)throw new TypeError('String expected for parameter "name"');this.name=e}function u(e){throw new Error("Undefined symbol "+e)}var c=n(r(11)),f=n(r(130));return s.prototype=new c,s.prototype.type="SymbolNode",s.prototype.isSymbolNode=!0,s.prototype._compile=function(e,t){return e.undef=u,e.Unit=f,t[this.name]?this.name:this.name in e.math?'("'+this.name+'" in scope ? scope["'+this.name+'"] : math["'+this.name+'"])':'("'+this.name+'" in scope ? scope["'+this.name+'"] : '+(f.isValuelessUnit(this.name)?'new Unit(null, "'+this.name+'")':'undef("'+this.name+'")')+")"},s.prototype.forEach=function(e){},s.prototype.map=function(e){return this.clone()},s.prototype.clone=function(){return new s(this.name)},s.prototype._toString=function(e){return this.name},s.prototype._toTex=function(e){var t=!1;"undefined"==typeof o[this.name]&&f.isValuelessUnit(this.name)&&(t=!0);var r=i.toSymbol(this.name,t);return"\\"===r[0]?r:" "+r},s}var i=r(3);t.name="SymbolNode",t.path="expression.node",t.math=!0,t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("abs",{number:Math.abs,Complex:function(e){return e.abs()},BigNumber:function(e){return e.abs()},Fraction:function(e){return e.abs()},"Array | Matrix":function(e){return i(e,a,!0)},Unit:function(e){return e.abs()}});return a.toTex={1:"\\left|${args[0]}\\right|"},a}var i=r(0);t.name="abs",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){var s=n(r(1)),u=n(r(12)),c=n(r(22)),f=n(r(14)),l=n(r(6)),p=n(r(5)),h=r(3),m=o("larger",{"boolean, boolean":function(e,t){return e>t},"number, number":function(e,r){return e>r&&!i(e,r,t.epsilon)},"BigNumber, BigNumber":function(e,r){return e.gt(r)&&!a(e,r,t.epsilon)},"Fraction, Fraction":function(e,t){return 1===e.compare(t)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return m(e.value,t.value)},"string, string":function(e,t){return e>t},"Matrix, Matrix":function(e,t){var r;switch(e.storage()){case"sparse":switch(t.storage()){case"sparse":r=c(e,t,m);break;default:r=u(t,e,m,!0)}break;default:switch(t.storage()){case"sparse":r=u(e,t,m,!1);break;default:r=l(e,t,m)}}return r},"Array, Array":function(e,t){return m(s(e),s(t)).valueOf()},"Array, Matrix":function(e,t){return m(s(e),t)},"Matrix, Array":function(e,t){return m(e,s(t))},"Matrix, any":function(e,t){var r;switch(e.storage()){case"sparse":r=f(e,t,m,!1);break;default:r=p(e,t,m,!1)}return r},"any, Matrix":function(e,t){var r;switch(t.storage()){case"sparse":r=f(t,e,m,!0);break;default:r=p(t,e,m,!0)}return r},"Array, any":function(e,t){return p(s(e),t,m,!1).valueOf()},"any, Array":function(e,t){return p(s(t),e,m,!0).valueOf()}});return m.toTex={2:"\\left(${args[0]}"+h.operators.larger+"${args[1]}\\right)"},m}var i=r(2).nearlyEqual,a=r(31);t.name="larger",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=e.DenseMatrix,o=function(e,t,r,o){var s=e._data,u=e._size,c=e._datatype,f=t._values,l=t._index,p=t._ptr,h=t._size,m=t._datatype;if(u.length!==h.length)throw new i(u.length,h.length);if(u[0]!==h[0]||u[1]!==h[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+h+")");if(!f)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var d,g,v=u[0],y=u[1],x="string"==typeof c&&c===m?c:void 0,w=x?n.find(r,[x,x]):r,b=[];for(d=0;d<v;d++)b[d]=[];var N=[],E=[];for(g=0;g<y;g++){for(var M=g+1,A=p[g],O=p[g+1],_=A;_<O;_++)d=l[_],N[d]=o?w(f[_],s[d][g]):w(s[d][g],f[_]),E[d]=M;for(d=0;d<v;d++)E[d]===M?b[d][g]=N[d]:b[d][g]=s[d][g]}return new a({data:b,size:[v,y],datatype:x})};return o}var i=r(9);t.name="algorithm01",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){function s(t,r){if(1!=arguments.length&&2!=arguments.length)throw new i("parse",arguments.length,1,2);if(he=r&&r.nodes?r.nodes:{},"string"==typeof t)return me=t,v();if(Array.isArray(t)||t instanceof e.Matrix)return a(t,function(e){if("string"!=typeof e)throw new TypeError("String expected");return me=e,v()});throw new TypeError("String or matrix expected")}function u(){ge=0,ve=me.charAt(0),we=0,be=null}function c(){ge++,ve=me.charAt(ge)}function f(){return me.charAt(ge-1)}function l(){return me.charAt(ge+1)}function p(){return me.charAt(ge+2)}function h(){for(xe=fe.NULL,ye="",de="";s.isWhitespace(ve,we);)c();if("#"==ve)for(;"\n"!=ve&&""!=ve;)de+=ve,c();if(""==ve)return void(xe=fe.DELIMITER);if("\n"==ve&&!we)return xe=fe.DELIMITER,ye=ve,void c();var e=ve+l(),t=e+p();if(3==t.length&&le[t])return xe=fe.DELIMITER,ye=t,c(),c(),void c();if(2==e.length&&le[e])return xe=fe.DELIMITER,ye=e,c(),void c();if(le[ve])return xe=fe.DELIMITER,ye=ve,void c();if(!s.isDigitDot(ve)){if(s.isAlpha(ve,f(),l())){for(;s.isAlpha(ve,f(),l())||s.isDigit(ve);)ye+=ve,c();return void(xe=pe.hasOwnProperty(ye)?fe.DELIMITER:fe.SYMBOL)}for(xe=fe.UNKNOWN;""!=ve;)ye+=ve,c();throw W('Syntax error in part "'+ye+'"')}if(xe=fe.NUMBER,"."==ve)ye+=ve,c(),s.isDigit(ve)||(xe=fe.DELIMITER);else{for(;s.isDigit(ve);)ye+=ve,c();s.isDecimalMark(ve,l())&&(ye+=ve,c())}for(;s.isDigit(ve);)ye+=ve,c();if(e=l(),"E"==ve||"e"==ve)if(s.isDigit(e)||"-"==e||"+"==e){if(ye+=ve,c(),"+"!=ve&&"-"!=ve||(ye+=ve,c()),!s.isDigit(ve))throw W('Digit expected, got "'+ve+'"');for(;s.isDigit(ve);)ye+=ve,c();if(s.isDecimalMark(ve,l()))throw W('Digit expected, got "'+ve+'"')}else if("."==e)throw c(),W('Digit expected, got "'+ve+'"')}function m(){do h();while("\n"==ye)}function d(){we++}function g(){we--}function v(){u(),h();var e=y();if(""!=ye)throw xe==fe.DELIMITER?Y("Unexpected operator "+ye):W('Unexpected part "'+ye+'"');return e}function y(){var e,t,r=[];for(""!=ye&&"\n"!=ye&&";"!=ye&&(e=x(),e.comment=de);"\n"==ye||";"==ye;)0==r.length&&e&&(t=";"!=ye,r.push({node:e,visible:t})),h(),"\n"!=ye&&";"!=ye&&""!=ye&&(e=x(),e.comment=de,t=";"!=ye,r.push({node:e,visible:t}));return r.length>0?new K(r):(e||(e=new te("undefined","undefined"),e.comment=de),e)}function x(){var e,t,r,n,i=w();if("="==ye){if(i&&i.isSymbolNode)return e=i.name,m(),r=x(),new Q(new ce(e),r);if(i&&i.isAccessorNode)return m(),r=x(),new Q(i.object,i.index,r);if(i&&i.isFunctionNode&&(n=!0,t=[],e=i.name,i.args.forEach(function(e,r){e&&e.isSymbolNode?t[r]=e.name:n=!1}),n))return m(),r=x(),new re(e,t,r);throw W("Invalid left hand side of assignment operator =")}return i}function w(){for(var e=b();"?"==ye;){var t=be;be=we,m();var r=e,n=x();if(":"!=ye)throw W("False part of conditional expression expected");be=null,m();var i=x();e=new ee(r,n,i),be=t}return e}function b(){for(var e=N();"or"==ye;)m(),e=new ae("or","or",[e,N()]);return e}function N(){for(var e=E();"xor"==ye;)m(),e=new ae("xor","xor",[e,E()]);return e}function E(){for(var e=M();"and"==ye;)m(),e=new ae("and","and",[e,M()]);return e}function M(){for(var e=A();"|"==ye;)m(),e=new ae("|","bitOr",[e,A()]);return e}function A(){for(var e=O();"^|"==ye;)m(),e=new ae("^|","bitXor",[e,O()]);return e}function O(){for(var e=_();"&"==ye;)m(),e=new ae("&","bitAnd",[e,_()]);return e}function _(){var e,t,r,n,i;for(e=T(),t={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};ye in t;)r=ye,n=t[r],m(),i=[e,T()],e=new ae(r,n,i);return e}function T(){var e,t,r,n,i;for(e=C(),t={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};ye in t;)r=ye,n=t[r],m(),i=[e,C()],e=new ae(r,n,i);return e}function C(){var e,t,r,n,i;for(e=S(),t={to:"to",in:"to"};ye in t;)r=ye,n=t[r],m(),"in"===r&&""===ye?e=new ae("*","multiply",[e,new ce("in")],!0):(i=[e,S()],e=new ae(r,n,i));return e}function S(){var e,t=[];if(e=":"==ye?new te("1","number"):z(),":"==ye&&be!==we){for(t.push(e);":"==ye&&t.length<3;)m(),")"==ye||"]"==ye||","==ye||""==ye?t.push(new ce("end")):t.push(z());e=3==t.length?new ue(t[0],t[2],t[1]):new ue(t[0],t[1])}return e}function z(){var e,t,r,n,i;for(e=k(),t={"+":"add","-":"subtract"};ye in t;)r=ye,n=t[r],m(),i=[e,k()],e=new ae(r,n,i);return e}function k(){var e,t,r,n,i;for(e=B(),t=e,r={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"};;)if(ye in r)n=ye,i=r[n],m(),t=B(),e=new ae(n,i,[e,t]);else{if(!(xe==fe.SYMBOL||"in"==ye&&e&&e.isConstantNode)&&(xe!=fe.NUMBER||t.isConstantNode||t.isOperatorNode&&"!"!==t.op)&&"("!=ye)break;t=B(),e=new ae("*","multiply",[e,t],!0)}return e}function B(){var e,t,r={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"}[ye];return r?(e=ye,m(),t=[B()],new ae(e,r,t)):I()}function I(){var e,t,r,n;return e=P(),"^"!=ye&&".^"!=ye||(t=ye,r="^"==t?"pow":"dotPow",m(),n=[e,B()],e=new ae(t,r,n)),e}function P(){var e,t,r,n,i;for(e=R(),t={"!":"factorial","'":"transpose"};ye in t;)r=ye,n=t[r],h(),i=[e],e=new ae(r,n,i),e=q(e);return e}function R(){var e,t=[];if(xe==fe.SYMBOL&&he[ye]){if(e=he[ye],h(),"("==ye){if(t=[],d(),h(),")"!=ye)for(t.push(x());","==ye;)h(),t.push(x());if(")"!=ye)throw W("Parenthesis ) expected");g(),h()}return new e(t)}return U()}function U(){var e,t;return xe==fe.SYMBOL||xe==fe.DELIMITER&&ye in pe?(t=ye,h(),e=new ce(t),e=q(e)):L()}function q(e,t){for(var r;!("("!=ye&&"["!=ye&&"."!=ye||t&&t.indexOf(ye)===-1);)if(r=[],"("==ye){if(!(e.isSymbolNode||e.isAccessorNode||e.isFunctionNode))return e;if(d(),h(),")"!=ye)for(r.push(x());","==ye;)h(),r.push(x());if(")"!=ye)throw W("Parenthesis ) expected");gLine truncated
|
||||
},"Array, Matrix":function(e,t){return h(s(e),t)},"Matrix, Array":function(e,t){return h(e,s(t))},"Matrix, any":function(e,t){var r;switch(e.storage()){case"sparse":r=f(e,t,h,!1);break;default:r=p(e,t,h,!1)}return r},"any, Matrix":function(e,t){var r;switch(t.storage()){case"sparse":r=f(t,e,h,!0);break;default:r=p(t,e,h,!0)}return r},"Array, any":function(e,t){return p(s(e),t,h,!1).valueOf()},"any, Array":function(e,t){return p(s(t),e,h,!0).valueOf()}});return h.toTex=void 0,h}var i=r(2).nearlyEqual,a=r(31);t.name="compare",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("isNegative",{number:function(e){return e<0},BigNumber:function(e){return e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return e.s<0},Unit:function(e){return a(e.value)},"Array | Matrix":function(e){return i(e,a)}});return a}var i=r(0);r(2);t.name="isNegative",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o,s){function u(e,t,r,n){if(!(this instanceof u))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof e)throw new TypeError('string expected for parameter "op"');if("string"!=typeof t)throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(r)||!r.every(function(e){return e&&e.isNode}))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=n===!0,this.op=e,this.fn=t,this.args=r||[]}function c(e,t,r,n){var i=a.getPrecedence(e,t),o=a.getAssociativity(e,t);if("all"===t||r.length>2&&"OperatorNode:add"!==e.getIdentifier()&&"OperatorNode:multiply"!==e.getIdentifier()){var s=r.map(function(e){switch(e.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});return s}if(0===r.length)return[];if(1===r.length){var u=a.getPrecedence(r[0],t);if(n&&null!==u){var c,f;if("keep"===t?(c=r[0].getIdentifier(),f=e.getIdentifier()):(c=r[0].getContent().getIdentifier(),f=e.getContent().getIdentifier()),a.properties[i][f].latexLeftParens===!1)return[!1];if(a.properties[u][c].latexParens===!1)return[!1]}return null===u?[!1]:u<=i?[!0]:[!1]}if(2===r.length){var l,p=a.getPrecedence(r[0],t),h=a.isAssociativeWith(e,r[0],t);l=null!==p&&(p===i&&"right"===o&&!h||p<i);var m,d=a.getPrecedence(r[1],t),g=a.isAssociativeWith(e,r[1],t);if(m=null!==d&&(d===i&&"left"===o&&!g||d<i),n){var f,v,y;"keep"===t?(f=e.getIdentifier(),v=e.args[0].getIdentifier(),y=e.args[1].getIdentifier()):(f=e.getContent().getIdentifier(),v=e.args[0].getContent().getIdentifier(),y=e.args[1].getContent().getIdentifier()),null!==p&&(a.properties[i][f].latexLeftParens===!1&&(l=!1),a.properties[p][v].latexParens===!1&&(l=!1)),null!==d&&(a.properties[i][f].latexRightParens===!1&&(m=!1),a.properties[d][y].latexParens===!1&&(m=!1))}return[l,m]}if(r.length>2&&("OperatorNode:add"===e.getIdentifier()||"OperatorNode:multiply"===e.getIdentifier())){var x=r.map(function(r){var n=a.getPrecedence(r,t),s=a.isAssociativeWith(e,r,t),u=a.getAssociativity(r,t);return null!==n&&(i===n&&o===u&&!s||n<i)});return x}}var f=n(r(11));n(r(43)),n(r(24)),n(r(44));return u.prototype=new f,u.prototype.type="OperatorNode",u.prototype.isOperatorNode=!0,u.prototype._compile=function(e,t){if(!e.math[this.fn])throw new Error("Function "+this.fn+' missing in provided namespace "math"');var r=this.args.map(function(r){return r._compile(e,t)});return"math."+this.fn+"("+r.join(", ")+")"},u.prototype.forEach=function(e){for(var t=0;t<this.args.length;t++)e(this.args[t],"args["+t+"]",this)},u.prototype.map=function(e){for(var t=[],r=0;r<this.args.length;r++)t[r]=this._ifNode(e(this.args[r],"args["+r+"]",this));return new u(this.op,this.fn,t)},u.prototype.clone=function(){return new u(this.op,this.fn,this.args.slice(0),this.implicit)},u.prototype._toString=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=e&&e.implicit?e.implicit:"hide",n=this.args,i=c(this,t,n,!1);if(1===n.length){var o=a.getAssociativity(this,t),s=n[0].toString(e);return i[0]&&(s="("+s+")"),"right"===o?this.op+s:"left"===o?s+this.op:s+this.op}if(2==n.length){var u=n[0].toString(e),f=n[1].toString(e);return i[0]&&(u="("+u+")"),i[1]&&(f="("+f+")"),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"==r?u+" "+f:u+" "+this.op+" "+f}if(n.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var l=n.map(function(t,r){return t=t.toString(e),i[r]&&(t="("+t+")"),t});return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===r?l.join(" "):l.join(" "+this.op+" ")}return this.fn+"("+this.args.join(", ")+")"},u.prototype._toTex=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=e&&e.implicit?e.implicit:"hide",n=this.args,o=c(this,t,n,!0),s=i.operators[this.fn];if(s="undefined"==typeof s?this.op:s,1===n.length){var u=a.getAssociativity(this,t),f=n[0].toTex(e);return o[0]&&(f="\\left("+f+"\\right)"),"right"===u?s+f:"left"===u?f+s:f+s}if(2===n.length){var l=n[0],p=l.toTex(e);o[0]&&(p="\\left("+p+"\\right)");var h=n[1],m=h.toTex(e);o[1]&&(m="\\left("+m+"\\right)");var d;switch(d="keep"===t?l.getIdentifier():l.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return s+"{"+p+"}{"+m+"}";case"OperatorNode:pow":switch(p="{"+p+"}",m="{"+m+"}",d){case"ConditionalNode":case"OperatorNode:divide":p="\\left("+p+"\\right)"}case"OperatorNode:multiply":if(this.implicit&&"hide"===r)return p+"~"+m}return p+s+m}if(n.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var g=n.map(function(t,r){return t=t.toTex(e),o[r]&&(t="\\left("+t+"\\right)"),t});return"OperatorNode:multiply"===this.getIdentifier()&&this.implicit?g.join("~"):g.join(s)}return"\\mathrm{"+this.fn+"}\\left("+n.map(function(t){return t.toTex(e)}).join(",")+"\\right)"},u.prototype.getIdentifier=function(){return this.type+":"+this.fn},u}var i=r(3),a=r(45);t.name="OperatorNode",t.path="expression.node",t.math=!0,t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){function a(e){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(!e||!e.isNode)throw new TypeError('Node expected for parameter "content"');this.content=e}var o=n(r(11));return a.prototype=new o,a.prototype.type="ParenthesisNode",a.prototype.isParenthesisNode=!0,a.prototype._compile=function(e,t){return this.content._compile(e,t)},a.prototype.getContent=function(){return this.content.getContent()},a.prototype.forEach=function(e){e(this.content,"content",this)},a.prototype.map=function(e){var t=e(this.content,"content",this);return new a(t)},a.prototype.clone=function(){return new a(this.content)},a.prototype._toString=function(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"("+this.content.toString(e)+")":this.content.toString(e)},a.prototype._toTex=function(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"\\left("+this.content.toTex(e)+"\\right)":this.content.toTex(e)},a}t.name="ParenthesisNode",t.path="expression.node",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){function a(r){return r>=0||t.predictable?Math.sqrt(r):new e.Complex(r,0).sqrt()}var o=n("sqrt",{number:a,Complex:function(e){return e.sqrt()},BigNumber:function(e){return!e.isNegative()||t.predictable?e.sqrt():a(e.toNumber())},"Array | Matrix":function(e){return i(e,o,!0)},Unit:function(e){return e.pow(.5)}});return o.toTex={1:"\\sqrt{${args[0]}}"},o}var i=r(0);t.name="sqrt",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,c){function f(e,t){if(!t||t.isIndex!==!0)throw new TypeError("Index expected");if(1!=t.size().length)throw new u(t.size().length,1);var r=e.length;s(t.min()[0],r),s(t.max()[0],r);var n=t.dimension(0),i="";return n.forEach(function(t){i+=e.charAt(t)}),i}function l(e,t,r,n){if(!t||t.isIndex!==!0)throw new TypeError("Index expected");if(1!=t.size().length)throw new u(t.size().length,1);if(void 0!==n){if("string"!=typeof n||1!==n.length)throw new TypeError("Single character expected as defaultValue")}else n=" ";var i=t.dimension(0),a=i.size()[0];if(a!=r.length)throw new u(i.size()[0],r.length);var o=e.length;s(t.min()[0]),s(t.max()[0]);for(var c=[],f=0;f<o;f++)c[f]=e.charAt(f);if(i.forEach(function(e,t){c[e]=r.charAt(t[0])}),c.length>o)for(f=o-1,a=c.length;f<a;f++)c[f]||(c[f]=n);return c.join("")}var p=n(r(1)),h=c("subset",{"Array, Index":function(e,t){var r=p(e),n=r.subset(t);return n&&n.valueOf()},"Matrix, Index":function(e,t){return e.subset(t)},"Object, Index":i,"string, Index":f,"Array, Index, any":function(e,t,r){return p(o(e)).subset(t,r,void 0).valueOf()},"Array, Index, any, any":function(e,t,r,n){return p(o(e)).subset(t,r,n).valueOf()},"Matrix, Index, any":function(e,t,r){return e.clone().subset(t,r)},"Matrix, Index, any, any":function(e,t,r,n){return e.clone().subset(t,r,n)},"string, Index, string":l,"string, Index, string, string":l,"Object, Index, any":a});return h.toTex=void 0,h}function i(e,t){if(1!==t.size().length)throw new u(t.size(),1);var r=t.dimension(0);if("string"!=typeof r)throw new TypeError("String expected as index to retrieve an object property");return e[r]}function a(e,t,r){if(1!==t.size().length)throw new u(t.size(),1);var n=t.dimension(0);if("string"!=typeof n)throw new TypeError("String expected as index to retrieve an object property");var i=o(e);return i[n]=r,i}var o=r(4).clone,s=r(7).validateIndex,u=r(9);t.name="subset",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){var s=r(3),u=n(r(1)),c=e.DenseMatrix,f=e.SparseMatrix,l=o("transpose",{Array:function(e){return l(u(e)).valueOf()},Matrix:function(e){var t,r=e.size();switch(r.length){case 1:t=e.clone();break;case 2:var n=r[0],i=r[1];if(0===i)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+a(r)+")");switch(e.storage()){case"dense":t=p(e,n,i);break;case"sparse":t=h(e,n,i)}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+a(this._size)+")")}return t},any:function(e){return iLine truncated
|
||||
string:function(e){var t=Number(e);if(isNaN(t))throw new SyntaxError('String "'+e+'" is no valid number');return t},BigNumber:function(e){return e.toNumber()},Fraction:function(e){return e.valueOf()},Unit:function(e){throw new Error("Second argument with valueless unit expected")},"Unit, string | Unit":function(e,t){return e.toNumber(t)},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},a}var i=r(0);t.name="number",t.factory=n},function(e,t){e.exports=function(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");var t=e.constructor,r=t.precision;t.config({precision:1e9});var e=e.plus(new t(1));return e.s=-e.s||null,t.config({precision:r}),e}},function(e,t,r){function n(e){for(var t=e.d,r=t[0]+"",n=1;n<t.length;++n){for(var i=t[n]+"",a=7-i.length;a--;)i="0"+i;r+=i}var o;for(o=r.length-1;"0"==r.charAt(o);--o);var s=e.e,u=r.slice(0,o+1||1),c=u.length;if(s>0)if(++s>c)for(s-=c;s--;u+="0");else s<c&&(u=u.slice(0,s)+"."+u.slice(s));for(var f=[0],n=0;n<u.length;){for(var l=f.length;l--;f[l]*=10);f[0]+=u.charAt(n++)<<0;for(var o=0;o<f.length;++o)f[o]>1&&(null==f[o+1]&&(f[o+1]=0),f[o+1]+=f[o]>>1,f[o]&=1)}return f.reverse()}var i=r(76);e.exports=function(e,t,r){var a,o,s=e.constructor,u=+(e.s<0),c=+(t.s<0);if(u){a=n(i(e));for(var f=0;f<a.length;++f)a[f]^=1}else a=n(e);if(c){o=n(i(t));for(var f=0;f<o.length;++f)o[f]^=1}else o=n(t);var l,p,h;a.length<=o.length?(l=a,p=o,h=u):(l=o,p=a,h=c);var m=l.length,d=p.length,g=1^r(u,c),v=new s(1^g),y=new s(1),x=new s(2),w=s.precision;for(s.config({precision:1e9});m>0;)r(l[--m],p[--d])==g&&(v=v.plus(y)),y=y.times(x);for(;d>0;)r(h,p[--d])==g&&(v=v.plus(y)),y=y.times(x);return s.config({precision:w}),0==g&&(v.s=-v.s),v}},function(e,t,r){"use strict";function n(e,t,n,a,o){function s(){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");this.scope={}}var u=n(r(28));return s.prototype.type="Parser",s.prototype.isParser=!0,s.prototype.parse=function(e){throw new Error("Parser.parse is deprecated. Use math.parse instead.")},s.prototype.compile=function(e){throw new Error("Parser.compile is deprecated. Use math.compile instead.")},s.prototype.eval=function(e){return u(e).compile().eval(this.scope)},s.prototype.get=function(e){return this.scope[e]},s.prototype.getAll=function(){return i({},this.scope)},s.prototype.set=function(e,t){return this.scope[e]=t},s.prototype.remove=function(e){delete this.scope[e]},s.prototype.clear=function(){for(var e in this.scope)this.scope.hasOwnProperty(e)&&delete this.scope[e]},s}var i=r(4).extend;t.name="Parser",t.path="expression",t.factory=n,t.math=!0},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t,r){function n(e,t,n,i){var a={};return a.bignumber=r(157),a.boolean=r(158),a.complex=r(159),a.createUnit=r(160),a.fraction=r(161),a.index=r(162),a.matrix=r(163),a.number=r(164),a.sparse=r(165),a.splitUnit=r(166),a.string=r(167),a.unit=r(168),a.e=r(79),a.E=r(79),a.false=r(150),a.i=r(151),a.Infinity=r(142),a.LN2=r(144),a.LN10=r(143),a.LOG2E=r(146),a.LOG10E=r(145),a.NaN=r(147),a.null=r(152),a.pi=r(80),a.PI=r(80),a.phi=r(153),a.SQRT1_2=r(148),a.SQRT2=r(149),a.tau=r(154),a.true=r(155),a.version=r(156),a.speedOfLight={description:"Speed of light in vacuum",examples:["speedOfLight"]},a.gravitationConstant={description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},a.planckConstant={description:"Planck constant",examples:["planckConstant"]},a.reducedPlanckConstant={description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},a.magneticConstant={description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},a.electricConstant={description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},a.vacuumImpedance={description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},a.coulomb={description:"Coulomb's constant",examples:["coulomb"]},a.elementaryCharge={description:"Elementary charge",examples:["elementaryCharge"]},a.bohrMagneton={description:"Borh magneton",examples:["bohrMagneton"]},a.conductanceQuantum={description:"Conductance quantum",examples:["conductanceQuantum"]},a.inverseConductanceQuantum={description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},a.magneticFluxQuantum={description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},a.nuclearMagneton={description:"Nuclear magneton",examples:["nuclearMagneton"]},a.klitzing={description:"Von Klitzing constant",examples:["klitzing"]},a.bohrRadius={description:"Borh radius",examples:["bohrRadius"]},a.classicalElectronRadius={description:"Classical electron radius",examples:["classicalElectronRadius"]},a.electronMass={description:"Electron mass",examples:["electronMass"]},a.fermiCoupling={description:"Fermi coupling constant",examples:["fermiCoupling"]},a.fineStructure={description:"Fine-structure constant",examples:["fineStructure"]},a.hartreeEnergy={description:"Hartree energy",examples:["hartreeEnergy"]},a.protonMass={description:"Proton mass",examples:["protonMass"]},a.deuteronMass={description:"Deuteron Mass",examples:["deuteronMass"]},a.neutronMass={description:"Neutron mass",examples:["neutronMass"]},a.quantumOfCirculation={description:"Quantum of circulation",examples:["quantumOfCirculation"]},a.rydberg={description:"Rydberg constant",examples:["rydberg"]},a.thomsonCrossSection={description:"Thomson cross section",examples:["thomsonCrossSection"]},a.weakMixingAngle={description:"Weak mixing angle",examples:["weakMixingAngle"]},a.efimovFactor={description:"Efimov factor",examples:["efimovFactor"]},a.atomicMass={description:"Atomic mass constant",examples:["atomicMass"]},a.avogadro={description:"Avogadro's number",examples:["avogadro"]},a.boltzmann={description:"Boltzmann constant",examples:["boltzmann"]},a.faraday={description:"Faraday constant",examples:["faraday"]},a.firstRadiation={description:"First radiation constant",examples:["firstRadiation"]},a.loschmidt={description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},a.gasConstant={description:"Gas constant",examples:["gasConstant"]},a.molarPlanckConstant={description:"Molar Planck constant",examples:["molarPlanckConstant"]},a.molarVolume={description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},a.sackurTetrode={description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},a.secondRadiation={description:"Second radiation constant",examples:["secondRadiation"]},a.stefanBoltzmann={description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},a.wienDisplacement={description:"Wien displacement law constant",examples:["wienDisplacement"]},a.molarMass={description:"Molar mass constant",examples:["molarMass"]},a.molarMassC12={description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},a.gravity={description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},a.planckLength={description:"Planck length",examples:["planckLength"]},a.planckMass={description:"Planck mass",examples:["planckMass"]},a.planckTime={description:"Planck time",examples:["planckTime"]},a.planckCharge={description:"Planck charge",examples:["planckCharge"]},a.planckTemperature={description:"Planck temperature",examples:["planckTemperature"]},a.derivative=r(172),a.lsolve=r(173),a.lup=r(174),a.lusolve=r(175),a.simplify=r(176),a.slu=r(177),a.usolve=r(178),a.abs=r(179),a.add=r(180),a.cbrt=r(181),a.ceil=r(182),a.cube=r(183),a.divide=r(184),a.dotDivide=r(185),a.dotMultiply=r(186),a.dotPow=r(187),a.exp=r(188),a.fix=r(189),a.floor=r(190),a.gcd=r(191),a.hypot=r(192),a.lcm=r(193),a.log=r(194),a.log10=r(195),a.mod=r(196),a.multiply=r(197),a.norm=r(198),a.nthRoot=r(199),a.pow=r(200),a.round=r(201),a.sign=r(202),a.sqrt=r(203),a.square=r(204),a.subtract=r(205),a.unaryMinus=r(206),a.unaryPlus=r(207),a.xgcd=r(208),a.bitAnd=r(209),a.bitNot=r(210),a.bitOr=r(211),a.bitXor=r(212),a.leftShift=r(213),a.rightArithShift=r(214),a.rightLogShift=r(215),a.bellNumbers=r(216),a.catalan=r(217),a.composition=r(218),a.stirlingS2=r(219),a.config=r(169),a.import=r(170),a.typed=r(171),a.arg=r(220),a.conj=r(221),a.re=r(223),a.im=r(222),a.eval=r(224),a.help=r(225),a.distance=r(226),a.intersect=r(227),a.and=r(228),a.not=r(229),a.or=r(230),a.xor=r(231),a.concat=r(232),a.cross=r(233),a.det=r(234),a.diag=r(235),a.dot=r(236),a.eye=r(237),a.filter=r(238),a.flatten=r(239),a.forEach=r(240),a.inv=r(241),a.kron=r(242),a.map=r(243),a.ones=r(244),a.partitionSelect=r(245),a.range=r(246),a.resize=r(247),a.size=r(248),a.sort=r(249),a.squeeze=r(250),a.subset=r(251),a.trace=r(252),a.transpose=r(253),a.zeros=r(254),a.combinations=r(255),a.factorial=r(256),a.gamma=r(257),a.kldivergence=r(258),a.multinomial=r(259),a.permutations=r(260),a.pickRandom=r(261),a.random=r(262),a.randomInt=r(263),a.compare=r(264),a.deepEqual=r(265),a.equal=r(266),a.larger=r(267),a.largerEq=r(268),a.smaller=r(269),a.smallerEq=r(270),a.unequal=r(271),a.erf=r(272),a.mad=r(273),a.max=r(274),a.mean=r(275),a.median=r(276),a.min=r(277),a.mode=r(278),a.prod=r(279),a.quantileSeq=r(280),a.std=r(281),a.sum=r(282),a.var=r(283),a.acos=r(284),a.acosh=r(285),a.acot=r(286),a.acoth=r(287),a.acsc=r(288),a.acsch=r(289),a.asec=r(290),a.asech=r(291),a.asin=r(292),a.asinh=r(293),a.atan=r(294),a.atanh=r(296),a.atan2=r(295),a.cos=r(297),a.cosh=r(298),a.cot=r(299),aLine truncated
|
||||
}function h(e,t){if(e instanceof d&&t instanceof d){if(e.value!==t.value)return!1}else if(e instanceof x&&t instanceof x){if(e.name!==t.name)return!1}else{if(!(e instanceof v&&t instanceof v||e instanceof g&&t instanceof g))return!1;if(e instanceof v){if(e.op!==t.op||e.fn!==t.fn)return!1}else if(e instanceof g&&e.name!==t.name)return!1;if(e.args.length!==t.args.length)return!1;for(var r=0;r<e.args.length;r++)if(!h(e.args[r],t.args[r]))return!1}return!0}var m=n(r(28)),d=n(r(43)),g=n(r(44)),v=n(r(48)),y=n(r(49)),x=n(r(24)),w=(n(r(11)),n(r(342))),b=n(r(94)),N=b.isCommutative,E=b.isAssociative,M=b.flatten,A=b.unflattenr,O=b.unflattenl,_=b.createMakeNodeFunction,T=i("simplify",{string:function(e){return T(m(e),T.rules)},"string, Array":function(e,t){return T(m(e),t)},Node:function(e){return T(e,T.rules)},"Node, Array":function(e,t){t=o(t);for(var r=a(e),n=r.toString({parenthesis:"all"}),i=null;i!=n;){C=0,i=n;for(var s=0;s<t.length;s++)"function"==typeof t[s]?r=t[s](r):(M(r),r=S(r,t[s])),O(r);n=r.toString({parenthesis:"all"})}return r}});T.rules=[{l:"n^0",r:"1"},{l:"0*n",r:"0"},{l:"n/n",r:"1"},{l:"n^1",r:"n"},{l:"+n1",r:"n1"},{l:"n--n1",r:"n+n1"},{l:"log(e)",r:"1"},{l:"n-n1",r:"n+-n1"},{l:"-(c*C)",r:"(-c) * C"},{l:"-C",r:"(-1) * C"},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{l:"n*n",r:"n^2"},{l:"n * n^n1",r:"n^(n1+1)"},{l:"n^n1 * n^n2",r:"n^(n1+n2)"},{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},{l:"n1*n2 + n2",r:"(n1+1)*n2"},{l:"n1*n3 + n2*n3",r:"(n1+n2)*n3"},w,{l:"(-n)*n1",r:"-(n*n1)"},{l:"c+C",r:"C+c",context:{add:{commutative:!1}}},{l:"C*c",r:"c*C",context:{multiply:{commutative:!1}}},{l:"(-1) * n",r:"-n"},{l:"n+-n1",r:"n-n1"},{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:"n-(n1+n2)",r:"n-n1-n2"},{l:"1*n",r:"n"}];var C=0,S=i("applyRule",{"Node, Object":function(e,t){var r=e;if(r instanceof v||r instanceof g){if(r.args)for(var n=0;n<r.args.length;n++)r.args[n]=S(r.args[n],t)}else r instanceof y&&r.content&&(r.content=S(r.content,t));var i=t.r,a=p(t.l,r)[0];return!a&&t.expanded&&(i=t.expanded.r,a=p(t.expanded.l,r)[0]),a&&(r=i.clone(),r=r.transform(function(e,t,r){if(e.isSymbolNode&&a.placeholders.hasOwnProperty(e.name)){var n=a.placeholders[e.name].clone();return n}return e})),r}});return T}t.name="simplify",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n,i){function a(e,t){if(!e.args||e.args.length<=1)return!0;var r=e.fn.toString();return t&&t.hasOwnProperty(r)&&t[r].hasOwnProperty("commutative")?t[r].commutative:d[r]||!1}function o(e,t){if(!e.args||e.args.length<=1)return!0;var r=e.fn.toString();return t&&t.hasOwnProperty(r)&&t[r].hasOwnProperty("associative")?t[r].associative:g[r]||!1}function s(e){if(!e.args||0===e.args.length)return e;e.args=u(e);for(var t=0;t<e.args.length;t++)s(e.args[t])}function u(e){var t,r=[],n=function(e){for(var i=0;i<e.args.length;i++){var a=e.args[i];a.isOperatorNode&&t===a.op?n(a):r.push(a)}};return e.isOperatorNode&&o(e)?(t=e.op,n(e),r):e.args}function c(e){if(e.args&&0!==e.args.length){for(var t=l(e),r=e.args.length,n=0;n<r;n++)c(e.args[n]);if(r>2&&o(e)){for(var i=e.args.pop();e.args.length>0;)i=t([e.args.pop(),i]);e.args=i.args}}}function f(e){if(e.args&&0!==e.args.length){for(var t=l(e),r=e.args.length,n=0;n<r;n++)f(e.args[n]);if(r>2&&o(e)){for(var i=e.args.shift();e.args.length>0;)i=t([i,e.args.shift()]);e.args=i.args}}}function l(e){return e.isOperatorNode?function(t){try{return new h(e.op,e.fn,t)}catch(e){return console.error(e),[]}}:function(t){return new p(new m(e.name),t)}}var p=i.expression.node.FunctionNode,h=i.expression.node.OperatorNode,m=i.expression.node.SymbolNode,d={add:!0,multiply:!0},g={add:!0,multiply:!0};return{createMakeNodeFunction:l,isCommutative:a,isAssociative:o,flatten:s,allChildren:u,unflattenr:c,unflattenl:f}}t.factory=n,t.math=!0},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(1)),o=n(r(16)),s=n(r(20)),u=n(r(18)),c=n(r(8)),f=n(r(64)),l=e.DenseMatrix,p=i("lsolve",{"SparseMatrix, Array | Matrix":function(e,t){return m(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return h(e,t)},"Array, Array | Matrix":function(e,t){var r=a(e),n=h(r,t);return n.valueOf()}}),h=function(e,t){t=f(e,t,!0);for(var r=t._data,n=e._size[0],i=e._size[1],a=[],p=e._data,h=0;h<i;h++){var m,d=r[h][0]||0;if(c(d,0))m=0;else{var g=p[h][h];if(c(g,0))throw new Error("Linear system cannot be solved since matrix is singular");m=o(d,g);for(var v=h+1;v<n;v++)r[v]=[u(r[v][0]||0,s(m,p[v][h]))]}a[h]=[m]}return new l({data:a,size:[n,1]})},m=function(e,t){t=f(e,t,!0);for(var r,n,i=t._data,a=e._size[0],p=e._size[1],h=e._values,m=e._index,d=e._ptr,g=[],v=0;v<p;v++){var y=i[v][0]||0;if(c(y,0))g[v]=[0];else{var x=0,w=[],b=[],N=d[v+1];for(n=d[v];n<N;n++)r=m[n],r===v?x=h[n]:r>v&&(w.push(h[n]),b.push(r));if(c(x,0))throw new Error("Linear system cannot be solved since matrix is singular");var E=o(y,x);for(n=0,N=b.length;n<N;n++)r=b[n],i[r]=[u(i[r][0]||0,s(E,w[n]))];g[v]=[E]}}return new l({data:g,size:[a,1]})};return p}t.name="lsolve",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(1)),o=n(r(16)),s=n(r(20)),u=n(r(18)),c=n(r(8)),f=n(r(64)),l=e.DenseMatrix,p=i("usolve",{"SparseMatrix, Array | Matrix":function(e,t){return m(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return h(e,t)},"Array, Array | Matrix":function(e,t){var r=a(e),n=h(r,t);return n.valueOf()}}),h=function(e,t){t=f(e,t,!0);for(var r=t._data,n=e._size[0],i=e._size[1],a=[],p=e._data,h=i-1;h>=0;h--){var m,d=r[h][0]||0;if(c(d,0))m=0;else{var g=p[h][h];if(c(g,0))throw new Error("Linear system cannot be solved since matrix is singular");m=o(d,g);for(var v=h-1;v>=0;v--)r[v]=[u(r[v][0]||0,s(m,p[v][h]))]}a[h]=[m]}return new l({data:a,size:[n,1]})},m=function(e,t){t=f(e,t,!0);for(var r,n,i=t._data,a=e._size[0],p=e._size[1],h=e._values,m=e._index,d=e._ptr,g=[],v=p-1;v>=0;v--){var y=i[v][0]||0;if(c(y,0))g[v]=[0];else{var x=0,w=[],b=[],N=d[v],E=d[v+1];for(n=E-1;n>=N;n--)r=m[n],r===v?x=h[n]:r<v&&(w.push(h[n]),b.push(r));if(c(x,0))throw new Error("Linear system cannot be solved since matrix is singular");var M=o(y,x);for(n=0,E=b.length;n<E;n++)r=b[n],i[r]=[u(i[r][0],s(M,w[n]))];g[v]=[M]}}return new l({data:g,size:[a,1]})};return p}t.name="usolve",t.factory=n},function(e,t,r){"use strict";function n(e,t,n){var i=n(r(65)),a=function(e,t){e[t]=i(e[t])};return a}t.name="cs_mark",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(){var e=function(e,t){return e[t]<0};return e}t.name="cs_marked",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(){var e=function(e,t,r,n,i,a,o){var s=0;for(r[o]=e;s>=0;){var u=r[o+s],c=r[n+u];c==-1?(s--,a[t++]=u):(r[n+u]=r[i+c],++s,r[o+s]=c)}return t};return e}t.name="cs_tdfs",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(1)),o=n(r(16)),s=r(3),u=n(r(21)),c=n(r(12)),f=n(r(22)),l=n(r(13)),p=n(r(14)),h=n(r(6)),m=n(r(5)),d=i("dotDivide",{"any, any":o,"Matrix, Matrix":function(e,t){var r;switch(e.storage()){case"sparse":switch(t.storage()){case"sparse":r=f(e,t,o,!1);break;default:r=u(t,e,o,!0)}break;default:switch(t.storage()){case"sparse":r=c(e,t,o,!1);break;default:r=h(e,t,o)}}return r},"Array, Array":function(e,t){return d(a(e),a(t)).valueOf()},"Array, Matrix":function(e,t){return d(a(e),t)},"Matrix, Array":function(e,t){return d(e,a(t))},"Matrix, any":function(e,t){var r;switch(e.storage()){case"sparse":r=l(e,t,o,!1);break;default:r=m(e,t,o,!1)}return r},"any, Matrix":function(e,t){var r;switch(t.storage()){case"sparse":r=p(t,e,o,!0);break;default:r=m(t,e,o,!0)}return r},"Array, any":function(e,t){return m(a(e),t,o,!1).valueOf()},"any, Array":function(e,t){return m(a(t),e,o,!0).valueOf()}});return d.toTex={2:"\\left(${args[0]}"+s.operators.dotDivide+"${args[1]}\\right)"},d}t.name="dotDivide",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("fix",{number:function(e){return e>0?Math.floor(e):Math.ceil(e)},Complex:function(t){return new e.Complex(t.re>0?Math.floor(t.re):Math.ceil(t.re),t.im>0?Math.floor(t.im):Math.ceil(t.im))},BigNumber:function(e){return e.isNegative()?e.ceil():e.floor()},Fraction:function(e){return e.s<0?e.ceil():e.floor()},"Array | Matrix":function(e){return i(e,a,!0)}});return a.toTex={1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},a}var i=r(0);t.name="fix",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){var o=n(r(16)),s=a("log",{number:function(r){return r>=0||t.predictable?Math.log(r):new e.Complex(r,0).log()},Complex:function(e){return e.log()},BigNumber:function(r){return!r.isNegative()||t.predictable?r.ln():new e.Complex(r.toNumber(),0).log()},"Array | Matrix":function(e){return i(e,s)},"any, any":function(e,t){return o(s(e),s(t))}});return s.toTex={1:"\\ln\\left(${args[0]}\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}\\right)"},s}var i=r(0);t.name="log",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(15)),o=n(r(18)),s=n(r(10)),u=n(r(34)),c=n(r(35)),f=n(r(54)),l=n(r(53)),p=n(r(47)),h=n(r(39)),m=n(r(26)),d=i("stirlingS2",{"number | BigNumber, number | BigNumber":function(e,t){if(!h(e)||p(e)||!h(t)||p(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");for(var r=f(t),n=0,i=0;i<=t;i++){var d=c(-1,o(t,i)),g=l(t,i),v=c(i,e);n=a(n,s(s(g,v),d))}return u(n,r)}});return d.toTex={2:"\\mathrm{S}\\left(${args}\\right)"},d}t.name="stirlingS2",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){var o=r(3),s=a("not",{number:function(e){return!e},Complex:function(e){return 0===e.re&&0===e.im},BigNumber:function(e){return e.isZero()||e.isNaN()},Unit:function(e){return s(e.value)},"Array | Matrix":function(e){return i(e,s)}});return s.toTex={1:o.operators.not+"\\left(${args[0]}\\right)"},s}var i=r(0);t.name="not",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,f){var l=n(r(1)),p=f("concat",{"...Array | Matrix | number | BigNumber":funcLine truncated
|
||||
return n}return e._size=t.slice(0),e._data=s.resize(e._data,e._size,r),e};return d.prototype.clone=function(){var e=new d({data:u.clone(this._data),size:u.clone(this._size),datatype:this._datatype});return e},d.prototype.size=function(){return this._size.slice(0)},d.prototype.map=function(e){var t=this,r=function(n,i){return f(n)?n.map(function(e,t){return r(e,i.concat(t))}):e(n,i,t)};return new d({data:r(this._data,[]),size:u.clone(this._size),datatype:this._datatype})},d.prototype.forEach=function(e){var t=this,r=function(n,i){f(n)?n.forEach(function(e,t){r(e,i.concat(t))}):e(n,i,t)};r(this._data,[])},d.prototype.toArray=function(){return u.clone(this._data)},d.prototype.valueOf=function(){return this._data},d.prototype.format=function(e){return o.format(this._data,e)},d.prototype.toString=function(){return o.format(this._data)},d.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},d.prototype.diagonal=function(e){if(e){if(e.isBigNumber===!0&&(e=e.toNumber()),!l(e)||!p(e))throw new TypeError("The parameter k must be an integer number")}else e=0;for(var t=e>0?e:0,r=e<0?-e:0,n=this._size[0],i=this._size[1],a=Math.min(n-r,i-t),o=[],s=0;s<a;s++)o[s]=this._data[s+r][s+t];return new d({data:o,size:[a],datatype:this._datatype})},d.diagonal=function(t,r,n,i,a){if(!f(t))throw new TypeError("Array expected, size parameter");if(2!==t.length)throw new Error("Only two dimensions matrix are supported");if(t=t.map(function(e){if(e&&e.isBigNumber===!0&&(e=e.toNumber()),!l(e)||!p(e)||e<1)throw new Error("Size values must be positive integers");return e}),n){if(n&&n.isBigNumber===!0&&(n=n.toNumber()),!l(n)||!p(n))throw new TypeError("The parameter k must be an integer number")}else n=0;i&&h(a)&&(i=c.convert(i,a));var o,u=n>0?n:0,m=n<0?-n:0,g=t[0],v=t[1],y=Math.min(g-m,v-u);if(f(r)){if(r.length!==y)throw new Error("Invalid value array length");o=function(e){return r[e]}}else if(r&&r.isMatrix===!0){var x=r.size();if(1!==x.length||x[0]!==y)throw new Error("Invalid matrix length");o=function(e){return r.get([e])}}else o=function(){return r};i||(i=o(0)&&o(0).isBigNumber===!0?new e.BigNumber(0):0);var w=[];if(t.length>0){w=s.resize(w,t,i);for(var b=0;b<y;b++)w[b+m][b+u]=o(b)}return new d({data:w,size:[g,v]})},d.fromJSON=function(e){return new d(e)},d.prototype.swapRows=function(e,t){if(!(l(e)&&p(e)&&l(t)&&p(t)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return m(e,this._size[0]),m(t,this._size[0]),d._swapRows(e,t,this._data),this},d._swapRows=function(e,t,r){var n=r[e];r[e]=r[t],r[t]=n},e.Matrix._storage.dense=d,e.Matrix._storage.default=d,d}var i=r(23),a=r(9),o=i.string,s=i.array,u=i.object,c=i.number,f=Array.isArray,l=c.isNumber,p=c.isInteger,h=o.isString,m=s.validateIndex;t.name="DenseMatrix",t.path="type",t.factory=n,t.lazy=!1},function(e,t,r){"use strict";function n(e,t,r,n){function a(e,t,r){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(null!=e)if(e.isBigNumber===!0)e=e.toNumber();else if("number"!=typeof e)throw new TypeError("Parameter start must be a number");if(null!=t)if(t.isBigNumber===!0)t=t.toNumber();else if("number"!=typeof t)throw new TypeError("Parameter end must be a number");if(null!=r)if(r.isBigNumber===!0)r=r.toNumber();else if("number"!=typeof r)throw new TypeError("Parameter step must be a number");this.start=null!=e?parseFloat(e):0,this.end=null!=t?parseFloat(t):0,this.step=null!=r?parseFloat(r):1}return a.prototype.type="Range",a.prototype.isRange=!0,a.parse=function(e){if("string"!=typeof e)return null;var t=e.split(":"),r=t.map(function(e){return parseFloat(e)}),n=r.some(function(e){return isNaN(e)});if(n)return null;switch(r.length){case 2:return new a(r[0],r[1]);case 3:return new a(r[0],r[2],r[1]);default:return null}},a.prototype.clone=function(){return new a(this.start,this.end,this.step)},a.prototype.size=function(){var e=0,t=this.start,r=this.step,n=this.end,a=n-t;return i.sign(r)==i.sign(a)?e=Math.ceil(a/r):0==a&&(e=0),isNaN(e)&&(e=0),[e]},a.prototype.min=function(){var e=this.size()[0];return e>0?this.step>0?this.start:this.start+(e-1)*this.step:void 0},a.prototype.max=function(){var e=this.size()[0];return e>0?this.step>0?this.start+(e-1)*this.step:this.start:void 0},a.prototype.forEach=function(e){var t=this.start,r=this.step,n=this.end,i=0;if(r>0)for(;t<n;)e(t,[i],this),t+=r,i++;else if(r<0)for(;t>n;)e(t,[i],this),t+=r,i++},a.prototype.map=function(e){var t=[];return this.forEach(function(r,n,i){t[n[0]]=e(r,n,i)}),t},a.prototype.toArray=function(){var e=[];return this.forEach(function(t,r){e[r[0]]=t}),e},a.prototype.valueOf=function(){return this.toArray()},a.prototype.format=function(e){var t=i.format(this.start,e);return 1!=this.step&&(t+=":"+i.format(this.step,e)),t+=":"+i.format(this.end,e)},a.prototype.toString=function(){return this.format()},a.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},a.fromJSON=function(e){return new a(e.start,e.end,e.step)},a}var i=r(2);t.name="Range",t.path="type",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){var o=n(r(8)),s=e.SparseMatrix,u=function(e,t,r){var n=e._values,u=e._index,c=e._ptr,f=e._size,l=e._datatype,p=t._values,h=t._index,m=t._ptr,d=t._size,g=t._datatype;if(f.length!==d.length)throw new i(f.length,d.length);if(f[0]!==d[0]||f[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+d+")");var v,y=f[0],x=f[1],w=o,b=0,N=r;"string"==typeof l&&l===g&&(v=l,w=a.find(o,[v,v]),b=a.convert(0,v),N=a.find(r,[v,v]));var E,M,A,O,_,T=n&&p?[]:void 0,C=[],S=[],z=new s({values:T,index:C,ptr:S,size:[y,x],datatype:v}),k=T?[]:void 0,B=[];for(M=0;M<x;M++){S[M]=C.length;var I=M+1;if(k)for(O=m[M],_=m[M+1],A=O;A<_;A++)E=h[A],B[E]=I,k[E]=p[A];for(O=c[M],_=c[M+1],A=O;A<_;A++)if(E=u[A],k){var P=B[E]===I?k[E]:b,R=N(n[A],P);w(R,b)||(C.push(E),T.push(R))}else C.push(E)}return S[x]=C.length,z};return u}var i=r(9);t.name="algorithm09",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){function i(e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this.entries=e||[]}return i.prototype.type="ResultSet",i.prototype.isResultSet=!0,i.prototype.valueOf=function(){return this.entries},i.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},i.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},i.fromJSON=function(e){return new i(e.entries)},i}t.name="ResultSet",t.path="type",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,s,u){function c(e,t){if(!(this instanceof c))throw new Error("Constructor must be called with the new operator");if(void 0!==e&&!C(e)&&!e.isComplex)throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(void 0!=t&&("string"!=typeof t||""==t))throw new TypeError("Second parameter in Unit constructor must be a string");if(void 0!=t){var r=c.parse(t);this.units=r.units,this.dimensions=r.dimensions}else{this.units=[{unit:$,prefix:q.NONE,power:0}],this.dimensions=[];for(var n=0;n<j.length;n++)this.dimensions[n]=0}this.value=void 0!=e?this._normalize(e):null,this.fixPrefix=!1,this.isUnitListSimplified=!0}function f(){for(;" "==R||"\t"==R;)h()}function l(e){return e>="0"&&e<="9"||"."==e}function p(e){return e>="0"&&e<="9"}function h(){P++,R=I.charAt(P)}function m(e){P=e,R=I.charAt(P)}function d(){var e,t="";if(e=P,"+"==R?h():"-"==R&&(t+=R,h()),!l(R))return m(e),null;if("."==R){if(t+=R,h(),!p(R))return m(e),null}else{for(;p(R);)t+=R,h();"."==R&&(t+=R,h())}for(;p(R);)t+=R,h();if("E"==R||"e"==R){var r="",n=P;if(r+=R,h(),"+"!=R&&"-"!=R||(r+=R,h()),!p(R))return m(n),t;for(t+=r;p(R);)t+=R,h()}return t}function g(){for(var e="",t=I.charCodeAt(P);t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122;)e+=R,h(),t=I.charCodeAt(P);return t=e.charCodeAt(0),t>=65&&t<=90||t>=97&&t<=122?e||null:null}function v(e){return R===e?(h(),e):null}function y(e){if(G.hasOwnProperty(e)){var t=G[e],r=t.prefixes[""];return{unit:t,prefix:r}}for(var n in G)if(G.hasOwnProperty(n)&&i(e,n)){var t=G[n],a=e.length-n.length,o=e.substring(0,a),r=t.prefixes[o];if(void 0!==r)return{unit:t,prefix:r}}return null}function x(t){if("BigNumber"===t.number){var r=o.pi(e.BigNumber);G.rad.value=new e.BigNumber(1),G.deg.value=r.div(180),G.grad.value=r.div(200),G.cycle.value=r.times(2),G.arcsec.value=r.div(648e3),G.arcmin.value=r.div(10800)}else G.rad.value=1,G.deg.value=Math.PI/180,G.grad.value=Math.PI/200,G.cycle.value=2*Math.PI,G.arcsec.value=Math.PI/648e3,G.arcmin.value=Math.PI/10800}function w(e){for(var t=0;t<e.length;t++){var r=e.charAt(t),n=function(e){return/^[a-zA-Z]$/.test(e)},i=function(e){return e>="0"&&e<="9"};if(0===t&&!n(r))throw new Error('Invalid unit name (must begin with alpha character): "'+e+'"');if(t>0&&!n(r)&&!i(r))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+e+'"')}}var b=n(r(17)),N=n(r(18)),E=n(r(20)),M=n(r(16)),A=n(r(35)),O=n(r(25)),_=n(r(101)),T=n(r(70)),C=n(r(71)),S=n(r(120)),z=n(r(123)),k=n(r(75)),B=n(r(124));c.prototype.type="Unit",c.prototype.isUnit=!0;var I,P,R;c.parse=function(r,n){if(n=n||{},I=r,P=-1,R="","string"!=typeof I)throw new TypeError("Invalid argument in Unit.parse, string expected");var i=new c;i.units=[],h(),f();var a=d(),o=null;a&&(o="BigNumber"===t.number?new e.BigNumber(a):"Fraction"===t.number?new e.Fraction(a):parseFloat(a)),f();for(var s=1,u=!1,l=[],p=1;;){for(f();"("===R;)l.push(s),p*=s,s=1,h(),f();if(!R)break;var m=R,x=g();if(null==x)throw new SyntaxError('Unexpected "'+m+'" in "'+I+'" at index '+P.toString());var w=y(x);if(null==w)throw new SyntaxError('Unit "'+x+'" not found.');var b=s*p;if(f(),v("^")){f();var N=d();if(null==N)throw new SyntaxError('In "'+r+'", "^" must be followed by a floating-point number');b*=N}i.units.push({unit:w.unit,prefix:w.prefix,powLine truncated
|
||||
offset:273.15},degF:{name:"degF",base:F.TEMPERATURE,prefixes:q.NONE,value:1/1.8,offset:459.67},degR:{name:"degR",base:F.TEMPERATURE,prefixes:q.NONE,value:1/1.8,offset:0},kelvin:{name:"kelvin",base:F.TEMPERATURE,prefixes:q.NONE,value:1,offset:0},celsius:{name:"celsius",base:F.TEMPERATURE,prefixes:q.NONE,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:F.TEMPERATURE,prefixes:q.NONE,value:1/1.8,offset:459.67},rankine:{name:"rankine",base:F.TEMPERATURE,prefixes:q.NONE,value:1/1.8,offset:0},mol:{name:"mol",base:F.AMOUNT_OF_SUBSTANCE,prefixes:q.SHORT,value:1,offset:0},mole:{name:"mole",base:F.AMOUNT_OF_SUBSTANCE,prefixes:q.LONG,value:1,offset:0},cd:{name:"cd",base:F.LUMINOUS_INTENSITY,prefixes:q.NONE,value:1,offset:0},candela:{name:"candela",base:F.LUMINOUS_INTENSITY,prefixes:q.NONE,value:1,offset:0},N:{name:"N",base:F.FORCE,prefixes:q.SHORT,value:1,offset:0},newton:{name:"newton",base:F.FORCE,prefixes:q.LONG,value:1,offset:0},dyn:{name:"dyn",base:F.FORCE,prefixes:q.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:F.FORCE,prefixes:q.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:F.FORCE,prefixes:q.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:F.FORCE,prefixes:q.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:F.FORCE,prefixes:q.LONG,value:4448.2216,offset:0},J:{name:"J",base:F.ENERGY,prefixes:q.SHORT,value:1,offset:0},joule:{name:"joule",base:F.ENERGY,prefixes:q.SHORT,value:1,offset:0},erg:{name:"erg",base:F.ENERGY,prefixes:q.NONE,value:1e-5,offset:0},Wh:{name:"Wh",base:F.ENERGY,prefixes:q.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:F.ENERGY,prefixes:q.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:F.ENERGY,prefixes:q.SHORT,value:1.602176565e-19,offset:0},electronvolt:{name:"electronvolt",base:F.ENERGY,prefixes:q.LONG,value:1.602176565e-19,offset:0},W:{name:"W",base:F.POWER,prefixes:q.SHORT,value:1,offset:0},watt:{name:"W",base:F.POWER,prefixes:q.LONG,value:1,offset:0},hp:{name:"hp",base:F.POWER,prefixes:q.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:F.POWER,prefixes:q.SHORT,value:B.I,offset:0},VA:{name:"VA",base:F.POWER,prefixes:q.SHORT,value:1,offset:0},Pa:{name:"Pa",base:F.PRESSURE,prefixes:q.SHORT,value:1,offset:0},psi:{name:"psi",base:F.PRESSURE,prefixes:q.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:F.PRESSURE,prefixes:q.NONE,value:101325,offset:0},bar:{name:"bar",base:F.PRESSURE,prefixes:q.NONE,value:1e5,offset:0},torr:{name:"torr",base:F.PRESSURE,prefixes:q.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:F.PRESSURE,prefixes:q.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:F.PRESSURE,prefixes:q.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:F.PRESSURE,prefixes:q.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:F.ELECTRIC_CHARGE,prefixes:q.LONG,value:1,offset:0},C:{name:"C",base:F.ELECTRIC_CHARGE,prefixes:q.SHORT,value:1,offset:0},farad:{name:"farad",base:F.ELECTRIC_CAPACITANCE,prefixes:q.LONG,value:1,offset:0},F:{name:"F",base:F.ELECTRIC_CAPACITANCE,prefixes:q.SHORT,value:1,offset:0},volt:{name:"volt",base:F.ELECTRIC_POTENTIAL,prefixes:q.LONG,value:1,offset:0},V:{name:"V",base:F.ELECTRIC_POTENTIAL,prefixes:q.SHORT,value:1,offset:0},ohm:{name:"ohm",base:F.ELECTRIC_RESISTANCE,prefixes:q.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:F.ELECTRIC_INDUCTANCE,prefixes:q.LONG,value:1,offset:0},H:{name:"H",base:F.ELECTRIC_INDUCTANCE,prefixes:q.SHORT,value:1,offset:0},siemens:{name:"siemens",base:F.ELECTRIC_CONDUCTANCE,prefixes:q.LONG,value:1,offset:0},S:{name:"S",base:F.ELECTRIC_CONDUCTANCE,prefixes:q.SHORT,value:1,offset:0},weber:{name:"weber",base:F.MAGNETIC_FLUX,prefixes:q.LONG,value:1,offset:0},Wb:{name:"Wb",base:F.MAGNETIC_FLUX,prefixes:q.SHORT,value:1,offset:0},tesla:{name:"tesla",base:F.MAGNETIC_FLUX_DENSITY,prefixes:q.LONG,value:1,offset:0},T:{name:"T",base:F.MAGNETIC_FLUX_DENSITY,prefixes:q.SHORT,value:1,offset:0},b:{name:"b",base:F.BIT,prefixes:q.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:F.BIT,prefixes:q.BINARY_LONG,value:1,offset:0},B:{name:"B",base:F.BIT,prefixes:q.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:F.BIT,prefixes:q.BINARY_LONG,value:8,offset:0}},H={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",hertz:"hertz",radians:"rad",degree:"deg",degrees:"deg",gradian:"grad",gradians:"grad",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole"};x(t),u.on("config",function(e,t){e.number!==t.number&&x(e)});var Z={si:{NONE:{unit:$,prefix:q.NONE[""]},LENGTH:{unit:G.m,prefix:q.SHORT[""]},MASS:{unit:G.g,prefix:q.SHORT.k},TIME:{unit:G.s,prefix:q.SHORT[""]},CURRENT:{unit:G.A,prefix:q.SHORT[""]},TEMPERATURE:{unit:G.K,prefix:q.SHORT[""]},LUMINOUS_INTENSITY:{unit:G.cd,prefix:q.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:G.mol,prefix:q.SHORT[""]},ANGLE:{unit:G.rad,prefix:q.SHORT[""]},BIT:{unit:G.bit,prefix:q.SHORT[""]},FORCE:{unit:G.N,prefix:q.SHORT[""]},ENERGY:{unit:G.J,prefix:q.SHORT[""]},POWER:{unit:G.W,prefix:q.SHORT[""]},PRESSURE:{unit:G.Pa,prefix:q.SHORT[""]},ELECTRIC_CHARGE:{unit:G.C,prefix:q.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:G.F,prefix:q.SHORT[""]},ELECTRIC_POTENTIAL:{unit:G.V,prefix:q.SHORT[""]},ELECTRIC_RESISTANCE:{unit:G.ohm,prefix:q.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:G.H,prefix:q.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:G.S,prefix:q.SHORT[""]},MAGNETIC_FLUX:{unit:G.Wb,prefix:q.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:G.T,prefix:q.SHORT[""]},FREQUENCY:{unit:G.Hz,prefix:q.SHORT[""]}}};Z.cgs=JSON.parse(JSON.stringify(Z.si)),Z.cgs.LENGTH={unit:G.m,prefix:q.SHORT.c},Z.cgs.MASS={unit:G.g,prefix:q.SHORT[""]},Z.cgs.FORCE={unit:G.dyn,prefix:q.SHORT[""]},Z.cgs.ENERGY={unit:G.erg,prefix:q.NONE[""]},Z.us=JSON.parse(JSON.stringify(Z.si)),Z.us.LENGTH={unit:G.ft,prefix:q.NONE[""]},Z.us.MASS={unit:G.lbm,prefix:q.NONE[""]},Z.us.TEMPERATURE={unit:G.degF,prefix:q.NONE[""]},Z.us.FORCE={unit:G.lbf,prefix:q.NONE[""]},Z.us.ENERGY={unit:G.BTU,prefix:q.BTU[""]},Z.us.POWER={unit:G.hp,prefix:q.NONE[""]},Z.us.PRESSURE={unit:G.psi,prefix:q.NONE[""]},Z.auto=JSON.parse(JSON.stringify(Z.si));var V=Z.auto;c.setUnitSystem=function(e){if(!Z.hasOwnProperty(e))throw new Error("Unit system "+e+" does not exist. Choices are: "+Object.keys(Z).join(", "));V=Z[e]},c.getUnitSystem=function(){for(var e in Z)if(Z[e]===V)return e},c.typeConverters={BigNumber:function(t){return new e.BigNumber(t+"")},Fraction:function(t){return new e.Fraction(t)},Complex:function(e){return e},number:function(e){return e}},c._getNumberConverter=function(e){if(!c.typeConverters[e])throw new TypeError('Unsupported type "'+e+'"');return c.typeConverters[e]};for(var L in G){var W=G[L];W.dimensions=W.base.dimensions}for(var Y in H)if(H.hasOwnProperty(Y)){var W=G[H[Y]],X={};for(var L in W)W.hasOwnProperty(L)&&(X[L]=W[L]);X.name=Y,G[Y]=X}return c.createUnit=function(e,t){if("object"!=typeof e)throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(t&&t.override)for(var r in e)if(e.hasOwnProperty(r)&&c.deleteUnit(r),e[r].aliases)for(var n=0;n<e[r].aliases.length;n++)c.deleteUnit(e[r].aliases[n]);var i;for(var r in e)e.hasOwnProperty(r)&&(i=c.createUnitSingle(r,e[r]));return i},c.createUnitSingle=function(e,t,r){if("undefined"!=typeof t&&null!==t||(t={}),"string"!=typeof e)throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(G.hasOwnProperty(e))throw new Error('Cannot create unit "'+e+'": a unit with that name already exists');w(e);var n,i,a=null,o=[],s=0;if(t&&"Unit"===t.type)a=t.clone();else if("string"==typeof t)""!==t&&(n=t);else{if("object"!=typeof t)throw new TypeError('Cannot create unit "'+e+'" from "'+t.toString()+'": expecting "string" or "Unit" or "Object"');n=t.definition,i=t.prefixes,s=t.offset,o=t.aliases}if(o)for(var u=0;u<o.length;u++)if(G.hasOwnProperty(o[u]))throw new Error('Cannot create alias "'+o[u]+'": a unit with that name already exists');if(n&&"string"==typeof n&&!a)try{a=c.parse(n,{allowNoUnits:!0})}catch(t){throw t.message='Could not create unit "'+e+'" from "'+n+'": '+t.message,t}else n&&"Unit"===n.type&&(a=n.clone());o=o||[],s=s||0,i=i&&i.toUpperCase?q[i.toUpperCase()]||q.NONE:q.NONE;var f={};if(a){f={name:e,value:a.value,dimensions:a.dimensions.slice(0),prefixes:i,offset:s};var l=!1;for(var u in F)if(F.hasOwnProperty(u)){for(var p=!0,h=0;h<j.length;h++)if(Math.abs((f.dimensions[h]||0)-(F[u].dimensions[h]||0))>1e-12){p=!1;break}if(p){l=!0;break}}if(!l){var m=e+"_STUFF",d={dimensions:a.dimensions.slice(0)};d.key=m,F[m]=d,V[m]={unit:f,prefix:q.NONE[""]},f.base=m}}else{var m=e+"_STUFF";if(j.indexOf(m)>=0)throw new Error('Cannot create new base unit "'+e+'": a base unit with that name already exists (and cannot be overridden)');j.push(m);for(var g in F)F.hasOwnProperty(g)&&(F[g].dimensions[j.length-1]=0);for(var d={dimensions:[]},u=0;u<j.length;u++)d.dimensions[u]=0;d.dimensions[j.length-1]=1,d.key=m,F[m]=d,f={name:e,value:1,dimensions:F[m].dimensions.slice(0),prefixes:i,offset:s,base:m},V[m]={unit:f,prefix:qLine truncated
|
||||
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"]}},function(e,t){e.exports={name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Solves 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:["lup","lusolve","lsolve","matrix","sparse"]}},function(e,t){e.exports={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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:["pow","log"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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","log10"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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","function isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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')"]}},function(e,t){e.exports={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:["sqrt","pow"]}},function(e,t){e.exports={name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3 = 8","2*2*2","1 + e ^ (pi * i)"],seealso:["multiply"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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","multiply"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]}},function(e,t){e.exports={name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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)"],sLine truncated
|
||||
examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","var","quantileSeq"]}},function(e,t){e.exports={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","var"]}},function(e,t){e.exports={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(5, 2, 7)","mode([3, -1, 5, 7])"],seealso:["max","mean","min","median","prod","std","sum","var"]}},function(e,t){e.exports={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","var"]}},function(e,t){e.exports={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","var"]}},function(e,t){e.exports={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(var(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","min","prod","sum","var"]}},function(e,t){e.exports={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","var"]}},function(e,t){e.exports={name:"var",category:"Statistics",syntax:["var(a, b, c, ...)","var(A)","var(A, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["var(2, 4, 6)","var([2, 4, 6, 8])",'var([2, 4, 6, 8], "uncorrected")','var([2, 4, 6, 8], "biased")',"var([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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(0.5)"],seealso:["acsch","asech"]}},function(e,t){e.exports={name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(0.5)","acsc(csc(0.5))","acsc(2)"],seealso:["csc","asin","asec"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]}},function(e,t){e.exports={name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(2.3))"],seealso:["sin","acos","atan"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(2.3))"],seealso:["tan","acos","asin"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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:[]}},function(e,t){e.exports={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:[]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={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"]}},function(e,t){e.exports={name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not aLine truncated
|
||||
var M=[],A=i(e),O=A._index,_=A._ptr;for(u=0;u<d;u++)for(s=r[u],M[s]=v[b+s]==-1?1:0;s!=-1&&v[b+s]==-1;s=t[s])v[b+s]=u;if(n){for(u=0;u<d;u++)v[r[u]]=u;for(o=0;o<m;o++){for(u=d,l=_[o],p=_[o+1],f=l;f<p;f++)u=Math.min(u,v[O[f]]);v[E+o]=v[N+u],v[N+u]=o}}for(o=0;o<d;o++)v[y+o]=o;for(u=0;u<d;u++){for(s=r[u],t[s]!=-1&&M[t[s]]--,c=n?v[N+u]:s;c!=-1;c=n?v[E+c]:-1)for(f=_[c];f<_[c+1];f++){o=O[f];var T=a(o,s,v,b,x,w,y);T.jleaf>=1&&M[s]++,2==T.jleaf&&M[T.q]--}t[s]!=-1&&(v[y+s]=t[s])}for(s=0;s<d;s++)t[s]!=-1&&(M[t[s]]+=M[s]);return M};return o}t.name="cs_counts",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(e,t,n){var i=n(r(98)),a=n(r(97)),o=n(r(357)),s=function(e,t,r,n,s){var u,c,f,l=t._index,p=t._ptr,h=t._size,m=h[1],d=0;for(n[0]=e;d>=0;){e=n[d];var g=s?s[e]:e;i(p,e)||(a(p,e),n[m+d]=g<0?0:o(p[g]));var v=1;for(c=n[m+d],f=g<0?0:o(p[g+1]);c<f;c++)if(u=l[c],!i(p,u)){n[m+d]=c,n[++d]=u,v=0;break}v&&(d--,n[--r]=e)}return r};return s}t.name="cs_dfs",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(){var e=function(e,t){if(!e)return null;var r,n,i=e._index,a=e._ptr,o=e._size,s=o[0],u=o[1],c=[],f=[],l=0,p=u;if(t)for(r=0;r<s;r++)f[p+r]=-1;for(var h=0;h<u;h++){c[h]=-1,f[l+h]=-1;for(var m=a[h],d=a[h+1],g=m;g<d;g++){var v=i[g];for(r=t?f[p+v]:v;r!=-1&&r<h;r=n)n=f[l+r],f[l+r]=h,n==-1&&(c[r]=h);t&&(f[p+v]=h)}}return c};return e}t.name="cs_etree",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(){var e=function(e,t,r){for(var n=e._values,i=e._index,a=e._ptr,o=e._size,s=o[1],u=0,c=0;c<s;c++){var f=a[c];for(a[c]=u;f<a[c+1];f++)t(i[f],c,n?n[f]:1,r)&&(i[u]=i[f],n&&(n[u]=n[f]),u++)}return a[s]=u,i.splice(u,i.length-u),n&&n.splice(u,n.length-u),u};return e}t.name="cs_fkeep",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(){var e=function(e,t,r){var n,r=t.length,i=[];if(e)for(n=0;n<r;n++)i[e[n]]=t[n];else for(n=0;n<r;n++)i[n]=t[n];return i};return e}t.name="cs_ipvec",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(){var e=function(e,t,r,n,i,a,o){var s,u,c,f,l=0;if(e<=t||r[n+t]<=r[i+e])return-1;if(r[i+e]=r[n+t],c=r[a+e],r[a+e]=t,c===-1)l=1,f=e;else{for(l=2,f=c;f!=r[o+f];f=r[o+f]);for(s=c;s!=f;s=u)u=r[o+s],r[o+s]=f}return{jleaf:l,q:f}};return e}t.name="cs_leaf",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(e,t,n){var i=n(r(25)),a=n(r(16)),o=n(r(10)),s=n(r(26)),u=n(r(113)),c=n(r(355)),f=e.SparseMatrix,l=function(e,t,r){if(!e)return null;var n,l=e._size,p=l[1],h=100,m=100;t&&(n=t.q,h=t.lnz||h,m=t.unz||m);var d,g,v=[],y=[],x=[],w=new f({values:v,index:y,ptr:x,size:[p,p]}),b=[],N=[],E=[],M=new f({values:b,index:N,ptr:E,size:[p,p]}),A=[],O=[],_=[];for(d=0;d<p;d++)O[d]=0,A[d]=-1,x[d+1]=0;h=0,m=0;for(var T=0;T<p;T++){x[T]=h,E[T]=m;var C=n?n[T]:T,S=c(w,e,C,_,O,A,1),z=-1,k=-1;for(g=S;g<p;g++)if(d=_[g],A[d]<0){var B=i(O[d]);s(B,k)&&(k=B,z=d)}else N[m]=A[d],b[m++]=O[d];if(z==-1||k<=0)return null;A[C]<0&&u(i(O[C]),o(k,r))&&(z=C);var I=O[z];for(N[m]=T,b[m++]=I,A[z]=T,y[h]=z,v[h++]=1,g=S;g<p;g++)d=_[g],A[d]<0&&(y[h]=d,v[h++]=a(O[d],I)),O[d]=0}for(x[p]=h,E[p]=m,g=0;g<h;g++)y[g]=A[y[g]];return v.splice(h,v.length-h),y.splice(h,y.length-h),b.splice(m,b.length-m),N.splice(m,N.length-m),{L:w,U:M,pinv:A}};return l}t.name="cs_lu",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(e){var t=e.SparseMatrix,r=function(e,r,n,i){for(var a=e._values,o=e._index,s=e._ptr,u=e._size,c=e._datatype,f=u[0],l=u[1],p=i&&e._values?[]:null,h=[],m=[],d=0,g=0;g<l;g++){m[g]=d;for(var v=n?n[g]:g,y=s[v],x=s[v+1],w=y;w<x;w++){var b=r?r[o[w]]:o[w];h[d]=b,p&&(p[d]=a[w]),d++}}return m[l]=d,new t({values:p,index:h,ptr:m,size:[f,l],datatype:c})};return r}t.name="cs_permute",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(e,t,n){var i=n(r(99)),a=function(e,t){if(!e)return null;var r,n=0,a=[],o=[],s=0,u=t,c=2*t;for(r=0;r<t;r++)o[s+r]=-1;for(r=t-1;r>=0;r--)e[r]!=-1&&(o[u+r]=o[s+e[r]],o[s+e[r]]=r);for(r=0;r<t;r++)e[r]==-1&&(n=i(r,n,o,s,u,a,c));return a};return a}t.name="cs_post",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(e,t,n){var i=n(r(346)),a=n(r(98)),o=n(r(97)),s=function(e,t,r,n,s){var u,c,f,l=e._ptr,p=e._size,h=t._index,m=t._ptr,d=p[1],g=d;for(c=m[r],f=m[r+1],u=c;u<f;u++){var v=h[u];a(l,v)||(g=i(v,e,g,n,s))}for(u=g;u<d;u++)o(l,n[u]);return g};return s}t.name="cs_reach",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(e,t,n){var i=n(r(16)),a=n(r(10)),o=n(r(18)),s=n(r(354)),u=function(e,t,r,n,u,c,f){var l,p,h,m,d=e._values,g=e._index,v=e._ptr,y=e._size,x=y[1],w=t._values,b=t._index,N=t._ptr,E=s(e,t,r,n,c);for(l=E;l<x;l++)u[n[l]]=0;for(p=N[r],h=N[r+1],l=p;l<h;l++)u[b[l]]=w[l];for(var M=E;M<x;M++){var A=n[M],O=c?c[A]:A;if(!(O<0))for(p=v[O],h=v[O+1],u[A]=i(u[A],d[f?p:h-1]),l=f?p+1:p,m=f?h:h-1;l<m;l++){var _=g[l];u[_]=o(u[_],a(d[l],u[A]))}}return E};return u}t.name="cs_spsolve",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(e,t,n){var i=n(r(344)),a=n(r(352)),o=n(r(347)),s=n(r(353)),u=n(r(345)),c=function(e,t,r){var n,c=t._ptr,l=t._size,p=l[1],h={};if(h.q=i(e,t),e&&!h.q)return null;if(r){var m=e?a(t,null,h.q,0):t;h.parent=o(m,1);var d=s(h.parent,p);if(h.cp=u(m,h.parent,d,1),m&&h.parent&&h.cp&&f(m,h))for(h.unz=0,n=0;n<p;n++)h.unz+=h.cp[n]}else h.unz=4*c[p]+p,h.lnz=h.unz;return h},f=function(e,t){var r=e._ptr,n=e._index,i=e._size,a=i[0],o=i[1];t.pinv=[],t.leftmost=[];var s,u,c,f,l,p=t.parent,h=t.pinv,m=t.leftmost,d=[],g=0,v=a,y=a+o,x=a+2*o;for(u=0;u<o;u++)d[v+u]=-1,d[y+u]=-1,d[x+u]=0;for(s=0;s<a;s++)m[s]=-1;for(u=o-1;u>=0;u--)for(f=r[u],l=r[u+1],c=f;c<l;c++)m[n[c]]=u;for(s=a-1;s>=0;s--)h[s]=-1,u=m[s],u!=-1&&(0===d[x+u]++&&(d[y+u]=s),d[g+s]=d[v+u],d[v+u]=s);for(t.lnz=0,t.m2=a,u=0;u<o;u++)if(s=d[v+u],t.lnz++,s<0&&(s=t.m2++),h[s]=u,!(--x[u]<=0)){t.lnz+=d[x+u];var w=p[u];w!=-1&&(0===d[x+w]&&(d[y+w]=d[y+u]),d[g+d[y+u]]=d[v+w],d[v+w]=d[g+s],d[x+w]+=d[x+u])}for(s=0;s<a;s++)h[s]<0&&(h[s]=u++);return!0};return c}t.name="cs_sqr",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(e,t,n){var i=n(r(65)),a=function(e){return e<0?i(e):e};return a}t.name="cs_unflip",t.path="sparse",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){function s(r,n){var i=r.arg()/3,o=r.abs(),s=new e.Complex(a(o),0).mul(new e.Complex(0,i).exp());if(n){var u=[s,new e.Complex(a(o),0).mul(new e.Complex(0,i+2*Math.PI/3).exp()),new e.Complex(a(o),0).mul(new e.Complex(0,i-2*Math.PI/3).exp())];return"Array"===t.matrix?u:l(u)}return s}function u(t){if(t.value&&t.value.isComplex){var r=t.clone();return r.value=1,r=r.pow(1/3),r.value=s(t.value),r}var n=f(t.value);n&&(t.value=c(t.value));var i;i=t.value&&t.value.isBigNumber?new e.BigNumber(1).div(3):t.value&&t.value.isFraction?new e.Fraction(1,3):1/3;var r=t.pow(i);return n&&(r.value=c(r.value)),r}var c=n(r(36)),f=n(r(47)),l=n(r(1)),p=o("cbrt",{number:a,Complex:s,"Complex, boolean":s,BigNumber:function(e){return e.cbrt()},Unit:u,"Array | Matrix":function(e){return i(e,p,!0)}});return p.toTex={1:"\\sqrt[3]{${args[0]}}"},p}var i=r(0),a=Math.cbrt||function(e){if(0===e)return e;var t,r=e<0;return r&&(e=-e),isFinite(e)?(t=Math.exp(Math.log(e)/3),t=(e/(t*t)+2*t)/3):t=e,r?-t:t};t.name="cbrt",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("ceil",{number:Math.ceil,Complex:function(e){return e.ceil()},BigNumber:function(e){return e.ceil()},Fraction:function(e){return e.ceil()},"Array | Matrix":function(e){return i(e,a,!0)}});return a.toTex={1:"\\left\\lceil${args[0]}\\right\\rceil"},a}var i=r(0);t.name="ceil",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("cube",{number:function(e){return e*e*e},Complex:function(e){return e.mul(e).mul(e)},BigNumber:function(e){return e.times(e).times(e)},Fraction:function(e){return e.pow(3)},"Array | Matrix":function(e){return i(e,a,!0)},Unit:function(e){return e.pow(3)}});return a.toTex={1:"\\left(${args[0]}\\right)^3"},a}var i=r(0);t.name="cube",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(1)),o=n(r(20)),s=r(3),u=n(r(21)),c=n(r(128)),f=n(r(13)),l=n(r(6)),p=n(r(5)),h=i("dotMultiply",{"any, any":o,"Matrix, Matrix":function(e,t){var r;switch(e.storage()){case"sparse":switch(t.storage()){case"sparse":r=c(e,t,o,!1);break;default:r=u(t,e,o,!0)}break;default:switch(t.storage()){case"sparse":r=u(e,t,o,!1);break;default:r=l(e,t,o)}}return r},"Array, Array":function(e,t){return h(a(e),a(t)).valueOf()},"Array, Matrix":function(e,t){return h(a(e),t)},"Matrix, Array":function(e,t){return h(e,a(t))},"Matrix, any":function(e,t){var r;switch(e.storage()){case"sparse":r=f(e,t,o,!1);break;default:r=p(e,t,o,!1)}return r},"any, Matrix":function(e,t){var r;switch(t.storage()){case"sparse":r=f(t,e,o,!0);break;default:r=p(t,e,o,!0)}return r},"Array, any":function(e,t){return p(a(e),t,o,!1).valueOf()},"any, Array":function(e,t){return p(a(t),e,o,!0).valueOf()}});return h.toTex={2:"\\left(${args[0]}"+s.operators.dotMultiply+"${args[1]}\\right)"},h}t.name="dotMultiply",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(1)),o=n(r(35)),s=r(3),u=n(r(12)),c=n(r(22)),f=n(r(13)),l=n(r(14)),p=n(r(6)),h=n(r(5)),m=i("dotPow",{"any, any":o,"Matrix, Matrix":function(e,t){var r;switch(e.storage()){case"sparse":switch(t.storage()){case"sparse":r=c(e,t,o,!1);break;default:r=u(t,e,o,!0)}break;default:switch(t.storage()){case"sparse":r=u(e,t,o,!1);break;default:r=p(e,t,o)}}return r},"Array, Array":function(e,t){return m(a(e),a(t)).valueOf()},"Array, Matrix":function(e,t){return m(a(e),t)},"Matrix, Array":function(e,t){return m(e,a(t))},"Matrix, any":function(e,t){var r;switch(e.storage()){case"sparse":r=f(e,t,m,!1);break;default:r=h(e,t,m,!1)}return r},"any, Matrix":function(e,t){var r;switch(t.storage()){case"sparse":r=l(t,e,m,!0);break;default:r=h(t,e,m,!0)}return r},"Array, any":function(e,t){return h(a(e),t,m,!1).valueOf()},"any, Array":function(e,t){return h(a(t),e,m,!0).valueOf()}});return m.toTex={2:"\\left(${args[0]}"+s.operators.dotPow+"${args[1]}\\right)"Line truncated
|
||||
},"Array, Matrix":function(e,t){return v(s(e),t)},"Matrix, Array":function(e,t){return v(e,s(t))},"Matrix, number | BigNumber":function(e,t){if(!u(t,0)){var r;switch(e.storage()){case"sparse":r=m(e,t,v,!1);break;default:r=g(e,t,v,!1)}return r}return e.clone()},"number | BigNumber, Matrix":function(e,t){if(!u(e,0)){var r;switch(t.storage()){case"sparse":r=h(t,e,v,!0);break;default:r=g(t,e,v,!0)}return r}return c(t.size(),t.storage())},"Array, number | BigNumber":function(e,t){return v(s(e),t).valueOf()},"number | BigNumber, Array":function(e,t){return v(e,s(t)).valueOf()}});return v.toTex={2:"\\left(${args[0]}"+o.operators.rightLogShift+"${args[1]}\\right)"},v}var i=r(2).isInteger;t.name="rightLogShift",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(15)),o=n(r(103)),s=n(r(47)),u=n(r(39)),c=i("bellNumbers",{"number | BigNumber":function(e){if(!u(e)||s(e))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var t=0,r=0;r<=e;r++)t=a(t,o(e,r));return t}});return c.toTex={1:"\\mathrm{B}_{${args[0]}}"},c}t.name="bellNumbers",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(15)),o=n(r(34)),s=n(r(10)),u=n(r(53)),c=n(r(47)),f=n(r(39)),l=i("catalan",{"number | BigNumber":function(e){if(!f(e)||c(e))throw new TypeError("Non-negative integer value expected in function catalan");return o(u(s(e,2),e),a(e,1))}});return l.toTex={1:"\\mathrm{C}_{${args[0]}}"},l}t.name="catalan",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(53)),o=n(r(17)),s=n(r(55)),u=n(r(39)),c=n(r(26)),f=i("composition",{"number | BigNumber, number | BigNumber":function(e,t){if(!(u(e)&&s(e)&&u(t)&&s(t)))throw new TypeError("Positive integer value expected in function composition");if(c(t,e))throw new TypeError("k must be less than or equal to n in function composition");return a(o(e,-1),o(t,-1))}});return f.toTex=void 0,f}t.name="composition",t.factory=n},function(e,t,r){e.exports=[r(386),r(388),r(103),r(387)]},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("arg",{number:function(e){return Math.atan2(0,e)},BigNumber:function(t){return e.BigNumber.atan2(0,t)},Complex:function(e){return e.arg()},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\arg\\left(${args[0]}\\right)"},a}var i=r(0);t.name="arg",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("conj",{number:function(e){return e},BigNumber:function(e){return e},Complex:function(e){return e.conjugate()},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\left(${args[0]}\\right)^*"},a}var i=r(0);t.name="conj",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("im",{number:function(e){return 0},BigNumber:function(t){return new e.BigNumber(0)},Complex:function(e){return e.im},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\Im\\left\\lbrace${args[0]}\\right\\rbrace"},a}var i=r(0);t.name="im",t.factory=n},function(e,t,r){e.exports=[r(390),r(391),r(392),r(394)]},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("re",{number:function(e){return e},BigNumber:function(e){return e},Complex:function(e){return e.re},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\Re\\left\\lbrace${args[0]}\\right\\rbrace"},a}var i=r(0);t.name="re",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,s){var m=(n(r(1)),s("distance",{"Array, Array, Array":function(e,t,r){if(2==e.length&&2==t.length&&2==r.length){if(!i(e))throw new TypeError("Array with 2 numbers expected for first argument");if(!i(t))throw new TypeError("Array with 2 numbers expected for second argument");if(!i(r))throw new TypeError("Array with 2 numbers expected for third argument");var n=(r[1]-r[0])/(t[1]-t[0]),a=n*n*t[0],o=-1*(n*t[0]),s=e[1];return c(e[0],e[1],a,o,s)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(e,t,r){if(2==Object.keys(e).length&&2==Object.keys(t).length&&2==Object.keys(r).length){if(!i(e))throw new TypeError("Values of pointX and pointY should be numbers");if(!i(t))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers");if(!i(r))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers");if(e.hasOwnProperty("pointX")&&e.hasOwnProperty("pointY")&&t.hasOwnProperty("lineOnePtX")&&t.hasOwnProperty("lineOnePtY")&&r.hasOwnProperty("lineTwoPtX")&&r.hasOwnProperty("lineTwoPtY")){var n=(r.lineTwoPtY-r.lineTwoPtX)/(t.lineOnePtY-t.lineOnePtX),a=n*n*t.lineOnePtX,o=-1*(n*t.lineOnePtX),s=e.pointX;return c(e.pointX,e.pointY,a,o,s)}throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(e,t){if(2==e.length&&3==t.length){if(!i(e))throw new TypeError("Array with 2 numbers expected for first argument");if(!a(t))throw new TypeError("Array with 3 numbers expected for second argument");return c(e[0],e[1],t[0],t[1],t[2])}if(3==e.length&&6==t.length){if(!a(e))throw new TypeError("Array with 3 numbers expected for first argument");if(!o(t))throw new TypeError("Array with 6 numbers expected for second argument");return f(e[0],e[1],e[2],t[0],t[1],t[2],t[3],t[4],t[5])}if(2==e.length&&2==t.length){if(!i(e))throw new TypeError("Array with 2 numbers expected for first argument");if(!i(t))throw new TypeError("Array with 2 numbers expected for second argument");return l(e[0],e[1],t[0],t[1])}if(3==e.length&&3==t.length){if(!a(e))throw new TypeError("Array with 3 numbers expected for first argument");if(!a(t))throw new TypeError("Array with 3 numbers expected for second argument");return p(e[0],e[1],e[2],t[0],t[1],t[2])}throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(e,t){if(2==Object.keys(e).length&&3==Object.keys(t).length){if(!i(e))throw new TypeError("Values of pointX and pointY should be numbers");if(!a(t))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers");if(e.hasOwnProperty("pointX")&&e.hasOwnProperty("pointY")&&t.hasOwnProperty("xCoeffLine")&&t.hasOwnProperty("yCoeffLine")&&t.hasOwnProperty("yCoeffLine"))return c(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(!a(e))throw new TypeError("Values of pointX, pointY and pointZ should be numbers");if(!o(t))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers");if(e.hasOwnProperty("pointX")&&e.hasOwnProperty("pointY")&&t.hasOwnProperty("x0")&&t.hasOwnProperty("y0")&&t.hasOwnProperty("z0")&&t.hasOwnProperty("a")&&t.hasOwnProperty("b")&&t.hasOwnProperty("c"))return f(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(!i(e))throw new TypeError("Values of pointOneX and pointOneY should be numbers");if(!i(t))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers");if(e.hasOwnProperty("pointOneX")&&e.hasOwnProperty("pointOneY")&&t.hasOwnProperty("pointTwoX")&&t.hasOwnProperty("pointTwoY"))return l(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(!a(e))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers");if(!a(t))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers");if(e.hasOwnProperty("pointOneX")&&e.hasOwnProperty("pointOneY")&&e.hasOwnProperty("pointOneZ")&&t.hasOwnProperty("pointTwoX")&&t.hasOwnProperty("pointTwoY")&&t.hasOwnProperty("pointTwoZ"))return p(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(!u(e))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return h(e)}}));return m}function i(e){return e.constructor!==Array&&(e=s(e)),"number"==typeof e[0]&&"number"==typeof e[1]}function a(e){return e.constructor!==Array&&(e=s(e)),"number"==typeof e[0]&&"number"==typeof e[1]&&"number"==typeof e[2]}function o(e){return e.constructor!==Array&&(e=s(e)),"number"==typeof e[0]&&"number"==typeof e[1]&&"number"==typeof e[2]&&"number"==typeof e[3]&&"number"==typeof e[4]&&"number"==typeof e[5]}function s(e){for(var t=Object.keys(e),r=[],n=0;n<t.length;n++)r.push(e[t[n]]);return r}function u(e){if(2==e[0].length&&"number"==typeof e[0][0]&&"number"==typeof e[0][1]){for(var t in e)if(2!=e[t].length||"number"!=typeof e[t][0]||"number"!=typeof e[t][1])return!1}else{if(3!=e[0].length||"number"!=typeof e[0][0]||"number"!=typeof e[0][1]||"number"!=typeof e[0][2])return!1;for(var t in e)if(3!=e[t].length||"number"!=typeof e[t][0]||"number"!=typeof e[t][1]||"number"!=typeof e[t][2])return!1}return!0}function c(e,t,r,n,i){var a=Math.abs(r*e+n*t+i),o=Math.pow(r*r+n*n,.5),s=a/o;return s}function f(e,t,r,n,i,a,o,s,u){var c=[(i-t)*u-(a-r)*s,(a-r)*o-(n-e)*u,(n-e)*s-(i-t)*o];c=Math.pow(c[0]*c[0]+c[1]*c[1]+c[2]*c[2],.5);var f=Math.pow(o*o+s*s+u*u,.5),l=c/f;return l}function l(e,t,r,n){var i=n-t,a=r-e,o=i*i+a*a,s=Math.pow(o,.5);return s}function p(e,t,r,n,i,a){var o=a-r,s=i-t,u=n-e,c=o*o+s*s+u*u,f=Math.pow(c,.5);return f}function h(e){for(var t=[],r=0;r<e.length-1;r++)for(var n=r+1;n<e.length;n++)2==e[0].length?t.push(l(e[r][0],e[r][1],e[n][0],e[n][1])):3==e[0].length&&t.push(p(e[r][0],e[r][1],e[r][2],e[n][0],e[n][1],e[n][2]));return t}t.name="distance",t.factory=n},function(e,t,r){e.exports=[r(397),r(395)]},function(e,t,r){"use strict";function n(e,t,n,i){function a(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function o(e){return 3===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]&&"number"==typeof e[2]}function s(e){return 4===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]&&"number"==typeof e[2]&&"number"==typeof e[3]}function u(e,r,n,i){var a=e,o=n,s=d(a,r),u=d(o,i),c=s[0]*u[1]-u[Line truncated
|
||||
t.name="erf",t.factory=n},function(e,t,r){e.exports=[r(425)]},function(e,t,r){e.exports=[r(428),r(114),r(115),r(116),r(117),r(429),r(430),r(431),r(432),r(118),r(119)]},function(e,t,r){"use strict";function n(e,t,n,a){function o(e){if(e=i(e.valueOf()),0===e.length)throw new Error("Cannot calculate median absolute deviation of an empty array");var t=c(e);return c(u(e,function(e){return s(f(e,t))}))}var s=n(r(25)),u=n(r(67)),c=n(r(116)),f=n(r(18)),l=a("mad",{"Array | Matrix":o,"...":function(e){return o(e)}});return l.toTex=void 0,l}var i=r(7).flatten;t.name="mad",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){function a(e){e=i(e.valueOf());var t=e.length;if(0==t)throw new Error("Cannot calculate mode of an empty array");var r={},n=[],a=0;for(var o in e)e[o]in r||(r[e[o]]=0),r[e[o]]++,r[e[o]]==a?n.push(e[o]):r[e[o]]>a&&(a=r[e[o]],n=[e[o]]);return n}var o=n("mode",{"Array | Matrix":a,"...":function(e){return a(e)}});return o}var i=r(7).flatten;t.name="mode",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){function o(e){var t=void 0;if(i(e,function(e){t=void 0===t?e:s(t,e)}),void 0===t)throw new Error("Cannot calculate prod of an empty array");return t}var s=n(r(20)),u=a("prod",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("prod(A, dim) is not yet supported")},"...":function(e){return o(e)}});return u.toTex=void 0,u}var i=r(32);t.name="prod",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,u){function c(t,r,n){var o,u,c;if(arguments.length<2||arguments.length>3)throw new SyntaxError("Function quantileSeq requires two or three parameters");if(s(t)){if(n=n||!1,"boolean"==typeof n){if(u=t.valueOf(),a(r)){if(r<0)throw new Error("N/prob must be non-negative");if(r<=1)return f(u,r,n);if(r>1){if(!i(r))throw new Error("N must be a positive integer");var l=r+1;o=new Array(r);for(var p=0;p<r;)o[p]=f(u,++p/l,n);return o}}if(r&&r.isBigNumber){if(r.isNegative())throw new Error("N/prob must be non-negative");if(c=new r.constructor(1),r.lte(c))return f(u,r,n);if(r.gt(c)){if(!r.isInteger())throw new Error("N must be a positive integer");var h=r.toNumber();if(h>4294967295)throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var l=new e.BigNumber(h+1);o=new Array(h);for(var p=0;p<h;)o[p]=f(u,new e.BigNumber(++p).div(l),n);return o}}if(Array.isArray(r)){o=new Array(r.length);for(var p=0;p<o.length;++p){var m=r[p];if(a(m)){if(m<0||m>1)throw new Error("Probability must be between 0 and 1, inclusive")}else{if(!m||!m.isBigNumber)throw new TypeError("Unexpected type of argument in function quantileSeq");if(c=new m.constructor(1),m.isNegative()||m.gt(c))throw new Error("Probability must be between 0 and 1, inclusive")}o[p]=f(u,m,n)}return o}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")}function f(e,t,r){var n=o(e),i=n.length;if(0===i)throw new Error("Cannot calculate quantile of an empty sequence");if(a(t)){var s=t*(i-1),u=s%1;if(0===u){var c=r?n[s]:h(n,s);return d(c),c}var f,g,v=Math.floor(s);if(r)f=n[v],g=n[v+1];else{g=h(n,v+1),f=n[v];for(var y=0;y<v;++y)m(n[y],f)>0&&(f=n[y])}return d(f),d(g),l(p(f,1-u),p(g,u))}var s=t.times(i-1);if(s.isInteger()){s=s.toNumber();var c=r?n[s]:h(n,s);return d(c),c}var f,g,v=s.floor(),u=s.minus(v),x=v.toNumber();if(r)f=n[x],g=n[x+1];else{g=h(n,x+1),f=n[x];for(var y=0;y<x;++y)m(n[y],f)>0&&(f=n[y])}d(f),d(g);var w=new u.constructor(1);return l(p(f,w.minus(u)),p(g,u))}var l=n(r(15)),p=n(r(10)),h=n(r(68)),m=n(r(46)),d=u({"number | BigNumber | Unit":function(e){return e}});return c}var i=r(2).isInteger,a=r(2).isNumber,o=r(7).flatten,s=r(40);t.name="quantileSeq",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){function a(e,t){if(0==e.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");return o(s.apply(null,arguments))}var o=n(r(50)),s=n(r(119)),u=i("std",{"Array | Matrix":a,"Array | Matrix, string":a,"...":function(e){return a(e)}});return u.toTex=void 0,u}t.name="std",t.factory=n},function(e,t,r){e.exports=[r(120),r(434)]},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("print",{"string, Object":i,"string, Object, number | Object":i});return a.toTex=void 0,a}function i(e,t,r){return e.replace(/\$([\w\.]+)/g,function(e,n){for(var i=n.split("."),s=t[i.shift()];i.length&&void 0!==s;){var u=i.shift();s=u?s[u]:s+"."}return void 0!==s?a(s)?s:o(s,r):e})}var a=r(19).isString,o=r(19).format;t.name="print",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("acos",{number:function(r){return r>=-1&&r<=1||t.predictable?Math.acos(r):new e.Complex(r,0).acos()},Complex:function(e){return e.acos()},BigNumber:function(e){return e.acos()},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\cos^{-1}\\left(${args[0]}\\right)"},a}var i=r(0);t.name="acos",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("acot",{number:function(e){return Math.atan(1/e)},Complex:function(e){return e.acot()},BigNumber:function(t){return new e.BigNumber(1).div(t).atan()},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\cot^{-1}\\left(${args[0]}\\right)"},a}var i=r(0);t.name="acot",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("acoth",{number:function(r){return r>=1||r<=-1||t.predictable?isFinite(r)?(Math.log((r+1)/r)+Math.log(r/(r-1)))/2:0:new e.Complex(r,0).acoth()},Complex:function(e){return e.acoth()},BigNumber:function(t){return new e.BigNumber(1).div(t).atanh()},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\coth^{-1}\\left(${args[0]}\\right)"},a}var i=r(0);t.name="acoth",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("acsc",{number:function(r){return r<=-1||r>=1||t.predictable?Math.asin(1/r):new e.Complex(r,0).acsc()},Complex:function(e){return e.acsc()},BigNumber:function(t){return new e.BigNumber(1).div(t).asin()},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\csc^{-1}\\left(${args[0]}\\right)"},a}var i=r(0);t.name="acsc",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("acsch",{number:function(e){return e=1/e,Math.log(e+Math.sqrt(e*e+1))},Complex:function(e){return e.acsch()},BigNumber:function(t){return new e.BigNumber(1).div(t).asinh()},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\mathrm{csch}^{-1}\\left(${args[0]}\\right)"},a}var i=r(0);t.name="acsch",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("asec",{number:function(r){return r<=-1||r>=1||t.predictable?Math.acos(1/r):new e.Complex(r,0).asec()},Complex:function(e){return e.asec()},BigNumber:function(t){return new e.BigNumber(1).div(t).acos()},"Array | Matrix":function(e){return i(e,a)}});return a.toTex={1:"\\sec^{-1}\\left(${args[0]}\\right)"},a}var i=r(0);t.name="asec",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){var o=(a.find(n(r(121)),["Complex"]),a("asech",{number:function(r){if(r<=1&&r>=-1||t.predictable){r=1/r;var n=Math.sqrt(r*r-1);return r>0||t.predictable?Math.log(n+r):new e.Complex(Math.log(n-r),Math.PI)}return new e.Complex(r,0).asech()},Complex:function(e){return e.asech()},BigNumber:function(t){return new e.BigNumber(1).div(t).acosh()},"Array | Matrix":function(e){return i(e,o)}}));return o.toTex={1:"\\mathrm{sech}^{-1}\\left(${args[0]}\\right)"},o}var i=r(0);t.name="asech",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("asin",{number:function(r){return r>=-1&&r<=1||t.predictable?Math.asin(r):new e.Complex(r,0).asin()},Complex:function(e){return e.asin()},BigNumber:function(e){return e.asin()},"Array | Matrix":function(e){return i(e,a,!0)}});return a.toTex={1:"\\sin^{-1}\\left(${args[0]}\\right)"},a}var i=r(0);t.name="asin",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("asinh",{number:Math.asinh||function(e){return Math.log(Math.sqrt(e*e+1)+e)},Complex:function(e){return e.asinh()},BigNumber:function(e){return e.asinh()},"Array | Matrix":function(e){return i(e,a,!0)}});return a.toTex={1:"\\sinh^{-1}\\left(${args[0]}\\right)"},a}var i=r(0);t.name="asinh",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("atan",{number:function(e){return Math.atan(e)},Complex:function(e){return e.atan()},BigNumber:function(e){return e.atan()},"Array | Matrix":function(e){return i(e,a,!0)}});return a.toTex={1:"\\tan^{-1}\\left(${args[0]}\\right)"},a}var i=r(0);t.name="atan",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(1)),o=n(r(21)),s=n(r(12)),u=n(r(128)),c=n(r(13)),f=n(r(14)),l=n(r(6)),p=n(r(5)),h=i("atan2",{"number, number":Math.atan2,"BigNumber, BigNumber":function(t,r){return e.BigNumber.atan2(t,r)},"Matrix, Matrix":function(e,t){var r;switch(e.storage()){case"sparse":switch(t.storage()){case"sparse":r=u(e,t,h,!1);break;default:r=o(t,e,h,!0)}break;default:switch(t.storage()){case"sparse":r=s(e,t,h,!1);break;default:r=l(e,t,h)}}return r},"Array, Array":function(e,t){return h(a(e),a(t)).valueOf()},"Array, Matrix":function(e,t){return h(a(e),t)},"Matrix, Array":function(e,t){return h(e,a(t))},"Matrix, number | BigNumber":function(e,t){var r;switch(e.storage()){case"sparse":r=c(e,t,h,!1);break;default:r=p(e,t,h,!1)}return r},"number | BigNumber, Matrix":function(e,t){var r;switch(t.storage()){case"sparse":r=f(t,e,h,!0);break;default:r=p(t,e,h,!0)}return r},"Array, number | BigNumber":function(e,t){return p(a(e),t,h,!1).valueOf()},"number | BigNumber, Array":function(e,t){return p(a(t),e,h,!0).valueOf()}});return h.toTex={2:"\\mathrm{atan2}\\left(${args}\\right)"},h}t.name="atan2",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var o=n("atanh",{number:function(r){return r<=1&&r>=-1||t.predictable?a(r):new e.Complex(r,0).atanh()},Complex:function(e){return e.atanh()},BigNumber:function(e){retuLine truncated
|
||||
if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return b(this,e);case 2:case 3:return N(this,e,t,r);default:throw new SyntaxError("Wrong number of arguments")}};var b=function(e,t){if(!t||t.isIndex!==!0)throw new TypeError("Invalid index");var r=t.isScalar();if(r)return e.get(t.min());var n=t.size();if(n.length!=e._size.length)throw new a(n.length,e._size.length);var i,o,s,u,c=t.min(),f=t.max();for(i=0,o=e._size.length;i<o;i++)m(c[i],e._size[i]),m(f[i],e._size[i]);var l=e._values,p=e._index,h=e._ptr,d=t.dimension(0),v=t.dimension(1),y=[],x=[];d.forEach(function(e,t){x[e]=t[0],y[e]=!0});var w=l?[]:void 0,b=[],N=[];return v.forEach(function(e){for(N.push(b.length),s=h[e],u=h[e+1];s<u;s++)i=p[s],y[i]===!0&&(b.push(x[i]),w&&w.push(l[s]))}),N.push(b.length),new g({values:w,index:b,ptr:N,size:n,datatype:e._datatype})},N=function(e,t,r,n){if(!t||t.isIndex!==!0)throw new TypeError("Invalid index");var i,u=t.size(),c=t.isScalar();if(r&&r.isMatrix===!0?(i=r.size(),r=r.toArray()):i=o.size(r),c){if(0!==i.length)throw new TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(1!==u.length&&2!==u.length)throw new a(u.length,e._size.length,"<");if(i.length<u.length){for(var f=0,l=0;1===u[f]&&1===i[f];)f++;for(;1===u[f];)l++,f++;r=o.unsqueeze(r,u.length,l,i)}if(!s.deepEqual(u,i))throw new a(u,i,">");for(var p=t.min()[0],h=t.min()[1],m=i[0],d=i[1],g=0;g<m;g++)for(var v=0;v<d;v++){var y=r[g][v];e.set([g+p,v+h],y,n)}}return e};g.prototype.get=function(e){if(!f(e))throw new TypeError("Array expected");if(e.length!=this._size.length)throw new a(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var t=e[0],r=e[1];m(t,this._size[0]),m(r,this._size[1]);var n=E(t,this._ptr[r],this._ptr[r+1],this._index);return n<this._ptr[r+1]&&this._index[n]===t?this._values[n]:0},g.prototype.set=function(e,t,r){if(!f(e))throw new TypeError("Array expected");if(e.length!=this._size.length)throw new a(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var n=e[0],i=e[1],o=this._size[0],s=this._size[1],u=y,c=0;h(this._datatype)&&(u=d.find(y,[this._datatype,this._datatype])||y,c=d.convert(0,this._datatype)),(n>o-1||i>s-1)&&(O(this,Math.max(n+1,o),Math.max(i+1,s),r),o=this._size[0],s=this._size[1]),m(n,o),m(i,s);var l=E(n,this._ptr[i],this._ptr[i+1],this._index);return l<this._ptr[i+1]&&this._index[l]===n?u(t,c)?M(l,i,this._values,this._index,this._ptr):this._values[l]=t:A(l,n,i,t,this._values,this._index,this._ptr),this};var E=function(e,t,r,n){if(r-t===0)return r;for(var i=t;i<r;i++)if(n[i]===e)return i;return t},M=function(e,t,r,n,i){r.splice(e,1),n.splice(e,1);for(var a=t+1;a<i.length;a++)i[a]--},A=function(e,t,r,n,i,a,o){i.splice(e,0,n),a.splice(e,0,t);for(var s=r+1;s<o.length;s++)o[s]++};g.prototype.resize=function(e,t,r){if(!f(e))throw new TypeError("Array expected");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");e.forEach(function(t){if(!c.isNumber(t)||!c.isInteger(t)||t<0)throw new TypeError("Invalid size, must contain positive integers (size: "+u.format(e)+")")});var n=r?this.clone():this;return O(n,e[0],e[1],t)};var O=function(e,t,r,n){var i=n||0,a=y,o=0;h(e._datatype)&&(a=d.find(y,[e._datatype,e._datatype])||y,o=d.convert(0,e._datatype),i=d.convert(i,e._datatype));var s,u,c,f=!a(i,o),l=e._size[0],p=e._size[1];if(r>p){for(u=p;u<r;u++)if(e._ptr[u]=e._values.length,f)for(s=0;s<l;s++)e._values.push(i),e._index.push(s);e._ptr[r]=e._values.length}else r<p&&(e._ptr.splice(r+1,p-r),e._values.splice(e._ptr[r],e._values.length),e._index.splice(e._ptr[r],e._index.length));if(p=r,t>l){if(f){var m=0;for(u=0;u<p;u++){e._ptr[u]=e._ptr[u]+m,c=e._ptr[u+1]+m;var g=0;for(s=l;s<t;s++,g++)e._values.splice(c+g,0,i),e._index.splice(c+g,0,s),m++}e._ptr[p]=e._values.length}}else if(t<l){var v=0;for(u=0;u<p;u++){e._ptr[u]=e._ptr[u]-v;var x=e._ptr[u],w=e._ptr[u+1]-v;for(c=x;c<w;c++)s=e._index[c],s>t-1&&(e._values.splice(c,1),e._index.splice(c,1),v++)}e._ptr[u]=e._values.length}return e._size[0]=t,e._size[1]=r,e};g.prototype.clone=function(){var e=new g({values:this._values?s.clone(this._values):void 0,index:s.clone(this._index),ptr:s.clone(this._ptr),size:s.clone(this._size),datatype:this._datatype});return e},g.prototype.size=function(){return this._size.slice(0)},g.prototype.map=function(e,t){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var r=this,n=this._size[0],i=this._size[1],a=function(t,n,i){return e(t,[n,i],r)};return _(this,0,n-1,0,i-1,a,t)};var _=function(e,t,r,n,i,a,o){var s=[],u=[],c=[],f=y,l=0;h(e._datatype)&&(f=d.find(y,[e._datatype,e._datatype])||y,l=d.convert(0,e._datatype));for(var p=function(e,t,r){e=a(e,t,r),f(e,l)||(s.push(e),u.push(t))},m=n;m<=i;m++){c.push(s.length);for(var v=e._ptr[m],x=e._ptr[m+1],w=t,b=v;b<x;b++){var N=e._index[b];if(N>=t&&N<=r){if(!o)for(var E=w;E<N;E++)p(0,E-t,m-n);p(e._values[b],N-t,m-n)}w=N+1}if(!o)for(var M=w;M<=r;M++)p(0,M-t,m-n)}return c.push(s.length),new g({values:s,index:u,ptr:c,size:[r-t+1,i-n+1]})};g.prototype.forEach=function(e,t){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var r=this,n=this._size[0],i=this._size[1],a=0;a<i;a++){for(var o=this._ptr[a],s=this._ptr[a+1],u=0,c=o;c<s;c++){var f=this._index[c];if(!t)for(var l=u;l<f;l++)e(0,[l,a],r);e(this._values[c],[f,a],r),u=f+1}if(!t)for(var p=u;p<n;p++)e(0,[p,a],r)}},g.prototype.toArray=function(){return T(this._values,this._index,this._ptr,this._size,!0)},g.prototype.valueOf=function(){return T(this._values,this._index,this._ptr,this._size,!1)};var T=function(e,t,r,n,i){var a,o,u=n[0],c=n[1],f=[];for(a=0;a<u;a++)for(f[a]=[],o=0;o<c;o++)f[a][o]=0;for(o=0;o<c;o++)for(var l=r[o],p=r[o+1],h=l;h<p;h++)a=t[h],f[a][o]=e?i?s.clone(e[h]):e[h]:1;return f};return g.prototype.format=function(e){for(var t=this._size[0],r=this._size[1],n=this.density(),i="Sparse Matrix ["+u.format(t,e)+" x "+u.format(r,e)+"] density: "+u.format(n,e)+"\n",a=0;a<r;a++)for(var o=this._ptr[a],s=this._ptr[a+1],c=o;c<s;c++){var f=this._index[c];i+="\n ("+u.format(f,e)+", "+u.format(a,e)+") ==> "+(this._values?u.format(this._values[c],e):"X")}return i},g.prototype.toString=function(){return u.format(this.toArray())},g.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},g.prototype.diagonal=function(e){if(e){if(e.isBigNumber===!0&&(e=e.toNumber()),!l(e)||!p(e))throw new TypeError("The parameter k must be an integer number")}else e=0;var t=e>0?e:0,r=e<0?-e:0,n=this._size[0],i=this._size[1],a=Math.min(n-r,i-t),o=[],s=[],u=[];u[0]=0;for(var c=t;c<i&&o.length<a;c++)for(var f=this._ptr[c],h=this._ptr[c+1],m=f;m<h;m++){var d=this._index[m];if(d===c-t+r){o.push(this._values[m]),s[o.length-1]=d-r;break}}return u.push(o.length),new g({values:o,index:s,ptr:u,size:[a,1]})},g.fromJSON=function(e){return new g(e)},g.diagonal=function(e,t,r,n,i){if(!f(e))throw new TypeError("Array expected, size parameter");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(e&&e.isBigNumber===!0&&(e=e.toNumber()),!l(e)||!p(e)||e<1)throw new Error("Size values must be positive integers");return e}),r){if(r.isBigNumber===!0&&(r=r.toNumber()),!l(r)||!p(r))throw new TypeError("The parameter k must be an integer number")}else r=0;var a=y,o=0;h(i)&&(a=d.find(y,[i,i])||y,o=d.convert(0,i));var s,u=r>0?r:0,c=r<0?-r:0,m=e[0],v=e[1],x=Math.min(m-c,v-u);if(f(t)){if(t.length!==x)throw new Error("Invalid value array length");s=function(e){return t[e]}}else if(t&&t.isMatrix===!0){var w=t.size();if(1!==w.length||w[0]!==x)throw new Error("Invalid matrix length");s=function(e){return t.get([e])}}else s=function(){return t};for(var b=[],N=[],E=[],M=0;M<v;M++){E.push(b.length);var A=M-u;if(A>=0&&A<x){var O=s(A);a(O,o)||(N.push(A+c),b.push(O))}}return E.push(b.length),new g({values:b,index:N,ptr:E,size:[m,v]})},g.prototype.swapRows=function(e,t){if(!(l(e)&&p(e)&&l(t)&&p(t)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return m(e,this._size[0]),m(t,this._size[0]),g._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this},g._forEachRow=function(e,t,r,n,i){for(var a=n[e],o=n[e+1],s=a;s<o;s++)i(r[s],t[s])},g._swapRows=function(e,t,r,n,i,a){for(var o=0;o<r;o++){var s=a[o],u=a[o+1],c=E(e,s,u,i),f=E(t,s,u,i);if(c<u&&f<u&&i[c]===e&&i[f]===t){if(n){var l=n[c];n[c]=n[f],n[f]=l}}else if(c<u&&i[c]===e&&(f>=u||i[f]!==t)){var p=n?n[c]:void 0;i.splice(f,0,t),n&&n.splice(f,0,p),i.splice(f<=c?c+1:c,1),n&&n.splice(f<=c?c+1:c,1)}else if(f<u&&i[f]===t&&(c>=u||i[c]!==e)){var h=n?n[f]:void 0;i.splice(c,0,e),n&&n.splice(c,0,h),i.splice(c<=f?f+1:f,1),n&&n.splice(c<=f?f+1:f,1)}}},e.Matrix._storage.sparse=g,g}var i=r(23),a=r(9),o=i.array,s=i.object,u=i.string,c=i.number,f=Array.isArray,l=c.isNumber,p=c.isInteger,h=u.isString,m=o.validateIndex;t.name="SparseMatrix",t.path="type",t.factory=n,t.lazy=!1},function(e,t,r){"use strict";function n(e,t,r,n){return n("index",{"...number | string | BigNumber | Range | Array | Matrix":function(t){var r=t.map(function(e){return e&&e.isBigNumber===!0?e.toNumber():e&&(Array.isArray(e)||e.isMatrix===!0)?e.map(function(e){return e&&e.isBigNumber===!0?e.toNumber():e}):e}),n=new e.Index;return e.Index.apply(n,r),n}})}t.name="index",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var i=e.SparseMatrix,a=n("sparse",{"":function(){return new i([])},string:function(e){return new i([],e)},"Array | Matrix":function(e){return new i(e)},"Array | Matrix, string":function(e,t){return new i(e,t)}});return a.toTex={0:"\\begin{bsparse}\\end{bsparse}",1:"\\left(${args[0]}\\right)"},a}t.name="sparse",t.factory=n},function(e,t,r){e.exports=[r(72),r(126),r(484),r(483),r(480),r(481),r(482),r(127),r(485),r(1),r(486)]}Line truncated
|
||||
* @license Complex.js v2.0.1 11/02/2016
|
||||
*
|
||||
* Copyright (c) 2016, Robert Eisele (robert@xarg.org)
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
**/
|
||||
!function(r){"use strict";function a(e,t){var r=Math.abs(e),n=Math.abs(t);return 0===e?Math.log(n):0===t?Math.log(r):r<3e3&&n<3e3?.5*Math.log(e*e+t*t):Math.log(e/Math.cos(Math.atan2(t,e)))}function o(e,t){return this instanceof o?(c(e,t),this.re=s.re,void(this.im=s.im)):new o(e,t)}var s={re:0,im:0};Math.cosh=Math.cosh||function(e){return.5*(Math.exp(e)+Math.exp(-e))},Math.sinh=Math.sinh||function(e){return.5*(Math.exp(e)-Math.exp(-e))};var u=function(){throw SyntaxError("Invalid Param")},c=function(e,t){if(void 0===e||null===e)s.re=s.im=0;else if(void 0!==t)s.re=e,s.im=t;else switch(typeof e){case"object":"im"in e&&"re"in e?(s.re=e.re,s.im=e.im):"abs"in e&&"arg"in e?(s.re=e.abs*Math.cos(e.arg),s.im=e.abs*Math.sin(e.arg)):"r"in e&&"phi"in e?(s.re=e.r*Math.cos(e.phi),s.im=e.r*Math.sin(e.phi)):u();break;case"string":s.im=s.re=0;var r=e.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),n=1,i=0;null===r&&u();for(var a=0;a<r.length;a++){var o=r[a];" "===o||"\t"===o||"\n"===o||("+"===o?n++:"-"===o?i++:"i"===o||"I"===o?(n+i===0&&u()," "===r[a+1]||isNaN(r[a+1])?s.im+=parseFloat((i%2?"-":"")+"1"):(s.im+=parseFloat((i%2?"-":"")+r[a+1]),a++),n=i=0):((n+i===0||isNaN(o))&&u(),"i"===r[a+1]||"I"===r[a+1]?(s.im+=parseFloat((i%2?"-":"")+o),a++):s.re+=parseFloat((i%2?"-":"")+o),n=i=0))}n+i>0&&u();break;case"number":s.im=0,s.re=e;break;default:u()}isNaN(s.re)||isNaN(s.im)};o.prototype={re:0,im:0,sign:function(){var e=this.abs();return new o(this.re/e,this.im/e)},add:function(e,t){return c(e,t),new o(this.re+s.re,this.im+s.im)},sub:function(e,t){return c(e,t),new o(this.re-s.re,this.im-s.im)},mul:function(e,t){return c(e,t),0===s.im&&0===this.im?new o(this.re*s.re,0):new o(this.re*s.re-this.im*s.im,this.re*s.im+this.im*s.re)},div:function(e,t){c(e,t),e=this.re,t=this.im;var r,n,i=s.re,a=s.im;return 0===i&&0===a?new o(0!==e?e/0:0,0!==t?t/0:0):0===a?new o(e/i,t/i):Math.abs(i)<Math.abs(a)?(n=i/a,r=i*n+a,new o((e*n+t)/r,(t*n-e)/r)):(n=a/i,r=a*n+i,new o((e+t*n)/r,(t-e*n)/r))},pow:function(e,t){if(c(e,t),e=this.re,t=this.im,0===e&&0===t)return new o(0,0);var r=Math.atan2(t,e),n=a(e,t);if(0===s.im){if(0===t&&e>=0)return new o(Math.pow(e,s.re),0);if(0===e)switch(s.re%4){case 0:return new o(Math.pow(t,s.re),0);case 1:return new o(0,Math.pow(t,s.re));case 2:return new o(-Math.pow(t,s.re),0);case 3:return new o(0,-Math.pow(t,s.re))}}return e=Math.exp(s.re*n-s.im*r),t=s.im*n+s.re*r,new o(e*Math.cos(t),e*Math.sin(t))},sqrt:function(){var e,t,r=this.re,n=this.im,i=this.abs();return r>=0&&0===n?new o(Math.sqrt(r),0):(e=r>=0?.5*Math.sqrt(2*(i+r)):Math.abs(n)/Math.sqrt(2*(i-r)),t=r<=0?.5*Math.sqrt(2*(i-r)):Math.abs(n)/Math.sqrt(2*(i+r)),new o(e,n>=0?t:-t))},exp:function(){var e=Math.exp(this.re);return 0===this.im,new o(e*Math.cos(this.im),e*Math.sin(this.im))},log:function(){var e=this.re,t=this.im;return new o(a(e,t),Math.atan2(t,e))},abs:function(){var e=Math.abs(this.re),t=Math.abs(this.im);return e<3e3&&t<3e3?Math.sqrt(e*e+t*t):(e<t?(e=t,t=this.re/this.im):t=this.im/this.re,e*Math.sqrt(1+t*t))},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var e=this.re,t=this.im;return new o(Math.sin(e)*Math.cosh(t),Math.cos(e)*Math.sinh(t))},cos:function(){var e=this.re,t=this.im;return new o(Math.cos(e)*Math.cosh(t),-Math.sin(e)*Math.sinh(t))},tan:function(){var e=2*this.re,t=2*this.im,r=Math.cos(e)+Math.cosh(t);return new o(Math.sin(e)/r,Math.sinh(t)/r)},cot:function(){var e=2*this.re,t=2*this.im,r=Math.cos(e)-Math.cosh(t);return new o(-Math.sin(e)/r,Math.sinh(t)/r)},sec:function(){var e=this.re,t=this.im,r=.5*Math.cosh(2*t)+.5*Math.cos(2*e);return new o(Math.cos(e)*Math.cosh(t)/r,Math.sin(e)*Math.sinh(t)/r)},csc:function(){var e=this.re,t=this.im,r=.5*Math.cosh(2*t)-.5*Math.cos(2*e);return new o(Math.sin(e)*Math.cosh(t)/r,-Math.cos(e)*Math.sinh(t)/r)},asin:function(){var e=this.re,t=this.im,r=new o(t*t-e*e+1,-2*e*t).sqrt(),n=new o(r.re-t,r.im+e).log();return new o(n.im,-n.re)},acos:function(){var e=this.re,t=this.im,r=new o(t*t-e*e+1,-2*e*t).sqrt(),n=new o(r.re-t,r.im+e).log();return new o(Math.PI/2-n.im,n.re)},atan:function(){var e=this.re,t=this.im;if(0===e){if(1===t)return new o(0,1/0);if(t===-1)return new o(0,-(1/0))}var r=e*e+(1-t)*(1-t),n=new o((1-t*t-e*e)/r,-2*e/r).log();return new o(-.5*n.im,.5*n.re)},acot:function(){var e=this.re,t=this.im;if(0===t)return new o(Math.atan2(1,e),0);var r=e*e+t*t;return 0!==r?new o(e/r,-t/r).atan():new o(0!==e?e/0:0,0!==t?-t/0:0).atan()},asec:function(){var e=this.re,t=this.im;if(0===e&&0===t)return new o(0,1/0);var r=e*e+t*t;return 0!==r?new o(e/r,-t/r).acos():new o(0!==e?e/0:0,0!==t?-t/0:0).acos()},acsc:function(){var e=this.re,t=this.im;if(0===e&&0===t)return new o(Math.PI/2,1/0);var r=e*e+t*t;return 0!==r?new o(e/r,-t/r).asin():new o(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){var e=this.re,t=this.im;return new o(Math.sinh(e)*Math.cos(t),Math.cosh(e)*Math.sin(t))},cosh:function(){var e=this.re,t=this.im;return new o(Math.cosh(e)*Math.cos(t),Math.sinh(e)*Math.sin(t))},tanh:function(){var e=2*this.re,t=2*this.im,r=Math.cosh(e)+Math.cos(t);return new o(Math.sinh(e)/r,Math.sin(t)/r)},coth:function(){var e=2*this.re,t=2*this.im,r=Math.cosh(e)-Math.cos(t);return new o(Math.sinh(e)/r,-Math.sin(t)/r)},csch:function(){var e=this.re,t=this.im,r=Math.cos(2*t)-Math.cosh(2*e);return new o(-2*Math.sinh(e)*Math.cos(t)/r,2*Math.cosh(e)*Math.sin(t)/r)},sech:function(){var e=this.re,t=this.im,r=Math.cos(2*t)+Math.cosh(2*e);return new o(2*Math.cosh(e)*Math.cos(t)/r,-2*Math.sinh(e)*Math.sin(t)/r)},asinh:function(){var e=this.im;this.im=-this.re,this.re=e;var t=this.asin();return this.re=-this.im,this.im=e,e=t.re,t.re=-t.im,t.im=e,t},acosh:function(){var e,t=this.acos();return t.im<=0?(e=t.re,t.re=-t.im,t.im=e):(e=t.im,t.im=-t.re,t.re=e),t},atanh:function(){var e=this.re,t=this.im,r=e>1&&0===t,n=1-e,i=1+e,s=n*n+t*t,u=0!==s?new o((i*n-t*t)/s,(t*n+i*t)/s):new o(e!==-1?e/0:0,0!==t?t/0:0),c=u.re;return u.re=a(u.re,u.im)/2,u.im=Math.atan2(u.im,c)/2,r&&(u.im=-u.im),u},acoth:function(){var e=this.re,t=this.im;if(0===e&&0===t)return new o(0,Math.PI/2);var r=e*e+t*t;return 0!==r?new o(e/r,-t/r).atanh():new o(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){var e=this.re,t=this.im;if(0===t)return new o(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);var r=e*e+t*t;return 0!==r?new o(e/r,-t/r).asinh():new o(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){var e=this.re,t=this.im;if(0===e&&0===t)return new o(1/0,0);var r=e*e+t*t;return 0!==r?new o(e/r,-t/r).acosh():new o(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){var e=this.re,t=this.im,r=e*e+t*t;return new o(0!==e?e/r:0,0!==t?-t/r:0)},conjugate:function(){return new o(this.re,-this.im)},neg:function(){return new o(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new o(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new o(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new o(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){return c(e,t),Math.abs(s.re-this.re)<=o.EPSILON&&Math.abs(s.im-this.im)<=o.EPSILON},clone:function(){return new o(this.re,this.im)},toString:function(){var e=this.re,t=this.im,r="";return isNaN(e)||isNaN(t)?"NaN":(0!==e&&(r+=e),0!==t&&(0!==e?r+=t<0?" - ":" + ":t<0&&(r+="-"),t=Math.abs(t),1!==t&&(r+=t),r+="i"),r?r:"0")},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)}},o.ZERO=new o(0,0),o.ONE=new o(1,0),o.I=new o(0,1),o.PI=new o(Math.PI,0),o.E=new o(Math.E,0),o.EPSILON=1e-16,n=[],i=function(){return o}.apply(t,n),!(void 0!==i&&(e.exports=i))}(this)},function(e,t,r){var n;!function(i){"use strict";function a(e){var t,r,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;t<i;t++)n=e[t]+"",r=Ie-n.length,r&&(a+=g(r)),a+=n;o=e[t],n=o+"",r=Ie-n.length,r&&(a+=g(r))}else if(0===o)return"0";for(;o%10===0;)o/=10;return a+o}function o(e,t,r){if(e!==~~e||e<t||e>r)throw Error(Me+e)}function s(e,t,r,n){var i,a,o,s;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=Ie,i=0):(i=Math.ceil((t+1)/Ie),t%=Ie),a=Te(10,Ie-t),s=e[i]%a|0,null==n?t<3?(0==t?s=s/100|0:1==t&&(s=s/10|0),o=r<4&&99999==s||r>3&&49999==s||5e4==s||0==s):o=(r<4&&s+1==a||r>3&&s+1==a/2)&&(e[i+1]/a/100|0)==Te(10,t-2)-1||(s==a/2||0==s)&&0==(e[i+1]/a/100|0):t<4?(0==t?s=s/1e3|0:1==t?s=s/100|0:2==t&&(s=s/10|0),o=(n||r<4)&&9999==s||!n&&r>3&&4999==s):o=((n||r<4)&&s+1==a||!n&&r>3&&s+1==a/2)&&(e[i+1]/a/1e3|0)==Te(10,t-3)-1,o}function u(e,t,r){for(var n,i,a=[0],o=0,s=e.length;o<s;){for(i=a.length;i--;)a[i]*=t;for(a[0]+=ye.indexOf(e.charAt(o++)),n=0;n<a.length;n++)a[n]>r-1&&(void 0===a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}function c(e,t){var r,n,i=t.d.length;i<32?(r=Math.ceil(i/3),n=Math.pow(4,-r).toString()):(r=16,n="2.3283064365386962890625e-10"),e.precision+=r,t=O(e,1,t.times(n),new e(1));for(var a=r;a--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}function f(e,t,r,n){var i,a,o,s,u,c,f,l,p,h=e.constructor;e:if(null!=t){if(l=e.d,!l)return e;for(i=1,s=l[0];s>=10;s/=10)i++;if(a=t-i,a<0)a+=Ie,o=t,f=l[p=0],u=f/Te(10,i-o-1)%10|0;else if(p=Math.ceil((a+1)/Ie),s=l.length,p>=s){if(!n)break e;for(;s++<=p;)l.push(0);f=u=0,i=1,a%=Ie,o=a-Ie+1}else{for(f=s=l[p],i=1;s>=10;s/=10)i++;a%=Ie,o=a-Ie+i,u=o<0?0:f/Te(10,i-o-1)%10|0}if(n=n||t<0||void 0!==l[p+1]||(o<0?f:f%Te(10,i-o-1)),c=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):u>5||5==u&&(4==r||n||6==r&&(a>0?o>0?f/Te(10,i-o):0:l[p-1])%10&1||r==(e.s<0?8:7)),t<1||!l[0])return l.length=0,c?(t-=e.e+1,l[0]=Te(10,(Ie-t%Ie)%Ie),e.e=-t||0):l[0]=e.e=0,e;if(0==a?(l.length=p,s=1,p--):(l.length=p+1,s=Te(10,Ie-a),l[p]=o>0?(f/Te(10,i-o)%Te(10,o)|0)*s:0),c)for(;;){if(0==p){for(a=1,o=l[0];o>=10;o/=10)a++;for(o=l[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(e.e++,l[0]==Be&&(l[0]=1));break}if(l[p]+=s,l[p]!=Be)break;l[p--]=0,s=1}for(a=l.length;0===l[--a];)l.pop()}return Ne&&(e.e>h.maxE?(e.d=null,e.e=NaN):e.e<h.minE&&(e.e=0,e.d=[0])),e}fLine truncated
|
||||
var e=this,t=e.constructor;return f(new t(e),e.e+1,t.rounding)},qe.sine=qe.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+Ie,n.rounding=1,r=A(n,_(n,r)),n.precision=e,n.rounding=t,f(de>2?r.neg():r,e,t,!0)):new n(NaN)},qe.squareRoot=qe.sqrt=function(){var e,t,r,n,i,o,s=this,u=s.d,c=s.e,l=s.s,p=s.constructor;if(1!==l||!u||!u[0])return new p(!l||l<0&&(!u||u[0])?NaN:u?s:1/0);for(Ne=!1,l=Math.sqrt(+s),0==l||l==1/0?(t=a(u),(t.length+c)%2==0&&(t+="0"),l=Math.sqrt(t),c=_e((c+1)/2)-(c<0||c%2),l==1/0?t="1e"+c:(t=l.toExponential(),t=t.slice(0,t.indexOf("e")+1)+c),n=new p(t)):n=new p(l.toString()),r=(c=p.precision)+3;;)if(o=n,n=o.plus(Le(s,o,r+2,1)).times(.5),a(o.d).slice(0,r)===(t=a(n.d)).slice(0,r)){if(t=t.slice(r-3,r+1),"9999"!=t&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(f(n,c+1,1),e=!n.times(n).eq(s));break}if(!i&&(f(o,c+1,0),o.times(o).eq(s))){n=o;break}r+=4,i=1}return Ne=!0,f(n,c,p.rounding,e)},qe.tangent=qe.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,r=r.sin(),r.s=1,r=Le(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,f(2==de||4==de?r.neg():r,e,t,!0)):new n(NaN)},qe.times=qe.mul=function(e){var t,r,n,i,a,o,s,u,c,l=this,h=l.constructor,m=l.d,d=(e=new h(e)).d;if(e.s*=l.s,!(m&&m[0]&&d&&d[0]))return new h(!e.s||m&&!m[0]&&!d||d&&!d[0]&&!m?NaN:m&&d?0*e.s:e.s/0);for(r=_e(l.e/Ie)+_e(e.e/Ie),u=m.length,c=d.length,u<c&&(a=m,m=d,d=a,o=u,u=c,c=o),a=[],o=u+c,n=o;n--;)a.push(0);for(n=c;--n>=0;){for(t=0,i=u+n;i>n;)s=a[i]+d[n]*m[i-n-1]+t,a[i--]=s%Be|0,t=s/Be|0;a[i]=(a[i]+t)%Be|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=p(a,r),Ne?f(e,h.precision,h.rounding):e},qe.toBinary=function(e,t){return T(this,2,e,t)},qe.toDecimalPlaces=qe.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),void 0===e?r:(o(e,0,ve),void 0===t?t=n.rounding:o(t,0,8),f(r,e+r.e+1,t))},qe.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=l(n,!0):(o(e,0,ve),void 0===t?t=i.rounding:o(t,0,8),n=f(new i(n),e+1,t),r=l(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},qe.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return void 0===e?r=l(i):(o(e,0,ve),void 0===t?t=a.rounding:o(t,0,8),n=f(new a(i),e+i.e+1,t),r=l(n,!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},qe.toFraction=function(e){var t,r,n,i,o,s,u,c,f,l,p,h,m=this,g=m.d,v=m.constructor;if(!g)return new v(m);if(f=r=new v(1),n=c=new v(0),t=new v(n),o=t.e=d(g)-m.e-1,s=o%Ie,t.d[0]=Te(10,s<0?Ie+s:s),null==e)e=o>0?t:f;else{if(u=new v(e),!u.isInt()||u.lt(f))throw Error(Me+u);e=u.gt(t)?o>0?t:f:u}for(Ne=!1,u=new v(a(g)),l=v.precision,v.precision=o=g.length*Ie*2;p=Le(u,t,0,1,1),i=r.plus(p.times(n)),1!=i.cmp(e);)r=n,n=i,i=f,f=c.plus(p.times(i)),c=i,i=t,t=u.minus(p.times(i)),u=i;return i=Le(e.minus(r),n,0,1,1),c=c.plus(i.times(f)),r=r.plus(i.times(n)),c.s=f.s=m.s,h=Le(f,n,o,1).minus(m).abs().cmp(Le(c,r,o,1).minus(m).abs())<1?[f,n]:[c,r],v.precision=l,Ne=!0,h},qe.toHexadecimal=qe.toHex=function(e,t){return T(this,16,e,t)},qe.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0!==t&&o(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(Ne=!1,t<4&&(t=[4,5,7,8][t]),r=Le(r,e,0,t,1).times(e),Ne=!0,f(r)):(e.s=r.s,r=e),r},qe.toNumber=function(){return+this},qe.toOctal=function(e,t){return T(this,8,e,t)},qe.toPower=qe.pow=function(e){var t,r,n,i,o,u,c,l=this,p=l.constructor,h=+(e=new p(e));if(!(l.d&&e.d&&l.d[0]&&e.d[0]))return new p(Te(+l,h));if(l=new p(l),l.eq(1))return l;if(n=p.precision,o=p.rounding,e.eq(1))return f(l,n,o);if(t=_e(e.e/Ie),r=e.d.length-1,c=t>=r,u=l.s,c){if((r=h<0?-h:h)<=Pe)return i=v(p,l,r,n),e.s<0?new p(1).div(i):f(i,n,o)}else if(u<0)return new p(NaN);return u=u<0&&1&e.d[Math.max(t,r)]?-1:1,r=Te(+l,h),t=0!=r&&isFinite(r)?new p(r+"").e:_e(h*(Math.log("0."+a(l.d))/Math.LN10+l.e+1)),t>p.maxE+1||t<p.minE-1?new p(t>0?u/0:0):(Ne=!1,p.rounding=l.s=1,r=Math.min(12,(t+"").length),i=w(e.times(b(l,n+r)),n),i=f(i,n+5,1),s(i.d,n,o)&&(t=n+10,i=f(w(e.times(b(l,t+r)),t),t+5,1),+a(i.d).slice(n+1,n+15)+1==1e14&&(i=f(i,n+1,0))),i.s=u,Ne=!0,p.rounding=o,f(i,n,o))},qe.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=l(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(o(e,1,ve),void 0===t?t=i.rounding:o(t,0,8),n=f(new i(n),e,t),r=l(n,e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},qe.toSignificantDigits=qe.toSD=function(e,t){var r=this,n=r.constructor;return void 0===e?(e=n.precision,t=n.rounding):(o(e,1,ve),void 0===t?t=n.rounding:o(t,0,8)),f(new n(r),e,t)},qe.toString=function(){var e=this,t=e.constructor,r=l(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},qe.truncated=qe.trunc=function(){return f(new this.constructor(this),this.e+1,1)},qe.valueOf=qe.toJSON=function(){var e=this,t=e.constructor,r=l(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};var Le=function(){function e(e,t,r){var n,i=0,a=e.length;for(e=e.slice();a--;)n=e[a]*t+i,e[a]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;i<r;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,a,o,s,u){var c,l,p,h,m,d,g,v,y,x,w,b,N,E,M,A,O,_,T,C,S=n.constructor,z=n.s==i.s?1:-1,k=n.d,B=i.d;if(!(k&&k[0]&&B&&B[0]))return new S(n.s&&i.s&&(k?!B||k[0]!=B[0]:B)?k&&0==k[0]||!B?0*z:z/0:NaN);for(u?(m=1,l=n.e-i.e):(u=Be,m=Ie,l=_e(n.e/m)-_e(i.e/m)),T=B.length,O=k.length,y=new S(z),x=y.d=[],p=0;B[p]==(k[p]||0);p++);if(B[p]>(k[p]||0)&&l--,null==a?(E=a=S.precision,o=S.rounding):E=s?a+(n.e-i.e)+1:a,E<0)x.push(1),d=!0;else{if(E=E/m+2|0,p=0,1==T){for(h=0,B=B[0],E++;(p<O||h)&&E--;p++)M=h*u+(k[p]||0),x[p]=M/B|0,h=M%B|0;d=h||p<O}else{for(h=u/(B[0]+1)|0,h>1&&(B=e(B,h,u),k=e(k,h,u),T=B.length,O=k.length),A=T,w=k.slice(0,T),b=w.length;b<T;)w[b++]=0;C=B.slice(),C.unshift(0),_=B[0],B[1]>=u/2&&++_;do h=0,c=t(B,w,T,b),c<0?(N=w[0],T!=b&&(N=N*u+(w[1]||0)),h=N/_|0,h>1?(h>=u&&(h=u-1),g=e(B,h,u),v=g.length,b=w.length,c=t(g,w,v,b),1==c&&(h--,r(g,T<v?C:B,v,u))):(0==h&&(c=h=1),g=B.slice()),v=g.length,v<b&&g.unshift(0),r(w,g,b,u),c==-1&&(b=w.length,c=t(B,w,T,b),c<1&&(h++,r(w,T<b?C:B,b,u))),b=w.length):0===c&&(h++,w=[0]),x[p++]=h,c&&w[0]?w[b++]=k[A]||0:(w=[k[A]],b=1);while((A++<O||void 0!==w[0])&&E--);d=void 0!==w[0]}x[0]||x.shift()}if(1==m)y.e=l,me=d;else{for(p=1,h=x[0];h>=10;h/=10)p++;y.e=p+l*m-1,f(y,s?a+y.e+1:a,o,d)}return y}}();be=G(be),xe=new be(xe),we=new be(we),n=function(){return be}.call(t,r,t,e),!(void 0!==n&&(e.exports=n))}(this)},function(e,t,r){var n,i;/**
|
||||
* @license Fraction.js v4.0.0 09/09/2015
|
||||
* http://www.xarg.org/2014/03/rational-numbers-in-javascript/
|
||||
*
|
||||
* Copyright (c) 2015, Robert Eisele (robert@xarg.org)
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
**/
|
||||
!function(r){"use strict";function a(e){var t=function(){var t=Error.apply(this,arguments);t.name=this.name=e,this.stack=t.stack,this.message=t.message},r=function(){};return r.prototype=Error.prototype,t.prototype=new r,t}function o(e,t){return isNaN(e=parseInt(e,10))&&s(),e*t}function s(){throw new p}function u(e,t){return this instanceof u?(h(e,t),e=u.REDUCE?v(f.d,f.n):1,this.s=f.s,this.n=f.n/e,void(this.d=f.d/e)):new u(e,t)}var c=2e3,f={s:1,n:0,d:1},l=u.DivisionByZero=a("DivisionByZero"),p=u.InvalidParameter=a("InvalidParameter"),h=function(e,t){var r,n=0,i=1,a=1,u=0,c=0,p=0,h=1,m=1,d=0,g=1,v=1,y=1,x=1e7;if(void 0===e||null===e);else if(void 0!==t)n=e,i=t,a=n*i;else switch(typeof e){case"object":"d"in e&&"n"in e?(n=e.n,i=e.d,"s"in e&&(n*=e.s)):0 in e?(n=e[0],1 in e&&(i=e[1])):s(),a=n*i;break;case"number":if(e<0&&(a=e,e=-e),e%1===0)n=e;else if(e>0){for(e>=1&&(m=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)),e/=m);g<=x&&y<=x;){if(r=(d+v)/(g+y),e===r){g+y<=x?(n=d+v,i=g+y):y>g?(n=v,i=y):(n=d,i=g);break}e>r?(d+=v,g+=y):(v+=d,y+=g),g>x?(n=v,i=y):(n=d,i=g)}n*=m}else(isNaN(e)||isNaN(t))&&(i=n=NaN);break;case"string":if(g=e.match(/\d+|./g),"-"===g[d]?(a=-1,d++):"+"===g[d]&&d++,g.length===d+1?c=o(g[d++],a):"."===g[d+1]||"."===g[d]?("."!==g[d]&&(u=o(g[d++],a)),d++,(d+1===g.length||"("===g[d+1]&&")"===g[d+3]||"'"===g[d+1]&&"'"===g[d+3])&&(c=o(g[d],a),h=Math.pow(10,g[d].length),d++),("("===g[d]&&")"===g[d+2]||"'"===g[d]&&"'"===g[d+2])&&(p=o(g[d+1],a),m=Math.pow(10,g[d+1].length)-1,d+=3)):"/"===g[d+1]||":"===g[d+1]?(c=o(g[d],a),h=o(g[d+2],1),d+=3):"/"===g[d+3]&&" "===g[d+1]&&(u=o(g[d],a),c=o(g[d+2],a),h=o(g[d+4],1),d+=5),g.length<=d){i=h*m,a=n=p+i*u+m*c;break}default:s()}if(0===i)throw new l;f.s=a<0?-1:1,f.n=Math.abs(n),f.d=Math.abs(i)},m=function(e,t,r){for(var n=1;t>0;e=e*e%r,t>>=1)1&t&&(n=n*e%r);return n},d=function(e,t){for(;t%2===0;t/=2);for(;t%5===0;t/=5);if(1===t)return 0;for(var r=10%t,n=1;1!==r;n++)if(r=10*r%t,n>c)return 0;return n},g=function(e,t,r){for(var n=1,i=m(10,r,t),a=0;a<300;a++){if(n===i)return a;n=10*n%t,i=10*i%t}return 0},v=function(e,t){if(!e)return t;if(!t)return e;for(;;){if(e%=t,!e)return t;if(t%=e,!t)return e}};u.REDUCE=1,u.prototype={s:1,n:0,d:1,abs:function(){return new u(this.n,this.d)},neg:function(){return new u(-this.s*this.n,this.d)},add:function(e,t){return h(e,t),new u(this.s*this.n*f.d+f.s*this.d*f.n,this.d*f.d)},sub:function(e,t){return h(e,t),new u(this.s*this.n*f.d-f.s*this.d*f.n,this.d*f.d)},mul:function(e,t){return h(e,t),new u(this.s*f.s*this.n*f.n,this.d*f.d)},div:function(e,t){return h(e,t),new u(this.s*f.s*this.n*f.d,this.d*f.n)},clone:function(){return new u(this)},mod:function(e,t){return isNaN(this.n)||isNaN(this.d)?new u(NaN):void 0===e?new u(this.s*this.n%this.d,1):(h(e,t),0===f.n&&0===this.d&&u(0,0),new u(this.s*f.d*this.n%(f.n*this.d),f.d*this.d))},gcd:function(e,t){return h(e,t),new u(v(f.n,this.n),f.d*this.d/v(f.d,this.d))},lcm:function(e,t){return h(e,t),0===f.n&&0===this.n?new u:new u(f.n*this.n/v(f.n,this.n),v(f.d,this.d))},ceil:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new u(NaN):new u(Math.ceil(e*this.s*this.n/this.d),e)},floor:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new u(NaN):new u(Math.floor(e*this.s*this.n/this.d),e)},round:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new u(NaN):new u(Math.round(e*this.s*this.n/this.d),e)},inverse:function(){return new u(this.s*this.d,this.n)},pow:function(e){return e<0?new u(Math.pow(this.s*this.d,-e),Math.pow(this.n,-e)):new u(Math.pow(this.s*this.n,e),Math.pow(this.d,e))},equals:function(e,t){return h(e,t),this.s*this.n*f.d===f.s*f.n*this.d},compare:function(e,t){h(e,t);var r=this.s*this.n*f.d-f.s*f.n*this.d;return(0<r)-(r<0)},divisible:function(e,t){return h(e,t),!(!(f.n*this.d)||this.n*f.d%(f.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,r+=" ",n%=i),r+=n,r+="/",r+=i),r},toLatex:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,n%=i),r+="\\frac{",r+=n,r+="}{",r+=i,r+="}"),r},toContinued:function(){var e,t=this.n,r=this.d,n=[];do n.push(Math.floor(t/r)),e=t%r,t=r,r=e;while(1!==t);return n},toString:function(){var e,t=this.n,r=this.d;if(isNaN(t)||isNaN(r))return"NaN";u.REDUCE||(e=v(t,r),t/=e,r/=e);for(var n=String(t).split(""),i=0,a=[~this.s?"":"-","",""],o="",s=d(t,r),c=g(t,r,s),f=-1,l=1,p=15+s+c+n.length,h=0;h<p;h++,i*=10){if(h<n.length?i+=Number(n[h]):(l=2,f++),s>0)if(f===c)a[l]+=o+"(",o="";else if(f===s+c){a[l]+=o+")";break}i>=r?(a[l]+=o+(i/r|0),o="",i%=r):l>1?o+="0":a[l]&&(a[l]+="0")}return a[0]+=a[1]||"0",a[2]?a[0]+"."+a[2]:a[0]}},n=[],i=function(){return u}.apply(t,n),!(void 0!==i&&(e.exports=i))}(this)},function(e,t){function r(){}r.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){function n(){i.off(e,n),t.apply(r,arguments)}var i=this;return n._=t,this.on(e,n,r)},emit:function(e){var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;for(n;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var a=0,o=n.length;a<o;a++)n[a].fn!==t&&n[a].fn._!==t&&i.push(n[a]);return i.length?r[e]=i:delete r[e],this}},e.exports=r},function(e,t,r){"use strict";var n,i,a;!function(r,o){i=[],n=o,a="function"==typeof n?n.apply(t,i):n,!(void 0!==a&&(e.exports=a))}(this,function(){function e(){function t(e){for(var t,r=0;r<M.types.length;r++){var n=M.types[r];if(n.name===e){t=n.test;break}}if(!t){var i;for(r=0;r<M.types.length;r++)if(n=M.types[r],n.name.toLowerCase()==e.toLowerCase()){i=n.name;break}throw new Error('Unknown type "'+e+'"'+(i?'. Did you mean "'+i+'"?':""))}return t}function r(e){for(var t="",r=0;r<e.length;r++){var n=e[r];if(n.signatures&&""!=n.name)if(""==t)t=n.name;else if(t!=n.name){var i=new Error("Function names do not match (expected: "+t+", actual: "+n.name+")");throw i.data={actual:n.name,expected:t},i}}return t}function n(e,t,r,n,i){var a,o=d(n),s=i?i.split(","):null,u=e||"unnamed",c=s&&g(s,"any"),f={fn:e,index:r,actual:n,expected:s};a=s?t>r&&!c?"Unexpected type of argument in function "+u+" (expected: "+s.join(" or ")+", actual: "+o+", index: "+r+")":"Too few arguments in function "+u+" (expected: "+s.join(" or ")+", index: "+r+")":"Too many arguments in function "+u+" (expected: "+r+", actual: "+t+")";var l=new TypeError(a);return l.data=f,l}function i(e){this.name=e||"refs",this.categories={}}function a(e,t){if("string"==typeof e){var r=e.trim(),n="..."===r.substr(0,3);if(n&&(r=r.substr(3)),""===r)this.types=["any"];else{this.types=r.split("|");for(var i=0;i<this.types.length;i++)this.types[i]=this.types[i].trim()}}else{if(!Array.isArray(e)){if(e instanceof a)return e.clone();throw new Error("String or Array expected")}this.types=e}this.conversions=[],this.varArgs=n||t||!1,this.anyType=this.types.indexOf("any")!==-1}function o(e,t){var r;if("string"==typeof e)r=""!==e?e.split(","):[];else{if(!Array.isArray(e))throw new Error("string or Array expected");r=e}this.params=new Array(r.length),this.anyType=!1,this.varArgs=!1;for(var n=0;n<r.length;n++){var i=new a(r[n]);if(this.params[n]=i,i.anyType&&(this.anyType=!0),n===r.length-1)this.varArgs=i.varArgs;else if(i.varArgs)throw new SyntaxError('Unexpected variable arguments operator "..."')}this.fn=t}function s(e,t,r,n){this.path=e||[],this.param=e[e.length-1]||null,this.signature=t||null,this.childs=r||[],this.fallThrough=n||!1}function u(e){var t,r,n={},i=[];for(var a in e)if(e.hasOwnProperty(a)){var s=e[a];if(t=new o(a,s),t.ignore())continue;var u=t.expand();for(r=0;r<u.length;r++){var c=u[r],f=c.toString(),l=n[f];if(l){var p=o.compare(c,l);if(p<0)n[f]=c;else if(0===p)throw new Error('Signature "'+f+'" is defined twice')}else n[f]=c}}for(f in n)n.hasOwnProperty(f)&&i.push(n[f]);for(i.sort(function(e,t){return o.compare(e,t)}),r=0;r<i.length;r++)if(t=i[r],t.varArgs)for(var h=t.params.length-1,m=t.params[h],d=0;d<m.types.length;){if(m.conversions[d])for(var v=m.types[d],y=0;y<i.length;y++){var x=i[y],w=x.params[h];if(x!==t&&w&&g(w.types,v)&&!w.conversions[h]){m.types.splice(d,1),m.conversions.splice(d,1),d--;break}}d++}return i}function c(e){for(var t=[],r=0;r<e.length;r++)e[r].anyType&&t.push(e[r]);return t}function f(e){for(var t={},r=0;r<e.length;r++){var n=e[r];if(n.fn&&!n.hasConversions()){var i=n.params.join(",");t[i]=n.fn}}return t}function l(e,t,r){var n,i,o,u=t.length,c=[];for(n=0;n<e.length;n++)i=e[n],i.params.length!==u||o||(o=i),void 0!=i.params[u]&&c.push(i);c.sort(function(e,t){return a.compare(e.params[u],t.params[u])});var f=[];for(n=0;n<c.length;n++){i=c[n];var p=i.params[u],h=f.filter(function(e){return e.param.overlapping(p)})[0];if(h){if(h.param.varArgs)throw new Error('Conflicting types "'+h.param+'" and "'+p+'"');h.signatures.push(i)}else f.push({param:p,signatures:[i]})}var m=[];for(n=0;n<r.length;n++)r[n].paramsStartWith(t)&&m.push(r[n]);var d=!1;for(n=0;n<m.length;n++)if(!g(e,m[n])){d=!0;break}var v=new Array(f.length);for(n=0;n<f.length;n++){var y=f[n];v[n]=l(y.signatures,t.concat(y.param),m)}return new s(t,o,v,d)}function p(e){for(var t=[],r=0;r<e;r++)t[r]="arg"+r;return t}function h(e,t){var r=new i,a=u(t);if(0==a.length)throw new Error("No signatures provided");var o=c(a),s=l(a,[],o),h=[],d=e||"",g=p(m(a));h.push("function "+d+"("+g.join(", ")+") {"),h.push(' "use strict";'),h.push(" var name = '"+d+"';"),h.push(s.toCode(r," ",!1)),h.push("}");var v=[r.toCode(),"return "+h.join("\n")].join("\n"),y=new Function(r.name,"createError",v),x=y(r,n);return x.signatures=f(a),x}function m(e){for(var t=0,r=0;r<e.length;r++){var n=e[r].params.length;n>t&&(t=n)}return t}function d(e){for(var t,r=0;r<M.types.length;r++){var n=M.types[r];if("Object"===n.name)t=n;else if(n.test(e))return n.name}return t&&tLine truncated
|
||||
//# sourceMappingURL=math.map
|
||||
Reference in new issue
Block a user