Metadata-Version: 2.3
Name: truncated_triangle_distribution_mean
Version: 0.1.2
Summary: A small package that calculates the mean of a truncated triangular distribution analytically.
Project-URL: repository, https://github.com/JohnScolaro/truncated_triangle_distribution_mean
Author-email: John Scolaro <johnscolaro95@gmail.com>
License: Copyright (c) 2024 John Scolaro
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: distribution,triangular,truncated
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.10
Provides-Extra: dev
Requires-Dist: mypy==1.11.2; extra == 'dev'
Requires-Dist: pre-commit==3.8.0; extra == 'dev'
Requires-Dist: pytest==8.3.2; extra == 'dev'
Requires-Dist: ruff==0.6.2; extra == 'dev'
Requires-Dist: scipy==1.14.1; extra == 'dev'
Description-Content-Type: text/markdown

# 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](https://mantimantilla.github.io/Truncated-Triangular-Simulation-R/) 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`.