forked from gcorazza/Staff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
taramath.js
executable file
·1 lines (1 loc) · 284 KB
/
taramath.js
1
var Complex_taramathObject=function(){function o(r){return 1==GlobalClasses.is_vector(r)&&2==r.length?r:1==GlobalClasses.is_number(r)?[r,0]:0}this.add=function(){if(arguments.length<2)return GlobalClasses.error_code("Complex","add",0);for(var r=[0,0],e=0;e<arguments.length;e++){var t=o(arguments[e]);if(0==t)return GlobalClasses.error_code("Complex","add",1);r=[r[0]+t[0],r[1]+t[1]]}return r},this.mult=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("Complex","mult",0);for(var t=[1,0],a=0;a<arguments.length;a++){var n=o(arguments[a]);if(0==n)return GlobalClasses.error_code("Complex","mult",1);t=[t[0]*n[0]-t[1]*n[1],t[0]*n[1]+t[1]*n[0]]}return t},this.sub=function(r,e){if(2!=arguments.length)return GlobalClasses.error_code("Complex","sub",0);var t=o(r);if(0==t)return GlobalClasses.error_code("Complex","sub",1);var a=o(e);return 0==a?GlobalClasses.error_code("Complex","sub",1):[t[0]-a[0],t[1]-a[1]]},this.div=function(r,e){if(2!=arguments.length)return GlobalClasses.error_code("Complex","div",0);var t=o(r);if(0==t)return GlobalClasses.error_code("Complex","div",1);var a=o(e);if(0==a)return GlobalClasses.error_code("Complex","div",1);var n=a[0]*a[0]+a[1]*a[1];return 0==n?[0,0]:[(t[0]*a[0]+t[1]*a[1])/n,(t[1]*a[0]-t[0]*a[1])/n]},this.sq=function(r){if(1!=arguments.length)return GlobalClasses.error_code("Complex","sq",0);var e=o(r);return 0==e?GlobalClasses.error_code("Complex","sq",1):[e[0]*e[0]-e[1]*e[1],2*e[0]*e[1]]},this.sqrt=function(r){if(1!=arguments.length)return GlobalClasses.error_code("Complex","sqrt",0);var e=o(r);if(0==e)return GlobalClasses.error_code("Complex","sqrt",1);var t=Math.sqrt(Math.sqrt(e[0]*e[0]+e[1]*e[1])),a=.5*Math.atan2(e[1],e[0]);return[t*Math.cos(a),t*Math.sin(a)]},this.exp=function(r){if(1!=arguments.length)return GlobalClasses.error_code("Complex","exp",0);var e=o(r);if(0==e)return GlobalClasses.error_code("Complex","exp",1);var t=Math.exp(e[0]);return[t*Math.cos(e[1]),t*Math.sin(e[1])]},this.cos=function(r){if(1!=arguments.length)return GlobalClasses.error_code("Complex","cos",0);var e=o(r);if(0==e)return GlobalClasses.error_code("Complex","cos",1);var t=(Math.exp(e[1])+Math.exp(-e[1]))/2,a=(Math.exp(e[1])-Math.exp(-e[1]))/2;return[Math.cos(e[0])*t,-Math.sin(e[0])*a]},this.sin=function(r){if(1!=arguments.length)return GlobalClasses.error_code("Complex","sin",0);var e=o(r);if(0==e)return GlobalClasses.error_code("Complex","sin",1);var t=(Math.exp(e[1])+Math.exp(-e[1]))/2,a=(Math.exp(e[1])-Math.exp(-e[1]))/2;return[Math.sin(e[0])*t,Math.cos(e[0])*a]},this.log=function(r){if(1!=arguments.length)return GlobalClasses.error_code("Complex","log",0);var e=o(r);if(0==e)return GlobalClasses.error_code("Complex","log",1);var t=e[0]*e[0]+e[1]*e[1];return t<=0?[0,0]:[Math.log(Math.sqrt(t)),Math.atan2(e[1],e[0])]},this.atan=function(r){if(1!=arguments.length)return GlobalClasses.error_code("Complex","atan",0);var e=o(r);return 0==e?GlobalClasses.error_code("Complex","atan",1):this.mult([0,.5],this.log(this.div([e[0],e[1]+1],[-e[0],1-e[1]])))},this.abs=function(r){if(1!=arguments.length)return GlobalClasses.error_code("Complex","abs",0);var e=o(r);return 0==e?GlobalClasses.error_code("Complex","abs",1):Math.sqrt(e[0]*e[0]+e[1]*e[1])},this.angle=function(r){if(1!=arguments.length)return GlobalClasses.error_code("Complex","angle",0);var e=o(r);return 0==e?GlobalClasses.error_code("Complex","angle",1):Math.atan2(e[1],e[0])}},Complex=new Complex_taramathObject,ComputationalGeometry_taramathObject=function(){var C=1e-6;function m(r,e){for(var t=r.length,a=[],n=0;n<t;n++)a.push([r[n][0],r[n][1]]);a.sort(function(r,e){return r[0]!=e[0]?r[0]-e[0]:r[1]-e[1]});for(var o=0;o<t-1;o++)for(var l=o+1;l<t&&Math.abs(a[o][0]-a[l][0])<e;){if(Math.abs(a[o][1]-a[l][1])<e)return!1;l++}return!0}function v(r,e,t,a){var n,o,l,s,i,f,u,g,_=r[e][0],h=r[e][1],c=r[t][0],d=r[t][1],v=r[a][0],b=r[a][1],m=Math.abs(h-d),p=Math.abs(d-b);if(m<C&&p<C)return"Unexpected failure, coincident data points.";o=m<C?(s=-(v-c)/(b-d))*((n=(c+_)/2)-(f=(c+v)/2))+(g=(d+b)/2):p<C?(l=-(c-_)/(d-h))*((n=(v+c)/2)-(i=(_+c)/2))+(u=(h+d)/2):(n=((l=-(c-_)/(d-h))*(i=(_+c)/2)-(s=-(v-c)/(b-d))*(f=(c+v)/2)+(g=(d+b)/2)-(u=(h+d)/2))/(l-s),p<m?l*(n-i)+u:s*(n-f)+g);var x=c-n,y=d-o;return{i:e,j:t,k:a,x:n,y:o,r:x*x+y*y}}function b(r){for(var e=r.length;0<e;)for(var t=r[--e],a=r[--e],n=e;0<n;){var o=r[--n],l=r[--n];if(a==l&&t==o||a==o&&t==l){r.splice(e,2),r.splice(n,2),e-=2;break}}}function p(r){for(var t=function(r){for(var e=[r[0][0],r[0][0]],t=[r[0][1],r[0][1]],a=1;a<r.length;a++)e[0]=Math.min(e[0],r[a][0]),e[1]=Math.max(e[1],r[a][0]),t[0]=Math.min(t[0],r[a][1]),t[1]=Math.max(t[1],r[a][1]);var n=e[1]-e[0],o=t[1]-t[0],l=Math.max(n,o);l<=0&&(l=1);var s=1024/l,i=[];for(a=0;a<r.length;a++)i.push([s*(r[a][0]-e[0]),s*(r[a][1]-t[0])]);return i}(r),e=t.length,a=new Array(e),n=0;n<e;n++)a[n]=n;a.sort(function(r,e){return t[e][0]-t[r][0]}),t.push([-19968,-512]),t.push([512,20992]),t.push([20992,-512]);var o=[v(t,e,e+1,e+2)],l=[];for(n=0;n<e;n++){for(var s=[],i=a[n],f=o.length-1;0<=f;f--){var u=t[i][0]-o[f].x;if(0<u&&u*u>o[f].r)l.push(o[f]),o.splice(f,1);else{var g=t[i][1]-o[f].y;u*u+g*g-o[f].r>C||(s.push(o[f].i,o[f].j,o[f].j,o[f].k,o[f].k,o[f].i),o.splice(f,1))}}b(s);for(f=0;f<s.length;f+=2){var _=s[f],h=s[f+1],c=v(t,h,_,i);if("string"==typeof c)return c;o.push(c)}}for(n=0;n<o.length;n++)l.push(o[n]);var d=[];for(n=0;n<l.length;n++)l[n].i<e&&l[n].j<e&&l[n].k<e&&d.push([l[n].i,l[n].j,l[n].k]);return d}this.random_points=function(r){if(arguments.length<1)return GlobalClasses.error_code("ComputationalGeometry","random_points",0);if(1!=GlobalClasses.is_number(r))return GlobalClasses.error_code("ComputationalGeometry","random_points",1);for(var e=Math.max(3,Math.round(r)),t=[],a=0,n=0;a<e;){var o=4.2*Math.sqrt(n+.5),l=[.1*o*Math.cos(o),.1*o*Math.sin(o)];Math.random()<.2&&(t.push([l[0],l[1]]),a++),n++}return function(r){var e=r[r.length-1],t=Math.sqrt(e[0]*e[0]+e[1]*e[1]);t*=1+Math.max(.1,1/t);for(var a=[],n=0;n<r.length;n++)a.push([100*(r[n][0]+t)/(2*t),100*(r[n][1]+t)/(2*t)]);return a}(t)},this.is_distinct=function(r){if(arguments.length<1)return GlobalClasses.error_code("ComputationalGeometry","is_distinct",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("ComputationalGeometry","is_distinct",1);if(2!=r[0].length)return GlobalClasses.error_code("ComputationalGeometry","is_distinct",1);var e=C;return 1<arguments.length&&1==GlobalClasses.is_number(arguments[1])&&(e=Math.max(1e-12,arguments[1])),m(r,e)},this.make_distinct=function(r){if(arguments.length<1)return GlobalClasses.error_code("ComputationalGeometry","make_distinct",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("ComputationalGeometry","make_distinct",1);if(2!=r[0].length)return GlobalClasses.error_code("ComputationalGeometry","make_distinct",1);var e=C;return 1<arguments.length&&1==GlobalClasses.is_number(arguments[1])&&(e=Math.max(1e-12,arguments[1])),function(r,e){for(var t=r.length,a=[],n=0;n<t;n++)a.push([r[n][0],r[n][1]]);a.sort(function(r,e){return r[0]!=e[0]?r[0]-e[0]:r[1]-e[1]});for(var o=t-1;0<o;o--)for(var l=o-1;0<=l&&Math.abs(a[o][0]-a[l][0])<e;)Math.abs(a[o][1]-a[l][1])<e&&(a.splice(l,1),l=0),l--;return a}(r,e)},this.convex_hull=function(r){return arguments.length<1?GlobalClasses.error_code("ComputationalGeometry","convex_hull",0):1!=GlobalClasses.is_matrix(r)?GlobalClasses.error_code("ComputationalGeometry","convex_hull",1):2!=r[0].length?GlobalClasses.error_code("ComputationalGeometry","convex_hull",1):r.length<3?GlobalClasses.error_code("ComputationalGeometry","convex_hull","At least three data points required."):function(r){for(var e=r.length,t=[],a=0;a<e;a++)t.push([r[a][0],r[a][1],a]);t.sort(function(r,e){return r[0]!=e[0]?r[0]-e[0]:r[1]-e[1]});for(var n,o,l,s,i,f=[],u=0;u<2*e;u++){for(var g=u<e?u:2*e-1-u;2<=f.length&&(n=f[f.length-2],o=f[f.length-1],l=t[g],s=(n[0]-o[0])*(l[1]-o[1])-(n[1]-o[1])*(l[0]-o[0]),i=(n[0]-o[0])*(l[0]-o[0])+(n[1]-o[1])*(l[1]-o[1]),s<0||0==s&&i<=0);)f.pop();f.push(t[g])}var _=[];for(a=0;a<f.length;a++)_.push(f[a][2]);return _}(r)},this.delaunay=function(r){if(arguments.length<1)return GlobalClasses.error_code("ComputationalGeometry","delaunay",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("ComputationalGeometry","delaunay",1);if(2!=r[0].length)return GlobalClasses.error_code("ComputationalGeometry","delaunay",1);if(r.length<3)return GlobalClasses.error_code("ComputationalGeometry","delaunay","At least three data points required.");if(1!=m(r,C))return GlobalClasses.error_code("ComputationalGeometry","delaunay","Set of data points is not distinct.");var e=p(r);return"string"==typeof e?GlobalClasses.error_code("ComputationalGeometry","delaunay",e):e},this.voronoi=function(t){if(arguments.length<1)return GlobalClasses.error_code("ComputationalGeometry","voronoi",0);if(1!=GlobalClasses.is_matrix(t))return GlobalClasses.error_code("ComputationalGeometry","voronoi",1);if(2!=t[0].length)return GlobalClasses.error_code("ComputationalGeometry","voronoi",1);if(t.length<3)return GlobalClasses.error_code("ComputationalGeometry","voronoi","At least three data points required.");if(1!=m(t,C))return GlobalClasses.error_code("ComputationalGeometry","voronoi","Set of data points is not distinct.");var r=p(t);if("string"==typeof r)return GlobalClasses.error_code("ComputationalGeometry","voronoi",r);for(var e,a,n,o,l,s,i,f=[],u=0;u<r.length;u++){var g=(e=t[r[u][0]],a=t[r[u][1]],n=t[r[u][2]],void 0,o=e[0]*e[0]+e[1]*e[1],l=a[0]*a[0]+a[1]*a[1],s=n[0]*n[0]+n[1]*n[1],0==(i=2*(e[0]*(a[1]-n[1])+a[0]*(n[1]-e[1])+n[0]*(e[1]-a[1])))?"Unexpected failure.":[(o*(a[1]-n[1])+l*(n[1]-e[1])+s*(e[1]-a[1]))/i,(o*(n[0]-a[0])+l*(e[0]-n[0])+s*(a[0]-e[0]))/i]);if("string"==typeof g)return GlobalClasses.error_code("ComputationalGeometry","voronoi",g);f.push(g)}var _=[];for(u=0;u<r.length;u++){var h=[r[u][0],r[u][1],r[u][2]];h.sort(function(r,e){return r-e}),_.push([h[0],h[1],u]),_.push([h[1],h[2],u]),_.push([h[0],h[2],u])}_.sort(function(r,e){return r[0]!=e[0]?r[0]-e[0]:r[1]-e[1]});for(var c=[],d=0;d<_.length-1;d++)_[d][0]==_[d+1][0]&&_[d][1]==_[d+1][1]&&(c.push([_[d][2],_[d+1][2]]),d++);for(var v=[],b=0;b<t.length;b++)v.push([]);for(u=0;u<r.length;u++)v[r[u][0]].push(u),v[r[u][1]].push(u),v[r[u][2]].push(u);for(b=0;b<v.length;b++)v[b].sort(function(r,e){return Math.atan2(f[r][0]-t[b][0],f[r][1]-t[b][1])-Math.atan2(f[e][0]-t[b][0],f[e][1]-t[b][1])});return[f,c,v]}},ComputationalGeometry=new ComputationalGeometry_taramathObject,CurveFitting_taramathObject=function(){function C(r,e,t){var a=0,n=1;try{a=r(e,t),1!=isFinite(a)&&(n=a=0)}catch(r){n=a=0}return{value:a,state:n}}function g(r,e,t){for(var a=!0,n=0;n<r.length;n++){1!=C(e,r[n][0],t).state&&(a=!1)}return a}function G(r,e,t){for(var a=[],n=0;n<t.length;n++)a.push(t[n]);var o=[];for(n=0;n<t.length;n++){a[n]=t[n]-1e-6;var l=C(r,e,a).value;a[n]=t[n]+1e-6;var s=C(r,e,a).value;a[n]=t[n],o.push((s-l)/2e-6)}return o}function _(r,e,t,a){for(var n=r.length,o=a.length,l=[],s=0;s<o;s++)l.push(a[s]);for(var i=.0078125,f=t(l),u=1,g=1,_=0,h=new Array(o),c=0;c<o;c++)h[c]=new Array(o);for(;_<1e3&&(1e-6<u||1e-6<g);){var d=[];for(s=0;s<n;s++)d.push(G(e,r[s][0],l));for(c=0;c<o;c++)for(var v=c;v<o;v++){var b=0;for(s=0;s<n;s++)b+=d[s][c]*d[s][v];h[c][v]=b,c!=v&&(h[v][c]=b)}for(c=0;c<o;c++)h[c][c]+=i*h[c][c];var m=[];for(s=0;s<n;s++)m.push(r[s][1]-C(e,r[s][0],l).value);var p=[];for(c=0;c<o;c++){for(b=0,s=0;s<n;s++)b+=m[s]*d[s][c];p.push(b)}var x=LinearAlgebra.solve(h,p);if("string"==typeof x)return"fail";for(s=0;s<o;s++)l[s]+=x[s];for(s=u=0;s<o;s++)u=Math.max(u,Math.abs(x[s]));var y=t(l);y<=f?i/=2:i*=2,1e6<i&&(i=1e6),i<1e-8&&(i=1e-8),g=Math.abs(f-y),f=y,_++}return[l,f]}this.linear=function(r){if(arguments.length<1)return GlobalClasses.error_code("CurveFitting","linear",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("CurveFitting","linear",1);if(r.length<2)return GlobalClasses.error_code("CurveFitting","linear","More data points required.");if(2!=r[0].length)return GlobalClasses.error_code("CurveFitting","linear",1);for(var e=r.length,t=0,a=0,n=0;n<e;n++)t+=r[n][0];for(n=0;n<e;n++)a+=r[n][1];t/=e,a/=e;var o=0,l=0;for(n=0;n<e;n++){var s=r[n][0]-t;o+=s*(r[n][1]-a),l+=s*s}if(l<=0)return GlobalClasses.error_code("CurveFitting","linear","All data points lie on a vertical line.");var i=o/l;return[a-i*t,i]},this.polynomial=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("CurveFitting","polynomial",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("CurveFitting","polynomial",1);if(r.length<2)return GlobalClasses.error_code("CurveFitting","polynomial","More data points required.");if(2!=r[0].length)return GlobalClasses.error_code("CurveFitting","polynomial",1);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("CurveFitting","polynomial",1);for(var t=r.length,a=Math.max(1,Math.round(e)),n=Math.min(t-1,a),o=new Array(t),l=0;l<t;l++){o[l]=[];for(var s=1,i=0;i<n;i++)o[l].push(s),s*=r[l][0];o[l].push(s)}var f=LinearAlgebra.qr(o);if("string"==typeof f)return GlobalClasses.error_code("CurveFitting","polynomial","Unexpected failure.");var u=f[0],g=f[1],_=[];for(i=0;i<=n;i++){for(s=0,l=0;l<t;l++)s+=u[l][i]*r[l][1];_.push(s)}for(s=1,i=0;i<=n;i++)s=Math.min(s,Math.abs(g[i][i]));if(s<1e-10)return GlobalClasses.error_code("CurveFitting","polynomial","At least "+(n+1)+" data points should be distinct in their x-values.");var h=LinearAlgebra.solve_upper_triangular(g.splice(0,n+1),_);if("string"==typeof h)return GlobalClasses.error_code("CurveFitting","polynomial","Unexpected failure.");for(i=n;i<a;i++)h.push(0);return h},this.line=function(l){if(arguments.length<1)return GlobalClasses.error_code("CurveFitting","line",0);if(1!=GlobalClasses.is_matrix(l))return GlobalClasses.error_code("CurveFitting","line",1);if(l.length<2)return GlobalClasses.error_code("CurveFitting","line","More data points required.");if(2!=l[0].length)return GlobalClasses.error_code("CurveFitting","line",1);var s=l.length;var r=this.linear(l);if("string"==typeof r)return GlobalClasses.error_code("CurveFitting","line","All data points lie on a vertical line.");var e=NonlinearProgramming.minimize(function(r){for(var e=0,t=0;t<s;t++){var a=(l[t][0]+r[1]*l[t][1]-r[0]*r[1])/(1+r[1]*r[1]),n=a-l[t][0],o=r[0]+a*r[1]-l[t][1];e+=n*n+o*o}return e},r);return"string"==typeof e?GlobalClasses.error_code("CurveFitting","line","Unexpected failure."):e[0]},this.least_squares=function(n,o,r){if(arguments.length<3)return GlobalClasses.error_code("CurveFitting","least_squares",0);if(1!=GlobalClasses.is_matrix(n))return GlobalClasses.error_code("CurveFitting","least_squares",1);if(n.length<2)return GlobalClasses.error_code("CurveFitting","least_squares","More data points required.");if(2!=n[0].length)return GlobalClasses.error_code("CurveFitting","least_squares",1);if(1!=GlobalClasses.is_function(o))return GlobalClasses.error_code("CurveFitting","least_squares",1);if(1!=GlobalClasses.is_vector(r))return GlobalClasses.error_code("CurveFitting","least_squares",1);if(1!=g(n,o,r))return GlobalClasses.error_code("CurveFitting","least_squares","Input data not consistent.");function e(r){for(var e=0,t=0;t<n.length;t++){var a=C(o,n[t][0],r).value-n[t][1];e+=a*a}return e}var t,a="default";if(3<arguments.length&&1==GlobalClasses.is_string(arguments[3])&&(a=arguments[3].replace(/\-/g,"").replace(/\_/g,"").toLowerCase()),"nelder"==a.substring(0,6))return"string"==typeof(t=NonlinearProgramming.minimize(e,r))?GlobalClasses.error_code("CurveFitting","least_squares","Unexpected failure."):t[0];if("levenberg"==a.substring(0,9))return"string"==typeof(t=_(n,o,e,r))?GlobalClasses.error_code("CurveFitting","least_squares","Unexpected failure."):t[0];var l=NonlinearProgramming.minimize(e,r),s=_(n,o,e,r);if("string"!=typeof l){var i=_(n,o,e,l[0]),f=1,u=l[1];if("string"!=typeof s&&s[1]<u&&(f=2,u=s[1]),"string"!=typeof i&&i[1]<u&&(f=3,u=i[1]),1==f)return l[0];if(2==f)return s[0];if(3==f)return i[0]}return"string"!=typeof s?s[0]:GlobalClasses.error_code("CurveFitting","least_squares","Unexpected failure.")},this.ordered_least_squares=function(o,l,r,e){if(arguments.length<4)return GlobalClasses.error_code("CurveFitting","ordered_least_squares",0);if(1!=GlobalClasses.is_matrix(o))return GlobalClasses.error_code("CurveFitting","ordered_least_squares",1);if(o.length<2)return GlobalClasses.error_code("CurveFitting","ordered_least_squares","More data points required.");if(2!=o[0].length)return GlobalClasses.error_code("CurveFitting","ordered_least_squares",1);if(1!=GlobalClasses.is_function(l))return GlobalClasses.error_code("CurveFitting","ordered_least_squares",1);if(1!=GlobalClasses.is_vector(r))return GlobalClasses.error_code("CurveFitting","ordered_least_squares",1);if(1!=g(o,l,r))return GlobalClasses.error_code("CurveFitting","ordered_least_squares","Input data not consistent.");if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("CurveFitting","ordered_least_squares",1);var s=Math.max(2,Math.min(Math.round(e),o.length));var t=NonlinearProgramming.minimize(function(r){for(var e=[],t=0;t<o.length;t++){var a=C(l,o[t][0],r).value-o[t][1];e.push(a*a)}e.sort(function(r,e){return r-e});var n=0;for(t=0;t<s;t++)n+=e[t];return n},r);return"string"==typeof t?GlobalClasses.error_code("CurveFitting","ordered_least_squares","Unexpected failure."):t[0]}},CurveFitting=new CurveFitting_taramathObject,Digraph_taramathObject=function(){function i(r,e){return Math.sqrt((r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1]))}function _(r){for(var e=r.length,t=0,a=[],n=0;n<e;n++){var o=[Math.round(r[n][0]),Math.round(r[n][1])];a.push([o[0],o[1]]),t=Math.min(t,Math.min(o[0],o[1]))}if(t<0)for(n=0;n<e;n++)a[n][0]-=t,a[n][1]-=t;return a}function m(r){for(var e=0,t=0;t<r.length;t++)e=Math.max(e,Math.max(r[t][0],r[t][1]));return e+1}function h(r){for(var e=r.length,t=0;t<e;t++)if(r[t][0]==r[t][1])return!1;var a=[];for(t=0;t<e;t++)a.push([r[t][0],r[t][1]]);a.sort(function(r,e){return r[0]!=e[0]?r[0]-e[0]:r[1]-e[1]});for(t=1;t<e;t++)if(a[t-1][0]==a[t][0]&&a[t-1][1]==a[t][1])return!1;return!0}function n(r){for(var e=r.length,t=m(r),a=[],n=0;n<t;n++)a.push([]);var o=[];for(n=0;n<t;n++)o.push([]);for(var l=0;l<e;l++)a[r[l][0]].push(r[l][1]),o[r[l][1]].push(r[l][0]);return{A:a,B:o}}function p(r,e,t,a){for(var n=m(r),o=function(r,e){for(var t=r.length,a=m(r),n=[],o=0;o<a;o++)n.push([]);for(var l=0;l<t;l++)n[r[l][0]].push([r[l][1],l]);return n}(r),l=[],s=0;s<n;s++)l.push([0,-1,-1,-1]);var i=e;for(l[i][2]=0;0<=i;){l[i][0]=1;for(s=0;s<o[i].length;s++){var f=o[i][s][0],u=l[i][2]+a[o[i][s][1]];(l[f][2]<0||u<l[f][2])&&(l[f][1]=i,l[f][2]=u,l[f][3]=o[i][s][1])}var g=i=-1;for(s=0;s<n;s++)0==l[s][0]&&0<=l[s][2]&&(g<0||l[s][2]<g)&&(g=l[i=s][2]);0<=t&&1==l[t][0]&&(i=-1)}return l}function f(r,e){if(r.length<2)return 0;if(1!=GlobalClasses.is_matrix(r[0]))return 1;if(2!=r[0][0].length)return 1;var t=_(r[0]),a=m(t);if(1!=GlobalClasses.is_number(r[1]))return 1;var n=Math.round(r[1]);if(n<0||a<=n)return"Source node is not a vertex of the graph.";var o=-1;if(1==e){if(r.length<3)return 0;if(1==GlobalClasses.is_number(r[2])&&(o=Math.round(r[2])),o<0||a<=o)return"Target node is not a vertex of the graph."}for(var l=[],s=0;s<t.length;s++)l.push(1);var i=r.length-1;1==GlobalClasses.is_vector(r[i])&&r[i].length==t.length&&(l=r[i]);for(s=0;s<l.length;s++)if(l[s]<0)return"Non-negativ weights expected.";return[t,n,o,l]}function c(r,e){for(var t=[r[0][0],r[0][0]],a=[r[0][1],r[0][1]],n=1;n<r.length;n++)t[0]=Math.min(t[0],r[n][0]),t[1]=Math.max(t[1],r[n][0]),a[0]=Math.min(a[0],r[n][1]),a[1]=Math.max(a[1],r[n][1]);var o=t[1]-t[0],l=a[1]-a[0],s=Math.max(o,l);s<=0&&(s=1);var i=o<s?(s-o)/2:0,f=l<s?(s-l)/2:0,u=[];for(n=0;n<r.length;n++)u.push([e*((r[n][0]-t[0]+i)/s*.8+.1),e*((r[n][1]-a[0]+f)/s*.8+.1)]);return u}function d(r,e,t){for(var a=0;a<r.length;a++){var n=(o=e[r[a][0]],l=e[r[a][1]],[(o[0]+l[0])/2,(o[1]+l[1])/2]);Svg.rect(n[0]-16,n[1]-8,32,16,"#222222"),Svg.text(n[0],n[1],t[a].toFixed(1),"#ffffff")}var o,l}function v(r,e,t){var a=i(r,e);if(a<=2*t+4)return"fail";var n=[(e[0]-r[0])/a,(e[1]-r[1])/a],o=[r[0]+t*n[0],r[1]+t*n[1]],l=[e[0]-(t+4)*n[0],e[1]-(t+4)*n[1]];return[o[0],o[1],l[0],l[1]]}this.is_simple=function(r){return arguments.length<1?GlobalClasses.error_code("Digraph","is_simple",0):1!=GlobalClasses.is_matrix(r)?GlobalClasses.error_code("Digraph","is_simple",1):2!=r[0].length?GlobalClasses.error_code("Digraph","is_simple",1):h(_(r))},this.is_connected=function(r){return arguments.length<1?GlobalClasses.error_code("Digraph","is_connected",0):1!=GlobalClasses.is_matrix(r)?GlobalClasses.error_code("Digraph","is_connected",1):2!=r[0].length?GlobalClasses.error_code("Digraph","is_connected",1):1==function(r){for(var e=r.length,t=m(r),a=new Array(t),n=0;n<t;n++)a[n]=n;for(var o=t,l=0;l<e;l++){var s=[a[r[l][0]],a[r[l][1]]];if(s[0]!=s[1]){for(n=0;n<t;n++)a[n]==s[1]&&(a[n]=s[0]);o--}}return o}(_(r))},this.adjacency_matrix=function(r){if(arguments.length<1)return GlobalClasses.error_code("Digraph","adjacency_matrix",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("Digraph","adjacency_matrix",1);if(2!=r[0].length)return GlobalClasses.error_code("Digraph","adjacency_matrix",1);for(var e=_(r),t=m(e),a=LinearAlgebra.zero_matrix(t),n=0;n<e.length;n++)a[e[n][0]][e[n][1]]++;return a},this.incidence_matrix=function(r){if(arguments.length<1)return GlobalClasses.error_code("Digraph","incidence_matrix",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("Digraph","incidence_matrix",1);if(2!=r[0].length)return GlobalClasses.error_code("Digraph","incidence_matrix",1);for(var e=_(r),t=e.length,a=m(e),n=LinearAlgebra.zero_matrix(a,t),o=0;o<e.length;o++)n[e[o][0]][o]++,n[e[o][1]][o]--;return n},this.degree=function(r){if(arguments.length<1)return GlobalClasses.error_code("Digraph","degree",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("Digraph","degree",1);if(2!=r[0].length)return GlobalClasses.error_code("Digraph","degree",1);for(var e=n(_(r)),t=0,a=0;a<e.A.length;a++)t=Math.max(t,e.A[a].length+e.B[a].length);return t},this.degree_in=function(r){if(arguments.length<1)return GlobalClasses.error_code("Digraph","degree_in",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("Digraph","degree_in",1);if(2!=r[0].length)return GlobalClasses.error_code("Digraph","degree_in",1);for(var e=n(_(r)),t=0,a=0;a<e.B.length;a++)t=Math.max(t,e.B[a].length);return t},this.degree_out=function(r){if(arguments.length<1)return GlobalClasses.error_code("Digraph","degree_out",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("Digraph","degree_out",1);if(2!=r[0].length)return GlobalClasses.error_code("Digraph","degree_out",1);for(var e=n(_(r)),t=0,a=0;a<e.A.length;a++)t=Math.max(t,e.A[a].length);return t},this.random=function(r){if(arguments.length<1)return GlobalClasses.error_code("Digraph","random",0);if(1!=GlobalClasses.is_number(r))return GlobalClasses.error_code("Digraph","random",1);for(var e=Math.max(3,Math.round(r)),t=ComputationalGeometry.random_points(e),a=ComputationalGeometry.delaunay(t),n=[],o=0;o<a.length;o++){var l=[a[o][0],a[o][1],a[o][2]];l.sort(function(r,e){return r-e}),n.push([l[0],l[1]]),n.push([l[0],l[2]]),n.push([l[1],l[2]])}n.sort(function(r,e){return r[0]!=e[0]?r[0]-e[0]:r[1]-e[1]});for(o=n.length-1;0<o;o--)n[o-1][0]==n[o][0]&&n[o-1][1]==n[o][1]&&n.splice(o,1);var s=[];for(o=0;o<n.length;o++)s.push(i(t[n[o][0]],t[n[o][1]]));return{E:n,L:t,w:s}},this.complete=function(r){if(arguments.length<1)return GlobalClasses.error_code("Digraph","complete",0);if(1!=GlobalClasses.is_number(r))return GlobalClasses.error_code("Digraph","complete",1);for(var e=Math.max(3,Math.round(r)),t=[],a=0;a<e;a++)t.push([50+40*Math.cos(2*Math.PI*a/e),50+40*Math.sin(2*Math.PI*a/e)]);for(var n=[],o=0;o<e-1;o++)for(var l=o+1;l<e;l++)n.push([o,l]),n.push([l,o]);var s=[];for(a=0;a<n.length;a++)s.push(1);return{E:n,L:t,w:s}},this.shortest_path=function(){var r=f(arguments,1);if("number"==typeof r||"string"==typeof r)return GlobalClasses.error_code("Digraph","shortest_path",r);var e=r[0],t=r[1],a=r[2],n=r[3];if(t==a)return{p:[t],s:[]};var o=p(e,t,a,n);if(-1==o[a][1])return GlobalClasses.error_code("Digraph","shortest_path","Path does not exist.");for(var l=a,s=[l],i=[];-1<o[l][1];)i.push(o[l][3]),l=o[l][1],s.push(l);return{p:s.reverse(),s:i.reverse()}},this.distance=function(){var r=f(arguments,1);if("number"==typeof r||"string"==typeof r)return GlobalClasses.error_code("Digraph","distance",r);var e=r[0],t=r[1],a=r[2],n=r[3];if(t==a)return 0;var o=p(e,t,a,n);return-1==o[a][1]?GlobalClasses.error_code("Digraph","distance","Path does not exist."):o[a][2]},this.max_flow=function(){var r=f(arguments,1);if("number"==typeof r||"string"==typeof r)return GlobalClasses.error_code("Digraph","max_flow",r);var e=r[0],t=r[1],a=r[2],n=r[3];if(t==a)return GlobalClasses.error_code("Digraph","max_flow","Source node equals target node.");var o=function(r,e,t,a){for(var n=r.length,o=m(r),l=[],s=[],i=0;i<n;i++)l.push([r[i][0],r[i][1]]),s.push(a[i]);for(i=0;i<n;i++)l.push([r[i][1],r[i][0]]),s.push(0);var f=0;do{var u=[];for(i=0;i<s.length;i++)s[i]<1e-8&&(u.push([i,l[i][1]]),s[i]=0);for(var g=0;g<u.length;g++)l[u[g][0]][1]=o;var _=p(l,e,t,s);for(g=0;g<u.length;g++)l[u[g][0]][1]=u[g][1];for(var h=-1,c=t,d=[];-1<_[c][1];)d.push(_[c][3]),h=h<0?s[_[c][3]]:Math.min(h,s[_[c][3]]),c=_[c][1];if((0==d.length||h<1e-8)&&(f=1),0==f)for(i=0;i<d.length;i++)s[d[i]]-=h,s[(d[i]+n)%(2*n)]+=h}while(0==f);var v=[],b=[];for(i=0;i<n;i++)1e-8<=a[i]-s[i]&&(v.push([r[i][0],r[i][1]]),b.push(a[i]-s[i]));return{E:v,w:b}}(e,t,a,n);return o.E.length<1?GlobalClasses.error_code("Digraph","max_flow","There does not exist any flow."):o},this.plot=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("Digraph","plot",0);if(1!=GlobalClasses.is_div(r))return GlobalClasses.error_code("Digraph","plot",11);if(1!=GlobalClasses.is_matrix(e))return GlobalClasses.error_code("Digraph","plot",1);if(2!=e[0].length)return GlobalClasses.error_code("Digraph","plot",1);var t=_(e);1!=h(t)&&GlobalClasses.warning_code("Digraph","plot","Graph is not simple.");for(var a=m(t),n=t.length,o=[],l=0;l<a;l++)o.push([Math.cos(2*Math.PI*l/a),Math.sin(2*Math.PI*l/a)]);for(var s=[],i=-1,f="small",u=2;u<arguments.length;u++){var g=arguments[u];1==GlobalClasses.is_matrix(g)&&g.length>=a&&2==g[0].length&&(o=g),1==GlobalClasses.is_vector(g)&&g.length==n&&(s=g),1==GlobalClasses.is_number(g)&&20<=g&&(i=Math.round(g)),1==GlobalClasses.is_string(g)&&(f=g)}switch(f){case"tiny":!function(r,e,t,a,n){var o=0<n?n:200,l=c(t,o);Svg.init(r,o,o),Svg.resize(0,o,0,o),Svg.clear("#f8f8f8");for(var s=0;s<e.length;s++){var i=v(l[e[s][0]],l[e[s][1]],0);"string"!=typeof i&&Svg.arrow(i[0],i[1],i[2],i[3],"#222222")}a.length==e.length&&d(e,l,a);for(var f=0;f<l.length;f++)Svg.disc(l[f][0],l[f][1],4,"#222222");Svg.draw()}(r,t,o,s,i);break;case"medium":!function(r,e,t,a,n){var o=0<n?n:640,l=c(t,o);Svg.init(r,o,o),Svg.resize(0,o,0,o),Svg.clear("#f8f8f8");for(var s=0;s<e.length;s++){var i=v(l[e[s][0]],l[e[s][1]],10.5);"string"!=typeof i&&Svg.arrow(i[0],i[1],i[2],i[3],"#222222")}a.length==e.length&&d(e,l,a);for(var f=0;f<l.length;f++)Svg.disc(l[f][0],l[f][1],7,"#e8e8e8","#222222");Svg.draw()}(r,t,o,s,i);break;case"large":!function(r,e,t,a,n){var o=0<n?n:800,l=c(t,o);Svg.init(r,o,o),Svg.resize(0,o,0,o),Svg.clear("#f8f8f8");for(var s=0;s<e.length;s++){var i=v(l[e[s][0]],l[e[s][1]],14);"string"!=typeof i&&Svg.arrow(i[0],i[1],i[2],i[3],"#222222")}a.length==e.length&&d(e,l,a);for(var f=0;f<l.length;f++)Svg.disc(l[f][0],l[f][1],10,"#e8e8e8","#222222"),Svg.text(l[f][0],l[f][1]-1,f.toFixed(0));Svg.draw()}(r,t,o,s,i);break;case"huge":!function(r,e,t,a,n){var o=0<n?n:1200,l=c(t,o);Svg.init(r,o,o),Svg.resize(0,o,0,o),Svg.clear("#f8f8f8");for(var s=0;s<e.length;s++){var i=v(l[e[s][0]],l[e[s][1]],17);"string"!=typeof i&&Svg.arrow(i[0],i[1],i[2],i[3],"#222222")}a.length==e.length&&d(e,l,a);for(var f=0;f<l.length;f++)Svg.disc(l[f][0],l[f][1],12.5,"#e6e6e6","#222222"),Svg.text(l[f][0],l[f][1]-1,f.toFixed(0));Svg.draw()}(r,t,o,s,i);break;default:!function(r,e,t,a,n){var o=0<n?n:320,l=c(t,o);Svg.init(r,o,o),Svg.resize(0,o,0,o),Svg.clear("#f8f8f8");for(var s=0;s<e.length;s++){var i=v(l[e[s][0]],l[e[s][1]],7);"string"!=typeof i&&Svg.arrow(i[0],i[1],i[2],i[3],"#222222")}a.length==e.length&&d(e,l,a);for(var f=0;f<l.length;f++)Svg.disc(l[f][0],l[f][1],4.5,"#222222");Svg.draw()}(r,t,o,s,i)}return!0}},Digraph=new Digraph_taramathObject,ExampleData_taramathObject=function(){function a(r){return"number"==typeof r&&isFinite(r)}function t(r){if("object"!=typeof r)return!1;var e=r.length;if("number"!=typeof e||e<1)return!1;for(var t=0;t<e;t++)if(1!=a(r[t]))return!1;return!0}var n=function(){var r=arguments,e=[0,0];return 1==r.length&&t(r[0])&&2==r[0].length&&(e=r[0]),2==r.length&&a(r[0])&&a(r[1])&&(e=[r[0],r[1]]),Math.pow(e[0]*e[0]+e[1]-11,2)+Math.pow(e[0]+e[1]*e[1]-7,2)},o=function(){var r=arguments,e=[0];return 1==r.length&&t(r[0])&&1==r[0].length&&(e=r[0]),1==r.length&&a(r[0])&&(e=[r[0]]),1/((e[0]-.3)*(e[0]-.3)+.01)+1/((e[0]-.9)*(e[0]-.9)+.04)-6},l=function(){var r=arguments,e=[0,0];return 1==r.length&&t(r[0])&&2==r[0].length&&(e=r[0]),2==r.length&&a(r[0])&&a(r[1])&&(e=[r[0],r[1]]),Math.pow(e[0]+2*e[1]-7,2)+Math.pow(2*e[0]+e[1]-5,2)},s=function(){var r=arguments,e=[0,0];return 1==r.length&&t(r[0])&&2==r[0].length&&(e=r[0]),2==r.length&&a(r[0])&&a(r[1])&&(e=[r[0],r[1]]),Math.pow(Math.sin(3*Math.PI*e[0]),2)+Math.pow(e[0]-1,2)*(1+Math.pow(Math.sin(3*Math.PI*e[1]),2))+Math.pow(e[1]-1,2)*(1+Math.pow(Math.sin(2*Math.PI*e[1]),2))},i=function(){var r=arguments,e=[0,0];return 1==r.length&&t(r[0])&&2==r[0].length&&(e=r[0]),2==r.length&&a(r[0])&&a(r[1])&&(e=[r[0],r[1]]),2*e[0]*e[0]-1.05*Math.pow(e[0],4)+Math.pow(e[0],6)/6+e[0]*e[1]+e[1]*e[1]},f=function(){var r=arguments,e=[0,0];return 1==r.length&&t(r[0])&&2==r[0].length&&(e=r[0]),2==r.length&&a(r[0])&&a(r[1])&&(e=[r[0],r[1]]),4*e[0]*e[0]-2.1*Math.pow(e[0],4)+Math.pow(e[0],6)/3+e[0]*e[1]-4*e[1]*e[1]+4*Math.pow(e[1],4)},u=function(){var r=arguments,e=[0,0];return 1==r.length&&t(r[0])&&2==r[0].length&&(e=r[0]),2==r.length&&a(r[0])&&a(r[1])&&(e=[r[0],r[1]]),100*(e[1]-e[0]*e[0])*(e[1]-e[0]*e[0])+(e[0]-1)*(e[0]-1)},g=function(){var r=arguments,e=[0,0];return 1==r.length&&t(r[0])&&2==r[0].length&&(e=r[0]),2==r.length&&a(r[0])&&a(r[1])&&(e=[r[0],r[1]]),e[0]*e[0]+e[1]*e[1]-10*Math.cos(2*Math.PI*e[0])-10*Math.cos(2*Math.PI*e[1])+20},_=function(){var r=arguments,e=[0,0,0];return 1==r.length&&t(r[0])&&3==r[0].length&&(e=r[0]),3==r.length&&a(r[0])&&a(r[1])&&a(r[2])&&(e=[r[0],r[1],r[2]]),100*(e[1]-e[0]*e[0])*(e[1]-e[0]*e[0])+(e[0]-1)*(e[0]-1)+100*(e[2]-e[1]*e[1])*(e[2]-e[1]*e[1])+(e[1]-1)*(e[1]-1)};this.func=function(r){if("string"!=typeof r)return n;var e=r.replace(/\s/g,"").replace(/\-/g,"").replace(/\_/g,"");return"humps"==e?o:"schwefel25"==e?l:"levy13"==e?s:"threehumpcamel"==e?i:"sixhumpcamel"==e?f:"rosenbrock2"==e?u:"rastrigin"==e?g:"rosenbrock3"==e?_:n};var e=[-5,-9,-1,-10,-1],h=[[3,1,3,3,3],[2,3,4,4,4]],c=[19,16],d=[-8,-5,-9,-4,-10],v=[[2,4,4,4,2],[1,4,2,3,4]],b=[20,11],m=[-7,-2],p=[[-1,2],[5,1],[-2,-2]],x=[4,20,-7],y=[-3,-4,-6,-4,-3,-7,-3,-10,-5,-5,-6,-7],C=[[4,3,3,1,1,2,4,1,4,3,1,2],[4,2,3,3,4,1,1,1,1,4,4,1],[1,4,1,1,1,3,4,1,3,1,3,1],[1,1,1,2,2,3,4,4,1,4,2,1],[2,4,3,4,4,4,2,2,4,2,3,2]],G=[63,42,51,39,61],M=[-6,-6,-5,-10,-2,-6,-7,-1,-7,-9,-4,-5,-1,-6,-9,-3,-1,-2,-7,-8,-7,-5,-4,-7,-6,-7,-2,-7,-7,-10,-9,-2],w=[[4,2,1,1,3,1,1,2,1,3,3,1,4,4,2,2,4,2,2,3,2,4,3,3,3,4,1,3,1,4,2,3],[1,3,4,1,2,3,4,1,1,1,2,3,3,2,4,1,2,2,3,2,3,3,3,1,3,3,2,3,3,1,1,3],[1,2,1,1,4,3,3,1,3,1,4,4,1,4,4,3,4,3,4,2,2,1,3,3,1,3,4,3,4,3,4,3],[1,1,3,4,2,4,1,1,4,1,4,3,1,2,3,4,3,3,3,3,3,1,3,2,1,3,1,4,1,1,3,1],[2,2,4,1,1,3,3,3,3,3,4,4,1,2,2,4,1,2,3,4,1,4,4,3,1,1,1,3,3,3,4,2]],A=[92,127,46,88,124],P=[2700,1500,30,2700,1500,30,2700,1500,30,2700,1500,30,2700,1500,30,2700,1500,30],L=[[0,0,1],[1,0,150],[1,1,-100],[1,2,1],[2,0,-20],[2,2,1],[3,0,.9],[3,1,1],[3,3,-1],[4,3,150],[4,4,-100],[4,5,1],[5,3,-20],[5,5,1],[6,3,.9],[6,4,1],[6,6,-1],[7,6,150],[7,7,-100],[7,8,1],[8,6,-20],[8,8,1],[9,6,.9],[9,7,1],[9,9,-1],[10,9,150],[10,10,-100],[10,11,1],[11,9,-20],[11,11,1],[12,9,.9],[12,10,1],[12,12,-1],[13,12,150],[13,13,-100],[13,14,1],[14,12,-20],[14,14,1],[15,12,.9],[15,13,1],[15,15,-1],[16,15,150],[16,16,-100],[16,17,1],[17,15,-20],[17,17,1],[18,1,1],[19,3,1],[20,3,1],[21,4,1],[22,6,1],[23,6,1],[24,7,1],[25,9,1],[26,9,1],[27,10,1],[28,12,1],[29,12,1],[30,13,1],[31,15,1],[32,15,1],[33,16,1]],F=[60,8e3,0,0,9e3,0,0,8e3,0,0,1e4,0,0,9e3,0,0,12e3,0,18,57,75,18,57,75,18,57,75,18,57,75,18,57,75,18],k=[0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,-1];function T(r,e,t,a,n){var o=r.length,l=a.length,s=n;if("number"==typeof n){s=new Array(l);for(var i=0;i<l;i++)s[i]=n}if(3!=t[0].length||t.length<4)return[r,e,t,a,s];var f=new Array(l);for(i=0;i<l;i++)f[i]=new Array(o);for(i=0;i<l;i++)for(var u=0;u<o;u++)f[i][u]=0;for(var g=0;g<t.length;g++)f[t[g][0]][t[g][1]]=t[g][2];return[r,e,f,a,s]}this.integer_program=function(r){return"string"==typeof r&&"tip25if"==r?T(e,"iiiii",h,c,0):"string"==typeof r&&"tip32"==r?T(m,"ii",p,x,-1):"string"==typeof r&&"tprod12"==r?T(y,"iiiiiiiiiiii",C,G,0):"string"==typeof r&&"tprod32"==r?T(M,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii",w,A,0):"string"==typeof r&&"flugpl"==r?T(P,"iiciiciiciiciiciic",L,F,k):T(d,"iiiii",v,b,0)};var O=[-.75,20,-.5,6,0,0,0],N=[[.25,-8,-1,9,1,0,0],[.5,-12,-.5,3,0,1,0],[0,0,1,0,0,0,1]],q=[0,0,1],S=[3,-5,0,2,1],D=[[5,-2,3,-4,1],[0,1,0,1,0],[-2,5,-3,1,-1]],E=[-6,9,-3],X=[3,-5,0,2,1],H=[[5,-2,3,-4,1],[0,1,0,-1,0],[-2,5,-3,1,-1]],I=[0,9,-3],Q=[3,-5,0,2,1],Z=[[-2,0,3,-4,1],[0,1,-4,1,1],[-4,1,0,0,-1]],B=[0,0,-1],R=[0,0,0,0,0,0,0,-1],j=[1,1,1,1,1,1,1,0],Y=[[2,6,4,1,-1,-8,-7,-1],[-4,1,0,0,3,8,4,-1],[1,3,6,-2,7,-9,3,-1],[2,4,-3,2,-3,-7,-3,-1],[2,-2,6,2,-7,-6,3,-1],[-7,-9,2,-8,-8,-6,7,-1],[7,8,4,9,-9,-2,0,-1],[1,1,1,1,1,1,1,0]],W=[0,0,0,0,0,0,0,1],U=[1,1,1,1,1,1,1,0],J=[0,-.4,0,0,0,0,0,0,0,0,0,0,-.32,0,0,0,-.6,0,0,0,0,0,0,0,0,0,0,0,-.48,0,0,10],K=[[0,0,-1],[0,1,1],[0,2,1],[1,0,-1.06],[1,3,1],[2,0,1],[3,1,-1],[3,12,1.4],[4,4,-1],[4,5,-1],[4,6,-1],[4,7,-1],[4,12,1],[4,13,1],[5,4,-1.06],[5,5,-1.06],[5,6,-.96],[5,7,-.86],[5,14,1],[6,4,1],[6,8,-1],[7,5,1],[7,9,-1],[8,6,1],[8,10,-1],[9,7,1],[9,11,-1],[10,15,-1],[10,16,1],[10,17,1],[10,18,1],[11,15,-.43],[11,19,1],[12,15,1],[13,16,-1],[13,28,1.4],[14,20,-.43],[14,21,-.43],[14,22,-.39],[14,23,-.37],[14,30,1],[15,20,1],[15,21,1],[15,22,1],[15,23,1],[15,28,-1],[15,29,1],[15,31,1],[16,20,1],[16,24,-1],[17,21,1],[17,25,-1],[18,22,1],[18,26,-1],[19,23,1],[19,27,-1],[20,8,2.364],[20,9,2.386],[20,10,2.408],[20,11,2.429],[20,18,-1],[20,24,2.191],[20,25,2.219],[20,26,2.249],[20,27,2.279],[21,2,-1],[21,15,.109],[22,13,-1],[22,20,.109],[22,21,.108],[22,22,.108],[22,23,.107],[23,0,.301],[23,17,-1],[24,4,.301],[24,5,.313],[24,6,.313],[24,7,.326],[24,29,-1],[25,3,1],[25,19,1],[26,14,1],[26,30,1]],V=[0,0,80,0,0,0,80,0,0,0,0,0,500,0,0,44,500,0,0,0,0,0,0,0,0,310,300],z=[0,0,-1,-1,0,0,-1,-1,-1,-1,0,0,-1,-1,0,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1];function $(r,e,t,a,n){var o=r.length,l=a.length,s=new Array(o);if("number"==typeof e)for(var i=0;i<o;i++)s[i]=e;else s=e;var f=new Array(l);if("number"==typeof n)for(var u=0;u<l;u++)f[u]=n;else f=n;if(3!=t[0].length||t.length<4)return[r,s,t,a,f];var g=new Array(l);for(u=0;u<l;u++)g[u]=new Array(o);for(u=0;u<l;u++)for(i=0;i<o;i++)g[u][i]=0;for(var _=0;_<t.length;_++)g[t[_][0]][t[_][1]]=t[_][2];return[r,s,g,a,f]}this.linear_program=function(r){return"string"==typeof r&&"afiro"==r?$(J,1,K,V,z):"string"==typeof r&&"beale"==r?$(O,1,N,q,0):"string"==typeof r&&"md35if"==r?$(X,1,H,I,0):"string"==typeof r&&"md35ub"==r?$(Q,1,Z,B,0):"string"==typeof r&&"zerosum"==r?$(R,j,Y,W,U):$(S,1,D,E,0)};var rr=["J:tWOqD:P6DZPM5XOqDXNpxUNMiHbclLI4THUraIbdyXcuAZcuEYc9uQa8E7aPyPZOaBZt6HZsm6VNHgS8qQb9AI.dAJ:PQNaPq:E5M9ZteGL:5NMptGR6TOKp1NO7HxWcM9:OmAYcDUL5hPIq1gSN5sXPAL.tA7","M6xhRaldQ6XcQMlgRMtdQM:bO620ggUkS4:UZOYekwVAnx7DmwjAlfuiaPYZktXUJ:PMLplVPaXdSMtsevn0mCrAmSfBnSjBnxMfC:ywhRAZYNhtQp:PM5lXONPy.uEhhfYsifuxjvmeTNTjP7mA.P6MbuimhREd","KMlfR6XcPqTbR6:hQqlfR6hdPaTZTev7lvEXZcAcjwRCoTFMpT7DlQuIbv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r){for(var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.:abcdefghijklmnopqrstuvwxyz",t=0,a=0;a<64;a++)r[0]==e[a]&&(t+=262144*a);for(a=0;a<64;a++)r[1]==e[a]&&(t+=4096*a);for(a=0;a<64;a++)r[2]==e[a]&&(t+=64*a);for(a=0;a<64;a++)r[3]==e[a]&&(t+=a);return[(t>>16)%256,(t>>8)%256,t%256]}function ar(r){for(var e=new Array(r.length),t=3*Math.floor(r[0].length/4),a=0;a<e.length;a++)e[a]=new Array(t);for(a=0;a<e.length;a++)for(var n=0;n<t-2;n+=3)for(var o=4*Math.floor(n/3),l=tr(r[a].substring(o,o+4)),s=0;s<3;s++)e[a][n+s]=l[s];return e}this.image=function(r){return ar("string"==typeof r&&"lena"==r?er:rr)}},ExampleData=new ExampleData_taramathObject,Fdm_taramathObject=function(){var P=new Array,I=new Array,B=new Array,F=function(r,e){return 0},G=function(r,e){return 0},H=function(r,e){return 0},R=function(r,e){return 0},F_string="0",G_string="0",H_string="0",R_string="0",x=new Array,xmin=0,ymin=0,xmax=0,ymax=0,n=0,m=0,h=0,omega=0,color=new Array,init_ready=!1;this.get_solution=function(){return x},this.get_points=function(){return P},this.init=function(r,e,t,a,o){if(arguments.length<5)return GlobalClasses.error_code("Fdm","init",0);if(1!=GlobalClasses.is_number(r))return GlobalClasses.error_code("Fdm","init",1);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Fdm","init",1);if(1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("Fdm","init",1);if(1!=GlobalClasses.is_number(a))return GlobalClasses.error_code("Fdm","init",1);if(1!=GlobalClasses.is_number(o))return GlobalClasses.error_code("Fdm","init",1);h=Math.max(o,1e-10),n=Math.max(2,Math.floor((e-r)/h+.9999)),m=Math.max(2,Math.floor((a-t)/h+.9999)),xmax=(xmin=r)+n*h,ymax=(ymin=t)+m*h,omega=0,color=GlobalClasses.get_color_table(),P=new Array,I=new Array,B=new Array,F=function(r,e){return 0},G=function(r,e){return 0},H=function(r,e){return 0},R=function(r,e){return 0},R_string=H_string=G_string=F_string="0",x=new Array;for(var l=0;l<=m;l++)for(var s=0;s<=n;s++)P.push(new Array(xmin+s*h,ymin+l*h)),I.push(new Array(l,s)),B.push(0==l||l==m||0==s||s==n?1:0);return init_ready=!0},this.set_boundary=function(r){if(arguments.length<1)return GlobalClasses.error_code("Fdm","set_boundary",0);if(1!=init_ready)return GlobalClasses.error_code("Fdm","set_boundary",13);if("function"==typeof r)for(k=0;k<B.length;k++)if(0!=B[k]){var e=r(P[k][0],P[k][1]);("number"==typeof e&&1==e||"string"==typeof e&&"dirichlet"==e)&&(B[k]=1),("number"==typeof e&&2==e||"string"==typeof e&&"neumann"==e)&&(B[k]=2),("number"==typeof e&&3==e||"string"==typeof e&&"robin"==e)&&(B[k]=3)}return!0},this.set_function_f=function(v){if(arguments.length<1)return GlobalClasses.error_code("Fdm","set_function_f",0);if(1!=init_ready)return GlobalClasses.error_code("Fdm","set_function_f",13);if("function"==typeof v&&(F=v),"number"==typeof v&&(F=function(r,e){return v}),"string"==typeof v){if(F_string=GlobalClasses.check_function_string_xy(v),0==F_string)return GlobalClasses.error_code("Fdm","set_function_f",24);F=function(x,y){var t=0;with(Math)t=eval(F_string);return t}}return!0},this.set_function_g=function(v){if(arguments.length<1)return GlobalClasses.error_code("Fdm","set_function_g",0);if(1!=init_ready)return GlobalClasses.error_code("Fdm","set_function_g",13);if("function"==typeof v&&(G=v),"number"==typeof v&&(G=function(r,e){return v}),"string"==typeof v){if(G_string=GlobalClasses.check_function_string_xy(v),0==G_string)return GlobalClasses.error_code("Fdm","set_function_g",24);G=function(x,y){var t=0;with(Math)t=eval(G_string);return t}}return!0},this.set_function_h=function(v){if(arguments.length<1)return GlobalClasses.error_code("Fdm","set_function_h",0);if(1!=init_ready)return GlobalClasses.error_code("Fdm","set_function_h",13);if("function"==typeof v&&(H=v),"number"==typeof v&&(H=function(r,e){return v}),"string"==typeof v){if(H_string=GlobalClasses.check_function_string_xy(v),0==H_string)return GlobalClasses.error_code("Fdm","set_function_h",24);H=function(x,y){var t=0;with(Math)t=eval(H_string);return t}}return!0},this.set_function_r=function(v){if(arguments.length<1)return GlobalClasses.error_code("Fdm","set_function_r",0);if(1!=init_ready)return GlobalClasses.error_code("Fdm","set_function_r",13);if("function"==typeof v&&(R=v),"number"==typeof v&&(R=function(r,e){return v}),"string"==typeof v){if(R_string=GlobalClasses.check_function_string_xy(v),0==R_string)return GlobalClasses.error_code("Fdm","set_function_r",24);R=function(x,y){var t=0;with(Math)t=eval(R_string);return t}}return!0},this.set_omega=function(r){return arguments.length<1?GlobalClasses.error_code("Fdm","set_omega",0):1!=init_ready?GlobalClasses.error_code("Fdm","set_omega",13):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("Fdm","set_omega",1):(omega=r,!0)};var svg_txt="",svg_xmin=0,svg_xmax=1,svg_ymin=0,svg_ymax=1,svg_width=100,svg_height=100;function calculate_svg_rectangle(){var r=.6*Math.max(xmax-xmin,ymax-ymin);svg_xmin=.5*(xmin+xmax)-r,svg_xmax=.5*(xmin+xmax)+r,svg_ymin=.5*(ymin+ymax)-r,svg_ymax=.5*(ymin+ymax)+r}function svg_scale(r){var e=new Array((r[0]-svg_xmin)/(svg_xmax-svg_xmin),(r[1]-svg_ymin)/(svg_ymax-svg_ymin));return new Array(e[0]*svg_width,svg_height-e[1]*svg_height)}function find_min(r){for(var e=r[0],t=1;t<r.length;t++)r[t]<e&&(e=r[t]);return e}function find_max(r){for(var e=r[0],t=1;t<r.length;t++)r[t]>e&&(e=r[t]);return e}function ByteToHex(r){var e=parseInt(r,10);return isNaN(e)?"00":(e=Math.max(0,Math.min(e,255)),"0123456789ABCDEF".charAt((e-e%16)/16)+"0123456789ABCDEF".charAt(e%16))}function rgbToHex(r){return"#"+ByteToHex(r[0])+ByteToHex(r[1])+ByteToHex(r[2])}function distance_fac(r,e,t,a,n,o){return Math.abs(e-a)>=o||Math.abs(t-n)>=o?0:r%2==0?Math.max(0,1-Math.max(Math.abs(e-a)/o,Math.abs(t-n)/o)):Math.max(0,1-Math.abs(e-a)/o-Math.abs(t-n)/o)}function find_index(r,e,t,a){if(r<xmin||xmax<r||e<ymin||ymax<e)return-1;for(var n=0,o=0;o<P.length;o++)n+=x[o]*distance_fac(I[o][0]+I[o][1],r,e,P[o][0],P[o][1],h);return a<n&&(n=a),n<t&&(n=t),100-Math.floor((a-n)/(a-t)*100)}function C_a(r,e){return r[0]==e[0]&&r[1]==e[1]?-4:1==Math.abs(r[0]-e[0])&&r[1]==e[1]?1:1==Math.abs(r[1]-e[1])&&r[0]==e[0]?1:0}function C_b(r,e){return r[0]==e[0]&&r[1]==e[1]?1:0==r[1]&&1==e[1]&&r[0]==e[0]?-1:r[1]==n&&e[1]==n-1&&r[0]==e[0]?-1:0==r[0]&&1==e[0]&&r[1]==e[1]?-1:r[0]==m&&e[0]==m-1&&r[1]==e[1]?-1:0}function C_c(r,e){return r[0]==e[0]&&r[1]==e[1]?1+h*omega:0==r[1]&&1==e[1]&&r[0]==e[0]?-1:r[1]==n&&e[1]==n-1&&r[0]==e[0]?-1:0==r[0]&&1==e[0]&&r[1]==e[1]?-1:r[0]==m&&e[0]==m-1&&r[1]==e[1]?-1:0}function Sum_a(r){for(var e=0,t=0;t<B.length;t++)1==B[t]&&(e+=C_a(r,I[t])*G(P[t][0],P[t][1]));return e}this.export_svg=function(){return svg_txt},this.plot_grid=function(r,e,t){if(arguments.length<3)return GlobalClasses.error_code("Fdm","plot_grid",0);if(1!=GlobalClasses.is_div(r))return GlobalClasses.error_code("Fdm","plot_grid",11);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Fdm","plot_grid",1);if(1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("Fdm","plot_grid",1);if(1!=init_ready)return GlobalClasses.error_code("Fdm","plot_grid",13);svg_width=Math.floor(Math.max(20,e)),svg_height=Math.floor(Math.max(20,t)),calculate_svg_rectangle(),svg_txt='<?xml version="1.0" encoding="UTF-8" ?><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+svg_width+'" height="'+svg_height+'">',svg_txt+='<rect x="0.000" y="0.000" width="'+svg_width.toFixed(3)+'" height="'+svg_height.toFixed(3)+'" style="fill:#F0F0F0; stroke:none;" />';var a=svg_scale(new Array(xmin,ymax)),n=svg_scale(new Array(xmax,ymin));svg_txt+='<rect x="'+a[0].toFixed(3)+'" y="'+a[1].toFixed(3)+'" width="'+(n[0]-a[0]).toFixed(3)+'" height="'+(n[1]-a[1]).toFixed(3)+'" style="fill:#D0D0D0; stroke:none;" />';for(var o=0;o<P.length;o++){var l=svg_scale(P[o]);svg_txt+='<circle cx="'+l[0].toFixed(3)+'" cy="'+l[1].toFixed(3)+'" r="2.6" style="fill:#000000; stroke:none;" />'}return svg_txt+="</svg>",document.getElementById(r).innerHTML=svg_txt,!0},this.plot_draft=function(r,e,t){if(arguments.length<3)return GlobalClasses.error_code("Fdm","plot_draft",0);if(1!=GlobalClasses.is_div(r))return GlobalClasses.error_code("Fdm","plot_draft",11);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Fdm","plot_draft",1);if(1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("Fdm","plot_draft",1);if(1!=init_ready)return GlobalClasses.error_code("Fdm","plot_draft",13);if(0==x.length)return GlobalClasses.error_code("Fdm","plot_draft",14);svg_width=Math.floor(Math.max(20,e)),svg_height=Math.floor(Math.max(20,t)),calculate_svg_rectangle(),svg_txt='<?xml version="1.0" encoding="UTF-8" ?><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+svg_width+'" height="'+svg_height+'">',svg_txt+='<rect x="0.000" y="0.000" width="'+svg_width.toFixed(3)+'" height="'+svg_height.toFixed(3)+'" style="fill:#000000; stroke:none;" />';var a=find_min(x),o=find_max(x);o-a<1e-12&&(o=a+1);for(var l=new Array(m),s=0;s<m;s++)l[s]=new Array(n);for(s=0;s<m;s++)for(var i=0;i<n;i++)l[s][i]=0;for(var f=0;f<P.length;f++)I[f][0]<m&&I[f][1]<n&&(l[I[f][0]][I[f][1]]+=x[f]),0<I[f][0]&&I[f][1]<n&&(l[I[f][0]-1][I[f][1]]+=x[f]),I[f][0]<m&&0<I[f][1]&&(l[I[f][0]][I[f][1]-1]+=x[f]),0<I[f][0]&&0<I[f][1]&&(l[I[f][0]-1][I[f][1]-1]+=x[f]);for(s=0;s<m;s++)for(i=0;i<n;i++)l[s][i]/=4;var u=svg_scale(new Array(xmax,ymax)),g=svg_scale(new Array(xmin,ymin)),_=Math.abs(g[0]-u[0])/n,h=Math.abs(g[1]-u[1])/m;for(s=0;s<m;s++)for(i=0;i<n;i++){var c=svg_scale(new Array(xmin+i*(xmax-xmin)/n,ymin+s*(ymax-ymin)/m)),d=100-Math.floor((o-l[s][i])/(o-a)*100);d=Math.min(100,Math.max(0,d)),svg_txt+='<rect x="'+c[0].toFixed(3)+'" y="'+(c[1]-h).toFixed(3)+'" width="'+_.toFixed(3)+'" height="'+h.toFixed(3)+'" style="fill:'+rgbToHex(color[d])+"; stroke:"+rgbToHex(color[d])+'; stroke-width:1.0; stroke-linejoin:round;" />'}var v=.25*Math.min(svg_width/n,svg_height/m);for(f=0;f<P.length;f++){c=svg_scale(P[f]),d=100-Math.floor((o-x[f])/(o-a)*100);d=Math.min(100,Math.max(0,d)),svg_txt+='<circle cx="'+c[0].toFixed(3)+'" cy="'+c[1].toFixed(3)+'" r="'+v.toFixed(3)+'" style="fill:'+rgbToHex(color[d])+'; stroke:none;" />'}var b=(svg_height-1)/101;for(f=0;f<=100;f++)svg_txt+='<rect x="'+(svg_width-20).toFixed(3)+'" y="'+((100-f)*b).toFixed(3)+'" width="20.000" height="'+(b+1).toFixed(3)+'" style="fill:'+rgbToHex(color[f])+'; stroke:none;" />';return svg_txt+='<text x="'+(svg_width-26).toFixed(3)+'" y="'+(svg_height-5).toFixed(3)+'" style="font-size:12px; text-anchor:end; fill:#FFFFFF; stroke:none; font-family:sans-serif;">'+a.toFixed(3)+"</text>",svg_txt+='<text x="'+(svg_width-26).toFixed(3)+'" y="14.000" style="font-size:12px; text-anchor:end; fill:#FFFFFF; stroke:none; font-family:sans-serif;">'+o.toFixed(3)+"</text>",svg_txt+="</svg>",document.getElementById(r).innerHTML=svg_txt,!0},this.plot_solution=function(r,e,t){if(arguments.length<3)return GlobalClasses.error_code("Fdm","plot_solution",0);if(1!=GlobalClasses.is_div(r))return GlobalClasses.error_code("Fdm","plot_solution",11);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Fdm","plot_solution",1);if(1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("Fdm","plot_solution",1);if(1!=init_ready)return GlobalClasses.error_code("Fdm","plot_solution",13);if(0==x.length)return GlobalClasses.error_code("Fdm","plot_solution",14);document.getElementById(r).innerHTML="";var a="canvas"+(1e10*Math.random()).toFixed(0),n=document.createElement("canvas");n.setAttribute("id",a),document.getElementById(r).appendChild(n);var o=document.getElementById(a),l=o.getContext("2d");o.width=Math.floor(Math.max(20,e)),o.height=Math.floor(Math.max(20,t)),calculate_svg_rectangle();var s=o.width,i=o.height;l.fillStyle="#000000",l.fillRect(0,0,s,i);var f=find_min(x),u=find_max(x);u-f<1e-12&&(u=f+1);for(var g=l.createImageData(s,i),_=0;_<g.data.length;_+=4){var h=Math.floor(_/4),c=Math.floor(h/s),d=h%s,v=find_index(svg_xmin+d/s*(svg_xmax-svg_xmin),svg_ymax-c/i*(svg_ymax-svg_ymin),f,u);s-20<d&&(v=100-Math.floor(c/i*100)),g.data[_+2]=v<0?(g.data[_+0]=0,g.data[_+1]=0):(v=Math.min(100,v),g.data[_+0]=color[v][0],g.data[_+1]=color[v][1],color[v][2]),g.data[_+3]=255}return l.putImageData(g,0,0),l.font="12px sans-serif",l.textBaseline="middle",l.textAlign="right",l.fillStyle="#FFFFFF",l.fillText(u.toFixed(3),s-24,10),l.fillText(f.toFixed(3),s-24,i-10),!0},this.solve_poisson=function(){if(1!=init_ready)return GlobalClasses.error_code("Fdm","solve_poisson",13);for(var r=new Array,e=0;e<B.length;e++)1!=B[e]&&r.push(e);for(var t=new Array(r.length),a=0;a<r.length;a++)t[a]=new Array(r.length);for(a=0;a<r.length;a++)for(e=0;e<r.length;e++)0==B[r[a]]?t[a][e]=C_a(I[r[a]],I[r[e]])/(h*h):2==B[r[a]]?t[a][e]=C_b(I[r[a]],I[r[e]])/h:3==B[r[a]]&&(t[a][e]=C_c(I[r[a]],I[r[e]])/h);var o=new Array(r.length);for(e=0;e<o.length;e++)0==B[r[e]]?o[e]=F(P[r[e]][0],P[r[e]][1])-Sum_a(I[r[e]])/(h*h):2==B[r[e]]?o[e]=H(P[r[e]][0],P[r[e]][1]):3==B[r[e]]&&(o[e]=omega*R(P[r[e]][0],P[r[e]][1]));var l=LinearAlgebra.solve(t,o);x=new Array(B.length);for(var s=0;s<x.length;s++)x[s]=G(P[s][0],P[s][1]);for(var i=0;i<r.length;i++)x[r[i]]=l[i];return 2!=B[0]&&3!=B[0]||(x[0]=.5*(x[1]+x[0+(n+1)])),2!=B[n]&&3!=B[n]||(x[n]=.5*(x[n-1]+x[n+(n+1)])),2!=B[m*(n+1)]&&3!=B[m*(n+1)]||(x[m*(n+1)]=.5*(x[m*(n+1)+1]+x[m*(n+1)-(n+1)])),2!=B[m*(n+1)+n]&&3!=B[m*(n+1)+n]||(x[m*(n+1)+n]=.5*(x[m*(n+1)+n-1]+x[m*(n+1)+n-(n+1)])),!0}},Fdm=new Fdm_taramathObject,Fem_taramathObject=function(){var P=new Array,T=new Array,B=new Array,F=function(r,e){return 0},G=function(r,e){return 0},H=function(r,e){return 0},R=function(r,e){return 0},F_string="0",G_string="0",H_string="0",R_string="0",x=new Array,ef=new Array,omega=0,color=new Array;this.get_points=function(){return P},this.get_triangles=function(){return T},this.get_solution=function(){return x},this.init=function(){return P=new Array,T=new Array,B=new Array,F=function(r,e){return 0},G=function(r,e){return 0},H=function(r,e){return 0},R=function(r,e){return 0},R_string=H_string=G_string=F_string="0",x=new Array,ef=new Array,omega=0,color=GlobalClasses.get_color_table(),!0},this.set_boundary=function(r){if(arguments.length<1)return GlobalClasses.error_code("Fem","set_boundary",0);B=new Array(P.length);for(var e=0;e<P.length;e++)B[e]=1;if("function"==typeof r)for(e=0;e<B.length;e++){var t=r(P[e][0],P[e][1]);("number"==typeof t&&1==t||"string"==typeof t&&"dirichlet"==t)&&(B[e]=1),("number"==typeof t&&2==t||"string"==typeof t&&"neumann"==t)&&(B[e]=2),("number"==typeof t&&3==t||"string"==typeof t&&"robin"==t)&&(B[e]=3)}return!0},this.set_function_f=function(v){if(arguments.length<1)return GlobalClasses.error_code("Fem","set_function_f",0);if("function"==typeof v&&(F=v),"number"==typeof v&&(F=function(r,e){return v}),"string"==typeof v){if(F_string=GlobalClasses.check_function_string_xy(v),0==F_string)return GlobalClasses.error_code("Fem","set_function_f",24);F=function(x,y){var t=0;with(Math)t=eval(F_string);return t}}return!0},this.set_function_g=function(v){if(arguments.length<1)return GlobalClasses.error_code("Fem","set_function_g",0);if("function"==typeof v&&(G=v),"number"==typeof v&&(G=function(r,e){return v}),"string"==typeof v){if(G_string=GlobalClasses.check_function_string_xy(v),0==G_string)return GlobalClasses.error_code("Fem","set_function_g",24);G=function(x,y){var t=0;with(Math)t=eval(G_string);return t}}return!0},this.set_function_h=function(v){if(arguments.length<1)return GlobalClasses.error_code("Fem","set_function_h",0);if("function"==typeof v&&(H=v),"number"==typeof v&&(H=function(r,e){return v}),"string"==typeof v){if(H_string=GlobalClasses.check_function_string_xy(v),0==H_string)return GlobalClasses.error_code("Fem","set_function_h",24);H=function(x,y){var t=0;with(Math)t=eval(H_string);return t}}return!0},this.set_function_r=function(v){if(arguments.length<1)return GlobalClasses.error_code("Fem","set_function_r",0);if("function"==typeof v&&(R=v),"number"==typeof v&&(R=function(r,e){return v}),"string"==typeof v){if(R_string=GlobalClasses.check_function_string_xy(v),0==R_string)return GlobalClasses.error_code("Fem","set_function_r",24);R=function(x,y){var t=0;with(Math)t=eval(R_string);return t}}return!0},this.set_omega=function(r){return arguments.length<1?GlobalClasses.error_code("Fem","set_omega",0):("number"==typeof r&&(omega=r),!0)};var TriangleSlope=new Array,rad=Math.PI/4,scale=3,e1=new Array(3*Math.cos(rad),Math.sin(rad)),e2=new Array(-3*Math.sin(rad),Math.cos(rad)),e3=new Array(0,scale),y=new Array,S=new Array,U=new Array,id_animation="canvas",animation_active=0,svg_txt="",svg_xmin=0,svg_xmax=1,svg_ymin=0,svg_ymax=1,svg_width=100,svg_height=100,animation_width=100,animation_height=100;function calculate_svg_rectangle(){if(0==P.length)var r=0,e=1,t=0,a=1;else{r=P[0][0],e=P[0][0],t=P[0][1],a=P[0][1];for(var n=1;n<P.length;n++)P[n][0]<r&&(r=P[n][0]),P[n][0]>e&&(e=P[n][0]),P[n][1]<t&&(t=P[n][1]),P[n][1]>a&&(a=P[n][1])}r==e&&(r-=1,e+=1),t==a&&(t-=1,a+=1);var o=.6*Math.max(e-r,a-t);svg_xmin=.5*(r+e)-o,svg_xmax=.5*(r+e)+o,svg_ymin=.5*(t+a)-o,svg_ymax=.5*(t+a)+o}function svg_scale(r){var e=new Array((r[0]-svg_xmin)/(svg_xmax-svg_xmin),(r[1]-svg_ymin)/(svg_ymax-svg_ymin));return new Array(e[0]*svg_width,svg_height-e[1]*svg_height)}function find_min(r){for(var e=r[0],t=1;t<r.length;t++)r[t]<e&&(e=r[t]);return e}function find_max(r){for(var e=r[0],t=1;t<r.length;t++)r[t]>e&&(e=r[t]);return e}function ByteToHex(r){var e=parseInt(r,10);return isNaN(e)?"00":(e=Math.max(0,Math.min(e,255)),"0123456789ABCDEF".charAt((e-e%16)/16)+"0123456789ABCDEF".charAt(e%16))}function rgbToHex(r){return"#"+ByteToHex(r[0])+ByteToHex(r[1])+ByteToHex(r[2])}function calculate_triangle_slope(){for(TriangleSlope=new Array,k=0;k<T.length;k++){var r=new Array(P[T[k][0]][0],P[T[k][0]][1]),e=new Array(P[T[k][1]][0],P[T[k][1]][1]),t=new Array(P[T[k][2]][0],P[T[k][2]][1]),a=x[T[k][0]],n=x[T[k][1]],o=x[T[k][2]],l=r[1]*e[0]-r[0]*e[1]-r[1]*t[0]+e[1]*t[0]+r[0]*t[1]-e[0]*t[1],s=-(e[1]*a-t[1]*a-r[1]*n+t[1]*n+r[1]*o-e[1]*o)/l,i=(e[0]*a-t[0]*a-r[0]*n+t[0]*n+r[0]*o-e[0]*o)/l,f=-(e[0]*t[1]*a-e[1]*t[0]*a+r[1]*t[0]*n-r[0]*t[1]*n-r[1]*e[0]*o+r[0]*e[1]*o)/l;TriangleSlope.push(new Array(s,i,f))}}function triangle_slope_eval(r,e,t){return TriangleSlope[r][0]*e+TriangleSlope[r][1]*t+TriangleSlope[r][2]}function orientation(r,e,t){return 0<(t[0]-e[0])*(r[1]-e[1])-(r[0]-e[0])*(t[1]-e[1])}function point_in_triangle(r,e,t,a){var n=orientation(r,e,t),o=orientation(r,t,a),l=orientation(r,a,e);return n==o&&o==l}function plot_solution_index(r,e,t,a){for(var n=-1,o=0;o<T.length;o++)point_in_triangle(new Array(r,e),P[T[o][0]],P[T[o][1]],P[T[o][2]])&&(n=o);if(-1==n)return-1;var l=triangle_slope_eval(n,r,e);return l=Math.max(Math.min(l,a),t),100-Math.floor((a-l)/(a-t)*100)}function projection(r,e,t){var a=new Array(r*e1[0]+e*e2[0]+t*e3[0],r*e1[1]+e*e2[1]+t*e3[1]);return a=new Array((a[0]+4)/8,(a[1]+2)/7),new Array(a[0]*animation_width,animation_height-a[1]*animation_height)}function plot_mesh_fixed(){if(0==S.length||0==U.length||0==y.length)return 0;e3=new Array(0,scale);var r=new Array;r.push(projection(-1,-1,0)),r.push(projection(-1,1,0)),r.push(projection(1,1,0)),r.push(projection(1,-1,0));for(var e=new Array,t=0;t<S.length;t++)e.push(projection(S[t][0],S[t][1],y[t]));svg_txt='<?xml version="1.0" encoding="UTF-8" ?><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+animation_width+'" height="'+animation_height+'">',svg_txt+='<rect x="0.000" y="0.000" width="'+animation_width.toFixed(3)+'" height="'+animation_height.toFixed(3)+'" style="fill:#F0F0F0; stroke:none;" />',svg_txt+='<polygon points="'+r[0][0].toFixed(3)+","+r[0][1].toFixed(3)+" "+r[1][0].toFixed(3)+","+r[1][1].toFixed(3)+" "+r[2][0].toFixed(3)+","+r[2][1].toFixed(3)+" "+r[3][0].toFixed(3)+","+r[3][1].toFixed(3)+'" style="fill:none; stroke:#666666; stroke-width:1.0; stroke-linejoin:round;" />';for(t=0;t<U.length;t++)svg_txt+='<polygon points="'+e[U[t][0]][0].toFixed(3)+","+e[U[t][0]][1].toFixed(3)+" "+e[U[t][1]][0].toFixed(3)+","+e[U[t][1]][1].toFixed(3)+" "+e[U[t][2]][0].toFixed(3)+","+e[U[t][2]][1].toFixed(3)+'" style="fill:none; stroke:#008800; stroke-width:1.0; stroke-linejoin:round;" />';svg_txt+="</svg>",document.getElementById(id_animation).innerHTML=svg_txt}function animate(){e1=new Array(3*Math.cos(rad),Math.sin(rad)),e2=new Array(-3*Math.sin(rad),Math.cos(rad)),plot_mesh_fixed(),rad+=.01}this.export_svg=function(){return svg_txt},this.plot_points=function(r,e,t){if(arguments.length<3)return GlobalClasses.error_code("Fem","plot_points",0);if(1!=GlobalClasses.is_div(r))return GlobalClasses.error_code("Fem","plot_points",11);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Fem","plot_points",1);if(1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("Fem","plot_points",1);svg_width=Math.floor(Math.max(20,e)),svg_height=Math.floor(Math.max(20,t)),calculate_svg_rectangle(),svg_txt='<?xml version="1.0" encoding="UTF-8" ?><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+svg_width+'" height="'+svg_height+'">',svg_txt+='<rect x="0.000" y="0.000" width="'+svg_width.toFixed(3)+'" height="'+svg_height.toFixed(3)+'" style="fill:#F0F0F0; stroke:none;" />';for(var a=0;a<T.length;a++){var n=svg_scale(P[T[a][0]]),o=svg_scale(P[T[a][1]]),l=svg_scale(P[T[a][2]]);svg_txt+='<polygon points="'+n[0].toFixed(3)+","+n[1].toFixed(3)+" "+o[0].toFixed(3)+","+o[1].toFixed(3)+" "+l[0].toFixed(3)+","+l[1].toFixed(3)+'" style="fill:#D0D0D0; stroke:#D0D0D0; stroke-width:1.0; stroke-linejoin:round;" />'}for(a=0;a<P.length;a++){var s=svg_scale(P[a]);svg_txt+='<circle cx="'+s[0].toFixed(3)+'" cy="'+s[1].toFixed(3)+'" r="2.6" style="fill:#000000; stroke:none;" />'}return svg_txt+="</svg>",document.getElementById(r).innerHTML=svg_txt,!0},this.plot_triangles=function(r,e,t){if(arguments.length<3)return GlobalClasses.error_code("Fem","plot_triangles",0);if(1!=GlobalClasses.is_div(r))return GlobalClasses.error_code("Fem","plot_triangles",11);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Fem","plot_triangles",1);if(1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("Fem","plot_triangles",1);svg_width=Math.floor(Math.max(20,e)),svg_height=Math.floor(Math.max(20,t)),calculate_svg_rectangle(),svg_txt='<?xml version="1.0" encoding="UTF-8" ?><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+svg_width+'" height="'+svg_height+'">',svg_txt+='<rect x="0.000" y="0.000" width="'+svg_width.toFixed(3)+'" height="'+svg_height.toFixed(3)+'" style="fill:#F0F0F0; stroke:none;" />';for(var a=0;a<T.length;a++){var n=svg_scale(P[T[a][0]]),o=svg_scale(P[T[a][1]]),l=svg_scale(P[T[a][2]]);svg_txt+='<polygon points="'+n[0].toFixed(3)+","+n[1].toFixed(3)+" "+o[0].toFixed(3)+","+o[1].toFixed(3)+" "+l[0].toFixed(3)+","+l[1].toFixed(3)+'" style="fill:#D0D0D0; stroke:#A2A2A2; stroke-width:1.4; stroke-linejoin:round;" />'}for(a=0;a<P.length;a++){var s=svg_scale(P[a]);svg_txt+='<circle cx="'+s[0].toFixed(3)+'" cy="'+s[1].toFixed(3)+'" r="2.6" style="fill:#000000; stroke:none;" />'}return svg_txt+="</svg>",document.getElementById(r).innerHTML=svg_txt,!0},this.plot_draft=function(r,e,t){if(arguments.length<3)return GlobalClasses.error_code("Fem","plot_draft",0);if(1!=GlobalClasses.is_div(r))return GlobalClasses.error_code("Fem","plot_draft",11);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Fem","plot_draft",1);if(1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("Fem","plot_draft",1);if(0==P.length||0==T.length||0==x.length)return GlobalClasses.error_code("Fem","plot_draft",14);0==color.length&&(color=GlobalClasses.get_color_table()),svg_width=Math.floor(Math.max(20,e)),svg_height=Math.floor(Math.max(20,t)),calculate_svg_rectangle(),svg_txt='<?xml version="1.0" encoding="UTF-8" ?><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+svg_width+'" height="'+svg_height+'">',svg_txt+='<rect x="0.000" y="0.000" width="'+svg_width.toFixed(3)+'" height="'+svg_height.toFixed(3)+'" style="fill:#000000; stroke:none;" />';var a=find_min(x),n=find_max(x);n-a<1e-12&&(n=a+1);for(var o=0;o<T.length;o++){var l=svg_scale(P[T[o][0]]),s=svg_scale(P[T[o][1]]),i=svg_scale(P[T[o][2]]),f=(t=(x[T[o][0]]+x[T[o][1]]+x[T[o][2]])/3,100-Math.floor((n-t)/(n-a)*100));f=Math.min(100,Math.max(0,f)),svg_txt+='<polygon points="'+l[0].toFixed(3)+","+l[1].toFixed(3)+" "+s[0].toFixed(3)+","+s[1].toFixed(3)+" "+i[0].toFixed(3)+","+i[1].toFixed(3)+'" style="fill:'+rgbToHex(color[f])+"; stroke:"+rgbToHex(color[f])+'; stroke-width:1.0; stroke-linejoin:round;" />'}var u=svg_width/Math.sqrt(P.length+1)*.25;for(o=0;o<P.length;o++){var g=svg_scale(P[o]);f=100-Math.floor((n-x[o])/(n-a)*100);f=Math.min(100,Math.max(0,f)),svg_txt+='<circle cx="'+g[0].toFixed(3)+'" cy="'+g[1].toFixed(3)+'" r="'+u.toFixed(3)+'" style="fill:'+rgbToHex(color[f])+'; stroke:none;" />'}var _=(svg_height-1)/101;for(o=0;o<=100;o++)svg_txt+='<rect x="'+(svg_width-20).toFixed(3)+'" y="'+((100-o)*_).toFixed(3)+'" width="20.000" height="'+(_+1).toFixed(3)+'" style="fill:'+rgbToHex(color[o])+'; stroke:none;" />';return svg_txt+='<text x="'+(svg_width-26).toFixed(3)+'" y="'+(svg_height-5).toFixed(3)+'" style="font-size:12px; text-anchor:end; fill:#FFFFFF; stroke:none; font-family:sans-serif;">'+a.toFixed(3)+"</text>",svg_txt+='<text x="'+(svg_width-26).toFixed(3)+'" y="14.000" style="font-size:12px; text-anchor:end; fill:#FFFFFF; stroke:none; font-family:sans-serif;">'+n.toFixed(3)+"</text>",svg_txt+="</svg>",document.getElementById(r).innerHTML=svg_txt,!0},this.plot_solution=function(r,e,t){if(arguments.length<3)return GlobalClasses.error_code("Fem","plot_solution",0);if(1!=GlobalClasses.is_div(r))return GlobalClasses.error_code("Fem","plot_solution",11);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Fem","plot_solution",1);if(1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("Fem","plot_solution",1);if(0==P.length||0==T.length||0==x.length)return GlobalClasses.error_code("Fem","plot_solution",14);0==color.length&&(color=GlobalClasses.get_color_table()),document.getElementById(r).innerHTML="";var a="canvas"+(1e10*Math.random()).toFixed(0),n=document.createElement("canvas");n.setAttribute("id",a),document.getElementById(r).appendChild(n);var o=document.getElementById(a),l=o.getContext("2d");o.width=Math.floor(Math.max(20,e)),o.height=Math.floor(Math.max(20,t));var s=o.width,i=o.height;l.fillStyle="#000000",l.fillRect(0,0,s,i),calculate_svg_rectangle();var f=find_min(x),u=find_max(x);u-f<1e-12&&(u=f+1),calculate_triangle_slope();for(var g=l.createImageData(s,i),_=0;_<g.data.length;_+=4){t=Math.floor(_/4);var h=Math.floor(t/s),c=t%s,d=plot_solution_index(svg_xmin+c/s*(svg_xmax-svg_xmin),svg_ymax-h/i*(svg_ymax-svg_ymin),f,u);s-20<c&&(d=100-Math.floor(h/i*100)),g.data[_+2]=d<0?(g.data[_+0]=0,g.data[_+1]=0):(d=Math.min(100,d),g.data[_+0]=color[d][0],g.data[_+1]=color[d][1],color[d][2]),g.data[_+3]=255}return l.putImageData(g,0,0),l.font="12px sans-serif",l.textBaseline="middle",l.textAlign="right",l.fillStyle="#FFFFFF",l.fillText(u.toFixed(3),s-24,10),l.fillText(f.toFixed(3),s-24,i-10),!0},this.plot_mesh=function(r,e,t){if(arguments.length<3)return GlobalClasses.error_code("Fem","plot_mesh",0);if(1!=GlobalClasses.is_div(r))return GlobalClasses.error_code("Fem","plot_mesh",11);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Fem","plot_mesh",1);if(1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("Fem","plot_mesh",1);if(0==P.length||0==T.length||0==x.length)return GlobalClasses.error_code("Fem","plot_mesh",14);animation_width=Math.floor(Math.max(20,e)),animation_height=Math.floor(Math.max(20,t)),id_animation=r,window.clearInterval(animation_active),rad=Math.PI/4,e1=new Array(3*Math.cos(rad),Math.sin(rad)),e2=new Array(-3*Math.sin(rad),Math.cos(rad)),calculate_svg_rectangle();var a=find_min(x),n=find_max(x);y=new Array(x.length),S=new Array(P.length),U=new Array(T.length);for(var o=0;o<x.length;o++)y[o]=Math.abs(n-a)<1e-12?a:(x[o]-a)/(n-a);for(o=0;o<P.length;o++)S[o]=new Array((P[o][0]-svg_xmin)/(svg_xmax-svg_xmin)*2-1,(P[o][1]-svg_ymin)/(svg_ymax-svg_ymin)*2-1);for(o=0;o<T.length;o++)U[o]=new Array(T[o][0],T[o][1],T[o][2]);return plot_mesh_fixed(),3<arguments.length&&"string"==typeof arguments[3]&&"animate"==arguments[3]&&(animation_active=window.setInterval(animate,40)),!0};var T_area=new Array,T_slope=new Array,T_side_length=new Array,T_angle=new Array,T_center=new Array,T_edge=new Array,P_boundary=new Array;function distance(r,e){return Math.sqrt((r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1]))}function triangle_area(r,e,t){return.5*Math.abs((e[0]-r[0])*(t[1]-r[1])-(t[0]-r[0])*(e[1]-r[1]))}function triangle_slope_single(r,e,t){var a=r[1]*e[0]-r[0]*e[1]-r[1]*t[0]+e[1]*t[0]+r[0]*t[1]-e[0]*t[1];return new Array((t[1]-e[1])/a,(e[0]-t[0])/a)}function triangle_slope(r,e,t){return new Array(triangle_slope_single(r,e,t),triangle_slope_single(e,t,r),triangle_slope_single(t,r,e))}function triangle_side_length(r,e,t){return new Array(distance(e,t),distance(t,r),distance(r,e))}function triangle_angle_single(r,e,t){return Math.acos((e*e+t*t-r*r)/(2*e*t))}function triangle_angle(r,e,t){return new Array(triangle_angle_single(r,e,t),triangle_angle_single(e,t,r),triangle_angle_single(t,r,e))}function triangle_center(r,e,t){return new Array(1/3*(r[0]+e[0]+t[0])/3,1/3*(r[1]+e[1]+t[1]))}function calculate_edges(r,e){for(var t=new Array(r.length),a=0;a<r.length;a++)t[a]=new Array(r.length);for(var n=0;n<r.length;n++)for(var o=0;o<r.length;o++)t[n][o]=0;for(a=0;a<e.length;a++)e[a][0]<e[a][1]?t[e[a][0]][e[a][1]]++:t[e[a][1]][e[a][0]]++,e[a][1]<e[a][2]?t[e[a][1]][e[a][2]]++:t[e[a][2]][e[a][1]]++,e[a][2]<e[a][0]?t[e[a][2]][e[a][0]]++:t[e[a][0]][e[a][2]]++;T_edge=new Array;for(n=0;n<r.length-1;n++)for(o=n+1;o<r.length;o++)1==t[n][o]&&T_edge.push(new Array(n,o))}function calculate_triangle_properties(r,e){T_area=new Array(e.length),T_slope=new Array(e.length),T_side_length=new Array(e.length),T_angle=new Array(e.length),T_center=new Array(e.length);for(var t=0;t<e.length;t++)T_area[t]=triangle_area(r[e[t][0]],r[e[t][1]],r[e[t][2]]);for(t=0;t<e.length;t++)T_slope[t]=triangle_slope(r[e[t][0]],r[e[t][1]],r[e[t][2]]);for(t=0;t<e.length;t++)T_side_length[t]=triangle_side_length(r[e[t][0]],r[e[t][1]],r[e[t][2]]);for(t=0;t<e.length;t++)T_angle[t]=triangle_angle(T_side_length[t][0],T_side_length[t][1],T_side_length[t][2]);for(t=0;t<e.length;t++)T_center[t]=triangle_center(r[e[t][0]],r[e[t][1]],r[e[t][2]]);calculate_edges(r,e)}function calculate_point_properties(r,e){P_boundary=new Array(r.length);for(var t=0;t<r.length;t++)P_boundary[t]=0;for(t=0;t<T_edge.length;t++)P_boundary[T_edge[t][0]]=1,P_boundary[T_edge[t][1]]=1}function calculate_properties(r,e){for(;B.length<r.length;)B.push(1);calculate_triangle_properties(r,e),calculate_point_properties(r,e)}function dot_product(r,e){return r[0]*e[0]+r[1]*e[1]}function find_index(r,e){return e[0]==r?0:e[1]==r?1:e[2]==r?2:-1}function calculate_a(r,e){for(var t=0,a=0;a<T.length;a++){var n=find_index(r,T[a]),o=find_index(e,T[a]);0<=n&&0<=o&&(t+=T_area[a]*dot_product(T_slope[a][n],T_slope[a][o]))}return t}function calculate_b(r){for(var e=0,t=0;t<T.length;t++)0<=find_index(r,T[t])&&(e+=1/3*T_area[t]*F(T_center[t][0],T_center[t][1]));return e}function calculate_fac_D(r){for(var e=0,t=0;t<P.length;t++)1==P_boundary[t]&&(e+=calculate_a(t,r)*G(P[t][0],P[t][1]));return e}function calculate_c_N(r){for(var e=0,t=0;t<T_edge.length;t++)if(T_edge[t][0]==r||T_edge[t][1]==r){var a=.5*(P[T_edge[t][0]][0]+P[T_edge[t][1]][0]),n=.5*(P[T_edge[t][0]][1]+P[T_edge[t][1]][1]);e+=.5*distance(P[T_edge[t][0]],P[T_edge[t][1]])*H(a,n)}return e}function calculate_c_R(r){for(var e=0,t=0;t<T_edge.length;t++)if(T_edge[t][0]==r||T_edge[t][1]==r){var a=.5*(P[T_edge[t][0]][0]+P[T_edge[t][1]][0]),n=.5*(P[T_edge[t][0]][1]+P[T_edge[t][1]][1]);e+=.5*distance(P[T_edge[t][0]],P[T_edge[t][1]])*omega*R(a,n)}return e}function calculate_a_R(r,e){for(var t=0,a=0;a<T_edge.length;a++)T_edge[a][0]!=r&&T_edge[a][1]!=r||T_edge[a][0]!=e&&T_edge[a][1]!=e||(t+=1/6*distance(P[T_edge[a][0]],P[T_edge[a][1]])*omega);return r==e&&(t*=2),t}function compare_triangles(r,e){for(var t=new Array,a=0;a<3;a++)r[a]==e[0]||r[a]==e[1]||r[a]==e[2]?t.unshift(r[a]):t.push(r[a]);for(a=0;a<3;a++)e[a]!=r[0]&&e[a]!=r[1]&&e[a]!=r[2]&&t.push(e[a]);return t}function distance_square(r,e){return(r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1])}function swap_check(r,e,t){return distance_square(r,e)>distance_square(r,t)+1e-6}function mesh_triangle_center(r,e,t){var a=new Array(e[0]-r[0],e[1]-r[1]),n=new Array(t[0]-r[0],t[1]-r[1]),o=2*(a[0]*n[1]-a[1]*n[0]),l=a[0]*a[0]+a[1]*a[1],s=n[0]*n[0]+n[1]*n[1],i=new Array((n[1]*l-a[1]*s)/o,(a[0]*s-n[0]*l)/o);return new Array(i[0]+r[0],i[1]+r[1])}function point_orientation(r,e,t){return 0<(t[0]-e[0])*(r[1]-e[1])-(r[0]-e[0])*(t[1]-e[1])}function point_in_triangle_mesh(r,e,t,a){var n=point_orientation(r,e,t),o=point_orientation(r,t,a),l=point_orientation(r,a,e);return n==o&&o==l}function legalize_triangle(){for(var r=0,e=0;e<T.length-1;e++)for(var t=e+1;t<T.length;t++){var a=compare_triangles(T[e],T[t]);if(4==a.length)swap_check(mesh_triangle_center(P[a[0]],P[a[1]],P[a[2]]),P[a[0]],P[a[3]])&&(T[e]=new Array(a[0],a[2],a[3]),T[t]=new Array(a[1],a[2],a[3]),r++)}return r}function add_to_triangulation(r,e){for(var t=0;t<T.length&&!point_in_triangle_mesh(new Array(r,e),P[T[t][0]],P[T[t][1]],P[T[t][2]]);)t++;t<T.length&&(P.push(new Array(r,e)),T.push(new Array(P.length-1,T[t][0],T[t][1])),T.push(new Array(P.length-1,T[t][1],T[t][2])),T.push(new Array(P.length-1,T[t][2],T[t][0])),T.splice(t,1))}this.solve_poisson=function(){if(0==P.length||0==T.length)return GlobalClasses.error_code("Fem","solve_poisson",17);calculate_properties(P,T);for(var r=0;r<P.length;r++)1!=P_boundary[r]||2!=B[r]&&3!=B[r]||(P_boundary[r]=B[r]);var e=new Array;for(r=0;r<P.length;r++)1!=P_boundary[r]&&e.push(r);var t=new Array(e.length);for(r=0;r<e.length;r++)t[r]=new Array(e.length);for(r=0;r<e.length;r++)for(var a=0;a<e.length;a++)t[r][a]=calculate_a(e[r],e[a]),3==P_boundary[e[a]]&&(t[r][a]+=calculate_a_R(e[r],e[a]));var n=new Array(e.length);for(a=0;a<n.length;a++)3==P_boundary[e[a]]?n[a]=calculate_c_R(e[a])-calculate_b(e[a])-calculate_fac_D(e[a]):2==P_boundary[e[a]]?n[a]=calculate_c_N(e[a])-calculate_b(e[a])-calculate_fac_D(e[a]):n[a]=-calculate_b(e[a])-calculate_fac_D(e[a]);var o=LinearAlgebra.solve(t,n);x=new Array(P.length);for(r=0;r<P.length;r++)x[r]=G(P[r][0],P[r][1]);for(a=0;a<e.length;a++)x[e[a]]=o[a];return!0},this.calculate_eigenfunctions=function(){if(0==P.length||0==T.length)return GlobalClasses.error_code("Fem","calculate_eigenfunctions",17);calculate_properties(P,T);for(var r=new Array,e=0;e<P.length;e++)1!=P_boundary[e]&&r.push(e);var t=new Array(r.length);for(e=0;e<r.length;e++)t[e]=new Array(r.length);for(e=0;e<r.length;e++)for(var a=0;a<r.length;a++)t[e][a]=calculate_a(r[e],r[a]);var n=LinearAlgebra.eigenvalues(t);ef=new Array(r.length);for(e=0;e<r.length;e++)ef[e]=new Array(P.length);for(e=0;e<r.length;e++)for(a=0;a<P.length;a++)ef[e][a]=0;for(e=0;e<r.length;e++)for(a=0;a<r.length;a++)ef[e][r[a]]=n[1][r.length-1-e][a];return x=ef[0],!0},this.set_eigenfunction=function(r){if(arguments.length<1)return GlobalClasses.error_code("Fem","set_eigenfunction",0);if(1!=GlobalClasses.is_number(r))return GlobalClasses.error_code("Fem","set_eigenfunction",1);var e=Math.max(0,Math.min(Math.floor(r),ef.length-1));return x=ef[e],!0},this.add_point=function(r,e){return arguments.length<2?GlobalClasses.error_code("Fem","add_point",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("Fem","add_point",1):1!=GlobalClasses.is_number(e)?GlobalClasses.error_code("Fem","add_point",1):(P.push(new Array(r,e)),!0)},this.add_triangle=function(r,e,t){if(arguments.length<3)return GlobalClasses.error_code("Fem","add_triangle",0);if(1!=GlobalClasses.is_number(r))return GlobalClasses.error_code("Fem","add_triangle",1);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Fem","add_triangle",1);if(1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("Fem","add_triangle",1);var a=Math.floor(r),n=Math.floor(e),o=Math.floor(t);return 0<=a&&a<P.length&&0<=n&&n<P.length&&0<=o&&o<P.length&&T.push(new Array(a,n,o)),!0},this.optimize_triangulation=function(){for(;0<legalize_triangle(););return!0},this.auto_triangulation=function(){if(P.length<3)return GlobalClasses.error_code("Fem","auto_triangulation",16);(T=new Array).push(new Array(0,1,2));for(var r=3;r<P.length;r++){for(var e=0;e<T.length&&!point_in_triangle_mesh(P[r],P[T[e][0]],P[T[e][1]],P[T[e][2]]);)e++;if(e<T.length)T.push(new Array(r,T[e][0],T[e][1])),T.push(new Array(r,T[e][1],T[e][2])),T.push(new Array(r,T[e][2],T[e][0])),T.splice(e,1);else for(var t=0;t<r-1;t++)for(var a=t+1;a<r;a++){for(var n=point_orientation(P[r],P[t],P[a]),o=!0,l=0;l<r;l++)l!=t&&l!=a&&point_orientation(P[l],P[t],P[a])==n&&(o=!1);o&&T.push(new Array(r,t,a))}legalize_triangle()}return this.optimize_triangulation(),!0},this.add_point_to_triangulation=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("Fem","add_point_to_triangulation",0);if(1!=GlobalClasses.is_number(r))return GlobalClasses.error_code("Fem","add_point_to_triangulation",1);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Fem","add_point_to_triangulation",1);for(var t=0;t<P.length;t++)if(0==distance_square(P[t],new Array(r,e)))return GlobalClasses.error_code("Fem","add_point_to_triangulation",18);return add_to_triangulation(r,e),this.optimize_triangulation(),!0},this.disc_distribution=function(r){if(arguments.length<1)return GlobalClasses.error_code("Fem","disc_distribution",0);if(1!=GlobalClasses.is_number(r))return GlobalClasses.error_code("Fem","disc_distribution",1);if(P.length<3||T.length<1)return GlobalClasses.error_code("Fem","disc_distribution",17);for(var e=P[0][0],t=P[0][0],a=P[0][1],n=P[0][1],o=1;o<P.length;o++)P[o][0]<e&&(e=P[o][0]),P[o][0]>t&&(t=P[o][0]),P[o][1]<a&&(a=P[o][1]),P[o][1]>n&&(n=P[o][1]);var l=r*r,s=Math.floor(10*(t-e)/r*(n-a)/r);for(o=0;o<s;o++){for(var i=new Array(e+(t-e)*Math.random(),a+(n-a)*Math.random()),f=0;f<P.length&&distance_square(P[f],i)>=l;)f++;f==P.length&&add_to_triangulation(i[0],i[1])}return this.optimize_triangulation(),!0},this.refine_triangulation=function(){if(P.length<3||T.length<1)return GlobalClasses.error_code("Fem","refine_triangulation",17);for(var r=new Array,e=0;e<T.length;e++)r.push(new Array(T[e][0],T[e][1],T[e][2]));for(e=0;e<r.length;e++){var t=new Array((P[r[e][0]][0]+P[r[e][1]][0]+P[r[e][2]][0])/3,(P[r[e][0]][1]+P[r[e][1]][1]+P[r[e][2]][1])/3);add_to_triangulation(t[0],t[1])}return this.optimize_triangulation(),!0},this.generate_mesh=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("Fem","generate_mesh",0);if(1!=GlobalClasses.is_string(r))return GlobalClasses.error_code("Fem","generate_mesh",1);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Fem","generate_mesh",1);if(P=new Array,T=new Array,B=new Array,"ring"==r){for(var t=Math.max(5,Math.min(100,Math.floor(e))),a=0;a<t;a++){var n=a/t;this.add_point(.4*Math.cos(2*Math.PI*n),.4*Math.sin(2*Math.PI*n))}for(a=0;a<2*t;a++){n=.5*a/t;this.add_point(Math.cos(2*Math.PI*n),Math.sin(2*Math.PI*n))}for(a=0;a<t;a++)this.add_triangle(a,2*a%(2*t)+t,(2*a+1)%(2*t)+t),this.add_triangle(a,2*a%(2*t)+t,(2*a-1+2*t)%(2*t)+t),this.add_triangle(a,(a-1+t)%t,(2*a-1+2*t)%(2*t)+t);this.refine_triangulation(),this.refine_triangulation()}if("rectangle"==r){t=Math.max(4,Math.min(200,Math.floor(e)));for(var o=0;o<=t;o++)for(var l=0;l<=t;l++)this.add_point(2*o/t-1,2*l/t-1);for(o=0;o<t;o++)for(l=0;l<t;l++)this.add_triangle(l*(t+1)+o,l*(t+1)+o+1,(l+1)*(t+1)+o);for(o=0;o<t;o++)for(l=0;l<t;l++)this.add_triangle((l+1)*(t+1)+o+1,l*(t+1)+o+1,(l+1)*(t+1)+o)}if("disc"==r){for(t=Math.max(5,Math.min(200,Math.floor(e))),a=0;a<t;a++){n=a/t;this.add_point(Math.cos(2*Math.PI*n),Math.sin(2*Math.PI*n))}this.auto_triangulation(),this.disc_distribution(Math.min(5/t,.5))}return!0}},Fem=new Fem_taramathObject,Fourier_taramathObject=function(){function s(r){for(var e=0,t=0;t<32;t++)r>>t&!0&&e++;return e}function _(r,e){return new Array(r[0]+e[0],r[1]+e[1])}function h(r,e){return new Array(r[0]*e[0]-r[1]*e[1],r[0]*e[1]+r[1]*e[0])}function c(r){var e=Math.exp(r[0]);return new Array(e*Math.cos(r[1]),e*Math.sin(r[1]))}function g(r){var e=r.length;if(e<=1)return r;for(var t=e/2,a=new Array(t),n=new Array(t),o=0;o<t;o++)a[o]=r[2*o],n[o]=r[2*o+1];a=g(a),n=g(n);for(var l,s,i=-2*Math.PI/e,f=0;f<t;f++){"number"==typeof a[f]&&(a[f]=new Array(a[f],0)),"number"==typeof n[f]&&(n[f]=new Array(n[f],0));var u=h(n[f],c(new Array(0,i*f)));r[f]=_(a[f],u),r[f+t]=(l=a[f],s=u,new Array(l[0]-s[0],l[1]-s[1]))}return r}function i(r){for(var e=r.length,t=new Array(e),a=0;a<e;a++)t[a]=new Array(r[a][0],-r[a][1]);t=g(t);for(a=0;a<e;a++)t[a]=new Array(t[a][0],-t[a][1]);return t}function u(r,e){return 0==r?1/e:2/e}this.amplitude=function(r){if(arguments.length<1)return GlobalClasses.error_code("Fourier","amplitude",0);if("object"!=typeof r)return GlobalClasses.error_code("Fourier","amplitude",1);if("number"!=typeof r.length)return GlobalClasses.error_code("Fourier","amplitude",1);for(var e=new Array,t=0;t<r.length;t++)"number"==typeof r[t]&&e.push(Math.abs(r[t])),"object"==typeof r[t]&&e.push(Math.sqrt(r[t][0]*r[t][0]+r[t][1]*r[t][1]));return e},this.amplitude_2d=function(r){if(arguments.length<1)return GlobalClasses.error_code("Fourier","amplitude_2d",0);if("object"!=typeof r)return GlobalClasses.error_code("Fourier","amplitude_2d",1);if("number"!=typeof r.length)return GlobalClasses.error_code("Fourier","amplitude_2d",1);for(var e=new Array(r.length),t=0;t<e.length;t++)e[t]=new Array(r[t].length);for(t=0;t<e.length;t++)for(var a=0;a<e[t].length;a++)"number"==typeof r[t][a]&&(e[t][a]=Math.abs(r[t][a])),"object"==typeof r[t][a]&&(e[t][a]=Math.sqrt(r[t][a][0]*r[t][a][0]+r[t][a][1]*r[t][a][1]));return e},this.complex_transform=function(r){if(arguments.length<1)return GlobalClasses.error_code("Fourier","complex_transform",0);if("object"!=typeof r)return GlobalClasses.error_code("Fourier","complex_transform",1);if("number"!=typeof r.length)return GlobalClasses.error_code("Fourier","complex_transform",1);for(var e=r.length,t=new Array(e),a=0;a<e;a++)"number"==typeof r[a]&&(t[a]=new Array(r[a],0)),"object"==typeof r[a]&&(t[a]=new Array(r[a][0],r[a][1]));if(e<8||1!=s(e))return function(r){for(var e=r.length,t=new Array(e),a=0;a<e;a++)t[a]=r[a];for(a=0;a<e;a++)"number"==typeof t[a]&&(t[a]=new Array(t[a],0));var n=new Array(e);for(a=0;a<e;a++)n[a]=new Array(0,0);for(a=0;a<e;a++){for(var o=-2*a*Math.PI/e,l=0;l<e;l++){var s=h(t[l],c(new Array(0,o*l)));n[a]=_(n[a],s)}n[a]=new Array(n[a][0]/e,n[a][1]/e)}return n}(t);for(a=0;a<e;a++)t[a][0]/=e,t[a][1]/=e;return g(t)},this.inverse_complex_transform=function(r){if(arguments.length<1)return GlobalClasses.error_code("Fourier","inverse_complex_transform",0);if("object"!=typeof r)return GlobalClasses.error_code("Fourier","inverse_complex_transform",1);if("number"!=typeof r.length)return GlobalClasses.error_code("Fourier","inverse_complex_transform",1);for(var e=r.length,t=new Array(e),a=0;a<e;a++)"number"==typeof r[a]&&(t[a]=new Array(r[a],0)),"object"==typeof r[a]&&(t[a]=new Array(r[a][0],r[a][1]));return e<8||1!=s(e)?function(r){for(var e=r.length,t=new Array(e),a=0;a<e;a++)t[a]=r[a];for(a=0;a<e;a++)"number"==typeof t[a]&&(t[a]=new Array(t[a],0));var n=new Array(e);for(a=0;a<e;a++)n[a]=new Array(0,0);for(a=0;a<e;a++)for(var o=2*a*Math.PI/e,l=0;l<e;l++){var s=h(t[l],c(new Array(0,o*l)));n[a]=_(n[a],s)}return n}(t):i(t)},this.complex_transform_2d=function(r){if(arguments.length<1)return GlobalClasses.error_code("Fourier","complex_transform_2d",0);if("object"!=typeof r)return GlobalClasses.error_code("Fourier","complex_transform_2d",1);if("number"!=typeof r.length)return GlobalClasses.error_code("Fourier","complex_transform_2d",1);if("object"!=typeof r[0])return GlobalClasses.error_code("Fourier","complex_transform_2d",1);if("number"!=typeof r[0].length)return GlobalClasses.error_code("Fourier","complex_transform_2d",1);for(var e=r.length,t=r[0].length,a=new Array(e),n=0;n<e;n++)a[n]=new Array(t);for(n=0;n<e;n++)for(var o=0;o<t;o++)a[n][o]=r[n][o];for(n=0;n<e;n++)for(o=0;o<t;o++)"number"==typeof a[n][o]&&(a[n][o]=new Array(a[n][o],0));var l=new Array(e);for(n=0;n<e;n++)l[n]=new Array(t);for(n=0;n<e;n++)for(o=0;o<t;o++)l[n][o]=new Array(0,0);for(n=0;n<e;n++)for(o=0;o<t;o++){for(var s=-2*n*Math.PI/e,i=-2*o*Math.PI/t,f=0;f<e;f++)for(var u=0;u<t;u++){var g=h(a[f][u],h(c(new Array(0,s*f)),c(new Array(0,i*u))));l[n][o]=_(l[n][o],g)}l[n][o]=new Array(l[n][o][0]/(t*e),l[n][o][1]/(t*e))}return l},this.inverse_complex_transform_2d=function(r){if(arguments.length<1)return GlobalClasses.error_code("Fourier","inverse_complex_transform_2d",0);if("object"!=typeof r)return GlobalClasses.error_code("Fourier","inverse_complex_transform_2d",1);if("number"!=typeof r.length)return GlobalClasses.error_code("Fourier","inverse_complex_transform_2d",1);if("object"!=typeof r[0])return GlobalClasses.error_code("Fourier","inverse_complex_transform_2d",1);if("number"!=typeof r[0].length)return GlobalClasses.error_code("Fourier","inverse_complex_transform_2d",1);for(var e=r.length,t=r[0].length,a=new Array(e),n=0;n<e;n++)a[n]=new Array(t);for(n=0;n<e;n++)for(var o=0;o<t;o++)a[n][o]=r[n][o];for(n=0;n<e;n++)for(o=0;o<t;o++)"number"==typeof a[n][o]&&(a[n][o]=new Array(a[n][o],0));var l=new Array(e);for(n=0;n<e;n++)l[n]=new Array(t);for(n=0;n<e;n++)for(o=0;o<t;o++)l[n][o]=new Array(0,0);for(n=0;n<e;n++)for(o=0;o<t;o++)for(var s=2*n*Math.PI/e,i=2*o*Math.PI/t,f=0;f<e;f++)for(var u=0;u<t;u++){var g=h(a[f][u],h(c(new Array(0,s*f)),c(new Array(0,i*u))));l[n][o]=_(l[n][o],g)}return l},this.transform=function(r){if(arguments.length<1)return GlobalClasses.error_code("Fourier","transform",0);if("object"!=typeof r)return GlobalClasses.error_code("Fourier","transform",1);if("number"!=typeof r.length)return GlobalClasses.error_code("Fourier","transform",1);var e=r.length;if(e<8||1!=s(e))return function(r){for(var e=r.length,t=Math.floor(e/2),a=new Array(t+1),n=2*Math.PI,o=0;o<=t;o++){for(var l=0,s=0,i=0;i<e;i++)l+=r[i]*Math.cos(o*(i/e)*n),s+=r[i]*Math.sin(o*(i/e)*n);a[o]=new Array(2/e*l,2/e*s)}return e%2==0&&(a[t][1]=0),a}(r);var t=this.complex_transform(r),a=new Array(e/2+1);a[0]=new Array(2*t[0][0],0);for(var n=1;n<a.length;n++)a[n]=new Array(t[n][0]+t[e-n][0],t[e-n][1]-t[n][1]);return a},this.inverse_transform=function(r){if(arguments.length<1)return GlobalClasses.error_code("Fourier","inverse_transform",0);if("object"!=typeof r)return GlobalClasses.error_code("Fourier","inverse_transform",1);if("number"!=typeof r.length)return GlobalClasses.error_code("Fourier","inverse_transform",1);var e=2*(r.length-1);if(e<8||1!=s(e)||0!=r[e/2][1])return function(r){var e=r.length-1,t=2*e;0!=r[e][1]&&t++;for(var a=new Array(t),n=2*Math.PI,o=0;o<t;o++){for(var l=r[0][0]/2,s=1;s<=e;s++)l+=r[s][0]*Math.cos(s*(o/t)*n)+r[s][1]*Math.sin(s*(o/t)*n);t%2==0&&(l-=r[e][0]/2*Math.cos(e*(o/t)*n)),a[o]=l}return a}(r);var t=new Array(e);t[0]=new Array(.5*r[0][0],0);for(var a=1;a<=e/2;a++)t[a]=new Array(.5*r[a][0],-.5*r[a][1]),t[e/2+a-1]=new Array(.5*r[e/2-a+1][0],.5*r[e/2-a+1][1]);var n=i(t),o=new Array(e);for(a=0;a<e;a++)o[a]=n[a][0];return o},this.cosine_transform=function(r){if(arguments.length<1)return GlobalClasses.error_code("Fourier","cosine_transform",0);if(1!=GlobalClasses.is_vector(r))return GlobalClasses.error_code("Fourier","cosine_transform",1);var e=r.length;if(e<8||1!=s(e))return function(r){for(var e=r.length,t=new Array(e),a=Math.PI/e,n=t[0]=0;n<e;n++)t[0]+=r[n];t[0]*=1/e;for(var o=1;o<e;o++){for(n=t[o]=0;n<e;n++)t[o]+=r[n]*Math.cos(o*(n+.5)*a);t[o]*=2/e}return t}(r);for(var t=new Array(2*e),a=0;a<e;a++)t[a]=r[a],t[2*e-a-1]=r[a];var n=this.complex_transform(t),o=this.amplitude(n),l=new Array(e);l[0]=(n[0][0]<0?-1:1)*o[0];for(a=1;a<e;a++)l[a]=2*(n[a][0]<0?-1:1)*o[a];return l},this.inverse_cosine_transform=function(r){if(arguments.length<1)return GlobalClasses.error_code("Fourier","inverse_cosine_transform",0);if(1!=GlobalClasses.is_vector(r))return GlobalClasses.error_code("Fourier","inverse_cosine_transform",1);var e=r.length;if(e<8||1!=s(e))return function(r){for(var e=r.length,t=new Array(e),a=Math.PI/e,n=0;n<e;n++)for(var o=(n+.5)*a,l=t[n]=0;l<e;l++)t[n]+=r[l]*Math.cos(l*o);return t}(r);var t=new Array(2*e);t[0]=new Array(2*r[0],0);for(var a=1;a<e;a++){var n=a*Math.PI/(2*e);t[a]=h(new Array(r[a],0),c(new Array(0,n))),t[2*e-a]=new Array(t[a][0],-t[a][1])}t[e]=new Array(0,0);var o=i(t),l=new Array(e);for(a=0;a<e;a++)l[a]=o[a][0]/2;return l},this.cosine_transform_2d=function(r){if(arguments.length<1)return GlobalClasses.error_code("Fourier","cosine_transform_2d",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("Fourier","cosine_transform_2d",1);for(var e=r.length,t=r[0].length,a=new Array(e),n=0;n<e;n++)a[n]=new Array(t);var o=Math.PI/e,l=Math.PI/t;for(n=0;n<e;n++)for(var s=0;s<t;s++){for(var i=a[n][s]=0;i<e;i++)for(var f=0;f<t;f++)a[n][s]+=r[i][f]*Math.cos(n*(i+.5)*o)*Math.cos(s*(f+.5)*l);a[n][s]*=u(n,e)*u(s,t)}return a},this.inverse_cosine_transform_2d=function(r){if(arguments.length<1)return GlobalClasses.error_code("Fourier","inverse_cosine_transform_2d",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("Fourier","inverse_cosine_transform_2d",1);for(var e=r.length,t=r[0].length,a=new Array(e),n=0;n<e;n++)a[n]=new Array(t);var o=Math.PI/e,l=Math.PI/t;for(n=0;n<e;n++)for(var s=0;s<t;s++)for(var i=(s+.5)*l,f=(n+.5)*o,u=a[n][s]=0;u<e;u++)for(var g=0;g<t;g++)a[n][s]+=r[u][g]*Math.cos(g*i)*Math.cos(u*f);return a}},Fourier=new Fourier_taramathObject,Gbb_taramathObject=function(){var o=0,l=1e-6,u=[],s=[],i=1e20,b=!1,f=0,g=0,t=0,m=0,p=0,x=0,n="",_=0,h=0,c=0,d=0;function v(r){for(var e=r.length,t=new Array(e),a=0;a<e;a++)t[a]=.5*(r[a][0]+r[a][1]);return t}function y(r){for(var e=r.length,t=1,a=0;a<e;a++)t*=r[a][1]-r[a][0];return t}function C(){var r=s.length;Svg.init(n,480,340+40*r),Svg.resize(0,130,0,340+40*r),Svg.clear("#e6e6e6");for(var e=0;e<r;e++){var t=r-e-1;Svg.rect(0,20+40*e,30,30,"#cccccc"),Svg.rect(30,20+40*e,100,30,"#f2f2f2");var a=Math.max(1e-12,glb_array_x_var[t]-s[t][0])/Math.max(1e-12,s[t][1]-s[t][0]);Svg.dot(30+100*a,35+40*e,"#0059c5"),Svg.text(15,35+40*e,glb_array_x_var[t].toFixed(6))}Svg.text(65,30+40*r,"current best-known solution"),Svg.rect(0,60+40*r,30,30,"#cccccc"),Svg.rect(30,60+40*r,100,30,"#f2f2f2"),Svg.rect(30,60+40*r,u.length/h*100,30,"#0059c5"),Svg.text(15,75+40*r,u.length.toFixed(0)),Svg.text(65,110+40*r,"current number of boxes"),Svg.rect(0,140+40*r,30,30,"#cccccc"),Svg.rect(30,140+40*r,100,30,"#f2f2f2");a=100*(1-d/c);0<u.length&&(a=Math.min(a,99.99)),Svg.rect(30,140+40*r,a,30,"#0059c5"),Svg.text(15,155+40*r,a.toFixed(2)+" %"),Svg.text(65,190+40*r,"percentage of inital box discarded"),Svg.rect(0,220+40*r,130,30,"#f2f2f2"),Svg.rect(15,220+40*r,40,30,"#cccccc"),Svg.text(35,235+40*r,o),Svg.text(35,270+40*r,"current number of iterations"),Svg.rect(75,220+40*r,40,30,"#cccccc"),Svg.text(95,235+40*r,i.toFixed(6)),Svg.text(95,270+40*r,"current best-known objective value"),Svg.rect(0,300+40*r,140,40,"#333333"),Svg.text(65,320+40*r,"Branch-and-Bound Monitor","#ffffff"),Svg.draw()}function G(r,e){var t=0;try{"number"==typeof(t=r(1==b?e[0]:e))&&1==isFinite(t)||(t=0,f=1)}catch(r){f=1}return t}function M(r,e,t){this.X=t,this.LB=G(e,t);var a=v(t),n=G(r,a);n<i&&0==f&&(i=n,glb_array_x_var=a),this.LB-l>n&&(g=1)}function a(r,e){1==t?function(r,e){for(var t=u[0].X.length,a=v(u[0].X),n=0;n<1<<t;n++){for(var o=[],l=0;l<t;l++)o.push([u[0].X[l][0],u[0].X[l][1]]);for(l=0;l<t;l++)o[l][n>>l&1]=a[l];u.push(new M(r,e,o))}u.splice(0,1)}(r,e):function(r,e){for(var t=u[0].X.length,a=u[0].X[0][1]-u[0].X[0][0],n=0,o=1;o<t;o++){var l=u[0].X[o][1]-u[0].X[o][0];a<l&&(a=l,n=o)}var s=.5*(u[0].X[n][1]+u[0].X[n][0]),i=[];for(o=0;o<t;o++)i.push([u[0].X[o][0],u[0].X[o][1]]);i[n][0]=s,u.push(new M(r,e,i));var f=[];for(o=0;o<t;o++)f.push([u[0].X[o][0],u[0].X[o][1]]);f[n][1]=s,u.push(new M(r,e,f)),u.splice(0,1)}(r,e)}function w(r,e){0<u.length&&(a(r,e),o++),1==f&&(u=[]);for(var t=0;t<u.length;)u[t].LB+l>i?(d-=y(u[t].X),u.splice(t,1)):t++;h=Math.max(h,u.length)}function A(r,e,t){if(u=[],1==GlobalClasses.is_vector(t)&&2==t.length){b=!0;var a=[[Math.min(t[0],t[1]),Math.max(t[0],t[1])]];s=[[a[0][0],a[0][1]]];var n=new M(r,e,a);return u.push(n),c=y(u[0].X),d=c,!0}if(1!=GlobalClasses.is_matrix(t)||2!=t[0].length)return!1;b=!1;for(var o=t.length,l=(a=new Array(o),0);l<o;l++)a[l]=[Math.min(t[l][0],t[l][1]),Math.max(t[l][0],t[l][1])];s=new Array(o);for(l=0;l<o;l++)s[l]=[a[l][0],a[l][1]];n=new M(r,e,a);return u.push(n),c=y(u[0].X),d=c,!0}function P(r){if(1==b)return t=.5*((e=r)[0]+e[1]),a=m(t),n=x(t),o=a+n*(e[0]-t)-p(e[0]),l=a+n*(e[1]-t)-p(e[1]),Math.min(o,l);for(var e,t,a,n,o,l,s=r.length,i=1<<s,f=new Array(s),u=0;u<s;u++)f[u]=.5*(r[u][0]+r[u][1]);for(var g=new Array(i),_=0;_<i;_++)g[_]=new Array(s);for(_=0;_<i;_++)for(u=0;u<s;u++)g[_][u]=_>>u&!0?r[u][0]:r[u][1];var h=m(f),c=x(f),d=new Array(i);for(_=0;_<i;_++)d[_]=h-p(g[_]);for(_=0;_<i;_++)for(u=0;u<s;u++)d[_]+=c[u]*(g[_][u]-f[u]);var v=d[0];for(_=1;_<i;_++)v=Math.min(v,d[_]);return v}this.set_accuracy=function(r){return arguments.length<1?GlobalClasses.error_code("Gbb","set_accuracy",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("Gbb","set_accuracy",1):(l=Math.min(1,Math.max(r,1e-12)),!0)},this.get_number_of_iterations=function(){return o},this.define_method=function(r){if(arguments.length<1)return GlobalClasses.error_code("Gbb","define_method",0);if(1!=GlobalClasses.is_string(r))return GlobalClasses.error_code("Gbb","define_method",1);var e=r.trim().toLowerCase().replace("-","").replace("_","");return"bisect"==e&&(t=0),"full"==e&&(t=1),!0},this.minimize=function(r,e,t){if(arguments.length<3)return GlobalClasses.error_code("Gbb","minimize",0);if(1!=GlobalClasses.is_function(r))return GlobalClasses.error_code("Gbb","minimize",1);if(1!=GlobalClasses.is_function(e))return GlobalClasses.error_code("Gbb","minimize",1);if(1!=GlobalClasses.is_vector(t)&&1!=GlobalClasses.is_matrix(t))return GlobalClasses.error_code("Gbb","minimize",1);if(i=1e20,(h=g=f=o=0)==A(r,e,t)||1==f)return GlobalClasses.error_code("Gbb","minimize",23);for(;0<u.length;)w(r,e);return 1==g&&GlobalClasses.warning_code("Gbb","minimize","Some lower bounds larger than objective function at center of box."),1==f?GlobalClasses.error_code("Gbb","minimize",10):1==b?[glb_array_x_var[0],i]:[glb_array_x_var,i]},this.monitor=function(r,e,t,a){return arguments.length<4?GlobalClasses.error_code("Gbb","monitor",0):1!=GlobalClasses.is_function(r)?GlobalClasses.error_code("Gbb","monitor",1):1!=GlobalClasses.is_function(e)?GlobalClasses.error_code("Gbb","monitor",1):1!=GlobalClasses.is_vector(t)&&1!=GlobalClasses.is_matrix(t)?GlobalClasses.error_code("Gbb","monitor",1):1!=GlobalClasses.is_div(a)?GlobalClasses.error_code("Gbb","monitor",11):(i=1e20,n=a,(h=g=f=o=0)==A(r,e,t)||1==f?GlobalClasses.error_code("Gbb","monitor",23):(C(),_=window.setInterval(function(){!function(r,e){for(var t=Date.now();w(r,e),0<u.length&&Date.now()-t<100;);C(),0==u.length&&window.clearInterval(_)}(r,e)},100),!0))},this.dc=function(r,e,t,a,n){if(arguments.length<5)return GlobalClasses.error_code("Gbb","dc",0);if(1!=GlobalClasses.is_function(r))return GlobalClasses.error_code("Gbb","dc",1);if(1!=GlobalClasses.is_function(e))return GlobalClasses.error_code("Gbb","dc",1);if(1!=GlobalClasses.is_function(t))return GlobalClasses.error_code("Gbb","dc",1);if(1!=GlobalClasses.is_function(a))return GlobalClasses.error_code("Gbb","dc",1);if(1!=GlobalClasses.is_vector(n)&&1!=GlobalClasses.is_matrix(n))return GlobalClasses.error_code("Gbb","dc",1);if(i=1e20,m=e,p=t,x=a,(h=g=f=o=0)==A(r,P,n)||1==f)return GlobalClasses.error_code("Gbb","dc",23);for(;0<u.length;)w(r,P);return 1==g&&GlobalClasses.warning_code("Gbb","dc","Some lower bounds larger than objective function at center of box."),1==f?GlobalClasses.error_code("Gbb","dc",10):1==b?[glb_array_x_var[0],i]:[glb_array_x_var,i]}},Gbb=new Gbb_taramathObject,GeneticAlgorithm_taramathObject=function(){var f=100,u=800,g=1e3,_=.02;function h(r){for(var e=[],t=0;t<r;t++)e.push(t);for(t=0;t<r;t++){var a=Math.floor(r*Math.random()),n=Math.floor(r*Math.random()),o=e[a];e[a]=e[n],e[n]=o}return e}function c(r,e){for(var t=r.length,a=[],n=[],o=0;o<t;o++)a.push(-1);for(o=0;o<t;o++)n.push(-1);var l=[],s=[];for(o=0;o<t;o++)l.push(-1);for(o=0;o<t;o++)s.push(-1);var i=2+Math.floor((t-2)*Math.random()),f=Math.floor(t*Math.random()),u=Math.floor(t*Math.random());for(o=0;o<i;o++)a[(f+o)%t]=e[(u+o)%t],n[(u+o)%t]=r[(f+o)%t],l[e[(u+o)%t]]=(f+o)%t,s[r[(f+o)%t]]=(u+o)%t;for(o=0;o<t;o++)-1==a[o]&&-1==l[r[o]]&&(a[o]=r[o],l[r[o]]=o),-1==n[o]&&-1==s[e[o]]&&(n[o]=e[o],s[e[o]]=o);for(o=0;o<t;o++){if(-1==a[o]){for(var g=r[o];-1!=l[g];)g=r[l[g]];l[a[o]=g]=o}if(-1==n[o]){for(g=e[o];-1!=s[g];)g=e[s[g]];s[n[o]=g]=o}}if(Math.random()<_){f=Math.floor(t*Math.random()),u=Math.floor(t*Math.random()),g=a[f];a[f]=a[u],a[u]=g}if(Math.random()<_){f=Math.floor(t*Math.random()),u=Math.floor(t*Math.random()),g=n[f];n[f]=n[u],n[u]=g}return[a,n]}this.set_size_of_population=function(r){return arguments.length<1?GlobalClasses.error_code("GeneticAlgorithm","set_size_of_population",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("GeneticAlgorithm","set_size_of_population",1):(f=Math.min(1e8,Math.max(Math.round(r),2)),u=8*f,1<arguments.length&&1==GlobalClasses.is_number(arguments[1])&&(u=Math.min(1e8,Math.max(Math.round(arguments[1]),2))),!0)},this.set_number_of_iterations=function(r){return arguments.length<1?GlobalClasses.error_code("GeneticAlgorithm","set_number_of_iterations",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("GeneticAlgorithm","set_number_of_iterations",1):(g=Math.max(Math.round(r),1),!0)},this.set_mutation_rate=function(r){return arguments.length<1?GlobalClasses.error_code("GeneticAlgorithm","set_mutation_rate",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("GeneticAlgorithm","set_mutation_rate",1):(_=Math.min(1,Math.max(r,0)),!0)},this.permutation=function(r,e){if(2!=arguments.length)return GlobalClasses.error_code("GeneticAlgorithm","permutation",0);if(1!=GlobalClasses.is_function(r))return GlobalClasses.error_code("GeneticAlgorithm","permutation",1);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("GeneticAlgorithm","permutation",1);var t=Math.round(e);if(t<3)return GlobalClasses.error_code("GeneticAlgorithm","permutation","Permutation too short.");if(1!=function(r,e){var t="fail";try{t=r(e),1!=isFinite(t)&&(t="fail")}catch(r){t="fail"}return"number"==typeof t}(r,o=h(t)))return GlobalClasses.error_code("GeneticAlgorithm","permutation","Invalid input data, method not applicable.");for(var a=[],n=0;n<f;n++){var o=h(t);a.push({x:o,v:r(o)})}a.sort(function(r,e){return r.v-e.v});for(e=0;e<g;e++){for(n=0;n<u;n++){var l=Math.floor(f*Math.pow(Math.random(),2)),s=Math.floor(f*Math.pow(Math.random(),2)),i=c(a[l].x,a[s].x);a.push({x:i[0],v:r(i[0])}),a.push({x:i[1],v:r(i[1])})}a.sort(function(r,e){return r.v-e.v}),a.splice(f)}return a[0].x}},GeneticAlgorithm=new GeneticAlgorithm_taramathObject,GlobalClasses_taramathObject=function(){var glb_array_error_cal=["Invalid number of function arguments.","Invalid function argument.","Improper matrix or vector dimension.","Matrix is not regular.","Matrix is not positive definite.","Matrix is not symmetrical.","Matrix is not square.","Decomposition does not exist.","Matrix diagonal-elements are not allowed to be zero.","Maximum number of iterations executed, method aborted.","Unexpected failure.","DIV-element does not exist.","TEXTAREA-element does not exist.","Function not initialized yet.","No solution calculated yet.","No function or list defined yet.","No points defined yet.","No mesh defined yet.","Point already exists.","Linear programming problem is unbounded.","Linear programming problem is infeasible.","Linear programming problem is unbounded, infeasible, or ill-posed.","Integer programming problem is unbounded, infeasible, or ill-posed.","Invalid input data, method not applicable.","Invalid function string.","Optimization problem unbounded or ill-posed."],glb_array_warning_cal=["Negative values treated as zero.","Lower bound larger than objective value at center of box."],glb_array_color_cal=[[7,1,142],[7,7,147],[6,13,152],[6,20,157],[6,26,162],[5,33,167],[5,39,172],[5,45,177],[4,52,182],[4,59,188],[4,65,193],[3,71,198],[3,77,203],[3,84,209],[3,91,214],[2,97,219],[2,103,224],[2,110,229],[1,116,234],[1,123,240],[1,129,245],[0,135,250],[0,142,255],[0,149,255],[0,156,255],[0,163,255],[0,170,255],[0,177,255],[0,184,255],[0,191,255],[0,197,255],[0,205,255],[0,212,255],[0,219,255],[0,225,255],[0,233,255],[0,240,255],[0,247,255],[0,253,255],[11,254,244],[24,254,231],[36,254,219],[47,254,207],[59,254,195],[72,254,182],[84,254,170],[96,254,158],[108,254,146],[121,254,133],[133,254,121],[145,254,109],[156,254,97],[165,254,88],[174,254,79],[182,254,71],[191,254,63],[199,254,55],[208,255,46],[216,255,38],[224,255,30],[232,255,22],[241,255,13],[249,255,5],[254,251,0],[254,240,0],[254,228,0],[254,216,0],[254,205,0],[254,194,0],[254,183,0],[254,171,0],[254,160,0],[254,149,0],[254,138,0],[255,126,0],[255,115,0],[255,104,0],[255,93,0],[255,82,0],[255,70,0],[255,59,0],[255,48,0],[255,37,0],[255,24,0],[255,13,0],[255,2,0],[248,0,0],[239,0,0],[231,0,0],[222,0,0],[214,0,0],[205,0,0],[196,0,0],[188,0,0],[179,0,0],[171,0,0],[162,0,0],[153,0,0],[145,0,0],[136,0,0],[128,0,0]],glb_array_error_log_var=[],glb_array_warning_log_var=[];function string_replace_all(r,e,t){for(var a=r;-1<a.indexOf(e);)a=a.replace(e,t);return a}function string_to_function(r){var e=r.replace(/\s/g,"");if(-1<(e=e.replace(/\[/g,"(").replace(/\]/g,")")).indexOf("#"))return!1;if(-1<e.indexOf("{"))return!1;if(-1<e.indexOf("}"))return!1;for(var t=0,a=1;a<=e.length;a++)-1<e.indexOf("x"+a.toFixed(0))&&(t=a);0==t&&(-1<(e=string_replace_all(e=string_replace_all(e=string_replace_all(e=string_replace_all(e=string_replace_all(e=string_replace_all(e=string_replace_all(e,"exp","e8p"),"max","ma8"),"x","#"),"#","x1"),"e8p","exp"),"ma8","max"),"y","x2")).indexOf("x1")&&(t=1),-1<e.indexOf("x2")&&(t=2));for(a=1;a<=t;a++)e=string_replace_all(e=(e=string_replace_all(e,"x"+a.toFixed(0),"y")).replace(/(y\^)(\-)?[0-9]+(\.[0-9]+)?/g,function(r){return"pow(y,"+r.split("^")[1]+")"}),"y","x"+a.toFixed(0));return!(-1<e.indexOf("^"))&&[e,t]}function color_char(r){for(var e="0123456789abcdef",t="0",a=1;a<e.length;a++)r==e[a]&&(t=r);return t}function check_color_string(r){var e=r.replace("#","").toLowerCase();if(3==e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6!=e.length)return"none";for(var t="#",a=0;a<6;a++)t+=color_char(e[a]);return t}function byte_to_hex(r){var e=Math.max(0,Math.min(Math.round(r),255)),t="0123456789abcdef";return t.charAt((e-e%16)/16)+t.charAt(e%16)}function check_color_vector(r){for(var e=r;e.length<3;)e.push(0);return"#"+byte_to_hex(e[0])+byte_to_hex(e[1])+byte_to_hex(e[2])}this.get_color_table=function(){return glb_array_color_cal},this.check_function_string_array=function(t){var u=string_to_function(t);if(0==u)return!1;for(var s=u[0],n=u[1],k=1;k<=n;k++)s=string_replace_all(s,"x"+k.toFixed(0),"x["+(k-1).toFixed(0)+"]");for(var x=new Array(n),k=0;k<n;k++)x[k]=0;try{with(Math)var z=eval(s)}catch(r){return!1}return s},this.check_function_string_x=function(t){var u=string_to_function(t);if(0==u)return!1;var s=u[0],n=u[1];if(1<n)return!1;s=string_replace_all(s,"x1","x");var x=0;try{with(Math)var z=eval(s)}catch(r){return!1}return s},this.check_function_string_xy=function(t){var u=string_to_function(t);if(0==u)return!1;var s=u[0],n=u[1];if(2<n)return!1;s=string_replace_all(s,"x1","x"),s=string_replace_all(s,"x2","y");var x=0,y=0;try{with(Math)var z=eval(s)}catch(r){return!1}return s},this.is_string=function(r){return"string"==typeof r},this.is_boolean=function(r){return"boolean"==typeof r},this.is_function=function(r){return"function"==typeof r},this.is_number=function(r){return"number"==typeof r&&isFinite(r)},this.is_vector=function(r){if("object"!=typeof r)return!1;var e=r.length;if("number"!=typeof e||e<1)return!1;for(var t=0;t<e;t++)if("number"!=typeof r[t])return!1;return!0},this.is_matrix=function(r){if("object"!=typeof r)return!1;var e=r.length;if("number"!=typeof e||e<1)return!1;if("object"!=typeof r[0])return!1;var t=r[0].length;if("number"!=typeof t||t<1)return!1;for(var a=1;a<e;a++)if("object"!=typeof r[a]||r[a].length!=t)return!1;for(a=0;a<e;a++)for(var n=0;n<t;n++)if("number"!=typeof r[a][n])return!1;return!0},this.is_div=function(r){if("string"!=typeof r)return!1;if(!document.getElementById(r))return!1;var e=document.getElementById(r).nodeName;return"DIV"==e||"SPAN"==e||"TD"==e||"TR"==e||"P"==e},this.is_textarea=function(r){return"string"==typeof r&&(!!document.getElementById(r)&&"TEXTAREA"==document.getElementById(r).nodeName)},this.check_color=function(r){return 0!=this.is_string(r)?check_color_string(r):0!=this.is_vector(r)?check_color_vector(r):"none"},this.error_code=function(r,e,t){var a=t;return"number"==typeof t&&(a=glb_array_error_cal[t]),glb_array_error_log_var.push([r,e,a]),a},this.get_error_log=function(){return glb_array_error_log_var},this.warning_code=function(r,e,t){var a=t;"number"==typeof t&&(a=glb_array_warning_cal[t]),glb_array_warning_log_var.push([r,e,a])},this.get_warning_log=function(){return glb_array_warning_log_var}},GlobalClasses=new GlobalClasses_taramathObject,Graph_taramathObject=function(){function i(r,e){return Math.sqrt((r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1]))}function _(r){for(var e=r.length,t=0,a=[],n=0;n<e;n++){var o=[Math.round(r[n][0]),Math.round(r[n][1])];a.push([Math.min(o[0],o[1]),Math.max(o[0],o[1])]),t=Math.min(t,Math.min(o[0],o[1]))}if(t<0)for(n=0;n<e;n++)a[n][0]-=t,a[n][1]-=t;return a}function h(r){for(var e=0,t=0;t<r.length;t++)e=Math.max(e,Math.max(r[t][0],r[t][1]));return e+1}function a(r){for(var e=r.length,t=h(r),a=new Array(t),n=0;n<t;n++)a[n]=n;for(var o=t,l=0;l<e;l++){var s=[a[r[l][0]],a[r[l][1]]];if(s[0]!=s[1]){for(n=0;n<t;n++)a[n]==s[1]&&(a[n]=s[0]);o--}}return o}function c(r){for(var e=r.length,t=0;t<e;t++)if(r[t][0]==r[t][1])return!1;var a=[];for(t=0;t<e;t++)a.push([Math.min(r[t][0],r[t][1]),Math.max(r[t][0],r[t][1])]);a.sort(function(r,e){return r[0]!=e[0]?r[0]-e[0]:r[1]-e[1]});for(t=1;t<e;t++)if(a[t-1][0]==a[t][0]&&a[t-1][1]==a[t][1])return!1;return!0}function d(r){for(var e=r.length,t=h(r),a=[],n=0;n<t;n++)a.push([]);for(var o=0;o<e;o++)a[r[o][0]].push(r[o][1]),a[r[o][1]].push(r[o][0]);return a}function o(r,e,t){if(t.length<2)return[360];for(var a=[],n=0;n<t.length;n++){var o=[r[t[n]][0]-r[e][0],r[t[n]][1]-r[e][1]],l=180/Math.PI*Math.atan2(o[1],o[0]);l<0&&(l+=360),a.push(l)}a.sort(function(r,e){return r-e});var s=[];for(n=1;n<a.length;n++)s.push(a[n]-a[n-1]);return s.push(a[0]+(360-a[a.length-1])),s.sort(function(r,e){return r-e})}function g(r,e){for(var t=[],a=0;a<r.length;a++)t.push(o(e,a,r[a]));var n=360;for(a=0;a<r.length;a++)n=Math.min(n,t[a][0]);return n}function v(r,e){for(var t=0;t<e.length;t++)if(e[t]==r)return!0;return!1}function b(r){for(var e=h(r),t=r.length,a=d(r),n=0;n<e;n++)a[n].push(n);var o=[];for(n=0;n<e;n++)o.push([]);for(var l=0;l<t;l++)for(n=0;n<e;n++)1==v(r[l][0],a[n])&&1==v(r[l][1],a[n])&&o[n].push([r[l][0],r[l][1]]);for(var s=[],i=0;i<e;i++){for(var f=0,u=-1;f<e;){var g=a[f].length;0<g&&o[f].length==Math.round(g*(g-1)/2)&&(u=f,f=e),f++}if(-1==u)return"Graph is not chordal";s.push(u),a[u]=[],o[u]=[];for(n=0;n<e;n++)for(l=0;l<a[n].length;)a[n][l]==u?a[n].splice(l,1):l++;for(n=0;n<e;n++)for(l=0;l<o[n].length;)o[n][l][0]==u||o[n][l][1]==u?o[n].splice(l,1):l++}return s}function t(r){for(var e=h(r),t=d(r),a=[],n=0;n<e;n++)a.push([0,-1]);for(var o=e,l=[];0<o;){for(var s=0;0!=a[s][0];)s++;for(l.push(s),a[s]=[1,0];0<l.length;){var i=l[0];l.splice(0,1),o--;var f=(a[i][1]+1)%2;for(n=0;n<t[i].length;n++){var u=t[i][n];if(a[u][1]<0)a[u][1]=f;else if(a[u][1]!=f)return"fail";0==a[u][0]&&(l.push(u),a[u][0]=1)}}}var g=[],_=[];for(n=0;n<e;n++)0==a[n][1]?g.push(n):_.push(n);return{L:g,R:_}}function f(r,e,t,a){for(var n=h(r),o=function(r,e){for(var t=r.length,a=h(r),n=[],o=0;o<a;o++)n.push([]);for(var l=0;l<t;l++)n[r[l][0]].push([r[l][1],l]),n[r[l][1]].push([r[l][0],l]);return n}(r),l=[],s=0;s<n;s++)l.push([0,-1,-1,-1]);var i=e;for(l[i][2]=0;0<=i;){l[i][0]=1;for(s=0;s<o[i].length;s++){var f=o[i][s][0],u=l[i][2]+a[o[i][s][1]];(l[f][2]<0||u<l[f][2])&&(l[f][1]=i,l[f][2]=u,l[f][3]=o[i][s][1])}var g=i=-1;for(s=0;s<n;s++)0==l[s][0]&&0<=l[s][2]&&(g<0||l[s][2]<g)&&(g=l[i=s][2]);0<=t&&1==l[t][0]&&(i=-1)}return l}function u(r,e){if(r.length<2)return 0;if(1!=GlobalClasses.is_matrix(r[0]))return 1;if(2!=r[0][0].length)return 1;var t=_(r[0]),a=h(t);if(1!=GlobalClasses.is_number(r[1]))return 1;var n=Math.round(r[1]);if(n<0||a<=n)return"Source node is not a vertex of the graph.";var o=-1;if(1==e){if(r.length<3)return 0;if(1==GlobalClasses.is_number(r[2])&&(o=Math.round(r[2])),o<0||a<=o)return"Target node is not a vertex of the graph."}for(var l=[],s=0;s<t.length;s++)l.push(1);var i=r.length-1;1==GlobalClasses.is_vector(r[i])&&r[i].length==t.length&&(l=r[i]);for(s=0;s<l.length;s++)if(l[s]<0)return"Non-negativ weights expected.";return[t,n,o,l]}function m(r,e){for(var t=[r[0][0],r[0][0]],a=[r[0][1],r[0][1]],n=1;n<r.length;n++)t[0]=Math.min(t[0],r[n][0]),t[1]=Math.max(t[1],r[n][0]),a[0]=Math.min(a[0],r[n][1]),a[1]=Math.max(a[1],r[n][1]);var o=t[1]-t[0],l=a[1]-a[0],s=Math.max(o,l);s<=0&&(s=1);var i=o<s?(s-o)/2:0,f=l<s?(s-l)/2:0,u=[];for(n=0;n<r.length;n++)u.push([e*((r[n][0]-t[0]+i)/s*.8+.1),e*((r[n][1]-a[0]+f)/s*.8+.1)]);return u}function p(r,e,t){for(var a=0;a<r.length;a++){var n=(o=e[r[a][0]],l=e[r[a][1]],[(o[0]+l[0])/2,(o[1]+l[1])/2]);Svg.rect(n[0]-16,n[1]-8,32,16,"#222222"),Svg.text(n[0],n[1],t[a].toFixed(1),"#ffffff")}var o,l}function x(r,e,t){var a=i(r,e);if(a<=2*t)return"fail";var n=[(e[0]-r[0])/a,(e[1]-r[1])/a],o=[r[0]+t*n[0],r[1]+t*n[1]],l=[e[0]-t*n[0],e[1]-t*n[1]];return[o[0],o[1],l[0],l[1]]}this.is_simple=function(r){return arguments.length<1?GlobalClasses.error_code("Graph","is_simple",0):1!=GlobalClasses.is_matrix(r)?GlobalClasses.error_code("Graph","is_simple",1):2!=r[0].length?GlobalClasses.error_code("Graph","is_simple",1):c(_(r))},this.is_connected=function(r){return arguments.length<1?GlobalClasses.error_code("Graph","is_connected",0):1!=GlobalClasses.is_matrix(r)?GlobalClasses.error_code("Graph","is_connected",1):2!=r[0].length?GlobalClasses.error_code("Graph","is_connected",1):1==a(_(r))},this.is_tree=function(r){if(arguments.length<1)return GlobalClasses.error_code("Graph","is_tree",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("Graph","is_tree",1);if(2!=r[0].length)return GlobalClasses.error_code("Graph","is_tree",1);var e=_(r),t=h(e);return 1==c(e)&&(1==a(e)&&e.length==t-1)},this.adjacency_matrix=function(r){if(arguments.length<1)return GlobalClasses.error_code("Graph","adjacency_matrix",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("Graph","adjacency_matrix",1);if(2!=r[0].length)return GlobalClasses.error_code("Graph","adjacency_matrix",1);for(var e=_(r),t=h(e),a=LinearAlgebra.zero_matrix(t),n=0;n<e.length;n++)a[e[n][0]][e[n][1]]++,a[e[n][1]][e[n][0]]++;return a},this.incidence_matrix=function(r){if(arguments.length<1)return GlobalClasses.error_code("Graph","incidence_matrix",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("Graph","incidence_matrix",1);if(2!=r[0].length)return GlobalClasses.error_code("Graph","incidence_matrix",1);for(var e=_(r),t=e.length,a=h(e),n=LinearAlgebra.zero_matrix(a,t),o=0;o<e.length;o++)n[e[o][0]][o]++,n[e[o][1]][o]++;return n},this.degree=function(r){if(arguments.length<1)return GlobalClasses.error_code("Graph","degree",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("Graph","degree",1);if(2!=r[0].length)return GlobalClasses.error_code("Graph","degree",1);for(var e=d(_(r)),t=0,a=0;a<e.length;a++)t=Math.max(t,e[a].length);return t},this.random=function(r){if(arguments.length<1)return GlobalClasses.error_code("Graph","random",0);if(1!=GlobalClasses.is_number(r))return GlobalClasses.error_code("Graph","random",1);for(var e=Math.max(3,Math.round(r)),t=ComputationalGeometry.random_points(e),a=ComputationalGeometry.delaunay(t),n=[],o=0;o<a.length;o++){var l=[a[o][0],a[o][1],a[o][2]];l.sort(function(r,e){return r-e}),n.push([l[0],l[1]]),n.push([l[0],l[2]]),n.push([l[1],l[2]])}n.sort(function(r,e){return r[0]!=e[0]?r[0]-e[0]:r[1]-e[1]});for(o=n.length-1;0<o;o--)n[o-1][0]==n[o][0]&&n[o-1][1]==n[o][1]&&n.splice(o,1);var s=[];for(o=0;o<n.length;o++)s.push(i(t[n[o][0]],t[n[o][1]]));return{E:n,L:t,w:s}},this.complete=function(r){if(arguments.length<1)return GlobalClasses.error_code("Graph","complete",0);if(1!=GlobalClasses.is_number(r))return GlobalClasses.error_code("Graph","complete",1);for(var e=Math.max(3,Math.round(r)),t=[],a=0;a<e;a++)t.push([50+40*Math.cos(2*Math.PI*a/e),50+40*Math.sin(2*Math.PI*a/e)]);for(var n=[],o=0;o<e-1;o++)for(var l=o+1;l<e;l++)n.push([o,l]);var s=[];for(a=0;a<n.length;a++)s.push(1);return{E:n,L:t,w:s}},this.interval=function(r){if(arguments.length<1)return GlobalClasses.error_code("Graph","interval",0);if(1!=GlobalClasses.is_number(r))return GlobalClasses.error_code("Graph","interval",1);var e=Math.max(3,Math.round(r)),t=1;1<arguments.length&&1==GlobalClasses.is_number(arguments[1])&&(t=Math.max(0,Math.min(2*(1-arguments[1]),2)));for(var a=[],n=0,o=0;o<e;o++)a.push([n,n+.5+6*Math.random()]),n+=.2+t+Math.random();a[e-1][0]>=a[e-2][1]&&(a[e-1][0]=a[e-2][1]-.1);var l=[];for(o=0;o<e-1;o++)for(var s=o+1,i=0;s<e&&0==i;)a[s][0]<=a[o][1]?l.push([o,s]):i=1,s++;var f=function(r,e){for(var t=d(r);t.length<e;)t.push([]);for(var a=[],n=0;n<e;n++)a.push([n,6*Math.random()]);var o=g(t,a);for(n=0;n<2e3/e;n++){var l=Math.floor(e*Math.random()),s=Math.floor(e*Math.random()),i=a[l][1],f=a[s][1];a[l][1]=6*Math.random(),a[s][1]=6*Math.random();var u=g(t,a);u<o?(a[l][1]=i,a[s][1]=f):o=u}return a}(l,e),u=[];for(o=0;o<l.length;o++)u.push(1);return{E:l,L:f,w:u,I:a}},this.perfect_elimination=function(r){if(arguments.length<1)return GlobalClasses.error_code("Graph","perfect_elimination",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("Graph","perfect_elimination",1);if(2!=r[0].length)return GlobalClasses.error_code("Graph","perfect_elimination",1);var e=_(r);if(1!=c(e))return GlobalClasses.error_code("Graph","perfect_elimination","Graph is not simple.");var t=b(e);return"string"==typeof t?GlobalClasses.error_code("Graph","perfect_elimination",t):t},this.is_chordal=function(r){if(arguments.length<1)return GlobalClasses.error_code("Graph","is_chordal",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("Graph","is_chordal",1);if(2!=r[0].length)return GlobalClasses.error_code("Graph","is_chordal",1);var e=_(r);return 1!=c(e)?GlobalClasses.error_code("Graph","is_chordal","Graph is not simple."):"string"!=typeof b(e)},this.coloring=function(r){if(arguments.length<1)return GlobalClasses.error_code("Graph","coloring",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("Graph","coloring",1);if(2!=r[0].length)return GlobalClasses.error_code("Graph","coloring",1);var e=_(r);if(1!=c(e))return GlobalClasses.error_code("Graph","coloring","Graph is not simple.");var t=b(e);if("string"==typeof t)return GlobalClasses.error_code("Graph","coloring",t);var a=d(e);if(a.length!=t.length)return GlobalClasses.error_code("Graph","coloring","Unexpected failure.");for(var n=a.length,o=[],l=0;l<n;l++)o.push(-1);for(l=n-1;0<=l;l--){for(var s=t[l],i=[],f=0;f<a[s].length;f++)-1!=o[a[s][f]]&&i.push(o[a[s][f]]);i.sort(function(r,e){return r-e});var u=-1,g=0;for(i.length<1?u=0:0<i[0]&&(u=0);-1==u&&g<i.length-1;)1<i[g+1]-i[g]&&(u=i[g]+1),g++;-1==u&&(u=i[i.length-1]+1),o[s]=u}return o},this.spanning_tree=function(r){if(arguments.length<1)return GlobalClasses.error_code("Graph","spanning_tree",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("Graph","spanning_tree",1);if(2!=r[0].length)return GlobalClasses.error_code("Graph","spanning_tree",1);var e=[];if(2<=arguments.length&&1==GlobalClasses.is_vector(arguments[1])&&arguments[1].length==r.length)e=arguments[1];else for(var t=0;t<r.length;t++)e.push(1);return function(r,e){for(var t=r.length,a=h(r),n=Sort.permutation(e),o=[],l=[],s=new Array(a),i=0;i<a;i++)s[i]=i;for(var f=a,u=0;u<t;u++){var g=[s[r[n[u]][0]],s[r[n[u]][1]]];if(g[0]!=g[1]){for(o.push([r[n[u]][0],r[n[u]][1]]),l.push(e[n[u]]),i=0;i<a;i++)s[i]==g[1]&&(s[i]=g[0]);1==--f&&(u=t)}}return{E:o,w:l}}(r,e)},this.bipartite=function(r){if(arguments.length<1)return GlobalClasses.error_code("Graph","bipartite",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("Graph","bipartite",1);if(2!=r[0].length)return GlobalClasses.error_code("Graph","bipartite",1);var e=t(_(r));return"string"==typeof e?GlobalClasses.error_code("Graph","bipartite","Graph is not bipartite."):{L:e.L,R:e.R}},this.is_bipartite=function(r){return arguments.length<1?GlobalClasses.error_code("Graph","is_bipartite",0):1!=GlobalClasses.is_matrix(r)?GlobalClasses.error_code("Graph","is_bipartite",1):2!=r[0].length?GlobalClasses.error_code("Graph","is_bipartite",1):"string"!=typeof t(_(r))},this.shortest_path=function(){var r=u(arguments,1);if("number"==typeof r||"string"==typeof r)return GlobalClasses.error_code("Graph","shortest_path",r);var e=r[0],t=r[1],a=r[2],n=r[3];if(t==a)return{p:[t],s:[]};var o=f(e,t,a,n);if(-1==o[a][1])return GlobalClasses.error_code("Graph","shortest_path","Path does not exist.");for(var l=a,s=[l],i=[];-1<o[l][1];)i.push(o[l][3]),l=o[l][1],s.push(l);return{p:s.reverse(),s:i.reverse()}},this.distance=function(){var r=u(arguments,1);if("number"==typeof r||"string"==typeof r)return GlobalClasses.error_code("Graph","distance",r);var e=r[0],t=r[1],a=r[2],n=r[3];if(t==a)return 0;var o=f(e,t,a,n);return-1==o[a][1]?GlobalClasses.error_code("Graph","distance","Path does not exist."):o[a][2]},this.shortest_path_tree=function(){var r=u(arguments,0);if("number"==typeof r||"string"==typeof r)return GlobalClasses.error_code("Graph","shortest_path_tree",r);for(var e=r[0],t=r[1],a=(r[2],r[3]),n=f(e,t,-1,a),o=[],l=[],s=0;s<n.length;s++)-1<n[s][3]&&(o.push([e[n[s][3]][0],e[n[s][3]][1]]),l.push(a[n[s][3]]));return{E:o,w:l}},this.plot=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("Graph","plot",0);if(1!=GlobalClasses.is_div(r))return GlobalClasses.error_code("Graph","plot",11);if(1!=GlobalClasses.is_matrix(e))return GlobalClasses.error_code("Graph","plot",1);if(2!=e[0].length)return GlobalClasses.error_code("Graph","plot",1);var t=_(e);1!=c(t)&&GlobalClasses.warning_code("Graph","plot","Graph is not simple.");for(var a=h(t),n=t.length,o=[],l=0;l<a;l++)o.push([Math.cos(2*Math.PI*l/a),Math.sin(2*Math.PI*l/a)]);for(var s=[],i=-1,f="small",u=2;u<arguments.length;u++){var g=arguments[u];1==GlobalClasses.is_matrix(g)&&g.length>=a&&2==g[0].length&&(o=g),1==GlobalClasses.is_vector(g)&&g.length==n&&(s=g),1==GlobalClasses.is_number(g)&&20<=g&&(i=Math.round(g)),1==GlobalClasses.is_string(g)&&(f=g)}switch(f){case"tiny":!function(r,e,t,a,n){var o=0<n?n:200,l=m(t,o);Svg.init(r,o,o),Svg.resize(0,o,0,o),Svg.clear("#f8f8f8");for(var s=0;s<e.length;s++){var i=x(l[e[s][0]],l[e[s][1]],0);"string"!=typeof i&&Svg.line(i[0],i[1],i[2],i[3],"#222222")}a.length==e.length&&p(e,l,a);for(var f=0;f<l.length;f++)Svg.disc(l[f][0],l[f][1],4,"#222222");Svg.draw()}(r,t,o,s,i);break;case"medium":!function(r,e,t,a,n){var o=0<n?n:640,l=m(t,o);Svg.init(r,o,o),Svg.resize(0,o,0,o),Svg.clear("#f8f8f8");for(var s=0;s<e.length;s++){var i=x(l[e[s][0]],l[e[s][1]],10.5);"string"!=typeof i&&Svg.line(i[0],i[1],i[2],i[3],"#222222")}a.length==e.length&&p(e,l,a);for(var f=0;f<l.length;f++)Svg.disc(l[f][0],l[f][1],7,"#e8e8e8","#222222");Svg.draw()}(r,t,o,s,i);break;case"large":!function(r,e,t,a,n){var o=0<n?n:800,l=m(t,o);Svg.init(r,o,o),Svg.resize(0,o,0,o),Svg.clear("#f8f8f8");for(var s=0;s<e.length;s++){var i=x(l[e[s][0]],l[e[s][1]],14);"string"!=typeof i&&Svg.line(i[0],i[1],i[2],i[3],"#222222")}a.length==e.length&&p(e,l,a);for(var f=0;f<l.length;f++)Svg.disc(l[f][0],l[f][1],10,"#e8e8e8","#222222"),Svg.text(l[f][0],l[f][1]-1,f.toFixed(0));Svg.draw()}(r,t,o,s,i);break;case"huge":!function(r,e,t,a,n){var o=0<n?n:1200,l=m(t,o);Svg.init(r,o,o),Svg.resize(0,o,0,o),Svg.clear("#f8f8f8");for(var s=0;s<e.length;s++){var i=x(l[e[s][0]],l[e[s][1]],17);"string"!=typeof i&&Svg.line(i[0],i[1],i[2],i[3],"#222222")}a.length==e.length&&p(e,l,a);for(var f=0;f<l.length;f++)Svg.disc(l[f][0],l[f][1],12.5,"#e6e6e6","#222222"),Svg.text(l[f][0],l[f][1]-1,f.toFixed(0));Svg.draw()}(r,t,o,s,i);break;default:!function(r,e,t,a,n){var o=0<n?n:320,l=m(t,o);Svg.init(r,o,o),Svg.resize(0,o,0,o),Svg.clear("#f8f8f8");for(var s=0;s<e.length;s++){var i=x(l[e[s][0]],l[e[s][1]],7);"string"!=typeof i&&Svg.line(i[0],i[1],i[2],i[3],"#222222")}a.length==e.length&&p(e,l,a);for(var f=0;f<l.length;f++)Svg.disc(l[f][0],l[f][1],4.5,"#222222");Svg.draw()}(r,t,o,s,i)}return!0}},Graph=new Graph_taramathObject,HtmlPrint_taramathObject=function(){var o=4;this.set_digits=function(r){return arguments.length<1?GlobalClasses.error_code("HtmlPrint","set_digits",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("HtmlPrint","set_digits",1):(o=Math.min(12,Math.max(0,Math.floor(r))),!0)},this.matrix=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("HtmlPrint","matrix",0);if(1!=GlobalClasses.is_div(r))return GlobalClasses.error_code("HtmlPrint","matrix",11);if(1!=GlobalClasses.is_matrix(e))return GlobalClasses.error_code("HtmlPrint","matrix",1);if(10<e.length||10<e[0].length){var t=e.length+" x "+e[0].length+" Matrix";document.getElementById(r).innerHTML=t}else{t='<table style="border-left:2px solid; border-right:2px solid; border-radius:8px;">';for(var a=0;a<e.length;a++){t+="<tr>";for(var n=0;n<e[a].length;n++)t+='<td style="text-align:right; padding:2px 5px;">'+e[a][n].toFixed(o)+"</td>";t+="</tr>"}t+="</table>",document.getElementById(r).innerHTML=t}return!0},this.vector=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("HtmlPrint","vector",0);if(1!=GlobalClasses.is_div(r))return GlobalClasses.error_code("HtmlPrint","vector",11);if(1!=GlobalClasses.is_vector(e))return GlobalClasses.error_code("HtmlPrint","vector",1);if(10<e.length){var t=e.length+" Vektor";document.getElementById(r).innerHTML=t}else{t='<div style="display:inline-block; padding:6px; border-left:2px solid; border-right:2px solid; border-radius:8px;">';for(var a=0;a<e.length;a++)t+=" "+e[a].toFixed(o)+" ";t+="</div>",document.getElementById(r).innerHTML=t}return!0}},HtmlPrint=new HtmlPrint_taramathObject,IntegerProgramming_taramathObject=function(){var d="minimize",v=0,b=0,m=1e3,u=1e-6,c=new Array,g=1e20,_=[],p=0;function x(r){return Math.abs(Math.round(r)-r)<u}function y(r){for(var e=0,t=r.length,a=0;a<t;a++)1!=x(r[a])&&e++;return 0==e}function h(r){if(1==GlobalClasses.is_string(r))return r;if("object"!=typeof r)return!1;for(var e="",t=0;t<r.length;t++)1==GlobalClasses.is_string(r[t])&&(e+=r[t]);return e}function C(r){if(3==r.length){if(1!=GlobalClasses.is_vector(r[0]))return GlobalClasses.error_code("IntegerProgramming",d,1);if(1!=GlobalClasses.is_matrix(r[1]))return GlobalClasses.error_code("IntegerProgramming",d,1);if(1!=GlobalClasses.is_vector(r[2]))return GlobalClasses.error_code("IntegerProgramming",d,1);var e=r[0],t=r[1],a=r[2],n=e.length,o=a.length;if(t.length!=o)return GlobalClasses.error_code("IntegerProgramming",d,2);if(t[0].length!=n)return GlobalClasses.error_code("IntegerProgramming",d,2);for(var l="",s=0;s<n;s++)l+="i";for(var i=new Array(o),f=0;f<o;f++)i[f]=0;return[e,l,t,a,i]}if(5==r.length){if(0==(u=h(r[1])))return GlobalClasses.error_code("IntegerProgramming",d,1);if(1!=GlobalClasses.is_vector(r[0]))return GlobalClasses.error_code("IntegerProgramming",d,1);if(1!=GlobalClasses.is_matrix(r[2]))return GlobalClasses.error_code("IntegerProgramming",d,1);if(1!=GlobalClasses.is_vector(r[3]))return GlobalClasses.error_code("IntegerProgramming",d,1);if(1!=GlobalClasses.is_vector(r[4]))return GlobalClasses.error_code("IntegerProgramming",d,1);e=r[0],t=r[2],a=r[3],i=r[4],n=e.length,o=a.length;if(u.length!=n)return GlobalClasses.error_code("IntegerProgramming",d,2);if(t.length!=o)return GlobalClasses.error_code("IntegerProgramming",d,2);if(t[0].length!=n)return GlobalClasses.error_code("IntegerProgramming",d,2);if(i.length!=o)return GlobalClasses.error_code("IntegerProgramming",d,2);for(l="",s=0;s<n;s++)l+="c"==u[s]?"c":"b"==u[s]?"b":"i";for(f=0;f<o;f++)i[f]=0<i[f]?1:i[f]<0?-1:0;return[e,l,t,a,i]}if(4==r.length&&1==GlobalClasses.is_vector(r[2])){if(1!=GlobalClasses.is_vector(r[0]))return GlobalClasses.error_code("IntegerProgramming",d,1);if(1!=GlobalClasses.is_matrix(r[1]))return GlobalClasses.error_code("IntegerProgramming",d,1);if(1!=GlobalClasses.is_vector(r[3]))return GlobalClasses.error_code("IntegerProgramming",d,1);e=r[0],t=r[1],a=r[2],i=r[3],n=e.length,o=a.length;if(t.length!=o)return GlobalClasses.error_code("IntegerProgramming",d,2);if(t[0].length!=n)return GlobalClasses.error_code("IntegerProgramming",d,2);if(i.length!=o)return GlobalClasses.error_code("IntegerProgramming",d,2);for(l="",s=0;s<n;s++)l+="i";for(f=0;f<o;f++)i[f]=0<i[f]?1:i[f]<0?-1:0;return[e,l,t,a,i]}if(4!=r.length||1!=GlobalClasses.is_matrix(r[2]))return 4==r.length?GlobalClasses.error_code("IntegerProgramming",d,1):GlobalClasses.error_code("IntegerProgramming",d,0);var u;if(0==(u=h(r[1])))return GlobalClasses.error_code("IntegerProgramming",d,1);if(1!=GlobalClasses.is_vector(r[0]))return GlobalClasses.error_code("IntegerProgramming",d,1);if(1!=GlobalClasses.is_vector(r[3]))return GlobalClasses.error_code("IntegerProgramming",d,1);e=r[0],t=r[2],a=r[3],n=e.length,o=a.length;if(u.length!=n)return GlobalClasses.error_code("IntegerProgramming",d,2);if(t.length!=o)return GlobalClasses.error_code("IntegerProgramming",d,2);if(t[0].length!=n)return GlobalClasses.error_code("IntegerProgramming",d,2);for(l="",s=0;s<n;s++)l+="c"==u[s]?"c":"b"==u[s]?"b":"i";for(i=new Array(o),f=0;f<o;f++)i[f]=0;return[e,l,t,a,i]}function G(r){for(var e=r.length,t=new Array(e),a=0;a<e;a++)t[a]="b"==r[a]?[0,1]:[0,-1];return[t]}function M(r,e,t,a){for(var n=a.length,o=e.length,l=new Array(o),s=new Array(o),i=new Array(o),f=0;f<o;f++)l[f]=e[f];for(f=0;f<o;f++)s[f]=t[f];for(f=0;f<o;f++)i[f]=new Array(n);for(f=0;f<o;f++)for(var u=0;u<n;u++)i[f][u]=r[f][u];for(var g=0;g<n;g++)if(0==a[g][0]&&0<a[g][1]){f=i.length;i.push(new Array(n));for(u=0;u<n;u++)i[f][u]=u==g?1:0;l.push(a[g][1]),s.push(-1)}else if(0<a[g][0]&&-1==a[g][1]){f=i.length;i.push(new Array(n));for(u=0;u<n;u++)i[f][u]=u==g?1:0;l.push(a[g][0]),s.push(1)}else if(a[g][0]==a[g][1]){f=i.length;i.push(new Array(n));for(u=0;u<n;u++)i[f][u]=u==g?1:0;l.push(a[g][1]),s.push(0)}else if(0<a[g][0]&&a[g][1]>a[g][0]){f=i.length;i.push(new Array(n));for(u=0;u<n;u++)i[f][u]=u==g?1:0;l.push(a[g][1]),s.push(-1),f++,i.push(new Array(n));for(u=0;u<n;u++)i[f][u]=u==g?1:0;l.push(a[g][0]),s.push(1)}return[i,l,s]}function w(r,e,t,a,n,o){this.B=o,this.x=[],this.LB=g+1,this.state=!1;var l=M(t,a,n,o),s=LinearProgramming.integer_programming_minimize(r,l[0],l[1],l[2]);if(b++,"boolean"!=typeof s){var i=r.length;if(this.x=s[0].splice(0,i),this.LB=s[1],this.state=!0,1==function(r,e){for(var t=0,a=r.length,n=0;n<a;n++)"c"!=e[n]&&1!=x(r[n])&&t++;return 0==t}(this.x,e)&&this.LB<g){g=this.LB,_=new Array(i);for(var f=0;f<i;f++)_[f]="c"!=e[f]?Math.round(this.x[f]):this.x[f]}}}function A(r,e,t,a,n){for(var o=r.length,l=-1,s=function(){if(1==p)return 0;if(2==p)return c.length-1;if(3==p)return Math.floor(c.length*Math.random());if(4==p){for(var r=c[t=0].LB,e=1;e<c.length;e++)c[e].LB>r&&(r=c[e].LB,t=e);return t}var t;for(r=c[t=0].LB,e=1;e<c.length;e++)c[e].LB<r&&(r=c[e].LB,t=e);return t}(),i=0;-1==l&&i<o;)"c"!=e[i]&&1!=x(c[s].x[i])&&(l=i),i++;if(-1==l)return!1;for(var f=new Array(o),u=new Array(o),g=0;g<o;g++)f[g]=[c[s].B[g][0],c[s].B[g][1]],u[g]=[c[s].B[g][0],c[s].B[g][1]];f[l][1]=Math.floor(c[s].x[l]),u[l][0]=Math.ceil(c[s].x[l]);var _=new w(r,e,t,a,n,f),h=new w(r,e,t,a,n,u);return c.push(_),c.push(h),c.splice(s,1),!0}function i(r,e,t,a,n,o){c=[],g=1e20,_=[];var l=new w(r,e,t,a,n,o);if("false"==l.state)return GlobalClasses.error_code("IntegerProgramming",d,22);for(c.push(l),c[0].LB+u>=g&&(c=[]),v=1;v<m&&0<c.length;){if(v++,0==A(r,e,t,a,n))return GlobalClasses.error_code("IntegerProgramming",d,10);for(var s=0;s<c.length;)c[s].LB+u>=g?c.splice(s,1):s++}if(v==m)return GlobalClasses.error_code("IntegerProgramming",d,9);if(0==_.length)return GlobalClasses.error_code("IntegerProgramming",d,22);for(var i=0,f=0;f<r.length;f++)i+=r[f]*_[f];return[_,i]}function P(r,e,t){if(1!=y(t))return GlobalClasses.error_code("IntegerProgramming",d,23);if(1!=function(r){for(var e=0,t=r.length,a=r[0].length,n=0;n<t;n++)for(var o=0;o<a;o++)1!=x(r[n][o])&&e++;return 0==e}(e))return GlobalClasses.error_code("IntegerProgramming",d,23);for(var a=0,n=0;n<r.length;n++)"c"==r[n]&&a++;return!(0<a)||GlobalClasses.error_code("IntegerProgramming",d,23)}function L(r,e,t,a,n,o){var l=r.length,s=t.length,i=function(r,e){for(var t=r[0].length,a=r.length,n=-1,o=t+1,l=0;l<a;l++)if(1!=x(e[l])){for(var s=0,i=0;i<t;i++)s+=r[l][i]-Math.floor(r[l][i]);s<o&&(o=s,n=l)}return n}(n,o);if(-1==i)return!1;r.push(0),a.push(0),t.push(o[i]-Math.floor(o[i])),e.push(new Array(l));for(var f=0;f<l;f++)e[s][f]=n[i][f]-Math.floor(n[i][f]);for(var u=0;u<s;u++)e[u].push(0);return e[s].push(-1),!0}this.define_method=function(r){if(arguments.length<1)return GlobalClasses.error_code("IntegerProgramming","define_method",0);if(1!=GlobalClasses.is_string(r))return GlobalClasses.error_code("IntegerProgramming","define_method",1);var e=r.trim().toLowerCase().replace("-","").replace("_","");return"lowerbound"==e&&(p=0),"first"==e&&(p=1),"last"==e&&(p=2),"random"==e&&(p=3),"largestbound"==e&&(p=4),!0},this.set_accuracy=function(r){return arguments.length<1?GlobalClasses.error_code("IntegerProgramming","set_accuracy",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("IntegerProgramming","set_accuracy",1):(u=Math.min(1,Math.max(r,1e-12)),!0)},this.set_maximal_iterations=function(r){return arguments.length<1?GlobalClasses.error_code("IntegerProgramming","set_maximal_iterations",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("IntegerProgramming","set_maximal_iterations",1):(m=Math.min(1e12,Math.max(Math.round(r),1)),!0)},this.get_number_of_iterations=function(){return v},this.get_number_of_solved_relaxations=function(){return b},this.minimize=function(){d="minimize",b=v=0;var r=C(arguments);if("string"==typeof r)return r;var e=r[0],t=r[1],a=r[2],n=r[3],o=r[4],l=G(t);if("string"==typeof l)return l;var s=i(e,t,a,n,o,l[0]);return"string"==typeof s?s:[s[0],s[1]]},this.maximize=function(){d="maximize",b=v=0;var r=C(arguments);if("string"==typeof r)return r;var e=function(r){for(var e=r.length,t=new Array(e),a=0;a<e;a++)t[a]=-r[a];return t}(r[0]),t=r[1],a=r[2],n=r[3],o=r[4],l=G(t);if("string"==typeof l)return l;var s=i(e,t,a,n,o,l[0]);return"string"==typeof s?s:[s[0],-s[1]]},this.cutting_plane=function(){d="cutting_plane",b=v=0;var r=C(arguments);if("string"==typeof r)return r;var e=r[0],t=r[1],a=r[2],n=r[3],o=r[4],l=P(t,a,n);if("string"==typeof l)return l;var s=G(t);if("string"==typeof s)return s;var i=M(a,n,o,s[0]);if("string"==typeof i)return i;var f=function(r,e,t,a,n){for(var o=r.length,l=a.length,s=new Array(o),i=0;i<o;i++)s[i]=r[i];for(var f=new Array(l),u=0;u<l;u++)f[u]=new Array(o);for(u=0;u<l;u++)for(i=0;i<o;i++)f[u][i]=Math.round(t[u][i]);var g=new Array(l);for(u=0;u<l;u++)g[u]=Math.round(a[u]);var _=new Array(l);for(u=0;u<l;u++)_[u]=n[u];var h=e;for(u=0;u<l;u++){if(_[u]<0)for(s.push(0),h+="i",i=0;i<l;i++)f[i].push(u==i?1:0);if(0<_[u])for(s.push(0),h+="i",i=0;i<l;i++)f[i].push(u==i?-1:0);_[u]=0}return[s,h,f,g,_]}(e,t,i[0],i[1],i[2]);if("string"==typeof f)return f;var u=f[0],g=(f[1],function(r,e,t,a){for(var n=r.length,o=t.length,l=new Array(n),s=0;s<n;s++)l[s]=r[s];for(var i=new Array(o),f=0;f<o;f++)i[f]=new Array(n);for(f=0;f<o;f++)for(s=0;s<n;s++)i[f][s]=e[f][s];var u=new Array(o);for(f=0;f<o;f++)u[f]=t[f];var g=new Array(o);for(f=0;f<o;f++)g[f]=a[f];var _=LinearProgramming.integer_programming_minimize(l,i,u,g);if(b++,0==_)return GlobalClasses.error_code("IntegerProgramming",d,22);var h=new Array(n);for(s=0;s<n;s++)h[s]=Math.round(_[0][s]);for(v=1;v<m&&1!=y(_[0].slice(0,n));){if(v++,0==L(l,i,u,g,_[2],_[3]))return GlobalClasses.error_code("IntegerProgramming",d,10);if(_=LinearProgramming.integer_programming_minimize(l,i,u,g),b++,0==_)return GlobalClasses.error_code("IntegerProgramming",d,22);for(s=0;s<n;s++)h[s]=Math.round(_[0][s])}if(v==m)return GlobalClasses.error_code("IntegerProgramming",d,9);var c=0;for(s=0;s<n;s++)c+=l[s]*h[s];return[h,c]}(u,f[2],f[3],f[4]));if("string"==typeof g)return g;var _=g[0],h=g[1];return[_.slice(0,e.length),h]}},IntegerProgramming=new IntegerProgramming_taramathObject,Integrate_taramathObject=function(){var glb_int_n_var=256,glb_string_method_var="romberg",glb_string_typeof_f_var="string",glb_string_f_var="0",glb_function_f_var=function(r){return 0};function neville_aitken(r,e,t){for(var a=r.length,n=new Array(a),o=0;o<a;o++)n[o]=e[o];for(o=1;o<a;o++)for(var l=a-1;o<=l;l--)n[l]+=(t-r[l])*(n[l]-n[l-1])/(r[l]-r[l-o]);return n[a-1]}function eval_f_string(x){var y=0;try{var t=0;with(Math)t=eval(glb_string_f_var);1==isFinite(t)&&(y=t)}catch(r){y=0}return y}function eval_f(r){return"string"==glb_string_typeof_f_var?eval_f_string(r):"function"==glb_string_typeof_f_var?glb_function_f_var(r):0}function trapezoid(r){for(var e=r.length-1,t=new Array(e+1),a=0;a<=e;a++)t[a]=eval_f(r[a]);var n=0;for(a=1;a<e;a++)n+=t[a];return(n+=(t[0]+t[e])/2)*(r[e]-r[0])/e}function simpson(r){for(var e=r.length-1,t=new Array(e+1),a=0;a<=e;a++)t[a]=eval_f(r[a]);var n=new Array(e);for(a=0;a<e;a++)n[a]=eval_f(.5*(r[a]+r[a+1]));var o=0;for(a=1;a<e;a++)o+=t[a];var l=0;for(a=0;a<e;a++)l+=n[a];return((t[0]+t[e])/6+o/3+2*l/3)*(r[e]-r[0])/e}function romberg(r){for(var e=r.length-1,t=new Array(e+1),a=0;a<=e;a++)t[a]=eval_f(r[a]);var n=r[e]-r[0],o=e,l=1,s=new Array,i=new Array;do{var f=0;for(a=l;a<e;a+=l)f+=t[a];f+=(t[0]+t[e])/2,s.push(n*n/(o*o)),i.push(f*n/o),o/=2,l*=2}while(o%2==0);return neville_aitken(s,i,0)}this.define_method=function(r,e){return arguments.length<2?GlobalClasses.error_code("Integrate","define_method",0):1!=GlobalClasses.is_string(r)?GlobalClasses.error_code("Integrate","define_method",1):1!=GlobalClasses.is_number(e)?GlobalClasses.error_code("Integrate","define_method",1):("trapezoid"!=r&&"simpson"!=r&&"romberg"!=r||(glb_string_method_var=r),glb_int_n_var=Math.max(1,Math.min(Math.floor(e),1e8)),!0)},this.func=function(r,e,t){if(arguments.length<3)return GlobalClasses.error_code("Integrate","func",0);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Integrate","func",1);if(1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("Integrate","func",1);var a=e,n=t;if(a==n)return 0;if("function"==typeof r&&(glb_function_f_var=r,glb_string_typeof_f_var="function"),"string"==typeof r){if(0==(glb_string_f_var=GlobalClasses.check_function_string_x(r)))return GlobalClasses.error_code("Integrate","func",24);glb_string_typeof_f_var="string"}for(var o=glb_int_n_var,l=new Array(o+1),s=0;s<=o;s++)l[s]=a+s/o*(n-a);return"trapezoid"==glb_string_method_var?trapezoid(l):"simpson"==glb_string_method_var?simpson(l):romberg(l)}},Integrate=new Integrate_taramathObject,Interpolate_taramathObject=function(){function y(r,e,t,a,n){if(1!=GlobalClasses.is_vector(r))return GlobalClasses.error_code("Interpolate",a,1);if(1!=GlobalClasses.is_vector(e))return GlobalClasses.error_code("Interpolate",a,1);if(1!=GlobalClasses.is_number(t)&&1!=GlobalClasses.is_vector(t))return GlobalClasses.error_code("Interpolate",a,1);if(r.length!=e.length)return GlobalClasses.error_code("Interpolate",a,2);var o=r.length;if(o<n)return GlobalClasses.error_code("Interpolate",a,23);for(var l=[],s=0;s<o;s++)l.push(r[s]);var i=Sort.permutation(l),f=[],u=[];for(s=0;s<o;s++)f.push(r[i[s]]),u.push(e[i[s]]);for(s=0;s<o-1;s++)if(f[s]>=f[s+1])return GlobalClasses.error_code("Interpolate",a,23);return[f,u]}this.linear=function(r,e,t){if(arguments.length<3)return GlobalClasses.error_code("Interpolate","linear",0);var a=y(r,e,t,"linear",2);if("string"==typeof a)return a;var n=a[0],o=a[1],l=n.length,s=t;"number"==typeof t&&(s=[t]);for(var i=[],f=0;f<s.length;f++){var u=s[f],g=0,_=l-1;if(u<=n[1])_=1;else if(u>=n[l-2])g=l-2;else for(;1<_-g;){var h=Math.floor((_+g)/2);n[h]>u?_=h:g=h}var c=(o[_]-o[g])/(n[_]-n[g]);i.push(o[g]+(u-n[g])*c)}return"number"==typeof t?i[0]:i},this.akima=function(r,e,t){if(arguments.length<3)return GlobalClasses.error_code("Interpolate","akima",0);var a=y(r,e,t,"akima",3);if("string"==typeof a)return a;for(var n=a[0],o=a[1],l=n.length,s=new Array(l+3),i=0;i<l-1;i++)s[i+2]=(o[i+1]-o[i])/(n[i+1]-n[i]);s[l+1]=2*s[l]-s[l-1],s[l+2]=2*s[l+1]-s[l],s[1]=2*s[2]-s[3],s[0]=2*s[1]-s[2];var f=new Array(l);for(i=0;i<l;i++){var u=(m=Math.abs(s[i+3]-s[i+2]))+(b=Math.abs(s[i+1]-s[i]));f[i]=0!=u?(m*s[i+1]+b*s[i+2])/u:(s[i+2]+s[i+1])/2}var g=t;"number"==typeof t&&(g=[t]);var _=[];for(i=0;i<g.length;i++){for(var h=g[i],c=0,d=l-1;1<d-c;){var v=Math.floor((d+c)/2);n[v]>h?d=v:c=v}var b=n[d]-n[c],m=h-n[c];_.push(o[c]+f[c]*m+(3*s[c+2]-2*f[c]-f[c+1])*m*m/b+(f[c]+f[c+1]-2*s[c+2])*m*m*m/(b*b))}return"number"==typeof t?_[0]:_},this.cubic=function(r,e,t){if(arguments.length<3)return GlobalClasses.error_code("Interpolate","cubic",0);var a=y(r,e,t,"cubic",3);if("string"==typeof a)return a;for(var n=a[0],o=a[1],l=n.length,s=new Array(l-1),i=0;i<l-1;i++)s[i]=n[i+1]-n[i];var f=new Array(l-2);for(i=0;i<l-2;i++)f[i]=(o[i+2]-o[i+1])/s[i+1]-(o[i+1]-o[i])/s[i];for(i=0;i<l-2;i++)f[i]*=6;var u=new Array(l-2);for(i=0;i<l-2;i++)u[i]=new Array(l-2);for(i=0;i<l-2;i++)for(var g=0;g<l-2;g++)u[i][g]=0;for(i=0;i<l-2;i++)u[i][i]=2*(s[i]+s[i+1]);for(i=0;i<l-3;i++)u[i][i+1]=s[i+1];for(i=0;i<l-3;i++)u[i+1][i]=s[i+1];var _=LinearAlgebra.solve_cholesky(u,f);if("string"==typeof _)return GlobalClasses.error_code("Interpolate","cubic",10);_.push(0),_.unshift(0);var h=new Array(l-1);for(i=0;i<l-1;i++)h[i]=(o[i+1]-o[i])/s[i]+s[i]*(_[i]+2*_[i+1])/6;var c=t;"number"==typeof t&&(c=[t]);var d=[];for(i=0;i<c.length;i++){for(var v=c[i],b=0,m=l-1;1<m-b;){var p=Math.floor((m+b)/2);n[p]>v?m=p:b=p}var x=v-n[m];d.push(o[m]+h[b]*x+_[m]*x*x/2+(_[m]-_[b])*x*x*x/(6*s[b]))}return"number"==typeof t?d[0]:d}},Interpolate=new Interpolate_taramathObject,Interval_taramathObject=function(){function o(r,e,t){return e<=r&&r<=t}function l(r){for(var e=r[0],t=1;t<r.length;t++)r[t]>e&&(e=r[t]);return e}function s(r){for(var e=r[0],t=1;t<r.length;t++)r[t]<e&&(e=r[t]);return e}function i(r){return 1==GlobalClasses.is_vector(r)&&2==r.length?[Math.min(r[0],r[1]),Math.max(r[0],r[1])]:1==GlobalClasses.is_number(r)?[r,r]:0}this.add=function(){if(arguments.length<2)return GlobalClasses.error_code("Interval","add",0);for(var r=[0,0],e=0;e<arguments.length;e++){var t=i(arguments[e]);if(0==t)return GlobalClasses.error_code("Interval","add",1);r=[r[0]+t[0],r[1]+t[1]]}return r},this.mult=function(){if(arguments.length<2)return GlobalClasses.error_code("Interval","mult",0);for(var r=[1,1],e=0;e<arguments.length;e++){var t=i(arguments[e]);if(0==t)return GlobalClasses.error_code("Interval","mult",1);var a=[r[0]*t[0],r[0]*t[1],r[1]*t[0],r[1]*t[1]];r=[s(a),l(a)]}return r},this.sub=function(r,e){if(2!=arguments.length)return GlobalClasses.error_code("Interval","sub",0);var t=i(r);if(0==t)return GlobalClasses.error_code("Interval","sub",1);var a=i(e);return 0==a?GlobalClasses.error_code("Interval","sub",1):[t[0]-a[1],t[1]-a[0]]},this.div=function(r,e){if(2!=arguments.length)return GlobalClasses.error_code("Interval","div",0);var t=i(r);if(0==t)return GlobalClasses.error_code("Interval","div",1);var a=i(e);if(0==a)return GlobalClasses.error_code("Interval","div",1);if(a[0]<=0&&0<=a[1])return[0,0];var n=[t[0]/a[0],t[0]/a[1],t[1]/a[0],t[1]/a[1]];return[s(n),l(n)]},this.min=function(){if(arguments.length<2)return GlobalClasses.error_code("Interval","min",0);var r=i(arguments[0]);if(0==r)return GlobalClasses.error_code("Interval","min",1);for(var e=1;e<arguments.length;e++){var t=i(arguments[e]);if(0==t)return GlobalClasses.error_code("Interval","min",1);r=[Math.min(r[0],t[0]),Math.min(r[1],t[1])]}return r},this.max=function(){if(arguments.length<2)return GlobalClasses.error_code("Interval","max",0);var r=i(arguments[0]);if(0==r)return GlobalClasses.error_code("Interval","max",1);for(var e=1;e<arguments.length;e++){var t=i(arguments[e]);if(0==t)return GlobalClasses.error_code("Interval","max",1);r=[Math.max(r[0],t[0]),Math.max(r[1],t[1])]}return r},this.sq=function(r){if(1!=arguments.length)return GlobalClasses.error_code("Interval","sq",0);var e=i(r);return 0==e?GlobalClasses.error_code("Interval","sq",1):0<=e[0]?[e[0]*e[0],e[1]*e[1]]:e[1]<=0?[e[1]*e[1],e[0]*e[0]]:[0,Math.max(e[0]*e[0],e[1]*e[1])]},this.pow=function(r,e){if(2!=arguments.length)return GlobalClasses.error_code("Interval","pow",0);var t=i(r);if(0==t)return GlobalClasses.error_code("Interval","pow",1);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Interval","pow",1);if(0<=t[0]&&0<=e)return[Math.pow(t[0],e),Math.pow(t[1],e)];var a=Math.round(e);return a<0||1e-12<Math.abs(a-e)?GlobalClasses.error_code("Interval","pow",1):0==a?[1,1]:a%2==1?[Math.pow(t[0],a),Math.pow(t[1],a)]:0<=t[0]?[Math.pow(t[0],a),Math.pow(t[1],a)]:t[1]<=0?[Math.pow(t[1],a),Math.pow(t[0],a)]:[0,Math.max(Math.pow(t[0],a),Math.pow(t[1],a))]},this.exp=function(r){if(1!=arguments.length)return GlobalClasses.error_code("Interval","exp",0);var e=i(r);return 0==e?GlobalClasses.error_code("Interval","exp",1):[Math.exp(e[0]),Math.exp(e[1])]},this.atan=function(r){if(1!=arguments.length)return GlobalClasses.error_code("Interval","atan",0);var e=i(r);return 0==e?GlobalClasses.error_code("Interval","atan",1):[Math.atan(e[0]),Math.atan(e[1])]},this.log=function(r){if(1!=arguments.length)return GlobalClasses.error_code("Interval","log",0);var e=i(r);return 0==e?GlobalClasses.error_code("Interval","log",1):e[0]<=0?[0,0]:[Math.log(e[0]),Math.log(e[1])]},this.abs=function(r){if(1!=arguments.length)return GlobalClasses.error_code("Interval","abs",0);var e=i(r);return 0==e?GlobalClasses.error_code("Interval","abs",1):0<=e[0]?[e[0],e[1]]:e[1]<=0?[-e[1],-e[0]]:[0,Math.max(-e[0],e[1])]},this.sqrt=function(r){if(1!=arguments.length)return GlobalClasses.error_code("Interval","sqrt",0);var e=i(r);return 0==e?GlobalClasses.error_code("Interval","sqrt",1):e[1]<=0?[0,0]:e[0]<=0?[0,Math.sqrt(e[1])]:[Math.sqrt(e[0]),Math.sqrt(e[1])]},this.cos=function(r){if(1!=arguments.length)return GlobalClasses.error_code("Interval","cos",0);var e=i(r);if(0==e)return GlobalClasses.error_code("Interval","cos",1);if(e[1]-e[0]>=2*Math.PI)return[-1,1];var t=(0<=e[0]?e[0]:e[0]+2*Math.PI*Math.floor(2-e[0]))%(2*Math.PI),a=t+(e[1]-e[0]),n=[Math.cos(e[0]),Math.cos(e[1])];return(o(Math.PI,t,a)||o(3*Math.PI,t,a))&&n.push(-1),o(2*Math.PI,t,a)&&n.push(1),[s(n),l(n)]},this.sin=function(r){if(1!=arguments.length)return GlobalClasses.error_code("Interval","sin",0);var e=i(r);if(0==e)return GlobalClasses.error_code("Interval","sin",1);if(e[1]-e[0]>=2*Math.PI)return[-1,1];var t=(0<=e[0]?e[0]:e[0]+2*Math.PI*Math.floor(2-e[0]))%(2*Math.PI),a=t+(e[1]-e[0]),n=[Math.sin(e[0]),Math.sin(e[1])];return(o(Math.PI/2,t,a)||o(5*Math.PI/2,t,a))&&n.push(1),(o(3*Math.PI/2,t,a)||o(7*Math.PI/2,t,a))&&n.push(-1),[s(n),l(n)]},this.add_scalar=function(r,e){return[r+e[0],r+e[1]]},this.mult_scalar=function(r,e){var t=[r*e[0],r*e[1]];return[s(t),l(t)]}},Interval=new Interval_taramathObject,LinearAlgebra_taramathObject=function(){var v=0,b=1e-10,m=1e-12;function p(r,e){for(var t=r.length,a=1;a<t;a++)for(var n=0;n<a;n++)if(Math.abs(r[a][n]-r[n][a])>e)return!1;return!0}function x(r,e){for(var t=r.length,a=new Array(t),n=0;n<t;n++){for(var o=0,l=0;l<t;l++)o+=r[n][l]*e[l];a[n]=o}return a}function y(r){for(var e=r.length,t=0,a=0;a<e;a++)t+=Math.abs(r[a]);return t}function C(r){for(var e=r.length,t=0,a=0;a<e;a++)t+=r[a]*r[a];return t}function c(r,e,t,a){var n=r*r+4*e*t-2*r*a+a*a;if(n<0)return a;var o=.5*(r+a-(n=Math.sqrt(n))),l=.5*(r+a+n);return Math.abs(o-a)<Math.abs(l-a)?o:l}function d(r,e){for(var t=r.length,a=e.length,n=new Array(t-1),o=new Array(t-1),l=0;l<t-1;l++){var s=(r[l][l]<0?-1:1)*Math.sqrt(r[l][l]*r[l][l]+r[l+1][l]*r[l+1][l]);n[l]=0==s?1:r[l][l]/s,o[l]=0==s?0:r[l+1][l]/s,r[l][l]=n[l]*r[l][l]+o[l]*r[l+1][l],r[l+1][l]=0;for(var i=Math.min(l+3,t),f=l+1;f<i;f++){var u=r[l][f];r[l][f]=n[l]*r[l][f]+o[l]*r[l+1][f],r[l+1][f]=n[l]*r[l+1][f]-o[l]*u}}for(l=0;l<t-1;l++){for(i=Math.min(t,l+2),f=Math.max(0,l-1);f<i;f++){u=r[f][l];r[f][l]=n[l]*r[f][l]+o[l]*r[f][l+1],r[f][l+1]=n[l]*r[f][l+1]-o[l]*u}for(f=0;f<a;f++){u=e[f][l];e[f][l]=n[l]*e[f][l]+o[l]*e[f][l+1],e[f][l+1]=n[l]*e[f][l+1]-o[l]*u}}}this.mult=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("LinearAlgebra","mult",0);if(1==GlobalClasses.is_number(r))return function(r,e){if(1==GlobalClasses.is_vector(e)){for(var t=e.length,a=new Array(t),n=0;n<t;n++)a[n]=r*e[n];return a}if(1!=GlobalClasses.is_matrix(e))return GlobalClasses.error_code("LinearAlgebra","mult",1);var o=e.length,l=(t=e[0].length,new Array(o));for(n=0;n<o;n++)l[n]=new Array(t);for(n=0;n<o;n++)for(var s=0;s<t;s++)l[n][s]=r*e[n][s];return l}(r,e);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","mult",1);var t=r.length,a=r[0].length;if(1==GlobalClasses.is_vector(e)){if(e.length!=a)return GlobalClasses.error_code("LinearAlgebra","mult",2);for(var n=new Array(t),o=0;o<t;o++)n[o]=0;for(o=0;o<t;o++)for(var l=0;l<a;l++)n[o]+=r[o][l]*e[l];return n}if(1!=GlobalClasses.is_matrix(e))return GlobalClasses.error_code("LinearAlgebra","mult",1);if(e.length!=a)return GlobalClasses.error_code("LinearAlgebra","mult",2);var s=e[0].length,i=new Array(t);for(o=0;o<t;o++)i[o]=new Array(s);for(o=0;o<t;o++)for(l=0;l<s;l++)i[o][l]=0;for(o=0;o<t;o++)for(l=0;l<s;l++)for(var f=0;f<a;f++)i[o][l]+=r[o][f]*e[f][l];return i},this.add=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("LinearAlgebra","add",0);if(1==GlobalClasses.is_vector(r)&&1==GlobalClasses.is_vector(e)){var t=r.length;if(e.length!=t)return GlobalClasses.error_code("LinearAlgebra","add",2);for(var a=new Array(t),n=0;n<t;n++)a[n]=r[n]+e[n];return a}if(1!=GlobalClasses.is_matrix(r)||1!=GlobalClasses.is_matrix(e))return GlobalClasses.error_code("LinearAlgebra","add",1);var o=r.length;t=r[0].length;if(e.length!=o||e[0].length!=t)return GlobalClasses.error_code("LinearAlgebra","add",2);var l=new Array(o);for(n=0;n<o;n++)l[n]=new Array(t);for(n=0;n<o;n++)for(var s=0;s<t;s++)l[n][s]=r[n][s]+e[n][s];return l},this.sub=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("LinearAlgebra","sub",0);if(1==GlobalClasses.is_vector(r)&&1==GlobalClasses.is_vector(e)){var t=r.length;if(e.length!=t)return GlobalClasses.error_code("LinearAlgebra","sub",2);for(var a=new Array(t),n=0;n<t;n++)a[n]=r[n]-e[n];return a}if(1!=GlobalClasses.is_matrix(r)||1!=GlobalClasses.is_matrix(e))return GlobalClasses.error_code("LinearAlgebra","sub",1);var o=r.length;t=r[0].length;if(e.length!=o||e[0].length!=t)return GlobalClasses.error_code("LinearAlgebra","sub",2);var l=new Array(o);for(n=0;n<o;n++)l[n]=new Array(t);for(n=0;n<o;n++)for(var s=0;s<t;s++)l[n][s]=r[n][s]-e[n][s];return l},this.transpose=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","transpose",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","transpose",1);for(var e=r.length,t=r[0].length,a=new Array(t),n=0;n<t;n++)a[n]=new Array(e);for(n=0;n<t;n++)for(var o=0;o<e;o++)a[n][o]=r[o][n];return a},this.vector_norm=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("LinearAlgebra","vector_norm",0);if(1!=GlobalClasses.is_vector(r))return GlobalClasses.error_code("LinearAlgebra","vector_norm",1);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("LinearAlgebra","vector_norm",1);if(-1!=e&&e<1)return GlobalClasses.error_code("LinearAlgebra","vector_norm",1);var t=r.length,a=0;if(-1==e){for(var n=0;n<t;n++)a=Math.max(a,Math.abs(r[n]));return a}if(1==e){for(n=0;n<t;n++)a+=Math.abs(r[n]);return a}if(2==e){for(n=0;n<t;n++)a+=r[n]*r[n];return Math.sqrt(a)}if(1<e){for(n=0;n<t;n++)a+=Math.pow(Math.abs(r[n]),e);return Math.pow(a,1/e)}return GlobalClasses.error_code("LinearAlgebra","vector_norm",10)},this.matrix_norm=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("LinearAlgebra","matrix_norm",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","matrix_norm",1);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("LinearAlgebra","matrix_norm",1);if(-1!=e&&1!=e&&2!=e)return GlobalClasses.error_code("LinearAlgebra","matrix_norm",1);var t=r.length,a=r[0].length,n=0;if(-1==e){for(var o=0;o<t;o++){for(var l=0,s=0;s<a;s++)l+=Math.abs(r[o][s]);n=Math.max(n,l)}return n}if(1==e){for(s=0;s<a;s++){for(l=0,o=0;o<t;o++)l+=Math.abs(r[o][s]);n=Math.max(n,l)}return n}if(2!=e)return GlobalClasses.error_code("LinearAlgebra","matrix_norm",10);var i=this.mult(this.transpose(r),r),f=this.eigenvalues(i);return 1!=GlobalClasses.is_number(f[0][0])?GlobalClasses.error_code("LinearAlgebra","matrix_norm",10):Math.sqrt(Math.abs(f[0][0]))},this.norm=function(){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","norm",0);var r=2;return 1<arguments.length&&0!=GlobalClasses.is_number(arguments[1])&&(r=arguments[1]),1==GlobalClasses.is_vector(arguments[0])?this.vector_norm(arguments[0],r):1==GlobalClasses.is_matrix(arguments[0])?this.matrix_norm(arguments[0],r):GlobalClasses.error_code("LinearAlgebra","norm",1)},this.cond=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","cond",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","cond",1);var e=r.length;if(r[0].length!=e)return GlobalClasses.error_code("LinearAlgebra","cond",6);var t=this.invert(r);return 1!=GlobalClasses.is_matrix(t)?GlobalClasses.error_code("LinearAlgebra","cond",3):this.matrix_norm(r,-1)*this.matrix_norm(t,-1)},this.identity_matrix=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","identity_matrix",0);if(1!=GlobalClasses.is_number(r))return GlobalClasses.error_code("LinearAlgebra","identity_matrix",1);for(var e=Math.max(1,Math.floor(r)),t=new Array(e),a=0;a<e;a++)t[a]=new Array(e);for(a=0;a<e;a++)for(var n=0;n<e;n++)t[a][n]=a==n?1:0;return t},this.diagonal_matrix=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","diagonal_matrix",0);if(1!=GlobalClasses.is_vector(r))return GlobalClasses.error_code("LinearAlgebra","diagonal_matrix",1);for(var e=r.length,t=new Array(e),a=0;a<e;a++)t[a]=new Array(e);for(a=0;a<e;a++)for(var n=0;n<e;n++)t[a][n]=a==n?r[a]:0;return t},this.zero_matrix=function(){var r=1;0<arguments.length&&1==GlobalClasses.is_number(arguments[0])&&(r=Math.max(1,Math.floor(arguments[0])));var e=r;1<arguments.length&&1==GlobalClasses.is_number(arguments[1])&&(r=Math.max(1,Math.floor(arguments[1])));for(var t=new Array(e),a=0;a<e;a++)t[a]=new Array(r);for(a=0;a<e;a++)for(var n=0;n<r;n++)t[a][n]=0;return t},this.tridiagonal_matrix=function(r,e,t,a){if(arguments.length<4)return GlobalClasses.error_code("LinearAlgebra","tridiagonal_matrix",0);if(1!=GlobalClasses.is_number(r))return GlobalClasses.error_code("LinearAlgebra","tridiagonal_matrix",1);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("LinearAlgebra","tridiagonal_matrix",1);if(1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("LinearAlgebra","tridiagonal_matrix",1);if(1!=GlobalClasses.is_number(a))return GlobalClasses.error_code("LinearAlgebra","tridiagonal_matrix",1);for(var n=this.zero_matrix(r),o=0;o<r;o++)for(var l=0;l<r;l++)n[o][l]=l==o?t:o-l==1?e:l-o==1?a:0;return n},this.random_matrix=function(){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","random_matrix",0);if(1!=GlobalClasses.is_number(arguments[0]))return GlobalClasses.error_code("LinearAlgebra","random_matrix",1);var r=Math.max(1,Math.floor(arguments[0])),e="",t=0;if(1<arguments.length&&"string"==typeof arguments[1]&&(e=arguments[1]),1<arguments.length&&"number"==typeof arguments[1]&&(t=r,r=Math.max(1,Math.floor(arguments[1]))),"tridiagonal"==e){var a=(Math.random()<.5?-1:1)*(Math.floor(9*Math.random())+1),n=(Math.random()<.5?-1:1)*(Math.floor(9*Math.random())+1),o=Math.abs(a)+Math.abs(n)+1;return this.tridiagonal_matrix(r,a,o,n)}if("lower_triangular"==e){for(var l=this.zero_matrix(r),s=1;s<r;s++)for(var i=0;i<s;i++)l[s][i]=(Math.random()<.5?-1:1)*Math.floor(13*Math.random());for(s=0;s<r;s++)l[s][s]=(Math.random()<.5?-1:1)*(Math.floor(12*Math.random())+1);return l}if("upper_triangular"==e){for(l=this.zero_matrix(r),s=0;s<r-1;s++)for(i=s+1;i<r;i++)l[s][i]=(Math.random()<.5?-1:1)*Math.floor(13*Math.random());for(s=0;s<r;s++)l[s][s]=(Math.random()<.5?-1:1)*(Math.floor(12*Math.random())+1);return l}if("symmetrical"==e){for(l=this.zero_matrix(r),s=1;s<r;s++)for(i=0;i<s;i++)l[s][i]=(Math.random()<.5?-1:1)*Math.floor(9*Math.random()),l[i][s]=l[s][i];for(s=0;s<r;s++){var f=0;for(i=0;i<s;i++)f+=Math.abs(l[s][i]);for(i=s+1;i<r;i++)f+=Math.abs(l[s][i]);l[s][s]=f+1}return l}if(0<t){for(l=this.zero_matrix(t,r),s=0;s<t;s++)for(i=0;i<r;i++)l[s][i]=(Math.random()<.5?-1:1)*Math.floor(13*Math.random());return l}for(l=this.zero_matrix(r),s=0;s<r-1;s++)for(i=s+1;i<r;i++)l[s][i]=(Math.random()<.5?-1:1)*Math.floor(5*Math.random());for(s=0;s<r;s++)l[s][s]=(Math.random()<.5?-1:1)*(Math.floor(4*Math.random())+1);for(var u=0;u<r/2-1;u++){var g=Math.random()<.5?-1:1;for(i=0;i<r;i++)l[r-1-u][i]+=g*l[u][i]}for(u=0;u<r/2-1;u++)for(g=Math.random()<.5?-1:1,s=0;s<r;s++)l[s][u]+=g*l[s][r-1-u];return l},this.invert=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","invert",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","invert",1);var e=r.length;if(r[0].length!=e)return GlobalClasses.error_code("LinearAlgebra","invert",6);for(var t=new Array(e),a=0;a<e;a++)t[a]=new Array(2*e);for(a=0;a<e;a++)for(var n=0;n<e;n++)t[a][n]=r[a][n];for(a=0;a<e;a++)for(n=e;n<2*e;n++)t[a][n]=0;for(a=0;a<e;a++)t[a][e+a]=1;for(a=0;a<e;a++){for(var o=Math.abs(t[a][a]),l=a,s=a+1;s<e;s++)Math.abs(t[s][a])>o&&(o=Math.abs(t[s][a]),l=s);if(0==o)return GlobalClasses.error_code("LinearAlgebra","invert",3);for(n=0;n<2*e;n++){var i=t[a][n];t[a][n]=t[l][n],t[l][n]=i}o=t[a][a];for(n=0;n<2*e;n++)t[a][n]/=o;for(s=0;s<e;s++)if(s!=a){var f=t[s][a];for(n=0;n<2*e;n++)t[s][n]-=f*t[a][n]}}var u=new Array(e);for(a=0;a<e;a++)u[a]=new Array(e);for(a=0;a<e;a++)for(n=0;n<e;n++)u[a][n]=t[a][e+n];return u},this.solve=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("LinearAlgebra","solve",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","solve",1);if(1!=GlobalClasses.is_vector(e))return GlobalClasses.error_code("LinearAlgebra","solve",1);var t=r.length;if(r[0].length!=t)return GlobalClasses.error_code("LinearAlgebra","solve",6);if(e.length!=t)return GlobalClasses.error_code("LinearAlgebra","solve",2);for(var a=new Array(t),n=0;n<t;n++)a[n]=new Array(t+1);for(n=0;n<t;n++){for(var o=0;o<t;o++)a[n][o]=r[n][o];a[n][t]=e[n]}for(n=0;n<t;n++){for(var l=Math.abs(a[n][n]),s=n,i=n+1;i<t;i++)Math.abs(a[i][n])>l&&(l=Math.abs(a[i][n]),s=i);if(0==l)return GlobalClasses.error_code("LinearAlgebra","solve",3);for(o=0;o<t+1;o++){var f=a[n][o];a[n][o]=a[s][o],a[s][o]=f}l=a[n][n];for(o=0;o<t+1;o++)a[n][o]/=l;for(i=n+1;i<t;i++){var u=a[i][n];for(o=0;o<t+1;o++)a[i][o]-=u*a[n][o]}}var g=new Array(t);for(n=t-1;0<=n;n--){g[n]=a[n][t];for(i=n+1;i<t;i++)g[n]-=g[i]*a[n][i]}return g},this.solve_backward=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("LinearAlgebra","solve_backward",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","solve_backward",1);if(1!=GlobalClasses.is_vector(e))return GlobalClasses.error_code("LinearAlgebra","solve_backward",1);var t=r.length;if(r[0].length!=t)return GlobalClasses.error_code("LinearAlgebra","solve_backward",6);if(e.length!=t)return GlobalClasses.error_code("LinearAlgebra","solve_backward",2);for(var a=0;a<t;a++)if(0==r[a][a])return GlobalClasses.error_code("LinearAlgebra","solve_backward",3);var n=new Array(t);for(a=t-1;0<=a;a--){n[a]=e[a];for(var o=a+1;o<t;o++)n[a]-=n[o]*r[a][o];n[a]/=r[a][a]}return n},this.solve_upper_triangular=function(r,e){return this.solve_backward(r,e)},this.solve_forward=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("LinearAlgebra","solve_forward",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","solve_forward",1);if(1!=GlobalClasses.is_vector(e))return GlobalClasses.error_code("LinearAlgebra","solve_forward",1);var t=r.length;if(r[0].length!=t)return GlobalClasses.error_code("LinearAlgebra","solve_forward",6);if(e.length!=t)return GlobalClasses.error_code("LinearAlgebra","solve_forward",2);for(var a=0;a<t;a++)if(0==r[a][a])return GlobalClasses.error_code("LinearAlgebra","solve_forward",3);var n=new Array(t);for(a=0;a<t;a++){n[a]=e[a];for(var o=0;o<a;o++)n[a]-=n[o]*r[a][o];n[a]/=r[a][a]}return n},this.solve_lower_triangular=function(r,e){return this.solve_forward(r,e)},this.solve_tridiagonal=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("LinearAlgebra","solve_tridiagonal",0);if(1!=GlobalClasses.is_vector(e))return GlobalClasses.error_code("LinearAlgebra","solve_tridiagonal",1);var t=r.length;if(r[0].length!=t)return GlobalClasses.error_code("LinearAlgebra","solve_tridiagonal",6);if(e.length!=t)return GlobalClasses.error_code("LinearAlgebra","solve_tridiagonal",2);for(var a=new Array(t),n=new Array(t-1),o=new Array(t-1),l=new Array(t),s=new Array(t-1),i=new Array(t-1),f=new Array(t),u=new Array(t),g=0;g<t;g++)a[g]=r[g][g];for(g=0;g<t-1;g++)n[g]=r[g][g+1];for(g=0;g<t-1;g++)o[g]=r[g+1][g];if(l[0]=a[0],0==l[0])return GlobalClasses.error_code("LinearAlgebra","solve_tridiagonal",3);for(g=0;g<t-1;g++)if(s[g]=n[g],i[g]=o[g]/l[g],l[g+1]=a[g+1]-i[g]*s[g],0==l[g+1])return GlobalClasses.error_code("LinearAlgebra","solve_tridiagonal",3);f[0]=e[0];for(g=1;g<t;g++)f[g]=e[g]-i[g-1]*f[g-1];u[t-1]=f[t-1]/l[t-1];for(g=t-2;0<=g;g--)u[g]=(f[g]-n[g]*u[g+1])/l[g];return u},this.qr=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","qr",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","qr",1);for(var e=r.length,t=r[0].length,a=new Array(e),n=0;n<e;n++)a[n]=new Array(t);for(n=0;n<e;n++)for(var o=0;o<t;o++)a[n][o]=r[n][o];for(var l=this.identity_matrix(e),s=0;s<Math.min(e,t);s++){var i=Math.abs(a[s][s]);for(n=s+1;n<e;n++)i=Math.max(i,Math.abs(a[n][s]));0==i&&(i=1);var f=new Array(e);for(n=0;n<e;n++)f[n]=n<s?0:a[n][s]/i;var u=0;for(n=s;n<e;n++)u+=f[n]*f[n];var g=0;0!=(u=Math.sqrt(u))&&(g=1/(u*(u+Math.abs(f[s])))),u*=a[s][s]<0?-1:1,f[s]+=u,a[s][s]=-u*i;for(n=s+1;n<e;n++)a[n][s]=0;for(o=s+1;o<t;o++){var _=0;for(n=s;n<e;n++)_+=a[n][o]*f[n];_*=g;for(n=s;n<e;n++)a[n][o]-=_*f[n]}for(n=0;n<e;n++){for(_=0,o=s;o<e;o++)_+=l[n][o]*f[o];_*=g;for(o=s;o<e;o++)l[n][o]-=_*f[o]}}return new Array(l,a)},this.qr_tridiagonal=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","qr_tridiagonal",0);var e=r.length;if(r[0].length!=e)return GlobalClasses.error_code("LinearAlgebra","qr_tridiagonal",6);for(var t=new Array(e),a=0;a<e;a++)t[a]=new Array(e);for(a=0;a<e;a++)for(var n=0;n<e;n++)t[a][n]=r[a][n];for(var o=this.identity_matrix(e),l=0;l<e-1;l++){var s=(t[l][l]<0?-1:1)*Math.sqrt(t[l][l]*t[l][l]+t[l+1][l]*t[l+1][l]),i=0==s?1:t[l][l]/s,f=0==s?0:t[l+1][l]/s;t[l][l]=i*t[l][l]+f*t[l+1][l],t[l+1][l]=0;var u=Math.min(l+3,e);for(a=l+1;a<u;a++){var g=t[l][a];t[l][a]=i*t[l][a]+f*t[l+1][a],t[l+1][a]=i*t[l+1][a]-f*g}for(a=0;a<=l;a++)o[a][l+1]=-f*o[a][l],o[a][l]*=i;o[l+1][l]=f,o[l+1][l+1]=i}return new Array(o,t)},this.qr_hessenberg=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","qr_hessenberg",0);var e=r.length;if(r[0].length!=e)return GlobalClasses.error_code("LinearAlgebra","qr_hessenberg",6);for(var t=new Array(e),a=0;a<e;a++)t[a]=new Array(e);for(a=0;a<e;a++)for(var n=0;n<e;n++)t[a][n]=r[a][n];for(var o=this.identity_matrix(e),l=0;l<e-1;l++){var s=(t[l][l]<0?-1:1)*Math.sqrt(t[l][l]*t[l][l]+t[l+1][l]*t[l+1][l]),i=0==s?1:t[l][l]/s,f=0==s?0:t[l+1][l]/s;t[l][l]=i*t[l][l]+f*t[l+1][l],t[l+1][l]=0;for(a=l+1;a<e;a++){var u=t[l][a];t[l][a]=i*t[l][a]+f*t[l+1][a],t[l+1][a]=i*t[l+1][a]-f*u}for(a=0;a<=l;a++)o[a][l+1]=-f*o[a][l],o[a][l]*=i;o[l+1][l]=f,o[l+1][l+1]=i}return new Array(o,t)},this.solve_qr=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("LinearAlgebra","solve_qr",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","solve_qr",1);if(1!=GlobalClasses.is_vector(e))return GlobalClasses.error_code("LinearAlgebra","solve_qr",1);var t=r.length;if(r[0].length!=t)return GlobalClasses.error_code("LinearAlgebra","solve_qr",6);if(e.length!=t)return GlobalClasses.error_code("LinearAlgebra","solve_qr",2);var a=this.qr(r);if(1!=GlobalClasses.is_matrix(a[0]))return GlobalClasses.error_code("LinearAlgebra","solve_qr",7);if(1!=GlobalClasses.is_matrix(a[1]))return GlobalClasses.error_code("LinearAlgebra","solve_qr",7);for(var n=this.mult(this.transpose(a[0]),e),o=new Array(t),l=t-1;0<=l;l--){o[l]=n[l];for(var s=l+1;s<t;s++)o[l]-=o[s]*a[1][l][s];if(0==a[1][l][l])return GlobalClasses.error_code("LinearAlgebra","solve_qr",3);o[l]/=a[1][l][l]}return o},this.hessenberg=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","hessenberg",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","hessenberg",1);var e=r.length;if(r[0].length!=e)return GlobalClasses.error_code("LinearAlgebra","hessenberg",6);for(var t=new Array(e),a=0;a<e;a++)t[a]=new Array(e);for(a=0;a<e;a++)for(var n=0;n<e;n++)t[a][n]=r[a][n];for(var o=this.identity_matrix(e),l=0;l<e-2;l++){var s=Math.abs(t[l+1][l]);for(a=l+2;a<e;a++)s=Math.max(s,Math.abs(t[a][l]));0==s&&(s=1);var i=new Array(e);for(a=0;a<e;a++)i[a]=a<l+1?0:t[a][l]/s;var f=0;for(a=l+1;a<e;a++)f+=i[a]*i[a];var u=0;0!=(f=Math.sqrt(f))&&(u=1/(f*(f+Math.abs(i[l+1])))),f*=t[l+1][l]<0?-1:1,i[l+1]+=f,t[l+1][l]=-f*s;for(a=l+2;a<e;a++)t[a][l]=0;for(n=l+1;n<e;n++){var g=0;for(a=l+1;a<e;a++)g+=t[a][n]*i[a];g*=u;for(a=l+1;a<e;a++)t[a][n]-=g*i[a]}for(a=0;a<e;a++){for(g=0,n=l+1;n<e;n++)g+=t[a][n]*i[n];g*=u;for(n=l+1;n<e;n++)t[a][n]-=g*i[n]}for(n=0;n<e;n++){for(g=0,a=l+1;a<e;a++)g+=o[a][n]*i[a];g*=u;for(a=l+1;a<e;a++)o[a][n]-=g*i[a]}}return new Array(o,t)},this.lu=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","lu",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","lu",1);var e=r.length;if(r[0].length!=e)return GlobalClasses.error_code("LinearAlgebra","lu",6);for(var t=this.identity_matrix(e),a=this.identity_matrix(e),n=0;n<e;n++)for(var o=0;o<e;o++)t[n][o]=r[n][o];for(var l=0;l<e-1;l++){if(0==t[l][l])return GlobalClasses.error_code("LinearAlgebra","lu",7);for(n=l+1;n<e;n++)a[n][l]=t[n][l]/t[l][l];for(n=l+1;n<e;n++)t[n][l]=0;for(n=l+1;n<e;n++)for(o=l+1;o<e;o++)t[n][o]=t[n][o]-a[n][l]*t[l][o]}return new Array(a,t)},this.solve_lu=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("LinearAlgebra","solve_lu",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","solve_lu",1);if(1!=GlobalClasses.is_vector(e))return GlobalClasses.error_code("LinearAlgebra","solve_lu",1);var t=r.length;if(r[0].length!=t)return GlobalClasses.error_code("LinearAlgebra","solve_lu",6);if(e.length!=t)return GlobalClasses.error_code("LinearAlgebra","solve_lu",2);var a=this.lu(r);if(1!=GlobalClasses.is_matrix(a[0]))return GlobalClasses.error_code("LinearAlgebra","solve_lu",7);if(1!=GlobalClasses.is_matrix(a[1]))return GlobalClasses.error_code("LinearAlgebra","solve_lu",7);for(var n=new Array(t),o=0;o<t;o++){n[o]=e[o];for(var l=0;l<o;l++)n[o]-=n[l]*a[0][o][l];if(0==a[0][o][o])return GlobalClasses.error_code("LinearAlgebra","solve_lu",3);n[o]/=a[0][o][o]}var s=new Array(t);for(o=t-1;0<=o;o--){s[o]=n[o];for(l=o+1;l<t;l++)s[o]-=s[l]*a[1][o][l];if(0==a[1][o][o])return GlobalClasses.error_code("LinearAlgebra","solve_lu",3);s[o]/=a[1][o][o]}return s},this.cholesky=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","cholesky",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","cholesky",1);var e=r.length;if(r[0].length!=e)return GlobalClasses.error_code("LinearAlgebra","cholesky",6);if(1!=p(r,1e-12))return GlobalClasses.error_code("LinearAlgebra","cholesky",5);for(var t=new Array(e),a=0;a<e;a++)t[a]=new Array(e);for(a=0;a<e;a++)for(var n=0;n<e;n++)t[a][n]=0;for(var o=0;o<e;o++){var l=r[o][o];for(n=0;n<o;n++)l-=t[o][n]*t[o][n];if(l<=0)return GlobalClasses.error_code("LinearAlgebra","cholesky",7);t[o][o]=Math.sqrt(l);for(a=o+1;a<e;a++){var s=r[a][o];for(n=0;n<o;n++)s-=t[o][n]*t[a][n];t[a][o]=s/t[o][o]}}return t},this.solve_cholesky=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("LinearAlgebra","solve_cholesky",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","solve_cholesky",1);if(1!=GlobalClasses.is_vector(e))return GlobalClasses.error_code("LinearAlgebra","solve_cholesky",1);var t=r.length;if(r[0].length!=t)return GlobalClasses.error_code("LinearAlgebra","solve_cholesky",6);if(e.length!=t)return GlobalClasses.error_code("LinearAlgebra","solve_cholesky",2);var a=this.cholesky(r);if(1!=GlobalClasses.is_matrix(a))return GlobalClasses.error_code("LinearAlgebra","solve_cholesky",7);for(var n=0;n<t;n++)if(0==a[n][n])return GlobalClasses.error_code("LinearAlgebra","solve_cholesky",3);var o=new Array(t);for(n=0;n<t;n++){o[n]=e[n];for(var l=0;l<n;l++)o[n]-=o[l]*a[n][l];o[n]/=a[n][n]}var s=new Array(t);for(n=t-1;0<=n;n--){s[n]=o[n];for(l=n+1;l<t;l++)s[n]-=s[l]*a[l][n];s[n]/=a[n][n]}return s},this.det=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","det",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","det",1);var e=r.length;if(r[0].length!=e)return GlobalClasses.error_code("LinearAlgebra","det",6);for(var t=new Array(e),a=0;a<e;a++)t[a]=new Array(e);for(a=0;a<e;a++)for(var n=0;n<e;n++)t[a][n]=r[a][n];for(var o=0;o<e;o++){var l=Math.abs(t[o][o]);for(a=o+1;a<e;a++)l=Math.max(l,Math.abs(t[a][o]));0==l&&(l=1);var s=new Array(e);for(a=0;a<e;a++)s[a]=a<o?0:t[a][o]/l;var i=0;for(a=o;a<e;a++)i+=s[a]*s[a];var f=0;0!=(i=Math.sqrt(i))&&(f=1/(i*(i+Math.abs(s[o])))),i*=t[o][o]<0?-1:1,s[o]+=i,t[o][o]=-i*l;for(a=o+1;a<e;a++)t[a][o]=0;for(n=o+1;n<e;n++){var u=0;for(a=o;a<e;a++)u+=t[a][n]*s[a];u*=f;for(a=o;a<e;a++)t[a][n]-=u*s[a]}}var g=e%2==0?1:-1;for(o=0;o<e;o++)g*=t[o][o];return g},this.row_sum_condition=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","row_sum_condition",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","row_sum_condition",1);var e=r.length;if(r[0].length!=e)return GlobalClasses.error_code("LinearAlgebra","row_sum_condition",6);for(var t=0;t<e;t++)if(0==r[t][t])return GlobalClasses.error_code("LinearAlgebra","row_sum_condition",8);var a=0;for(t=0;t<e;t++){for(var n=0,o=0;o<t;o++)n+=Math.abs(r[t][o]);for(o=t+1;o<e;o++)n+=Math.abs(r[t][o]);n/=Math.abs(r[t][t]),a=Math.max(a,n)}return a},this.column_sum_condition=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","column_sum_condition",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","column_sum_condition",1);var e=r.length;if(r[0].length!=e)return GlobalClasses.error_code("LinearAlgebra","column_sum_condition",6);for(var t=0;t<e;t++)if(0==r[t][t])return GlobalClasses.error_code("LinearAlgebra","column_sum_condition",8);for(var a=0,n=0;n<e;n++){var o=0;for(t=0;t<n;t++)o+=Math.abs(r[t][n]);for(t=n+1;t<e;t++)o+=Math.abs(r[t][n]);o/=Math.abs(r[n][n]),a=Math.max(a,o)}return a},this.sassenfeld_condition=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","sassenfeld_condition",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","sassenfeld_condition",1);var e=r.length;if(r[0].length!=e)return GlobalClasses.error_code("LinearAlgebra","sassenfeld_condition",6);for(var t=0;t<e;t++)if(0==r[t][t])return GlobalClasses.error_code("LinearAlgebra","sassenfeld_condition",8);var a=new Array(e);for(t=0;t<e;t++){for(var n=0,o=0;o<t;o++)n+=a[o]*Math.abs(r[t][o]);for(o=t+1;o<e;o++)n+=Math.abs(r[t][o]);a[t]=n/Math.abs(r[t][t])}var l=0;for(t=0;t<e;t++)l=Math.max(l,a[t]);return l},this.solve_jacobi=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("LinearAlgebra","solve_jacobi",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","solve_jacobi",1);if(1!=GlobalClasses.is_vector(e))return GlobalClasses.error_code("LinearAlgebra","solve_jacobi",1);var t=r.length;if(r[0].length!=t)return GlobalClasses.error_code("LinearAlgebra","solve_jacobi",6);if(e.length!=t)return GlobalClasses.error_code("LinearAlgebra","solve_jacobi",2);for(var a=0;a<t;a++)if(0==r[a][a])return GlobalClasses.error_code("LinearAlgebra","solve_jacobi",8);var n=b;2<arguments.length&&1==GlobalClasses.is_number(arguments[2])&&(n=Math.max(m,arguments[2]));var o=new Array(t);for(a=0;a<t;a++)o[a]=0;for(var l=new Array(t),s=new Array(t),i=0,f=n+1;i<1e3+10*t&&n<=f;){for(a=0;a<t;a++)l[a]=o[a];for(a=0;a<t;a++){o[a]=-e[a];for(var u=0;u<a;u++)o[a]+=r[a][u]*l[u];for(u=a+1;u<t;u++)o[a]+=r[a][u]*l[u];s[a]=o[a]+r[a][a]*l[a],o[a]/=-r[a][a]}for(a=f=0;a<t;a++)f+=Math.abs(s[a]);i++}return v=i,n<=f?GlobalClasses.error_code("LinearAlgebra","solve_jacobi",9):o},this.solve_gauss_seidel=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("LinearAlgebra","solve_gauss_seidel",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","solve_gauss_seidel",1);if(1!=GlobalClasses.is_vector(e))return GlobalClasses.error_code("LinearAlgebra","solve_gauss_seidel",1);var t=r.length;if(r[0].length!=t)return GlobalClasses.error_code("LinearAlgebra","solve_gauss_seidel",6);if(e.length!=t)return GlobalClasses.error_code("LinearAlgebra","solve_gauss_seidel",2);for(var a=0;a<t;a++)if(0==r[a][a])return GlobalClasses.error_code("LinearAlgebra","solve_gauss_seidel",8);var n=b;2<arguments.length&&1==GlobalClasses.is_number(arguments[2])&&(n=Math.max(m,arguments[2]));var o=new Array(t);for(a=0;a<t;a++)o[a]=0;for(var l=new Array(t),s=new Array(t),i=0,f=n+1;i<1e3+10*t&&n<=f;){for(a=0;a<t;a++)l[a]=o[a];for(a=0;a<t;a++){o[a]=-e[a];for(var u=0;u<a;u++)o[a]+=r[a][u]*o[u];for(u=a+1;u<t;u++)o[a]+=r[a][u]*l[u];s[a]=o[a]+r[a][a]*l[a],o[a]/=-r[a][a]}for(a=f=0;a<t;a++)f+=Math.abs(s[a]);i++}return v=i,n<=f?GlobalClasses.error_code("LinearAlgebra","solve_gauss_seidel",9):o},this.solve_cg=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("LinearAlgebra","solve_cg",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","solve_cg",1);if(1!=GlobalClasses.is_vector(e))return GlobalClasses.error_code("LinearAlgebra","solve_cg",1);var t=r.length;if(r[0].length!=t)return GlobalClasses.error_code("LinearAlgebra","solve_cg",6);if(e.length!=t)return GlobalClasses.error_code("LinearAlgebra","solve_cg",2);if(1!=p(r,1e-12))return GlobalClasses.error_code("LinearAlgebra","solve_cg",5);var a=b;2<arguments.length&&1==GlobalClasses.is_number(arguments[2])&&(a=Math.max(m,arguments[2]));for(var n=0,o=0,l=0,s=new Array(t),i=new Array(t),f=0;f<t;f++)s[f]=0;var u=function(r,e,t){for(var a=r.length,n=new Array(a),o=0;o<a;o++)n[o]=e[o];for(o=0;o<a;o++){for(var l=0,s=0;s<a;s++)l+=r[o][s]*t[s];n[o]-=l}return n}(r,e,s);for(f=0;f<t;f++)i[f]=u[f];for(var g=y(u),_=C(u);n<t&&a<=g;){var h=x(r,i),c=0;for(f=0;f<t;f++)c+=i[f]*h[f];if(0==c)return GlobalClasses.error_code("LinearAlgebra","solve_cg",4);o=_/c;for(f=0;f<t;f++)s[f]+=o*i[f];for(f=0;f<t;f++)u[f]-=o*h[f];var d=_;g=y(u),l=(_=C(u))/d;for(f=0;f<t;f++)i[f]=u[f]+l*i[f];n++}return v=n,s},this.eigenvalues=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","eigenvalues",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","eigenvalues",1);var e=r.length;if(r[0].length!=e)return GlobalClasses.error_code("LinearAlgebra","eigenvalues",6);if(1!=p(r,1e-12))return GlobalClasses.error_code("LinearAlgebra","eigenvalues",5);var t=b;1<arguments.length&&1==GlobalClasses.is_number(arguments[1])&&(t=Math.max(m,arguments[1]));for(var a=new Array(e),n=0;n<e;n++)a[n]=new Array(e);for(n=0;n<e;n++)a[n][n]=r[n][n];for(n=1;n<e;n++)for(var o=0;o<n;o++)a[n][o]=.5*(r[n][o]+r[o][n]),a[o][n]=a[n][o];var l=this.identity_matrix(e);if(1!=function(r,e){for(var t=r.length,a=2;a<t;a++)for(var n=0;n<a-1;n++)if(Math.abs(r[a][n])>e)return!1;return!0}(a,0)){var s=this.hessenberg(a);a=s[1],l=this.transpose(s[0])}for(var i=0,f=10*e+1e3,u=e;1<u;u--){var g=new Array(u);for(n=0;n<u;n++)g[n]=new Array(u);for(n=0;n<u;n++)for(o=0;o<u;o++)g[n][o]=a[n][o];for(;i<f&&Math.abs(g[u-1][u-2])>t;){var _=c(g[u-2][u-2],g[u-2][u-1],g[u-1][u-2],g[u-1][u-1]);for(n=0;n<u;n++)g[n][n]-=_;d(g,l);for(n=0;n<u;n++)g[n][n]+=_;i++}for(n=0;n<u;n++)for(o=0;o<u;o++)a[n][o]=g[n][o]}var h=new Array(e);for(n=0;n<e;n++)h[n]=a[n][n];return(v=i)==f?GlobalClasses.error_code("LinearAlgebra","eigenvalues",9):function(r,e){for(var t=r.length,a=new Array(t),n=0;n<t;n++)a[n]=Math.abs(r[n]);var o=new Array(t);for(n=0;n<t;n++)o[n]=n;for(var l=0;l<t-1;l++)for(var s=l+1;s<t;s++)if(a[l]<a[s]){var i=o[l];o[l]=o[s],o[s]=i;var f=a[l];a[l]=a[s],a[s]=f}var u=new Array(t);for(l=0;l<t;l++)u[l]=r[o[l]];var g=new Array(t);for(l=0;l<t;l++)g[l]=new Array(t);for(l=0;l<t;l++){var _=e[o[l]][0]<0?-1:1;for(s=0;s<t;s++)g[l][s]=_*e[o[l]][s]}return new Array(u,g)}(h,this.transpose(l))},this.bidiagonalize=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","bidiagonalize",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","bidiagonalize",1);for(var e=r.length,t=r[0].length,a=new Array(e),n=0;n<e;n++)a[n]=new Array(t);for(n=0;n<e;n++)for(var o=0;o<t;o++)a[n][o]=r[n][o];for(var l=this.identity_matrix(e),s=this.identity_matrix(t),i=0;i<Math.min(e,t);i++){var f=Math.abs(a[i][i]);for(n=i+1;n<e;n++)f=Math.max(f,Math.abs(a[n][i]));0==f&&(f=1);var u=new Array(e);for(n=0;n<e;n++)u[n]=n<i?0:a[n][i]/f;var g=0;for(n=i;n<e;n++)g+=u[n]*u[n];var _=0;0!=(g=Math.sqrt(g))&&(_=1/(g*(g+Math.abs(u[i])))),g*=a[i][i]<0?-1:1,u[i]+=g,a[i][i]=-g*f;for(n=i+1;n<e;n++)a[n][i]=0;for(o=i+1;o<t;o++){var h=0;for(n=i;n<e;n++)h+=a[n][o]*u[n];h*=_;for(n=i;n<e;n++)a[n][o]-=h*u[n]}for(n=0;n<e;n++){for(h=0,o=i;o<e;o++)h+=l[n][o]*u[o];h*=_;for(o=i;o<e;o++)l[n][o]-=h*u[o]}if(i<t-1){for(f=Math.abs(a[i][i+1]),o=i+2;o<t;o++)f=Math.max(f,Math.abs(a[i][o]));0==f&&(f=1);for(u=new Array(t),o=0;o<t;o++)u[o]=o<i+1?0:a[i][o]/f;for(g=0,o=i+1;o<t;o++)g+=u[o]*u[o];_=0;0!=(g=Math.sqrt(g))&&(_=1/(g*(g+Math.abs(u[i+1])))),g*=a[i][i+1]<0?-1:1,u[i+1]+=g;for(o=0;o<t;o++){for(h=0,n=i+1;n<t;n++)h+=s[n][o]*u[n];h*=_;for(n=i+1;n<t;n++)s[n][o]-=h*u[n]}a[i][i+1]=-g*f;for(o=i+2;o<t;o++)a[i][o]=0;for(n=i+1;n<e;n++){for(h=0,o=i+1;o<t;o++)h+=a[n][o]*u[o];h*=_;for(o=i+1;o<t;o++)a[n][o]-=h*u[o]}}}return new Array(l,a,s)},this.svd=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearAlgebra","svd",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("LinearAlgebra","svd",1);var e=r.length<r[0].length,t=this.bidiagonalize(e?this.transpose(r):r),a=t[0].length,n=t[2].length,o=this.zero_matrix(n);o[0][0]=t[1][0][0]*t[1][0][0];for(var l=1;l<n;l++)o[l][l]=t[1][l][l]*t[1][l][l]+t[1][l-1][l]*t[1][l-1][l],o[l-1][l]=t[1][l-1][l-1]*t[1][l-1][l],o[l][l-1]=o[l-1][l];var s=this.eigenvalues(o),i=this.zero_matrix(n);for(l=0;l<n-1;l++)for(var f=0;f<n;f++)i[l][f]=t[1][l][l]*s[1][f][l]+t[1][l][l+1]*s[1][f][l+1];for(f=0;f<n;f++)i[n-1][f]=t[1][n-1][n-1]*s[1][f][n-1];var u=this.qr(i),g=this.zero_matrix(a,n);for(l=0;l<n;l++)g[l][l]=Math.abs(u[1][l][l]);var _=this.identity_matrix(a);for(l=0;l<n;l++)for(f=0;f<n;f++)_[l][f]=u[0][l][f];for(f=0;f<n;f++)if(u[1][f][f]<0)for(l=0;l<n;l++)_[l][f]*=-1;var h=this.zero_matrix(a);for(l=n;l<a;l++)for(f=n;f<a;f++)h[l][f]=t[0][l][f];for(l=0;l<a;l++)for(f=0;f<n;f++)for(var c=0;c<a;c++)h[l][f]+=t[0][l][c]*_[c][f];for(l=0;l<n;l++)for(f=n;f<a;f++)for(c=0;c<a;c++)h[l][f]+=t[0][l][c]*_[c][f];var d=this.zero_matrix(n);for(l=0;l<n;l++)d[l][0]=s[1][l][0];for(l=0;l<n;l++)for(f=1;f<n;f++)for(c=0;c<n;c++)d[l][f]+=s[1][l][c]*t[2][c][f];return 1!=e?new Array(h,g,d):new Array(this.transpose(d),this.transpose(g),this.transpose(h))},this.get_number_of_iterations=function(){return v}},LinearAlgebra=new LinearAlgebra_taramathObject,LinearProgramming_taramathObject=function(){var u=0,C=!1,L=!1,F=1e-6,G=0,o=0;function l(r){return 1==o?GlobalClasses.error_code("LinearProgramming",r,19):2==o?GlobalClasses.error_code("LinearProgramming",r,20):5==o?GlobalClasses.error_code("LinearProgramming",r,9):6==o?GlobalClasses.error_code("LinearProgramming",r,0):7==o?GlobalClasses.error_code("LinearProgramming",r,1):8==o?GlobalClasses.error_code("LinearProgramming",r,2):9==o?GlobalClasses.error_code("LinearProgramming",r,21):GlobalClasses.error_code("LinearProgramming",r,10)}function k(r){return o=r,!1}function M(r,e){for(var t=r,a=2;a<=e;a++)t*=(r+1-a)/a;return Math.round(t)}function d(r){for(var e=0,t=0;t<r.length;t++)e+=Math.abs(r[t]);return e<r.length*F}function v(r){for(var e=0,t=0;t<r.length-1;t++)e+=Math.abs(r[t]);var a=Math.abs(r[r.length-1]);return!(e<(r.length-1)*F&&F<a)}function n(r){for(var e=r.length,t=0,a=0,n=0;n<e;n++)r[n]<0&&t++;for(n=0;n<e;n++)0<r[n]&&a++;return t==e?-2:a==e?2:0==t?1:0==a?-1:0}function g(r,e){for(var t=r.length,a=r[0].length,n=new Array(t),o=0;o<t;o++)n[o]=new Array(a+1);for(o=0;o<t;o++)for(var l=0;l<a;l++)n[o][l]=r[o][l];for(o=0;o<t;o++)n[o][a]=e[o];var s=0;for(l=0;s<t&&l<a;){var i=Math.abs(n[s][l]),f=s;for(o=s+1;o<t;o++)Math.abs(n[o][l])>i&&(i=Math.abs(n[o][l]),f=o);if(F<i){if(s<f)for(var u=l;u<=a;u++){var g=n[s][u];n[s][u]=n[f][u],n[f][u]=g}for(u=l+1;u<=a;u++)n[s][u]/=n[s][l];for(o=s+(n[s][l]=1);o<t;o++)if(Math.abs(n[o][l])>F){for(u=l+1;u<=a;u++)n[o][u]-=n[o][l]*n[s][u];n[o][l]=0}else n[o][l]=0;s++}else for(o=s;o<t;o++)n[o][l]=0;l++}for(;0<t&&1==d(n[t-1]);)t--;if(0==t)return k(4);if(t==r.length&&1==C){for(o=0;o<t;o++)for(l=0;l<a;l++)n[o][l]=r[o][l];for(o=0;o<t;o++)n[o][a]=e[o]}for(o=0;o<t;o++)if(n[o][a]<0)for(l=0;l<=a;l++)n[o][l]=-n[o][l];var _=0;for(o=0;o<t;o++)1!=v(n[o])&&_++;if(0<_)return k(2);var h=new Array(t),c=new Array(t);for(o=0;o<t;o++)h[o]=new Array(a);for(o=0;o<t;o++)for(l=0;l<a;l++)h[o][l]=n[o][l];for(o=0;o<t;o++)c[o]=n[o][a];return[h,c]}function _(r,e){for(var t=r.length,a=r[0].length,n=new Array(t),o=new Array(t),l=0;l<t;l++)n[l]=new Array(a);for(l=0;l<t;l++)for(var s=0;s<a;s++)n[l][s]=r[l][s];for(l=0;l<t;l++)o[l]=e[l];for(l=0;l<t;l++)for(s=0;s<t;s++)n[l].push(l==s?1:0);var i=new Array(t);for(l=0;l<t;l++)i[l]=a+l;var f=new Array(a+t);for(s=0;s<a+t;s++)f[s]=s<a?0:1;return[f,n,o,i]}function w(r,e,t,a){for(var n=-1,o=-1,l=0;l<t&&-1==n;)r[0][l]<-F&&(n=l),l++;if(-1==n)return[-1,-1];for(var s=0,i=1;i<=e;i++)if(r[i][n]>F){var f=r[i][t]/r[i][n];-1==o||f<s?(o=i,s=f):f==s&&a[i-1]<a[o-1]&&(o=i)}return[n,o]}function A(r,e,t){for(var a=-1,n=-1,o=0;o<t&&-1==a;)r[0][o]<-F&&(a=o),o++;if(-1==a)return[-1,-1];for(var l=0,s=1;s<=e;s++)if(r[s][a]>F){var i=r[s][t]/r[s][a];(-1==n||i<l)&&(n=s,l=i)}return[a,n]}function P(r,e,t){for(var a=-1,n=-1,o=-F,l=0;l<t;l++)r[0][l]<o&&(o=r[0][l],a=l);if(-1==a)return[-1,-1];o=0;for(var s=1;s<=e;s++)if(r[s][a]>F){var i=r[s][t]/r[s][a];(-1==n||i<o)&&(n=s,o=i)}return[a,n]}function T(r,e,t){for(var a=0,n=[],o=0;o<t;o++)if(r[0][o]<-F){a++;for(var l=0,s=[],i=1;i<=e;i++)if(r[i][o]>F){var f=r[i][t]/r[i][o];0==s.length&&(l=f+1),f==l&&s.push(i),f<l&&(s=[i],l=f)}for(var u=0;u<s.length;u++)n.push([o,s[u]])}return 0==a?1:0==n.length?2:n}function O(r,e,t){var a=T(r,e,t);if("number"==typeof a&&1==a)return[-1,-1];if("number"==typeof a&&2==a)return[0,-1];for(var n=1,o=-1,l=0;l<a.length;l++){var s=r[0][a[l][0]]*r[a[l][1]][t]/r[a[l][1]][a[l][0]];s<n&&(n=s,o=l)}return a[o]}function h(r,e,t,a){for(var n=e.length,o=e[0].length,l=new Array(n+1),s=0;s<n+1;s++)l[s]=new Array(o+1);for(s=0;s<n;s++)for(var i=0;i<o;i++)l[s+1][i]=e[s][i];for(s=0;s<n;s++)l[s+1][o]=t[s];for(i=0;i<o;i++)l[0][i]=r[i];l[0][o]=0;var f=new Array(n);for(s=0;s<n;s++)f[s]=a[s];1==C&&(Print.object("Ausgangstableau:"),Print.object(l));for(s=0;s<n;s++)if(0!=l[0][f[s]]){for(i=0;i<=o;i++)i!=f[s]&&(l[0][i]-=l[0][f[s]]*l[s+1][i]);l[0][f[s]]=0}for(var u,g=0,_=0,h=Math.min(M(o,n),1e3*o);0==_;){1==C&&(Print.object("Basis und Tableau:"),Print.object(f),Print.object(l));var c=[-1,-1];0==G&&(c=O(l,n,o)),1==G&&(c=A(l,n,o)),2==G&&(c=P(l,n,o)),3==G&&(void 0,c="number"==typeof(u=T(l,n,o))&&1==u?[-1,-1]:"number"==typeof u&&2==u?[0,-1]:u[Math.floor(u.length*Math.random())]),4==G&&(c=w(l,n,o,f));var d=c[0],v=c[1];if(-1==d&&(_=3),-1<d&&-1==v&&(_=1),0==_){for(i=0;i<=o;i++)i!=d&&(l[v][i]/=l[v][d]);l[v][d]=1;for(s=0;s<=n;s++)if(s!=v){for(i=0;i<=o;i++)i!=d&&(l[s][i]-=l[s][d]*l[v][i]);l[s][d]=0}for(s=1;s<=n;s++)l[s][o]<0&&(l[s][o]=0);f[v-1]=d,g++}h<=g&&(_=5)}if(1==_)return k(1);if(5==_)return k(5);var b=new Array(o);for(i=0;i<o;i++)b[i]=0;for(s=0;s<n;s++)b[f[s]]=l[s+1][o];var m=new Array(n);for(s=0;s<n;s++)m[s]=new Array(o);for(s=0;s<n;s++)for(i=0;i<o;i++)m[s][i]=l[s+1][i];var p=new Array(n);for(s=0;s<n;s++)p[s]=l[s+1][o];var x=0;for(i=0;i<o;i++)x+=(Math.abs(b[i])<F?0:b[i])*r[i];var y=new Array(o);for(i=0;i<o;i++)y[i]=l[0][i];return[b,m,p,f,x,g,y]}function y(r,e,t){for(var a=-1,n=-1,o=1;o<=e&&-1==n;)r[o][t]<-F&&(n=o),o++;if(-1==n)return[-1,-1];for(var l=0,s=0;s<t;s++)if(r[n][s]<-F){var i=-r[0][s]/r[n][s];(-1==a||i<l)&&(a=s,l=i)}return[a,n]}function N(r,e,t){for(var a=-1,n=-1,o=-F,l=1;l<=e;l++)r[l][t]<o&&(o=r[l][t],n=l);if(-1==n)return[-1,-1];o=0;for(var s=0;s<t;s++)if(r[n][s]<-F){var i=-r[0][s]/r[n][s];(-1==a||i<o)&&(a=s,o=i)}return[a,n]}function q(r,e,t){for(var a=0,n=[],o=1;o<=e;o++)if(r[o][t]<-F){a++;for(var l=0,s=[],i=0;i<t;i++)if(r[o][i]<-F){var f=-r[0][i]/r[o][i];0==s.length&&(l=f+1),f==l&&s.push(i),f<l&&(s=[i],l=f)}for(var u=0;u<s.length;u++)n.push([s[u],o])}return 0==a?1:0==n.length?2:n}function S(r,e,t){var a=q(r,e,t);if("number"==typeof a&&1==a)return[-1,-1];if("number"==typeof a&&2==a)return[0,-1];for(var n=-1,o=-1,l=0;l<a.length;l++){var s=r[0][a[l][0]]*r[a[l][1]][t]/r[a[l][1]][a[l][0]];n<s&&(n=s,o=l)}return a[o]}function c(r,e){for(var t=r.length,a=r[0].length,n=new Array(t),o=0;o<t;o++)n[o]=new Array(a);for(o=0;o<t;o++)for(var l=0;l<a;l++)n[o][l]=r[o][l];var s=new Array(t);for(o=0;o<t;o++)s[o]=e[o];for(var i=0;i<t;i++)if(s[i]>=a-t){var f=-1,u=0;for(l=0;l<a-t;l++){var g=Math.abs(n[i][l]);1<g&&(g=1/g),u<g&&(u=g,f=l)}if(-1<f){for(l=0;l<a;l++)l!=f&&(n[i][l]/=n[i][f]);n[i][f]=1;for(o=0;o<t;o++)if(o!=i){for(l=0;l<a;l++)l!=f&&(n[o][l]-=n[o][f]*n[i][l]);n[o][f]=0}s[i]=f}}for(o=0;o<t;o++)if(s[o]>=a-t)return k(4);var _=new Array(t);for(o=0;o<t;o++)_[o]=new Array(a-t);for(o=0;o<t;o++)for(l=0;l<a-t;l++)_[o][l]=n[o][l];return[_,s]}function b(r,e,t){for(var a=r.length,n=e.length,o=new Array(n),l=0;l<n;l++)o[l]=new Array(a);for(l=0;l<n;l++)for(var s=0;s<a;s++)o[l][s]=e[l][s];var i=new Array(a);for(s=0;s<a;s++)i[s]=r[s];for(l=0;l<n;l++){if(t[l]<0){i.push(0);for(var f=0;f<n;f++)f!=l&&o[f].push(0);o[l].push(1)}if(0<t[l]){i.push(0);for(f=0;f<n;f++)f!=l&&o[f].push(0);o[l].push(-1)}}return[i,o]}function s(r){if(3==r.length){if(1!=GlobalClasses.is_vector(r[0]))return k(7);if(1!=GlobalClasses.is_matrix(r[1]))return k(7);if(1!=GlobalClasses.is_vector(r[2]))return k(7);var e=r[0],t=r[1],a=r[2],n=e.length,o=a.length;if(t.length!=o)return k(8);if(t[0].length!=n)return k(8);for(var l=new Array(n),s=0;s<n;s++)l[s]=1;for(var i=new Array(o),f=0;f<o;f++)i[f]=0;return[e,l,t,a,i]}if(5==r.length){if(1!=GlobalClasses.is_vector(r[0]))return k(7);if(1!=GlobalClasses.is_vector(r[1]))return k(7);if(1!=GlobalClasses.is_matrix(r[2]))return k(7);if(1!=GlobalClasses.is_vector(r[3]))return k(7);if(1!=GlobalClasses.is_vector(r[4]))return k(7);e=r[0],l=r[1],t=r[2],a=r[3],i=r[4],n=e.length,o=a.length;if(l.length!=n)return k(8);if(t.length!=o)return k(8);if(t[0].length!=n)return k(8);if(i.length!=o)return k(8);for(s=0;s<n;s++)l[s]=0<l[s]?1:l[s]<0?-1:0;for(f=0;f<o;f++)i[f]=0<i[f]?1:i[f]<0?-1:0;return[e,l,t,a,i]}if(4==r.length&&1==GlobalClasses.is_vector(r[1])){if(1!=GlobalClasses.is_vector(r[0]))return k(7);if(1!=GlobalClasses.is_matrix(r[2]))return k(7);if(1!=GlobalClasses.is_vector(r[3]))return k(7);e=r[0],l=r[1],t=r[2],a=r[3],n=e.length,o=a.length;if(l.length!=n)return k(8);if(t.length!=o)return k(8);if(t[0].length!=n)return k(8);for(s=0;s<n;s++)l[s]=0<l[s]?1:l[s]<0?-1:0;for(i=new Array(o),f=0;f<o;f++)i[f]=0;return[e,l,t,a,i]}if(4!=r.length||1!=GlobalClasses.is_matrix(r[1]))return 4==r.length?k(7):k(6);if(1!=GlobalClasses.is_vector(r[0]))return k(7);if(1!=GlobalClasses.is_vector(r[2]))return k(7);if(1!=GlobalClasses.is_vector(r[3]))return k(7);e=r[0],t=r[1],a=r[2],i=r[3],n=e.length,o=a.length;if(t.length!=o)return k(8);if(t[0].length!=n)return k(8);if(i.length!=o)return k(8);for(f=0;f<o;f++)i[f]=0<i[f]?1:i[f]<0?-1:0;for(l=new Array(n),s=0;s<n;s++)l[s]=1;return[e,l,t,a,i]}function i(r,e,t,a,n){for(var o=r.length,l=a.length,s=new Array(l),i=0;i<l;i++)s[i]=new Array(o);for(i=0;i<l;i++)for(var f=0;f<o;f++)s[i][f]=t[i][f];var u=new Array(o);for(f=0;f<o;f++)u[f]=r[f];var g=new Array(l);for(i=0;i<l;i++)g[i]=a[i];var _=new Array(l);for(i=0;i<l;i++)_[i]=n[i];for(f=0;f<o;f++){if(e[f]<0){u[f]=-u[f];for(i=0;i<l;i++)s[i][f]=-s[i][f]}if(0==e[f]){u.push(-u[f]);for(i=0;i<l;i++)s[i].push(-s[i][f])}}for(o=u.length,i=0;i<l;i++)if(0<_[i]){_[i]=-1,g[i]=-g[i];for(f=0;f<o;f++)s[i][f]=-s[i][f]}return[u,s,g,_]}function f(r,e){for(var t=e.length,a=new Array(t),n=0,o=0,l=0;l<t;l++)0==e[l]&&o++;if(r.length<t+o)return k(4);for(l=0;l<t;l++)0<e[l]&&(a[l]=r[l]),e[l]<0&&(a[l]=-r[l]),0==e[l]&&(a[l]=r[l]-r[t+n],n++);return a}function m(r){var e=r.length,t=r[0].length;if(t<e)return k(4);for(var a=new Array(e),n=0;n<e;n++)a[n]=t-e+n;return a}function D(r,e,t){for(var a=r.length,n=e.length,o=new Array(a),l=0;l<a;l++)o[l]=new Array(a);for(l=0;l<a;l++)for(var s=l;s<a;s++){for(var i=0,f=0;f<n;f++)i+=r[l][f]*r[s][f]*(e[f]/t[f]);o[l][s]=i,o[s][l]=i,1!=isFinite(o[l][s])&&(L=!0)}if(1==L)return LinearAlgebra.identity_matrix(a);var u=new Array(a);for(l=0;l<a;l++)u[l]=new Array(a);for(l=0;l<a;l++)for(s=0;s<a;s++)u[l][s]=0;for(f=0;f<a;f++){for(i=o[f][f],s=0;s<f;s++)i-=u[f][s]*u[f][s];i=Math.max(i,0),u[f][f]=Math.sqrt(i),1!=isFinite(u[f][f])&&(L=!0),u[f][f]<1e-12&&(u[f][f]=1);for(l=f+1;l<a;l++){var g=o[l][f];for(s=0;s<f;s++)g-=u[f][s]*u[l][s];u[l][f]=g/u[f][f],1!=isFinite(u[l][f])&&(L=!0)}}return 1==L?LinearAlgebra.identity_matrix(a):u}function E(r,e,t,a,n,o,l){for(var s=n.length,i=o.length,f=new Array(i),u=0;u<i;u++)f[u]=(t[u]*o[u]-l[u])/a[u];for(var g=new Array(s),_=0;_<s;_++){var h=0;for(u=0;u<i;u++)h+=r[_][u]*f[u];g[_]=n[_]+h}var c=function(r,e){for(var t=e.length,a=new Array(t),n=0;n<t;n++){a[n]=e[n];for(var o=0;o<n;o++)a[n]-=a[o]*r[n][o];a[n]/=r[n][n],1!=isFinite(a[n])&&(L=!0)}if(1==L){for(n=0;n<t;n++)a[n]=0;return a}var l=new Array(t);for(n=t-1;0<=n;n--){for(l[n]=a[n],o=n+1;o<t;o++)l[n]-=l[o]*r[o][n];l[n]/=r[n][n],1!=isFinite(l[n])&&(L=!0)}if(1==L)for(n=0;n<t;n++)l[n]=0;return l}(e,g);for(_=0;_<s;_++)1!=isFinite(c[_])&&(c[_]=0,L=!0);var d=new Array(i);for(u=0;u<i;u++){for(h=0,_=0;_<s;_++)h+=r[_][u]*c[_];d[u]=o[u]-h}for(u=0;u<i;u++)1!=isFinite(d[u])&&(d[u]=a[u],L=!0);var v=new Array(i);for(u=0;u<i;u++)v[u]=(l[u]-d[u]*t[u])/a[u];for(u=0;u<i;u++)1!=isFinite(v[u])&&(v[u]=t[u],L=!0);return[v,c,d]}function X(r,e){for(var t=1,a=0;a<r.length;a++)e[a]<0&&(t=Math.min(t,-r[a]/e[a]));return t}function H(r,e,t){for(var a=r.length,n=t.length,o=new Array(a),l=0;l<a;l++){for(var s=0,i=0;i<n;i++)s+=e[l][i]*t[i];o[l]=r[l]-s}return o}function I(r,e,t,a){for(var n=t.length,o=r.length,l=new Array(o),s=0;s<o;s++){for(var i=0,f=0;f<n;f++)i+=e[f][s]*t[f];l[s]=r[s]-i-a[s]}return l}function Q(r){for(var e=r.length,t=0,a=0;a<e;a++)t=Math.max(t,Math.abs(r[a]));return t}function p(r,e,t,a){var n=b(r,e,a);if(0==n)return!1;var o=m(n[1]);if(0==o)return!1;var l=function(r,e,t,a){for(var n=e.length,o=e[0].length,l=new Array(n+1),s=0;s<n+1;s++)l[s]=new Array(o+1);for(s=0;s<n;s++)for(var i=0;i<o;i++)l[s+1][i]=e[s][i];for(s=0;s<n;s++)l[s+1][o]=t[s];for(i=0;i<o;i++)l[0][i]=r[i];l[0][o]=0;var f=new Array(n);for(s=0;s<n;s++)f[s]=a[s];1==C&&(Print.object("Ausgangstableau:"),Print.object(l));for(var u,g=0,_=0,h=Math.min(M(o,n),1e3*o);0==_;){1==C&&(Print.object("Basis und Tableau:"),Print.object(f),Print.object(l));var c=[-1,-1];0==G&&(c=S(l,n,o)),1==G&&(c=y(l,n,o)),2==G&&(c=N(l,n,o)),3==G&&(c="number"==typeof(u=q(l,n,o))&&1==u?[-1,-1]:"number"==typeof u&&2==u?[0,-1]:u[Math.floor(u.length*Math.random())]),4==G&&(c=y(l,n,o));var d=c[0],v=c[1];if(-1==v&&(_=3),-1<v&&-1==d&&(_=2),0==_){for(i=0;i<=o;i++)i!=d&&(l[v][i]/=l[v][d]);for(l[v][d]=1,s=0;s<=n;s++)if(s!=v){for(i=0;i<=o;i++)i!=d&&(l[s][i]-=l[s][d]*l[v][i]);l[s][d]=0}for(i=0;i<o;i++)l[0][i]<0&&(l[0][i]=0);f[v-1]=d,g++}h<=g&&(_=5)}if(2==_)return k(2);if(5==_)return k(5);var b=new Array(o);for(i=0;i<o;i++)b[i]=0;for(s=0;s<n;s++)b[f[s]]=l[s+1][o];var m=new Array(n);for(s=0;s<n;s++)m[s]=new Array(o);for(s=0;s<n;s++)for(i=0;i<o;i++)m[s][i]=l[s+1][i];var p=new Array(n);for(s=0;s<n;s++)p[s]=l[s+1][o];var x=0;for(i=0;i<o;i++)x+=(Math.abs(b[i])<F?0:b[i])*r[i];return[b,m,p,f,x,g]}(n[0],n[1],t,o);return 0!=l&&(u[1]=l[5],[l[0],l[4]])}function x(r,e,t,a){var n=b(r,e,a);if(0==n)return!1;var o=g(n[1],t);if(0==o)return!1;var l=function(r,e,t){for(var a=r.length,n=t.length,o=new Array(a),l=0;l<a;l++)o[l]=1;var s=new Array(a);for(l=0;l<a;l++)s[l]=1;for(var i=new Array(n),f=0;f<n;f++)i[f]=0;for(var u=0,g=0;0==g&&u<10*a+1e3;){var _=new Array(n),h=new Array(a),c=new Array(a);for(f=0;f<n;f++)_[f]=0;for(l=0;l<a;l++)h[l]=0;for(l=0;l<a;l++)c[l]=-o[l]*s[l];var d=D(e,o,s),v=E(e,d,o,s,_,h,c),b=X(o,v[0]),m=X(s,v[2]),p=0;for(l=0;l<a;l++)p+=o[l]*s[l];var x=0;for(l=0;l<a;l++)x+=(o[l]+b*v[0][l])*(s[l]+m*v[2][l]);var y=x*Math.pow(x/p,2)/a;if(_=H(t,e,o),h=I(r,e,i,s),Q(_)<F)for(f=0;f<n;f++)_[f]=0;if(Q(h)<F)for(l=0;l<a;l++)h[l]=0;for(l=0;l<a;l++)c[l]+=y-v[0][l]*v[2][l];var C=E(e,d,o,s,_,h,c),G=.95*X(o,C[0]),M=.95*X(s,C[2]);for(l=0;l<a;l++)o[l]+=G*C[0][l];for(f=0;f<n;f++)i[f]+=M*C[1][f];for(l=0;l<a;l++)s[l]+=M*C[2][l];for(l=0;l<a;l++)o[l]=Math.max(o[l],1e-12);for(l=0;l<a;l++)s[l]=Math.max(s[l],1e-12);for(l=0;l<a;l++)1!=isFinite(o[l])&&(L=!0);for(f=0;f<n;f++)1!=isFinite(i[f])&&(L=!0);for(l=0;l<a;l++)1!=isFinite(s[l])&&(L=!0);(1==L||1e12<Q(o)||1e12<Q(i)||1e12<Q(s))&&(g=2);var w=0;for(l=1;l<a;l++)w=Math.max(w,Math.abs(o[l]*s[l]));w<F&&(g=1),u++}if(2==g)return k(9);if(0==g)return k(5);for(var A=0,P=0;P<o.length;P++)A+=o[P]*r[P];return[o,A,u]}(n[0],o[0],o[1]);return 0!=l&&(u=l[2],[l[0],l[1]])}function Z(r,e,t,a){return-2==n(a)&&1<=n(r)?p(r,e,t,a):-2==n(a)&&1<=n(t)?function(r,e,t,a){var n=b(r,e,a);if(0==n)return!1;var o=m(n[1]);if(0==o)return!1;var l=h(n[0],n[1],t,o);return 0!=l&&(u[1]=l[5],[l[0],l[4]])}(r,e,t,a):function(r,e,t,a){var n=b(r,e,a);if(0==n)return!1;var o=g(n[1],t);if(0==o)return!1;var l=_(o[0],o[1]);if(0==l)return!1;var s=h(l[0],l[1],l[2],l[3]);if(0==s)return!1;if(Math.abs(s[4])>=F)return k(2);u[0]=s[5];var i=c(s[1],s[3]);if(0==i)return!1;var f=h(n[0],i[0],s[2],i[1]);return 0!=f&&(u[1]=f[5],[f[0],f[4]])}(r,e,t,a)}this.define_method=function(r){if(arguments.length<1)return GlobalClasses.error_code("LinearProgramming","define_method",0);if(1!=GlobalClasses.is_string(r))return GlobalClasses.error_code("LinearProgramming","define_method",1);var e=r.trim().toLowerCase().replace("-","").replace("_","");return"steepestedge"==e&&(G=0),"firstindex"==e&&(G=1),"smallestvalue"==e&&(G=2),"random"==e&&(G=3),"bland"==e&&(G=4),!0},this.set_accuracy=function(r){return arguments.length<1?GlobalClasses.error_code("LinearProgramming","set_accuracy",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("LinearProgramming","set_accuracy",1):(F=Math.max(r,1e-12),!0)},this.get_number_of_iterations=function(){return u},this.simplex_print=function(r){return arguments.length<1?GlobalClasses.error_code("LinearProgramming","simplex_print",0):1!=GlobalClasses.is_boolean(r)?GlobalClasses.error_code("LinearProgramming","simplex_print",1):(C=r,!0)},this.minimize=function(){u=[o=0,0];var r=s(arguments);if(0==r)return l("minimize");var e=i(r[0],r[1],r[2],r[3],r[4]);if(0==e)return l("minimize");var t=Z(e[0],e[1],e[2],e[3]);if(0==t)return l("minimize");var a=f(t[0],r[1]);return 0==a?l("minimize"):[a,t[1]]},this.maximize=function(){u=[o=0,0];var r=s(arguments);if(0==r)return l("maximize");var e=function(r){for(var e=r.length,t=new Array(e),a=0;a<e;a++)t[a]=-r[a];return t}(r[0]);if(0==e)return l("maximize");var t=i(e,r[1],r[2],r[3],r[4]);if(0==t)return l("maximize");var a=Z(t[0],t[1],t[2],t[3]);if(0==a)return l("maximize");var n=f(a[0],r[1]);return 0==n?l("maximize"):[n,-a[1]]},this.interior_point=function(){u=o=0;var r=s(arguments);if(0==r)return l("interior_point");var e=i(r[0],r[1],r[2],r[3],r[4]);if(0==e)return l("interior_point");var t=x(e[0],e[1],e[2],e[3]);if(0==t)return l("interior_point");var a=f(t[0],r[1]);return 0==a?l("interior_point"):[a,t[1]]},this.integer_programming_minimize=function(r,e,t,a){var n=b(r,e,a);if(0==n)return!1;var o=g(n[1],t);if(0==o)return!1;var l=_(o[0],o[1]);if(0==l)return!1;var s=h(l[0],l[1],l[2],l[3]);if(0==s)return!1;if(Math.abs(s[4])>=F)return!1;var i=c(s[1],s[3]);if(0==i)return!1;var f=h(n[0],i[0],s[2],i[1]);return 0!=f&&[f[0],f[4],f[1],f[2]]}},LinearProgramming=new LinearProgramming_taramathObject,NeuralNetwork_taramathObject=function(){var g=[],_=[],l=1e3,s=100,i=5;function h(r){for(var e=new Array(r),t=0;t<r;t++)e[t]=0;return e}function c(r,e){for(var t=new Array(r),a=0;a<r;a++)t[a]=new Array(e);for(a=0;a<r;a++)for(var n=0;n<e;n++)t[a][n]=0;return t}function a(r,e){for(var t=0;t<g.length;t++)for(var a=0;a<g[t].length;a++)for(var n=0;n<g[t][a].length;n++)g[t][a][n]+=r*e[0][t][a][n];for(t=0;t<_.length;t++)for(a=0;a<_[t].length;a++)_[t][a]+=r*e[1][t][a]}function o(r,e){for(var t=0;t<r[0].length;t++)for(var a=0;a<r[0][t].length;a++)for(var n=0;n<r[0][t][a].length;n++)r[0][t][a][n]+=e[0][t][a][n];for(t=0;t<r[1].length;t++)for(a=0;a<r[1][t].length;a++)r[1][t][a]+=e[1][t][a];return r}function n(r,e){for(var t,a=r.length,n=_[e].length,o=new Array(n),l=0;l<n;l++)o[l]=_[e][l];for(l=0;l<n;l++)for(var s=0;s<a;s++)o[l]+=r[s]*g[e][l][s];for(l=0;l<n;l++)o[l]=(t=o[l],1/(1+Math.exp(-t)));return o}function u(r){for(var e=[],t=r,a=0;a<_.length;a++)t=n(t,a),e.push(t);return e}function f(r){for(var e=r,t=0;t<g.length;t++)e=n(e,t);return e}function d(r,e){for(var t=0,a=f(r),n=0;n<e.length;n++)t+=(a[n]-e[n])*(a[n]-e[n]);return t/2}function v(r,e){for(var t=[],a=[],n=0;n<g.length;n++)t.push(c(g[n].length,g[n][0].length)),a.push(h(_[n].length));var o=u(r),l=[];for(n=0;n<_.length;n++)l.push(h(_[n].length));for(n=_.length-1;0<=n;n--)for(var s=0;s<l[n].length;s++)if(n==_.length-1)l[n][s]=o[n][s]*(1-o[n][s])*(o[n][s]-e[s]);else{for(var i=0,f=0;f<l[n+1].length;f++)i+=g[n+1][f][s]*l[n+1][f];l[n][s]=o[n][s]*(1-o[n][s])*i}for(n=0;n<g.length;n++)for(f=0;f<g[n].length;f++)for(s=0;s<g[n][f].length;s++)t[n][f][s]=(0<n?o[n-1][s]:r[s])*l[n][f];for(n=0;n<_.length;n++)for(f=0;f<_[n].length;f++)a[n][f]=l[n][f];return[t,a]}function b(r){for(var e=v(r[0][0],r[0][1]),t=1;t<r.length;t++)e=o(e,v(r[t][0],r[t][1]));return e}function m(r){for(var e=r.length,t=Math.floor(e*Math.random()),a=v(r[t][0],r[t][1]),n=1;n<s;)a=o(a,v(r[t=Math.floor(e*Math.random())][0],r[t][1])),n++;return a}function p(r){for(var e=0,t=r[e],a=1;a<=r.length;a++)r[a]>t&&(t=r[a],e=a);return e}function x(r){for(var e=0,t=0;t<r.length;t++)e=2*e+Math.max(0,Math.min(Math.round(r[t]),1));return e}function y(r,e){var t=Math.sqrt((r[0]-e[0])*(r[0]-e[0])+(r[1]-e[1])*(r[1]-e[1]));return dG1=24/t,G1=[r[0]+dG1*(e[0]-r[0]),r[1]+dG1*(e[1]-r[1])],dG2=(t-26)/t,G2=[r[0]+dG2*(e[0]-r[0]),r[1]+dG2*(e[1]-r[1])],[G1,G2]}function C(r){var e=Math.max(0,Math.min(r,1)),t=[0,89,197],a=[255,255,255];return[Math.round(e*t[0]+(1-e)*a[0]),Math.round(e*t[1]+(1-e)*a[1]),Math.round(e*t[2]+(1-e)*a[2])]}function G(r,e,t,a){return[120+150*t,50*(e+r[t])/2-50*a-10]}this.set_number_of_iterations=function(r){return arguments.length<1?GlobalClasses.error_code("NeuralNetwork","set_number_of_iterations",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("NeuralNetwork","set_number_of_iterations",1):(l=Math.min(1e12,Math.max(Math.round(r),1)),!0)},this.set_batch_size=function(r){return arguments.length<1?GlobalClasses.error_code("NeuralNetwork","set_batch_size",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("NeuralNetwork","set_batch_size",1):(s=Math.max(1,Math.round(r)),!0)},this.set_learning_rate=function(r){return arguments.length<1?GlobalClasses.error_code("NeuralNetwork","set_learning_rate",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("NeuralNetwork","set_learning_rate",1):(i=Math.abs(r),!0)},this.init=function(r){if(arguments.length<1)return GlobalClasses.error_code("NeuralNetwork","init",0);if(1!=GlobalClasses.is_vector(r))return GlobalClasses.error_code("NeuralNetwork","init",1);if(r.length<2)return GlobalClasses.error_code("NeuralNetwork","init","Length of input vector must be at least 2.");for(var e=0;e<r.length;e++)r[e]=Math.max(1,Math.round(r[e]));g=[],_=[];for(e=0;e<r.length-1;e++){for(var t=c(r[e+1],r[e]),a=0;a<r[e+1];a++)for(var n=0;n<r[e];n++)t[a][n]=2*Math.random()-1;g.push(t);var o=h(r[e+1]);for(n=0;n<r[e+1];n++)o[n]=2*Math.random()-1;_.push(o)}return l=1e3,s=100,i=5,!0},this.evaluate=function(r){return 0==g.length?GlobalClasses.error_code("NeuralNetwork","evaluate",13):arguments.length<1?GlobalClasses.error_code("NeuralNetwork","evaluate",0):1!=GlobalClasses.is_vector(r)?GlobalClasses.error_code("NeuralNetwork","evaluate",1):r.length!=g[0][0].length?GlobalClasses.error_code("NeuralNetwork","evaluate","Improper dimension of function input data."):f(r)},this.train=function(r){if(0==g.length)return GlobalClasses.error_code("NeuralNetwork","train",13);if(arguments.length<1)return GlobalClasses.error_code("NeuralNetwork","train",0);if("object"!=typeof r||r.length<2)return GlobalClasses.error_code("NeuralNetwork","train",1);for(var e=0;e<r.length;e++){if("object"!=typeof r[e]||2!=r[e].length)return GlobalClasses.error_code("NeuralNetwork","train",1);if(1!=GlobalClasses.is_vector(r[e][0]))return GlobalClasses.error_code("NeuralNetwork","train",1);if(r[e][0].length!=g[0][0].length)return GlobalClasses.error_code("NeuralNetwork","train",1);if(1!=GlobalClasses.is_vector(r[e][1]))return GlobalClasses.error_code("NeuralNetwork","train",1);if(r[e][1].length!=_[_.length-1].length)return GlobalClasses.error_code("NeuralNetwork","train",1)}return r.length<=s?function(r){for(var e=i/r.length,t=0;t<l;t++)a(-e,b(r))}(r):function(r){for(var e=i/s,t=0;t<l;t++)a(-e,m(r))}(r),function(r){for(var e=0,t=0;t<r.length;t++)e+=d(r[t][0],r[t][1]);return e}(r)},this.test=function(r,e){if(0==g.length)return GlobalClasses.error_code("NeuralNetwork","test",13);if(arguments.length<2)return GlobalClasses.error_code("NeuralNetwork","test",0);if("object"!=typeof r||r.length<2)return GlobalClasses.error_code("NeuralNetwork","test",1);for(var t=0;t<r.length;t++){if("object"!=typeof r[t]||2!=r[t].length)return GlobalClasses.error_code("NeuralNetwork","test",1);if(1!=GlobalClasses.is_vector(r[t][0]))return GlobalClasses.error_code("NeuralNetwork","test",1);if(r[t][0].length!=g[0][0].length)return GlobalClasses.error_code("NeuralNetwork","test",1);if(1!=GlobalClasses.is_vector(r[t][1]))return GlobalClasses.error_code("NeuralNetwork","test",1);if(r[t][1].length!=_[_.length-1].length)return GlobalClasses.error_code("NeuralNetwork","test",1)}return 1!=GlobalClasses.is_string(e)?GlobalClasses.error_code("NeuralNetwork","test",1):"max"==e?function(r){for(var e=r[0][1].length,t=new Array(e),a=0;a<e;a++)t[a]=new Array(e);for(a=0;a<e;a++)for(var n=0;n<e;n++)t[a][n]=0;for(var o=0;o<r.length;o++){var l=f(r[o][0]);t[p(r[o][1])][p(l)]++}return t}(r):"round"==e?function(r){for(var e=1<<r[0][1].length,t=new Array(e),a=0;a<e;a++)t[a]=new Array(e);for(a=0;a<e;a++)for(var n=0;n<e;n++)t[a][n]=0;for(var o=0;o<r.length;o++){var l=f(r[o][0]);t[x(r[o][1])][x(l)]++}return t}(r):GlobalClasses.error_code("NeuralNetwork","test",1)},this.plot=function(r){if(0==g.length)return GlobalClasses.error_code("NeuralNetwork","plot",13);if(arguments.length<1)return GlobalClasses.error_code("NeuralNetwork","plot",0);if(1!=GlobalClasses.is_div(r))return GlobalClasses.error_code("NeuralNetwork","plot",11);for(var e=[g[0][0].length],t=e[0],a=0;a<_.length;a++)e.push(_[a].length),t=Math.max(t,_[a].length);var n=0;1<arguments.length&&1==GlobalClasses.is_vector(arguments[1])&&arguments[1].length==e[0]&&(n=u(arguments[1])).unshift(arguments[1]);Svg.init(r,150*(e.length-1)+240,50*(t-1)+80),Svg.clear("#f2f2f2");for(a=0;a<e.length-1;a++)for(var o=0;o<e[a];o++)for(var l=0;l<e[a+1];l++){var s=y(G(e,t,a,o),G(e,t,a+1,l));Svg.arrow(s[0][0],s[0][1],s[1][0],s[1][1],"#0059c5")}for(o=0;o<e[0];o++){s=y([(i=G(e,t,0,o))[0]-100,i[1]],i);Svg.arrow(s[0][0],s[0][1],s[1][0],s[1][1],"#0059c5")}for(o=0;o<e[e.length-1];o++){s=y(i=G(e,t,e.length-1,o),[i[0]+100,i[1]]);Svg.arrow(s[0][0],s[0][1],s[1][0],s[1][1],"#0059c5")}for(a=0;a<e.length;a++)for(o=0;o<e[a];o++){var i=G(e,t,a,o);Svg.disc(i[0],i[1],16,"#0059c5"),"number"==typeof n&&Svg.disc(i[0],i[1],14,C(.3)),"number"!=typeof n&&Svg.disc(i[0],i[1],14,C(n[a][o]))}return Svg.draw(),!0},this.get_weights=function(){return[g,_]},this.set_weights=function(r,e){if(arguments.length<2)return GlobalClasses.error_code("NeuralNetwork","set_weights",0);if(1==GlobalClasses.is_matrix(r)&&1==GlobalClasses.is_vector(e)&&(r=[r],e=[e]),"object"!=typeof r)return GlobalClasses.error_code("NeuralNetwork","set_weights",1);if("object"!=typeof e)return GlobalClasses.error_code("NeuralNetwork","set_weights",1);if(r.length!=e.length)return GlobalClasses.error_code("NeuralNetwork","set_weights","Invalid input data.");for(var t=r.length,a=!1,n=0;n<t;n++)1!=GlobalClasses.is_matrix(r[n])&&(a=!0),1!=GlobalClasses.is_vector(e[n])&&(a=!0);if(1==a)return GlobalClasses.error_code("NeuralNetwork","set_weights","Invalid input data.");var o=[r[0][0].length];for(n=0;n<t;n++)o.push(e[n].length);var l=!1;for(n=0;n<t;n++)r[n].length!=o[n+1]&&(l=!0),r[n][0].length!=o[n]&&(l=!0);if(1==l)return GlobalClasses.error_code("NeuralNetwork","set_weights",2);g=[],_=[];for(n=0;n<t;n++){for(var s=c(o[n+1],o[n]),i=0;i<o[n+1];i++)for(var f=0;f<o[n];f++)s[i][f]=r[n][i][f];g.push(s);var u=h(o[n+1]);for(i=0;i<o[n+1];i++)u[i]=e[n][i];_.push(u)}return!0},this.export_weights=function(r){if(0==g.length)return GlobalClasses.error_code("NeuralNetwork","export_weights",13);if(arguments.length<1)return GlobalClasses.error_code("NeuralNetwork","export_weights",0);if(1!=GlobalClasses.is_textarea(r))return GlobalClasses.error_code("NeuralNetwork","export_weights",12);for(var e="var w = [",t=0;t<g.length;t++){e+="[";for(var a=0;a<g[t].length;a++){e+="[";for(var n=0;n<g[t][a].length;n++)e+=g[t][a][n].toFixed(4)+(n<g[t][a].length-1?",":"");e+="]"+(a<g[t].length-1?",":"")}e+="]"+(t<g.length-1?",":"")}e+="];\n\n",e+="var b = [";for(t=0;t<_.length;t++){e+="[";for(a=0;a<_[t].length;a++)e+=_[t][a].toFixed(4)+(a<_[t].length-1?",":"");e+="]"+(t<_.length-1?",":"")}e+="];\n\n",document.getElementById(r).value=e}},NeuralNetwork=new NeuralNetwork_taramathObject,NonlinearProgramming_taramathObject=function(){var glb_int_iterations_var=0,glb_int_maxiterations_var=1e3,glb_float_accuracy_cal=1e-6,glb_array_x_var=[],glb_func_f_var="0",glb_bool_scalar_var=!1,glb_bool_maximize_var=!1;function eval_string(z){var y="fail",x="number"==typeof z?[z]:z;try{with(Math)y=eval(glb_func_f_var);1!=isFinite(y)&&(y="fail")}catch(r){y="fail"}return y}function eval_function(r){var e="fail";try{e=glb_func_f_var(1==glb_bool_scalar_var?r[0]:r),1!=isFinite(e)&&(e="fail")}catch(r){e="fail"}return e}function eval_func(r){return"string"==typeof glb_func_f_var?eval_string(r):eval_function(r)}function func_consistency(r){var e=eval_func(r);return"number"==typeof e&&1==isFinite(e)}function f(r){var e=eval_func(r);return"number"!=typeof e||1!=isFinite(e)?0:(1==glb_bool_maximize_var&&(e*=-1),e)}function get_gradient(r){for(var e=r.length,t=new Array(e),a=new Array(e),n=0;n<e;n++)a[n]=r[n];for(n=0;n<e;n++)a[n]=r[n]+1e-6,t[n]=f(a),a[n]=r[n]-1e-6,t[n]-=f(a),t[n]/=2e-6,a[n]=r[n];return t}function gradient_method(r){for(var e=r.length,t=new Array(e),a=0;a<e;a++)t[a]=r[a];for(var n=f(t),o=1,l="run";glb_int_iterations_var<glb_int_maxiterations_var&&"run"==l;){glb_int_iterations_var++;var s=get_gradient(t),i=new Array(e);for(a=0;a<e;a++)i[a]=t[a]-o*s[a];var u=f(i),g=0;for(a=0;a<e;a++)g+=Math.abs(s[a]);if(g<=glb_float_accuracy_cal)l="done";else if(1e10<o)l="illposed";else{for(a=g=0;a<e;a++)g+=Math.abs(t[a]);if(1e12<g)l="unbounded";else if(u!=n)if(u<n){for(a=0;a<e;a++)t[a]=i[a];n=u,o*=1.7}else{for(;n<u&&glb_float_accuracy_cal<o;){o*=.53;for(a=0;a<e;a++)i[a]=t[a]-o*s[a];u=f(i)}if(o<=glb_float_accuracy_cal)l="done";else{for(a=0;a<e;a++)t[a]=i[a];n=u}}else o*=.87}}return"illposed"==l?"illposed":"unbounded"==l?"unbounded":[t,n]}function simplex_size(r){for(var e=r.length-1,t=0,a=new Array(e),n=0;n<e;n++)a[n]=0;for(var o=0;o<=e;o++)for(n=0;n<e;n++)a[n]+=r[o][n];for(n=0;n<e;n++)a[n]/=e+1;for(o=0;o<=e;o++){var l=0;for(n=0;n<e;n++)l+=(a[n]-r[o][n])*(a[n]-r[o][n]);t=Math.max(t,Math.sqrt(l))}return t}function nelder_mead(r){for(var e=r.length,t=new Array(e+1),a=new Array(e+1),n="run",o=0,l=0;l<=e;l++){t[l]=new Array(e);for(var s=0;s<e;s++)t[l][s]=r[s]}for(s=0;s<e;s++)t[s][s]*=1.05,Math.abs(t[s][s])<25e-5&&(t[s][s]=25e-5*(0<=t[s][s]?1:-1));for(l=0;l<=e;l++)a[l]=f(t[l]);for(;glb_int_iterations_var<glb_int_maxiterations_var&&"run"==n;){glb_int_iterations_var++;var i=Sort.permutation(a);if(simplex_size(t)<glb_float_accuracy_cal&&a[i[e]]-a[i[0]]<glb_float_accuracy_cal)n="done",o=i[0];else{var u=0;for(s=0;s<e;s++)u+=Math.abs(t[i[0]][s]);if(1e20<u)n="unbounded";else{var g=new Array(e);for(s=0;s<e;s++)g[s]=0;for(s=0;s<e;s++)for(l=0;l<e;l++)g[s]+=t[i[l]][s];for(s=0;s<e;s++)g[s]/=e;var _=new Array(e);for(s=0;s<e;s++)_[s]=2*g[s]-t[i[e]][s];var h=f(_);if(h<a[i[0]]){var c=new Array(e);for(s=0;s<e;s++)c[s]=3*g[s]-2*t[i[e]][s];var d=f(c);if(d<h){for(s=0;s<e;s++)t[i[e]][s]=c[s];a[i[e]]=d}else{for(s=0;s<e;s++)t[i[e]][s]=_[s];a[i[e]]=h}}else if(h<a[i[e-1]]){for(s=0;s<e;s++)t[i[e]][s]=_[s];a[i[e]]=h}else{var v=new Array(e);if(h<a[i[e]])for(s=0;s<e;s++)v[s]=.5*g[s]+.5*_[s];else for(s=0;s<e;s++)v[s]=.5*g[s]+.5*t[i[e]][s];var b=f(v);if(b<a[i[e]]){for(s=0;s<e;s++)t[i[e]][s]=v[s];a[i[e]]=b}else for(l=1;l<=e;l++){for(s=0;s<e;s++)t[i[l]][s]=.5*t[i[0]][s]+.5*t[i[l]][s];a[i[l]]=f(t[i[l]])}}}}}return"unbounded"==n?"unbounded":[t[o],a[o]]}function assign_global_variables(r,e){if(1==GlobalClasses.is_vector(e)){glb_bool_scalar_var=!1,glb_array_x_var=new Array(e.length);for(var t=0;t<e.length;t++)glb_array_x_var[t]=e[t]}return 1==GlobalClasses.is_number(e)&&(glb_bool_scalar_var=!0,glb_array_x_var=[e]),1==GlobalClasses.is_function(r)&&(glb_func_f_var=r),1==GlobalClasses.is_string(r)&&0==(glb_func_f_var=GlobalClasses.check_function_string_array(r))?"invalidstring":0!=func_consistency(glb_array_x_var)||"inconsistency"}this.set_accuracy=function(r){return arguments.length<1?GlobalClasses.error_code("NonlinearProgramming","set_accuracy",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("NonlinearProgramming","set_accuracy",1):(glb_float_accuracy_cal=Math.min(1,Math.max(r,1e-12)),!0)},this.set_maximal_iterations=function(r){return arguments.length<1?GlobalClasses.error_code("NonlinearProgramming","set_maximal_iterations",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("NonlinearProgramming","set_maximal_iterations",1):(glb_int_maxiterations_var=Math.min(1e12,Math.max(Math.round(r),1)),!0)},this.get_number_of_iterations=function(){return glb_int_iterations_var},this.minimize=function(r,e){if(2!=arguments.length)return GlobalClasses.error_code("NonlinearProgramming","minimize",0);if(1!=GlobalClasses.is_string(r)&&1!=GlobalClasses.is_function(r))return GlobalClasses.error_code("NonlinearProgramming","minimize",1);if(1!=GlobalClasses.is_number(e)&&1!=GlobalClasses.is_vector(e))return GlobalClasses.error_code("NonlinearProgramming","minimize",1);glb_int_iterations_var=0,glb_bool_maximize_var=!1;var t=assign_global_variables(r,e);if("invalidstring"==t)return GlobalClasses.error_code("NonlinearProgramming","minimize",24);if("inconsistency"==t)return GlobalClasses.error_code("NonlinearProgramming","minimize",23);var a=nelder_mead(glb_array_x_var);return"unbounded"==a||"illposed"==a?GlobalClasses.error_code("NonlinearProgramming","minimize",25):(glb_int_maxiterations_var<=glb_int_iterations_var&&GlobalClasses.warning_code("NonlinearProgramming","minimize","Maximum number of iterations achieved. Result may not satisfy expected accuracy."),1==glb_bool_scalar_var?[a[0][0],a[1]]:[a[0],a[1]])},this.maximize=function(r,e){if(2!=arguments.length)return GlobalClasses.error_code("NonlinearProgramming","maximize",0);if(1!=GlobalClasses.is_string(r)&&1!=GlobalClasses.is_function(r))return GlobalClasses.error_code("NonlinearProgramming","maximize",1);if(1!=GlobalClasses.is_number(e)&&1!=GlobalClasses.is_vector(e))return GlobalClasses.error_code("NonlinearProgramming","maximize",1);glb_bool_maximize_var=!(glb_int_iterations_var=0);var t=assign_global_variables(r,e);if("invalidstring"==t)return GlobalClasses.error_code("NonlinearProgramming","maximize",24);if("inconsistency"==t)return GlobalClasses.error_code("NonlinearProgramming","maximize",23);var a=nelder_mead(glb_array_x_var);return"unbounded"==a||"illposed"==a?GlobalClasses.error_code("NonlinearProgramming","maximize",25):(glb_int_maxiterations_var<=glb_int_iterations_var&&GlobalClasses.warning_code("NonlinearProgramming","maximize","Maximum number of iterations achieved. Result may not satisfy expected accuracy."),1==glb_bool_scalar_var?[a[0][0],-a[1]]:[a[0],-a[1]])},this.gradient_descent=function(r,e){if(2!=arguments.length)return GlobalClasses.error_code("NonlinearProgramming","gradient_descent",0);if(1!=GlobalClasses.is_string(r)&&1!=GlobalClasses.is_function(r))return GlobalClasses.error_code("NonlinearProgramming","gradient_descent",1);if(1!=GlobalClasses.is_number(e)&&1!=GlobalClasses.is_vector(e))return GlobalClasses.error_code("NonlinearProgramming","gradient_descent",1);glb_int_iterations_var=0,glb_bool_maximize_var=!1;var t=assign_global_variables(r,e);if("invalidstring"==t)return GlobalClasses.error_code("NonlinearProgramming","gradient_descent",24);if("inconsistency"==t)return GlobalClasses.error_code("NonlinearProgramming","gradient_descent",23);var a=gradient_method(glb_array_x_var);return"unbounded"==a||"illposed"==a?GlobalClasses.error_code("NonlinearProgramming","gradient_descent",25):(glb_int_maxiterations_var<=glb_int_iterations_var&&GlobalClasses.warning_code("NonlinearProgramming","gradient_descent","Maximum number of iterations achieved. Result may not satisfy expected accuracy."),1==glb_bool_scalar_var?[a[0][0],a[1]]:[a[0],a[1]])}},NonlinearProgramming=new NonlinearProgramming_taramathObject,Ode_taramathObject=function(){var glb_float_alpha_cal=.8,glb_float_beta_cal=1.5,glb_int_dimension_var=0,glb_int_order_var=0,glb_int_n_var=0,glb_array_f_var=new Array,glb_array_solution_var=new Array,glb_int_animation_var=0,glb_array_animation_var=new Array,glb_int_method_var=5,glb_float_epsilon_var=1e-10,glb_float_grid_size_var=0,glb_array_A_var=new Array(new Array(0,0),new Array(1,0)),glb_array_b_var=new Array(0,1),glb_array_options_var=new Array("multi","dots","label_off");function string_delete_whitespaces(r){if("string"!=typeof r)return"";for(var e=r;-1<e.indexOf("(t)");)e=e.replace("(t)","");return e.replace(/\s/g,"")}function string_delete_brackets(r){var e=string_delete_whitespaces(r);return e=(e=(e=(e=(e=(e=(e=e.replace(/\(/g,"")).replace(/\)/g,"")).replace(/\[/g,"")).replace(/\]/g,"")).replace(/\{/g,"")).replace(/\}/g,"")).replace(/\;/g,"")}function string_get_order(r){return("-"+r+"-").split("'").length-1}function string_get_variablenumber(r){var e=r.split("'")[0].replace("x",""),t=parseInt(e);return 1==isNaN(e)&&(t=0),t}function string_to_array(r){for(var e=string_delete_brackets(r).split(","),t=new Array(e.length),a=0;a<t.length;a++){var n=parseFloat(e[a]);t[a]=isFinite(n)?n:0}return t}function string_to_function(r){glb_int_n_var=glb_int_order_var=glb_int_dimension_var=0;var e=r;if(-1==e.indexOf("x1")){for(;-1<e.indexOf("max");)e=e.replace("max","ma8");for(;-1<e.indexOf("exp");)e=e.replace("exp","e8p");for(;-1<e.indexOf("x");)e=e.replace("x","#");for(;-1<e.indexOf("#");)e=e.replace("#","x1");for(;-1<e.indexOf("ma8");)e=e.replace("ma8","max");for(;-1<e.indexOf("e8p");)e=e.replace("e8p","exp")}for(var t=string_delete_whitespaces(e).split(";"),a=new Array,n=new Array,o=0;o<t.length;o++){2==(h=t[o].split("=")).length&&(a.push(h[0]),n.push(h[1]))}if(a.length<1)return!1;glb_int_dimension_var=a.length;var l=string_get_order(a[0]),s=!1;l<0&&(s=!0);for(o=1;o<glb_int_dimension_var;o++)string_get_order(a[o])!=l&&(s=!0);if(1==s)return!1;glb_int_n_var=(glb_int_order_var=l)*glb_int_dimension_var,glb_array_f_var=new Array(glb_int_n_var);for(o=0;o<glb_int_n_var;o++)glb_array_f_var[o]="x"+(o+1+glb_int_dimension_var);for(o=glb_int_order_var-1;0<o;o--){for(var i="'",f=2;f<=o;f++)i+="'";for(f=1;f<=glb_int_dimension_var;f++)for(var u="x"+f+i,g="x"+(o*glb_int_dimension_var+f),_=0;_<glb_int_dimension_var;_++)for(;-1<n[_].indexOf(u);)n[_]=n[_].replace(u,g)}for(o=0;o<glb_int_dimension_var;o++){var h;0<=(h=string_get_variablenumber(a[o])-1)&&h<glb_int_dimension_var&&(glb_array_f_var[glb_int_dimension_var*(glb_int_order_var-1)+h]=n[o])}for(o=0;o<glb_int_n_var;o++)for(f=glb_int_n_var;0<f;f--){for(u="x"+f,g="X["+(f-1)+"]";-1<glb_array_f_var[o].indexOf(u);)glb_array_f_var[o]=glb_array_f_var[o].replace(u,g);for(;-1<glb_array_f_var[o].indexOf("(t)");)glb_array_f_var[o]=glb_array_f_var[o].replace("(t)","")}}function string_to_init_vector(r){for(var e=new Array(glb_int_n_var),t=0;t<e.length;t++)e[t]=0;if(-1==r.indexOf("=")){var a=string_to_array(r);for(t=0;t<Math.min(e.length,a.length);t++)e[t]=a[t];return e}for(var n=r.split(";"),o=new Array,l=new Array,s=0;s<n.length;s++){2==(i=n[s].split("=")).length&&(o.push(i[0]),l.push(i[1]))}for(s=0;s<o.length;s++){var i;if(0<=(i=string_get_order(o[s]))&&i<glb_int_order_var)for(a=string_to_array(l[s]),t=0;t<Math.min(glb_int_dimension_var,a.length);t++){var f=i*glb_int_dimension_var+t;f<e.length&&(e[f]=a[t])}}return e}function eval_string(X){for(var y=new Array(X.length),k=0;k<y.length;k++)try{var t=0;with(Math)t=eval(glb_array_f_var[k]);y[k]=isFinite(t)?t:0}catch(r){y[k]=0}return y}function add_point_to_solution(r,e){glb_array_solution_var[0].push(r);for(var t=0;t<glb_int_dimension_var;t++)glb_array_solution_var[t+1].push(e[t])}function add_point_to_solution_step(r,e,t,a,n){for(var o=n;o<=t;){var l=(o-r)/(t-r);glb_array_solution_var[0].push(o);for(var s=0;s<glb_int_dimension_var;s++)glb_array_solution_var[s+1].push((1-l)*e[s]+l*a[s]);o+=glb_float_grid_size_var}return o}function psi_user(r,e){for(var t=new Array(e.length),a=glb_array_A_var.length,n=new Array(a),o=0;o<a;o++){for(var l=0;l<t.length;l++){for(var s=0,i=0;i<o;i++)s+=glb_array_A_var[o][i]*n[i][l];t[l]=e[l]+r*s}n[o]=eval_string(t)}for(l=0;l<t.length;l++){for(s=0,o=0;o<a;o++)s+=glb_array_b_var[o]*n[o][l];t[l]=e[l]+r*s}return t}function psi_euler(r,e){for(var t=new Array(e.length),a=eval_string(e),n=0;n<t.length;n++)t[n]=e[n]+r*a[n];return t}function psi_midpoint(r,e){for(var t=new Array(e.length),a=eval_string(e),n=0;n<t.length;n++)t[n]=e[n]+r*a[n]/2;var o=eval_string(t);for(n=0;n<t.length;n++)t[n]=e[n]+r*o[n];return t}function psi_trapezoid(r,e){for(var t=new Array(e.length),a=eval_string(e),n=0;n<t.length;n++)t[n]=e[n]+r*a[n];var o=eval_string(t);for(n=0;n<t.length;n++)t[n]=e[n]+r*(a[n]/2+o[n]/2);return t}function psi_heun(r,e){for(var t=new Array(e.length),a=eval_string(e),n=0;n<t.length;n++)t[n]=e[n]+r*a[n]/3;var o=eval_string(t);for(n=0;n<t.length;n++)t[n]=e[n]+2*r*o[n]/3;var l=eval_string(t);for(n=0;n<t.length;n++)t[n]=e[n]+r*(a[n]/4+3*l[n]/4);return t}function psi_simpson(r,e){for(var t=new Array(e.length),a=eval_string(e),n=0;n<t.length;n++)t[n]=e[n]+r*a[n]/2;var o=eval_string(t);for(n=0;n<t.length;n++)t[n]=e[n]+r*(-1*a[n]+2*o[n]);var l=eval_string(t);for(n=0;n<t.length;n++)t[n]=e[n]+r*(a[n]/6+2*o[n]/3+l[n]/6);return t}function psi_runge(r,e){for(var t=new Array(e.length),a=eval_string(e),n=0;n<t.length;n++)t[n]=e[n]+r*a[n]/2;var o=eval_string(t);for(n=0;n<t.length;n++)t[n]=e[n]+r*o[n]/2;var l=eval_string(t);for(n=0;n<t.length;n++)t[n]=e[n]+r*l[n];var s=eval_string(t);for(n=0;n<t.length;n++)t[n]=e[n]+r*(a[n]/6+o[n]/3+l[n]/3+s[n]/6);return t}function psi(r,e){return 41==glb_int_method_var?psi_runge(r,e):32==glb_int_method_var?psi_simpson(r,e):31==glb_int_method_var?psi_heun(r,e):22==glb_int_method_var?psi_trapezoid(r,e):21==glb_int_method_var?psi_midpoint(r,e):11==glb_int_method_var?psi_euler(r,e):255==glb_int_method_var?psi_user(r,e):void 0}function runge_kutta(r,e,t){var a=0,n=r;for(add_point_to_solution(a,n);a<e;)add_point_to_solution(a+=t,n=psi(t,n))}function runge_kutta_step(r,e,t){var a=0,n=r;add_point_to_solution(a,n);for(var o=glb_float_grid_size_var;a<e;){for(var l=a,s=new Array(n.length),i=0;i<n.length;i++)s[i]=n[i];n=psi(t,n),o<=(a+=t)&&(o=add_point_to_solution_step(l,s,a,n,o))}}function norm(r){for(var e=0,t=0;t<r.length;t++)e+=r[t]*r[t];return Math.sqrt(e)}function distance(r,e){for(var t=0,a=0;a<r.length;a++)t+=(r[a]-e[a])*(r[a]-e[a]);return Math.sqrt(t)}function psi_adaptive32(r,e){for(var t=new Array(e.length),a=new Array(e.length),n=eval_string(e),o=0;o<t.length;o++)t[o]=e[o]+r*n[o]/2;var l=eval_string(t);for(o=0;o<t.length;o++)t[o]=e[o]+3*r*l[o]/4;var s=eval_string(t);for(o=0;o<t.length;o++)t[o]=e[o]+r*(2*n[o]+3*l[o]+4*s[o])/9;var i=eval_string(t);for(o=0;o<t.length;o++)a[o]=r*(5*n[o]/72-l[o]/12-s[o]/9+i[o]/8);return new Array(norm(a),t)}function psi_adaptive43(r,e){for(var t=new Array(e.length),a=new Array(e.length),n=eval_string(e),o=0;o<t.length;o++)t[o]=e[o]+r*n[o]/2;var l=eval_string(t);for(o=0;o<t.length;o++)t[o]=e[o]+r*l[o]/2;var s=eval_string(t);for(o=0;o<t.length;o++)t[o]=e[o]+r*s[o];var i=eval_string(t);for(o=0;o<t.length;o++)t[o]=e[o]+r*(n[o]/6+l[o]/3+s[o]/3+i[o]/6);var f=eval_string(t);for(o=0;o<t.length;o++)a[o]=r*(i[o]-f[o])/6;return new Array(norm(a),t)}function psi_adaptive54(r,e){for(var t=new Array(e.length),a=new Array(e.length),n=eval_string(e),o=0;o<t.length;o++)t[o]=e[o]+r*n[o]/5;var l=eval_string(t);for(o=0;o<t.length;o++)t[o]=e[o]+r*(3*n[o]/40+9*l[o]/40);var s=eval_string(t);for(o=0;o<t.length;o++)t[o]=e[o]+r*(44*n[o]/45-56*l[o]/15+32*s[o]/9);var i=eval_string(t);for(o=0;o<t.length;o++)t[o]=e[o]+r*(19372*n[o]/6561-25360*l[o]/2187+64448*s[o]/6561-212*i[o]/729);var f=eval_string(t);for(o=0;o<t.length;o++)t[o]=e[o]+r*(9017*n[o]/3168-355*l[o]/33+46732*s[o]/5247+49*i[o]/176-5103*f[o]/18656);var u=eval_string(t);for(o=0;o<t.length;o++)t[o]=e[o]+r*(35*n[o]/384+500*s[o]/1113+125*i[o]/192-2187*f[o]/6784+11*u[o]/84);var g=eval_string(t);for(o=0;o<t.length;o++)a[o]=r*(71*n[o]/57600-71*s[o]/16695+71*i[o]/1920-17253*f[o]/339200+22*u[o]/525-g[o]/40);return new Array(norm(a),t)}function float_next_step_size(r,e,t){var a=glb_float_beta_cal-r*(glb_float_beta_cal-1);return e<=glb_float_epsilon_var*r*Math.pow(glb_float_alpha_cal/a,t)?a*r:glb_float_alpha_cal*r*Math.pow(glb_float_epsilon_var*r/e,1/t)}function psi_adaptive(r,e){return 3==glb_int_method_var?psi_adaptive32(r,e):4==glb_int_method_var?psi_adaptive43(r,e):5==glb_int_method_var?psi_adaptive54(r,e):void 0}function adaptive_runge_kutta(r,e){var t=0,a=r;add_point_to_solution(t,a);for(var n=glb_float_epsilon_var;t<e;){var o=psi_adaptive(n,a);add_point_to_solution(t+=n,a=o[1]),n=float_next_step_size(n,o[0],glb_int_method_var)}}function adaptive_runge_kutta_step(r,e){var t=0,a=r;add_point_to_solution(t,a);for(var n=glb_float_grid_size_var,o=glb_float_epsilon_var;t<e;){for(var l=t,s=new Array(a.length),i=0;i<a.length;i++)s[i]=a[i];var f=psi_adaptive(o,a);a=f[1],n<=(t+=o)&&(n=add_point_to_solution_step(l,s,t,a,n)),o=float_next_step_size(o,f[0],glb_int_method_var)}}function plot_multi(r,e,t){for(var a=new Array(glb_array_solution_var.length-1),n=0;n<a.length;n++)a[n]=new Array;for(n=0;n<a.length;n++)for(var o=0;o<glb_array_solution_var[0].length;o++)a[n].push(new Array(glb_array_solution_var[0][o],glb_array_solution_var[n+1][o]));var l=1<a.length?"x1(t) ... x"+a.length+"(t)":"x1(t)";Plot.init(r,e,t),Plot.options(glb_array_options_var[1]),Plot.caption("time t",l);for(n=0;n<a.length;n++)Plot.add_list(a[n]);if("label"==glb_array_options_var[2])for(n=0;n<a.length;n++){var s=Math.floor((n+1)/Math.max(12,a.length+1)*a[n].length);Plot.label("x"+(n+1)+"(t)",a[n][s][0],a[n][s][1])}Plot.draw()}function plot_single(r,e,t){for(j=0;j<glb_int_dimension_var;j++){for(var a=new Array,n=0;n<glb_array_solution_var[0].length;n++)a.push(new Array(glb_array_solution_var[0][n],glb_array_solution_var[j+1][n]));var o="div"+(1e10*Math.random()).toFixed(0),l=document.createElement("div");l.setAttribute("id",o),document.getElementById(r).appendChild(l),Plot.init(o,e,t),Plot.options(glb_array_options_var[1]),Plot.caption("time t","x"+(j+1)+"(t)"),Plot.list(a)}}function plot_2d(r,e,t){for(var a=new Array,n=0;n<glb_array_solution_var[0].length;n++)a.push(new Array(glb_array_solution_var[1][n],glb_array_solution_var[2][n]));Plot.init(r,e,t),Plot.options(glb_array_options_var[1]),Plot.caption("x1","x2"),Plot.list(a)}function plot_animation_step(){for(var r=new Array,e=0;e<glb_array_solution_var[0].length;e++)r.push(new Array(glb_array_solution_var[1][e],glb_array_solution_var[2][e]));var t=new Array;t.push(r[Math.min(glb_int_animation_var,r.length-1)]),++glb_int_animation_var>=r.length+50&&(glb_int_animation_var=0),Plot.init(glb_array_animation_var[0],glb_array_animation_var[1],glb_array_animation_var[2]),Plot.caption("x1","x2"),Plot.options("line"),Plot.add_list(r),Plot.options("dots"),Plot.add_list(t),Plot.draw()}function plot_animation(r,e,t){glb_int_animation_var=0,glb_array_animation_var=new Array(r,e,t),window.setInterval(plot_animation_step,40)}this.define_method=function(){var r;if(0<arguments.length&&"string"==typeof arguments[0])return"adaptive32"==(r=arguments[0])&&(glb_int_method_var=3,glb_float_epsilon_var=1e-6),"adaptive43"==r&&(glb_int_method_var=4,glb_float_epsilon_var=1e-8),"adaptive54"==r&&(glb_int_method_var=5,glb_float_epsilon_var=1e-10),"euler"==r&&(glb_int_method_var=11),"midpoint"==r&&(glb_int_method_var=21),"trapezoid"==r&&(glb_int_method_var=22),"heun"==r&&(glb_int_method_var=31),"simpson"==r&&(glb_int_method_var=32),"runge"==r&&(glb_int_method_var=41),!0;if(0<arguments.length&&"number"==typeof arguments[0])return 32==(r=parseInt(arguments[0]))&&(glb_int_method_var=3,glb_float_epsilon_var=1e-6),43==r&&(glb_int_method_var=4,glb_float_epsilon_var=1e-8),54==r&&(glb_int_method_var=5,glb_float_epsilon_var=1e-10),1<=r&&r<=4&&(glb_int_method_var=10*r+1),!0;if(1<arguments.length&&"object"==typeof arguments[0]&&"object"==typeof arguments[1]){for(var e=arguments[0],t=arguments[1],a=t.length,n=!1,o=0;o<a;o++)"number"!=typeof t[o]&&(n=!0);for(o=0;o<a;o++)for(var l=0;l<a;l++)"number"!=typeof e[o][l]&&(n=!0);if(0==n){glb_array_b_var=new Array(a);for(o=0;o<a;o++)glb_array_b_var[o]=t[o];glb_array_A_var=new Array(a);for(o=0;o<a;o++)glb_array_A_var[o]=new Array(a);for(o=0;o<a;o++)for(l=0;l<a;l++)glb_array_A_var[o][l]=e[o][l];glb_int_method_var=255}return!0}return GlobalClasses.error_code("Ode","define_method",1)},this.set_accuracy=function(r){return arguments.length<1?GlobalClasses.error_code("Ode","set_accuracy",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("Ode","set_accuracy",1):(glb_float_epsilon_var=Math.max(r,1e-12),!0)},this.equidistant_grid=function(r){return arguments.length<1?GlobalClasses.error_code("Ode","equidistant_grid",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("Ode","equidistant_grid",1):(glb_float_grid_size_var=Math.max(r,0),!0)},this.get_solution=function(){return glb_array_solution_var},this.solve=function(){if(arguments.length<3)return GlobalClasses.error_code("Ode","solve",0);if(1!=GlobalClasses.is_string(arguments[0]))return GlobalClasses.error_code("Ode","solve",1);if(1!=GlobalClasses.is_string(arguments[1]))return GlobalClasses.error_code("Ode","solve",1);if(1!=GlobalClasses.is_number(arguments[2]))return GlobalClasses.error_code("Ode","solve",1);string_to_function(arguments[0]);var r=string_to_init_vector(arguments[1]),e=Math.max(0,arguments[2]);glb_array_solution_var=new Array(glb_int_dimension_var+1);for(var t=0;t<glb_int_dimension_var+1;t++)glb_array_solution_var[t]=new Array;if(10<glb_int_method_var){var a=1e-10;return a=arguments.length<4||"number"!=typeof arguments[3]?Math.max(a,.001*e):Math.max(a,arguments[3]),1e-12<glb_float_grid_size_var?runge_kutta_step(r,e,a):runge_kutta(r,e,a),!0}return glb_int_method_var<10?(1e-12<glb_float_grid_size_var?adaptive_runge_kutta_step(r,e):adaptive_runge_kutta(r,e),!0):GlobalClasses.error_code("Ode","solve",10)},this.plot_options=function(){for(var r=0;r<arguments.length;r++)if("string"==typeof arguments[r]){var e=arguments[r];"multi"!=e&&"single"!=e&&"2d"!=e&&"animation"!=e||(glb_array_options_var[0]=e),"dots"!=e&&"line"!=e&&"joined"!=e||(glb_array_options_var[1]=e),"label_off"!=e&&"label"!=e||(glb_array_options_var[2]=e)}return!0},this.plot_solution=function(r,e,t){return arguments.length<3?GlobalClasses.error_code("Ode","plot_solution",0):1!=GlobalClasses.is_div(r)?GlobalClasses.error_code("Ode","plot_solution",11):1!=GlobalClasses.is_number(e)?GlobalClasses.error_code("Ode","plot_solution",1):1!=GlobalClasses.is_number(t)?GlobalClasses.error_code("Ode","plot_solution",1):0==glb_array_solution_var.length?GlobalClasses.error_code("Ode","plot_solution",14):(2==glb_int_dimension_var&&"animation"==glb_array_options_var[0]?plot_animation(r,e,t):2==glb_int_dimension_var&&"2d"==glb_array_options_var[0]?plot_2d(r,e,t):"single"==glb_array_options_var[0]?plot_single(r,e,t):plot_multi(r,e,t),!0)}},Ode=new Ode_taramathObject,Plot_taramathObject=function(){var div_id="div",init_ready=!1,width=320,height=320,xmin=1,xmax=0,ymin=1,ymax=0,svg_txt="",T=new Array,T_options=new Array,pins_x=new Array,pins_y=new Array,caption=new Array("",""),label=new Array,options=new Array("dots","filling_off","grid_level","frame","animation_off","black_white","","","",""),omega=Math.PI/4,e1=new Array(.65*Math.cos(omega),Math.sin(omega)),e2=new Array(-.65*Math.sin(omega),Math.cos(omega)),e3=new Array(0,4.2),U=new Array,color=["#0059c5","#de102d","#359f2f","#fec806","#ff7f2a"],color_table=[];function eval_f1d(x,txt){var z=0;try{var t=0;with(Math)t=eval(txt);1==isFinite(t)&&(z=t)}catch(r){z=0}return z}function eval_f2d(x,y,txt){var z=0;try{var t=0;with(Math)t=eval(txt);1==isFinite(t)&&(z=t)}catch(r){z=0}return z}function number_digits(r){var e=Math.abs(r);return 100<=e?0:1<=e?1:.1<=e?2:.01<=e?3:.001<=e?4:1e-4<=e?5:1e-5<=e?6:7}function pins_int100(r){var e=new Array,t=Math.max(Math.floor(r),0);if(t<12)for(var a=1;a<=t;a+=1)e.push(a);else if(t<24)for(a=2;a<=t;a+=2)e.push(a);else if(t<60)for(a=5;a<=t;a+=5)e.push(a);else for(a=10;a<=t;a+=10)e.push(a);return e}function pins_float(r,e){var t=new Array;if(e<=r)return t.push(r),t;for(var a=e-r,n=0;a<10;)a*=10,n--;for(;100<=a;)a/=10,n++;for(var o=(t=pins_int100(Math.floor(a)))[1]-t[0],l=0;l<2;l++)t.push(t[t.length-1]+o);for(l=0;l<2;l++)t.unshift(t[0]-o);for(var s=Math.pow(10,n),i=Math.floor(r*Math.pow(10,-n)/t[0])*Math.pow(10,n)*t[0],f=0;f<t.length;f++)t[f]=t[f]*s+i;for(;t[0]<=r+.025*(e-r);)t.shift();for(;t[t.length-1]>=e-.025*(e-r);)t.pop();return t}function calculate_pins(){pins_x=pins_float(xmin,xmax),pins_y=pins_float(ymin,ymax)}function L(r){var e=new Array((r[0]-xmin)/(xmax-xmin),(r[1]-ymin)/(ymax-ymin));return"frame"==options[3]?new Array(70+e[0]*(width-80),height-(60+e[1]*(height-80))):new Array(e[0]*width,height-e[1]*height)}function plot_dot(r,e){var t=L(r);svg_txt+='<circle cx="'+t[0].toFixed(3)+'" cy="'+t[1].toFixed(3)+'" r="2.5" style="fill:'+e+'; stroke:none;" />'}function plot_arrow(r,e,t){if(t<=1e-6)plot_dot(r,"#000000");else{var a=L(r),n=new Array(a[0]+24*t*Math.cos(e),a[1]-24*t*Math.sin(e));svg_txt+='<line x1="'+a[0].toFixed(3)+'" y1="'+a[1].toFixed(3)+'" x2="'+n[0].toFixed(3)+'" y2="'+n[1].toFixed(3)+'" style="fill:none; stroke:#000000; stroke-width:1.4; stroke-linecap:round;" />';var o=new Array(30*Math.cos(e),30*Math.sin(e)),l=new Array(n[0]+35*Math.cos(e)-o[0],n[1]-35*Math.sin(e)+o[1]),s=new Array(n[0]+28*Math.cos(e)-o[0],n[1]-28*Math.sin(e)+o[1]),i=new Array(n[0]+25*Math.cos(e+.15)-o[0],n[1]-25*Math.sin(e+.15)+o[1]),f=new Array(n[0]+25*Math.cos(e-.15)-o[0],n[1]-25*Math.sin(e-.15)+o[1]);svg_txt+='<polygon points="'+l[0].toFixed(3)+","+l[1].toFixed(3)+" "+i[0].toFixed(3)+","+i[1].toFixed(3)+" "+s[0].toFixed(3)+","+s[1].toFixed(3)+" "+f[0].toFixed(3)+","+f[1].toFixed(3)+'" style="fill:#000000; stroke:none;" />'}}function plot_line(r,e,t){var a=L(r),n=L(e);svg_txt+='<line x1="'+a[0].toFixed(3)+'" y1="'+a[1].toFixed(3)+'" x2="'+n[0].toFixed(3)+'" y2="'+n[1].toFixed(3)+'" style="fill:none; stroke:'+t+'; stroke-width:1.4; stroke-linecap:round;" />'}function plot_polyline(r,e){if(r.length<2)return!1;var t='<polyline points="',a=L(new Array(r[0][0],r[0][1]));t+=a[0].toFixed(3)+","+a[1].toFixed(3);for(var n=1;n<r.length;n++)t+=" "+(a=L(r[n]))[0].toFixed(3)+","+a[1].toFixed(3);svg_txt+=t+='" style="fill:none; stroke:'+e+'; stroke-width:1.4; stroke-linecap:round; stroke-linejoin:round;" />'}function plot_clear(){svg_txt="";var r=L(new Array(xmin,ymax)),e=L(new Array(xmax,ymin));svg_txt+='<rect x="'+r[0].toFixed(3)+'" y="'+r[1].toFixed(3)+'" width="'+(e[0]-r[0]).toFixed(3)+'" height="'+(e[1]-r[1]).toFixed(3)+'" style="fill:#F2F2F2; stroke:none;" />'}function plot_frame(){var r=L(new Array(xmin,ymax)),e=L(new Array(xmax,ymin));svg_txt+='<rect x="'+r[0].toFixed(3)+'" y="'+r[1].toFixed(3)+'" width="'+(e[0]-r[0]).toFixed(3)+'" height="'+(e[1]-r[1]).toFixed(3)+'" style="fill:none; stroke:#000000; stroke-width:2; stroke-linecap:round; stroke-linejoin:round;" />'}function plot_filled(r){if(r.length<2)return!1;for(var e=!0,t=1;t<r.length;t++)r[t][0]<=r[t-1][0]&&(e=!1);if(0==e)return!1;var a='<polygon points="',n=L(new Array(r[0][0],ymin));a+=n[0].toFixed(3)+","+n[1].toFixed(3);for(t=0;t<r.length;t++)a+=" "+(n=L(r[t]))[0].toFixed(3)+","+n[1].toFixed(3);a+=" "+(n=L(new Array(r[r.length-1][0],ymin)))[0].toFixed(3)+","+n[1].toFixed(3),svg_txt+=a+='" style="fill:#DADAE8; stroke:none;" />'}function plot_grid(){if("grid_vertical"==options[2])for(var r=0;r<pins_x.length;r++)plot_line(new Array(pins_x[r],ymin),new Array(pins_x[r],ymax),"#D4D4D4");else if("grid_level"==options[2])for(r=0;r<pins_y.length;r++)plot_line(new Array(xmin,pins_y[r]),new Array(xmax,pins_y[r]),"#D4D4D4");else if("grid_full"==options[2]){for(r=0;r<pins_y.length;r++)plot_line(new Array(xmin,pins_y[r]),new Array(xmax,pins_y[r]),"#D4D4D4");for(r=0;r<pins_x.length;r++)plot_line(new Array(pins_x[r],ymin),new Array(pins_x[r],ymax),"#D4D4D4")}else if("grid_crosses"==options[2])for(r=0;r<pins_y.length;r++)for(var e=0;e<pins_x.length;e++){var t=L(new Array(pins_x[e],pins_y[r]));svg_txt+='<line x1="'+(t[0]-3).toFixed(3)+'" y1="'+(t[1]-0).toFixed(3)+'" x2="'+(t[0]+3).toFixed(3)+'" y2="'+(t[1]+0).toFixed(3)+'" style="fill:none; stroke:#D4D4D4; stroke-width:1.4; stroke-linecap:round;" />',svg_txt+='<line x1="'+(t[0]-0).toFixed(3)+'" y1="'+(t[1]-3).toFixed(3)+'" x2="'+(t[0]+0).toFixed(3)+'" y2="'+(t[1]+3).toFixed(3)+'" style="fill:none; stroke:#D4D4D4; stroke-width:1.4; stroke-linecap:round;" />'}else if("grid_dots"==options[2])for(r=0;r<pins_y.length;r++)for(e=0;e<pins_x.length;e++)plot_dot(new Array(pins_x[e],pins_y[r]),"#D4D4D4")}function plot_caption_x(){var r=L(new Array(.5*(xmin+xmax),ymin));svg_txt+='<text x="'+r[0].toFixed(3)+'" y="'+(height-16).toFixed(3)+'" style="font-size:12px; text-anchor:middle; fill:#000000; stroke:none; font-family:sans-serif;">'+caption[0]+"</text>"}function plot_caption_y(){var r=L(new Array(xmin,.5*(ymin+ymax)));svg_txt+='<text x="16.000" y="'+r[1].toFixed(3)+'" style="font-size:12px; text-anchor:middle; fill:#000000; stroke:none; font-family:sans-serif;" transform="rotate(270 16,'+r[1].toFixed(0)+')">'+caption[1]+"</text>"}function plot_caption(){""!=caption[0]&&plot_caption_x(),""!=caption[1]&&plot_caption_y()}function plot_label(){for(k=0;k<label.length;k++){var r=L(new Array(label[k][1],label[k][2]));svg_txt+='<text x="'+r[0].toFixed(3)+'" y="'+r[1].toFixed(3)+'" style="font-size:12px; text-anchor:middle; dominant-baseline:middle; fill:none; stroke:#FFFFFF; font-family:sans-serif; stroke-width:4;">'+label[k][0]+"</text>",svg_txt+='<text x="'+r[0].toFixed(3)+'" y="'+r[1].toFixed(3)+'" style="font-size:12px; text-anchor:middle; dominant-baseline:middle; fill:#000000; stroke:none; font-family:sans-serif;">'+label[k][0]+"</text>"}}function plot_pin_x(r){var e=L(new Array(r,ymin));svg_txt+='<line x1="'+e[0].toFixed(3)+'" y1="'+e[1].toFixed(3)+'" x2="'+e[0].toFixed(3)+'" y2="'+(e[1]-7).toFixed(3)+'" style="fill:none; stroke:#000000; stroke-width:2; stroke-linecap:round;" />';var t=r.toFixed(number_digits(xmax-xmin));svg_txt+='<text x="'+e[0].toFixed(3)+'" y="'+(e[1]+20).toFixed(3)+'" style="font-size:12px; text-anchor:middle; fill:#000000; stroke:none; font-family:sans-serif;">'+t+"</text>",e=L(new Array(r,ymax)),svg_txt+='<line x1="'+e[0].toFixed(3)+'" y1="'+e[1].toFixed(3)+'" x2="'+e[0].toFixed(3)+'" y2="'+(e[1]+7).toFixed(3)+'" style="fill:none; stroke:#000000; stroke-width:2; stroke-linecap:round;" />'}function plot_pin_y(r,e){var t=L(new Array(xmin,r));svg_txt+='<line x1="'+t[0].toFixed(3)+'" y1="'+t[1].toFixed(3)+'" x2="'+(t[0]+7).toFixed(3)+'" y2="'+t[1].toFixed(3)+'" style="fill:none; stroke:#000000; stroke-width:2; stroke-linecap:round;" />';var a=r.toFixed(number_digits(ymax-ymin));svg_txt+='<text x="'+(t[0]-8).toFixed(3)+'" y="'+(t[1]+4).toFixed(3)+'" style="font-size:12px; text-anchor:end; fill:#000000; stroke:none; font-family:sans-serif;">'+a+"</text>",t=L(new Array(xmax,r)),svg_txt+='<line x1="'+t[0].toFixed(3)+'" y1="'+t[1].toFixed(3)+'" x2="'+(t[0]-7).toFixed(3)+'" y2="'+t[1].toFixed(3)+'" style="fill:none; stroke:#000000; stroke-width:2; stroke-linecap:round;" />'}function plot_pins(){for(var r=0;r<pins_x.length;r++)plot_pin_x(pins_x[r]);for(r=0;r<pins_y.length;r++)plot_pin_y(pins_y[r])}function get_scale(r){return 4*Math.exp(-.02*Math.max(0,r-20))+.08}function calculate_range_x(){if(0==T.length)return!1;for(k=0;k<T.length;k++)"list"==T_options[k][0]&&xmax<xmin&&(xmin=T[k][0][0],xmax=T[k][0][0]);for(k=0;k<T.length;k++)if("list"==T_options[k][0])for(i=0;i<T[k].length;i++)xmin=Math.min(xmin,T[k][i][0]),xmax=Math.max(xmax,T[k][i][0]);if(xmin<xmax){var r=get_scale(width)*(xmax-xmin);xmin-=r,xmax+=r}else xmin=T[0][0][0],xmax=T[0][0][0];for(k=0;k<T.length;k++)if("function"==T_options[k][0])for(i=0;i<T[k].length;i++)xmin=Math.min(xmin,T[k][i][0]),xmax=Math.max(xmax,T[k][i][0]);xmax<=xmin&&(xmin-=1,xmax+=1)}function calculate_range_y(){if(0==T.length)return!1;var r=!1;for(ymax=ymin=0,k=0;k<T.length;k++)for(i=0;i<T[k].length;i++)xmin<=T[k][i][0]&&T[k][i][0]<=xmax&&(0==r?(ymin=T[k][i][1],ymax=T[k][i][1],r=!0):(ymin=Math.min(ymin,T[k][i][1]),ymax=Math.max(ymax,T[k][i][1])));var e=get_scale(height)*(ymax-ymin);0==e&&(e=1),ymin-=e,ymax+=e}function data_in_range_check(){for(k=0;k<T.length;k++){if("list"==T_options[k][0])for(var r=0;r<T[k].length;)T[k][r][0]<xmin||T[k][r][0]>xmax||T[k][r][1]<ymin||T[k][r][1]>ymax?T[k].splice(r,1):r++;if("function"==T_options[k][0]){for(r=0;r<T[k].length;)T[k][r][0]<xmin||T[k][r][0]>xmax?T[k].splice(r,1):r++;for(var e=0;e<T[k].length;e++)T[k][e][1]=Math.min(Math.max(T[k][e][1],ymin),ymax)}}}function level_line(r,e,t,a,n,o,l){var s=(l-t)/(o-t);return[r+s*(a-r),e+s*(n-e)]}function level_triangle(r,e,t,a,n,o,l,s,i,f){var u=[];return t==f&&o==f&&i==f?0:(t==f&&o==f&&(u.push([r,e]),u.push([a,n])),o==f&&i==f&&(u.push([a,n]),u.push([l,s])),t==f&&i==f&&(u.push([r,e]),u.push([l,s])),2==u.length?u:(t==f&&o<f&&f<i&&(u.push([r,e]),u.push(level_line(a,n,o,l,s,i,f))),t==f&&f<o&&i<f&&(u.push([r,e]),u.push(level_line(l,s,i,a,n,o,f))),o==f&&t<f&&f<i&&(u.push([a,n]),u.push(level_line(r,e,t,l,s,i,f))),o==f&&f<t&&i<f&&(u.push([a,n]),u.push(level_line(l,s,i,r,e,t,f))),i==f&&t<f&&f<o&&(u.push([l,s]),u.push(level_line(r,e,t,a,n,o,f))),i==f&&f<t&&o<f&&(u.push([l,s]),u.push(level_line(a,n,o,r,e,t,f))),2==u.length?u:(t<f&&f<o&&u.push(level_line(r,e,t,a,n,o,f)),f<t&&o<f&&u.push(level_line(a,n,o,r,e,t,f)),t<f&&f<i&&u.push(level_line(r,e,t,l,s,i,f)),f<t&&i<f&&u.push(level_line(l,s,i,r,e,t,f)),o<f&&f<i&&u.push(level_line(a,n,o,l,s,i,f)),f<o&&i<f&&u.push(level_line(l,s,i,a,n,o,f)),2==u.length?u:0)))}function get_angle_from_vector(r){return 0==r[0]&&0==r[1]?0:0==r[0]&&0<r[1]?Math.PI/2:0==r[0]&&r[1]<0?-Math.PI/2:(0<r[0]?0:Math.PI)+Math.atan(r[1]/r[0])}function ByteToHex(r){var e=parseInt(r,10);return isNaN(e)?"00":(e=Math.max(0,Math.min(e,255)),"0123456789ABCDEF".charAt((e-e%16)/16)+"0123456789ABCDEF".charAt(e%16))}function rgbToHex(r){return"#"+ByteToHex(r[0])+ByteToHex(r[1])+ByteToHex(r[2])}function matrix_svg(r,e,t,a){var n=r.length,o=r[0].length;if(svg_txt="","color_table"==options[5])for(var l=0;l<n;l++)for(var s=0;s<o;s++){var i=Math.min(100,Math.max(0,Math.floor(100*(r[l][s]-e)/(t-e))));svg_txt+='<rect x="'+(s*a).toFixed(3)+'" y="'+(l*a).toFixed(3)+'" width="'+a.toFixed(3)+'" height="'+a.toFixed(3)+'" style="fill:'+rgbToHex(color_table[i])+'; stroke:none;" />'}else for(l=0;l<n;l++)for(s=0;s<o;s++){i=Math.min(255,Math.max(0,Math.floor(255*(r[l][s]-e)/(t-e))));svg_txt+='<rect x="'+(s*a).toFixed(3)+'" y="'+(l*a).toFixed(3)+'" width="'+a.toFixed(3)+'" height="'+a.toFixed(3)+'" style="fill:'+rgbToHex([i,i,i])+'; stroke:none;" />'}svg_txt='<?xml version="1.0" encoding="UTF-8" ?><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+a*o+'" height="'+a*n+'">'+svg_txt+"</svg>",document.getElementById(div_id).innerHTML=svg_txt}function matrix_canvas(r,e,t,a){var n="canvas"+(1e10*Math.random()).toFixed(0),o=document.createElement("canvas");o.setAttribute("id",n),document.getElementById(div_id).innerHTML="",document.getElementById(div_id).appendChild(o);var l=document.getElementById(n),s=l.getContext("2d");l.width=r[0].length*a,l.height=r.length*a;for(var i=l.height,f=l.width,u=s.createImageData(f,i),g=0;g<u.data.length;g+=4){var _=Math.floor(g/4),h=Math.floor(_/f),c=_%f;h=Math.floor(h/a),c=Math.floor(c/a);var d=0,v=[0,0,0];v="color_table"==options[5]?(d=Math.min(100,Math.max(0,Math.floor(100*(r[h][c]-e)/(t-e)))),color_table[d]):[d=Math.min(255,Math.max(0,Math.floor(255*(r[h][c]-e)/(t-e)))),d,d],u.data[g+0]=v[0],u.data[g+1]=v[1],u.data[g+2]=v[2],u.data[g+3]=255}s.putImageData(u,0,0)}function rgb_vector(r){var e=[0,0,0];if("number"==typeof r&&1==isFinite(r)){var t=Math.max(0,Math.min(Math.round(r),255));e=[t,t,t]}if("object"==typeof r&&"number"==typeof r.length&&3==r.length)for(var a=0;a<3;a++)"number"==typeof r[a]&&1==isFinite(r[a])&&(e[a]=Math.max(0,Math.min(Math.round(r[a]),255)));return e}function check_image_matrix(r){if("object"!=typeof r)return 0;var e=r.length;if("number"!=typeof e||e<1)return 0;if("object"!=typeof r[0])return 0;var t=r[0].length;if("number"!=typeof t||t<1)return 0;for(var a=1;a<e;a++)if("object"!=typeof r[a]||r[a].length!=t)return 0;var n=new Array(e);for(a=0;a<e;a++)n[a]=new Array(t);for(a=0;a<e;a++)for(var o=0;o<t;o++)n[a][o]=rgb_vector(r[a][o]);return n}function projection(r,e,t){return new Array(r*e1[0]+e*e2[0]+t*e3[0],r*e1[1]+e*e2[1]+t*e3[1])}function L_3d(r){var e=new Array((r[0]+1)/2,(r[1]+2)/8);return new Array(e[0]*width,height-e[1]*height)}function plot_line_3d(r,e,t){var a=L_3d(r),n=L_3d(e);svg_txt+='<line x1="'+a[0].toFixed(3)+'" y1="'+a[1].toFixed(3)+'" x2="'+n[0].toFixed(3)+'" y2="'+n[1].toFixed(3)+'" style="fill:none; stroke:'+t+'; stroke-width:1.4; stroke-linecap:round;" />'}function draw_3d(){var r=new Array;r.push(projection(-1,-1,0)),r.push(projection(-1,1,0)),r.push(projection(1,1,0)),r.push(projection(1,-1,0));for(var e=U.length-1,t=new Array(e+1),a=0;a<=e;a++)t[a]=new Array(e+1);for(a=0;a<=e;a++)for(var n=0;n<=e;n++)t[a][n]=projection(U[a][n][0],U[a][n][1],U[a][n][2]);svg_txt="",svg_txt+='<rect x="0.000" y="0.000" width="'+width.toFixed(3)+'" height="'+height.toFixed(3)+'" style="fill:#F2F2F2; stroke:none;" />';for(var o=0;o<4;o++)plot_line_3d(r[o],r[(o+1)%4],"#CCCCCC");for(a=0;a<e;a++)for(n=0;n<e;n++)plot_line_3d(t[a][n],t[a+1][n],"#008800"),plot_line_3d(t[a][n],t[a][n+1],"#008800");for(a=0;a<e;a++)plot_line_3d(t[a][e],t[a+1][e],"#008800");for(n=0;n<e;n++)plot_line_3d(t[e][n],t[e][n+1],"#008800");svg_txt='<?xml version="1.0" encoding="UTF-8" ?><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+width+'" height="'+height+'">'+svg_txt+"</svg>",document.getElementById(div_id).innerHTML=svg_txt}function animate_3d(){(omega-=.02)<0&&(omega+=2*Math.PI),e1=new Array(.65*Math.cos(omega),Math.sin(omega)),e2=new Array(-.65*Math.sin(omega),Math.cos(omega)),draw_3d()}this.set_color=function(){if(arguments.length<1)return GlobalClasses.error_code("Plot","set_color",0);color=[];var r=arguments;1==arguments.length&&(r=1==GlobalClasses.is_string(r[0])||1==GlobalClasses.is_vector(r[0])?[r[0]]:"object"==typeof r?r[0]:[]);for(var e=0;e<r.length;e++){var t=GlobalClasses.check_color(r[e]);"none"!=t&&color.push(t)}return 0==color.length&&(color=["#0059c5"]),!0},this.init=function(r){if(arguments.length<1)return GlobalClasses.error_code("Plot","init",0);if(1!=GlobalClasses.is_div(r))return GlobalClasses.error_code("Plot","init",11);var e=320,t=320;return 2<arguments.length&&(1==GlobalClasses.is_number(arguments[1])&&(e=arguments[1]),1==GlobalClasses.is_number(arguments[2])&&(t=arguments[2])),div_id=r,width=Math.max(100,Math.floor(e)),height=Math.max(100,Math.floor(t)),ymin=xmin=1,ymax=xmax=0,svg_txt="",T=new Array,T_options=new Array,pins_x=new Array,pins_y=new Array,caption=new Array("",""),label=new Array,options=new Array("dots","filling_off","grid_level","frame","animation_off","black_white","","","",""),color=["#0059c5","#de102d","#359f2f","#fec806","#ff7f2a"],color_table=GlobalClasses.get_color_table(),omega=Math.PI/4,e1=new Array(.65*Math.cos(omega),Math.sin(omega)),e2=new Array(-.65*Math.sin(omega),Math.cos(omega)),e3=new Array(0,4.2),U=new Array,init_ready=!0},this.range_x=function(r,e){return arguments.length<2?GlobalClasses.error_code("Plot","range_x",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("Plot","range_x",1):1!=GlobalClasses.is_number(e)?GlobalClasses.error_code("Plot","range_x",1):(xmin=Math.min(r,e),xmax=Math.max(r,e),xmin==xmax&&(xmin-=1,xmax+=1),!0)},this.range_y=function(r,e){return arguments.length<2?GlobalClasses.error_code("Plot","range_y",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("Plot","range_y",1):1!=GlobalClasses.is_number(e)?GlobalClasses.error_code("Plot","range_y",1):(ymin=Math.min(r,e),ymax=Math.max(r,e),ymin==ymax&&(ymin-=1,ymax+=1),!0)},this.draw=function(){if(1!=init_ready)return GlobalClasses.error_code("Plot","draw",13);if(T.length<1)return GlobalClasses.error_code("Plot","draw",15);xmax<=xmin&&calculate_range_x(),ymax<=ymin&&calculate_range_y(),data_in_range_check(),calculate_pins(),plot_clear(),plot_grid();for(var r=0;r<T.length;r++)if(0<T[r].length){var e=color[r%color.length];"line"==T_options[r][1]&&"filling"==T_options[r][2]&&plot_filled(T[r]),"joined"==T_options[r][1]&&"filling"==T_options[r][2]&&plot_filled(T[r])}"frame"==options[3]&&plot_pins();for(r=0;r<T.length;r++)if(0<T[r].length){e=color[r%color.length];if("line"!=T_options[r][1]&&"joined"!=T_options[r][1]||plot_polyline(T[r],e),"dots"==T_options[r][1]||"joined"==T_options[r][1])for(var t=0;t<T[r].length;t++)plot_dot(T[r][t],e)}return"frame"==options[3]&&plot_frame(),"frame"==options[3]&&plot_caption(),plot_label(),svg_txt='<?xml version="1.0" encoding="UTF-8" ?><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+width+'" height="'+height+'">'+svg_txt+"</svg>",document.getElementById(div_id).innerHTML=svg_txt,!0},this.add_list=function(r){if(arguments.length<1)return GlobalClasses.error_code("Plot","add_list",0);if(1!=GlobalClasses.is_vector(r)&&1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("Plot","add_list",1);if(1!=init_ready)return GlobalClasses.error_code("Plot","add_list",13);var e=new Array,t=new Array("list",options[0],options[1]);if("number"==typeof r[0])for(var a=0;a<r.length;a++)e.push(new Array(a+1,r[a]));if("object"==typeof r[0])for(a=0;a<r.length;a++)e.push(new Array(r[a][0],r[a][1]));return T.push(e),T_options.push(t),!0},this.list=function(){if(arguments.length<1)return GlobalClasses.error_code("Plot","list",0);if(1!=init_ready)return GlobalClasses.error_code("Plot","list",13);for(var r=0;r<arguments.length;r++)this.add_list(arguments[r]);return this.draw()},this.add_func=function(r,e,t){if(arguments.length<3)return GlobalClasses.error_code("Plot","add_func",0);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Plot","add_func",1);if(1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("Plot","add_func",1);if(1!=init_ready)return GlobalClasses.error_code("Plot","add_func",13);if("string"==typeof r&&0==(r=GlobalClasses.check_function_string_x(r)))return GlobalClasses.error_code("Plot","add_func",24);var a=Math.min(e,t),n=Math.max(e,t);a==n&&(a-=1,n+=1);for(var o=new Array,l=new Array("function","line",options[1]),s=width,i=0;i<=s;i++){var f=a+i/s*(n-a);"function"==typeof r&&o.push(new Array(f,r(f))),"string"==typeof r&&o.push(new Array(f,eval_f1d(f,r)))}return T.push(o),T_options.push(l),!0},this.func=function(){if(arguments.length<3)return GlobalClasses.error_code("Plot","func",0);if(1!=GlobalClasses.is_number(arguments[arguments.length-1]))return GlobalClasses.error_code("Plot","func",1);if(1!=GlobalClasses.is_number(arguments[arguments.length-2]))return GlobalClasses.error_code("Plot","func",1);if(1!=init_ready)return GlobalClasses.error_code("Plot","func",13);xmin=Math.min(arguments[arguments.length-2],arguments[arguments.length-1]),xmax=Math.max(arguments[arguments.length-2],arguments[arguments.length-1]),xmin==xmax&&(xmin-=1,xmax+=1);for(var r=0;r<arguments.length-2;r++)this.add_func(arguments[r],xmin,xmax);return this.draw()},this.contour=function(r,e,t,a,n){if(arguments.length<5)return GlobalClasses.error_code("Plot","contour",0);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Plot","contour",1);if(1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("Plot","contour",1);if(1!=GlobalClasses.is_number(a))return GlobalClasses.error_code("Plot","contour",1);if(1!=GlobalClasses.is_number(n))return GlobalClasses.error_code("Plot","contour",1);if(1!=GlobalClasses.is_function(r)&&1!=GlobalClasses.is_string(r))return GlobalClasses.error_code("Plot","contour",1);if(1!=init_ready)return GlobalClasses.error_code("Plot","contour",13);var o=r;if("string"==typeof o&&0==(o=GlobalClasses.check_function_string_xy(o)))return GlobalClasses.error_code("Plot","contour",24);xmin=Math.min(e,t),xmax=Math.max(e,t),ymin=Math.min(a,n),ymax=Math.max(a,n),xmin==xmax&&(xmin-=1,xmax+=1),ymin==ymax&&(ymin-=1,ymax+=1);for(var l=[],s=[],i=[],f=0;f<=100;f++)for(var u=0;u<=100;u++){var g=xmin+u/100*(xmax-xmin),_=ymin+f/100*(ymax-ymin);l.push([g,_]),"function"==typeof o?s.push(o(g,_)):"string"==typeof o?s.push(eval_f2d(g,_,o)):s.push(0),f<100&&u<100&&(i.push([101*f+u,101*f+u+1,101*(f+1)+u]),i.push([101*(f+1)+u+1,101*f+u+1,101*(f+1)+u]))}calculate_pins(),plot_clear();var h=Sort.permutation(s);for(f=0;f<=10;f++){var c=.02+.1*f*.96,d=s[h[Math.floor(c*h.length)]];for(k=0;k<i.length;k++){var v="#A6A6A6";"color_table"==options[5]&&(v=rgbToHex(color_table[Math.floor(100*c)]));var b=level_triangle(l[i[k][0]][0],l[i[k][0]][1],s[i[k][0]],l[i[k][1]][0],l[i[k][1]][1],s[i[k][1]],l[i[k][2]][0],l[i[k][2]][1],s[i[k][2]],d);0!=b&&plot_line(b[0],b[1],v)}}return"frame"==options[3]&&(plot_pins(),plot_frame(),plot_caption()),plot_label(),svg_txt='<?xml version="1.0" encoding="UTF-8" ?><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+width+'" height="'+height+'">'+svg_txt+"</svg>",document.getElementById(div_id).innerHTML=svg_txt,!0},this.vectorfield=function(r,e,t,a,n){if(arguments.length<5)return GlobalClasses.error_code("Plot","vectorfield",0);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Plot","vectorfield",1);if(1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("Plot","vectorfield",1);if(1!=GlobalClasses.is_number(a))return GlobalClasses.error_code("Plot","vectorfield",1);if(1!=GlobalClasses.is_number(n))return GlobalClasses.error_code("Plot","vectorfield",1);if(1!=GlobalClasses.is_function(r)&&1!=GlobalClasses.is_string(r))return GlobalClasses.error_code("Plot","vectorfield",1);if(1!=init_ready)return GlobalClasses.error_code("Plot","vectorfield",13);var o=r,l="",s="";if("string"==typeof o){var i=o.split(";");if(i.length<2)return GlobalClasses.error_code("Plot","vectorfield",24);if(0==(l=GlobalClasses.check_function_string_xy(i[0])))return GlobalClasses.error_code("Plot","vectorfield",24);if(0==(s=GlobalClasses.check_function_string_xy(i[1])))return GlobalClasses.error_code("Plot","vectorfield",24)}xmin=Math.min(e,t),xmax=Math.max(e,t),ymin=Math.min(a,n),ymax=Math.max(a,n),xmin==xmax&&(xmin-=1,xmax+=1),ymin==ymax&&(ymin-=1,ymax+=1);var f=width,u=height;"frame"==options[3]&&(f-=80,u-=80),f=Math.max(2,2*Math.floor(f/60)+1),u=Math.max(2,2*Math.floor(u/60)+1);for(var g=new Array(u),_=0;_<u;_++)g[_]=new Array(f);for(_=0;_<u;_++)for(var h=0;h<f;h++)g[_][h]=new Array(0,0);var c=new Array(u);for(_=0;_<u;_++)c[_]=new Array(f);for(_=0;_<u;_++)for(h=0;h<f;h++)c[_][h]=new Array(xmin+h*(xmax-xmin)/(f-1),ymin+_*(ymax-ymin)/(u-1));var d=xmax-xmin,v=ymax-ymin;if(xmin-=1.2*d/f,xmax+=1.2*d/f,ymin-=1.2*v/u,ymax+=1.2*v/u,calculate_pins(),plot_clear(),"frame"==options[3]&&plot_pins(),"function"==typeof o)for(_=0;_<u;_++)for(h=0;h<f;h++){"object"==typeof(b=o(c[_][h][0],c[_][h][1]))&&isFinite(b[0])&&isFinite(b[1])&&(g[_][h]=new Array(b[0],b[1]))}if("string"==typeof o)for(_=0;_<u;_++)for(h=0;h<f;h++){var b=new Array(eval_f2d(c[_][h][0],c[_][h][1],l),eval_f2d(c[_][h][0],c[_][h][1],s));isFinite(b[0])&&isFinite(b[1])&&(g[_][h]=new Array(b[0],b[1]))}var m=new Array(u);for(_=0;_<u;_++)m[_]=new Array(f);for(_=0;_<u;_++)for(h=0;h<f;h++)m[_][h]=Math.sqrt(g[_][h][0]*g[_][h][0]+g[_][h][1]*g[_][h][1]);var p=0;for(_=0;_<u;_++)for(h=0;h<f;h++)p=Math.max(p,m[_][h]);0==p&&(p=1),"frame"==options[3]&&plot_frame(),"frame"==options[3]&&plot_caption(),plot_label();for(_=0;_<u;_++)for(h=0;h<f;h++)plot_arrow(c[_][h],get_angle_from_vector(g[_][h]),m[_][h]/p);return svg_txt='<?xml version="1.0" encoding="UTF-8" ?><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+width+'" height="'+height+'">'+svg_txt+"</svg>",document.getElementById(div_id).innerHTML=svg_txt,!0},this.matrix=function(r){if(arguments.length<1)return GlobalClasses.error_code("Plot","matrix",0);if(1!=GlobalClasses.is_matrix(r))return GlobalClasses.error_code("Plot","matrix",1);if(1!=init_ready)return GlobalClasses.error_code("Plot","matrix",13);var e=1;1<arguments.length&&1==GlobalClasses.is_number(arguments[1])&&(e=Math.max(1,Math.min(Math.floor(arguments[1]),1e3)));for(var t=r[0][0],a=r[0][0],n=0;n<r.length;n++)for(var o=0;o<r[0].length;o++)t=Math.min(t,r[n][o]),a=Math.max(a,r[n][o]);return t==a&&(a=t+1),2==arguments.length&&1==GlobalClasses.is_string(arguments[1])||3==arguments.length&&1==GlobalClasses.is_string(arguments[2])?matrix_canvas(r,t,a,e):matrix_svg(r,t,a,e),!0},this.image=function(r){if(1!=init_ready)return GlobalClasses.error_code("Plot","image",13);if(arguments.length<1)return GlobalClasses.error_code("Plot","image",0);var e=check_image_matrix(r);if("number"==typeof e)return GlobalClasses.error_code("Plot","image",1);var t=1;1<arguments.length&&1==GlobalClasses.is_number(arguments[1])&&(t=Math.max(1,Math.min(Math.floor(arguments[1]),1e3)));var a="canvas"+(1e10*Math.random()).toFixed(0),n=document.createElement("canvas");n.setAttribute("id",a),document.getElementById(div_id).innerHTML="",document.getElementById(div_id).appendChild(n);var o=document.getElementById(a),l=o.getContext("2d");o.width=e[0].length*t,o.height=e.length*t;for(var s=o.height,i=o.width,f=l.createImageData(i,s),u=0;u<f.data.length;u+=4){var g=Math.floor(u/4),_=Math.floor(g/i),h=g%i;_=Math.floor(_/t),h=Math.floor(h/t),f.data[u+0]=e[_][h][0],f.data[u+1]=e[_][h][1],f.data[u+2]=e[_][h][2],f.data[u+3]=255}return l.putImageData(f,0,0),!0},this.func_3d=function(r,e,t,a,n){if(arguments.length<5)return GlobalClasses.error_code("Plot","func_3d",0);if(1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Plot","func_3d",1);if(1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("Plot","func_3d",1);if(1!=GlobalClasses.is_number(a))return GlobalClasses.error_code("Plot","func_3d",1);if(1!=GlobalClasses.is_number(n))return GlobalClasses.error_code("Plot","func_3d",1);if(1!=GlobalClasses.is_function(r)&&1!=GlobalClasses.is_string(r))return GlobalClasses.error_code("Plot","func_3d",1);if(1!=init_ready)return GlobalClasses.error_code("Plot","func_3d",13);var o=r;if("string"==typeof o&&0==(o=GlobalClasses.check_function_string_xy(o)))return GlobalClasses.error_code("Plot","func_3d",24);for(var l=new Array(41),s=0;s<=40;s++)l[s]=new Array(41);for(s=0;s<=40;s++)for(var i=0;i<=40;i++)l[s][i]=0;for(s=0;s<=40;s++)for(i=0;i<=40;i++){var f=e+i/40*(t-e),u=a+s/40*(n-a);"function"==typeof o&&(l[s][i]=o(f,u)),"string"==typeof o&&(l[s][i]=eval_f2d(f,u,o))}var g=l[0][0],_=l[0][0];for(s=0;s<=40;s++)for(i=0;i<=40;i++)g=Math.min(g,l[s][i]),_=Math.max(_,l[s][i]);for(s=0;s<=40;s++)for(i=0;i<=40;i++)l[s][i]=_<=g?0:(l[s][i]-g)/(_-g);U=new Array(41);for(s=0;s<=40;s++)U[s]=new Array(41);for(s=0;s<=40;s++)for(i=0;i<=40;i++)U[s][i]=new Array(2*i/40-1,2*s/40-1,l[s][i]);return"animation"==options[4]?window.setInterval(animate_3d,40):draw_3d(),!0},this.caption=function(){return arguments.length<1?GlobalClasses.error_code("Plot","caption",0):(1==arguments.length&&"string"==typeof arguments[0]&&(caption[1]=arguments[0]),1<arguments.length&&("string"==typeof arguments[0]&&(caption[0]=arguments[0]),"string"==typeof arguments[1]&&(caption[1]=arguments[1])),!0)},this.label=function(r,e,t){return arguments.length<3?GlobalClasses.error_code("Plot","label",0):1!=GlobalClasses.is_string(r)?GlobalClasses.error_code("Plot","label",1):1!=GlobalClasses.is_number(e)?GlobalClasses.error_code("Plot","label",1):1!=GlobalClasses.is_number(t)?GlobalClasses.error_code("Plot","label",1):(label.push(new Array(r,e,t)),!0)},this.options=function(){if(arguments.length<1)return GlobalClasses.error_code("Plot","options",0);for(var r=0;r<arguments.length;r++)"string"==typeof arguments[r]&&("dots"==arguments[r]&&(options[0]=arguments[r]),"line"==arguments[r]&&(options[0]=arguments[r]),"joined"==arguments[r]&&(options[0]=arguments[r]),"filling"==arguments[r]&&(options[1]=arguments[r]),"filling_off"==arguments[r]&&(options[1]=arguments[r]),"grid_off"==arguments[r]&&(options[2]=arguments[r]),"grid_full"==arguments[r]&&(options[2]=arguments[r]),"grid_level"==arguments[r]&&(options[2]=arguments[r]),"grid_vertical"==arguments[r]&&(options[2]=arguments[r]),"grid_crosses"==arguments[r]&&(options[2]=arguments[r]),"grid_dots"==arguments[r]&&(options[2]=arguments[r]),"frame"==arguments[r]&&(options[3]=arguments[r]),"frame_off"==arguments[r]&&(options[3]=arguments[r]),"animation"==arguments[r]&&(options[4]=arguments[r]),"animation_off"==arguments[r]&&(options[4]=arguments[r]),"black_white"==arguments[r]&&(options[5]=arguments[r]),"color_table"==arguments[r]&&(options[5]=arguments[r]));return!0},this.export_svg=function(){return svg_txt}},Plot=new Plot_taramathObject,Print_taramathObject=function(){var e=4,l=new Object,a=!1;function n(r){l.value+=r+"\n\n"}function s(r){return parseFloat(r.toFixed(e)).toFixed(e)}function i(r){for(var e="",t=0;t<r;)e+=" ",t++;return e}this.set_digits=function(r){return arguments.length<1?GlobalClasses.error_code("Print","set_digits",0):1!=GlobalClasses.is_number(r)?GlobalClasses.error_code("Print","set_digits",1):(e=Math.min(12,Math.max(0,Math.floor(r))),!0)},this.init=function(r){return arguments.length<1?GlobalClasses.error_code("Print","init",0):1!=GlobalClasses.is_textarea(r)?GlobalClasses.error_code("Print","init",12):((l=document.getElementById(r)).value="",a=!0)},this.clear=function(){return 1!=a?GlobalClasses.error_code("Print","clear",13):!(l.value="")},this.object=function(r){return arguments.length<1?GlobalClasses.error_code("Print","object",0):1!=a?GlobalClasses.error_code("Print","object",13):(1==GlobalClasses.is_vector(r)?function(r){l.value+="[";for(var e=0;e<r.length;e++)l.value+=" "+s(r[e])+" ";l.value+="]\n\n"}(r):1==GlobalClasses.is_matrix(r)?function(r){for(var e=0,t=new Array(r.length),a=0;a<t.length;a++)t[a]=new Array(r[a].length);for(a=0;a<t.length;a++)for(var n=0;n<t[a].length;n++)t[a][n]=s(r[a][n]).length,e=Math.max(e,t[a][n]);var o="";for(a=0;a<r.length;a++){for(o+="[",n=0;n<r[a].length;n++)o+=" "+i(e-t[a][n])+s(r[a][n])+" ";o+="]\n"}l.value+=o+"\n"}(r):1==GlobalClasses.is_string(r)?n(r):1==GlobalClasses.is_number(r)?(t=r,l.value+=s(t)+"\n\n"):1==GlobalClasses.is_boolean(r)?(e=r,l.value+=(1==e?"true":"false")+"\n\n"):n("Error: invalid input."),!0);var e,t}},Print=new Print_taramathObject,ReadInput_taramathObject=function(){function s(r){for(var e=function(r){if("string"!=typeof r)return"";var e=r;for(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/\(/g,"")).replace(/\)/g,"")).replace(/\[/g,"")).replace(/\]/g,"")).replace(/\{/g,"")).replace(/\}/g,"")).replace(/\s/g,",")).replace(/;/g,",");-1<e.indexOf(",,");)e=e.replace(/,,/g,",");return e}(r),t=new Array,a=e.split(","),n=0;n<a.length;n++){var o=parseFloat(a[n]);1==isFinite(o)&&t.push(o)}return 0==t.length&&t.push(0),t}this.vector=function(r){var e="";return 1==GlobalClasses.is_textarea(r)&&(e=document.getElementById(r).value.trim()),s(e)},this.matrix=function(r){var e="";1==GlobalClasses.is_textarea(r)&&(e=document.getElementById(r).value.trim());var t=new Array;for(e=(e=e.replace(/\n/g,"|")).replace(/\s/g,",");-1<e.indexOf(",,");)e=e.replace(/,,/g,",");var a=e.split("|");a.length<=1&&(a=e.split(";")),a.length<=1&&(a=(e=(e=(e=(e=(e=(e=e.replace(/\},\{/g,"|")).replace(/\),\(/g,"|")).replace(/\],\[/g,"|")).replace(/\}\{/g,"|")).replace(/\)\(/g,"|")).replace(/\]\[/g,"|")).split("|"));for(var n=0;n<a.length;n++){var o=s(a[n]);0<o.length&&t.push(o)}var l=t[0].length;for(n=1;n<t.length;n++)l=Math.max(l,t[n].length);for(n=0;n<t.length;n++)for(;t[n].length<l;)t[n].push(0);return t}},ReadInput=new ReadInput_taramathObject,Sort_taramathObject=function(){var s=new Array,n=new Array;function l(r,e){var t=s[r];s[r]=s[e],s[e]=t;var a=n[r];n[r]=n[e],n[e]=a}function a(r,e){if(r<e-1){var t=Math.floor(.5*(r+e));a(r,t=function(r,e,t){var a=s[t];l(t,e-1);for(var n=r,o=r;o<e-1;o++)s[o]<=a&&(l(n,o),n++);return l(e-1,n),n}(r,e,t)),a(t+1,e)}}function e(r){s=new Array;for(var e=0;e<r.length;e++)s.push(r[e]);n=new Array(s.length);for(e=0;e<n.length;e++)n[e]=e;a(0,s.length)}this.quick=function(r){return arguments.length<1?GlobalClasses.error_code("Sort","quick",0):1!=GlobalClasses.is_vector(r)?GlobalClasses.error_code("Sort","quick",0):(e(r),s)},this.permutation=function(r){return arguments.length<1?GlobalClasses.error_code("Sort","permutation",0):1!=GlobalClasses.is_vector(r)?GlobalClasses.error_code("Sort","permutation",1):(e(r),n)},this.bubble=function(r){if(arguments.length<1)return GlobalClasses.error_code("Sort","bubble",0);if(1!=GlobalClasses.is_vector(r))return GlobalClasses.error_code("Sort","bubble",1);s=new Array;for(var e=0;e<r.length;e++)s.push(r[e]);for(var t=0;t<s.length-1;t++)for(var a=t+1;a<s.length;a++)s[t]>s[a]&&(o=a,void 0,l=s[n=t],s[n]=s[o],s[o]=l);var n,o,l;return s}},Sort=new Sort_taramathObject,StopWatch_taramathObject=function(){var e=0,t=0;this.start=function(){e=(new Date).getTime()},this.stop=function(){var r=(new Date).getTime();t=r-e},this.get_result=function(){return t}},StopWatch=new StopWatch_taramathObject,Svg_taramathObject=function(){var a="",G="",M=!1,n=100,o=100,l=0,s=n,i=0,f=o,u=1,g=1;function w(r){return[u*(r[0]-l),o-g*(r[1]-i)]}this.init=function(r,e,t){return arguments.length<3?GlobalClasses.error_code("Svg","init",0):1!=GlobalClasses.is_div(r)?GlobalClasses.error_code("Svg","init",11):1!=GlobalClasses.is_number(e)||1!=GlobalClasses.is_number(t)?GlobalClasses.error_code("Svg","init",1):(a=r,G="",n=Math.max(2,Math.round(e)),o=Math.max(2,Math.round(t)),s=n,f=o,g=u=1,M=!(i=l=0))},this.export_svg=function(){return'<svg width="'+n.toFixed(3)+'" height="'+o.toFixed(3)+'">'+G+"</svg>"},this.draw=function(){return document.getElementById(a).innerHTML=this.export_svg(),!0},this.resize=function(r,e,t,a){return 1!=M?GlobalClasses.error_code("Svg","resize",13):arguments.length<4?GlobalClasses.error_code("Svg","resize",0):1!=GlobalClasses.is_number(r)||1!=GlobalClasses.is_number(e)||1!=GlobalClasses.is_number(t)||1!=GlobalClasses.is_number(a)?GlobalClasses.error_code("Svg","resize",1):(l=Math.min(r,e),s=Math.max(r,e),i=Math.min(t,a),f=Math.max(t,a),s==l&&(s+=1),f==i&&(f+=1),u=n/(s-l),g=o/(f-i),!0)},this.clear=function(){if(1!=M)return GlobalClasses.error_code("Svg","clear",13);var r=0<arguments.length?GlobalClasses.check_color(arguments[0]):"#f0f0f0";return G='<rect x="0.000" y="0.000" width="'+n.toFixed(3)+'" height="'+o.toFixed(3)+'" style="fill:'+r+'; stroke:none;" />',!0},this.dot=function(r,e){if(1!=M)return GlobalClasses.error_code("Svg","dot",13);if(arguments.length<2)return GlobalClasses.error_code("Svg","dot",0);if(1!=GlobalClasses.is_number(r)||1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Svg","dot",1);var t=w([r,e]),a=2<arguments.length?GlobalClasses.check_color(arguments[2]):"#000000";return G+='<circle cx="'+t[0].toFixed(3)+'" cy="'+t[1].toFixed(3)+'" r="2.5" style="fill:'+a+'; stroke:none;" />',!0},this.disc=function(r,e,t){if(1!=M)return GlobalClasses.error_code("Svg","disc",13);if(arguments.length<3)return GlobalClasses.error_code("Svg","disc",0);if(1!=GlobalClasses.is_number(r)||1!=GlobalClasses.is_number(e)||1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("Svg","disc",1);var a=w([r,e]),n=3<arguments.length?GlobalClasses.check_color(arguments[3]):"#000000",o=4<arguments.length?GlobalClasses.check_color(arguments[4]):"none",l=Math.abs(Math.min(t*u,t*g));return G+='<circle cx="'+a[0].toFixed(3)+'" cy="'+a[1].toFixed(3)+'" r="'+l.toFixed(3)+'" style="fill:'+n+"; stroke:"+o+'; stroke-width:1.5;" />',!0},this.circle=function(r,e,t){if(1!=M)return GlobalClasses.error_code("Svg","circle",13);if(arguments.length<3)return GlobalClasses.error_code("Svg","circle",0);if(1!=GlobalClasses.is_number(r)||1!=GlobalClasses.is_number(e)||1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("Svg","circle",1);var a=w([r,e]),n=3<arguments.length?GlobalClasses.check_color(arguments[3]):"#000000",o=4<arguments.length?GlobalClasses.check_color(arguments[4]):"none",l=Math.abs(t*u),s=Math.abs(t*g);return G+='<ellipse cx="'+a[0].toFixed(3)+'" cy="'+a[1].toFixed(3)+'" rx="'+l.toFixed(3)+'" ry="'+s.toFixed(3)+'" style="fill:'+n+"; stroke:"+o+'; stroke-width:1.5;" />',!0},this.rect=function(r,e,t,a){if(1!=M)return GlobalClasses.error_code("Svg","rect",13);if(arguments.length<4)return GlobalClasses.error_code("Svg","rect",0);if(1!=GlobalClasses.is_number(r)||1!=GlobalClasses.is_number(e)||1!=GlobalClasses.is_number(t)||1!=GlobalClasses.is_number(a))return GlobalClasses.error_code("Svg","rect",1);var n=w([r,e]),o=4<arguments.length?GlobalClasses.check_color(arguments[4]):"#000000",l=5<arguments.length?GlobalClasses.check_color(arguments[5]):"none",s=Math.abs(t)*u,i=Math.abs(a)*g;return G+='<rect x="'+n[0].toFixed(3)+'" y="'+(n[1]-i).toFixed(3)+'" width="'+s.toFixed(3)+'" height="'+i.toFixed(3)+'" style="fill:'+o+"; stroke:"+l+'; stroke-width:1.5; stroke-linejoin:round;" />',!0},this.line=function(r,e,t,a){if(1!=M)return GlobalClasses.error_code("Svg","line",13);if(arguments.length<4)return GlobalClasses.error_code("Svg","line",0);if(1!=GlobalClasses.is_number(r)||1!=GlobalClasses.is_number(e)||1!=GlobalClasses.is_number(t)||1!=GlobalClasses.is_number(a))return GlobalClasses.error_code("Svg","line",1);var n=w([r,e]),o=w([t,a]),l=4<arguments.length?GlobalClasses.check_color(arguments[4]):"#000000";return G+='<line x1="'+n[0].toFixed(3)+'" y1="'+n[1].toFixed(3)+'" x2="'+o[0].toFixed(3)+'" y2="'+o[1].toFixed(3)+'" style="fill:none; stroke:'+l+'; stroke-width:1.5; stroke-linecap:round;" />',!0},this.triangle=function(r,e,t,a,n,o){if(1!=M)return GlobalClasses.error_code("Svg","triangle",13);if(arguments.length<6)return GlobalClasses.error_code("Svg","triangle",0);if(1!=GlobalClasses.is_number(r)||1!=GlobalClasses.is_number(e)||1!=GlobalClasses.is_number(t)||1!=GlobalClasses.is_number(a)||1!=GlobalClasses.is_number(n)||1!=GlobalClasses.is_number(o))return GlobalClasses.error_code("Svg","triangle",1);var l=w([r,e]),s=w([t,a]),i=w([n,o]),f=6<arguments.length?GlobalClasses.check_color(arguments[6]):"#000000",u=7<arguments.length?GlobalClasses.check_color(arguments[7]):"none";return G+='<polygon points="'+l[0].toFixed(3)+","+l[1].toFixed(3)+" "+s[0].toFixed(3)+","+s[1].toFixed(3)+" "+i[0].toFixed(3)+","+i[1].toFixed(3)+'" style="fill:'+f+"; stroke:"+u+'; stroke-width:1.5; stroke-linejoin:round;" />',!0},this.text=function(r,e,t){if(1!=M)return GlobalClasses.error_code("Svg","text",13);if(arguments.length<3)return GlobalClasses.error_code("Svg","text",0);if(1!=GlobalClasses.is_number(r)||1!=GlobalClasses.is_number(e))return GlobalClasses.error_code("Svg","text",1);if(1!=GlobalClasses.is_string(t)&&1!=GlobalClasses.is_number(t))return GlobalClasses.error_code("Svg","text",1);var a=w([r,e]),n=3<arguments.length?GlobalClasses.check_color(arguments[3]):"#000000",o=t;return 1==GlobalClasses.is_number(t)&&(o=Math.abs(t-Math.round(t))<1e-12?t.toFixed(0):t.toFixed(4)),G+='<text x="'+a[0].toFixed(3)+'" y="'+a[1].toFixed(3)+'" style="fill:'+n+'; stroke:none; font-size:12px; font-family:sans-serif; text-anchor:middle; dominant-baseline:middle;">'+o+"</text>",!0},this.arrow=function(r,e,t,a){if(1!=M)return GlobalClasses.error_code("Svg","arrow",13);if(arguments.length<4)return GlobalClasses.error_code("Svg","arrow",0);if(1!=GlobalClasses.is_number(r)||1!=GlobalClasses.is_number(e)||1!=GlobalClasses.is_number(t)||1!=GlobalClasses.is_number(a))return GlobalClasses.error_code("Svg","arrow",1);var n,o,l,s,i,f,u,g,_,h,c=w([r,e]),d=w([t,a]),v=4<arguments.length?GlobalClasses.check_color(arguments[4]):"#000000";if((n=c[0],o=c[1],l=d[0],s=d[1],Math.sqrt((n-l)*(n-l)+(o-s)*(o-s)))<.1)G+='<circle cx="'+d[0].toFixed(3)+'" cy="'+d[1].toFixed(3)+'" r="2.5" style="fill:'+v+'; stroke:none;" />';else{G+='<line x1="'+c[0].toFixed(3)+'" y1="'+c[1].toFixed(3)+'" x2="'+d[0].toFixed(3)+'" y2="'+d[1].toFixed(3)+'" style="fill:none; stroke:'+v+'; stroke-width:1.5; stroke-linecap:round;" />';var b=(i=c[0],f=c[1],u=d[0],g=d[1],h=f-g,0==(_=u-i)&&0==h?0:0==_&&0<h?Math.PI/2:0==_&&h<0?-Math.PI/2:Math.atan(h/_)+(0<_?0:Math.PI)),m=[30*Math.cos(b),30*Math.sin(b)],p=[d[0]+35*Math.cos(b)-m[0],d[1]-35*Math.sin(b)+m[1]],x=[d[0]+28*Math.cos(b)-m[0],d[1]-28*Math.sin(b)+m[1]],y=[d[0]+25*Math.cos(b+.15)-m[0],d[1]-25*Math.sin(b+.15)+m[1]],C=[d[0]+25*Math.cos(b-.15)-m[0],d[1]-25*Math.sin(b-.15)+m[1]];G+='<polygon points="'+p[0].toFixed(3)+","+p[1].toFixed(3)+" "+y[0].toFixed(3)+","+y[1].toFixed(3)+" "+x[0].toFixed(3)+","+x[1].toFixed(3)+" "+C[0].toFixed(3)+","+C[1].toFixed(3)+'" style="fill:'+v+'; stroke:none;" />'}return!0}},Svg=new Svg_taramathObject,VersionData=new function(){this.get=function(){return"139"},this.date=function(){return"2018-09-15-21-07"}};