The degree of the series. .. versionadded:: 1.5.0 Returns ------- degree : int Degree of the series, one less than the number of coefficients. Examples -------- Create a polynomial object for ``1 + 7*x + 4*x**2``: >>> p
(self)
| 673 | return self.__class__(self.coef, self.domain, self.window, self.symbol) |
| 674 | |
| 675 | def degree(self): |
| 676 | """The degree of the series. |
| 677 | |
| 678 | .. versionadded:: 1.5.0 |
| 679 | |
| 680 | Returns |
| 681 | ------- |
| 682 | degree : int |
| 683 | Degree of the series, one less than the number of coefficients. |
| 684 | |
| 685 | Examples |
| 686 | -------- |
| 687 | |
| 688 | Create a polynomial object for ``1 + 7*x + 4*x**2``: |
| 689 | |
| 690 | >>> poly = np.polynomial.Polynomial([1, 7, 4]) |
| 691 | >>> print(poly) |
| 692 | 1.0 + 7.0·x + 4.0·x² |
| 693 | >>> poly.degree() |
| 694 | 2 |
| 695 | |
| 696 | Note that this method does not check for non-zero coefficients. |
| 697 | You must trim the polynomial to remove any trailing zeroes: |
| 698 | |
| 699 | >>> poly = np.polynomial.Polynomial([1, 7, 0]) |
| 700 | >>> print(poly) |
| 701 | 1.0 + 7.0·x + 0.0·x² |
| 702 | >>> poly.degree() |
| 703 | 2 |
| 704 | >>> poly.trim().degree() |
| 705 | 1 |
| 706 | |
| 707 | """ |
| 708 | return len(self) - 1 |
| 709 | |
| 710 | def cutdeg(self, deg): |
| 711 | """Truncate series to the given degree. |
no outgoing calls