Extend the Support for Arithmetics Manipulation of Polynomials
This is a parent issue collecting a series of issues to improve Minterpy for handling arithmetics operation involving polynomials. The list of issues below are not intended to be exhaustive and in the future may be renewed for another series of improvements. The list may be extended as the issues are tackled but there is no need to go indefinitely.
-
Polynomial-scalar multiplication (real scalar numbers) (see Issue #139 (closed); resolved via MR !112 (merged)) -
Polynomial-polynomial multiplication -
Add support for polynomial-polynomial multiplication in the Newton basis (see Issue #143 (closed); resolved via MR !116 (merged)) -
Refactor the polynomial-polynomial multiplication in the Lagrange basis (see Issue #169 (closed); resolved via MR !146 (merged)) -
Add support for polynomial-polynomial multiplication in the canonical basis (see Issue #163 (closed); resolved via MR !140 (merged)) -
Refactor the implementation of polynomial-polynomial addition and subtraction in the Newton basis (see Issue #165 (closed); resolved via MR !142 (merged)) -
Add support for polynomial-polynomial multiplication in the Chebyshev basis (see Issue #167 (closed); resolved via MR !143 (merged)) -
Improve the performance of multi-index set multiplication (see Issue #145 (closed); resolved via MR !120 (merged))
-
-
Polynomial-polynomial addition/subtraction -
Add support for polynomial-polynomial addition and subtraction in the Newton basis (see Issue #140 (closed); resolved via MR !117 (merged)) -
Refactor the implementation of polynomial-polynomial addition and subtraction in the canonical basis (see Issue #161 (closed); resolved via MR !139 (merged)) -
Refactor the implementation of polynomial-polynomial addition and subtraction in the Lagrange basis (see Issue #170 (closed); resolved via MR !147 (merged)) -
Add support for polynomial-polynomial addition and subtraction in the Chebyshev basis (see Issue #164 (closed); resolved via MR !141 (merged)) -
Refactor the implementation of polynomial-polynomial addition and subtraction in the Newton basis (see Issue #166 (closed); resolved via MR !145 (merged))
-
-
Polynomial-scalar addition/subtraction (real scalar numbers) -
Add support for polynomial-scalar addition and subtraction in the Newton basis (see Issue #140 (closed); resolved via MR !117 (merged)) -
Add support for polynomial-scalar addition and subtraction in the Lagrange basis (see Issue #170 (closed); resolved via MR !147 (merged)) -
Add support for polynomial-scalar addition and subtraction in the canonical basis (resolved via MR !139 (merged))
-
-
Add support (if possible) for augmented polynomial-polynomial multiplicationof polynomials in the Newton basisof polynomials in the canonical basisof polynomials in the Lagrange basis- PS: I would argue that such explicit in-place operation is currently not necessary as keeping the promise of consistent mutation is difficult; these tasks are thus postponed indefinitely
-
Add support (if possible) for augmented polynomial-polynomial subtraction/additionof polynomials in the Newton basisof polynomials in the canonical basisof polynomials in the Lagrange basis- PS: I would argue that such explicit in-place operation is currently not necessary as keeping the promise of consistent mutation is difficult; these tasks are thus postponed indefinitely
-
Fix the issue with negating a polynomial in any basis (see Issue #141 (closed); resolved via MR !113 (merged)) -
Add support for exact equality check between two polynomials (see Issue #138 (closed); resolved via MR !111 (merged)) -
Introduce a Method to whether the Domain of two Polynomials Matches (see Issue #144 (closed); resolved via MR !115 (merged)) -
Add support for the power operator ( **
) operated on the polynomials and only for round positive numbers (see Issue #171 (closed); resolved via MR !148 (merged)) -
Handle the addition and subtraction of polynomials in the Newton basis with a common underlying grid (see Issue #172 (closed); resolved via MR !150 (merged)) -
Refactor scalar addition/subtraction for all instances of polynomials (see Issue #173 (closed); resolved via MR !149 (merged)) -
Refactor scalar multiplication for all instances of polynomials (see Issue #174 (closed); resolved via MR !151 (merged)) -
Implement division by real scalar numbers for all polynomial instances (see Issue #175 (closed); resolved via MR !152 (merged))
Notes
- Polynomial-polynomial multiplication in the canonical or Chebyshev basis differs from the multiplication in the Newton or Lagrange bases because the bases are independent of the underlying interpolating Grid. In the canonical basis, a basis of a given degree in a given multi-index set is the same as a basis of the same degree in another multi-index set.
- Make sure that the multiplication of a polynomial with a scalar is consistent with the constant polynomial in the same basis.
- Polynomial-scalar addition and subtraction is a syntactic shortcut for polynomial-polynomial addition/subtraction where one of the term is a constant polynomial. A single implementation should apply for concrete implementation of polynomial bases.
- A minor complication is that some polynomials may be defined on a non-downward-closed multi-index set, meaning that the multi-index element (0, \ldots, 0) may not always be present and thus the set must be expanded. For addition/subtraction in the Newton, there is no need to do DDS for such cases.
- Furthermore, scalar addition/subtraction in the Lagrange basis applies to all the coefficients not only the coefficient corresponding to the element (0, \ldots, 0).
- Subtracting a polynomial means adding the polynomial on the left with the negated polynomial on the right (
P1 + (-P2)
). There shouldn't be a separate implementation for this. Note that this operation is not the same but should give equivalent result with adding the polynomial on the left with polynomial on the right multiplied by -1 (P1 + (-1 * P2)
), because this operation first uses polynomial-scalar multiplication (__mul__()
) while the former uses polynomial-polynomial addition with negated polynomial (__neg__()
)
Edited by Damar Wicaksono