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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file truncated_triangle_distribution_mean-0.1.2.tar.gz.
File metadata
- Download URL: truncated_triangle_distribution_mean-0.1.2.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cca68009cfd3bef08224f83c4898f020998deff2cbafd06ef881452ade66238
|
|
| MD5 |
2fe6ef4d7af830017f164bc5210cd16f
|
|
| BLAKE2b-256 |
d3c69ce80643082e60b9ded89fd4bd799c38fffce665f6affc119b2f27a5a672
|
File details
Details for the file truncated_triangle_distribution_mean-0.1.2-py3-none-any.whl.
File metadata
- Download URL: truncated_triangle_distribution_mean-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.8 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 |
a3bc6d733863599726df4d7cdcb1afabc15133208efd79610f4fc9bfc10ab8cd
|
|
| MD5 |
948d83404eaa74b72c4eb2a8e7e2112e
|
|
| BLAKE2b-256 |
9cb000bed036a3255ba7955d855f4c24df66afdacd2354fc7093a285d8de467a
|