diff options
Diffstat (limited to 'numpy/polynomial/chebyshev.py')
-rw-r--r-- | numpy/polynomial/chebyshev.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/numpy/polynomial/chebyshev.py b/numpy/polynomial/chebyshev.py index 99edecca1..533b4c293 100644 --- a/numpy/polynomial/chebyshev.py +++ b/numpy/polynomial/chebyshev.py @@ -852,8 +852,6 @@ def chebder(cs, m=1, scl=1) : raise ValueError, "The order of derivation must be integer" if cnt < 0 : raise ValueError, "The order of derivation must be non-negative" - if not np.isscalar(scl) : - raise ValueError, "The scl parameter must be a scalar" # cs is a trimmed copy [cs] = pu.as_series([cs]) @@ -955,23 +953,24 @@ def chebint(cs, m=1, k=[], lbnd=0, scl=1): raise ValueError, "The order of integration must be non-negative" if len(k) > cnt : raise ValueError, "Too many integration constants" - if not np.isscalar(lbnd) : - raise ValueError, "The lbnd parameter must be a scalar" - if not np.isscalar(scl) : - raise ValueError, "The scl parameter must be a scalar" # cs is a trimmed copy [cs] = pu.as_series([cs]) if cnt == 0: return cs - else: - k = list(k) + [0]*(cnt - len(k)) - for i in range(cnt) : - zs = _cseries_to_zseries(cs)*scl + + k = list(k) + [0]*(cnt - len(k)) + for i in range(cnt) : + n = len(cs) + cs *= scl + if n == 1 and cs[0] == 0: + cs[0] += k[i] + else: + zs = _cseries_to_zseries(cs) zs = _zseries_int(zs) cs = _zseries_to_cseries(zs) cs[0] += k[i] - chebval(lbnd, cs) - return cs + return cs def chebval(x, cs): """Evaluate a Chebyshev series. |