I'm neither answering your question nor being helpful by reviewing
#813, but asking a question: I have a polynomial in QQ[u][x] and I
want to convert it into an element of QQ[u,x], simply because I want
to factor it. (I will want to move the factors back). I get the
impression from this ticket that there is no coercion to do that --
fine. But I cannot even define a Homomorphism:
sage: R.<x> = PolynomialRing(QQ)
sage: S.<u> = PolynomialRing(R)
sage: T.<X,U> = PolynomialRing(QQ,2)
sage: Hom(S,T)([U])
TypeError: images do not define a valid homomorphism
sage: Hom(S,T)([X,U])
TypeError: images do not define a valid homomorphism
How do I define the natural map sending x,u to X,U?
John
Thank you very much for your help! I had discovered that by reusing a
variable name the conversion was possible, so had got over this
particular block in my computation. But your extended example is very
helpful indeed, so I will keep it for a future occasion. How is it
that I had never heard of the convert_map_from() function?
To sum up your 2-step construction, to go from QQ[x][u] to QQ[X,U]
mapping x,u to X,U respectively we form the composite
QQ[x][u] --> QQ[X][U] --> QQ[X,U]
where the first map (which is called a "conversion map" but not a
homomorphism for some reason) is the obvious one, and the second map
(which is a genuine Homomorphism) works because the variable names are
the same.
I seem to remember that in Magma one could define a homomorphism
QQ[x][u] --> QQ[X,U] but it is also a little contrived; first map
QQ[x] to QQ[X,U] by mapping x to X, and then map QQ[x][u] to QQ[X,U]
using both the already-defined map for the coefficients in QQ[x] and
also specifying that u maps to U. Which is not at all easy until you
get used to it!
John
Nope. It just means that two parents having a coercion in both
directions between them are (or should be!) canonically
isomorphic. Yet we may not want to identify them, typically because
the representation of their respective elements are quite different.
Since efficient algorithm in computer algebra often rely on switching
between different representations, such switching should be easy,
which non identified parents + bidirectional coercion supports. It
turns out that, at the moment, the coercion model does not handle a
conversion graph with cycles as well as it should. But that's just a
bug with the current coercion model; cycles in the conversion graph
should be used whenever meaningful.
Cheers,
Nicolas
--
Nicolas M. Thi�ry "Isil" <nth...@users.sf.net>
http://Nicolas.Thiery.name/
John