SkillAgentSearch skills...

Minterpy

Multivariate polynomial interpolation in Python

Install / Use

/learn @minterpy-project/Minterpy
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

DOI status [![Code style: black][black-badge]][black-link] License PyPI

Minterpy: Multivariate Polynomial Interpolation in Python

| Branches | Status | | :-----------------------------------------------------------------------: |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | main (stable) | Build codecov Documentation Build and Deployment | | dev (latest) | Build codecov Documentation Build and Deployment |

Minterpy is an open-source Python package designed for constructing and manipulating multivariate interpolating polynomials with the goal of addressing the curse of dimensionality from interpolation tasks.

Minterpy is being continuously extended and improved, with new functionalities added to address the computational bottlenecks in accuracy, stability, and performance of multidimensional interpolation tasks.

Installation

You can install Minterpy from PyPI or from source.

From PyPI

You can obtain the stable release of Minterpy directly from PyPI using pip:

pip install minterpy

From source

To install the latest development version of Minterpy, you can clone the GitHub repository:

git clone https://github.com/minterpy-project/minterpy

Then install Minterpy from the source directory:

pip install .[all,dev,docs]

For an editable installation, use the flag -e:

pip install -e .[all,dev,docs]

The options [all,dev,docs] refer to the requirements defined in the options.extras_require section in setup.cfg.

Virtual environments

We recommend installing Minterpy in a virtual environment. Tools like [mamba], [conda], [venv], [virtualenv] or [pyenv-virtualenv] can help you set one up. See CONTRIBUTING.md for details.

NOTE: Do not use the command python setup.py install to install Minterpy, as setup.py may not be present in the future releases.

Quickstart

Using Minterpy, you can interpolate a given function. For instance, take the one-dimensional function $f(x) = x \, \sin{(x)}$ with $x \in [0, 15]$:

import numpy as np

def func(x):
    return x * np.sin(x)

To interpolate the function, you can use the function interpolate():

import minterpy as mp

interpolant = mp.interpolate(func, spatial_dimension=1, poly_degree=64, bounds=[0, 15])

interpolate() takes as arguments the function to interpolate, the number of dimensions (spatial_dimension), the degree of the underlying polynomial interpolant (poly_degree), and the bounds of the domain (bounds). You may adjust the polynomial degree parameter to get higher accuracy. The resulting interpolant is a Python callable, which can be used as an approximation of func.

In this example, an interpolating polynomial of degree $64$ produces an approximation of func to near machine precision:

import matplotlib.pyplot as plt

xx = np.linspace(0, 15, 100)

plt.plot(xx, func(xx), "k.",label="function")
plt.plot(xx, interpolant(xx), label="interpolant")
plt.legend()
plt.show()
<img src="./docs/assets/images/xsinx.png" alt="Compare test function with its interpolating polynomial" width="400"/>

Minterpy's capabilities extend beyond function approximation; by accessing the underlying interpolating polynomials, you can carry out common numerical operations on the approximations like multiplication and differentiation:

# Extract the underlying Newton interpolating polynomial
nwt_poly = interpolant.to_newton()
# Multiply the polynomial -> results in another polynomial
prod_poly = nwt_poly * nwt_poly
# Differentiate the polynomial once -> results in another polynomial
diff_poly = nwt_poly.diff(1)
# Analytical derivative of the function
diff_func = lambda xx: np.sin(xx) + xx * np.cos(xx)

fig, axs = plt.subplots(1, 2, figsize=(10, 5))

axs[0].plot(xx, func(xx)**2, "k.", label="product function")
axs[0].plot(xx, prod_poly(xx), label="product polynomial")
axs[0].legend()
axs[0].set_xlabel("$x$")
axs[0].set_ylabel("$y$")

axs[1].plot(xx, diff_func(xx), "k.", label="differentiated function")
axs[1].plot(xx, diff_poly(xx), label="differentiated polynomial")
axs[1].legend()
axs[1].set_xlabel("$x$")

plt.show()
<img src="./docs/assets/images/xsinx-prod-diff.png" alt="Product and differentiated polynomial" width="700"/>

The Getting Started Guides provide more examples on approximating functions and performing operations on interpolating polynomials, including multidimensional cases.

Getting help

For detailed guidance, please refer to the online documentation (stable or latest). It includes detailed installation instructions, usage examples, API references, and contributors guide.

For any other questions related to the package, feel free to post your questions on the GitHub repository Issue page.

Contributing to Minterpy

Contributions to Minterpy are welcome!

We recommend you have a look at the CONTRIBUTING.md first. For a more comprehensive guide visit the Contributors Guide of the documentation.

Citing Minterpy

If you use Minterpy in your research or projects, please cite our paper published in the Journal of Open Source Software:

@article{Wicaksono2025,
  author    = {Wicaksono, Damar and Acosta, Uwe Hernandez and Veettil, Sachin Krishnan Thekke and Kissinger, Jannik and Hecht, Michael},
  title     = {{Minterpy}: multivariate polynomial interpolation in {Python}},
  journal   = {Journal of Open Source Software},
  year      = {2025},
  volume    = {10},
  number    = {109},
  pages     = {7702},
  doi       = {10.21105/joss.07702},
  url       = {https://doi.org/10.21105/joss.07702}
}

For reproducibility, please also cite the specific version of Minterpy that you used. The current archived version is available on RODARE:

@software{Minterpy_0_3_1,
  author       = {Hernandez Acosta, Uwe and Thekke Veettil, Sachin Krishnan and Wicaksono, Damar Canggih and Michelfeit, Jannik and Hecht, Michael},
  title        = {{Minterpy} - multivariate polynomial interpolation},
  month        = apr,
  year         = 2025,
  publisher    = {RODARE},
  version      = {v0.3.1},
  doi          = {10.14278/rodare.3725},
  url          = {https://doi.org/10.14278/rodare.3725}
}

Credits and contributors

This work was partly funded by the Center for Advanced Systems Understanding ([CASUS]), an institute of the Helmholtz-Zentrum Dresden-Rossendorf ([HZDR]), financed by Germany’s Federal Ministry of Education and Research ([BMBF]) and by the Saxony Ministry for Science, Culture, and Tourism ([SMWK]) with tax funds on the basis of the budget approved by the Saxony State Parliament.

The Minterpy development

View on GitHub
GitHub Stars12
CategoryDevelopment
Updated14d ago
Forks0

Languages

Python

Security Score

90/100

Audited on Mar 13, 2026

No findings