diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-07-02 18:30:06 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-07-02 18:30:06 -0600 |
commit | 0739b6b0379deecac18811af27966d4515c2ff7c (patch) | |
tree | fc55f71178cd687920fcd6e83a429e1f772451d1 /numpy/polynomial/tests/test_classes.py | |
parent | 966fb719b711c7760ff54c154f91daa7d98a225b (diff) | |
download | numpy-0739b6b0379deecac18811af27966d4515c2ff7c.tar.gz |
BUG: Fix failure to return monic polynomials from roots.
This bug affected the various polynomial class methods fromroots due to
the ability to specify both window and domain. In that circumstance the
roots are mapped from the domain to the window by the substitution
`x = off + scl*x`. The polynomial that was being generated was monic in
the window before substitution, but if scl was not one it was not monic
considered as a function of the variable x in the domain. The fix is to
divide the generated coefficients by `scl ** deg` so that the scaling of
the highest degree term after substitution is canceled.
It might be better to make the scaling optional in the future, but this
fix makes the result match the documentation.
Closes #3467.
Diffstat (limited to 'numpy/polynomial/tests/test_classes.py')
-rw-r--r-- | numpy/polynomial/tests/test_classes.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/polynomial/tests/test_classes.py b/numpy/polynomial/tests/test_classes.py index 56af16a98..f8910a473 100644 --- a/numpy/polynomial/tests/test_classes.py +++ b/numpy/polynomial/tests/test_classes.py @@ -145,7 +145,9 @@ def check_fromroots(Poly): assert_almost_equal(p1(r), 0) # check that polynomial is monic - p2 = Polynomial.cast(p1, domain=d, window=w) + pdom = Polynomial.domain + pwin = Polynomial.window + p2 = Polynomial.cast(p1, domain=pdom, window=pwin) assert_almost_equal(p2.coef[-1], 1) |