8000 Merge pull request #984 from more-itertools/polynomial-endianness · rhettinger/more-itertools@ee1b2fe · GitHub
[go: up one dir, main page]

Skip to content

Commit ee1b2fe

Browse files
authored
Merge pull request more-itertools#984 from more-itertools/polynomial-endianness
Add a note about polynomial endianness
2 parents 2d1b859 + 85ebeb2 commit ee1b2fe

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

more_itertools/recipes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,8 @@ def convolve(signal, kernel):
760760
>>> list(convolve([1, -1, -20], [1, -3]))
761761
[1, -4, -17, 60]
762762
763+
Note that polynomial coefficients are specified in descending power order.
764+
763765
Examples of popular kinds of kernels:
764766
765767
* The kernel ``[0.25, 0.25, 0.25, 0.25]`` computes a moving average.
@@ -905,6 +907,8 @@ def polynomial_from_roots(roots):
905907
>>> polynomial_from_roots(roots) # x³ - 4 x² - 17 x + 60
906908
[1, -4, -17, 60]
907909
910+
Note that polynomial coefficients are specified in descending power order.
911+
908912
Supports all numeric types: int, float, complex, Decimal, Fraction.
909913
"""
910914
# This recipe differs from the one in itertools docs in that it
@@ -1112,6 +1116,8 @@ def polynomial_eval(coefficients, x):
11121116
>>> polynomial_eval(coefficients, x)
11131117
8.125
11141118
1119+
Note that polynomial coefficients are specified in descending power order.
1120+
11151121
Supports all numeric types: int, float, complex, Decimal, Fraction.
11161122
"""
11171123
n = len(coefficients)
@@ -1142,6 +1148,8 @@ def polynomial_derivative(coefficients):
11421148
>>> derivative_coefficients
11431149
[3, -8, -17]
11441150
1151+
Note that polynomial coefficients are specified in descending power order.
1152+
11451153
Supports all numeric types: int, float, complex, Decimal, Fraction.
11461154
"""
11471155
n = len(coefficients)

0 commit comments

Comments
 (0)
0