Polynomials - interface

https://www.python-course.eu/polynomial_class_in_python.php

INTRODUCTION

Polynomials are implemented in many computer systems (Mathematica, Maple, Sage) and python modules (numpy, sympy). The interface of polynomials is not unique.

+-------------------------+-----------------------+
| Operation               | Method                |
+-------------------------+-----------------------+
| poly1 = Poly(c, n)      | __init__, constructor |
| poly2 = Poly(c)         | a constant polynomial |
| poly1 + poly2           | __add__               |
| poly1 - poly2           | __sub__               |
| poly1 * poly2           | __mul__               |
| +poly1                  | __pos__               |
| -poly1                  | __neg__               |
| poly1 == poly2          | __eq__                |
| poly1 != poly2          | __ne__                |
| poly1.degree()          | the degree of poly1   |
| poly1.is_zero()         | zero coefficients     |
| len(poly1)              | __len__, monomials    |
| poly1(x)                | __call__              |
| poly1.combine(poly2)    | composition           |
| poly1**n, pow(poly1, n) | __pow__               |
| del poly1               | remove the name poly1 |
+-------------------------+-----------------------+

P(x) = p_0 + p_1 * x + p_2 * x^2

will be created as

poly1 = Poly(p_0) + Poly(p_1, 1) + Poly(p_2, 2)