#19538: Fix LaurentPolynomialRing coercion issues
-------------------------+-------------------------------------------------
Reporter: | Owner:
etn40ff | Status: needs_review
Type: | Milestone: sage-6.10
defect | Resolution:
Priority: major | Merged in:
Component: | Reviewers:
algebra | Work issues:
Keywords: | Commit:
Authors: | 76ac4339b195762106d406516400f8468de844ef
Salvatore Stella | Stopgaps:
Report Upstream: N/A |
Branch: |
u/etn40ff/19358 |
Dependencies: |
-------------------------+-------------------------------------------------
Comment (by vdelecroix):
Unless I did a mistake, the conversion rules are the same for
`PolynomialRing` and `LaurentPolynomialRing` (but the semantic of the
operation `in` is not as you noticed). The rules are as follows for a map
`R -> S`:
1. if the variables of `R` are included in the variables of `S` then the
map `R -> S` is given by names of variables
2. else if `R` has less or equal variables than `S` then the map `R ->
S` is given by the order of the variable
3. else if some variable of `R` are present in `S` then there is a
partial map considered
4. otherwise an error is raised
{{{
sage: R1 = PolynomialRing(ZZ, 'x,y')
sage: R2 = PolynomialRing(ZZ, 'x,t')
sage: R3 = PolynomialRing(ZZ, 't,x')
sage: R4 = PolynomialRing(ZZ, 'x,t,y')
sage: map(R4, R1.gens()) # rule 1
[x, y]
sage: map(R4, R3.gens()) # rule 1
[t, x]
sage: map(R2, R1.gens()) # rule 2
[x, t]
sage: map(R1, R2.gens()) # rule 2
[x, y]
sage: R1(R4('y')) # rule 3
y
sage: R1(R4('t')) # rule 4
Traceback (most recent call last):
...
TypeError: Could not find a mapping of the passed element to this ring.
}}}
These rules should not change. You can have a look at the implementation
of `_element_constructor_` for polynomial rings.
--
Ticket URL: <http://trac.sagemath.org/ticket/19538#comment:8>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.