#8992: Coercion of univariate quotient polynomial rings
-------------------------+--------------------------------------------------
Reporter: SimonKing | Owner: robertwb
Type: defect | Status: new
Priority: major | Milestone: sage-4.4.2
Component: coercion | Keywords: coercion quotient ring
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
-------------------------+--------------------------------------------------
Comment(by SimonKing):
OK, I have a ticket. I worked on top of my patches for #8807 and #8800,
but ''if'' this new patch applies then it should be stand-alone (simply
try).
What does it provide?
1. Polynomial quotient rings had a call method instead of an
_element_constructor_. My patch provides one.
2. Previously, a coercion between polynomial quotient rings was not used,
even though it clearly should exist when the modulus of the codomain
divides the modulus of the domain. This is now solved, by adding a
_coerce_map_from_ method.
3. The old call method relied on the variable names of the underlying
polynomial ring, when processing a string. That's obviously wrong, because
the variable names of the ''quotient'' ring may be different.
4. String evaluation is possible even when one has a polynomial quotient
ring over a polynomial ring (example below). This is possible by using
{{{GenDictWithBasering}}}, which I had originally introduced for infinite
polynomial rings.
'''__Examples__'''
Conversion between two quotient rings (coercion exists only in one
direction):
{{{
sage: P.<x> = QQ[]
sage: Q1 = P.quo([(x^2+1)^2*(x^2-3)])
sage: Q2 = P.quo([(x^2+1)^2])
sage: Q2(Q1.gen())
xbar
sage: Q1(Q2.gen())
xbar
sage: Q1.has_coerce_map_from(Q2)
False
sage: Q2.has_coerce_map_from(Q1)
True
}}}
Here the underlying polynomial ring has a basering that by itself is a
polynomial ring:
{{{
sage: R.<y> = P[]
sage: Q3 = R.quo([(y^2+1)]); Q3
Univariate Quotient Polynomial Ring in ybar over Univariate Polynomial
Ring in x over Rational Field with modulus y^2 + 1
sage: Q3(Q1.gen()) # this uses the lift into the underlying polynomial
ring
x
}}}
String evaluation works (if you think about it, this is non-trivial, since
it involves generator names of both Q3 and R):
{{{
sage: Q3('x*ybar^2')
-x
}}}
Now, back to the example from the ticket description. If #8807 and #8800
are used as well, one obtains:
{{{
sage: P.<x> = QQ[]
sage: Q1 = P.quo([(x^2+1)^2*(x^2-3)])
sage: Q2 = P.quo([(x^2+1)^2*(x^5+3)])
sage: Q1.gen()^2*Q2.gen()^2 + 2*Q1.gen()^2 + 1
0
sage: (Q1.gen()^2*Q2.gen()^2 + 2*Q1.gen()^2 + 1).parent()
Univariate Quotient Polynomial Ring in xbar over Rational Field with
modulus x^4 + 2*x^2 + 1
}}}
I just realise that I forgot to provide a doc test for _coerce_map_from_.
I will post it in a few minutes, and then it's ready for review!
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8992#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.