-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add normal distribution and area under curve to statistics package.
- Loading branch information
1 parent
d24a19c
commit 0076751
Showing
4 changed files
with
74 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,35 @@ | ||
generic | ||
type F is digits <>; | ||
package BBS.Numerical.statistics is | ||
type data_array is array (Integer range <>) of F; | ||
type data_array is array (Integer range <>) of F'Base; | ||
-- ----------------------------------------------------------------- | ||
-- Statistics of a sample of data | ||
-- | ||
-- Compute the mean of an array of data | ||
-- | ||
function mean(d : data_array) return F; | ||
function mean(d : data_array) return F'Base; | ||
-- | ||
-- Compute the median of an array of data | ||
-- | ||
procedure limits(d : data_array; min : out F; max : out F); | ||
procedure limits(d : data_array; min : out F'Base; max : out F'Base); | ||
-- | ||
-- Compute the variance (and mean) of an array of data. Use this, | ||
-- instead of mean() if you need both values. | ||
-- | ||
procedure variance(d : data_array; var : out F; mean : out F); | ||
procedure variance(d : data_array; var : out F'Base; mean : out F'Base); | ||
-- ----------------------------------------------------------------- | ||
-- Distributions | ||
-- | ||
-- Standard Normal distribution | ||
-- | ||
function normal(p : F'Base) return F'Base; | ||
-- | ||
-- Normal distribution with mean and sigma | ||
-- | ||
function normal(p, mean, sigma : F'Base) return F'Base; | ||
-- | ||
-- Compute the area under a Normal curve from a to b using the | ||
-- specified number of steps of Simpson's integration. | ||
-- | ||
function normal_area(a, b : F'Base; steps : Positive) return F'Base; | ||
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters