Skip to content

ENH: Replace x**1 with x in polynomials str representation #21695

@axil

Description

@axil

Proposed new feature or change:

Currently the first degree of the indeterminate variable in polynomials is displayed as x**1:

>>> import numpy.polynomial as poly
>>> str(poly.Polynomial([1,2,3]))
'1.0 + 2.0·x¹ + 3.0·x²'

Usually the first degree is not written. It is suggested to omit the degree for the term with the power of one:

>>> import numpy.polynomial as poly
>>> str(poly.Polynomial([1,2,3]))
'1.0 + 2.0·x + 3.0·x²'

In Latex representation it is displayed correctly, so there is nothing to be done:

image

Numpy version: master branch

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