Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
21106: minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bhutz committed Jul 27, 2016
1 parent cf97fed commit 957589f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
3 changes: 0 additions & 3 deletions src/sage/rings/polynomial/all.py
Expand Up @@ -46,6 +46,3 @@

# Evaluation of cyclotomic polynomials
from sage.rings.polynomial.cyclotomic import cyclotomic_value

# Flattening morphisms
from sage.rings.polynomial.flatten import FlatteningMorphism
34 changes: 20 additions & 14 deletions src/sage/rings/polynomial/flatten.py
@@ -1,7 +1,7 @@
r"""
Class to flatten polynomial rings over polynomial ring
For example ``QQ['a','b'],['x','y']`` flattens to ``QQ['a','b','c','d']``.
For example ``QQ['a','b'],['x','y']`` flattens to ``QQ['a','b','x','y']``.
EXAMPLES::
Expand All @@ -15,7 +15,6 @@
Multivariate Polynomial Ring in x, y, s, t, X over Rational Field
Authors:
Vincent Delecroix, Ben Hutz (July 2016): initial implementation
Expand Down Expand Up @@ -79,7 +78,7 @@ def __init__(self, domain):
Polynomial Ring in a, b, c over Integer Ring
To: Multivariate Polynomial Ring in a, b, c, x, y, z over Integer
Ring
::
sage: R = ZZ['a']['b']['c']
Expand All @@ -88,6 +87,14 @@ def __init__(self, domain):
From: Univariate Polynomial Ring in c over Univariate Polynomial Ring
in b over Univariate Polynomial Ring in a over Integer Ring
To: Multivariate Polynomial Ring in a, b, c over Integer Ring
::
sage: R = ZZ['a']['a','b']
sage: FlatteningMorphism(R)
Traceback (most recent call last):
...
ValueError: clash in variable names
"""
if not is_PolynomialRing(domain) and not is_MPolynomialRing(domain):
raise ValueError("domain should be a polynomial ring")
Expand All @@ -108,27 +115,26 @@ def __init__(self, domain):
def _call_(self, p):
"""
Evaluate an flatenning morphism.
This is slow, but works.
EXAMPLES::
sage: R = QQ['a','b','c']['x','y','z']
sage: h = FlatteningMorphism(R)('2*a*x + b*z'); h
2*a*x + b*z
sage: h.parent()
Multivariate Polynomial Ring in a, b, c, x, y, z over Rational Field
"""
return self.codomain()(str(p))

def section(self):
"""
Inverse of this flattenning morphism.
EXAMPLES::
sage: R = QQ['a','b','c']['x','y','z']
sage: h = FlatteningMorphism(R)
sage: h.section()
Expand All @@ -152,7 +158,7 @@ def section(self):
class UnflatteningMorphism(Morphism):
r"""
Inverses for :class:`FlatteningMorphism`
EXAMPLES::
sage: R = QQ['x']['y']['s','t']['X']
Expand All @@ -165,11 +171,11 @@ class UnflatteningMorphism(Morphism):
def _call_(self, p):
"""
Evaluate an unflattening morphism.
This is slow, but works.
EXAMPLES::
sage: R = QQ['x']['y']['a,b,c']
sage: p = R.random_element()
sage: f = FlatteningMorphism(R)
Expand Down

0 comments on commit 957589f

Please sign in to comment.