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.0.tar.gz
(15.7 kB
view hashes)
Built Distributions
nutils_poly-1.0.0-cp37-abi3-win32.whl
(204.7 kB
view hashes)
Close
Hashes for nutils_poly-1.0.0-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 320caa297cebee7f85abc1a3e22362c027ef862c45be916ff170be3c9fcad58c |
|
MD5 | 938e7131e2a8be4171d5c7dd8f795da7 |
|
BLAKE2b-256 | ae86722eb79c84029fa563c260bbebaf832de1227f302a405d2356e2d31bb8fd |
Close
Hashes for nutils_poly-1.0.0-cp37-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 506a3ade5691f6081840d75ed00f1cf711a9cf4e43a22e8c760693738677c3f4 |
|
MD5 | 6d4dfeab7c14b19802c09150382ff53c |
|
BLAKE2b-256 | ac1f8c4910942aed4b9ea65b153ade6054d07cbc9cb052e89b8a17059d371f85 |
Close
Hashes for nutils_poly-1.0.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fb8fe532a9e9993d2f656142cffddbe0cf048946b7ac138e9541295ba37009c |
|
MD5 | ec8dcb617597f3e2b7edac638adde5d4 |
|
BLAKE2b-256 | 0ec84264b665d9ce6de7cfc966822be47bf25d892dfdc9c2502faf7f3ce0226a |
Close
Hashes for nutils_poly-1.0.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09160b5dc32851b7ac6f060486f99d333e12605ff5e7534a3acef6141db79e85 |
|
MD5 | 7ab28e0e92f330cee5ec91c569379844 |
|
BLAKE2b-256 | 0b8941ae84377262ae5c89c074eae259ece75e2528d6638543c987fba562a672 |
Close
Hashes for nutils_poly-1.0.0-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f75bd7fc4df83842ec89045b3f2a8a3ccd72aaf404217e4b9d73d69510e7a66b |
|
MD5 | f9d7abb02254f20caf4daf99e08fc654 |
|
BLAKE2b-256 | e7749bf8b236a3bcb136f28a73ee741e0d5266b4316df3f899b0d82e10eb9fb2 |
Close
Hashes for nutils_poly-1.0.0-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 248f2696cf94f4eb14f71da97aa8d4235a40fd6a94e9401ce94532d5b24f34a9 |
|
MD5 | 5dc97fcea17e0300b8282cb274d17558 |
|
BLAKE2b-256 | 5f59c3f5a453bc0b54166d1e824174545a3fc19d176dc7f22a1cb7e8e58f4cb6 |