A package for computing Riemann summations in n-dimensional space
Project description
riemann
Riemann, a pure-Python package for computing Riemann sums of functions of several real variables.
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, 1]$ using 10 partitions along the $x$ axis.
>>> import riemann
>>> from riemann import Interval
>>> f = lambda x: x ** 2
>>> intervals = [Interval(0, 1, 10)]
>>> methods = [riemann.LEFT]
>>> riemann.rsum(f, intervals, methods)
Decimal('0.285')
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, 1], y \in [0, 1]$ using 10 partitions along the $x$ axis and 10 partitions along the $y$ axis.
>>> import riemann
>>> from riemann import Interval
>>> f = lambda x, y: x ** 2 + y ** 2
>>> intervals = [Interval(0, 1, 10), Interval(0, 1, 10)]
>>> methods = [riemann.LEFT, riemann.LEFT]
>>> riemann.rsum(f, intervals, methods)
Decimal('0.57')
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.
Requirements
Riemann requires Python 3.5+. This project does not require any additional dependencies.
Installation
$ pip install riemann
Documentation
The documentation for this project is available on Read the Docs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for riemann-1.0.0a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8991a5857a8494e8fcab653449fccb4de857cf00cd3325dba8eddc171bb4f5b |
|
MD5 | a0853dbf08905475a30f75980fe0e85c |
|
BLAKE2b-256 | c3a65932cee7c0fe2e8fa544651351a83f2588d85aec289d8ba5a2b0a77de67e |