Implements the standard math syntax for expectation values of random variables on finite sets
## How?
This is best explained with an example:
```
# import the objects
from random_variable import RandomVariable, E
# define a universe for example the possible outcomes of a dice
dice = [1, 2, 3, 4, 5, 6]
# define one random variable
X = RandomVariable(dice)
# compute and print expectation values
print('mean:', E[X])
print('one minus mean:', E[1-X])
print('twice the mean:', E[X*2])
print('variance:', E[(X-E[X])**2])
print('variance again:', E[X**2]-E[X]**2)
print('standard deviation:', (E[X**2]-E[X]**2)**0.5)
print('skewness:', E[(X-E[X])**3]/E[(X-E[X])**2]**1.5)
print('kurtosis:', E[(X-E[X])**4]/E[(X-E[X])**2]**2)
print('some other complex expectation value:', E[sin(2*X)*cos(X+1)])
```
(works in both python 2 and python 3)
## License
BSD v3 - Created by Prof. Massimo Di Pierro (DePaul Universty) 2018
Metadata
Release files for random-variable 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| random_variable-0.2.tar.gz | 2.0 kB | Without provenance | Details for random_variable-0.2.tar.gz |
Release files / random_variable-0.2.tar.gz
| Download URL | random_variable-0.2.tar.gz |
|---|---|
| Size | 2.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e1fcbf6f0a93d3caa6513c398e344f31a242c74dec91e528e1e525dc1b73c20c
|
|
BLAKE2b-256 checksum How to use checksums |
23d0f12a19d410438753f30f58ea22ad5ce8315322eb6ee18d146167b18e3acf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for random-variable 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.