A tool for calculating definite integrals over a 2D polygonal domain
Project description
Pyntegrals
Pyntegrals is a simple library for computing a definite integral over a 2D polygonal domain.
At the moment the only function of the library is integrate_over_polygon, which perform the calculation.
It is possible that in the future other functions will be added.
pyntegrals.integrals
pyntegrals.integrals.integrate_over_polygon
pyntegrals.integrals.integrate_over_polygon(function: Union[Callable, float], polygon: list[tuple]) -> float
Computes the integral of a two-variables function over a polygonal domain in R2.
Returns the definite integral of function(x, y) = f(x, y) over
polygon = Σ, that is:
Parameters
function : Union[Callable, float]
polygon: list[tuple]
Returns
r : float
function(x, y) over polygon.
Example
Compute the integral of x2 + y over a 50 x 40 rectangle Σ with a vertex in (0, 0) and another in (50, 40)
from pyntegrals.integrals import integrate_over_polygon
polygon = [(0, 0), (50, 0), (50, 40), (0, 40)]
rho = lambda x, y: x**2 + y
mass = integrate_over_polygon(function=rho, polygon=polygon)
>>> 1706666.666666667
For more example see examples/example.py
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyntegrals-1.0.0.tar.gz.
File metadata
- Download URL: pyntegrals-1.0.0.tar.gz
- Upload date:
- Size: 39.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eceeac2f715c8aeaa805a167a2f2c3884e5f86737cfe61e3f66acd561e6d22b3
|
|
| MD5 |
142f166112e8f6ff4f39368ea0b43a23
|
|
| BLAKE2b-256 |
2e1104a260ec96313121b176e33bef64109f7d26cc4021e91c6ccb8f2ba979d1
|
File details
Details for the file pyntegrals-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pyntegrals-1.0.0-py3-none-any.whl
- Upload date:
- Size: 28.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48ae01166059ee369102e044761b49809247b89ab61524c2f49f00a20295f06e
|
|
| MD5 |
a26f8f07ff99abf4e1943fecc8153f77
|
|
| BLAKE2b-256 |
18ac35cbe628da453352a5bc54adb9741bb4807cda78f586e5d0c14541a5d5f4
|