php-tools/math.min.js

47 lines
407 KiB
JavaScript
Raw Normal View History

/**
* math.js
* https://github.com/josdejong/mathjs
*
* Math.js is an extensive math library for JavaScript and Node.js,
* It features real and complex numbers, units, matrices, a large set of
* mathematical functions, and a flexible expression parser.
*
* @version 2.6.0
* @date 2016-01-08
*
* @license
* Copyright (C) 2013-2016 Jos de Jong <wjosdejong@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.math=t():e.math=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){function n(e){var t=i.create(e);return t.create=n,t["import"](r(13)),t}var i=r(1);e.exports=n()},function(e,t,r){e.exports=r(2)},function(e,t,r){var n=r(3).isFactory,i=r(3).deepExtend,a=r(4),o=r(8),s=r(10),u=r(12);t.create=function(e){function t(e){if(!n(e))throw new Error("Factory object with properties `type`, `name`, and `factory` expected");var i,a=r.indexOf(e);return-1===a?(i=e.math===!0?e.factory(f.type,l,t,f.typed,f):e.factory(f.type,l,t,f.typed),r.push(e),c.push(i)):i=c[a],i}if("function"!=typeof Object.create)throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var r=[],c=[],f=o.mixin({});f.type={},f.expression={transform:Object.create(f)},f.typed=a.create(f.type);var l={epsilon:1e-14,matrix:"matrix",number:"number",precision:64,predictable:!1};return e&&i(l,e),f["import"]=t(s),f.config=t(u),f}},function(e,t){"use strict";t.clone=function r(e){var t=typeof e;if("number"===t||"string"===t||"boolean"===t||null===e||void 0===e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map(function(e){return r(e)});if(e instanceof Number)return new Number(e.valueOf());if(e instanceof String)return new String(e.valueOf());if(e instanceof Boolean)return new Boolean(e.valueOf());if(e instanceof Date)return new Date(e.valueOf());if(e&&e.isBigNumber===!0)return e;if(e instanceof RegExp)throw new TypeError("Cannot clone "+e);var n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]=r(e[i]));return n},t.extend=function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e},t.deepExtend=function n(e,t){if(Array.isArray(t))throw new TypeError("Arrays are not supported by deepExtend");for(var r in t)if(t.hasOwnProperty(r))if(t[r]&&t[r].constructor===Object)void 0===e[r]&&(e[r]={}),e[r].constructor===Object?n(e[r],t[r]):e[r]=t[r];else{if(Array.isArray(t[r]))throw new TypeError("Arrays are not supported by deepExtend");e[r]=t[r]}return e},t.deepEqual=function(e,r){var n,i,a;if(Array.isArray(e)){if(!Array.isArray(r))return!1;if(e.length!=r.length)return!1;for(i=0,a=e.length;a>i;i++)if(!t.deepEqual(e[i],r[i]))return!1;return!0}if(e instanceof Object){if(Array.isArray(r)||!(r instanceof Object))return!1;for(n in e)if(!t.deepEqual(e[n],r[n]))return!1;for(n in r)if(!t.deepEqual(e[n],r[n]))return!1;return!0}return typeof e==typeof r&&e==r},t.canDefineProperty=function(){try{if(Object.defineProperty)return Object.defineProperty({},"x",{get:function(){}}),!0}catch(e){}return!1},t.lazy=function(e,r,n){if(t.canDefineProperty()){var i,a=!0;Object.defineProperty(e,r,{get:function(){return a&&(i=n(),a=!1),i},set:function(e){i=e,a=!1},configurable:!0,enumerable:!0})}else e[r]=n()},t.traverse=function(e,t){var r=e;if(t)for(var n=t.split("."),i=0;i<n.length;i++){var a=n[i];a in r||(r[a]={}),r=r[a]}return r},t.isFactory=function(e){return e&&"function"==typeof e.factory}},function(e,t,r){var n=r(5),i=r(6).digits,a=function(){return a=n.create,n};t.create=function(e){var t=a();return t.types=[{name:"number",test:function(e){return"number"==typeof e}},{name:"Complex",test:function(e){return e&&e.isComplex}},{name:"BigNumber",test:function(e){return e&&e.isBigNumber}},{name:"Fraction",test:function(e){return e&&e.isFraction}},{name:"Unit",test:function(e){return e&&e.isUnit}},{name:"string",test:function(e){return"string"==typeof e}},{name:"Array",test:Array.isArray},{name:"Matrix",test:function(e){return e&&e.isMatrix}},{name:"DenseMatrix",test:function(e){return e&&e.isDenseMatrix}},{name:"SparseMatrix",test:function(e){return e&&e.isSparseMatrix}},{name:"ImmutableDenseMatrix",test:function(e){return e&&e.isImmutableDenseMat
T.absoluteValue=T.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),g(e)},T.ceil=function(){return g(new this.constructor(this),this.e+1,2)},T.comparedTo=T.cmp=function(e,t){var r,n=this,i=n.c,a=(w=-w,e=new n.constructor(e,t),e.c),o=n.s,s=e.s,u=n.e,c=e.e;if(!o||!s)return null;if(r=i&&!i[0],t=a&&!a[0],r||t)return r?t?0:-s:o;if(o!=s)return o;if(r=0>o,!i||!a)return u==c?0:!i^r?1:-1;if(u!=c)return u>c^r?1:-1;for(o=-1,s=(u=i.length)<(c=a.length)?u:c;++o<s;)if(i[o]!=a[o])return i[o]>a[o]^r?1:-1;return u==c?0:u>c^r?1:-1},T.decimalPlaces=T.dp=function(){var e,t,r=null;if(e=this.c){if(r=((t=e.length-1)-N(this.e/_))*_,t=e[t])for(;t%10==0;t/=10,r--);0>r&&(r=0)}return r},T.dividedBy=T.div=function(e,t){return w=2,k(this,new this.constructor(e,t))},T.dividedToIntegerBy=T.divToInt=function(e,t){var r=this,n=r.constructor;return w=18,g(k(r,new n(e,t),0,1,1),n.precision,n.rounding)},T.equals=T.eq=function(e,t){return w=3,0===this.cmp(e,t)},T.exponential=T.exp=function(){return c(this)},T.floor=function(){return g(new this.constructor(this),this.e+1,3)},T.greaterThan=T.gt=function(e,t){return w=4,this.cmp(e,t)>0},T.greaterThanOrEqualTo=T.gte=function(e,t){return w=5,t=this.cmp(e,t),1==t||0===t},T.isFinite=function(){return!!this.c},T.isInteger=T.isInt=function(){return!!this.c&&N(this.e/_)>this.c.length-2},T.isNaN=function(){return!this.s},T.isNegative=T.isNeg=function(){return this.s<0},T.isZero=function(){return!!this.c&&0==this.c[0]},T.lessThan=T.lt=function(e,t){return w=6,this.cmp(e,t)<0},T.lessThanOrEqualTo=T.lte=function(e,t){return w=7,t=this.cmp(e,t),-1==t||0===t},T.logarithm=T.log=function(e,t){var r,n,i,s,u,c,f,l,m,v=this,d=v.constructor,y=d.precision,x=d.rounding,N=5;if(null==e)e=new d(10),r=!0;else{if(w=15,e=new d(e,t),n=e.c,e.s<0||!n||!n[0]||!e.e&&1==n[0]&&1==n.length)return new d(NaN);r=e.eq(10)}if(n=v.c,v.s<0||!n||!n[0]||!v.e&&1==n[0]&&1==n.length)return new d(n&&!n[0]?-1/0:1!=v.s?NaN:n?0:1/0);if(u=r&&(s=n[0],n.length>1||1!=s&&10!=s&&100!=s&&1e3!=s&&1e4!=s&&1e5!=s&&1e6!=s),b=!1,f=y+N,l=f+10,c=h(v,f),r?(l>B.length&&p(d,1,l,"log"),i=new d(B.slice(0,l))):i=h(e,f),m=k(c,i,f,1),o(m.c,s=y,x))do if(f+=10,c=h(v,f),r?(l=f+10,l>B.length&&p(d,1,l,"log"),i=new d(B.slice(0,l))):i=h(e,f),m=k(c,i,f,1),!u){+a(m.c).slice(s+1,s+15)+1==1e14&&(m=g(m,y+1,0));break}while(o(m.c,s+=10,x));return b=!0,g(m,y,x)},T.minus=function(e,t){var r,n,i,a,o=this,s=o.constructor,u=o.s;if(w=8,e=new s(e,t),t=e.s,!u||!t)return new s(NaN);if(u!=t)return e.s=-t,o.plus(e);var c=o.c,f=e.c,l=N(e.e/_),p=N(o.e/_),m=s.precision,h=s.rounding;if(!p||!l){if(!c||!f)return c?(e.s=-t,e):new s(f?o:NaN);if(!c[0]||!f[0])return o=f[0]?(e.s=-t,e):new s(c[0]?o:3==h?-0:0),b?g(o,m,h):o}if(c=c.slice(),n=c.length,u=p-l){for((a=0>u)?(u=-u,r=c,n=f.length):(l=p,r=f),(p=Math.ceil(m/_))>n&&(n=p),u>(n+=2)&&(u=n,r.length=1),r.reverse(),t=u;t--;r.push(0));r.reverse()}else for((a=n<(i=f.length))&&(i=n),u=t=0;i>t;t++)if(c[t]!=f[t]){a=c[t]<f[t];break}if(a&&(r=c,c=f,f=r,e.s=-e.s),(t=-((i=c.length)-f.length))>0)for(;t--;c[i++]=0);for(p=A-1,t=f.length;t>u;){if(c[--t]<f[t]){for(n=t;n&&!c[--n];c[n]=p);--c[n],c[t]+=A}c[t]-=f[t]}for(;0==c[--i];c.pop());for(;0==c[0];c.shift(),--l);for(c[0]||(c=[l=0],e.s=3==h?-1:1),e.c=c,u=1,t=c[0];t>=10;t/=10,u++);return e.e=u+l*_-1,b?g(e,m,h):e},T.modulo=T.mod=function(e,t){var r,n,i=this,a=i.constructor,o=a.modulo;return w=9,e=new a(e,t),t=e.s,r=!i.c||!t||e.c&&!e.c[0],r||!e.c||i.c&&!i.c[0]?r?new a(NaN):g(new a(i),a.precision,a.rounding):(b=!1,9==o?(e.s=1,n=k(i,e,0,3,1),e.s=t,n.s*=t):n=k(i,e,0,o,1),n=n.times(e),b=!0,i.minus(n))},T.naturalLogarithm=T.ln=function(){return h(this)},T.negated=T.neg=function(){var e=new this.constructor(this);return e.s=-e.s||null,g(e)},T.plus=function(e,t){var r,n=this,i=n.constructor,a=n.s;if(w=10,e=new i(e,t),t=e.s,!a||!t)return new i(NaN);if(a!=t)return e.s=-t,n.minus(e);var o=n.c,s=e.c,u=N(e.e/_),c=N(n.e/_),f=i.precision,l=i.rounding;if(!c||!u){if(!o||!s)return new i(a/0);if(!o[0]||!s[0])return n=s[0]?e:new i(o[0]?n:0*a),b?g(n,f,l):n}if(o=o.slice(),a=c-u){for(0>a?(a=-a,r=o,t=s.length):(u=c,r=s,t=o.length),(c=Math.c
* @license Fraction.js v3.0.0 09/09/2015
* http://www.xarg.org/2014/03/precise-calculations-in-javascript/
*
* Copyright (c) 2015, Robert Eisele (robert@xarg.org)
* Dual licensed under the MIT or GPL Version 2 licenses.
**/
!function(a){"use strict";function o(e,t){return isNaN(e=parseInt(e,10))&&s(),e*t}function s(){throw"Invalid Param"}function u(e,t){return this instanceof u?(l(e,t),e=u.REDUCE?g(f.d,f.n):1,this.s=f.s,this.n=f.n/e,void(this.d=f.d/e)):new u(e,t)}var c=2e3,f={s:1,n:0,d:1},l=function(e,t){var r,n=0,i=1,a=1,u=0,c=0,l=0,p=1,m=1,h=0,g=1,v=1,d=1,y=1e7;if(void 0===e||null===e);else if(void 0!==t)n=e,i=t,a=n*i;else switch(typeof e){case"object":"d"in e&&"n"in e?(n=e.n,i=e.d,"s"in e&&(n*=e.s)):0 in e?(n=e[0],1 in e&&(i=e[1])):s(),a=n*i;break;case"number":if(0>e&&(a=e,e=-e),e%1===0)n=e;else if(e>0){for(e>=1&&(m=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)),e/=m);y>=g&&y>=d;){if(r=(h+v)/(g+d),e===r){y>=g+d?(n=h+v,i=g+d):d>g?(n=v,i=d):(n=h,i=g);break}e>r?(h+=v,g+=d):(v+=h,d+=g),g>y?(n=v,i=d):(n=h,i=g)}n*=m}break;case"string":if(g=e.match(/\d+|./g),"-"===g[h]?(a=-1,h++):"+"===g[h]&&h++,g.length===h+1?c=o(g[h++],a):"."===g[h+1]||"."===g[h]?("."!==g[h]&&(u=o(g[h++],a)),h++,(h+1===g.length||"("===g[h+1]&&")"===g[h+3]||"'"===g[h+1]&&"'"===g[h+3])&&(c=o(g[h],a),p=Math.pow(10,g[h].length),h++),("("===g[h]&&")"===g[h+2]||"'"===g[h]&&"'"===g[h+2])&&(l=o(g[h+1],a),m=Math.pow(10,g[h+1].length)-1,h+=3)):"/"===g[h+1]||":"===g[h+1]?(c=o(g[h],a),p=o(g[h+2],1),h+=3):"/"===g[h+3]&&" "===g[h+1]&&(u=o(g[h],a),c=o(g[h+2],a),p=o(g[h+4],1),h+=5),g.length<=h){a=n=l+m*(u*p+c),i=p*m;break}default:s()}if(!i)throw"DIV/0";f.s=0>a?-1:1,f.n=Math.abs(n),f.d=Math.abs(i)},p=function(e,t,r){for(var n=1;t>0;e=e*e%r,t>>=1)1&t&&(n=n*e%r);return n},m=function(e,t){for(;t%2===0;t/=2);for(;t%5===0;t/=5);if(1===t)return 0;for(var r=10%t,n=1;1!==r;n++)if(r=10*r%t,n>c)return 0;return n},h=function(e,t,r){for(var n=1,i=p(10,r,t),a=0;300>a;a++){if(n===i)return a;n=10*n%t,i=10*i%t}return 0},g=function(e,t){if(!e)return t;if(!t)return e;for(;;){if(e%=t,!e)return t;if(t%=e,!t)return e}};u.REDUCE=1,u.prototype={s:1,n:0,d:1,abs:function(){return new u(this.n,this.d)},neg:function(){return new u(-this.s*this.n,this.d)},add:function(e,t){return l(e,t),new u(this.s*this.n*f.d+f.s*this.d*f.n,this.d*f.d)},sub:function(e,t){return l(e,t),new u(this.s*this.n*f.d-f.s*this.d*f.n,this.d*f.d)},mul:function(e,t){return l(e,t),new u(this.s*f.s*this.n*f.n,this.d*f.d)},div:function(e,t){return l(e,t),new u(this.s*f.s*this.n*f.d,this.d*f.n)},clone:function(){return new u(this)},mod:function(e,t){return void 0===e?new u(this.s*this.n%this.d,1):(l(e,t),0===f.n*this.d&&u(0,0),new u(this.s*f.d*this.n%(f.n*this.d),f.d*this.d))},gcd:function(e,t){return l(e,t),new u(g(f.n,this.n),f.d*this.d/g(f.d,this.d))},lcm:function(e,t){return l(e,t),new u(f.n*this.n/g(f.n,this.n),g(f.d,this.d))},ceil:function(){return new u(Math.ceil(this.s*this.n/this.d),1)},floor:function(){return new u(Math.floor(this.s*this.n/this.d),1)},round:function(){return new u(Math.round(this.s*this.n/this.d),1)},inverse:function(){return new u(this.s*this.d,this.n)},pow:function(e){var t=this.d,r=this.n;return 0>e?(this.d=Math.pow(r,-e),this.n=Math.pow(t,-e)):(this.d=Math.pow(t,e),this.n=Math.pow(r,e)),0===e%2&&(this.s=1),this},equals:function(e,t){return l(e,t),this.s*this.n*f.d===f.s*f.n*this.d},compare:function(e,t){l(e,t);var r=this.s*this.n*f.d-f.s*f.n*this.d;return(r>0)-(0>r)},divisible:function(e,t){return l(e,t),!(!(f.n*this.d)||this.n*f.d%(f.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,r+=" ",n%=i),r+=n,r+="/",r+=i),r},toLatex:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,n%=i),r+="\\frac{",r+=n,r+="}{",r+=i,r+="}"),r},toString:function(){var e,t=this.n,r=this.d;u.REDUCE||(e=g(t,r),t/=e,r/=e);for(var n=String(t).split(""),i=0,a=[~this.s?"":"-","",""],o="",s=m(t,r),c=h(t,r,s),f=-1,l=1,p=10+s+c+n.length,v=0;p>v;v++,i*=10){if(v<n.length?i+=Number(n[v]):(l=2,f++),s>0)if(f===c)a[l]+=o+"(",o="";else if(f===s+c){a[l]+=o+")";break}i>=r?(a[l]+=o+(i/r|0),o="",i%=r):l>1?o+="0":a[l]&&(a[l]+="0")}return a[0]+=a[1]||"0",a[2]?a[0]+"."+a[2]:a[
return e.plus(t)},"Fraction, Fraction":function(e,t){return e.add(t)},"Unit, Unit":function(e,t){if(null==e.value)throw new Error("Parameter x contains a unit with undefined value");if(null==t.value)throw new Error("Parameter y contains a unit with undefined value");if(!e.equalBase(t))throw new Error("Units do not match");var r=e.clone();return r.value=i(r.value,t.value),r.fixPrefix=!1,r}});return i}t.factory=r},function(e,t,r){"use strict";function n(e,t,r,n){var a=e.DenseMatrix,o=function(e,t,r,o){var s=e._data,u=e._size,c=e._datatype,f=t._values,l=t._index,p=t._ptr,m=t._size,h=t._datatype;if(u.length!==m.length)throw new i(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");if(!f)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var g,v,d=u[0],y=u[1],x="string"==typeof c&&c===h?c:void 0,b=x?n.find(r,[x,x]):r,w=[];for(g=0;d>g;g++)w[g]=[];var N=[],E=[];for(v=0;y>v;v++){for(var M=v+1,A=p[v],_=p[v+1],O=A;_>O;O++)g=l[O],N[g]=o?b(f[O],s[g][v]):b(s[g][v],f[O]),E[g]=M;for(g=0;d>g;g++)E[g]===M?w[g][v]=N[g]:w[g][v]=s[g][v]}return new a({data:w,size:[d,y],datatype:x})};return o}var i=r(41);t.name="algorithm01",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){var o=n(r(47)),s=e.SparseMatrix,u=function(e,t,r){var n=e._values,u=e._index,c=e._ptr,f=e._size,l=e._datatype,p=t._values,m=t._index,h=t._ptr,g=t._size,v=t._datatype;if(f.length!==g.length)throw new i(f.length,g.length);if(f[0]!==g[0]||f[1]!==g[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+g+")");var d,y=f[0],x=f[1],b=o,w=0,N=r;"string"==typeof l&&l===v&&(d=l,b=a.find(o,[d,d]),w=a.convert(0,d),N=a.find(r,[d,d]));var E,M,A,_,O,T=n&&p?[]:void 0,C=[],S=[],z=new s({values:T,index:C,ptr:S,size:[y,x],datatype:d}),B=n&&p?[]:void 0,k=n&&p?[]:void 0,I=[],R=[];for(M=0;x>M;M++){S[M]=C.length;var P=M+1;for(_=c[M],O=c[M+1],A=_;O>A;A++)E=u[A],C.push(E),I[E]=P,B&&(B[E]=n[A]);for(_=h[M],O=h[M+1],A=_;O>A;A++)if(E=m[A],I[E]===P){if(B){var U=N(B[E],p[A]);b(U,w)?I[E]=null:B[E]=U}}else C.push(E),R[E]=P,k&&(k[E]=p[A]);if(B&&k)for(A=S[M];A<C.length;)E=C[A],I[E]===P?(T[A]=B[E],A++):R[E]===P?(T[A]=k[E],A++):C.splice(A,1)}return S[x]=C.length,z};return u}var i=r(41);t.name="algorithm04",t.factory=n},function(e,t){"use strict";function r(e,t,r,n){var i=e.DenseMatrix,a=function(e,t,r,a){var o=e._values,s=e._index,u=e._ptr,c=e._size,f=e._datatype;if(!o)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var l,p=c[0],m=c[1],h=r;"string"==typeof f&&(l=f,t=n.convert(t,l),h=n.find(r,[l,l]));for(var g=[],v=new i({data:g,size:[p,m],datatype:l}),d=[],y=[],x=0;m>x;x++){for(var b=x+1,w=u[x],N=u[x+1],E=w;N>E;E++){var M=s[E];d[M]=o[E],y[M]=b}for(var A=0;p>A;A++)0===x&&(g[A]=[]),y[A]===b?g[A][x]=a?h(t,d[A]):h(d[A],t):g[A][x]=t}return v};return a}t.name="algorithm10",t.factory=r},function(e,t,r){"use strict";function n(e,t,r,n){var i=e.DenseMatrix,o=function(e,t,r){var o=e._data,u=e._size,c=e._datatype,f=t._data,l=t._size,p=t._datatype,m=[];if(u.length!==l.length)throw new a(u.length,l.length);for(var h=0;h<u.length;h++){if(u[h]!==l[h])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+l+")");m[h]=u[h]}var g,v=r;"string"==typeof c&&c===p&&(g=c,t=n.convert(t,g),v=n.find(r,[g,g]));var d=m.length>0?s(v,0,m,m[0],o,f):[];return new i({data:d,size:m,datatype:g})},s=function(e,t,r,n,i,a){var o=[];if(t===r.length-1)for(var u=0;n>u;u++)o[u]=e(i[u],a[u]);else for(var c=0;n>c;c++)o[c]=s(e,t+1,r,r[t+1],i[c],a[c]);return o};return o}var i=r(38),a=r(41),o=i.string;o.isString;t.name="algorithm13",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=e.DenseMatrix,o=function(e,t,r,o){var u,c=e._data,f=e._size,l=e._datatype,p=r;"string"==typeof l&&(u=l,t=n.convert(t,u),p=n.find(r,[u,u]));var m=f.length>0?s(p,0,f,f[0],c,t,o):[];return new a({data:m,size:i(f),datatype:u})},s=function(e,t,r,n,i,a,o){var u=[];if(t===r.length-1)for(var c=0;n>c;c++)u[c]=o?e(a,i[c]):e(i[c],a);else for(var f=0
name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0}},BINARY_SHORT:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};B.SHORTLONG={};for(var k in B.SHORT)B.SHORT.hasOw
v=o.find(c,[r,r]),d=o.find(f,[r,r]));for(var y=[],x=0;p>x;x++){var b=n[x];y[x]=[];for(var w=0;g>w;w++){for(var N=d(b[0],s[0][w]),E=1;m>E;E++)N=v(N,d(b[E],s[E][w]));y[x][w]=N}}return 1===p&&1===g?y[0][0]:new h({data:y,size:[p,g],datatype:r})},A=function(e,t){var r=e._data,n=e._size,i=e._datatype,a=t._values,s=t._index,u=t._ptr,p=t._size,m=t._datatype;if(!a)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var h,v=n[0],d=p[1],y=c,x=f,b=l,w=0;i&&m&&i===m&&"string"==typeof i&&(h=i,y=o.find(c,[h,h]),x=o.find(f,[h,h]),b=o.find(l,[h,h]),w=o.convert(0,h));for(var N=[],E=[],M=[],A=new g({values:N,index:E,ptr:M,size:[v,d],datatype:h}),_=0;d>_;_++){M[_]=E.length;var O=u[_],T=u[_+1];if(T>O)for(var C=0,S=0;v>S;S++){for(var z,B=S+1,k=O;T>k;k++){var I=s[k];C!==B?(z=x(r[S][I],a[k]),C=B):z=y(z,x(r[S][I],a[k]))}C!==B||b(z,w)||(E.push(S),N.push(z))}}return M[d]=E.length,1===v&&1===d?1===N.length?N[0]:0:A},_=function(e,t){var r=e._values,n=e._index,i=e._ptr,a=e._datatype;if(!r)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var s,u=t._data,p=t._datatype,m=e._size[0],h=t._size[0],v=[],d=[],y=[],x=c,b=f,w=l,N=0;a&&p&&a===p&&"string"==typeof a&&(s=a,x=o.find(c,[s,s]),b=o.find(f,[s,s]),w=o.find(l,[s,s]),N=o.convert(0,s));var E=[],M=[];y[0]=0;for(var A=0;h>A;A++){var _=u[A];if(!w(_,N))for(var O=i[A],T=i[A+1],C=O;T>C;C++){var S=n[C];M[S]?E[S]=x(E[S],b(_,r[C])):(M[S]=!0,d.push(S),E[S]=b(_,r[C]))}}for(var z=d.length,B=0;z>B;B++){var k=d[B];v[B]=E[k]}return y[1]=d.length,1===m?1===v.length?v[0]:0:new g({values:v,index:d,ptr:y,size:[m,1],datatype:s})},O=function(e,t){var r=e._values,n=e._index,i=e._ptr,a=e._datatype;if(!r)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var s,u=t._data,p=t._datatype,m=e._size[0],h=t._size[0],v=t._size[1],d=c,y=f,x=l,b=0;a&&p&&a===p&&"string"==typeof a&&(s=a,d=o.find(c,[s,s]),y=o.find(f,[s,s]),x=o.find(l,[s,s]),b=o.convert(0,s));for(var w=[],N=[],E=[],M=new g({values:w,index:N,ptr:E,size:[m,v],datatype:s}),A=[],_=[],O=0;v>O;O++){E[O]=N.length;for(var T=O+1,C=0;h>C;C++){var S=u[C][O];if(!x(S,b))for(var z=i[C],B=i[C+1],k=z;B>k;k++){var I=n[k];_[I]!==T?(_[I]=T,N.push(I),A[I]=y(S,r[k])):A[I]=d(A[I],y(S,r[k]))}}for(var R=E[O],P=N.length,U=R;P>U;U++){var q=N[U];w[U]=A[q]}}return E[v]=N.length,1===m&&1===v?1===w.length?w[0]:0:M},T=function(e,t){var r,n=e._values,i=e._index,a=e._ptr,s=e._datatype,u=t._values,l=t._index,p=t._ptr,m=t._datatype,h=e._size[0],v=t._size[1],d=n&&u,y=c,x=f;s&&m&&s===m&&"string"==typeof s&&(r=s,y=o.find(c,[r,r]),x=o.find(f,[r,r]));for(var b,w,N,E,M,A,_,O,T=d?[]:void 0,C=[],S=[],z=new g({values:T,index:C,ptr:S,size:[h,v],datatype:r}),B=d?[]:void 0,k=[],I=0;v>I;I++){S[I]=C.length;var R=I+1;for(M=p[I],A=p[I+1],E=M;A>E;E++)if(O=l[E],d)for(w=a[O],N=a[O+1],b=w;N>b;b++)_=i[b],k[_]!==R?(k[_]=R,C.push(_),B[_]=x(u[E],n[b])):B[_]=y(B[_],x(u[E],n[b]));else for(w=a[O],N=a[O+1],b=w;N>b;b++)_=i[b],k[_]!==R&&(k[_]=R,C.push(_));if(d)for(var P=S[I],U=C.length,q=P;U>q;q++){var L=C[q];T[q]=B[L]}}return S[v]=C.length,1===h&&1===v&&d?1===T.length?T[0]:0:z};return v.toTex="\\left(${args[0]}"+s.operators.multiply+"${args[1]}\\right)",v}var i=r(3).extend,a=r(39);t.name="multiply",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(47)),o=e.SparseMatrix,s=function(e,t,r,n){var s=e._values,u=e._index,c=e._ptr,f=e._size,l=e._datatype;if(!s)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var p,m=f[0],h=f[1],g=a,v=0,d=r;"string"==typeof l&&(p=l,g=i.find(a,[p,p]),v=i.convert(0,p),t=i.convert(t,p),d=i.find(r,[p,p]));for(var y=[],x=[],b=[],w=new o({values:y,index:x,ptr:b,size:[m,h],datatype:p}),N=0;h>N;N++){b[N]=x.length;for(var E=c[N],M=c[N+1],A=E;M>A;A++){var _=u[A],O=n?d(t,s[A]):d(s[A],t);g(O,v)||(x.push(_),y.push(O))}}return b[h]=x.length,w};return s}t.name="algorithm11",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("abs",{number:Math.abs,Complex:function(e){var t=Math.abs(e.re),r=Math.abs(e.im);if(1e3>t&&1e3>r)return Math.sqrt(t*t+r*r);if(t>=r){var n=r/t;return t*Math.sqrt(
name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]}},function(e,t){e.exports={name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log10"]}},function(e,t){e.exports={name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]}},function(e,t){e.exports={name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","function isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]}},function(e,t){e.exports={name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]}},function(e,t){e.exports={name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i))","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)","norm([[1, 2], [3, 4]], 'inf')","norm([[1, 2], [3, 4]], 'fro')"]}},function(e,t){e.exports={name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["sqrt","pow"]}},function(e,t){e.exports={name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3 = 8","2*2*2","1 + e ^ (pi * i)"],seealso:["multiply"]}},function(e,t){e.exports={name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)"],seealso:["ceil","floor","fix"]}},function(e,t){e.exports={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]}},function(e,t){e.exports={name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","multiply"]}},function(e,t){e.exports={name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]}},function(e,t){e.exports={name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]}},function(e,t){e.exports={name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]}},function(e,t){e.exports={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Co
seealso:["sech","csch","tanh"]}},function(e,t){e.exports={name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]}},function(e,t){e.exports={name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]}},function(e,t){e.exports={name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]}},function(e,t){e.exports={name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]}},function(e,t){e.exports={name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]}},function(e,t){e.exports={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]}},function(e,t){e.exports={name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]}},function(e,t){e.exports={name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]}},function(e,t){e.exports={name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]}},function(e,t){e.exports={name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]}},function(e,t){e.exports={name:"map",category:"Utils",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], function(val) { return value * value })"],seealso:["filter","forEach"]}},function(e,t){e.exports={name:"partitionSelect",category:"Utils",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1)'],seealso:["sort"]}},function(e,t){e.exports={name:"filter",category:"Utils",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]}},function(e,t){e.exports={name:"forEach",category:"Utils",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["forEach([1, 2, 3], function(val) { console.log(val) })"],seealso:["map","sort","filter"]}},function(e,t){e.exports={name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]}},function(e,t){e.exports={name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]}},function(e,t){e.exports={name:"i
var n=a[r];return t&&t.isRangeNode?n?(o.end=!0,"(function () { var end = size["+r+"]; return range( "+t.start._compile(e,o)+", "+t.end._compile(e,o)+", "+(t.step?t.step._compile(e,o):"1")+" );})()"):"range("+t.start._compile(e,o)+", "+t.end._compile(e,o)+", "+(t.step?t.step._compile(e,o):"1")+")":n?(o.end=!0,"(function () { var end = size["+r+"]; return "+t._compile(e,o)+";})()"):t._compile(e,o)});return i?"(function () { var obj = "+this.object._compile(e,o)+"; var size = math.size(obj).valueOf(); return math.subset( obj, math.index("+s.join(", ")+") "+(r?", "+r:"")+" );})()":"math.subset("+this.object._compile(e,o)+",math.index("+s.join(", ")+")"+(r?", "+r:"")+")"},a.prototype.forEach=function(e){e(this.object,"object",this);for(var t=0;t<this.ranges.length;t++)e(this.ranges[t],"ranges["+t+"]",this)},a.prototype.map=function(e){for(var t=this._ifNode(e(this.object,"object",this)),r=[],n=0;n<this.ranges.length;n++)r[n]=this._ifNode(e(this.ranges[n],"ranges["+n+"]",this));return new a(t,r)},a.prototype.objectName=function(){return this.object.name},a.prototype.clone=function(){return new a(this.object,this.ranges.slice(0))},a.prototype._toString=function(e){var t=this.object.toString(e);return o(this)&&(t="("+t+"("),t+"["+this.ranges.join(", ")+"]"},a.prototype._toTex=function(e){var t=this.object.toTex(e);o(this)&&(t="\\left("+t+"\\right)");var r=this.ranges.map(function(t){return t.toTex(e)});return t+"_{"+r.join(",")+"}"},a}t.name="IndexNode",t.path="expression.node",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){function o(e,t,r){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");if(!e||!e.isNode)throw new TypeError("Node expected");if(!t||!t.isNode)throw new TypeError("Node expected");if(r&&(!r||!r.isNode))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=e,this.end=t,this.step=r||null}function s(e,t){var r=i.getPrecedence(e,t),n={},a=i.getPrecedence(e.start,t);if(n.start=null!==a&&r>=a||"all"===t,e.step){var o=i.getPrecedence(e.step,t);n.step=null!==o&&r>=o||"all"===t}var s=i.getPrecedence(e.end,t);return n.end=null!==s&&r>=s||"all"===t,n}var u=n(r(271));return o.prototype=new u,o.prototype.type="RangeNode",o.prototype.isRangeNode=!0,o.prototype._compile=function(e,t){return"math.range("+this.start._compile(e,t)+", "+this.end._compile(e,t)+(this.step?", "+this.step._compile(e,t):"")+")"},o.prototype.forEach=function(e){e(this.start,"start",this),e(this.end,"end",this),this.step&&e(this.step,"step",this)},o.prototype.map=function(e){return new o(this._ifNode(e(this.start,"start",this)),this._ifNode(e(this.end,"end",this)),this.step&&this._ifNode(e(this.step,"step",this)))},o.prototype.clone=function(){return new o(this.start,this.end,this.step&&this.step)},o.prototype._toString=function(e){var t,r=e&&e.parenthesis?e.parenthesis:"keep",n=s(this,r),i=this.start.toString(e);if(n.start&&(i="("+i+")"),t=i,this.step){var a=this.step.toString(e);n.step&&(a="("+a+")"),t+=":"+a}var o=this.end.toString(e);return n.end&&(o="("+o+")"),t+=":"+o},o.prototype._toTex=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=s(this,t),n=this.start.toTex(e);if(r.start&&(n="\\left("+n+"\\right)"),this.step){var i=this.step.toTex(e);r.step&&(i="\\left("+i+"\\right)"),n+=":"+i}var a=this.end.toTex(e);return r.end&&(a="\\left("+a+"\\right)"),n+=":"+a},o}var i=r(274);t.name="RangeNode",t.path="expression.node",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a,o){function s(e){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof e)throw new TypeError('String expected for parameter "name"');this.name=e}function u(e){throw new Error("Undefined symbol "+e)}var c=n(r(271)),f=n(r(73));return s.prototype=new c,s.prototype.type="SymbolNode",s.prototype.isSymbolNode=!0,s.prototype._compile=function(e,t){return e.undef=u,e.Unit=f,t[this.name]?this.name:this.name in e.math?'("'+this.name+'" in scope ? scope["'+this.name+'"] :
s.prototype.isHelp=!0,s.prototype.toString=function(){var e=this.doc||{},t="\n";if(e.name&&(t+="Name: "+e.name+"\n\n"),e.category&&(t+="Category: "+e.category+"\n\n"),e.description&&(t+="Description:\n "+e.description+"\n\n"),e.syntax&&(t+="Syntax:\n "+e.syntax.join("\n ")+"\n\n"),e.examples){t+="Examples:\n";for(var r=0;r<e.examples.length;r++){var n=e.examples[r];t+=" "+n+"\n";var i;try{i=u.eval(n)}catch(o){i=o}i&&!i.isHelp&&(t+=" "+a.format(i,{precision:14})+"\n")}t+="\n"}return e.seealso&&(t+="See also: "+e.seealso.join(", ")+"\n"),t},s.prototype.toJSON=function(){var e=i.clone(this.doc);return e.mathjs="Help",e},s.fromJSON=function(e){var t={};for(var r in e)"mathjs"!==r&&(t[r]=e[r]);return new s(t)},s.prototype.valueOf=s.prototype.toString,s}var i=r(3),a=r(23);t.name="Help",t.path="type",t.factory=n},function(e,t,r){e.exports=[r(321),r(348),r(378),r(394),r(403),r(408),r(411),r(417),r(426),r(435),r(440),r(448),r(489),r(491)]},function(e,t,r){e.exports=[r(322),r(323),r(343),r(345),r(347)]},function(e,t,r){"use strict";function n(e,t,n,i){var o=n(r(50)),s=n(r(85)),u=n(r(51)),c=n(r(78)),f=n(r(77)),l=n(r(74)),p=n(r(62)),m=n(r(47)),h=n(r(75)),g=e.SparseMatrix,v=e.DenseMatrix,d=e.Spa,y=i("lup",{DenseMatrix:function(e){return x(e)},SparseMatrix:function(e){return b(e)},Array:function(e){var t=o(e),r=x(t);return{L:r.L.valueOf(),U:r.U.valueOf(),p:r.p}}}),x=function(e){var t,r,n,i=e._size[0],o=e._size[1],h=Math.min(i,o),g=a.clone(e._data),d=[],y=[i,h],x=[],b=[h,o],w=[];for(t=0;i>t;t++)w[t]=t;for(r=0;o>r;r++){if(r>0)for(t=0;i>t;t++){var N=Math.min(t,r),E=0;for(n=0;N>n;n++)E=u(E,f(g[t][n],g[n][r]));g[t][r]=l(g[t][r],E)}var M=r,A=0,_=0;for(t=r;i>t;t++){var O=g[t][r],T=s(O);p(T,A)&&(M=t,A=T,_=O)}if(r!==M&&(w[r]=[w[M],w[M]=w[r]][0],v._swapRows(r,M,g)),i>r)for(t=r+1;i>t;t++){var C=g[t][r];m(C,0)||(g[t][r]=c(g[t][r],_))}}for(r=0;o>r;r++)for(t=0;i>t;t++)0===r&&(o>t&&(x[t]=[]),d[t]=[]),r>t?(o>t&&(x[t][r]=g[t][r]),i>r&&(d[t][r]=0)):t!==r?(o>t&&(x[t][r]=0),i>r&&(d[t][r]=g[t][r])):(o>t&&(x[t][r]=g[t][r]),i>r&&(d[t][r]=1));var S=new v({data:d,size:y}),z=new v({data:x,size:b}),B=[];for(t=0,h=w.length;h>t;t++)B[w[t]]=t;return{L:S,U:z,p:B,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}},b=function(e){var t,r,n,i=e._size[0],a=e._size[1],o=Math.min(i,a),u=e._values,l=e._index,v=e._ptr,y=[],x=[],b=[],w=[i,o],N=[],E=[],M=[],A=[o,a],_=[],O=[];for(t=0;i>t;t++)_[t]=t,O[t]=t;var T=function(e,t){var r=O[e],n=O[t];_[r]=t,_[n]=e,O[e]=n,O[t]=r};for(r=0;a>r;r++){var C=new d;i>r&&(b.push(y.length),y.push(1),x.push(r)),M.push(N.length);var S=v[r],z=v[r+1];for(n=S;z>n;n++)t=l[n],C.set(_[t],u[n]);r>0&&C.forEach(0,r-1,function(e,t){g._forEachRow(e,y,x,b,function(r,n){r>e&&C.accumulate(r,h(f(n,t)))})});var B=r,k=C.get(r),I=s(k);C.forEach(r+1,i-1,function(e,t){var r=s(t);p(r,I)&&(B=e,I=r,k=t)}),r!==B&&(g._swapRows(r,B,w[1],y,x,b),g._swapRows(r,B,A[1],N,E,M),C.swap(r,B),T(r,B)),C.forEach(0,i-1,function(e,t){r>=e?(N.push(t),E.push(e)):(t=c(t,k),m(t,0)||(y.push(t),x.push(e)))})}return M.push(N.length),b.push(y.length),{L:new g({values:y,index:x,ptr:b,size:w}),U:new g({values:N,index:E,ptr:M,size:A}),p:_,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}};return y}var i=r(38),a=i.object;t.name="lup",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(324)),s=n(r(335)),u=i("slu",{"SparseMatrix, number, number":function(e,t,r){if(!o(t)||0>t||t>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(0>r||r>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var n=a(t,e,!1),i=s(e,n,r);return{L:i.L,U:i.U,p:i.pinv,q:n.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}});return u}var i=r(38),a=i.number,o=a.isInteger;t.name="slu",t.factory=n},function(e,t,r){"use strict";function n(e,t,n){var i=n(r(325)),a=n(r(330)),o=n(r(331)),s=n(r(332)),u=n(r(333)),c=function(e,t,r){var
return n}});return m.toTex="\\gcd\\left(${args}\\right)",m}function i(e,t){if(!a(e)||!a(t))throw new Error("Parameters in function gcd must be integer numbers");for(var r;0!=t;)r=e%t,e=t,t=r;return 0>e?-e:e}var a=r(6).isInteger;t.name="gcd",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){function o(e){for(var t=0,r=0,n=0;n<e.length;n++){var i=s(e[n]);p(r,i)?(t=f(t,f(c(r,i),c(r,i))),t=u(t,1),r=i):t=u(t,m(i)?f(c(i,r),c(i,r)):i)}return f(r,l(t))}var s=n(r(85)),u=n(r(51)),c=n(r(78)),f=n(r(77)),l=n(r(362)),p=n(r(58)),m=n(r(363)),h=a("hypot",{"... number | BigNumber":o,Array:function(e){return h.apply(h,i(e))},Matrix:function(e){return h.apply(h,i(e.toArray()))}});return h.toTex="\\hypot\\left(${args}\\right)",h}var i=r(39).flatten;t.name="hypot",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){function a(r){return r>=0||t.predictable?Math.sqrt(r):o(new e.Complex(r,0))}function o(t){var r,n,i=Math.sqrt(t.re*t.re+t.im*t.im);return r=t.re>=0?.5*Math.sqrt(2*(i+t.re)):Math.abs(t.im)/Math.sqrt(2*(i-t.re)),n=t.re<=0?.5*Math.sqrt(2*(i-t.re)):Math.abs(t.im)/Math.sqrt(2*(i+t.re)),t.im>=0?new e.Complex(r,n):new e.Complex(r,-n)}var s=n("sqrt",{number:a,Complex:o,BigNumber:function(e){return!e.isNegative()||t.predictable?e.sqrt():a(e.toNumber())},"Array | Matrix":function(e){return i(e,s,!0)},Unit:function(e){return e.pow(.5)}});return s.toTex="\\sqrt{${args[0]}}",s}var i=r(19);t.name="sqrt",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("isPositive",{number:function(e){return e>0},BigNumber:function(e){return!e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return e.s>0&&e.n>0},Unit:function(e){return a(e.value)},"Array | Matrix":function(e){return i(e,a)}});return a}var i=r(19);r(6);t.name="isPositive",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){function o(t,r){if(!t.isInt()||!r.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(t.isZero()||r.isZero())return new e.BigNumber(0);for(var n=t.times(r);!r.isZero();){var i=r;r=t.mod(i),t=i}return n.div(t).abs()}var s=n(r(50)),u=n(r(354)),c=n(r(365)),f=n(r(84)),l=n(r(55)),p=n(r(56)),m=a("lcm",{"number, number":i,"BigNumber, BigNumber":o,"Fraction, Fraction":function(t,r){return 0===t.n&&0===r.n?new e.Fraction(0):t.mul(r).abs().div(t.gcd(r))},"Matrix, Matrix":function(e,t){var r;switch(e.storage()){case"sparse":switch(t.storage()){case"sparse":r=c(e,t,m);break;default:r=u(t,e,m,!0)}break;default:switch(t.storage()){case"sparse":r=u(e,t,m,!1);break;default:r=l(e,t,m)}}return r},"Array, Array":function(e,t){return m(s(e),s(t)).valueOf()},"Array, Matrix":function(e,t){return m(s(e),t)},"Matrix, Array":function(e,t){return m(e,s(t))},"Matrix, number | BigNumber":function(e,t){var r;switch(e.storage()){case"sparse":r=f(e,t,m,!1);break;default:r=p(e,t,m,!1)}return r},"number | BigNumber, Matrix":function(e,t){var r;switch(t.storage()){case"sparse":r=f(t,e,m,!0);break;default:r=p(t,e,m,!0)}return r},"Array, number | BigNumber":function(e,t){return p(s(e),t,m,!1).valueOf()},"number | BigNumber, Array":function(e,t){return p(s(t),e,m,!0).valueOf()},"Array | Matrix | number | BigNumber, Array | Matrix | number | BigNumber, ...Array | Matrix | number | BigNumber":function(e,t,r){for(var n=m(e,t),i=0;i<r.length;i++)n=m(n,r[i]);return n}});return m.toTex="\\mathrm{${name}}\\left(${args}\\right)",m}function i(e,t){if(!a(e)||!a(t))throw new Error("Parameters in function lcm must be integer numbers");if(0==e||0==t)return 0;for(var r,n=e*t;0!=t;)r=t,t=e%r,e=r;return Math.abs(n/e)}var a=r(6).isInteger;t.name="lcm",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,o){var s=n(r(47)),u=e.SparseMatrix,c=function(e,t,r){var n=e._values,c=e._size,f=e._datatype,l=t._values,p=t._size,m=t._datatype;if(c.length!==p.length)throw new a(c.length,p.length);if(c[0]!==p[0]||c[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+c+") must match Matrix B ("+p+")");var h,g=c[0],v=c[1],d=s,y=0,x=r;"string"==typeof f&&f===m&&(h=f,d=o.find(s,[h,h]),y=o.convert(0,h),x=o.find(r,[h,h]));for(var b=n&&l?[]:void 0,
}--e,r=s[0];for(var m=1;m<s.length;++m)r+=s[m]/(e+m);return t=e+o+.5,Math.sqrt(2*Math.PI)*Math.pow(t,e+.5)*Math.exp(-t)*r},Complex:function(t){var r,n;if(0==t.im)return p(t.re);t=new e.Complex(t.re-1,t.im),n=new e.Complex(s[0],0);for(var i=1;i<s.length;++i){var a=t.re+i,u=a*a+t.im*t.im;0!=u?(n.re+=s[i]*a/u,n.im+=-(s[i]*t.im)/u):n.re=s[i]<0?-(1/0):1/0}r=new e.Complex(t.re+o+.5,t.im);var c=Math.sqrt(2*Math.PI);t.re+=.5;var m=l(r,t);0==m.im?m.re*=c:0==m.re?m.im*=c:(m.re*=c,m.im*=c);var h=Math.exp(-r.re);return r.re=h*Math.cos(-r.im),r.im=h*Math.sin(-r.im),f(f(m,r),n)},BigNumber:function(t){if(t.isInteger())return t.isNegative()||t.isZero()?new e.BigNumber(1/0):c(t.minus(1));if(!t.isFinite())return new e.BigNumber(t.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")},"Array | Matrix":function(e){return i(e,p)}});return p.toTex="\\Gamma\\left(${args[0]}\\right)",p}var i=r(19),a=r(6).isInteger,o=4.7421875,s=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];t.name="gamma",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var o=n("combinations",{"number, number":function(e,t){var r,n,i;if(!a(e)||0>e)throw new TypeError("Positive integer value expected in function combinations");if(!a(t)||0>t)throw new TypeError("Positive integer value expected in function combinations");if(t>e)throw new TypeError("k must be less than or equal to n");for(r=Math.max(t,e-t),n=1,i=1;e-r>=i;i++)n=n*(r+i)/i;return n},"BigNumber, BigNumber":function(t,r){var n,a,o,s,u=new e.BigNumber(1);if(!i(t)||!i(r))throw new TypeError("Positive integer value expected in function combinations");if(r.gt(t))throw new TypeError("k must be less than n in function combinations");for(n=t.minus(r),r.lt(n)&&(n=r),a=u,o=u,s=t.minus(n);o.lte(s);o=o.plus(1))a=a.times(n.plus(o)).dividedBy(o);return a}});return o.toTex="\\binom{${args[0]}}{${args[1]}}",o}function i(e){return e.isInteger()&&e.gte(0)}var a=r(6).isInteger;t.name="combinations",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var o=n("isInteger",{number:a.isInteger,BigNumber:function(e){return e.isInt()},Fraction:function(e){return 1===e.d&&isFinite(e.n)},"Array | Matrix":function(e){return i(e,o)}});return o}var i=r(19),a=r(6);t.name="isInteger",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(399)),o=n(r(51)),s=n(r(363)),u=n(r(400)),c=n(r(62)),f=i("composition",{"number | BigNumber, number | BigNumber":function(e,t){if(!(u(e)&&s(e)&&u(t)&&s(t)))throw new TypeError("Positive integer value expected in function composition");if(c(t,e))throw new TypeError("k must be less than or equal to n in function composition");return a(o(e,-1),o(t,-1))}});return f.toTex="\\mathrm{${name}}\\left(${args}\\right)",f}t.name="composition",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,i){var a=n(r(49)),o=n(r(310)),s=n(r(83)),u=n(r(399)),c=n(r(350)),f=n(r(400)),l=i("catalan",{"number | BigNumber":function(e){if(!f(e)||c(e))throw new TypeError("Non-negative integer value expected in function catalan");return o(u(s(e,2),e),a(e,1))}});return l.toTex="\\mathrm{C}_{${args[0]}}",l}t.name="catalan",t.factory=n},function(e,t,r){e.exports=[r(404),r(405),r(406),r(407)]},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("arg",{number:function(e){return Math.atan2(0,e)},Complex:function(e){return Math.atan2(e.im,e.re)},"Array | Matrix":function(e){return i(e,a)}});return a.toTex="\\arg\\left(${args[0]}\\right)",a}var i=r(19);t.name="arg",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("conj",{number:function(e){return e},BigNumber:function(e){return e},Complex:function(t){return new e.Complex(t.re,-t.im)},"Array | Matrix":function(e){return i(e,a)}});return a.toTex="\\left(${args[0]}\\right)^*",a}var i=r(19);t.name="conj",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){v
s}t.name="deepEqual",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){var o=n(r(50)),s=n(r(59)),u=n(r(60)),c=n(r(61)),f=n(r(55)),l=n(r(56)),p=r(29),m=a("smallerEq",{"boolean, boolean":function(e,t){return t>=e},"number, number":function(e,r){return r>=e||i(e,r,t.epsilon)},"BigNumber, BigNumber":function(e,t){return e.lte(t)},"Fraction, Fraction":function(e,t){return 1!==e.compare(t)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return m(e.value,t.value)},"string, string":function(e,t){return t>=e},"Matrix, Matrix":function(e,t){var r;switch(e.storage()){case"sparse":switch(t.storage()){case"sparse":r=u(e,t,m);break;default:r=s(t,e,m,!0)}break;default:switch(t.storage()){case"sparse":r=s(e,t,m,!1);break;default:r=f(e,t,m)}}return r},"Array, Array":function(e,t){return m(o(e),o(t)).valueOf()},"Array, Matrix":function(e,t){return m(o(e),t)},"Matrix, Array":function(e,t){return m(e,o(t))},"Matrix, any":function(e,t){var r;switch(e.storage()){case"sparse":r=c(e,t,m,!1);break;default:r=l(e,t,m,!1)}return r},"any, Matrix":function(e,t){var r;switch(t.storage()){case"sparse":r=c(t,e,m,!0);break;default:r=l(t,e,m,!0)}return r},"Array, any":function(e,t){return l(o(e),t,m,!1).valueOf()},"any, Array":function(e,t){return l(o(t),e,m,!0).valueOf()}});return m.toTex="\\left(${args[0]}"+p.operators.smallerEq+"${args[1]}\\right)",m}var i=r(6).nearlyEqual;t.name="smallerEq",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){var o=n(r(50)),s=n(r(59)),u=n(r(60)),c=n(r(61)),f=n(r(55)),l=n(r(56)),p=r(29),m=a("unequal",{"any, any":function(e,t){return null===e?null!==t:null===t?null!==e:void 0===e?void 0!==t:void 0===t?void 0!==e:h(e,t)},"Matrix, Matrix":function(e,t){var r;switch(e.storage()){case"sparse":switch(t.storage()){case"sparse":r=u(e,t,h);break;default:r=s(t,e,h,!0)}break;default:switch(t.storage()){case"sparse":r=s(e,t,h,!1);break;default:r=f(e,t,h)}}return r},"Array, Array":function(e,t){return m(o(e),o(t)).valueOf()},"Array, Matrix":function(e,t){return m(o(e),t)},"Matrix, Array":function(e,t){return m(e,o(t))},"Matrix, any":function(e,t){var r;switch(e.storage()){case"sparse":r=c(e,t,h,!1);break;default:r=l(e,t,h,!1)}return r},"any, Matrix":function(e,t){var r;switch(t.storage()){case"sparse":r=c(t,e,h,!0);break;default:r=l(t,e,h,!0)}return r},"Array, any":function(e,t){return l(o(e),t,h,!1).valueOf()},"any, Array":function(e,t){return l(o(t),e,h,!0).valueOf()}}),h=a("_unequal",{"boolean, boolean":function(e,t){return e!==t},"number, number":function(e,r){return!i(e,r,t.epsilon)},"BigNumber, BigNumber":function(e,t){return!e.eq(t)},"Fraction, Fraction":function(e,t){return 0!==e.compare(t)},"Complex, Complex":function(e,r){return!i(e.re,r.re,t.epsilon)||!i(e.im,r.im,t.epsilon)},"Unit, Unit":function(e,t){if(!e.equalBase(t))throw new Error("Cannot compare units with different base");return m(e.value,t.value)},"string, string":function(e,t){return e!==t}});return m.toTex="\\left(${args[0]}"+p.operators.unequal+"${args[1]}\\right)",m}var i=r(6).nearlyEqual;t.name="unequal",t.factory=n},function(e,t,r){e.exports=[r(305),r(309),r(441),r(314),r(443),r(444),r(445),r(446),r(428),r(447)]},function(e,t,r){"use strict";function n(e,t,n,a){function o(e){e=i(e.valueOf());var t=e.length;if(0==t)throw new Error("Cannot calculate median of an empty array");if(t%2==0){for(var r=t/2-1,n=f(e,r+1),a=e[r],o=0;r>o;++o)c(e[o],a)>0&&(a=e[o]);return m(a,n)}var s=f(e,(t-1)/2);return p(s)}var s=n(r(51)),u=n(r(78)),c=n(r(436)),f=n(r(442)),l=a("median",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("median(A, dim) is not yet supported")},"...":function(){return o(Array.prototype.slice.call(arguments))}}),p=a({"number | BigNumber | Unit":function(e){return e}}),m=a({"number | BigNumber | Unit, number | BigNumber | Unit":function(e,t){return u(s(e,t),2)}});return l.toTex="\\mathrm{${name}}\\left(${args}\\right)",l}var i=r(39).flat
return o(t.value)},"Array | Matrix":function(e){return i(e,o,!0)}});return o.toTex="\\tan\\left(${args[0]}\\right)",o}var i=r(19),a=r(479);t.name="tan",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var s=n("tanh",{number:i,Complex:function(t){var r=Math.exp(2*t.re),n=r*Math.cos(2*t.im),i=r*Math.sin(2*t.im),a=(n+1)*(n+1)+i*i;return new e.Complex(((n-1)*(n+1)+i*i)/a,2*i/a)},BigNumber:function(t){return o(t,e.BigNumber,!1)},Unit:function(t){if(!t.hasBase(e.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function tanh is no angle");return s(t.value)},"Array | Matrix":function(e){return a(e,s,!0)}});return s.toTex="\\tanh\\left(${args[0]}\\right)",s}function i(e){var t=Math.exp(2*e);return(t-1)/(t+1)}var a=r(19),o=r(481);t.name="tanh",t.factory=n},function(e,t,r){e.exports=[r(490)]},function(e,t,r){"use strict";function n(e,t,n,i){var a=r(29),o=n(r(50)),s=n(r(55)),u=n(r(56)),c=i("to",{"Unit, Unit | string":function(e,t){return e.to(t)},"Matrix, Matrix":function(e,t){return s(e,t,c)},"Array, Array":function(e,t){return c(o(e),o(t)).valueOf()},"Array, Matrix":function(e,t){return c(o(e),t)},"Matrix, Array":function(e,t){return c(e,o(t))},"Matrix, any":function(e,t){return u(e,t,c,!1)},"any, Matrix":function(e,t){return u(t,e,c,!0)},"Array, any":function(e,t){return u(o(e),t,c,!1).valueOf()},"any, Array":function(e,t){return u(o(t),e,c,!0).valueOf()}});return c.toTex="\\left(${args[0]}"+a.operators.to+"${args[1]}\\right)",c}t.name="to",t.factory=n},function(e,t,r){e.exports=[r(492),r(297),r(88),r(400),r(350),r(87),r(363),r(414),r(302),r(442),r(493),r(494),r(89),r(299)]},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("clone",{any:i.clone});return a.toTex="\\mathrm{${name}}\\left(${args}\\right)",a}var i=r(3);t.name="clone",t.factory=n},function(e,t,r){"use strict";function n(e,t,r,n){var a=n("print",{"string, Object":i,"string, Object, number":i});return a.toTex="\\mathrm{${name}}\\left(${args}\\right)",a}function i(e,t,r){return e.replace(/\$([\w\.]+)/g,function(e,n){for(var i=n.split("."),s=t[i.shift()];i.length&&void 0!==s;){var u=i.shift();s=u?s[u]:s+"."}return void 0!==s?a(s)?s:o(s,r):e})}var a=r(23).isString,o=r(23).format;t.name="print",t.factory=n},function(e,t,r){"use strict";function n(e,t,n,a){function o(e){if("asc"===e)return f;if("desc"===e)return l;throw new Error('String "asc" or "desc" expected')}function s(e){if(1!==i(e).length)throw new Error("One dimensional array expected")}function u(e){if(1!==e.size().length)throw new Error("One dimensional matrix expected")}var c=n(r(50)),f=n(r(436)),l=function(e,t){return-f(e,t)},p=a("sort",{Array:function(e){return s(e),e.sort(f)},Matrix:function(e){return u(e),c(e.toArray().sort(f),e.storage())},"Array, function":function(e,t){return s(e),e.sort(t)},"Matrix, function":function(e,t){return u(e),c(e.toArray().sort(t),e.storage())},"Array, string":function(e,t){return s(e),e.sort(o(t))},"Matrix, string":function(e,t){return u(e),c(e.toArray().sort(o(t)),e.storage())}});return p.toTex="\\mathrm{${name}}\\left(${args}\\right)",p}var i=r(39).size;t.name="sort",t.factory=n},function(e,t,r){e.exports=[r(496)]},function(e,t){"use strict";function r(e,t,r,n){return function(t,r){var n=e[r&&r.mathjs];return n&&"function"==typeof n.fromJSON?n.fromJSON(r):r}}t.name="reviver",t.path="json",t.factory=r},function(e,t,r){"use strict";var n=r(11),i=r(41),a=r(42);e.exports=[{name:"ArgumentsError",path:"error",factory:function(){return n}},{name:"DimensionError",path:"error",factory:function(){return i}},{name:"IndexError",path:"error",factory:function(){return a}}]}])});
//# sourceMappingURL=math.map