Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
0ed8f6ba
Commit
0ed8f6ba
authored
Jun 09, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add BETA.INV formula
parent
06c580d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
9 deletions
+69
-9
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+69
-9
No files found.
cell/model/FormulaObjects/statisticalFunctions.js
View file @
0ed8f6ba
...
...
@@ -61,7 +61,7 @@
cFormulaFunctionGroup
[
'
Statistical
'
]
=
cFormulaFunctionGroup
[
'
Statistical
'
]
||
[];
cFormulaFunctionGroup
[
'
Statistical
'
].
push
(
cAVEDEV
,
cAVERAGE
,
cAVERAGEA
,
cAVERAGEIF
,
cAVERAGEIFS
,
cBETADIST
,
cBETAINV
,
cBINOMDIST
,
cCHIDIST
,
cCHIINV
,
cCHITEST
,
cCONFIDENCE
,
cCORREL
,
cCOUNT
,
cCOUNTA
,
cCOUNTBLANK
,
cCOUNTIF
,
cBETA
_
INV
,
cBINOMDIST
,
cCHIDIST
,
cCHIINV
,
cCHITEST
,
cCONFIDENCE
,
cCORREL
,
cCOUNT
,
cCOUNTA
,
cCOUNTBLANK
,
cCOUNTIF
,
cCOUNTIFS
,
cCOVAR
,
cCRITBINOM
,
cDEVSQ
,
cEXPONDIST
,
cFDIST
,
cF_DIST
,
cF_DIST_RT
,
cFINV
,
cFISHER
,
cFISHERINV
,
cFORECAST
,
cFREQUENCY
,
cFTEST
,
cGAMMA
,
cGAMMA_DIST
,
cGAMMA_INV
,
cGAMMALN
,
cGEOMEAN
,
cGROWTH
,
cHARMEAN
,
cHYPGEOMDIST
,
cINTERCEPT
,
cKURT
,
cLARGE
,
cLINEST
,
cLOGEST
,
cLOGINV
,
cLOGNORMDIST
,
cMAX
,
cMAXA
,
cMEDIAN
,
cMIN
,
cMINA
,
cMODE
,
cNEGBINOMDIST
,
cNORMDIST
,
...
...
@@ -782,14 +782,14 @@
}
if
(
fAy
===
0
){
return
fAx
;
return
{
val
:
fAx
,
bError
:
rConvError
}
;
}
if
(
fBy
===
0
){
return
fBx
;
return
{
val
:
fBx
,
bError
:
rConvError
}
;
}
if
(
!
hasChangeOfSign
(
fAy
,
fBy
)){
rConvError
=
true
;
return
0.0
;
return
{
val
:
0
,
bError
:
rConvError
}
;
}
// inverse quadric interpolation with additional brackets
// set three points
...
...
@@ -847,7 +847,6 @@
this
.
fAlpha
=
fAlpha
;
this
.
fBeta
=
fBeta
;
}
GAMMADISTFUNCTION
.
prototype
.
constructor
=
GAMMADISTFUNCTION
;
GAMMADISTFUNCTION
.
prototype
.
GetValue
=
function
(
x
){
var
res
;
var
gammaDistVal
=
getGammaDist
(
x
,
this
.
fAlpha
,
this
.
fBeta
);
...
...
@@ -855,6 +854,18 @@
return
res
;
};
function
BETADISTFUNCTION
(
fp
,
fAlpha
,
fBeta
){
this
.
fp
=
fp
;
this
.
fAlpha
=
fAlpha
;
this
.
fBeta
=
fBeta
;
}
BETADISTFUNCTION
.
prototype
.
GetValue
=
function
(
x
){
var
res
;
var
betaDistVal
=
getBetaDist
(
x
,
this
.
fAlpha
,
this
.
fBeta
);
res
=
this
.
fp
-
betaDistVal
;
return
res
;
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
@@ -1248,12 +1259,61 @@
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cBETAINV
()
{
/*Нет реализации в Google Docs*/
cBaseFunction
.
call
(
this
,
"
BETAINV
"
);
function
cBETA_INV
()
{
this
.
name
=
"
BETA.INV
"
;
this
.
value
=
null
;
this
.
argumentsCurrent
=
0
;
}
cBETAINV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cBETAINV
.
prototype
.
constructor
=
cBETAINV
;
cBETA_INV
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cBETA_INV
.
prototype
.
constructor
=
cBETA_INV
;
cBETA_INV
.
prototype
.
argumentsMin
=
3
;
cBETA_INV
.
prototype
.
argumentsMax
=
5
;
cBETA_INV
.
prototype
.
Calculate
=
function
(
arg
)
{
var
oArguments
=
this
.
_prepareArguments
(
arg
,
arguments
[
1
],
true
);
var
argClone
=
oArguments
.
args
;
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
].
tocNumber
();
argClone
[
2
]
=
argClone
[
2
].
tocNumber
();
argClone
[
3
]
=
argClone
[
3
]
?
argClone
[
3
].
tocNumber
()
:
new
cNumber
(
0
);
argClone
[
4
]
=
argClone
[
4
]
?
argClone
[
4
].
tocNumber
()
:
new
cNumber
(
1
);
var
argError
;
if
(
argError
=
this
.
_checkErrorArg
(
argClone
))
{
return
this
.
value
=
argError
;
}
var
calcGamma
=
function
(
argArray
){
var
fP
=
argArray
[
0
];
var
fAlpha
=
argArray
[
1
];
var
fBeta
=
argArray
[
2
];
var
fA
=
argArray
[
3
];
var
fB
=
argArray
[
4
];
if
(
fP
<
0
||
fP
>
1
||
fA
>=
fB
||
fAlpha
<=
0
||
fBeta
<=
0
){
return
new
cError
(
cErrorType
.
not_numeric
);
}
var
aFunc
=
new
BETADISTFUNCTION
(
fP
,
fAlpha
,
fBeta
);
var
oVal
=
iterateInverse
(
aFunc
,
0
,
1
);
var
bConvError
=
oVal
.
bError
;
if
(
bConvError
){
return
new
cError
(
cErrorType
.
not_numeric
);
//SetError(FormulaError::NoConvergence);
}
var
res
=
fA
+
oVal
.
val
*
(
fB
-
fA
)
;
return
null
!==
res
&&
!
isNaN
(
res
)
?
new
cNumber
(
res
)
:
new
cError
(
cErrorType
.
wrong_value_type
);
};
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
calcGamma
);
};
cBETA_INV
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( probability, alpha, beta, a, b )
"
}
};
/**
* @constructor
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment