Skip to main content

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:

∫Σ f(x, y) dΣ

Parameters

function : Union[Callable, float]

A scalar or a Python function with two arguments: the first one is x and the second one is y in R2 space.

polygon: list[tuple]

A polygon defined by a list of its vertices. Each vertex is described by a tuple containing its coordinated in the form (x, y). The vertices in the list must be in clockwise or counter-clockwise order (it makes no difference)

Returns

r : float

The definite integral of 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)

∫Σ (x2 + y) dΣ
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

Metadata

Release files for pyntegrals 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyntegrals 1.0.0
File Size Uploaded Provenance Actions
pyntegrals-1.0.0.tar.gz 39.4 kB Without provenance Details for pyntegrals-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyntegrals 1.0.0
File Interpreter ABI Platform Actions
pyntegrals-1.0.0-py3-none-any.whl Python 3 none any Details for pyntegrals-1.0.0-py3-none-any.whl

Total release size: 67.7 kB

Release files / pyntegrals-1.0.0.tar.gz

Download URL pyntegrals-1.0.0.tar.gz
Size 39.4 kB
Tags Source
SHA-256 checksum
How to use checksums
eceeac2f715c8aeaa805a167a2f2c3884e5f86737cfe61e3f66acd561e6d22b3
BLAKE2b-256 checksum
How to use checksums
2e1104a260ec96313121b176e33bef64109f7d26cc4021e91c6ccb8f2ba979d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.9

Release files / pyntegrals-1.0.0-py3-none-any.whl

Download URL pyntegrals-1.0.0-py3-none-any.whl
Size 28.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48ae01166059ee369102e044761b49809247b89ab61524c2f49f00a20295f06e
BLAKE2b-256 checksum
How to use checksums
18ac35cbe628da453352a5bc54adb9741bb4807cda78f586e5d0c14541a5d5f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.9

Security for pyntegrals 1.0.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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page