Remove trailing coefficients Remove trailing coefficients until a coefficient is reached whose absolute value greater than `tol` or the beginning of the series is reached. If all the coefficients would be removed the series is set to ``[0]``. A new series instance is
(self, tol=0)
| 733 | return self.truncate(deg + 1) |
| 734 | |
| 735 | def trim(self, tol=0): |
| 736 | """Remove trailing coefficients |
| 737 | |
| 738 | Remove trailing coefficients until a coefficient is reached whose |
| 739 | absolute value greater than `tol` or the beginning of the series is |
| 740 | reached. If all the coefficients would be removed the series is set |
| 741 | to ``[0]``. A new series instance is returned with the new |
| 742 | coefficients. The current instance remains unchanged. |
| 743 | |
| 744 | Parameters |
| 745 | ---------- |
| 746 | tol : non-negative number. |
| 747 | All trailing coefficients less than `tol` will be removed. |
| 748 | |
| 749 | Returns |
| 750 | ------- |
| 751 | new_series : series |
| 752 | New instance of series with trimmed coefficients. |
| 753 | |
| 754 | """ |
| 755 | coef = pu.trimcoef(self.coef, tol) |
| 756 | return self.__class__(coef, self.domain, self.window, self.symbol) |
| 757 | |
| 758 | def truncate(self, size): |
| 759 | """Truncate series to length `size`. |