| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Include additional example about 0-coefficients and the trim method.
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
|
|
|
| |
(#23382)
|
|
|
|
|
|
|
|
| |
On line 502, self.symbol.copy() was called, which
causes an AttributeError, since self.symbol is a
string, so it doesn't have a copy() method. To fix
it, I simply removed the copy() and directly assigned
the string.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* limit the number of decimals in Polynomial representation
* tests pass
* parenthesize exponential notation in polynomials
* fixed a long line warning
* added polynomial printoptions tests
* polynomial printoptions typo fixed
* made switch to exp notation in polynomial display more natural
* added a test on switching polynomials to exp notation
* fixed linter errors/warnings
* support for nanstr and infstr printoptions in polynomials
* 10^8 threshold for switching to exp notation when displaying polynomials
* merged in PR #21696 fixing issue #21695
* made linter happy
* made some docstring tests pass
* fixed the docs
Co-authored-by: Lev Maximov <lev.maximov@gmail.com>
|
|
|
|
|
|
|
| |
Adds a symbol attribute to the polynomials from the np.polynomial package to allow the user to control/modify the symbol used to represent the independent variable for a polynomial expression. This attribute corresponds to the variable attribute of the poly1d class from the old np.lib.polynomial module.
Marked as draft for now as it depends on #15666 - all _str* and _repr* methods of ABCPolyBase and derived classes would need to be modified (and tested) to support this change.
Co-authored-by: Warren Weckesser <warren.weckesser@gmail.com>
|
|\
| |
| | |
DOC: fix docstring formatting of polynomial fit method return values.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes #19897
The 2nd return value of the following methods/functions were badly
formatted and the list was all appearing in a single line. Changed them
to separate points which are rendered nicely.
- numpy.polyfit
- numpy.ma.polyfit
- numpy.polynomial.polynomial.polyfit
- numpy.polynomial.polynomial.Polynomial.fit
- numpy.polynomial.chebyshev.chebfit
- numpy.polynomial.chebyshev.Chebyshev.fit
- numpy.polynomial.hermite.hermfit
- numpy.polynomial.hermite.Hermite.fit
- numpy.polynomial.hermite_e.hermefit
- numpy.polynomial.hermite_e.HermiteE.fit
- numpy.polynomial.laguerre.lagfit
- numpy.polynomial.laguerre.Laguerre.fit
- numpy.polynomial.legendre.legfit
- numpy.polynomial.legendre.Legendre.fit
Also fixed erroneous links to `numpy.full` which were actually referring
to the `full` argument. Changed those to code strings (double backticks)
from single backticks.
Also fixed formatting issues in the 3rd return value of numpy.polyfit
(and hence also numpy.ma.polyfit).
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* DOC: Adjust polyfit doc to clarify the meaning of w
cov='unscaled', in particular, had inconsistently referred to a weight
of 1/sigma**2, while the doc for w says it should be equal to 1/sigma.
This change clarifies w to comport with more typical meanings of
weights in weighted least squares, and makes clear that cov='unscaled'
is appropriate when the weight w**2 = 1/sigma**2.
See Issue #5261 for more discussion of the errors/confusion in
the previous doc string.
* Update doc text for w in all polynomial module fit functions
Co-authored-by: Stefan van der Walt <sjvdwalt@gmail.com>
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
|
|
|
|
| |
Numpydoc format says that the colon need o be omitted if there is no
type, there were also some empty Examples Sections
|
|
|
|
|
|
|
|
|
|
|
|
| |
... or when the input isn't/cannot be a set. I left a few usages, e.g.
in random sampling, where "set" is reasonable as informal description of
an array as the order doesn't matter; however, for e.g. np.gradient the
order of the returned list is clearly important, so "set" is wrong.
Also some other minor doc edits noticed during the grepping: using
`shape` instead of `form` in `cov` is consistent with most other places;
the wording in `Polynomial.trim` now matches other methods on the same
class.
|
|
|
|
|
| |
Single backticks default role is reference, while here it seem to be for
verbatim. Fix it in a couple of places.
|
|
|
| |
* Removed "from" keyword and changed "raise e" to "raise"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
| |
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
|
|
| |
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
| |
|
| |
|
|
|
|
|
|
| |
Add a fallback for TypeErrors that are raised when attempting
to compare arbitrary elements (e.g. strings or Python complex)
to 0 in _generate_str.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|\
| |
| | |
MAINT: Updated polynomial to use fstrings
|
| | |
|
|/ |
|
|
|
|
|
| |
As numpy is Python 3 only, these import statements are now unnecessary
and don't alter runtime behavior.
|
|
|
|
|
|
|
|
|
|
|
| |
This previously:
* Did not indicate the arguments in the abstract methods
* Did not actually use the `abc` mechanism at all on python 3 (`__metaclass__` does not work any more)
* Used the now-deprecated `@abstractproperty`
This didn't cause any runtime problems, but does confuse LGTM, and was using the `abc` module incorrectly.
This uses python3-only features of the abc module, so can't be backported.
|
|
|
|
|
|
| |
This variable is never used, and shows signs of being leftover from a previous implementation.
Introduced in gh-11528. Closes gh-11842
|
|\
| |
| | |
DOC: add comment to remove fn after python 2 support is dropped
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add augmented assignment for supported operations
Add augmented assignments for `+=`, `-=`, `*=`, `/=`, `%=`, and `**=`.
* correct idiv and imod
* remove augomented operationa. add notes.
Explicitly state the intention that all instances of a polynomial baseclass are immutable.
* fix typo, remove Note from _polybase
|
|
|
|
|
| |
* Remove misleading reference to numpy/polynomial/polynomial/polyfit.
* Add missing period in numpy/polynomial/_polybase.py
|
|
|
|
|
|
|
|
|
|
| |
* DOC: reccomend polynomail.Polynomial over np.polyfit
* update from review
* update from review, fix links
* fix from review
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Also, update the docs with this new repr
|
| |
|
|
|
|
| |
Bare except is very rarely the right thing
|
|
|
|
|
|
|
|
| |
Add `__array_ufunc__ = None` to ABCPolyBase. This ensures that polynomial
convenience classes will not participate in ufuncs and will have priority
when combined with an ndarray in a Python binary operator.
`__array_priority__` is removed, as it is no longer needed.
|
| |
|
|
|
|
| |
The strings in error messages were left untouched
|
| |
|
|
|
|
|
|
|
| |
* 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.
|
| |
|
| |
|
|
|
|
|
| |
The rather lax standards used in scipy were used to identify the
needed style fixups.
|
|
|
|
|
|
|
| |
Makes the identity check `a = np.array([np.nan], dtype=object)`
`a == a`, etc. a deprecation/futurewarning instead of just
changing it.
Also fixes some smaller things.
|
|
|
|
|
|
|
|
|
|
| |
1) Clean up the code and move repeated snippet to a method.
2) Remove use of has_sametype, has_samewindow, has_samedomain. I would
like to deprecate those methods.
3) Fix error in __truediv__, and make it only allow non-boolean numbers
for the denominator.
Closes #4631.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
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.
|