'use strict';var LCMATH=function(){function m(){this.operators=[]}function e(b,a,c,g,f){this.type=b;this.op=a;this.value=c;this.children=g;this.interval_type="undefined"==typeof f?e.NOT_AN_INTERVAL:f}function p(b,a,c,g,f,e){this.id=b;this.arity=a;this.lbp=c;this.rbp=g;this.nud=f;this.led=e}function n(b,a,c){this.msg=b;this.from=a;this.to=c?c:this.from}function r(b,a,c){this.implicit_operators="undefined"==typeof b?!1:b;this.unit_mode="undefined"==typeof a?!1:a;this.constants="undefined"==typeof c|| null==c?[]:c;this.defs=new m;this.defs.define();this.operators=this.defs.operators;this.oph={};for(b=0;b=",80,80);this.infix("<",80,80);this.infix(">",80,80);this.separator(")");this.separator(m.ARG_SEPARATOR);this.separator(m.INTERVAL_SEPARATOR);var b=this;this.operator("(",p.BINARY,200,200,function(a){var c=a.expression(0);if(null!=a.current_token&&null!=a.current_token.op&&a.current_token.op.id==m.INTERVAL_SEPARATOR)return b.buildInterval(!1,c,this,a);a.advance(")");return c},function(a,b){if(b.type!=e.NAME&&b.type!=e.SUBSCRIPT)throw new n("Function name expected before a parenthesis.", a.tokens[a.token_nr-1].from);var g=[b];if(null==a.current_token||null==a.current_token.op||")"!==a.current_token.op.id)for(;;){g.push(a.expression(0));if(null==a.current_token||null==a.current_token.op||a.current_token.op.id!==m.ARG_SEPARATOR)break;a.advance(m.ARG_SEPARATOR)}a.advance(")");return new e(e.FUNCTION,this,"(",g)});this.separator("]");this.operator("[",p.BINARY,200,70,function(a){var c=[];if(null==a.current_token||null==a.current_token.op||"]"!==a.current_token.op.id){var g=a.expression(0); if(null!=a.current_token&&null!=a.current_token.op&&a.current_token.op.id==m.INTERVAL_SEPARATOR)return b.buildInterval(!0,g,this,a);for(;;){c.push(g);if(null==a.current_token||null==a.current_token.op||a.current_token.op.id!==m.ARG_SEPARATOR)break;a.advance(m.ARG_SEPARATOR);g=a.expression(0)}}a.advance("]");return new e(e.VECTOR,this,null,c)},function(a,b){if(b.type!=e.NAME&&b.type!=e.SUBSCRIPT)throw new n("Name expected before a square bracket.",a.tokens[a.token_nr-1].from);var g=[b];if(null==a.current_token|| null==a.current_token.op||"]"!==a.current_token.op.id)for(;;){g.push(a.expression(0));if(null==a.current_token||null==a.current_token.op||a.current_token.op.id!==m.ARG_SEPARATOR)break;a.advance(m.ARG_SEPARATOR)}a.advance("]");return new e(e.SUBSCRIPT,this,"[",g)});this.separator("}");this.prefix("{",200,function(a){var b=[];if(null==a.current_token||null==a.current_token.op||"}"!==a.current_token.op.id)for(;;){b.push(a.expression(0));if(null==a.current_token||null==a.current_token.op||a.current_token.op.id!== m.ARG_SEPARATOR)break;a.advance(m.ARG_SEPARATOR)}a.advance("}");return new e(e.SET,this,null,b)});this.prefix("$",300,function(a){var b=a.expression(300);if(b.type!=e.NAME)throw new n("Variable name expected after a $.",a.tokens[a.token_nr-1].from);b.value="$"+b.value;return b})};"use strict";e.UNKNOWN=0;e.NAME=1;e.NUMBER=2;e.OPERATOR=3;e.FUNCTION=4;e.VECTOR=5;e.INTERVAL=6;e.SET=7;e.SUBSCRIPT=8;e.COLORS="#E01010 #0010FF #009000 #FF00FF #00B0B0 #F09000 #800080 #F080A0 #6090F0 #902000 #70A050 #A07060 #5000FF #E06050 #008080 #808000".split(" "); e.NOT_AN_INTERVAL=0;e.OPEN_OPEN=1;e.OPEN_CLOSED=2;e.CLOSED_OPEN=3;e.CLOSED_CLOSED=4;e.prototype.toString=function(){var b="(";switch(this.type){case e.UNKNOWN:b+="UNKNOWN";break;case e.NAME:b+="NAME";break;case e.NUMBER:b+="NUMBER";break;case e.OPERATOR:b+="OPERATOR";break;case e.FUNCTION:b+="FUNCTION";break;case e.VECTOR:b+="VECTOR";break;case e.INTERVAL:b+="INTERVAL";break;case e.SET:b+="SET";break;case e.SUBSCRIPT:b+="SUBSCRIPT"}this.op&&(b+=" '"+this.op.id+"'");this.value&&(b+=" '"+this.value+ "'");if(this.children){for(var b=b+" [",a=0;athis.children.length?d.appendChild(this.mo("lim")):(a=document.createElement("munder"),a.appendChild(this.mo("lim")),h=document.createElement("mrow"),h.appendChild(g._toMathML(b)),h.appendChild(this.mo("\u2192")),h.appendChild(f._toMathML(b)),null!=k&&("plus"==k.value?h.appendChild(this.mo("+")):"minus"==k.value&&h.appendChild(this.mo("-"))),a.appendChild(h),d.appendChild(a)), d.appendChild(c._toMathML(b));else if("binomial"==a.value){d=document.createElement("mrow");d.appendChild(this.mo("("));g=document.createElement("mtable");for(f=1;f=":"\u2265","<=":"\u2264",inf:"\u221e",minf:"-\u221e",hbar:"\u210f",G:"\ud835\udca2"};"use strict";p.UNKNOWN=0;p.UNARY=1;p.BINARY=2;p.TERNARY=3;"use strict";n.prototype.toString=function(){return this.msg+" at "+this.from+" - "+this.to};"use strict";r.prototype.expression=function(b){var a,c= this.current_token;if(null==c)throw new n("Expected something at the end",this.tokens[this.tokens.length-1].to+1);this.advance();if(null==c.op)a=new e(c.type,null,c.value,null);else{if(null==c.op.nud)throw new n("Unexpected operator '"+c.op.id+"'",c.from);a=c.op.nud(this)}for(;null!=this.current_token&&null!=this.current_token.op&&b=this.tokens.length?this.current_token=null:(this.current_token=this.tokens[this.token_nr],this.token_nr+=1)};r.prototype.addHiddenOperators=function(){for(var b=this.defs.findOperator("*"),a=this.defs.findOperator("`"),c=!1,g=!1,f=0;ff+2&&this.tokens[f+2].type==l.NAME)){var h,m;d.type==l.NAME?(h=d,m=f+1):(m=f+2,h=this.tokens[m]);for(var s=0;sm+1&&"("==this.tokens[m+1].value)for(m="pow sqrt abs exp factorial diff integrate sum product limit binomial matrix ln log log10 mod signum ceiling floor sin cos tan asin acos atan atan2 sinh cosh tanh asinh acosh atanh".split(" "), s=0;s=b)a++,b=this.text.charAt(a);else{if("0"<=b&&"9">=b||(b===m.DECIMAL_SIGN_1||b===m.DECIMAL_SIGN_2)&&"0"<=this.text.charAt(a+1)&&"9">=this.text.charAt(a+1)){c="";if(b!==m.DECIMAL_SIGN_1&&b!==m.DECIMAL_SIGN_2)for(a++,c+=b;;){b=this.text.charAt(a);if("0">b||"9"b||"9"b||"9"=b)}var e=+c.replace(m.DECIMAL_SIGN_1,".").replace(m.DECIMAL_SIGN_2,".");if(isFinite(e)){f.push(new l(l.NUMBER,g,a-1,c,null));continue}else throw new n("syntax error in number",g,a);}for(c=0;c=b||"A"<=b&&"Z">=b||"\u03b1"<=b&&"\u03c9">=b||"\u0391"<=b&&"\u03a9">=b||"\u00b5"==b){c=b;for(a++;;)if(b=this.text.charAt(a),"a"<=b&&"z">=b||"A"<=b&&"Z">=b||"\u03b1"<=b&&"\u03c9">=b||"\u0391"<=b&&"\u03a9">=b||"\u00b5"==b||"0"<=b&&"9">=b||"_"===b)c+=b,a++;else break;f.push(new l(l.NAME,g,a-1,c,null))}else throw new n("unrecognized operator",g,a);}return f};"use strict";l.UNKNOWN= 0;l.NAME=1;l.NUMBER=2;l.OPERATOR=3;"use strict";var u=function(b){var a,c,e,f,k;a=b.ta;c=b.output_node;a=a.value;f="";for(k=a;k!=f;)f=k,k=f.replace(/\[[^\[\]]*\]/g,"");if(k.split("[").length==k.split("]").length){for(f="";k!=f;)f=k,k=f.replace(/\([^\(\)]*\)/g,"");if(k.split("(").length==k.split(")").length){for(f="";k!=f;)f=k,k=f.replace(/\{[^\{\}]*\}/g,"");k.split("{").length==k.split("}").length&&-1!=k.indexOf(m.ARG_SEPARATOR)&&(a="["+a+"]")}}if(a!=b.oldtxt){for(b.oldtxt=a;null!=c.firstChild;)c.removeChild(c.firstChild); c.removeAttribute("title");if(""!=a){b=b.parser;try{if(e=b.parse(a),null!=e){var d=document.createElement("math");d.setAttribute("display","block");d.appendChild(e.toMathML());c.appendChild(d);MathJax.Hub.Queue(["Typeset",MathJax.Hub,c])}}catch(h){e="error: "+h,c.setAttribute("title",e),h instanceof n?(c.appendChild(document.createTextNode(a.substring(0,h.from))),e=document.createElement("span"),e.appendChild(document.createTextNode(a.substring(h.from,h.to+1))),e.className="math-error",c.appendChild(e), h.tod.bottom+b.offsetHeight?c+a.offsetHeight+"px":c-b.offsetHeight+"px"};c.nextSibling?c.parentNode.insertBefore(f,c.nextSibling):c.parentNode.appendChild(f);k= function(a){return function(b){a.style.display="none"}};c.addEventListener("blur",k(f),!1);c.addEventListener("focus",function(a,b){return function(c){""!=a.value&&(b.style.display="block",m(a,b))}}(c,f),!1);f.addEventListener("mouseenter",k(f),!1);k=q.length;q[k]={ta:c,output_node:f,oldtxt:"",parser:new r(e,d,h)};e=function(a){return function(b){var c=q[a];u(c);document.activeElement==c.ta&&(""!=c.ta.value?(c.output_node.style.display="block",MathJax.Hub.Queue(function(){m(c.ta,c.output_node)})): c.output_node.style.display="none")}}(k);""!=c.value&&e();c.addEventListener("change",e,!1);c.addEventListener("keyup",e,!1)}else{var l,n=q[k].parser;if(h||0!=n.constants.length)if(h){if(l=n.constants.length==h.length)for(f=0;f