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
6339a5f7
Commit
6339a5f7
authored
Jun 30, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify cPOISSON formula
parent
90af20c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
44 deletions
+23
-44
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+23
-44
No files found.
cell/model/FormulaObjects/statisticalFunctions.js
View file @
6339a5f7
...
...
@@ -5474,12 +5474,30 @@
cPOISSON
.
prototype
.
argumentsMax
=
3
;
cPOISSON
.
prototype
.
Calculate
=
function
(
arg
)
{
function
poisson
(
x
,
l
,
cumulativeFlag
)
{
var
_x
=
parseInt
(
x
.
getValue
()),
_l
=
l
.
getValue
(),
f
=
cumulativeFlag
.
toBool
();
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
();
var
argError
;
if
(
argError
=
this
.
_checkErrorArg
(
argClone
))
{
return
this
.
value
=
argError
;
}
function
poisson
(
argArray
)
{
var
_x
=
parseInt
(
argArray
[
0
]);
var
_l
=
argArray
[
1
];
var
f
=
argArray
[
2
];
if
(
_x
<
0
||
_l
<
0
)
{
return
new
cError
(
cErrorType
.
not_numeric
);
}
if
(
f
)
{
var
sum
=
0
;
for
(
var
k
=
0
;
k
<=
x
;
k
++
)
{
for
(
var
k
=
0
;
k
<=
_
x
;
k
++
)
{
sum
+=
Math
.
pow
(
_l
,
k
)
/
Math
.
fact
(
k
);
}
sum
*=
Math
.
exp
(
-
_l
);
...
...
@@ -5490,51 +5508,12 @@
}
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
],
arg2
=
arg
[
2
],
arg3
=
arg
[
3
];
if
(
arg0
instanceof
cArea
||
arg0
instanceof
cArea3D
)
{
arg0
=
arg0
.
cross
(
arguments
[
1
]);
}
else
if
(
arg0
instanceof
cArray
)
{
arg0
=
arg0
.
getElement
(
0
);
}
if
(
arg1
instanceof
cArea
||
arg1
instanceof
cArea3D
)
{
arg1
=
arg1
.
cross
(
arguments
[
1
]);
}
else
if
(
arg1
instanceof
cArray
)
{
arg1
=
arg1
.
getElement
(
0
);
}
if
(
arg2
instanceof
cArea
||
arg2
instanceof
cArea3D
)
{
arg2
=
arg2
.
cross
(
arguments
[
1
]);
}
else
if
(
arg2
instanceof
cArray
)
{
arg2
=
arg2
.
getElement
(
0
);
}
arg0
=
arg0
.
tocNumber
();
arg1
=
arg1
.
tocNumber
();
arg2
=
arg2
.
tocBool
();
if
(
arg0
instanceof
cError
)
{
return
this
.
value
=
arg0
;
}
if
(
arg1
instanceof
cError
)
{
return
this
.
value
=
arg1
;
}
if
(
arg2
instanceof
cError
)
{
return
this
.
value
=
arg2
;
}
if
(
arg0
.
getValue
()
<
0
||
arg1
.
getValue
()
<
0
)
{
return
this
.
value
=
new
cError
(
cErrorType
.
not_numeric
);
}
return
this
.
value
=
new
cNumber
(
poisson
(
arg0
,
arg1
,
arg2
));
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
oArguments
,
poisson
);
};
/**
* @constructor
* @extends {cP
OISSON
}
* @extends {cP
ERCENTRANK
}
*/
function
cPOISSON_DIST
()
{
cPOISSON
.
call
(
this
);
...
...
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