Skip to content

polydiv example incorrect #18020

Open
Open

Description

@ehchen

The example given here with the following polynomial:

3x^2 + 5x + 2 / (2x + 1)

Should have the following code to be consistent with numpy >1.4, as documented here:

x = np.array([2.0, 5.0, 3.0])
y = np.array([1.0, 2.0])
np.polydiv(x, y)
(array([1.75 , 1.5]), array([0.25]))

Activity

  1. rossbar commented on Dec 18, 2020

    @rossbar
    Contributor

    The first link above points to the documentation for the older polynomial module, whereas the second link points to the new polynomial package. The API between these two is not consistent - the polynomial package expects coefficient arrays in ascending order whereas the module has them in the opposite order. np.polydiv is a function from the polynomial module so is consistent with the older API.

    This is indeed quite confusing, so suggestions on how to improve the situation are very welcome!

  2. rossbar commented on Dec 18, 2020

    @rossbar
    Contributor

    FWIW there is an attempt at summarizing the situation in the reference guide.

  3. ayush1300 commented on Dec 21, 2020

    @ayush1300

    Well what I was thinking was we can simply take polynomial as input in polydiv, as in np.polynomial and then just simlply reverse the 1d array and then the rest of the polydiv function can be performed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions