Establish a Bridge between Interpolant Instances and Polynomial Instances
The Interpolant
object in Minterpy acts as the primary interface for interpolation. It is generated by invoking the high-level interpolate()
function and, at present, functions primarily as a callable that can be evaluated at arbitrary query points.
Internally, the interpolation process defaults to constructing a Newton polynomial with standard values (such as a predefined grid), which is then stored as a private attribute within the Interpolant
. When the Interpolant
is evaluated, this hidden Newton polynomial is used to compute results for the specified query points.
However, there is currently no direct public link between an Interpolant
instance and the underlying polynomial classes in Minterpy. As a result, advanced polynomial features—such as arithmetic operations and calculus—that Minterpy supports cannot be directly applied to an Interpolant
.
This separation does make sense, as the two classes serve distinct purposes: Interpolant
focuses on approximating a function using an interpolating polynomial, while a polynomial class can represent more general mathematical objects beyond function approximation.
That said, it would be useful for Interpolant
to provide easy access to the associated Minterpy polynomial, especially since the Newton polynomial is already stored as a hidden attribute.
I propose introducing methods that allow an Interpolant
instance to return a polynomial object, such as:
to_canonical()
to_newton()
to_chebyshev()
to_lagrange()
These methods would conveniently enable users to retrieve the underlying polynomial of an interpolant and manipulate it further, if needed. These methods do not need additional parameters as everything required is already stored internally.