Skip to content

Polynomial can't be evaluated on list of numbers only ndarray of numbers #17949

Closed
@jjmortensen

Description

@jjmortensen

Is it on purpose that this doesn't work:

>>> np.polynomial.Polynomial([1, 2])([3, 4])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jensj/.local/lib/python3.7/site-packages/numpy/polynomial/_polybase.py", line 482, in __call__
    arg = off + scl*arg
TypeError: can't multiply sequence by non-int of type 'numpy.float64'

but this does:

>>> np.polynomial.Polynomial([1, 2])(np.array([3, 4]))
array([7., 9.])

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