Skip to main content

pypolys package

Python implementation of polynomials is presented.

Installation

See doc/quickstart.txt

Usage

>>> from fractions import Fraction
>>> from pypolys.polys import Poly
>>> p = Poly(2, 3) + 4   # 2 * x ** 3 + 4
>>> p
Poly(4) + Poly(2, 3)
>>> p.is_zero()
False
>>> len(p)   # the number of terms
2
>>> p * Poly(3, 5)
Poly(12, 5) + Poly(6, 8)
>>> p ** 2
Poly(16) + Poly(16, 3) + Poly(4, 6)
>>> p.diff()
Poly(6, 2)                    # 6 * x ** 2
>>> p.integrate()
Poly(4, 1) + Poly(Fraction(1, 2), 4)   # 4 * x + x ** 4 / 2
>>> p.combine(Poly(5, 7))
Poly(4) + Poly(250, 21)
>>> p.eval(Fraction(3, 5))
Fraction(554, 125)
>>> p.eval(0.6)
4.432
>>> p.leading_term(key=Poly.key_deg)
Poly(2, 3)
>>> p.leading_monomial(key=Poly.key_deg)
Poly(1, 3)
>>> p.leading_coefficient(key=Poly.key_deg)
2
>>> Poly(6, 5) / Poly(3, 2)   # for monomials only
Poly(2, 3)
>>> Poly(6, 3).lcm(Poly(3, 2))
Poly(1, 3)
>>> list(p.iterterms())
[Poly(4), Poly(2, 3)]
>>> sorted(term.degree() for term in p.iterterms())
[0, 3]
>>> [p[i] for i in range(8)]  # coefficient list
[4, 0, 0, 2, 0, 0, 0, 0]

Contributors

Andrzej Kapanowski (project leader)

Adrian Szumski

EOF

Metadata

Release files for pypolys 0.2.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 pypolys 0.2.0
File Size Uploaded
pypolys-0.2.0.tar.gz 11.3 kB Details

Built distribution (wheel)

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

Total release size: 25.3 kB

Release files / pypolys-0.2.0.tar.gz

Download URL pypolys-0.2.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2ed9f6bb4a8d6c2c7262057b262ae29c5277a732b178785c8273db5a0d0e1b25
BLAKE2b-256 checksum
How to use checksums
b47544b30c568d10481ad06f70b0eb2aa5fe8c8f32a98c61517778ff4a729486
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.7.3

Release files / pypolys-0.2.0-py3-none-any.whl

Download URL pypolys-0.2.0-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db5e8751f378e82623be9bf6de20dbd95f2a0d089b250e6c52f925ec7922dca8
BLAKE2b-256 checksum
How to use checksums
169d2ae06071be77c46ff31e96c59a5be6af67daa6c1d8d82060328e3951db72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

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