Skip to main content

pypoly: Python Polynomials

A Python extension written in C, implementing the Polynomial type.

Installation

Installation from source:

$ python setup.py install

Or, using pip:

$ pip install PyPolynomial

Usage

Instanciating a polynomial:

>>> from pypoly import Polynomial
>>> P = Polynomial(-1, 0, complex(1, 3))
>>> P
-1 + (1+3j) * X**2
>>> P.degree
2

Or:

>>> from pypoly import X
>>> P = (X - 1) * (X**2 + 2)
>>> P
-2 + 2 * X - X**2 + X**3

Operations on polynomials:

>>> Polynomial(-1, -1) * Polynomial(2, -3)
-2 + X + 3 * X**2
>>> P = Polynomial(1, 2, 3)
>>> P(13)
534.0
>>> (1 + X + X**2) // (1 + X)
X
>>> (2 * X + 3 * X**2 + X**5 + X**7) % (X**2 + 1)
-3 + 2 * X

Even more:

>>> (1 + X**3 - 2 * X**5) >> 2      # Second derivative
6 * X - 40 * X**3
>>> (1 + 2 * X) << 1                # Primitive integral
X + X**2
>>> from pypoly import gcd
>>> gcd(X**6 - 1, X**12 - 1, X**9 - 1)
-1 + X**3

Metadata

Release files for PyPolynomial 0.4.1

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

Source distribution (sdist)

Source distribution for PyPolynomial 0.4.1
File Size Uploaded Provenance
PyPolynomial-0.4.1.tar.gz 14.3 kB Without provenance Details

Release files / PyPolynomial-0.4.1.tar.gz

Download URL PyPolynomial-0.4.1.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
24f32eab165003a798d83434b45fd2240223d633a90c8396e514c0588a66c5c7
BLAKE2b-256 checksum
How to use checksums
8cbeef61da0d4fa19cb3beb1d1b2533af73c05626ff803b24345480585eb3267
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for PyPolynomial 0.4.1

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.

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