diff options
Diffstat (limited to 'numpy/polynomial/chebyshev.py')
-rw-r--r-- | numpy/polynomial/chebyshev.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/numpy/polynomial/chebyshev.py b/numpy/polynomial/chebyshev.py index 23f8a728f..ea064a695 100644 --- a/numpy/polynomial/chebyshev.py +++ b/numpy/polynomial/chebyshev.py @@ -408,9 +408,10 @@ def cheb2poly(cs) : else: c0 = cs[-2] c1 = cs[-1] - for i in range(n - 3, -1, -1) : + # i is the current degree of c1 + for i in range(n - 1, 1, -1) : tmp = c0 - c0 = polysub(cs[i], c1) + c0 = polysub(cs[i - 2], c1) c1 = polyadd(tmp, polymulx(c1)*2) return polyadd(c0, polymulx(c1)) |