Skip to content

ENH: Change default values for "domain" and "window" parameters of Polynomial class #24568

Open
@KrisMinchev

Description

@KrisMinchev

Proposed new feature or change:

The current default values for both domain and window parameters are both np.array([-1, 1]). On the other hand, if we call __init__ with 3 parameters, then domain and window always get cast to double. This leads to the following behaviour:

>>> p1 = P(np.array([1,2,3]))
>>> p1
Polynomial([1., 2., 3.], domain=[-1,  1], window=[-1,  1], symbol='x')
>>> p2 = P(np.array([1,2,3]), np.array([-1, 1]), np.array([-1,1]))
>>> p2
Polynomial([1., 2., 3.], domain=[-1.,  1.], window=[-1.,  1.], symbol='x')
>>> p1.domain.dtype
dtype('int64')
>>> p2.domain.dtype
dtype('float64')

Changing the default values of the parameters domain and window to np.array([-1., 1.]) will increase consistency between constructors Polynomial(coef) and Polynomial(coef, domain, window).

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