A power series class. The Polynomial class provides the standard Python numerical methods '+', '-', '*', '//', '%', 'divmod', '**', and '()' as well as the attributes and methods listed below. Parameters ---------- coef : array_like Polynomial coefficients in order
| 1613 | # |
| 1614 | |
| 1615 | class Polynomial(ABCPolyBase): |
| 1616 | """A power series class. |
| 1617 | |
| 1618 | The Polynomial class provides the standard Python numerical methods |
| 1619 | '+', '-', '*', '//', '%', 'divmod', '**', and '()' as well as the |
| 1620 | attributes and methods listed below. |
| 1621 | |
| 1622 | Parameters |
| 1623 | ---------- |
| 1624 | coef : array_like |
| 1625 | Polynomial coefficients in order of increasing degree, i.e., |
| 1626 | ``(1, 2, 3)`` give ``1 + 2*x + 3*x**2``. |
| 1627 | domain : (2,) array_like, optional |
| 1628 | Domain to use. The interval ``[domain[0], domain[1]]`` is mapped |
| 1629 | to the interval ``[window[0], window[1]]`` by shifting and scaling. |
| 1630 | The default value is [-1., 1.]. |
| 1631 | window : (2,) array_like, optional |
| 1632 | Window, see `domain` for its use. The default value is [-1., 1.]. |
| 1633 | symbol : str, optional |
| 1634 | Symbol used to represent the independent variable in string |
| 1635 | representations of the polynomial expression, e.g. for printing. |
| 1636 | The symbol must be a valid Python identifier. Default value is 'x'. |
| 1637 | |
| 1638 | .. versionadded:: 1.24 |
| 1639 | |
| 1640 | """ |
| 1641 | # Virtual Functions |
| 1642 | _add = staticmethod(polyadd) |
| 1643 | _sub = staticmethod(polysub) |
| 1644 | _mul = staticmethod(polymul) |
| 1645 | _div = staticmethod(polydiv) |
| 1646 | _pow = staticmethod(polypow) |
| 1647 | _val = staticmethod(polyval) |
| 1648 | _int = staticmethod(polyint) |
| 1649 | _der = staticmethod(polyder) |
| 1650 | _fit = staticmethod(polyfit) |
| 1651 | _line = staticmethod(polyline) |
| 1652 | _roots = staticmethod(polyroots) |
| 1653 | _fromroots = staticmethod(polyfromroots) |
| 1654 | |
| 1655 | # Virtual properties |
| 1656 | domain = np.array(polydomain) |
| 1657 | window = np.array(polydomain) |
| 1658 | basis_name = None |
| 1659 | |
| 1660 | @classmethod |
| 1661 | def _str_term_unicode(cls, i, arg_str): |
| 1662 | if i == '1': |
| 1663 | return f"·{arg_str}" |
| 1664 | else: |
| 1665 | return f"·{arg_str}{i.translate(cls._superscript_mapping)}" |
| 1666 | |
| 1667 | @staticmethod |
| 1668 | def _str_term_ascii(i, arg_str): |
| 1669 | if i == '1': |
| 1670 | return f" {arg_str}" |
| 1671 | else: |
| 1672 | return f" {arg_str}**{i}" |
no outgoing calls
searching dependent graphs…