@khanacademy/kas 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/LICENSE.txt +21 -0
- package/README.md +94 -0
- package/dist/es/index.js +2 -0
- package/dist/es/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.flow +2 -0
- package/dist/index.js.map +1 -0
- package/experimenter.html +75 -0
- package/package.json +38 -0
- package/src/__genfiles__/parser.js +840 -0
- package/src/__genfiles__/unitparser.js +679 -0
- package/src/__tests__/checking-form_test.js +76 -0
- package/src/__tests__/comparing_test.js +322 -0
- package/src/__tests__/compilation_test.js +97 -0
- package/src/__tests__/evaluating_test.js +73 -0
- package/src/__tests__/index_test.js +364 -0
- package/src/__tests__/parsing_test.js +480 -0
- package/src/__tests__/rendering_test.js +272 -0
- package/src/__tests__/transforming_test.js +331 -0
- package/src/__tests__/units_test.js +188 -0
- package/src/compare.js +69 -0
- package/src/index.js +2 -0
- package/src/nodes.js +3504 -0
- package/src/parser-generator.js +212 -0
- package/src/unitvalue.jison +161 -0
package/CHANGELOG.md
ADDED
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 Khan Academy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
KAS
|
|
2
|
+
===
|
|
3
|
+
|
|
4
|
+
A lightweight JavaScript CAS (Computer Algebra System) for comparing expressions and equations.
|
|
5
|
+
It is used throughout [Khan Academy](https://khanacademy.org)'s interactive exercises.
|
|
6
|
+
|
|
7
|
+
What can it do?
|
|
8
|
+
---------------
|
|
9
|
+
|
|
10
|
+
It can parse plain text math, LaTeX, or a mix of both:
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
var expr = KAS.parse("3x \\frac{42}{42} sin^2y").expr;
|
|
14
|
+
expr.print();
|
|
15
|
+
// "3*x*42/42*sin(y)^(2)"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
It can evaluate expressions:
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
var expr = KAS.parse("(x^2+y^2)^.5").expr;
|
|
22
|
+
expr.eval({x: 3, y: 4});
|
|
23
|
+
// 5
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
It can compare expressions and equations:
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
var expr1 = KAS.parse("(1-x)(-1-6x)").expr;
|
|
30
|
+
var expr2 = KAS.parse("(6x+1)(x-1)").expr;
|
|
31
|
+
KAS.compare(expr1, expr2).equal;
|
|
32
|
+
// true
|
|
33
|
+
|
|
34
|
+
var eq1 = KAS.parse("2w+50/w=25").expr;
|
|
35
|
+
var eq2 = KAS.parse("w(12.5-w)=25").expr;
|
|
36
|
+
KAS.compare(eq1, eq2).equal;
|
|
37
|
+
// true
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
It can perform basic transforms that always simplify an expression:
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
var expr = KAS.parse("1+1+x+x+x+y").expr;
|
|
44
|
+
expr.collect().print();
|
|
45
|
+
// "2+3*x+y"
|
|
46
|
+
|
|
47
|
+
var expr = KAS.parse("b^(2*y*log_b x)").expr;
|
|
48
|
+
expr.collect().print();
|
|
49
|
+
// "x^(2*y)"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
It can perform non-simplifying transforms on an expression:
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
var expr = KAS.parse("ab(c+d)e^f").expr;
|
|
56
|
+
expr.print();
|
|
57
|
+
// "a*b*(c+d)*e^(f)"
|
|
58
|
+
expr.expand().print();
|
|
59
|
+
// "a*b*e^(f)*c+a*b*e^(f)*d"
|
|
60
|
+
expr.expand().factor().print();
|
|
61
|
+
// "a*b*e^(f)*(c+d)"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
It can combine the above abilities to perform powerful simplification:
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
var expr = KAS.parse("((nx^5)^5)/(n^-2x^2)^-3").expr;
|
|
68
|
+
expr.print();
|
|
69
|
+
// "(n*x^(5))^(5)*(n^(-2)*x^(2))^(-1*-3)"
|
|
70
|
+
expr.simplify().print();
|
|
71
|
+
// "n^(-1)*x^(31)"
|
|
72
|
+
|
|
73
|
+
var expr = KAS.parse("(15np-25mp)/(15p^2-5p)+(20mp+10p^2)/(15p^2-5p)").expr;
|
|
74
|
+
expr.print();
|
|
75
|
+
// "(15*n*p+-25*m*p)*(15*p^(2)+-5*p)^(-1)+(20*m*p+10*p^(2))*(15*p^(2)+-5*p)^(-1)"
|
|
76
|
+
expr.simplify().print();
|
|
77
|
+
// "(-1+3*p)^(-1)*(3*n+-1*m+2*p)"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
How to build the library
|
|
81
|
+
------------------------
|
|
82
|
+
npm install
|
|
83
|
+
npm run build
|
|
84
|
+
|
|
85
|
+
How to build the parser
|
|
86
|
+
-----------------------
|
|
87
|
+
First, make any changes in `src/parser-generator.js`
|
|
88
|
+
|
|
89
|
+
npm install
|
|
90
|
+
npm run build:parser
|
|
91
|
+
|
|
92
|
+
License
|
|
93
|
+
-------
|
|
94
|
+
[MIT License](http://opensource.org/licenses/MIT)
|
package/dist/es/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import t from"underscore";var e=function(){var t=function(t,e,n,i){for(n=n||{},i=t.length;i--;n[t[i]]=e);return n},e=[1,11],n=[1,9],i=[8,17],r=[6,11],s=[6,11,13,17],a={trace:function(){},yy:{},symbols_:{error:2,unitvalue:3,magnitude:4,unit:5,EOF:6,float:7,POW:8,int:9,multatoms:10,DIV:11,expatom:12,MUL:13,atom:14,"^":15,nat:16,ATOM:17,FLOAT:18,NAT:19,NEG:20,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",8:"POW",11:"DIV",13:"MUL",15:"^",17:"ATOM",18:"FLOAT",19:"NAT",20:"NEG"},productions_:[0,[3,3],[3,2],[4,3],[4,1],[5,3],[5,1],[10,3],[10,2],[10,1],[12,3],[12,1],[14,1],[7,1],[7,1],[16,1],[9,2],[9,1]],performAction:function(t,e,n,i,r,s,a){var o=s.length-1;switch(r){case 1:return{type:"unitMagnitude",magnitude:s[o-2],unit:s[o-1]};case 2:return{type:"unitStandalone",unit:s[o-1]};case 3:this.$=s[o-2]+"e"+s[o];break;case 4:case 13:case 14:case 15:case 17:this.$=s[o];break;case 5:this.$={num:s[o-2],denom:s[o]};break;case 6:this.$={num:s[o],denom:null};break;case 7:this.$=[s[o-2]].concat(s[o]);break;case 8:this.$=[s[o-1]].concat(s[o]);break;case 9:this.$=[s[o]];break;case 10:this.$={name:s[o-2],pow:s[o]};break;case 11:this.$={name:s[o],pow:1};break;case 12:this.$=t;break;case 16:this.$="-"+s[o]}},table:[{3:1,4:2,5:3,7:4,10:5,12:8,14:10,16:7,17:e,18:[1,6],19:n},{1:[3]},{5:12,10:5,12:8,14:10,17:e},{6:[1,13]},{8:[1,14],17:[2,4]},{6:[2,6],11:[1,15]},t(i,[2,13]),t(i,[2,14]),t(r,[2,9],{12:8,14:10,10:17,13:[1,16],17:e}),t([6,8,11,13,17],[2,15]),t(s,[2,11],{15:[1,18]}),t([6,11,13,15,17],[2,12]),{6:[1,19]},{1:[2,2]},{9:20,19:[1,22],20:[1,21]},{10:23,12:8,14:10,17:e},{10:24,12:8,14:10,17:e},t(r,[2,8]),{16:25,19:n},{1:[2,1]},{17:[2,3]},{19:[1,26]},{17:[2,17]},{6:[2,5]},t(r,[2,7]),t(s,[2,10]),{17:[2,16]}],defaultActions:{13:[2,2],19:[2,1],20:[2,3],22:[2,17],23:[2,5],26:[2,16]},parseError:function(t,e){if(!e.recoverable)throw new Error(t);this.trace(t)},parse:function(t){var e=this,n=[0],i=[null],r=[],s=this.table,a="",o=0,c=0,u=2,h=1,l=r.slice.call(arguments,1),f=Object.create(this.lexer),p={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(p.yy[y]=this.yy[y]);f.setInput(t,p.yy),p.yy.lexer=f,p.yy.parser=this,void 0===f.yylloc&&(f.yylloc={});var g=f.yylloc;r.push(g);var d=f.options&&f.options.ranges;function m(){var t;return"number"!=typeof(t=f.lex()||h)&&(t=e.symbols_[t]||t),t}"function"==typeof p.yy.parseError?this.parseError=p.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var v,x,w,b,_,k,M,E,I={};;){if(x=n[n.length-1],this.defaultActions[x]?w=this.defaultActions[x]:(null==v&&(v=m()),w=s[x]&&s[x][v]),void 0===w||!w.length||!w[0]){var S="";for(_ in E=[],s[x])this.terminals_[_]&&_>u&&E.push("'"+this.terminals_[_]+"'");S=f.showPosition?"Parse error on line "+(o+1)+":\n"+f.showPosition()+"\nExpecting "+E.join(", ")+", got '"+(this.terminals_[v]||v)+"'":"Parse error on line "+(o+1)+": Unexpected "+(v==h?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(S,{text:f.match,token:this.terminals_[v]||v,line:f.yylineno,loc:g,expected:E})}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+x+", token: "+v);switch(w[0]){case 1:n.push(v),i.push(f.yytext),r.push(f.yylloc),n.push(w[1]),v=null,c=f.yyleng,a=f.yytext,o=f.yylineno,g=f.yylloc;break;case 2:if(k=this.productions_[w[1]][1],I.$=i[i.length-k],I._$={first_line:r[r.length-(k||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(k||1)].first_column,last_column:r[r.length-1].last_column},d&&(I._$.range=[r[r.length-(k||1)].range[0],r[r.length-1].range[1]]),void 0!==(b=this.performAction.apply(I,[a,c,o,p.yy,w[1],i,r].concat(l))))return b;k&&(n=n.slice(0,-1*k*2),i=i.slice(0,-1*k),r=r.slice(0,-1*k)),n.push(this.productions_[w[1]][0]),i.push(I.$),r.push(I._$),M=s[n[n.length-2]][n[n.length-1]],n.push(M);break;case 3:return!0}}return!0}},o={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===i.length?this.yylloc.first_column:0)+i[i.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,i,r;if(this.options.backtrack_lexer&&(r={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(r.yylloc.range=this.yylloc.range.slice(0))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var s in r)this[s]=r[s];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var r=this._currentRules(),s=0;s<r.length;s++)if((n=this._input.match(this.rules[r[s]]))&&(!e||n[0].length>e[0].length)){if(e=n,i=s,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,r[s])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,r[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,i){switch(n){case 0:return 11;case 1:return"(";case 2:return")";case 3:return 8;case 4:return 15;case 5:return 13;case 6:return 18;case 7:return 19;case 8:return 20;case 9:case 10:case 11:return 17;case 12:break;case 13:return 6}},rules:[/^(?:\/)/,/^(?:\()/,/^(?:\))/,/^(?:(\*|x|\u00d7|\u2219|\u22c5|\u00b7)\s*10\s*\^)/,/^(?:\^)/,/^(?:\*)/,/^(?:[0-9]+\.[0-9]+)/,/^(?:[0-9]+)/,/^(?:-)/,/^(?:\u00b0( ?)[cCfF])/,/^(?:fl\.? oz\.?)/,/^(?:[\u00b5]?([A-Za-z-]+|[\u2103\u2109\u212b]))/,/^(?:\s+)/,/^(?:$)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}}};function c(){this.yy={}}return a.lexer=o,c.prototype=a,a.Parser=c,new c}(),n=e,i=function(){var t=function(t,e,n,i){for(n=n||{},i=t.length;i--;n[t[i]]=e);return n},e=[1,7],n=[1,17],i=[1,13],r=[1,14],s=[1,15],a=[1,32],o=[1,22],c=[1,23],u=[1,24],h=[1,25],l=[1,26],f=[1,33],p=[1,27],y=[1,28],g=[1,29],d=[1,30],m=[1,20],v=[1,36],x=[1,37],w=[5,6,8,10,33,35,41,43,45],b=[1,39],_=[1,40],k=[5,6,8,10,12,14,16,19,21,22,28,29,30,31,32,33,34,35,37,39,41,42,43,44,45,46],M=[10,16,19,21,22,28,29,30,31,32,34,37,39,42,43,44,46],E=[5,6,8,10,12,14,16,18,19,21,22,28,29,30,31,32,33,34,35,37,39,41,42,43,44,45,46],I={trace:function(){},yy:{},symbols_:{error:2,equation:3,expression:4,SIGN:5,EOF:6,additive:7,"+":8,multiplicative:9,"-":10,triglog:11,"*":12,negative:13,"/":14,trig:15,TRIG:16,trigfunc:17,"^":18,TRIGINV:19,logbase:20,ln:21,log:22,_:23,subscriptable:24,power:25,primitive:26,variable:27,VAR:28,CONST:29,INT:30,FLOAT:31,"{":32,"}":33,"(":34,")":35,function:36,FUNC:37,invocation:38,sqrt:39,"[":40,"]":41,abs:42,"|":43,"LEFT|":44,"RIGHT|":45,FRAC:46,$accept:0,$end:1},terminals_:{2:"error",5:"SIGN",6:"EOF",8:"+",10:"-",12:"*",14:"/",16:"TRIG",18:"^",19:"TRIGINV",21:"ln",22:"log",23:"_",28:"VAR",29:"CONST",30:"INT",31:"FLOAT",32:"{",33:"}",34:"(",35:")",37:"FUNC",39:"sqrt",40:"[",41:"]",42:"abs",43:"|",44:"LEFT|",45:"RIGHT|",46:"FRAC"},productions_:[0,[3,4],[3,2],[3,1],[4,1],[7,3],[7,3],[7,1],[9,2],[9,3],[9,3],[9,1],[13,2],[13,1],[15,1],[17,1],[17,3],[17,1],[20,1],[20,1],[20,3],[11,2],[11,2],[11,1],[25,3],[25,1],[27,1],[24,3],[24,1],[24,1],[24,1],[24,1],[24,3],[24,3],[36,1],[38,4],[38,4],[38,7],[38,4],[38,3],[38,3],[38,4],[26,1],[26,1],[26,7]],performAction:function(t,e,n,i,r,s,a){var o=s.length-1;switch(r){case 1:return new i.Eq(s[o-3],s[o-2],s[o-1]);case 2:return s[o-1];case 3:return new i.Add([]);case 4:case 7:case 11:case 13:case 15:case 20:case 23:case 25:case 42:case 43:this.$=s[o];break;case 5:this.$=i.Add.createOrAppend(s[o-2],s[o]);break;case 6:this.$=i.Add.createOrAppend(s[o-2],i.Mul.handleNegative(s[o],"subtract"));break;case 8:this.$=i.Mul.fold(i.Mul.createOrAppend(s[o-1],s[o]));break;case 9:this.$=i.Mul.fold(i.Mul.createOrAppend(s[o-2],s[o]));break;case 10:this.$=i.Mul.fold(i.Mul.handleDivide(s[o-2],s[o]));break;case 12:this.$=i.Mul.handleNegative(s[o]);break;case 14:case 17:this.$=[t];break;case 16:this.$=s[o-2].concat(s[o]);break;case 18:this.$=i.Log.natural();break;case 19:this.$=i.Log.common();break;case 21:this.$=i.Trig.create(s[o-1],s[o]);break;case 22:this.$=i.Log.create(s[o-1],s[o]);break;case 24:this.$=new i.Pow(s[o-2],s[o]);break;case 26:case 34:this.$=t;break;case 27:this.$=new i.Var(s[o-2],s[o]);break;case 28:this.$=new i.Var(s[o]);break;case 29:this.$=new i.Const(t.toLowerCase());break;case 30:this.$=i.Int.create(Number(t));break;case 31:this.$=i.Float.create(Number(t));break;case 32:this.$=s[o-1].completeParse();break;case 33:this.$=s[o-1].completeParse().addHint("parens");break;case 35:case 36:this.$=i.Pow.sqrt(s[o-1]);break;case 37:this.$=new i.Pow.nthroot(s[o-1],s[o-4]);break;case 38:case 39:case 40:this.$=new i.Abs(s[o-1]);break;case 41:this.$=new i.Func(s[o-3],s[o-1]);break;case 44:this.$=i.Mul.handleDivide(s[o-4],s[o-1])}},table:[{3:1,4:2,6:[1,3],7:4,9:5,10:e,11:8,13:6,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{1:[3]},{5:[1,34],6:[1,35]},{1:[2,3]},t([5,6],[2,4],{8:v,10:x}),t(w,[2,7],{17:9,20:10,25:11,15:12,26:16,24:18,38:19,27:21,36:31,11:38,12:b,14:_,16:n,19:i,21:r,22:s,28:a,29:o,30:c,31:u,32:h,34:l,37:f,39:p,42:y,44:d,46:m}),t(k,[2,11]),{10:e,11:8,13:41,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},t(k,[2,13]),{10:e,11:8,13:42,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{10:e,11:8,13:43,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},t(k,[2,23]),t(M,[2,15],{18:[1,44]}),t(M,[2,17]),t(M,[2,18]),t(M,[2,19],{23:[1,45]}),t(k,[2,25],{18:[1,46]}),t([10,16,18,19,21,22,28,29,30,31,32,34,37,39,42,43,44,46],[2,14]),t(E,[2,42]),t(E,[2,43]),{32:[1,47]},t(E,[2,28],{23:[1,48]}),t(E,[2,29]),t(E,[2,30]),t(E,[2,31]),{7:49,9:5,10:e,11:8,13:6,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{7:50,9:5,10:e,11:8,13:6,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{32:[1,52],34:[1,51],40:[1,53]},{34:[1,54]},{7:55,9:5,10:e,11:8,13:6,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{7:56,9:5,10:e,11:8,13:6,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{34:[1,57]},t([5,6,8,10,12,14,16,18,19,21,22,23,28,29,30,31,32,33,34,35,37,39,41,42,43,44,45,46],[2,26]),{34:[2,34]},{4:58,7:4,9:5,10:e,11:8,13:6,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{1:[2,2]},{9:59,10:e,11:8,13:6,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{9:60,10:e,11:8,13:6,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},t(k,[2,8]),{10:e,11:8,13:61,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{10:e,11:8,13:62,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},t(k,[2,12]),t(k,[2,21]),t(k,[2,22]),{10:e,11:8,13:63,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{24:64,27:21,28:a,29:o,30:c,31:u,32:h,34:l},{10:e,11:8,13:65,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{7:66,9:5,10:e,11:8,13:6,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{24:67,27:21,28:a,29:o,30:c,31:u,32:h,34:l},{8:v,10:x,33:[1,68]},{8:v,10:x,35:[1,69]},{7:70,9:5,10:e,11:8,13:6,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{7:71,9:5,10:e,11:8,13:6,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{7:72,9:5,10:e,11:8,13:6,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{7:73,9:5,10:e,11:8,13:6,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{8:v,10:x,43:[1,74]},{8:v,10:x,45:[1,75]},{7:76,9:5,10:e,11:8,13:6,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{6:[1,77]},t(w,[2,5],{17:9,20:10,25:11,15:12,26:16,24:18,38:19,27:21,36:31,11:38,12:b,14:_,16:n,19:i,21:r,22:s,28:a,29:o,30:c,31:u,32:h,34:l,37:f,39:p,42:y,44:d,46:m}),t(w,[2,6],{17:9,20:10,25:11,15:12,26:16,24:18,38:19,27:21,36:31,11:38,12:b,14:_,16:n,19:i,21:r,22:s,28:a,29:o,30:c,31:u,32:h,34:l,37:f,39:p,42:y,44:d,46:m}),t(k,[2,9]),t(k,[2,10]),t(M,[2,16]),t(M,[2,20]),t(k,[2,24]),{8:v,10:x,33:[1,78]},t(E,[2,27]),t(E,[2,32]),t(E,[2,33]),{8:v,10:x,35:[1,79]},{8:v,10:x,33:[1,80]},{8:v,10:x,41:[1,81]},{8:v,10:x,35:[1,82]},t(E,[2,39]),t(E,[2,40]),{8:v,10:x,35:[1,83]},{1:[2,1]},{32:[1,84]},t(E,[2,35]),t(E,[2,36]),{32:[1,85]},t(E,[2,38]),t(E,[2,41]),{7:86,9:5,10:e,11:8,13:6,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{7:87,9:5,10:e,11:8,13:6,15:12,16:n,17:9,19:i,20:10,21:r,22:s,24:18,25:11,26:16,27:21,28:a,29:o,30:c,31:u,32:h,34:l,36:31,37:f,38:19,39:p,42:y,43:g,44:d,46:m},{8:v,10:x,33:[1,88]},{8:v,10:x,33:[1,89]},t(E,[2,44]),t(E,[2,37])],defaultActions:{3:[2,3],33:[2,34],35:[2,2],77:[2,1]},parseError:function(t,e){if(!e.recoverable)throw new Error(t);this.trace(t)},parse:function(t){var e=this,n=[0],i=[null],r=[],s=this.table,a="",o=0,c=0,u=2,h=1,l=r.slice.call(arguments,1),f=Object.create(this.lexer),p={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(p.yy[y]=this.yy[y]);f.setInput(t,p.yy),p.yy.lexer=f,p.yy.parser=this,void 0===f.yylloc&&(f.yylloc={});var g=f.yylloc;r.push(g);var d=f.options&&f.options.ranges;function m(){var t;return"number"!=typeof(t=f.lex()||h)&&(t=e.symbols_[t]||t),t}"function"==typeof p.yy.parseError?this.parseError=p.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var v,x,w,b,_,k,M,E,I={};;){if(x=n[n.length-1],this.defaultActions[x]?w=this.defaultActions[x]:(null==v&&(v=m()),w=s[x]&&s[x][v]),void 0===w||!w.length||!w[0]){var S="";for(_ in E=[],s[x])this.terminals_[_]&&_>u&&E.push("'"+this.terminals_[_]+"'");S=f.showPosition?"Parse error on line "+(o+1)+":\n"+f.showPosition()+"\nExpecting "+E.join(", ")+", got '"+(this.terminals_[v]||v)+"'":"Parse error on line "+(o+1)+": Unexpected "+(v==h?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(S,{text:f.match,token:this.terminals_[v]||v,line:f.yylineno,loc:g,expected:E})}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+x+", token: "+v);switch(w[0]){case 1:n.push(v),i.push(f.yytext),r.push(f.yylloc),n.push(w[1]),v=null,c=f.yyleng,a=f.yytext,o=f.yylineno,g=f.yylloc;break;case 2:if(k=this.productions_[w[1]][1],I.$=i[i.length-k],I._$={first_line:r[r.length-(k||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(k||1)].first_column,last_column:r[r.length-1].last_column},d&&(I._$.range=[r[r.length-(k||1)].range[0],r[r.length-1].range[1]]),void 0!==(b=this.performAction.apply(I,[a,c,o,p.yy,w[1],i,r].concat(l))))return b;k&&(n=n.slice(0,-1*k*2),i=i.slice(0,-1*k),r=r.slice(0,-1*k)),n.push(this.productions_[w[1]][0]),i.push(I.$),r.push(I._$),M=s[n[n.length-2]][n[n.length-1]],n.push(M);break;case 3:return!0}}return!0}},S={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===i.length?this.yylloc.first_column:0)+i[i.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,i,r;if(this.options.backtrack_lexer&&(r={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(r.yylloc.range=this.yylloc.range.slice(0))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var s in r)this[s]=r[s];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var r=this._currentRules(),s=0;s<r.length;s++)if((n=this._input.match(this.rules[r[s]]))&&(!e||n[0].length>e[0].length)){if(e=n,i=s,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,r[s])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,r[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{flex:!0},performAction:function(t,e,n,i){switch(n){case 0:case 1:case 2:break;case 3:return"INT";case 4:return"FLOAT";case 5:case 15:return"^";case 6:case 7:case 8:case 9:return"*";case 10:case 11:return"/";case 12:case 13:return"-";case 14:return"+";case 16:case 18:return"(";case 17:case 19:return")";case 20:return"[";case 21:return"]";case 22:case 24:return"{";case 23:case 25:return"}";case 26:return"_";case 27:return"|";case 28:return"LEFT|";case 29:return"RIGHT|";case 30:return"!";case 31:return"SIGN";case 32:case 34:case 40:return e.yytext="<=","SIGN";case 33:case 35:case 41:return e.yytext=">=","SIGN";case 36:case 37:case 38:case 39:return e.yytext="<>","SIGN";case 42:case 43:return"FRAC";case 44:return"sqrt";case 45:return"abs";case 46:return"ln";case 47:return"log";case 48:case 49:case 50:case 51:return"TRIG";case 52:return e.yytext="sin","TRIG";case 53:return e.yytext="cos","TRIG";case 54:return e.yytext="tan","TRIG";case 55:return e.yytext="csc","TRIG";case 56:return e.yytext="sec","TRIG";case 57:return e.yytext="cot","TRIG";case 58:return e.yytext="arcsin","TRIG";case 59:return e.yytext="arccos","TRIG";case 60:return e.yytext="arctan","TRIG";case 61:return e.yytext="arccsc","TRIG";case 62:return e.yytext="arcsec","TRIG";case 63:return e.yytext="arccot","TRIG";case 64:case 65:return"TRIGINV";case 66:return e.yytext="sinh","TRIG";case 67:return e.yytext="cosh","TRIG";case 68:case 71:return e.yytext="tanh","TRIG";case 69:return e.yytext="csch","TRIG";case 70:return e.yytext="sech","TRIG";case 72:return"CONST";case 73:case 74:return e.yytext="pi","CONST";case 75:case 78:return"VAR";case 76:case 77:return e.yytext="theta","VAR";case 79:case 80:return e.yytext="phi","VAR";case 81:return t.symbolLexer(e.yytext);case 82:return"EOF";case 83:return"INVALID";case 84:console.log(e.yytext)}},rules:[/^(?:\s+)/,/^(?:\\space)/,/^(?:\\ )/,/^(?:[0-9]+\.?)/,/^(?:([0-9]+)?\.[0-9]+)/,/^(?:\*\*)/,/^(?:\*)/,/^(?:\\cdot|·)/,/^(?:\\times|×)/,/^(?:\\ast)/,/^(?:\/)/,/^(?:\\div|÷)/,/^(?:-)/,/^(?:−)/,/^(?:\+)/,/^(?:\^)/,/^(?:\()/,/^(?:\))/,/^(?:\\left\()/,/^(?:\\right\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:\\left\{)/,/^(?:\\right\})/,/^(?:_)/,/^(?:\|)/,/^(?:\\left\|)/,/^(?:\\right\|)/,/^(?:\!)/,/^(?:<=|>=|<>|<|>|=)/,/^(?:\\le)/,/^(?:\\ge)/,/^(?:\\leq)/,/^(?:\\geq)/,/^(?:=\/=)/,/^(?:\\ne)/,/^(?:\\neq)/,/^(?:≠)/,/^(?:≤)/,/^(?:≥)/,/^(?:\\frac)/,/^(?:\\dfrac)/,/^(?:sqrt|\\sqrt)/,/^(?:abs|\\abs)/,/^(?:ln|\\ln)/,/^(?:log|\\log)/,/^(?:sin|cos|tan)/,/^(?:csc|sec|cot)/,/^(?:sinh|cosh|tanh)/,/^(?:csch|sech|coth)/,/^(?:\\sin)/,/^(?:\\cos)/,/^(?:\\tan)/,/^(?:\\csc)/,/^(?:\\sec)/,/^(?:\\cot)/,/^(?:\\arcsin)/,/^(?:\\arccos)/,/^(?:\\arctan)/,/^(?:\\arccsc)/,/^(?:\\arcsec)/,/^(?:\\arccot)/,/^(?:arcsin|arccos|arctan)/,/^(?:arccsc|arcsec|arccot)/,/^(?:\\sinh)/,/^(?:\\cosh)/,/^(?:\\tanh)/,/^(?:\\csch)/,/^(?:\\sech)/,/^(?:\\coth)/,/^(?:pi)/,/^(?:π)/,/^(?:\\pi)/,/^(?:theta)/,/^(?:θ)/,/^(?:\\theta)/,/^(?:phi)/,/^(?:φ)/,/^(?:\\phi)/,/^(?:[a-zA-Z])/,/^(?:$)/,/^(?:.)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],inclusive:!0}}};function D(){this.yy={}}return I.lexer=S,D.prototype=I,I.Parser=D,new D}(),r=function(){throw new Error("Abstract method - must override for expr: "+this.print())},s=function(t){throw new Error(t)},a=function(t){return t!=t};function o(){}function c(){}function u(){this.terms=1===arguments.length?arguments[0]:t.toArray(arguments)}function h(){this.terms=1===arguments.length?arguments[0]:t.toArray(arguments)}function l(t,e){this.base=t,this.exp=e}function f(t,e){this.base=t,this.power=e}function p(t,e){this.type=t,this.arg=e}function y(t){this.arg=t}function g(t,e,n){this.left=t,this.type=e,this.right=n}function d(){}function m(t,e){this.symbol=t,this.arg=e}function v(t,e){this.symbol=t,this.subscript=e}function x(t){this.symbol=t}function w(){}function b(t,e){var n=t,i=e;i<0&&(n=-n,i=-i),this.n=n,this.d=i}function _(t){this.n=t}function k(t){this.n=t}t.extend(o.prototype,{func:r,args:r,construct:function(t){var e=new this.func;return this.func.apply(e,t),e},recurse:function(e){var n=Array.prototype.slice.call(arguments,1),i=t.map(this.args(),(function(i){return t.isString(i)?i:i[e].apply(i,n)}));return this.construct(i)},eval:r,codegen:r,compile:function(){var t=this.codegen();try{return new Function("vars","return "+t+";")}catch(e){throw new Error("Function did not compile: "+t)}},print:r,tex:r,asTex:function(e){e=e||{},t.defaults(e,{display:!0,dynamic:!0,times:!1});var n=this.tex();return e.display&&(n="\\displaystyle "+n),e.dynamic&&(n=(n=n.replace(/\(/g,"\\left(")).replace(/\)/g,"\\right)")),e.times&&(n=n.replace(/\\cdot/g,"\\times")),n},name:function(){return this.func.name?this.func.name:this.func.toString().match(/^function\s*([^\s(]+)/)[1]},repr:function(){return this.name()+"("+t.map(this.args(),(function(e){return t.isString(e)?e:e.repr()})).join(",")+")"},strip:function(){return this.recurse("strip")},normalize:function(){return this.recurse("normalize")},expand:function(){return this.recurse("expand")},factor:function(t){return this.recurse("factor",t)},collect:function(t){return this.recurse("collect",t)},equals:function(t){return this.normalize().print()===t.normalize().print()},simplify:function(e){e=t.extend({once:!1},e);var n=this.factor(e),i=n.collect(e);n.equals(i)&&(i=this.collect(e));var r=i.expand(e),s=r.collect(e);r.equals(s)&&(s=i.collect(e));var a=s;return e.once||this.equals(a)?a:a.simplify(e)},isSimplified:function(){return this.equals(this.simplify())},exprArgs:function(){return t.filter(this.args(),(function(t){return t instanceof o}))},getVars:function(e){return t.uniq(t.flatten(t.invoke(this.exprArgs(),"getVars",e))).sort()},getConsts:function(){return t.uniq(t.flatten(t.invoke(this.exprArgs(),"getConsts"))).sort()},getUnits:function(){return t.flatten(t.invoke(this.exprArgs(),"getUnits"))},is:function(t){return this instanceof t},has:function(e){return this instanceof e||t.any(this.exprArgs(),(function(t){return t.has(e)}))},raiseToThe:function(t){return new l(this,t)},isSubtract:function(){return!1},isDivide:function(){return!1},isRoot:function(){return!1},needsExplicitMul:function(){return this.args()[0].needsExplicitMul()},sameVars:function(e){var n=this.getVars(),i=e.getVars(),r=function(e,n){return!t.difference(e,n).length},s=function(e){return t.uniq(t.invoke(e,"toLowerCase")).sort()};return{equal:r(n,i),equalIgnoringCase:r(s(n),s(i))}},compare:function(e){if(e instanceof g)return!1;var n=t.union(this.getVars(!0),e.getVars(!0)),i=function(t,e){var n=function(t,e){return Math.abs(t)<1||Math.abs(e)<1?Math.abs(t-e):Math.abs(1-t/e)}(t,e);return t===e||a(t)&&a(e)||n<Math.pow(10,-9)};if(!n.length&&!this.has(E)&&!e.has(E))return i(this.eval(),e.eval());var r=this.collect(),s=e.collect(),o=this.getUnits(),c=e.getUnits();if(!t.isEqual(o,c))return!1;for(var u=0;u<12;u++){var h,l={},f=Math.pow(10,1+Math.floor(3*u/12)),p=u%2==0;if(t.each(n,(function(e){var n,i;l[e]=p?(i=f-(n=-f),Math.random()*i+n):t.random(-f,f)})),r.has(m)||s.has(m)||r.has(E)||s.has(E)){var y=r.partialEval(l),d=s.partialEval(l);h=y.simplify().equals(d.simplify())}else{h=i(y=r.eval(l),d=s.eval(l))}if(!h)return!1}return!0},partialEval:function(t){return this instanceof E?this:this.has(m)?this instanceof m?new m(this.symbol,this.arg.partialEval(t)):this.recurse("partialEval",t):new k(this.eval(t).toFixed(9)).collect()},sameForm:function(t){return this.strip().equals(t.strip())},findGCD:function(t){return this.equals(t)?t:w.One},getDenominator:function(){return w.One},asMul:function(){return new h(w.One,this)},isPositive:r,isNegative:function(){return!1},asPositiveFactor:function(){return this.isPositive()?this:w.One},addHint:function(e){if(!e)return this;var n=this.construct(this.args());return n.hints=t.clone(this.hints),n.hints[e]=!0,n},hints:{parens:!1},asExpr:function(){return this},completeParse:function(){return this.recurse("completeParse")},abs:r,negate:function(){return new h(w.Neg,this)}}),c.prototype=new o,t.extend(c.prototype,{args:function(){return this.terms},normalize:function(){var e=t.sortBy(t.invoke(this.terms,"normalize"),(function(t){return t.print()}));return new this.func(e)},expand:function(){return this.recurse("expand").flatten()},partition:function(){var e=t.groupBy(this.terms,(function(t){return t instanceof w})),n=e[!0]||[],i=e[!1]||[];return[new this.func(n),new this.func(i)]},flatten:function(){var e=this,n=t.reject(this.terms,(function(t){return t.equals(e.identity)}));if(0===n.length)return e.identity;if(1===n.length)return n[0];var i=t.groupBy(n,(function(t){return t instanceof e.func})),r=i[!0]||[],s=(i[!1]||[]).concat(t.flatten(t.pluck(r,"terms"),!0));return new e.func(s)},identity:void 0,reduce:r,isPositive:function(){var e=t.invoke(this.terms,"collect");return t.all(t.invoke(e,"isPositive"))},replace:function(e,n){var i;i=e instanceof o?t.indexOf(this.terms,e):e;var r=[];t.isArray(n)?r=n:n&&(r=[n]);var s=this.terms.slice(0,i).concat(r).concat(this.terms.slice(i+1));return new this.func(s)},remove:function(t){return this.replace(t)},getDenominator:function(){return new h(t.invoke(this.terms,"getDenominator")).flatten()}}),u.prototype=new c,t.extend(u.prototype,{func:u,eval:function(e,n){return t.reduce(this.terms,(function(t,i){return t+i.eval(e,n)}),0)},codegen:function(){return t.map(this.terms,(function(t){return"("+t.codegen()+")"})).join(" + ")||"0"},print:function(){return t.invoke(this.terms,"print").join("+")},tex:function(){var e="";return t.each(this.terms,(function(t){!e||t.isSubtract()?e+=t.tex():e+="+"+t.tex()})),e},collect:function(e){var n=t.invoke(this.terms,"collect",e),i=[];t.each(n,(function(t){if(t instanceof h){var n=t.partition();i.push([n[1].flatten(),n[0].reduce(e)])}else t instanceof w?i.push([w.One,t]):i.push([t,w.One])}));var r=t.groupBy(i,(function(t){return t[0].normalize().print()})),s=t.compact(t.map(r,(function(n){var i=n[0][0];return new h(new u(t.zip.apply(t,n)[1]).reduce(e),i).collect(e)})));return new u(s).flatten()},factor:function(e){e=t.extend({keepNegative:!1},e);var n,i=t.invoke(this.terms,"collect");n=i[0]instanceof h?i[0].terms:[i[0]],t.each(t.rest(this.terms),(function(e){n=t.map(n,(function(t){return e.findGCD(t)}))})),!e.keepNegative&&this.isNegative()&&n.push(w.Neg),n=new h(n).flatten().collect();var r=t.map(i,(function(t){return h.handleDivide(t,n).simplify()}));return r=new u(r).flatten(),h.createOrAppend(n,r).flatten()},reduce:function(e){return t.reduce(this.terms,(function(t,n){return t.add(n,e)}),this.identity)},needsExplicitMul:function(){return!1},isNegative:function(){var e=t.invoke(this.terms,"collect");return t.all(t.invoke(e,"isNegative"))},negate:function(){return new u(t.invoke(this.terms,"negate"))}}),h.prototype=new c,t.extend(h.prototype,{func:h,eval:function(e,n){return t.reduce(this.terms,(function(t,i){return t*i.eval(e,n)}),1)},codegen:function(){return t.map(this.terms,(function(t){return"("+t.codegen()+")"})).join(" * ")||"0"},print:function(){return t.map(this.terms,(function(t){return t instanceof u?"("+t.print()+")":t.print()})).join("*")},getUnits:function(){var e=t(this.terms).chain().map((function(t){return t.getUnits()})).flatten().value();return e.sort(((t,e)=>t.unit.localeCompare(e.unit))),e},tex:function(){for(var e,n=" \\cdot ",i=t.groupBy(this.terms,(function(t){return t.isDivide()?"inverse":t instanceof w?"number":"other"})),r=i.inverse||[],s=i.number||[],a=i.other||[],o="",c=0;c<s.length;c++){if(s[c]instanceof b&&!(s[c]instanceof _)&&a.length>0&&r.length>0){var f=s.slice();f.splice(c,1);var p=f.concat(r).concat(a);return s[c].tex()+new h(p).tex()}}if(0===(s=t.compact(t.map(s,(function(e){var n=e instanceof b&&!(e instanceof _),i=!e.hints.fraction||r.length>0;if(n&&i){r.push(new l(new _(e.d),w.Div));var s=new _(e.n);return s.hints=e.hints,t.any(e.hints)?s:null}return e})))).length&&1===a.length)e=a[0].tex();else{var y="";t.each(s,(function(t){t.hints.subtract&&t.hints.entered?(o+="-",y+=(y?n:"")+t.abs().tex()):t instanceof _&&-1===t.n&&(t.hints.negate||t.hints.subtract)?o+="-":y+=(y?n:"")+t.tex()})),t.each(a,(function(t){t.needsExplicitMul()?y+=(y?n:"")+t.tex():y+=t instanceof u?"("+t.tex()+")":t.tex()})),e=y||"1"}if(r.length){var g=new h(t.invoke(r,"asDivide")).flatten().tex();return o+"\\frac{"+e+"}{"+g+"}"}return o+e},strip:function(){return new h(t.map(this.terms,(function(t){return t instanceof w?t.abs():t.strip()}))).flatten()},expand:function(){var e=function(t){return t instanceof u},n=function(t){return t instanceof l&&t.exp.isNegative()},i=this.recurse("expand").flatten(),r=t.any(i.terms,e),s=t.any(i.terms,(function(t){return n(t)&&e(t.base)}));if(!r&&!s)return i;var a=t.groupBy(i.terms,n),o=a[!1]||[],c=a[!0]||[];if(r){var f=t.groupBy(o,e),p=f[!0]||[],y=f[!1]||[],g=t.reduce(p,(function(e,n){return t.reduce(e,(function(e,i){return e.concat(t.map(n.terms,(function(t){return i.concat(t)})))}),[])}),[[]]);o=[new u(t.map(g,(function(t){return new h(y.concat(t)).flatten()})))]}s&&(c=[new l(new h(t.invoke(c,"getDenominator")).flatten().expand(),w.Div)]);return new h(o.concat(c)).flatten()},factor:function(e){var n=this.recurse("factor",e).flatten();if(!(n instanceof h))return n;var i=t.groupBy(n.terms,(function(t){return t instanceof b})),r=t.reduce(i[!0],(function(t,e){return{n:t.n*e.n,d:t.d*e.d}}),{n:1,d:1});return r=1===r.d?new _(r.n):new b(r.n,r.d),new h((i[!1]||[]).concat(r)).flatten()},collect:function(e){var n=this.recurse("collect",e).partition(),i=n[0].reduce(e);if(0===i.eval())return w.Zero;var r=n[1].flatten();if(!(r instanceof h))return new h(i,r).flatten();r=r.terms;var s=[];t.each(r,(function(t){t instanceof l?s.push([t.base,t.exp]):s.push([t,w.One])}));var a=t.groupBy(s,(function(t){return t[0].normalize().print()})),o=t.compact(t.map(a,(function(n){var i=n[0][0],r=new u(t.zip.apply(t,n)[1]).collect(e);return r instanceof w&&0===r.eval()?null:[i,r]}))),c=(s=t.groupBy(o,(function(t){return t[0]instanceof p&&t[0].isBasic()?"trig":t[0]instanceof f?"log":"expr"}))).trig||[],y=s.log||[],g=s.expr||[];if(c.length>1){var d=t.groupBy(c,(function(t){return t[0].arg.normalize().print()}));c=[],t.each(d,(function(n){var i=n[0][0].arg,r={sin:w.Zero,cos:w.Zero};t.each(n,(function(t){r[t[0].type]=t[1]})),h.handleNegative(r.sin).collect(e).equals(r.cos)&&(r=r.cos.isNegative()?{tan:r.sin}:{cot:r.cos}),t.each(r,(function(t,e){c.push([new p(e,i),t])}))}))}if(y.length>1){var m=t.groupBy(y,(function(t){return t[0].base.normalize().print()}));y=[],t.each(m,(function(t){2===t.length&&h.handleNegative(t[0][1]).collect(e).equals(t[1][1])?t[0][1].isNegative()?y.push([new f(t[0][0].power,t[1][0].power),t[1][1]]):y.push([new f(t[1][0].power,t[0][0].power),t[0][1]]):y=y.concat(t)}))}s=c.concat(y).concat(g);var v=t.map(s,(function(t){return new l(t[0],t[1]).collect(e)}));return new h([i].concat(v)).flatten()},isSubtract:function(){return t.any(this.terms,(function(t){return t instanceof w&&t.hints.subtract}))},factorIn:function(e){var n=this.partition()[0].terms,i=n.length&&t.all(n,(function(t){return t.n>0}));if(i){var r=n[0].negate();return r.hints=n[0].hints,this.replace(n[0],r.addHint(e))}return new h([w.negativeOne(e)].concat(this.terms))},factorOut:function(){var e=!1,n=t.compact(t.map(this.terms,(function(t,n,i){return!e&&t instanceof w&&t.hints.divide?(e=!0,-1!==t.n?t.negate():null):t})));return 1===n.length?n[0]:new h(n)},reduce:function(e){return t.reduce(this.terms,(function(t,n){return t.mul(n,e)}),this.identity)},findGCD:function(e){return new h(t.invoke(this.terms,"findGCD",e)).flatten()},asMul:function(){return this},asPositiveFactor:function(){return this.isPositive()?this:new h(t.invoke(this.collect().terms,"asPositiveFactor")).flatten()},isNegative:function(){return t.any(t.invoke(this.collect().terms,"isNegative"))},fold:function(){return h.fold(this)},negate:function(){var e=function(t){return t instanceof w};if(t.any(this.terms,e)){var n=t.find(this.terms,e);return this.replace(n,n.negate())}return new h([w.Neg].concat(this.terms))}}),t.each([u,h],(function(e){t.extend(e,{createOrAppend:function(t,n){return t instanceof e?new e(t.terms.concat(n)):new e(t,n)}})})),t.extend(h,{handleNegative:function(t,e){if(t instanceof w&&t.n>0){var n=t.negate();return n.hints=t.hints,n.addHint(e)}return t instanceof h?t.factorIn(e):new h(w.negativeOne(e),t)},handleDivide:function(e,n){if(n instanceof h){var i=h.handleDivide(e,n.terms[0]),r=new h(t.rest(n.terms)).flatten();return h.handleDivide(i,r)}var s=function(t){return t instanceof _};if(s(n)&&e instanceof h&&t.any(e.terms,s)){var a=e.terms.slice().reverse(),o=t.find(a,(function(t){return t instanceof b}));if(!s(o))return new h(e.terms.concat([new b(1,n.n).addHint("fraction")]));var c=new b(o.n,n.n);return c.hints=o.hints,o===a[0]&&(c=c.addHint("fraction")),o.n<0&&n.n<0?(c.d=-c.d,e.replace(o,[w.Neg,c])):e.replace(o,c)}var u=function(t,e){if(e instanceof _){if(t instanceof _)return t.n<0&&e.n<0?[w.Neg,new b(t.n,-e.n).addHint("fraction")]:[new b(t.n,e.n).addHint("fraction")];var n=new b(1,e.eval());return e.eval()<0?[t,n.addHint("negate")]:[t,n]}var i;if(e instanceof p&&e.exp){var r=e.exp;e.exp=void 0,e=new l(e,r)}return i=e instanceof l?new l(e.base,h.handleNegative(e.exp,"divide")):new l(e,w.Div),t instanceof _&&1===t.n?[i]:[t,i]};if(e instanceof h){var f=u(t.last(e.terms),n);return new h(t.initial(e.terms).concat(f))}return new h(f=u(e,n)).flatten()},fold:function(e){if(e instanceof h){var n=t.find(t.initial(e.terms),(function(t){return(t instanceof p||t instanceof f)&&t.hints.open})),i=t.indexOf(e.terms,n);if(n){var r,s=t.last(e.terms);if(!(n.hints.parens||s.hints.parens||s.has(p)||s.has(f)))return r=n instanceof p?p.create([n.type,n.exp],h.createOrAppend(n.arg,s).fold()):f.create(n.base,h.createOrAppend(n.power,s).fold()),0===i?r:new h(e.terms.slice(0,i).concat(r)).fold();n.hints.open=!1}var a=e.partition()[0].terms,o=function(t){return t.n>0},c=function(t){return-1===t.n&&t.hints.negate};if(a.length>1&&t.some(a,c)&&t.some(a,o)&&t.every(a,(function(t){return o(t)||c(t)}))){var u=t.indexOf(e.terms,t.find(e.terms,c)),l=t.indexOf(e.terms,t.find(e.terms,o));if(u<l)return e.replace(l,e.terms[l].negate()).remove(u)}}return e}}),l.prototype=new o,t.extend(l.prototype,{func:l,args:function(){return[this.base,this.exp]},eval:function(t,e){var n=this.base.eval(t,e),i=this.exp.eval(t,e);if(n<0){var r=this.exp.simplify();if(r instanceof k){var s=r.n,a=(s-s.toFixed()).toString().length-2,o=Math.pow(10,a);r=new b(s*o,o).simplify()}if(r instanceof b)if(Math.abs(r.d)%2==1)return(Math.abs(r.n)%2==1?-1:1)*Math.pow(-1*n,i)}return Math.pow(n,i)},getUnits:function(){return this.base.getUnits().map(function(t){return{unit:t.unit,pow:t.pow*this.exp.n}}.bind(this))},codegen:function(){return"Math.pow("+this.base.codegen()+", "+this.exp.codegen()+")"},print:function(){var t=this.base.print();return(this.base instanceof c||this.base instanceof l)&&(t="("+t+")"),t+"^("+this.exp.print()+")"},tex:function(){if(this.isDivide())return"\\frac{1}{"+this.asDivide().tex()+"}";if(this.isRoot())return 1!==this.exp.n&&s("Node marked with hint 'root' does not have exponent of form 1/x."),2===this.exp.d?"\\sqrt{"+this.base.tex()+"}":"\\sqrt["+this.exp.d+"]{"+this.base.tex()+"}";if(this.base instanceof p&&!this.base.isInverse()&&this.exp instanceof w&&this.exp.isSimple()&&this.exp.eval()>=0){var t=this.base.tex({split:!0});return t[0]+"^{"+this.exp.tex()+"}"+t[1]}var e=this.base.tex();return this.base instanceof c||this.base instanceof l||this.base instanceof w&&!this.base.isSimple()?e="("+e+")":(this.base instanceof p||this.base instanceof f)&&(e="["+e+"]"),e+"^{"+this.exp.tex()+"}"},needsExplicitMul:function(){return!this.isRoot()&&this.base.needsExplicitMul()},expand:function(){var e=this.recurse("expand");if(e.base instanceof h)return new h(t.map(e.base.terms,(function(t){return new l(t,e.exp)}))).expand();if(e.base instanceof u&&e.exp instanceof _&&e.exp.abs().eval()>1){for(var n=e.exp.eval()>0,i=e.exp.abs().eval(),r=function(t){return n?t:new l(t,w.Div)},s={1:e.base},a=2;a<=i;a*=2){var o=new h(s[a/2],s[a/2]);s[a]=o.expand().collect()}if(t.has(s,i))return r(s[i]);var c=t.map(i.toString(2).split(""),(function(t,e,n){return Number(t)*Math.pow(2,n.length-e-1)}));return c=t.without(c,0),r(o=new h(t.pick(s,c)).expand().collect())}return e.exp instanceof u?new h(t.map(e.exp.terms,(function(t){return new l(e.base,t).expand()}))).expand():e},factor:function(){var e=this.recurse("factor");return e.base instanceof h?new h(t.map(e.base.terms,(function(t){return t instanceof _&&e.exp.equals(w.Div)?new b(1,t.n):new l(t,e.exp)}))):e},collect:function(e){if(this.base instanceof l)return new l(this.base.base,s=h.createOrAppend(this.base.exp,this.exp)).collect(e);var n=this.recurse("collect",e),i=function(t){return t instanceof f&&t.base.equals(n.base)};if(n.exp instanceof w&&0===n.exp.eval())return w.One;if(n.exp instanceof w&&1===n.exp.eval())return n.base;if(i(n.exp))return n.exp.power;if(n.exp instanceof h&&t.any(n.exp.terms,i)){var r=t.find(n.exp.terms,i);return new l(r.power,s=n.exp.remove(r).flatten()).collect(e)}if(n.base instanceof w&&n.exp instanceof w){if(e&&e.preciseFloats){var s=n.exp.asRational(),a=n.base.getDecimalPlaces();if(new l(n.base,new b(1,s.d)).collect().getDecimalPlaces()>a){var o=new l(n.base,new _(s.n)).collect();return new l(o,new b(1,s.d))}}return n.base.raiseToThe(n.exp,e)}return n},isDivide:function(){var e=function(t){return t instanceof w&&t.hints.divide};return e(this.exp)||this.exp instanceof h&&t.any(this.exp.terms,e)},asDivide:function(){if(this.exp instanceof w){if(-1===this.exp.eval())return this.base;var e=this.exp.negate();return e.hints=t.clone(this.exp.hints),e.hints.divide=!1,new l(this.base,e)}if(this.exp instanceof h)return new l(this.base,this.exp.factorOut());s("called asDivide() on an Expr that wasn't a Num or Mul")},isRoot:function(){return this.exp instanceof b&&this.exp.hints.root},isSquaredTrig:function(){return this.base instanceof p&&!this.base.isInverse()&&this.exp instanceof w&&2===this.exp.eval()},getDenominator:function(){if(this.exp instanceof w&&-1===this.exp.eval())return h.createOrAppend(this.base,this.base.getDenominator()).flatten();if(this.exp.isNegative()){var t=new l(this.base,h.handleNegative(this.exp).collect());return h.createOrAppend(t,t.collect().getDenominator()).flatten()}return this.base instanceof w?new l(this.base.getDenominator(),this.exp).collect():w.One},findGCD:function(t){var e,n;if(t instanceof l?(e=t.base,n=t.exp):(e=t,n=w.One),this.base.equals(e)){if(this.exp.equals(n))return this;if(this.exp instanceof w&&n instanceof w)return new l(this.base,w.min(this.exp,n)).collect();if(this.exp instanceof w||n instanceof w)return w.One;var i=this.exp.asMul().partition(),r=n.asMul().partition();if(i[1].equals(r[1]))return new l(e,new h(w.min(i[0].reduce(),r[0].reduce()),i[1].flatten()).flatten()).collect()}return w.One},isPositive:function(){if(this.base.isPositive())return!0;var t=this.exp.simplify();return t instanceof _&&t.eval()%2==0},asPositiveFactor:function(){if(this.isPositive())return this;var t=this.exp.simplify();if(t instanceof _){var e=t.eval();if(e>2)return new l(this.base,new _(e-1));if(e<-2)return new l(this.base,new _(e+1))}return w.One}}),t.extend(l,{sqrt:function(t){return new l(t,w.Sqrt)},nthroot:function(t,e){return new l(t,h.fold(h.handleDivide(new _(1),e)).addHint("root"))}}),f.prototype=new o,t.extend(f.prototype,{func:f,args:function(){return[this.base,this.power]},eval:function(t,e){return Math.log(this.power.eval(t,e))/Math.log(this.base.eval(t,e))},codegen:function(){return"(Math.log("+this.power.codegen()+") / Math.log("+this.base.codegen()+"))"},print:function(){var t="("+this.power.print()+")";return this.isNatural()?"ln"+t:"log_("+this.base.print()+") "+t},tex:function(){var t="("+this.power.tex()+")";return this.isNatural()?"\\ln"+t:"\\log_{"+this.base.tex()+"}"+t},collect:function(t){var e=this.recurse("collect",t);return e.power instanceof w&&1===e.power.eval()?w.Zero:e.base.equals(e.power)?w.One:e.power instanceof l&&e.power.base.equals(e.base)?e.power.exp:e},expand:function(){var e=this.recurse("expand");return e.power instanceof h?new u(t.map(e.power.terms,(function(t){return new f(e.base,t).expand()}))):e.power instanceof l?new h(e.power.exp,new f(e.base,e.power.base).expand()).flatten():e.isNatural()?e:h.handleDivide(new f(x.e,e.power),new f(x.e,e.base))},hints:t.extend(f.prototype.hints,{open:!1}),isPositive:function(){var t=this.collect();return t.base instanceof w&&t.power instanceof w&&this.eval()>0},needsExplicitMul:function(){return!1},isNatural:function(){return this.base.equals(x.e)}}),t.extend(f,{natural:function(){return x.e},common:function(){return w.Ten},create:function(t,e){var n=new f(t,e);return e.hints.parens||(n=n.addHint("open")),n}}),p.prototype=new o,t.extend(p.prototype,{func:p,args:function(){return[this.type,this.arg]},functions:{sin:{eval:Math.sin,codegen:"Math.sin((",tex:"\\sin",expand:function(){return this}},cos:{eval:Math.cos,codegen:"Math.cos((",tex:"\\cos",expand:function(){return this}},tan:{eval:Math.tan,codegen:"Math.tan((",tex:"\\tan",expand:function(){return h.handleDivide(p.sin(this.arg),p.cos(this.arg))}},csc:{eval:function(t){return 1/Math.sin(t)},codegen:"(1/Math.sin(",tex:"\\csc",expand:function(){return h.handleDivide(w.One,p.sin(this.arg))}},sec:{eval:function(t){return 1/Math.cos(t)},codegen:"(1/Math.cos(",tex:"\\sec",expand:function(){return h.handleDivide(w.One,p.cos(this.arg))}},cot:{eval:function(t){return 1/Math.tan(t)},codegen:"(1/Math.tan(",tex:"\\cot",expand:function(){return h.handleDivide(p.cos(this.arg),p.sin(this.arg))}},arcsin:{eval:Math.asin,codegen:"Math.asin((",tex:"\\arcsin"},arccos:{eval:Math.acos,codegen:"Math.acos((",tex:"\\arccos"},arctan:{eval:Math.atan,codegen:"Math.atan((",tex:"\\arctan"},arccsc:{eval:function(t){return Math.asin(1/t)},codegen:"Math.asin(1/(",tex:"\\operatorname{arccsc}"},arcsec:{eval:function(t){return Math.acos(1/t)},codegen:"Math.acos(1/(",tex:"\\operatorname{arcsec}"},arccot:{eval:function(t){return Math.atan(1/t)},codegen:"Math.atan(1/(",tex:"\\operatorname{arccot}"},sinh:{eval:function(t){return(Math.exp(t)-Math.exp(-t))/2},codegen:function(t){return"((Math.exp("+t+") - Math.exp(-("+t+"))) / 2)"},tex:"\\sinh",expand:function(){return this}},cosh:{eval:function(t){return(Math.exp(t)+Math.exp(-t))/2},codegen:function(t){return"((Math.exp("+t+") + Math.exp(-("+t+"))) / 2)"},tex:"\\cosh",expand:function(){return this}},tanh:{eval:function(t){return(Math.exp(t)-Math.exp(-t))/(Math.exp(t)+Math.exp(-t))},codegen:function(t){return"((Math.exp("+t+") - Math.exp(-("+t+"))) / (Math.exp("+t+") + Math.exp(-("+t+"))))"},tex:"\\tanh",expand:function(){return h.handleDivide(p.sinh(this.arg),p.cosh(this.arg))}},csch:{eval:function(t){return 2/(Math.exp(t)-Math.exp(-t))},codegen:function(t){return"(2 / (Math.exp("+t+") - Math.exp(-("+t+"))))"},tex:"\\csch",expand:function(){return h.handleDivide(w.One,p.sinh(this.arg))}},sech:{eval:function(t){return 2/(Math.exp(t)+Math.exp(-t))},codegen:function(t){return"(2 / (Math.exp("+t+") + Math.exp(-("+t+"))))"},tex:"\\sech",expand:function(){return h.handleDivide(w.One,p.cosh(this.arg))}},coth:{eval:function(t){return(Math.exp(t)+Math.exp(-t))/(Math.exp(t)-Math.exp(-t))},codegen:function(t){return"((Math.exp("+t+") + Math.exp(-("+t+"))) / (Math.exp("+t+") - Math.exp(-("+t+"))))"},tex:"\\coth",expand:function(){return h.handleDivide(p.cosh(this.arg),p.sinh(this.arg))}}},isEven:function(){return t.contains(["cos","sec"],this.type)},isInverse:function(){return 0===this.type.indexOf("arc")},isBasic:function(){return t.contains(["sin","cos"],this.type)},eval:function(t,e){return(0,this.functions[this.type].eval)(this.arg.eval(t,e))},codegen:function(){var t=this.functions[this.type].codegen;if("function"==typeof t)return t(this.arg.codegen());if("string"==typeof t)return t+this.arg.codegen()+"))";throw new Error("codegen not implemented for "+this.type)},print:function(){return this.type+"("+this.arg.print()+")"},tex:function(t){var e=this.functions[this.type].tex,n="("+this.arg.tex()+")";return t&&t.split?[e,n]:e+n},hints:t.extend(p.prototype.hints,{open:!1}),isPositive:function(){return this.collect().arg instanceof w&&this.eval()>0},completeParse:function(){if(this.exp){var t=new l(this,this.exp);return this.exp=void 0,t}return this},needsExplicitMul:function(){return!1},expand:function(){var e=this.recurse("expand");if(e.isInverse())return e;var n=e.functions[e.type].expand;return t.bind(n,e)()},collect:function(t){var e,n=this.recurse("collect",t);return!n.isInverse()&&n.arg.isNegative()?(e=n.arg instanceof w?n.arg.abs():h.handleDivide(n.arg,w.Neg).collect(t),n.isEven()?new p(n.type,e):new h(w.Neg,new p(n.type,e))):n}}),t.extend(p,{create:function(t,e){var n=t[0],i=t[1];i&&i.equals(w.Neg)&&(n="arc"+n,i=void 0);var r=new p(n,e);return e.hints.parens||(r=r.addHint("open")),i&&(r.exp=i),r},sin:function(t){return new p("sin",t)},cos:function(t){return new p("cos",t)},sinh:function(t){return new p("sinh",t)},cosh:function(t){return new p("cosh",t)}}),y.prototype=new o,t.extend(y.prototype,{func:y,args:function(){return[this.arg]},eval:function(t,e){return Math.abs(this.arg.eval(t,e))},codegen:function(){return"Math.abs("+this.arg.codegen()+")"},print:function(){return"abs("+this.arg.print()+")"},tex:function(){return"\\left|"+this.arg.tex()+"\\right|"},collect:function(e){var n=this.recurse("collect",e);if(n.arg.isPositive())return n.arg;if(n.arg instanceof w)return n.arg.abs();if(n.arg instanceof h){var i=t.groupBy(n.arg.terms,(function(t){return t.isPositive()?"positive":t instanceof w?"number":"other"})),r=i.positive.concat(t.invoke(i.number,"abs"));return i.other.length&&r.push(new y(new h(i.other).flatten())),new h(r).flatten()}return n},expand:function(){var e=this.recurse("expand");return e.arg instanceof h?new h(t.map(e.arg.terms,(function(t){return new y(t)}))):e},isPositive:function(){return!0}}),g.prototype=new o,t.extend(g.prototype,{func:g,args:function(){return[this.left,this.type,this.right]},needsExplicitMul:function(){return!1},print:function(){return this.left.print()+this.type+this.right.print()},signs:{"=":" = ","<":" < ",">":" > ","<>":" \\ne ","<=":" \\le ",">=":" \\ge "},tex:function(){return this.left.tex()+this.signs[this.type]+this.right.tex()},normalize:function(){var e=this.recurse("normalize");return t.contains([">",">="],e.type)?new g(e.right,e.type.replace(">","<"),e.left):e},asExpr:function(e){var n=function(t){return t instanceof w&&t.isSimple()&&0===t.eval()},i=[];this.left instanceof u?i=t.clone(this.left.terms):n(this.left)||(i=[this.left]),this.right instanceof u?i=i.concat(this.right.negate().terms):n(this.right)||i.push(this.right.negate());var r=!this.isEquality();i=t.invoke(i,"collect",{preciseFloats:!0});for(var s=0;s<i.length;s++){var a=i[s].getDenominator();r&&!a.isPositive()&&(a=a.asPositiveFactor()),a.equals(w.One)||(i=t.map(i,(function(t){return h.createOrAppend(t,a).simplify({once:!0,preciseFloats:!0})})))}var o=new u(i).flatten();return e?o:this.divideThrough(o)},divideThrough:function(e){var n=!this.isEquality(),i=e.simplify({once:!0}),r=i.factor({keepNegative:n});if(!(r instanceof h))return e;var s=r.terms,a=t.groupBy(s,(function(t){return t instanceof u})),o=a[!0]||[],c=a[!1]||[];if(o.length&&this.isEquality())return new h(o).flatten();var f=c;o.length||(f=t.reject(f,(function(t){return!!t.getVars().length}))),n&&(f=t.invoke(f,"asPositiveFactor")),f=t.reject(f,(function(t){return t.equals(w.One)})),f=t.map(f,(function(t){return new l(t,w.Div)}));var p=new h(s.concat(f)).collect();return p.equals(r)?i:p},isEquality:function(){return t.contains(["=","<>"],this.type)},compare:function(t){if(!(t instanceof g))return!1;var e=this.normalize(),n=t.normalize();if(e.type!==n.type)return!1;var i=e.divideThrough(e.asExpr(!0).collect()),r=n.divideThrough(n.asExpr(!0).collect());return e.isEquality()?i.compare(r)||i.compare(h.handleNegative(r)):i.compare(r)},sameForm:function(t){var e=this.normalize(),n=t.normalize(),i=e.left.sameForm(n.left)&&e.right.sameForm(n.right);return e.isEquality()?i||e.left.sameForm(n.right)&&e.right.sameForm(n.left):i},isSimplified:function(){var t=this.asExpr(!0),e=this.divideThrough(t).simplify();return t.equals(e)&&this.left.isSimplified()&&this.right.isSimplified()}}),t.extend(g.prototype,{solveLinearEquationForVariable:function(e){var n=this.asExpr();if(!n.is(u)||2!==n.terms.length)throw new Error("Can only handle linear equations of the form a + bx (= 0)");var i,r,s;return(s=n.terms[0]).has(v)&&t.contains(s.getVars(),e.symbol)?(i=h.handleNegative(n.terms[1]),r=h.handleDivide(n.terms[0],e)):(i=h.handleNegative(n.terms[0]),r=h.handleDivide(n.terms[1],e)),h.handleDivide(i,r).simplify()}}),d.prototype=new o,t.extend(d.prototype,{needsExplicitMul:function(){return!1},findGCD:function(t){return t instanceof d||t instanceof w?this.equals(t)?this:w.One:t.findGCD(this)}}),m.prototype=new d,t.extend(m.prototype,{func:m,args:function(){return[this.symbol,this.arg]},print:function(){return this.symbol+"("+this.arg.print()+")"},tex:function(){return this.symbol+"("+this.arg.tex()+")"},eval:function(e,n){var i=this.arg,r=e[this.symbol],s=t.extend(t.clone(e),{x:i.eval(e,n)}),a=M(r,n);return a.parsed?a.expr.eval(s,n):a},codegen:function(){return'vars["'+this.symbol+'"]('+this.arg.codegen()+")"},getUnits:function(){return this.arg.getUnits()},getVars:function(e){return e?this.arg.getVars():t.union(this.arg.getVars(),[this.symbol]).sort()},getConsts:function(){return this.arg.getConsts()}}),v.prototype=new d,t.extend(v.prototype,{func:v,args:function(){return[this.symbol,this.subscript]},exprArgs:function(){return[]},recurse:function(){return this},print:function(){var t="";return this.subscript&&(t="_("+this.subscript.print()+")"),this.symbol+t},prettyPrint:function(){var t=this.subscript;return t&&(t instanceof w||t instanceof d)?this.symbol+"_"+t.print():this.print()},tex:function(){var t="";return this.subscript&&(t="_{"+this.subscript.tex()+"}"),(this.symbol.length>1?"\\":"")+this.symbol+t},repr:function(){return"Var("+this.print()+")"},eval:function(t,e){return t[this.prettyPrint()]},codegen:function(){return'vars["'+this.prettyPrint()+'"]'},getVars:function(){return[this.prettyPrint()]},isPositive:function(){return!1}}),x.prototype=new d,t.extend(x.prototype,{func:x,args:function(){return[this.symbol]},recurse:function(){return this},eval:function(t,e){return"pi"===this.symbol?Math.PI:"e"===this.symbol?Math.E:void 0},codegen:function(){return"pi"===this.symbol?"Math.PI":"e"===this.symbol?"Math.E":void 0},print:function(){return this.symbol},tex:function(){return"pi"===this.symbol?"\\pi ":"e"===this.symbol?"e":void 0},isPositive:function(){return this.eval()>0},abs:function(){return this.eval()>0?this:h.handleNegative(this)},getConsts:function(){return[this.print()]}}),x.e=new x("e"),x.pi=new x("pi"),w.prototype=new o,t.extend(w.prototype,{repr:function(){return this.print()},strip:function(){return this.abs()},recurse:function(){return this},codegen:function(){return this.print()},add:r,mul:r,negate:r,isSubtract:function(){return this.hints.subtract},abs:r,needsExplicitMul:function(){return!0},findGCD:r,isPositive:function(){return this.eval()>0},isNegative:function(){return this.eval()<0},asPositiveFactor:function(){return this.isPositive()?this:this.abs()},hints:t.extend(w.prototype.hints,{negate:!1,subtract:!1,divide:!1,root:!1,fraction:!1,entered:!1}),isSimple:r,getDecimalPlaces:function(){var t=(""+this.n).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0},asRational:r}),b.prototype=new w,t.extend(b.prototype,{func:b,args:function(){return[this.n,this.d]},eval:function(){return this.n/this.d},print:function(){return this.n.toString()+"/"+this.d.toString()},tex:function(){var t="\\frac{"+Math.abs(this.n).toString()+"}{"+this.d.toString()+"}";return this.n<0?"-"+t:t},add:function(t,e){return t instanceof b?new b(this.n*t.d+this.d*t.n,this.d*t.d).collect():t.add(this,e)},mul:function(t,e){return t instanceof b?new b(this.n*t.n,this.d*t.d).collect():t.mul(this,e)},collect:function(){var t=w.findGCD(this.n,this.d),e=this.n/t,n=this.d/t;return 1===n?new _(e):new b(e,n)},negate:function(){return new b(-this.n,this.d)},abs:function(){return new b(Math.abs(this.n),this.d)},findGCD:function(t){return t instanceof b?new b(w.findGCD(this.n*t.d,t.n*this.d),this.d*t.d).collect():t instanceof _?new b(w.findGCD(this.n,t.n),this.d):t.findGCD(this)},raiseToThe:function(t){if(t instanceof _){var e=t.eval()>0,n=t.abs().eval(),i=Math.pow(this.n,n),r=Math.pow(this.d,n);return e?new b(i,r).collect():new b(r,i).collect()}return new k(this.eval()).raiseToThe(t)},getDenominator:function(){return new _(this.d)},isSimple:function(){return!1},asRational:function(){return this}}),_.prototype=new b(0,1),t.extend(_.prototype,{func:_,args:function(){return[this.n]},print:function(){return this.n.toString()},tex:function(){return this.n.toString()},negate:function(){return new _(-this.n)},abs:function(){return new _(Math.abs(this.n))},isSimple:function(){return!0},findGCD:function(t){return t instanceof _?new _(w.findGCD(this.n,t.n)):t.findGCD(this)}}),t.extend(_,{create:function(t){return new _(t).addHint("entered")}}),k.prototype=new w,t.extend(k.prototype,{func:k,args:function(){return[this.n]},eval:function(){return this.n},print:function(){return this.n.toString()},tex:function(){return this.n.toString()},add:function(t,e){return e&&e.preciseFloats?k.toDecimalPlaces(this.n+t.eval(),Math.max(this.getDecimalPlaces(),t.getDecimalPlaces())):new k(this.n+t.eval()).collect()},mul:function(t,e){return e&&e.preciseFloats?k.toDecimalPlaces(this.n*t.eval(),this.getDecimalPlaces()+t.getDecimalPlaces()):new k(this.n*t.eval()).collect()},collect:function(){return this},negate:function(){return new k(-this.n)},abs:function(){return new k(Math.abs(this.n))},findGCD:function(t){return t instanceof w?new k(w.findGCD(this.eval(),t.eval())).collect():t.findGCD(this)},raiseToThe:function(t,e){return e&&e.preciseFloats&&t instanceof _&&t.n>1?k.toDecimalPlaces(new l(this,t).eval(),this.getDecimalPlaces()*t.n):new k(new l(this,t).eval()).collect()},asRational:function(){var t=this.n.toString().split(".");return 1===t.length?new b(this.n,1):new b(Number(t.join("")),Math.pow(10,t[1].length)).collect()},getDenominator:function(){return this.asRational().getDenominator()},isSimple:function(){return!0}}),t.extend(k,{create:function(t){return new k(t).addHint("entered")},toDecimalPlaces:function(t,e){return new k(+t.toFixed(Math.min(e,20))).collect()}}),t.extend(w,{negativeOne:function(t){return"subtract"===t?w.Sub:"divide"===t?w.Div:w.Neg},findGCD:function(t,e){var n;if(t=Math.abs(t),e=Math.abs(e),t!==Math.floor(t)||e!==Math.floor(e))return 1;for(;e;)n=t%e,t=e,e=n;return t},min:function(){return t.min(t.toArray(arguments),(function(t){return t.eval()}))},max:function(){return t.max(t.toArray(arguments),(function(t){return t.eval()}))}}),w.Neg=new _(-1).addHint("negate"),w.Sub=new _(-1).addHint("subtract"),w.Div=new _(-1).addHint("divide"),w.Sqrt=new b(1,2).addHint("root"),w.Zero=new _(0),w.One=new _(1),w.Ten=new _(10),u.prototype.identity=w.Zero,h.prototype.identity=w.One;i.yy={Add:u,Mul:h,Pow:l,Log:f,Trig:p,Eq:g,Abs:y,Func:m,Const:x,Var:v,Int:_,Float:k,parseError:function(t,e){throw new Error(e.loc.first_column)},constants:["e"],symbolLexer:function(e){return t.contains(i.yy.constants,e)?"CONST":t.contains(i.yy.functions,e)?"FUNC":"VAR"}};var M=function(e,n){try{return n&&n.functions?i.yy.functions=t.without(n.functions,"i"):i.yy.functions=[],n&&n.decimal_separator&&(e=e.split(n.decimal_separator).join(".")),{parsed:!0,expr:i.parse(e).completeParse()}}catch(t){return{parsed:!1,error:t.message}}};function E(t){this.symbol=t}E.prototype=new d;var I=function(e){if(t(D).has(e)||t(T).has(e))return new E(e);var n=t(t(N).keys()).find((function(t){return new RegExp("^"+t).test(e)}));if(n){var i=e.replace(new RegExp("^"+n),"");if(t(D).has(i)||T[i]&&T[i].prefixes===A)return new h(N[n],new E(i));throw new Error(i+" does not allow prefixes")}return new E(e)},S=function(e){try{var i=n.parse(e),r=[];t(i.unit.num).each((function(t){r.push(new l(I(t.name),new _(t.pow)))})),t(i.unit.denom).each((function(t){r.push(new l(I(t.name),new _(-1*t.pow)))}));var s=new h(r).flatten();return"unitMagnitude"===i.type?{parsed:!0,unit:s,expr:new h([new k(+i.magnitude)].concat(r)),coefficient:i.magnitude,type:i.type}:{parsed:!0,unit:s,type:i.type}}catch(t){return{parsed:!1,error:t.message}}};t.extend(E.prototype,{func:E,args:function(){return[this.symbol]},recurse:function(){return this},eval:function(t,e){return 1},getUnits:function(){return[{unit:this.symbol,pow:1}]},codegen:function(){return"1"},print:function(){return this.symbol},tex:function(){return this.symbol},collect:function(e){if(t(D).has(this.symbol))return this;if(t(T).has(this.symbol))return T[this.symbol].conversion;throw new Error("could not understand unit: "+this.symbol)}});var D={m:new E("m"),g:new E("g"),s:new E("s"),A:new E("A"),K:new E("K"),mol:new E("mol"),cd:new E("cd")},N={a:new l(new _(10),new _(-18)),f:new l(new _(10),new _(-15)),p:new l(new _(10),new _(-12)),n:new l(new _(10),new _(-9)),u:new l(new _(10),new _(-6)),m:new l(new _(10),new _(-3)),c:new l(new _(10),new _(-2)),d:new l(new _(10),new _(-1)),da:new _(10),h:new l(new _(10),new _(2)),k:new l(new _(10),new _(3)),M:new l(new _(10),new _(6)),G:new l(new _(10),new _(9)),T:new l(new _(10),new _(12)),P:new l(new _(10),new _(15)),E:new l(new _(10),new _(18)),hella:new l(new _(10),new _(27))},A={},O={},P=function(t,e){var n=t.split("|"),i=n[0].trim(),r=n[1].trim(),s=w.One;""!==i&&(s=M(i).expr);var a=r.split("/"),o=[s];return a[0]&&a[0].split(" ").filter((function(t){return""!==t})).map((function(t){o.push(new E(t))})),a[1]&&a[1].split(" ").filter((function(t){return""!==t})).map((function(t){o.push(new l(new E(t),w.Div))})),{conversion:new h(o),prefixes:e}},T={Da:P("1.6605388628 x 10^-24 | g",A),u:P("| Da",O),meter:P("| m",O),meters:P("| m",O),in:P("254 / 10000 | m",O),ft:P("3048 / 10000 | m",O),yd:P("9144 / 10000 | m",O),mi:P("1609344 / 1000 | m",O),ly:P("9.4607 x 10^15 | m",O),nmi:P("1852 | m",O),"Å":P("10^-10 | m",O),pc:P("3.0857 x 10^16 | m",O),min:P("60 | s",O),hr:P("3600 | s",O),sec:P("| s",O),day:P("86400 | s",O),wk:P("604800 | s",O),fortnight:P("14 | day",O),shake:P("10^-8 | s",O),olympiad:P("126200000 | s",O),"°C":P("1 | K",O),"°F":P("5/9 | K",O),"°R":P("5/9 | K",O),e:P("1.6021765314 x 10^-19 | C",O),c:P("299792458 | m / s",O),kn:P("514/1000 | m / s",O),kt:P("| kn",O),knot:P("| kn",O),J:P("| N m",A),BTU:P("1060 | J",O),cal:P("4184 / 1000 | J",A),eV:P("1.602176514 x 10^-19 | J",A),erg:P("10^−7 | J",A),W:P("| J / s",A),"H-e":P("80 | W",O),N:P("1000 | g m / s s",A),lb:P("4448221615 / 1000000000 | N",O),dyn:P("10^-5 | N",O),Pa:P("1 | N / m m m",A),bar:P("10^5 | Pa",A),"㏔":P("1/1000 | bar",O),"㍴":P("| bar",O),atm:P("101325 | Pa",O),Torr:P("1/760 | atm",O),mmHg:P("| Torr",O),ha:P("10^4 | m m",O),b:P("10^−28 | m m",A),barn:P("| b",A),acre:P("4046.87 | m m",O),skilodge:P("10^-31 | m m",O),outhouse:P("10^-34 | m m",O),shed:P("10^-52 | m m",O),L:P("1/1000 | m m m",A),gal:P("3785/1000 | L",A),cup:P("1/16 | gal",O),qt:P("1/4 | gal",O),quart:P("| qt",O),p:P("1/8 | gal",O),pt:P("| p",O),pint:P("| p",O),"fl oz":P("1/8 | cup",O),"fl. oz.":P("1/8 | cup",O),tbsp:P("1/16 | cup",O),tsp:P("1/3 | tbsp",O),rev:P("2 pi | rad",O),deg:P("180 pi | rad",O),"°":P("| deg",O),arcminute:P("1/60 | deg",O),arcsec:P("1/3600 | deg",O),Hu:P("1000 | dB",A),dozen:P("12 |",O),mol:P("6.0221412927 x 10^23 |",A),"%":P("1/100 |",O),percent:P("| %",O),ppm:P("1/1000000 |",O),V:P("1000 | g m m / s s C",A),C:P("| A s",A),ampere:P("| A",O),"Ω":P("| V / A",A),ohm:P("| Ω",O),F:P("| C / V",A),H:P("| ohm s",A),T:P("1000 | g / C s",A),Wb:P("1000 | g m m / C s",A),lm:P("pi x 10^4 | cd / m m",O),lx:P("| lm / m m",O),nit:P("| cd / m m",O),sb:P("10^4 | cd / m m",O),stilb:P("1 | sb",O),apostilb:P("1 / pi x 10^(-4) | sb",O),blondel:P("| apostilb",O),asb:P("| apostilb",O),la:P("| lm",O),Lb:P("| lm",O),sk:P("10^-7 | lm",O),skot:P("| sk",O),bril:P("10^-11 | lm",O),Hz:P("| / s",A)},q=w.Zero,F=w.One,C=function(e,n,i){var r={form:!1,simplify:!1};i=void 0!==i?t.extend(r,i):r;var s,a=e.sameVars(n);return a.equal?e.compare(n)?i.form&&!e.sameForm(n)?{equal:!1,message:"Your answer is not in the correct form."}:i.simplify&&!e.isSimplified()?{equal:!1,message:"Your answer is not fully expanded and simplified."}:{equal:!0,message:null}:{equal:!1,message:null}:(s=a.equalIgnoringCase?"Check your variables; one or more are using the wrong case (upper or lower).":"Check your variables; you may have used the wrong letter for one or more of them.",{equal:!1,wrongVariableCase:a.equalIgnoringCase,wrongVariableNames:!a.equalIgnoringCase,message:s})};export{y as Abs,u as Add,x as Const,g as Eq,k as Float,m as Func,_ as Int,f as Log,h as Mul,F as One,l as Pow,b as Rational,p as Trig,E as Unit,v as Var,q as Zero,C as compare,M as parse,S as unitParse};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|