Skip to content

Clean up polynomial constructor #23338

@jdemeyer

Description

@jdemeyer

This ticket cleans up the PolynomialRing() function in many ways. Mainly:

  1. Use normalize_names() as much as possible to deal with variable names.

  2. Fix indentation in docstring.

  3. Pass arguments like sparse and implementation as **kwds to the single-variate or multi-variate polynomial constructor.

  4. Make the code easier to understand.

  5. Allow PolynomialRing(..., implementation="singular") which forces Singular. This allows simplifying some code in src/sage/algebras/free_algebra.py which currently needs to jump through hoops to get a MPolynomialRing_libsingular.

  6. Check more error conditions, for example currently we have

sage: PolynomialRing(QQ, name="x", names="y")
Univariate Polynomial Ring in y over Rational Field
  1. Change some arguments of PolynomialRing() to keyword-only arguments. This does break some existing uses of PolynomialRing(), although much more likely in library code and not user code (some code in Sage gets this even wrong and was passing sparse="lex" instead of order="lex")

Apart from items 6 and 7, no existing functionality is changed.

CC: @tscrim

Component: algebra

Author: Jeroen Demeyer

Branch/Commit: fc75734

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/23338

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions