mathjs/dist/math.min.js
2013-09-03 20:19:14 +02:00

31 lines
155 KiB
JavaScript

/**
* 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 0.13.0
* @date 2013-09-03
*
* @license
* Copyright (C) 2013 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){if("function"==typeof bootstrap)bootstrap("math",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeMath=e}else"undefined"!=typeof window?window.math=e():global.math=e()}(function(){return function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);throw new Error("Cannot find module '"+s+"'")}var l=n[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return i(n?n:e)},l,l.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,n){n.options=e("./lib/options"),n.expression={},n.expression.node=e("./lib/expression/node/index.js"),n.expression.Scope=e("./lib/expression/Scope.js"),n.expression.Parser=e("./lib/expression/Parser.js"),n.expression.docs=e("./lib/expression/docs/index.js"),n.expr={},n.expr.Scope=function(){throw new Error("Moved to math.expression.Scope")},n.expr.Parser=function(){throw new Error("Moved to math.expression.Parser")},n.type={},n.type.Complex=e("./lib/type/Complex.js"),n.type.Range=e("./lib/type/Range.js"),n.type.Index=e("./lib/type/Index.js"),n.type.Matrix=e("./lib/type/Matrix.js"),n.type.Unit=e("./lib/type/Unit.js"),n.type.Help=e("./lib/type/Help.js"),n.collection=e("./lib/type/collection.js"),e("./lib/function/expression/eval.js")(n),e("./lib/function/expression/help.js")(n),e("./lib/function/expression/parse.js")(n),e("./lib/function/arithmetic/abs.js")(n),e("./lib/function/arithmetic/add.js")(n),e("./lib/function/arithmetic/add.js")(n),e("./lib/function/arithmetic/ceil.js")(n),e("./lib/function/arithmetic/cube.js")(n),e("./lib/function/arithmetic/divide.js")(n),e("./lib/function/arithmetic/edivide.js")(n),e("./lib/function/arithmetic/emultiply.js")(n),e("./lib/function/arithmetic/epow.js")(n),e("./lib/function/arithmetic/equal.js")(n),e("./lib/function/arithmetic/exp.js")(n),e("./lib/function/arithmetic/fix.js")(n),e("./lib/function/arithmetic/floor.js")(n),e("./lib/function/arithmetic/gcd.js")(n),e("./lib/function/arithmetic/larger.js")(n),e("./lib/function/arithmetic/largereq.js")(n),e("./lib/function/arithmetic/lcm.js")(n),e("./lib/function/arithmetic/log.js")(n),e("./lib/function/arithmetic/log10.js")(n),e("./lib/function/arithmetic/mod.js")(n),e("./lib/function/arithmetic/multiply.js")(n),e("./lib/function/arithmetic/pow.js")(n),e("./lib/function/arithmetic/round.js")(n),e("./lib/function/arithmetic/sign.js")(n),e("./lib/function/arithmetic/smaller.js")(n),e("./lib/function/arithmetic/smallereq.js")(n),e("./lib/function/arithmetic/sqrt.js")(n),e("./lib/function/arithmetic/square.js")(n),e("./lib/function/arithmetic/subtract.js")(n),e("./lib/function/arithmetic/unary.js")(n),e("./lib/function/arithmetic/unequal.js")(n),e("./lib/function/arithmetic/xgcd.js")(n),e("./lib/function/complex/arg.js")(n),e("./lib/function/complex/conj.js")(n),e("./lib/function/complex/re.js")(n),e("./lib/function/complex/im.js")(n),e("./lib/function/construction/boolean.js")(n),e("./lib/function/construction/complex.js")(n),e("./lib/function/construction/index.js")(n),e("./lib/function/construction/matrix.js")(n),e("./lib/function/construction/number.js")(n),e("./lib/function/construction/parser.js")(n),e("./lib/function/construction/string.js")(n),e("./lib/function/construction/unit.js")(n),e("./lib/function/matrix/concat.js")(n),e("./lib/function/matrix/det.js")(n),e("./lib/function/matrix/diag.js")(n),e("./lib/function/matrix/eye.js")(n),e("./lib/function/matrix/inv.js")(n),e("./lib/function/matrix/ones.js")(n),e("./lib/function/matrix/range.js")(n),e("./lib/function/matrix/size.js")(n),e("./lib/function/matrix/squeeze.js")(n),e("./lib/function/matrix/subset.js")(n),e("./lib/function/matrix/transpose.js")(n),e("./lib/function/matrix/zeros.js")(n),e("./lib/function/probability/factorial.js")(n),e("./lib/function/probability/random.js")(n),e("./lib/function/statistics/min.js")(n),e("./lib/function/statistics/max.js")(n),e("./lib/function/trigonometry/acos.js")(n),e("./lib/function/trigonometry/asin.js")(n),e("./lib/function/trigonometry/atan.js")(n),e("./lib/function/trigonometry/atan2.js")(n),e("./lib/function/trigonometry/cos.js")(n),e("./lib/function/trigonometry/cot.js")(n),e("./lib/function/trigonometry/csc.js")(n),e("./lib/function/trigonometry/sec.js")(n),e("./lib/function/trigonometry/sin.js")(n),e("./lib/function/trigonometry/tan.js")(n),e("./lib/function/units/in.js")(n),e("./lib/function/utils/clone.js")(n),e("./lib/function/utils/format.js")(n),e("./lib/function/utils/import.js")(n),e("./lib/function/utils/select.js")(n),e("./lib/function/utils/typeof.js")(n),e("./lib/function/utils/map.js")(n),e("./lib/function/utils/forEach.js")(n),e("./lib/constants.js")(n),n.chaining={},n.chaining.Selector=e("./lib/chaining/Selector.js")(n),n.expr.Selector=function(){throw new Error("Moved to math.expression.Selector")}},{"./lib/chaining/Selector.js":2,"./lib/constants.js":3,"./lib/expression/Parser.js":4,"./lib/expression/Scope.js":5,"./lib/expression/docs/index.js":100,"./lib/expression/node/index.js":113,"./lib/function/arithmetic/abs.js":114,"./lib/function/arithmetic/add.js":115,"./lib/function/arithmetic/ceil.js":116,"./lib/function/arithmetic/cube.js":117,"./lib/function/arithmetic/divide.js":118,"./lib/function/arithmetic/edivide.js":119,"./lib/function/arithmetic/emultiply.js":120,"./lib/function/arithmetic/epow.js":121,"./lib/function/arithmetic/equal.js":122,"./lib/function/arithmetic/exp.js":123,"./lib/function/arithmetic/fix.js":124,"./lib/function/arithmetic/floor.js":125,"./lib/function/arithmetic/gcd.js":126,"./lib/function/arithmetic/larger.js":127,"./lib/function/arithmetic/largereq.js":128,"./lib/function/arithmetic/lcm.js":129,"./lib/function/arithmetic/log.js":130,"./lib/function/arithmetic/log10.js":131,"./lib/function/arithmetic/mod.js":132,"./lib/function/arithmetic/multiply.js":133,"./lib/function/arithmetic/pow.js":134,"./lib/function/arithmetic/round.js":135,"./lib/function/arithmetic/sign.js":136,"./lib/function/arithmetic/smaller.js":137,"./lib/function/arithmetic/smallereq.js":138,"./lib/function/arithmetic/sqrt.js":139,"./lib/function/arithmetic/square.js":140,"./lib/function/arithmetic/subtract.js":141,"./lib/function/arithmetic/unary.js":142,"./lib/function/arithmetic/unequal.js":143,"./lib/function/arithmetic/xgcd.js":144,"./lib/function/complex/arg.js":145,"./lib/function/complex/conj.js":146,"./lib/function/complex/im.js":147,"./lib/function/complex/re.js":148,"./lib/function/construction/boolean.js":149,"./lib/function/construction/complex.js":150,"./lib/function/construction/index.js":151,"./lib/function/construction/matrix.js":152,"./lib/function/construction/number.js":153,"./lib/function/construction/parser.js":154,"./lib/function/construction/string.js":155,"./lib/function/construction/unit.js":156,"./lib/function/expression/eval.js":157,"./lib/function/expression/help.js":158,"./lib/function/expression/parse.js":159,"./lib/function/matrix/concat.js":160,"./lib/function/matrix/det.js":161,"./lib/function/matrix/diag.js":162,"./lib/function/matrix/eye.js":163,"./lib/function/matrix/inv.js":164,"./lib/function/matrix/ones.js":165,"./lib/function/matrix/range.js":166,"./lib/function/matrix/size.js":167,"./lib/function/matrix/squeeze.js":168,"./lib/function/matrix/subset.js":169,"./lib/function/matrix/transpose.js":170,"./lib/function/matrix/zeros.js":171,"./lib/function/probability/factorial.js":172,"./lib/function/probability/random.js":173,"./lib/function/statistics/max.js":174,"./lib/function/statistics/min.js":175,"./lib/function/trigonometry/acos.js":176,"./lib/function/trigonometry/asin.js":177,"./lib/function/trigonometry/atan.js":178,"./lib/function/trigonometry/atan2.js":179,"./lib/function/trigonometry/cos.js":180,"./lib/function/trigonometry/cot.js":181,"./lib/function/trigonometry/csc.js":182,"./lib/function/trigonometry/sec.js":183,"./lib/function/trigonometry/sin.js":184,"./lib/function/trigonometry/tan.js":185,"./lib/function/units/in.js":186,"./lib/function/utils/clone.js":187,"./lib/function/utils/forEach.js":188,"./lib/function/utils/format.js":189,"./lib/function/utils/import.js":190,"./lib/function/utils/map.js":191,"./lib/function/utils/select.js":192,"./lib/function/utils/typeof.js":193,"./lib/options":194,"./lib/type/Complex.js":195,"./lib/type/Help.js":196,"./lib/type/Index.js":197,"./lib/type/Matrix.js":198,"./lib/type/Range.js":199,"./lib/type/Unit.js":200,"./lib/type/collection.js":201}],2:[function(e,t){t.exports=function(t){function n(e){if(!(this instanceof n))throw new SyntaxError("Selector constructor must be called with the new operator");this.value=e instanceof n?e.value:e}function r(e,t){var r=Array.prototype.slice;n.prototype[e]="function"==typeof t?function(){var e=[this.value].concat(r.call(arguments,0));return new n(t.apply(this,e))}:new n(t)}var i=e("../util/index.js"),o=i.string;n.prototype={done:function(){return this.value},get:function(){throw new Error("Selector.get is removed. Use Selector.subset(index) instead.")},set:function(){throw new Error("Selector.set is removed. Use Selector.subset(index, replacement) instead.")},valueOf:function(){return this.value},toString:function(){return o.format(this.value)}},n.createProxy=r;for(var s in t)t.hasOwnProperty(s)&&s&&r(s,t[s]);return i.types.addType("selector",n),n}},{"../util/index.js":205}],3:[function(e,t){t.exports=function(t){var n=e("./type/Complex.js");t.pi=Math.PI,t.e=Math.E,t.tau=2*Math.PI,t.i=new n(0,1),t.Infinity=1/0,t.NaN=0/0,t["true"]=!0,t["false"]=!1,t.E=Math.E,t.LN2=Math.LN2,t.LN10=Math.LN10,t.LOG2E=Math.LOG2E,t.LOG10E=Math.LOG10E,t.PI=Math.PI,t.SQRT1_2=Math.SQRT1_2,t.SQRT2=Math.SQRT2}},{"./type/Complex.js":195}],4:[function(e,t){function n(e){if(!(this instanceof n))throw new SyntaxError("Parser constructor must be called with the new operator");this.math=e,this.scope=new r(e)}var r=e("./Scope.js");n.prototype.parse=function(e){return this.math.parse(e,this.scope)},n.prototype.eval=function(e){var t=this.math.parse(e,this.scope);return t.eval()},n.prototype.get=function(e){return this.scope.get(e)},n.prototype.set=function(e,t){return this.scope.set(e,t)},n.prototype.remove=function(e){this.scope.remove(e)},n.prototype.clear=function(){this.scope.clear()},t.exports=n},{"./Scope.js":5}],5:[function(e,t){function n(e,t,r){this.math=e,this.parentScope=null,this.subScopes=null,this.symbols={},this.cache={},t&&(t instanceof n?this.parentScope=t:t instanceof Object&&(this.symbols=t)),r&&r instanceof Object&&(this.symbols=r)}var r=e("../type/Unit.js");n.prototype={createSubScope:function(){var e=new n(this.math,this);return this.subScopes||(this.subScopes=[]),this.subScopes.push(e),e},get:function(e){var t;if(t=this.symbols[e],void 0!==t)return t;var n=this.cache[e];if(n)return n[e];for(var i=this.parentScope;i;){if(t=i.symbols[e],void 0!==t)return this.cache[e]=i.symbols,t;i=i.parentScope}return t=this.math[e],void 0!==t?(this.cache[e]=this.math,t):r.isPlainUnit(e)?(t=new r(null,e),this.cache[e]={},this.cache[e][e]=t,t):void 0},has:function(e){return void 0!==this.symbols[e]},set:function(e,t){return this.symbols[e]=t},remove:function(e){delete this.symbols[e]},clear:function(){var e=this.symbols;for(var t in e)e.hasOwnProperty(t)&&delete e[t];if(this.subScopes)for(var n=this.subScopes,r=0,i=n.length;i>r;r++)n[r].clear();this.clearCache()},clearCache:function(){this.cache={}}},n.context=[],t.exports=n},{"../type/Unit.js":200}],6:[function(e,t){t.exports={name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]}},{}],7:[function(e,t){t.exports={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]}},{}],8:[function(e,t){t.exports={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]}},{}],9:[function(e,t){t.exports={name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]}},{}],10:[function(e,t){t.exports={name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]}},{}],11:[function(e,t){t.exports={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]}},{}],12:[function(e,t){t.exports={name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]}},{}],13:[function(e,t){t.exports={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]}},{}],14:[function(e,t){t.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"]}},{}],15:[function(e,t){t.exports={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]}},{}],16:[function(e,t){t.exports={name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]}},{}],17:[function(e,t){t.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"]}},{}],18:[function(e,t){t.exports={name:"tau",category:"Constants",syntax:["pi"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]}},{}],19:[function(e,t){t.exports={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]}},{}],20:[function(e,t){t.exports={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]}},{}],21:[function(e,t){t.exports={name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["2.1 + 3.6","ans - 3.6","3 + 2i",'"hello" + " world"',"3 cm + 2 inch"],seealso:["subtract"]}},{}],22:[function(e,t){t.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"]}},{}],23:[function(e,t){t.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"]}},{}],24:[function(e,t){t.exports={name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["2 / 3","ans * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]}},{}],25:[function(e,t){t.exports={name:"edivide",category:"Operators",syntax:["x ./ y","edivide(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","emultiply","divide"]}},{}],26:[function(e,t){t.exports={name:"emultiply",category:"Operators",syntax:["x .* y","emultiply(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","edivide"]}},{}],27:[function(e,t){t.exports={name:"epow",category:"Operators",syntax:["x .^ y","epow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]}},{}],28:[function(e,t){t.exports={name:"equal",category:"Operators",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns 1 if the values are equal, and 0 if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallereq","largereq"]}},{}],29:[function(e,t){t.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:["square","multiply","log"]}},{}],30:[function(e,t){t.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"]}},{}],31:[function(e,t){t.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"]}},{}],32:[function(e,t){t.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"]}},{}],33:[function(e,t){t.exports={name:"larger",category:"Operators",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns 1 if x is larger than y, and 0 if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallereq","largereq"]}},{}],34:[function(e,t){t.exports={name:"largereq",category:"Operators",syntax:["x >= y","largereq(x, y)"],description:"Check if value x is larger or equal to y. Returns 1 if x is larger or equal to y, and 0 if not.",examples:["2 > 1+1","2 >= 1+1","a = 3.2","b = 6-2.8","(a > b)"],seealso:["equal","unequal","smallereq","smaller","largereq"]}},{}],35:[function(e,t){t.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"]}},{}],36:[function(e,t){t.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 ^ 3","log(1000, 10)","log(1000) / log(10)","b = logb(1024, 2)","2 ^ b"],seealso:["exp","log10"]}},{}],37:[function(e,t){t.exports={name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(1000)","10 ^ 3","log10(0.01)","log(1000) / log(10)","log(1000, 10)"],seealso:["exp","log"]}},{}],38:[function(e,t){t.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:[]}},{}],39:[function(e,t){t.exports={name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["2.1 * 3.6","ans / 3.6","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]}},{}],40:[function(e,t){t.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:["unequal","smaller","larger","smallereq","largereq"]}},{}],41:[function(e,t){t.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"]}},{}],42:[function(e,t){t.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"]}},{}],43:[function(e,t){t.exports={name:"smaller",category:"Operators",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns 1 if x is smaller than y, and 0 if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallereq","largereq"]}},{}],44:[function(e,t){t.exports={name:"smallereq",category:"Operators",syntax:["x <= y","smallereq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns 1 if x is smaller than y, and 0 if not.",examples:["2 < 1+1","2 <= 1+1","a = 3.2","b = 6-2.8","(a < b)"],seealso:["equal","unequal","larger","smaller","largereq"]}},{}],45:[function(e,t){t.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"]}},{}],46:[function(e,t){t.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"]}},{}],47:[function(e,t){t.exports={name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["5.3 - 2","ans + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]}},{}],48:[function(e,t){t.exports={name:"unary",category:"Operators",syntax:["-x","unary(x)"],description:"Inverse the sign of a value.",examples:["-4.5","-(-5.6)"],seealso:["add","subtract"]}},{}],49:[function(e,t){t.exports={name:"unequal",category:"Operators",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns 1 if the values are unequal, and 0 if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallereq","largereq"]}},{}],50:[function(e,t){t.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"]}},{}],51:[function(e,t){t.exports={name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 - 3i)"],seealso:["re","im","conj","abs"]}},{}],52:[function(e,t){t.exports={name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]}},{}],53:[function(e,t){t.exports={name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]}},{}],54:[function(e,t){t.exports={name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]}},{}],55:[function(e,t){t.exports={name:"boolean",category:"Type",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["complex","index","matrix","number","string","unit"]}},{}],56:[function(e,t){t.exports={name:"complex",category:"Type",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["boolean","index","matrix","number","string","unit"]}},{}],57:[function(e,t){t.exports={name:"index",category:"Type",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["[]","[1, 2, 3]","A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[0:2, 0:2] = ones(2, 2)"],seealso:["boolean","complex","matrix,","number","range","string","unit"]}},{}],58:[function(e,t){t.exports={name:"matrix",category:"Type",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()","matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])"],seealso:["boolean","complex","index","number","string","unit"]}},{}],59:[function(e,t){t.exports={name:"number",category:"Type",syntax:["x","number(x)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])"],seealso:["boolean","complex","index","matrix","string","unit"]}},{}],60:[function(e,t){t.exports={name:"string",category:"Type",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["boolean","complex","index","matrix","number","unit"]}},{}],61:[function(e,t){t.exports={name:"unit",category:"Type",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["boolean","complex","index","matrix","number","string"]}},{}],62:[function(e,t){t.exports={name:"eval",category:"Expression",syntax:["eval(expression)","eval([expr1, expr2, expr3, ...])"],description:"Evaluate an expression or an array with expressions.",examples:['eval("2 + 3")','eval("sqrt(" + 4 + ")")'],seealso:[]}},{}],63:[function(e,t){t.exports={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]}},{}],64:[function(e,t){t.exports={name:"concat",category:"Matrix",syntax:["concat(a, b, c, ...)","concat(a, b, c, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the first dimension. The dimension on which to concatenate can be provided as last argument.",examples:["a = [1, 2; 5, 6]","b = [3, 4; 7, 8]","concat(a, b)","[a, b]","concat(a, b, 2)","[a; b]"],seealso:["det","diag","eye","inv","ones","range","size","squeeze","subset","transpose","zeros"]}},{}],65:[function(e,t){t.exports={name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","eye","inv","ones","range","size","squeeze","subset","transpose","zeros"]}},{}],66:[function(e,t){t.exports={name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned.When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","eye","inv","ones","range","size","squeeze","subset","transpose","zeros"]}},{}],67:[function(e,t){t.exports={name:"eye",category:"Matrix",syntax:["eye(n)","eye(m, n)","eye([m, n])","eye"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["eye(3)","eye(3, 5)","a = [1, 2, 3; 4, 5, 6]","eye(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","transpose","zeros"]}},{}],68:[function(e,t){t.exports={name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","eye","ones","range","size","squeeze","subset","transpose","zeros"]}},{}],69:[function(e,t){t.exports={name:"ones",category:"Matrix",syntax:["ones(n)","ones(m, n)","ones(m, n, p, ...)","ones([m, n])","ones([m, n, p, ...])","ones"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","eye","inv","range","size","squeeze","subset","transpose","zeros"]}},{}],70:[function(e,t){t.exports={name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"a = [1, 2, 3, 4; 5, 6, 7, 8]","a(1:2, 1:2)"],seealso:["concat","det","diag","eye","inv","ones","size","squeeze","subset","transpose","zeros"]}},{}],71:[function(e,t){t.exports={name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","det","diag","eye","inv","ones","range","squeeze","subset","transpose","zeros"]}},{}],72:[function(e,t){t.exports={name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove singleton dimensions from a matrix.",examples:["a = zeros(1,3,2)","size(squeeze(a))","b = zeros(3,1,1)","size(squeeze(b))"],seealso:["concat","det","diag","eye","inv","ones","range","size","subset","transpose","zeros"]}},{}],73:[function(e,t){t.exports={name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of a matrix or string. Indexes are one-based. Both the ranges lower-bound and upper-bound are included.",examples:["d = [1, 2; 3, 4]","e = []","e(1, 1:2) = [5, 6]","e(2, :) = [7, 8]","f = d * e","f(2, 1)","f(:, 1)"],seealso:["concat","det","diag","eye","inv","ones","range","size","squeeze","transpose","zeros"]}},{}],74:[function(e,t){t.exports={name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","eye","inv","ones","range","size","squeeze","subset","zeros"]}},{}],75:[function(e,t){t.exports={name:"zeros",category:"Matrix",syntax:["zeros(n)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m, n])","zeros([m, n, p, ...])","zeros"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","eye","inv","ones","range","size","squeeze","subset","transpose"]}},{}],76:[function(e,t){t.exports={name:"distribution",category:"Probability",syntax:["distribution(name)","distribution(name, arg1, arg2, ...)"],description:'Create a distribution object of a specific type. A distribution object contains functions `random([size,] [min,] [max])`, `randomInt([size,] [min,] [max])`, and `pickRandom(array)`. Available types of distributions: "uniform", "normal". Note that the function distribution is currently not available via the expression parser.',examples:[],seealso:["random","randomInt"]}
},{}],77:[function(e,t){t.exports={name:"factorial",category:"Probability",syntax:["x!","factorial(x)"],description:"Compute the factorial of a value",examples:["5!","5*4*3*2*1","3!"],seealso:[]}},{}],78:[function(e,t){t.exports={name:"pickRandom",category:"Probability",syntax:["pickRandom(array)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])"],seealso:["distribution","random","randomInt"]}},{}],79:[function(e,t){t.exports={name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["distribution","pickRandom","randomInt"]}},{}],80:[function(e,t){t.exports={name:"randInt",category:"Probability",syntax:["randInt()","randInt(max)","randInt(min, max)","randInt(size)","randInt(size, max)","randInt(size, min, max)"],description:"Return a random integer number",examples:["randInt()","randInt(10, 20)","randInt([2, 3], 10)"],seealso:["distribution","pickRandom","random"]}},{}],81:[function(e,t){t.exports={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["min"]}},{}],82:[function(e,t){t.exports={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max"]}},{}],83:[function(e,t){t.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","acos","asin"]}},{}],84:[function(e,t){t.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","asin"]}},{}],85:[function(e,t){t.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"]}},{}],86:[function(e,t){t.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"]}},{}],87:[function(e,t){t.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"]}},{}],88:[function(e,t){t.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"]}},{}],89:[function(e,t){t.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"]}},{}],90:[function(e,t){t.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"]}},{}],91:[function(e,t){t.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"]}},{}],92:[function(e,t){t.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"]}},{}],93:[function(e,t){t.exports={name:"in",category:"Units",syntax:["x in unit","in(x, unit)"],description:"Change the unit of a value.",examples:["5 inch in cm","3.2kg in g","16 bytes in bits"],seealso:[]}},{}],94:[function(e,t){t.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:[]}},{}],95:[function(e,t){t.exports={name:"forEach",category:"Utils",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback.",examples:["forEach([1, 2, 3], function(val) { console.log(val) })"],seealso:[]}},{}],96:[function(e,t){t.exports={name:"format",category:"Utils",syntax:["format(value)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])"],seealso:[]}},{}],97:[function(e,t){t.exports={name:"import",category:"Utils",syntax:["import(string)"],description:"Import functions from a file.",examples:['import("numbers")','import("./mylib.js")'],seealso:[]}},{}],98:[function(e,t){t.exports={name:"map",category:"Utils",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], function(val) { return math.max(val, 1.5) })"],seealso:[]}},{}],99:[function(e,t){t.exports={name:"typeof",category:"Utils",syntax:["typeof(x)"],description:"Get the type of a variable.",examples:["typeof(3.5)","typeof(2 - 4i)","typeof(45 deg)",'typeof("hello world")'],seealso:[]}},{}],100:[function(e,t,n){n.e=e("./constants/e.js"),n.E=e("./constants/e.js"),n["false"]=e("./constants/false.js"),n.i=e("./constants/i.js"),n.Infinity=e("./constants/Infinity.js"),n.LN2=e("./constants/LN2.js"),n.LN10=e("./constants/LN10.js"),n.LOG2E=e("./constants/LOG2E.js"),n.LOG10E=e("./constants/LOG10E.js"),n.NaN=e("./constants/NaN.js"),n.pi=e("./constants/pi.js"),n.PI=e("./constants/pi.js"),n.SQRT1_2=e("./constants/SQRT1_2.js"),n.SQRT2=e("./constants/SQRT2.js"),n.tau=e("./constants/tau.js"),n["true"]=e("./constants/true.js"),n.abs=e("./function/arithmetic/abs.js"),n.add=e("./function/arithmetic/add.js"),n.ceil=e("./function/arithmetic/ceil.js"),n.cube=e("./function/arithmetic/cube.js"),n.divide=e("./function/arithmetic/divide.js"),n.edivide=e("./function/arithmetic/edivide.js"),n.emultiply=e("./function/arithmetic/emultiply.js"),n.epow=e("./function/arithmetic/epow.js"),n.equal=e("./function/arithmetic/equal.js"),n.exp=e("./function/arithmetic/exp.js"),n.fix=e("./function/arithmetic/fix.js"),n.floor=e("./function/arithmetic/floor.js"),n.gcd=e("./function/arithmetic/gcd.js"),n.larger=e("./function/arithmetic/larger.js"),n.largereq=e("./function/arithmetic/largereq.js"),n.lcm=e("./function/arithmetic/lcm.js"),n.log=e("./function/arithmetic/log.js"),n.log10=e("./function/arithmetic/log10.js"),n.mod=e("./function/arithmetic/mod.js"),n.multiply=e("./function/arithmetic/multiply.js"),n.pow=e("./function/arithmetic/pow.js"),n.round=e("./function/arithmetic/round.js"),n.sign=e("./function/arithmetic/sign.js"),n.smaller=e("./function/arithmetic/smaller.js"),n.smallereq=e("./function/arithmetic/smallereq.js"),n.sqrt=e("./function/arithmetic/sqrt.js"),n.square=e("./function/arithmetic/square.js"),n.subtract=e("./function/arithmetic/subtract.js"),n.unary=e("./function/arithmetic/unary.js"),n.unequal=e("./function/arithmetic/unequal.js"),n.xgcd=e("./function/arithmetic/xgcd.js"),n.arg=e("./function/complex/arg.js"),n.conj=e("./function/complex/conj.js"),n.re=e("./function/complex/re.js"),n.im=e("./function/complex/im.js"),n.boolean=e("./function/construction/boolean.js"),n.complex=e("./function/construction/complex.js"),n.index=e("./function/construction/index.js"),n.matrix=e("./function/construction/matrix.js"),n.number=e("./function/construction/number.js"),n.string=e("./function/construction/string.js"),n.unit=e("./function/construction/unit.js"),n.eval=e("./function/expression/eval.js"),n.help=e("./function/expression/help.js"),n.concat=e("./function/matrix/concat.js"),n.det=e("./function/matrix/det.js"),n.diag=e("./function/matrix/diag.js"),n.eye=e("./function/matrix/eye.js"),n.inv=e("./function/matrix/inv.js"),n.ones=e("./function/matrix/ones.js"),n.range=e("./function/matrix/range.js"),n.size=e("./function/matrix/size.js"),n.squeeze=e("./function/matrix/squeeze.js"),n.subset=e("./function/matrix/subset.js"),n.transpose=e("./function/matrix/transpose.js"),n.zeros=e("./function/matrix/zeros.js"),n.factorial=e("./function/probability/factorial.js"),n.distribution=e("./function/probability/distribution.js"),n.pickRandom=e("./function/probability/pickRandom.js"),n.random=e("./function/probability/random.js"),n.randomInt=e("./function/probability/randomInt.js"),n.min=e("./function/statistics/min.js"),n.max=e("./function/statistics/max.js"),n.acos=e("./function/trigonometry/acos.js"),n.asin=e("./function/trigonometry/asin.js"),n.atan=e("./function/trigonometry/atan.js"),n.atan2=e("./function/trigonometry/atan2.js"),n.cos=e("./function/trigonometry/cos.js"),n.cot=e("./function/trigonometry/cot.js"),n.csc=e("./function/trigonometry/csc.js"),n.sec=e("./function/trigonometry/sec.js"),n.sin=e("./function/trigonometry/sin.js"),n.tan=e("./function/trigonometry/tan.js"),n["in"]=e("./function/units/in.js"),n.clone=e("./function/utils/clone.js"),n.map=e("./function/utils/map.js"),n.forEach=e("./function/utils/forEach.js"),n.format=e("./function/utils/format.js"),n["import"]=e("./function/utils/import.js"),n["typeof"]=e("./function/utils/typeof.js")},{"./constants/Infinity.js":6,"./constants/LN10.js":7,"./constants/LN2.js":8,"./constants/LOG10E.js":9,"./constants/LOG2E.js":10,"./constants/NaN.js":11,"./constants/SQRT1_2.js":12,"./constants/SQRT2.js":13,"./constants/e.js":14,"./constants/false.js":15,"./constants/i.js":16,"./constants/pi.js":17,"./constants/tau.js":18,"./constants/true.js":19,"./function/arithmetic/abs.js":20,"./function/arithmetic/add.js":21,"./function/arithmetic/ceil.js":22,"./function/arithmetic/cube.js":23,"./function/arithmetic/divide.js":24,"./function/arithmetic/edivide.js":25,"./function/arithmetic/emultiply.js":26,"./function/arithmetic/epow.js":27,"./function/arithmetic/equal.js":28,"./function/arithmetic/exp.js":29,"./function/arithmetic/fix.js":30,"./function/arithmetic/floor.js":31,"./function/arithmetic/gcd.js":32,"./function/arithmetic/larger.js":33,"./function/arithmetic/largereq.js":34,"./function/arithmetic/lcm.js":35,"./function/arithmetic/log.js":36,"./function/arithmetic/log10.js":37,"./function/arithmetic/mod.js":38,"./function/arithmetic/multiply.js":39,"./function/arithmetic/pow.js":40,"./function/arithmetic/round.js":41,"./function/arithmetic/sign.js":42,"./function/arithmetic/smaller.js":43,"./function/arithmetic/smallereq.js":44,"./function/arithmetic/sqrt.js":45,"./function/arithmetic/square.js":46,"./function/arithmetic/subtract.js":47,"./function/arithmetic/unary.js":48,"./function/arithmetic/unequal.js":49,"./function/arithmetic/xgcd.js":50,"./function/complex/arg.js":51,"./function/complex/conj.js":52,"./function/complex/im.js":53,"./function/complex/re.js":54,"./function/construction/boolean.js":55,"./function/construction/complex.js":56,"./function/construction/index.js":57,"./function/construction/matrix.js":58,"./function/construction/number.js":59,"./function/construction/string.js":60,"./function/construction/unit.js":61,"./function/expression/eval.js":62,"./function/expression/help.js":63,"./function/matrix/concat.js":64,"./function/matrix/det.js":65,"./function/matrix/diag.js":66,"./function/matrix/eye.js":67,"./function/matrix/inv.js":68,"./function/matrix/ones.js":69,"./function/matrix/range.js":70,"./function/matrix/size.js":71,"./function/matrix/squeeze.js":72,"./function/matrix/subset.js":73,"./function/matrix/transpose.js":74,"./function/matrix/zeros.js":75,"./function/probability/distribution.js":76,"./function/probability/factorial.js":77,"./function/probability/pickRandom.js":78,"./function/probability/random.js":79,"./function/probability/randomInt.js":80,"./function/statistics/max.js":81,"./function/statistics/min.js":82,"./function/trigonometry/acos.js":83,"./function/trigonometry/asin.js":84,"./function/trigonometry/atan.js":85,"./function/trigonometry/atan2.js":86,"./function/trigonometry/cos.js":87,"./function/trigonometry/cot.js":88,"./function/trigonometry/csc.js":89,"./function/trigonometry/sec.js":90,"./function/trigonometry/sin.js":91,"./function/trigonometry/tan.js":92,"./function/units/in.js":93,"./function/utils/clone.js":94,"./function/utils/forEach.js":95,"./function/utils/format.js":96,"./function/utils/import.js":97,"./function/utils/map.js":98,"./function/utils/typeof.js":99}],101:[function(e,t){function n(e,t,n){this.name=e,this.expr=t,this.scope=n}var r=e("./Node.js");n.prototype=new r,n.prototype.eval=function(){if(void 0===this.expr)throw new Error("Undefined symbol "+this.name);var e=this.expr.eval();return this.scope.set(this.name,e),e},n.prototype.find=function(e){var t=[];return this.match(e)&&t.push(this),this.expr&&(t=t.concat(this.expr.find(e))),t},n.prototype.toString=function(){return this.name+" = "+this.expr.toString()},t.exports=n},{"./Node.js":106}],102:[function(e,t){function n(){this.params=[],this.visible=[]}var r=e("./Node.js");n.prototype=new r,n.prototype.add=function(e,t){var n=this.params.length;this.params[n]=e,this.visible[n]=void 0!=t?t:!0},n.prototype.eval=function(){for(var e=[],t=0,n=this.params.length;n>t;t++){var r=this.params[t].eval();this.visible[t]&&e.push(r)}return e},n.prototype.find=function(e){var t=[];this.match(e)&&t.push(this);var n=this.params;if(n)for(var r=0,i=n.length;i>r;r++)t=t.concat(n[r].find(e));return t},n.prototype.toString=function(){for(var e=[],t=0,n=this.params.length;n>t;t++)this.visible[t]&&e.push("\n "+this.params[t].toString());return"["+e.join(",")+"\n]"},t.exports=n},{"./Node.js":106}],103:[function(e,t){function n(e){this.value=e}var r=e("./Node.js"),i=e("../../util/string.js");n.prototype=new r,n.prototype.eval=function(){return this.value},n.prototype.toString=function(){return i.format(this.value)},t.exports=n},{"../../util/string.js":208,"./Node.js":106}],104:[function(e,t){function n(e,t,n,r,o){this.name=e,this.variables=t,this.expr=n,this.scope=o,this.fn=function(){var o=t?t.length:0;if(arguments.length!=o)throw new i.ArgumentsError(e,arguments.length,o);for(var s=0;o>s;s++)r.set(t[s],arguments[s]);return n.eval()},this.fn.toString=function(){return e+"("+t.join(", ")+")"}}var r=e("./Node.js"),i=e("../../util/error.js");n.prototype=new r,n.prototype.eval=function(){return this.scope.set(this.name,this.fn),this.fn},n.prototype.find=function(e){var t=[];return this.match(e)&&t.push(this),this.expr&&(t=t.concat(this.expr.find(e))),t},n.prototype.toString=function(){return this.fn.toString()},t.exports=n},{"../../util/error.js":204,"./Node.js":106}],105:[function(e,t){function n(e){this.nodes=e||[]}function r(e){for(var t=[],n=e.length,r=0;n>r;r++){for(var i=e[r],s=i.length,a=null,l=null,c=0;s>c;c++){var f,p=o.clone(i[c]);if(p instanceof u){if(f=p.size(),p=p.valueOf(),1==f.length)p=[p],f=[1,f[0]];else if(f.length>2)throw new Error("Cannot merge a multi dimensional matrix")}else Array.isArray(p)?(f=[1,p.length],p=[p]):(f=[1,1],p=[[p]]);if(null==a)a=p,l=f[0];else{if(f[0]!=l)throw new Error("Dimension mismatch ("+f[0]+" != "+l+")");for(var m=0;l>m;m++)a[m]=a[m].concat(p[m])}}t=t.concat(a)}return t}var i=e("./Node.js"),o=e("../../util/object.js"),s=e("../../util/string.js"),a=e("../../type/collection.js"),u=e("../../type/Matrix.js");n.prototype=new i,n.prototype.eval=function(){for(var e=this.nodes,t=[],n=!1,i=0,o=e.length;o>i;i++){for(var s=e[i],l=[],c=0,f=s.length;f>c;c++){var p=s[c].eval();a.isCollection(p)&&(n=!0),l[c]=p}t[i]=l}return n&&(t=r(t)),new u(t)},n.prototype.find=function(e){var t=[];this.match(e)&&t.push(this);for(var n=this.nodes,r=0,i=n.length;i>r;r++)for(var o=n[r],s=0,a=o.length;a>s;s++)t=t.concat(o[s].find(e));return t},n.prototype.toString=function(){return s.format(this.nodes)},t.exports=n},{"../../type/Matrix.js":198,"../../type/collection.js":201,"../../util/object.js":207,"../../util/string.js":208,"./Node.js":106}],106:[function(e,t){function n(){}n.prototype.eval=function(){throw new Error("Cannot evaluate a Node interface")},n.prototype.find=function(e){return this.match(e)?[this]:[]},n.prototype.match=function(e){var t=!0;if(e&&(!e.type||this instanceof e.type||(t=!1),t&&e.properties))for(var n in e.properties)if(e.properties.hasOwnProperty(n)&&this[n]!=e.properties[n]){t=!1;break}return t},n.prototype.toString=function(){return""},t.exports=n},{}],107:[function(e,t){function n(e,t,n){this.name=e,this.fn=t,this.params=n}var r=e("./Node.js");n.prototype=new r,n.prototype.eval=function(){return this.fn.apply(this,this.params.map(function(e){return e.eval()}))},n.prototype.find=function(e){var t=[];this.match(e)&&t.push(this);var n=this.params;if(n)for(var r=0,i=n.length;i>r;r++)t=t.concat(n[r].find(e));return t},n.prototype.toString=function(){var e=this.params;switch(e.length){case 1:return"-"==this.name?"-"+e[0].toString():e[0].toString()+this.name;case 2:var t=e[0].toString();e[0]instanceof n&&(t="("+t+")");var r=e[1].toString();return e[1]instanceof n&&(r="("+r+")"),t+" "+this.name+" "+r;default:return this.name+"("+this.params.join(", ")+")"}},t.exports=n},{"./Node.js":106}],108:[function(e,t){function n(e,t,n,r){if(this.math=e,this.object=t,this.params=n,this.paramScopes=r,this.hasContextParams=!1,n)for(var i={type:s,properties:{name:"end"}},o=0,a=n.length;a>o;o++)if(n[o].find(i).length>0){this.hasContextParams=!0;break}}var r=e("../../util/number.js"),i=e("./Node.js"),o=e("./RangeNode.js"),s=e("./SymbolNode.js"),a=e("../../type/Index.js"),u=e("../../type/Range.js"),l=r.isNumber;n.prototype=new i,n.prototype.eval=function(){var e,t,n,r,i=this.object;if(void 0==i)throw new Error("Node undefined");var s=i.eval();if(this.hasContextParams){var c=this.paramScopes,f=this.math.size(s).valueOf();if(c&&f)for(e=0,t=this.params.length;t>e;e++){var p=c[e];p&&p.set("end",f[e])}}if("function"==typeof s){for(n=this.params,r=[],e=0,t=this.params.length;t>e;e++)r[e]=n[e].eval();return s.apply(this,r)}for(n=this.params,r=[],e=0,t=this.params.length;t>e;e++){var m,h=n[e];if(m=h instanceof o?h.toRange():h.eval(),m instanceof u)m.start--,m.end--;else{if(!l(m))throw new TypeError("Number or Range expected");m--}r[e]=m}var x=a.create(r);return this.math.subset(s,x)},n.prototype.find=function(e){var t=[];this.match(e)&&t.push(this),this.object&&(t=t.concat(this.object.find(e)));var n=this.params;if(n)for(var r=0,i=n.length;i>r;r++)t=t.concat(n[r].find(e));return t},n.prototype.toString=function(){var e=this.object?this.object.toString():"";return this.params&&(e+="("+this.params.join(", ")+")"),e},t.exports=n},{"../../type/Index.js":197,"../../type/Range.js":199,"../../util/number.js":206,"./Node.js":106,"./RangeNode.js":109,"./SymbolNode.js":110}],109:[function(e,t){function n(e,t){if(this.math=e,this.start=null,this.end=null,this.step=null,2==t.length)this.start=t[0],this.end=t[1];else{if(3!=t.length)throw new SyntaxError("Wrong number of arguments");this.start=t[0],this.step=t[1],this.end=t[2]}}var r=e("./Node.js"),i=e("../../type/Range.js");n.prototype=new r,n.prototype.eval=function(){var e=this.start.eval(),t=this.step?this.step.eval():1,n=this.end.eval(),r=[],i=e;if(t>0)for(;n>=i;)r.push(i),i+=t;else if(0>t)for(;i>=n;)r.push(i),i+=t;return r},n.prototype.toRange=function(){var e=this.start.eval(),t=this.step?this.step.eval():1,n=this.end.eval();return n=this.math.add(n,t>0?1:-1),new i(e,n,t)},n.prototype.find=function(e){var t=[];return this.match(e)&&t.push(this),this.start&&(t=t.concat(this.start.find(e))),this.step&&(t=t.concat(this.step.find(e))),this.end&&(t=t.concat(this.end.find(e))),t},n.prototype.toString=function(){var e=this.start.toString();return this.step&&(e+=":"+this.step.toString()),e+=":"+this.end.toString()},t.exports=n},{"../../type/Range.js":199,"./Node.js":106}],110:[function(e,t){function n(e,t){this.name=e,this.scope=t}var r=e("./Node.js");n.prototype=new r,n.prototype.eval=function(){var e=this.scope.get(this.name);if(void 0===e)throw new Error("Undefined symbol "+this.name);return e},n.prototype.toString=function(){return this.name},t.exports=n},{"./Node.js":106}],111:[function(e,t){function n(e,t,n,r,i,o){this.math=e,this.name=t,this.params=n,this.paramScopes=r,this.expr=i,this.scope=o,this.hasContextParams=!1;for(var a={type:s,properties:{name:"end"}},u=0,l=n.length;l>u;u++)if(n[u].find(a).length>0){this.hasContextParams=!0;break}}var r=e("../../util/number.js"),i=e("./Node.js"),o=e("./RangeNode.js"),s=e("./SymbolNode.js"),a=e("../../type/Index.js"),u=e("../../type/Range.js"),l=r.isNumber;n.prototype=new i,n.prototype.eval=function(){if(void 0===this.expr)throw new Error("Undefined symbol "+this.name);var e,t=this.scope.get(this.name);if(void 0==t)throw new Error("Undefined symbol "+this.name);if(this.hasContextParams){var n=this.paramScopes,r=this.math.size(t).valueOf();if(n&&r)for(var i=0,s=this.params.length;s>i;i++){var c=n[i];c&&c.set("end",r[i])}}var f=[];this.params.forEach(function(e){var t;if(t=e instanceof o?e.toRange():e.eval(),t instanceof u)t.start--,t.end--;else{if(!l(t))throw new TypeError("Number or Range expected");t--}f.push(t)});var p=this.expr.eval(),m=a.create(f);return e=this.math.subset(t,m,p),this.scope.set(this.name,e),e},n.prototype.find=function(e){var t=[];this.match(e)&&t.push(this);var n=this.params;if(n)for(var r=0,i=n.length;i>r;r++)t=t.concat(n[r].find(e));return this.expr&&(t=t.concat(this.expr.find(e))),t},n.prototype.toString=function(){var e="";return e+=this.name,this.params&&this.params.length&&(e+="("+this.params.join(", ")+")"),e+=" = ",e+=this.expr.toString()},t.exports=n},{"../../type/Index.js":197,"../../type/Range.js":199,"../../util/number.js":206,"./Node.js":106,"./RangeNode.js":109,"./SymbolNode.js":110}],112:[function(){},{}],113:[function(e,t,n){n.AssignmentNode=e("./AssignmentNode.js"),n.BlockNode=e("./BlockNode.js"),n.ConstantNode=e("./ConstantNode.js"),n.FunctionNode=e("./FunctionNode.js"),n.MatrixNode=e("./MatrixNode.js"),n.Node=e("./Node.js"),n.OperatorNode=e("./OperatorNode.js"),n.ParamsNode=e("./ParamsNode.js"),n.RangeNode=e("./RangeNode.js"),n.SymbolNode=e("./SymbolNode.js"),n.UpdateNode=e("./UpdateNode.js"),n.handlers=e("./handlers.js")},{"./AssignmentNode.js":101,"./BlockNode.js":102,"./ConstantNode.js":103,"./FunctionNode.js":104,"./MatrixNode.js":105,"./Node.js":106,"./OperatorNode.js":107,"./ParamsNode.js":108,"./RangeNode.js":109,"./SymbolNode.js":110,"./UpdateNode.js":111,"./handlers.js":112}],114:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=(e("../../type/Matrix.js"),e("../../type/collection.js")),o=n.number.isNumBool,s=r.isComplex,a=i.isCollection;t.abs=function u(e){if(1!=arguments.length)throw new n.error.ArgumentsError("abs",arguments.length,1);if(o(e))return Math.abs(e);if(s(e))return Math.sqrt(e.re*e.re+e.im*e.im);if(a(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("abs",e)}}},{"../../type/Complex.js":195,"../../type/Matrix.js":198,"../../type/collection.js":201,"../../util/index.js":205}],115:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=(e("../../type/Matrix.js"),e("../../type/Unit.js")),o=e("../../type/collection.js"),s=n.number.isNumBool,a=n.string.isString,u=r.isComplex,l=i.isUnit,c=o.isCollection;t.add=function f(e,t){if(2!=arguments.length)throw new n.error.ArgumentsError("add",arguments.length,2);if(s(e)){if(s(t))return e+t;if(u(t))return new r(e+t.re,t.im)}else if(u(e)){if(s(t))return new r(e.re+t,e.im);if(u(t))return new r(e.re+t.re,e.im+t.im)}else if(l(e)&&l(t)){if(!e.equalBase(t))throw new Error("Units do not match");if(null==e.value)throw new Error("Unit on left hand side of operator + has an undefined value");if(null==t.value)throw new Error("Unit on right hand side of operator + has an undefined value");var i=e.clone();return i.value+=t.value,i.fixPrefix=!1,i}if(a(e)||a(t))return e+t;if(c(e)||c(t))return o.map2(e,t,f);if(e.valueOf()!==e||t.valueOf()!==t)return f(e.valueOf(),t.valueOf());throw new n.error.UnsupportedTypeError("add",e,t)}}},{"../../type/Complex.js":195,"../../type/Matrix.js":198,"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],116:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/collection.js"),o=n.number.isNumBool,s=i.isCollection,a=r.isComplex;t.ceil=function u(e){if(1!=arguments.length)throw new n.error.ArgumentsError("ceil",arguments.length,1);if(o(e))return Math.ceil(e);if(a(e))return new r(Math.ceil(e.re),Math.ceil(e.im));if(s(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("ceil",e)}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],117:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/collection.js"),o=n.number.isNumBool,s=r.isComplex,a=i.isCollection;t.cube=function u(e){if(1!=arguments.length)throw new n.error.ArgumentsError("cube",arguments.length,1);if(o(e))return e*e*e;if(s(e))return t.multiply(t.multiply(e,e),e);if(a(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("cube",e)}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],118:[function(e,t){t.exports=function(t){function n(e,t){var n=t.re*t.re+t.im*t.im;return 0!=n?new i((e.re*t.re+e.im*t.im)/n,(e.im*t.re-e.re*t.im)/n):new i(0!=e.re?e.re/0:0,0!=e.im?e.im/0:0)}var r=e("../../util/index.js"),i=e("../../type/Complex.js"),o=(e("../../type/Matrix.js"),e("../../type/Unit.js")),s=e("../../type/collection.js"),a=r.number.isNumBool,u=i.isComplex,l=o.isUnit,c=s.isCollection;t.divide=function f(e,o){if(2!=arguments.length)throw new r.error.ArgumentsError("divide",arguments.length,2);if(a(e)){if(a(o))return e/o;if(u(o))return n(new i(e,0),o)}if(u(e)){if(a(o))return n(e,new i(o,0));if(u(o))return n(e,o)}if(l(e)&&a(o)){var p=e.clone();return p.value/=o,p}if(c(e))return c(o)?t.multiply(e,t.inv(o)):s.map2(e,o,f);if(c(o))return t.multiply(e,t.inv(o));if(e.valueOf()!==e||o.valueOf()!==o)return f(e.valueOf(),o.valueOf());throw new r.error.UnsupportedTypeError("divide",e,o)}}},{"../../type/Complex.js":195,"../../type/Matrix.js":198,"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],119:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/collection.js");t.edivide=function(e,i){if(2!=arguments.length)throw new n.error.ArgumentsError("edivide",arguments.length,2);return r.deepMap2(e,i,t.divide)}}},{"../../type/collection.js":201,"../../util/index.js":205}],120:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/collection.js");t.emultiply=function(e,i){if(2!=arguments.length)throw new n.error.ArgumentsError("emultiply",arguments.length,2);return r.deepMap2(e,i,t.multiply)}}},{"../../type/collection.js":201,"../../util/index.js":205}],121:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/collection.js");t.epow=function(e,i){if(2!=arguments.length)throw new n.error.ArgumentsError("epow",arguments.length,2);return r.deepMap2(e,i,t.pow)}}},{"../../type/collection.js":201,"../../util/index.js":205}],122:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/Unit.js"),o=e("../../type/collection.js"),s=n.number.isNumBool,a=n.string.isString,u=r.isComplex,l=i.isUnit,c=o.isCollection;t.equal=function f(e,t){if(2!=arguments.length)throw new n.error.ArgumentsError("equal",arguments.length,2);if(s(e)){if(s(t))return e==t;if(u(t))return e==t.re&&0==t.im}if(u(e)){if(s(t))return e.re==t&&0==e.im;if(u(t))return e.re==t.re&&e.im==t.im}if(l(e)&&l(t)){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return e.value==t.value}if(a(e)||a(t))return e==t;if(c(e)||c(t))return o.map2(e,t,f);if(e.valueOf()!==e||t.valueOf()!==t)return f(e.valueOf(),t.valueOf());throw new n.error.UnsupportedTypeError("equal",e,t)}}},{"../../type/Complex.js":195,"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],123:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=(e("../../type/Matrix.js"),e("../../type/collection.js")),o=n.number.isNumBool,s=r.isComplex,a=i.isCollection;t.exp=function u(e){if(1!=arguments.length)throw new n.error.ArgumentsError("exp",arguments.length,1);if(o(e))return Math.exp(e);if(s(e)){var t=Math.exp(e.re);return new r(t*Math.cos(e.im),t*Math.sin(e.im))}if(a(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("exp",e)}}},{"../../type/Complex.js":195,"../../type/Matrix.js":198,"../../type/collection.js":201,"../../util/index.js":205}],124:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/collection.js"),o=n.number.isNumBool,s=r.isComplex,a=i.isCollection;t.fix=function u(e){if(1!=arguments.length)throw new n.error.ArgumentsError("fix",arguments.length,1);if(o(e))return e>0?Math.floor(e):Math.ceil(e);if(s(e))return new r(e.re>0?Math.floor(e.re):Math.ceil(e.re),e.im>0?Math.floor(e.im):Math.ceil(e.im));if(a(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("fix",e)}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],125:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/collection.js"),o=n.number.isNumBool,s=r.isComplex,a=i.isCollection;t.floor=function u(e){if(1!=arguments.length)throw new n.error.ArgumentsError("floor",arguments.length,1);if(o(e))return Math.floor(e);if(s(e))return new r(Math.floor(e.re),Math.floor(e.im));if(a(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("floor",e)}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],126:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/collection.js"),i=n.number.isNumBool,o=n.number.isInteger,s=r.isCollection;t.gcd=function a(){var e,t=arguments[0],u=arguments[1];if(2==arguments.length){if(i(t)&&i(u)){if(!o(t)||!o(u))throw new Error("Parameters in function gcd must be integer numbers");for(;0!=u;)e=t%u,t=u,u=e;return 0>t?-t:t}if(s(t)||s(u))return r.map2(t,u,a);if(t.valueOf()!==t||u.valueOf()!==u)return a(t.valueOf(),u.valueOf());throw new n.error.UnsupportedTypeError("gcd",t,u)}if(arguments.length>2){for(var l=1;l<arguments.length;l++)t=a(t,arguments[l]);return t}throw new SyntaxError("Function gcd expects two or more arguments")}}},{"../../type/collection.js":201,"../../util/index.js":205}],127:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/Unit.js"),o=e("../../type/collection.js"),s=n.number.isNumBool,a=n.string.isString,u=r.isComplex,l=i.isUnit,c=o.isCollection;t.larger=function f(e,r){if(2!=arguments.length)throw new n.error.ArgumentsError("larger",arguments.length,2);if(s(e)){if(s(r))return e>r;if(u(r))return e>t.abs(r)}if(u(e)){if(s(r))return t.abs(e)>r;if(u(r))return t.abs(e)>t.abs(r)}if(l(e)&&l(r)){if(!e.equalBase(r))throw new Error("Cannot compare units with different base");return e.value>r.value}if(a(e)||a(r))return e>r;if(c(e)||c(r))return o.map2(e,r,f);
if(e.valueOf()!==e||r.valueOf()!==r)return f(e.valueOf(),r.valueOf());throw new n.error.UnsupportedTypeError("larger",e,r)}}},{"../../type/Complex.js":195,"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],128:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/Unit.js"),o=e("../../type/collection.js"),s=n.number.isNumBool,a=n.string.isString,u=r.isComplex,l=i.isUnit,c=o.isCollection;t.largereq=function f(e,r){if(2!=arguments.length)throw new n.error.ArgumentsError("largereq",arguments.length,2);if(s(e)){if(s(r))return e>=r;if(u(r))return e>=t.abs(r)}if(u(e)){if(s(r))return t.abs(e)>=r;if(u(r))return t.abs(e)>=t.abs(r)}if(l(e)&&l(r)){if(!e.equalBase(r))throw new Error("Cannot compare units with different base");return e.value>=r.value}if(a(e)||a(r))return e>=r;if(c(e)||c(r))return o.map2(e,r,f);if(e.valueOf()!==e||r.valueOf()!==r)return f(e.valueOf(),r.valueOf());throw new n.error.UnsupportedTypeError("largereq",e,r)}}},{"../../type/Complex.js":195,"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],129:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/collection.js"),i=n.number.isNumBool,o=n.number.isInteger,s=r.isCollection;t.lcm=function a(){var e,t=arguments[0],u=arguments[1];if(2==arguments.length){if(i(t)&&i(u)){if(!o(t)||!o(u))throw new Error("Parameters in function lcm must be integer numbers");if(0==t||0==u)return 0;for(var l=t*u;0!=u;)e=u,u=t%e,t=e;return Math.abs(l/t)}if(s(t)||s(u))return r.map2(t,u,a);if(t.valueOf()!==t||u.valueOf()!==u)return a(t.valueOf(),u.valueOf());throw new n.error.UnsupportedTypeError("lcm",t,u)}if(arguments.length>2){for(var c=1;c<arguments.length;c++)t=a(t,arguments[c]);return t}throw new SyntaxError("Function lcm expects two or more arguments")}}},{"../../type/collection.js":201,"../../util/index.js":205}],130:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/collection.js"),o=n.number.isNumBool,s=r.isComplex,a=i.isCollection;t.log=function u(e,l){if(1==arguments.length){if(o(e))return e>=0?Math.log(e):u(new r(e,0));if(s(e))return new r(Math.log(Math.sqrt(e.re*e.re+e.im*e.im)),Math.atan2(e.im,e.re));if(a(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("log",e)}if(2==arguments.length)return t.divide(u(e),u(l));throw new n.error.ArgumentsError("log",arguments.length,1,2)}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],131:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/collection.js"),o=n.number.isNumBool,s=r.isComplex,a=i.isCollection;t.log10=function u(e){if(1!=arguments.length)throw new n.error.ArgumentsError("log10",arguments.length,1);if(o(e))return e>=0?Math.log(e)/Math.LN10:u(new r(e,0));if(s(e))return new r(Math.log(Math.sqrt(e.re*e.re+e.im*e.im))/Math.LN10,Math.atan2(e.im,e.re)/Math.LN10);if(a(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("log10",e)}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],132:[function(e,t){t.exports=function(t){function n(e,t){if(t>0)return e>0?e%t:0==e?0:e-t*Math.floor(e/t);if(0==t)return e;throw new Error("Cannot calculate mod for a negative divisor")}var r=e("../../util/index.js"),i=e("../../type/collection.js"),o=r.number.isNumber,s=r.boolean.isBoolean,a=i.isCollection;t.mod=function u(e,t){if(2!=arguments.length)throw new r.error.ArgumentsError("mod",arguments.length,2);if(o(e)){if(o(t))return n(e,t);if(s(t))return n(e,Number(t))}else if(s(e)){if(o(t))return n(Number(e),t);if(s(t))return n(Number(e),Number(t))}if(a(e)||a(t))return i.map2(e,t,u);if(e.valueOf()!==e||t.valueOf()!==t)return u(e.valueOf(),t.valueOf());throw new r.error.UnsupportedTypeError("mod",e,t)}}},{"../../type/collection.js":201,"../../util/index.js":205}],133:[function(e,t){t.exports=function(t){function n(e,t){return 0==e.im?0==t.im?e.re*t.re:0==t.re?new i(0,e.re*t.im):new i(e.re*t.re,e.re*t.im):0==e.re?0==t.im?new i(0,e.im*t.re):0==t.re?-e.im*t.im:new i(-e.im*t.im,e.im*t.re):0==t.im?new i(e.re*t.re,e.im*t.re):0==t.re?new i(-e.im*t.im,e.re*t.im):new i(e.re*t.re-e.im*t.im,e.re*t.im+e.im*t.re)}var r=e("../../util/index.js"),i=e("../../type/Complex.js"),o=e("../../type/Matrix.js"),s=e("../../type/Unit.js"),a=e("../../type/collection.js"),u=r.array,l=r.number.isNumBool,c=i.isComplex,f=Array.isArray,p=s.isUnit;t.multiply=function m(e,s){if(2!=arguments.length)throw new r.error.ArgumentsError("multiply",arguments.length,2);if(l(e)){if(l(s))return e*s;if(c(s))return n(new i(e,0),s);if(p(s))return g=s.clone(),g.value*=e,g}else if(c(e)){if(l(s))return n(e,new i(s,0));if(c(s))return n(e,s)}else if(p(e)){if(l(s))return g=e.clone(),g.value*=s,g}else{if(f(e)){if(f(s)){var h=u.size(e),x=u.size(s);if(2!=h.length)throw new Error("Can only multiply a 2 dimensional matrix (A has "+h.length+" dimensions)");if(2!=x.length)throw new Error("Can only multiply a 2 dimensional matrix (B has "+x.length+" dimensions)");if(h[1]!=x[0])throw new RangeError("Dimensions mismatch in multiplication. Columns of A must match rows of B (A is "+h[0]+"x"+h[1]+", B is "+x[0]+"x"+x[1]+", "+x[1]+" != "+x[0]+")");for(var g=[],d=h[0],y=x[1],v=h[1],j=0;d>j;j++){g[j]=[];for(var b=0;y>b;b++){for(var w=null,E=0;v>E;E++){var N=m(e[j][E],s[E][b]);w=null==w?N:t.add(w,N)}g[j][b]=w}}return g}return s instanceof o?new o(m(e.valueOf(),s.valueOf())):a.map2(e,s,m)}if(e instanceof o)return new o(m(e.valueOf(),s.valueOf()))}if(f(s))return a.map2(e,s,m);if(s instanceof o)return new o(m(e.valueOf(),s.valueOf()));if(e.valueOf()!==e||s.valueOf()!==s)return m(e.valueOf(),s.valueOf());throw new r.error.UnsupportedTypeError("multiply",e,s)}}},{"../../type/Complex.js":195,"../../type/Matrix.js":198,"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],134:[function(e,t){t.exports=function(t){function n(e,n){var r=t.log(e),i=t.multiply(r,n);return t.exp(i)}var r=e("../../util/index.js"),i=e("../../type/Complex.js"),o=e("../../type/Matrix.js"),s=r.array,a=r.number.isNumBool,u=Array.isArray,l=r.number.isInteger,c=i.isComplex;t.pow=function f(e,p){if(2!=arguments.length)throw new r.error.ArgumentsError("pow",arguments.length,2);if(a(e)){if(a(p))return l(p)||e>=0?Math.pow(e,p):n(new i(e,0),new i(p,0));if(c(p))return n(new i(e,0),p)}else if(c(e)){if(a(p))return n(e,new i(p,0));if(c(p))return n(e,p)}else{if(u(e)){if(!a(p)||!l(p)||0>p)throw new TypeError("For A^b, b must be a positive integer (value is "+p+")");var m=s.size(e);if(2!=m.length)throw new Error("For A^b, A must be 2 dimensional (A has "+m.length+" dimensions)");if(m[0]!=m[1])throw new Error("For A^b, A must be square (size is "+m[0]+"x"+m[1]+")");if(0==p)return t.eye(m[0]);for(var h=e,x=1;p>x;x++)h=t.multiply(e,h);return h}if(e instanceof o)return new o(f(e.valueOf(),p))}if(e.valueOf()!==e||p.valueOf()!==p)return f(e.valueOf(),p.valueOf());throw new r.error.UnsupportedTypeError("pow",e,p)}}},{"../../type/Complex.js":195,"../../type/Matrix.js":198,"../../util/index.js":205}],135:[function(e,t){t.exports=function(t){function n(e,t){if(t){var n=Math.pow(10,t);return Math.round(e*n)/n}return Math.round(e)}var r=e("../../util/index.js"),i=e("../../type/Complex.js"),o=e("../../type/collection.js"),s=r.number.isNumber,a=r.number.isInteger,u=r.number.isNumBool,l=i.isComplex,c=o.isCollection;t.round=function f(e,t){if(1!=arguments.length&&2!=arguments.length)throw new r.error.ArgumentsError("round",arguments.length,1,2);if(void 0==t){if(u(e))return Math.round(e);if(l(e))return new i(Math.round(e.re),Math.round(e.im));if(c(e))return o.map(e,f);if(e.valueOf()!==e)return f(e.valueOf());throw new r.error.UnsupportedTypeError("round",e)}if(!s(t)||!a(t))throw new TypeError("Number of decimals in function round must be an integer");if(0>t||t>9)throw new Error("Number of decimals in function round must be in te range of 0-9");if(u(e))return n(e,t);if(l(e))return new i(n(e.re,t),n(e.im,t));if(c(e)||c(t))return o.map2(e,t,f);if(e.valueOf()!==e||t.valueOf()!==t)return f(e.valueOf(),t.valueOf());throw new r.error.UnsupportedTypeError("round",e,t)}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],136:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/collection.js"),o=n.number,s=n.number.isNumBool,a=r.isComplex,u=i.isCollection;t.sign=function l(e){if(1!=arguments.length)throw new n.error.ArgumentsError("sign",arguments.length,1);if(s(e))return o.sign(e);if(a(e)){var t=Math.sqrt(e.re*e.re+e.im*e.im);return new r(e.re/t,e.im/t)}if(u(e))return i.map(e,l);if(e.valueOf()!==e)return l(e.valueOf());throw new n.error.UnsupportedTypeError("sign",e)}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],137:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/Unit.js"),o=e("../../type/collection.js"),s=n.number.isNumBool,a=n.string.isString,u=r.isComplex,l=i.isUnit,c=o.isCollection;t.smaller=function f(e,r){if(2!=arguments.length)throw new n.error.ArgumentsError("smaller",arguments.length,2);if(s(e)){if(s(r))return r>e;if(u(r))return e<t.abs(r)}if(u(e)){if(s(r))return t.abs(e)<r;if(u(r))return t.abs(e)<t.abs(r)}if(l(e)&&l(r)){if(!e.equalBase(r))throw new Error("Cannot compare units with different base");return e.value<r.value}if(a(e)||a(r))return r>e;if(c(e)||c(r))return o.map2(e,r,f);if(e.valueOf()!==e||r.valueOf()!==r)return f(e.valueOf(),r.valueOf());throw new n.error.UnsupportedTypeError("smaller",e,r)}}},{"../../type/Complex.js":195,"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],138:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/Unit.js"),o=e("../../type/collection.js"),s=n.number.isNumBool,a=n.string.isString,u=r.isComplex,l=i.isUnit,c=o.isCollection;t.smallereq=function f(e,r){if(2!=arguments.length)throw new n.error.ArgumentsError("smallereq",arguments.length,2);if(s(e)){if(s(r))return r>=e;if(u(r))return e<=t.abs(r)}if(u(e)){if(s(r))return t.abs(e)<=r;if(u(r))return t.abs(e)<=t.abs(r)}if(l(e)&&l(r)){if(!e.equalBase(r))throw new Error("Cannot compare units with different base");return e.value<=r.value}if(a(e)||a(r))return r>=e;if(c(e)||c(r))return o.map2(e,r,f);if(e.valueOf()!==e||r.valueOf()!==r)return f(e.valueOf(),r.valueOf());throw new n.error.UnsupportedTypeError("smallereq",e,r)}}},{"../../type/Complex.js":195,"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],139:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/collection.js"),o=n.number.isNumBool,s=r.isComplex,a=i.isCollection;t.sqrt=function u(e){if(1!=arguments.length)throw new n.error.ArgumentsError("sqrt",arguments.length,1);if(o(e))return e>=0?Math.sqrt(e):u(new r(e,0));if(s(e)){var t=Math.sqrt(e.re*e.re+e.im*e.im);return e.im>=0?new r(.5*Math.sqrt(2*(t+e.re)),.5*Math.sqrt(2*(t-e.re))):new r(.5*Math.sqrt(2*(t+e.re)),-.5*Math.sqrt(2*(t-e.re)))}if(a(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("sqrt",e)}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],140:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/collection.js"),o=n.number.isNumBool,s=r.isComplex,a=i.isCollection;t.square=function u(e){if(1!=arguments.length)throw new n.error.ArgumentsError("square",arguments.length,1);if(o(e))return e*e;if(s(e))return t.multiply(e,e);if(a(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("square",e)}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],141:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=(e("../../type/Matrix.js"),e("../../type/Unit.js")),o=e("../../type/collection.js"),s=n.number.isNumBool,a=(n.string.isString,r.isComplex),u=i.isUnit,l=o.isCollection;t.subtract=function c(e,t){if(2!=arguments.length)throw new n.error.ArgumentsError("subtract",arguments.length,2);if(s(e)){if(s(t))return e-t;if(a(t))return new r(e-t.re,-t.im)}else if(a(e)){if(s(t))return new r(e.re-t,e.im);if(a(t))return new r(e.re-t.re,e.im-t.im)}else if(u(e)&&u(t)){if(!e.equalBase(t))throw new Error("Units do not match");if(null==e.value)throw new Error("Unit on left hand side of operator - has an undefined value");if(null==t.value)throw new Error("Unit on right hand side of operator - has an undefined value");var i=e.clone();return i.value-=t.value,i.fixPrefix=!1,i}if(l(e)||l(t))return o.map2(e,t,c);if(e.valueOf()!==e||t.valueOf()!==t)return c(e.valueOf(),t.valueOf());throw new n.error.UnsupportedTypeError("subtract",e,t)}}},{"../../type/Complex.js":195,"../../type/Matrix.js":198,"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],142:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/Unit.js"),o=e("../../type/collection.js"),s=n.number.isNumBool,a=r.isComplex,u=i.isUnit,l=o.isCollection;t.unary=function c(e){if(1!=arguments.length)throw new n.error.ArgumentsError("unary",arguments.length,1);if(s(e))return-e;if(a(e))return new r(-e.re,-e.im);if(u(e)){var t=e.clone();return t.value=-e.value,t}if(l(e))return o.map(e,c);if(e.valueOf()!==e)return c(e.valueOf());throw new n.error.UnsupportedTypeError("unary",e)}}},{"../../type/Complex.js":195,"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],143:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/Unit.js"),o=e("../../type/collection.js"),s=n.number.isNumBool,a=n.string.isString,u=r.isComplex,l=i.isUnit,c=o.isCollection;t.unequal=function f(e,t){if(2!=arguments.length)throw new n.error.ArgumentsError("unequal",arguments.length,2);if(s(e)){if(s(t))return e!=t;if(u(t))return e!=t.re||0!=t.im}if(u(e)){if(s(t))return e.re!=t||0!=e.im;if(u(t))return e.re!=t.re||e.im!=t.im}if(l(e)&&l(t)){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return e.value!=t.value}if(a(e)||a(t))return e!=t;if(c(e)||c(t))return o.map2(e,t,f);if(e.valueOf()!==e||t.valueOf()!==t)return f(e.valueOf(),t.valueOf());throw new n.error.UnsupportedTypeError("unequal",e,t)}}},{"../../type/Complex.js":195,"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],144:[function(e,t){t.exports=function(t){function n(e,t){for(var n,r,i,o=0,s=1,a=1,u=0;t;)r=Math.floor(e/t),i=e%t,n=o,o=s-r*o,s=n,n=a,a=u-r*a,u=n,e=t,t=i;return 0>e?[-e,e?-s:0,-u]:[e,e?s:0,u]}var r=e("../../util/index.js"),i=r.number.isNumBool,o=r.number.isInteger;t.xgcd=function(e,t){if(2==arguments.length){if(i(e)&&i(t)){if(!o(e)||!o(t))throw new Error("Parameters in function xgcd must be integer numbers");return n(e,t)}throw new r.error.UnsupportedTypeError("xgcd",e,t)}throw new SyntaxError("Function xgcd expects two arguments")}}},{"../../util/index.js":205}],145:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/collection.js"),o=n.number.isNumBool,s=i.isCollection,a=r.isComplex;t.arg=function u(e){if(1!=arguments.length)throw new n.error.ArgumentsError("arg",arguments.length,1);return o(e)?Math.atan2(0,e):a(e)?Math.atan2(e.im,e.re):s(e)?i.map(e,u):e.valueOf()!==e?u(e.valueOf()):t.atan2(0,e)}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],146:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/collection.js"),o=n.object,s=n.number.isNumBool,a=i.isCollection,u=r.isComplex;t.conj=function l(e){if(1!=arguments.length)throw new n.error.ArgumentsError("conj",arguments.length,1);return s(e)?e:u(e)?new r(e.re,-e.im):a(e)?i.map(e,l):e.valueOf()!==e?l(e.valueOf()):o.clone(e)}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],147:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/collection.js"),o=n.number.isNumBool,s=i.isCollection,a=r.isComplex;t.im=function u(e){if(1!=arguments.length)throw new n.error.ArgumentsError("im",arguments.length,1);return o(e)?0:a(e)?e.im:s(e)?i.map(e,u):e.valueOf()!==e?u(e.valueOf()):0}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],148:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/collection.js"),o=n.object,s=n.number.isNumBool,a=i.isCollection,u=r.isComplex;t.re=function l(e){if(1!=arguments.length)throw new n.error.ArgumentsError("re",arguments.length,1);return s(e)?e:u(e)?e.re:a(e)?i.map(e,l):e.valueOf()!==e?l(e.valueOf()):o.clone(e)}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],149:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/collection.js"),i=r.isCollection,o=n.number.isNumber,s=n.string.isString;t["boolean"]=function a(e){if(1!=arguments.length)throw new n.error.ArgumentsError("boolean",arguments.length,0,1);if("true"===e||e===!0)return!0;if("false"===e||e===!1)return!1;if(e instanceof Boolean)return e?!0:!1;if(o(e))return 0!==e;if(s(e)){var t=e.toLowerCase();if("true"===t)return!0;if("false"===t)return!1;var u=Number(e);if(""!=e&&!isNaN(u))return 0!==u}if(i(e))return r.map(e,a);throw new SyntaxError(e.toString()+" is no valid boolean")}}},{"../../type/collection.js":201,"../../util/index.js":205}],150:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/collection.js"),o=i.isCollection,s=n.number.isNumber,a=n.boolean.isBoolean,u=n.string.isString,l=r.isComplex;t.complex=function c(){switch(arguments.length){case 0:return new r(0,0);case 1:var e=arguments[0];if(s(e))return new r(e,0);if(l(e))return e.clone();if(u(e)){var t=r.parse(e);if(t)return t;throw new SyntaxError('String "'+e+'" is no valid complex number')}if(o(e))return i.map(e,c);if(a(e))return new r(Number(e),0);throw new TypeError("Two numbers or a single string expected in function complex");case 2:return new r(arguments[0],arguments[1]);default:throw new n.error.ArgumentsError("complex",arguments.length,0,2)}}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],151:[function(e,t){t.exports=function(t){var n=(e("../../util/index.js"),e("../../type/Index.js"));t.index=function(){var e=new n;return n.apply(e,arguments),e}}},{"../../type/Index.js":197,"../../util/index.js":205}],152:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Matrix.js");t.matrix=function(e){if(arguments.length>1)throw new n.error.ArgumentsError("matrix",arguments.length,0,1);return new r(e)}}},{"../../type/Matrix.js":198,"../../util/index.js":205}],153:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/collection.js"),i=r.isCollection;t.number=function o(e){switch(arguments.length){case 0:return 0;case 1:if(i(e))return r.map(e,o);var t=Number(e);if(isNaN(t)&&(t=Number(e.valueOf())),isNaN(t))throw new SyntaxError(e.toString()+" is no valid number");return t;default:throw new n.error.ArgumentsError("number",arguments.length,0,1)}}}},{"../../type/collection.js":201,"../../util/index.js":205}],154:[function(e,t){t.exports=function(t){var n=(e("../../util/index.js"),e("../../expression/Parser.js"));t.parser=function(){return new n(t)}}},{"../../expression/Parser.js":4,"../../util/index.js":205}],155:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/collection.js"),i=n.number,o=n.number.isNumber,s=r.isCollection;t.string=function a(e){switch(arguments.length){case 0:return"";case 1:return o(e)?i.format(e):s(e)?r.map(e,a):null===e?"null":e.toString();default:throw new n.error.ArgumentsError("string",arguments.length,0,1)}}}},{"../../type/collection.js":201,"../../util/index.js":205}],156:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Unit.js"),i=e("../../type/collection.js"),o=i.isCollection,s=n.string.isString;t.unit=function a(e){switch(arguments.length){case 1:var t=arguments[0];if(t instanceof r)return t.clone();if(s(t)){if(r.isPlainUnit(t))return new r(null,t);var u=r.parse(t);if(u)return u;throw new SyntaxError('String "'+t+'" is no valid unit')}if(o(e))return i.map(e,a);throw new TypeError("A string or a number and string expected in function unit");case 2:return new r(arguments[0],arguments[1]);default:throw new n.error.ArgumentsError("unit",arguments.length,1,2)}}}},{"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],157:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../expression/Scope.js"),i=e("../../type/collection.js"),o=n.string.isString,s=i.isCollection;t.eval=function(e,a){if(1!=arguments.length&&2!=arguments.length)throw new n.error.ArgumentsError("eval",arguments.length,1,2);var u;if(u=a?a instanceof r?a:new r(t,a):new r(t),o(e)){var l=t.parse(e,u);return l.eval()}if(s(e))return i.map(e,function(e){var n=t.parse(e,u);return n.eval()});throw new TypeError("String or matrix expected")}}},{"../../expression/Scope.js":5,"../../type/collection.js":201,"../../util/index.js":205}],158:[function(e,t){t.exports=function(t){var n=(e("../../util/index.js"),e("../../type/Help.js"));t.help=function(e){if(1!=arguments.length)throw new SyntaxError("Wrong number of arguments in function help ("+arguments.length+" provided, 1 expected)");var r=null;if(e instanceof String||"string"==typeof e)r=e;else{var i;for(i in t)if(t.hasOwnProperty(i)&&e===t[i]){r=i;break}if(!r)for(i in t.type)if(t.type.hasOwnProperty(i)&&e===t.type[i]){r=i;break}}if(r){var o=t.expression.docs[r];if(!o)throw new Error('No documentation found on "'+r+'"');return new n(t,o)}throw new Error('Could not find search term "'+e+'"')}}},{"../../type/Help.js":196,"../../util/index.js":205}],159:[function(e,t){t.exports=function(t){function n(){st=0,at=ot.charAt(0)}function r(){st++,at=ot.charAt(st)}function i(){return ot.charAt(st+1)}function o(){for(lt=rt.NULL,ut="";" "==at||" "==at;)r();if("#"==at)for(;"\n"!=at&&""!=at;)r();if(""==at)return lt=rt.DELIMITER,void 0;var e=at+i();if(it[e])return lt=rt.DELIMITER,ut=e,r(),r(),void 0;if(it[at])return lt=rt.DELIMITER,ut=at,r(),void 0;if(a(at)){if(lt=rt.NUMBER,"."==at)ut+=at,r(),u(at)||(lt=rt.UNKNOWN);else{for(;u(at);)ut+=at,r();"."==at&&(ut+=at,r())}for(;u(at);)ut+=at,r();if("E"==at||"e"==at)for(ut+=at,r(),("+"==at||"-"==at)&&(ut+=at,r()),u(at)||(lt=rt.UNKNOWN);u(at);)ut+=at,r()}else{if(!s(at)){for(lt=rt.UNKNOWN;""!=at;)ut+=at,r();throw I('Syntax error in part "'+ut+'"')}for(lt=rt.SYMBOL;s(at)||u(at);)ut+=at,r()}}function s(e){return e>="a"&&"z">=e||e>="A"&&"Z">=e||"_"==e}function a(e){return e>="0"&&"9">=e||"."==e}function u(e){return e>="0"&&"9">=e}function l(e){n(),o();var t;if(t=""==ut?new Q(void 0):c(e),""!=ut)throw lt==rt.DELIMITER?B("Unknown operator "+ut):I('Unexpected part "'+ut+'"');return t}function c(e){var t,n,r;for("\n"!=ut&&";"!=ut&&""!=ut&&(t=f(e));"\n"==ut||";"==ut;)n||(n=new W,t&&(r=";"!=ut,n.add(t,r))),o(),"\n"!=ut&&";"!=ut&&""!=ut&&(t=f(e),r=";"!=ut,n.add(t,r));return n?n:(t||(t=f(e)),t)}function f(e){var t=p(e),n="ans";return new Y(n,t,e)}function p(e){if(lt==rt.SYMBOL&&"function"==ut){if(o(),lt!=rt.SYMBOL)throw I("Function name expected");var t=ut;if(o(),"("!=ut)throw I("Opening parenthesis ( expected");for(var n=e.createSubScope(),r=[];;){if(o(),lt!=rt.SYMBOL)throw I("Variable name expected");if(r.push(ut),o(),","!=ut){if(")"==ut)break;throw I('Comma , or closing parenthesis ) expected"')}}if(o(),"="!=ut)throw I("Equal sign = expected");o();var i=m(n);return new K(t,r,i,n,e)}return m(e)}function m(e){var n,r,i,s,a=h(e);if("="==ut){if(a instanceof et)return o(),n=a.name,r=null,s=m(e),new Y(n,s,e);if(a instanceof J&&a.object instanceof et)return o(),n=a.object.name,r=a.params,i=a.paramScopes,s=m(e),new tt(t,n,r,i,s,e);throw I("Symbol expected at the left hand side of assignment operator =")}return a}function h(e){var n,r=[];if(n=":"==ut?new Q(1):x(e),":"==ut){for(r.push(n);":"==ut;)o(),")"==ut||","==ut||""==ut?r.push(new et("end",e)):r.push(x(e));r.length&&(n=new X(t,r))}return n}function x(e){var n,r,i,s,a;for(n=g(e),r={"in":t["in"]};void 0!==r[ut];)i=ut,s=r[i],o(),a=[n,g(e)],n=new $(i,s,a);return n}function g(e){var t=d(e);return t}function d(e){var n,r,i,s,a;for(n=y(e),r={"==":t.equal,"!=":t.unequal,"<":t.smaller,">":t.larger,"<=":t.smallereq,">=":t.largereq};void 0!==r[ut];)i=ut,s=r[i],o(),a=[n,y(e)],n=new $(i,s,a);return n}function y(e){var n,r,i,s,a;for(n=v(e),r={"+":t.add,"-":t.subtract};void 0!==r[ut];)i=ut,s=r[i],o(),a=[n,v(e)],n=new $(i,s,a);return n}function v(e){var n,r,i,s,a;for(n=j(e),r={"*":t.multiply,".*":t.emultiply,"/":t.divide,"./":t.edivide,"%":t.mod,mod:t.mod};void 0!==r[ut];)i=ut,s=r[i],o(),a=[n,j(e)],n=new $(i,s,a);return n}function j(e){var n,r,i;return"-"==ut?(n=ut,r=t.unary,o(),i=[j(e)],new $(n,r,i)):b(e)}function b(e){var n,r,i,s,a,u,l;for(i=[w(e)],s=[];"^"==ut||".^"==ut;)s.push(ut),o(),i.push(w(e));for(n=i.pop();i.length;)r=i.pop(),a=s.pop(),u="^"==a?t.pow:t.epow,l=[r,n],n=new $(a,u,l);return n}function w(e){var n,r,i,s;for(n=E(e);"!"==ut;)r=ut,i=t.factorial,o(),s=[n],n=new $(r,i,s);return n}function E(e){var n,r,i,s;for(n=N(e);"'"==ut;)r=ut,i=t.transpose,o(),s=[n],n=new $(r,i,s);return n}function N(e){var t,n,r,i;if(lt==rt.SYMBOL&&nt[ut]){if(i=nt[ut],o(),"("==ut){if(t=[],n=[],o(),")"!=ut)for(r=e.createSubScope(),n.push(r),t.push(h(r));","==ut;)o(),r=e.createSubScope(),n.push(r),t.push(h(r));if(")"!=ut)throw I("Parenthesis ) expected");o()}return new i(t,n)}return O(e)}function O(e){var t,n;return lt==rt.SYMBOL?(n=ut,o(),t=new et(n,e),M(e,t)):C(e)}function M(e,n){for(var r,i,s,a;"("==ut;){if(r=ut,i=[],s=[],o(),")"!=ut)for(a=e.createSubScope(),s.push(a),i.push(h(a));","==ut;)o(),a=e.createSubScope(),s.push(a),i.push(h(a));if("("==r&&")"!=ut)throw I("Parenthesis ) expected");o(),n=new J(t,n,i,s)}return n}function C(e){var t,n,i;if('"'==ut){for(n="",i="";""!=at&&('"'!=at||"\\"==i);)n+=at,i=at,r();if(o(),'"'!=ut)throw I('End of string " expected');return o(),t=new Q(n),t=M(e,t)}return A(e)}function A(e){var t,n,r,i,s,a;if("["==ut){for(o();"\n"==ut;)o();if("]"!=ut){for(n=[],r=0,i=0,n[0]=[m(e)];","==ut||";"==ut;){for(","==ut?i++:(r++,i=0,n[r]=[]),o();"\n"==ut;)o();for(n[r][i]=m(e);"\n"==ut;)o()}for(s=n.length,a=n.length>0?n[0].length:0,r=1;s>r;r++)if(n[r].length!=a)throw B("Number of columns must match ("+n[r].length+" != "+a+")");if("]"!=ut)throw I("End of matrix ] expected");o(),t=new Z(n)}else o(),t=new Z([]);return t=M(e,t)}return S(e)}function S(e){var t,n,r;if(lt==rt.NUMBER){if(r="."==ut?0:Number(ut),o(),lt==rt.SYMBOL){if("i"==ut||"I"==ut)return n=new G(0,r),o(),new Q(n);if(F.isPlainUnit(ut))return n=new F(r,ut),o(),new Q(n);throw L('Unknown unit "'+ut+'"')}return t=new Q(r),t=M(e,t)}return T(e)}function T(e){var t;if("("==ut){if(o(),t=m(e),")"!=ut)throw I("Parenthesis ) expected");return o(),t=M(e,t)}return U(e)}function U(){throw""==ut?I("Unexpected end of expression"):I("Value expected")}function q(){return void 0}function z(){return st-ut.length+1}function R(e){var t=q(),n=z();return void 0===t?void 0===n?e:e+" (char "+n+")":e+" (line "+t+", char "+n+")"}function I(e){return new SyntaxError(R(e))}function L(e){return new TypeError(R(e))}function B(e){return new Error(R(e))}var _=e("../../util/index.js"),P=_.string.isString,k=Array.isArray,G=e("./../../type/Complex.js"),H=e("./../../type/Matrix.js"),F=e("./../../type/Unit.js"),V=e("../../type/collection.js"),D=e("./../../expression/Scope.js"),Y=e("../../expression/node/AssignmentNode.js"),W=e("../../expression/node/BlockNode.js"),Q=e("../../expression/node/ConstantNode.js"),K=e("../../expression/node/FunctionNode.js"),Z=e("../../expression/node/MatrixNode.js"),$=e("../../expression/node/OperatorNode.js"),J=e("../../expression/node/ParamsNode.js"),X=e("../../expression/node/RangeNode.js"),et=e("../../expression/node/SymbolNode.js"),tt=e("../../expression/node/UpdateNode.js"),nt=e("../../expression/node/handlers.js");t.parse=function(e,n){if(1!=arguments.length&&2!=arguments.length)throw new _.error.ArgumentsError("parse",arguments.length,1,2);var r;if(r=n?n instanceof D?n:new D(t,n):new D(t),P(e))return ot=e||"",l(r);if(k(e)||e instanceof H)return V.map(e,function(e){return ot=e||"",l(r)});throw new TypeError("String or matrix expected")};var rt={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},it={",":!0,"(":!0,")":!0,"[":!0,"]":!0,'"':!0,"\n":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"!":!0,"'":!0,"=":!0,":":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0},ot="",st=0,at="",ut="",lt=rt.NULL}},{"../../expression/node/AssignmentNode.js":101,"../../expression/node/BlockNode.js":102,"../../expression/node/ConstantNode.js":103,"../../expression/node/FunctionNode.js":104,"../../expression/node/MatrixNode.js":105,"../../expression/node/OperatorNode.js":107,"../../expression/node/ParamsNode.js":108,"../../expression/node/RangeNode.js":109,"../../expression/node/SymbolNode.js":110,"../../expression/node/UpdateNode.js":111,"../../expression/node/handlers.js":112,"../../type/collection.js":201,"../../util/index.js":205,"./../../expression/Scope.js":5,"./../../type/Complex.js":195,"./../../type/Matrix.js":198,"./../../type/Unit.js":200}],160:[function(e,t){t.exports=function(t){function n(e,t,r,i){if(r>i){if(e.length!=t.length)throw new Error("Dimensions mismatch ("+e.length+" != "+t.length+")");for(var o=[],s=0;s<e.length;s++)o[s]=n(e[s],t[s],r,i+1);return o}return e.concat(t)}var r=e("../../util/index.js"),i=e("../../type/Matrix.js"),o=e("../../type/collection.js"),s=r.object,a=r.array,u=r.number.isNumber,l=r.number.isInteger,c=o.isCollection;t.concat=function(){var e,t,o=arguments.length,f=-1,p=!1,m=[];for(e=0;o>e;e++){var h=arguments[e];if(h instanceof i&&(p=!0),e==o-1&&u(h)){if(t=f,f=h,!l(f)||0>f)throw new TypeError("Dimension number must be a positive integer (dim = "+f+")");if(e>0&&f>t)throw new RangeError("Dimension out of range ("+f+" > "+t+")")}else{if(!c(h))throw new r.error.UnsupportedTypeError("concat",h);var x=s.clone(h).valueOf(),g=a.size(h.valueOf());if(m[e]=x,t=f,f=g.length-1,e>0&&f!=t)throw new RangeError("Dimension mismatch ("+t+" != "+f+")")}}if(0==m.length)throw new SyntaxError("At least one matrix expected");for(var d=m.shift();m.length;)d=n(d,m.shift(),f,0);return p?new i(d):d}}},{"../../type/Matrix.js":198,"../../type/collection.js":201,"../../util/index.js":205}],161:[function(e,t){t.exports=function(t){function n(e,n,r){if(1==n)return e[0][0];if(2==n)return t.subtract(t.multiply(e[0][0],e[1][1]),t.multiply(e[1][0],e[0][1]));for(var o=1,s=0,a=0;n>a&&!(s>=r);a++){for(var u=a;0==e[u][s];)if(u++,u==n&&(u=a,s++,s==r))return i.deepEqual(e,eye(n).valueOf())?t.round(o,6):0;if(u!=a){for(var l=0;r>l;l++){var c=e[u][l];e[u][l]=e[a][l],e[a][l]=c}o*=-1}for(var f=e[a][s],l=0;r>l;l++)e[a][l]=e[a][l]/f;o*=f;for(var p=0;n>p;p++)if(p!=a)for(var m=e[p][s],l=0;r>l;l++)e[p][l]=e[p][l]-e[a][l]*m;s++}return i.deepEqual(e,t.eye(n).valueOf())?t.round(o,6):0}var r=e("../../util/index.js"),i=(e("../../type/Matrix.js"),r.object),o=r.array,s=r.string;t.det=function(e){if(1!=arguments.length)throw new r.error.ArgumentsError("det",arguments.length,1);var t=o.size(e.valueOf());switch(t.length){case 0:return i.clone(e);case 1:if(1==t[0])return i.clone(e.valueOf()[0]);throw new RangeError("Matrix must be square (size: "+s.format(t)+")");
case 2:var a=t[0],u=t[1];if(a==u)return n(e.valueOf(),a,u);throw new RangeError("Matrix must be square (size: "+s.format(t)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+s.format(t)+")")}}}},{"../../type/Matrix.js":198,"../../util/index.js":205}],162:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Matrix.js"),i=n.object,o=n.number.isNumber,s=n.number.isInteger;t.diag=function(e,t){var a,u,l,c;if(1!=arguments.length&&2!=arguments.length)throw new n.error.ArgumentsError("diag",arguments.length,1,2);if(t){if(!o(t)||!s(t))throw new TypeError("Second parameter in function diag must be an integer")}else t=0;var f=t>0?t:0,p=0>t?-t:0;e instanceof r||(e=new r(e));var m;switch(e.isVector()?(e=e.toVector(),m=[e.length]):m=e.size(),m.length){case 1:u=e.valueOf();var h=new r;for(h.resize([u.length+p,u.length+f]),a=h.valueOf(),c=u.length,l=0;c>l;l++)a[l+p][l+f]=i.clone(u[l]);return h;case 2:for(u=[],a=e.valueOf(),c=Math.min(m[0]-p,m[1]-f),l=0;c>l;l++)u[l]=i.clone(a[l+p][l+f]);return new r(u);default:throw new RangeError("Matrix for function diag must be 2 dimensional")}}}},{"../../type/Matrix.js":198,"../../util/index.js":205}],163:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Matrix.js"),i=e("../../type/collection.js"),o=n.number.isNumber,s=n.number.isInteger;t.eye=function(){var e=i.argsToArray(arguments);if(0==e.length)e=[1,1];else if(1==e.length)e[1]=e[0];else if(e.length>2)throw new n.error.ArgumentsError("eye",e.length,0,2);var a=e[0],u=e[1];if(!o(a)||!s(a)||1>a)throw new Error("Parameters in function eye must be positive integers");if(u&&(!o(u)||!s(u)||1>u))throw new Error("Parameters in function eye must be positive integers");var l=new r;l.resize(e);for(var c=t.min(e),f=l.valueOf(),p=0;c>p;p++)f[p][p]=1;return l}}},{"../../type/Matrix.js":198,"../../type/collection.js":201,"../../util/index.js":205}],164:[function(e,t){t.exports=function(t){function n(e,n,r){var i,o,s,a,u;if(1==n){if(a=e[0][0],0==a)throw Error("Cannot calculate inverse, determinant is zero");return[[t.divide(1,a)]]}if(2==n){var l=t.det(e);if(0==l)throw Error("Cannot calculate inverse, determinant is zero");return[[t.divide(e[1][1],l),t.divide(t.unary(e[0][1]),l)],[t.divide(t.unary(e[1][0]),l),t.divide(e[0][0],l)]]}var c=e.concat();for(i=0;n>i;i++)c[i]=c[i].concat();for(var f=t.eye(n).valueOf(),p=0;r>p;p++){for(i=p;n>i&&0==c[i][p];)i++;if(i==n||0==c[i][p])throw Error("Cannot calculate inverse, determinant is zero");i!=p&&(u=c[p],c[p]=c[i],c[i]=u,u=f[p],f[p]=f[i],f[i]=u);var m=c[p],h=f[p];for(i=0;n>i;i++){var x=c[i],g=f[i];if(i!=p){if(0!=x[p]){for(s=t.divide(t.unary(x[p]),m[p]),o=p;r>o;o++)x[o]=t.add(x[o],t.multiply(s,m[o]));for(o=0;r>o;o++)g[o]=t.add(g[o],t.multiply(s,h[o]))}}else{for(s=m[p],o=p;r>o;o++)x[o]=t.divide(x[o],s);for(o=0;r>o;o++)g[o]=t.divide(g[o],s)}}}return f}var r=e("../../util/index.js"),i=e("../../type/Matrix.js"),o=r.string;t.inv=function(e){if(1!=arguments.length)throw new r.error.ArgumentsError("inv",arguments.length,1);var s=t.size(e).valueOf();switch(s.length){case 0:return t.divide(1,e);case 1:if(1==s[0])return e instanceof i?new i([t.divide(1,e.valueOf()[0])]):[t.divide(1,e[0])];throw new RangeError("Matrix must be square (size: "+o.format(s)+")");case 2:var a=s[0],u=s[1];if(a==u)return e instanceof i?new i(n(e.valueOf(),a,u)):n(e,a,u);throw new RangeError("Matrix must be square (size: "+o.format(s)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+o.format(s)+")")}}}},{"../../type/Matrix.js":198,"../../util/index.js":205}],165:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Matrix.js"),i=e("../../type/collection.js"),o=n.array;t.ones=function(e){var t=i.argsToArray(arguments),n=e instanceof r;if(0==t.length)return 1;var s=[],a=1;return o.resize(s,t,a),n?new r(s):s}}},{"../../type/Matrix.js":198,"../../type/collection.js":201,"../../util/index.js":205}],166:[function(e,t){t.exports=function(t){function n(e){var t=e.split(":"),n=t.map(function(e){return Number(e)}),r=n.some(function(e){return isNaN(e)});if(r)return null;switch(n.length){case 2:return{start:n[0],end:n[1],step:1};case 3:return{start:n[0],end:n[2],step:n[1]};default:return null}}var r=e("../../util/index.js"),i=r.string.isString,o=r.number.isNumber;t.range=function(e){var t,s,a;switch(arguments.length){case 1:if(!i(e))throw new TypeError("Two or three numbers or a single string expected in function range");var u=n(e);if(!u)throw new SyntaxError('String "'+u+'" is no valid range');t=u.start,s=u.end,a=u.step;break;case 2:t=arguments[0],s=arguments[1],a=1;break;case 3:t=arguments[0],s=arguments[1],a=arguments[2];break;default:throw new r.error.ArgumentsError("range",arguments.length,2,3)}if(!o(t))throw new TypeError("Parameter start must be a number");if(!o(s))throw new TypeError("Parameter end must be a number");if(!o(a))throw new TypeError("Parameter step must be a number");var l=[],c=t;if(a>0)for(;s>c;)l.push(c),c+=a;else if(0>a)for(;c>s;)l.push(c),c+=a;return l}}},{"../../util/index.js":205}],167:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/Unit.js"),o=e("../../type/Matrix.js"),s=n.array,a=n.number.isNumber,u=n.boolean.isBoolean,l=n.string.isString,c=r.isComplex,f=i.isUnit;t.size=function p(e){if(1!=arguments.length)throw new n.error.ArgumentsError("size",arguments.length,1);if(a(e)||c(e)||f(e)||u(e)||null==e)return[];if(l(e))return[e.length];if(Array.isArray(e))return s.size(e);if(e instanceof o)return new o(e.size());if(e.valueOf()!==e)return p(e.valueOf());throw new n.error.UnsupportedTypeError("size",e)}}},{"../../type/Complex.js":195,"../../type/Matrix.js":198,"../../type/Unit.js":200,"../../util/index.js":205}],168:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Matrix.js"),i=n.object,o=n.array,s=Array.isArray;t.squeeze=function(e){if(1!=arguments.length)throw new n.error.ArgumentsError("squeeze",arguments.length,1);return s(e)?o.squeeze(i.clone(e)):e instanceof r?new r(o.squeeze(e.toArray())):s(e.valueOf())?o.squeeze(i.clone(e.valueOf())):i.clone(e)}}},{"../../type/Matrix.js":198,"../../util/index.js":205}],169:[function(e,t){t.exports=function(t){function n(e,t){var n,i;if(f(e))return n=new a(e),i=n.subset(t),i.valueOf();if(e instanceof a)return e.subset(t);if(c(e))return r(e,t);throw new s.error.UnsupportedTypeError("subset",e)}function r(e,t){if(!(t instanceof u))throw new TypeError("Index expected");if(1!=t.size().length)throw new RangeError("Dimension mismatch ("+t.size().length+" != 1)");var n=t.range(0),r="",i=e.length;return n.forEach(function(t){l.validateIndex(t,i),r+=e.charAt(t)}),r}function i(e,n,r){var i;if(f(e))return i=new a(t.clone(e)),i.subset(n,r),i.valueOf();if(e instanceof a)return e.clone().subset(n,r);if(c(e))return o(e,n,r);throw new s.error.UnsupportedTypeError("subset",e)}function o(e,t,n){if(!(t instanceof u))throw new TypeError("Index expected");if(1!=t.size().length)throw new RangeError("Dimension mismatch ("+t.size().length+" != 1)");var r=t.range(0),i=r.size()[0];if(i!=n.length)throw new RangeError("Dimension mismatch ("+r.size()[0]+" != "+n.length+")");for(var o=e.length,s=[],a=0;o>a;a++)s[a]=e.charAt(a);if(r.forEach(function(e,t){l.validateIndex(e),s[e]=n.charAt(t)}),s.length>o)for(a=o-1,i=s.length;i>a;a++)s[a]||(s[a]=" ");return s.join("")}var s=e("../../util/index.js"),a=e("../../type/Matrix.js"),u=e("../../type/Index.js"),l=s.array,c=s.string.isString,f=Array.isArray;t.subset=function(){switch(arguments.length){case 2:return n(arguments[0],arguments[1]);case 3:return i(arguments[0],arguments[1],arguments[2]);default:throw new s.error.ArgumentsError("subset",arguments.length,2,3)}}}},{"../../type/Index.js":197,"../../type/Matrix.js":198,"../../util/index.js":205}],170:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Matrix.js"),i=n.object,o=n.string;t.transpose=function(e){if(1!=arguments.length)throw new n.error.ArgumentsError("transpose",arguments.length,1);var s=t.size(e).valueOf();switch(s.length){case 0:return i.clone(e);case 1:return i.clone(e);case 2:var a,u=s[1],l=s[0],c=r.isMatrix(e),f=e.valueOf(),p=[],m=i.clone;if(0===u)throw new RangeError("Cannot transpose a 2D matrix with no rows(size: "+o.format(s)+")");for(var h=0;u>h;h++){a=p[h]=[];for(var x=0;l>x;x++)a[x]=m(f[x][h])}return 0==l&&(p[0]=[]),c?new r(p):p;default:throw new RangeError("Matrix must be two dimensional (size: "+o.format(s)+")")}}}},{"../../type/Matrix.js":198,"../../util/index.js":205}],171:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Matrix.js"),i=e("../../type/collection.js"),o=n.array;t.zeros=function(e){var t=i.argsToArray(arguments),n=e instanceof r;if(0==t.length)return 0;var s=[],a=0;return o.resize(s,t,a),n?new r(s):s}}},{"../../type/Matrix.js":198,"../../type/collection.js":201,"../../util/index.js":205}],172:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/collection.js"),i=n.number.isNumber,o=n.boolean.isBoolean,s=n.number.isInteger,a=r.isCollection;t.factorial=function u(e){if(1!=arguments.length)throw new n.error.ArgumentsError("factorial",arguments.length,1);if(i(e)){if(!s(e)||0>e)throw new TypeError("Positive integer value expected in function factorial");var t=e,l=t;for(t--;t>1;)l*=t,t--;return 0==l&&(l=1),l}if(o(e))return 1;if(a(e))return r.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("factorial",e)}}},{"../../type/collection.js":201,"../../util/index.js":205}],173:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Matrix.js"),i={uniform:function(){return Math.random},normal:function(){return function(){for(var e,t,n=-1;0>n||n>1;)e=Math.random(),t=Math.random(),n=1/6*Math.pow(-2*Math.log(e),.5)*Math.cos(2*Math.PI*t)+.5;return n}}};t.distribution=function(e){if(!i.hasOwnProperty(e))throw new Error("unknown distribution "+e);var t=Array.prototype.slice.call(arguments,1),o=i[e].apply(this,t);return function(e){var t={random:function(e,t,o){var a,u,l;if(arguments.length>3)throw new n.error.ArgumentsError("random",arguments.length,0,3);return 1===arguments.length?Array.isArray(e)?a=e:l=e:2===arguments.length?Array.isArray(e)?a=e:(u=e,l=t):(a=e,u=t,l=o),void 0===l&&(l=1),void 0===u&&(u=0),void 0!==a?new r(s(a,u,l,i)):i(u,l)},randomInt:function(e,t,i){var a,u,l;if(arguments.length>3||arguments.length<1)throw new n.error.ArgumentsError("randomInt",arguments.length,1,3);return 1===arguments.length?l=e:2===arguments.length?"[object Array]"===Object.prototype.toString.call(e)?a=e:(u=e,l=t):(a=e,u=t,l=i),void 0===u&&(u=0),void 0!==a?new r(s(a,u,l,o)):o(u,l)},pickRandom:function(e){if(1!==arguments.length)throw new n.error.ArgumentsError("pickRandom",arguments.length,1);if(!Array.isArray(e))throw new n.error.UnsupportedTypeError("pickRandom",e);return e[Math.floor(Math.random()*e.length)]}},i=function(t,n){return t+e()*(n-t)},o=function(t,n){return Math.floor(t+e()*(n-t))},s=function(e,t,n,r){var i,o,a=[];if(e=e.slice(0),e.length>1)for(o=0,i=e.shift();i>o;o++)a.push(s(e,t,n,r));else for(o=0,i=e.shift();i>o;o++)a.push(r(t,n));return a};return t}(o)};var o=t.distribution("uniform");t.random=o.random,t.randomInt=o.randomInt,t.pickRandom=o.pickRandom}},{"../../type/Matrix.js":198,"../../util/index.js":205}],174:[function(e,t){t.exports=function(t){function n(e){for(var n=e[0],r=1,i=e.length;i>r;r++){var o=e[r];t.larger(o,n)&&(n=o)}return n}function r(e,n,r){for(var i=[],o=0;r>o;o++){for(var s=e[0][o],a=1;n>a;a++){var u=e[a][o];t.larger(u,s)&&(s=u)}i[o]=s}return i}var i=(e("../../util/index.js"),e("../../type/Matrix.js")),o=e("../../type/collection.js"),s=o.isCollection;t.max=function(e){if(0==arguments.length)throw new Error("Function max requires one or more parameters (0 provided)");if(s(e)){if(arguments.length>1)throw Error("Wrong number of parameters (1 matrix or multiple scalars expected)");var o=t.size(e).valueOf();if(1==o.length){if(0==e.length)throw new Error("Cannot calculate max of an empty vector");return n(e.valueOf())}if(2==o.length){if(0==o[0]||0==o[1])throw new Error("Cannot calculate max of an empty matrix");return i.isMatrix(e)?new i(r(e.valueOf(),o[0],o[1])):r(e,o[0],o[1])}throw new RangeError("Cannot calculate max for multi dimensional matrix")}return n(arguments)}}},{"../../type/Matrix.js":198,"../../type/collection.js":201,"../../util/index.js":205}],175:[function(e,t){t.exports=function(t){function n(e){for(var n=e[0],r=1,i=e.length;i>r;r++){var o=e[r];t.smaller(o,n)&&(n=o)}return n}function r(e,n,r){for(var i=[],o=0;r>o;o++){for(var s=e[0][o],a=1;n>a;a++){var u=e[a][o];t.smaller(u,s)&&(s=u)}i[o]=s}return i}var i=(e("../../util/index.js"),e("../../type/Matrix.js")),o=e("../../type/collection.js"),s=o.isCollection;t.min=function(e){if(0==arguments.length)throw new Error("Function min requires one or more parameters (0 provided)");if(s(e)){if(arguments.length>1)throw Error("Wrong number of parameters (1 matrix or multiple scalars expected)");var o=t.size(e).valueOf();if(1==o.length){if(0==e.length)throw new Error("Cannot calculate min of an empty vector");return n(e.valueOf())}if(2==o.length){if(0==o[0]||0==o[1])throw new Error("Cannot calculate min of an empty matrix");return i.isMatrix(e)?new i(r(e.valueOf(),o[0],o[1])):r(e,o[0],o[1])}throw new RangeError("Cannot calculate min for multi dimensional matrix")}return n(arguments)}}},{"../../type/Matrix.js":198,"../../type/collection.js":201,"../../util/index.js":205}],176:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/collection.js"),o=n.number.isNumBool,s=r.isComplex,a=i.isCollection;t.acos=function u(e){if(1!=arguments.length)throw new n.error.ArgumentsError("acos",arguments.length,1);if(o(e))return e>=-1&&1>=e?Math.acos(e):u(new r(e,0));if(s(e)){var l,c=new r(e.im*e.im-e.re*e.re+1,-2*e.re*e.im),f=t.sqrt(c);l=f instanceof r?new r(f.re-e.im,f.im+e.re):new r(f-e.im,e.re);var p=t.log(l);return p instanceof r?new r(1.5707963267948966-p.im,p.re):new r(1.5707963267948966,p)}if(a(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("acos",e)}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],177:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/collection.js"),o=n.number.isNumBool,s=r.isComplex,a=i.isCollection;t.asin=function u(e){if(1!=arguments.length)throw new n.error.ArgumentsError("asin",arguments.length,1);if(o(e))return e>=-1&&1>=e?Math.asin(e):u(new r(e,0));if(s(e)){var l,c=e.re,f=e.im,p=new r(f*f-c*c+1,-2*c*f),m=t.sqrt(p);l=m instanceof r?new r(m.re-f,m.im+c):new r(m-f,c);var h=t.log(l);return h instanceof r?new r(h.im,-h.re):new r(0,-h)}if(a(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("asin",e)}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],178:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/collection.js"),o=n.number.isNumBool,s=r.isComplex,a=i.isCollection;t.atan=function u(e){if(1!=arguments.length)throw new n.error.ArgumentsError("atan",arguments.length,1);if(o(e))return Math.atan(e);if(s(e)){var l=e.re,c=e.im,f=l*l+(1-c)*(1-c),p=new r((1-c*c-l*l)/f,-2*l/f),m=t.log(p);return m instanceof r?new r(-.5*m.im,.5*m.re):new r(0,.5*m)}if(a(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("atan",e)}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],179:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/collection.js"),o=n.number.isNumBool,s=r.isComplex,a=i.isCollection;t.atan2=function u(e,t){if(2!=arguments.length)throw new n.error.ArgumentsError("atan2",arguments.length,2);if(o(e)){if(o(t))return Math.atan2(e,t)}else if(s(e)&&o(t))return Math.atan2(e.re,t);if(a(e)||a(t))return i.map2(e,t,u);if(t.valueOf()!==t||e.valueOf()!==e)return u(e.valueOf(),t.valueOf());throw new n.error.UnsupportedTypeError("atan2",e,t)}}},{"../../type/Complex.js":195,"../../type/collection.js":201,"../../util/index.js":205}],180:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/Unit.js"),o=e("../../type/collection.js"),s=n.number.isNumBool,a=r.isComplex,u=i.isUnit,l=o.isCollection;t.cos=function c(e){if(1!=arguments.length)throw new n.error.ArgumentsError("cos",arguments.length,1);if(s(e))return Math.cos(e);if(a(e))return new r(.5*Math.cos(e.re)*(Math.exp(-e.im)+Math.exp(e.im)),.5*Math.sin(e.re)*(Math.exp(-e.im)-Math.exp(e.im)));if(u(e)){if(!e.hasBase(i.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cos is no angle");return Math.cos(e.value)}if(l(e))return o.map(e,c);if(e.valueOf()!==e)return c(e.valueOf());throw new n.error.UnsupportedTypeError("cos",e)}}},{"../../type/Complex.js":195,"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],181:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/Unit.js"),o=e("../../type/collection.js"),s=n.number.isNumBool,a=r.isComplex,u=i.isUnit,l=o.isCollection;t.cot=function c(e){if(1!=arguments.length)throw new n.error.ArgumentsError("cot",arguments.length,1);if(s(e))return 1/Math.tan(e);if(a(e)){var t=Math.exp(-4*e.im)-2*Math.exp(-2*e.im)*Math.cos(2*e.re)+1;return new r(2*Math.exp(-2*e.im)*Math.sin(2*e.re)/t,(Math.exp(-4*e.im)-1)/t)}if(u(e)){if(!e.hasBase(i.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return 1/Math.tan(e.value)}if(l(e))return o.map(e,c);if(e.valueOf()!==e)return c(e.valueOf());throw new n.error.UnsupportedTypeError("cot",e)}}},{"../../type/Complex.js":195,"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],182:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/Unit.js"),o=e("../../type/collection.js"),s=n.number.isNumBool,a=r.isComplex,u=i.isUnit,l=o.isCollection;t.csc=function c(e){if(1!=arguments.length)throw new n.error.ArgumentsError("csc",arguments.length,1);if(s(e))return 1/Math.sin(e);if(a(e)){var t=.25*(Math.exp(-2*e.im)+Math.exp(2*e.im))-.5*Math.cos(2*e.re);return new r(.5*Math.sin(e.re)*(Math.exp(-e.im)+Math.exp(e.im))/t,.5*Math.cos(e.re)*(Math.exp(-e.im)-Math.exp(e.im))/t)}if(u(e)){if(!e.hasBase(i.BASE_UNITS.ANGLE))throw new TypeError("Unit in function csc is no angle");return 1/Math.sin(e.value)}if(l(e))return o.map(e,c);if(e.valueOf()!==e)return c(e.valueOf());throw new n.error.UnsupportedTypeError("csc",e)}}},{"../../type/Complex.js":195,"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],183:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/Unit.js"),o=e("../../type/collection.js"),s=n.number.isNumBool,a=r.isComplex,u=i.isUnit,l=o.isCollection;t.sec=function c(e){if(1!=arguments.length)throw new n.error.ArgumentsError("sec",arguments.length,1);if(s(e))return 1/Math.cos(e);if(a(e)){var t=.25*(Math.exp(-2*e.im)+Math.exp(2*e.im))+.5*Math.cos(2*e.re);return new r(.5*Math.cos(e.re)*(Math.exp(-e.im)+Math.exp(e.im))/t,.5*Math.sin(e.re)*(Math.exp(e.im)-Math.exp(-e.im))/t)}if(u(e)){if(!e.hasBase(i.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sec is no angle");return 1/Math.cos(e.value)}if(l(e))return o.map(e,c);if(e.valueOf()!==e)return c(e.valueOf());throw new n.error.UnsupportedTypeError("sec",e)}}},{"../../type/Complex.js":195,"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],184:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/Unit.js"),o=e("../../type/collection.js"),s=n.number.isNumBool,a=r.isComplex,u=i.isUnit,l=o.isCollection;t.sin=function c(e){if(1!=arguments.length)throw new n.error.ArgumentsError("sin",arguments.length,1);if(s(e))return Math.sin(e);if(a(e))return new r(.5*Math.sin(e.re)*(Math.exp(-e.im)+Math.exp(e.im)),.5*Math.cos(e.re)*(Math.exp(e.im)-Math.exp(-e.im)));if(u(e)){if(!e.hasBase(i.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cos is no angle");return Math.sin(e.value)}if(l(e))return o.map(e,c);if(e.valueOf()!==e)return c(e.valueOf());throw new n.error.UnsupportedTypeError("sin",e)}}},{"../../type/Complex.js":195,"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],185:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=e("../../type/Unit.js"),o=e("../../type/collection.js"),s=n.number.isNumBool,a=r.isComplex,u=i.isUnit,l=o.isCollection;t.tan=function c(e){if(1!=arguments.length)throw new n.error.ArgumentsError("tan",arguments.length,1);if(s(e))return Math.tan(e);if(a(e)){var t=Math.exp(-4*e.im)+2*Math.exp(-2*e.im)*Math.cos(2*e.re)+1;return new r(2*Math.exp(-2*e.im)*Math.sin(2*e.re)/t,(1-Math.exp(-4*e.im))/t)}if(u(e)){if(!e.hasBase(i.BASE_UNITS.ANGLE))throw new TypeError("Unit in function tan is no angle");return Math.tan(e.value)}if(l(e))return o.map(e,c);if(e.valueOf()!==e)return c(e.valueOf());throw new n.error.UnsupportedTypeError("tan",e)}}},{"../../type/Complex.js":195,"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],186:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Unit.js"),i=e("../../type/collection.js"),o=n.string.isString,s=r.isUnit,a=i.isCollection;t["in"]=function u(e,t){if(2!=arguments.length)throw new n.error.ArgumentsError("in",arguments.length,2);if(s(e)&&(s(t)||o(t)))return e["in"](t);if(a(e)||a(t))return i.map2(e,t,u);if(e.valueOf()!==e||t.valueOf()!==t)return u(e.valueOf(),t.valueOf());throw new n.error.UnsupportedTypeError("in",e,t)}}},{"../../type/Unit.js":200,"../../type/collection.js":201,"../../util/index.js":205}],187:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=n.object;t.clone=function(e){if(1!=arguments.length)throw new n.error.ArgumentsError("clone",arguments.length,1);return r.clone(e)}}},{"../../util/index.js":205}],188:[function(e,t){t.exports=function(t){function n(e,t){var n=[],r=function(i,o){Array.isArray(i)?i.forEach(function(e,t){n[o]=t,r(e,o+1)}):t(i,n,e)};r(e,0)}var r=e("../../util/error.js"),i=e("../../type/Matrix").isMatrix;t.forEach=function(e,t){if(2!=arguments.length)throw new r.ArgumentsError("forEach",arguments.length,2);if(Array.isArray(e))return n(e,t);if(i(e))return e.forEach(t);throw new r.UnsupportedTypeError("forEach",e)}}},{"../../type/Matrix":198,"../../util/error.js":204}],189:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=n.string;t.format=function(){var e=arguments.length;if(1!=e&&2!=e)throw new n.error.ArgumentsError("format",e,1,2);return r.format.apply(r.format,arguments)}}},{"../../util/index.js":205}],190:[function(e,t){t.exports=function(t){function n(e,n,r){(r.override||void 0===t[e])&&(t[e]=r.wrap&&"function"==typeof n?function(){for(var e=[],r=0,i=arguments.length;i>r;r++)e[r]=arguments[r].valueOf();return n.apply(t,e)}:n,t.chaining.Selector.createProxy(e,n))}function r(e){return"function"==typeof e||a(e)||u(e)||l(e)||c(e)}var i=e("../../util/index.js"),o=e("../../type/Complex.js"),s=e("../../type/Unit.js"),a=i.number.isNumber,u=i.string.isString,l=o.isComplex,c=s.isUnit;t["import"]=function f(o,s){var a,l={override:!1,wrap:!0};if(s&&s instanceof Object&&i.object.extend(l,s),u(o)){if("undefined"==typeof e)throw new Error("Cannot load file: require not available.");var c=e(o);f(c)}else if(r(o)){if(a=o.name,!a)throw new Error("Cannot import an unnamed function or object");(l.override||void 0===t[a])&&n(a,o,l)}else if(o instanceof Object)for(a in o)if(o.hasOwnProperty(a)){var p=o[a];r(p)?n(a,p,l):f(p)}}}},{"../../type/Complex.js":195,"../../type/Unit.js":200,"../../util/index.js":205}],191:[function(e,t){t.exports=function(t){function n(e,t){var n=[],r=function(i,o){return Array.isArray(i)?i.map(function(e,t){return n[o]=t,r(e,o+1)}):t(i,n,e)};return r(e,0)}var r=e("../../util/error.js"),i=e("../../type/Matrix").isMatrix;t.map=function(e,t){if(2!=arguments.length)throw new r.ArgumentsError("map",arguments.length,2);if(Array.isArray(e))return n(e,t);if(i(e))return e.map(t);throw new r.UnsupportedTypeError("map",e)}}},{"../../type/Matrix":198,"../../util/error.js":204}],192:[function(e,t){t.exports=function(e){e.select=function(t){return new e.chaining.Selector(t)}}},{}],193:[function(e,t){t.exports=function(t){var n=e("../../util/index.js");t["typeof"]=function(e){if(1!=arguments.length)throw new n.error.ArgumentsError("typeof",arguments.length,1);return n.types.type(e)}}},{"../../util/index.js":205}],194:[function(e,t,n){n.precision=5},{}],195:[function(e,t,n){function r(e,t){if(!(this instanceof r))throw new SyntaxError("Complex constructor must be called with the new operator");switch(arguments.length){case 0:this.re=0,this.im=0;break;case 2:if(!m(e)||!m(t))throw new TypeError("Two numbers expected in Complex constructor");this.re=e,this.im=t;break;default:if(0!=arguments.length&&2!=arguments.length)throw new SyntaxError("Two or zero arguments expected in Complex constructor")}}function i(){for(;" "==d||" "==d;)a()}function o(e){return e>="0"&&"9">=e||"."==e}function s(e){return e>="0"&&"9">=e}function a(){g++,d=x.charAt(g)}function u(e){g=e,d=x.charAt(g)}function l(){var e,t="";if(e=g,"+"==d?a():"-"==d&&(t+=d,a()),!o(d))return u(e),null;if("."==d){if(t+=d,a(),!s(d))return u(e),null}else{for(;s(d);)t+=d,a();"."==d&&(t+=d,a())}for(;s(d);)t+=d,a();if("E"==d||"e"==d){if(t+=d,a(),("+"==d||"-"==d)&&(t+=d,a()),!s(d))return u(e),null;for(;s(d);)t+=d,a()}return t}function c(){var e=x.charAt(g+1);if("I"==d||"i"==d)return a(),"1";if(!("+"!=d&&"-"!=d||"I"!=e&&"i"!=e)){var t="+"==d?"1":"-1";return a(),a(),t}return null}var f=e("../util/index.js"),p=f.number,m=f.number.isNumber,h=f.string.isString;r.isComplex=function(e){return e instanceof r};var x,g,d;r.parse=function(e){if(x=e,g=-1,d="",!h(x))return null;a(),i();var t=l();if(t){if("I"==d||"i"==d)return a(),i(),d?null:new r(0,Number(t));i();var n=d;if("+"!=n&&"-"!=n)return i(),d?null:new r(Number(t),0);a(),i();var o=l();if(o){if("I"!=d&&"i"!=d)return null;a()}else if(o=c(),!o)return null;return"-"==n&&(o="-"==o[0]?"+"+o.substring(1):"-"+o),a(),i(),d?null:new r(Number(t),Number(o))}return(t=c())?(i(),d?null:new r(0,Number(t))):null},r.prototype.clone=function(){return new r(this.re,this.im)},r.prototype.toString=function(){var e="",t=p.format(this.re),n=p.format(this.im);return e=0==this.im?t:0==this.re?1==this.im?"i":-1==this.im?"-i":n+"i":this.im>0?1==this.im?t+" + i":t+" + "+n+"i":-1==this.im?t+" - i":t+" - "+p.format(Math.abs(this.im))+"i"},t.exports=r,n.isComplex=r.isComplex,n.parse=r.parse,f.types.addType("complex",r)},{"../util/index.js":205}],196:[function(e,t,n){function r(e,t){this.math=e,this.doc=t}var i=e("../util/index.js"),o=i.object,s=i.string;r.isHelp=function(e){return e instanceof r},r.prototype.toString=function(){var e=this.doc||{},t="\n";if(e.name&&(t+="Name: "+e.name+"\n\n"),e.category&&(t+="Category: "+e.category+"\n\n"),e.description&&(t+="Description:\n "+e.description+"\n\n"),e.syntax&&(t+="Syntax:\n "+e.syntax.join("\n ")+"\n\n"),e.examples){var n=this.math.parser();t+="Examples:\n";for(var i=0;i<e.examples.length;i++){var o,a=e.examples[i];try{o=n.eval(a)}catch(u){o=u}t+=" "+a+"\n",!o||o instanceof r||(t+=" "+s.format(o)+"\n")}t+="\n"}return e.seealso&&(t+="See also: "+e.seealso.join(", ")+"\n"),t},r.prototype.toJSON=function(){return o.extend({},this.doc)},t.exports=r,n.isHelp=r.isHelp,i.types.addType("help",r)},{"../util/index.js":205}],197:[function(e,t,n){function r(){if(!(this instanceof r))throw new SyntaxError("Index constructor must be called with the new operator");this._ranges=[];for(var e=0,t=arguments.length;t>e;e++){var n=arguments[e];if(n instanceof s)this._ranges.push(n);else if(n&&(n=n.valueOf()),isArray(n))this._ranges.push(i(n));else{if(!isNumber(n))throw new TypeError("Range expected as Array, Number, or String");this._ranges.push(i([n,n+1]))}}}function i(e){for(var t=e.length,n=0;t>n;n++)if(!isNumber(e[n])||!isInteger(e[n]))throw new TypeError("Index parameters must be integer numbers");switch(e.length){case 2:return new s(e[0],e[1]);case 3:return new s(e[0],e[1],e[2]);default:throw new SyntaxError("Wrong number of arguments in Index (2 or 3 expected)")}}var o=e("../util/index"),s=e("./Range");number=o.number,isNumber=number.isNumber,isInteger=number.isInteger,isArray=Array.isArray,validateIndex=o.array.validateIndex,r.prototype.clone=function(){var e=new r;return e._ranges=o.object.clone(this._ranges),e},r.isIndex=function(e){return e instanceof r},r.create=function(e){var t=new r;return r.apply(t,e),t},r.prototype.size=function(){for(var e=[],t=0,n=this._ranges.length;n>t;t++){var r=this._ranges[t];r instanceof s?e.push(r.size()[0]):e.push(null)}return e},r.prototype.forEach=function(e){for(var t=0,n=this._ranges.length;n>t;t++)e(this._ranges[t],t,this)},r.prototype.range=function(e){return this._ranges[e]},r.prototype.toArray=function(){for(var e=[],t=0,n=this._ranges.length;n>t;t++){var r=this._ranges[t],i=[],o=r.start,s=r.end,a=r.step;if(a>0)for(;s>o;)i.push(o),o+=a;else if(0>a)for(;o>s;)i.push(o),o+=a;e.push(i)}return e},r.prototype.valueOf=r.prototype.toArray,r.prototype.toString=function(){for(var e=[],t=0,n=this._ranges.length;n>t;t++){var r=this._ranges[t],i=number.format(r.start);1!=r.step&&(i+=":"+number.format(r.step)),i+=":"+number.format(r.end),e.push(i)}return"["+e.join(",")+"]"},t.exports=r,n.isIndex=r.isIndex,n.create=r.create,o.types.addType("index",r)},{"../util/index":205,"./Range":199}],198:[function(e,t,n){function r(e){if(!(this instanceof r))throw new SyntaxError("Matrix constructor must be called with the new operator");if(e instanceof r)this._data=e.clone()._data;else if(Array.isArray(e))this._data=e;else{if(null!=e)throw new TypeError("Unsupported type of data ("+v.types.type(e)+")");this._data=[]}this._size=w.size(this._data)}function i(e,t){if(!(t instanceof j))throw new TypeError("Invalid index");var n=t.size(),i=!n.some(function(e){return 1!=e});if(n.length!=e._size.length)throw new RangeError("Dimension mismatch ("+n.length+" != "+e._size.length+")");if(i)switch(n.length){case 1:return a(e._data,t);case 2:return u(e._data,t);default:return s(e._data,t)}else switch(n.length){case 1:return new r(l(e._data,t));case 2:return new r(c(e._data,t));default:return new r(f(e._data,t,0))}}function o(e,t){return w.validateIndex(t,e.length),e[t]}function s(e,t){return t.forEach(function(t){e=o(e,t.start)}),E.clone(e)}function a(e,t){return o(e,t.range(0).start)}function u(e,t){return o(o(e,t.range(0).start),t.range(1).start)}function l(e,t){var n=t.range(0);return n.map(function(t){return o(e,t)})}function c(e,t){var n=t.range(0),r=t.range(1);return n.map(function(t){var n=o(e,t);return r.map(function(e){return o(n,e)})})}function f(e,t,n){var r=n==t.size().length-1,i=t.range(n);return r?i.map(function(t){return o(e,t)}):i.map(function(r){var i=o(e,r);return f(i,t,n+1)})}function p(e,t,n){if(!(t instanceof j))throw new TypeError("Invalid index");var i=t.size(),o=!i.some(function(e){return 1!=e});if(i.length<e._size.length)throw new RangeError("Dimension mismatch ("+i.length+" != "+e._size.length+")");if(n instanceof r&&(n=n.valueOf()),o){if(0!=w.size(n.valueOf()).length)throw new TypeError("Scalar value expected");switch(t.length){case 1:x(e._data,e._size,t,n);break;case 2:g(e._data,e._size,t,n);break;default:h(e._data,e._size,t,n)}}else{var s=e._size.concat();d(e._data,s,t,0,n),E.deepEqual(e._size,s)||(y(e._data),e.resize(s))}return e}function m(e,t,n){if(w.validateIndex(t),Array.isArray(n))throw new TypeError("Dimension mismatch, value expected instead of array");
e[t]=n}function h(e,t,n,r){var i=!1;n.size().length>t.length&&(i=!0),n.forEach(function(e,n){var r=e.start;w.validateIndex(r),(null==t[n]||r+1>t[n])&&(t[n]=r+1,i=!0)}),i&&w.resize(e,t,0);var o=t.length;n.forEach(function(t,n){var i=t.start;o-1>n?e=e[i]:e[i]=r})}function x(e,t,n,r){var i=n.range(0).start;w.validateIndex(i),i+1>t[0]&&(w.resize(e,[i+1],0),t[0]=i+1),e[i]=r}function g(e,t,n,r){var i=n.range(0).start,o=n.range(1).start;w.validateIndex(i),w.validateIndex(o);var s=!1;i+1>(t[0]||0)&&(t[0]=i+1,s=!0),o+1>(t[1]||0)&&(t[1]=o+1,s=!0),s&&w.resize(e,t,0),e[i][o]=r}function d(e,t,n,r,i){var o=r==n.size().length-1,s=n.range(r),a=s.size()[0];if(a!=i.length)throw new RangeError("Dimensions mismatch ("+a+" != "+i.length+")");o?s.forEach(function(n,o){m(e,n,i[o]),n+1>(t[r]||0)&&(t[r]=n+1)}):s.forEach(function(o,s){var a=e[o];Array.isArray(a)||(e[o]=a=[a]),o+1>(t[r]||0)&&(t[r]=o+1),d(a,t,n,r+1,i[s])})}function y(e){for(var t=0,n=e.length;n>t;t++){var r=e[t];Array.isArray(r)?y(r):void 0==r&&(e[t]=0)}}var v=e("../util/index"),j=e("./Index"),b=(v.number,v.string),w=v.array,E=v.object;r.isMatrix=function(e){return e instanceof r},r.prototype.subset=function(e,t){switch(arguments.length){case 1:return i(this,e);case 2:return p(this,e,t);default:throw new v.error.ArgumentsError("subset",arguments.length,1,2)}},r.prototype.get=function(){throw new Error("Matrix.get is removed. Use matrix.subet(index) instead.")},r.prototype.set=function(){throw new Error("Matrix.set is removed. Use matrix.subet(index, replacement) instead.")},r.prototype.resize=function(e,t){w.resize(this._data,e,t),this._size=E.clone(e)},r.prototype.clone=function(){var e=new r;return e._data=E.clone(this._data),e._size=E.clone(this._size),e},r.prototype.size=function(){return this._size},r.prototype.map=function(e){var t=this,n=new r,i=[],o=function(n,r){return Array.isArray(n)?n.map(function(e,t){return i[r]=t,o(e,r+1)}):e(n,i,t)};return n._data=o(this._data,0),n._size=E.clone(this._size),n},r.prototype.forEach=function(e){var t=this,n=[],r=function(i,o){Array.isArray(i)?i.forEach(function(e,t){n[o]=t,r(e,o+1)}):e(i,n,t)};r(this._data,0)},r.prototype.toScalar=function(){for(var e=this._data;Array.isArray(e)&&1==e.length;)e=e[0];return Array.isArray(e)?null:E.clone(e)},r.prototype.isScalar=function(){return this._size.every(function(e){return 1>=e})},r.prototype.toVector=function(){var e=0,t=void 0,n=[];if(this._size.forEach(function(r,i){r>1&&(e++,t=i),n[i]=0}),0==e){var r=this.toScalar();return r?[r]:[]}if(1==e){var i=[],o=function(e){Array.isArray(e)?e.forEach(o):i.push(e)};return o(this._data),i}return null},r.prototype.isVector=function(){var e=0;return this._size.forEach(function(t){t>1&&e++}),1>=e},r.prototype.toArray=function(){return E.clone(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.toString=function(){return b.format(this._data)},t.exports=r,n.isMatrix=r.isMatrix,v.types.addType("matrix",r)},{"../util/index":205,"./Index":197}],199:[function(e,t,n){function r(e,t,n){if(!(this instanceof r))throw new SyntaxError("Range constructor must be called with the new operator");if(null!=e&&!o.isNumber(e))throw new TypeError("Parameter start must be a number");if(null!=t&&!o.isNumber(t))throw new TypeError("Parameter end must be a number");if(null!=n&&!o.isNumber(n))throw new TypeError("Parameter step must be a number");this.start=null!=e?e:0,this.end=null!=t?t:0,this.step=null!=n?n:1}var i=e("../util/index.js"),o=i.number,s=i.string;i.array,r.parse=function(e){if(!s.isString(e))return null;var t=e.split(":"),n=t.map(function(e){return Number(e)}),i=n.some(function(e){return isNaN(e)});if(i)return null;switch(n.length){case 2:return new r(n[0],n[1]);case 3:return new r(n[0],n[2],n[1]);default:return null}},r.prototype.clone=function(){return new r(this.start,this.end,this.step)},r.isRange=function(e){return e instanceof r},r.prototype.size=function(){var e=0,t=Number(this.start),n=Number(this.step),r=Number(this.end),i=r-t;return o.sign(n)==o.sign(i)?e=Math.ceil(i/n):0==i&&(e=0),isNaN(e)&&(e=0),[e]},r.prototype.forEach=function(e){var t=Number(this.start),n=Number(this.step),r=Number(this.end),i=0;if(n>0)for(;r>t;)e(t,i,this),t+=n,i++;else if(0>n)for(;t>r;)e(t,i,this),t+=n,i++},r.prototype.map=function(e){var t=[];return this.forEach(function(n,r,i){t[r]=e(n,r,i)}),t},r.prototype.toArray=function(){var e=[];return this.forEach(function(t,n){e[n]=t}),e},r.prototype.toVector=r.prototype.toArray,r.prototype.isVector=function(){return!0},r.prototype.toScalar=function(){var e=this.toArray();return 1==e.length?e[0]:null},r.prototype.isScalar=function(){return 1==this.size()[0]},r.prototype.valueOf=function(){return this.toArray()},r.prototype.toString=function(){var e=o.format(Number(this.start));return 1!=this.step&&(e+=":"+o.format(Number(this.step))),e+=":"+o.format(Number(this.end))},t.exports=r,n.isRange=r.isRange,n.parse=r.parse,i.types.addType("range",r)},{"../util/index.js":205}],200:[function(e,t,n){function r(e,t){if(!(this instanceof r))throw new Error("Unit constructor must be called with the new operator");if(null!=e&&!y(e))throw new TypeError("First parameter in Unit constructor must be a number");if(null!=t&&!v(t))throw new TypeError("Second parameter in Unit constructor must be a string");if(null!=t){var n=f(t);if(!n)throw new SyntaxError('String "'+t+'" is no unit');this.unit=n.unit,this.prefix=n.prefix}else this.unit=UNIT_NONE,this.prefix=b;null!=e?(this.value=this._normalize(e),this.fixPrefix=!1):(this.value=null,this.fixPrefix=!0)}function i(){for(;" "==h||" "==h;)a()}function o(e){return e>="0"&&"9">=e||"."==e}function s(e){return e>="0"&&"9">=e}function a(){m++,h=p.charAt(m)}function u(e){m=e,h=p.charAt(m)}function l(){var e,t="";if(e=m,"+"==h?a():"-"==h&&(t+=h,a()),!o(h))return u(e),null;if("."==h){if(t+=h,a(),!s(h))return u(e),null}else{for(;s(h);)t+=h,a();"."==h&&(t+=h,a())}for(;s(h);)t+=h,a();if("E"==h||"e"==h){if(t+=h,a(),("+"==h||"-"==h)&&(t+=h,a()),!s(h))return u(e),null;for(;s(h);)t+=h,a()}return t}function c(){var e="";for(i();h&&" "!=h&&" "!=h;)e+=h,a();return e||null}function f(e){for(var t=0,n=E.length;n>t;t++){var r=E[t];if(d.endsWith(e,r.name)){var i=e.length-r.name.length,o=e.substring(0,i),s=r.prefixes[o];if(void 0!==s)return{unit:r,prefix:s}}}return null}var p,m,h,x=e("../util/index.js"),g=x.number,d=x.string,y=x.number.isNumber,v=x.string.isString;r.parse=function(e){if(p=e,m=-1,h="",!v(p))return null;a(),i();var t,n=l();return n?(t=c(),a(),i(),h?null:n&&t?new r(Number(n),t):null):(t=c(),a(),i(),h?null:new r(null,t))},r.isUnit=function(e){return e instanceof r},r.prototype.clone=function(){var e=new r;for(var t in this)this.hasOwnProperty(t)&&(e[t]=this[t]);return e},r.prototype._normalize=function(e){return(e+this.unit.offset)*this.unit.value*this.prefix.value},r.prototype._unnormalize=function(e,t){return void 0==t?e/this.unit.value/this.prefix.value-this.unit.offset:e/this.unit.value/t-this.unit.offset},r.isPlainUnit=function(e){return null!=f(e)},r.prototype.hasBase=function(e){return void 0===this.unit.base?void 0===e:this.unit.base===e},r.prototype.equalBase=function(e){return this.unit.base===e.unit.base},r.prototype.equals=function(e){return this.equalBase(e)&&this.value==e.value},r.prototype["in"]=function(e){var t;if(v(e)){if(t=new r(null,e),!this.equalBase(t))throw new Error("Units do not match");return t.value=this.value,t}if(e instanceof r){if(!this.equalBase(e))throw new Error("Units do not match");if(null!=e.value)throw new Error("Cannot convert to a unit with a value");if(null==e.unit)throw new Error("Unit expected on the right hand side of function in");return t=e.clone(),t.value=this.value,t.fixPrefix=!0,t}throw new Error("String or Unit expected as parameter")},r.prototype.toNumber=function(e){var t=this["in"](e),n=this.fixPrefix?t._bestPrefix():t.prefix;return t._unnormalize(t.value,n.value)},r.prototype.toString=function(){var e,t;if(this.fixPrefix)e=this._unnormalize(this.value),t=null!=this.value?g.format(e)+" ":"",t+=this.prefix.name+this.unit.name;else{var n=this._bestPrefix();e=this._unnormalize(this.value,n.value),t=null!=this.value?g.format(e)+" ":"",t+=n.name+this.unit.name}return t},r.prototype._bestPrefix=function(){var e=Math.abs(this.value/this.unit.value),t=b,n=Math.abs(Math.log(e/t.value)/Math.LN10-1.2),r=this.unit.prefixes;for(var i in r)if(r.hasOwnProperty(i)){var o=r[i];if(o.scientific){var s=Math.abs(Math.log(e/o.value)/Math.LN10-1.2);n>s&&(t=o,n=s)}}return t};var j={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!1},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0}},BINARY_SHORT:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1024,scientific:!0},M:{name:"M",value:Math.pow(1024,2),scientific:!0},G:{name:"G",value:Math.pow(1024,3),scientific:!0},T:{name:"T",value:Math.pow(1024,4),scientific:!0},P:{name:"P",value:Math.pow(1024,5),scientific:!0},E:{name:"E",value:Math.pow(1024,6),scientific:!0},Z:{name:"Z",value:Math.pow(1024,7),scientific:!0},Y:{name:"Y",value:Math.pow(1024,8),scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1024,scientific:!0},mega:{name:"mega",value:Math.pow(1024,2),scientific:!0},giga:{name:"giga",value:Math.pow(1024,3),scientific:!0},tera:{name:"tera",value:Math.pow(1024,4),scientific:!0},peta:{name:"peta",value:Math.pow(1024,5),scientific:!0},exa:{name:"exa",value:Math.pow(1024,6),scientific:!0},zetta:{name:"zetta",value:Math.pow(1024,7),scientific:!0},yotta:{name:"yotta",value:Math.pow(1024,8),scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}}},b={name:"",value:1,scientific:!0},w={NONE:{},LENGTH:{},MASS:{},TIME:{},CURRENT:{},TEMPERATURE:{},LUMINOUS_INTENSITY:{},AMOUNT_OF_SUBSTANCE:{},FORCE:{},SURFACE:{},VOLUME:{},ANGLE:{},BIT:{}};BASE_UNIT_NONE={},UNIT_NONE={name:"",base:BASE_UNIT_NONE,value:1,offset:0};var E=[{name:"meter",base:w.LENGTH,prefixes:j.LONG,value:1,offset:0},{name:"inch",base:w.LENGTH,prefixes:j.NONE,value:.0254,offset:0},{name:"foot",base:w.LENGTH,prefixes:j.NONE,value:.3048,offset:0},{name:"yard",base:w.LENGTH,prefixes:j.NONE,value:.9144,offset:0},{name:"mile",base:w.LENGTH,prefixes:j.NONE,value:1609.344,offset:0},{name:"link",base:w.LENGTH,prefixes:j.NONE,value:.201168,offset:0},{name:"rod",base:w.LENGTH,prefixes:j.NONE,value:5.02921,offset:0},{name:"chain",base:w.LENGTH,prefixes:j.NONE,value:20.1168,offset:0},{name:"angstrom",base:w.LENGTH,prefixes:j.NONE,value:1e-10,offset:0},{name:"m",base:w.LENGTH,prefixes:j.SHORT,value:1,offset:0},{name:"ft",base:w.LENGTH,prefixes:j.NONE,value:.3048,offset:0},{name:"yd",base:w.LENGTH,prefixes:j.NONE,value:.9144,offset:0},{name:"mi",base:w.LENGTH,prefixes:j.NONE,value:1609.344,offset:0},{name:"li",base:w.LENGTH,prefixes:j.NONE,value:.201168,offset:0},{name:"rd",base:w.LENGTH,prefixes:j.NONE,value:5.02921,offset:0},{name:"ch",base:w.LENGTH,prefixes:j.NONE,value:20.1168,offset:0},{name:"mil",base:w.LENGTH,prefixes:j.NONE,value:254e-7,offset:0},{name:"m2",base:w.SURFACE,prefixes:j.SHORT,value:1,offset:0},{name:"sqin",base:w.SURFACE,prefixes:j.NONE,value:64516e-8,offset:0},{name:"sqft",base:w.SURFACE,prefixes:j.NONE,value:.09290304,offset:0},{name:"sqyd",base:w.SURFACE,prefixes:j.NONE,value:.83612736,offset:0},{name:"sqmi",base:w.SURFACE,prefixes:j.NONE,value:2589988.110336,offset:0},{name:"sqrd",base:w.SURFACE,prefixes:j.NONE,value:25.29295,offset:0},{name:"sqch",base:w.SURFACE,prefixes:j.NONE,value:404.6873,offset:0},{name:"sqmil",base:w.SURFACE,prefixes:j.NONE,value:6.4516e-10,offset:0},{name:"m3",base:w.VOLUME,prefixes:j.SHORT,value:1,offset:0},{name:"L",base:w.VOLUME,prefixes:j.SHORT,value:.001,offset:0},{name:"litre",base:w.VOLUME,prefixes:j.LONG,value:.001,offset:0},{name:"cuin",base:w.VOLUME,prefixes:j.NONE,value:16387064e-12,offset:0},{name:"cuft",base:w.VOLUME,prefixes:j.NONE,value:.028316846592,offset:0},{name:"cuyd",base:w.VOLUME,prefixes:j.NONE,value:.764554857984,offset:0},{name:"teaspoon",base:w.VOLUME,prefixes:j.NONE,value:5e-6,offset:0},{name:"tablespoon",base:w.VOLUME,prefixes:j.NONE,value:15e-6,offset:0},{name:"minim",base:w.VOLUME,prefixes:j.NONE,value:6.161152e-8,offset:0},{name:"fluiddram",base:w.VOLUME,prefixes:j.NONE,value:36966911e-13,offset:0},{name:"fluidounce",base:w.VOLUME,prefixes:j.NONE,value:2957353e-11,offset:0},{name:"gill",base:w.VOLUME,prefixes:j.NONE,value:.0001182941,offset:0},{name:"cup",base:w.VOLUME,prefixes:j.NONE,value:.0002365882,offset:0},{name:"pint",base:w.VOLUME,prefixes:j.NONE,value:.0004731765,offset:0},{name:"quart",base:w.VOLUME,prefixes:j.NONE,value:.0009463529,offset:0},{name:"gallon",base:w.VOLUME,prefixes:j.NONE,value:.003785412,offset:0},{name:"beerbarrel",base:w.VOLUME,prefixes:j.NONE,value:.1173478,offset:0},{name:"oilbarrel",base:w.VOLUME,prefixes:j.NONE,value:.1589873,offset:0},{name:"hogshead",base:w.VOLUME,prefixes:j.NONE,value:.238481,offset:0},{name:"fldr",base:w.VOLUME,prefixes:j.NONE,value:36966911e-13,offset:0},{name:"floz",base:w.VOLUME,prefixes:j.NONE,value:2957353e-11,offset:0},{name:"gi",base:w.VOLUME,prefixes:j.NONE,value:.0001182941,offset:0},{name:"cp",base:w.VOLUME,prefixes:j.NONE,value:.0002365882,offset:0},{name:"pt",base:w.VOLUME,prefixes:j.NONE,value:.0004731765,offset:0},{name:"qt",base:w.VOLUME,prefixes:j.NONE,value:.0009463529,offset:0},{name:"gal",base:w.VOLUME,prefixes:j.NONE,value:.003785412,offset:0},{name:"bbl",base:w.VOLUME,prefixes:j.NONE,value:.1173478,offset:0},{name:"obl",base:w.VOLUME,prefixes:j.NONE,value:.1589873,offset:0},{name:"g",base:w.MASS,prefixes:j.SHORT,value:.001,offset:0},{name:"gram",base:w.MASS,prefixes:j.LONG,value:.001,offset:0},{name:"ton",base:w.MASS,prefixes:j.SHORT,value:907.18474,offset:0},{name:"tonne",base:w.MASS,prefixes:j.SHORT,value:1e3,offset:0},{name:"grain",base:w.MASS,prefixes:j.NONE,value:6479891e-11,offset:0},{name:"dram",base:w.MASS,prefixes:j.NONE,value:.0017718451953125,offset:0},{name:"ounce",base:w.MASS,prefixes:j.NONE,value:.028349523125,offset:0},{name:"poundmass",base:w.MASS,prefixes:j.NONE,value:.45359237,offset:0},{name:"hundredweight",base:w.MASS,prefixes:j.NONE,value:45.359237,offset:0},{name:"stick",base:w.MASS,prefixes:j.NONE,value:.115,offset:0},{name:"gr",base:w.MASS,prefixes:j.NONE,value:6479891e-11,offset:0},{name:"dr",base:w.MASS,prefixes:j.NONE,value:.0017718451953125,offset:0},{name:"oz",base:w.MASS,prefixes:j.NONE,value:.028349523125,offset:0},{name:"lbm",base:w.MASS,prefixes:j.NONE,value:.45359237,offset:0},{name:"cwt",base:w.MASS,prefixes:j.NONE,value:45.359237,offset:0},{name:"s",base:w.TIME,prefixes:j.SHORT,value:1,offset:0},{name:"min",base:w.TIME,prefixes:j.NONE,value:60,offset:0},{name:"h",base:w.TIME,prefixes:j.NONE,value:3600,offset:0},{name:"seconds",base:w.TIME,prefixes:j.LONG,value:1,offset:0},{name:"second",base:w.TIME,prefixes:j.LONG,value:1,offset:0},{name:"sec",base:w.TIME,prefixes:j.LONG,value:1,offset:0},{name:"minutes",base:w.TIME,prefixes:j.NONE,value:60,offset:0},{name:"minute",base:w.TIME,prefixes:j.NONE,value:60,offset:0},{name:"hours",base:w.TIME,prefixes:j.NONE,value:3600,offset:0},{name:"hour",base:w.TIME,prefixes:j.NONE,value:3600,offset:0},{name:"day",base:w.TIME,prefixes:j.NONE,value:86400,offset:0},{name:"days",base:w.TIME,prefixes:j.NONE,value:86400,offset:0},{name:"rad",base:w.ANGLE,prefixes:j.NONE,value:1,offset:0},{name:"deg",base:w.ANGLE,prefixes:j.NONE,value:.017453292519943295,offset:0},{name:"grad",base:w.ANGLE,prefixes:j.NONE,value:.015707963267948967,offset:0},{name:"cycle",base:w.ANGLE,prefixes:j.NONE,value:6.283185307179586,offset:0},{name:"A",base:w.CURRENT,prefixes:j.SHORT,value:1,offset:0},{name:"ampere",base:w.CURRENT,prefixes:j.LONG,value:1,offset:0},{name:"K",base:w.TEMPERATURE,prefixes:j.NONE,value:1,offset:0},{name:"degC",base:w.TEMPERATURE,prefixes:j.NONE,value:1,offset:273.15},{name:"degF",base:w.TEMPERATURE,prefixes:j.NONE,value:1/1.8,offset:459.67},{name:"degR",base:w.TEMPERATURE,prefixes:j.NONE,value:1/1.8,offset:0},{name:"kelvin",base:w.TEMPERATURE,prefixes:j.NONE,value:1,offset:0},{name:"celsius",base:w.TEMPERATURE,prefixes:j.NONE,value:1,offset:273.15},{name:"fahrenheit",base:w.TEMPERATURE,prefixes:j.NONE,value:1/1.8,offset:459.67},{name:"rankine",base:w.TEMPERATURE,prefixes:j.NONE,value:1/1.8,offset:0},{name:"mol",base:w.AMOUNT_OF_SUBSTANCE,prefixes:j.NONE,value:1,offset:0},{name:"mole",base:w.AMOUNT_OF_SUBSTANCE,prefixes:j.NONE,value:1,offset:0},{name:"cd",base:w.LUMINOUS_INTENSITY,prefixes:j.NONE,value:1,offset:0},{name:"candela",base:w.LUMINOUS_INTENSITY,prefixes:j.NONE,value:1,offset:0},{name:"N",base:w.FORCE,prefixes:j.SHORT,value:1,offset:0},{name:"newton",base:w.FORCE,prefixes:j.LONG,value:1,offset:0},{name:"lbf",base:w.FORCE,prefixes:j.NONE,value:4.4482216152605,offset:0},{name:"poundforce",base:w.FORCE,prefixes:j.NONE,value:4.4482216152605,offset:0},{name:"b",base:w.BIT,prefixes:j.BINARY_SHORT,value:1,offset:0},{name:"bits",base:w.BIT,prefixes:j.BINARY_LONG,value:1,offset:0},{name:"B",base:w.BIT,prefixes:j.BINARY_SHORT,value:8,offset:0},{name:"bytes",base:w.BIT,prefixes:j.BINARY_LONG,value:8,offset:0}];r.PREFIXES=j,r.BASE_UNITS=w,r.UNITS=E,t.exports=r,n.isUnit=r.isUnit,n.isPlainUnit=r.isPlainUnit,n.parse=r.parse,x.types.addType("unit",r)},{"../util/index.js":205}],201:[function(e,t,n){var r=e("../util/index.js"),i=e("./Matrix.js"),o=Array.isArray;r.string.isString,n.argsToArray=function(e){var t;return 0==e.length?t=[]:1==e.length?(t=e[0],t instanceof i&&(t=t.toVector()),o(t)||(t=[t])):t=Array.prototype.slice.apply(e),t},n.isCollection=function(e){return o(e)||e instanceof i},n.map=function(e,t){if(e&&e.map)return e.map(function(e){return t(e)});throw new TypeError("Array expected")},n.deepMap=function s(e,t){return e&&e.map?e.map(function(e){return s(e,t)}):t(e)},n.map2=function a(e,t,n){var r,s,u;if(e instanceof i||t instanceof i)return new i(a(e.valueOf(),t.valueOf(),n));if(o(e))if(o(t)){if(e.length!=t.length)throw new RangeError("Dimension mismatch ("+e.length+" != "+t.length+")");for(r=[],s=e.length,u=0;s>u;u++)r[u]=n(e[u],t[u])}else for(r=[],s=e.length,u=0;s>u;u++)r[u]=n(e[u],t);else if(o(t))for(r=[],s=t.length,u=0;s>u;u++)r[u]=n(e,t[u]);else r=n(e,t);return r},n.deepMap2=function u(e,t,n){var r,s,a;if(e instanceof i||t instanceof i)return new i(u(e.valueOf(),t.valueOf(),n));if(o(e))if(o(t)){if(e.length!=t.length)throw new RangeError("Dimension mismatch ("+e.length+" != "+t.length+")");for(r=[],s=e.length,a=0;s>a;a++)r[a]=u(e[a],t[a],n)}else for(r=[],s=e.length,a=0;s>a;a++)r[a]=u(e[a],t,n);else if(o(t))for(r=[],s=t.length,a=0;s>a;a++)r[a]=u(e,t[a],n);else r=n(e,t);return r}},{"../util/index.js":205,"./Matrix.js":198}],202:[function(e,t,n){function r(e){if(Array.isArray(e)){var t=e.length,n=t?r(e[0]):[];return n.unshift(t),n}return[]}function i(e,t,n){var r,o=e.length;if(o!=t[n])throw new RangeError("Dimension mismatch ("+o+" != "+t[n]+")");if(n<t.length-1){var s=n+1;for(r=0;o>r;r++){var a=e[r];if(!Array.isArray(a))throw new RangeError("Dimension mismatch ("+(t.length-1)+" < "+t.length+")");i(e[r],t,s)}}else for(r=0;o>r;r++)if(Array.isArray(e[r]))throw new RangeError("Dimension mismatch ("+(t.length+1)+" > "+t.length+")")}function o(e,t,n,r){if(!Array.isArray(e))throw new TypeError("Array expected");var i=e.length,s=t[n];if(i!=s){if(s>e.length)for(var a=e.length;s>a;a++)e[a]=r?u.clone(r):0;else e.length=t[n];i=e.length}if(n<t.length-1){var l=n+1;for(a=0;i>a;a++)c=e[a],Array.isArray(c)||(c=[c],e[a]=c),o(c,t,l,r)}else for(a=0;i>a;a++){for(var c=e[a];Array.isArray(c);)c=c[0];e[a]=c}}var s=e("./number"),a=e("./string"),u=e("./object"),l=e("./types"),c=Array.isArray;n.size=function(e){var t=r(e);return n.validate(e,t),t},n.validate=function(e,t){var n=0==t.length;if(n){if(Array.isArray(e))throw new RangeError("Dimension mismatch ("+e.length+" != 0)")}else i(e,t,0)},n.validateIndex=function(e,t){if(!s.isNumber(e)||!s.isInteger(e))throw new TypeError("Index must be an integer (value: "+e+")");if(0>e)throw new RangeError("Index out of range ("+e+" < 0)");if(void 0!==t&&e>=t)throw new RangeError("Index out of range ("+e+" > "+(t-1)+")")},n.resize=function(e,t,n){if(!Array.isArray(t))throw new TypeError("Size must be an array (size is "+l.type(t)+")");t.forEach(function(e){if(!s.isNumber(e)||!s.isInteger(e)||0>e)throw new TypeError("Invalid size, must contain positive integers (size: "+a.format(t)+")")}),o(e,t,0,n)},n.squeeze=function(e){for(;c(e)&&1===e.length;)e=e[0];return e},n.unsqueeze=function(e,t){for(var r=n.size(e),i=0,o=t-r.length;o>i;i++)e=[e];return e},n.isArray=Array.isArray},{"./number":206,"./object":207,"./string":208,"./types":209}],203:[function(e,t,n){n.isBoolean=function(e){return e instanceof Boolean||"boolean"==typeof e}},{}],204:[function(e,t,n){var r=e("./types.js");n.UnsupportedTypeError=function(e,t){if(2==arguments.length){var n=r.type(t);this.message="Function "+e+"("+n+") not supported"}else if(arguments.length>2){for(var i=[],o=1;o<arguments.length;o++)i.push(r.type(arguments[o]));this.message="Function "+e+"("+i.join(", ")+") not supported"}else this.message="Unsupported parameter in function "+e},n.UnsupportedTypeError.prototype=new TypeError,n.UnsupportedTypeError.prototype.name="UnsupportedTypeError",n.ArgumentsError=function(e,t,n,r){this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+n+(void 0!=r?"-"+r:"")+" expected)"},n.ArgumentsError.prototype=new SyntaxError,n.ArgumentsError.prototype.name="ArgumentError"},{"./types.js":209}],205:[function(e,t,n){n.array=e("./array"),n.boolean=e("./boolean"),n.error=e("./error"),n.number=e("./number"),n.object=e("./object"),n.string=e("./string"),n.types=e("./types")},{"./array":202,"./boolean":203,"./error":204,"./number":206,"./object":207,"./string":208,"./types":209}],206:[function(e,t,n){var r=e("../options.js");n.isNumber=function(e){return e instanceof Number||"number"==typeof e},n.isNumBool=function(e){var t=typeof e;return"number"===t||"boolean"===t||e instanceof Number||e instanceof Boolean},n.isInteger=function(e){return e==Math.round(e)},n.format=function(e,t){if(1/0===e)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var r=Math.abs(e);if(r>.001&&1e5>r||0==r)return n.toPrecision(e,t);var i=Math.round(Math.log(r)/Math.LN10),o=e/Math.pow(10,i);return n.toPrecision(o,t)+"e"+i},n.sign=function(e){return e>0?1:0>e?-1:0},n.toPrecision=function(e,t){return void 0===t&&(t=r.precision),e.toPrecision(t).replace(i,function(e,t,n){return e.substring(0,e.length-(t.length?0:1)-n.length)})};var i=/\.(\d*?)(0+)$/g},{"../options.js":194}],207:[function(e,t,n){var r=e("./number.js"),i=e("./string.js"),o=e("./boolean.js");n.clone=function s(e){if(null==e)return e;if("function"==typeof e.clone)return e.clone();if(r.isNumber(e)||i.isString(e)||o.isBoolean(e))return e;if(Array.isArray(e))return e.map(function(e){return s(e)});if(e instanceof Object){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=s(e[n]))}throw new TypeError("Cannot clone "+e)},n.extend=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},n.deepExtend=function a(e,t){for(var n in t)t.hasOwnProperty(n)&&(t[n]&&t[n].constructor===Object?(void 0===e[n]&&(e[n]={}),e[n].constructor===Object?a(e[n],t[n]):e[n]=t[n]):e[n]=t[n]);return e},n.deepEqual=function(e,t){var r,i,o;if(Array.isArray(e)){if(!Array.isArray(t))return!1;for(i=0,o=e.length;o>i;i++)if(!n.deepEqual(e[i],t[i]))return!1;return!0}if(e instanceof Object){if(Array.isArray(t)||!(t instanceof Object))return!1;for(r in e)if(e.hasOwnProperty(r)&&!n.deepEqual(e[r],t[r]))return!1;for(r in t)if(t.hasOwnProperty(r)&&!n.deepEqual(e[r],t[r]))return!1;return!0}return e.valueOf()==t.valueOf()}},{"./boolean.js":203,"./number.js":206,"./string.js":208}],208:[function(e,t,n){function r(e){if(Array.isArray(e)){for(var t="[",i=e.length,o=0;i>o;o++)0!=o&&(t+=", "),t+=r(e[o]);return t+="]"}return n.format(e)}var i=e("./number.js");n.isString=function(e){return e instanceof String||"string"==typeof e},n.endsWith=function(e,t){var n=e.length-t.length,r=e.length;return e.substring(n,r)===t},n.format=function(e,t){var o=arguments.length;if(1==o){var s=arguments[0];return i.isNumber(s)?i.format(s):Array.isArray(s)?r(s):n.isString(s)?'"'+s+'"':s instanceof Object?s.toString():String(s)}if(!n.isString(e))throw new TypeError("String expected as first parameter in function format");if(!(t instanceof Object))throw new TypeError("Object expected as second parameter in function format");return e.replace(/\$([\w\.]+)/g,function(e,n){for(var r=n.split("."),i=t[r.shift()];r.length&&void 0!=i;){var o=r.shift();i=o?i[o]:i+"."}return void 0!=i?i:e})}},{"./number.js":206}],209:[function(e,t,n){n.type=function i(e){var t,i=typeof e;if("object"===i){if(null===e)return"null";if(e instanceof Boolean)return"boolean";if(e instanceof Number)return"number";if(e instanceof String)return"string";if(Array.isArray(e))return"array";if(e instanceof Date)return"date";if(e.constructor){for(t in r)if(r.hasOwnProperty(t)&&e.constructor==r[t])return t.toLowerCase();if(e.constructor.name)return e.constructor.name.toLowerCase()}}return i};var r={};n.addType=function(e,t){r[e]=t}},{}]},{},[1])(1)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e){for(var t=0;t<this.length;t++)if(this[t]==e)return t;return-1}),Array.prototype.forEach||(Array.prototype.forEach=function(e,t){for(var n=0,r=this.length;r>n;++n)e.call(t||this,this[n],n,this)}),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Array.prototype.map||(Array.prototype.map=function(e,t){var n,r,i;if(null==this)throw new TypeError(" this is null or not defined");var o=Object(this),s=o.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(t&&(n=t),r=new Array(s),i=0;s>i;){var a,u;i in o&&(a=o[i],u=e.call(n,a,i,o),r[i]=u),i++}return r}),Array.prototype.every||(Array.prototype.every=function(e){"use strict";if(null==this)throw new TypeError;var t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw new TypeError;for(var r=arguments[1],i=0;n>i;i++)if(i in t&&!e.call(r,t[i],i,t))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(e){"use strict";if(null==this)throw new TypeError;var t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw new TypeError;for(var r=arguments[1],i=0;n>i;i++)if(i in t&&e.call(r,t[i],i,t))return!0;return!1}),Function.prototype.bind||(Function.prototype.bind=function(e){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var t=Array.prototype.slice.call(arguments,1),n=this,r=function(){},i=function(){return n.apply(this instanceof r&&e?this:e,t.concat(Array.prototype.slice.call(arguments)))};return r.prototype=this.prototype,i.prototype=new r,i});