!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).math=t()}}(function(){return function i(a,s,u){function p(e,t){if(!s[e]){if(!a[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(c)return c(e,!0);var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}var o=s[e]={exports:{}};a[e][0].call(o.exports,function(t){return p(a[e][1][t]||t)},o,o.exports,i,a,s,u)}return s[e].exports}for(var c="function"==typeof require&&require,t=0;t>e},rightLogShift:function(t,e){return t>>>e},or:function(t,e){return!(!t&&!e)},xor:function(t,e){return!!t!=!!e},and:function(t,e){return!(!t||!e)},not:function(t){return!t},equal:function(t,e){return t==e},unequal:function(t,e){return t!=e},smaller:function(t,e){return t=t.length&&a.slice(0,t.length)===t&&(s+=u[p[e]],a=a.slice(t.length,a.length),n=!0)}),n||(s+=a.slice(0,1),a=a.slice(1,a.length))};a;)c();return s}},{}],3:[function(t,e,n){e.exports=t("./lib/core/core")},{"./lib/core/core":4}],4:[function(t,e,n){"use strict";t("./../utils/polyfills");var u=t("./../utils/object").isFactory,p=t("./typed"),c=t("./../utils/emitter"),f=t("./function/import"),h=t("./function/config");n.create=function(t){if("function"!=typeof Object.create)throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var r=[],o=[],i=c.mixin({});i.type={},i.expression={transform:{},mathWithTransform:{}},i.typed=p.create(i.type);var a={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function s(t){if(!u(t))throw new Error("Factory object with properties `type`, `name`, and `factory` expected");var e,n=r.indexOf(t);return-1===n?(e=!0===t.math?t.factory(i.type,a,s,i.typed,i):t.factory(i.type,a,s,i.typed),r.push(t),o.push(e)):e=o[n],e}return i.import=s(f),i.config=s(h),i.expression.mathWithTransform.config=i.config,t&&i.config(t),i}},{"./../utils/emitter":52,"./../utils/object":55,"./../utils/polyfills":56,"./function/config":5,"./function/import":6,"./typed":7}],5:[function(t,e,n){"use strict";var u=t("../../utils/object");function p(t,e,n){if(void 0!==t[e]&&(a=n,s=t[e],-1===a.indexOf(s))){var r=(o=n,i=t[e],o.map(function(t){return t.toLowerCase()}).indexOf(i.toLowerCase()));-1!==r?(console.warn('Warning: Wrong casing for configuration option "'+e+'", should be "'+n[r]+'" instead of "'+t[e]+'".'),t[e]=n[r]):console.warn('Warning: Unknown value "'+t[e]+'" for configuration option "'+e+'". Available options: '+n.map(JSON.stringify).join(", ")+".")}var o,i,a,s}n.name="config",n.math=!0,n.factory=function(t,o,e,n,i){var a=["Matrix","Array"],s=["number","BigNumber","Fraction"];function r(t){if(t){var e=u.map(o,u.clone);p(t,"matrix",a),p(t,"number",s),u.deepExtend(o,t);var n=u.map(o,u.clone),r=u.map(t,u.clone);return i.emit("config",n,e,r),n}return u.map(o,u.clone)}return r.MATRIX=a,r.NUMBER=s,r}},{"../../utils/object":55}],6:[function(t,e,n){"use strict";function y(t){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var g=t("../../utils/object").lazy,v=t("../../utils/object").isFactory,b=t("../../utils/object").traverse,x=t("../../error/ArgumentsError");n.math=!0,n.name="import",n.factory=function(s,t,u,p,c){function f(t,e,n){if(n.wrap&&"function"==typeof e&&(r=function(){for(var t=[],e=0,n=arguments.length;e15 significant digits to BigNumber (value: "+t+"). Use function bignumber(x) to convert to BigNumber.");return new n.BigNumber(t)}},{from:"number",to:"Complex",convert:function(t){return new n.Complex(t,0)}},{from:"number",to:"string",convert:function(t){return t+""}},{from:"BigNumber",to:"Complex",convert:function(t){return new n.Complex(t.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(t){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(t){return new n.Complex(t.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(t){if(new n.Fraction(t).valueOf()!==t)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+t+"). Use function fraction(x) to convert to Fraction.");return new n.Fraction(t)}},{from:"string",to:"number",convert:function(t){var e=Number(t);if(isNaN(e))throw new Error('Cannot convert "'+t+'" to a number');return e}},{from:"string",to:"BigNumber",convert:function(e){try{return new n.BigNumber(e)}catch(t){throw new Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){try{return new n.Fraction(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){try{return new n.Complex(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(t){return+t}},{from:"boolean",to:"BigNumber",convert:function(t){return new n.BigNumber(+t)}},{from:"boolean",to:"Fraction",convert:function(t){return new n.Fraction(+t)}},{from:"boolean",to:"string",convert:function(t){return+t}},{from:"Array",to:"Matrix",convert:function(t){return new n.DenseMatrix(t)}},{from:"Matrix",to:"Array",convert:function(t){return t.valueOf()}}],t}},{"./../utils/bignumber/isBigNumber":48,"./../utils/collection/isMatrix":50,"./../utils/number":54,"typed-function":59}],8:[function(t,e,n){"use strict";function o(t,e,n,r){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");this.fn=t,this.count=e,this.min=n,this.max=r,this.message="Wrong number of arguments in function "+t+" ("+e+" provided, "+n+(null!=r?"-"+r:"")+" expected)",this.stack=(new Error).stack}(o.prototype=new Error).constructor=Error,o.prototype.name="ArgumentsError",o.prototype.isArgumentsError=!0,e.exports=o},{}],9:[function(t,e,n){"use strict";function r(t,e,n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.actual=t,this.expected=e,this.relation=n,this.message="Dimension mismatch ("+(Array.isArray(t)?"["+t.join(", ")+"]":t)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=(new Error).stack}(r.prototype=new RangeError).constructor=RangeError,r.prototype.name="DimensionError",r.prototype.isDimensionError=!0,e.exports=r},{}],10:[function(t,e,n){"use strict";function r(t,e,n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.index=t,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=n),void 0!==this.min&&this.index=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=(new Error).stack}(r.prototype=new RangeError).constructor=RangeError,r.prototype.name="IndexError",r.prototype.isIndexError=!0,e.exports=r},{}],11:[function(i,t,e){"use strict";var a=i("../../utils/collection/deepMap");e.name="compile",e.factory=function(t,e,n,r){var o=n(i("../parse"));return r("compile",{string:function(t){return o(t).compile()},"Array | Matrix":function(t){return a(t,function(t){return o(t).compile()})}})}},{"../../utils/collection/deepMap":49,"../parse":34}],12:[function(i,t,e){"use strict";var a=i("../../utils/collection/deepMap");e.name="eval",e.factory=function(t,e,n,r){var o=n(i("../parse"));return r("compile",{string:function(t){return o(t).compile().eval({})},"string, Object":function(t,e){return o(t).compile().eval(e)},"Array | Matrix":function(t){var e={};return a(t,function(t){return o(t).compile().eval(e)})},"Array | Matrix, Object":function(t,e){return a(t,function(t){return o(t).compile().eval(e)})}})}},{"../../utils/collection/deepMap":49,"../parse":34}],13:[function(i,t,e){"use strict";e.name="parse",e.factory=function(t,e,n,r){var o=n(i("../parse"));return r("parse",{"string | Array | Matrix":o,"string | Array | Matrix, Object":o})}},{"../parse":34}],14:[function(t,e,n){"use strict";e.exports={end:!0}},{}],15:[function(u,t,e){"use strict";var p=u("../../utils/customs").getSafeProperty;e.name="AccessorNode",e.path="expression.node",e.factory=function(n,t,e,r){var o=e(u("./Node")),s=e(u("./utils/access"));function i(t,e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(!n.isNode(t))throw new TypeError('Node expected for parameter "object"');if(!n.isIndexNode(e))throw new TypeError('IndexNode expected for parameter "index"');this.object=t||null,this.index=e,Object.defineProperty(this,"name",{get:function(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}})}function a(t){return!(n.isAccessorNode(t)||n.isArrayNode(t)||n.isConstantNode(t)||n.isFunctionNode(t)||n.isObjectNode(t)||n.isParenthesisNode(t)||n.isSymbolNode(t))}return(i.prototype=new o).type="AccessorNode",i.prototype.isAccessorNode=!0,i.prototype._compile=function(t,e){var i=this.object._compile(t,e),a=this.index._compile(t,e);if(this.index.isObjectProperty()){var r=this.index.getObjectProperty();return function(t,e,n){return p(i(t,e,n),r)}}return function(t,e,n){var r=i(t,e,n),o=a(t,e,r);return s(r,o)}},i.prototype.forEach=function(t){t(this.object,"object",this),t(this.index,"index",this)},i.prototype.map=function(t){return new i(this._ifNode(t(this.object,"object",this)),this._ifNode(t(this.index,"index",this)))},i.prototype.clone=function(){return new i(this.object,this.index)},i.prototype._toString=function(t){var e=this.object.toString(t);return a(this.object)&&(e="("+e+")"),e+this.index.toString(t)},i.prototype.toHTML=function(t){var e=this.object.toHTML(t);return a(this.object)&&(e='('+e+')'),e+this.index.toHTML(t)},i.prototype._toTex=function(t){var e=this.object.toTex(t);return a(this.object)&&(e="\\left(' + object + '\\right)"),e+this.index.toTex(t)},i.prototype.toJSON=function(){return{mathjs:"AccessorNode",object:this.object,index:this.index}},i.fromJSON=function(t){return new i(t.object,t.index)},i}},{"../../utils/customs":51,"./Node":24,"./utils/access":31}],16:[function(a,t,e){"use strict";var s=a("../../utils/array").map;e.name="ArrayNode",e.path="expression.node",e.factory=function(n,t,e,r){var o=e(a("./Node"));function i(t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(this.items=t||[],!Array.isArray(this.items)||!this.items.every(n.isNode))throw new TypeError("Array containing Nodes expected");var e=function(){throw new Error("Property `ArrayNode.nodes` is deprecated, use `ArrayNode.items` instead")};Object.defineProperty(this,"nodes",{get:e,set:e})}return(i.prototype=new o).type="ArrayNode",i.prototype.isArrayNode=!0,i.prototype._compile=function(e,n){var t=s(this.items,function(t){return t._compile(e,n)});if("Array"===e.config().matrix)return function(e,n,r){return s(t,function(t){return t(e,n,r)})};var o=e.matrix;return function(e,n,r){return o(s(t,function(t){return t(e,n,r)}))}},i.prototype.forEach=function(t){for(var e=0;e['+this.items.map(function(t){return t.toHTML(e)}).join(',')+']'},i.prototype._toTex=function(e){var n="\\begin{bmatrix}";return this.items.forEach(function(t){t.items?n+=t.items.map(function(t){return t.toTex(e)}).join("&"):n+=t.toTex(e),n+="\\\\"}),n+="\\end{bmatrix}"},i}},{"../../utils/array":46,"./Node":24}],17:[function(u,t,e){"use strict";var d=u("../../utils/customs").getSafeProperty,y=u("../../utils/customs").setSafeProperty;e.name="AssignmentNode",e.path="expression.node",e.factory=function(r,t,e,n){var o=e(u("./Node")),l=e(u("./utils/assign")),m=e(u("./utils/access")),i=u("../operators");function a(t,e,n){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(this.object=t,this.index=n?e:null,this.value=n||e,!r.isSymbolNode(t)&&!r.isAccessorNode(t))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(r.isSymbolNode(t)&&"end"===t.name)throw new Error('Cannot assign to symbol "end"');if(this.index&&!r.isIndexNode(this.index))throw new TypeError('IndexNode expected as "index"');if(!r.isNode(this.value))throw new TypeError('Node expected as "value"');Object.defineProperty(this,"name",{get:function(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}})}function s(t,e){e||(e="keep");var n=i.getPrecedence(t,e),r=i.getPrecedence(t.value,e);return"all"===e||null!==r&&r<=n}return(a.prototype=new o).type="AssignmentNode",a.prototype.isAssignmentNode=!0,a.prototype._compile=function(t,e){var a=this.object._compile(t,e),u=this.index?this.index._compile(t,e):null,p=this.value._compile(t,e),s=this.object.name;if(this.index){if(this.index.isObjectProperty()){var i=this.index.getObjectProperty();return function(t,e,n){var r=a(t,e,n),o=p(t,e,n);return y(r,i,o)}}if(r.isSymbolNode(this.object))return function(t,e,n){var r=a(t,e,n),o=p(t,e,n),i=u(t,e,r);return y(t,s,l(r,i,o)),o};var c=this.object.object._compile(t,e);if(this.object.index.isObjectProperty()){var f=this.object.index.getObjectProperty();return function(t,e,n){var r=c(t,e,n),o=d(r,f),i=u(t,e,o),a=p(t,e,n);return y(r,f,l(o,i,a)),a}}var h=this.object.index._compile(t,e);return function(t,e,n){var r=c(t,e,n),o=h(t,e,r),i=m(r,o),a=u(t,e,i),s=p(t,e,n);return l(r,o,l(i,a,s)),s}}if(!r.isSymbolNode(this.object))throw new TypeError("SymbolNode expected as object");return function(t,e,n){return y(t,s,p(t,e,n))}},a.prototype.forEach=function(t){t(this.object,"object",this),this.index&&t(this.index,"index",this),t(this.value,"value",this)},a.prototype.map=function(t){return new a(this._ifNode(t(this.object,"object",this)),this.index?this._ifNode(t(this.index,"index",this)):null,this._ifNode(t(this.value,"value",this)))},a.prototype.clone=function(){return new a(this.object,this.index,this.value)},a.prototype._toString=function(t){var e=this.object.toString(t),n=this.index?this.index.toString(t):"",r=this.value.toString(t);return s(this,t&&t.parenthesis)&&(r="("+r+")"),e+n+" = "+r},a.prototype.toJSON=function(){return{mathjs:"AssignmentNode",object:this.object,index:this.index,value:this.value}},a.fromJSON=function(t){return new a(t.object,t.index,t.value)},a.prototype.toHTML=function(t){var e=this.object.toHTML(t),n=this.index?this.index.toHTML(t):"",r=this.value.toHTML(t);return s(this,t&&t.parenthesis)&&(r='('+r+')'),e+n+'='+r},a.prototype._toTex=function(t){var e=this.object.toTex(t),n=this.index?this.index.toTex(t):"",r=this.value.toTex(t);return s(this,t&&t.parenthesis)&&(r="\\left(".concat(r,"\\right)")),e+n+":="+r},a}},{"../../utils/customs":51,"../operators":33,"./Node":24,"./utils/access":31,"./utils/assign":32}],18:[function(s,t,e){"use strict";var u=s("../../utils/array").forEach,p=s("../../utils/array").map;e.name="BlockNode",e.path="expression.node",e.factory=function(r,t,e,n){var o=e(s("./Node")),a=e(s("../../type/resultset/ResultSet"));function i(t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(!Array.isArray(t))throw new Error("Array expected");this.blocks=t.map(function(t){var e=t&&t.node,n=!t||void 0===t.visible||t.visible;if(!r.isNode(e))throw new TypeError('Property "node" must be a Node');if("boolean"!=typeof n)throw new TypeError('Property "visible" must be a boolean');return{node:e,visible:n}})}return(i.prototype=new o).type="BlockNode",i.prototype.isBlockNode=!0,i.prototype._compile=function(e,n){var t=p(this.blocks,function(t){return{eval:t.node._compile(e,n),visible:t.visible}});return function(n,r,o){var i=[];return u(t,function(t){var e=t.eval(n,r,o);t.visible&&i.push(e)}),new a(i)}},i.prototype.forEach=function(t){for(var e=0;e;')}).join('
')},i.prototype._toTex=function(e){return this.blocks.map(function(t){return t.node.toTex(e)+(t.visible?"":";")}).join("\\;\\;\n")},i}},{"../../type/resultset/ResultSet":45,"../../utils/array":46,"./Node":24}],19:[function(i,t,e){"use strict";var p=i("../operators");e.name="ConditionalNode",e.path="expression.node",e.factory=function(a,t,e,n){var r=e(i("./Node")),s=e(i("../../function/utils/typeof"));function o(t,e,n){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");if(!a.isNode(t))throw new TypeError("Parameter condition must be a Node");if(!a.isNode(e))throw new TypeError("Parameter trueExpr must be a Node");if(!a.isNode(n))throw new TypeError("Parameter falseExpr must be a Node");this.condition=t,this.trueExpr=e,this.falseExpr=n}return(o.prototype=new r).type="ConditionalNode",o.prototype.isConditionalNode=!0,o.prototype._compile=function(t,e){var r=this.condition._compile(t,e),o=this.trueExpr._compile(t,e),i=this.falseExpr._compile(t,e);return function(t,e,n){return function(t){if("number"==typeof t||"boolean"==typeof t||"string"==typeof t)return!!t;if(t){if(a.isBigNumber(t))return!t.isZero();if(a.isComplex(t))return!(!t.re&&!t.im);if(a.isUnit(t))return!!t.value}if(null!=t)throw new TypeError('Unsupported type of condition "'+s(t)+'"');return!1}(r(t,e,n))?o(t,e,n):i(t,e,n)}},o.prototype.forEach=function(t){t(this.condition,"condition",this),t(this.trueExpr,"trueExpr",this),t(this.falseExpr,"falseExpr",this)},o.prototype.map=function(t){return new o(this._ifNode(t(this.condition,"condition",this)),this._ifNode(t(this.trueExpr,"trueExpr",this)),this._ifNode(t(this.falseExpr,"falseExpr",this)))},o.prototype.clone=function(){return new o(this.condition,this.trueExpr,this.falseExpr)},o.prototype._toString=function(t){var e=t&&t.parenthesis?t.parenthesis:"keep",n=p.getPrecedence(this,e),r=this.condition.toString(t),o=p.getPrecedence(this.condition,e);("all"===e||"OperatorNode"===this.condition.type||null!==o&&o<=n)&&(r="("+r+")");var i=this.trueExpr.toString(t),a=p.getPrecedence(this.trueExpr,e);("all"===e||"OperatorNode"===this.trueExpr.type||null!==a&&a<=n)&&(i="("+i+")");var s=this.falseExpr.toString(t),u=p.getPrecedence(this.falseExpr,e);return("all"===e||"OperatorNode"===this.falseExpr.type||null!==u&&u<=n)&&(s="("+s+")"),r+" ? "+i+" : "+s},o.prototype.toJSON=function(){return{mathjs:"ConditionalNode",condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}},o.fromJSON=function(t){return new o(t.condition,t.trueExpr,t.falseExpr)},o.prototype.toHTML=function(t){var e=t&&t.parenthesis?t.parenthesis:"keep",n=p.getPrecedence(this,e),r=this.condition.toHTML(t),o=p.getPrecedence(this.condition,e);("all"===e||"OperatorNode"===this.condition.type||null!==o&&o<=n)&&(r='('+r+')');var i=this.trueExpr.toHTML(t),a=p.getPrecedence(this.trueExpr,e);("all"===e||"OperatorNode"===this.trueExpr.type||null!==a&&a<=n)&&(i='('+i+')');var s=this.falseExpr.toHTML(t),u=p.getPrecedence(this.falseExpr,e);return("all"===e||"OperatorNode"===this.falseExpr.type||null!==u&&u<=n)&&(s='('+s+')'),r+'?'+i+':'+s},o.prototype._toTex=function(t){return"\\begin{cases} {"+this.trueExpr.toTex(t)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(t)+"}\\\\{"+this.falseExpr.toTex(t)+"}, &\\quad{\\text{otherwise}}\\end{cases}"},o}},{"../../function/utils/typeof":38,"../operators":33,"./Node":24}],20:[function(s,t,e){"use strict";var u=s("../../utils/string").format,p=s("../../utils/latex").escape;e.name="ConstantNode",e.path="expression.node",e.factory=function(t,e,n,r){var o=n(s("./Node")),i=n(s("../../function/utils/typeof"));function a(t){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(2===arguments.length)throw new SyntaxError("new ConstantNode(valueStr, valueType) is not supported anymore since math v4.0.0. Use new ConstantNode(value) instead, where value is a non-stringified value.");this.value=t}return(a.prototype=new o).type="ConstantNode",a.prototype.isConstantNode=!0,a.prototype._compile=function(t,e){var n=this.value;return function(){return n}},a.prototype.forEach=function(t){},a.prototype.map=function(t){return this.clone()},a.prototype.clone=function(){return new a(this.value)},a.prototype._toString=function(t){return u(this.value,t)},a.prototype.toHTML=function(t){var e=this._toString(t);switch(i(this.value)){case"number":case"BigNumber":case"Fraction":return''+e+"";case"string":return''+e+"";case"boolean":return''+e+"";case"null":return''+e+"";case"undefined":return''+e+"";default:return''+e+""}},a.prototype.toJSON=function(){return{mathjs:"ConstantNode",value:this.value}},a.fromJSON=function(t){return new a(t.value)},a.prototype._toTex=function(t){var e=this._toString(t);switch(i(this.value)){case"string":return"\\mathtt{"+p(e)+"}";case"number":case"BigNumber":var n=e.toLowerCase().indexOf("e");return-1!==n?e.substring(0,n)+"\\cdot10^{"+e.substring(n+1)+"}":e;case"Fraction":return this.value.toLatex();default:return e}},a}},{"../../function/utils/typeof":38,"../../utils/latex":53,"../../utils/string":57,"./Node":24}],21:[function(a,t,e){"use strict";var s=a("../keywords"),u=a("../../utils/string").escape,f=a("../../utils/array").forEach,h=a("../../utils/array").join,p=a("../../utils/latex"),l=a("../operators"),m=a("../../utils/customs").setSafeProperty;e.name="FunctionAssignmentNode",e.path="expression.node",e.factory=function(r,t,e,c){var n=e(a("./Node"));function o(t,e,n){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof t)throw new TypeError('String expected for parameter "name"');if(!Array.isArray(e))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!r.isNode(n))throw new TypeError('Node expected for parameter "expr"');if(t in s)throw new Error('Illegal function name, "'+t+'" is a reserved keyword');this.name=t,this.params=e.map(function(t){return t&&t.name||t}),this.types=e.map(function(t){return t&&t.type||"any"}),this.expr=n}function i(t,e){var n=l.getPrecedence(t,e),r=l.getPrecedence(t.expr,e);return"all"===e||null!==r&&r<=n}return(o.prototype=new n).type="FunctionAssignmentNode",o.prototype.isFunctionAssignmentNode=!0,o.prototype._compile=function(t,e){var n=Object.create(e);f(this.params,function(t){n[t]=!0});var i=this.expr._compile(t,n),a=this.name,s=this.params,u=h(this.types,","),p=a+"("+h(this.params,", ")+")";return function(n,r,o){var t={};t[u]=function(){for(var t=Object.create(r),e=0;e'+u(this.params[r])+"");var o=this.expr.toHTML(t);return i(this,e)&&(o='('+o+')'),''+u(this.name)+'('+n.join(',')+')='+o},o.prototype._toTex=function(t){var e=t&&t.parenthesis?t.parenthesis:"keep",n=this.expr.toTex(t);return i(this,e)&&(n="\\left(".concat(n,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(p.toSymbol).join(",")+"\\right):="+n},o}},{"../../utils/array":46,"../../utils/customs":51,"../../utils/latex":53,"../../utils/string":57,"../keywords":14,"../operators":33,"./Node":24}],22:[function(p,t,e){"use strict";function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function v(){return(v=Object.assign||function(t){for(var e=1;e'+h(this.fn)+'('+t.join(',')+')'};var u=g.prototype.toTex;return g.prototype.toTex=function(t){var e;return t&&"object"===c(t.handler)&&l(t.handler,this.name)&&(e=t.handler[this.name](this,t)),void 0!==e?e:u.call(this,t)},g.prototype._toTex=function(e){var t,n,r=this.args.map(function(t){return t.toTex(e)});switch(!o[this.name]||"function"!=typeof o[this.name].toTex&&"object"!==c(o[this.name].toTex)&&"string"!=typeof o[this.name].toTex||(t=o[this.name].toTex),c(t)){case"function":n=t(this,e);break;case"string":n=s(t,this,e);break;case"object":switch(c(t[r.length])){case"function":n=t[r.length](this,e);break;case"string":n=s(t[r.length],this,e)}}return void 0!==n?n:s(f.defaultTemplate,this,e)},g.prototype.getIdentifier=function(){return this.type+":"+this.name},g}},{"../../utils/array":46,"../../utils/customs":51,"../../utils/latex":53,"../../utils/object":55,"../../utils/string":57,"./Node":24,"./SymbolNode":30}],23:[function(s,t,e){"use strict";var u=s("../../utils/array").map,p=s("../../utils/string").escape;e.name="IndexNode",e.path="expression.node",e.factory=function(m,t,e,n){var r=e(s("./Node")),o=e(s("../../type/matrix/Range")),i=Array.isArray;function a(t,e){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(this.dimensions=t,this.dotNotation=e||!1,!i(t)||!t.every(m.isNode))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties");var n=function(){throw new Error("Property `IndexNode.object` is deprecated, use `IndexNode.fn` instead")};Object.defineProperty(this,"object",{get:n,set:n})}function d(t,e,n){return new o(m.isBigNumber(t)?t.toNumber():t,m.isBigNumber(e)?e.toNumber():e,m.isBigNumber(n)?n.toNumber():n)}return(a.prototype=new r).type="IndexNode",a.prototype.isIndexNode=!0,a.prototype._compile=function(h,l){var o=u(this.dimensions,function(t,i){if(m.isRangeNode(t)){if(t.needsEnd()){var e=Object.create(l);e.end=!0;var a=t.start._compile(h,e),s=t.end._compile(h,e),u=t.step?t.step._compile(h,e):function(){return 1};return function(t,e,n){var r=h.size(n).valueOf(),o=Object.create(e);return o.end=r[i],d(a(t,o,n),s(t,o,n),u(t,o,n))}}var r=t.start._compile(h,l),o=t.end._compile(h,l),p=t.step?t.step._compile(h,l):function(){return 1};return function(t,e,n){return d(r(t,e,n),o(t,e,n),p(t,e,n))}}if(m.isSymbolNode(t)&&"end"===t.name){var n=Object.create(l);n.end=!0;var c=t._compile(h,n);return function(t,e,n){var r=h.size(n).valueOf(),o=Object.create(e);return o.end=r[i],c(t,o,n)}}var f=t._compile(h,l);return function(t,e,n){return f(t,e,n)}});return function(e,n,r){var t=u(o,function(t){return t(e,n,r)});return h.index.apply(h,t)}},a.prototype.forEach=function(t){for(var e=0;e.'+p(this.getObjectProperty())+"":'['+e.join(',')+']'},a.prototype._toTex=function(e){var t=this.dimensions.map(function(t){return t.toTex(e)});return this.dotNotation?"."+this.getObjectProperty():"_{"+t.join(",")+"}"},a}},{"../../type/matrix/Range":41,"../../utils/array":46,"../../utils/string":57,"./Node":24}],24:[function(t,e,n){"use strict";function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=t("../keywords"),u=t("../../utils/object").deepEqual,p=t("../../utils/object").hasOwnProperty;n.name="Node",n.path="expression.node",n.math=!0,n.factory=function(e,t,n,r,o){function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator")}return i.prototype.eval=function(t){return this.compile().eval(t)},i.prototype.type="Node",i.prototype.isNode=!0,i.prototype.comment="",i.prototype.compile=function(){var n=this._compile(o.expression.mathWithTransform,{}),r={};return{eval:function(t){var e=t||{};return function(t){for(var e in t)if(p(t,e)&&e in s)throw new Error('Scope contains an illegal symbol, "'+e+'" is a reserved keyword')}(e),n(e,r,null)}}},i.prototype._compile=function(t,e){throw new Error("Method _compile should be implemented by type "+this.type)},i.prototype.forEach=function(t){throw new Error("Cannot run forEach on a Node interface")},i.prototype.map=function(t){throw new Error("Cannot run map on a Node interface")},i.prototype._ifNode=function(t){if(!e.isNode(t))throw new TypeError("Callback function must return a Node");return t},i.prototype.traverse=function(t){t(this,null,null),function r(t,o){t.forEach(function(t,e,n){o(t,e,n),r(t,o)})}(this,t)},i.prototype.transform=function(t){return function r(t,o){return t.map(function(t,e,n){return r(o(t,e,n),o)})}(t(this,null,null),t)},i.prototype.filter=function(r){var o=[];return this.traverse(function(t,e,n){r(t,e,n)&&o.push(t)}),o},i.prototype.find=function(){throw new Error("Function Node.find is deprecated. Use Node.filter instead.")},i.prototype.match=function(){throw new Error("Function Node.match is deprecated. See functions Node.filter, Node.transform, Node.traverse.")},i.prototype.clone=function(){throw new Error("Cannot clone a Node interface")},i.prototype.cloneDeep=function(){return this.map(function(t){return t.cloneDeep()})},i.prototype.equals=function(t){return!!t&&u(this,t)},i.prototype.toString=function(t){var e;if(t&&"object"===a(t))switch(a(t.handler)){case"object":case"undefined":break;case"function":e=t.handler(this,t);break;default:throw new TypeError("Object or function expected as callback")}return void 0!==e?e:this._toString(t)},i.prototype.toJSON=function(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)},i.prototype.toHTML=function(t){var e;if(t&&"object"===a(t))switch(a(t.handler)){case"object":case"undefined":break;case"function":e=t.handler(this,t);break;default:throw new TypeError("Object or function expected as callback")}return void 0!==e?e:this.toHTML(t)},i.prototype._toString=function(){throw new Error("_toString not implemented for "+this.type)},i.prototype.toTex=function(t){var e;if(t&&"object"===a(t))switch(a(t.handler)){case"object":case"undefined":break;case"function":e=t.handler(this,t);break;default:throw new TypeError("Object or function expected as callback")}return void 0!==e?e:this._toTex(t)},i.prototype._toTex=function(t){throw new Error("_toTex not implemented for "+this.type)},i.prototype.getIdentifier=function(){return this.type},i.prototype.getContent=function(){return this},i}},{"../../utils/object":55,"../keywords":14}],25:[function(a,t,e){"use strict";function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var u=a("../../utils/string").stringify,p=a("../../utils/string").escape,c=a("../../utils/customs").isSafeProperty,f=a("../../utils/object").hasOwnProperty;e.name="ObjectNode",e.path="expression.node",e.factory=function(n,t,e,r){var o=e(a("./Node"));function i(e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(this.properties=e||{},e&&("object"!==s(e)||!Object.keys(e).every(function(t){return n.isNode(e[t])})))throw new TypeError("Object containing Nodes expected")}return(i.prototype=new o).type="ObjectNode",i.prototype.isObjectNode=!0,i.prototype._compile=function(t,e){var i={};for(var n in this.properties)if(f(this.properties,n)){var r=u(n),o=JSON.parse(r);if(!c(this.properties,o))throw new Error('No access to property "'+o+'"');i[o]=this.properties[n]._compile(t,e)}return function(t,e,n){var r={};for(var o in i)f(i,o)&&(r[o]=i[o](t,e,n));return r}},i.prototype.forEach=function(t){for(var e in this.properties)this.properties.hasOwnProperty(e)&&t(this.properties[e],"properties["+u(e)+"]",this)},i.prototype.map=function(t){var e={};for(var n in this.properties)this.properties.hasOwnProperty(n)&&(e[n]=this._ifNode(t(this.properties[n],"properties["+u(n)+"]",this)));return new i(e)},i.prototype.clone=function(){var t={};for(var e in this.properties)this.properties.hasOwnProperty(e)&&(t[e]=this.properties[e]);return new i(t)},i.prototype._toString=function(t){var e=[];for(var n in this.properties)this.properties.hasOwnProperty(n)&&e.push(u(n)+": "+this.properties[n].toString(t));return"{"+e.join(", ")+"}"},i.prototype.toJSON=function(){return{mathjs:"ObjectNode",properties:this.properties}},i.fromJSON=function(t){return new i(t.properties)},i.prototype.toHTML=function(t){var e=[];for(var n in this.properties)this.properties.hasOwnProperty(n)&&e.push(''+p(n)+':'+this.properties[n].toHTML(t));return'{'+e.join(',')+'}'},i.prototype._toTex=function(t){var e=[];for(var n in this.properties)this.properties.hasOwnProperty(n)&&e.push("\\mathbf{"+n+":} & "+this.properties[n].toTex(t)+"\\\\");return"\\left\\{\\begin{array}{ll}".concat(e.join("\n"),"\\end{array}\\right\\}")},i}},{"../../utils/customs":51,"../../utils/object":55,"../../utils/string":57,"./Node":24}],26:[function(a,t,e){"use strict";var m=a("../../utils/latex"),s=a("../../utils/array").map,c=a("../../utils/string").escape,u=a("../../utils/customs").isSafeMethod,p=a("../../utils/customs").getSafeProperty,x=a("../operators");e.name="OperatorNode",e.path="expression.node",e.factory=function(o,t,e,n){var r=e(a("./Node"));function i(t,e,n,r){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof t)throw new TypeError('string expected for parameter "op"');if("string"!=typeof e)throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(n)||!n.every(o.isNode))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=!0===r,this.op=t,this.fn=e,this.args=n||[]}function l(o,i,t,e,n){var r,a=x.getPrecedence(o,i),s=x.getAssociativity(o,i);if("all"===i||2)'),"right"===i?''+c(this.op)+""+a:''+c(this.op)+""+a}if(2===r.length){var s=r[0].toHTML(n),u=r[1].toHTML(n);return o[0]&&(s='('+s+')'),o[1]&&(u='('+u+')'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===e?s+''+u:s+''+c(this.op)+""+u}var p=r.map(function(t,e){return t=t.toHTML(n),o[e]&&(t='('+t+')'),t});return 2'):p.join(''+c(this.op)+""):''+c(this.fn)+'('+p.join(',')+')'},i.prototype._toTex=function(n){var t=n&&n.parenthesis?n.parenthesis:"keep",e=n&&n.implicit?n.implicit:"hide",r=this.args,o=l(this,t,e,r,!0),i=m.operators[this.fn];if(i=void 0===i?this.op:i,1===r.length){var a=x.getAssociativity(this,t),s=r[0].toTex(n);return o[0]&&(s="\\left(".concat(s,"\\right)")),"right"===a?i+s:s+i}if(2===r.length){var u=r[0],p=u.toTex(n);o[0]&&(p="\\left(".concat(p,"\\right)"));var c,f=r[1].toTex(n);switch(o[1]&&(f="\\left(".concat(f,"\\right)")),c="keep"===t?u.getIdentifier():u.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return i+"{"+p+"}{"+f+"}";case"OperatorNode:pow":switch(p="{"+p+"}",f="{"+f+"}",c){case"ConditionalNode":case"OperatorNode:divide":p="\\left(".concat(p,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&"hide"===e)return p+"~"+f}return p+i+f}if(2('+this.content.toHTML(t)+')':this.content.toHTML(t)},i.prototype._toTex=function(t){return!t||t&&!t.parenthesis||t&&"keep"===t.parenthesis?"\\left(".concat(this.content.toTex(t),"\\right)"):this.content.toTex(t)},i}},{"./Node":24}],28:[function(s,t,e){"use strict";var u=s("../operators");e.name="RangeNode",e.path="expression.node",e.factory=function(r,t,e,n){var o=e(s("./Node"));function i(t,e,n){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(!r.isNode(t))throw new TypeError("Node expected");if(!r.isNode(e))throw new TypeError("Node expected");if(n&&!r.isNode(n))throw new TypeError("Node expected");if(3('+r+')'),e=r,this.step){var o=this.step.toHTML(t);n.step&&(o='('+o+')'),e+=':'+o}var i=this.end.toHTML(t);return n.end&&(i='('+i+')'),e+=':'+i},i.prototype._toTex=function(t){var e=a(this,t&&t.parenthesis?t.parenthesis:"keep"),n=this.start.toTex(t);if(e.start&&(n="\\left(".concat(n,"\\right)")),this.step){var r=this.step.toTex(t);e.step&&(r="\\left(".concat(r,"\\right)")),n+=":"+r}var o=this.end.toTex(t);return e.end&&(o="\\left(".concat(o,"\\right)")),n+=":"+o},i}},{"../operators":33,"./Node":24}],29:[function(a,t,e){"use strict";var s=a("../operators"),u=a("../../utils/latex"),c=a("../../utils/string").escape;e.name="RelationalNode",e.path="expression.node",e.factory=function(t,e,n,r){var o=n(a("./Node")),p=a("../../utils/customs").getSafeProperty;function i(t,e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(!Array.isArray(t))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(e))throw new TypeError("Parameter params must be an array");if(t.length!==e.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=t,this.params=e}return(i.prototype=new o).type="RelationalNode",i.prototype.isRelationalNode=!0,i.prototype._compile=function(a,e){var s=this,u=this.params.map(function(t){return t._compile(a,e)});return function(t,e,n){for(var r,o=u[0](t,e,n),i=0;i",smallerEq:"<=",largerEq:">="},n=t[0],a=0;a('+t.toHTML(r)+')':t.toHTML(r)}),e={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="},n=t[0],a=0;a'+c(e[this.conditionals[a]])+""+t[a+1];return n},i.prototype._toTex=function(r){for(var o=r&&r.parenthesis?r.parenthesis:"keep",i=s.getPrecedence(this,o),t=this.params.map(function(t,e){var n=s.getPrecedence(t,o);return"all"===o||null!==n&&n<=i?"\\left("+t.toString(r)+"\right)":t.toString(r)}),e=t[0],n=0;n'+e+"":"i"===e?''+e+"":"Infinity"===e?''+e+"":"NaN"===e?''+e+"":"null"===e?''+e+"":"undefined"===e?''+e+"":''+e+""},i.prototype.toJSON=function(){return{mathjs:"SymbolNode",name:this.name}},i.fromJSON=function(t){return new i(t.name)},i.prototype._toTex=function(t){var e=!1;void 0===r[this.name]&&s(this.name)&&(e=!0);var n=p.toSymbol(this.name,e);return"\\"===n[0]?n:" "+n},i}},{"../../utils/customs":51,"../../utils/latex":53,"../../utils/object":55,"../../utils/string":57,"./Node":24}],31:[function(i,t,e){"use strict";function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=i("../../transform/error.transform").transform,u=i("../../../utils/customs").getSafeProperty;e.factory=function(t,e,n,r){var o=n(i("../../../function/matrix/subset"));return function(t,e){try{if(Array.isArray(t))return o(t,e);if(t&&"function"==typeof t.subset)return t.subset(e);if("string"==typeof t)return o(t,e);if("object"!==a(t))throw new TypeError("Cannot apply index: unsupported type of object");if(!e.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return u(t,e.getObjectProperty())}catch(t){throw s(t)}}}},{"../../../function/matrix/subset":36,"../../../utils/customs":51,"../../transform/error.transform":35}],32:[function(a,t,e){"use strict";function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var u=a("../../transform/error.transform").transform,p=a("../../../utils/customs").setSafeProperty;e.factory=function(t,e,n,r){var o=n(a("../../../function/matrix/subset")),i=n(a("../../../type/matrix/function/matrix"));return function(t,e,n){try{if(Array.isArray(t))return i(t).subset(e,n).valueOf();if(t&&"function"==typeof t.subset)return t.subset(e,n);if("string"==typeof t)return o(t,e,n);if("object"!==s(t))throw new TypeError("Cannot apply index: unsupported type of object");if(!e.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return p(t,e.getObjectProperty(),n),t}catch(t){throw u(t)}}}},{"../../../function/matrix/subset":36,"../../../type/matrix/function/matrix":42,"../../../utils/customs":51,"../../transform/error.transform":35}],33:[function(t,e,n){"use strict";var c=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{associativity:"left",associativeWith:[]}},{"OperatorNode:and":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{associativity:"left",associativeWith:[]},"OperatorNode:unequal":{associativity:"left",associativeWith:[]},"OperatorNode:smaller":{associativity:"left",associativeWith:[]},"OperatorNode:larger":{associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{associativity:"left",associativeWith:[]}},{"OperatorNode:to":{associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{associativity:"left",associativeWith:[]},"OperatorNode:mod":{associativity:"left",associativeWith:[]}},{"OperatorNode:unaryPlus":{associativity:"right"},"OperatorNode:unaryMinus":{associativity:"right"},"OperatorNode:bitNot":{associativity:"right"},"OperatorNode:not":{associativity:"right"}},{"OperatorNode:pow":{associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{associativity:"left"}},{"OperatorNode:transpose":{associativity:"left"}}];function f(t,e){var n=t;"keep"!==e&&(n=t.getContent());for(var r=n.getIdentifier(),o=0;o":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},O={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},S={true:!0,false:!1,null:null,undefined:void 0},j=["NaN","Infinity"];function k(t,e){return t.expression.substr(t.index,e)}function T(t){return k(t,1)}function A(t){t.index++}function P(t){return t.expression.charAt(t.index-1)}function M(t){return t.expression.charAt(t.index+1)}function C(t){for(t.tokenType=N.NULL,t.token="",t.comment="";w.isWhitespace(T(t),t.nestingLevel);)A(t);if("#"===T(t))for(;"\n"!==T(t)&&""!==T(t);)t.comment+=T(t),A(t);if(""!==T(t)){if("\n"===T(t)&&!t.nestingLevel)return t.tokenType=N.DELIMITER,t.token=T(t),void A(t);var e=T(t),n=k(t,2),r=k(t,3);if(3===r.length&&E[r])return t.tokenType=N.DELIMITER,t.token=r,A(t),A(t),void A(t);if(2===n.length&&E[n])return t.tokenType=N.DELIMITER,t.token=n,A(t),void A(t);if(E[e])return t.tokenType=N.DELIMITER,t.token=e,void A(t);if(w.isDigitDot(e)){if(t.tokenType=N.NUMBER,"."===T(t))t.token+=T(t),A(t),w.isDigit(T(t))||(t.tokenType=N.DELIMITER);else{for(;w.isDigit(T(t));)t.token+=T(t),A(t);w.isDecimalMark(T(t),M(t))&&(t.token+=T(t),A(t))}for(;w.isDigit(T(t));)t.token+=T(t),A(t);if("E"===T(t)||"e"===T(t))if(w.isDigit(M(t))||"-"===M(t)||"+"===M(t)){if(t.token+=T(t),A(t),"+"!==T(t)&&"-"!==T(t)||(t.token+=T(t),A(t)),!w.isDigit(T(t)))throw nt(t,'Digit expected, got "'+T(t)+'"');for(;w.isDigit(T(t));)t.token+=T(t),A(t);if(w.isDecimalMark(T(t),M(t)))throw nt(t,'Digit expected, got "'+T(t)+'"')}else if("."===M(t))throw A(t),nt(t,'Digit expected, got "'+T(t)+'"')}else{if(!w.isAlpha(T(t),P(t),M(t))){for(t.tokenType=N.UNKNOWN;""!==T(t);)t.token+=T(t),A(t);throw nt(t,'Syntax error in part "'+t.token+'"')}for(;w.isAlpha(T(t),P(t),M(t))||w.isDigit(T(t));)t.token+=T(t),A(t);O.hasOwnProperty(t.token)?t.tokenType=N.DELIMITER:t.tokenType=N.SYMBOL}}else t.tokenType=N.DELIMITER}function I(t){for(;C(t),"\n"===t.token;);}function F(t){t.nestingLevel++}function _(t){t.nestingLevel--}function D(t,e){var n={extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:N.NULL,nestingLevel:0,conditionalLevel:null};it(n,{expression:t,extraNodes:e}),C(n);var r=function(t){var e,n,r=[];for(""!==t.token&&"\n"!==t.token&&";"!==t.token&&((e=L(t)).comment=t.comment);"\n"===t.token||";"===t.token;)0===r.length&&e&&(n=";"!==t.token,r.push({node:e,visible:n})),C(t),"\n"!==t.token&&";"!==t.token&&""!==t.token&&((e=L(t)).comment=t.comment,n=";"!==t.token,r.push({node:e,visible:n}));return 0":"larger","<=":"smallerEq",">=":"largerEq"};r.hasOwnProperty(t.token);){var o={name:t.token,fn:r[t.token]};n.push(o),I(t),e.push(U(t))}return 1===e.length?e[0]:2===e.length?new f(n[0].name,n[0].fn,e):new b(n.map(function(t){return t.fn}),e)}function U(t){var e,n,r,o,i;for(e=J(t),n={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};n.hasOwnProperty(t.token);)o=n[r=t.token],I(t),i=[e,J(t)],e=new f(r,o,i);return e}function J(t){var e,n,r,o,i;for(e=z(t),n={to:"to",in:"to"};n.hasOwnProperty(t.token);)o=n[r=t.token],I(t),e="in"===r&&""===t.token?new f("*","multiply",[e,new x("in")],!0):(i=[e,z(t)],new f(r,o,i));return e}function z(t){var e,n=[];if(e=":"===t.token?new d(1):$(t),":"===t.token&&t.conditionalLevel!==t.nestingLevel){for(n.push(e);":"===t.token&&n.length<3;)I(t),")"===t.token||"]"===t.token||","===t.token||""===t.token?n.push(new x("end")):n.push($(t));e=3===n.length?new r(n[0],n[2],n[1]):new r(n[0],n[1])}return e}function $(t){var e,n,r,o,i;for(e=V(t),n={"+":"add","-":"subtract"};n.hasOwnProperty(t.token);)o=n[r=t.token],I(t),i=[e,V(t)],e=new f(r,o,i);return e}function V(t){var e,n,r,o,i;for(n=e=X(t),r={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"};r.hasOwnProperty(t.token);)i=r[o=t.token],I(t),n=X(t),e=new f(o,i,[e,n]);return e}function X(t){var e,n;for(n=e=Y(t);t.tokenType===N.SYMBOL||"in"===t.token&&a.isConstantNode(e)||!(t.tokenType!==N.NUMBER||a.isConstantNode(n)||a.isOperatorNode(n)&&"!"!==n.op)||"("===t.token;)n=Y(t),e=new f("*","multiply",[e,n],!0);return e}function Y(t){for(var e=Z(t),n=e,r=[];"/"===t.token&&a.isConstantNode(n);){if(r.push(it({},t)),I(t),t.tokenType!==N.NUMBER){it(t,r.pop());break}if(r.push(it({},t)),I(t),t.tokenType!==N.SYMBOL&&"("!==t.token){r.pop(),it(t,r.pop());break}it(t,r.pop()),r.pop(),n=Z(t),e=new f("/","divide",[e,n])}return e}function Z(t){var e,n,r,o,i,a,s,u,p={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return p.hasOwnProperty(t.token)?(r=p[t.token],e=t.token,I(t),n=[Z(t)],new f(e,r,n)):(i=function(t){var e,n,r,o;for(e=function(t){var e,n,r,o,i,a,s,u,p,c=[];if(t.tokenType===N.SYMBOL&&t.extraNodes.hasOwnProperty(t.token)){var f=t.extraNodes[t.token];if(C(t),"("===t.token){if(c=[],F(t),C(t),")"!==t.token)for(c.push(L(t));","===t.token;)C(t),c.push(L(t));if(")"!==t.token)throw nt(t,"Parenthesis ) expected");_(t),C(t)}return new f(c)}return(e=t).tokenType===N.SYMBOL||e.tokenType===N.DELIMITER&&e.token in O?(r=e.token,C(e),n=S.hasOwnProperty(r)?new d(S[r]):-1!==j.indexOf(r)?new d(l(r,"number")):new x(r),n=G(e,n)):'"'!==(o=e).token?"'"!==(s=o).token?function(t){var e,n,r,o;if("["!==t.token)return function(t){if("{"!==t.token)return(e=t).tokenType!==N.NUMBER?function(t){var e;if("("!==t.token)return function(t){throw""===t.token?nt(t,"Unexpected end of expression"):nt(t,"Value expected")}(t);if(F(t),C(t),e=L(t),")"===t.token)return _(t),C(t),e=new g(e),e=G(t,e);throw nt(t,"Parenthesis ) expected")}(e):(n=e.token,C(e),new d(l(n,h.number)));var e,n,r,o={};do{if(C(t),"}"!==t.token){if('"'===t.token)r=K(t);else if("'"===t.token)r=Q(t);else{if(t.tokenType!==N.SYMBOL)throw nt(t,"Symbol or string expected as object key");r=t.token,C(t)}if(":"!==t.token)throw nt(t,"Colon : expected after object key");C(t),o[r]=L(t)}}while(","===t.token);if("}"!==t.token)throw nt(t,"Comma , or bracket } expected after object value");C(t);var i=new y(o);return i=G(t,i)}(t);if(F(t),C(t),"]"!==t.token){var i=tt(t);if(";"===t.token){for(r=1,n=[i];";"===t.token;)C(t),n[r]=tt(t),r++;if("]"!==t.token)throw nt(t,"End of matrix ] expected");_(t),C(t),o=n[0].items.length;for(var a=1;ai)for(var u=i-1,p=a.length;u")}(t,e,0)},n.validateIndex=function(t,e){if(!o.default.isNumber(t)||!o.default.isInteger(t))throw new TypeError("Index must be an integer (value: "+t+")");if(t<0||"number"==typeof e&&e<=t)throw new r.default(t,e)},n.resize=function(t,e,n){if(!Array.isArray(t)||!Array.isArray(e))throw new TypeError("Array expected");if(0===e.length)throw new Error("Resizing to scalar is not supported");e.forEach(function(t){if(!o.default.isNumber(t)||!o.default.isInteger(t)||t<0)throw new TypeError("Invalid size, must contain positive integers (size: "+i.default.format(e)+")")});var r=void 0!==n?n:0;return function t(e,n,r,o){var i,a,s=e.length,u=n[r],p=Math.min(s,u);if(e.length=u,r>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"},n.defaultTemplate="\\mathrm{${name}}\\left(${args}\\right)";var o={deg:"^\\circ"};n.escape=function(t){return r(t,{preserveFormatting:!0})},n.toSymbol=function(t,e){return(e=void 0!==e&&e)?o.hasOwnProperty(t)?o[t]:"\\mathrm{"+n.escape(t)+"}":n.symbols.hasOwnProperty(t)?n.symbols[t]:n.escape(t)}},{"escape-latex":2}],54:[function(t,e,h){"use strict";var i=t("./object");function l(t){for(var e=[],n=0;no.length&&(o=o.concat(l(e-o.length)));else{var a=0<=r?r:Math.abs(i);o.length-1=o)return h.toExponential(t,e);var a=e?h.roundDigits(i,e):i,s=a.coefficients,u=a.exponent;s.lengthe&&5<=r.splice(e,r.length-e)[0]){var o=e-1;for(r[o]++;10===r[o];)r.pop(),0===o&&(r.unshift(0),n.exponent++,o++),r[--o]++}return n},h.digits=function(t){return t.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length},h.DBL_EPSILON=Number.EPSILON||2220446049250313e-31,h.nearlyEqual=function(t,e,n){if(null==n)return t===e;if(t===e)return!0;if(isNaN(t)||isNaN(e))return!1;if(isFinite(t)&&isFinite(e)){var r=Math.abs(t-e);return r/g,">")}},{"./bignumber/formatter":47,"./bignumber/isBigNumber":48,"./number":54}],58:[function(t,e,n){function r(){}r.prototype={on:function(t,e,n){var r=this.e||(this.e={});return(r[t]||(r[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var r=this;function o(){r.off(t,o),e.apply(n,arguments)}return o._=e,this.on(t,o,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),r=0,o=n.length;r=i+1}}return 0===t.length?function(t){return 0===t.length}:1===t.length?(e=X(t[0]),function(t){return e(t[0])&&1===t.length}):2===t.length?(e=X(t[0]),r=X(t[1]),function(t){return e(t[0])&&r(t[1])&&2===t.length}):(n=t.map(X),function(t){for(var e=0;ef?(r=new TypeError("Too many arguments in function "+a+" (expected: "+f+", actual: "+n.length+")")).data={category:"tooManyArgs",fn:a,index:n.length,expectedLength:f}:(r=new TypeError('Arguments of type "'+n.join(", ")+'" do not match any of the defined signatures of function '+a+".")).data={category:"mismatch",actual:n.map(U)},r}(e,arguments,r)},H=function(t,e){return arguments.length===C&&l(t)&&b(e)?j.apply(null,arguments):arguments.length===I&&m(t)&&x(e)?k.apply(null,arguments):arguments.length===F&&d(t)&&w(e)?T.apply(null,arguments):arguments.length===_&&y(t)&&N(e)?A.apply(null,arguments):arguments.length===D&&g(t)&&E(e)?P.apply(null,arguments):arguments.length===L&&v(t)&&O(e)?M.apply(null,arguments):W.apply(null,arguments)};try{Object.defineProperty(H,"name",{value:e})}catch(t){}return H.signatures=(o={},r.forEach(function(e){e.params.some(V)||et(e.params,!0).forEach(function(t){o[J(t)]=e.fn})}),o),H}function l(t){return-1===q.ignore.indexOf(t)}function nt(t){return t.trim()}function m(t){return!!t}function rt(t){return null!==t}function ot(t){return 0===t.types.length}function s(t){return t[t.length-1]}function it(t,e,n){return Array.prototype.slice.call(t,e,n)}function at(t,e){for(var n=0;n