diff options
Diffstat (limited to 'numpy/polynomial')
-rw-r--r-- | numpy/polynomial/chebyshev.py | 19 | ||||
-rw-r--r-- | numpy/polynomial/legendre.py | 25 | ||||
-rw-r--r-- | numpy/polynomial/polynomial.py | 10 | ||||
-rw-r--r-- | numpy/polynomial/polytemplate.py | 52 |
4 files changed, 52 insertions, 54 deletions
diff --git a/numpy/polynomial/chebyshev.py b/numpy/polynomial/chebyshev.py index ea064a695..6b1edf497 100644 --- a/numpy/polynomial/chebyshev.py +++ b/numpy/polynomial/chebyshev.py @@ -23,6 +23,7 @@ Arithmetic - `chebsub` -- subtract one Chebyshev series from another. - `chebmul` -- multiply two Chebyshev series. - `chebdiv` -- divide one Chebyshev series by another. +- `chebpow` -- raise a Chebyshev series to an positive integer power - `chebval` -- evaluate a Chebyshev series at given points. Calculus @@ -39,7 +40,7 @@ Misc Functions - `chebpts1` -- Chebyshev points of the first kind. - `chebpts2` -- Chebyshev points of the second kind. - `chebtrim` -- trim leading coefficients from a Chebyshev series. -- `chebline` -- Chebyshev series of given straight line. +- `chebline` -- Chebyshev series representing given straight line. - `cheb2poly` -- convert a Chebyshev series to a polynomial. - `poly2cheb` -- convert a polynomial to a Chebyshev series. @@ -78,10 +79,10 @@ References from __future__ import division __all__ = ['chebzero', 'chebone', 'chebx', 'chebdomain', 'chebline', - 'chebadd', 'chebsub', 'chebmulx', 'chebmul', 'chebdiv', 'chebval', - 'chebder', 'chebint', 'cheb2poly', 'poly2cheb', 'chebfromroots', - 'chebvander', 'chebfit', 'chebtrim', 'chebroots', 'chebpts1', - 'chebpts2', 'Chebyshev'] + 'chebadd', 'chebsub', 'chebmulx', 'chebmul', 'chebdiv', 'chebpow', + 'chebval', 'chebder', 'chebint', 'cheb2poly', 'poly2cheb', + 'chebfromroots', 'chebvander', 'chebfit', 'chebtrim', 'chebroots', + 'chebpts1', 'chebpts2', 'Chebyshev'] import numpy as np import numpy.linalg as la @@ -1344,12 +1345,12 @@ def chebpts1(npts): Parameters ---------- - npts: int + npts : int Number of sample points desired. Returns ------- - pts: ndarray + pts : ndarray The Chebyshev points of the second kind. Notes @@ -1375,12 +1376,12 @@ def chebpts2(npts): Parameters ---------- - npts: int + npts : int Number of sample points desired. Returns ------- - pts: ndarray + pts : ndarray The Chebyshev points of the second kind. Notes diff --git a/numpy/polynomial/legendre.py b/numpy/polynomial/legendre.py index f09f3dc17..9aec256cd 100644 --- a/numpy/polynomial/legendre.py +++ b/numpy/polynomial/legendre.py @@ -21,6 +21,7 @@ Arithmetic - `legsub` -- subtract one Legendre series from another. - `legmul` -- multiply two Legendre series. - `legdiv` -- divide one Legendre series by another. +- `legpow` -- raise a Legendre series to an positive integer power - `legval` -- evaluate a Legendre series at given points. Calculus @@ -35,7 +36,7 @@ Misc Functions - `legvander` -- Vandermonde-like matrix for Legendre polynomials. - `legfit` -- least-squares fit returning a Legendre series. - `legtrim` -- trim leading coefficients from a Legendre series. -- `legline` -- Legendre series of given straight line. +- `legline` -- Legendre series representing given straight line. - `leg2poly` -- convert a Legendre series to a polynomial. - `poly2leg` -- convert a polynomial to a Legendre series. @@ -51,9 +52,10 @@ See also from __future__ import division __all__ = ['legzero', 'legone', 'legx', 'legdomain', 'legline', - 'legadd', 'legsub', 'legmulx', 'legmul', 'legdiv', 'legval', - 'legder', 'legint', 'leg2poly', 'poly2leg', 'legfromroots', - 'legvander', 'legfit', 'legtrim', 'legroots', 'Legendre'] + 'legadd', 'legsub', 'legmulx', 'legmul', 'legdiv', 'legpow', + 'legval', 'legder', 'legint', 'leg2poly', 'poly2leg', + 'legfromroots', 'legvander', 'legfit', 'legtrim', 'legroots', + 'Legendre'] import numpy as np import numpy.linalg as la @@ -65,8 +67,6 @@ legtrim = pu.trimcoef def poly2leg(pol) : """ - poly2leg(pol) - Convert a polynomial to a Legendre series. Convert an array representing the coefficients of a polynomial (relative @@ -463,7 +463,7 @@ def legmulx(cs): .. math:: - xP_i(x) = ((i + 1)*P_{i + 1}(x) + i*P_{i - 1}(x))/(2i + 1) + xP_i(x) = ((i + 1)*P_{i + 1}(x) + i*P_{i - 1}(x))/(2i + 1) """ # cs is a trimmed copy @@ -564,12 +564,12 @@ def legdiv(c1, c2): Parameters ---------- c1, c2 : array_like - 1-d arrays of Legendre series coefficients ordered from low to + 1-D arrays of Legendre series coefficients ordered from low to high. Returns ------- - [quo, rem] : ndarrays + quo, rem : ndarrays Of Legendre series coefficients representing the quotient and remainder. @@ -683,8 +683,8 @@ def legder(cs, m=1, scl=1) : Parameters ---------- - cs: array_like - 1-d array of Legendre series coefficients ordered from low to high. + cs : array_like + 1-D array of Legendre series coefficients ordered from low to high. m : int, optional Number of derivatives taken, must be non-negative. (Default: 1) scl : scalar, optional @@ -887,9 +887,6 @@ def legval(x, cs): -------- legfit - Examples - -------- - Notes ----- The evaluation uses Clenshaw recursion, aka synthetic division. diff --git a/numpy/polynomial/polynomial.py b/numpy/polynomial/polynomial.py index 6b5b7be98..3efe25920 100644 --- a/numpy/polynomial/polynomial.py +++ b/numpy/polynomial/polynomial.py @@ -20,6 +20,7 @@ Arithmetic - `polysub` -- subtract one polynomial from another. - `polymul` -- multiply two polynomials. - `polydiv` -- divide one polynomial by another. +- `polypow` -- raise a polynomial to an positive integer power - `polyval` -- evaluate a polynomial at given points. Calculus @@ -34,8 +35,7 @@ Misc Functions - `polyvander` -- Vandermonde-like matrix for powers. - `polyfit` -- least-squares fit returning a polynomial. - `polytrim` -- trim leading coefficients from a polynomial. -- `polyline` -- Given a straight line, return the equivalent polynomial - object. +- `polyline` -- polynomial representing given straight line. Classes ------- @@ -49,9 +49,9 @@ See also from __future__ import division __all__ = ['polyzero', 'polyone', 'polyx', 'polydomain', 'polyline', - 'polyadd', 'polysub', 'polymulx', 'polymul', 'polydiv', 'polyval', - 'polyder', 'polyint', 'polyfromroots', 'polyvander', 'polyfit', - 'polytrim', 'polyroots', 'Polynomial'] + 'polyadd', 'polysub', 'polymulx', 'polymul', 'polydiv', 'polypow', + 'polyval', 'polyder', 'polyint', 'polyfromroots', 'polyvander', + 'polyfit', 'polytrim', 'polyroots', 'Polynomial'] import numpy as np import numpy.linalg as la diff --git a/numpy/polynomial/polytemplate.py b/numpy/polynomial/polytemplate.py index 37f0018d0..2106ad84e 100644 --- a/numpy/polynomial/polytemplate.py +++ b/numpy/polynomial/polytemplate.py @@ -345,12 +345,12 @@ class $name(pu.PolyBase) : Parameters ---------- - domain : {None, array_like} - The domain of the new series type instance. If the value is is - ``None``, then the default domain of `kind` is used. - kind : {None, class} + domain : array_like, optional + The domain of the new series type instance. If the value is None, + then the default domain of `kind` is used. + kind : class, optional The polynomial series type class to which the current instance - should be converted. If kind is ``None``, then the class of the + should be converted. If kind is None, then the class of the current instance is used. Returns @@ -359,14 +359,14 @@ class $name(pu.PolyBase) : The returned class can be of different type than the current instance and/or have a different domain. - Examples - -------- - Notes ----- Conversion between domains and class types can result in numerically ill defined series. + Examples + -------- + """ if kind is None : kind = $name @@ -390,11 +390,11 @@ class $name(pu.PolyBase) : off, scl : floats or complex The mapping function is defined by ``off + scl*x``. - Notes: - ------ + Notes + ----- If the current domain is the interval ``[l_1, r_1]`` and the default interval is ``[l_2, r_2]``, then the linear mapping function ``L`` is - defined by the equations: + defined by the equations:: L(l_1) = l_2 L(r_1) = r_2 @@ -491,8 +491,8 @@ class $name(pu.PolyBase) : See Also -------- - `${nick}int` : similar function. - `${nick}der` : similar function for derivative. + ${nick}int : similar function. + ${nick}der : similar function for derivative. """ off, scl = self.mapparms() @@ -521,8 +521,8 @@ class $name(pu.PolyBase) : See Also -------- - `${nick}der` : similar function. - `${nick}int` : similar function for integration. + ${nick}der : similar function. + ${nick}int : similar function for integration. """ off, scl = self.mapparms() @@ -538,8 +538,8 @@ class $name(pu.PolyBase) : See Also -------- - `${nick}roots` : similar function - `${nick}fromroots` : function to go generate series from roots. + ${nick}roots : similar function + ${nick}fromroots : function to go generate series from roots. """ roots = ${nick}roots(self.coef) @@ -552,8 +552,8 @@ class $name(pu.PolyBase) : Here y is the value of the polynomial at the points x. This is intended as a plotting aid. - Paramters - --------- + Parameters + ---------- n : int, optional Number of point pairs to return. The default value is 100. @@ -577,9 +577,9 @@ class $name(pu.PolyBase) : """Least squares fit to data. Return a `$name` instance that is the least squares fit to the data - `y` sampled at `x`. Unlike ${nick}fit, the domain of the returned + `y` sampled at `x`. Unlike `${nick}fit`, the domain of the returned instance can be specified and this will often result in a superior - fit with less chance of ill conditioning. See ${nick}fit for full + fit with less chance of ill conditioning. See `${nick}fit` for full documentation of the implementation. Parameters @@ -591,7 +591,7 @@ class $name(pu.PolyBase) : points sharing the same x-coordinates can be fitted at once by passing in a 2D-array that contains one dataset per column. deg : int - Degree of the fitting polynomial + Degree of the fitting polynomial. domain : {None, [beg, end], []}, optional Domain to use for the returned $name instance. If ``None``, then a minimal domain that covers the points `x` is chosen. If @@ -671,14 +671,14 @@ class $name(pu.PolyBase) : If ``p`` is the returned $name object, then ``p(x) == x`` for all values of x. - Parameters: - ----------- + Parameters + ---------- domain : array_like The resulting array must be if the form ``[beg, end]``, where ``beg`` and ``end`` are the endpoints of the domain. - Returns: - -------- + Returns + ------- identity : $name object """ |