math.min.js 242 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * math.js
  3. * https://github.com/josdejong/mathjs
  4. *
  5. * Math.js is an extensive math library for JavaScript and Node.js,
  6. * It features real and complex numbers, units, matrices, a large set of
  7. * mathematical functions, and a flexible expression parser.
  8. *
  9. * @version 1.2.0
  10. * @date 2014-12-25
  11. *
  12. * @license
  13. * Copyright (C) 2013-2014 Jos de Jong <wjosdejong@gmail.com>
  14. *
  15. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  16. * use this file except in compliance with the License. You may obtain a copy
  17. * of the License at
  18. *
  19. * http://www.apache.org/licenses/LICENSE-2.0
  20. *
  21. * Unless required by applicable law or agreed to in writing, software
  22. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  23. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  24. * License for the specific language governing permissions and limitations under
  25. * the License.
  26. */
  27. !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):"object"==typeof exports?exports.math=r():e.math=r()}(this,function(){return function(e){function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}var t={};return r.m=e,r.c=t,r.p="",r(0)}([function(e,r,t){e.exports=t(1)},function(e,r,t){"use strict";function n(e){if("function"!=typeof Object.create)throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var r={},a={matrix:"matrix",number:"number",precision:64,epsilon:1e-14};r.config=function(e){if(e){if(i.deepExtend(a,e),e.precision&&r.type.BigNumber.config({precision:e.precision}),t(2)(r,a),e.number&&e.number.defaultType)throw new Error("setting `number.defaultType` is deprecated. Use `number` instead.");if(e.number&&e.number.precision)throw new Error("setting `number.precision` is deprecated. Use `precision` instead.");if(e.matrix&&e.matrix.defaultType)throw new Error("setting `matrix.defaultType` is deprecated. Use `matrix` instead.");if(e.matrix&&e.matrix["default"])throw new Error("setting `matrix.default` is deprecated. Use `matrix` instead.");if(e.decimals)throw new Error("setting `decimals` is deprecated. Use `precision` instead.")}return i.clone(a)},r.create=n;var s=t(159).constructor();if("function"!=typeof s.prototype.clone&&(s.prototype.clone=function(){return this}),"function"==typeof s.convert)throw new Error("Cannot add function convert to BigNumber: function already exists");return s.convert=function(e){return o(e)>15?e:new s(e)},r.error=t(5),r.type={},r.type.Complex=t(6),r.type.Range=t(7),r.type.Index=t(8),r.type.Matrix=t(9),r.type.Unit=t(10),r.type.Help=t(11),r.type.ResultSet=t(12),r.type.BigNumber=s,r.collection=t(13),r.expression={},r.expression.node=t(16),r.expression.parse=t(14),r.expression.Parser=t(15),r.expression.docs=t(17),t(29)(r,a),t(30)(r,a),t(31)(r,a),t(32)(r,a),t(33)(r,a),t(34)(r,a),t(35)(r,a),t(36)(r,a),t(37)(r,a),t(38)(r,a),t(39)(r,a),t(40)(r,a),t(41)(r,a),t(42)(r,a),t(43)(r,a),t(44)(r,a),t(45)(r,a),t(46)(r,a),t(47)(r,a),t(48)(r,a),t(49)(r,a),t(50)(r,a),t(51)(r,a),t(52)(r,a),t(53)(r,a),t(54)(r,a),t(55)(r,a),t(56)(r,a),t(57)(r,a),t(58)(r,a),t(59)(r,a),t(60)(r,a),t(61)(r,a),t(62)(r,a),t(63)(r,a),t(64)(r,a),t(65)(r,a),t(66)(r,a),t(67)(r,a),t(68)(r,a),t(69)(r,a),t(70)(r,a),t(71)(r,a),t(72)(r,a),t(73)(r,a),t(74)(r,a),t(75)(r,a),t(76)(r,a),t(77)(r,a),t(78)(r,a),t(79)(r,a),t(80)(r,a),t(81)(r,a),t(82)(r,a),t(83)(r,a),t(84)(r,a),t(85)(r,a),t(86)(r,a),t(87)(r,a),t(88)(r,a),t(89)(r,a),t(90)(r,a),t(91)(r,a),t(92)(r,a),t(93)(r,a),t(94)(r,a),t(95)(r,a),t(96)(r,a),t(97)(r,a),t(98)(r,a),t(99)(r,a),t(100)(r,a),t(101)(r,a),t(102)(r,a),t(103)(r,a),t(104)(r,a),t(105)(r,a),t(106)(r,a),t(107)(r,a),t(108)(r,a),t(109)(r,a),t(110)(r,a),t(111)(r,a),t(112)(r,a),t(113)(r,a),t(114)(r,a),t(115)(r,a),t(116)(r,a),t(117)(r,a),t(118)(r,a),t(119)(r,a),t(120)(r,a),t(121)(r,a),t(122)(r,a),t(123)(r,a),t(124)(r,a),t(125)(r,a),t(126)(r,a),t(127)(r,a),t(128)(r,a),t(129)(r,a),t(130)(r,a),t(131)(r,a),t(132)(r,a),t(133)(r,a),t(134)(r,a),t(135)(r,a),t(136)(r,a),t(137)(r,a),t(138)(r,a),t(139)(r,a),t(140)(r,a),t(141)(r,a),t(142)(r,a),t(143)(r,a),t(144)(r,a),t(145)(r,a),t(146)(r,a),t(147)(r,a),t(148)(r,a),t(149)(r,a),t(150)(r,a),t(151)(r,a),r.ifElse=function(){throw new Error("Function ifElse is deprecated. Use the conditional operator instead.")},t(2)(r,a),t(18)(r,a),t(19)(r,a),t(20)(r,a),t(21)(r,a),t(22)(r,a),t(23)(r,a),t(24)(r,a),t(25)(r,a),t(26)(r,a),t(27)(r,a),r.chaining={},r.chaining.Chain=t(28)(r,a),r.chaining.Selector=r.chaining.Chain,r.config(a),r.config(e),r}var i=t(3),o=t(4).digits,a=n();"undefined"!=typeof window&&(window.mathjs=a),e.exports=a},function(e,r,t){"use strict";e.exports=function(e,r){var n=t(152),i=t(6),o=e.type.BigNumber,a="bignumber"===r.number;e.pi=a?n.pi(r.precision):Math.PI,e.tau=a?n.tau(r.precision):2*Math.PI,e.e=a?n.e(r.precision):Math.E,e.phi=a?n.phi(r.precision):1.618033988749895,e.i=new i(0,1),e.Infinity=1/0,e.NaN=0/0,e["true"]=!0,e["false"]=!1,e["null"]=null,e.uninitialized=t(153).UNINITIALIZED,e.E=e.e,e.LN2=a?new o(2).ln():Math.LN2,e.LN10=a?new o(10).ln():Math.LN10,e.LOG2E=a?new o(1).div(new o(2).ln()):Math.LOG2E,e.LOG10E=a?new o(1).div(new o(10).ln()):Math.LOG10E,e.PI=e.pi,e.SQRT1_2=a?new o(.5).sqrt():Math.SQRT1_2,e.SQRT2=a?new o(2).sqrt():Math.SQRT2,e.version=t(154)}},function(e,r){"use strict";r.clone=function t(e){var r=typeof e;if("number"===r||"string"===r||"boolean"===r||null===e||void 0===e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map(function(e){return t(e)});if(e instanceof Number)return new Number(e.valueOf());if(e instanceof String)return new String(e.valueOf());if(e instanceof Boolean)return new Boolean(e.valueOf());if(e instanceof Date)return new Date(e.valueOf());if(e instanceof RegExp)throw new TypeError("Cannot clone "+e);var n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]=t(e[i]));return n},r.extend=function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t]);return e},r.deepExtend=function n(e,r){if(Array.isArray(r))throw new TypeError("Arrays are not supported by deepExtend");for(var t in r)if(r.hasOwnProperty(t))if(r[t]&&r[t].constructor===Object)void 0===e[t]&&(e[t]={}),e[t].constructor===Object?n(e[t],r[t]):e[t]=r[t];else{if(Array.isArray(r[t]))throw new TypeError("Arrays are not supported by deepExtend");e[t]=r[t]}return e},r.deepEqual=function(e,t){var n,i,o;if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!=t.length)return!1;for(i=0,o=e.length;o>i;i++)if(!r.deepEqual(e[i],t[i]))return!1;return!0}if(e instanceof Object){if(Array.isArray(t)||!(t instanceof Object))return!1;for(n in e)if(!r.deepEqual(e[n],t[n]))return!1;for(n in t)if(!r.deepEqual(e[n],t[n]))return!1;return!0}return typeof e==typeof t&&e==t}},function(e,r){"use strict";r.isNumber=function(e){return e instanceof Number||"number"==typeof e},r.isInteger=function(e){return e==Math.round(e)},r.sign=function(e){return e>0?1:0>e?-1:0},r.format=function(e,t){if("function"==typeof t)return t(e);if(1/0===e)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var n="auto",i=void 0;switch(t&&(t.notation&&(n=t.notation),r.isNumber(t)?i=t:t.precision&&(i=t.precision)),n){case"fixed":return r.toFixed(e,i);case"exponential":return r.toExponential(e,i);case"auto":var o=.001,a=1e5;if(t&&t.exponential&&(void 0!==t.exponential.lower&&(o=t.exponential.lower),void 0!==t.exponential.upper&&(a=t.exponential.upper)),0===e)return"0";var s,u=Math.abs(e);if(u>=o&&a>u){var f=i?e.toPrecision(Math.min(i,21)):e.toPrecision();s=parseFloat(f)+""}else s=r.toExponential(e,i);return s.replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],r=arguments[4];return"."!==e?e+r:r});default:throw new Error('Unknown notation "'+n+'". Choose "auto", "exponential", or "fixed".')}},r.toExponential=function(e,r){return void 0!==r?e.toExponential(Math.min(r-1,20)):e.toExponential()},r.toFixed=function(e,r){return e.toFixed(Math.min(r,20))},r.digits=function(e){return e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length},r.DBL_EPSILON=Number.EPSILON||2.220446049250313e-16,r.nearlyEqual=function(e,t,n){if(null==n)return e==t;if(e==t)return!0;if(isNaN(e)||isNaN(t))return!1;if(isFinite(e)&&isFinite(t)){var i=Math.abs(e-t);return i<r.DBL_EPSILON?!0:i<=Math.max(Math.abs(e),Math.abs(t))*n}return!1}},function(e,r,t){"use strict";r.ArgumentsError=t(155),r.DimensionError=t(156),r.IndexError=t(157),r.UnsupportedTypeError=t(158)},function(e,r,t){"use strict";function n(e,r){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");switch(arguments.length){case 0:this.re=0,this.im=0;break;case 1:var t=arguments[0];if("object"==typeof t){if("re"in t&&"im"in t){var i=new n(t.re,t.im);this.re=i.re,this.im=i.im;break}if("r"in t&&"phi"in t){var i=n.fromPolar(t.r,t.phi);this.re=i.re,this.im=i.im;break}}throw new SyntaxError("Object with the re and im or r and phi properties expected.");case 2:if(!h(e)||!h(r))throw new TypeError("Two numbers expected in Complex constructor");this.re=e,this.im=r;break;default:throw new SyntaxError("One, two or three 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(){x++,y=w.charAt(x)}function u(e){x=e,y=w.charAt(x)}function f(){var e,r="";if(e=x,"+"==y?s():"-"==y&&(r+=y,s()),!o(y))return u(e),null;if("."==y){if(r+=y,s(),!a(y))return u(e),null}else{for(;a(y);)r+=y,s();"."==y&&(r+=y,s())}for(;a(y);)r+=y,s();if("E"==y||"e"==y){if(r+=y,s(),("+"==y||"-"==y)&&(r+=y,s()),!a(y))return u(e),null;for(;a(y);)r+=y,s()}return r}function c(){var e=w.charAt(x+1);if("I"==y||"i"==y)return s(),"1";if(!("+"!=y&&"-"!=y||"I"!=e&&"i"!=e)){var r="+"==y?"1":"-1";return s(),s(),r}return null}var l=t(160),p=t(10),m=l.number,h=l.number.isNumber,g=p.isUnit,d=l.string.isString;n.isComplex=function(e){return e instanceof n};var w,x,y;n.parse=function(e){if(w=e,x=-1,y="",!d(w))return null;s(),i();var r=f();if(r){if("I"==y||"i"==y)return s(),i(),y?null:new n(0,Number(r));i();var t=y;if("+"!=t&&"-"!=t)return i(),y?null:new n(Number(r),0);s(),i();var o=f();if(o){if("I"!=y&&"i"!=y)return null;s()}else if(o=c(),!o)return null;return"-"==t&&(o="-"==o[0]?"+"+o.substring(1):"-"+o),s(),i(),y?null:new n(Number(r),Number(o))}return(r=c())?(i(),y?null:new n(0,Number(r))):null},n.fromPolar=function(){switch(arguments.length){case 1:var e=arguments[0];if("object"==typeof e)return n.fromPolar(e.r,e.phi);throw new TypeError("Input has to be an object with r and phi keys.");case 2:var r=arguments[0],t=arguments[1];if(h(r)){if(g(t)&&t.hasBase(p.BASE_UNITS.ANGLE)&&(t=t.toNumber("rad")),h(t))return new n(r*Math.cos(t),r*Math.sin(t));throw new TypeError("Phi is not a number nor an angle unit.")}throw new TypeError("Radius r is not a number.");default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},n.prototype.toPolar=function(){return{r:Math.sqrt(this.re*this.re+this.im*this.im),phi:Math.atan2(this.im,this.re)}},n.prototype.clone=function(){return new n(this.re,this.im)},n.prototype.equals=function(e){return this.re===e.re&&this.im===e.im},n.prototype.format=function(e){var r="",t=m.format(this.re,e),n=m.format(this.im,e);return r=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+" - "+n.substring(1)+"i"},n.prototype.toString=function(){return this.format()},n.prototype.valueOf=n.prototype.toString,e.exports=n},function(e,r,t){"use strict";function n(e,r,t){if(!(this instanceof n))throw new SyntaxError("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!=r&&!o.isNumber(r))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?parseFloat(e):0,this.end=null!=r?parseFloat(r):0,this.step=null!=t?parseFloat(t):1}{var i=t(160),o=i.number,a=i.string;i.array}n.parse=function(e){if(!a.isString(e))return null;var r=e.split(":"),t=r.map(function(e){return parseFloat(e)}),i=t.some(function(e){return isNaN(e)});if(i)return null;switch(t.length){case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[2],t[1]);default:return null}},n.prototype.clone=function(){return new n(this.start,this.end,this.step)},n.isRange=function(e){return e instanceof n},n.prototype.size=function(){var e=0,r=this.start,t=this.step,n=this.end,i=n-r;return o.sign(t)==o.sign(i)?e=Math.ceil(i/t):0==i&&(e=0),isNaN(e)&&(e=0),[e]},n.prototype.min=function(){var e=this.size()[0];return e>0?this.step>0?this.start:this.start+(e-1)*this.step:void 0},n.prototype.max=function(){var e=this.size()[0];return e>0?this.step>0?this.start+(e-1)*this.step:this.start:void 0},n.prototype.forEach=function(e){var r=this.start,t=this.step,n=this.end,i=0;if(t>0)for(;n>r;)e(r,i,this),r+=t,i++;else if(0>t)for(;r>n;)e(r,i,this),r+=t,i++},n.prototype.map=function(e){var r=[];return this.forEach(function(t,n,i){r[n]=e(t,n,i)}),r},n.prototype.toArray=function(){var e=[];return this.forEach(function(r,t){e[t]=r}),e},n.prototype.valueOf=function(){return this.toArray()},n.prototype.format=function(e){var r=o.format(this.start,e);return 1!=this.step&&(r+=":"+o.format(this.step,e)),r+=":"+o.format(this.end,e)},n.prototype.toString=function(){return this.format()},e.exports=n},function(e,r,t){"use strict";function n(){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this._ranges=[],this._isScalar=!0;for(var e=0,r=arguments.length;r>e;e++){var t=arguments[e];if(t instanceof a)this._ranges.push(t),this._isScalar=!1;else if(c(t))this._ranges.push(i(t)),this._isScalar=!1;else if(u(t))this._ranges.push(i([t,t+1]));else{var o=t.valueOf();if(!c(o))throw new TypeError("Ranges must be an Array, Number, or Range");this._ranges.push(i(o)),this._isScalar=!1}}}function i(e){for(var r=e.length,t=0;r>t;t++)if(!u(e[t])||!f(e[t]))throw new TypeError("Index parameters must be integer numbers");switch(e.length){case 2:return new a(e[0],e[1]);case 3:return new a(e[0],e[1],e[2]);default:throw new SyntaxError("Wrong number of arguments in Index (2 or 3 expected)")}}var o=t(160),a=t(7),s=o.number,u=s.isNumber,f=s.isInteger,c=Array.isArray;n.prototype.clone=function(){var e=new n;return e._ranges=o.object.clone(this._ranges),e._isScalar=this._isScalar,e},n.isIndex=function(e){return e instanceof n},n.create=function(e){var r=new n;return n.apply(r,e),r},n.prototype.size=function(){for(var e=[],r=0,t=this._ranges.length;t>r;r++){var n=this._ranges[r];e[r]=n.size()[0]}return e},n.prototype.max=function(){for(var e=[],r=0,t=this._ranges.length;t>r;r++){var n=this._ranges[r];e[r]=n.max()}return e},n.prototype.min=function(){for(var e=[],r=0,t=this._ranges.length;t>r;r++){var n=this._ranges[r];e[r]=n.min()}return e},n.prototype.forEach=function(e){for(var r=0,t=this._ranges.length;t>r;r++)e(this._ranges[r],r,this)},n.prototype.range=function(e){return this._ranges[e]||null},n.prototype.isScalar=function(){return this._isScalar},n.prototype.toArray=function(){for(var e=[],r=0,t=this._ranges.length;t>r;r++){var n=this._ranges[r],i=[],o=n.start,a=n.end,s=n.step;if(s>0)for(;a>o;)i.push(o),o+=s;else if(0>s)for(;o>a;)i.push(o),o+=s;e.push(i)}return e},n.prototype.valueOf=n.prototype.toArray,n.prototype.toString=function(){for(var e=[],r=0,t=this._ranges.length;t>r;r++){var n=this._ranges[r],i=s.format(n.start);1!=n.step&&(i+=":"+s.format(n.step)),i+=":"+s.format(n.end),e.push(i)}return"["+e.join(", ")+"]"},e.exports=n},function(e,r,t){"use strict";function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(e instanceof n)this._data=e.clone()._data;else if(d(e))this._data=f(e);else{if(null!=e)throw new TypeError("Unsupported type of data ("+c.types.type(e)+")");this._data=[]}this._size=h.size(this._data)}function i(e,r){if(!(r instanceof p))throw new TypeError("Invalid index");var t=r.isScalar();if(t)return e.get(r.min());var i=r.size();if(i.length!=e._size.length)throw new l(i.length,e._size.length);for(var a=r.min(),s=r.max(),u=0,f=e._size.length;f>u;u++)w(a[u],e._size[u]),w(s[u],e._size[u]);return new n(o(e._data,r,i.length,0))}function o(e,r,t,n){var i=n==t-1,a=r.range(n);return a.map(i?function(r){return e[r]}:function(i){var a=e[i];return o(a,r,t,n+1)})}function a(e,r,t,i){if(!(r instanceof p))throw new TypeError("Invalid index");var o,a=r.size(),f=r.isScalar();if(t instanceof n?(o=t.size(),t=t.valueOf()):o=h.size(t),f){if(0!=o.length)throw new TypeError("Scalar expected");e.set(r.min(),t,i)}else{if(a.length<e._size.length)throw new l(a.length,e._size.length,"<");if(o.length<a.length){for(var c=0,m=0;1===a[c]&&1===o[c];)c++;for(;1===a[c];)m++,c++;t=h.unsqueeze(t,a.length,m,o)}if(!g.deepEqual(a,o))throw new l(a,o,">");var d=r.max().map(function(e){return e+1});u(e,d,i);var w=a.length,x=0;s(e._data,r,t,w,x)}return e}function s(e,r,t,n,i){var o=i==n-1,a=r.range(i);a.forEach(o?function(r,n){w(r),e[r]=t[n]}:function(o,a){w(o),s(e[o],r,t[a],n,i+1)})}function u(e,r,t){for(var n=g.clone(e._size),i=!1;n.length<r.length;)n.push(0),i=!0;for(var o=0,a=r.length;a>o;o++)r[o]>n[o]&&(n[o]=r[o],i=!0);i&&e.resize(n,t)}function f(e){for(var r=0,t=e.length;t>r;r++){var i=e[r];d(i)?e[r]=f(i):i instanceof n&&(e[r]=f(i._data))}return e}var c=t(160),l=t(156),p=t(8),m=(c.number,c.string),h=c.array,g=c.object,d=Array.isArray,w=h.validateIndex;n.isMatrix=function(e){return e instanceof n},n.prototype.subset=function(e,r,t){switch(arguments.length){case 1:return i(this,e);case 2:case 3:return a(this,e,r,t);default:throw new SyntaxError("Wrong number of arguments")}},n.prototype.get=function(e){if(!d(e))throw new TypeError("Array expected");if(e.length!=this._size.length)throw new l(e.length,this._size.length);for(var r=this._data,t=0,n=e.length;n>t;t++){var i=e[t];w(i,r.length),r=r[i]}return g.clone(r)},n.prototype.set=function(e,r,t){var n,i;if(!d(e))throw new Error("Array expected");if(e.length<this._size.length)throw new l(e.length,this._size.length,"<");var o=e.map(function(e){return e+1});u(this,o,t);var a=this._data;for(n=0,i=e.length-1;i>n;n++){var s=e[n];w(s,a.length),a=a[s]}return s=e[e.length-1],w(s,a.length),a[s]=r,this},n.prototype.resize=function(e,r){return this._size=g.clone(e),this._data=h.resize(this._data,this._size,r),this},n.prototype.clone=function(){var e=new n;return e._data=g.clone(this._data),e._size=g.clone(this._size),e},n.prototype.size=function(){return this._size},n.prototype.map=function(e){var r=this,t=new n,i=function(t,n){return d(t)?t.map(function(e,r){return i(e,n.concat(r))}):e(t,n,r)};return t._data=i(this._data,[]),t._size=g.clone(this._size),t},n.prototype.forEach=function(e){var r=this,t=function(n,i){d(n)?n.forEach(function(e,r){t(e,i.concat(r))}):e(n,i,r)};t(this._data,[])},n.prototype.toArray=function(){return g.clone(this._data)},n.prototype.valueOf=function(){return this._data},n.prototype.format=function(e){return m.format(this._data,e)},n.prototype.toString=function(){return m.format(this._data)},e.exports=n},function(e,r,t){"use strict";function n(e,r){if(!(this instanceof n))throw new Error("Constructor must be called with the new operator");if(void 0!=e&&!x(e))throw new TypeError("First parameter in Unit constructor must be a number");if(void 0!=r&&(!y(r)||""==r))throw new TypeError("Second parameter in Unit constructor must be a string");if(void 0!=r){var t=l(r);if(!t)throw new SyntaxError('Unknown unit "'+r+'"');this.unit=t.unit,this.prefix=t.prefix}else this.unit=A,this.prefix=b;this.value=void 0!=e?this._normalize(e):null,this.fixPrefix=!1}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 f(){var e,r="";if(e=m,"+"==h?s():"-"==h&&(r+=h,s()),!o(h))return u(e),null;if("."==h){if(r+=h,s(),!a(h))return u(e),null}else{for(;a(h);)r+=h,s();"."==h&&(r+=h,s())}for(;a(h);)r+=h,s();if("E"==h||"e"==h){if(r+=h,s(),("+"==h||"-"==h)&&(r+=h,s()),!a(h))return u(e),null;for(;a(h);)r+=h,s()}return r}function c(){var e="";for(i();h&&" "!=h&&" "!=h;)e+=h,s();return e||null}function l(e){for(var r in M)if(M.hasOwnProperty(r)&&w.endsWith(e,r)){var t=M[r],n=e.length-r.length,i=e.substring(0,n),o=t.prefixes[i];if(void 0!==o)return{unit:t,prefix:o}}return null}var p,m,h,g=t(160),d=g.number,w=g.string,x=g.number.isNumber,y=g.string.isString;n.parse=function(e){if(p=e,m=-1,h="",!y(p))return null;s(),i();var r,t=f();if(t){if(r=c(),s(),i(),h)return null;if(t&&r)try{return new n(Number(t),r)}catch(o){}}else{if(r=c(),s(),i(),h)return null;if(r)try{return new n(null,r)}catch(o){}}return null},n.isUnit=function(e){return e instanceof n},n.prototype.clone=function(){var e=new n;for(var r in this)this.hasOwnProperty(r)&&(e[r]=this[r]);return e},n.prototype._normalize=function(e){return(e+this.unit.offset)*this.unit.value*this.prefix.value},n.prototype._unnormalize=function(e,r){return void 0==r?e/this.unit.value/this.prefix.value-this.unit.offset:e/this.unit.value/r-this.unit.offset},n.isValuelessUnit=function(e){return null!=l(e)},n.prototype.hasBase=function(e){return this.unit.base===e},n.prototype.equalBase=function(e){return this.unit.base===e.unit.base},n.prototype.equals=function(e){return this.equalBase(e)&&this.value==e.value},n.prototype.to=function(e){var r,t=null==this.value?this._normalize(1):this.value;if(y(e)){if(r=new n(null,e),!this.equalBase(r))throw new Error("Units do not match");return r.value=t,r.fixPrefix=!0,r}if(e instanceof n){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");return r=e.clone(),r.value=t,r.fixPrefix=!0,r}throw new Error("String or Unit expected as parameter")},n.prototype.toNumber=function(e){var r=this.to(e);return r._unnormalize(r.value,r.prefix.value)},n.prototype.toString=function(){return this.format()},n.prototype.valueOf=n.prototype.toString,n.prototype.format=function(e){var r,t;if(null===this.value||this.fixPrefix)r=this._unnormalize(this.value),t=null!==this.value?d.format(r,e)+" ":"",t+=this.prefix.name+this.unit.name;else{var n=this._bestPrefix();r=this._unnormalize(this.value,n.value),t=d.format(r,e)+" ",t+=n.name+this.unit.name}return t},n.prototype._bestPrefix=function(){var e=Math.abs(this.value/this.unit.value),r=b,t=Math.abs(Math.log(e/r.value)/Math.LN10-1.2),n=this.unit.prefixes;for(var i in n)if(n.hasOwnProperty(i)){var o=n[i];if(o.scientific){var a=Math.abs(Math.log(e/o.value)/Math.LN10-1.2);t>a&&(r=o,t=a)}}return r};var v={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}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-42,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0}},BINARY_SHORT:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1024,scientific:!0},M:{name:"M",value:Math.pow(1024,2),scientific:!0},G:{name:"G",value:Math.pow(1024,3),scientific:!0},T:{name:"T",value:Math.pow(1024,4),scientific:!0},P:{name:"P",value:Math.pow(1024,5),scientific:!0},E:{name:"E",value:Math.pow(1024,6),scientific:!0},Z:{name:"Z",value:Math.pow(1024,7),scientific:!0},Y:{name:"Y",value:Math.pow(1024,8),scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1024,scientific:!0},mega:{name:"mega",value:Math.pow(1024,2),scientific:!0},giga:{name:"giga",value:Math.pow(1024,3),scientific:!0},tera:{name:"tera",value:Math.pow(1024,4),scientific:!0},peta:{name:"peta",value:Math.pow(1024,5),scientific:!0},exa:{name:"exa",value:Math.pow(1024,6),scientific:!0},zetta:{name:"zetta",value:Math.pow(1024,7),scientific:!0},yotta:{name:"yotta",value:Math.pow(1024,8),scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}}},b={name:"",value:1,scientific:!0},E={NONE:{},LENGTH:{},MASS:{},TIME:{},CURRENT:{},TEMPERATURE:{},LUMINOUS_INTENSITY:{},AMOUNT_OF_SUBSTANCE:{},FORCE:{},SURFACE:{},VOLUME:{},ANGLE:{},BIT:{}},N={},A={name:"",base:N,value:1,offset:0},M={meter:{name:"meter",base:E.LENGTH,prefixes:v.LONG,value:1,offset:0},inch:{name:"inch",base:E.LENGTH,prefixes:v.NONE,value:.0254,offset:0},foot:{name:"foot",base:E.LENGTH,prefixes:v.NONE,value:.3048,offset:0},yard:{name:"yard",base:E.LENGTH,prefixes:v.NONE,value:.9144,offset:0},mile:{name:"mile",base:E.LENGTH,prefixes:v.NONE,value:1609.344,offset:0},link:{name:"link",base:E.LENGTH,prefixes:v.NONE,value:.201168,offset:0},rod:{name:"rod",base:E.LENGTH,prefixes:v.NONE,value:5.02921,offset:0},chain:{name:"chain",base:E.LENGTH,prefixes:v.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:E.LENGTH,prefixes:v.NONE,value:1e-10,offset:0},m:{name:"m",base:E.LENGTH,prefixes:v.SHORT,value:1,offset:0},"in":{name:"in",base:E.LENGTH,prefixes:v.NONE,value:.0254,offset:0},ft:{name:"ft",base:E.LENGTH,prefixes:v.NONE,value:.3048,offset:0},yd:{name:"yd",base:E.LENGTH,prefixes:v.NONE,value:.9144,offset:0},mi:{name:"mi",base:E.LENGTH,prefixes:v.NONE,value:1609.344,offset:0},li:{name:"li",base:E.LENGTH,prefixes:v.NONE,value:.201168,offset:0},rd:{name:"rd",base:E.LENGTH,prefixes:v.NONE,value:5.02921,offset:0},ch:{name:"ch",base:E.LENGTH,prefixes:v.NONE,value:20.1168,offset:0},mil:{name:"mil",base:E.LENGTH,prefixes:v.NONE,value:254e-7,offset:0},m2:{name:"m2",base:E.SURFACE,prefixes:v.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:E.SURFACE,prefixes:v.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:E.SURFACE,prefixes:v.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:E.SURFACE,prefixes:v.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:E.SURFACE,prefixes:v.NONE,value:2589988.110336,offset:0},sqrd:{name:"sqrd",base:E.SURFACE,prefixes:v.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:E.SURFACE,prefixes:v.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:E.SURFACE,prefixes:v.NONE,value:6.4516e-10,offset:0},m3:{name:"m3",base:E.VOLUME,prefixes:v.CUBIC,value:1,offset:0},L:{name:"L",base:E.VOLUME,prefixes:v.SHORT,value:.001,offset:0},l:{name:"l",base:E.VOLUME,prefixes:v.SHORT,value:.001,offset:0},litre:{name:"litre",base:E.VOLUME,prefixes:v.LONG,value:.001,offset:0},cuin:{name:"cuin",base:E.VOLUME,prefixes:v.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:E.VOLUME,prefixes:v.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:E.VOLUME,prefixes:v.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:E.VOLUME,prefixes:v.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:E.VOLUME,prefixes:v.NONE,value:15e-6,offset:0},drop:{name:"drop",base:E.VOLUME,prefixes:v.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:E.VOLUME,prefixes:v.NONE,value:5e-8,offset:0},minim:{name:"minim",base:E.VOLUME,prefixes:v.NONE,value:6.161152e-8,offset:0},fluiddram:{name:"fluiddram",base:E.VOLUME,prefixes:v.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:E.VOLUME,prefixes:v.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:E.VOLUME,prefixes:v.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:E.VOLUME,prefixes:v.NONE,value:1e-6,offset:0},cup:{name:"cup",base:E.VOLUME,prefixes:v.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:E.VOLUME,prefixes:v.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:E.VOLUME,prefixes:v.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:E.VOLUME,prefixes:v.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:E.VOLUME,prefixes:v.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:E.VOLUME,prefixes:v.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:E.VOLUME,prefixes:v.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:E.VOLUME,prefixes:v.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:E.VOLUME,prefixes:v.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:E.VOLUME,prefixes:v.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:E.VOLUME,prefixes:v.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:E.VOLUME,prefixes:v.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:E.VOLUME,prefixes:v.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:E.VOLUME,prefixes:v.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:E.VOLUME,prefixes:v.NONE,value:.1173478,offset:0},obl:{name:"obl",base:E.VOLUME,prefixes:v.NONE,value:.1589873,offset:0},g:{name:"g",base:E.MASS,prefixes:v.SHORT,value:.001,offset:0},gram:{name:"gram",base:E.MASS,prefixes:v.LONG,value:.001,offset:0},ton:{name:"ton",base:E.MASS,prefixes:v.SHORT,value:907.18474,offset:0},tonne:{name:"tonne",base:E.MASS,prefixes:v.SHORT,value:1e3,offset:0},grain:{name:"grain",base:E.MASS,prefixes:v.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:E.MASS,prefixes:v.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:E.MASS,prefixes:v.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:E.MASS,prefixes:v.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:E.MASS,prefixes:v.NONE,value:45.359237,offset:0},stick:{name:"stick",base:E.MASS,prefixes:v.NONE,value:.115,offset:0},gr:{name:"gr",base:E.MASS,prefixes:v.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:E.MASS,prefixes:v.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:E.MASS,prefixes:v.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:E.MASS,prefixes:v.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:E.MASS,prefixes:v.NONE,value:45.359237,offset:0},s:{name:"s",base:E.TIME,prefixes:v.SHORT,value:1,offset:0},min:{name:"min",base:E.TIME,prefixes:v.NONE,value:60,offset:0},h:{name:"h",base:E.TIME,prefixes:v.NONE,value:3600,offset:0},second:{name:"second",base:E.TIME,prefixes:v.LONG,value:1,offset:0},sec:{name:"sec",base:E.TIME,prefixes:v.LONG,value:1,offset:0},minute:{name:"minute",base:E.TIME,prefixes:v.NONE,value:60,offset:0},hour:{name:"hour",base:E.TIME,prefixes:v.NONE,value:3600,offset:0},day:{name:"day",base:E.TIME,prefixes:v.NONE,value:86400,offset:0},rad:{name:"rad",base:E.ANGLE,prefixes:v.NONE,value:1,offset:0},deg:{name:"deg",base:E.ANGLE,prefixes:v.NONE,value:.017453292519943295,offset:0},grad:{name:"grad",base:E.ANGLE,prefixes:v.NONE,value:.015707963267948967,offset:0},cycle:{name:"cycle",base:E.ANGLE,prefixes:v.NONE,value:6.283185307179586,offset:0},A:{name:"A",base:E.CURRENT,prefixes:v.SHORT,value:1,offset:0},ampere:{name:"ampere",base:E.CURRENT,prefixes:v.LONG,value:1,offset:0},K:{name:"K",base:E.TEMPERATURE,prefixes:v.NONE,value:1,offset:0},degC:{name:"degC",base:E.TEMPERATURE,prefixes:v.NONE,value:1,offset:273.15},degF:{name:"degF",base:E.TEMPERATURE,prefixes:v.NONE,value:1/1.8,offset:459.67},degR:{name:"degR",base:E.TEMPERATURE,prefixes:v.NONE,value:1/1.8,offset:0},kelvin:{name:"kelvin",base:E.TEMPERATURE,prefixes:v.NONE,value:1,offset:0},celsius:{name:"celsius",base:E.TEMPERATURE,prefixes:v.NONE,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:E.TEMPERATURE,prefixes:v.NONE,value:1/1.8,offset:459.67},rankine:{name:"rankine",base:E.TEMPERATURE,prefixes:v.NONE,value:1/1.8,offset:0},mol:{name:"mol",base:E.AMOUNT_OF_SUBSTANCE,prefixes:v.NONE,value:1,offset:0},mole:{name:"mole",base:E.AMOUNT_OF_SUBSTANCE,prefixes:v.NONE,value:1,offset:0},cd:{name:"cd",base:E.LUMINOUS_INTENSITY,prefixes:v.NONE,value:1,offset:0},candela:{name:"candela",base:E.LUMINOUS_INTENSITY,prefixes:v.NONE,value:1,offset:0},N:{name:"N",base:E.FORCE,prefixes:v.SHORT,value:1,offset:0},newton:{name:"newton",base:E.FORCE,prefixes:v.LONG,value:1,offset:0},lbf:{name:"lbf",base:E.FORCE,prefixes:v.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:E.FORCE,prefixes:v.NONE,value:4.4482216152605,offset:0},b:{name:"b",base:E.BIT,prefixes:v.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:E.BIT,prefixes:v.BINARY_LONG,value:1,offset:0},B:{name:"B",base:E.BIT,prefixes:v.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:E.BIT,prefixes:v.BINARY_LONG,value:8,offset:0}},T={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",litres:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",seconds:"second",minutes:"minute",hours:"hour",days:"day",radians:"rad",degrees:"deg",gradients:"grad",cycles:"cycle",amperes:"ampere",moles:"mole"};
  28. for(var S in T)if(T.hasOwnProperty(S)){var O=M[T[S]],C=Object.create(O);C.name=S,M[S]=C}M.lt=M.l,M.liter=M.litre,M.liters=M.litres,M.lb=M.lbm,M.lbs=M.lbm,n.PREFIXES=v,n.BASE_UNITS=E,n.UNITS=M,e.exports=n},function(e,r,t){"use strict";function n(e,r){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this.math=e,this.doc=r}var i=t(160),o=i.object,a=i.string;n.isHelp=function(e){return e instanceof n},n.prototype.toString=function(){var e=this.doc||{},r="\n";if(e.name&&(r+="Name: "+e.name+"\n\n"),e.category&&(r+="Category: "+e.category+"\n\n"),e.description&&(r+="Description:\n "+e.description+"\n\n"),e.syntax&&(r+="Syntax:\n "+e.syntax.join("\n ")+"\n\n"),e.examples){var t=this.math.parser();r+="Examples:\n";for(var i=0;i<e.examples.length;i++){var o,s=e.examples[i];try{o=t.eval(s)}catch(u){o=u}r+=" "+s+"\n",void 0===o||o instanceof n||(r+=" "+a.format(o,{precision:14})+"\n")}r+="\n"}return e.seealso&&(r+="See also: "+e.seealso.join(", ")+"\n"),r},n.prototype.toJSON=function(){return o.clone(this.doc)},n.prototype.valueOf=n.prototype.toString,e.exports=n},function(e){"use strict";function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.entries=e||[]}r.prototype.valueOf=function(){return this.entries},r.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},e.exports=r},function(e,r,t){"use strict";function n(e,r,t){var o,a,s,u;if(0>=r){if(c(e[0])){for(u=i(e),a=[],o=0;o<u.length;o++)a[o]=n(u[o],r-1,t);return a}for(s=e[0],o=1;o<e.length;o++)s=t(s,e[o]);return s}for(a=[],o=0;o<e.length;o++)a[o]=n(e[o],r-1,t);return a}function i(e){var r,t,n=e.length,i=e[0].length,o=[];for(t=0;i>t;t++){var a=[];for(r=0;n>r;r++)a.push(e[r][t]);o.push(a)}return o}{var o=t(160),a=t(157),s=t(156),u=t(9),f=o.array,c=o.array.isArray;o.string.isString}r.argsToArray=function(e){if(0==e.length)return[];if(1==e.length){var r=e[0];return r instanceof u&&(r=r.valueOf()),c(r)||(r=[r]),r}return o.array.argsToArray(e)},r.isCollection=function(e){return c(e)||e instanceof u},r.deepMap=function l(e,r){return e&&"function"==typeof e.map?e.map(function(e){return l(e,r)}):r(e)},r.deepMap2=function p(e,r,t){var n,i,o;if(c(e))if(c(r)){if(e.length!=r.length)throw new s(e.length,r.length);for(n=[],i=e.length,o=0;i>o;o++)n[o]=p(e[o],r[o],t)}else{if(r instanceof u)return n=p(e,r.valueOf(),t),new u(n);for(n=[],i=e.length,o=0;i>o;o++)n[o]=p(e[o],r,t)}else{if(e instanceof u)return r instanceof u?(n=p(e.valueOf(),r.valueOf(),t),new u(n)):(n=p(e.valueOf(),r,t),new u(n));if(c(r))for(n=[],i=r.length,o=0;i>o;o++)n[o]=p(e,r[o],t);else{if(r instanceof u)return n=p(e,r.valueOf(),t),new u(n);n=t(e,r)}}return n},r.reduce=function(e,r,t){var i=c(e)?f.size(e):e.size();if(0>r)throw new a(r);if(r>=i.length)throw new a(r,i.length);return e instanceof u?new u(n(e.valueOf(),r,t)):n(e,r,t)},r.deepForEach=function m(e,r){e instanceof u&&(e=e.valueOf());for(var t=0,n=e.length;n>t;t++){var i=e[t];c(i)?m(i,r):r(i)}}},function(e,r,t){"use strict";function n(e,r){if(1!=arguments.length&&2!=arguments.length)throw new X("parse",arguments.length,1,2);if(gr=r&&r.nodes?r.nodes:{},Q(e))return dr=e,g();if(K(e)||e instanceof $)return J.deepMap(e,function(e){if(!Q(e))throw new TypeError("String expected");return dr=e,g()});throw new TypeError("String or matrix expected")}function i(){wr=0,xr=dr.charAt(0),br=0,Er=null}function o(){wr++,xr=dr.charAt(wr)}function a(){return dr.charAt(wr+1)}function s(){return dr.charAt(wr+2)}function u(){for(vr=pr.NULL,yr="";" "==xr||" "==xr||"\n"==xr&&br;)o();if("#"==xr)for(;"\n"!=xr&&""!=xr;)o();if(""==xr)return void(vr=pr.DELIMITER);if("\n"==xr&&!br)return vr=pr.DELIMITER,yr=xr,void o();var e=xr+a(),r=e+s();if(3==r.length&&mr[r])return vr=pr.DELIMITER,yr=r,o(),o(),void o();if(2==e.length&&mr[e])return vr=pr.DELIMITER,yr=e,o(),void o();if(mr[xr])return vr=pr.DELIMITER,yr=xr,void o();if(!m(xr)){if(p(xr)){for(;p(xr)||h(xr);)yr+=xr,o();return void(vr=hr[yr]?pr.DELIMITER:pr.SYMBOL)}for(vr=pr.UNKNOWN;""!=xr;)yr+=xr,o();throw H('Syntax error in part "'+yr+'"')}if(vr=pr.NUMBER,"."==xr)yr+=xr,o(),h(xr)||(vr=pr.UNKNOWN);else{for(;h(xr);)yr+=xr,o();"."==xr&&(yr+=xr,o())}for(;h(xr);)yr+=xr,o();if(e=a(),("E"==xr||"e"==xr)&&(h(e)||"-"==e||"+"==e))for(yr+=xr,o(),("+"==xr||"-"==xr)&&(yr+=xr,o()),h(xr)||(vr=pr.UNKNOWN);h(xr);)yr+=xr,o()}function f(){do u();while("\n"==yr)}function c(){br++}function l(){br--}function p(e){return e>="a"&&"z">=e||e>="A"&&"Z">=e||"_"==e}function m(e){return e>="0"&&"9">=e||"."==e}function h(e){return e>="0"&&"9">=e}function g(){i(),u();var e=d();if(""!=yr)throw vr==pr.DELIMITER?Y("Unexpected operator "+yr):H('Unexpected part "'+yr+'"');return e}function d(){var e,r,t=[];if(""==yr)return new ir("undefined","undefined");for("\n"!=yr&&";"!=yr&&(e=w());"\n"==yr||";"==yr;)0==t.length&&e&&(r=";"!=yr,t.push({node:e,visible:r})),u(),"\n"!=yr&&";"!=yr&&""!=yr&&(e=w(),r=";"!=yr,t.push({node:e,visible:r}));return t.length>0?new tr(t):e}function w(){if(vr==pr.SYMBOL&&"function"==yr)throw H('Deprecated keyword "function". Functions can now be assigned without it, like "f(x) = x^2".');return x()}function x(){var e,r,t,n,i=y();if("="==yr){if(i instanceof cr)return e=i.name,f(),t=x(),new rr(e,t);if(i instanceof ar)return f(),t=x(),new lr(i,t);if(i instanceof ur&&(n=!0,r=[],e=i.name,i.args.forEach(function(e,t){e instanceof cr?r[t]=e.name:n=!1}),n))return f(),t=x(),new or(e,r,t);throw H("Invalid left hand side of assignment operator =")}return i}function y(){for(var e=v();"?"==yr;){var r=Er;Er=br,f();var t=e,n=v();if(":"!=yr)throw H("False part of conditional expression expected");Er=null,f();var i=y();e=new nr(t,n,i),Er=r}return e}function v(){for(var e=b();"or"==yr;)f(),e=new sr("or","or",[e,b()]);return e}function b(){for(var e=E();"xor"==yr;)f(),e=new sr("xor","xor",[e,E()]);return e}function E(){for(var e=N();"and"==yr;)f(),e=new sr("and","and",[e,N()]);return e}function N(){for(var e=A();"|"==yr;)f(),e=new sr("|","bitOr",[e,A()]);return e}function A(){for(var e=M();"^|"==yr;)f(),e=new sr("^|","bitXor",[e,M()]);return e}function M(){for(var e=T();"&"==yr;)f(),e=new sr("&","bitAnd",[e,T()]);return e}function T(){var e,r,t,n,i;for(e=S(),r={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};yr in r;)t=yr,n=r[t],f(),i=[e,S()],e=new sr(t,n,i);return e}function S(){var e,r,t,n,i;for(e=O(),r={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};yr in r;)t=yr,n=r[t],f(),i=[e,O()],e=new sr(t,n,i);return e}function O(){var e,r,t,n,i;for(e=C(),r={to:"to","in":"to"};yr in r;)t=yr,n=r[t],f(),i=[e,C()],e=new sr(t,n,i);return e}function C(){var e,r=[];if(e=":"==yr?new ir("1","number"):U(),":"==yr&&Er!==br){for(r.push(e);":"==yr&&r.length<3;)f(),r.push(")"==yr||"]"==yr||","==yr||""==yr?new cr("end"):U());e=3==r.length?new fr(r[0],r[2],r[1]):new fr(r[0],r[1])}return e}function U(){var e,r,t,n,i;for(e=B(),r={"+":"add","-":"subtract"};yr in r;)t=yr,n=r[t],f(),i=[e,B()],e=new sr(t,n,i);return e}function B(){var e,r,t,n,i;if(e=q(),r={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"},yr in r)for(;yr in r;)t=yr,n=r[t],f(),i=[e,q()],e=new sr(t,n,i);return(vr==pr.SYMBOL||"in"==yr&&e instanceof ir||vr==pr.NUMBER&&!(e instanceof ir)||"("==yr||"["==yr)&&(e=new sr("*","multiply",[e,B()])),e}function q(){var e,r,t={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"}[yr];return t?(e=yr,f(),r=[q()],new sr(e,t,r)):I()}function I(){var e,r,t,n;return e=z(),("^"==yr||".^"==yr)&&(r=yr,t="^"==r?"pow":"dotPow",f(),n=[e,q()],e=new sr(r,t,n)),e}function z(){var e,r,t,n,i;for(e=_(),r={"!":"factorial","'":"transpose"};yr in r;)t=yr,n=r[t],u(),i=[e],e=new sr(t,n,i);return e}function _(){var e,r=[];if(vr==pr.SYMBOL&&gr[yr]){if(e=gr[yr],u(),"("==yr){if(r=[],c(),u(),")"!=yr)for(r.push(y());","==yr;)u(),r.push(y());if(")"!=yr)throw H("Parenthesis ) expected");l(),u()}return new e(r)}return R()}function R(){var e,r;return vr==pr.SYMBOL||vr==pr.DELIMITER&&yr in hr?(r=yr,u(),e=L(r),e=P(e)):F()}function L(e){var r;if("("==yr){if(r=[],c(),u(),")"!=yr)for(r.push(y());","==yr;)u(),r.push(y());if(")"!=yr)throw H("Parenthesis ) expected");return l(),u(),new ur(e,r)}return new cr(e)}function P(e){for(var r;"["==yr;){if(r=[],c(),u(),"]"!=yr)for(r.push(y());","==yr;)u(),r.push(y());if("]"!=yr)throw H("Parenthesis ] expected");l(),u(),e=new ar(e,r)}return e}function F(){var e,r,t;if('"'==yr){for(r="",t="";""!=xr&&('"'!=xr||"\\"==t);)r+=xr,t=xr,o();if(u(),'"'!=yr)throw H('End of string " expected');return u(),e=new ir(r,"string"),e=P(e)}return k()}function k(){var e,r,t,n;if("["==yr){if(c(),u(),"]"!=yr){var i=j();if(";"==yr){for(t=1,r=[i];";"==yr;)u(),r[t]=j(),t++;if("]"!=yr)throw H("End of matrix ] expected");l(),u(),n=r[0].nodes.length;for(var o=1;t>o;o++)if(r[o].nodes.length!=n)throw Y("Column dimensions mismatch ("+r[o].nodes.length+" != "+n+")");e=new er(r)}else{if("]"!=yr)throw H("End of matrix ] expected");l(),u(),e=i}}else l(),u(),e=new er([]);return e}return G()}function j(){for(var e=[x()],r=1;","==yr;)u(),e[r]=x(),r++;return new er(e)}function G(){var e;return vr==pr.NUMBER?(e=yr,u(),new ir(e,"number")):D()}function D(){var e;if("("==yr){if(c(),u(),e=x(),")"!=yr)throw H("Parenthesis ) expected");return l(),u(),e}return V()}function V(){throw H(""==yr?"Unexpected end of expression":"Value expected")}function Z(){return wr-yr.length+1}function H(e){var r=Z(),t=new SyntaxError(e+" (char "+r+")");return t["char"]=r,t}function Y(e){var r=Z(),t=new Error(e+" (char "+r+")");return t["char"]=r,t}var W=t(160),X=t(155),Q=W.string.isString,K=Array.isArray,$=(W.types.type,t(6),t(9)),J=(t(10),t(13)),er=t(161),rr=t(162),tr=t(163),nr=t(164),ir=t(165),or=t(166),ar=t(167),sr=t(168),ur=t(169),fr=t(170),cr=t(171),lr=t(172),pr={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},mr={",":!0,"(":!0,")":!0,"[":!0,"]":!0,'"':!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"'":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},hr={mod:!0,to:!0,"in":!0,and:!0,xor:!0,or:!0,not:!0},gr={},dr="",wr=0,xr="",yr="",vr=pr.NULL,br=0,Er=null;e.exports=n},function(e,r,t){"use strict";function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!(e instanceof Object))throw new TypeError("Object expected as parameter math");this.math=e,this.scope={}}var i=t(14);n.prototype.parse=function(){throw new Error("Parser.parse is deprecated. Use math.parse instead.")},n.prototype.compile=function(){throw new Error("Parser.compile is deprecated. Use math.compile instead.")},n.prototype.eval=function(e){return i(e).compile(this.math).eval(this.scope)},n.prototype.get=function(e){return this.scope[e]},n.prototype.set=function(e,r){return this.scope[e]=r},n.prototype.remove=function(e){delete this.scope[e]},n.prototype.clear=function(){for(var e in this.scope)this.scope.hasOwnProperty(e)&&delete this.scope[e]},e.exports=n},function(e,r,t){"use strict";r.ArrayNode=t(161),r.AssignmentNode=t(162),r.BlockNode=t(163),r.ConditionalNode=t(164),r.ConstantNode=t(165),r.IndexNode=t(167),r.FunctionAssignmentNode=t(166),r.FunctionNode=t(169),r.Node=t(173),r.OperatorNode=t(168),r.RangeNode=t(170),r.SymbolNode=t(171),r.UpdateNode=t(172)},function(e,r,t){r.e=t(177),r.E=t(177),r["false"]=t(178),r.i=t(179),r.Infinity=t(180),r.LN2=t(181),r.LN10=t(182),r.LOG2E=t(183),r.LOG10E=t(184),r.NaN=t(185),r["null"]=t(186),r.pi=t(187),r.PI=t(187),r.phi=t(188),r.SQRT1_2=t(189),r.SQRT2=t(190),r.tau=t(191),r["true"]=t(192),r.version=t(193),r.abs=t(197),r.add=t(198),r.ceil=t(199),r.cube=t(200),r.divide=t(201),r.dotDivide=t(202),r.dotMultiply=t(203),r.dotPow=t(204),r.exp=t(205),r.fix=t(206),r.floor=t(207),r.gcd=t(208),r.lcm=t(209),r.log=t(210),r.log10=t(211),r.mod=t(212),r.multiply=t(213),r.norm=t(214),r.nthRoot=t(215),r.pow=t(216),r.round=t(217),r.sign=t(218),r.sqrt=t(219),r.square=t(220),r.subtract=t(221),r.unaryMinus=t(222),r.unaryPlus=t(223),r.xgcd=t(224),r.bitAnd=t(225),r.bitNot=t(226),r.bitOr=t(227),r.bitXor=t(228),r.leftShift=t(229),r.rightArithShift=t(230),r.rightLogShift=t(231),r.arg=t(232),r.conj=t(233),r.re=t(234),r.im=t(235),r.bignumber=t(236),r["boolean"]=t(237),r.complex=t(238),r.index=t(239),r.matrix=t(240),r.number=t(241),r.string=t(242),r.unit=t(243),r.eval=t(244),r.help=t(245),r.and=t(246),r.not=t(247),r.or=t(248),r.xor=t(249),r.concat=t(250),r.cross=t(251),r.det=t(252),r.diag=t(253),r.dot=t(254),r.eye=t(255),r.flatten=t(256),r.inv=t(257),r.ones=t(258),r.range=t(259),r.resize=t(260),r.size=t(261),r.squeeze=t(262),r.subset=t(263),r.transpose=t(264),r.zeros=t(265),r.combinations=t(266),r.factorial=t(267),r.gamma=t(268),r.permutations=t(269),r.pickRandom=t(270),r.random=t(271),r.randomInt=t(272),r.compare=t(273),r.deepEqual=t(274),r.equal=t(275),r.larger=t(276),r.largerEq=t(277),r.smaller=t(278),r.smallerEq=t(279),r.unequal=t(280),r.max=t(281),r.mean=t(282),r.median=t(283),r.min=t(284),r.prod=t(285),r.std=t(286),r.sum=t(287),r["var"]=t(288),r.acos=t(289),r.asin=t(290),r.atan=t(291),r.atan2=t(292),r.cos=t(293),r.cosh=t(294),r.cot=t(295),r.coth=t(296),r.csc=t(297),r.csch=t(298),r.sec=t(299),r.sech=t(300),r.sin=t(301),r.sinh=t(302),r.tan=t(303),r.tanh=t(304),r.to=t(305),r.clone=t(306),r.map=t(307),r.filter=t(308),r.forEach=t(309),r.format=t(310),r["import"]=t(311),r.sort=t(312),r["typeof"]=t(313)},function(e,r,t){"use strict";var n=t(159),i=t(174).transform,o=t(4).isNumber,a=t(153).argsToArray;e.exports=function(e){e.concat.transform=function(){var r=a(arguments),t=r.length-1,s=r[t];o(s)?r[t]=s-1:s instanceof n&&(r[t]=s.minus(1));try{return e.concat.apply(e,r)}catch(u){throw i(u)}}}},function(e,r,t){"use strict";var n=t(171),i=(t(175).isBoolean,t(153).argsToArray,t(155));e.exports=function(e){var r=e.filter;r.transform=function(e,t,o){if(2!==e.length)throw new i("filter",arguments.length,2);var a,s=e[0].compile(t).eval(o);if(e[1]instanceof n)a=e[1].compile(t).eval(o);else{var u=o||{},f=e[1].filter(function(e){return e instanceof n&&!(e.name in t)&&!(e.name in u)})[0],c=Object.create(u),l=e[1].compile(t);if(!f)throw new Error("No undefined variable found in filter equation");var p=f.name;a=function(e){return c[p]=e,l.eval(c)}}return r(s,a)},e.filter.transform.rawArgs=!0}},function(e,r,t){"use strict";var n=t(9);e.exports=function(e){function r(e,r,t){var n=function(e,i){Array.isArray(e)?e.forEach(function(e,r){n(e,i.concat(r+1))}):r(e,i,t)};n(e,[])}e.forEach.transform=function(t,i){if(2!=arguments.length)throw new e.error.ArgumentsError("forEach",arguments.length,2);if(Array.isArray(t))r(t,i,t);else{if(!(t instanceof n))throw new e.error.UnsupportedTypeError("forEach",e["typeof"](t));r(t.valueOf(),i,t)}}}},function(e,r,t){"use strict";{var n=t(159),i=t(7),o=t(8),a=(t(9),t(4).isNumber);Array.isArray}e.exports=function(e){e.index.transform=function(){for(var e=[],r=0,t=arguments.length;t>r;r++){var s=arguments[r];if(s instanceof i)s.start--,s.end-=s.step>0?0:2;else if(a(s))s--;else{if(!(s instanceof n))throw new TypeError("Ranges must be a Number or Range");s=s.toNumber()-1}e[r]=s}var u=new o;return o.apply(u,e),u}}},function(e,r,t){"use strict";{var n=t(9);t(159),t(7),t(8),t(4).isNumber,Array.isArray}e.exports=function(e){function r(e,r,t){var n=function(e,i){return Array.isArray(e)?e.map(function(e,r){return n(e,i.concat(r+1))}):r(e,i,t)};return n(e,[])}e.map.transform=function(t,i){if(2!=arguments.length)throw new e.error.ArgumentsError("map",arguments.length,2);if(Array.isArray(t))return r(t,i,t);if(t instanceof n)return new n(r(t.valueOf(),i,t));throw new e.error.UnsupportedTypeError("map",e["typeof"](t))}}},function(e,r,t){"use strict";var n=t(159),i=t(174).transform,o=t(4).isNumber,a=t(13).isCollection,s=t(153).argsToArray;e.exports=function(e){e.max.transform=function(){var r=s(arguments);if(2==r.length&&a(r[0])){var t=r[1];o(t)?r[1]=t-1:t instanceof n&&(r[1]=t.minus(1))}try{return e.max.apply(e,r)}catch(u){throw i(u)}}}},function(e,r,t){"use strict";var n=t(159),i=t(174).transform,o=t(4).isNumber,a=t(13).isCollection,s=t(153).argsToArray;e.exports=function(e){e.mean.transform=function(){var r=s(arguments);if(2==r.length&&a(r[0])){var t=r[1];o(t)?r[1]=t-1:t instanceof n&&(r[1]=t.minus(1))}try{return e.mean.apply(e,r)}catch(u){throw i(u)}}}},function(e,r,t){"use strict";var n=t(159),i=t(174).transform,o=t(4).isNumber,a=t(13).isCollection,s=t(153).argsToArray;e.exports=function(e){e.min.transform=function(){var r=s(arguments);if(2==r.length&&a(r[0])){var t=r[1];o(t)?r[1]=t-1:t instanceof n&&(r[1]=t.minus(1))}try{return e.min.apply(e,r)}catch(u){throw i(u)}}}},function(e,r,t){"use strict";var n=t(175).isBoolean,i=t(153).argsToArray;e.exports=function(e){e.range.transform=function(){var r=i(arguments),t=r.length-1,o=r[t];return n(o)||r.push(!0),e.range.apply(e,r)}}},function(e,r,t){"use strict";var n=t(174).transform,i=(t(175).isBoolean,t(153).argsToArray);e.exports=function(e){e.subset.transform=function(){try{return e.subset.apply(e,i(arguments))}catch(r){throw n(r)}}}},function(e,r,t){"use strict";e.exports=function(e){function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.value=e instanceof r?e.value:e}function n(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 i=t(176);r.prototype.done=function(){return this.value},r.prototype.valueOf=function(){return this.value},r.prototype.toString=function(){return i.format(this.value)},r.createProxy=n;for(var o in e)e.hasOwnProperty(o)&&n(o,e[o]);return r}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=t(14),i=t(13),o=r.string.isString,a=i.isCollection;e.compile=function(r){if(1!=arguments.length)throw new e.error.ArgumentsError("compile",arguments.length,1);if(o(r))return n(r).compile(e);if(a(r))return i.deepMap(r,function(r){return n(r).compile(e)});throw new TypeError("String, array, or matrix expected")}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=t(14),i=t(13),o=r.string.isString,a=i.isCollection;e.eval=function(r,t){if(1!=arguments.length&&2!=arguments.length)throw new e.error.ArgumentsError("eval",arguments.length,1,2);if(t=t||{},o(r))return n(r).compile(e).eval(t);if(a(r))return i.deepMap(r,function(r){return n(r).compile(e).eval(t)});throw new TypeError("String, array, or matrix expected")}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(11);e.help=function(t){if(1!=arguments.length)throw new SyntaxError("Wrong number of arguments in function help ("+arguments.length+" provided, 1 expected)");var n=null;if(t instanceof String||"string"==typeof t)n=t;else{var i;for(i in e)if(e.hasOwnProperty(i)&&t===e[i]){n=i;break}}var o=e.expression.docs[n];if(!n)throw new Error('Cannot find "'+t+'" in math.js');if(!o)throw new Error('No documentation found on "'+n+'"');return new r(e,o)}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(14);e.parse=function(){return r.apply(r,arguments)}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=(t(9),t(13)),a=r.number.isNumber,s=r["boolean"].isBoolean,u=i.isComplex,f=o.isCollection;e.abs=function c(r){if(1!=arguments.length)throw new e.error.ArgumentsError("abs",arguments.length,1);if(a(r))return Math.abs(r);if(u(r))return Math.sqrt(r.re*r.re+r.im*r.im);if(r instanceof n)return r.abs();if(f(r))return o.deepMap(r,c);if(s(r)||null===r)return Math.abs(r);throw new e.error.UnsupportedTypeError("abs",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=(t(9),t(10)),a=t(13),s=r["boolean"].isBoolean,u=r.number.isNumber,f=r.string.isString,c=i.isComplex,l=o.isUnit,p=a.isCollection;e.add=function m(r,t){if(2!=arguments.length)throw new e.error.ArgumentsError("add",arguments.length,2);if(u(r)){if(u(t))return r+t;if(c(t))return new i(r+t.re,t.im)}if(c(r)){if(c(t))return new i(r.re+t.re,r.im+t.im);if(u(t))return new i(r.re+t,r.im)}if(l(r)&&l(t)){if(null==r.value)throw new Error("Parameter x contains a unit with undefined value");if(null==t.value)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(t))throw new Error("Units do not match");var o=r.clone();return o.value+=t.value,o.fixPrefix=!1,o}if(r instanceof n)return u(t)?t=n.convert(t):(s(t)||null===t)&&(t=new n(t?1:0)),t instanceof n?r.plus(t):m(r.toNumber(),t);if(t instanceof n)return u(r)?r=n.convert(r):(s(r)||null===r)&&(r=new n(r?1:0)),r instanceof n?r.plus(t):m(r,t.toNumber());if(p(r)||p(t))return a.deepMap2(r,t,m);if(f(r)||f(t))return r+t;if(s(r)||null===r)return m(+r,t);if(s(t)||null===t)return m(r,+t);throw new e.error.UnsupportedTypeError("add",e["typeof"](r),e["typeof"](t))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=r.number.isNumber,s=r["boolean"].isBoolean,u=o.isCollection,f=i.isComplex;e.ceil=function c(r){if(1!=arguments.length)throw new e.error.ArgumentsError("ceil",arguments.length,1);if(a(r))return Math.ceil(r);if(f(r))return new i(Math.ceil(r.re),Math.ceil(r.im));if(r instanceof n)return r.ceil();if(u(r))return o.deepMap(r,c);if(s(r)||null===r)return Math.ceil(r);throw new e.error.UnsupportedTypeError("ceil",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=r.number.isNumber,s=r["boolean"].isBoolean,u=i.isComplex,f=o.isCollection;e.cube=function c(r){if(1!=arguments.length)throw new e.error.ArgumentsError("cube",arguments.length,1);if(a(r))return r*r*r;if(u(r))return e.multiply(e.multiply(r,r),r);if(r instanceof n)return r.times(r).times(r);if(f(r))return o.deepMap(r,c);if(s(r)||null===r)return c(+r);throw new e.error.UnsupportedTypeError("cube",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){function r(e,r){var t=r.re*r.re+r.im*r.im;return 0!=t?new o((e.re*r.re+e.im*r.im)/t,(e.im*r.re-e.re*r.im)/t):new o(0!=e.re?e.re/0:0,0!=e.im?e.im/0:0)}var n=t(160),i=e.type.BigNumber,o=t(6),a=(t(9),t(10)),s=n.number.isNumber,u=n["boolean"].isBoolean,f=o.isComplex,c=a.isUnit;e._divide=function l(t,n){if(s(t)){if(s(n))return t/n;if(f(n))return r(new o(t,0),n)}if(f(t)){if(f(n))return r(t,n);if(s(n))return r(t,new o(n,0))}if(t instanceof i)return s(n)?n=i.convert(n):(u(n)||null===n)&&(n=new i(n?1:0)),n instanceof i?t.div(n):l(t.toNumber(),n);if(n instanceof i)return s(t)?t=i.convert(t):(u(t)||null===t)&&(t=new i(t?1:0)),t instanceof i?t.div(n):l(t,n.toNumber());if(c(t)&&s(n)){var a=t.clone();return a.value=(null===a.value?a._normalize(1):a.value)/n,a}if(u(t)||null===t)return l(+t,n);if(u(n)||null===n)return l(t,+n);throw new e.error.UnsupportedTypeError("divide",e["typeof"](t),e["typeof"](n))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(13),n=r.isCollection;e.divide=function(t,i){if(2!=arguments.length)throw new e.error.ArgumentsError("divide",arguments.length,2);return n(t)?n(i)?e.multiply(t,e.inv(i)):r.deepMap2(t,i,e._divide):n(i)?e.multiply(t,e.inv(i)):e._divide(t,i)}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(13);e.dotDivide=function(t,n){if(2!=arguments.length)throw new e.error.ArgumentsError("dotDivide",arguments.length,2);return r.deepMap2(t,n,e.divide)},e.edivide=function(){throw new Error("Function edivide is renamed to dotDivide")}}},function(e,r,t){"use strict";e.exports=function(e){var r=(t(160),t(13));e.dotMultiply=function(t,n){if(2!=arguments.length)throw new e.error.ArgumentsError("dotMultiply",arguments.length,2);return r.deepMap2(t,n,e.multiply)},e.emultiply=function(){throw new Error("Function emultiply is renamed to dotMultiply")}}},function(e,r,t){"use strict";e.exports=function(e){var r=(t(160),t(13));e.dotPow=function(t,n){if(2!=arguments.length)throw new e.error.ArgumentsError("dotPow",arguments.length,2);return r.deepMap2(t,n,e.pow)},e.epow=function(){throw new Error("Function epow is renamed to dotPow")}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=(t(9),t(13)),a=r.number.isNumber,s=r["boolean"].isBoolean,u=i.isComplex,f=o.isCollection;e.exp=function c(r){if(1!=arguments.length)throw new e.error.ArgumentsError("exp",arguments.length,1);if(a(r))return Math.exp(r);if(u(r)){var t=Math.exp(r.re);return new i(t*Math.cos(r.im),t*Math.sin(r.im))}if(r instanceof n)return r.exp();if(f(r))return o.deepMap(r,c);if(s(r)||null===r)return Math.exp(r);throw new e.error.UnsupportedTypeError("exp",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=r.number.isNumber,s=r["boolean"].isBoolean,u=i.isComplex,f=o.isCollection;e.fix=function c(r){if(1!=arguments.length)throw new e.error.ArgumentsError("fix",arguments.length,1);if(a(r))return r>0?Math.floor(r):Math.ceil(r);if(u(r))return new i(r.re>0?Math.floor(r.re):Math.ceil(r.re),r.im>0?Math.floor(r.im):Math.ceil(r.im));if(r instanceof n)return r.isNegative()?r.ceil():r.floor();if(f(r))return o.deepMap(r,c);if(s(r)||null===r)return c(+r);throw new e.error.UnsupportedTypeError("fix",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=r.number.isNumber,s=r["boolean"].isBoolean,u=i.isComplex,f=o.isCollection;e.floor=function c(r){if(1!=arguments.length)throw new e.error.ArgumentsError("floor",arguments.length,1);if(a(r))return Math.floor(r);if(u(r))return new i(Math.floor(r.re),Math.floor(r.im));if(r instanceof n)return r.floor();if(f(r))return o.deepMap(r,c);if(s(r)||null===r)return c(+r);throw new e.error.UnsupportedTypeError("floor",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){function r(e,r){if(!e.isInt()||!r.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var t=new i(0);!r.isZero();){var n=e.mod(r);e=r,r=n}return e.lt(t)?e.neg():e}var n=t(160),i=e.type.BigNumber,o=t(13),a=n.number.isNumber,s=n["boolean"].isBoolean,u=n.number.isInteger,f=o.isCollection;e.gcd=function c(){var t,n=arguments[0],l=arguments[1];if(2==arguments.length){if(a(n)&&a(l)){if(!u(n)||!u(l))throw new Error("Parameters in function gcd must be integer numbers");for(;0!=l;)t=n%l,n=l,l=t;return 0>n?-n:n}if(f(n)||f(l))return o.deepMap2(n,l,c);if(n instanceof i)return a(l)?l=i.convert(l):(s(l)||null===l)&&(l=new i(l?1:0)),l instanceof i?r(n,l):c(n.toNumber(),l);if(l instanceof i)return a(n)?n=i.convert(n):(s(n)||null===n)&&(n=new i(n?1:0)),n instanceof i?r(n,l):c(n.toNumber(),l);if(s(n)||null===n)return c(+n,l);if(s(l)||null===l)return c(n,+l);throw new e.error.UnsupportedTypeError("gcd",e["typeof"](n),e["typeof"](l))}if(arguments.length>2){for(var p=1;p<arguments.length;p++)n=c(n,arguments[p]);return n}throw new SyntaxError("Function gcd expects two or more arguments")}}},function(e,r,t){"use strict";e.exports=function(e){function r(e,r){if(!e.isInt()||!r.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(e.isZero()||r.isZero())return new i(0);for(var t=e.times(r);!r.isZero();){var n=r;r=e.mod(n),e=n}return t.div(e).abs()}var n=t(160),i=e.type.BigNumber,o=t(13),a=n.number.isNumber,s=n["boolean"].isBoolean,u=n.number.isInteger,f=o.isCollection;e.lcm=function c(){var t,n=arguments[0],l=arguments[1];if(2==arguments.length){if(a(n)&&a(l)){if(!u(n)||!u(l))throw new Error("Parameters in function lcm must be integer numbers");if(0==n||0==l)return 0;for(var p=n*l;0!=l;)t=l,l=n%t,n=t;return Math.abs(p/n)}if(f(n)||f(l))return o.deepMap2(n,l,c);if(n instanceof i)return a(l)?l=i.convert(l):(s(l)||null===l)&&(l=new i(l?1:0)),l instanceof i?r(n,l):c(n.toNumber(),l);if(l instanceof i)return a(n)?n=i.convert(n):(s(n)||null===n)&&(n=new i(n?1:0)),n instanceof i?r(n,l):c(n.toNumber(),l);if(s(n)||null===n)return c(+n,l);if(s(l)||null===l)return c(n,+l);throw new e.error.UnsupportedTypeError("lcm",e["typeof"](n),e["typeof"](l))}if(arguments.length>2){for(var m=1;m<arguments.length;m++)n=c(n,arguments[m]);return n}throw new SyntaxError("Function lcm expects two or more arguments")}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=r.number.isNumber,s=r["boolean"].isBoolean,u=i.isComplex,f=o.isCollection;e.log=function c(r,t){if(1==arguments.length){if(a(r))return r>=0?Math.log(r):c(new i(r,0));if(u(r))return new i(Math.log(Math.sqrt(r.re*r.re+r.im*r.im)),Math.atan2(r.im,r.re));if(r instanceof n)return r.isNegative()?c(r.toNumber()):r.ln();if(f(r))return o.deepMap(r,c);if(s(r)||null===r)return c(+r);throw new e.error.UnsupportedTypeError("log",e["typeof"](r))}if(2==arguments.length)return e.divide(c(r),c(t));throw new e.error.ArgumentsError("log",arguments.length,1,2)}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=r.number.isNumber,s=r["boolean"].isBoolean,u=i.isComplex,f=o.isCollection;e.log10=function c(r){if(1!=arguments.length)throw new e.error.ArgumentsError("log10",arguments.length,1);if(a(r))return r>=0?Math.log(r)/Math.LN10:c(new i(r,0));if(r instanceof n)return r.isNegative()?c(r.toNumber()):r.log();if(u(r))return new i(Math.log(Math.sqrt(r.re*r.re+r.im*r.im))/Math.LN10,Math.atan2(r.im,r.re)/Math.LN10);if(f(r))return o.deepMap(r,c);if(s(r)||null===r)return c(+r);throw new e.error.UnsupportedTypeError("log10",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){function r(e,r){if(r>0)return e-r*Math.floor(e/r);if(0==r)return e;throw new Error("Cannot calculate mod for a negative divisor")}var n=t(160),i=e.type.BigNumber,o=t(13),a=n.number.isNumber,s=n["boolean"].isBoolean,u=o.isCollection;e.mod=function f(t,n){if(2!=arguments.length)throw new e.error.ArgumentsError("mod",arguments.length,2);if(a(t)&&a(n))return r(t,n);if(t instanceof i)return a(n)?n=i.convert(n):(s(n)||null===n)&&(n=new i(n?1:0)),n instanceof i?n.isZero()?t:t.mod(n):f(t.toNumber(),n);if(n instanceof i)return a(t)?t=i.convert(t):(s(t)||null===t)&&(t=new i(t?1:0)),t instanceof i?n.isZero()?t:t.mod(n):f(t,n.toNumber());if(u(t)||u(n))return o.deepMap2(t,n,f);if(s(t)||null===t)return f(+t,n);if(s(n)||null===n)return f(t,+n);throw new e.error.UnsupportedTypeError("mod",e["typeof"](t),e["typeof"](n))}}},function(e,r,t){"use strict";e.exports=function(e){function r(r,t){for(var n=[],i=r.length,o=t[0].length,a=r[0].length,s=0;i>s;s++){n[s]=[];for(var u=0;o>u;u++){for(var f=null,c=0;a>c;c++){var l=e.multiply(r[s][c],t[c][u]);f=null===f?l:e.add(f,l)}n[s][u]=f}}var p=1===i&&1===o;return p?n[0][0]:n}function n(r,t){for(var n=[],i=t.length,o=t[0].length,a=0;o>a;a++){for(var s=null,u=0;i>u;u++){var f=e.multiply(r[u],t[u][a]);s=0===u?f:e.add(s,f)}n[a]=s}return 1===n.length?n[0]:n}function i(r,t){for(var n=[],i=r.length,o=r[0].length,a=0;i>a;a++){for(var s=null,u=0;o>u;u++){var f=e.multiply(r[a][u],t[u]);s=0===u?f:e.add(s,f)}n[a]=s}return 1===n.length?n[0]:n}function o(r,t){var n=r.length;if(!n)throw new Error("Cannot multiply two empty vectors");for(var i=0,o=0;n>o;o++)i=e.add(i,e.multiply(r[o],t[o]));return i}function a(e,r){return 0==e.im?0==r.im?new f(e.re*r.re,0):0==r.re?new f(0,e.re*r.im):new f(e.re*r.re,e.re*r.im):0==e.re?0==r.im?new f(0,e.im*r.re):0==r.re?new f(-e.im*r.im,0):new f(-e.im*r.im,e.im*r.re):0==r.im?new f(e.re*r.re,e.im*r.re):0==r.re?new f(-e.im*r.im,e.re*r.im):new f(e.re*r.re-e.im*r.im,e.re*r.im+e.im*r.re)}var s=t(160),u=e.type.BigNumber,f=t(6),c=t(9),l=t(10),p=t(13),m=s.array,h=s.number.isNumber,g=s["boolean"].isBoolean,d=f.isComplex,w=Array.isArray,x=l.isUnit;e.multiply=function y(t,s){var l;if(2!=arguments.length)throw new e.error.ArgumentsError("multiply",arguments.length,2);if(h(t)){if(h(s))return t*s;if(d(s))return a(new f(t,0),s);if(x(s))return l=s.clone(),l.value=null===l.value?l._normalize(t):l.value*t,l}if(d(t)){if(h(s))return a(t,new f(s,0));if(d(s))return a(t,s)}if(t instanceof u)return h(s)?s=u.convert(s):(g(s)||null===s)&&(s=new u(s?1:0)),s instanceof u?t.times(s):y(t.toNumber(),s);
  29. if(s instanceof u)return h(t)?t=u.convert(t):(g(t)||null===t)&&(t=new u(t?1:0)),t instanceof u?t.times(s):y(t,s.toNumber());if(x(t)&&h(s))return l=t.clone(),l.value=null===l.value?l._normalize(s):l.value*s,l;if(w(t)){if(w(s)){var v=m.size(t),b=m.size(s);if(1==v.length){if(1==b.length){if(v[0]!=b[0])throw new RangeError("Dimension mismatch in multiplication. Length of A must match length of B (A is "+v[0]+", B is "+b[0]+", "+v[0]+" != "+b[0]+")");return o(t,s)}if(2==b.length){if(v[0]!=b[0])throw new RangeError("Dimension mismatch in multiplication. Length of A must match rows of B (A is "+v[0]+", B is "+b[0]+"x"+b[1]+", "+v[0]+" != "+b[0]+")");return n(t,s)}throw new Error("Can only multiply a 1 or 2 dimensional matrix (B has "+b.length+" dimensions)")}if(2==v.length){if(1==b.length){if(v[1]!=b[0])throw new RangeError("Dimension mismatch in multiplication. Columns of A must match length of B (A is "+v[0]+"x"+v[0]+", B is "+b[0]+", "+v[1]+" != "+b[0]+")");return i(t,s)}if(2==b.length){if(v[1]!=b[0])throw new RangeError("Dimension mismatch in multiplication. Columns of A must match rows of B (A is "+v[0]+"x"+v[1]+", B is "+b[0]+"x"+b[1]+", "+v[1]+" != "+b[0]+")");return r(t,s)}throw new Error("Can only multiply a 1 or 2 dimensional matrix (B has "+b.length+" dimensions)")}throw new Error("Can only multiply a 1 or 2 dimensional matrix (A has "+v.length+" dimensions)")}return s instanceof c?(l=y(t,s.valueOf()),w(l)?new c(l):l):p.deepMap2(t,s,y)}if(t instanceof c)return s instanceof c?(l=y(t.valueOf(),s.valueOf()),w(l)?new c(l):l):(l=y(t.valueOf(),s),w(l)?new c(l):l);if(w(s))return p.deepMap2(t,s,y);if(s instanceof c)return new c(p.deepMap2(t,s.valueOf(),y));if(g(t)||null===t)return y(+t,s);if(g(s)||null===s)return y(t,+s);throw new e.error.UnsupportedTypeError("multiply",e["typeof"](t),e["typeof"](s))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=t(153),i=e.type.BigNumber,o=t(6),a=t(9),s=(t(13),r.number.isNumber),u=r["boolean"].isBoolean,f=o.isComplex,c=Array.isArray;e.norm=function l(r,t){if(arguments.length<1||arguments.length>2)throw new e.error.ArgumentsError("abs",arguments.length,1,2);if(s(r))return Math.abs(r);if(f(r))return Math.sqrt(r.re*r.re+r.im*r.im);if(r instanceof i)return r.abs();if(u(r)||null===r)return Math.abs(r);if(c(r)){var o=n.size(r);if(null==t&&(t=2),1==o.length){if(t===Number.POSITIVE_INFINITY||"inf"===t){var p;return e.forEach(r,function(r){var t=e.abs(r);(!p||e.larger(t,p))&&(p=t)}),p}if(t===Number.NEGATIVE_INFINITY||"-inf"===t){var p;return e.forEach(r,function(r){var t=e.abs(r);(!p||e.smaller(t,p))&&(p=t)}),p}if("fro"===t)return l(r);if(s(t)&&!isNaN(t)){if(!e.equal(t,0)){var p=0;return e.forEach(r,function(r){p=e.add(e.pow(e.abs(r),t),p)}),e.pow(p,1/t)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}if(2==o.length){if(1==t){for(var m=[],h=0;h<r.length;h++)for(var g=r[h],d=0;d<g.length;d++)m[d]=e.add(m[d]||0,e.abs(g[d]));return e.max(m)}if(t==Number.POSITIVE_INFINITY||"inf"===t){for(var p=0,h=0;h<r.length;h++){for(var w=0,g=r[h],d=0;d<g.length;d++)w=e.add(w,e.abs(g[d]));e.larger(w,p)&&(p=w)}return p}if("fro"===t){var x=e.diag(e.multiply(e.transpose(r),r)),y=0;return e.forEach(x,function(r){y=e.add(r,y)}),e.sqrt(y)}if(2==t)throw new Error("Unsupported parameter value, missing implementation of matrix singular value decomposition");throw new Error("Unsupported parameter value")}}if(r instanceof a)return l(r.valueOf(),t);throw new e.error.UnsupportedTypeError("norm",r)}}},function(e,r,t){"use strict";e.exports=function(e){function r(e,r){var t=void 0!=r?r:2,n=0>t;if(n&&(t=-t),0==t)throw new Error("Root must be non-zero");if(0>e&&Math.abs(t)%2!=1)throw new Error("Root must be odd when a is negative.");if(0==e)return 0;if(!Number.isFinite(e))return n?0:e;var i=1e-16,o=1,a=0,s=100;do{var u=(e/Math.pow(o,t-1)-o)/t;o+=u,a++}while(Math.abs(u)>i&&s>a);return n?1/o:o}function i(e,r){var t=void 0!=r?r:new a(2),n=new a(0),i=new a(1),o=t.isNegative();if(o&&(t=t.negated()),t.isZero())throw new Error("Root must be non-zero");if(e.isNegative()&&!t.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(e.isZero())return n;if(!e.isFinite())return o?n:e;var s=i,u=0,f=100;do{var c=s,l=e.div(s.pow(t.minus(1))).minus(s).div(t);s=s.plus(l),u++}while(!s.equals(c)&&f>u);return o?i.div(s):s}var o=t(160),a=e.type.BigNumber,s=t(13),u=o.number.isNumber,f=o["boolean"].isBoolean,c=s.isCollection;e.nthRoot=function l(t,o){if(1!=arguments.length&&2!=arguments.length)throw new e.error.ArgumentsError("nthRoot",arguments.length,1,2);switch(arguments.length){case 1:if(u(t))return r(t);if(t instanceof a)return i(t);if(c(t))return s.deepMap(x,l);if(f(t)||null===t)return l(+t);break;case 2:if(u(t)){if(u(o))return r(t,o);if(o instanceof a)return t=a.convert(t),t instanceof a?i(t,o):r(t,o.toNumber())}else{if(t instanceof a)return u(o)&&(o=a.convert(o)),o instanceof a?i(t,o):r(t.toNumber(),o);if(c(t)&&!c(o))return s.deepMap2(t,o,l)}if(f(t)||null===t)return l(+t,o);if(f(o)||null===o)return l(t,+o);break;default:throw new e.error.ArgumentsError("nthRoot",arguments.length,1,2)}if(f(x)||null===x)return 2==arguments.length?l(+x,n):l(+x);throw new e.error.UnsupportedTypeError("nthRoot",e["typeof"](t),e["typeof"](o))}}},function(e,r,t){"use strict";e.exports=function(e){function r(r,t){var n=e.log(r),i=e.multiply(n,t);return e.exp(i)}var n=t(160),i=e.type.BigNumber,o=t(6),a=t(9),s=(t(13),n.array),u=n.number.isNumber,f=n["boolean"].isBoolean,c=Array.isArray,l=n.number.isInteger,p=o.isComplex;e.pow=function m(t,n){if(2!=arguments.length)throw new e.error.ArgumentsError("pow",arguments.length,2);if(u(t)){if(u(n))return l(n)||t>=0?Math.pow(t,n):r(new o(t,0),new o(n,0));if(p(n))return r(new o(t,0),n)}if(p(t)){if(u(n))return r(t,new o(n,0));if(p(n))return r(t,n)}if(t instanceof i)return u(n)?n=i.convert(n):(f(n)||null===n)&&(n=new i(n?1:0)),n instanceof i?n.isInteger()||!t.isNegative()?t.pow(n):m(t.toNumber(),n.toNumber()):m(t.toNumber(),n);if(n instanceof i)return u(t)?t=i.convert(t):(f(t)||null===t)&&(t=new i(t?1:0)),t instanceof i?n.isInteger()&&!t.isNegative()?t.pow(n):m(t.toNumber(),n.toNumber()):m(t,n.toNumber());if(c(t)){if(!u(n)||!l(n)||0>n)throw new TypeError("For A^b, b must be a positive integer (value is "+n+")");var h=s.size(t);if(2!=h.length)throw new Error("For A^b, A must be 2 dimensional (A has "+h.length+" dimensions)");if(h[0]!=h[1])throw new Error("For A^b, A must be square (size is "+h[0]+"x"+h[1]+")");for(var g=e.eye(h[0]).valueOf(),d=t;n>=1;)1==(1&n)&&(g=e.multiply(d,g)),n>>=1,d=e.multiply(d,d);return g}if(t instanceof a)return new a(m(t.valueOf(),n));if(f(t)||null===t)return m(+t,n);if(f(n)||null===n)return m(t,+n);throw new e.error.UnsupportedTypeError("pow",e["typeof"](t),e["typeof"](n))}}},function(e,r,t){"use strict";e.exports=function(e){function r(e,r){var t=Math.pow(10,r);return Math.round(e*t)/t}var n=t(160),i=e.type.BigNumber,o=t(6),a=t(13),s=n.number.isNumber,u=n.number.isInteger,f=n["boolean"].isBoolean,c=o.isComplex,l=a.isCollection;e.round=function p(t,n){if(1!=arguments.length&&2!=arguments.length)throw new e.error.ArgumentsError("round",arguments.length,1,2);if(void 0==n){if(s(t))return Math.round(t);if(c(t))return new o(Math.round(t.re),Math.round(t.im));if(t instanceof i)return t.toDecimalPlaces(0);if(l(t))return a.deepMap(t,p);if(f(t)||null===t)return Math.round(t);throw new e.error.UnsupportedTypeError("round",e["typeof"](t))}if(!s(n)||!u(n)){if(!(n instanceof i)){if(f(n)||null===t)return p(t,+n);throw new TypeError("Number of decimals in function round must be an integer")}n=parseFloat(n.valueOf())}if(0>n||n>15)throw new Error("Number of decimals in function round must be in te range of 0-15");if(s(t))return r(t,n);if(c(t))return new o(r(t.re,n),r(t.im,n));if(t instanceof i)return t.toDecimalPlaces(n);if(l(t)||l(n))return a.deepMap2(t,n,p);if(f(t)||null===t)return p(+t,n);throw new e.error.UnsupportedTypeError("round",e["typeof"](t),e["typeof"](n))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=r.number,s=r.number.isNumber,u=r["boolean"].isBoolean,f=i.isComplex,c=o.isCollection;e.sign=function l(r){if(1!=arguments.length)throw new e.error.ArgumentsError("sign",arguments.length,1);if(s(r))return a.sign(r);if(f(r)){var t=Math.sqrt(r.re*r.re+r.im*r.im);return new i(r.re/t,r.im/t)}if(r instanceof n)return new n(r.cmp(0));if(c(r))return o.deepMap(r,l);if(u(r)||null===r)return a.sign(r);throw new e.error.UnsupportedTypeError("sign",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=r.number.isNumber,s=r["boolean"].isBoolean,u=i.isComplex,f=o.isCollection;e.sqrt=function c(r){if(1!=arguments.length)throw new e.error.ArgumentsError("sqrt",arguments.length,1);if(a(r))return r>=0?Math.sqrt(r):c(new i(r,0));if(u(r)){var t,l,p=Math.sqrt(r.re*r.re+r.im*r.im);return t=r.re>=0?.5*Math.sqrt(2*(p+r.re)):Math.abs(r.im)/Math.sqrt(2*(p-r.re)),l=r.re<=0?.5*Math.sqrt(2*(p-r.re)):Math.abs(r.im)/Math.sqrt(2*(p+r.re)),r.im>=0?new i(t,l):new i(t,-l)}if(r instanceof n)return r.isNegative()?c(r.toNumber()):r.sqrt();if(f(r))return o.deepMap(r,c);if(s(r)||null===r)return c(+r);throw new e.error.UnsupportedTypeError("sqrt",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=r.number.isNumber,s=r["boolean"].isBoolean,u=i.isComplex,f=o.isCollection;e.square=function c(r){if(1!=arguments.length)throw new e.error.ArgumentsError("square",arguments.length,1);if(a(r))return r*r;if(u(r))return e.multiply(r,r);if(r instanceof n)return r.times(r);if(f(r))return o.deepMap(r,c);if(s(r)||null===r)return r*r;throw new e.error.UnsupportedTypeError("square",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=(t(9),t(10)),a=t(13),s=r["boolean"].isBoolean,u=r.number.isNumber,f=i.isComplex,c=o.isUnit,l=a.isCollection;e.subtract=function p(r,t){if(2!=arguments.length)throw new e.error.ArgumentsError("subtract",arguments.length,2);if(u(r)){if(u(t))return r-t;if(f(t))return new i(r-t.re,-t.im)}else if(f(r)){if(u(t))return new i(r.re-t,r.im);if(f(t))return new i(r.re-t.re,r.im-t.im)}if(r instanceof n)return u(t)?t=n.convert(t):(s(t)||null===t)&&(t=new n(t?1:0)),t instanceof n?r.minus(t):p(r.toNumber(),t);if(t instanceof n)return u(r)?r=n.convert(r):(s(r)||null===r)&&(r=new n(r?1:0)),r instanceof n?r.minus(t):p(r,t.toNumber());if(c(r)&&c(t)){if(null==r.value)throw new Error("Parameter x contains a unit with undefined value");if(null==t.value)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(t))throw new Error("Units do not match");var o=r.clone();return o.value-=t.value,o.fixPrefix=!1,o}if(l(r)||l(t))return a.deepMap2(r,t,p);if(s(r)||null===r)return p(+r,t);if(s(t)||null===t)return p(r,+t);throw new e.error.UnsupportedTypeError("subtract",e["typeof"](r),e["typeof"](t))}}},function(e,r,t){"use strict";e.exports=function(e,r){var n=t(160),i=e.type.BigNumber,o=t(6),a=t(10),s=t(13),u=n.number.isNumber,f=n["boolean"].isBoolean,c=n.string.isString,l=o.isComplex,p=a.isUnit,m=s.isCollection;e.unaryMinus=function h(t){if(1!=arguments.length)throw new e.error.ArgumentsError("unaryMinus",arguments.length,1);if(u(t))return-t;if(l(t))return new o(-t.re,-t.im);if(t instanceof i)return t.neg();if(p(t)){var n=t.clone();return n.value=-t.value,n}if(m(t))return s.deepMap(t,h);if(f(t)||c(t)||null===t)return"bignumber"==r.number?new i(-t):-t;throw new e.error.UnsupportedTypeError("unaryMinus",e["typeof"](t))},e.unary=function(){throw new Error("Function unary is deprecated. Use unaryMinus instead.")}}},function(e,r,t){"use strict";e.exports=function(e,r){var n=t(160),i=e.type.BigNumber,o=t(6),a=t(10),s=t(13),u=n.number.isNumber,f=n["boolean"].isBoolean,c=n.string.isString,l=o.isComplex,p=a.isUnit,m=s.isCollection;e.unaryPlus=function h(t){if(1!=arguments.length)throw new e.error.ArgumentsError("unaryPlus",arguments.length,1);if(u(t))return t;if(l(t))return t.clone();if(t instanceof i)return t;if(p(t))return t.clone();if(m(t))return s.deepMap(t,h);if(f(t)||c(t)||null===t)return"bignumber"==r.number?new i(+t):+t;throw new e.error.UnsupportedTypeError("unaryPlus",e["typeof"](t))}}},function(e,r,t){"use strict";e.exports=function(e,r){function n(e,t){for(var n,i,o,s=0,u=1,f=1,c=0;t;)i=Math.floor(e/t),o=e%t,n=s,s=u-i*s,u=n,n=f,f=c-i*f,c=n,e=t,t=o;var l;return l=0>e?[-e,-u,-c]:[e,e?u:0,c],"array"===r.matrix?l:new a(l)}function i(e,t){for(var n,i,o,u=new s(0),f=new s(0),c=new s(1),l=new s(1),p=new s(0);!t.isZero();)i=e.div(t).floor(),o=e.mod(t),n=f,f=c.minus(i.times(f)),c=n,n=l,l=p.minus(i.times(l)),p=n,e=t,t=o;var m;return m=e.lt(u)?[e.neg(),c.neg(),p.neg()]:[e,e.isZero()?0:c,p],"array"===r.matrix?m:new a(m)}var o=t(160),a=t(9),s=e.type.BigNumber,u=o.number.isNumber,f=o["boolean"].isBoolean,c=o.number.isInteger;e.xgcd=function l(r,t){if(2==arguments.length){if(u(r)&&u(t)){if(!c(r)||!c(t))throw new Error("Parameters in function xgcd must be integer numbers");return n(r,t)}if(r instanceof s)return u(t)?t=s.convert(t):(f(t)||null===t)&&(t=new s(t?1:0)),t instanceof s?i(r,t):l(r.toNumber(),t);if(t instanceof s)return u(r)?r=s.convert(r):(f(r)||null===r)&&(r=new s(r?1:0)),r instanceof s?i(r,t):l(r.toNumber(),t);if(f(r)||null===r)return l(+r,t);if(f(t)||null===t)return l(r,+t);throw new e.error.UnsupportedTypeError("xgcd",e["typeof"](r),e["typeof"](t))}throw new SyntaxError("Function xgcd expects two arguments")}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=(t(9),t(10),t(13)),o=r["boolean"].isBoolean,a=r.number.isInteger,s=r.number.isNumber,u=i.isCollection,f=r.bignumber.and;e.bitAnd=function c(r,t){if(2!=arguments.length)throw new e.error.ArgumentsError("bitAnd",arguments.length,2);if(s(r)&&s(t)){if(!a(r)||!a(t))throw new Error("Parameters in function bitAnd must be integer numbers");return r&t}if(u(r)||u(t))return i.deepMap2(r,t,c);if(o(r)||null===r)return c(+r,t);if(o(t)||null===t)return c(r,+t);if(r instanceof n)return s(t)&&(t=n.convert(t)),t instanceof n?f(r,t):c(r.toNumber(),t);if(t instanceof n)return s(r)&&(r=n.convert(r)),r instanceof n?f(r,t):c(r,t.toNumber());throw new e.error.UnsupportedTypeError("bitAnd",e["typeof"](r),e["typeof"](t))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=(t(9),t(10),t(13)),o=r["boolean"].isBoolean,a=r.number.isInteger,s=r.number.isNumber,u=i.isCollection,f=r.bignumber.not;e.bitNot=function c(r){if(1!=arguments.length)throw new e.error.ArgumentsError("bitNot",arguments.length,1);if(s(r)){if(!a(r))throw new Error("Parameter in function bitNot must be integer numbers");return~r}if(r instanceof n)return f(r);if(u(r))return i.deepMap(r,c);if(o(r)||null===r)return c(+r);throw new e.error.UnsupportedTypeError("bitNot",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=(t(9),t(10),t(13)),o=r["boolean"].isBoolean,a=r.number.isInteger,s=r.number.isNumber,u=i.isCollection,f=r.bignumber.or;e.bitOr=function c(r,t){if(2!=arguments.length)throw new e.error.ArgumentsError("bitOr",arguments.length,2);if(s(r)&&s(t)){if(!a(r)||!a(t))throw new Error("Parameters in function bitOr must be integer numbers");return r|t}if(u(r)||u(t))return i.deepMap2(r,t,c);if(o(r)||null===r)return c(+r,t);if(o(t)||null===t)return c(r,+t);if(r instanceof n)return s(t)&&(t=n.convert(t)),t instanceof n?f(r,t):c(r.toNumber(),t);if(t instanceof n)return s(r)&&(r=n.convert(r)),r instanceof n?f(r,t):c(r,t.toNumber());throw new e.error.UnsupportedTypeError("bitOr",e["typeof"](r),e["typeof"](t))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=(t(9),t(10),t(13)),o=r["boolean"].isBoolean,a=r.number.isInteger,s=r.number.isNumber,u=i.isCollection,f=r.bignumber.xor;e.bitXor=function c(r,t){if(2!=arguments.length)throw new e.error.ArgumentsError("bitXor",arguments.length,2);if(s(r)&&s(t)){if(!a(r)||!a(t))throw new Error("Parameters in function bitXor must be integer numbers");return r^t}if(u(r)||u(t))return i.deepMap2(r,t,c);if(o(r)||null===r)return c(+r,t);if(o(t)||null===t)return c(r,+t);if(r instanceof n)return s(t)&&(t=n.convert(t)),t instanceof n?f(r,t):c(r.toNumber(),t);if(t instanceof n)return s(r)&&(r=n.convert(r)),r instanceof n?f(r,t):c(r,t.toNumber());throw new e.error.UnsupportedTypeError("bitXor",e["typeof"](r),e["typeof"](t))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=(t(9),t(10),t(13)),o=r["boolean"].isBoolean,a=r.number.isInteger,s=r.number.isNumber,u=i.isCollection,f=r.bignumber.leftShift;e.leftShift=function c(r,t){if(2!=arguments.length)throw new e.error.ArgumentsError("leftShift",arguments.length,2);if(s(r)){if(s(t)){if(!a(r)||!a(t))throw new Error("Parameters in function leftShift must be integer numbers");return r<<t}if(t instanceof n)return f(n.convert(r),t)}if(s(t)){if(isFinite(t)&&!a(t))throw new Error("Parameters in function leftShift must be integer numbers");if(r instanceof n){if(r.isFinite()&&!r.isInteger())throw new Error("Parameters in function leftShift must be integer numbers");return r.isNaN()||isNaN(t)||0>t?new n(0/0):0==t||r.isZero()?r:1/0!=t||r.isFinite()?55>t?r.times(Math.pow(2,t)+""):(t=n.convert(t),f(r,t)):new n(0/0)}}if(u(r)&&s(t))return i.deepMap2(r,t,c);if(o(r)||null===r)return c(+r,t);if(o(t)||null===t)return c(r,+t);if(r instanceof n)return t instanceof n?f(r,t):c(r.toNumber(),t);if(t instanceof n)return c(r,t.toNumber());throw new e.error.UnsupportedTypeError("leftShift",e["typeof"](r),e["typeof"](t))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=(t(9),t(10),t(13)),o=r["boolean"].isBoolean,a=r.number.isInteger,s=r.number.isNumber,u=i.isCollection,f=r.bignumber.rightShift;e.rightArithShift=function c(r,t){if(2!=arguments.length)throw new e.error.ArgumentsError("rightArithShift",arguments.length,2);if(s(r)){if(s(t)){if(!a(r)||!a(t))throw new Error("Parameters in function rightArithShift must be integer numbers");return r>>t}if(t instanceof n)return f(n.convert(r),t)}if(s(t)){if(isFinite(t)&&!a(t))throw new Error("Parameters in function rightArithShift must be integer numbers");if(r instanceof n){if(r.isFinite()&&!r.isInteger())throw new Error("Parameters in function rightArithShift must be integer numbers");return r.isNaN()||isNaN(t)||0>t?new n(0/0):1/0==t?new n(r.isNegative()?-1:r.isFinite()?0:0/0):55>t?r.div(Math.pow(2,t)+"").floor():(t=n.convert(t),f(r,t))}}if(u(r)&&s(t))return i.deepMap2(r,t,c);if(o(r)||null===r)return c(+r,t);if(o(t)||null===t)return c(r,+t);if(r instanceof n)return t instanceof n?f(r,t):c(r.toNumber(),t);if(t instanceof n)return c(r,t.toNumber());throw new e.error.UnsupportedTypeError("rightArithShift",e["typeof"](r),e["typeof"](t))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=(t(9),t(10),t(13)),i=r["boolean"].isBoolean,o=r.number.isInteger,a=r.number.isNumber,s=n.isCollection;e.rightLogShift=function u(r,t){if(2!=arguments.length)throw new e.error.ArgumentsError("rightLogShift",arguments.length,2);if(a(r)&&a(t)){if(!o(r)||!o(t))throw new Error("Parameters in function rightLogShift must be integer numbers");return r>>>t}if(s(r)&&a(t))return n.deepMap2(r,t,u);if(i(r)||null===r)return u(+r,t);if(i(t)||null===t)return u(r,+t);throw new e.error.UnsupportedTypeError("rightLogShift",e["typeof"](r),e["typeof"](t))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=r.number.isNumber,s=r["boolean"].isBoolean,u=o.isCollection,f=i.isComplex;e.arg=function c(r){if(1!=arguments.length)throw new e.error.ArgumentsError("arg",arguments.length,1);if(a(r))return Math.atan2(0,r);if(f(r))return Math.atan2(r.im,r.re);if(u(r))return o.deepMap(r,c);if(s(r)||null===r)return c(+r);if(r instanceof n)return c(r.toNumber());throw new e.error.UnsupportedTypeError("arg",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=r.object,s=r.number.isNumber,u=r["boolean"].isBoolean,f=o.isCollection,c=i.isComplex;e.conj=function l(r){if(1!=arguments.length)throw new e.error.ArgumentsError("conj",arguments.length,1);return s(r)?r:r instanceof n?new n(r):c(r)?new i(r.re,-r.im):f(r)?o.deepMap(r,l):u(r)||null===r?+r:a.clone(r)}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=r.object,s=r.number.isNumber,u=r["boolean"].isBoolean,f=o.isCollection,c=i.isComplex;e.re=function l(r){if(1!=arguments.length)throw new e.error.ArgumentsError("re",arguments.length,1);return s(r)?r:r instanceof n?new n(r):c(r)?r.re:f(r)?o.deepMap(r,l):u(r)||null===r?+r:a.clone(r)}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=r.number.isNumber,s=r["boolean"].isBoolean,u=o.isCollection,f=i.isComplex;e.im=function c(r){if(1!=arguments.length)throw new e.error.ArgumentsError("im",arguments.length,1);return a(r)?0:r instanceof n?new n(0):f(r)?r.im:u(r)?o.deepMap(r,c):(s(r)||null===r,0)}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(13),o=i.isCollection,a=r.number.isNumber,s=r.string.isString,u=r["boolean"].isBoolean;e.bignumber=function f(r){if(arguments.length>1)throw new e.error.ArgumentsError("bignumber",arguments.length,0,1);if(r instanceof n||a(r)||s(r))return new n(r);if(u(r)||null===r)return new n(+r);if(o(r))return i.deepMap(r,f);if(0==arguments.length)return new n(0);throw new e.error.UnsupportedTypeError("bignumber",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(13),o=i.isCollection,a=r.number.isNumber,s=r.string.isString;e["boolean"]=function u(r){if(1!=arguments.length)throw new e.error.ArgumentsError("boolean",arguments.length,0,1);if("true"===r||r===!0)return!0;if("false"===r||r===!1||null===r)return!1;if(r instanceof Boolean)return 1==r;if(a(r))return 0!==r;if(r instanceof n)return!r.isZero();if(s(r)){var t=r.toLowerCase();if("true"===t)return!0;if("false"===t)return!1;var f=Number(r);if(""!=r&&!isNaN(f))return 0!==f}if(o(r))return i.deepMap(r,u);throw new SyntaxError(r.toString()+" is no valid boolean")}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=o.isCollection,s=r.number.isNumber,u=r.string.isString,f=i.isComplex;e.complex=function c(){switch(arguments.length){case 0:return new i(0,0);case 1:var r=arguments[0];if(s(r))return new i(r,0);if(r instanceof n)return new i(r.toNumber(),0);if(f(r))return r.clone();if(u(r)){var t=i.parse(r);if(t)return t;throw new SyntaxError('String "'+r+'" is no valid complex number')}if(a(r))return o.deepMap(r,c);if("object"==typeof r){if("re"in r&&"im"in r)return new i(r.re,r.im);if("r"in r&&"phi"in r)return i.fromPolar(r.r,r.phi)}throw new TypeError("Two numbers, single string or an fitting object expected in function complex");case 2:var l=arguments[0],p=arguments[1];if(l instanceof n&&(l=l.toNumber()),p instanceof n&&(p=p.toNumber()),s(l)&&s(p))return new i(l,p);throw new TypeError("Two numbers or a single string expected in function complex");default:throw new e.error.ArgumentsError("complex",arguments.length,0,2)}}}},function(e,r,t){"use strict";e.exports=function(e){var r=(t(160),e.type.BigNumber),n=t(8);e.index=function(){var e=Array.prototype.slice.apply(arguments).map(function(e){return e instanceof r?e.toNumber():Array.isArray(e)?e.map(function(e){return e instanceof r?e.toNumber():e}):e}),t=new n;return n.apply(t,e),t}}},function(e,r,t){"use strict";e.exports=function(e){var r=(t(160),t(9));e.matrix=function(t){if(arguments.length>1)throw new e.error.ArgumentsError("matrix",arguments.length,0,1);return new r(t)}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=e.type.Unit,o=t(13),a=o.isCollection,s=r.number.isNumber,u=r["boolean"].isBoolean,f=r.string.isString;e.number=function c(r,t){switch(arguments.length){case 0:return 0;case 1:if(a(r))return o.deepMap(r,c);if(r instanceof n)return r.toNumber();if(f(r)){var l=Number(r);if(isNaN(l)&&(l=Number(r.valueOf())),isNaN(l))throw new SyntaxError(r.toString()+" is no valid number");return l}if(u(r)||null===r)return+r;if(s(r))return r;if(r instanceof i)throw new Error("Second argument with valueless unit expected");throw new e.error.UnsupportedTypeError("number",e["typeof"](r));case 2:if(r instanceof i&&f(t)||t instanceof i)return r.toNumber(t);throw new e.error.UnsupportedTypeError("number",e["typeof"](r),e["typeof"](t));default:throw new e.error.ArgumentsError("number",arguments.length,0,1)}}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(15);e.parser=function(){return new r(e)}}},function(e){"use strict";e.exports=function(e){e.chain=function(r){return new e.chaining.Chain(r)},e.select=function(r){return console&&"function"==typeof console.log&&console.log('WARNING: Function "select" is renamed to "chain". It will be deprecated in v2.0.'),e.select=e.chain,e.chaining.Chain.prototype.select=e.select,e.chain(r)}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=t(13),i=r.number,o=r.number.isNumber,a=n.isCollection;e.string=function s(r){switch(arguments.length){case 0:return"";case 1:return o(r)?i.format(r):a(r)?n.deepMap(r,s):null===r?"null":r.toString();default:throw new e.error.ArgumentsError("string",arguments.length,0,1)}}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(10),o=t(13),a=o.isCollection,s=r.string.isString;e.unit=function u(r){switch(arguments.length){case 1:var t=arguments[0];if(t instanceof i)return t.clone();if(s(t)){if(i.isValuelessUnit(t))return new i(null,t);var f=i.parse(t);if(f)return f;throw new SyntaxError('String "'+t+'" is no valid unit')}if(a(r))return o.deepMap(r,u);throw new TypeError("A string or a number and string expected in function unit");case 2:return arguments[0]instanceof n?new i(arguments[0].toNumber(),arguments[1]):new i(arguments[0],arguments[1]);default:throw new e.error.ArgumentsError("unit",arguments.length,1,2)}}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(10),a=t(13),s=r.number.isNumber,u=r["boolean"].isBoolean,f=i.isComplex,c=o.isUnit,l=a.isCollection;e.and=function p(r,t){if(2!=arguments.length)throw new e.error.ArgumentsError("and",arguments.length,2);if((s(r)||u(r)||null===r)&&(s(t)||u(t)||null===t))return!(!r||!t);if(f(r))return 0==r.re&&0==r.im?!1:p(!0,t);if(f(t))return 0==t.re&&0==t.im?!1:p(r,!0);if(r instanceof n)return r.isZero()||r.isNaN()?!1:p(!0,t);if(t instanceof n)return t.isZero()||t.isNaN()?!1:p(r,!0);if(c(r))return null===r.value||0==r.value?!1:p(!0,t);if(c(t))return null===t.value||0==t.value?!1:p(r,!0);if(l(r)||l(t))return a.deepMap2(r,t,p);throw new e.error.UnsupportedTypeError("and",e["typeof"](r),e["typeof"](t))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(10),a=t(13),s=r.number.isNumber,u=r["boolean"].isBoolean,f=i.isComplex,c=o.isUnit,l=a.isCollection;e.not=function p(r){if(1!=arguments.length)throw new e.error.ArgumentsError("not",arguments.length,1);if(s(r)||u(r)||null===r)return!r;if(f(r))return 0==r.re&&0==r.im;if(r instanceof n)return r.isZero()||r.isNaN();if(c(r))return null===r.value||0==r.value;if(l(r))return a.deepMap(r,p);throw new e.error.UnsupportedTypeError("not",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(10),a=t(13),s=r.number.isNumber,u=r["boolean"].isBoolean,f=i.isComplex,c=o.isUnit,l=a.isCollection;e.or=function p(r,t){if(2!=arguments.length)throw new e.error.ArgumentsError("or",arguments.length,2);if((s(r)||u(r)||null===r)&&(s(t)||u(t)||null===t))return!(!r&&!t);if(f(r))return 0==r.re&&0==r.im?p(!1,t):!0;if(f(t))return 0==t.re&&0==t.im?p(r,!1):!0;if(r instanceof n)return r.isZero()||r.isNaN()?p(!1,t):!0;if(t instanceof n)return t.isZero()||t.isNaN()?p(r,!1):!0;if(c(r))return null===r.value||0==r.value?p(!1,t):!0;if(c(t))return null===t.value||0==t.value?p(r,!1):!0;if(l(r)||l(t))return a.deepMap2(r,t,p);throw new e.error.UnsupportedTypeError("or",e["typeof"](r),e["typeof"](t))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(10),a=t(13),s=r.number.isNumber,u=r["boolean"].isBoolean,f=i.isComplex,c=o.isUnit,l=a.isCollection;e.xor=function p(r,t){if(2!=arguments.length)throw new e.error.ArgumentsError("xor",arguments.length,2);if((s(r)||u(r)||null===r)&&(s(t)||u(t)||null===t))return!!(!!r^!!t);if(f(r))return p(!(0==r.re&&0==r.im),t);if(f(t))return p(r,!(0==t.re&&0==t.im));if(r instanceof n)return p(!(r.isZero()||r.isNaN()),t);if(t instanceof n)return p(r,!(t.isZero()||t.isNaN()));if(c(r))return p(!(null===r.value||0==r.value),t);if(c(t))return p(r,!(null===t.value||0==t.value));if(l(r)||l(t))return a.deepMap2(r,t,p);throw new e.error.UnsupportedTypeError("xor",e["typeof"](r),e["typeof"](t))}}},function(e,r,t){"use strict";e.exports=function(e){function r(t,n,i,o){if(i>o){if(t.length!=n.length)throw new e.error.DimensionError(t.length,n.length);for(var a=[],s=0;s<t.length;s++)a[s]=r(t[s],n[s],i,o+1);return a}return t.concat(n)}var n=t(160),i=t(159),o=t(9),a=t(13),s=n.object,u=n.array,f=n.number.isNumber,c=n.number.isInteger,l=a.isCollection;e.concat=function(){var t,n,a=arguments.length,p=-1,m=!1,h=[];for(t=0;a>t;t++){var g=arguments[t];if(g instanceof o&&(m=!0),t==a-1&&(f(g)||g instanceof i)){if(n=p,p=g.valueOf(),!c(p))throw new TypeError("Integer number expected for dimension");if(0>p)throw new e.error.IndexError(p);if(t>0&&p>n)throw new e.error.IndexError(p,n+1)}else{if(!l(g))throw new e.error.UnsupportedTypeError("concat",e["typeof"](g));var d=s.clone(g).valueOf(),w=u.size(g.valueOf());if(h[t]=d,n=p,p=w.length-1,t>0&&p!=n)throw new e.error.DimensionError(n+1,p+1)}}if(0==h.length)throw new SyntaxError("At least one matrix expected");for(var x=h.shift();h.length;)x=r(x,h.shift(),p,0);return m?new o(x):x}}},function(e,r,t){"use strict";e.exports=function(e){function r(r,t){var i=n.size(r),o=n.size(t);if(1!=i.length||1!=o.length||3!=i[0]||3!=o[0])throw new RangeError("Vectors with length 3 expected (Size A = ["+i.join(", ")+"], B = ["+o.join(", ")+"])");return[e.subtract(e.multiply(r[1],t[2]),e.multiply(r[2],t[1])),e.subtract(e.multiply(r[2],t[0]),e.multiply(r[0],t[2])),e.subtract(e.multiply(r[0],t[1]),e.multiply(r[1],t[0]))]}var n=t(153),i=t(9);e.cross=function(t,n){if(t instanceof i){if(n instanceof i)return new i(r(t.toArray(),n.toArray()));if(Array.isArray(n))return new i(r(t.toArray(),n))}else if(Array.isArray(t)){if(n instanceof i)return new i(r(t,n.toArray()));if(Array.isArray(n))return r(t,n)}throw new e.error.UnsupportedTypeError("cross",e["typeof"](t),e["typeof"](n))}}},function(e,r,t){"use strict";e.exports=function(e){function r(r,t){if(1==t)return o.clone(r[0][0]);if(2==t)return e.subtract(e.multiply(r[0][0],r[1][1]),e.multiply(r[1][0],r[0][1]));for(var n=function(r){var t,n,i=new Array(r.length),o=0;for(t=1;t<r.length;t++)o=e.add(o,r[t][t]);for(t=0;t<r.length;t++){for(i[t]=new Array(r.length),i[t][t]=e.unaryMinus(o),n=0;t>n;n++)i[t][n]=0;for(n=t+1;n<r.length;n++)i[t][n]=r[t][n];t+1<r.length&&(o=e.subtract(o,r[t+1][t+1]))}return i},i=r,a=0;t-1>a;a++)i=e.multiply(n(i),r);return t%2==0?e.unaryMinus(i[0][0]):i[0][0]}var n=t(160),i=t(9),o=n.object,a=n.string;e.det=function(t){if(1!=arguments.length)throw new e.error.ArgumentsError("det",arguments.length,1);var n;switch(t instanceof i?n=t.size():t instanceof Array?(t=new i(t),n=t.size()):n=[],n.length){case 0:return o.clone(t);case 1:if(1==n[0])return o.clone(t.valueOf()[0]);throw new RangeError("Matrix must be square (size: "+a.format(n)+")");case 2:var s=n[0],u=n[1];if(s==u)return r(t.clone().valueOf(),s,u);throw new RangeError("Matrix must be square (size: "+a.format(n)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+a.format(n)+")")
  30. }}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(9),o=r.object,a=r.array.isArray,s=r.number.isNumber,u=r.number.isInteger;e.diag=function(r,t){var f,c,l,p;if(1!=arguments.length&&2!=arguments.length)throw new e.error.ArgumentsError("diag",arguments.length,1,2);if(t){if(t instanceof n&&(t=t.toNumber()),!s(t)||!u(t))throw new TypeError("Second parameter in function diag must be an integer")}else t=0;var m,h=t>0?t:0,g=0>t?-t:0;if(r instanceof i)m=!1;else{if(!a(r))throw new TypeError("First parameter in function diag must be a Matrix or Array");r=new i(r),m=!0}var d=r.size();switch(d.length){case 1:c=r.valueOf();var w=new i,x=c[0]instanceof n?new n(0):0;for(w.resize([c.length+g,c.length+h],x),f=w.valueOf(),p=c.length,l=0;p>l;l++)f[l+g][l+h]=o.clone(c[l]);return m?w.valueOf():w;case 2:for(c=[],f=r.valueOf(),p=Math.min(d[0]-g,d[1]-h),l=0;p>l;l++)c[l]=o.clone(f[l+g][l+h]);return m?c:new i(c);default:throw new RangeError("Matrix for function diag must be 2 dimensional")}}}},function(e,r,t){"use strict";e.exports=function(e){function r(r,t){var i=n.size(r),o=n.size(t),a=i[0];if(1!==i.length||1!==o.length)throw new RangeError("Vector expected");if(i[0]!=o[0])throw new RangeError("Vectors must have equal length ("+i[0]+" != "+o[0]+")");if(0==a)throw new RangeError("Cannot calculate the dot product of empty vectors");for(var s=0,u=0;a>u;u++)s=e.add(s,e.multiply(r[u],t[u]));return s}var n=t(153),i=t(9);e.dot=function(t,n){if(t instanceof i){if(n instanceof i)return r(t.toArray(),n.toArray());if(Array.isArray(n))return r(t.toArray(),n)}else if(Array.isArray(t)){if(n instanceof i)return r(t,n.toArray());if(Array.isArray(n))return r(t,n)}throw new e.error.UnsupportedTypeError("dot",e["typeof"](t),e["typeof"](n))}}},function(e,r,t){"use strict";e.exports=function(e,r){var n=t(160),i=e.type.BigNumber,o=t(9),a=t(13),s=n.number.isNumber,u=n.number.isInteger,f=Array.isArray;e.eye=function(t){var n=a.argsToArray(arguments),c=t instanceof o?!0:f(t)?!1:"matrix"===r.matrix;if(0==n.length)return c?new o:[];if(1==n.length)n[1]=n[0];else if(n.length>2)throw new e.error.ArgumentsError("eye",n.length,0,2);var l=n[0],p=n[1];if(l instanceof i&&(l=l.toNumber()),p instanceof i&&(p=p.toNumber()),!s(l)||!u(l)||1>l)throw new Error("Parameters in function eye must be positive integers");if(!s(p)||!u(p)||1>p)throw new Error("Parameters in function eye must be positive integers");var m=!1;n=n.map(function(e){return e instanceof i?(m=!0,e.toNumber()):e});var h=new o,g=m?new i(1):1,d=m?new i(0):0;h.resize(n,d);for(var w=e.min(n),x=h.valueOf(),y=0;w>y;y++)x[y][y]=g;return c?h:h.valueOf()}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=t(9),i=r.object,o=r.array,a=Array.isArray;e.flatten=function(r){if(1!==arguments.length)throw new e.error.ArgumentsError("flatten",arguments.length,1);if(r instanceof n){var t=i.clone(r.toArray()),s=o.flatten(t);return new n(s)}if(a(r))return o.flatten(i.clone(r));throw new e.error.UnsupportedTypeError("flatten",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){function r(r,t,n){var i,o,a,s,u;if(1==t){if(s=r[0][0],0==s)throw Error("Cannot calculate inverse, determinant is zero");return[[e._divide(1,s)]]}if(2==t){var f=e.det(r);if(0==f)throw Error("Cannot calculate inverse, determinant is zero");return[[e._divide(r[1][1],f),e._divide(e.unaryMinus(r[0][1]),f)],[e._divide(e.unaryMinus(r[1][0]),f),e._divide(r[0][0],f)]]}var c=r.concat();for(i=0;t>i;i++)c[i]=c[i].concat();for(var l=e.eye(t).valueOf(),p=0;n>p;p++){for(i=p;t>i&&0==c[i][p];)i++;if(i==t||0==c[i][p])throw Error("Cannot calculate inverse, determinant is zero");i!=p&&(u=c[p],c[p]=c[i],c[i]=u,u=l[p],l[p]=l[i],l[i]=u);var m=c[p],h=l[p];for(i=0;t>i;i++){var g=c[i],d=l[i];if(i!=p){if(0!=g[p]){for(a=e._divide(e.unaryMinus(g[p]),m[p]),o=p;n>o;o++)g[o]=e.add(g[o],e.multiply(a,m[o]));for(o=0;n>o;o++)d[o]=e.add(d[o],e.multiply(a,h[o]))}}else{for(a=m[p],o=p;n>o;o++)g[o]=e._divide(g[o],a);for(o=0;n>o;o++)d[o]=e._divide(d[o],a)}}}return l}var n=t(160),i=t(9);e.inv=function(t){if(1!=arguments.length)throw new e.error.ArgumentsError("inv",arguments.length,1);var o=e.size(t).valueOf();switch(o.length){case 0:return e._divide(1,t);case 1:if(1==o[0])return t instanceof i?new i([e._divide(1,t.valueOf()[0])]):[e._divide(1,t[0])];throw new RangeError("Matrix must be square (size: "+n.string.format(o)+")");case 2:var a=o[0],s=o[1];if(a==s)return t instanceof i?new i(r(t.valueOf(),a,s)):r(t,a,s);throw new RangeError("Matrix must be square (size: "+n.string.format(o)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+n.string.format(o)+")")}}}},function(e,r,t){"use strict";e.exports=function(e,r){var n=t(160),i=e.type.BigNumber,o=t(9),a=t(13),s=n.array,u=Array.isArray;e.ones=function(e){var t=a.argsToArray(arguments),n=e instanceof o?!0:u(e)?!1:"matrix"===r.matrix;if(0==t.length)return n?new o:[];var f=!1;t=t.map(function(e){return e instanceof i?(f=!0,e.toNumber()):e});var c=[],l=f?new i(1):1;return c=s.resize(c,t,l),n?new o(c):c}}},function(e,r,t){"use strict";e.exports=function(e,r){function n(e,r,t){var n=[],i=e;if(t>0)for(;r>i;)n.push(i),i+=t;else if(0>t)for(;i>r;)n.push(i),i+=t;return n}function i(e,r,t){var n=[],i=e;if(t>0)for(;r>=i;)n.push(i),i+=t;else if(0>t)for(;i>=r;)n.push(i),i+=t;return n}function o(e,r,t){var n=[],i=e.clone(),o=new f(0);if(t.gt(o))for(;i.lt(r);)n.push(i),i=i.plus(t);else if(t.lt(o))for(;i.gt(r);)n.push(i),i=i.plus(t);return n}function a(e,r,t){var n=[],i=e.clone(),o=new f(0);if(t.gt(o))for(;i.lte(r);)n.push(i),i=i.plus(t);else if(t.lt(o))for(;i.gte(r);)n.push(i),i=i.plus(t);return n}function s(e){var t=e.split(":"),n=null;if("bignumber"===r.number)try{n=t.map(function(e){return new f(e)})}catch(i){return null}else{n=t.map(function(e){return Number(e)});var o=n.some(function(e){return isNaN(e)});if(o)return null}switch(n.length){case 2:return{start:n[0],end:n[1],step:1};case 3:return{start:n[0],end:n[2],step:n[1]};default:return null}}var u=t(160),f=e.type.BigNumber,c=t(9),l=(t(13),u["boolean"].isBoolean),p=u.string.isString,m=u.number.isNumber;e.range=function(){var t,u,h,g=Array.prototype.slice.call(arguments),d=!1;switch(l(g[g.length-1])&&(d=g.pop()?!0:!1),g.length){case 1:if(!p(g[0]))throw new TypeError("Two or three numbers or a single string expected in function range");var w=s(g[0]);if(!w)throw new SyntaxError('String "'+g[0]+'" is no valid range');t=w.start,u=w.end,h=w.step;break;case 2:t=g[0],u=g[1],h=1;break;case 3:t=g[0],u=g[1],h=g[2];break;case 4:throw new TypeError("Parameter includeEnd must be a boolean");default:throw new e.error.ArgumentsError("range",arguments.length,2,4)}if(!(m(t)||t instanceof f))throw new TypeError("Parameter start must be a number");if(!(m(u)||u instanceof f))throw new TypeError("Parameter end must be a number");if(!(m(h)||h instanceof f))throw new TypeError("Parameter step must be a number");if(t instanceof f||u instanceof f||h instanceof f){var x=!0;t instanceof f||(t=f.convert(t)),u instanceof f||(u=f.convert(u)),h instanceof f||(h=f.convert(h)),t instanceof f&&u instanceof f&&h instanceof f||(x=!1,t instanceof f&&(t=t.toNumber()),u instanceof f&&(u=u.toNumber()),h instanceof f&&(h=h.toNumber()))}var y=x?d?a:o:d?i:n,v=y(t,u,h);return"array"===r.matrix?v:new c(v)}}},function(e,r,t){"use strict";e.exports=function(e,r){function n(r,t,n){if(void 0!==n){if(!c(n)||1!==n.length)throw new TypeError("Single character expected as defaultValue")}else n=" ";if(1!==t.length)throw new e.error.DimensionError(t.length,1);var i=t[0];if(!l(i)||!p(i))throw new TypeError("Invalid size, must contain positive integers (size: "+f.format(t)+")");if(r.length>i)return r.substring(0,i);if(r.length<i){for(var o=r,a=0,s=i-r.length;s>a;a++)o+=n;return o}return r}var i=t(160),o=e.type.BigNumber,a=t(9),s=i.array,u=i.object.clone,f=i.string,c=i.string.isString,l=i.number.isNumber,p=i.number.isInteger,m=s.isArray;e.resize=function(t,i,f){if(2!=arguments.length&&3!=arguments.length)throw new e.error.ArgumentsError("resize",arguments.length,2,3);var l=t instanceof a?!0:m(t)?!1:"array"!==r.matrix;if(t instanceof a&&(t=t.valueOf()),i instanceof a&&(i=i.valueOf()),i.length&&i[0]instanceof o&&(i=i.map(function(e){return e instanceof o?e.toNumber():e})),c(t))return n(t,i,f);if(0==i.length){for(;m(t);)t=t[0];return u(t)}m(t)||(t=[t]),t=u(t);var p=s.resize(t,i,f);return l?new a(p):p}}},function(e,r,t){"use strict";e.exports=function(e,r){var n=t(160),i=e.type.BigNumber,o=t(6),a=t(10),s=t(9),u=n.array,f=n.number.isNumber,c=n["boolean"].isBoolean,l=n.string.isString,p=o.isComplex,m=a.isUnit;e.size=function(t){if(1!=arguments.length)throw new e.error.ArgumentsError("size",arguments.length,1);var n="array"===r.matrix;if(f(t)||p(t)||m(t)||c(t)||null==t||t instanceof i)return n?[]:new s([]);if(l(t))return n?[t.length]:new s([t.length]);if(Array.isArray(t))return u.size(t);if(t instanceof s)return new s(t.size());throw new e.error.UnsupportedTypeError("size",e["typeof"](t))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=t(9),i=r.object,o=r.array,a=Array.isArray;e.squeeze=function(r){if(1!=arguments.length)throw new e.error.ArgumentsError("squeeze",arguments.length,1);if(a(r))return o.squeeze(i.clone(r));if(r instanceof n){var t=o.squeeze(r.toArray());return a(t)?new n(t):t}return i.clone(r)}}},function(e,r,t){"use strict";e.exports=function(e){function r(r,t){var i,o;if(l(r))return i=new s(r),o=i.subset(t),o&&o.valueOf();if(r instanceof s)return r.subset(t);if(c(r))return n(r,t);throw new e.error.UnsupportedTypeError("subset",e["typeof"](r))}function n(r,t){if(!(t instanceof u))throw new TypeError("Index expected");if(1!=t.size().length)throw new e.error.DimensionError(t.size().length,1);var n=r.length;f.validateIndex(t.min()[0],n),f.validateIndex(t.max()[0],n);var i=t.range(0),o="";return i.forEach(function(e){o+=r.charAt(e)}),o}function i(r,t,n,i){var a;if(l(r))return a=new s(e.clone(r)),a.subset(t,n,i),a.valueOf();if(r instanceof s)return r.clone().subset(t,n,i);if(c(r))return o(r,t,n,i);throw new e.error.UnsupportedTypeError("subset",e["typeof"](r))}function o(r,t,n,i){if(!(t instanceof u))throw new TypeError("Index expected");if(1!=t.size().length)throw new e.error.DimensionError(t.size().length,1);if(void 0!==i){if(!c(i)||1!==i.length)throw new TypeError("Single character expected as defaultValue")}else i=" ";var o=t.range(0),a=o.size()[0];if(a!=n.length)throw new e.error.DimensionError(o.size()[0],n.length);var s=r.length;f.validateIndex(t.min()[0]),f.validateIndex(t.max()[0]);for(var l=[],p=0;s>p;p++)l[p]=r.charAt(p);if(o.forEach(function(e,r){l[e]=n.charAt(r)}),l.length>s)for(p=s-1,a=l.length;a>p;p++)l[p]||(l[p]=i);return l.join("")}var a=t(160),s=t(9),u=t(8),f=a.array,c=a.string.isString,l=Array.isArray;e.subset=function(){switch(arguments.length){case 2:return r(arguments[0],arguments[1]);case 3:case 4:return i(arguments[0],arguments[1],arguments[2],arguments[3]);default:throw new e.error.ArgumentsError("subset",arguments.length,2,4)}}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=t(9),i=r.object,o=r.string;e.transpose=function(r){if(1!=arguments.length)throw new e.error.ArgumentsError("transpose",arguments.length,1);var t=e.size(r).valueOf();switch(t.length){case 0:return i.clone(r);case 1:return i.clone(r);case 2:var a,s=t[1],u=t[0],f=r instanceof n,c=r.valueOf(),l=[],p=i.clone;if(0===s)throw new RangeError("Cannot transpose a 2D matrix with no rows(size: "+o.format(t)+")");for(var m=0;s>m;m++){a=l[m]=[];for(var h=0;u>h;h++)a[h]=p(c[h][m])}return f?new n(l):l;default:throw new RangeError("Matrix must be two dimensional (size: "+o.format(t)+")")}}}},function(e,r,t){"use strict";e.exports=function(e,r){var n=t(160),i=e.type.BigNumber,o=t(9),a=t(13),s=n.array,u=Array.isArray;e.zeros=function(e){var t=a.argsToArray(arguments),n=e instanceof o?!0:u(e)?!1:"matrix"===r.matrix;if(0==t.length)return n?new o:[];var f=!1;t=t.map(function(e){return e instanceof i?(f=!0,e.toNumber()):e});var c=[],l=f?new i(0):0;return c=s.resize(c,t,l),n?new o(c):c}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(13),o=r.number.isNumber,a=r["boolean"].isBoolean,s=(r.number.isInteger,i.isCollection);e.factorial=function c(r){var t,l;if(1!=arguments.length)throw new e.error.ArgumentsError("factorial",arguments.length,1);if(o(r))return e.gamma(r+1);if(r instanceof n){if(!u(r)&&r.isFinite())return e.gamma(r.plus(1));if(!r.isFinite())return new n(r);if(r=r.toNumber(),r<f.length)return 21>r?new n(f[r]):f[r];var p=new n(1);t=new n(f.length),l=f[f.length-1];for(var m=f.length;r>m;++m)l=l.times(t),t=t.plus(p),f[m]=l;return f[r]=l.times(t)}if(a(r)||null===r)return 1;if(s(r))return i.deepMap(r,c);throw new e.error.UnsupportedTypeError("factorial",e["typeof"](r))};var u=function(e){return e.isInteger()&&(!e.isNegative()||e.isZero())},f=[1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200,1307674368e3,20922789888e3,355687428096e3,6402373705728e3,0x1b02b9306890000,243290200817664e4,new n("51090942171709440000")]}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=r["boolean"].isBoolean,s=i.isComplex,u=r.number.isNumber,f=r.number.isInteger,c=o.isCollection;e.gamma=function p(r){var t,m,h=4.7421875;if(1!=arguments.length)throw new e.error.ArgumentsError("gamma",arguments.length,1);if(u(r)){if(f(r)){if(0>=r)return isFinite(r)?1/0:0/0;if(r>171)return 1/0;for(var g=r-2,d=r-1;g>1;)d*=g,g--;return 0==d&&(d=1),d}if(.5>r)return Math.PI/(Math.sin(Math.PI*r)*p(1-r));if(r>=171.35)return 1/0;if(r>85){var w=r*r,x=w*r,y=x*r,v=y*r;return Math.sqrt(2*Math.PI/r)*Math.pow(r/Math.E,r)*(1+1/(12*r)+1/(288*w)-139/(51840*x)-571/(2488320*y)+163879/(209018880*v)+5246819/(75246796800*v*r))}--r,m=l[0];for(var b=1;b<l.length;++b)m+=l[b]/(r+b);return t=r+h+.5,Math.sqrt(2*Math.PI)*Math.pow(t,r+.5)*Math.exp(-t)*m}if(s(r)){if(0==r.im)return p(r.re);r=new i(r.re-1,r.im),m=new i(l[0],0);for(var b=1;b<l.length;++b){var E=r.re+b,N=E*E+r.im*r.im;0!=N?(m.re+=l[b]*E/N,m.im+=-(l[b]*r.im)/N):m.re=l[b]<0?-1/0:1/0}t=new i(r.re+h+.5,r.im);var A=Math.sqrt(2*Math.PI);r.re+=.5;var M=e.pow(t,r);0==M.im?M.re*=A:0==M.re?M.im*=A:(M.re*=A,M.im*=A);var T=Math.exp(-t.re);return t.re=T*Math.cos(-t.im),t.im=T*Math.sin(-t.im),e.multiply(e.multiply(M,t),m)}if(r instanceof n){if(r.isInteger())return r.isNegative()||r.isZero()?new n(1/0):e.factorial(r.minus(1));if(!r.isFinite())return new n(r.isNegative()?0/0:1/0)}if(a(r)||null===r)return r?1:1/0;if(c(r))return o.deepMap(r,p);throw new e.error.UnsupportedTypeError("gamma",e["typeof"](r))};var l=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22]}},function(e,r,t){"use strict";e.exports=function(e){var r=t(194)(e);e.random=r("uniform").random}},function(e,r,t){"use strict";e.exports=function(e){var r=t(194)(e);e.randomInt=r("uniform").randomInt}},function(e,r,t){"use strict";e.exports=function(e){var r=t(194)(e);e.pickRandom=r("uniform").pickRandom}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=r.number.isNumber,o=r.number.isInteger;e.permutations=function(r,t){var s,u,f=arguments.length;if(f>2)throw new e.error.ArgumentsError("permutations",arguments.length,2);if(i(r)){if(!o(r)||0>r)throw new TypeError("Positive integer value expected in function permutations");if(1==f)return e.factorial(r);if(2==f&&i(t)){if(!o(t)||0>t)throw new TypeError("Positive integer value expected in function permutations");if(t>r)throw new TypeError("second argument k must be less than or equal to first argument n");for(s=1,u=r-t+1;r>=u;u++)s*=u;return s}}if(r instanceof n){if(void 0===t&&a(r))return e.factorial(r);if(t=n.convert(t),!(t instanceof n&&a(r)&&a(t)))throw new TypeError("Positive integer value expected in function permutations");if(t.gt(r))throw new TypeError("second argument k must be less than or equal to first argument n");for(s=new n(1),u=r.minus(t).plus(1);u.lte(r);u=u.plus(1))s=s.times(u);return s}throw new e.error.UnsupportedTypeError("permutations",e["typeof"](r))};var a=function(e){return e.isInteger()&&e.gte(0)}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=(t(13),r.number.isNumber),o=r.number.isInteger;e.combinations=function(r,t){var s,u,f,c,l=arguments.length;if(2!=l)throw new e.error.ArgumentsError("combinations",arguments.length,2);if(i(r)){if(!o(r)||0>r)throw new TypeError("Positive integer value enpected in function combinations");if(t>r)throw new TypeError("k must be less than or equal to n");for(s=Math.max(t,r-t),u=1,f=1;r-s>=f;f++)u=u*(s+f)/f;return u}if(r instanceof n){if(t=n.convert(t),!(t instanceof n&&a(r)&&a(t)))throw new TypeError("Positive integer value expected in function combinations");if(t.gt(r))throw new TypeError("k must be less than n in function combinations");for(s=r.minus(t),t.lt(s)&&(s=t),u=new n(1),f=new n(1),c=r.minus(s);f.lte(c);f=f.plus(1))u=u.times(s.plus(f)).dividedBy(f);return u}throw new e.error.UnsupportedTypeError("combinations",e["typeof"](r))};var a=function(e){return e.isInteger()&&e.gte(0)}}},function(e,r,t){"use strict";e.exports=function(e,r){var n=t(160),i=e.type.BigNumber,o=t(6),a=t(10),s=t(13),u=n.number.isNumber,f=n.number.nearlyEqual,c=n["boolean"].isBoolean,l=n.string.isString,p=o.isComplex,m=a.isUnit,h=s.isCollection;e.compare=function g(t,n){if(2!=arguments.length)throw new e.error.ArgumentsError("compare",arguments.length,2);if(u(t)&&u(n))return f(t,n,r.epsilon)?0:t>n?1:-1;if(t instanceof i)return u(n)?n=i.convert(n):(c(n)||null===n)&&(n=new i(n?1:0)),n instanceof i?new i(t.cmp(n)):g(t.toNumber(),n);if(n instanceof i)return u(t)?t=i.convert(t):(c(t)||null===t)&&(t=new i(t?1:0)),t instanceof i?new i(t.cmp(n)):g(t,n.toNumber());if(m(t)&&m(n)){if(!t.equalBase(n))throw new Error("Cannot compare units with different base");return t.value>n.value?1:t.value<n.value?-1:0}if(h(t)||h(n))return s.deepMap2(t,n,g);if(l(t)||l(n))return t>n?1:n>t?-1:0;if(c(t)||null===t)return g(+t,n);if(c(n)||null===n)return g(t,+n);if(p(t)||p(n))throw new TypeError("No ordering relation is defined for complex numbers");throw new e.error.UnsupportedTypeError("compare",e["typeof"](t),e["typeof"](n))}}},function(e,r,t){"use strict";e.exports=function(e){function r(t,n){if(o(t)){if(o(n)){var i=t.length;if(i!==n.length)return!1;for(var a=0;i>a;a++)if(!r(t[a],n[a]))return!1;return!0}return!1}return o(n)?!1:e.equal(t,n)}var n=t(13),i=n.isCollection,o=Array.isArray;e.deepEqual=function(t,n){if(2!=arguments.length)throw new e.error.ArgumentsError("deepEqual",arguments.length,2);return i(t)||i(n)?r(t.valueOf(),n.valueOf()):e.equal(t,n)}}},function(e,r,t){"use strict";e.exports=function(e,r){var n=t(160),i=e.type.BigNumber,o=t(6),a=t(10),s=t(13),u=n.number.isNumber,f=n.number.nearlyEqual,c=n["boolean"].isBoolean,l=n.string.isString,p=o.isComplex,m=a.isUnit,h=s.isCollection;e.equal=function g(t,n){if(2!=arguments.length)throw new e.error.ArgumentsError("equal",arguments.length,2);if(u(t)){if(u(n))return f(t,n,r.epsilon);if(p(n))return f(t,n.re,r.epsilon)&&f(n.im,0,r.epsilon)}if(p(t)){if(u(n))return f(t.re,n,r.epsilon)&&f(t.im,0,r.epsilon);if(p(n))return f(t.re,n.re,r.epsilon)&&f(t.im,n.im,r.epsilon)}if(t instanceof i)return u(n)?n=i.convert(n):c(n)&&(n=new i(n?1:0)),n instanceof i?t.eq(n):g(t.toNumber(),n);if(n instanceof i)return u(t)?t=i.convert(t):c(t)&&(t=new i(t?1:0)),t instanceof i?t.eq(n):g(t,n.toNumber());if(m(t)&&m(n)){if(!t.equalBase(n))throw new Error("Cannot compare units with different base");return t.value==n.value}if(h(t)||h(n))return s.deepMap2(t,n,g);if(l(t)||l(n))return t==n;if(c(t))return g(+t,n);if(c(n))return g(t,+n);if(null===t)return null===n;if(null===n)return null===t;if(void 0===t)return void 0===n;if(void 0===n)return void 0===t;throw new e.error.UnsupportedTypeError("equal",e["typeof"](t),e["typeof"](n))}}},function(e,r,t){"use strict";e.exports=function(e,r){var n=t(160),i=e.type.BigNumber,o=t(6),a=t(10),s=t(13),u=n.number.isNumber,f=n.number.nearlyEqual,c=n["boolean"].isBoolean,l=n.string.isString,p=o.isComplex,m=a.isUnit,h=s.isCollection;e.larger=function g(t,n){if(2!=arguments.length)throw new e.error.ArgumentsError("larger",arguments.length,2);if(u(t)&&u(n))return!f(t,n,r.epsilon)&&t>n;if(t instanceof i)return u(n)?n=i.convert(n):(c(n)||null===n)&&(n=new i(n?1:0)),n instanceof i?t.gt(n):g(t.toNumber(),n);if(n instanceof i)return u(t)?t=i.convert(t):(c(t)||null===t)&&(t=new i(t?1:0)),t instanceof i?t.gt(n):g(t,n.toNumber());if(m(t)&&m(n)){if(!t.equalBase(n))throw new Error("Cannot compare units with different base");return t.value>n.value}if(h(t)||h(n))return s.deepMap2(t,n,g);if(l(t)||l(n))return t>n;if(c(t)||null===t)return g(+t,n);if(c(n)||null===n)return g(t,+n);if(p(t)||p(n))throw new TypeError("No ordering relation is defined for complex numbers");throw new e.error.UnsupportedTypeError("larger",e["typeof"](t),e["typeof"](n))}}},function(e,r,t){"use strict";e.exports=function(e,r){var n=t(160),i=e.type.BigNumber,o=t(6),a=t(10),s=t(13),u=n.number.isNumber,f=n.number.nearlyEqual,c=n["boolean"].isBoolean,l=n.string.isString,p=o.isComplex,m=a.isUnit,h=s.isCollection;e.largerEq=function g(t,n){if(2!=arguments.length)throw new e.error.ArgumentsError("largerEq",arguments.length,2);if(u(t)&&u(n))return f(t,n,r.epsilon)||t>n;if(t instanceof i)return u(n)?n=i.convert(n):(c(n)||null===n)&&(n=new i(n?1:0)),n instanceof i?t.gte(n):g(t.toNumber(),n);if(n instanceof i)return u(t)?t=i.convert(t):(c(t)||null===t)&&(t=new i(t?1:0)),t instanceof i?t.gte(n):g(t,n.toNumber());if(m(t)&&m(n)){if(!t.equalBase(n))throw new Error("Cannot compare units with different base");return t.value>=n.value}if(h(t)||h(n))return s.deepMap2(t,n,g);if(l(t)||l(n))return t>=n;if(c(t)||null===t)return g(+t,n);if(c(n)||null===n)return g(t,+n);if(p(t)||p(n))throw new TypeError("No ordering relation is defined for complex numbers");throw new e.error.UnsupportedTypeError("largerEq",e["typeof"](t),e["typeof"](n))},e.largereq=function(){throw new Error("Function largereq is renamed to largerEq")}}},function(e,r,t){"use strict";e.exports=function(e,r){var n=t(160),i=e.type.BigNumber,o=t(6),a=t(10),s=t(13),u=n.number.isNumber,f=n.number.nearlyEqual,c=n["boolean"].isBoolean,l=n.string.isString,p=o.isComplex,m=a.isUnit,h=s.isCollection;e.smaller=function g(t,n){if(2!=arguments.length)throw new e.error.ArgumentsError("smaller",arguments.length,2);if(u(t)&&u(n))return!f(t,n,r.epsilon)&&n>t;if(t instanceof i)return u(n)?n=i.convert(n):(c(n)||null===n)&&(n=new i(n?1:0)),n instanceof i?t.lt(n):g(t.toNumber(),n);if(n instanceof i)return u(t)?t=i.convert(t):(c(t)||null===t)&&(t=new i(t?1:0)),t instanceof i?t.lt(n):g(t,n.toNumber());if(m(t)&&m(n)){if(!t.equalBase(n))throw new Error("Cannot compare units with different base");return t.value<n.value}if(h(t)||h(n))return s.deepMap2(t,n,g);if(l(t)||l(n))return n>t;if(c(t)||null===t)return g(+t,n);if(c(n)||null===n)return g(t,+n);if(p(t)||p(n))throw new TypeError("No ordering relation is defined for complex numbers");throw new e.error.UnsupportedTypeError("smaller",e["typeof"](t),e["typeof"](n))}}},function(e,r,t){"use strict";e.exports=function(e,r){var n=t(160),i=e.type.BigNumber,o=t(6),a=t(10),s=t(13),u=n.number.isNumber,f=n.number.nearlyEqual,c=n["boolean"].isBoolean,l=n.string.isString,p=o.isComplex,m=a.isUnit,h=s.isCollection;e.smallerEq=function g(t,n){if(2!=arguments.length)throw new e.error.ArgumentsError("smallerEq",arguments.length,2);if(u(t)&&u(n))return f(t,n,r.epsilon)||n>t;if(t instanceof i)return u(n)?n=i.convert(n):(c(n)||null===n)&&(n=new i(n?1:0)),n instanceof i?t.lte(n):g(t.toNumber(),n);if(n instanceof i)return u(t)?t=i.convert(t):(c(t)||null===t)&&(t=new i(t?1:0)),t instanceof i?t.lte(n):g(t,n.toNumber());if(m(t)&&m(n)){if(!t.equalBase(n))throw new Error("Cannot compare units with different base");return t.value<=n.value}if(h(t)||h(n))return s.deepMap2(t,n,g);if(l(t)||l(n))return n>=t;if(c(t)||null===t)return g(+t,n);if(c(n)||null===n)return g(t,+n);if(p(t)||p(n))throw new TypeError("No ordering relation is defined for complex numbers");throw new e.error.UnsupportedTypeError("smallerEq",e["typeof"](t),e["typeof"](n))},e.smallereq=function(){throw new Error("Function smallereq is renamed to smallerEq")}}},function(e,r,t){"use strict";e.exports=function(e,r){var n=t(160),i=e.type.BigNumber,o=t(6),a=t(10),s=t(13),u=n.number.isNumber,f=n.number.nearlyEqual,c=n["boolean"].isBoolean,l=n.string.isString,p=o.isComplex,m=a.isUnit,h=s.isCollection;e.unequal=function g(t,n){if(2!=arguments.length)throw new e.error.ArgumentsError("unequal",arguments.length,2);if(u(t)){if(u(n))return!f(t,n,r.epsilon);if(p(n))return!f(t,n.re,r.epsilon)||!f(n.im,0,r.epsilon)}if(p(t)){if(u(n))return!f(t.re,n,r.epsilon)||!f(t.im,0,r.epsilon);if(p(n))return!f(t.re,n.re,r.epsilon)||!f(t.im,n.im,r.epsilon)}if(t instanceof i)return u(n)?n=i.convert(n):c(n)&&(n=new i(n?1:0)),n instanceof i?!t.eq(n):g(t.toNumber(),n);if(n instanceof i)return u(t)?t=i.convert(t):c(t)&&(t=new i(t?1:0)),t instanceof i?!t.eq(n):g(t,n.toNumber());if(m(t)&&m(n)){if(!t.equalBase(n))throw new Error("Cannot compare units with different base");return t.value!=n.value}if(h(t)||h(n))return s.deepMap2(t,n,g);if(l(t)||l(n))return t!=n;if(c(t))return g(+t,n);if(c(n))return g(t,+n);if(null===t)return null!==n;if(null===n)return null!==t;if(void 0===t)return void 0!==n;if(void 0===n)return void 0!==t;throw new e.error.UnsupportedTypeError("unequal",e["typeof"](t),e["typeof"](n))}}},function(e,r,t){"use strict";e.exports=function(e){function r(r,t){return e.smaller(r,t)?r:t}function n(r){var t=void 0;if(i.deepForEach(r,function(r){(void 0===t||e.smaller(r,t))&&(t=r)}),void 0===t)throw new Error("Cannot calculate min of an empty array");return t}var i=(t(9),t(13)),o=i.isCollection;e.min=function(e){if(0==arguments.length)throw new SyntaxError("Function min requires one or more parameters (0 provided)");if(o(e)){if(1==arguments.length)return n(e);if(2==arguments.length)return i.reduce(arguments[0],arguments[1],r);throw new SyntaxError("Wrong number of parameters")}return n(arguments)}}},function(e,r,t){"use strict";e.exports=function(e){function r(r,t){return e.larger(r,t)?r:t}function n(r){var t=void 0;if(i.deepForEach(r,function(r){(void 0===t||e.larger(r,t))&&(t=r)}),void 0===t)throw new Error("Cannot calculate max of an empty array");return t}var i=(t(9),t(13)),o=i.isCollection;e.max=function(e){if(0==arguments.length)throw new SyntaxError("Function max requires one or more parameters (0 provided)");if(o(e)){if(1==arguments.length)return n(e);if(2==arguments.length)return i.reduce(arguments[0],arguments[1],r);throw new SyntaxError("Wrong number of parameters")}return n(arguments)}}},function(e,r,t){"use strict";e.exports=function(e){function r(r,t){var n=i.reduce(r,t,e.add),o=s(r)?a(r):r.size();return e.divide(n,o[t])}function n(r){var t=0,n=0;if(i.deepForEach(r,function(r){t=e.add(t,r),n++}),0===n)throw new Error("Cannot calculate mean of an empty array");return e.divide(t,n)}var i=(t(9),t(13)),o=i.isCollection,a=t(153).size,s=Array.isArray;e.mean=function(e){if(0==arguments.length)throw new SyntaxError("Function mean requires one or more parameters (0 provided)");if(o(e)){if(1==arguments.length)return n(e);if(2==arguments.length)return r(arguments[0],arguments[1]);throw new SyntaxError("Wrong number of parameters")}return n(arguments)}}},function(e,r,t){"use strict";e.exports=function(e){function r(r){var t=u(r);t.sort(e.compare);var o=t.length;if(0==o)throw new Error("Cannot calculate median of an empty array");if(o%2==0){var s=t[o/2-1],f=t[o/2];if(!(a(s)||s instanceof i||s instanceof n))throw new e.error.UnsupportedTypeError("median",e["typeof"](s));if(!(a(f)||f instanceof i||f instanceof n))throw new e.error.UnsupportedTypeError("median",e["typeof"](f));return e.divide(e.add(s,f),2)}var c=t[(o-1)/2];if(!(a(c)||c instanceof i||c instanceof n))throw new e.error.UnsupportedTypeError("median",e["typeof"](c));return c}var n=(t(9),t(10)),i=e.type.BigNumber,o=t(13),a=t(4).isNumber,s=o.isCollection,u=t(153).flatten;e.median=function(e){if(0==arguments.length)throw new SyntaxError("Function median requires one or more parameters (0 provided)");if(s(e)){if(1==arguments.length)return r(e.valueOf());throw 2==arguments.length?new Error("median(A, dim) is not yet supported"):new SyntaxError("Wrong number of parameters")}return r(Array.prototype.slice.call(arguments))}}},function(e,r,t){"use strict";e.exports=function(e){function r(r){var t=void 0;if(n.deepForEach(r,function(r){t=void 0===t?r:e.multiply(t,r)}),void 0===t)throw new Error("Cannot calculate prod of an empty array");return t}var n=(t(9),t(13)),i=n.isCollection;e.prod=function(e){if(0==arguments.length)throw new SyntaxError("Function prod requires one or more parameters (0 provided)");if(i(e)){if(1==arguments.length)return r(e);throw 2==arguments.length?new Error("prod(A, dim) is not yet supported"):new SyntaxError("Wrong number of parameters")}return r(arguments)}}},function(e){"use strict";e.exports=function(e){e.std=function(){if(0==arguments.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");var r=e["var"].apply(null,arguments);return e.sqrt(r)}}},function(e,r,t){"use strict";e.exports=function(e){function r(r){var t=void 0;if(n.deepForEach(r,function(r){t=void 0===t?r:e.add(t,r)}),void 0===t)throw new Error("Cannot calculate sum of an empty array");return t}var n=(t(9),t(13)),i=n.isCollection;e.sum=function(e){if(0==arguments.length)throw new SyntaxError("Function sum requires one or more parameters (0 provided)");if(i(e)){if(1==arguments.length)return r(e);throw 2==arguments.length?new Error("sum(A, dim) is not yet supported"):new SyntaxError("Wrong number of parameters")}return r(arguments)}}},function(e,r,t){"use strict";e.exports=function(e){function r(r,t){var o=0,a=0;if(i.deepForEach(r,function(r){o=e.add(o,r),a++}),0===a)throw new Error("Cannot calculate var of an empty array");var s=e.divide(o,a);switch(o=0,i.deepForEach(r,function(r){var t=e.subtract(r,s);o=e.add(o,e.multiply(t,t))}),t){case"uncorrected":return e.divide(o,a);case"biased":return e.divide(o,a+1);case"unbiased":var u=o instanceof n?new n(0):0;return 1==a?u:e.divide(o,a-1);default:throw new Error('Unknown normalization "'+t+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}var n=(t(9),e.type.BigNumber),i=t(13),o=i.isCollection,a=t(176).isString,s="unbiased";e["var"]=function(e,t){if(0==arguments.length)throw new SyntaxError("Function var requires one or more parameters (0 provided)");if(o(e)){if(1==arguments.length)return r(e,s);if(2==arguments.length){if(!a(t))throw new Error("String expected for parameter normalization");return r(e,t)}throw new SyntaxError("Wrong number of parameters")}return r(arguments,s)}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=r.number.isNumber,s=r["boolean"].isBoolean,u=i.isComplex,f=o.isCollection;e.acos=function c(r){if(1!=arguments.length)throw new e.error.ArgumentsError("acos",arguments.length,1);if(a(r))return r>=-1&&1>=r?Math.acos(r):c(new i(r,0));if(u(r)){var t=new i(r.im*r.im-r.re*r.re+1,-2*r.re*r.im),l=e.sqrt(t),p=new i(l.re-r.im,l.im+r.re),m=e.log(p);return new i(1.5707963267948966-m.im,m.re)}if(f(r))return o.deepMap(r,c);if(s(r)||null===r)return Math.acos(r);if(r instanceof n)return c(r.toNumber());throw new e.error.UnsupportedTypeError("acos",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=r.number.isNumber,s=r["boolean"].isBoolean,u=i.isComplex,f=o.isCollection;e.asin=function c(r){if(1!=arguments.length)throw new e.error.ArgumentsError("asin",arguments.length,1);
  31. if(a(r))return r>=-1&&1>=r?Math.asin(r):c(new i(r,0));if(u(r)){var t=r.re,l=r.im,p=new i(l*l-t*t+1,-2*t*l),m=e.sqrt(p),h=new i(m.re-l,m.im+t),g=e.log(h);return new i(g.im,-g.re)}if(f(r))return o.deepMap(r,c);if(s(r)||null===r)return Math.asin(r);if(r instanceof n)return c(r.toNumber());throw new e.error.UnsupportedTypeError("asin",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=r.number.isNumber,s=r["boolean"].isBoolean,u=i.isComplex,f=o.isCollection;e.atan=function c(r){if(1!=arguments.length)throw new e.error.ArgumentsError("atan",arguments.length,1);if(a(r))return Math.atan(r);if(u(r)){var t=r.re,l=r.im,p=t*t+(1-l)*(1-l),m=new i((1-l*l-t*t)/p,-2*t/p),h=e.log(m);return new i(-.5*h.im,.5*h.re)}if(f(r))return o.deepMap(r,c);if(s(r)||null===r)return Math.atan(r);if(r instanceof n)return c(r.toNumber());throw new e.error.UnsupportedTypeError("atan",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(13),a=r.number.isNumber,s=r["boolean"].isBoolean,u=(i.isComplex,o.isCollection);e.atan2=function f(r,t){if(2!=arguments.length)throw new e.error.ArgumentsError("atan2",arguments.length,2);if(a(r)&&a(t))return Math.atan2(r,t);if(u(r)||u(t))return o.deepMap2(r,t,f);if(s(r)||null===r)return f(+r,t);if(s(t)||null===t)return f(r,+t);if(r instanceof n)return f(r.toNumber(),t);if(t instanceof n)return f(r,t.toNumber());throw new e.error.UnsupportedTypeError("atan2",e["typeof"](r),e["typeof"](t))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(10),a=t(13),s=r.number.isNumber,u=r["boolean"].isBoolean,f=i.isComplex,c=o.isUnit,l=a.isCollection;e.cos=function p(r){if(1!=arguments.length)throw new e.error.ArgumentsError("cos",arguments.length,1);if(s(r))return Math.cos(r);if(f(r))return new i(Math.cos(r.re)*e.cosh(-r.im),Math.sin(r.re)*e.sinh(-r.im));if(c(r)){if(!r.hasBase(o.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cos is no angle");return Math.cos(r.value)}if(l(r))return a.deepMap(r,p);if(u(r)||null===r)return Math.cos(r);if(r instanceof n)return p(r.toNumber());throw new e.error.UnsupportedTypeError("cos",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(10),a=t(13),s=r.number.isNumber,u=r["boolean"].isBoolean,f=i.isComplex,c=o.isUnit,l=a.isCollection;e.cosh=function p(r){if(1!=arguments.length)throw new e.error.ArgumentsError("cosh",arguments.length,1);if(s(r))return(Math.exp(r)+Math.exp(-r))/2;if(f(r)){var t=Math.exp(r.re),m=Math.exp(-r.re);return new i(Math.cos(r.im)*(t+m)/2,Math.sin(r.im)*(t-m)/2)}if(c(r)){if(!r.hasBase(o.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cosh is no angle");return p(r.value)}if(l(r))return a.deepMap(r,p);if(u(r)||null===r)return p(r?1:0);if(r instanceof n)return p(r.toNumber());throw new e.error.UnsupportedTypeError("cosh",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(10),a=t(13),s=r.number.isNumber,u=r["boolean"].isBoolean,f=i.isComplex,c=o.isUnit,l=a.isCollection;e.cot=function p(r){if(1!=arguments.length)throw new e.error.ArgumentsError("cot",arguments.length,1);if(s(r))return 1/Math.tan(r);if(f(r)){var t=Math.exp(-4*r.im)-2*Math.exp(-2*r.im)*Math.cos(2*r.re)+1;return new i(2*Math.exp(-2*r.im)*Math.sin(2*r.re)/t,(Math.exp(-4*r.im)-1)/t)}if(c(r)){if(!r.hasBase(o.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return 1/Math.tan(r.value)}if(l(r))return a.deepMap(r,p);if(u(r)||null===r)return p(+r);if(r instanceof n)return p(r.toNumber());throw new e.error.UnsupportedTypeError("cot",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(10),a=t(13),s=r.number.isNumber,u=r["boolean"].isBoolean,f=i.isComplex,c=o.isUnit,l=a.isCollection;e.coth=function p(r){if(1!=arguments.length)throw new e.error.ArgumentsError("coth",arguments.length,1);if(s(r)){var t=Math.exp(2*r);return(t+1)/(t-1)}if(f(r)){var m=Math.exp(2*r.re),h=m*Math.cos(2*r.im),g=m*Math.sin(2*r.im),d=(h-1)*(h-1)+g*g;return new i(((h+1)*(h-1)+g*g)/d,-2*g/d)}if(c(r)){if(!r.hasBase(o.BASE_UNITS.ANGLE))throw new TypeError("Unit in function coth is no angle");return p(r.value)}if(l(r))return a.deepMap(r,p);if(u(r)||null===r)return p(r?1:0);if(r instanceof n)return p(r.toNumber());throw new e.error.UnsupportedTypeError("coth",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(10),a=t(13),s=r.number.isNumber,u=r["boolean"].isBoolean,f=i.isComplex,c=o.isUnit,l=a.isCollection;e.csc=function p(r){if(1!=arguments.length)throw new e.error.ArgumentsError("csc",arguments.length,1);if(s(r))return 1/Math.sin(r);if(f(r)){var t=.25*(Math.exp(-2*r.im)+Math.exp(2*r.im))-.5*Math.cos(2*r.re);return new i(.5*Math.sin(r.re)*(Math.exp(-r.im)+Math.exp(r.im))/t,.5*Math.cos(r.re)*(Math.exp(-r.im)-Math.exp(r.im))/t)}if(c(r)){if(!r.hasBase(o.BASE_UNITS.ANGLE))throw new TypeError("Unit in function csc is no angle");return 1/Math.sin(r.value)}if(l(r))return a.deepMap(r,p);if(u(r)||null===r)return p(+r);if(r instanceof n)return p(r.toNumber());throw new e.error.UnsupportedTypeError("csc",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(10),a=t(13),s=r.number,u=r.number.isNumber,f=r["boolean"].isBoolean,c=i.isComplex,l=o.isUnit,p=a.isCollection;e.csch=function m(r){if(1!=arguments.length)throw new e.error.ArgumentsError("csch",arguments.length,1);if(u(r))return 0==r?Number.NaN:Math.abs(2/(Math.exp(r)-Math.exp(-r)))*s.sign(r);if(c(r)){var t=Math.exp(r.re),h=Math.exp(-r.re),g=Math.cos(r.im)*(t-h),d=Math.sin(r.im)*(t+h),w=g*g+d*d;return new i(2*g/w,-2*d/w)}if(l(r)){if(!r.hasBase(o.BASE_UNITS.ANGLE))throw new TypeError("Unit in function csch is no angle");return m(r.value)}if(p(r))return a.deepMap(r,m);if(f(r)||null===r)return m(r?1:0);if(r instanceof n)return m(r.toNumber());throw new e.error.UnsupportedTypeError("csch",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(10),a=t(13),s=r.number.isNumber,u=r["boolean"].isBoolean,f=i.isComplex,c=o.isUnit,l=a.isCollection;e.sec=function p(r){if(1!=arguments.length)throw new e.error.ArgumentsError("sec",arguments.length,1);if(s(r))return 1/Math.cos(r);if(f(r)){var t=.25*(Math.exp(-2*r.im)+Math.exp(2*r.im))+.5*Math.cos(2*r.re);return new i(.5*Math.cos(r.re)*(Math.exp(-r.im)+Math.exp(r.im))/t,.5*Math.sin(r.re)*(Math.exp(r.im)-Math.exp(-r.im))/t)}if(c(r)){if(!r.hasBase(o.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sec is no angle");return 1/Math.cos(r.value)}if(l(r))return a.deepMap(r,p);if(u(r)||null===r)return p(+r);if(r instanceof n)return p(r.toNumber());throw new e.error.UnsupportedTypeError("sec",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(10),a=t(13),s=r.number.isNumber,u=r["boolean"].isBoolean,f=i.isComplex,c=o.isUnit,l=a.isCollection;e.sech=function p(r){if(1!=arguments.length)throw new e.error.ArgumentsError("sech",arguments.length,1);if(s(r))return 2/(Math.exp(r)+Math.exp(-r));if(f(r)){var t=Math.exp(r.re),m=Math.exp(-r.re),h=Math.cos(r.im)*(t+m),g=Math.sin(r.im)*(t-m),d=h*h+g*g;return new i(2*h/d,-2*g/d)}if(c(r)){if(!r.hasBase(o.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sech is no angle");return p(r.value)}if(l(r))return a.deepMap(r,p);if(u(r)||null===r)return p(r?1:0);if(r instanceof n)return p(r.toNumber());throw new e.error.UnsupportedTypeError("sech",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(10),a=t(13),s=r.number.isNumber,u=r["boolean"].isBoolean,f=i.isComplex,c=o.isUnit,l=a.isCollection;e.sin=function p(r){if(1!=arguments.length)throw new e.error.ArgumentsError("sin",arguments.length,1);if(s(r))return Math.sin(r);if(f(r))return new i(Math.sin(r.re)*e.cosh(-r.im),Math.cos(r.re)*e.sinh(r.im));if(c(r)){if(!r.hasBase(o.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sin is no angle");return Math.sin(r.value)}if(l(r))return a.deepMap(r,p);if(u(r)||null===r)return Math.sin(r);if(r instanceof n)return p(r.toNumber());throw new e.error.UnsupportedTypeError("sin",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(10),a=t(13),s=r.number.isNumber,u=r["boolean"].isBoolean,f=i.isComplex,c=o.isUnit,l=a.isCollection;e.sinh=function p(r){if(1!=arguments.length)throw new e.error.ArgumentsError("sinh",arguments.length,1);if(s(r))return Math.abs(r)<1?r+r*r*r/6+r*r*r*r*r/120:(Math.exp(r)-Math.exp(-r))/2;if(f(r)){var t=Math.cos(r.im),m=Math.sin(r.im),h=Math.exp(r.re),g=Math.exp(-r.re);return new i(t*(h-g)/2,m*(h+g)/2)}if(c(r)){if(!r.hasBase(o.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sinh is no angle");return p(r.value)}if(l(r))return a.deepMap(r,p);if(u(r)||null===r)return p(r?1:0);if(r instanceof n)return p(r.toNumber());throw new e.error.UnsupportedTypeError("sinh",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(10),a=t(13),s=r.number.isNumber,u=r["boolean"].isBoolean,f=i.isComplex,c=o.isUnit,l=a.isCollection;e.tan=function p(r){if(1!=arguments.length)throw new e.error.ArgumentsError("tan",arguments.length,1);if(s(r))return Math.tan(r);if(f(r)){var t=Math.exp(-4*r.im)+2*Math.exp(-2*r.im)*Math.cos(2*r.re)+1;return new i(2*Math.exp(-2*r.im)*Math.sin(2*r.re)/t,(1-Math.exp(-4*r.im))/t)}if(c(r)){if(!r.hasBase(o.BASE_UNITS.ANGLE))throw new TypeError("Unit in function tan is no angle");return Math.tan(r.value)}if(l(r))return a.deepMap(r,p);if(u(r)||null===r)return Math.tan(r);if(r instanceof n)return p(r.toNumber());throw new e.error.UnsupportedTypeError("tan",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=e.type.BigNumber,i=t(6),o=t(10),a=t(13),s=r.number.isNumber,u=r["boolean"].isBoolean,f=i.isComplex,c=o.isUnit,l=a.isCollection;e.tanh=function p(r){if(1!=arguments.length)throw new e.error.ArgumentsError("tanh",arguments.length,1);if(s(r)){var t=Math.exp(2*r);return(t-1)/(t+1)}if(f(r)){var m=Math.exp(2*r.re),h=m*Math.cos(2*r.im),g=m*Math.sin(2*r.im),d=(h+1)*(h+1)+g*g;return new i(((h-1)*(h+1)+g*g)/d,2*g/d)}if(c(r)){if(!r.hasBase(o.BASE_UNITS.ANGLE))throw new TypeError("Unit in function tanh is no angle");return p(r.value)}if(l(r))return a.deepMap(r,p);if(u(r)||null===r)return p(r?1:0);if(r instanceof n)return p(r.toNumber());throw new e.error.UnsupportedTypeError("tanh",e["typeof"](r))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=t(10),i=t(13),o=r.string.isString,a=n.isUnit,s=i.isCollection;e.to=function u(r,t){if(2!=arguments.length)throw new e.error.ArgumentsError("to",arguments.length,2);if(a(r)&&(a(t)||o(t)))return r.to(t);if(s(r)||s(t))return i.deepMap2(r,t,u);throw new e.error.UnsupportedTypeError("to",e["typeof"](r),e["typeof"](t))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=r.object;e.clone=function(r){if(1!=arguments.length)throw new e.error.ArgumentsError("clone",arguments.length,1);return n.clone(r)}}},function(e,r,t){"use strict";e.exports=function(e){function r(e,r){if("function"==typeof r)return e.filter(function(e){return r(e)});if(r instanceof RegExp)return e.filter(function(e){return r.test(e)});throw new TypeError("Function or RegExp expected")}var n=t(9);e.filter=function(t,i){if(2!==arguments.length)throw new e.error.ArgumentsError("filter",arguments.length,2);if(t instanceof n){var o=t.size();if(o.length>1)throw new Error("Only one dimensional matrices supported");return new n(r(t.toArray(),i))}if(Array.isArray(t))return r(t,i);throw new e.error.UnsupportedTypeError("filter",e["typeof"](t),e["typeof"](compare))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=r.string;e.format=function(r,t){var i=arguments.length;if(1!==i&&2!==i)throw new e.error.ArgumentsError("format",i,1,2);return n.format(r,t)}}},function(e,r,t){"use strict";e.exports=function(e){function r(r,t,n){(n.override||void 0===e[r])&&(e[r]=n.wrap&&"function"==typeof t?function(){for(var r=[],n=0,i=arguments.length;i>n;n++){var o=arguments[n];r[n]=o&&o.valueOf()}return t.apply(e,r)}:t,e.chaining.Chain.createProxy(r,t))}function n(e){return"function"==typeof e||s(e)||u(e)||f(e)||c(e)}var i=t(160),o=t(6),a=t(10),s=i.number.isNumber,u=i.string.isString,f=o.isComplex,c=a.isUnit;e["import"]=function l(i,o){var a=arguments.length;if(1!=a&&2!=a)throw new e.error.ArgumentsError("import",a,1,2);var s,f={override:o&&o.override||!1,wrap:o&&o.wrap||!1};if(u(i)){var c=t(195)(i);l(c,o)}else{if("object"!=typeof i)throw new TypeError("Object or module name expected");for(s in i)if(i.hasOwnProperty(s)){var p=i[s];n(p)?r(s,p,f):l(p,o)}}}}},function(e,r,t){"use strict";e.exports=function(e){function r(e,r){var t=function(n,i){return Array.isArray(n)?n.map(function(e,r){return t(e,i.concat(r))}):r(n,i,e)};return t(e,[])}var n=t(9);e.map=function(t,i){if(2!=arguments.length)throw new e.error.ArgumentsError("map",arguments.length,2);if(Array.isArray(t))return r(t,i);if(t instanceof n)return t.map(i);throw new e.error.UnsupportedTypeError("map",e["typeof"](t))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(160),n=r.string.isString;e.print=function(r,t,i){var o=arguments.length;if(2!=o&&3!=o)throw new e.error.ArgumentsError("print",o,2,3);if(!n(r))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 r.replace(/\$([\w\.]+)/g,function(r,o){for(var a=o.split("."),s=t[a.shift()];a.length&&void 0!==s;){var u=a.shift();s=u?s[u]:s+"."}return void 0!==s?n(s)?s:e.format(s,i):r})}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(9);e.sort=function(t,n){var i=null;if(1===arguments.length)i=e.compare;else{if(2!==arguments.length)throw new e.error.ArgumentsError("sort",arguments.length,1,2);if("function"==typeof n)i=n;else if("asc"===n)i=e.compare;else{if("desc"!==n)throw new e.error.UnsupportedTypeError("sort",e["typeof"](t),e["typeof"](n));i=function(r,t){return-e.compare(r,t)}}}if(t instanceof r){var o=t.size();if(o.length>1)throw new Error("Only one dimensional matrices supported");return new r(t.toArray().sort(i))}if(Array.isArray(t))return t.sort(i);throw new e.error.UnsupportedTypeError("sort",e["typeof"](t),e["typeof"](n))}}},function(e,r,t){"use strict";e.exports=function(e){var r=t(196),n=t(6),i=t(9),o=t(10),a=t(8),s=t(7),u=t(11);e["typeof"]=function(t){if(1!=arguments.length)throw new e.error.ArgumentsError("typeof",arguments.length,1);var f=r.type(t);if("object"===f){if(t instanceof n)return"complex";if(t instanceof i)return"matrix";if(t instanceof o)return"unit";if(t instanceof a)return"index";if(t instanceof s)return"range";if(t instanceof u)return"help";if(t instanceof e.type.BigNumber)return"bignumber";if(t instanceof e.chaining.Chain)return"chain"}return f}}},function(e,r,t){"use strict";e.exports=function(e){function r(e,r){var t=function(n,i){Array.isArray(n)?n.forEach(function(e,r){t(e,i.concat(r))}):r(n,i,e)};t(e,[])}var n=t(9);e.forEach=function(t,i){if(2!=arguments.length)throw new e.error.ArgumentsError("forEach",arguments.length,2);if(Array.isArray(t))return r(t,i);if(t instanceof n)return t.forEach(i);throw new e.error.UnsupportedTypeError("forEach",e["typeof"](t))}}},function(e,r,t){"use strict";function n(e,t,n){var a,s,u=e.constructor,f=+(e.s<0),c=+(t.s<0);if(f){a=o(i(r.not(e)));for(var l=0;l<a.length;++l)a[l]^=1}else a=o(i(e));if(c){s=o(i(r.not(t)));for(var l=0;l<s.length;++l)s[l]^=1}else s=o(i(t));var p,m,h;a.length<=s.length?(p=a,m=s,h=f):(p=s,m=a,h=c);var g=p.length,d=m.length,w=1^n(f,c),x=new u(1^w),y=u.ONE,v=new u(2),b=u.precision;for(u.precision=1e9;g>0;)n(p[--g],m[--d])==w&&(x=x.plus(y)),y=y.times(v);for(;d>0;)n(h,m[--d])==w&&(x=x.plus(y)),y=y.times(v);return u.precision=b,0==w&&(x.s=-x.s),x}function i(e){for(var r=e.c,t=r[0]+"",n=1;n<r.length;++n){for(var i=r[n]+"",o=7-i.length;o--;)i="0"+i;t+=i}var a;for(a=t.length-1;"0"==t.charAt(a);--a);var s=e.e,u=t.slice(0,a+1||1),f=u.length;if(s>0)if(++s>f)for(s-=f;s--;u+="0");else f>s&&(u=u.slice(0,s)+"."+u.slice(s));return u}function o(e){for(var r=[0],t=0;t<e.length;){for(var n=r.length;n--;r[n]*=10);r[0]+=e.charAt(t++)<<0;for(var i=0;i<r.length;++i)r[i]>1&&(null==r[i+1]&&(r[i+1]=0),r[i+1]+=r[i]>>1,r[i]&=1)}return r.reverse()}{var a=t(159),s=t(4).isNumber;t(4).digits}r.isBigNumber=function(e){return e instanceof a},r.e=function(e){var r=a.constructor({precision:e});return new r(1).exp()},r.phi=function(e){var r=a.constructor({precision:e});return new r(1).plus(new r(5).sqrt()).div(2)},r.arctan=function(e){for(var r=e,t=0/0,n=e.times(e),i=e,o=-1,a=3;!r.equals(t);a+=2)i=i.times(n),t=r,r=o>0?r.plus(i.div(a)):r.minus(i.div(a)),o=-o;return r},r.pi=function(e){var t=a.constructor({precision:e+4}),n=new t(4).times(r.arctan(new t(1).div(5))).minus(r.arctan(new t(1).div(239)));return t.config({precision:e}),new t(4).times(n)},r.tau=function(e){var t=r.pi(e+2),n=a.constructor({precision:e});return new n(2).times(t)},r.and=function(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Parameters in function bitAnd must be integer numbers");var t=e.constructor;if(e.isNaN()||r.isNaN())return new t(0/0);if(e.isZero()||r.eq(-1)||e.eq(r))return e;if(r.isZero()||e.eq(-1))return r;if(!e.isFinite()||!r.isFinite()){if(!e.isFinite()&&!r.isFinite())return e.isNegative()==r.isNegtive()?e:new t(0);if(!e.isFinite())return r.isNegative()?e:e.isNegative()?new t(0):r;if(!r.isFinite())return e.isNegative()?r:r.isNegative()?new t(0):e}return n(e,r,function(e,r){return e&r})},r.leftShift=function(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Parameters in function leftShift must be integer numbers");var t=e.constructor;return e.isNaN()||r.isNaN()||r.isNegative()&&!r.isZero()?new t(0/0):e.isZero()||r.isZero()?e:e.isFinite()||r.isFinite()?e.times(r.lt(55)?Math.pow(2,r.toNumber())+"":new t(2).pow(r)):new t(0/0)},r.not=function(e){if(e.isFinite()&&!e.isInteger())throw new Error("Parameter in function bitNot must be integer numbers");var r=e.constructor,t=r.precision;r.precision=1e9;var e=e.plus(r.ONE);return e.s=-e.s||null,r.precision=t,e},r.or=function(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Parameters in function bitOr must be integer numbers");var t=e.constructor;if(e.isNaN()||r.isNaN())return new t(0/0);var i=new t(-1);return e.isZero()||r.eq(i)||e.eq(r)?r:r.isZero()||e.eq(i)?e:e.isFinite()&&r.isFinite()?n(e,r,function(e,r){return e|r}):!e.isFinite()&&!e.isNegative()&&r.isNegative()||e.isNegative()&&!r.isNegative()&&!r.isFinite()?i:e.isNegative()&&r.isNegative()?e.isFinite()?e:r:e.isFinite()?r:e},r.rightShift=function(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Parameters in function rightArithShift must be integer numbers");var t=e.constructor;return e.isNaN()||r.isNaN()||r.isNegative()&&!r.isZero()?new t(0/0):e.isZero()||r.isZero()?e:r.isFinite()?r.lt(55)?e.div(Math.pow(2,r.toNumber())+"").floor():e.div(new t(2).pow(r)).floor():new t(e.isNegative()?-1:e.isFinite()?0:0/0)},r.xor=function(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Parameters in function bitXor must be integer numbers");var i=e.constructor;if(e.isNaN()||t.isNaN())return new i(0/0);if(e.isZero())return t;if(t.isZero())return e;if(e.eq(t))return new i(0);var o=new i(-1);return e.eq(o)?r.not(t):t.eq(o)?r.not(e):e.isFinite()&&t.isFinite()?n(e,t,function(e,r){return e^r}):e.isFinite()||t.isFinite()?new i(e.isNegative()==t.isNegative()?1/0:-1/0):o},r.format=function(e,t){if("function"==typeof t)return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var n="auto",i=void 0;switch(void 0!==t&&(t.notation&&(n=t.notation),s(t)?i=t:t.precision&&(i=t.precision)),n){case"fixed":return r.toFixed(e,i);case"exponential":return r.toExponential(e,i);case"auto":var o=.001,a=1e5;t&&t.exponential&&(void 0!==t.exponential.lower&&(o=t.exponential.lower),void 0!==t.exponential.upper&&(a=t.exponential.upper));{({toExpNeg:e.constructor.toExpNeg,toExpPos:e.constructor.toExpPos})}if(e.constructor.config({toExpNeg:Math.round(Math.log(o)/Math.LN10),toExpPos:Math.round(Math.log(a)/Math.LN10)}),e.isZero())return"0";var u,f=e.abs();return u=f.gte(o)&&f.lt(a)?e.toSignificantDigits(i).toFixed():r.toExponential(e,i),u.replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],r=arguments[4];return"."!==e?e+r:r});default:throw new Error('Unknown notation "'+n+'". Choose "auto", "exponential", or "fixed".')}},r.toExponential=function(e,r){return void 0!==r?e.toExponential(r-1):e.toExponential()},r.toFixed=function(e,r){return e.toFixed(r||0)}},function(e,r,t){"use strict";function n(e){for(var r=[];m(e);)r.push(e.length),e=e[0];return r}function i(e,r,t){var n,o=e.length;if(o!=r[t])throw new l(o,r[t]);if(t<r.length-1){var a=t+1;for(n=0;o>n;n++){var s=e[n];if(!m(s))throw new l(r.length-1,r.length,"<");i(e[n],r,a)}}else for(n=0;o>n;n++)if(m(e[n]))throw new l(r.length+1,r.length,">")}function o(e,t,n,i){var a,s,u=e.length,f=t[n],l=Math.min(u,f);if(e.length=f,n<t.length-1){var p=n+1;for(a=0;l>a;a++)s=e[a],m(s)||(s=[s],e[a]=s),o(s,t,p,i);for(a=l;f>a;a++)s=[],e[a]=s,o(s,t,p,i)}else{for(a=0;l>a;a++)for(;m(e[a]);)e[a]=e[a][0];if(i!==r.UNINITIALIZED)for(a=l;f>a;a++)e[a]=c.clone(i)}}function a(e,r,t){var n,i;if(r>t){var o=t+1;for(n=0,i=e.length;i>n;n++)e[n]=a(e[n],r,o)}else for(;m(e);)e=e[0];return e}function s(e,r,t){var n,i;if(m(e)){var o=t+1;for(n=0,i=e.length;i>n;n++)e[n]=s(e[n],r,o)}else for(var a=t;r>a;a++)e=[e];return e}var u=t(4),f=t(176),c=t(3),l=(t(196),t(156)),p=t(157),m=Array.isArray;r.size=function(e){var t=n(e);return r.validate(e,t),t},r.validate=function(e,r){var t=0==r.length;if(t){if(m(e))throw new l(e.length,0)}else i(e,r,0)},r.validateIndex=function(e,r){if(!u.isNumber(e)||!u.isInteger(e))throw new TypeError("Index must be an integer (value: "+e+")");if(0>e)throw new p(e);if(void 0!==r&&e>=r)throw new p(e,r)},r.UNINITIALIZED={},r.resize=function(e,r,t){if(!m(e)||!m(r))throw new TypeError("Array expected");if(0===r.length)throw new Error("Resizing to scalar is not supported");r.forEach(function(e){if(!u.isNumber(e)||!u.isInteger(e)||0>e)throw new TypeError("Invalid size, must contain positive integers (size: "+f.format(r)+")")});var n=void 0!==t?t:0;return o(e,r,0,n),e},r.squeeze=function(e,t){for(var n=t||r.size(e);m(e)&&1===e.length;)e=e[0],n.shift();for(var i=n.length;1===n[i-1];)i--;return i<n.length&&(e=a(e,i,0),n.length=i),e},r.unsqueeze=function(e,t,n,i){var o=i||r.size(e);if(n)for(var a=0;n>a;a++)e=[e],o.unshift(1);for(e=s(e,t,0);o.length<t;)o.push(1);return e},r.flatten=function(e){for(var r=e,t=Array.isArray;t(r[0]);){for(var n=[],i=0,o=r.length;o>i;i++)n=n.concat.apply(n,r[i]);r=n}return r},r.argsToArray=function(e){for(var r=[],t=0,n=e.length;n>t;t++)r[t]=e[t];return r},r.isArray=m},function(e){e.exports="1.2.0"},function(e){"use strict";function r(e,t,n,i){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=n,this.max=i,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+n+(void 0!=i?"-"+i:"")+" expected)",this.stack=(new Error).stack}r.prototype=new Error,r.prototype.constructor=Error,r.prototype.name="ArgumentsError",e.exports=r},function(e){"use strict";function r(e,t,n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=n,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=(new Error).stack}r.prototype=new RangeError,r.prototype.constructor=RangeError,r.prototype.name="DimensionError",e.exports=r},function(e){"use strict";function r(e,t,n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=n),this.message=void 0!==this.min&&this.index<this.min?"Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?"Index out of range ("+this.index+" > "+(this.max-1)+")":"Index out of range ("+this.index+")",this.stack=(new Error).stack}r.prototype=new RangeError,r.prototype.constructor=RangeError,r.prototype.name="IndexError",e.exports=r},function(e){"use strict";function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.types=Array.prototype.splice.call(arguments,1),this.message=e?0==this.types.length?"Unsupported type of argument in function "+e:"Function "+e+"("+this.types.join(", ")+") not supported":"Unsupported type of argument",this.stack=(new Error).stack}r.prototype=new TypeError,r.prototype.constructor=TypeError,r.prototype.name="UnsupportedTypeError",e.exports=r},function(e,r,t){var n;!function(i){"use strict";function o(e){for(var r,t,n=1,i=e.length,o=e[0]+"";i>n;n++){for(r=e[n]+"",t=T-r.length;t--;)r="0"+r;o+=r}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function a(e,r,t,n){var i,o,a,s,u;for(o=1,a=e[0];a>=10;a/=10,o++);return a=r-o,0>a?(a+=T,i=0):(i=Math.ceil((a+1)/T),a%=T),o=N(10,T-a),u=e[i]%o|0,null==n?3>a?(0==a?u=u/100|0:1==a&&(u=u/10|0),s=4>t&&99999==u||t>3&&49999==u||5e4==u||0==u):s=(4>t&&u+1==o||t>3&&u+1==o/2)&&(e[i+1]/o/100|0)==N(10,a-2)-1||(u==o/2||0==u)&&0==(e[i+1]/o/100|0):4>a?(0==a?u=u/1e3|0:1==a?u=u/100|0:2==a&&(u=u/10|0),s=(n||4>t)&&9999==u||!n&&t>3&&4999==u):s=((n||4>t)&&u+1==o||!n&&t>3&&u+1==o/2)&&(e[i+1]/o/1e3|0)==N(10,a-3)-1,s}function s(e,r,t){var n=e.constructor;return null==r||((x=0>r||r>8)||0!==r&&(n.errors?parseInt:parseFloat)(r)!=r)&&!p(n,"rounding mode",r,t,0)?n.rounding:0|r}function u(e,r,t,n){var i=e.constructor;return!(x=(n||0)>r||r>=U+1)&&(0===r||(i.errors?parseInt:parseFloat)(r)==r)||p(i,"argument",r,t,0)}function f(e,r){var t,n,i,s,u,f,c,l=0,p=0,m=0,h=e.constructor,d=h.ONE,w=h.rounding,x=h.precision;if(!e.c||!e.c[0]||e.e>17)return new h(e.c?e.c[0]?e.s<0?0:1/0:d:e.s?e.s<0?0:e:0/0);for(null==r?(v=!1,u=x):u=r,c=new h(.03125);e.e>-2;)e=e.times(c),m+=5;for(n=Math.log(N(2,m))/Math.LN10*2+5|0,u+=n,t=s=f=new h(d),h.precision=u;;){if(s=g(s.times(e),u,1),t=t.times(++p),c=f.plus(I(s,t,u,1)),o(c.c).slice(0,u)===o(f.c).slice(0,u)){for(i=m;i--;)f=g(f.times(f),u,1);if(null!=r)return h.precision=x,f;if(!(3>l&&a(f.c,u-n,w,l)))return g(f,h.precision=x,w,v=!0);h.precision=u+=10,t=s=c=new h(d),p=0,l++}f=c}}function c(e,r,t,n){var i,a,s=e.constructor,u=(e=new s(e)).e;if(null==r?t=0:(g(e,++r,t),t=n?r:r+e.e-u),u=e.e,i=o(e.c),1==n||2==n&&(u>=r||u<=s.toExpNeg)){for(;i.length<t;i+="0");i.length>1&&(i=i.charAt(0)+"."+i.slice(1)),i+=(0>u?"e":"e+")+u}else{if(n=i.length,0>u){for(a=t-n;++u;i="0"+i);i="0."+i}else if(++u>n){for(a=t-u,u-=n;u--;i+="0");a>0&&(i+=".")}else a=t-n,n>u?i=i.slice(0,u)+"."+i.slice(u):a>0&&(i+=".");if(a>0)for(;a--;i+="0");}return e.s<0&&e.c[0]?"-"+i:i}function l(e){var r=e.length-1,t=r*T+1;if(r=e[r]){for(;r%10==0;r/=10,t--);for(r=e[0];r>=10;r/=10,t++);}return t}function p(e,r,t,n,i){if(e.errors){var o=new Error((n||["new Decimal","cmp","div","eq","gt","gte","lt","lte","minus","mod","plus","times","toFraction","pow","random","log","sqrt","toNearest","divToInt"][b?0>b?-b:b:0>1/b?1:0])+"() "+(["number type has more than 15 significant digits","LN10 out of digits"][r]||r+([x?" out of range":" not an integer"," not a boolean or binary digit"][i]||""))+": "+t);throw o.name="Decimal Error",x=b=0,o}}function m(e,r,t){var n=new e(e.ONE);for(v=!1;1&t&&(n=n.times(r)),t>>=1,t;)r=r.times(r);return v=!0,n}function h(e,r){var t,n,i,s,u,f,c,l,m,d,w,x=1,y=10,b=e,E=b.c,N=b.constructor,A=N.ONE,M=N.rounding,T=N.precision;if(b.s<0||!E||!E[0]||!b.e&&1==E[0]&&1==E.length)return new N(E&&!E[0]?-1/0:1!=b.s?0/0:E?0:b);if(null==r?(v=!1,c=T):c=r,N.precision=c+=y,t=o(E),n=t.charAt(0),!(Math.abs(s=b.e)<15e14))return b=new N(n+"."+t.slice(1)),c+2>q.length&&p(N,1,c+2,"ln"),b=h(b,c-y).plus(new N(q.slice(0,c+2)).times(s+"")),N.precision=T,null==r?g(b,T,M,v=!0):b;for(;7>n&&1!=n||1==n&&t.charAt(1)>3;)b=b.times(e),t=o(b.c),n=t.charAt(0),x++;for(s=b.e,n>1?(b=new N("0."+t),s++):b=new N(n+"."+t.slice(1)),d=b,l=u=b=I(b.minus(A),b.plus(A),c,1),w=g(b.times(b),c,1),i=3;;){if(u=g(u.times(w),c,1),m=l.plus(I(u,new N(i),c,1)),o(m.c).slice(0,c)===o(l.c).slice(0,c)){if(l=l.times(2),0!==s&&(c+2>q.length&&p(N,1,c+2,"ln"),l=l.plus(new N(q.slice(0,c+2)).times(s+""))),l=I(l,new N(x),c,1),null!=r)return N.precision=T,l;if(!a(l.c,c-y,M,f))return g(l,N.precision=T,M,v=!0);N.precision=c+=y,m=u=b=I(d.minus(A),d.plus(A),c,1),w=g(b.times(b),c,1),i=f=1}l=m,i+=2}}function g(e,r,t,n){var i,o,a,s,u,f,c,l,p=e.constructor;e:if(null!=r){if(!(c=e.c))return e;for(i=1,s=c[0];s>=10;s/=10,i++);if(o=r-i,0>o)o+=T,a=r,u=c[l=0],f=u/N(10,i-a-1)%10|0;else if(l=Math.ceil((o+1)/T),l>=c.length){if(!n)break e;for(;c.length<=l;c.push(0));u=f=0,i=1,o%=T,a=o-T+1}else{for(u=s=c[l],i=1;s>=10;s/=10,i++);o%=T,a=o-T+i,f=0>a?0:E(u/N(10,i-a-1)%10)}if(n=n||0>r||null!=c[l+1]||(0>a?u:u%N(10,i-a-1)),n=4>t?(f||n)&&(0==t||t==(e.s<0?3:2)):f>5||5==f&&(4==t||n||6==t&&(o>0?a>0?u/N(10,i-a):0:c[l-1])%10&1||t==(e.s<0?8:7)),1>r||!c[0])return c.length=0,n?(r-=e.e+1,c[0]=N(10,r%T),e.e=-r||0):c[0]=e.e=0,e;if(0==o?(c.length=l,s=1,l--):(c.length=l+1,s=N(10,T-o),c[l]=a>0?(u/N(10,i-a)%N(10,a)|0)*s:0),n)for(;;){if(0==l){for(o=1,a=c[0];a>=10;a/=10,o++);for(a=c[0]+=s,s=1;a>=10;a/=10,s++);o!=s&&(e.e++,c[0]==M&&(c[0]=1));break}if(c[l]+=s,c[l]!=M)break;c[l--]=0,s=1}for(o=c.length;0===c[--o];c.pop());}return v&&(e.e>p.maxE?e.c=e.e=null:e.e<p.minE&&(e.c=[e.e=0])),e}var d,w,x,y=i.crypto,v=!0,b=0,E=Math.floor,N=Math.pow,A=Object.prototype.toString,M=1e7,T=7,S="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",O={},C=9e15,U=1e9,B=3e3,q="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058";O.absoluteValue=O.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),g(e)},O.ceil=function(){return g(new this.constructor(this),this.e+1,2)},O.comparedTo=O.cmp=function(e,r){var t,n=this,i=n.c,o=(b=-b,e=new n.constructor(e,r),e.c),a=n.s,s=e.s,u=n.e,f=e.e;if(!a||!s)return null;if(t=i&&!i[0],r=o&&!o[0],t||r)return t?r?0:-s:a;if(a!=s)return a;if(t=0>a,!i||!o)return u==f?0:!i^t?1:-1;if(u!=f)return u>f^t?1:-1;for(a=-1,s=(u=i.length)<(f=o.length)?u:f;++a<s;)if(i[a]!=o[a])return i[a]>o[a]^t?1:-1;return u==f?0:u>f^t?1:-1},O.decimalPlaces=O.dp=function(){var e,r,t=null;if(e=this.c){if(t=((r=e.length-1)-E(this.e/T))*T,r=e[r])for(;r%10==0;r/=10,t--);0>t&&(t=0)}return t},O.dividedBy=O.div=function(e,r){return b=2,I(this,new this.constructor(e,r))},O.dividedToIntegerBy=O.divToInt=function(e,r){var t=this,n=t.constructor;
  32. return b=18,g(I(t,new n(e,r),0,1,1),n.precision,n.rounding)},O.equals=O.eq=function(e,r){return b=3,0===this.cmp(e,r)},O.exponential=O.exp=function(){return f(this)},O.floor=function(){return g(new this.constructor(this),this.e+1,3)},O.greaterThan=O.gt=function(e,r){return b=4,this.cmp(e,r)>0},O.greaterThanOrEqualTo=O.gte=function(e,r){return b=5,r=this.cmp(e,r),1==r||0===r},O.isFinite=function(){return!!this.c},O.isInteger=O.isInt=function(){return!!this.c&&E(this.e/T)>this.c.length-2},O.isNaN=function(){return!this.s},O.isNegative=O.isNeg=function(){return this.s<0},O.isZero=function(){return!!this.c&&0==this.c[0]},O.lessThan=O.lt=function(e,r){return b=6,this.cmp(e,r)<0},O.lessThanOrEqualTo=O.lte=function(e,r){return b=7,r=this.cmp(e,r),-1==r||0===r},O.logarithm=O.log=function(e,r){var t,n,i,s,u,f,c,l,m,d=this,w=d.constructor,x=w.precision,y=w.rounding,E=5;if(null==e)e=new w(10),t=!0;else{if(b=15,e=new w(e,r),n=e.c,e.s<0||!n||!n[0]||!e.e&&1==n[0]&&1==n.length)return new w(0/0);t=e.eq(10)}if(n=d.c,d.s<0||!n||!n[0]||!d.e&&1==n[0]&&1==n.length)return new w(n&&!n[0]?-1/0:1!=d.s?0/0:n?0:1/0);if(u=t&&(s=n[0],n.length>1||1!=s&&10!=s&&100!=s&&1e3!=s&&1e4!=s&&1e5!=s&&1e6!=s),v=!1,c=x+E,l=c+10,f=h(d,c),t?(l>q.length&&p(w,1,l,"log"),i=new w(q.slice(0,l))):i=h(e,c),m=I(f,i,c,1),a(m.c,s=x,y))do if(c+=10,f=h(d,c),t?(l=c+10,l>q.length&&p(w,1,l,"log"),i=new w(q.slice(0,l))):i=h(e,c),m=I(f,i,c,1),!u){+o(m.c).slice(s+1,s+15)+1==1e14&&(m=g(m,x+1,0));break}while(a(m.c,s+=10,y));return v=!0,g(m,x,y)},O.minus=function(e,r){var t,n,i,o,a=this,s=a.constructor,u=a.s;if(b=8,e=new s(e,r),r=e.s,!u||!r)return new s(0/0);if(u!=r)return e.s=-r,a.plus(e);var f=a.c,c=e.c,l=E(e.e/T),p=E(a.e/T),m=s.precision,h=s.rounding;if(!p||!l){if(!f||!c)return f?(e.s=-r,e):new s(c?a:0/0);if(!f[0]||!c[0])return a=c[0]?(e.s=-r,e):new s(f[0]?a:3==h?-0:0),v?g(a,m,h):a}if(f=f.slice(),n=f.length,u=p-l){for((o=0>u)?(u=-u,t=f,n=c.length):(l=p,t=c),(p=Math.ceil(m/T))>n&&(n=p),u>(n+=2)&&(u=n,t.length=1),t.reverse(),r=u;r--;t.push(0));t.reverse()}else for((o=n<(i=c.length))&&(i=n),u=r=0;i>r;r++)if(f[r]!=c[r]){o=f[r]<c[r];break}if(o&&(t=f,f=c,c=t,e.s=-e.s),(r=-((i=f.length)-c.length))>0)for(;r--;f[i++]=0);for(p=M-1,r=c.length;r>u;){if(f[--r]<c[r]){for(n=r;n&&!f[--n];f[n]=p);--f[n],f[r]+=M}f[r]-=c[r]}for(;0==f[--i];f.pop());for(;0==f[0];f.shift(),--l);for(f[0]||(f=[l=0],e.s=3==h?-1:1),e.c=f,u=1,r=f[0];r>=10;r/=10,u++);return e.e=u+l*T-1,v?g(e,m,h):e},O.modulo=O.mod=function(e,r){var t,n,i=this,o=i.constructor,a=o.modulo;return b=9,e=new o(e,r),r=e.s,t=!i.c||!r||e.c&&!e.c[0],t||!e.c||i.c&&!i.c[0]?t?new o(0/0):g(new o(i),o.precision,o.rounding):(v=!1,9==a?(e.s=1,n=I(i,e,0,3,1),e.s=r,n.s*=r):n=I(i,e,0,a,1),n=n.times(e),v=!0,i.minus(n))},O.naturalLogarithm=O.ln=function(){return h(this)},O.negated=O.neg=function(){var e=new this.constructor(this);return e.s=-e.s||null,g(e)},O.plus=function(e,r){var t,n=this,i=n.constructor,o=n.s;if(b=10,e=new i(e,r),r=e.s,!o||!r)return new i(0/0);if(o!=r)return e.s=-r,n.minus(e);var a=n.c,s=e.c,u=E(e.e/T),f=E(n.e/T),c=i.precision,l=i.rounding;if(!f||!u){if(!a||!s)return new i(o/0);if(!a[0]||!s[0])return n=s[0]?e:new i(a[0]?n:0*o),v?g(n,c,l):n}if(a=a.slice(),o=f-u){for(0>o?(o=-o,t=a,r=s.length):(u=f,t=s,r=a.length),(f=Math.ceil(c/T))>r&&(r=f),o>++r&&(o=r,t.length=1),t.reverse();o--;t.push(0));t.reverse()}for(a.length-s.length<0&&(t=s,s=a,a=t),o=s.length,r=0,f=M;o;a[o]%=f)r=(a[--o]=a[o]+s[o]+r)/f|0;for(r&&(a.unshift(r),++u),o=a.length;0==a[--o];a.pop());for(e.c=a,o=1,r=a[0];r>=10;r/=10,o++);return e.e=o+u*T-1,v?g(e,c,l):e},O.precision=O.sd=function(e){var r=null,t=this;return e!=r&&e!==!!e&&1!==e&&0!==e&&p(t.constructor,"argument",e,"precision",1),t.c&&(r=l(t.c),e&&t.e+1>r&&(r=t.e+1)),r},O.round=function(){var e=this,r=e.constructor;return g(new r(e),e.e+1,r.rounding)},O.squareRoot=O.sqrt=function(){var e,r,t,n,i,a,s=this,u=s.c,f=s.s,c=s.e,l=s.constructor,p=new l(.5);if(1!==f||!u||!u[0])return new l(!f||0>f&&(!u||u[0])?0/0:u?s:1/0);for(v=!1,f=Math.sqrt(+s),0==f||f==1/0?(r=o(u),(r.length+c)%2==0&&(r+="0"),f=Math.sqrt(r),c=E((c+1)/2)-(0>c||c%2),f==1/0?r="1e"+c:(r=f.toExponential(),r=r.slice(0,r.indexOf("e")+1)+c),n=new l(r)):n=new l(f.toString()),t=(c=l.precision)+3;;)if(a=n,n=p.times(a.plus(I(s,a,t+2,1))),o(a.c).slice(0,t)===(r=o(n.c)).slice(0,t)){if(r=r.slice(t-3,t+1),"9999"!=r&&(i||"4999"!=r)){(!+r||!+r.slice(1)&&"5"==r.charAt(0))&&(g(n,c+1,1),e=!n.times(n).eq(s));break}if(!i&&(g(a,c+1,0),a.times(a).eq(s))){n=a;break}t+=4,i=1}return v=!0,g(n,c,l.rounding,e)},O.times=function(e,r){var t,n,i=this,o=i.constructor,a=i.c,s=(b=11,e=new o(e,r),e.c),u=E(i.e/T),f=E(e.e/T),c=i.s;if(r=e.s,e.s=c==r?1:-1,!((u||a&&a[0])&&(f||s&&s[0])))return new o(!c||!r||a&&!a[0]&&!s||s&&!s[0]&&!a?0/0:a&&s?0*e.s:e.s/0);for(n=u+f,c=a.length,r=s.length,r>c&&(t=a,a=s,s=t,f=c,c=r,r=f),f=c+r,t=[];f--;t.push(0));for(u=r-1;u>-1;u--){for(r=0,f=c+u;f>u;)r=t[f]+s[u]*a[f-u-1]+r,t[f--]=r%M|0,r=r/M|0;t[f]=(t[f]+r)%M|0}for(r?++n:t[0]||t.shift(),f=t.length;!t[--f];t.pop());for(e.c=t,c=1,r=t[0];r>=10;r/=10,c++);return e.e=c+n*T-1,v?g(e,o.precision,o.rounding):e},O.toDecimalPlaces=O.toDP=function(e,r){var t=this;return t=new t.constructor(t),null!=e&&u(t,e,"toDP")?g(t,(0|e)+t.e+1,s(t,r,"toDP")):t},O.toExponential=function(e,r){var t=this;return t.c?c(t,null!=e&&u(t,e,"toExponential")?0|e:null,null!=e&&s(t,r,"toExponential"),1):t.toString()},O.toFixed=function(e,r){var t,n=this,i=n.constructor,o=i.toExpNeg,a=i.toExpPos;return null!=e&&(e=u(n,e,t="toFixed")?n.e+(0|e):null,r=s(n,r,t)),i.toExpNeg=-(i.toExpPos=1/0),null!=e&&n.c?(t=c(n,e,r),n.s<0&&n.c&&(n.c[0]?t.indexOf("-")<0&&(t="-"+t):t=t.replace("-",""))):t=n.toString(),i.toExpNeg=o,i.toExpPos=a,t},O.toFormat=function(e,r){var t=this;if(!t.c)return t.toString();var n,i=t.s<0,o=t.constructor.format,a=o.groupSeparator,s=+o.groupSize,u=+o.secondaryGroupSize,f=t.toFixed(e,r).split("."),c=f[0],l=f[1],p=i?c.slice(1):c,m=p.length;if(u&&(n=s,s=u,m-=u=n),s>0&&m>0){for(n=m%s||s,c=p.substr(0,n);m>n;n+=s)c+=a+p.substr(n,s);u>0&&(c+=a+p.slice(n)),i&&(c="-"+c)}return l?c+o.decimalSeparator+((u=+o.fractionGroupSize)?l.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+o.fractionGroupSeparator):l):c},O.toFraction=function(e){var r,t,n,i,a,s,u,f,c=this,m=c.constructor,h=r=new m(m.ONE),g=s=new m(0),d=c.c,w=new m(g);if(!d)return c.toString();for(n=w.e=l(d)-c.e-1,w.c[0]=N(10,(u=n%T)<0?T+u:u),(null==e||(!(b=12,a=new m(e)).s||(x=a.cmp(h)<0||!a.c)||m.errors&&E(a.e/T)<a.c.length-1)&&!p(m,"max denominator",e,"toFraction",0)||(e=a).cmp(w)>0)&&(e=n>0?w:h),v=!1,a=new m(o(d)),u=m.precision,m.precision=n=d.length*T*2;f=I(a,w,0,1,1),t=r.plus(f.times(g)),1!=t.cmp(e);)r=g,g=t,h=s.plus(f.times(t=h)),s=t,w=a.minus(f.times(t=w)),a=t;return t=I(e.minus(r),g,0,1,1),s=s.plus(t.times(h)),r=r.plus(t.times(g)),s.s=h.s=c.s,i=I(h,g,n,1).minus(c).abs().cmp(I(s,r,n,1).minus(c).abs())<1?[h+"",g+""]:[s+"",r+""],v=!0,m.precision=u,i},O.toNearest=function(e,r){var t=this,n=t.constructor;return t=new n(t),null==e?(e=new n(n.ONE),r=n.rounding):(b=17,e=new n(e),r=s(t,r,"toNearest")),e.c?t.c&&(e.c[0]?(v=!1,t=I(t,e,0,4>r?[4,5,7,8][r]:r,1).times(e),v=!0,g(t)):t.c=[t.e=0]):t.s&&(e.s&&(e.s=t.s),t=e),t},O.toNumber=function(){var e=this;return+e||(e.s?0*e.s:0/0)},O.toPower=O.pow=function(e,r){var t,n,i,s,u=this,c=u.constructor,l=u.s,p=(b=13,+(e=new c(e,r))),d=0>p?-p:p,w=c.precision,x=c.rounding;if(!u.c||!e.c||(i=!u.c[0])||!e.c[0])return new c(N(i?0*l:+u,p));if(u=new c(u),t=u.c.length,!u.e&&u.c[0]==u.s&&1==t)return u;if(r=e.c.length-1,e.e||e.c[0]!=e.s||r)if(n=E(e.e/T),i=n>=r,!i&&0>l)s=new c(0/0);else{if(i&&B>t*T*d){if(s=m(c,u,d),e.s<0)return c.ONE.div(s)}else{if(l=0>l&&1&e.c[Math.max(n,r)]?-1:1,r=N(+u,p),n=0!=r&&isFinite(r)?new c(r+"").e:E(p*(Math.log("0."+o(u.c))/Math.LN10+u.e+1)),n>c.maxE+1||n<c.minE-1)return new c(n>0?l/0:0);v=!1,c.rounding=u.s=1,d=Math.min(12,(n+"").length),s=f(e.times(h(u,w+d)),w),s=g(s,w+5,1),a(s.c,w,x)&&(n=w+10,s=g(f(e.times(h(u,n+d)),n),n+5,1),+o(s.c).slice(w+1,w+15)+1==1e14&&(s=g(s,w+1,0))),s.s=l,v=!0,c.rounding=x}s=g(s,w,x)}else s=g(u,w,x);return s},O.toPrecision=function(e,r){var t=this;return null!=e&&u(t,e,"toPrecision",1)&&t.c?c(t,0|--e,s(t,r,"toPrecision"),2):t.toString()},O.toSignificantDigits=O.toSD=function(e,r){var t=this,n=t.constructor;return t=new n(t),null!=e&&u(t,e,"toSD",1)?g(t,0|e,s(t,r,"toSD")):g(t,n.precision,n.rounding)},O.toString=function(e){var r,t,n,i=this,a=i.constructor,s=i.e;if(null===s)t=i.s?"Infinity":"NaN";else{if(e===r&&(s<=a.toExpNeg||s>=a.toExpPos))return c(i,null,a.rounding,1);if(t=o(i.c),0>s){for(;++s;t="0"+t);t="0."+t}else if(n=t.length,s>0)if(++s>n)for(s-=n;s--;t+="0");else n>s&&(t=t.slice(0,s)+"."+t.slice(s));else if(r=t.charAt(0),n>1)t=r+"."+t.slice(1);else if("0"==r)return r;if(null!=e)if((x=!(e>=2&&65>e))||e!=(0|e)&&a.errors)p(a,"base",e,"toString",0);else if(t=d(a,t,0|e,10,i.s),"0"==t)return t}return i.s<0?"-"+t:t},O.truncated=O.trunc=function(){return g(new this.constructor(this),this.e+1,1)},O.valueOf=O.toJSON=function(){return this.toString()},d=function(){function e(e,r,t){for(var n,i,o=[0],a=0,s=e.length;s>a;){for(i=o.length;i--;o[i]*=r);for(o[n=0]+=S.indexOf(e.charAt(a++));n<o.length;n++)o[n]>t-1&&(null==o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/t|0,o[n]%=t)}return o.reverse()}return function(r,t,n,i,o){var a,s,u,f,c,l,p=t.indexOf("."),h=r.precision,g=r.rounding;for(37>i&&(t=t.toLowerCase()),p>=0&&(t=t.replace(".",""),l=new r(i),f=m(r,l,t.length-p),l.c=e(f.toFixed(),10,n),l.e=l.c.length),c=e(t,i,n),a=s=c.length;0==c[--s];c.pop());if(!c[0])return"0";if(0>p?a--:(f.c=c,f.e=a,f.s=o,f=I(f,l,h,g,0,n),c=f.c,u=f.r,a=f.e),p=c[h],s=n/2,u=u||null!=c[h+1],4>g?(null!=p||u)&&(0==g||g==(f.s<0?3:2)):p>s||p==s&&(4==g||u||6==g&&1&c[h-1]||g==(f.s<0?8:7)))for(c.length=h,--n;++c[--h]>n;)c[h]=0,h||(++a,c.unshift(1));else c.length=h;for(s=c.length;!c[--s];);for(p=0,t="";s>=p;t+=S.charAt(c[p++]));if(0>a){for(;++a;t="0"+t);t="0."+t}else if(p=t.length,++a>p)for(a-=p;a--;t+="0");else p>a&&(t=t.slice(0,a)+"."+t.slice(a));return t}}();var I=function(){function e(e,r,t){var n,i=0,o=e.length;for(e=e.slice();o--;)n=e[o]*r+i,e[o]=n%t|0,i=n/t|0;return i&&e.unshift(i),e}function r(e,r,t,n){var i,o;if(t!=n)o=t>n?1:-1;else for(i=o=0;t>i;i++)if(e[i]!=r[i]){o=e[i]>r[i]?1:-1;break}return o}function t(e,r,t,n){for(var i=0;t--;)e[t]-=i,i=e[t]<r[t]?1:0,e[t]=i*n+e[t]-r[t];for(;!e[0]&&e.length>1;e.shift());}return function(n,i,o,a,s,u){var f,c,l,p,m,h,d,w,x,y,v,b,N,A,S,O,C,U,B,q=n.constructor,I=n.s==i.s?1:-1,z=n.c,_=i.c;if(!(z&&z[0]&&_&&_[0]))return new q(n.s&&i.s&&(z?!_||z[0]!=_[0]:_)?z&&0==z[0]||!_?0*I:I/0:0/0);for(u?(p=1,c=n.e-i.e):(u=M,p=T,c=E(n.e/p)-E(i.e/p)),U=_.length,O=z.length,x=new q(I),y=x.c=[],l=0;_[l]==(z[l]||0);l++);if(_[l]>(z[l]||0)&&c--,null==o?(I=o=q.precision,a=q.rounding):I=s?o+(n.e-i.e)+1:o,0>I)y.push(1),m=!0;else{if(I=I/p+2|0,l=0,1==U){for(h=0,_=_[0],I++;(O>l||h)&&I--;l++)A=h*u+(z[l]||0),y[l]=A/_|0,h=A%_|0;m=h||O>l}else{for(h=u/(_[0]+1)|0,h>1&&(_=e(_,h,u),z=e(z,h,u),U=_.length,O=z.length),S=U,v=z.slice(0,U),b=v.length;U>b;v[b++]=0);B=_.slice(),B.unshift(0),C=_[0],_[1]>=u/2&&C++;do h=0,f=r(_,v,U,b),0>f?(N=v[0],U!=b&&(N=N*u+(v[1]||0)),h=N/C|0,h>1?(h>=u&&(h=u-1),d=e(_,h,u),w=d.length,b=v.length,f=r(d,v,w,b),1==f&&(h--,t(d,w>U?B:_,w,u))):(0==h&&(f=h=1),d=_.slice()),w=d.length,b>w&&d.unshift(0),t(v,d,b,u),-1==f&&(b=v.length,f=r(_,v,U,b),1>f&&(h++,t(v,b>U?B:_,b,u))),b=v.length):0===f&&(h++,v=[0]),y[l++]=h,f&&v[0]?v[b++]=z[S]||0:(v=[z[S]],b=1);while((S++<O||null!=v[0])&&I--);m=null!=v[0]}y[0]||y.shift()}if(1==p)x.e=c,x.r=+m;else{for(l=1,I=y[0];I>=10;I/=10,l++);x.e=l+c*p-1,g(x,s?o+x.e+1:o,a,m)}return x}}();w=function(){function e(e){var r,t,n,i=this,o="config",a=i.errors?parseInt:parseFloat;return e==t||"object"!=typeof e&&!p(i,"object expected",e,o)?i:((n=e[r="precision"])!=t&&((x=1>n||n>U)||a(n)!=n?p(i,r,n,o,0):i[r]=0|n),(n=e[r="rounding"])!=t&&((x=0>n||n>8)||a(n)!=n?p(i,r,n,o,0):i[r]=0|n),(n=e[r="toExpNeg"])!=t&&((x=-C>n||n>0)||a(n)!=n?p(i,r,n,o,0):i[r]=E(n)),(n=e[r="toExpPos"])!=t&&((x=0>n||n>C)||a(n)!=n?p(i,r,n,o,0):i[r]=E(n)),(n=e[r="minE"])!=t&&((x=-C>n||n>0)||a(n)!=n?p(i,r,n,o,0):i[r]=E(n)),(n=e[r="maxE"])!=t&&((x=0>n||n>C)||a(n)!=n?p(i,r,n,o,0):i[r]=E(n)),(n=e[r="errors"])!=t&&(n===!!n||1===n||0===n?(x=b=0,i[r]=!!n):p(i,r,n,o,1)),(n=e[r="crypto"])!=t&&(n===!!n||1===n||0===n?i[r]=!(!n||!y||"object"!=typeof y):p(i,r,n,o,1)),(n=e[r="modulo"])!=t&&((x=0>n||n>9)||a(n)!=n?p(i,r,n,o,0):i[r]=0|n),(e=e[r="format"])!=t&&("object"==typeof e?i[r]=e:p(i,"format object expected",e,o)),i)}function r(e){return new this(e).exp()}function t(e){return new this(e).ln()}function n(e,r){return new this(e).log(r)}function i(e,r,t){var n,i,o=0;for("[object Array]"==A.call(r[0])&&(r=r[0]),n=new e(r[0]);++o<r.length;){if(i=new e(r[o]),!i.s){n=i;break}n[t](i)&&(n=i)}return n}function o(){return i(this,arguments,"lt")}function a(){return i(this,arguments,"gt")}function s(e,r){return new this(e).pow(r)}function f(e){var r,t,n,i=0,o=[],a=this,s=new a(a.ONE);if(null!=e&&u(s,e,"random")?e|=0:e=a.precision,t=Math.ceil(e/T),a.crypto)if(y&&y.getRandomValues)for(r=y.getRandomValues(new Uint32Array(t));t>i;)n=r[i],n>=429e7?r[i]=y.getRandomValues(new Uint32Array(1))[0]:o[i++]=n%1e7;else if(y&&y.randomBytes){for(r=y.randomBytes(t*=4);t>i;)n=r[i]+(r[i+1]<<8)+(r[i+2]<<16)+((127&r[i+3])<<24),n>=214e7?y.randomBytes(4).copy(r,i):(o.push(n%1e7),i+=4);i=t/4}else p(a,"crypto unavailable",y,"random");if(!i)for(;t>i;)o[i++]=1e7*Math.random()|0;for(t=o[--i],e%=T,t&&e&&(n=N(10,T-e),o[i]=(t/n|0)*n);0===o[i];i--)o.pop();if(0>i)o=[t=0];else{for(t=-1;0===o[0];)o.shift(),t-=T;for(i=1,n=o[0];n>=10;)n/=10,i++;T>i&&(t-=T-i)}return s.e=t,s.c=o,s}function c(e){return new this(e).sqrt()}function l(i){function u(e,r){var t=this;if(!(t instanceof u))return p(u,"Decimal called without new",e),new u(e,r);if(t.constructor=u,e instanceof u){if(null==r)return b=0,t.s=e.s,t.e=e.e,t.c=(e=e.c)?e.slice():e,t;if(10==r)return g(new u(e),u.precision,u.rounding);e+=""}return m(u,t,e,r)}return u.precision=20,u.rounding=4,u.modulo=1,u.toExpNeg=-7,u.toExpPos=21,u.minE=-C,u.maxE=C,u.errors=!0,u.crypto=!1,u.format={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0},u.prototype=O,u.ONE=new u(1),u.ROUND_UP=0,u.ROUND_DOWN=1,u.ROUND_CEIL=2,u.ROUND_FLOOR=3,u.ROUND_HALF_UP=4,u.ROUND_HALF_DOWN=5,u.ROUND_HALF_EVEN=6,u.ROUND_HALF_CEIL=7,u.ROUND_HALF_FLOOR=8,u.EUCLID=9,u.config=e,u.constructor=l,u.exp=r,u.ln=t,u.log=n,u.max=o,u.min=a,u.pow=s,u.sqrt=c,u.random=f,null!=i&&u.config(i),u}var m=function(){var e=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,r=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")};return function(t,n,i,o){var a,s,u,f,c,l;if("string"!=typeof i&&(i=(f="number"==typeof i||"[object Number]"==A.call(i))&&0===i&&0>1/i?"-0":i+""),c=i,null==o&&e.test(i))n.s=45===i.charCodeAt(0)?(i=i.slice(1),-1):1;else{if(10==o)return g(new t(i),t.precision,t.rounding);if(i=r.call(i).replace(/^\+(?!-)/,""),n.s=45===i.charCodeAt(0)?(i=i.replace(/^-(?!-)/,""),-1):1,null!=o?o!=(0|o)&&t.errors||(x=!(o>=2&&65>o))?(p(t,"base",o,0,0),l=e.test(i)):(a="["+S.slice(0,o=0|o)+"]+",i=i.replace(/\.$/,"").replace(/^\./,"0."),(l=new RegExp("^"+a+"(?:\\."+a+")?$",37>o?"i":"").test(i))?(f&&(i.replace(/^0\.0*|\./,"").length>15&&p(t,0,c),f=!f),i=d(t,i,10,o,n.s)):"Infinity"!=i&&"NaN"!=i&&(p(t,"not a base "+o+" number",c),i="NaN")):l=e.test(i),!l)return n.c=n.e=null,"Infinity"!=i&&("NaN"!=i&&p(t,"not a number",c),n.s=null),b=0,n}for((s=i.indexOf("."))>-1&&(i=i.replace(".","")),(u=i.search(/e/i))>0?(0>s&&(s=u),s+=+i.slice(u+1),i=i.substring(0,u)):0>s&&(s=i.length),u=0;48===i.charCodeAt(u);u++);for(o=i.length;48===i.charCodeAt(--o););if(i=i.slice(u,o+1)){if(o=i.length,f&&o>15&&p(t,0,c),n.e=s=s-u-1,n.c=[],u=(s+1)%T,0>s&&(u+=T),o>u){for(u&&n.c.push(+i.slice(0,u)),o-=T;o>u;)n.c.push(+i.slice(u,u+=T));i=i.slice(u),u=T-i.length}else u-=o;for(;u--;i+="0");n.c.push(+i),v&&(n.e>t.maxE?n.c=n.e=null:n.e<t.minE&&(n.c=[n.e=0]))}else n.c=[n.e=0];return b=0,n}}();return l()}(),n=function(){return w}.call(r,t,r,e),!(void 0!==n&&(e.exports=n))}(this)},function(e,r,t){"use strict";r.array=t(153),r["boolean"]=t(175),r.number=t(4),r.bignumber=t(152),r.object=t(3),r.string=t(176),r.types=t(196)},function(e,r,t){"use strict";function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(this.nodes=e||[],!a(this.nodes)||!this.nodes.every(s))throw new TypeError("Array containing Nodes expected")}var i=t(173),o=(t(3),t(176)),a=(t(13),t(160),Array.isArray),s=i.isNode;n.prototype=new i,n.prototype.type="ArrayNode",n.prototype._compile=function(e){var r="array"!==e.math.config().matrix,t=this.nodes.map(function(r){return r._compile(e)});return(r?"math.matrix([":"[")+t.join(",")+(r?"])":"]")},n.prototype.forEach=function(e){for(var r=0;r<this.nodes.length;r++){var t=this.nodes[r];e(t,"nodes["+r+"]",this)}},n.prototype.map=function(e){for(var r=[],t=0;t<this.nodes.length;t++)r[t]=this._ifNode(e(this.nodes[t],"nodes["+t+"]",this));return new n(r)},n.prototype.clone=function(){return new n(this.nodes.slice(0))},n.prototype.toString=function(){return o.format(this.nodes)},n.prototype.toTex=function(e){e=e||"bmatrix";var r="\\begin{"+e+"}";return this.nodes.forEach(function(e){r+=e.nodes?e.nodes.map(function(e){return e.toTex()}).join("&"):e.toTex(),r+="\\\\"}),r+="\\end{"+e+"}"},e.exports=n},function(e,r,t){"use strict";function n(e,r){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!u(e))throw new TypeError('String expected for parameter "name"');if(!(r instanceof i))throw new TypeError('Node expected for parameter "expr"');if(e in a)throw new Error('Illegal symbol name, "'+e+'" is a reserved keyword');this.name=e,this.expr=r}var i=t(173),o=t(161),a=t(314),s=t(315),u=t(176).isString;n.prototype=new i,n.prototype.type="AssignmentNode",n.prototype._compile=function(e){return'scope["'+this.name+'"] = '+this.expr._compile(e)},n.prototype.forEach=function(e){e(this.expr,"expr",this)},n.prototype.map=function(e){return new n(this.name,this._ifNode(e(this.expr,"expr",this)))},n.prototype.clone=function(){return new n(this.name,this.expr)},n.prototype.toString=function(){return this.name+" = "+this.expr.toString()},n.prototype.toTex=function(){var e;return this.expr instanceof o&&(e=["\\mathbf{","}"]),s.addBraces(s.toSymbol(this.name),e)+"="+s.addBraces(this.expr.toTex())},e.exports=n},function(e,r,t){"use strict";function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!Array.isArray(e))throw new Error("Array expected");this.blocks=e.map(function(e){var r=e&&e.node,t=e&&void 0!==e.visible?e.visible:!0;if(!(r instanceof i))throw new TypeError('Property "node" must be a Node');if(!a(t))throw new TypeError('Property "visible" must be a boolean');return{node:r,visible:t}})}var i=t(173),o=t(12),a=t(175).isBoolean;n.prototype=new i,n.prototype.type="BlockNode",n.prototype._compile=function(e){e.ResultSet=o;var r=this.blocks.map(function(r){var t=r.node._compile(e);return r.visible?"results.push("+t+");":t+";"});return"(function () {var results = [];"+r.join("")+"return new ResultSet(results);})()"},n.prototype.forEach=function(e){for(var r=0;r<this.blocks.length;r++)e(this.blocks[r].node,"blocks["+r+"].node",this)},n.prototype.map=function(e){for(var r=[],t=0;t<this.blocks.length;t++){var i=this.blocks[t],o=this._ifNode(e(i.node,"blocks["+t+"].node",this));r[t]={node:o,visible:i.visible}}return new n(r)},n.prototype.clone=function(){var e=this.blocks.map(function(e){return{node:e.node,visible:e.visible}});return new n(e)},n.prototype.toString=function(){return this.blocks.map(function(e){return e.node.toString()+(e.visible?"":";")}).join("\n")},n.prototype.toTex=function(){return this.blocks.map(function(e){return e.node.toTex()+(e.visible?"":";")}).join("\n")},e.exports=n},function(e,r,t){"use strict";function n(e,r,t){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!(e instanceof i))throw new TypeError("Parameter condition must be a Node");if(!(r instanceof i))throw new TypeError("Parameter trueExpr must be a Node");if(!(t instanceof i))throw new TypeError("Parameter falseExpr must be a Node");this.condition=e,this.trueExpr=r,this.falseExpr=t}var i=t(173),o=t(315),a=t(159),s=t(6),u=t(10),f=t(160),c=f.string.isString,l=f.number.isNumber,p=f["boolean"].isBoolean;n.prototype=new i,n.prototype.type="ConditionalNode",n.prototype._compile=function(e){return e.testCondition=function(r){if(l(r)||p(r)||c(r))return r?!0:!1;if(r instanceof a)return r.isZero()?!1:!0;if(r instanceof s)return r.re||r.im?!0:!1;if(r instanceof u)return r.value?!0:!1;if(null===r||void 0===r)return!1;throw new TypeError('Unsupported type of condition "'+e.math["typeof"](r)+'"')},"testCondition("+this.condition._compile(e)+") ? ( "+this.trueExpr._compile(e)+") : ( "+this.falseExpr._compile(e)+")"},n.prototype.forEach=function(e){e(this.condition,"condition",this),e(this.trueExpr,"trueExpr",this),e(this.falseExpr,"falseExpr",this)},n.prototype.map=function(e){return new n(this._ifNode(e(this.condition,"condition",this)),this._ifNode(e(this.trueExpr,"trueExpr",this)),this._ifNode(e(this.falseExpr,"falseExpr",this)))},n.prototype.clone=function(){return new n(this.condition,this.trueExpr,this.falseExpr)},n.prototype.toString=function(){return"("+this.condition.toString()+") ? ("+this.trueExpr.toString()+") : ("+this.falseExpr.toString()+")"},n.prototype.toTex=function(){var e=o.addBraces(this.trueExpr.toTex())+", &\\quad"+o.addBraces("\\text{if}\\;"+this.condition.toTex())+"\\\\"+(o.addBraces(this.falseExpr.toTex())+", &\\quad"+o.addBraces("\\text{otherwise}"));return o.addBraces(e,["\\left\\{\\begin{array}{l l}","\\end{array}\\right."])},e.exports=n},function(e,r,t){"use strict";function n(e,r){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(r){if(!a(r))throw new TypeError('String expected for parameter "valueType"');if(!a(e))throw new TypeError('String expected for parameter "value"');this.value=e,this.valueType=r}else this.value=e+"",this.valueType=o(e);if(!s[this.valueType])throw new TypeError('Unsupported type of value "'+this.valueType+'"')}var i=t(173),o=(t(159),t(196).type),a=t(176).isString,s={number:!0,string:!0,"boolean":!0,undefined:!0,"null":!0};n.prototype=new i,n.prototype.type="ConstantNode",n.prototype._compile=function(e){switch(this.valueType){case"number":return"bignumber"===e.math.config().number?'math.bignumber("'+this.value+'")':this.value.replace(/^(0*)[0-9]/,function(e,r){return e.substring(r.length)});case"string":return'"'+this.value+'"';case"boolean":return this.value;case"undefined":return this.value;case"null":return this.value;default:throw new TypeError('Unsupported type of constant "'+this.valueType+'"')}},n.prototype.forEach=function(){},n.prototype.map=function(){return this.clone()},n.prototype.clone=function(){return new n(this.value,this.valueType)},n.prototype.toString=function(){switch(this.valueType){case"string":return'"'+this.value+'"';default:return this.value}},n.prototype.toTex=function(){var e,r=this.value;switch(this.valueType){case"string":return"\\text{"+r+"}";case"number":return e=r.toLowerCase().indexOf("e"),-1!==e?r.substring(0,e)+" \\cdot 10^{"+r.substring(e+1)+"}":r;default:return r}},e.exports=n},function(e,r,t){"use strict";function n(e,r,t){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!s(e))throw new TypeError('String expected for parameter "name"');if(!u(r)||!r.every(s))throw new TypeError('Array containing strings expected for parameter "params"');if(!(t instanceof i))throw new TypeError('Node expected for parameter "expr"');if(e in o)throw new Error('Illegal function name, "'+e+'" is a reserved keyword');this.name=e,this.params=r,this.expr=t}var i=t(173),o=t(314),a=t(315),s=t(176).isString,u=Array.isArray;n.prototype=new i,n.prototype.type="FunctionAssignmentNode",n.prototype._compile=function(e){return'scope["'+this.name+'"] = (function (scope) { scope = Object.create(scope); var fn = function '+this.name+"("+this.params.join(",")+") { if (arguments.length != "+this.params.length+') { throw new SyntaxError("Wrong number of arguments in function '+this.name+' (" + arguments.length + " provided, '+this.params.length+' expected)"); }'+this.params.map(function(e,r){return'scope["'+e+'"] = arguments['+r+"];"}).join("")+" return "+this.expr._compile(e)+' }; fn.syntax = "'+this.name+"("+this.params.join(", ")+')"; return fn; })(scope);'},n.prototype.forEach=function(e){e(this.expr,"expr",this)},n.prototype.map=function(e){var r=this._ifNode(e(this.expr,"expr",this));return new n(this.name,this.params.slice(0),r)},n.prototype.clone=function(){return new n(this.name,this.params.slice(0),this.expr)},n.prototype.toString=function(){return"function "+this.name+"("+this.params.join(", ")+") = "+this.expr.toString()},n.prototype.toTex=function(){return this.name+a.addBraces(this.params.map(a.toSymbol).join(", "),!0)+"="+a.addBraces(this.expr.toTex())},e.exports=n},function(e,r,t){"use strict";function n(e,r){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!(e instanceof i))throw new TypeError('Node expected for parameter "object"');if(!c(r)||!r.every(f))throw new TypeError('Array containing Nodes expected for parameter "ranges"');this.object=e,this.ranges=r}var i=t(173),o=t(170),a=t(171),s=t(159),u=t(7),f=i.isNode,c=Array.isArray;n.prototype=new i,n.prototype.type="IndexNode",n.prototype._compile=function(e){return this.compileSubset(e)},n.prototype.compileSubset=function(e,r){function t(e){return e instanceof a&&"end"==e.name}var n=!1,i=this.ranges.map(function(e){var r=e.filter(t).length>0;return n=r?r:n,r});e.range=function(e,r,t){return new u(e instanceof s?e.toNumber():e,r instanceof s?r.toNumber():r,t instanceof s?t.toNumber():t)};var f=this.ranges.map(function(r,t){var n=i[t];return r instanceof o?n?'(function (scope) { scope = Object.create(scope); scope["end"] = size['+t+"]; return range( "+r.start._compile(e)+", "+r.end._compile(e)+", "+(r.step?r.step._compile(e):"1")+" );})(scope)":"range("+r.start._compile(e)+", "+r.end._compile(e)+", "+(r.step?r.step._compile(e):"1")+")":n?'(function (scope) { scope = Object.create(scope); scope["end"] = size['+t+"]; return "+r._compile(e)+";})(scope)":r._compile(e)});return n?"(function () { var obj = "+this.object._compile(e)+"; var size = math.size(obj).valueOf(); return math.subset( obj, math.index("+f.join(", ")+") "+(r?", "+r:"")+" );})()":"math.subset("+this.object._compile(e)+",math.index("+f.join(", ")+")"+(r?", "+r:"")+")"},n.prototype.forEach=function(e){e(this.object,"object",this);for(var r=0;r<this.ranges.length;r++)e(this.ranges[r],"ranges["+r+"]",this)},n.prototype.map=function(e){for(var r=this._ifNode(e(this.object,"object",this)),t=[],i=0;i<this.ranges.length;i++)t[i]=this._ifNode(e(this.ranges[i],"ranges["+i+"]",this));return new n(r,t)},n.prototype.objectName=function(){return this.object.name},n.prototype.clone=function(){return new n(this.object,this.ranges.slice(0))},n.prototype.toString=function(){return this.object.toString()+"["+this.ranges.join(", ")+"]"},n.prototype.toTex=function(){return this.object.toTex()+"["+this.ranges.join(", ")+"]"},e.exports=n},function(e,r,t){"use strict";function n(e,r,t){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this.op=e,this.fn=r,this.args=t||[]}var i=t(173),o=t(165),a=t(171),s=t(169),u=t(315);n.prototype=new i,n.prototype.type="OperatorNode",n.prototype._compile=function(e){if(!(this.fn in e.math))throw new Error("Function "+this.fn+' missing in provided namespace "math"');var r=this.args.map(function(r){return r._compile(e)});return"math."+this.fn+"("+r.join(", ")+")"},n.prototype.forEach=function(e){for(var r=0;r<this.args.length;r++)e(this.args[r],"args["+r+"]",this)},n.prototype.map=function(e){for(var r=[],t=0;t<this.args.length;t++)r[t]=this._ifNode(e(this.args[t],"args["+t+"]",this));return new n(this.op,this.fn,r)},n.prototype.clone=function(){return new n(this.op,this.fn,this.args.slice(0))},n.prototype.toString=function(){var e=this.args;switch(e.length){case 1:return"-"==this.op?"-"+e[0].toString():e[0].toString()+this.op;case 2:var r=e[0].toString();e[0]instanceof n&&(r="("+r+")");var t=e[1].toString();return e[1]instanceof n&&(t="("+t+")"),r+" "+this.op+" "+t;default:return this.op+"("+this.args.join(", ")+")"}},n.prototype.toTex=function(){var e=this.args,r=u.toOperator(this.op),t=e[0],i=e[1];switch(e.length){case 1:return"-"===this.op||"+"===this.op?this.op+t.toTex():t.toTex()+this.op;case 2:var f=t.toTex(),c=!1,l=i.toTex(),p=!1,m="",h="";switch(this.op){case"/":m=r,r="";break;case"*":t instanceof n&&("+"===t.op||"-"===t.op)&&(c=!0),i instanceof n&&("+"===i.op||"-"===i.op?p=!0:"*"===i.op&&(p=!0)),r=(t instanceof o||t instanceof n)&&(i instanceof o||i instanceof n)?" \\cdot ":" \\, ";break;case"^":t instanceof n||t instanceof s?c=!0:t instanceof a&&(c=null);break;case"to":l=u.toUnit(l,!0)}return f=u.addBraces(f,c),l=u.addBraces(l,p),m+f+r+l+h;default:return r+"("+this.args.map(u.toSymbol).join(", ")+")"}},e.exports=n},function(e,r,t){"use strict";function n(e,r){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof e)throw new TypeError('string expected for parameter "name"');if(!u(r)||!r.every(s))throw new TypeError('Array containing Nodes expected for parameter "args"');this.name=e,this.args=r||[]}var i=t(173),o=t(171),a=t(315),s=i.isNode,u=Array.isArray;n.prototype=new i,n.prototype.type="FunctionNode",n.prototype._compile=function(e){var r=e.math[this.name],t="function"==typeof r&&1==r.rawArgs,n=this.args.map(function(r){return r._compile(e)});if(t){var i;do i="p"+Math.round(1e4*Math.random());while(i in e);return e[i]=this.args,'("'+this.name+'" in scope ? scope["'+this.name+'"]('+n.join(", ")+') : math["'+this.name+'"]('+i+", math, scope))"}var a=new o(this.name);return a._compile(e)+"("+n.join(", ")+")"},n.prototype.forEach=function(e){for(var r=0;r<this.args.length;r++)e(this.args[r],"args["+r+"]",this)},n.prototype.map=function(e){for(var r=[],t=0;t<this.args.length;t++)r[t]=this._ifNode(e(this.args[t],"args["+t+"]",this));return new n(this.name,r)},n.prototype.clone=function(){return new n(this.name,this.args.slice(0))},n.prototype.toString=function(){return this.name+"("+this.args.join(", ")+")"},n.prototype.toTex=function(){return a.toArgs(this)},e.exports=n},function(e,r,t){"use strict";function n(e,r,t){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!o(e))throw new TypeError("Node expected");if(!o(r))throw new TypeError("Node expected");if(t&&!o(t))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=e,this.end=r,this.step=t||null}var i=t(173),o=i.isNode;n.prototype=new i,n.prototype.type="RangeNode",n.prototype._compile=function(e){return"math.range("+this.start._compile(e)+", "+this.end._compile(e)+(this.step?", "+this.step._compile(e):"")+")"},n.prototype.forEach=function(e){e(this.start,"start",this),e(this.end,"end",this),this.step&&e(this.step,"step",this)},n.prototype.map=function(e){return new n(this._ifNode(e(this.start,"start",this)),this._ifNode(e(this.end,"end",this)),this.step&&this._ifNode(e(this.step,"step",this)))},n.prototype.clone=function(){return new n(this.start,this.end,this.step&&this.step)},n.prototype.toString=function(){var e=this.start.toString();return this.step&&(e+=":"+this.step.toString()),e+=":"+this.end.toString()},n.prototype.toTex=function(){var e=this.start.toTex();return this.step&&(e+=":"+this.step.toTex()),e+=":"+this.end.toTex()},e.exports=n},function(e,r,t){"use strict";
  33. function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!u(e))throw new TypeError('String expected for parameter "name"');this.name=e}function i(e){throw new Error("Undefined symbol "+e)}var o=t(173),a=t(10),s=t(315),u=t(176).isString;n.prototype=new o,n.prototype.type="SymbolNode",n.prototype._compile=function(e){return e.undef=i,e.Unit=a,this.name in e.math?'("'+this.name+'" in scope ? scope["'+this.name+'"] : math["'+this.name+'"])':'("'+this.name+'" in scope ? scope["'+this.name+'"] : '+(a.isValuelessUnit(this.name)?'new Unit(null, "'+this.name+'")':'undef("'+this.name+'")')+")"},n.prototype.forEach=function(){},n.prototype.map=function(){return this.clone()},n.prototype.clone=function(){return new n(this.name)},n.prototype.toString=function(){return this.name},n.prototype.toTex=function(){return s.toSymbol(this.name)},e.exports=n},function(e,r,t){"use strict";function n(e,r){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!(e instanceof o))throw new TypeError('Expected IndexNode for parameter "index"');if(!(r instanceof i))throw new TypeError('Expected Node for parameter "expr"');this.index=e,this.expr=r}var i=t(173),o=t(167);n.prototype=new i,n.prototype.type="UpdateNode",n.prototype._compile=function(e){return'scope["'+this.index.objectName()+'"] = '+this.index.compileSubset(e,this.expr._compile(e))},n.prototype.forEach=function(e){e(this.index,"index",this),e(this.expr,"expr",this)},n.prototype.map=function(e){return new n(this._ifNode(e(this.index,"index",this)),this._ifNode(e(this.expr,"expr",this)))},n.prototype.clone=function(){return new n(this.index,this.expr)},n.prototype.toString=function(){return this.index.toString()+" = "+this.expr.toString()},n.prototype.toTex=function(){return this.index.toTex()+" = "+this.expr.toTex()},e.exports=n},function(e,r,t){"use strict";function n(){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator")}function i(e){for(var r in e)if(e.hasOwnProperty(r)&&r in a)throw new Error('Scope contains an illegal symbol, "'+r+'" is a reserved keyword')}function o(e){var r=Object.create(e);for(var t in e)if(e.hasOwnProperty(t)){var n=e[t],i=n&&n.transform;i&&(r[t]=i)}return r}var a=t(314);n.prototype.eval=function(){throw new Error("Node.eval is deprecated. Use Node.compile(math).eval([scope]) instead.")},n.prototype.type="Node",n.prototype.compile=function(e){if(!(e instanceof Object))throw new TypeError("Object expected for parameter math");var r={math:o(e),_validateScope:i},t=this._compile(r),n=Object.keys(r).map(function(e){return" var "+e+' = defs["'+e+'"];'}),a=n.join(" ")+'return { "eval": function (scope) { if (scope) _validateScope(scope); scope = scope || {}; return '+t+"; }};",s=new Function("defs",a);return s(r)},n.prototype._compile=function(){throw new Error("Cannot compile a Node interface")},n.prototype.forEach=function(){throw new Error("Cannot run forEach on a Node interface")},n.prototype.map=function(){throw new Error("Cannot run map on a Node interface")},n.prototype._ifNode=function(e){if(!(e instanceof n))throw new TypeError("Callback function must return a Node");return e},n.prototype.traverse=function(e){function r(e,t){e.forEach(function(e,n,i){t(e,n,i),r(e,t)})}e(this,null,null),r(this,e)},n.prototype.transform=function(e){function r(e,t){return e.map(function(e,n,i){var o=t(e,n,i);return o!==e?o:r(e,t)})}var t=e(this,null,null);return t!==this?t:r(this,e)},n.prototype.filter=function(e){var r=[];return this.traverse(function(t,n,i){e(t,n,i)&&r.push(t)}),r},n.prototype.find=function(){throw new Error("Function Node.find is deprecated. Use Node.filter instead.")},n.prototype.match=function(){throw new Error("Function Node.match is deprecated. See functions Node.filter, Node.transform, Node.traverse.")},n.prototype.clone=function(){throw new Error("Cannot clone a Node interface")},n.prototype.toString=function(){return""},n.prototype.toTex=function(){return""},n.isNode=function(e){return e instanceof n},e.exports=n},function(e,r,t){var n=(t(156),t(157));r.transform=function(e){return e instanceof n?new n(e.index+1,e.min+1,e.max+1):e}},function(e,r){"use strict";r.isBoolean=function(e){return e instanceof Boolean||"boolean"==typeof e}},function(e,r,t){"use strict";function n(e,t){if(Array.isArray(e)){for(var i="[",o=e.length,a=0;o>a;a++)0!=a&&(i+=", "),i+=n(e[a],t);return i+="]"}return r.format(e,t)}var i=t(4),o=t(152),a=t(159);r.isString=function(e){return e instanceof String||"string"==typeof e},r.endsWith=function(e,r){var t=e.length-r.length,n=e.length;return e.substring(t,n)===r},r.format=function(e,t){return i.isNumber(e)?i.format(e,t):e instanceof a?o.format(e,t):Array.isArray(e)?n(e,t):r.isString(e)?'"'+e+'"':"function"==typeof e?e.syntax?e.syntax+"":"function":e instanceof Object?"function"==typeof e.format?e.format(t):e.toString():String(e)}},function(e){e.exports={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]}},function(e){e.exports={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]}},function(e){e.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:[]}},function(e){e.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:[]}},function(e){e.exports={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]}},function(e){e.exports={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]}},function(e){e.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:[]}},function(e){e.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:[]}},function(e){e.exports={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]}},function(e){e.exports={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]}},function(e){e.exports={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]}},function(e){e.exports={name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...",examples:["tau"],seealso:[]}},function(e){e.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:[]}},function(e){e.exports={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]}},function(e){e.exports={name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]}},function(e){e.exports={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]}},function(e){e.exports={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]}},function(e,r,t){"use strict";e.exports=function(e){function r(r){if(!s.hasOwnProperty(r))throw new Error("Unknown distribution "+r);var t=Array.prototype.slice.call(arguments,1),o=s[r].apply(this,t);return function(r){var t={random:function(r,t,i){var s,f,c;if(arguments.length>3)throw new e.error.ArgumentsError("random",arguments.length,0,3);if(1===arguments.length?a(r)?s=r:c=r:2===arguments.length?a(r)?(s=r,c=t):(f=r,c=t):(s=r,f=t,c=i),void 0===c&&(c=1),void 0===f&&(f=0),void 0!==s){var l=u(s.valueOf(),f,c,o);return s instanceof n?new n(l):l}return o(f,c)},randomInt:function(r,t,i){var o,f,c;if(arguments.length>3||arguments.length<1)throw new e.error.ArgumentsError("randomInt",arguments.length,1,3);if(1===arguments.length?a(r)?o=r:c=r:2===arguments.length?a(r)?(o=r,c=t):(f=r,c=t):(o=r,f=t,c=i),void 0===f&&(f=0),void 0!==o){var l=u(o.valueOf(),f,c,s);return o instanceof n?new n(l):l}return s(f,c)},pickRandom:function(r){if(1!==arguments.length)throw new e.error.ArgumentsError("pickRandom",arguments.length,1);if(r instanceof n)r=r.valueOf();else if(!Array.isArray(r))throw new e.error.UnsupportedTypeError("pickRandom",e["typeof"](r));if(i.size(r).length>1)throw new Error("Only one dimensional vectors supported");return r[Math.floor(Math.random()*r.length)]}},o=function(e,t){return e+r()*(t-e)},s=function(e,t){return Math.floor(e+r()*(t-e))},u=function(e,r,t,n){var i,o,a=[];if(e=e.slice(0),e.length>1)for(o=0,i=e.shift();i>o;o++)a.push(u(e,r,t,n));else for(o=0,i=e.shift();i>o;o++)a.push(n(r,t));return a};return t}(o)}var n=t(9),i=t(153),o=t(13),a=o.isCollection,s={uniform:function(){return Math.random},normal:function(){return function(){for(var e,r,t=-1;0>t||t>1;)e=Math.random(),r=Math.random(),t=1/6*Math.pow(-2*Math.log(e),.5)*Math.cos(2*Math.PI*r)+.5;return t}}};return r}},function(e,r,t){function n(e){return t(i(e))}function i(e){return o[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var o={"./clone":143,"./clone.js":143,"./filter":144,"./filter.js":144,"./forEach":151,"./forEach.js":151,"./format":145,"./format.js":145,"./import":146,"./import.js":146,"./map":147,"./map.js":147,"./print":148,"./print.js":148,"./sort":149,"./sort.js":149,"./typeof":150,"./typeof.js":150};n.keys=function(){return Object.keys(o)},n.resolve=i,e.exports=n,n.id=195},function(e,r){"use strict";r.type=function(e){var r=typeof e;if("object"===r){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 instanceof Function)return"function";if(e instanceof RegExp)return"regexp"}return r}},function(e){e.exports={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]}},function(e){e.exports={name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i",'"hello" + " world"',"3 cm + 2 inch"],seealso:["subtract"]}},function(e){e.exports={name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]}},function(e){e.exports={name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]}},function(e){e.exports={name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]}},function(e){e.exports={name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]}},function(e){e.exports={name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]}},function(e){e.exports={name:"dotpow",category:"Operators",syntax:["x .^ y","dotpow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]}},function(e){e.exports={name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["pow","log"]}},function(e){e.exports={name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]}},function(e){e.exports={name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]}},function(e){e.exports={name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]}},function(e){e.exports={name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]}},function(e){e.exports={name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log10"]}},function(e){e.exports={name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]}},function(e){e.exports={name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","function isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]}},function(e){e.exports={name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]}},function(e){e.exports={name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i))","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)","norm([[1, 2], [3, 4]], 'inf')","norm([[1, 2], [3, 4]], 'fro')"]}},function(e){e.exports={name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["sqrt","pow"]}},function(e){e.exports={name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3 = 8","2*2*2","1 + e ^ (pi * i)"],seealso:["multiply"]}},function(e){e.exports={name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)"],seealso:["ceil","floor","fix"]}},function(e){e.exports={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]}},function(e){e.exports={name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","multiply"]}},function(e){e.exports={name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]}},function(e){e.exports={name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]}},function(e){e.exports={name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]}},function(e){e.exports={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]}},function(e){e.exports={name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]}},function(e){e.exports={name:"bitAnd",category:"Bitwise",syntax:["x & y","bitAnd(x, y)"],description:"Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0",examples:["5 & 3","bitAnd(53, 131)","[1, 12, 31] & 42"],seealso:["bitNot","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]}},function(e){e.exports={name:"bitNot",category:"Bitwise",syntax:["~x","bitNot(x)"],description:"Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.",examples:["~1","~2","bitNot([2, -3, 4])"],seealso:["bitAnd","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]}},function(e){e.exports={name:"bitOr",category:"Bitwise",syntax:["x | y","bitOr(x, y)"],description:"Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.",examples:["5 | 3","bitOr([1, 2, 3], 4)"],seealso:["bitAnd","bitNot","bitXor","leftShift","rightArithShift","rightLogShift"]}},function(e){e.exports={name:"bitXor",category:"Bitwise",syntax:["bitXor(x, y)"],description:"Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.",examples:["bitOr(1, 2)","bitXor([2, 3, 4], 4)"],seealso:["bitAnd","bitNot","bitOr","leftShift","rightArithShift","rightLogShift"]}},function(e){e.exports={name:"leftShift",category:"Bitwise",syntax:["x << y","leftShift(x, y)"],description:"Bitwise left logical shift of a value x by y number of bits.",examples:["4 << 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]}},function(e){e.exports={name:"rightArithShift",category:"Bitwise",syntax:["x >> y","leftShift(x, y)"],description:"Bitwise right arithmetic shift of a value x by y number of bits.",examples:["8 >> 1","4 << 1","-12 >> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightLogShift"]}},function(e){e.exports={name:"rightLogShift",category:"Bitwise",syntax:["x >> y","leftShift(x, y)"],description:"Bitwise right logical shift of a value x by y number of bits.",examples:["8 >>> 1","4 << 1","-12 >>> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightArithShift"]}},function(e){e.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"]}},function(e){e.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"]}},function(e){e.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"]}},function(e){e.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"]}},function(e){e.exports={name:"bignumber",category:"Type",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","index","matrix","string","unit"]}},function(e){e.exports={name:"boolean",category:"Type",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]}},function(e){e.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:["bignumber","boolean","index","matrix","number","string","unit"]}},function(e){e.exports={name:"index",category:"Type",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["[]","[1, 2, 3]","A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[0:2, 0:2] = ones(2, 2)"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]}},function(e){e.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:["bignumber","boolean","complex","index","number","string","unit"]}},function(e){e.exports={name:"number",category:"Type",syntax:["x","number(x)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number("52cm", "m")'],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]}},function(e){e.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:["bignumber","boolean","complex","index","matrix","number","unit"]}},function(e){e.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:["bignumber","boolean","complex","index","matrix","number","string"]}},function(e){e.exports={name:"eval",category:"Expression",syntax:["eval(expression)","eval([expr1, expr2, expr3, ...])"],description:"Evaluate an expression or an array with expressions.",examples:['eval("2 + 3")','eval("sqrt(" + 4 + ")")'],seealso:[]}},function(e){e.exports={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]}},function(e){e.exports={name:"and",category:"Logical",syntax:["x and y","and(x, y)"],description:"Logical and. Test whether two values are both defined with a nonzero/nonempty value.",examples:["true and false","true and true","2 and 4"],seealso:["not","or","xor"]}},function(e){e.exports={name:"not",category:"Logical",syntax:["!x","not x","not(x)"],description:"Logical not. Flips the boolean value of given argument.",examples:["!true","not false","!2","!0"],seealso:["and","or","xor"]}},function(e){e.exports={name:"or",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical or. Test if at least one value is defined with a nonzero/nonempty value.",examples:["true or false","false or false","0 or 4"],seealso:["not","and","xor"]}},function(e){e.exports={name:"xor",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.",examples:["true xor false","false xor false","true xor true","0 or 4"],seealso:["not","and","or"]}},function(e){e.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 last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","eye","inv","ones","range","size","squeeze","subset","transpose","zeros"]}},function(e){e.exports={name:"cross",category:"Matrix",syntax:["cross(A, B)"],description:"Calculate the cross product for two vectors in three dimensional space.",examples:["cross([1, 1, 0], [0, 1, 1])","cross([3, -3, 1], [4, 9, 2])","cross([2, 3, 4], [5, 6, 7])"],seealso:["multiply","dot"]}},function(e){e.exports={name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","eye","inv","ones","range","size","squeeze","subset","transpose","zeros"]}},function(e){e.exports={name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","eye","inv","ones","range","size","squeeze","subset","transpose","zeros"]}},function(e){e.exports={name:"dot",category:"Matrix",syntax:["dot(A, B)"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]}},function(e){e.exports={name:"eye",category:"Matrix",syntax:["eye(n)","eye(m, n)","eye([m, n])","eye"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["eye(3)","eye(3, 5)","a = [1, 2, 3; 4, 5, 6]","eye(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","transpose","zeros"]}},function(e){e.exports={name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]}},function(e){e.exports={name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","eye","ones","range","size","squeeze","subset","transpose","zeros"]}},function(e){e.exports={name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])","ones"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","eye","inv","range","size","squeeze","subset","transpose","zeros"]}},function(e){e.exports={name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","eye","inv","ones","size","squeeze","subset","transpose","zeros"]}},function(e){e.exports={name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze"]}},function(e){e.exports={name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","det","diag","eye","inv","ones","range","squeeze","subset","transpose","zeros"]}},function(e){e.exports={name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","eye","inv","ones","range","size","subset","transpose","zeros"]}},function(e){e.exports={name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of a matrix or string. Indexes are one-based. Both the ranges lower-bound and upper-bound are included.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]"],seealso:["concat","det","diag","eye","inv","ones","range","size","squeeze","transpose","zeros"]}},function(e){e.exports={name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","eye","inv","ones","range","size","squeeze","subset","zeros"]}
  34. },function(e){e.exports={name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])","zeros"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","eye","inv","ones","range","size","squeeze","subset","transpose"]}},function(e){e.exports={name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["permutations","factorial"]}},function(e){e.exports={name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","permutations","gamma"]}},function(e){e.exports={name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]}},function(e){e.exports={name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","factorial"]}},function(e){e.exports={name:"pickRandom",category:"Probability",syntax:["pickRandom(array)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])"],seealso:["random","randomInt"]}},function(e){e.exports={name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]}},function(e){e.exports={name:"randInt",category:"Probability",syntax:["randInt()","randInt(max)","randInt(min, max)","randInt(size)","randInt(size, max)","randInt(size, min, max)"],description:"Return a random integer number",examples:["randInt()","randInt(10, 20)","randInt([2, 3], 10)"],seealso:["pickRandom","random"]}},function(e){e.exports={name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 if x is larger than y, -1 if x is smaller than y, and 0 if x and y are equal.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq"]}},function(e){e.exports={name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["[1,3,4] == [1,3,4]","[1,3,4] == [1,3]"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]}},function(e){e.exports={name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]}},function(e){e.exports={name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]}},function(e){e.exports={name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 > 1+1","2 >= 1+1","a = 3.2","b = 6-2.8","(a > b)"],seealso:["equal","unequal","smallerEq","smaller","largerEq","compare"]}},function(e){e.exports={name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]}},function(e){e.exports={name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 1+1","2 <= 1+1","a = 3.2","b = 6-2.8","(a < b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]}},function(e){e.exports={name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]}},function(e){e.exports={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dim)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3], 0)","max([2, 5; 4, 3], 1)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","var"]}},function(e){e.exports={name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dim)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3], 0)","mean([2, 5; 4, 3], 1)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","var"]}},function(e){e.exports={name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","var"]}},function(e){e.exports={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dim)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3], 0)","min([2, 5; 4, 3], 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","mean","median","prod","std","sum","var"]}},function(e){e.exports={name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","var"]}},function(e){e.exports={name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(var(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","sum","var"]}},function(e){e.exports={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","var"]}},function(e){e.exports={name:"var",category:"Statistics",syntax:["var(a, b, c, ...)","var(A)","var(A, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["var(2, 4, 6)","var([2, 4, 6, 8])",'var([2, 4, 6, 8], "uncorrected")','var([2, 4, 6, 8], "biased")',"var([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]}},function(e){e.exports={name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]}},function(e){e.exports={name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(2.3))"],seealso:["sin","acos","atan"]}},function(e){e.exports={name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(2.3))"],seealso:["tan","acos","asin"]}},function(e){e.exports={name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]}},function(e){e.exports={name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]}},function(e){e.exports={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]}},function(e){e.exports={name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]}},function(e){e.exports={name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]}},function(e){e.exports={name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]}},function(e){e.exports={name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]}},function(e){e.exports={name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]}},function(e){e.exports={name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]}},function(e){e.exports={name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]}},function(e){e.exports={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]}},function(e){e.exports={name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]}},function(e){e.exports={name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]}},function(e){e.exports={name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]}},function(e){e.exports={name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]}},function(e){e.exports={name:"map",category:"Utils",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], function(val) { return value * value })"],seealso:["filter","forEach"]}},function(e){e.exports={name:"filter",category:"Utils",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]}},function(e){e.exports={name:"forEach",category:"Utils",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["forEach([1, 2, 3], function(val) { console.log(val) })"],seealso:["map","sort","filter"]}},function(e){e.exports={name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]}},function(e){e.exports={name:"import",category:"Utils",syntax:["import(string)"],description:"Import functions from a file.",examples:['import("numbers")','import("./mylib.js")'],seealso:[]}},function(e){e.exports={name:"sort",category:"Utils",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc" or "desc", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"])',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)'],seealso:["map","filter","forEach"]}},function(e){e.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:[]}},function(e){"use strict";e.exports={end:!0}},function(e,r,t){"use strict";function n(){for(var e,r=Array.prototype.slice.call(arguments),t=0,n=r.length;n>t;t++){e=r[t];for(var i in e)e.hasOwnProperty(i)&&(w[i]=e[i])}}function i(e,r){return"undefined"!=typeof e[r]}function o(e){return function(r){return i(e,r)}}function a(e){return function(t){if("boolean"==typeof e[t])t=e[t]===!0?"\\"+t:"\\mathrm{"+t+"}";else if("string"==typeof e[t])t=e[t];else if("string"==typeof t){var n=t.indexOf("_");-1!==n&&(t=r.toSymbol(t.substring(0,n))+"_{"+r.toSymbol(t.substring(n+1))+"}")}return t}}var s=t(161),u=t(168),f={Alpha:"A",alpha:!0,Beta:"B",beta:!0,Gamma:!0,gamma:!0,Delta:!0,delta:!0,Epsilon:"E",epsilon:!0,varepsilon:!0,Zeta:"Z",zeta:!0,Eta:"H",eta:!0,Theta:!0,theta:!0,vartheta:!0,Iota:"I",iota:!0,Kappa:"K",kappa:!0,varkappa:!0,Lambda:!0,lambda:!0,Mu:"M",mu:!0,Nu:"N",nu:!0,Xi:!0,xi:!0,Omicron:"O",omicron:!0,Pi:!0,pi:!0,varpi:!0,Rho:"P",rho:!0,varrho:!0,Sigma:!0,sigma:!0,varsigma:!0,Tau:"T",tau:!0,Upsilon:!0,upsilon:!0,Phi:!0,phi:!0,varphi:!0,Chi:"X",chi:!0,Psi:!0,psi:!0,Omega:!0,omega:!0},c={dots:!0,ldots:!0,cdots:!0,vdots:!0,ddots:!0,idots:!0},l={"true":"\\mathrm{True}","false":"\\mathrm{False}"},p={inf:"\\infty",Inf:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:!0,undefined:"\\mathbf{?}"},m={acos:"\\cos^{-1}",arccos:"\\cos^{-1}",cos:!0,csc:!0,csch:!1,exp:!0,ker:!0,limsup:!0,min:!0,sinh:!0,asin:"\\sin^{-1}",arcsin:"\\sin^{-1}",cosh:!0,deg:!0,gcd:!0,lg:!0,ln:!0,Pr:!0,sup:!0,atan:"\\tan^{-1}",atan2:"\\tan2^{-1}",arctan:"\\tan^{-1}",cot:!0,det:!0,hom:!0,log:!0,log10:"\\log_{10}",sec:!0,sech:!1,tan:!0,arg:!0,coth:!0,dim:!0,inf:!0,max:!0,sin:!0,tanh:!0,fix:!1,lcm:!1,sign:!1,xgcd:!1,unaryMinus:!1,unaryPlus:!1,complex:!1,conj:!1,im:!1,re:!1,diag:!1,resize:!1,size:!1,squeeze:!1,subset:!1,index:!1,ones:!1,zeros:!1,range:!1,random:!1,mean:"\\mu",median:!1,prod:!1,std:"\\sigma","var":"\\sigma^2"},h={sqrt:!0,inv:!0,"int":"\\int",Int:"\\int",integrate:"\\int",eigenvalues:"\\lambda",liminf:!0,lim:!0,exp:"e^",sum:!0,eye:"\\mathbf{I}"},g={"<=":"\\leq",">=":"\\geq","!=":"\\neq","in":!0,"*":"\\cdot","/":"\\frac",mod:"\\bmod",to:"\\rightarrow"},d={deg:"^{\\circ}"},w={};n(m,h,f,c,l,p),r.isSymbol=o(w),r.toSymbol=a(w),r.isFunction=o(m),r.toFunction=a(m),r.isCurlyFunction=o(h),r.toCurlyFunction=a(h),r.isOperator=o(g),r.toOperator=a(g),r.isUnit=o(d),r.toUnit=function(){var e=a(d);return function(t,n){return r.isUnit(t)?e(t):(n?"":"\\,")+"\\mathrm{"+t+"}"}}(),r.addBraces=function(e,r,t){if(null===r)return e;var n=["",""];switch(t=t||"normal","undefined"==typeof r||r===!1?n=["{","}"]:r===!0?(n=["(",")"],t="lr"):n=Array.isArray(r)&&2===r.length?r:[r,r],t){case"normal":case!1:return n[0]+e+n[1];case"lr":return"\\left"+n[0]+"{"+e+"}\\right"+n[1];case"be":return"\\begin{"+n[0]+"}"+e+"\\end{"+n[1]+"}"}return n[0]+e+n[1]},r.toArgs=function(e){var t=e.name,n=e.args,i=r.toSymbol(e.name),o=null,a=null,f=!1,c=!1,l="",p="",m=null;switch(t){case"add":m="+";break;case"subtract":m="-";break;case"larger":m=">";break;case"largerEq":m=">=";break;case"smaller":m="<";break;case"smallerEq":m="<=";break;case"unequal":m="!=";break;case"equal":m="=";break;case"mod":m="mod";break;case"multiply":m="*";break;case"pow":m="^";break;case"concat":m="||";break;case"factorial":m="!";break;case"permutations":if(1!==n.length){var h=n[0].toTex(),g=n[1].toTex();return"\\frac{"+h+"!}{\\left("+h+" - "+g+"\\right)!}"}m="!";break;case"combinations":m="\\choose";break;case"abs":a="|",f="lr";break;case"norm":if(a="\\|",f="lr",2===n.length){var d=n[1].toTex();"\\text{inf}"===d?d="\\infty":"\\text{-inf}"===d?d="{- \\infty}":"\\text{fro}"===d&&(d="F"),p="_{"+d+"}",n=[n[0]]}break;case"ceil":a=["\\lceil","\\rceil"],f="lr";break;case"floor":a=["\\lfloor","\\rfloor"],f="lr";break;case"round":a=["\\lfloor","\\rceil"],f="lr",2===n.length&&(p="_"+r.addBraces(n[1].toTex()),n=[n[0]]);break;case"inv":p="^{-1}";break;case"transpose":p="^{T}",a=!1;break;case"log":var w="e";2===n.length&&(w=n[1].toTex(),i="\\log_{"+w+"}",n=[n[0]]),"e"===w&&(i="\\ln"),c=!0;break;case"square":p="^{2}";break;case"cube":p="^{3}";break;case"eye":c=!0,a=!1,i+="_";break;case"det":if(e.args[0]instanceof s)return e.args[0].toTex("vmatrix");a="vmatrix",f="be";break;default:c=!0}return null!==m?(a="+"===m||"-"===m,o=new u(m,t,n).toTex()):m=", ",null!==a||r.isCurlyFunction(t)||(a=!0),o=o||n.map(function(e){return"{"+e.toTex()+"}"}).join(m),l+(c?i:"")+r.addBraces(o,a,f)+p}}])});
  35. //# sourceMappingURL=math.map