Skip to content

Replace numpy.poly1d with numpy.polynomial.Polynomial #350

@DeBruinJohan

Description

@DeBruinJohan

Johan de Bruin has attempted to solve this in 2019. His code did not pass the test. It was found that it is possible to rewrite the tf function to work with Polynomial, however numerous other functions in the repo are dependant on the coefficients of numerator and denominator of the fransferfunction. These numerators and denominators are both of type Polynomial and therefore their coefficients are given in the reverse order of that what is expected from the user, namely in increasing order of powers instead of decreasing order, as poly1d gives it. The transfer function can be made to display in decreasing order and takes inputs in decreasing order, however is no obvious way to ensure that the call tf.numerator.coef() would return the values in decreasing order. A possible solution to this would be to replace all instances of tf.numerator.coef with tf.numerator.coef[::-1], however this will cause confusion to anyone who wants code further on it.

His code can be found on the "Polynomial" branch of https://github.com/DeBruinJohan/Skogestad-Python/tree/Polynomial

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions