mathjs/dist/math.min.js
2013-08-07 22:46:02 +02:00

31 lines
146 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.11.2-SNAPSHOT
* @date 2013-08-07
*
* @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(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);throw new Error("Cannot find module '"+a+"'")}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[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":188}],2:[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:[]}},{}],3:[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:[]}},{}],4:[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:[]}},{}],5:[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:[]}},{}],6:[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:[]}},{}],7:[function(e,t){t.exports={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]}},{}],8:[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:[]}},{}],9:[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:[]}},{}],10:[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"]}},{}],11:[function(e,t){t.exports={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]}},{}],12:[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:[]}},{}],13:[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"]}},{}],14:[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"]}},{}],15:[function(e,t){t.exports={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]}},{}],16:[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"]}},{}],17:[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"]}},{}],18:[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"]}},{}],19:[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"]}},{}],20:[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"]}},{}],21:[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"]}},{}],22:[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"]}},{}],23:[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"]}},{}],24:[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"]}},{}],25:[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"]}},{}],26:[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"]}},{}],27:[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"]}},{}],28:[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"]}},{}],29:[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"]}},{}],30:[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"]}},{}],31:[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"]}},{}],32:[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"]}},{}],33:[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"]}},{}],34:[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:[]}},{}],35:[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"]}},{}],36:[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"]}},{}],37:[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"]}},{}],38:[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"]}},{}],39:[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"]}},{}],40:[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"]}},{}],41:[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"]}},{}],42:[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"]}},{}],43:[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"]}},{}],44:[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"]}},{}],45:[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"]}},{}],46:[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"]}},{}],47:[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"]}},{}],48:[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"]}},{}],49:[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"]}},{}],50:[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"]}},{}],51:[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")'],seealso:["complex","matrix","range","string","unit"]}},{}],52:[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","matrix","number","range","string","unit"]}},{}],53:[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","number","range","string","unit"]}},{}],54:[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)"],seealso:["boolean","complex","matrix","range","string","unit"]}},{}],55:[function(e,t){t.exports={name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, step, end)","range(string)"],description:"Create a range.",examples:["1:5","3:-1:-3","range(3, 6)","range(0, 2, 10)",'range("4:10")',"a = [1, 2, 3; 4, 5, 6]","a(:, 1:2)"],seealso:["boolean","complex","matrix","number","string","unit"]}},{}],56:[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","matrix","number","range","unit"]}},{}],57:[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","matrix","number","range","string"]}},{}],58:[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","size","squeeze","subset","transpose","zeros"]}},{}],59:[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","size","squeeze","subset","transpose","zeros"]}},{}],60:[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:4)","diag(1:4, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","eye","inv","ones","size","squeeze","subset","transpose","zeros"]}},{}],61:[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","size","squeeze","subset","transpose","zeros"]}},{}],62:[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","size","squeeze","subset","transpose","zeros"]}},{}],63:[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","size","squeeze","subset","transpose","zeros"]}},{}],64:[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","squeeze","subset","transpose","zeros"]}},{}],65:[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","size","subset","transpose","zeros"]}},{}],66:[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.",examples:["d = [1, 2; 3, 4]","e = []","e(0, 0:1) = [5, 6]","e(1, :) = [7, 8]","f = d * e","f(1, 0)","f(:, 0)"],seealso:["concat","det","diag","eye","inv","ones","range","size","squeeze","transpose","zeros"]}},{}],67:[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","size","squeeze","subset","zeros"]}},{}],68:[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","size","squeeze","subset","transpose"]}},{}],69:[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:[]}},{}],70:[function(e,t){t.exports={name:"random",category:"Probability",syntax:["random(min, max)"],description:"Return a random number between 0 and 1.",examples:["random()"],seealso:[]}},{}],71:[function(e,t){t.exports={name:"randInt",category:"Probability",syntax:["randInt()"],description:"Return a random number between 0 and 1.",examples:["randInt()"],seealso:[]}},{}],72:[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"]}},{}],73:[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"]}},{}],74:[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"]}},{}],75:[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"]}},{}],76:[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"]}},{}],77:[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"]}},{}],78:[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"]}},{}],79:[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"]}},{}],80:[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"]}},{}],81:[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"]}},{}],82:[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"]}},{}],83:[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"]}},{}],84:[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:[]}},{}],85:[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:[]}},{}],86:[function(e,t){t.exports={name:"eval",category:"Utils",syntax:["eval(expression)","eval([expr1, expr2, expr3, ...])"],description:"Evaluate an expression or an array with expressions.",examples:['eval("2 + 3")','eval("sqrt(" + 4 + ")")'],seealso:[]}},{}],87:[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:[]}},{}],88:[function(e,t){t.exports={name:"help",category:"Utils",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]}},{}],89:[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:[]}},{}],90:[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:[]}},{}],91:[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.matrix=e("./function/construction/matrix.js"),n.number=e("./function/construction/number.js"),n.range=e("./function/construction/range.js"),n.string=e("./function/construction/string.js"),n.unit=e("./function/construction/unit.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.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.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.eval=e("./function/utils/eval.js"),n.format=e("./function/utils/format.js"),n.help=e("./function/utils/help.js"),n["import"]=e("./function/utils/import.js"),n["typeof"]=e("./function/utils/typeof.js")},{"./constants/Infinity.js":2,"./constants/LN10.js":3,"./constants/LN2.js":4,"./constants/LOG10E.js":5,"./constants/LOG2E.js":6,"./constants/NaN.js":7,"./constants/SQRT1_2.js":8,"./constants/SQRT2.js":9,"./constants/e.js":10,"./constants/false.js":11,"./constants/i.js":12,"./constants/pi.js":13,"./constants/tau.js":14,"./constants/true.js":15,"./function/arithmetic/abs.js":16,"./function/arithmetic/add.js":17,"./function/arithmetic/ceil.js":18,"./function/arithmetic/cube.js":19,"./function/arithmetic/divide.js":20,"./function/arithmetic/edivide.js":21,"./function/arithmetic/emultiply.js":22,"./function/arithmetic/epow.js":23,"./function/arithmetic/equal.js":24,"./function/arithmetic/exp.js":25,"./function/arithmetic/fix.js":26,"./function/arithmetic/floor.js":27,"./function/arithmetic/gcd.js":28,"./function/arithmetic/larger.js":29,"./function/arithmetic/largereq.js":30,"./function/arithmetic/lcm.js":31,"./function/arithmetic/log.js":32,"./function/arithmetic/log10.js":33,"./function/arithmetic/mod.js":34,"./function/arithmetic/multiply.js":35,"./function/arithmetic/pow.js":36,"./function/arithmetic/round.js":37,"./function/arithmetic/sign.js":38,"./function/arithmetic/smaller.js":39,"./function/arithmetic/smallereq.js":40,"./function/arithmetic/sqrt.js":41,"./function/arithmetic/square.js":42,"./function/arithmetic/subtract.js":43,"./function/arithmetic/unary.js":44,"./function/arithmetic/unequal.js":45,"./function/arithmetic/xgcd.js":46,"./function/complex/arg.js":47,"./function/complex/conj.js":48,"./function/complex/im.js":49,"./function/complex/re.js":50,"./function/construction/boolean.js":51,"./function/construction/complex.js":52,"./function/construction/matrix.js":53,"./function/construction/number.js":54,"./function/construction/range.js":55,"./function/construction/string.js":56,"./function/construction/unit.js":57,"./function/matrix/concat.js":58,"./function/matrix/det.js":59,"./function/matrix/diag.js":60,"./function/matrix/eye.js":61,"./function/matrix/inv.js":62,"./function/matrix/ones.js":63,"./function/matrix/size.js":64,"./function/matrix/squeeze.js":65,"./function/matrix/subset.js":66,"./function/matrix/transpose.js":67,"./function/matrix/zeros.js":68,"./function/probability/factorial.js":69,"./function/probability/random.js":70,"./function/probability/randomInt.js":71,"./function/statistics/max.js":72,"./function/statistics/min.js":73,"./function/trigonometry/acos.js":74,"./function/trigonometry/asin.js":75,"./function/trigonometry/atan.js":76,"./function/trigonometry/atan2.js":77,"./function/trigonometry/cos.js":78,"./function/trigonometry/cot.js":79,"./function/trigonometry/csc.js":80,"./function/trigonometry/sec.js":81,"./function/trigonometry/sin.js":82,"./function/trigonometry/tan.js":83,"./function/units/in.js":84,"./function/utils/clone.js":85,"./function/utils/eval.js":86,"./function/utils/format.js":87,"./function/utils/help.js":88,"./function/utils/import.js":89,"./function/utils/typeof.js":90}],92:[function(e,t){function n(){if(!(this instanceof n))throw new SyntaxError("Parser constructor must be called with the new operator");
this.scope=new i}var r=e("../math.js"),i=e("./Scope.js");n.prototype.parse=function(e){return r.parse(e,this.scope)},n.prototype.eval=function(e){var t=r.parse(e,this.scope);return t.eval()},n.prototype.get=function(e){return this.scope.get(e)},n.prototype.set=function(e,t){this.scope.set(e,t)},n.prototype.remove=function(e){this.scope.remove(e)},n.prototype.clear=function(){this.scope.clear()},t.exports=n},{"../math.js":186,"./Scope.js":93}],93:[function(e,t){function n(){if(this.parentScope=null,this.subScopes=null,this.symbols={},this.cache={},arguments.length>0){var e=arguments[0];e instanceof n?this.parentScope=e:e instanceof Object&&(this.symbols=e)}if(arguments.length>1){var t=arguments[1];t instanceof Object&&(this.symbols=t)}}var r=e("../math.js"),i=e("../type/Unit.js");n.prototype={createSubScope:function(){var e=new n(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 o=this.parentScope;o;){if(t=o.symbols[e],void 0!==t)return this.cache[e]=o.symbols,t;o=o.parentScope}return t=r[e],void 0!==t?(this.cache[e]=r,t):i.isPlainUnit(e)?(t=new i(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={}}},t.exports=n},{"../math.js":186,"../type/Unit.js":192}],94:[function(e,t,n){function r(e){if(!(this instanceof r))throw new SyntaxError("Selector constructor must be called with the new operator");this.value=e instanceof r?e.value:e}function i(e,t){var n=Array.prototype.slice;r.prototype[e]="function"==typeof t?function(){var e=[this.value].concat(n.call(arguments,0));return new r(t.apply(this,e))}:new r(t)}var o=e("../math.js"),a=e("../util/index.js"),s=a.string;r.prototype={done:function(){return this.value},get:function(e){var t=this.value;if(!t)throw Error("Selector value is undefined");return new r(o.subset(t,e))},set:function(e,t){var n=this.value;if(!n)throw Error("Selector value is undefined");return new r(o.subset(n,e,t))},valueOf:function(){return this.value},toString:function(){return s.format(this.value)}},r.createProxy=i,r.init=function(){r.init=null;for(var e in o)o.hasOwnProperty(e)&&e&&i(e,o[e])},t.exports=r,n.init=r.init,a.types.addType("selector",r)},{"../math.js":186,"../util/index.js":198}],95:[function(e,t,n){n.node=e("./node/index.js"),n.Scope=e("./Scope.js"),n.Parser=e("./Parser.js"),n.Selector=e("./Selector.js")},{"./Parser.js":92,"./Scope.js":93,"./Selector.js":94,"./node/index.js":107}],96:[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":101}],97:[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":101}],98:[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":201,"./Node.js":101}],99:[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 a=0;o>a;a++)r.set(t[a],arguments[a]);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":197,"./Node.js":101}],100:[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],a=i.length,s=null,l=null,f=0;a>f;f++){var p,m=o.clone(i[f]);if(m instanceof u){if(p=m.size(),m=m.valueOf(),1==p.length)m=[m],p=[1,p[0]];else if(p.length>2)throw new Error("Cannot merge a multi dimensional matrix")}else m instanceof c?(m=[m.valueOf()],p=[1,m[0].length]):Array.isArray(m)?(p=[1,m.length],m=[m]):(p=[1,1],m=[[m]]);if(null==s)s=m,l=p[0];else{if(p[0]!=l)throw new Error("Dimension mismatch ("+p[0]+" != "+l+")");for(var h=0;l>h;h++)s[h]=s[h].concat(m[h])}}t=t.concat(s)}return t}var i=e("./Node.js"),o=e("../../util/object.js"),a=e("../../util/string.js"),s=e("../../type/collection.js"),u=e("../../type/Matrix.js"),c=e("../../type/Range.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 a=e[i],c=[],l=0,f=a.length;f>l;l++){var p=a[l].eval();s.isCollection(p)&&(n=!0),c[l]=p}t[i]=c}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],a=0,s=o.length;s>a;a++)t=t.concat(o[a].find(e));return t},n.prototype.toString=function(){return a.format(this.nodes)},t.exports=n},{"../../type/Matrix.js":190,"../../type/Range.js":191,"../../type/collection.js":193,"../../util/object.js":200,"../../util/string.js":201,"./Node.js":101}],101:[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},{}],102:[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":101}],103:[function(e,t){function n(e,t,n,r){if(this.subset=e.subset,this.object=t,this.params=n,this.paramScopes=r,this.hasContextParams=!1,n)for(var o={type:i,properties:{name:"end"}},a=0,s=n.length;s>a;a++)if(n[a].find(o).length>0){this.hasContextParams=!0;break}}var r=e("./Node.js"),i=e("./SymbolNode.js").SymbolNode;n.prototype=new r,n.prototype.eval=function(){var e,t,n=this.object;if(void 0==n)throw new Error("Node undefined");var r=n.eval();if(this.hasContextParams){var i,o=this.paramScopes;if(i=r.size?r.size():void 0!==r.length?[r.length]:[],o&&i)for(e=0,t=this.params.length;t>e;e++){var a=o[e];a&&a.set("end",i[e]-1)}}var s=this.params,u=[];for(e=0,t=this.params.length;t>e;e++)u[e]=s[e].eval();return"function"==typeof r?r.apply(this,u):this.subset(r,u)},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},{"./Node.js":101,"./SymbolNode.js":104}],104:[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":101}],105:[function(e,t){function n(e,t,n,r,o,a){this.subset=e.subset,this.name=t,this.params=n,this.paramScopes=r,this.expr=o,this.scope=a,this.hasContextParams=!1;for(var s={type:i,properties:{name:"end"}},u=0,c=n.length;c>u;u++)if(n[u].find(s).length>0){this.hasContextParams=!0;break}}var r=e("./Node.js"),i=e("./SymbolNode.js").SymbolNode;n.prototype=new r,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,r=this.paramScopes;if(n=t.size?t.size():void 0!==t.length?[t.length]:[],r&&n)for(var i=0,o=this.params.length;o>i;i++){var a=r[i];a&&a.set("end",n[i]-1)}}var s=[];this.params.forEach(function(e){s.push(e.eval())});var u=this.expr.eval();return e=this.subset(t,s,u),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},{"./Node.js":101,"./SymbolNode.js":104}],106:[function(){},{}],107:[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.SymbolNode=e("./SymbolNode.js"),n.UpdateNode=e("./UpdateNode.js"),n.handlers=e("./handlers.js")},{"./AssignmentNode.js":96,"./BlockNode.js":97,"./ConstantNode.js":98,"./FunctionNode.js":99,"./MatrixNode.js":100,"./Node.js":101,"./OperatorNode.js":102,"./ParamsNode.js":103,"./SymbolNode.js":104,"./UpdateNode.js":105,"./handlers.js":106}],108:[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.isNumber,a=r.isComplex,s=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(a(e))return Math.sqrt(e.re*e.re+e.im*e.im);if(s(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("abs",e)}}},{"../../type/Complex.js":188,"../../type/Matrix.js":190,"../../type/collection.js":193,"../../util/index.js":198}],109:[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"),a=n.number.isNumber,s=n.string.isString,u=r.isComplex,c=i.isUnit,l=o.isCollection;t.add=function f(e,t){if(2!=arguments.length)throw new n.error.ArgumentsError("add",arguments.length,2);if(a(e)){if(a(t))return e+t;if(u(t))return r.create(e+t.re,t.im)}else if(u(e)){if(a(t))return r.create(e.re+t,e.im);if(u(t))return r.create(e.re+t.re,e.im+t.im)}else if(c(e)&&c(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(s(e)||s(t))return e+t;if(l(e)||l(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":188,"../../type/Matrix.js":190,"../../type/Unit.js":192,"../../type/collection.js":193,"../../util/index.js":198}],110:[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.isNumber,a=i.isCollection,s=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(s(e))return r.create(Math.ceil(e.re),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("ceil",e)}}},{"../../type/Complex.js":188,"../../type/collection.js":193,"../../util/index.js":198}],111:[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.isNumber,a=r.isComplex,s=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(a(e))return t.multiply(t.multiply(e,e),e);if(s(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("cube",e)}}},{"../../type/Complex.js":188,"../../type/collection.js":193,"../../util/index.js":198}],112:[function(e,t){t.exports=function(t){function n(e,t){var n=t.re*t.re+t.im*t.im;return 0!=n?i.create((e.re*t.re+e.im*t.im)/n,(e.im*t.re-e.re*t.im)/n):i.create(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")),a=e("../../type/collection.js"),s=r.number.isNumber,u=i.isComplex,c=o.isUnit,l=a.isCollection;t.divide=function f(e,o){if(2!=arguments.length)throw new r.error.ArgumentsError("divide",arguments.length,2);if(s(e)){if(s(o))return e/o;if(u(o))return n(new i(e,0),o)}if(u(e)){if(s(o))return n(e,new i(o,0));if(u(o))return n(e,o)}if(c(e)&&s(o)){var p=e.clone();return p.value/=o,p}if(l(e))return l(o)?t.multiply(e,t.inv(o)):a.map2(e,o,f);if(l(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":188,"../../type/Matrix.js":190,"../../type/Unit.js":192,"../../type/collection.js":193,"../../util/index.js":198}],113:[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":193,"../../util/index.js":198}],114:[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":193,"../../util/index.js":198}],115:[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":193,"../../util/index.js":198}],116:[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"),a=n.number.isNumber,s=n.string.isString,u=r.isComplex,c=i.isUnit,l=o.isCollection;t.equal=function f(e,t){if(2!=arguments.length)throw new n.error.ArgumentsError("equal",arguments.length,2);if(a(e)){if(a(t))return e==t;if(u(t))return e==t.re&&0==t.im}if(u(e)){if(a(t))return e.re==t&&0==e.im;if(u(t))return e.re==t.re&&e.im==t.im}if(c(e)&&c(t)){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return e.value==t.value}if(s(e)||s(t))return e==t;if(l(e)||l(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":188,"../../type/Unit.js":192,"../../type/collection.js":193,"../../util/index.js":198}],117:[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.isNumber,a=r.isComplex,s=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(a(e)){var t=Math.exp(e.re);return r.create(t*Math.cos(e.im),t*Math.sin(e.im))}if(s(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("exp",e)}}},{"../../type/Complex.js":188,"../../type/Matrix.js":190,"../../type/collection.js":193,"../../util/index.js":198}],118:[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.isNumber,a=r.isComplex,s=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(a(e))return r.create(e.re>0?Math.floor(e.re):Math.ceil(e.re),e.im>0?Math.floor(e.im):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("fix",e)}}},{"../../type/Complex.js":188,"../../type/collection.js":193,"../../util/index.js":198}],119:[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.isNumber,a=r.isComplex,s=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(a(e))return r.create(Math.floor(e.re),Math.floor(e.im));if(s(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("floor",e)}}},{"../../type/Complex.js":188,"../../type/collection.js":193,"../../util/index.js":198}],120:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/collection.js"),i=n.number.isNumber,o=n.number.isInteger,a=r.isCollection;t.gcd=function s(){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=u,u=t%e,t=e;return Math.abs(t)}if(a(t)||a(u))return r.map2(t,u,s);if(t.valueOf()!==t||u.valueOf()!==u)return s(t.valueOf(),u.valueOf());throw new n.error.UnsupportedTypeError("gcd",t,u)}if(arguments.length>2){for(var c=1;c<arguments.length;c++)t=s(t,arguments[c]);return t}throw new SyntaxError("Function gcd expects two or more arguments")}}},{"../../type/collection.js":193,"../../util/index.js":198}],121:[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"),a=n.number.isNumber,s=n.string.isString,u=r.isComplex,c=i.isUnit,l=o.isCollection;t.larger=function f(e,r){if(2!=arguments.length)throw new n.error.ArgumentsError("larger",arguments.length,2);if(a(e)){if(a(r))return e>r;if(u(r))return e>t.abs(r)}if(u(e)){if(a(r))return t.abs(e)>r;if(u(r))return t.abs(e)>t.abs(r)}if(c(e)&&c(r)){if(!e.equalBase(r))throw new Error("Cannot compare units with different base");return e.value>r.value}if(s(e)||s(r))return e>r;if(l(e)||l(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":188,"../../type/Unit.js":192,"../../type/collection.js":193,"../../util/index.js":198}],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"),a=n.number.isNumber,s=n.string.isString,u=r.isComplex,c=i.isUnit,l=o.isCollection;t.largereq=function f(e,r){if(2!=arguments.length)throw new n.error.ArgumentsError("largereq",arguments.length,2);if(a(e)){if(a(r))return e>=r;if(u(r))return e>=t.abs(r)}if(u(e)){if(a(r))return t.abs(e)>=r;if(u(r))return t.abs(e)>=t.abs(r)}if(c(e)&&c(r)){if(!e.equalBase(r))throw new Error("Cannot compare units with different base");return e.value>=r.value}if(s(e)||s(r))return e>=r;if(l(e)||l(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":188,"../../type/Unit.js":192,"../../type/collection.js":193,"../../util/index.js":198}],123:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/collection.js"),i=n.number.isNumber,o=n.number.isInteger,a=r.isCollection;t.lcm=function s(){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");for(var c=t*u;0!=u;)e=u,u=t%e,t=e;return Math.abs(c/t)}if(a(t)||a(u))return r.map2(t,u,s);if(t.valueOf()!==t||u.valueOf()!==u)return s(t.valueOf(),u.valueOf());throw new n.error.UnsupportedTypeError("lcm",t,u)}if(arguments.length>2){for(var l=1;l<arguments.length;l++)t=s(t,arguments[l]);return t}throw new SyntaxError("Function lcm expects two or more arguments")}}},{"../../type/collection.js":193,"../../util/index.js":198}],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.isNumber,a=r.isComplex,s=i.isCollection;t.log=function u(e,c){if(1==arguments.length){if(o(e))return e>=0?Math.log(e):u(new r(e,0));if(a(e))return r.create(Math.log(Math.sqrt(e.re*e.re+e.im*e.im)),Math.atan2(e.im,e.re));if(s(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(c));throw new n.error.ArgumentsError("log",arguments.length,1,2)}}},{"../../type/Complex.js":188,"../../type/collection.js":193,"../../util/index.js":198}],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.isNumber,a=r.isComplex,s=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(a(e))return r.create(Math.log(Math.sqrt(e.re*e.re+e.im*e.im))/Math.LN10,Math.atan2(e.im,e.re)/Math.LN10);if(s(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("log10",e)}}},{"../../type/Complex.js":188,"../../type/collection.js":193,"../../util/index.js":198}],126:[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,a=i.isCollection;t.mod=function s(e,t){if(2!=arguments.length)throw new r.error.ArgumentsError("mod",arguments.length,2);if(o(e)&&o(t))return n(e,t);if(a(e)||a(t))return i.map2(e,t,s);if(e.valueOf()!==e||t.valueOf()!==t)return s(e.valueOf(),t.valueOf());throw new r.error.UnsupportedTypeError("mod",e,t)}}},{"../../type/collection.js":193,"../../util/index.js":198}],127:[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"),a=e("../../type/Unit.js"),s=e("../../type/collection.js"),u=r.array,c=r.number.isNumber,l=i.isComplex,f=Array.isArray,p=a.isUnit;t.multiply=function m(e,a){if(2!=arguments.length)throw new r.error.ArgumentsError("multiply",arguments.length,2);if(c(e)){if(c(a))return e*a;if(l(a))return n(new i(e,0),a);if(p(a))return g=a.clone(),g.value*=e,g}else if(l(e)){if(c(a))return n(e,new i(a,0));if(l(a))return n(e,a)}else if(p(e)){if(c(a))return g=e.clone(),g.value*=a,g}else{if(f(e)){if(f(a)){var h=u.size(e),x=u.size(a);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=[],y=h[0],d=x[1],v=h[1],j=0;y>j;j++){g[j]=[];for(var w=0;d>w;w++){for(var b=null,E=0;v>E;E++){var N=m(e[j][E],a[E][w]);b=null==b?N:t.add(b,N)}g[j][w]=b}}return g}return a instanceof o?new o(m(e.valueOf(),a.valueOf())):s.map2(e,a,m)}if(e instanceof o)return new o(m(e.valueOf(),a.valueOf()))}if(f(a))return s.map2(e,a,m);if(a instanceof o)return new o(m(e.valueOf(),a.valueOf()));if(e.valueOf()!==e||a.valueOf()!==a)return m(e.valueOf(),a.valueOf());throw new r.error.UnsupportedTypeError("multiply",e,a)}}},{"../../type/Complex.js":188,"../../type/Matrix.js":190,"../../type/Unit.js":192,"../../type/collection.js":193,"../../util/index.js":198}],128:[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"),a=r.array,s=r.number.isNumber,u=Array.isArray,c=r.number.isInteger,l=i.isComplex;t.pow=function f(e,p){if(2!=arguments.length)throw new r.error.ArgumentsError("pow",arguments.length,2);if(s(e)){if(s(p))return c(p)||e>=0?Math.pow(e,p):n(new i(e,0),new i(p,0));if(l(p))return n(new i(e,0),p)}else if(l(e)){if(s(p))return n(e,new i(p,0));if(l(p))return n(e,p)}else{if(u(e)){if(!s(p)||!c(p)||0>p)throw new TypeError("For A^b, b must be a positive integer (value is "+p+")");var m=a.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":188,"../../type/Matrix.js":190,"../../util/index.js":198}],129:[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"),a=r.number.isNumber,s=i.isComplex,u=o.isCollection;t.round=function c(e,t){if(1!=arguments.length&&2!=arguments.length)throw new r.error.ArgumentsError("round",arguments.length,1,2);if(void 0==t){if(a(e))return Math.round(e);if(s(e))return i.create(Math.round(e.re),Math.round(e.im));if(u(e))return o.map(e,c);if(e.valueOf()!==e)return c(e.valueOf());throw new r.error.UnsupportedTypeError("round",e)}if(!a(t))throw new TypeError("Number of decimals in function round must be an integer");if(t!==Math.round(t))throw new TypeError("Number of decimals in function round must be integer");if(0>t||t>9)throw new Error("Number of decimals in function round must be in te range of 0-9");if(a(e))return n(e,t);if(s(e))return i.create(n(e.re,t),n(e.im,t));if(u(e)||u(t))return o.map2(e,t,c);if(e.valueOf()!==e||t.valueOf()!==t)return c(e.valueOf(),t.valueOf());throw new r.error.UnsupportedTypeError("round",e,t)}}},{"../../type/Complex.js":188,"../../type/collection.js":193,"../../util/index.js":198}],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,a=n.number.isNumber,s=r.isComplex,u=i.isCollection;t.sign=function c(e){if(1!=arguments.length)throw new n.error.ArgumentsError("sign",arguments.length,1);if(a(e))return o.sign(e);if(s(e)){var t=Math.sqrt(e.re*e.re+e.im*e.im);return r.create(e.re/t,e.im/t)}if(u(e))return i.map(e,c);if(e.valueOf()!==e)return c(e.valueOf());throw new n.error.UnsupportedTypeError("sign",e)}}},{"../../type/Complex.js":188,"../../type/collection.js":193,"../../util/index.js":198}],131:[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"),a=n.number.isNumber,s=n.string.isString,u=r.isComplex,c=i.isUnit,l=o.isCollection;t.smaller=function f(e,r){if(2!=arguments.length)throw new n.error.ArgumentsError("smaller",arguments.length,2);if(a(e)){if(a(r))return r>e;if(u(r))return e<t.abs(r)}if(u(e)){if(a(r))return t.abs(e)<r;if(u(r))return t.abs(e)<t.abs(r)}if(c(e)&&c(r)){if(!e.equalBase(r))throw new Error("Cannot compare units with different base");return e.value<r.value}if(s(e)||s(r))return r>e;if(l(e)||l(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":188,"../../type/Unit.js":192,"../../type/collection.js":193,"../../util/index.js":198}],132:[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"),a=n.number.isNumber,s=n.string.isString,u=r.isComplex,c=i.isUnit,l=o.isCollection;t.smallereq=function f(e,r){if(2!=arguments.length)throw new n.error.ArgumentsError("smallereq",arguments.length,2);if(a(e)){if(a(r))return r>=e;if(u(r))return e<=t.abs(r)}if(u(e)){if(a(r))return t.abs(e)<=r;if(u(r))return t.abs(e)<=t.abs(r)}if(c(e)&&c(r)){if(!e.equalBase(r))throw new Error("Cannot compare units with different base");return e.value<=r.value}if(s(e)||s(r))return r>=e;if(l(e)||l(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":188,"../../type/Unit.js":192,"../../type/collection.js":193,"../../util/index.js":198}],133:[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.isNumber,a=r.isComplex,s=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(a(e)){var t=Math.sqrt(e.re*e.re+e.im*e.im);return e.im>=0?r.create(.5*Math.sqrt(2*(t+e.re)),.5*Math.sqrt(2*(t-e.re))):r.create(.5*Math.sqrt(2*(t+e.re)),-.5*Math.sqrt(2*(t-e.re)))}if(s(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("sqrt",e)}}},{"../../type/Complex.js":188,"../../type/collection.js":193,"../../util/index.js":198}],134:[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.isNumber,a=r.isComplex,s=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(a(e))return t.multiply(e,e);if(s(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());
throw new n.error.UnsupportedTypeError("square",e)}}},{"../../type/Complex.js":188,"../../type/collection.js":193,"../../util/index.js":198}],135:[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"),a=n.number.isNumber,s=(n.string.isString,r.isComplex),u=i.isUnit,c=o.isCollection;t.subtract=function l(e,t){if(2!=arguments.length)throw new n.error.ArgumentsError("subtract",arguments.length,2);if(a(e)){if(a(t))return e-t;if(s(t))return r.create(e-t.re,-t.im)}else if(s(e)){if(a(t))return r.create(e.re-t,e.im);if(s(t))return r.create(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(c(e)||c(t))return o.map2(e,t,l);if(e.valueOf()!==e||t.valueOf()!==t)return l(e.valueOf(),t.valueOf());throw new n.error.UnsupportedTypeError("subtract",e,t)}}},{"../../type/Complex.js":188,"../../type/Matrix.js":190,"../../type/Unit.js":192,"../../type/collection.js":193,"../../util/index.js":198}],136:[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"),a=n.number.isNumber,s=r.isComplex,u=i.isUnit,c=o.isCollection;t.unary=function l(e){if(1!=arguments.length)throw new n.error.ArgumentsError("unary",arguments.length,1);if(a(e))return-e;if(s(e))return r.create(-e.re,-e.im);if(u(e)){var t=e.clone();return t.value=-e.value,t}if(c(e))return o.map(e,l);if(e.valueOf()!==e)return l(e.valueOf());throw new n.error.UnsupportedTypeError("unary",e)}}},{"../../type/Complex.js":188,"../../type/Unit.js":192,"../../type/collection.js":193,"../../util/index.js":198}],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"),a=n.number.isNumber,s=n.string.isString,u=r.isComplex,c=i.isUnit,l=o.isCollection;t.unequal=function f(e,t){if(2!=arguments.length)throw new n.error.ArgumentsError("unequal",arguments.length,2);if(a(e)){if(a(t))return e!=t;if(u(t))return e!=t.re||0!=t.im}if(u(e)){if(a(t))return e.re!=t||0!=e.im;if(u(t))return e.re!=t.re||e.im!=t.im}if(c(e)&&c(t)){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return e.value!=t.value}if(s(e)||s(t))return e!=t;if(l(e)||l(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":188,"../../type/Unit.js":192,"../../type/collection.js":193,"../../util/index.js":198}],138:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=n.number.isNumber,i=n.number.isInteger;t.xgcd=function o(e,t){if(2==arguments.length){if(r(e)&&r(t)){if(!i(e)||!i(t))throw new Error("Parameters in function xgcd must be integer numbers");if(0==t)return[e,1,0];var a=o(t,e%t),s=a[0],u=a[1],c=a[2];return[s,c,u-c*Math.floor(e/t)]}throw new n.error.UnsupportedTypeError("xgcd",e,t)}throw new SyntaxError("Function xgcd expects two arguments")}}},{"../../util/index.js":198}],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.isNumber,a=i.isCollection,s=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):s(e)?Math.atan2(e.im,e.re):a(e)?i.map(e,u):e.valueOf()!==e?u(e.valueOf()):t.atan2(0,e)}}},{"../../type/Complex.js":188,"../../type/collection.js":193,"../../util/index.js":198}],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.object,a=n.number.isNumber,s=i.isCollection,u=r.isComplex;t.conj=function c(e){if(1!=arguments.length)throw new n.error.ArgumentsError("conj",arguments.length,1);return a(e)?e:u(e)?r.create(e.re,-e.im):s(e)?i.map(e,c):e.valueOf()!==e?c(e.valueOf()):o.clone(e)}}},{"../../type/Complex.js":188,"../../type/collection.js":193,"../../util/index.js":198}],141:[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.isNumber,a=i.isCollection,s=r.isComplex;t.im=function u(e){if(1!=arguments.length)throw new n.error.ArgumentsError("im",arguments.length,1);return o(e)?0:s(e)?e.im:a(e)?i.map(e,u):e.valueOf()!==e?u(e.valueOf()):0}}},{"../../type/Complex.js":188,"../../type/collection.js":193,"../../util/index.js":198}],142:[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,a=n.number.isNumber,s=i.isCollection,u=r.isComplex;t.re=function c(e){if(1!=arguments.length)throw new n.error.ArgumentsError("re",arguments.length,1);return a(e)?e:u(e)?e.re:s(e)?i.map(e,c):e.valueOf()!==e?c(e.valueOf()):o.clone(e)}}},{"../../type/Complex.js":188,"../../type/collection.js":193,"../../util/index.js":198}],143:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=n.number.isNumber,i=n.string.isString;t["boolean"]=function(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(r(e))return 0!==e;if(i(e)){var t=e.toLowerCase();if("true"===t)return!0;if("false"===t)return!1;var o=Number(e);if(""!=e&&!isNaN(o))return 0!==o}throw new SyntaxError(e.toString()+" is no valid boolean")}}},{"../../util/index.js":198}],144:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Complex.js"),i=n.string.isString,o=r.isComplex;t.complex=function(){switch(arguments.length){case 0:return new r(0,0);case 1:var e=arguments[0];if(o(e))return e.clone();if(i(e)){var t=r.parse(e);if(t)return t;throw new SyntaxError('String "'+e+'" is no valid complex number')}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":188,"../../util/index.js":198}],145:[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":190,"../../util/index.js":198}],146:[function(e,t){t.exports=function(t){var n=e("../../util/index.js");t.number=function(e){switch(arguments.length){case 0:return 0;case 1: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)}}}},{"../../util/index.js":198}],147:[function(e,t){t.exports=function(t){var n=(e("../../util/index.js"),e("../../expr/Parser.js"));t.parser=function(){return new n}}},{"../../expr/Parser.js":92,"../../util/index.js":198}],148:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Range.js"),i=n.string.isString;t.range=function(e){switch(arguments.length){case 1:if(e instanceof r)return e.clone();if(i(e)){var t=r.parse(e);if(t)return t;throw new SyntaxError('String "'+t+'" is no valid range')}throw new TypeError("Two or three numbers or a single string expected in function range");case 2:return new r(arguments[0],null,arguments[1]);case 3:return new r(arguments[0],arguments[1],arguments[2]);default:throw new n.error.ArgumentsError("range",arguments.length,2,3)}}}},{"../../type/Range.js":191,"../../util/index.js":198}],149:[function(e,t){t.exports=function(t){function n(e){if(s(e)){for(var t=e.valueOf(),r="[",i=t.length,u=0;i>u;u++)0!=u&&(r+=", "),r+=n(t[u]);return r+="]"}return a(e)?o.format(e):e.toString()}var r=e("../../util/index.js"),i=e("../../type/collection.js"),o=r.number,a=r.number.isNumber,s=i.isCollection;t.string=function(e){switch(arguments.length){case 0:return"";case 1:return n(e);default:throw new r.error.ArgumentsError("string",arguments.length,0,1)}}}},{"../../type/collection.js":193,"../../util/index.js":198}],150:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Unit.js"),i=n.string.isString;t.unit=function(){switch(arguments.length){case 1:var e=arguments[0];if(e instanceof r)return e.clone();if(i(e)){if(r.isPlainUnit(e))return new r(null,e);var t=r.parse(e);if(t)return t;throw new SyntaxError('String "'+e+'" is no valid unit')}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":192,"../../util/index.js":198}],151:[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=[],a=0;a<e.length;a++)o[a]=n(e[a],t[a],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"),a=r.object,s=r.array,u=r.number.isNumber,c=r.number.isInteger,l=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,!c(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(!l(h))throw new r.error.UnsupportedTypeError("concat",h);var x=a.clone(h).valueOf(),g=s.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 y=m.shift();m.length;)y=n(y,m.shift(),f,0);return p?new i(y):y}}},{"../../type/Matrix.js":190,"../../type/collection.js":193,"../../util/index.js":198}],152:[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,a=0,s=0;n>s&&!(a>=r);s++){for(var u=s;0==e[u][a];)if(u++,u==n&&(u=s,a++,a==r))return i.deepEqual(e,eye(n).valueOf())?t.round(o,6):0;if(u!=s){for(var c=0;r>c;c++){var l=e[u][c];e[u][c]=e[s][c],e[s][c]=l}o*=-1}for(var f=e[s][a],c=0;r>c;c++)e[s][c]=e[s][c]/f;o*=f;for(var p=0;n>p;p++)if(p!=s)for(var m=e[p][a],c=0;r>c;c++)e[p][c]=e[p][c]-e[s][c]*m;a++}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,a=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: "+a.format(t)+")");case 2:var s=t[0],u=t[1];if(s==u)return n(e.valueOf(),s,u);throw new RangeError("Matrix must be square (size: "+a.format(t)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+a.format(t)+")")}}}},{"../../type/Matrix.js":190,"../../util/index.js":198}],153:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/Range.js"),i=e("../../type/Matrix.js"),o=n.object,a=n.number.isNumber,s=n.number.isInteger;t.diag=function(e,t){var u,c,l,f;if(1!=arguments.length&&2!=arguments.length)throw new n.error.ArgumentsError("diag",arguments.length,1,2);if(t){if(!a(t)||!s(t))throw new TypeError("Second parameter in function diag must be an integer")}else t=0;var p=t>0?t:0,m=0>t?-t:0;e instanceof i||e instanceof r||(e=new i(e));var h;switch(e.isVector()?(e=e.toVector(),h=[e.length]):h=e.size(),h.length){case 1:c=e.valueOf();var x=new i;for(x.resize([c.length+m,c.length+p]),u=x.valueOf(),f=c.length,l=0;f>l;l++)u[l+m][l+p]=o.clone(c[l]);return x;case 2:for(c=[],u=e.valueOf(),f=Math.min(h[0]-m,h[1]-p),l=0;f>l;l++)c[l]=o.clone(u[l+m][l+p]);return new i(c);default:throw new RangeError("Matrix for function diag must be 2 dimensional")}}}},{"../../type/Matrix.js":190,"../../type/Range.js":191,"../../util/index.js":198}],154:[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,a=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 s=e[0],u=e[1];if(!o(s)||!a(s)||1>s)throw new Error("Parameters in function eye must be positive integers");if(u&&(!o(u)||!a(u)||1>u))throw new Error("Parameters in function eye must be positive integers");var c=new r;c.resize(e);for(var l=t.min(e),f=c.valueOf(),p=0;l>p;p++)f[p][p]=1;return c}}},{"../../type/Matrix.js":190,"../../type/collection.js":193,"../../util/index.js":198}],155:[function(e,t){t.exports=function(t){function n(e,n,r){var i,o,a,s,u;if(1==n){if(s=e[0][0],0==s)throw Error("Cannot calculate inverse, determinant is zero");return[[t.divide(1,s)]]}if(2==n){var c=t.det(e);if(0==c)throw Error("Cannot calculate inverse, determinant is zero");return[[t.divide(e[1][1],c),t.divide(t.unary(e[0][1]),c)],[t.divide(t.unary(e[1][0]),c),t.divide(e[0][0],c)]]}var l=e.concat();for(i=0;n>i;i++)l[i]=l[i].concat();for(var f=t.eye(n).valueOf(),p=0;r>p;p++){for(i=p;n>i&&0==l[i][p];)i++;if(i==n||0==l[i][p])throw Error("Cannot calculate inverse, determinant is zero");i!=p&&(u=l[p],l[p]=l[i],l[i]=u,u=f[p],f[p]=f[i],f[i]=u);var m=l[p],h=f[p];for(i=0;n>i;i++){var x=l[i],g=f[i];if(i!=p){if(0!=x[p]){for(a=t.divide(t.unary(x[p]),m[p]),o=p;r>o;o++)x[o]=t.add(x[o],t.multiply(a,m[o]));for(o=0;r>o;o++)g[o]=t.add(g[o],t.multiply(a,h[o]))}}else{for(a=m[p],o=p;r>o;o++)x[o]=t.divide(x[o],a);for(o=0;r>o;o++)g[o]=t.divide(g[o],a)}}}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 a=t.size(e).valueOf();switch(a.length){case 0:return t.divide(1,e);case 1:if(1==a[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(a)+")");case 2:var s=a[0],u=a[1];if(s==u)return e instanceof i?new i(n(e.valueOf(),s,u)):n(e,s,u);throw new RangeError("Matrix must be square (size: "+o.format(a)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+o.format(a)+")")}}}},{"../../type/Matrix.js":190,"../../util/index.js":198}],156:[function(e,t){t.exports=function(t){var n=(e("../../util/index.js"),e("../../type/Matrix.js")),r=e("../../type/collection.js");t.ones=function(){var e=r.argsToArray(arguments);0==e.length?e=[1,1]:1==e.length&&(e[1]=e[0]);var t=new n,i=1;return t.resize(e,i),t}}},{"../../type/Matrix.js":190,"../../type/collection.js":193,"../../util/index.js":198}],157:[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"),a=n.array,s=n.number.isNumber,u=n.string.isString,c=r.isComplex,l=i.isUnit;t.size=function f(e){if(1!=arguments.length)throw new n.error.ArgumentsError("size",arguments.length,1);if(s(e)||c(e)||l(e)||null==e)return[];if(u(e))return[e.length];if(Array.isArray(e))return a.size(e);if(e instanceof o)return new o(e.size());if(e.valueOf()!==e)return f(e.valueOf());throw new n.error.UnsupportedTypeError("size",e)}}},{"../../type/Complex.js":188,"../../type/Matrix.js":190,"../../type/Unit.js":192,"../../util/index.js":198}],158:[function(e,t){t.exports=function(t){function n(e){if(1==e.length)return n(e[0]);for(var t=0,r=e.length;r>t;t++){var i=e[t];a(i)&&(e[t]=n(i))}return e}var r=e("../../util/index.js"),i=e("../../type/Matrix.js"),o=r.object,a=Array.isArray;t.squeeze=function(e){if(1!=arguments.length)throw new r.error.ArgumentsError("squeeze",arguments.length,1);return a(e)?n(o.clone(e)):e instanceof i?new i(n(e.toArray())):a(e.valueOf())?n(o.clone(e.valueOf())):o.clone(e)}}},{"../../type/Matrix.js":190,"../../util/index.js":198}],159:[function(e,t){t.exports=function(t){function n(e,t){var n,i;return f(e)||e instanceof u?(n=new s(e),i=n.get(t),i.valueOf()):e instanceof s?e.get(t):l(e)?r(e,t):(n=new s([e]),i=n.get(t),i.valueOf())}function r(e,t){var n,r;if(t=t.valueOf(),1!=t.length)throw new RangeError("Dimension mismatch ("+t.length+" != 1)");f(t)&&(t=t[0]),t=t.valueOf(),f(t)||(t=[t]);var i="",o=e.length;for(n=0,r=t.length;r>n;n++){var a=t[n];c.validateIndex(a,o),i+=e.charAt(a)}return i}function i(e,n,r){if(f(e)||e instanceof u){var i=new s(t.clone(e));return i.set(n,r),i.valueOf()}return e instanceof s?e.clone().set(n,r):l(e)?o(e,n,r):(i=new s([e]),i.set(n,r),i.isScalar()?i.toScalar():i.valueOf())}function o(e,t,n){var r,i;if(t=t.valueOf(),1!=t.length)throw new RangeError("Dimension mismatch ("+t.length+" != 1)");if(f(t)&&(t=t[0]),t=t.valueOf(),f(t)||(t=[t]),t.length!=n.length)throw new RangeError("Dimension mismatch ("+t.length+" != "+n.length+")");var o=e.length,a=[];for(r=0;o>r;r++)a[r]=e.charAt(r);for(r=0,i=t.length;i>r;r++){var s=t[r];c.validateIndex(s),a[s]=n.charAt(r)}if(a.length>o)for(r=o-1,i=a.length;i>r;r++)a[r]||(a[r]=" ");return a.join("")}var a=e("../../util/index.js"),s=e("../../type/Matrix.js"),u=e("../../type/Range.js"),c=a.array,l=a.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 a.error.ArgumentsError("subset",arguments.length,2,3)}}}},{"../../type/Matrix.js":190,"../../type/Range.js":191,"../../util/index.js":198}],160:[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 a=t.size(e).valueOf();switch(a.length){case 0:return i.clone(e);case 1:return i.clone(e);case 2:for(var s,u=a[1],c=a[0],l=r.isMatrix(e),f=e.valueOf(),p=[],m=i.clone,h=0;u>h;h++){s=p[h]=[];for(var x=0;c>x;x++)s[x]=m(f[x][h])}return 0==c&&(p[0]=[]),l?new r(p):p;default:throw new RangeError("Matrix must be two dimensional (size: "+o.format(a)+")")}}}},{"../../type/Matrix.js":190,"../../util/index.js":198}],161:[function(e,t){t.exports=function(t){var n=(e("../../util/index.js"),e("../../type/Matrix.js")),r=e("../../type/collection.js");t.zeros=function(){var e=r.argsToArray(arguments);0==e.length?e=[1,1]:1==e.length&&(e[1]=e[0]);var t=new n;return t.resize(e),t}}},{"../../type/Matrix.js":190,"../../type/collection.js":193,"../../util/index.js":198}],162:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../type/collection.js"),i=n.number.isNumber,o=n.number.isInteger,a=r.isCollection;t.factorial=function s(e){if(1!=arguments.length)throw new n.error.ArgumentsError("factorial",arguments.length,1);if(i(e)){if(!o(e)||0>e)throw new TypeError("Positive integer value expected in function factorial");var t=e,u=t;for(t--;t>1;)u*=t,t--;return 0==u&&(u=1),u}if(a(e))return r.map(e,s);if(e.valueOf()!==e)return s(e.valueOf());throw new n.error.UnsupportedTypeError("factorial",e)}}},{"../../type/collection.js":193,"../../util/index.js":198}],163:[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 s,u,c;if(arguments.length>3)throw new n.error.ArgumentsError("random",arguments.length,0,3);return 1===arguments.length?"[object Array]"===Object.prototype.toString.call(e)?s=e:c=e:2===arguments.length?"[object Array]"===Object.prototype.toString.call(e)?s=e:(u=e,c=t):(s=e,u=t,c=o),void 0===c&&(c=1),void 0===u&&(u=0),void 0!==s?new r(a(s,u,c,i)):i(u,c)},randomInt:function(e,t,i){var s,u,c;if(arguments.length>3||arguments.length<1)throw new n.error.ArgumentsError("randomInt",arguments.length,1,3);return 1===arguments.length?c=e:2===arguments.length?"[object Array]"===Object.prototype.toString.call(e)?s=e:(u=e,c=t):(s=e,u=t,c=i),void 0===u&&(u=0),void 0!==s?new r(a(s,u,c,o)):o(u,c)},pickRandom:function(e){if(1!==arguments.length)throw new n.error.ArgumentsError("pickRandom",arguments.length,1);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))},a=function(e,t,n,r){var i,o,s=[];if(e=e.slice(0),e.length>1)for(o=0,i=e.shift();i>o;o++)s.push(a(e,t,n,r));else for(o=0,i=e.shift();i>o;o++)s.push(r(t,n));return s};return t}(o)};var o=t.distribution("uniform");t.random=o.random,t.randomInt=o.randomInt,t.pickRandom=o.pickRandom}},{"../../type/Matrix.js":190,"../../util/index.js":198}],164:[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 a=e[0][o],s=1;n>s;s++){var u=e[s][o];t.larger(u,a)&&(a=u)}i[o]=a}return i}var i=(e("../../util/index.js"),e("../../type/Matrix.js")),o=e("../../type/collection.js"),a=o.isCollection;t.max=function(e){if(0==arguments.length)throw new Error("Function max requires one or more parameters (0 provided)");if(a(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":190,"../../type/collection.js":193,"../../util/index.js":198}],165:[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 a=e[0][o],s=1;n>s;s++){var u=e[s][o];t.smaller(u,a)&&(a=u)}i[o]=a}return i}var i=(e("../../util/index.js"),e("../../type/Matrix.js")),o=e("../../type/collection.js"),a=o.isCollection;t.min=function(e){if(0==arguments.length)throw new Error("Function min requires one or more parameters (0 provided)");if(a(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":190,"../../type/collection.js":193,"../../util/index.js":198}],166:[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.isNumber,a=r.isComplex,s=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(a(e)){var c,l=r.create(e.im*e.im-e.re*e.re+1,-2*e.re*e.im),f=t.sqrt(l);c=f instanceof r?r.create(f.re-e.im,f.im+e.re):r.create(f-e.im,e.re);var p=t.log(c);return p instanceof r?r.create(1.5707963267948966-p.im,p.re):new r(1.5707963267948966,p)}if(s(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("acos",e)}}},{"../../type/Complex.js":188,"../../type/collection.js":193,"../../util/index.js":198}],167:[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.isNumber,a=r.isComplex,s=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(a(e)){var c,l=e.re,f=e.im,p=r.create(f*f-l*l+1,-2*l*f),m=t.sqrt(p);c=m instanceof r?r.create(m.re-f,m.im+l):r.create(m-f,l);var h=t.log(c);return h instanceof r?r.create(h.im,-h.re):r.create(0,-h)}if(s(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("asin",e)}}},{"../../type/Complex.js":188,"../../type/collection.js":193,"../../util/index.js":198}],168:[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.isNumber,a=r.isComplex,s=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(a(e)){var c=e.re,l=e.im,f=c*c+(1-l)*(1-l),p=r.create((1-l*l-c*c)/f,-2*c/f),m=t.log(p);return m instanceof r?r.create(-.5*m.im,.5*m.re):r.create(0,.5*m)}if(s(e))return i.map(e,u);if(e.valueOf()!==e)return u(e.valueOf());throw new n.error.UnsupportedTypeError("atan",e)}}},{"../../type/Complex.js":188,"../../type/collection.js":193,"../../util/index.js":198}],169:[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.isNumber,a=r.isComplex,s=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(a(e)&&o(t))return Math.atan2(e.re,t);if(s(e)||s(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":188,"../../type/collection.js":193,"../../util/index.js":198}],170:[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"),a=n.number.isNumber,s=r.isComplex,u=i.isUnit,c=o.isCollection;t.cos=function l(e){if(1!=arguments.length)throw new n.error.ArgumentsError("cos",arguments.length,1);if(a(e))return Math.cos(e);if(s(e))return r.create(.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(c(e))return o.map(e,l);if(e.valueOf()!==e)return l(e.valueOf());throw new n.error.UnsupportedTypeError("cos",e)}}},{"../../type/Complex.js":188,"../../type/Unit.js":192,"../../type/collection.js":193,"../../util/index.js":198}],171:[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"),a=n.number.isNumber,s=r.isComplex,u=i.isUnit,c=o.isCollection;t.cot=function l(e){if(1!=arguments.length)throw new n.error.ArgumentsError("cot",arguments.length,1);if(a(e))return 1/Math.tan(e);if(s(e)){var t=Math.exp(-4*e.im)-2*Math.exp(-2*e.im)*Math.cos(2*e.re)+1;return r.create(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(c(e))return o.map(e,l);if(e.valueOf()!==e)return l(e.valueOf());throw new n.error.UnsupportedTypeError("cot",e)}}},{"../../type/Complex.js":188,"../../type/Unit.js":192,"../../type/collection.js":193,"../../util/index.js":198}],172:[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"),a=n.number.isNumber,s=r.isComplex,u=i.isUnit,c=o.isCollection;t.csc=function l(e){if(1!=arguments.length)throw new n.error.ArgumentsError("csc",arguments.length,1);if(a(e))return 1/Math.sin(e);if(s(e)){var t=.25*(Math.exp(-2*e.im)+Math.exp(2*e.im))-.5*Math.cos(2*e.re);return r.create(.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(c(e))return o.map(e,l);if(e.valueOf()!==e)return l(e.valueOf());throw new n.error.UnsupportedTypeError("csc",e)}}},{"../../type/Complex.js":188,"../../type/Unit.js":192,"../../type/collection.js":193,"../../util/index.js":198}],173:[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"),a=n.number.isNumber,s=r.isComplex,u=i.isUnit,c=o.isCollection;t.sec=function l(e){if(1!=arguments.length)throw new n.error.ArgumentsError("sec",arguments.length,1);if(a(e))return 1/Math.cos(e);if(s(e)){var t=.25*(Math.exp(-2*e.im)+Math.exp(2*e.im))+.5*Math.cos(2*e.re);return r.create(.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(c(e))return o.map(e,l);if(e.valueOf()!==e)return l(e.valueOf());throw new n.error.UnsupportedTypeError("sec",e)}}},{"../../type/Complex.js":188,"../../type/Unit.js":192,"../../type/collection.js":193,"../../util/index.js":198}],174:[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"),a=n.number.isNumber,s=r.isComplex,u=i.isUnit,c=o.isCollection;t.sin=function l(e){if(1!=arguments.length)throw new n.error.ArgumentsError("sin",arguments.length,1);if(a(e))return Math.sin(e);if(s(e))return r.create(.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(c(e))return o.map(e,l);if(e.valueOf()!==e)return l(e.valueOf());throw new n.error.UnsupportedTypeError("sin",e)}}},{"../../type/Complex.js":188,"../../type/Unit.js":192,"../../type/collection.js":193,"../../util/index.js":198}],175:[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"),a=n.number.isNumber,s=r.isComplex,u=i.isUnit,c=o.isCollection;t.tan=function l(e){if(1!=arguments.length)throw new n.error.ArgumentsError("tan",arguments.length,1);if(a(e))return Math.tan(e);if(s(e)){var t=Math.exp(-4*e.im)+2*Math.exp(-2*e.im)*Math.cos(2*e.re)+1;return r.create(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(c(e))return o.map(e,l);if(e.valueOf()!==e)return l(e.valueOf());throw new n.error.UnsupportedTypeError("tan",e)}}},{"../../type/Complex.js":188,"../../type/Unit.js":192,"../../type/collection.js":193,"../../util/index.js":198}],176:[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,a=r.isUnit,s=i.isCollection;t["in"]=function u(e,t){if(2!=arguments.length)throw new n.error.ArgumentsError("in",arguments.length,2);if(a(e)&&(a(t)||o(t)))return e["in"](t);if(s(e)||s(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":192,"../../type/collection.js":193,"../../util/index.js":198}],177:[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":198}],178:[function(e,t){t.exports=function(t){var n=e("../../util/index.js"),r=e("../../expr/Scope.js"),i=e("../../type/collection.js"),o=n.string.isString,a=i.isCollection;t.eval=function(e,s){if(1!=arguments.length&&2!=arguments.length)throw new n.error.ArgumentsError("eval",arguments.length,1,2);var u;if(u=s?s instanceof r?s:new r(s):new r,o(e)){var c=t.parse(e,u);return c.eval()}if(a(e))return i.map(e,function(e){var n=t.parse(e,u);return n.eval()});throw new TypeError("String or matrix expected")}}},{"../../expr/Scope.js":93,"../../type/collection.js":193,"../../util/index.js":198}],179:[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":198}],180:[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.docs[r];if(!o)throw new Error('No documentation found on "'+r+'"');return new n(o)}throw new Error('Could not find search term "'+e+'"')}}},{"../../type/Help.js":189,"../../util/index.js":198}],181:[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,o.createProxy(e,n))}function r(e){return"function"==typeof e||u(e)||c(e)||l(e)||f(e)}var i=e("../../util/index.js"),o=e("../../expr/Selector.js"),a=e("../../type/Complex.js"),s=e("../../type/Unit.js"),u=i.number.isNumber,c=i.string.isString,l=a.isComplex,f=s.isUnit;t["import"]=function p(o,a){var s,u={override:!1,wrap:!0};if(a&&a instanceof Object&&i.object.extend(u,a),c(o)){if("undefined"==typeof e)throw new Error("Cannot load file: require not available.");var l=e(o);p(l)}else if(r(o)){if(s=o.name,!s)throw new Error("Cannot import an unnamed function or object");(u.override||void 0===t[s])&&n(s,o,u)}else if(o instanceof Object)for(s in o)if(o.hasOwnProperty(s)){var f=o[s];r(f)?n(s,f,u):p(f)}}}},{"../../expr/Selector.js":94,"../../type/Complex.js":188,"../../type/Unit.js":192,"../../util/index.js":198}],182:[function(e,t){t.exports=function(t){function n(){ot=0,at=it.charAt(0)}function r(){ot++,at=it.charAt(ot)}function i(){return it.charAt(ot+1)}function o(){for(ut=nt.NULL,st="";" "==at||" "==at;)r();if("#"==at)for(;"\n"!=at&&""!=at;)r();if(""==at)return ut=nt.DELIMITER,void 0;var e=at+i();if(rt[e])return ut=nt.DELIMITER,st=e,r(),r(),void 0;if(rt[at])return ut=nt.DELIMITER,st=at,r(),void 0;if(s(at)){if(ut=nt.NUMBER,"."==at)st+=at,r(),u(at)||(ut=nt.UNKNOWN);else{for(;u(at);)st+=at,r();"."==at&&(st+=at,r())}for(;u(at);)st+=at,r();if("E"==at||"e"==at)for(st+=at,r(),("+"==at||"-"==at)&&(st+=at,r()),u(at)||(ut=nt.UNKNOWN);u(at);)st+=at,r()}else{if(!a(at)){for(ut=nt.UNKNOWN;""!=at;)st+=at,r();throw L('Syntax error in part "'+st+'"')}for(ut=nt.SYMBOL;a(at)||u(at);)st+=at,r()}}function a(e){return e>="a"&&"z">=e||e>="A"&&"Z">=e||"_"==e}function s(e){return e>="0"&&"9">=e||"."==e}function u(e){return e>="0"&&"9">=e}function c(e){n(),o();var t;if(t=""==st?new W(void 0):l(e),""!=st)throw ut==nt.DELIMITER?P("Unknown operator "+st):L('Unexpected part "'+st+'"');return t}function l(e){var t,n,r;for("\n"!=st&&";"!=st&&""!=st&&(t=f(e));"\n"==st||";"==st;)n||(n=new Q,t&&(r=";"!=st,n.add(t,r))),o(),"\n"!=st&&";"!=st&&""!=st&&(t=f(e),r=";"!=st,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(ut==nt.SYMBOL&&"function"==st){if(o(),ut!=nt.SYMBOL)throw L("Function name expected");var t=st;if(o(),"("!=st)throw L("Opening parenthesis ( expected");for(var n=e.createSubScope(),r=[];;){if(o(),ut!=nt.SYMBOL)throw L("Variable name expected");if(r.push(st),o(),","!=st){if(")"==st)break;throw L('Comma , or closing parenthesis ) expected"')}}if(o(),"="!=st)throw L("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,a,s=h(e);if("="==st){if(s instanceof X)return o(),n=s.name,r=null,a=m(e),new Y(n,a,e);if(s instanceof J&&s.object instanceof X)return o(),n=s.object.name,r=s.params,i=s.paramScopes,a=m(e),new et(t,n,r,i,a,e);throw L("Symbol expected at the left hand side of assignment operator =")}return s}function h(e){var n,r,i,a=[];if(n=":"==st?new W(0):x(e),":"==st){for(a.push(n);":"==st;)o(),")"==st||","==st||""==st?a.push(new X("end",e)):a.push(x(e));a.length&&(r="range",i=t.range,n=new $(r,i,a))}return n}function x(e){var n,r,i,a,s;for(n=g(e),r={"in":t["in"]};void 0!==r[st];)i=st,a=r[i],o(),s=[n,g(e)],n=new $(i,a,s);return n}function g(e){var t=y(e);return t}function y(e){var n,r,i,a,s;for(n=d(e),r={"==":t.equal,"!=":t.unequal,"<":t.smaller,">":t.larger,"<=":t.smallereq,">=":t.largereq};void 0!==r[st];)i=st,a=r[i],o(),s=[n,d(e)],n=new $(i,a,s);return n}function d(e){var n,r,i,a,s;for(n=v(e),r={"+":t.add,"-":t.subtract};void 0!==r[st];)i=st,a=r[i],o(),s=[n,v(e)],n=new $(i,a,s);return n}function v(e){var n,r,i,a,s;for(n=j(e),r={"*":t.multiply,".*":t.emultiply,"/":t.divide,"./":t.edivide,"%":t.mod,mod:t.mod};void 0!==r[st];)i=st,a=r[i],o(),s=[n,j(e)],n=new $(i,a,s);return n}function j(e){var n,r,i;return"-"==st?(n=st,r=t.unary,o(),i=[j(e)],new $(n,r,i)):w(e)}function w(e){var n,r,i,a,s,u,c;for(i=[b(e)],a=[];"^"==st||".^"==st;)a.push(st),o(),i.push(b(e));for(n=i.pop();i.length;)r=i.pop(),s=a.pop(),u="^"==s?t.pow:t.epow,c=[r,n],n=new $(s,u,c);return n}function b(e){var n,r,i,a;for(n=E(e);"!"==st;)r=st,i=t.factorial,o(),a=[n],n=new $(r,i,a);return n}function E(e){var n,r,i,a;for(n=N(e);"'"==st;)r=st,i=t.transpose,o(),a=[n],n=new $(r,i,a);return n}function N(e){var t,n,r,i;if(ut==nt.SYMBOL&&tt[st]){if(i=tt[st],o(),"("==st){if(t=[],n=[],o(),")"!=st)for(r=e.createSubScope(),n.push(r),t.push(h(r));","==st;)o(),r=e.createSubScope(),n.push(r),t.push(h(r));if(")"!=st)throw L("Parenthesis ) expected");o()}return new i(t,n)}return O(e)}function O(e){var t,n;return ut==nt.SYMBOL?(n=st,o(),t=new X(n,e),M(e,t)):C(e)}function M(e,n){for(var r,i,a;"("==st;){if(r=[],i=[],o(),")"!=st)for(a=e.createSubScope(),i.push(a),r.push(h(a));","==st;)o(),a=e.createSubScope(),i.push(a),r.push(h(a));if(")"!=st)throw L("Parenthesis ) expected");o(),n=new J(t,n,r,i)}return n}function C(e){var t,n,i;if('"'==st){for(n="",i="";""!=at&&('"'!=at||"\\"==i);)n+=at,i=at,r();if(o(),'"'!=st)throw L('End of string " expected');return o(),t=new W(n),t=M(e,t)}return A(e)}function A(e){var t,n,r,i,a,s;if("["==st){for(o();"\n"==st;)o();if("]"!=st){for(n=[],r=0,i=0,n[0]=[m(e)];","==st||";"==st;){for(","==st?i++:(r++,i=0,n[r]=[]),o();"\n"==st;)o();for(n[r][i]=m(e);"\n"==st;)o()}for(a=n.length,s=n.length>0?n[0].length:0,r=1;a>r;r++)if(n[r].length!=s)throw P("Number of columns must match ("+n[r].length+" != "+s+")");if("]"!=st)throw L("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(ut==nt.NUMBER){if(r="."==st?0:Number(st),o(),ut==nt.SYMBOL){if("i"==st||"I"==st)return n=new k(0,r),o(),new W(n);if(F.isPlainUnit(st))return n=new F(r,st),o(),new W(n);throw I('Unknown unit "'+st+'"')}return t=new W(r),t=M(e,t)}return T(e)}function T(e){var t;if("("==st){if(o(),t=m(e),")"!=st)throw L("Parenthesis ) expected");return o(),t=M(e,t)}return U(e)}function U(){throw""==st?L("Unexpected end of expression"):L("Value expected")}function q(){return void 0}function z(){return ot-st.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 L(e){return new SyntaxError(R(e))}function I(e){return new TypeError(R(e))}function P(e){return new Error(R(e))}var _=e("../../util/index.js"),B=_.string.isString,G=Array.isArray,k=e("./../../type/Complex.js"),H=e("./../../type/Matrix.js"),F=e("./../../type/Unit.js"),V=(e("./../../type/Range.js"),e("../../type/collection.js")),D=e("./../../expr/Scope.js"),Y=e("../../expr/node/AssignmentNode.js"),Q=e("../../expr/node/BlockNode.js"),W=e("../../expr/node/ConstantNode.js"),K=e("../../expr/node/FunctionNode.js"),Z=e("../../expr/node/MatrixNode.js"),$=e("../../expr/node/OperatorNode.js"),J=e("../../expr/node/ParamsNode.js"),X=e("../../expr/node/SymbolNode.js"),et=e("../../expr/node/UpdateNode.js"),tt=e("../../expr/node/handlers.js");t.parse=function(e,t){if(1!=arguments.length&&2!=arguments.length)throw new _.error.ArgumentsError("parse",arguments.length,1,2);var n;if(n=t?t instanceof D?t:new D(t):new D,B(e))return it=e||"",c(n);if(G(e)||e instanceof H)return V.map(e,function(e){return it=e||"",c(n)});throw new TypeError("String or matrix expected")};var nt={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},rt={",":!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},it="",ot=0,at="",st="",ut=nt.NULL}},{"../../expr/node/AssignmentNode.js":96,"../../expr/node/BlockNode.js":97,"../../expr/node/ConstantNode.js":98,"../../expr/node/FunctionNode.js":99,"../../expr/node/MatrixNode.js":100,"../../expr/node/OperatorNode.js":102,"../../expr/node/ParamsNode.js":103,"../../expr/node/SymbolNode.js":104,"../../expr/node/UpdateNode.js":105,"../../expr/node/handlers.js":106,"../../type/collection.js":193,"../../util/index.js":198,"./../../expr/Scope.js":93,"./../../type/Complex.js":188,"./../../type/Matrix.js":190,"./../../type/Range.js":191,"./../../type/Unit.js":192}],183:[function(e,t){t.exports=function(t){var n=e("../../expr/Selector.js");t.select=function(e){return new n(e)}}},{"../../expr/Selector.js":94}],184:[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":198}],185:[function(e,t){var n=t.exports=e("./math.js");n.options=e("./options"),n.expr=e("./expr/index.js"),n.type=e("./type/index.js"),n.docs=e("./docs/index.js"),e("./function/arithmetic/abs.js")(n),e("./function/arithmetic/add.js")(n),e("./function/arithmetic/add.js")(n),e("./function/arithmetic/ceil.js")(n),e("./function/arithmetic/cube.js")(n),e("./function/arithmetic/divide.js")(n),e("./function/arithmetic/edivide.js")(n),e("./function/arithmetic/emultiply.js")(n),e("./function/arithmetic/epow.js")(n),e("./function/arithmetic/equal.js")(n),e("./function/arithmetic/exp.js")(n),e("./function/arithmetic/fix.js")(n),e("./function/arithmetic/floor.js")(n),e("./function/arithmetic/gcd.js")(n),e("./function/arithmetic/larger.js")(n),e("./function/arithmetic/largereq.js")(n),e("./function/arithmetic/lcm.js")(n),e("./function/arithmetic/log.js")(n),e("./function/arithmetic/log10.js")(n),e("./function/arithmetic/mod.js")(n),e("./function/arithmetic/multiply.js")(n),e("./function/arithmetic/pow.js")(n),e("./function/arithmetic/round.js")(n),e("./function/arithmetic/sign.js")(n),e("./function/arithmetic/smaller.js")(n),e("./function/arithmetic/smallereq.js")(n),e("./function/arithmetic/sqrt.js")(n),e("./function/arithmetic/square.js")(n),e("./function/arithmetic/subtract.js")(n),e("./function/arithmetic/unary.js")(n),e("./function/arithmetic/unequal.js")(n),e("./function/arithmetic/xgcd.js")(n),e("./function/complex/arg.js")(n),e("./function/complex/conj.js")(n),e("./function/complex/re.js")(n),e("./function/complex/im.js")(n),e("./function/construction/boolean.js")(n),e("./function/construction/complex.js")(n),e("./function/construction/matrix.js")(n),e("./function/construction/number.js")(n),e("./function/construction/parser.js")(n),e("./function/construction/range.js")(n),e("./function/construction/string.js")(n),e("./function/construction/unit.js")(n),e("./function/matrix/concat.js")(n),e("./function/matrix/det.js")(n),e("./function/matrix/diag.js")(n),e("./function/matrix/eye.js")(n),e("./function/matrix/inv.js")(n),e("./function/matrix/ones.js")(n),e("./function/matrix/size.js")(n),e("./function/matrix/squeeze.js")(n),e("./function/matrix/subset.js")(n),e("./function/matrix/transpose.js")(n),e("./function/matrix/zeros.js")(n),e("./function/probability/factorial.js")(n),e("./function/probability/random.js")(n),e("./function/statistics/min.js")(n),e("./function/statistics/max.js")(n),e("./function/trigonometry/acos.js")(n),e("./function/trigonometry/asin.js")(n),e("./function/trigonometry/atan.js")(n),e("./function/trigonometry/atan2.js")(n),e("./function/trigonometry/cos.js")(n),e("./function/trigonometry/cot.js")(n),e("./function/trigonometry/csc.js")(n),e("./function/trigonometry/sec.js")(n),e("./function/trigonometry/sin.js")(n),e("./function/trigonometry/tan.js")(n),e("./function/units/in.js")(n),e("./function/utils/clone.js")(n),e("./function/utils/eval.js")(n),e("./function/utils/format.js")(n),e("./function/utils/help.js")(n),e("./function/utils/import.js")(n),e("./function/utils/parse.js")(n),e("./function/utils/select.js")(n),e("./function/utils/typeof.js")(n),e("./constants.js")(n),e("./expr/Selector.js").init()},{"./constants.js":1,"./docs/index.js":91,"./expr/Selector.js":94,"./expr/index.js":95,"./function/arithmetic/abs.js":108,"./function/arithmetic/add.js":109,"./function/arithmetic/ceil.js":110,"./function/arithmetic/cube.js":111,"./function/arithmetic/divide.js":112,"./function/arithmetic/edivide.js":113,"./function/arithmetic/emultiply.js":114,"./function/arithmetic/epow.js":115,"./function/arithmetic/equal.js":116,"./function/arithmetic/exp.js":117,"./function/arithmetic/fix.js":118,"./function/arithmetic/floor.js":119,"./function/arithmetic/gcd.js":120,"./function/arithmetic/larger.js":121,"./function/arithmetic/largereq.js":122,"./function/arithmetic/lcm.js":123,"./function/arithmetic/log.js":124,"./function/arithmetic/log10.js":125,"./function/arithmetic/mod.js":126,"./function/arithmetic/multiply.js":127,"./function/arithmetic/pow.js":128,"./function/arithmetic/round.js":129,"./function/arithmetic/sign.js":130,"./function/arithmetic/smaller.js":131,"./function/arithmetic/smallereq.js":132,"./function/arithmetic/sqrt.js":133,"./function/arithmetic/square.js":134,"./function/arithmetic/subtract.js":135,"./function/arithmetic/unary.js":136,"./function/arithmetic/unequal.js":137,"./function/arithmetic/xgcd.js":138,"./function/complex/arg.js":139,"./function/complex/conj.js":140,"./function/complex/im.js":141,"./function/complex/re.js":142,"./function/construction/boolean.js":143,"./function/construction/complex.js":144,"./function/construction/matrix.js":145,"./function/construction/number.js":146,"./function/construction/parser.js":147,"./function/construction/range.js":148,"./function/construction/string.js":149,"./function/construction/unit.js":150,"./function/matrix/concat.js":151,"./function/matrix/det.js":152,"./function/matrix/diag.js":153,"./function/matrix/eye.js":154,"./function/matrix/inv.js":155,"./function/matrix/ones.js":156,"./function/matrix/size.js":157,"./function/matrix/squeeze.js":158,"./function/matrix/subset.js":159,"./function/matrix/transpose.js":160,"./function/matrix/zeros.js":161,"./function/probability/factorial.js":162,"./function/probability/random.js":163,"./function/statistics/max.js":164,"./function/statistics/min.js":165,"./function/trigonometry/acos.js":166,"./function/trigonometry/asin.js":167,"./function/trigonometry/atan.js":168,"./function/trigonometry/atan2.js":169,"./function/trigonometry/cos.js":170,"./function/trigonometry/cot.js":171,"./function/trigonometry/csc.js":172,"./function/trigonometry/sec.js":173,"./function/trigonometry/sin.js":174,"./function/trigonometry/tan.js":175,"./function/units/in.js":176,"./function/utils/clone.js":177,"./function/utils/eval.js":178,"./function/utils/format.js":179,"./function/utils/help.js":180,"./function/utils/import.js":181,"./function/utils/parse.js":182,"./function/utils/select.js":183,"./function/utils/typeof.js":184,"./math.js":186,"./options":187,"./type/index.js":194}],186:[function(){},{}],187:[function(e,t,n){n.precision=5},{}],188:[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(;" "==y||" "==y;)s()}function o(e){return e>="0"&&"9">=e||"."==e}function a(e){return e>="0"&&"9">=e}function s(){g++,y=x.charAt(g)}function u(e){g=e,y=x.charAt(g)}function c(){var e,t="";if(e=g,"+"==y?s():"-"==y&&(t+=y,s()),!o(y))return u(e),null;if("."==y){if(t+=y,s(),!a(y))return u(e),null}else{for(;a(y);)t+=y,s();"."==y&&(t+=y,s())}for(;a(y);)t+=y,s();if("E"==y||"e"==y){if(t+=y,s(),("+"==y||"-"==y)&&(t+=y,s()),!a(y))return u(e),null;for(;a(y);)t+=y,s()}return t}function l(){var e=x.charAt(g+1);if("I"==y||"i"==y)return s(),"1";if(!("+"!=y&&"-"!=y||"I"!=e&&"i"!=e)){var t="+"==y?"1":"-1";return s(),s(),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,y;r.create=function(e,t){return 0==t?e:new r(e,t)},r.parse=function(e){if(x=e,g=-1,y="",!h(x))return null;s(),i();var t=c();if(t){if("I"==y||"i"==y)return s(),i(),y?null:new r(0,Number(t));i();var n=y;if("+"!=n&&"-"!=n)return i(),y?null:new r(Number(t),0);s(),i();var o=c();if(o){if("I"!=y&&"i"!=y)return null;s()}else if(o=l(),!o)return null;return"-"==n&&(o="-"==o[0]?"+"+o.substring(1):"-"+o),s(),i(),y?null:new r(Number(t),Number(o))}return(t=l())?(i(),y?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,n.create=r.create,f.types.addType("complex",r)},{"../util/index.js":198}],189:[function(e,t,n){function r(e){e&&a.extend(this,e)}var i=e("../math.js"),o=e("../util/index.js"),a=o.object,s=o.string;r.isHelp=function(e){return e instanceof r},r.prototype.toString=function(){var e="\n";if(this.name&&(e+="Name: "+this.name+"\n\n"),this.category&&(e+="Category: "+this.category+"\n\n"),this.syntax&&(e+="Syntax:\n "+this.syntax.join("\n ")+"\n\n"),this.examples){var t=i.parser();e+="Examples:\n";for(var n=0;n<this.examples.length;n++){var o,a=this.examples[n];try{o=t.eval(a)}catch(u){o=u}e+=" "+a+"\n",!o||o instanceof r||(e+=" "+s.format(o)+"\n")}e+="\n"}return this.seealso&&(e+="See also: "+this.seealso.join(", ")+"\n"),e},r.prototype.toJSON=function(){return a.extend({},this)},t.exports=r,n.isHelp=r.isHelp,o.types.addType("help",r)},{"../math.js":186,"../util/index.js":198}],190:[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||e instanceof g)this._data=e.toArray();else if(Array.isArray(e))this._data=e;else{if(null!=e)throw new TypeError("Unsupported type of data ("+v.type(e)+")");this._data=[]}this._size=d.size(this._data)}function i(e,t){return d.validateIndex(t,e.length),e[t]}function o(e,t){return t.forEach(function(t){e=i(e,t)}),v.clone(e)}function a(e,t){var n=t[0];return n.map?n.map(function(t){return i(e,t)}):[i(e,n)]}function s(e,t){var n=t[0],r=t[1];if(n.map)return r.map?n.map(function(t){var n=i(e,t);return r.map(function(e){return i(n,e)})}):n.map(function(t){return[i(i(e,t),r)]});if(r.map){var o=i(e,n);return[r.map(function(e){return i(o,e)})]}return[[i(i(e,n),r)]]}function u(e,t,n){var r=n==t.length-1,o=t[n],a=function(o){var a=i(e,o);return r?a:u(a,t,n+1)};return o.map?o.map(a):[a(o)]}function c(e,t,n){if(d.validateIndex(t),Array.isArray(n))throw new TypeError("Dimension mismatch, value expected instead of array");e[t]=n}function l(e,t,n,r){var i=!1;n.length>t.length&&(i=!0);for(var o=0;o<n.length;o++){var a=n[o];d.validateIndex(a),(null==t[o]||a+1>t[o])&&(t[o]=a+1,i=!0)}i&&d.resize(e,t,0);var s=t.length;n.forEach(function(t,n){s-1>n?e=e[t]:e[t]=r})}function f(e,t,n,r){var i=n[0];d.validateIndex(i),i+1>t[0]&&(d.resize(e,[i+1],0),t[0]=i+1),e[i]=r}function p(e,t,n,r){var i=n[0],o=n[1];d.validateIndex(i),d.validateIndex(o);var a=!1;i+1>(t[0]||0)&&(t[0]=i+1,a=!0),o+1>(t[1]||0)&&(t[1]=o+1,a=!0),a&&d.resize(e,t,0),e[i][o]=r}function m(e,t,n,r,i){var o=r==n.length-1,a=n[r],s=function(a,s){if(o)c(e,a,i[s]),a+1>(t[r]||0)&&(t[r]=a+1);else{var u=e[a];Array.isArray(u)||(e[a]=u=[u]),a+1>(t[r]||0)&&(t[r]=a+1),m(u,t,n,r+1,i[s])}};if(a.map){var u=a.size&&a.size()||a.length;if(u!=i.length)throw new RangeError("Dimensions mismatch ("+u+" != "+i.length+")");a.map(s)}else s(a,0)}function h(e){for(var t=0,n=e.length;n>t;t++){var r=e[t];Array.isArray(r)?h(r):void 0==r&&(e[t]=0)}}var x=e("../util/index.js"),g=e("./Range.js"),y=(x.number,x.string),d=x.array,v=x.object;r.isMatrix=function(e){return e instanceof r},r.prototype.get=function(e){var t;if(e instanceof r)t=1==e.size().length||!e.size().some(function(e){return 0!=e}),e=e.valueOf();else{if(!Array.isArray(e))throw new TypeError("Invalid index");t=!e.some(function(e){var t=d.size(e.valueOf());return 0!=t.length&&t!=[0]})}if(e.length!=this._size.length)throw new RangeError("Dimension mismatch ("+e.length+" != "+this._size.length+")");if(t)switch(e.length){case 1:return i(this._data,e[0]);case 2:return i(i(this._data,e[0]),e[1]);default:return o(this._data,e)}else switch(e.length){case 1:return new r(a(this._data,e));case 2:return new r(s(this._data,e));default:return new r(u(this._data,e,0))}},r.prototype.set=function(e,t){var n;if(e instanceof r)n=1==e.size().length||!e.size().some(function(e){return 0!=e}),e=e.valueOf();else{if(!Array.isArray(e))throw new TypeError("Invalid index");n=!e.some(function(e){var t=d.size(e.valueOf());return 0!=t.length&&t!=[0]})}if((t instanceof r||t instanceof g)&&(t=t.valueOf()),e.length<this._size.length)throw new RangeError("Dimension mismatch ("+e.length+" != "+this._size.length+")");if(n){if(0!=d.size(t.valueOf()).length)throw new TypeError("Scalar value expected");switch(e.length){case 1:f(this._data,this._size,e,t);break;case 2:p(this._data,this._size,e,t);break;default:l(this._data,this._size,e,t)}}else{var i=this._size.concat();m(this._data,i,e,0,t),v.deepEqual(this._size,i)||(h(this._data),this.resize(i))}return this},r.prototype.resize=function(e,t){d.resize(this._data,e,t),this._size=v.clone(e)},r.prototype.clone=function(){var e=new r;return e._data=v.clone(this._data),e._size=v.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=v.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:v.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 v.clone(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.toString=function(){return y.format(this._data)},t.exports=r,n.isMatrix=r.isMatrix,x.types.addType("matrix",r)},{"../util/index.js":198,"./Range.js":191}],191:[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!=n&&!o.isNumber(n))throw new TypeError("Parameter end must be a number");if(null!=t&&!o.isNumber(t))throw new TypeError("Parameter step must be a number");this.start=null!=e?e:0,this.end=null!=n?n:0,this.step=null!=t?t:1}var i=e("../util/index.js"),o=i.number,a=i.string;i.array,r.parse=function(e){if(!a.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],1,n[1]);case 3:return new r(n[0],n[1],n[2]);default:return null}},r.prototype.clone=function(){return new r(this.start,this.step,this.end)},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.floor(i/n)+1:0==i&&(e=1),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":198}],192:[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&&!d(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=w;null!=e?(this.value=this._normalize(e),this.fixPrefix=!1):(this.value=null,this.fixPrefix=!0)}function i(){for(;" "==h||" "==h;)s()}function o(e){return e>="0"&&"9">=e||"."==e}function a(e){return e>="0"&&"9">=e}function s(){m++,h=p.charAt(m)}function u(e){m=e,h=p.charAt(m)}function c(){var e,t="";if(e=m,"+"==h?s():"-"==h&&(t+=h,s()),!o(h))return u(e),null;if("."==h){if(t+=h,s(),!a(h))return u(e),null}else{for(;a(h);)t+=h,s();"."==h&&(t+=h,s())}for(;a(h);)t+=h,s();if("E"==h||"e"==h){if(t+=h,s(),("+"==h||"-"==h)&&(t+=h,s()),!a(h))return u(e),null;for(;a(h);)t+=h,s()}return t}function l(){var e="";for(i();h&&" "!=h&&" "!=h;)e+=h,s();return e||null}function f(e){for(var t=0,n=E.length;n>t;t++){var r=E[t];if(y.endsWith(e,r.name)){var i=e.length-r.name.length,o=e.substring(0,i),a=r.prefixes[o];if(void 0!==a)return{unit:r,prefix:a}}}return null}var p,m,h,x=e("../util/index.js"),g=x.number,y=x.string,d=x.number.isNumber,v=x.string.isString;r.parse=function(e){if(p=e,m=-1,h="",!v(p))return null;s(),i();var t,n=c();return n?(t=l(),s(),i(),h?null:n&&t?new r(Number(n),t):null):(t=l(),s(),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=w,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 a=Math.abs(Math.log(e/o.value)/Math.LN10-1.2);n>a&&(t=o,n=a)}}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}}},w={name:"",value:1,scientific:!0},b={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:b.LENGTH,prefixes:j.LONG,value:1,offset:0},{name:"inch",base:b.LENGTH,prefixes:j.NONE,value:.0254,offset:0},{name:"foot",base:b.LENGTH,prefixes:j.NONE,value:.3048,offset:0},{name:"yard",base:b.LENGTH,prefixes:j.NONE,value:.9144,offset:0},{name:"mile",base:b.LENGTH,prefixes:j.NONE,value:1609.344,offset:0},{name:"link",base:b.LENGTH,prefixes:j.NONE,value:.201168,offset:0},{name:"rod",base:b.LENGTH,prefixes:j.NONE,value:5.02921,offset:0},{name:"chain",base:b.LENGTH,prefixes:j.NONE,value:20.1168,offset:0},{name:"angstrom",base:b.LENGTH,prefixes:j.NONE,value:1e-10,offset:0},{name:"m",base:b.LENGTH,prefixes:j.SHORT,value:1,offset:0},{name:"ft",base:b.LENGTH,prefixes:j.NONE,value:.3048,offset:0},{name:"yd",base:b.LENGTH,prefixes:j.NONE,value:.9144,offset:0},{name:"mi",base:b.LENGTH,prefixes:j.NONE,value:1609.344,offset:0},{name:"li",base:b.LENGTH,prefixes:j.NONE,value:.201168,offset:0},{name:"rd",base:b.LENGTH,prefixes:j.NONE,value:5.02921,offset:0},{name:"ch",base:b.LENGTH,prefixes:j.NONE,value:20.1168,offset:0},{name:"mil",base:b.LENGTH,prefixes:j.NONE,value:254e-7,offset:0},{name:"m2",base:b.SURFACE,prefixes:j.SHORT,value:1,offset:0},{name:"sqin",base:b.SURFACE,prefixes:j.NONE,value:64516e-8,offset:0},{name:"sqft",base:b.SURFACE,prefixes:j.NONE,value:.09290304,offset:0},{name:"sqyd",base:b.SURFACE,prefixes:j.NONE,value:.83612736,offset:0},{name:"sqmi",base:b.SURFACE,prefixes:j.NONE,value:2589988.110336,offset:0},{name:"sqrd",base:b.SURFACE,prefixes:j.NONE,value:25.29295,offset:0},{name:"sqch",base:b.SURFACE,prefixes:j.NONE,value:404.6873,offset:0},{name:"sqmil",base:b.SURFACE,prefixes:j.NONE,value:6.4516e-10,offset:0},{name:"m3",base:b.VOLUME,prefixes:j.SHORT,value:1,offset:0},{name:"L",base:b.VOLUME,prefixes:j.SHORT,value:.001,offset:0},{name:"litre",base:b.VOLUME,prefixes:j.LONG,value:.001,offset:0},{name:"cuin",base:b.VOLUME,prefixes:j.NONE,value:16387064e-12,offset:0},{name:"cuft",base:b.VOLUME,prefixes:j.NONE,value:.028316846592,offset:0},{name:"cuyd",base:b.VOLUME,prefixes:j.NONE,value:.764554857984,offset:0},{name:"teaspoon",base:b.VOLUME,prefixes:j.NONE,value:5e-6,offset:0},{name:"tablespoon",base:b.VOLUME,prefixes:j.NONE,value:15e-6,offset:0},{name:"minim",base:b.VOLUME,prefixes:j.NONE,value:6.161152e-8,offset:0},{name:"fluiddram",base:b.VOLUME,prefixes:j.NONE,value:36966911e-13,offset:0},{name:"fluidounce",base:b.VOLUME,prefixes:j.NONE,value:2957353e-11,offset:0},{name:"gill",base:b.VOLUME,prefixes:j.NONE,value:.0001182941,offset:0},{name:"cup",base:b.VOLUME,prefixes:j.NONE,value:.0002365882,offset:0},{name:"pint",base:b.VOLUME,prefixes:j.NONE,value:.0004731765,offset:0},{name:"quart",base:b.VOLUME,prefixes:j.NONE,value:.0009463529,offset:0},{name:"gallon",base:b.VOLUME,prefixes:j.NONE,value:.003785412,offset:0},{name:"beerbarrel",base:b.VOLUME,prefixes:j.NONE,value:.1173478,offset:0},{name:"oilbarrel",base:b.VOLUME,prefixes:j.NONE,value:.1589873,offset:0},{name:"hogshead",base:b.VOLUME,prefixes:j.NONE,value:.238481,offset:0},{name:"fldr",base:b.VOLUME,prefixes:j.NONE,value:36966911e-13,offset:0},{name:"floz",base:b.VOLUME,prefixes:j.NONE,value:2957353e-11,offset:0},{name:"gi",base:b.VOLUME,prefixes:j.NONE,value:.0001182941,offset:0},{name:"cp",base:b.VOLUME,prefixes:j.NONE,value:.0002365882,offset:0},{name:"pt",base:b.VOLUME,prefixes:j.NONE,value:.0004731765,offset:0},{name:"qt",base:b.VOLUME,prefixes:j.NONE,value:.0009463529,offset:0},{name:"gal",base:b.VOLUME,prefixes:j.NONE,value:.003785412,offset:0},{name:"bbl",base:b.VOLUME,prefixes:j.NONE,value:.1173478,offset:0},{name:"obl",base:b.VOLUME,prefixes:j.NONE,value:.1589873,offset:0},{name:"g",base:b.MASS,prefixes:j.SHORT,value:.001,offset:0},{name:"gram",base:b.MASS,prefixes:j.LONG,value:.001,offset:0},{name:"ton",base:b.MASS,prefixes:j.SHORT,value:907.18474,offset:0},{name:"tonne",base:b.MASS,prefixes:j.SHORT,value:1e3,offset:0},{name:"grain",base:b.MASS,prefixes:j.NONE,value:6479891e-11,offset:0},{name:"dram",base:b.MASS,prefixes:j.NONE,value:.0017718451953125,offset:0},{name:"ounce",base:b.MASS,prefixes:j.NONE,value:.028349523125,offset:0},{name:"poundmass",base:b.MASS,prefixes:j.NONE,value:.45359237,offset:0},{name:"hundredweight",base:b.MASS,prefixes:j.NONE,value:45.359237,offset:0},{name:"stick",base:b.MASS,prefixes:j.NONE,value:.115,offset:0},{name:"gr",base:b.MASS,prefixes:j.NONE,value:6479891e-11,offset:0},{name:"dr",base:b.MASS,prefixes:j.NONE,value:.0017718451953125,offset:0},{name:"oz",base:b.MASS,prefixes:j.NONE,value:.028349523125,offset:0},{name:"lbm",base:b.MASS,prefixes:j.NONE,value:.45359237,offset:0},{name:"cwt",base:b.MASS,prefixes:j.NONE,value:45.359237,offset:0},{name:"s",base:b.TIME,prefixes:j.SHORT,value:1,offset:0},{name:"min",base:b.TIME,prefixes:j.NONE,value:60,offset:0},{name:"h",base:b.TIME,prefixes:j.NONE,value:3600,offset:0},{name:"seconds",base:b.TIME,prefixes:j.LONG,value:1,offset:0},{name:"second",base:b.TIME,prefixes:j.LONG,value:1,offset:0},{name:"sec",base:b.TIME,prefixes:j.LONG,value:1,offset:0},{name:"minutes",base:b.TIME,prefixes:j.NONE,value:60,offset:0},{name:"minute",base:b.TIME,prefixes:j.NONE,value:60,offset:0},{name:"hours",base:b.TIME,prefixes:j.NONE,value:3600,offset:0},{name:"hour",base:b.TIME,prefixes:j.NONE,value:3600,offset:0},{name:"day",base:b.TIME,prefixes:j.NONE,value:86400,offset:0},{name:"days",base:b.TIME,prefixes:j.NONE,value:86400,offset:0},{name:"rad",base:b.ANGLE,prefixes:j.NONE,value:1,offset:0},{name:"deg",base:b.ANGLE,prefixes:j.NONE,value:.017453292519943295,offset:0},{name:"grad",base:b.ANGLE,prefixes:j.NONE,value:.015707963267948967,offset:0},{name:"cycle",base:b.ANGLE,prefixes:j.NONE,value:6.283185307179586,offset:0},{name:"A",base:b.CURRENT,prefixes:j.SHORT,value:1,offset:0},{name:"ampere",base:b.CURRENT,prefixes:j.LONG,value:1,offset:0},{name:"K",base:b.TEMPERATURE,prefixes:j.NONE,value:1,offset:0},{name:"degC",base:b.TEMPERATURE,prefixes:j.NONE,value:1,offset:273.15},{name:"degF",base:b.TEMPERATURE,prefixes:j.NONE,value:1/1.8,offset:459.67},{name:"degR",base:b.TEMPERATURE,prefixes:j.NONE,value:1/1.8,offset:0},{name:"kelvin",base:b.TEMPERATURE,prefixes:j.NONE,value:1,offset:0},{name:"celsius",base:b.TEMPERATURE,prefixes:j.NONE,value:1,offset:273.15},{name:"fahrenheit",base:b.TEMPERATURE,prefixes:j.NONE,value:1/1.8,offset:459.67},{name:"rankine",base:b.TEMPERATURE,prefixes:j.NONE,value:1/1.8,offset:0},{name:"mol",base:b.AMOUNT_OF_SUBSTANCE,prefixes:j.NONE,value:1,offset:0},{name:"mole",base:b.AMOUNT_OF_SUBSTANCE,prefixes:j.NONE,value:1,offset:0},{name:"cd",base:b.LUMINOUS_INTENSITY,prefixes:j.NONE,value:1,offset:0},{name:"candela",base:b.LUMINOUS_INTENSITY,prefixes:j.NONE,value:1,offset:0},{name:"N",base:b.FORCE,prefixes:j.SHORT,value:1,offset:0},{name:"newton",base:b.FORCE,prefixes:j.LONG,value:1,offset:0},{name:"lbf",base:b.FORCE,prefixes:j.NONE,value:4.4482216152605,offset:0},{name:"poundforce",base:b.FORCE,prefixes:j.NONE,value:4.4482216152605,offset:0},{name:"b",base:b.BIT,prefixes:j.BINARY_SHORT,value:1,offset:0},{name:"bits",base:b.BIT,prefixes:j.BINARY_LONG,value:1,offset:0},{name:"B",base:b.BIT,prefixes:j.BINARY_SHORT,value:8,offset:0},{name:"bytes",base:b.BIT,prefixes:j.BINARY_LONG,value:8,offset:0}];r.PREFIXES=j,r.BASE_UNITS=b,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":198}],193:[function(e,t,n){var r=e("../util/index.js"),i=e("./Matrix.js"),o=e("./Range.js"),a=Array.isArray;r.string.isString,n.argsToArray=function(e){var t;if(0==e.length)t=[];else if(1==e.length)t=e[0],t instanceof i&&(t=t.toVector()),t instanceof o&&(t=t.valueOf()),a(t)||(t=[t]);else{t=[];for(var n=0;n<e.length;n++)t[n]=e[n]}return t},n.isCollection=function(e){return a(e)||e instanceof i||e instanceof o},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 u(e,t,n){var r,s,c;if(e instanceof i||t instanceof i)return new i(u(e.valueOf(),t.valueOf(),n));if(e instanceof o||t instanceof o)return u(e.valueOf(),t.valueOf(),n);if(a(e))if(a(t)){if(e.length!=t.length)throw new RangeError("Dimension mismatch ("+e.length+" != "+t.length+")");for(r=[],s=e.length,c=0;s>c;c++)r[c]=n(e[c],t[c])}else for(r=[],s=e.length,c=0;s>c;c++)r[c]=n(e[c],t);else if(a(t))for(r=[],s=t.length,c=0;s>c;c++)r[c]=n(e,t[c]);else r=n(e,t);return r},n.deepMap2=function c(e,t,n){var r,s,u;if(e instanceof i||t instanceof i)return new i(c(e.valueOf(),t.valueOf(),n));if(e instanceof o||t instanceof o)return c(e.valueOf(),t.valueOf(),n);if(a(e))if(a(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]=c(e[u],t[u],n)}else for(r=[],s=e.length,u=0;s>u;u++)r[u]=c(e[u],t,n);else if(a(t))for(r=[],s=t.length,u=0;s>u;u++)r[u]=c(e,t[u],n);else r=n(e,t);return r}},{"../util/index.js":198,"./Matrix.js":190,"./Range.js":191}],194:[function(e,t,n){n.Complex=e("./Complex.js"),n.Range=e("./Range.js"),n.Matrix=e("./Matrix.js"),n.Unit=e("./Unit.js"),n.Help=e("./Help.js"),n.collection=e("./collection.js")},{"./Complex.js":188,"./Help.js":189,"./Matrix.js":190,"./Range.js":191,"./Unit.js":192,"./collection.js":193}],195:[function(e,t,n){function r(e){if(Array.isArray(e)){var t=e.length;if(t){var n=r(e[0]);return 0==n[0]?[0].concat(n):[t].concat(n)}return[t]}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 a=n+1;for(r=0;o>r;r++){var s=e[r];if(!Array.isArray(s))throw new RangeError("Dimension mismatch ("+(t.length-1)+" < "+t.length+")");i(e[r],t,a)}}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){if(n<t.length-1){var r=e[0];if(1!=e.length||!Array.isArray(r))throw new RangeError("Dimension mismatch ("+e.length+" > 0)");o(r,t,n+1)}else if(e.length)throw new RangeError("Dimension mismatch ("+e.length+" > 0)")}function a(e,t,n,r){if(!Array.isArray(e))throw new TypeError("Array expected");var i=e.length,o=t[n];if(i!=o){if(o>e.length)for(var s=e.length;o>s;s++)e[s]=r?c.clone(r):0;else e.length=t[n];i=e.length}if(n<t.length-1){var u=n+1;for(s=0;i>s;s++)l=e[s],Array.isArray(l)||(l=[l],e[s]=l),a(l,t,u,r)}else for(s=0;i>s;s++){for(var l=e[s];Array.isArray(l);)l=l[0];e[s]=l}}var s=e("./number"),u=e("./string"),c=e("./object");n.size=function(e){var t=r(e);return n.validate(e,t),t},n.validate=function(e,t){var r=0==t.length;if(r){if(Array.isArray(e))throw new RangeError("Dimension mismatch ("+e.length+" != 0)")}else{var a=-1!=t.indexOf(0);a?(t.forEach(function(e){if(0!=e)throw new RangeError("Invalid size, all dimensions must be either zero or non-zero (size: "+n.formatArray(t)+")")}),o(e,t,0)):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+")")},n.resize=function(e,t,n){if(!Array.isArray(t))throw new TypeError("Size must be an array (size is "+c.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: "+u.format(t)+")")});var r=-1!=t.indexOf(0);r&&t.forEach(function(e){if(0!=e)throw new RangeError("Invalid size, all dimensions must be either zero or non-zero (size: "+u.format(t)+")")}),a(e,t,0,n)},n.isArray=Array.isArray},{"./number":199,"./object":200,"./string":201}],196:[function(e,t,n){n.isBoolean=function(e){return e instanceof Boolean||"boolean"==typeof e}},{}],197:[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":202}],198:[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":195,"./boolean":196,"./error":197,"./number":199,"./object":200,"./string":201,"./types":202}],199:[function(e,t,n){var r=e("../options.js");n.isNumber=function(e){return e instanceof Number||"number"==typeof e},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":187}],200:[function(e,t,n){var r=e("./number.js"),i=e("./string.js"),o=e("./boolean.js");n.clone=function a(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 a(e)});if(e instanceof Object){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=a(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 s(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?s(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":196,"./number.js":199,"./string.js":201}],201:[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 a=arguments[0];return i.isNumber(a)?i.format(a):Array.isArray(a)?r(a):n.isString(a)?'"'+a+'"':a instanceof Object?a.toString():String(a)}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":199}],202:[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}},{}]},{},[185])(185)}),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),a=o.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(t&&(n=t),r=new Array(a),i=0;a>i;){var s,u;i in o&&(s=o[i],u=e.call(n,s,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});