riemann
Riemann is a pure-Python package for computing Riemann sums of functions in $n$-dimensional space.
Basic Usage
Riemann provides an intuitive syntax for calculating the Riemann sum of a function over a closed interval. The below code snippet computes the Riemann sum of $f(x) = x^{2}$ over the interval $[0, 2]$ using 10 partitions along the $x$ axis.
>>> import riemann
>>> from riemann import Dimension
>>> f = lambda x: x ** 2
>>> dim_x = Dimension(0, 2, 10, riemann.LOWER)
>>> dim_x
Dimension(a=0, b=2, n=10, method=Method(name='lower'))
>>> riemann.rsum(f, dim_x)
Decimal('2.28')
However, Riemann is not restricted to computing Riemann sums only over one dimension. A similar syntax can be used to calculate the Riemann sum of a function of several real variables over a closed multi-dimensional interval. The below code snippet computes the Riemann sum of $f(x, y) = x^{2} y^{2}$ over the interval $x \in [0, 2], y \in [0, 4]$ using 10 partitions along the $x$ axis and 10 partitions along the $y$ axis.
>>> import riemann
>>> from riemann import Dimension
>>> f = lambda x, y: (x ** 2) * (y ** 2)
>>> dim_x = Dimension(0, 2, 10, riemann.MIDDLE)
>>> dim_x
Dimension(a=0, b=2, n=10, method=Method(name='middle'))
>>> dim_y = Dimension(0, 4, 10, riemann.MIDDLE)
>>> dim_y
Dimension(a=0, b=4, n=10, method=Method(name='middle'))
>>> riemann.rsum(f, dim_x, dim_y)
Decimal('56.6048')
The sole requirement is that the number of parameters taken by the function passed as the func argument to riemann.rsum equals the number of riemann.Dimension objects passed.
Features
- Fast computation of Riemann sum.
- Support for computation of multi-dimensional Riemann sum.
- Built-in support for left, middle, and right Riemann sum methods.
- Support for custom Riemann sum methods (using the :py:class:
riemann.Methodclass).
Requirements
Riemann requires Python 3.7+. This project does not require any additional dependencies.
Installation
$ pip install riemann
Documentation
The documentation for this project is available on Read the Docs.
Metadata
Release files for riemann 0.9.0
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 | |
|---|---|---|---|---|
| riemann-0.9.0.tar.gz | 5.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| riemann-0.9.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.4 kB
Release files / riemann-0.9.0.tar.gz
| Download URL | riemann-0.9.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
40159879e2a180e2438a8cea743ea1a7ef1898bdae87b8de5b9fc5d213041075
|
|
BLAKE2b-256 checksum How to use checksums |
21ae9ec7c5987d371f3e5c4546473713c2639d14b2c93c2e2543dd30448cac46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Release files / riemann-0.9.0-py3-none-any.whl
| Download URL | riemann-0.9.0-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
55064b4390193cb235668fbaf14426ac5428e0ba3374b5b5c72bf0435035ef34
|
|
BLAKE2b-256 checksum How to use checksums |
a8914fd625a2e29a514f2348ea1840ba1c6ceaf76cad56a0180122f64afa1c6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Security for riemann 0.9.0
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.