Skip to main content

multipoly

A multivariate polynomial module.

This package provides a single class, MultiPoly, to handle multivariate polynomials of form

$$ p(\vec{x}) = \sum_{0\leq n\leq\deg(p)}a_n(\vec{x}-\vec{c})^n = \sum_{n_0=0}^{\deg_0(p)}\cdots\sum_{n_{\dim(p)-1}=0}^{\deg_{\dim(p)-1}(p)}a_{n_0\cdots n_{\dim(p)-1}}(x_0-c_0)^{n_0}\cdots(x_{\dim(p)-1}-c_{\dim(p)-1})^{n_{\dim(p)-1}} $$

where $n$ and $\deg(p)$ are multi-indices. This differs from the usual upper sum limit $|n|\leq\deg(p)$ where $n$ is a multi-index and $\deg(p)$ a natural number, because this way the degree in every variable can be controlled individually.

Installation

pip install multipoly

Usage

A polynomial can be initialized in two ways:

  • With the constructor Multipoly(a, c=None), that takes the coefficients and optional offsets. The coefficients are of shape deg, that is a tuple with the degree for every variable.
  • By fitting data with Multipoly.fit(X, y, deg, c=None).

MultiPoly objects have

  • a dimension dim, the number of variables &
  • a degree deg, the degrees in its variables.

They can

  • be called on a single datapoint p(x, y, ...) or on multiple datapoints in a 2D numpy.array,
  • rounded p.round(decimals=0), to round coefficients a and offsets c &
  • be converted to strings with toString(symbols=None), where the symbols for its variables can be specified (__str__ defaults to x0, x1, ...).

License (MIT)

Copyright (c) 2023 Sebastian Gössl

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Release files for multipoly 0.9.3

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

Source distribution (sdist)

Source distribution for multipoly 0.9.3
File Size Uploaded
multipoly-0.9.3.tar.gz 4.1 kB Details

Built distribution (wheel)

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

Total release size: 8.8 kB

Release files / multipoly-0.9.3.tar.gz

Download URL multipoly-0.9.3.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6c87094cccccfd19aa5b4762ce9b098d949cbefb1bab9bd61a02f0e27d99a34d
BLAKE2b-256 checksum
How to use checksums
eb60c957dbc4ccc84c7fd750fdbccbe69bb9b1d8c0926e4dcb030dd04b41f98a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / multipoly-0.9.3-py3-none-any.whl

Download URL multipoly-0.9.3-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f893638a2230bc5af2ac803dd17160803c6dd196c7dba231c8cfaa1573ca578
BLAKE2b-256 checksum
How to use checksums
19d76cfb8f712c3b8fa49196d43dafbe5cfb9dc540cba2febf6f143a4fbf77d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.9.3 This release

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9

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