1 (
function(a){
if(typeof define===
"function"&&define.amd){define([
"JSRootCore"],a)}
else{
if(typeof JSROOT==
"undefined"){
throw new Error(
"This extension requires JSRootCore.js",
"JSRootMath.js")}
if(typeof JSROOT.Math==
"object"){
throw new Error(
"This JSROOT Math already loaded",
"JSRootMath.js")}a(JSROOT)}}(
function(a){a.Math={};a.Math.lgam=
function(m){var e,c,o,n,l,g,h=1;var j=2.556348e+305;var k=0.9189385332046728;var f=[0.0008116141674705085,-0.0005950619042843014,0.0007936503404577169,-0.002777777777300997,0.08333333333333319];var d=[-1378.2515256912086,-38801.631513463784,-331612.9927388712,-1162370.974927623,-1721737.0082083966,-853555.6642457654];var b=[-351.81570143652345,-17064.210665188115,-220528.59055385445,-1139334.4436798252,-2532523.0717758294,-2018891.4143353277];
if(m>=Number.POSITIVE_INFINITY){
return(Number.POSITIVE_INFINITY)}
if(m<-34){c=-m;n=this.lgam(c);e=Math.floor(c);
if(e==c){
return(Number.POSITIVE_INFINITY)}g=Math.round(e);
if((g&1)==0){h=-1}
else{h=1}l=c-e;
if(l>0.5){e+=1;l=e-c}l=c*Math.sin(Math.PI*l);
if(l<1e-300){
return(Number.POSITIVE_INFINITY)}l=Math.log(Math.PI)-Math.log(l)-n;
return(l)}
if(m<13){l=1;e=0;o=m;
while(o>=3){e-=1;o=m+e;l*=o}
while(o<2){
if(o<1e-300){
return(Number.POSITIVE_INFINITY)}l/=o;e+=1;o=m+e}
if(l<0){h=-1;l=-l}
else{h=1}
if(o==2){
return(Math.log(l))}e-=2;m=m+e;e=m*this.Polynomialeval(m,d,5)/this.Polynomial1eval(m,b,6);
return(Math.log(l)+e)}
if(m>j){
return(h*Number.POSITIVE_INFINITY)}c=(m-0.5)*Math.log(m)-m+k;
if(m>100000000){
return(c)}e=1/(m*m);
if(m>=1000){c+=((0.0007936507936507937*e-0.002777777777777778)*e+0.08333333333333333)/m}
else{c+=this.Polynomialeval(e,f,4)/m}
return(c)};a.Math.Polynomialeval=
function(b,c,f){
if(f==0){
return c[0]}
else{var e=c[0];
for(var d=1;d<=f;++d){e=e*b+c[d]}
return e}};a.Math.Polynomial1eval=
function(b,c,f){
if(f==0){
return c[0]}
else{var e=b+c[0];
for(var d=1;d<f;++d){e=e*b+c[d]}
return e}};a.Math.ndtri=
function(o){
if(o<=0){
return(Number.NEGATIVE_INFINITY)}
if(o>=1){
return(Number.POSITIVE_INFINITY)}var c=
new Array(-59.96335010141079,98.00107541859997,-56.67628574690703,13.931260938727968,-1.2391658386738125);var m=
new Array(1.9544885833814176,4.676279128988815,86.36024213908905,-225.46268785411937,200.26021238006066,-82.03722561683334,15.90562251262117,-1.1833162112133);var b=
new Array(4.0554489230596245,31.525109459989388,57.16281922464213,44.08050738932008,14.684956192885803,2.1866330685079025,-0.1402560791713545,-0.03504246268278482,-0.0008574567851546854);var j=
new Array(15.779988325646675,45.39076351288792,41.3172038254672,15.04253856929075,2.504649462083094,-0.14218292285478779,-0.03808064076915783,-0.0009332594808954574);var p=
new Array(3.2377489177694603,6.915228890689842,3.9388102529247444,1.3330346081580755,0.20148538954917908,0.012371663481782003,0.00030158155350823543,0.0000026580697468673755,6.239745391849833e-9);var h=
new Array(6.02427039364742,3.6798356385616087,1.3770209948908132,0.21623699359449663,0.013420400608854318,0.00032801446468212774,0.0000028924786474538068,6.790194080099813e-9);var g=2.5066282746310007;var e=1;var l=o;var n,i,k,f,d;
if(l>(1-0.1353352832366127)){l=1-l;e=0}
if(l>0.1353352832366127){l=l-0.5;k=l*l;n=l+l*(k*this.Polynomialeval(k,c,4)/this.Polynomial1eval(k,m,8));n=n*g;
return(n)}n=Math.sqrt(-2*Math.log(l));f=n-Math.log(n)/n;i=1/n;
if(n<8){d=i*this.Polynomialeval(i,b,8)/this.Polynomial1eval(i,j,8)}
else{d=i*this.Polynomialeval(i,p,8)/this.Polynomial1eval(i,h,8)}n=f-d;
if(e!=0){n=-n}
return(n)};a.Math.igam=
function(d,b){var i=1.1102230246251565e-16;var f=709.782712893384;var e,h,j,g;
if(d<=0){
return 1}
if(b<=0){
return 0}
if((b>1)&&(b>d)){
return(1-this.igamc(d,b))}h=d*Math.log(b)-b-this.lgam(d);
if(h<-f){
return(0)}h=Math.exp(h);g=d;j=1;e=1;
do{g+=1;j*=b/g;e+=j}
while(j/e>i);
return(e*h/d)};a.Math.igamc=
function(w,l){var f=1.1102230246251565e-16;var b=709.782712893384;var A=4503599627370496;var h=2.220446049250313e-16;var p,m,s,g,o,n,k,j;var q,v,u,i,e,d;
if(w<=0){
return 0}
if(l<=0){
return 1}
if((l<1)||(l<w)){
return(1-a.Math.igam(w,l))}m=w*Math.log(l)-l-a.Math.lgam(w);
if(m<-b){
return(0)}m=Math.exp(m);k=1-w;j=l+k+1;s=0;u=1;d=l;v=l+1;e=j*l;p=v/e;
do{s+=1;k+=1;j+=2;g=k*s;q=v*j-u*g;i=e*j-d*g;
if(i){o=q/i;n=Math.abs((p-o)/o);p=o}
else{n=1}u=v;v=q;d=e;e=i;
if(Math.abs(q)>A){u*=h;v*=h;d*=h;e*=h}}
while(n>f);
return(p*m)};a.Math.igami=
function(o,q){var e,c,p,f,j,n,l,r,h;var k,g;var m=1.1102230246251565e-16;
if(o<=0){alert(
"igami : Wrong domain for parameter a (must be > 0)");
return 0}
if(q<=0){
return Number.POSITIVE_INFINITY}
if(q>=1){
return 0}var b=Number.MAX_VALUE;e=b;f=0;c=0;j=1;h=5*m;l=1/(9*o);n=(1-l-this.ndtri(q)*Math.sqrt(l));p=o*n*n*n;r=this.lgam(o);
for(k=0;k<10;++k){
if(p>e||p<c){
break}n=this.igamc(o,p);
if(n<f||n>j){
break}
if(n<q){e=p;f=n}
else{c=p;j=n}l=(o-1)*Math.log(p)-p-r;
if(l<-kMAXLOG){
break}l=-Math.exp(l);l=(n-q)/l;
if(Math.abs(l/p)<m){
return(p)}p=p-l}l=0.0625;
if(e==b){
if(p<=0){p=1}
while(e==b){p=(1+l)*p;n=this.igamc(o,p);
if(n<q){e=p;f=n;
break}l=l+l}}l=0.5;g=0;
for(k=0;k<400;++k){p=c+l*(e-c);n=this.igamc(o,p);r=(e-c)/(c+e);
if(Math.abs(r)<h){
break}r=(n-q)/q;
if(Math.abs(r)<h){
break}
if(p<=0){
break}
if(n>=q){c=p;j=n;
if(g<0){g=0;l=0.5}
else{
if(g>1){l=0.5*l+0.5}
else{l=(q-f)/(j-f)}}g+=1}
else{e=p;f=n;
if(g>0){g=0;l=0.5}
else{
if(g<-1){l=0.5*l}
else{l=(q-f)/(j-f)}}g-=1}}
return(p)};a.Math.gamma_quantile_c=
function(d,c,b){
return b*this.igami(c,d)};a.Math.gamma_quantile=
function(d,c,b){
return b*this.igami(c,1-d)};a.Math.log10=
function(b){
return Math.log(b)/Math.log(10)};a.Math.landau_pdf=
function(n,q,s){
if(q<=0){
return 0}var o=(n-s)/q;var p,r,k,h;var e=
new Array(0.4259894875,-0.124976255,0.039842437,-0.006298287635,0.001511162253);var m=
new Array(1,-0.3388260629,0.09594393323,-0.01608042283,0.003778942063);var d=
new Array(0.1788541609,0.1173957403,0.01488850518,-0.001394989411,0.0001283617211);var l=
new Array(1,0.7428795082,0.3153932961,0.06694219548,0.008790609714);var c=
new Array(0.1788544503,0.09359161662,0.006325387654,0.00006611667319,-0.000002031049101);var j=
new Array(1,0.6097809921,0.2560616665,0.04746722384,0.006957301675);var b=
new Array(0.9874054407,118.6723273,849.279436,-743.7792444,427.0262186);var i=
new Array(1,106.8615961,337.6496214,2016.712389,1597.063511);var z=
new Array(1.003675074,167.5702434,4789.711289,21217.86767,-22324.9491);var g=
new Array(1,156.9424537,3745.310488,9834.698876,66924.28357);var y=
new Array(1.000827619,664.9143136,62972.92665,475554.6998,-5743609.109);var f=
new Array(1,651.4101098,56974.73333,165917.4725,-2815759.939);var w=
new Array(0.04166666667,-0.01996527778,0.02709538966);var t=
new Array(-1.84556867,-4.284640743);
if(o<-5.5){p=Math.exp(o+1);
if(p<1e-10){
return 0}r=Math.exp(-1/p);k=Math.sqrt(p);h=0.3989422803*(r/k)*(1+(w[0]+(w[1]+w[2]*p)*p)*p)}
else{
if(o<-1){p=Math.exp(-o-1);h=Math.exp(-p)*Math.sqrt(p)*(e[0]+(e[1]+(e[2]+(e[3]+e[4]*o)*o)*o)*o)/(m[0]+(m[1]+(m[2]+(m[3]+m[4]*o)*o)*o)*o)}
else{
if(o<1){h=(d[0]+(d[1]+(d[2]+(d[3]+d[4]*o)*o)*o)*o)/(l[0]+(l[1]+(l[2]+(l[3]+l[4]*o)*o)*o)*o)}
else{
if(o<5){h=(c[0]+(c[1]+(c[2]+(c[3]+c[4]*o)*o)*o)*o)/(j[0]+(j[1]+(j[2]+(j[3]+j[4]*o)*o)*o)*o)}
else{
if(o<12){p=1/o;h=p*p*(b[0]+(b[1]+(b[2]+(b[3]+b[4]*p)*p)*p)*p)/(i[0]+(i[1]+(i[2]+(i[3]+i[4]*p)*p)*p)*p)}
else{
if(o<50){p=1/o;h=p*p*(z[0]+(z[1]+(z[2]+(z[3]+z[4]*p)*p)*p)*p)/(g[0]+(g[1]+(g[2]+(g[3]+g[4]*p)*p)*p)*p)}
else{
if(o<300){p=1/o;h=p*p*(y[0]+(y[1]+(y[2]+(y[3]+y[4]*p)*p)*p)*p)/(f[0]+(f[1]+(f[2]+(f[3]+f[4]*p)*p)*p)*p)}
else{p=1/(o-o*Math.log(o)/(o+1));h=p*p*(1+(t[0]+t[1]*p)*p)}}}}}}}
return h/q};a.Math.Landau=
function(b,f,d,c){
if(d<=0){
return 0}var e=a.Math.landau_pdf((b-f)/d,1,0);
if(!c){
return e}
return e/d};a.Math.inc_gamma_c=
function(c,b){
return a.Math.igamc(c,b)};a.Math.chisquared_cdf_c=
function(b,d,c){
return a.Math.inc_gamma_c(0.5*d,0.5*(b-c))};a.Math.Prob=
function(b,c){
if(c<=0){
return 0}
if(b<=0){
if(b<0){
return 0}
else{
return 1}}
return a.Math.chisquared_cdf_c(b,c,0)};a.Math.gaus=
function(d,b,c){
return d.fParams[c+0]*Math.exp(-0.5*Math.pow((b-d.fParams[c+1])/d.fParams[c+2],2))};a.Math.gausn=
function(d,b,c){
return a.Math.gaus(d,b,c)/(Math.sqrt(2*Math.PI)*d.fParams[c+2])};a.Math.expo=
function(d,b,c){
return Math.exp(d.fParams[c+0]+d.fParams[c+1]*b)};a.Math.landau=
function(d,b,c){
return a.Math.Landau(b,d.fParams[c+1],d.fParams[c+2],
false)};a.Math.landaun=
function(d,b,c){
return a.Math.Landau(b,d.fParams[c+1],d.fParams[c+2],
true)};
return a}));