Add support for polynomial exponentiation.
All polynomial instances may now be exponentiated by a real scalar non-negative whole number. Exponentiation by 0 returns a polynomial with zero coefficients and a constant term of 1. Exponentiation by 1 returns a copy of the polynomial. Exponentiation by other valid numbers multiplies the polynomial with itself multiple times according to the given number (i.e., power).
So for instance:
>>> poly**0 == poly * 0 + 1
True
>>> poly**1 == poly
True
>>> poly**3 == poly * poly * poly # Only for basis other than Lagrange
True
As the implementation relies on polynomial-polynomial multiplication, polynomials in the Lagrange basis may only be exponentiated by either 0 or 1.
Additionally:
- The high-level function
minterpy.services.is_constant()
has been renamed tois_scalar
to better indicate the purpose of the function: checking if a given polynomials is a scalar constant polynomial. - The verification function
is_scalar()
has been renamed tois_real_scalar()
that better indicates the purpose: checking if a given number is a real scalar number. - The tests have been updated to take into account the new feature.
This commit should resolve Issue #171 (closed) and part of extending the support for arithmetic operations involving polynomial (see Issue #142 (closed)).