Commit 7f22fac1 authored by GoshaZotov's avatar GoshaZotov

delete duplicate, change name function

parent 15b34ae1
...@@ -317,7 +317,7 @@ ...@@ -317,7 +317,7 @@
} else { } else {
var nIndex = Math.floor(alpha * (nSize - 1)); var nIndex = Math.floor(alpha * (nSize - 1));
var fDiff = alpha * (nSize - 1) - Math.floor(alpha * (nSize - 1)); var fDiff = alpha * (nSize - 1) - Math.floor(alpha * (nSize - 1));
if (fDiff == 0.0) { if (fDiff === 0.0) {
return new cNumber(values[nIndex]); return new cNumber(values[nIndex]);
} else { } else {
return new cNumber(values[nIndex] + fDiff * (values[nIndex + 1] - values[nIndex])); return new cNumber(values[nIndex] + fDiff * (values[nIndex + 1] - values[nIndex]));
...@@ -842,26 +842,19 @@ ...@@ -842,26 +842,19 @@
return (u < 0 && w > 0) || (u > 0 && w < 0); return (u < 0 && w > 0) || (u > 0 && w < 0);
} }
function cGammaDistFunction(fp, fAlpha, fBeta){ function GAMMADISTFUNCTION(fp, fAlpha, fBeta){
this.fp = fp; this.fp = fp;
this.fAlpha = fAlpha; this.fAlpha = fAlpha;
this.fBeta = fBeta; this.fBeta = fBeta;
} }
cGammaDistFunction.prototype.constructor = cGammaDistFunction; GAMMADISTFUNCTION.prototype.constructor = GAMMADISTFUNCTION;
cGammaDistFunction.prototype.GetValue = function(x){ GAMMADISTFUNCTION.prototype.GetValue = function(x){
return this.fp - getGammaDist(x, this.fAlpha, this.fBeta); var res;
var gammaDistVal = getGammaDist(x, this.fAlpha, this.fBeta);
res = this.fp - gammaDistVal;
return res;
}; };
function getLowRegIGamma( fA, fX ){
var fLnFactor = fA * Math.log(fX) - fX - getLogGamma(fA);
var fFactor = Math.exp(fLnFactor);
if (fX > fA + 1){
return 1 - fFactor * getGammaContFraction(fA,fX);
} else {
return fFactor * getGammaSeries(fA,fX);
}
}
/** /**
* @constructor * @constructor
* @extends {AscCommonExcel.cBaseFunction} * @extends {AscCommonExcel.cBaseFunction}
...@@ -2676,7 +2669,7 @@ ...@@ -2676,7 +2669,7 @@
if (fP === 0){ if (fP === 0){
res = 0; res = 0;
}else { }else {
var aFunc = new cGammaDistFunction(fP, fAlpha, fBeta); var aFunc = new GAMMADISTFUNCTION(fP, fAlpha, fBeta);
var fStart = fAlpha * fBeta; var fStart = fAlpha * fBeta;
var oVal = iterateInverse(aFunc, fStart * 0.5, fStart); var oVal = iterateInverse(aFunc, fStart * 0.5, fStart);
var bConvError = oVal.bError; var bConvError = oVal.bError;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment