A small package that calculates the mean of a truncated triangular distribution analytically.
Project description
Introduction
Do you have a truncated triangle distribution and want to find the average value? This package calculates it for you.
Usage
After installing truncated_triangle_distribution_mean with something like:
pip install truncated_triangle_distribution_mean
You can get the mean of the distribution like so:
from truncated_triangle_distribution_mean import TruncatedTriangleDistribution
lower = 1
middle = 2
upper = 3
lower_truncation = 1.1
upper_truncation = 2.8
truncated_triangle_distribution = TruncatedTriangleDistribution(
lower, middle, upper, lower_truncation, upper_truncation
)
print(f"The mean is: {truncated_triangle_distribution.mean}.")
Credit
I'd like to credit the author of this website here for laying out the maths that this package is based on. I'd also like to let them know that they have integrated between the incorrect bounds for their third equation in the "mean" section, and I had to figure that out myself.
Contributions
If you have any problems, raise an issue on Github or send me an email. If you want to contribute, just submit a pull request. To set the repo up for development, clone it down and run:
pip install -e.[dev]
and install the pre-commit with pre-commit install
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file truncated_triangle_distribution_mean-0.1.1.tar.gz
.
File metadata
- Download URL: truncated_triangle_distribution_mean-0.1.1.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f6e4f58b631b806c03b4be5df833fbc7b49ae93510d9f6ca6edc80b8aedb9b3 |
|
MD5 | 71d9e890e3e43104fab7a80d1fa4f656 |
|
BLAKE2b-256 | faa40e62e1297db8386caabe4447dac6bdcd64b5455a743556d2f4547b355b17 |
File details
Details for the file truncated_triangle_distribution_mean-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: truncated_triangle_distribution_mean-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 017c2e131262207884fb2d800c44745e07a6602374e9d9618a09197ab108f17f |
|
MD5 | ef76182a43c17194f7554dd7a5b2af9f |
|
BLAKE2b-256 | 51e5ad4f52c986ed8e24ced975bbf909dd00becf671c508c9c102b811a51839b |