Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Binomial Distribution Calculator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Shawn McAdam (ssm259)
Binomial Distribution Calculator
Commits
3575a541
Commit
3575a541
authored
4 years ago
by
Shawn Samuel Carl McAdam
Browse files
Options
Downloads
Patches
Plain Diff
Added better comments
parent
72538ba6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin_dfs.c
+2
-2
2 additions, 2 deletions
bin_dfs.c
bin_dfs.h
+4
-3
4 additions, 3 deletions
bin_dfs.h
with
6 additions
and
5 deletions
bin_dfs.c
+
2
−
2
View file @
3575a541
#include
<inttypes.h>
// uint64_t
#include
<stdio.h>
#include
<stdlib.h>
#include
"bin_dfs.h"
// private helper functions
...
...
@@ -25,6 +23,8 @@ long double cdf(uint64_t k, uint64_t n, long double p){
}
// Can't do tail recursion here because the intermediate products can get
// far larger than LDBL_MAX
long
double
pmf_helper
(
uint64_t
k
,
uint64_t
n
,
long
double
p
){
// work through our k's then work through our n's.
if
(
n
==
0
)
...
...
This diff is collapsed.
Click to expand it.
bin_dfs.h
+
4
−
3
View file @
3575a541
...
...
@@ -19,11 +19,12 @@ long double pmf(uint64_t k, uint64_t n, long double p);
* Purpose:
* Recusively sum up the probabilities for each i<=n
* Assumptions:
*
i
<=n
*
k
<=
n
* Returns:
* P(X<=i) where X~bin(n, p)
* P(X<=k) where X~bin(n, p)
* ie, \sum_{j=0}^k pmf(j, n, p)
*/
long
double
cdf
(
uint64_t
i
,
uint64_t
n
,
long
double
p
);
long
double
cdf
(
uint64_t
k
,
uint64_t
n
,
long
double
p
);
#endif // DIST_FUNCT_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment