Low-level functions for evaluating and manipulating polynomials (Python bindings)
Project description
Low-level functions for evaluating and manipulating polynomials.
Examples
The vector of coefficients for the polynomial f(x, y) = 3 x y + x^2
is
[0, 3, 0, 1, 0, 0]
.
With eval()
we can evaluate this polynomial:
import nutils_poly
import numpy
coeffs = numpy.array([0, 3, 0, 1, 0, 0], dtype=float)
# array of three `x` and `y` pairs (last axis)
values = numpy.array([[1, 0], [1, 1], [2, 3]], dtype=float)
numpy.testing.assert_allclose(nutils_poly.eval(coeffs, values), [1, 4, 22])
PartialDerivPlan::apply()
computes the coefficients for the partial
derivative of a polynomial to one of the variables. The partial derivative
of f
to x
, the first variable, is ∂_x f(x, y) = 3 y + 2 x
(coefficients: [3, 2, 0]
):
import nutils_poly
import numpy
coeffs = numpy.array([0, 3, 0, 1, 0, 0], dtype=float)
pd = nutils_poly.PartialDerivPlan(
2, # number of variables
2, # degree
0, # variable to compute the partial derivative to
)
numpy.testing.assert_allclose(pd(coeffs), [3, 2, 0])
Further reading
This package is a Python interface for the Rust crate
nutils-poly
using PyO3.
This package is part of the Nutils project.
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
nutils_poly-1.0.1.tar.gz
(15.7 kB
view hashes)
Built Distributions
nutils_poly-1.0.1-cp38-abi3-win32.whl
(202.5 kB
view hashes)
Close
Hashes for nutils_poly-1.0.1-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5118f1df97856c1e462f0c3ab4f1e960447b88900ed2975918c7e67996f448a |
|
MD5 | 0cbd59cf551fd13f832c3ac09d4cb095 |
|
BLAKE2b-256 | 0554e01764cc588650387061e75f413ef156b2da2574bcc3e75b2cbec0c5cf33 |
Close
Hashes for nutils_poly-1.0.1-cp38-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b688de6b21d23d013061c3c20b638ef42a27467dcc9d211f9834b5e0a3d60d37 |
|
MD5 | 5b77b0b0b4831b4986fa21928fc9e518 |
|
BLAKE2b-256 | 0ef9f299233ca0685f13868ad0da1a642596119ca391def460bd344aa6028804 |
Close
Hashes for nutils_poly-1.0.1-cp38-abi3-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9f43689335b2ef12048b0964725b31426e3f460532ad5df87e798567e0f99b2 |
|
MD5 | 12501873160630e2cbf6db5b7119de94 |
|
BLAKE2b-256 | 932a733600c5fb2d2cf4695223096158690a8af8d4bfaa971f6e0271e73af841 |
Close
Hashes for nutils_poly-1.0.1-cp38-abi3-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8eef88742e8052a56b55811aa79c4858fcb2c001ea89c51d9c7db7d5b4427f2 |
|
MD5 | 2ee8207ae837a740892b891fdcf19df8 |
|
BLAKE2b-256 | 0d7946cb5d6c1b6b576241ab0192a760ca78eefa1aa9705829c241bb4889c1f7 |
Close
Hashes for nutils_poly-1.0.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6630fc5d4373eaf888e9e09697545e4e4f182a728f27657cc5882956b06b5317 |
|
MD5 | e26489fb73be3e7d2cc7d4f6209423f2 |
|
BLAKE2b-256 | dec6a9d27c6f8b7ea7c675cdb049e2b9f96844a1d091bfb355b011ca65679846 |
Close
Hashes for nutils_poly-1.0.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 538c841d9ac53ee48bc32376fa905feac1742907b5c91303d29ff300081f6a32 |
|
MD5 | 486a5b86aaed68ccfe5870be809e589d |
|
BLAKE2b-256 | bb5f0439024d34727a5e1d48d66879c0f6d41679bd8c39111a7dd4fb59df7baa |
Close
Hashes for nutils_poly-1.0.1-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | efe99a301e4eb637c36ad4be76c686080c24fce57eeaf9d3789ff92d14cb6550 |
|
MD5 | e3fcf80946aba4809c7347ebcdc49eb1 |
|
BLAKE2b-256 | 74ecc2a4e6cb7b90bea678f9b33be6aaad72f610f894a60d0790b78d3e1eed33 |