up previous next
1.1.10 Tutorial: homomorphisms
CoCoA-5 lets you create ring homomorphisms; these are useful for various purposes such as "moving" a value from one ring to another.

A homomorphism from a polynomial ring must state what the images of the indeterminates are. If the codomain is also a polynomial ring with the same ring of coefficients then use PolyAlgebraHom , otherwise use PolyRingHom giving also the homomorphism saying how the coefficient ring is mapped.

Some "special" homomorphisms can be created easily via dedicated functions. If there is a canonical homomorphism between the rings then this may be specified using CanonicalHom . For the homomorphism which embed the coefficent ring into a polynomial ring use CoeffEmbeddingHom .

/**/ P1 ::= QQ[x,y];   // polys in x,y with coefficients in QQ
/**/ P2 ::= QQ[a,b];   // polys in a,b with coefficients in QQ
/**/ use P2; IndetImages := [a^2, b^3];
/**/ phi := PolyAlgebraHom(P1, P2, IndetImages);
/**/ use P1;
/**/ f := 2*x^2 + 3*y + 4;
/**/ phi(f);
2*a^4 + 3*b^3 + 4