# 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": "",
"docs_url": null,
"requires_python": ">=3.10,<3.12",
"maintainer_email": "",
"keywords": "statistics,typed,python3,distribution,random,algebra",
"author": "Vaibhav Karve",
"author_email": "vkarve@protonmail.com",
"download_url": "https://files.pythonhosted.org/packages/72/ad/d655c1b601e889f2674635c126596c3c08c081bc56a9943032bf4251633f/distribution_algebra-0.1.20.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.20",
"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": "1ac63e95d0e787eb229c6dd5913e1942730911851563184926f893ffb28401f0",
"md5": "f83cf2b718b072e931935e88fb98e67b",
"sha256": "3e716be623d3c7ded21c504e39980a5e8bf9dbf2fe70ca6d4de9a5b64d8398ec"
},
"downloads": -1,
"filename": "distribution_algebra-0.1.20-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f83cf2b718b072e931935e88fb98e67b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<3.12",
"size": 32380,
"upload_time": "2023-06-05T20:27:14",
"upload_time_iso_8601": "2023-06-05T20:27:14.849053Z",
"url": "https://files.pythonhosted.org/packages/1a/c6/3e95d0e787eb229c6dd5913e1942730911851563184926f893ffb28401f0/distribution_algebra-0.1.20-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "72add655c1b601e889f2674635c126596c3c08c081bc56a9943032bf4251633f",
"md5": "ce904ad01351f07607af984de0bcbc45",
"sha256": "d6ae06044fb94a4b5abc48ca5ad5ec2643435cd45ba666f5d102a3f6a7cb21e4"
},
"downloads": -1,
"filename": "distribution_algebra-0.1.20.tar.gz",
"has_sig": false,
"md5_digest": "ce904ad01351f07607af984de0bcbc45",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<3.12",
"size": 27342,
"upload_time": "2023-06-05T20:27:16",
"upload_time_iso_8601": "2023-06-05T20:27:16.305096Z",
"url": "https://files.pythonhosted.org/packages/72/ad/d655c1b601e889f2674635c126596c3c08c081bc56a9943032bf4251633f/distribution_algebra-0.1.20.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-05 20:27:16",
"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"
}