Skip to content

Commit

Permalink
DOC: Polynomial domain clarification
Browse files Browse the repository at this point in the history
This commit adds a note about the `coef` array in Polynomial
being stored in the domain scaled according to the `window`
and `domain` parameters, and not, as a np.polyfit user
may expect, in the usual data coordinates.

This is a followup to issue numpy#9533.
  • Loading branch information
Dominik Stańczak committed Jan 29, 2020
1 parent 49102a5 commit f8041f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions numpy/polynomial/_polybase.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,10 @@ def fit(cls, x, y, deg, domain=None, rcond=None, full=False, w=None,
specified and this will often result in a superior fit with less
chance of ill conditioning.
Please note that ``Polynomial.coef`` are coefficients in the scaled
domain, and that to get coefficients from the data domain, you should
use ``Polynomial.convert().coef``.
Parameters
----------
x : array_like, shape (M,)
Expand Down
4 changes: 4 additions & 0 deletions numpy/polynomial/polynomial.py
Original file line number Diff line number Diff line change
Expand Up @@ -1443,6 +1443,10 @@ class Polynomial(ABCPolyBase):
'+', '-', '*', '//', '%', 'divmod', '**', and '()' as well as the
attributes and methods listed in the `ABCPolyBase` documentation.
Please note that ``Polynomial.coef`` are coefficients in the scaled
domain, and that to get coefficients from the data domain, you
should use ``Polynomial.convert().coef``.
Parameters
----------
coef : array_like
Expand Down

0 comments on commit f8041f1

Please sign in to comment.