# distribution-algebra
A python package that implements an easy-to-use interface for random
variables, statistical distributions, and their algebra.
This Python package is brought to you by [Vaibhav Karve](https://vaibhavkarve.github.io).
`distribution-algebra` recognizes Normal, Lognormal, Beta and Poisson
distributions. The package implements an interface to easily construct
user-defined Univariate distributions as well Vectorized distributions.
Additional features include:
- A `plot` function for probability density/mass function plotting.
- A `draw` function for drawing random samples of specified size from a given distribution.
- Addition and multiplication operations defined directly on distributions:
- For example, the sum of two Normal (Poisson) distributions is Normal (Poisson).
- The product of two Lognormal distributions is Lognormal.
- The sum of two arbitrary univariate distributions is expressed as a Vectorized distribution.
![Example plot](https://github.com/vaibhavkarve/distribution-algebra/raw/main/docs/example_plot_univariate.png)
This package is written in Python v3.10, and is publicly available
under the [GNU-GPL-v3.0
license](https://github.com/vaibhavkarve/normal-form/blob/main/LICENSE).
# Installation and usage
To get started on using this package,
1. Install Python 3.10 or higher.
2. `python3.10 -m pip install distribution-algebra`
3. Use it in a python script (or interactive REPL)
```python
from distribution_algebra import Beta, Lognormal, Normal, Poisson
x: Normal = Normal(mean=1.0, var=9.0)
y: Normal = Normal(mean=1.0, var=16.0)
assert x + y == Normal(mean=2.0, var=25.0)
```
Raw data
{
"_id": null,
"home_page": "https://vaibhavkarve.github.io/distribution-algebra/",
"name": "distribution-algebra",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.12,>=3.9",
"maintainer_email": null,
"keywords": "statistics, typed, python3, distribution, random, algebra",
"author": "Vaibhav Karve",
"author_email": "vkarve@protonmail.com",
"download_url": "https://files.pythonhosted.org/packages/6b/1f/d244612128bb26eb8c01d6c9626df828ed0d3de8414724ffb0d1fdcef863/distribution_algebra-0.1.26.tar.gz",
"platform": null,
"description": "# distribution-algebra\nA python package that implements an easy-to-use interface for random\nvariables, statistical distributions, and their algebra.\n\nThis Python package is brought to you by [Vaibhav Karve](https://vaibhavkarve.github.io).\n\n`distribution-algebra` recognizes Normal, Lognormal, Beta and Poisson\ndistributions. The package implements an interface to easily construct\nuser-defined Univariate distributions as well Vectorized distributions.\n\nAdditional features include:\n- A `plot` function for probability density/mass function plotting.\n- A `draw` function for drawing random samples of specified size from a given distribution.\n- Addition and multiplication operations defined directly on distributions:\n - For example, the sum of two Normal (Poisson) distributions is Normal (Poisson).\n - The product of two Lognormal distributions is Lognormal.\n - The sum of two arbitrary univariate distributions is expressed as a Vectorized distribution.\n\n\n![Example plot](https://github.com/vaibhavkarve/distribution-algebra/raw/main/docs/example_plot_univariate.png)\n\n\nThis package is written in Python v3.10, and is publicly available\nunder the [GNU-GPL-v3.0\nlicense](https://github.com/vaibhavkarve/normal-form/blob/main/LICENSE).\n\n\n# Installation and usage\n\nTo get started on using this package,\n\n1. Install Python 3.10 or higher.\n2. `python3.10 -m pip install distribution-algebra`\n3. Use it in a python script (or interactive REPL)\n\n ```python\n from distribution_algebra import Beta, Lognormal, Normal, Poisson\n\n x: Normal = Normal(mean=1.0, var=9.0)\n\ty: Normal = Normal(mean=1.0, var=16.0)\n\n\tassert x + y == Normal(mean=2.0, var=25.0)\n ```\n",
"bugtrack_url": null,
"license": "GPL-3.0-or-later",
"summary": "A python package that implements an easy-to-use interface for random variables, statistical distributions, and their algebra.",
"version": "0.1.26",
"project_urls": {
"Documentation": "https://vaibhavkarve.github.io/distribution-algebra/",
"Homepage": "https://vaibhavkarve.github.io/distribution-algebra/",
"Repository": "https://github.com/vaibhavkarve/distribution-algebra"
},
"split_keywords": [
"statistics",
" typed",
" python3",
" distribution",
" random",
" algebra"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e1e5f971066ef293f7ea8d3842762d602e15f3b69a482975c5b6e2980eab99cc",
"md5": "9f8783818c8adecb6318c994e648289f",
"sha256": "26d7a34742fc3b8323131de23a27349a0d57287bf026735b3ebf6c0fa595e958"
},
"downloads": -1,
"filename": "distribution_algebra-0.1.26-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9f8783818c8adecb6318c994e648289f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.12,>=3.9",
"size": 32701,
"upload_time": "2024-07-06T21:35:46",
"upload_time_iso_8601": "2024-07-06T21:35:46.750643Z",
"url": "https://files.pythonhosted.org/packages/e1/e5/f971066ef293f7ea8d3842762d602e15f3b69a482975c5b6e2980eab99cc/distribution_algebra-0.1.26-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6b1fd244612128bb26eb8c01d6c9626df828ed0d3de8414724ffb0d1fdcef863",
"md5": "1747b352efae8dfaa1c477c8e64a514d",
"sha256": "6da9a9d2a345f3ce02715e8d40523ebe4ed79a489485e14c4d2662cc7cc540bc"
},
"downloads": -1,
"filename": "distribution_algebra-0.1.26.tar.gz",
"has_sig": false,
"md5_digest": "1747b352efae8dfaa1c477c8e64a514d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.12,>=3.9",
"size": 27621,
"upload_time": "2024-07-06T21:35:48",
"upload_time_iso_8601": "2024-07-06T21:35:48.575439Z",
"url": "https://files.pythonhosted.org/packages/6b/1f/d244612128bb26eb8c01d6c9626df828ed0d3de8414724ffb0d1fdcef863/distribution_algebra-0.1.26.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-06 21:35:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vaibhavkarve",
"github_project": "distribution-algebra",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "distribution-algebra"
}