MCPcopy Create free account
hub / github.com/numpy/numpy / Polynomial

Class Polynomial

numpy/polynomial/polynomial.py:1472–1542  ·  view source on GitHub ↗

A power series class. The Polynomial class provides the standard Python numerical methods '+', '-', '*', '//', '%', 'divmod', '**', and '()' as well as the attributes and methods listed in the `ABCPolyBase` documentation. Parameters ---------- coef : array_like Poly

Source from the content-addressed store, hash-verified

1470#
1471
1472class Polynomial(ABCPolyBase):
1473 """A power series class.
1474
1475 The Polynomial class provides the standard Python numerical methods
1476 '+', '-', '*', '//', '%', 'divmod', '**', and '()' as well as the
1477 attributes and methods listed in the `ABCPolyBase` documentation.
1478
1479 Parameters
1480 ----------
1481 coef : array_like
1482 Polynomial coefficients in order of increasing degree, i.e.,
1483 ``(1, 2, 3)`` give ``1 + 2*x + 3*x**2``.
1484 domain : (2,) array_like, optional
1485 Domain to use. The interval ``[domain[0], domain[1]]`` is mapped
1486 to the interval ``[window[0], window[1]]`` by shifting and scaling.
1487 The default value is [-1, 1].
1488 window : (2,) array_like, optional
1489 Window, see `domain` for its use. The default value is [-1, 1].
1490
1491 .. versionadded:: 1.6.0
1492 symbol : str, optional
1493 Symbol used to represent the independent variable in string
1494 representations of the polynomial expression, e.g. for printing.
1495 The symbol must be a valid Python identifier. Default value is 'x'.
1496
1497 .. versionadded:: 1.24
1498
1499 """
1500 # Virtual Functions
1501 _add = staticmethod(polyadd)
1502 _sub = staticmethod(polysub)
1503 _mul = staticmethod(polymul)
1504 _div = staticmethod(polydiv)
1505 _pow = staticmethod(polypow)
1506 _val = staticmethod(polyval)
1507 _int = staticmethod(polyint)
1508 _der = staticmethod(polyder)
1509 _fit = staticmethod(polyfit)
1510 _line = staticmethod(polyline)
1511 _roots = staticmethod(polyroots)
1512 _fromroots = staticmethod(polyfromroots)
1513
1514 # Virtual properties
1515 domain = np.array(polydomain)
1516 window = np.array(polydomain)
1517 basis_name = None
1518
1519 @classmethod
1520 def _str_term_unicode(cls, i, arg_str):
1521 if i == '1':
1522 return f"·{arg_str}"
1523 else:
1524 return f"·{arg_str}{i.translate(cls._superscript_mapping)}"
1525
1526 @staticmethod
1527 def _str_term_ascii(i, arg_str):
1528 if i == '1':
1529 return f" {arg_str}"

Callers 6

test_addFunction · 0.90
test_subFunction · 0.90
test_mulFunction · 0.90
test_floordivFunction · 0.90
test_modFunction · 0.90
test_divmodFunction · 0.90

Calls

no outgoing calls

Tested by 6

test_addFunction · 0.72
test_subFunction · 0.72
test_mulFunction · 0.72
test_floordivFunction · 0.72
test_modFunction · 0.72
test_divmodFunction · 0.72