summaryrefslogtreecommitdiff
path: root/numpy/polynomial/polynomial.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix docstring cross-referencingAlbert Villanova del Moral2020-09-041-7/+22
|
* MAINT: Remove nickname from polynomial classes. (gh-16589)Ross Barnowski2020-07-081-1/+0
| | | | | | | | | | | | | | | | * MAINT: Remove nickname from polynomial classes. The convenience classes derived from ABCPolyBase had a nickname attribute that was only used internally in the previous implementation of __str__. After the overhaul of __str__ in #15666, this attr is no longer used. * DOC: Add release note. Add release note to notify users of removal of the abstract property, and highlight users that may be affected by the change. * DOC: fixed rST in release note
* ENH: Improved __str__, __format__ for polynomialsRoss Barnowski2020-05-071-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | Changes the printing style of instances of the convenience classes in the polynomial package to a more "human-readable" format. __str__ has been modified and __format__ added to ABCPolyBase, modifying the string representation of polynomial instances, e.g. when printed. __repr__ and the _repr_latex method (which is used in the Jupyter environment are unchanged. Two print formats have been added: 'unicode' and 'ascii'. 'unicode' is the default mode on *nix systems, and uses unicode values for numeric subscripts and superscripts in the polynomial expression. The 'ascii' format is the default on Windows (due to font considerations) and uses Python-style syntax to represent powers, e.g. x**2. The default printing style can be controlled at the package-level with the set_default_printstyle function. The ABCPolyBase.__str__ has also been made to respect the linewidth printoption. Other parameters from the printoptions dictionary are not used. Co-Authored-By: Warren Weckesser <warren.weckesser@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
* DOC: Refactor `np.polynomial` docs using `automodule` (#15662)Ross Barnowski2020-03-121-32/+49
| | | * DOC: Refactor polynomial docs using automodule.
* Updated files in polynomial/ to use fstringsAnton Ritter-Gogerly2020-01-271-2/+2
|
* MAINT: Clean up, mostly unused imports.Warren Weckesser2020-01-231-1/+0
|
* MAINT: Remove unnecessary 'from __future__ import ...' statementsJon Dufresne2020-01-031-2/+0
| | | | | As numpy is Python 3 only, these import statements are now unnecessary and don't alter runtime behavior.
* MAINT: polynomial: Add an N-d vander implementation used under the hood of ↵Eric Wieser2019-09-141-2/+2
| | | | | | | | the vander2d and vander3d functions The generalization is not exposed in the public API yet, but it could be if the need arises. The shape / dtype conversion logic is left as is for now, even if it might be broken.
* MAINT: Replace integers in places where booleans are expectedMSeifert042019-07-011-5/+5
|
* DOC: fix doc formatting issues exposed by numpydoc 0.9.0rc1Ralf Gommers2019-04-141-2/+2
|
* ENH: rotate companion matrix for all polynomial basesTyler Moncur2019-04-081-2/+3
|
* ENH: use rotated companion matrix to reduce errorTyler Moncur2019-04-081-1/+1
|
* MAINT: Unify polynomial power functionsEric Wieser2019-03-161-18/+3
| | | | | | These power functions are all the same - the algorithm used does not care about the basis. `polypow` and `chebpow` have some optimizations in their versions, which this maintains
* DEP: polynomial: Be stricter about integral argumentsEric Wieser2019-03-161-15/+5
| | | | | | | | | | | | | | | | | | | This changes the behavior for: * The `deg` and `axis` arguments of `<type>der` * The `deg` and `axis` arguments of `<type>int` * The `deg` argument of `<type>gauss` * The `deg` argument of `<type>vander2d` * The `deg` argument of `<type>vander3d` The old behavior was: * Raise `ValueError` if the argument is a float, but not an integral one * Allow a float like `1.0` to mean `1`. This is inconsistent with most other integer-accepting APIs in numpy, which require these to be actual integers, and raise TypeError when they are not. The new behavior is: * Raise `TypeError` if the argument is a float, but not an integral one * Emit a `DeprecationWarning` if a float like `1.0` is passed, continuing to allow it its old meaning.
* MAINT: Unify polynomial fitting functionsEric Wieser2019-03-151-75/+1
| | | | | | | | | | These fitting functions are all the same - the algorithm used does not care about the basis. This was done using: * A regex find / replace on all but poly and cheb * A manual diff showing that cheb differed only by whitespace * A manual diff showing that poly differed in `deg.ndim == 1` vs `deg.ndim > 0`. Given that this function only allows `deg.ndim <= 1`, and `ndim >= 0`, these two comparison are equivalent.
* MAINT: Unify polynomial addition and subtraction functionsEric Wieser2019-03-141-19/+2
| | | | These functions are all the same - the algorithm used does not care about the basis.
* MAINT: Unify polynomial division functionsEric Wieser2019-03-121-0/+1
| | | | | | These division functions are all the same - the algorithm used does not care about the basis. Note that while chebdiv and polydiv could be implemented in terms of this function, their current implementations are more optimal and exploit the properties of a multiplication by a basis polynomial.
* MAINT: Adjust variable names for consistencyEric Wieser2019-03-121-7/+7
| | | | | This makes the variable names in polydiv and chebdiv match polyutils._div. It also brings the order of the special-casing in line to match.
* MAINT: Unify polynomial valnd functionsEric Wieser2019-03-121-24/+4
| | | | No point writing the same function 12 times, when you can write it once
* MAINT: Move duplicate implementations of ABCPolyBase._fromroots into polyutilsEric Wieser2019-03-111-15/+1
| | | | | | Every implementation is the same right now, other than calling different line / mul functions. Found by LGTM.
* MAINT: Merge duplicate implementations of `*vander2d` and `*vander3d` functionsEric Wieser2019-03-021-27/+2
| | | | | | | Every implementation is the same right now, other than calling a different `*vander` function. Merging these into a single private function taking a callback results in significant deduplication. Found by LGTM.
* TST, DOC: enable refguide_checkTyler Reddy2018-12-141-26/+27
| | | | | | | | * ported the refguide_check module from SciPy for usage in NumPy docstring execution/ verification; added the refguide_check run to Azure Mac OS CI * adjusted NumPy docstrings such that refguide_check passes
* MAINT, DOC: Replace 'an' by 'a' in some docstrings.Charles Harris2018-08-301-1/+1
| | | | | | [ci skip] Small fixes in the polynomial package.
* DOC: add examples and extend exisiting dos for polynomial subclassesJeffrey Yancey2018-08-261-6/+14
|
* ENH: Add support for ipython latex printing to polynomialEric Wieser2018-08-121-0/+12
| | | | | | | | | | | | | | | Choices made, and the alternatives rejected (for no particularly strong reason): 1. Show terms in ascending order, to match their internal representation * alternative: descending, to match convention 2. Shows 0 terms in gray * alternative: omit entirely * alternative: show normally to aid comparison 3. Write each term as `basis(ax + b) * alternative: write as `basis(u) ... where u = ax + b` * alternative: show the normalized polynomial In future it would perhaps make sense to expose these options to the end user
* More misc. typosluz.paz2018-01-041-1/+1
| | | Found via `codespell`
* MAINT: Add parameter checks to polynomial integration functions.Charles Harris2017-10-261-1/+6
| | | | | | | It was not being checked that the `lbnd` and `scl` parameters were scalars as required. Closes #9901.
* DOC: Fix inline "math" directives [skip ci]Michael Seifert2017-09-121-1/+1
|
* MAINT: Use moveaxis instead of rollaxis internally (#9475)Nico Schlömer2017-08-101-5/+5
| | | | | Also add a hint to the documentation advising the use of moveaxis over rollaxis. Tests for rollaxis are left alone.
* BUG: KeyboardInterrupt is swallowed all over the placeEric Wieser2017-06-031-2/+2
| | | | Bare except is very rarely the right thing
* MAINT: Use normalize_axis_index in all python axis checkingEric Wieser2017-02-201-8/+3
| | | | | | | As a result, some exceptions change from ValueError to IndexError This also changes the exception types raised in places where normalize_axis_index is not quite appropriate
* Fixing docstring error in polyvander2dTom Boyd2017-02-011-1/+1
|
* DEP: Fix escaped string characters deprecated in Python 3.6.Charles Harris2016-12-141-1/+1
| | | | | | | In Python 3.6 a number of escape sequences that were previously accepted -- for instance "\(" that was translated to "\\(" -- are deprecated. To retain the previous behavior either raw strings must be used or the backslash must be properly escaped itself.
* DOC: change version references from x.y to x.y.zPierre de Buyl2016-09-071-1/+1
|
* DOC: change Numpy to NumPy in dosctrings and commentsPierre de Buyl2016-09-061-1/+1
| | | | The strings in error messages were left untouched
* ENH: Add stacklevel to all (or almost all) our function callsSebastian Berg2016-09-021-1/+1
|
* MAINT: refactor and small fixes to polyvalfromroots.Charles Harris2016-06-121-9/+10
| | | | | | | | | Simplify the logic a bit and make behavior consistent with polyval. Note that this adds a check that the number of dimensions of the array of the evaluation points is less than the number of dimensions of the array of roots when tensor=False. That check is missing from polyval and needs to be added.
* ENH: Add `polyrootval` to numpy.polynomiale-q2016-06-121-2/+90
| | | | | | | | | | | As one can easily encounter when working with high-order signal processing filters, converting a high-order polynomial from its roots to its polynomial coefficients can be quite lossy, leading to inaccuracies in the filter's properties. This PR adds a new function, `polyrootval` - based on `polyval` - that evaluates a polynomial given a list of its roots. The benefit of calculating it this way can be seen at scipy/scipy:6059. Some tests are included, as well.
* MAINT: Refactor polynomial leastsquares fits.Charles Harris2016-01-191-23/+18
| | | | | | | * Rewrite the documentation for `deg`. * Check that the passed degrees are int and raise if not. * Do not accept `deg` arguments that do not convert as 0-D or 1-D. * Sort passed degree terms for repeatability.
* ENH: Allow specification of terms to fit in polyfitJonathan Underwood2016-01-181-5/+34
| | | | | | | | | | The argument `deg` is enhanced to allow an array_like argument to past which specifies which terms to include in the fit. The returned coef array is exapnded to have entries of 0 for all coefficients which were not included in the fit.
* Merge pull request #4924 from charris/pep8-numpy-polynomialCharles Harris2014-08-041-45/+45
|\ | | | | Pep8 numpy polynomial
| * STY: PEP8 fixes for files in numpy/polynomial.Charles Harris2014-07-291-45/+45
| | | | | | | | | | The rather lax standards used in scipy were used to identify the needed style fixups.
* | DOC Polynomial example import statement corrected. #3615Ilambharathi Kanniah2014-06-241-2/+2
| |
* | DOC Polynomial example import statement updated. #3615Ilambharathi Kanniah2014-06-241-11/+11
|/
* Merge pull request #4566 from juliantaylor/na-docCharles Harris2014-03-281-5/+0
|\ | | | | DOC: remove obsolete NA reference from polyfit docs
| * DOC: remove obsolete NA reference from polyfit docsJulian Taylor2014-03-281-5/+0
| |
* | DOC: Fixup documentation for new way of generating classes.Charles Harris2014-03-261-10/+35
| | | | | | | | | | | | | | | | | | | | Move the class documentation to the place of definition in the appropriate module. This allow for documenting the specific series kind along with the series specific default domains and windows Remove template placeholders from the ABCPolyBase class documention. General fixup of documentation that rendered poorly.
* | ENH, MAINT: Use an abstract base class for the polynomial classes.Charles Harris2014-03-261-3/+22
|/ | | | | | | | The new base is ABCPolyBase and is intended to replace the use of the polytemplate string. In this way the need to compile the polynomial classes on import is avoided. Closes #634. Closes #3639.
* typoJames Yu2014-03-011-1/+1
|
* STY: Giant comma spacing fixup.Charles Harris2013-08-181-8/+8
| | | | | | | Run the 2to3 ws_comma fixer on *.py files. Some lines are now too long and will need to be broken at some point. OTOH, some lines were already too long and need to be broken at some point. Now seems as good a time as any to do this with open PRs at a minimum.