diff options
-rw-r--r-- | doc/source/reference/routines.polynomials.classes.rst | 21 | ||||
-rw-r--r-- | doc/source/reference/routines.polynomials.package.rst | 8 |
2 files changed, 26 insertions, 3 deletions
diff --git a/doc/source/reference/routines.polynomials.classes.rst b/doc/source/reference/routines.polynomials.classes.rst index 71e635866..10331e9c1 100644 --- a/doc/source/reference/routines.polynomials.classes.rst +++ b/doc/source/reference/routines.polynomials.classes.rst @@ -65,11 +65,26 @@ window:: >>> p.window array([-1., 1.]) -Printing a polynomial yields a shorter form without the domain -and window:: +Printing a polynomial yields the polynomial expression in a more familiar +format:: >>> print(p) - poly([1. 2. 3.]) + 1.0 + 2.0·x¹ + 3.0·x² + +Note that the string representation of polynomials uses Unicode characters +by default (except on Windows) to express powers and subscripts. An ASCII-based +representation is also available (default on Windows). The polynomial string +format can be toggled at the package-level with the +`~numpy.polynomial.set_default_printstyle` function:: + + >>> numpy.polynomial.set_default_printstyle('ascii') + >>> print(p) + 1.0 + 2.0 x**1 + 3.0 x**2 + +or controlled for individual polynomial instances with string formatting:: + + >>> print(f"{p:unicode}") + 1.0 + 2.0·x¹ + 3.0·x² We will deal with the domain and window when we get to fitting, for the moment we ignore them and run through the basic algebraic and arithmetic operations. diff --git a/doc/source/reference/routines.polynomials.package.rst b/doc/source/reference/routines.polynomials.package.rst index ca1217f80..1bc528c59 100644 --- a/doc/source/reference/routines.polynomials.package.rst +++ b/doc/source/reference/routines.polynomials.package.rst @@ -4,3 +4,11 @@ :no-members: :no-inherited-members: :no-special-members: + +Configuration +------------- + +.. autosummary:: + :toctree: generated/ + + numpy.polynomial.set_default_printstyle |