summaryrefslogtreecommitdiff
path: root/numpy/polynomial/polynomial.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2011-12-10 08:35:29 -0700
committerCharles Harris <charlesr.harris@gmail.com>2012-01-09 10:45:12 -0700
commit0a17ccb5dad99e6dd33ab315223f1b0a6ffe98ae (patch)
tree2f716c0f09f3b517c1296cd92bff2dc561ce4a37 /numpy/polynomial/polynomial.py
parentb8179388d3868be2cc26b6ca12e937c7f83a9d5c (diff)
downloadnumpy-0a17ccb5dad99e6dd33ab315223f1b0a6ffe98ae.tar.gz
STY: Whitespace cleanup and double space between function definitions.
Diffstat (limited to 'numpy/polynomial/polynomial.py')
-rw-r--r--numpy/polynomial/polynomial.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/numpy/polynomial/polynomial.py b/numpy/polynomial/polynomial.py
index 181716ad4..a0716b9a5 100644
--- a/numpy/polynomial/polynomial.py
+++ b/numpy/polynomial/polynomial.py
@@ -82,6 +82,7 @@ polyx = np.array([0,1])
# Polynomial series functions
#
+
def polyline(off, scl) :
"""
Returns an array representing a linear polynomial.
@@ -115,6 +116,7 @@ def polyline(off, scl) :
else :
return np.array([off])
+
def polyfromroots(roots) :
"""
Generate a polynomial with the given roots.
@@ -394,6 +396,7 @@ def polydiv(c1, c2):
j -= 1
return c1[j+1:]/scl, pu.trimseq(c1[:j+1])
+
def polypow(cs, pow, maxpower=None) :
"""Raise a polynomial to a power.
@@ -444,6 +447,7 @@ def polypow(cs, pow, maxpower=None) :
prd = np.convolve(prd, cs)
return prd
+
def polyder(cs, m=1, scl=1):
"""
Differentiate a polynomial.
@@ -508,6 +512,7 @@ def polyder(cs, m=1, scl=1):
cs[i:] *= d[:n-i]
return cs[i+1:].copy()
+
def polyint(cs, m=1, k=[], lbnd=0, scl=1):
"""
Integrate a polynomial.
@@ -605,10 +610,11 @@ def polyint(cs, m=1, k=[], lbnd=0, scl=1):
tmp = np.empty(n + 1, dtype=cs.dtype)
tmp[0] = cs[0]*0
tmp[1:] = cs/np.arange(1, n + 1)
- tmp[0] += k[i] - polyval(lbnd, tmp)
+ tmp[0] += k[i] - polyval(lbnd, tmp)
cs = tmp
return cs
+
def polyval(x, cs):
"""
Evaluate a polynomial.
@@ -654,6 +660,7 @@ def polyval(x, cs):
c0 = cs[-i] + c0*x
return c0
+
def polyvander(x, deg) :
"""Vandermonde matrix of given degree.
@@ -692,6 +699,7 @@ def polyvander(x, deg) :
v[i] = v[i-1]*x
return np.rollaxis(v, 0, v.ndim)
+
def polyfit(x, y, deg, rcond=None, full=False, w=None):
"""
Least-squares fit of a polynomial to data.