next | previous | forward | backward | up | top | index | toc | home
Macaulay2 > substitution and maps between rings > basic construction, source and target of a ring map

basic construction, source and target of a ring map

constructing a ring map

Use the function map construct a map between two rings. The input, in order, is the target, the source, and the images of the variables of the source ring. The images can be given as a matrix or a list.
i1 : S = QQ[x,y,z]/ideal(x^3+y^3+z^3);
i2 : T = QQ[u,v,w]/ideal(u^3+v^3+w^3);
i3 : G = map(T,S,matrix{{u,v,w^2}})

                     2
o3 = map(T,S,{u, v, w })

o3 : RingMap T <--- S
i4 : G(x^3+y^3+z)

        6    2
o4 = - w  + w

o4 : T
If the third argument is not given there are two possibilities. If a variable in the source ring also appears in the target ring then that variable is mapped to itself and if a variable does not appear in the target ring then it is mapped to zero.
i5 : R = QQ[x,y,w];
i6 : F = map(S,R)

o6 = map(S,R,{x, y, 0})

o6 : RingMap S <--- R
i7 : F(x^3)

        3    3
o7 = - y  - z

o7 : S

source and target

Once a ring map is defined the functions source and target can be used to find out what the source and target of a map are. These functions are particularly useful when working with matrices (see the next example).
i8 : U = QQ[s,t,u, Degrees => {{1,2},{1,1},{1,3}}];
i9 : H = map(U,R,matrix{{s^2,t^3,u^4}})

               2   3   4
o9 = map(U,R,{s , t , u })

o9 : RingMap U <--- R
i10 : use R; H(x^2+y^2+w^2)

       8    6    4
o11 = u  + t  + s

o11 : U
i12 : source H

o12 = R

o12 : PolynomialRing
i13 : target H

o13 = U

o13 : PolynomialRing

obtaining the matrix defining a map

Use F.matrix to obtain the matrix defining the map F.
i14 : H.matrix

o14 = | s2 t3 u4 |

              1       3
o14 : Matrix U  <--- U
i15 : source H.matrix

       3
o15 = U

o15 : U-module, free, degrees {{2, 4}, {3, 3}, {4, 12}}
i16 : target H.matrix

       1
o16 = U

o16 : U-module, free
For more on matrices from maps see inputting a matrix.