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.0.tar.gz
.
File metadata
- Download URL: truncated_triangle_distribution_mean-0.1.0.tar.gz
- Upload date:
- Size: 5.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 | 7aec6023fb7332b471369e5a8f9ab18bb795e3731c3b4c5e933a91d0e830cb0a |
|
MD5 | 5468f375d154538d94a7fdb9257678db |
|
BLAKE2b-256 | 03e47056c402e12f29a7d5628155e84f726d8411cd72be852ee7e9156cbb8d01 |
File details
Details for the file truncated_triangle_distribution_mean-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: truncated_triangle_distribution_mean-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 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 | 5f9c30bc0c7f4b70ffeef0765110b15034bdd8db9f6d66a80619c58b9c60dafe |
|
MD5 | fd6b94e9a6fc948f60f92566746bdc1b |
|
BLAKE2b-256 | 4f0527126a3206faa84f693496f755466bbda12fb9af6b4f377c7f7910c2a811 |